Updated GetProperty documentation

Summary: As titled. Also added the kBaseLevel string, which was missing earlier.

Test Plan: built

Reviewers: yhchiang, anthony, rven, kradhakrishnan, IslamAbdelRahman, sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D53271
This commit is contained in:
Andrew Kryczka 2016-01-25 14:04:55 -08:00
parent 40911e0b32
commit 3e9209a078
2 changed files with 113 additions and 55 deletions

View File

@ -180,6 +180,7 @@ const std::string DB::Properties::kEstimateLiveDataSize =
rocksdb_prefix + estimate_live_data_size; rocksdb_prefix + estimate_live_data_size;
const std::string DB::Properties::kTotalSstFilesSize = const std::string DB::Properties::kTotalSstFilesSize =
rocksdb_prefix + total_sst_files_size; rocksdb_prefix + total_sst_files_size;
const std::string DB::Properties::kBaseLevel = rocksdb_prefix + base_level;
const std::string DB::Properties::kEstimatePendingCompactionBytes = const std::string DB::Properties::kEstimatePendingCompactionBytes =
rocksdb_prefix + estimate_pending_comp_bytes; rocksdb_prefix + estimate_pending_comp_bytes;
const std::string DB::Properties::kAggregatedTableProperties = const std::string DB::Properties::kAggregatedTableProperties =

View File

@ -327,97 +327,154 @@ class DB {
// use "snapshot" after this call. // use "snapshot" after this call.
virtual void ReleaseSnapshot(const Snapshot* snapshot) = 0; virtual void ReleaseSnapshot(const Snapshot* snapshot) = 0;
// DB implementations can export properties about their state #ifndef ROCKSDB_LITE
// via this method. If "property" is a valid property understood by this // Contains all valid property arguments for GetProperty().
// DB implementation, fills "*value" with its current value and returns struct Properties {
// true. Otherwise returns false. // "rocksdb.num-files-at-level<N>" - returns string containing the number
// // of files at level <N>, where <N> is an ASCII representation of a
// // level number (e.g., "0").
// Valid property names include: static const std::string kNumFilesAtLevelPrefix;
//
// "rocksdb.num-files-at-level<N>" - return the number of files at level <N>, // "rocksdb.stats" - returns a multi-line string containing the data
// where <N> is an ASCII representation of a level number (e.g. "0"). // described by kCFStats followed by the data described by kDBStats.
// "rocksdb.stats" - returns a multi-line string that describes statistics static const std::string kStats;
// about the internal operation of the DB.
// "rocksdb.sstables" - returns a multi-line string that describes all // "rocksdb.sstables" - returns a multi-line string summarizing current
// of the sstables that make up the db contents. // SST files.
// "rocksdb.cfstats" static const std::string kSSTables;
// "rocksdb.dbstats"
// "rocksdb.levelstats" // "rocksdb.cfstats" - returns a multi-line string with general column
// "rocksdb.num-immutable-mem-table" // family stats per-level over db's lifetime ("L<n>"), aggregated over
// "rocksdb.mem-table-flush-pending" // db's lifetime ("Sum"), and aggregated over the interval since the
// "rocksdb.num-immutable-mem-table-flushed" // last retrieval ("Int").
// "rocksdb.compaction-pending" - 1 if at least one compaction is pending static const std::string kCFStats;
// "rocksdb.background-errors" - accumulated number of background errors
// "rocksdb.cur-size-active-mem-table" // "rocksdb.dbstats" - returns a multi-line string with general database
// "rocksdb.cur-size-all-mem-tables" // stats, both cumulative (over the db's lifetime) and interval (since
// "rocksdb.size-all-mem-tables" // the last retrieval of kDBStats).
// "rocksdb.num-entries-active-mem-table" static const std::string kDBStats;
// "rocksdb.num-entries-imm-mem-tables"
// "rocksdb.num-deletes-active-mem-table" // "rocksdb.levelstats" - returns multi-line string containing the number
// "rocksdb.num-deletes-imm-mem-tables" // of files per level and total size of each level (MB).
// "rocksdb.estimate-num-keys" - estimated keys in the column family static const std::string kLevelStats;
// "rocksdb.estimate-table-readers-mem" - estimated memory used for reding
// SST tables, that is not counted as a part of block cache. // "rocksdb.num-immutable-mem-table" - returns number of immutable
// "rocksdb.is-file-deletions-enabled" // memtables that have not yet been flushed.
// "rocksdb.num-snapshots" static const std::string kNumImmutableMemTable;
// "rocksdb.oldest-snapshot-time"
// "rocksdb.num-live-versions" - `version` is an internal data structure. // "rocksdb.num-immutable-mem-table-flushed" - returns number of immutable
// See version_set.h for details. More live versions often mean more SST // memtables that have already been flushed.
// files are held from being deleted, by iterators or unfinished static const std::string kNumImmutableMemTableFlushed;
// compactions.
// "rocksdb.estimate-live-data-size" // "rocksdb.mem-table-flush-pending" - returns 1 if a memtable flush is
// "rocksdb.total-sst-files-size" - total size of all used sst files, this // pending; otherwise, returns 0.
// may slow down online queries if there are too many files. static const std::string kMemTableFlushPending;
// "rocksdb.base-level"
// "rocksdb.estimate-pending-compaction-bytes" - estimated total number of // "rocksdb.num-running-flushes" - returns the number of currently running
// bytes compaction needs to rewrite the data to get all levels down // flushes.
// to under target size. Not valid for other compactions than static const std::string kNumRunningFlushes;
// level-based.
// "rocksdb.compaction-pending" - returns 1 if at least one compaction is
// pending; otherwise, returns 0.
static const std::string kCompactionPending;
// "rocksdb.num-running-compactions" - returns the number of currently
// running compactions.
static const std::string kNumRunningCompactions;
// "rocksdb.background-errors" - returns accumulated number of background
// errors.
static const std::string kBackgroundErrors;
// "rocksdb.cur-size-active-mem-table" - returns approximate size of active
// memtable (bytes).
static const std::string kCurSizeActiveMemTable;
// "rocksdb.cur-size-all-mem-tables" - returns approximate size of active
// and unflushed immutable memtables (bytes).
static const std::string kCurSizeAllMemTables;
// "rocksdb.size-all-mem-tables" - returns approximate size of active,
// unflushed immutable, and pinned immutable memtables (bytes).
static const std::string kSizeAllMemTables;
// "rocksdb.num-entries-active-mem-table" - returns total number of entries
// in the active memtable.
static const std::string kNumEntriesActiveMemTable;
// "rocksdb.num-entries-imm-mem-tables" - returns total number of entries
// in the unflushed immutable memtables.
static const std::string kNumEntriesImmMemTables;
// "rocksdb.num-deletes-active-mem-table" - returns total number of delete
// entries in the active memtable.
static const std::string kNumDeletesActiveMemTable;
// "rocksdb.num-deletes-imm-mem-tables" - returns total number of delete
// entries in the unflushed immutable memtables.
static const std::string kNumDeletesImmMemTables;
// "rocksdb.estimate-num-keys" - returns estimated number of total keys in
// the active and unflushed immutable memtables.
static const std::string kEstimateNumKeys;
// "rocksdb.estimate-table-readers-mem" - returns estimated memory used for
// reading SST tables, excluding memory used in block cache (e.g.,
// filter and index blocks).
static const std::string kEstimateTableReadersMem;
// "rocksdb.is-file-deletions-enabled" - returns 0 if deletion of obsolete
// files is enabled; otherwise, returns a non-zero number.
static const std::string kIsFileDeletionsEnabled;
// "rocksdb.num-snapshots" - returns number of unreleased snapshots of the
// database.
static const std::string kNumSnapshots;
// "rocksdb.oldest-snapshot-time" - returns number representing unix
// timestamp of oldest unreleased snapshot.
static const std::string kOldestSnapshotTime;
// "rocksdb.num-live-versions" - returns number of live versions. `Version`
// is an internal data structure. See version_set.h for details. More
// live versions often mean more SST files are held from being deleted,
// by iterators or unfinished compactions.
static const std::string kNumLiveVersions;
// "rocksdb.estimate-live-data-size" - returns an estimate of the amount of
// live data in bytes.
static const std::string kEstimateLiveDataSize;
// "rocksdb.total-sst-files-size" - returns total size (bytes) of all SST
// files.
// WARNING: may slow down online queries if there are too many files.
static const std::string kTotalSstFilesSize;
// "rocksdb.base-level" - returns number of level to which L0 data will be
// compacted.
static const std::string kBaseLevel;
// "rocksdb.estimate-pending-compaction-bytes" - returns estimated total
// number of bytes compaction needs to rewrite to get all levels down
// to under target size. Not valid for other compactions than level-
// based.
static const std::string kEstimatePendingCompactionBytes;
// "rocksdb.aggregated-table-properties" - returns a string representation // "rocksdb.aggregated-table-properties" - returns a string representation
// of the aggregated table properties of the target column family. // of the aggregated table properties of the target column family.
// "rocksdb.aggregated-table-properties-at-level<N>", same as the previous
// one but only returns the aggregated table properties of the specified
// level "N" at the target column family.
// "rocksdb.num-running-compactions" - the number of currently running
// compacitons.
// "rocksdb.num-running-flushes" - the number of currently running flushes.
#ifndef ROCKSDB_LITE
struct Properties {
static const std::string kNumFilesAtLevelPrefix;
static const std::string kStats;
static const std::string kSSTables;
static const std::string kCFStats;
static const std::string kDBStats;
static const std::string kLevelStats;
static const std::string kNumImmutableMemTable;
static const std::string kNumImmutableMemTableFlushed;
static const std::string kMemTableFlushPending;
static const std::string kNumRunningFlushes;
static const std::string kCompactionPending;
static const std::string kNumRunningCompactions;
static const std::string kBackgroundErrors;
static const std::string kCurSizeActiveMemTable;
static const std::string kCurSizeAllMemTables;
static const std::string kSizeAllMemTables;
static const std::string kNumEntriesActiveMemTable;
static const std::string kNumEntriesImmMemTables;
static const std::string kNumDeletesActiveMemTable;
static const std::string kNumDeletesImmMemTables;
static const std::string kEstimateNumKeys;
static const std::string kEstimateTableReadersMem;
static const std::string kIsFileDeletionsEnabled;
static const std::string kNumSnapshots;
static const std::string kOldestSnapshotTime;
static const std::string kNumLiveVersions;
static const std::string kEstimateLiveDataSize;
static const std::string kTotalSstFilesSize;
static const std::string kEstimatePendingCompactionBytes;
static const std::string kAggregatedTableProperties; static const std::string kAggregatedTableProperties;
// "rocksdb.aggregated-table-properties-at-level<N>", same as the previous
// one but only returns the aggregated table properties of the
// specified level "N" at the target column family.
static const std::string kAggregatedTablePropertiesAtLevel; static const std::string kAggregatedTablePropertiesAtLevel;
}; };
#endif /* ROCKSDB_LITE */ #endif /* ROCKSDB_LITE */
// DB implementations can export properties about their state via this method.
// If "property" is a valid property understood by this DB implementation (see
// Properties struct above for valid options), fills "*value" with its current
// value and returns true. Otherwise, returns false.
virtual bool GetProperty(ColumnFamilyHandle* column_family, virtual bool GetProperty(ColumnFamilyHandle* column_family,
const Slice& property, std::string* value) = 0; const Slice& property, std::string* value) = 0;
virtual bool GetProperty(const Slice& property, std::string* value) { virtual bool GetProperty(const Slice& property, std::string* value) {