Skip to content

Commit e94df3d

Browse files
mszeszko-metameta-codesync[bot]
authored andcommitted
Remove dead code and unused includes (#14278)
Summary: Pull Request resolved: #14278 Remove dead code from `BlobDBImpl`: - `debug_level_ `member and associated unreachable debug logging - `CopyBlobFiles()` - private method that was never called - `FileDeleteOk_SnapshotCheckLocked()` - declared but never implemented - `RemoveTimerQ()` - declared but never implemented Remove unused includes: - rocksdb/wal_filter.h from blob_db_impl.h - rocksdb/utilities/transaction.h from blob_db_impl.cc - table/meta_blocks.h from blob_db_impl.cc - util/random.h from blob_db_impl.cc Remove from BlobFile: - `GetColumnFamilyId()` - declared/implemented but never called Reviewed By: xingbowang Differential Revision: D91089144 fbshipit-source-id: d9bce24122b3bb790644fe4e51ce4403c77a1abf
1 parent 83d24db commit e94df3d

File tree

4 files changed

+1
-48
lines changed

4 files changed

+1
-48
lines changed

utilities/blob_db/blob_db_impl.cc

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@
2828
#include "rocksdb/env.h"
2929
#include "rocksdb/iterator.h"
3030
#include "rocksdb/utilities/stackable_db.h"
31-
#include "rocksdb/utilities/transaction.h"
32-
#include "table/meta_blocks.h"
3331
#include "test_util/sync_point.h"
3432
#include "util/cast_util.h"
3533
#include "util/crc32c.h"
3634
#include "util/mutexlock.h"
37-
#include "util/random.h"
3835
#include "util/stop_watch.h"
3936
#include "util/timer_queue.h"
4037
#include "utilities/blob_db/blob_compaction_filter.h"
@@ -85,8 +82,7 @@ BlobDBImpl::BlobDBImpl(const std::string& dbname,
8582
closed_(true),
8683
open_file_count_(0),
8784
total_blob_size_(0),
88-
live_sst_size_(0),
89-
debug_level_(0) {
85+
live_sst_size_(0) {
9086
clock_ = env_->GetSystemClock().get();
9187
blob_dir_ = dbname + "/" + kBlobDirName;
9288
file_options_.bytes_per_sync = kBytesPerSync;
@@ -740,11 +736,6 @@ Status BlobDBImpl::CreateWriterLocked(const std::shared_ptr<BlobFile>& bfile) {
740736
statistics_, Histograms::BLOB_DB_BLOB_FILE_WRITE_MICROS));
741737

742738
uint64_t boffset = bfile->GetFileSize();
743-
if (debug_level_ >= 2 && boffset) {
744-
ROCKS_LOG_DEBUG(db_options_.info_log,
745-
"Open blob file: %s with offset: %" PRIu64, fpath.c_str(),
746-
boffset);
747-
}
748739

749740
BlobLogWriter::ElemType et = BlobLogWriter::kEtNone;
750741
if (bfile->file_size_ == BlobLogHeader::kSize) {
@@ -1365,15 +1356,6 @@ Status BlobDBImpl::GetRawBlobFromFile(const Slice& key, uint64_t file_number,
13651356
// valid offset.
13661357
if (offset <
13671358
(BlobLogHeader::kSize + BlobLogRecord::kHeaderSize + key.size())) {
1368-
if (debug_level_ >= 2) {
1369-
ROCKS_LOG_ERROR(db_options_.info_log,
1370-
"Invalid blob index file_number: %" PRIu64
1371-
" blob_offset: %" PRIu64 " blob_size: %" PRIu64
1372-
" key: %s",
1373-
file_number, offset, size,
1374-
key.ToString(/* output_hex */ true).c_str());
1375-
}
1376-
13771359
return Status::NotFound("Invalid blob offset");
13781360
}
13791361

@@ -1463,15 +1445,6 @@ Status BlobDBImpl::GetRawBlobFromFile(const Slice& key, uint64_t file_number,
14631445
blob_record.size() - sizeof(uint32_t));
14641446
crc = crc32c::Mask(crc); // Adjust for storage
14651447
if (crc != crc_exp) {
1466-
if (debug_level_ >= 2) {
1467-
ROCKS_LOG_ERROR(
1468-
db_options_.info_log,
1469-
"Blob crc mismatch file: %" PRIu64 " blob_offset: %" PRIu64
1470-
" blob_size: %" PRIu64 " key: %s status: '%s'",
1471-
file_number, offset, size,
1472-
key.ToString(/* output_hex */ true).c_str(), s.ToString().c_str());
1473-
}
1474-
14751448
return Status::Corruption("Corruption. Blob CRC mismatch");
14761449
}
14771450

@@ -1930,14 +1903,6 @@ std::pair<bool, int64_t> BlobDBImpl::DeleteObsoleteFiles(bool aborted) {
19301903
return std::make_pair(!aborted, -1);
19311904
}
19321905

1933-
void BlobDBImpl::CopyBlobFiles(
1934-
std::vector<std::shared_ptr<BlobFile>>* bfiles_copy) {
1935-
ReadLock rl(&mutex_);
1936-
for (auto const& p : blob_files_) {
1937-
bfiles_copy->push_back(p.second);
1938-
}
1939-
}
1940-
19411906
Iterator* BlobDBImpl::NewIterator(const ReadOptions& _read_options) {
19421907
if (_read_options.io_activity != Env::IOActivity::kUnknown &&
19431908
_read_options.io_activity != Env::IOActivity::kDBIterator) {

utilities/blob_db/blob_db_impl.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "rocksdb/listener.h"
2727
#include "rocksdb/options.h"
2828
#include "rocksdb/statistics.h"
29-
#include "rocksdb/wal_filter.h"
3029
#include "util/mutexlock.h"
3130
#include "util/timer_queue.h"
3231
#include "utilities/blob_db/blob_db.h"
@@ -286,8 +285,6 @@ class BlobDBImpl : public BlobDB {
286285
// Evict expired blob files from the TTL queue.
287286
std::pair<bool, int64_t> EvictExpiredFiles(bool aborted);
288287

289-
std::pair<bool, int64_t> RemoveTimerQ(TimerQueue* tq, bool aborted);
290-
291288
// Adds the background tasks to the timer queue
292289
void StartBackgroundTasks();
293290

@@ -374,9 +371,6 @@ class BlobDBImpl : public BlobDB {
374371
// checks if there is no snapshot which is referencing the
375372
// blobs
376373
bool VisibleToActiveSnapshot(const std::shared_ptr<BlobFile>& file);
377-
bool FileDeleteOk_SnapshotCheckLocked(const std::shared_ptr<BlobFile>& bfile);
378-
379-
void CopyBlobFiles(std::vector<std::shared_ptr<BlobFile>>* bfiles_copy);
380374

381375
uint64_t EpochNow() { return clock_->NowMicros() / 1000000; }
382376

@@ -469,8 +463,6 @@ class BlobDBImpl : public BlobDB {
469463
//
470464
// REQUIRES: access with delete_file_mutex_ held.
471465
int disable_file_deletions_ = 0;
472-
473-
uint32_t debug_level_;
474466
};
475467

476468
} // namespace blob_db

utilities/blob_db/blob_file.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ BlobFile::~BlobFile() {
4848
}
4949
}
5050

51-
uint32_t BlobFile::GetColumnFamilyId() const { return column_family_id_; }
52-
5351
std::string BlobFile::PathName() const {
5452
return BlobFileName(path_to_dir_, file_number_);
5553
}

utilities/blob_db/blob_file.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ class BlobFile {
110110

111111
~BlobFile();
112112

113-
uint32_t GetColumnFamilyId() const;
114-
115113
// Returns log file's absolute pathname.
116114
std::string PathName() const;
117115

0 commit comments

Comments
 (0)