Remove some dead code from BlobLogWriter (#7125)

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: https://github.com/facebook/rocksdb/pull/7125

Test Plan: `make check`

Reviewed By: riversand963

Differential Revision: D22531021

Pulled By: ltamasi

fbshipit-source-id: 6b293ad5a79d3e6bf15c5c68f7aedd7ce7a15f10
This commit is contained in:
Levi Tamasi 2020-07-14 13:50:26 -07:00 committed by Facebook GitHub Bot
parent fc4d5f5065
commit bdf4de6cb9
3 changed files with 4 additions and 13 deletions

View File

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

View File

@ -35,8 +35,8 @@ class BlobLogWriter {
// "*dest" must be initially empty. // "*dest" must be initially empty.
// "*dest" must remain live while this BlobLogWriter is in use. // "*dest" must remain live while this BlobLogWriter is in use.
BlobLogWriter(std::unique_ptr<WritableFileWriter>&& dest, Env* env, BlobLogWriter(std::unique_ptr<WritableFileWriter>&& dest, Env* env,
Statistics* statistics, uint64_t log_number, uint64_t bpsync, Statistics* statistics, uint64_t log_number, bool use_fsync,
bool use_fsync, uint64_t boffset = 0); uint64_t boffset = 0);
// No copying allowed // No copying allowed
BlobLogWriter(const BlobLogWriter&) = delete; BlobLogWriter(const BlobLogWriter&) = delete;
BlobLogWriter& operator=(const BlobLogWriter&) = delete; BlobLogWriter& operator=(const BlobLogWriter&) = delete;
@ -66,20 +66,14 @@ class BlobLogWriter {
uint64_t get_log_number() const { return log_number_; } uint64_t get_log_number() const { return log_number_; }
bool ShouldSync() const { return block_offset_ > next_sync_offset_; }
Status Sync(); Status Sync();
void ResetSyncPointer() { next_sync_offset_ += bytes_per_sync_; }
private: private:
std::unique_ptr<WritableFileWriter> dest_; std::unique_ptr<WritableFileWriter> dest_;
Env* env_; Env* env_;
Statistics* statistics_; Statistics* statistics_;
uint64_t log_number_; uint64_t log_number_;
uint64_t block_offset_; // Current offset in block uint64_t block_offset_; // Current offset in block
uint64_t bytes_per_sync_;
uint64_t next_sync_offset_;
bool use_fsync_; bool use_fsync_;
public: public:

View File

@ -756,7 +756,7 @@ Status BlobDBImpl::CreateWriterLocked(const std::shared_ptr<BlobFile>& bfile) {
bfile->log_writer_ = std::make_shared<BlobLogWriter>( bfile->log_writer_ = std::make_shared<BlobLogWriter>(
std::move(fwriter), env_, statistics_, bfile->file_number_, 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; bfile->log_writer_->last_elem_type_ = et;
return s; return s;