Skip to content

Commit

Permalink
Remove some dead code from BlobLogWriter (facebook#7125)
Browse files Browse the repository at this point in the history
Summary:
Periodic syncing of blob files is performed by `WritableFileWriter`;
`bytes_per_sync_` and `next_sync_offset_` in `BlobLogWriter` are
actually unused (or more precisely, only used by methods that are
themselves unused). The patch removes all this dead code.

Pull Request resolved: facebook#7125

Test Plan: `make check`

Reviewed By: riversand963

Differential Revision: D22531021

Pulled By: ltamasi

fbshipit-source-id: 6b293ad5a79d3e6bf15c5c68f7aedd7ce7a15f10
  • Loading branch information
ltamasi authored and facebook-github-bot committed Jul 14, 2020
1 parent fc4d5f5 commit bdf4de6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
5 changes: 1 addition & 4 deletions db/blob/blob_log_writer.cc
Expand Up @@ -20,15 +20,12 @@ namespace ROCKSDB_NAMESPACE {

BlobLogWriter::BlobLogWriter(std::unique_ptr<WritableFileWriter>&& dest,
Env* env, Statistics* statistics,
uint64_t log_number, uint64_t bpsync, bool use_fs,
uint64_t boffset)
uint64_t log_number, bool use_fs, uint64_t boffset)
: dest_(std::move(dest)),
env_(env),
statistics_(statistics),
log_number_(log_number),
block_offset_(boffset),
bytes_per_sync_(bpsync),
next_sync_offset_(0),
use_fsync_(use_fs),
last_elem_type_(kEtNone) {}

Expand Down
10 changes: 2 additions & 8 deletions db/blob/blob_log_writer.h
Expand Up @@ -35,8 +35,8 @@ class BlobLogWriter {
// "*dest" must be initially empty.
// "*dest" must remain live while this BlobLogWriter is in use.
BlobLogWriter(std::unique_ptr<WritableFileWriter>&& dest, Env* env,
Statistics* statistics, uint64_t log_number, uint64_t bpsync,
bool use_fsync, uint64_t boffset = 0);
Statistics* statistics, uint64_t log_number, bool use_fsync,
uint64_t boffset = 0);
// No copying allowed
BlobLogWriter(const BlobLogWriter&) = delete;
BlobLogWriter& operator=(const BlobLogWriter&) = delete;
Expand Down Expand Up @@ -66,20 +66,14 @@ class BlobLogWriter {

uint64_t get_log_number() const { return log_number_; }

bool ShouldSync() const { return block_offset_ > next_sync_offset_; }

Status Sync();

void ResetSyncPointer() { next_sync_offset_ += bytes_per_sync_; }

private:
std::unique_ptr<WritableFileWriter> dest_;
Env* env_;
Statistics* statistics_;
uint64_t log_number_;
uint64_t block_offset_; // Current offset in block
uint64_t bytes_per_sync_;
uint64_t next_sync_offset_;
bool use_fsync_;

public:
Expand Down
2 changes: 1 addition & 1 deletion utilities/blob_db/blob_db_impl.cc
Expand Up @@ -756,7 +756,7 @@ Status BlobDBImpl::CreateWriterLocked(const std::shared_ptr<BlobFile>& bfile) {

bfile->log_writer_ = std::make_shared<BlobLogWriter>(
std::move(fwriter), env_, statistics_, bfile->file_number_,
bdb_options_.bytes_per_sync, db_options_.use_fsync, boffset);
db_options_.use_fsync, boffset);
bfile->log_writer_->last_elem_type_ = et;

return s;
Expand Down

0 comments on commit bdf4de6

Please sign in to comment.