Skip to content

Commit 053b0d5

Browse files
mszeszko-metameta-codesync[bot]
authored andcommitted
Remove blob_dir config option (facebook#14275)
Summary: Pull Request resolved: facebook#14275 No one ever sets `blob_dir` to a non-default value. Replace the configurable `blob_dir` option with a constant `kBlobDirName`. This simplifies the code and further reduces the configurability surface. Reviewed By: xingbowang Differential Revision: D91089039 fbshipit-source-id: 7d82e86415cc4bc89a7fe1399c29d4cc3058d1de
1 parent 56d40be commit 053b0d5

5 files changed

Lines changed: 7 additions & 14 deletions

File tree

utilities/blob_db/blob_db.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ Status BlobDB::Open(const DBOptions& db_options,
6868
BlobDB::BlobDB() : StackableDB(nullptr) {}
6969

7070
void BlobDBOptions::Dump(Logger* log) const {
71-
ROCKS_LOG_HEADER(
72-
log, " BlobDBOptions.blob_dir: %s",
73-
blob_dir.c_str());
7471
ROCKS_LOG_HEADER(
7572
log, " BlobDBOptions.max_db_size: %" PRIu64,
7673
max_db_size);

utilities/blob_db/blob_db.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,10 @@ namespace blob_db {
2525
// users to use blob DB.
2626

2727
constexpr uint64_t kNoExpiration = std::numeric_limits<uint64_t>::max();
28+
// Name of the directory under the base DB where blobs will be stored.
29+
constexpr const char* kBlobDirName = "blob_dir";
2830

2931
struct BlobDBOptions {
30-
// Name of the directory under the base DB where blobs will be stored. Using
31-
// a directory where the base DB stores its SST files is not supported.
32-
// Default is "blob_dir"
33-
std::string blob_dir = "blob_dir";
34-
3532
// Maximum size of the database (including SST files and blob files).
3633
//
3734
// Default: 0 (no limits)

utilities/blob_db/blob_db_impl.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ BlobDBImpl::BlobDBImpl(const std::string& dbname,
8888
live_sst_size_(0),
8989
debug_level_(0) {
9090
clock_ = env_->GetSystemClock().get();
91-
blob_dir_ = dbname + "/" + bdb_options_.blob_dir;
91+
blob_dir_ = dbname + "/" + kBlobDirName;
9292
file_options_.bytes_per_sync = blob_db_options.bytes_per_sync;
9393
}
9494

@@ -1970,12 +1970,12 @@ Iterator* BlobDBImpl::NewIterator(const ReadOptions& _read_options) {
19701970
}
19711971

19721972
Status DestroyBlobDB(const std::string& dbname, const Options& options,
1973-
const BlobDBOptions& bdb_options) {
1973+
const BlobDBOptions& /*bdb_options*/) {
19741974
const ImmutableDBOptions soptions(SanitizeOptions(dbname, options));
19751975
Env* env = soptions.env;
19761976

19771977
Status status;
1978-
std::string blobdir = dbname + "/" + bdb_options.blob_dir;
1978+
std::string blobdir = dbname + "/" + kBlobDirName;
19791979

19801980
std::vector<std::string> filenames;
19811981
if (env->GetChildren(blobdir, &filenames).ok()) {

utilities/blob_db/blob_db_impl_filesnapshot.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Status BlobDBImpl::GetLiveFiles(std::vector<std::string>& ret,
7070
auto blob_file = bfile_pair.second;
7171
// Path should be relative to db_name, but begin with slash.
7272
ret.emplace_back(
73-
BlobFileName("", bdb_options_.blob_dir, blob_file->BlobFileNumber()));
73+
BlobFileName("", kBlobDirName, blob_file->BlobFileNumber()));
7474
}
7575
return Status::OK();
7676
}
@@ -85,7 +85,7 @@ void BlobDBImpl::GetLiveFilesMetaData(std::vector<LiveFileMetaData>* metadata) {
8585
filemetadata.size = blob_file->GetFileSize();
8686
const uint64_t file_number = blob_file->BlobFileNumber();
8787
// Path should be relative to db_name, but begin with slash.
88-
filemetadata.name = BlobFileName("", bdb_options_.blob_dir, file_number);
88+
filemetadata.name = BlobFileName("", kBlobDirName, file_number);
8989
filemetadata.file_number = file_number;
9090
if (blob_file->HasTTL()) {
9191
filemetadata.oldest_ancester_time = blob_file->GetExpirationRange().first;

utilities/blob_db/blob_db_test.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,6 @@ TEST_F(BlobDBTest, GetLiveFilesMetaData) {
754754
Random rnd(301);
755755

756756
BlobDBOptions bdb_options;
757-
bdb_options.blob_dir = "blob_dir";
758757
bdb_options.ttl_range_secs = 10;
759758
bdb_options.disable_background_tasks = true;
760759

0 commit comments

Comments
 (0)