Skip to content

Commit 56d40be

Browse files
mszeszko-metameta-codesync[bot]
authored andcommitted
Remove path_relative config option (facebook#14273)
Summary: Pull Request resolved: facebook#14273 The `path_relative` option in `BlobDBOptions` was never used in practice - all production deployments use the default value of `true` (relative path). The absolute path mode (`path_relative = false`) was essentially unsupported: - `GetLiveFiles()` returned `NotSupported` for absolute paths - `GetLiveFilesMetaData()` had an assertion that would crash for absolute paths This change removes the option and simplifies the code to always use relative paths for the blob directory. Changes: - Remove `path_relative` field from `BlobDBOptions` - Simplify `blob_dir_` construction in `BlobDBImpl` constructor - Simplify path construction in `DestroyBlobDB()` - Remove `NotSupported` check in `GetLiveFiles()` - Remove assertion in `GetLiveFilesMetaData()` - Remove logging of `path_relative` in `Dump()` - Remove redundant `path_relative = true` in tests Reviewed By: xingbowang Differential Revision: D91089016 fbshipit-source-id: 947b129e405a315b94ac73bc48b23103ba12d73b
1 parent 148f6c9 commit 56d40be

5 files changed

Lines changed: 2 additions & 19 deletions

File tree

utilities/blob_db/blob_db.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ void BlobDBOptions::Dump(Logger* log) const {
7171
ROCKS_LOG_HEADER(
7272
log, " BlobDBOptions.blob_dir: %s",
7373
blob_dir.c_str());
74-
ROCKS_LOG_HEADER(
75-
log, " BlobDBOptions.path_relative: %d",
76-
path_relative);
7774
ROCKS_LOG_HEADER(
7875
log, " BlobDBOptions.max_db_size: %" PRIu64,
7976
max_db_size);

utilities/blob_db/blob_db.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ struct BlobDBOptions {
3232
// Default is "blob_dir"
3333
std::string blob_dir = "blob_dir";
3434

35-
// whether the blob_dir path is relative or absolute.
36-
bool path_relative = true;
37-
3835
// Maximum size of the database (including SST files and blob files).
3936
//
4037
// Default: 0 (no limits)

utilities/blob_db/blob_db_impl.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +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_ = (bdb_options_.path_relative)
92-
? dbname + "/" + bdb_options_.blob_dir
93-
: bdb_options_.blob_dir;
91+
blob_dir_ = dbname + "/" + bdb_options_.blob_dir;
9492
file_options_.bytes_per_sync = blob_db_options.bytes_per_sync;
9593
}
9694

@@ -1977,9 +1975,7 @@ Status DestroyBlobDB(const std::string& dbname, const Options& options,
19771975
Env* env = soptions.env;
19781976

19791977
Status status;
1980-
std::string blobdir;
1981-
blobdir = (bdb_options.path_relative) ? dbname + "/" + bdb_options.blob_dir
1982-
: bdb_options.blob_dir;
1978+
std::string blobdir = dbname + "/" + bdb_options.blob_dir;
19831979

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

utilities/blob_db/blob_db_impl_filesnapshot.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ Status BlobDBImpl::EnableFileDeletions() {
5959
Status BlobDBImpl::GetLiveFiles(std::vector<std::string>& ret,
6060
uint64_t* manifest_file_size,
6161
bool flush_memtable) {
62-
if (!bdb_options_.path_relative) {
63-
return Status::NotSupported(
64-
"Not able to get relative blob file path from absolute blob_dir.");
65-
}
6662
// Hold a lock in the beginning to avoid updates to base DB during the call
6763
ReadLock rl(&mutex_);
6864
Status s = db_->GetLiveFiles(ret, manifest_file_size, flush_memtable);
@@ -80,8 +76,6 @@ Status BlobDBImpl::GetLiveFiles(std::vector<std::string>& ret,
8076
}
8177

8278
void BlobDBImpl::GetLiveFilesMetaData(std::vector<LiveFileMetaData>* metadata) {
83-
// Path should be relative to db_name.
84-
assert(bdb_options_.path_relative);
8579
// Hold a lock in the beginning to avoid updates to base DB during the call
8680
ReadLock rl(&mutex_);
8781
db_->GetLiveFilesMetaData(metadata);

utilities/blob_db/blob_db_test.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,6 @@ TEST_F(BlobDBTest, GetLiveFilesMetaData) {
755755

756756
BlobDBOptions bdb_options;
757757
bdb_options.blob_dir = "blob_dir";
758-
bdb_options.path_relative = true;
759758
bdb_options.ttl_range_secs = 10;
760759
bdb_options.disable_background_tasks = true;
761760

0 commit comments

Comments
 (0)