Skip to content

Commit

Permalink
Remote options file name from payload completely
Browse files Browse the repository at this point in the history
  • Loading branch information
jaykorean committed Sep 20, 2024
1 parent 4515e33 commit 5a4ae3b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
1 change: 0 additions & 1 deletion db/compaction/compaction_job.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ class CompactionJob {
// doesn't contain the LSM tree information, which is passed though MANIFEST
// file.
struct CompactionServiceInput {
std::string options_file;
std::string cf_name;

std::vector<SequenceNumber> snapshots;
Expand Down
1 change: 0 additions & 1 deletion db/compaction/compaction_job_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,6 @@ TEST_F(CompactionJobTest, InputSerialization) {
Random rnd(static_cast<uint32_t>(time(nullptr)));
Random64 rnd64(time(nullptr));
input.cf_name = rnd.RandomString(rnd.Uniform(kStrMaxLen));
input.options_file = "OPTIONS-007";
while (!rnd.OneIn(10)) {
input.snapshots.emplace_back(rnd64.Uniform(UINT64_MAX));
}
Expand Down
11 changes: 1 addition & 10 deletions db/compaction/compaction_service_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ CompactionJob::ProcessKeyValueCompactionWithCompactionService(

const Compaction* compaction = sub_compact->compaction;
CompactionServiceInput compaction_input;
Status s = GetLatestOptionsFileName(dbname_, db_options_.env,
&compaction_input.options_file);
if (!s.ok()) {
sub_compact->status = s;
return CompactionServiceJobStatus::kFailure;
}

compaction_input.output_level = compaction->output_level();
compaction_input.db_id = db_id_;
Expand All @@ -58,7 +52,7 @@ CompactionJob::ProcessKeyValueCompactionWithCompactionService(
compaction_input.has_end ? sub_compact->end->ToString() : "";

std::string compaction_input_binary;
s = compaction_input.Write(&compaction_input_binary);
Status s = compaction_input.Write(&compaction_input_binary);
if (!s.ok()) {
sub_compact->status = s;
return CompactionServiceJobStatus::kFailure;
Expand Down Expand Up @@ -409,9 +403,6 @@ static std::unordered_map<std::string, OptionTypeInfo> cfd_type_info = {
};

static std::unordered_map<std::string, OptionTypeInfo> cs_input_type_info = {
{"options_file",
{offsetof(struct CompactionServiceInput, options_file),
OptionType::kEncodedString}},
{"cf_name",
{offsetof(struct CompactionServiceInput, cf_name),
OptionType::kEncodedString}},
Expand Down
15 changes: 10 additions & 5 deletions db/db_impl/db_impl_secondary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -951,16 +951,21 @@ Status DB::OpenAndCompact(
return s;
}

// 2. Parse Base DBOptions from OPTIONS File
// 2. Load the options from latest OPTIONS file
DBOptions db_options;
ConfigOptions config_options;
config_options.env = override_options.env;
std::vector<ColumnFamilyDescriptor> all_column_families;
s = LoadOptionsFromFile(config_options,
name + "/" + compaction_input.options_file,
&db_options, &all_column_families);
s = LoadLatestOptions(config_options, name, &db_options,
&all_column_families);
// In a very rare scenario, loading options may fail if the options changed by
// the primary host at the same time. Just retry once for now.
if (!s.ok()) {
return s;
s = LoadLatestOptions(config_options, name, &db_options,
&all_column_families);
if (!s.ok()) {
return s;
}
}

// 3. Override pointer configurations in DBOptions with
Expand Down

0 comments on commit 5a4ae3b

Please sign in to comment.