Remove some more dead code around syncing blob files (#7138)

Summary:
Periodic syncing of blob files is handled by a lower layer, namely by
`WritableFileWriter`; the `NeedsFsync` method of `BlobFile` and the
`last_fsync_` member variable are actually unused and thus can be
removed. See also https://github.com/facebook/rocksdb/pull/7125 .

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7138

Test Plan: `make check`

Reviewed By: zhichao-cao

Differential Revision: D22562981

Pulled By: ltamasi

fbshipit-source-id: c235aad94a7c27120528c9ec270a7a5b9154e49f
main
Levi Tamasi 4 years ago committed by Facebook GitHub Bot
parent a7feebd670
commit c5ddeceba0
  1. 9
      utilities/blob_db/blob_file.cc
  2. 6
      utilities/blob_db/blob_file.h

@ -103,12 +103,6 @@ void BlobFile::MarkObsolete(SequenceNumber sequence) {
obsolete_.store(true);
}
bool BlobFile::NeedsFsync(bool hard, uint64_t bytes_per_sync) const {
assert(last_fsync_ <= file_size_);
return (hard) ? file_size_ > last_fsync_
: (file_size_ - last_fsync_) >= bytes_per_sync;
}
Status BlobFile::WriteFooterAndCloseLocked(SequenceNumber sequence) {
BlobLogFooter footer;
footer.blob_count = blob_count_;
@ -160,8 +154,6 @@ Status BlobFile::ReadFooter(BlobLogFooter* bf) {
}
Status BlobFile::SetFromFooterLocked(const BlobLogFooter& footer) {
// assume that file has been fully fsync'd
last_fsync_.store(file_size_);
blob_count_ = footer.blob_count;
expiration_range_ = footer.expiration_range;
closed_ = true;
@ -172,7 +164,6 @@ Status BlobFile::Fsync() {
Status s;
if (log_writer_.get()) {
s = log_writer_->Sync();
last_fsync_.store(file_size_.load());
}
return s;
}

@ -98,9 +98,6 @@ class BlobFile {
// time when the random access reader was last created.
std::atomic<std::int64_t> last_access_{-1};
// last time file was fsync'd/fdatasyncd
std::atomic<uint64_t> last_fsync_{0};
bool header_valid_{false};
bool footer_valid_{false};
@ -184,9 +181,6 @@ class BlobFile {
return obsolete_sequence_;
}
// we will assume this is atomic
bool NeedsFsync(bool hard, uint64_t bytes_per_sync) const;
Status Fsync();
uint64_t GetFileSize() const {

Loading…
Cancel
Save