Skip to content

Commit

Permalink
sstables: Delete duplicated code
Browse files Browse the repository at this point in the history
For some reason date_tiered_compaction_strategy had its own identical
copy of get_value.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20200819211509.106594-1-espindola@scylladb.com>
  • Loading branch information
espindola authored and avikivity committed Aug 26, 2020
1 parent f7c5c48 commit 5fcfbd7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
6 changes: 3 additions & 3 deletions sstables/compaction_strategy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -915,15 +915,15 @@ date_tiered_manifest::create_sst_and_min_timestamp_pairs(const std::vector<sstab
date_tiered_compaction_strategy_options::date_tiered_compaction_strategy_options(const std::map<sstring, sstring>& options) {
using namespace cql3::statements;

auto tmp_value = get_value(options, TIMESTAMP_RESOLUTION_KEY);
auto tmp_value = sstables::compaction_strategy_impl::get_value(options, TIMESTAMP_RESOLUTION_KEY);
auto target_unit = tmp_value ? tmp_value.value() : DEFAULT_TIMESTAMP_RESOLUTION;

tmp_value = get_value(options, MAX_SSTABLE_AGE_KEY);
tmp_value = sstables::compaction_strategy_impl::get_value(options, MAX_SSTABLE_AGE_KEY);
auto fractional_days = property_definitions::to_double(MAX_SSTABLE_AGE_KEY, tmp_value, DEFAULT_MAX_SSTABLE_AGE_DAYS);
int64_t max_sstable_age_in_hours = std::lround(fractional_days * 24);
max_sstable_age = duration_conversor::convert(target_unit, std::chrono::hours(max_sstable_age_in_hours));

tmp_value = get_value(options, BASE_TIME_KEY);
tmp_value = sstables::compaction_strategy_impl::get_value(options, BASE_TIME_KEY);
auto base_time_seconds = property_definitions::to_long(BASE_TIME_KEY, tmp_value, DEFAULT_BASE_TIME_SECONDS);
base_time = duration_conversor::convert(target_unit, std::chrono::seconds(base_time_seconds));
}
Expand Down
7 changes: 0 additions & 7 deletions sstables/date_tiered_compaction_strategy.hh
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ public:

date_tiered_compaction_strategy_options();
private:
static std::optional<sstring> get_value(const std::map<sstring, sstring>& options, const sstring& name) {
auto it = options.find(name);
if (it == options.end()) {
return std::nullopt;
}
return it->second;
}

friend class date_tiered_manifest;
};
Expand Down

0 comments on commit 5fcfbd7

Please sign in to comment.