mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-26 03:20:37 +00:00
api: add get_unleveled_sstables to column family api
Adding to API function to return count of sstables in L0 if leveled compaction strategy is enabled, 0 otherwise. Currently, we don't support leveled compaction strategy, so function to return count of sstables in L0 always return zero. Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
This commit is contained in:
@@ -97,6 +97,12 @@ static future<json::json_return_type> get_cf_histogram(http_context& ctx, utils:
|
||||
});
|
||||
}
|
||||
|
||||
static future<json::json_return_type> get_cf_unleveled_sstables(http_context& ctx, const sstring& name) {
|
||||
return map_reduce_cf(ctx, name, 0, [](const column_family& cf) {
|
||||
return cf.get_unleveled_sstables();
|
||||
}, std::plus<int64_t>());
|
||||
}
|
||||
|
||||
static int64_t min_row_size(column_family& cf) {
|
||||
int64_t res = INT64_MAX;
|
||||
for (auto i: *cf.get_sstables() ) {
|
||||
@@ -313,6 +319,10 @@ void set_column_family(http_context& ctx, routes& r) {
|
||||
return get_cf_stats(ctx, &column_family::stats::live_sstable_count);
|
||||
});
|
||||
|
||||
cf::get_unleveled_sstables.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_unleveled_sstables(ctx, req->param["name"]);
|
||||
});
|
||||
|
||||
cf::get_live_disk_space_used.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_stats(ctx, req->param["name"], &column_family::stats::live_disk_space_used);
|
||||
});
|
||||
|
||||
@@ -623,6 +623,13 @@ size_t column_family::sstables_count() {
|
||||
return _sstables->size();
|
||||
}
|
||||
|
||||
int64_t column_family::get_unleveled_sstables() const {
|
||||
// TODO: when we support leveled compaction, we should return the number of
|
||||
// SSTables in L0. If leveled compaction is enabled in this column family,
|
||||
// then we should return zero, as we currently do.
|
||||
return 0;
|
||||
}
|
||||
|
||||
lw_shared_ptr<sstable_list> column_family::get_sstables() {
|
||||
return _sstables;
|
||||
}
|
||||
|
||||
@@ -190,6 +190,7 @@ public:
|
||||
|
||||
lw_shared_ptr<sstable_list> get_sstables();
|
||||
size_t sstables_count();
|
||||
int64_t get_unleveled_sstables() const;
|
||||
|
||||
void start_compaction();
|
||||
void trigger_compaction();
|
||||
|
||||
Reference in New Issue
Block a user