diff --git a/api/column_family.cc b/api/column_family.cc index b7d2937589..2e018c6491 100644 --- a/api/column_family.cc +++ b/api/column_family.cc @@ -97,6 +97,12 @@ static future get_cf_histogram(http_context& ctx, utils: }); } +static future 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()); +} + 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 req) { + return get_cf_unleveled_sstables(ctx, req->param["name"]); + }); + cf::get_live_disk_space_used.set(r, [&ctx] (std::unique_ptr req) { return get_cf_stats(ctx, req->param["name"], &column_family::stats::live_disk_space_used); }); diff --git a/database.cc b/database.cc index a51d37c744..49ca1ca341 100644 --- a/database.cc +++ b/database.cc @@ -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 column_family::get_sstables() { return _sstables; } diff --git a/database.hh b/database.hh index 5b12b40a32..c6e1fb7c01 100644 --- a/database.hh +++ b/database.hh @@ -190,6 +190,7 @@ public: lw_shared_ptr get_sstables(); size_t sstables_count(); + int64_t get_unleveled_sstables() const; void start_compaction(); void trigger_compaction();