rocksdb/properties.rs
1//! Properties
2//!
3//! Full list of valid properties and descriptions pulled from
4//! [here](https:///github.com/facebook/rocksdb/blob/08809f5e6cd9cc4bc3958dd4d59457ae78c76660/include/rocksdb/db.h#L428-L634).
5
6use crate::prop_name::level_property;
7pub use crate::prop_name::{PropName, PropertyName};
8
9macro_rules! property {
10 ($suffix: literal) => {
11 PropName::new_unwrap(concat!("rocksdb.", $suffix, "\0"))
12 };
13}
14
15/// "rocksdb.num-files-at-level<`N`>" - returns string containing the number
16/// of files at level <`N`>, where <`N`> is an ASCII representation of a
17/// level number (e.g., "0").
18pub fn num_files_at_level(level: usize) -> PropertyName {
19 unsafe { level_property("num-files-at-level", level) }
20}
21
22/// "rocksdb.compression-ratio-at-level<`N`>" - returns string containing the
23/// compression ratio of data at level <`N`>, where <`N`> is an ASCII
24/// representation of a level number (e.g., "0"). Here, compression
25/// ratio is defined as uncompressed data size / compressed file size.
26/// Returns "-1.0" if no open files at level <`N`>.
27pub fn compression_ratio_at_level(level: usize) -> PropertyName {
28 unsafe { level_property("compression-ratio-at-level", level) }
29}
30
31/// "rocksdb.stats" - returns a multi-line string containing the data
32/// described by kCFStats followed by the data described by kDBStats.
33pub const STATS: &PropName = property!("stats");
34
35/// "rocksdb.sstables" - returns a multi-line string summarizing current
36/// SST files.
37pub const SSTABLES: &PropName = property!("sstables");
38
39/// "rocksdb.cfstats" - Both of "rocksdb.cfstats-no-file-histogram" and
40/// "rocksdb.cf-file-histogram" together. See below for description
41/// of the two.
42pub const CFSTATS: &PropName = property!("CFSTATS");
43
44/// "rocksdb.cfstats-no-file-histogram" - returns a multi-line string with
45/// general column family stats per-level over db's lifetime ("`L<n>`"),
46/// aggregated over db's lifetime ("Sum"), and aggregated over the
47/// interval since the last retrieval ("Int").
48/// It could also be used to return the stats in the format of the map.
49/// In this case there will a pair of string to array of double for
50/// each level as well as for "Sum". "Int" stats will not be affected
51/// when this form of stats are retrieved.
52pub const CFSTATS_NO_FILE_HISTOGRAM: &PropName = property!("cfstats-no-file-histogram");
53
54/// "rocksdb.cf-file-histogram" - print out how many file reads to every
55/// level, as well as the histogram of latency of single requests.
56pub const CF_FILE_HISTOGRAM: &PropName = property!("cf-file-histogram");
57
58/// "rocksdb.dbstats" - returns a multi-line string with general database
59/// stats, both cumulative (over the db's lifetime) and interval (since
60/// the last retrieval of kDBStats).
61pub const DBSTATS: &PropName = property!("dbstats");
62
63/// "rocksdb.levelstats" - returns multi-line string containing the number
64/// of files per level and total size of each level (MB).
65pub const LEVELSTATS: &PropName = property!("levelstats");
66
67/// "rocksdb.num-immutable-mem-table" - returns number of immutable
68/// memtables that have not yet been flushed.
69pub const NUM_IMMUTABLE_MEM_TABLE: &PropName = property!("num-immutable-mem-table");
70
71/// "rocksdb.num-immutable-mem-table-flushed" - returns number of immutable
72/// memtables that have already been flushed.
73pub const NUM_IMMUTABLE_MEM_TABLE_FLUSHED: &PropName = property!("num-immutable-mem-table-flushed");
74
75/// "rocksdb.mem-table-flush-pending" - returns 1 if a memtable flush is
76/// pending; otherwise, returns 0.
77pub const MEM_TABLE_FLUSH_PENDING: &PropName = property!("mem-table-flush-pending");
78
79/// "rocksdb.num-running-flushes" - returns the number of currently running
80/// flushes.
81pub const NUM_RUNNING_FLUSHES: &PropName = property!("num-running-flushes");
82
83/// "rocksdb.compaction-pending" - returns 1 if at least one compaction is
84/// pending; otherwise, returns 0.
85pub const COMPACTION_PENDING: &PropName = property!("compaction-pending");
86
87/// "rocksdb.num-running-compactions" - returns the number of currently
88/// running compactions.
89pub const NUM_RUNNING_COMPACTIONS: &PropName = property!("num-running-compactions");
90
91/// "rocksdb.background-errors" - returns accumulated number of background
92/// errors.
93pub const BACKGROUND_ERRORS: &PropName = property!("background-errors");
94
95/// "rocksdb.cur-size-active-mem-table" - returns approximate size of active
96/// memtable (bytes).
97pub const CUR_SIZE_ACTIVE_MEM_TABLE: &PropName = property!("cur-size-active-mem-table");
98
99/// "rocksdb.cur-size-all-mem-tables" - returns approximate size of active
100/// and unflushed immutable memtables (bytes).
101pub const CUR_SIZE_ALL_MEM_TABLES: &PropName = property!("cur-size-all-mem-tables");
102
103/// "rocksdb.size-all-mem-tables" - returns approximate size of active,
104/// unflushed immutable, and pinned immutable memtables (bytes).
105pub const SIZE_ALL_MEM_TABLES: &PropName = property!("size-all-mem-tables");
106
107/// "rocksdb.num-entries-active-mem-table" - returns total number of entries
108/// in the active memtable.
109pub const NUM_ENTRIES_ACTIVE_MEM_TABLE: &PropName = property!("num-entries-active-mem-table");
110
111/// "rocksdb.num-entries-imm-mem-tables" - returns total number of entries
112/// in the unflushed immutable memtables.
113pub const NUM_ENTRIES_IMM_MEM_TABLES: &PropName = property!("num-entries-imm-mem-tables");
114
115/// "rocksdb.num-deletes-active-mem-table" - returns total number of delete
116/// entries in the active memtable.
117pub const NUM_DELETES_ACTIVE_MEM_TABLE: &PropName = property!("num-deletes-active-mem-table");
118
119/// "rocksdb.num-deletes-imm-mem-tables" - returns total number of delete
120/// entries in the unflushed immutable memtables.
121pub const NUM_DELETES_IMM_MEM_TABLES: &PropName = property!("num-deletes-imm-mem-tables");
122
123/// "rocksdb.estimate-num-keys" - returns estimated number of total keys in
124/// the active and unflushed immutable memtables and storage.
125pub const ESTIMATE_NUM_KEYS: &PropName = property!("estimate-num-keys");
126
127/// "rocksdb.estimate-table-readers-mem" - returns estimated memory used for
128/// reading SST tables, excluding memory used in block cache (e.g.,
129/// filter and index blocks).
130pub const ESTIMATE_TABLE_READERS_MEM: &PropName = property!("estimate-table-readers-mem");
131
132/// "rocksdb.is-file-deletions-enabled" - returns 0 if deletion of obsolete
133/// files is enabled; otherwise, returns a non-zero number.
134pub const IS_FILE_DELETIONS_ENABLED: &PropName = property!("is-file-deletions-enabled");
135
136/// "rocksdb.num-snapshots" - returns number of unreleased snapshots of the
137/// database.
138pub const NUM_SNAPSHOTS: &PropName = property!("num-snapshots");
139
140/// "rocksdb.oldest-snapshot-time" - returns number representing unix
141/// timestamp of oldest unreleased snapshot.
142pub const OLDEST_SNAPSHOT_TIME: &PropName = property!("oldest-snapshot-time");
143
144/// "rocksdb.num-live-versions" - returns number of live versions. `Version`
145/// is an internal data structure. See version_set.h for details. More
146/// live versions often mean more SST files are held from being deleted,
147/// by iterators or unfinished compactions.
148pub const NUM_LIVE_VERSIONS: &PropName = property!("num-live-versions");
149
150/// "rocksdb.current-super-version-number" - returns number of current LSM
151/// version. It is a uint64_t integer number, incremented after there is
152/// any change to the LSM tree. The number is not preserved after restarting
153/// the DB. After DB restart, it will start from 0 again.
154pub const CURRENT_SUPER_VERSION_NUMBER: &PropName = property!("current-super-version-number");
155
156/// "rocksdb.estimate-live-data-size" - returns an estimate of the amount of
157/// live data in bytes.
158pub const ESTIMATE_LIVE_DATA_SIZE: &PropName = property!("estimate-live-data-size");
159
160/// "rocksdb.min-log-number-to-keep" - return the minimum log number of the
161/// log files that should be kept.
162pub const MIN_LOG_NUMBER_TO_KEEP: &PropName = property!("min-log-number-to-keep");
163
164/// "rocksdb.min-obsolete-sst-number-to-keep" - return the minimum file
165/// number for an obsolete SST to be kept. The max value of `uint64_t`
166/// will be returned if all obsolete files can be deleted.
167pub const MIN_OBSOLETE_SST_NUMBER_TO_KEEP: &PropName = property!("min-obsolete-sst-number-to-keep");
168
169/// "rocksdb.total-sst-files-size" - returns total size (bytes) of all SST
170/// files.
171/// WARNING: may slow down online queries if there are too many files.
172pub const TOTAL_SST_FILES_SIZE: &PropName = property!("total-sst-files-size");
173
174/// "rocksdb.live-sst-files-size" - returns total size (bytes) of all SST
175/// files belong to the latest LSM tree.
176pub const LIVE_SST_FILES_SIZE: &PropName = property!("live-sst-files-size");
177
178/// "rocksdb.base-level" - returns number of level to which L0 data will be
179/// compacted.
180pub const BASE_LEVEL: &PropName = property!("base-level");
181
182/// "rocksdb.estimate-pending-compaction-bytes" - returns estimated total
183/// number of bytes compaction needs to rewrite to get all levels down
184/// to under target size. Not valid for other compactions than level-
185/// based.
186pub const ESTIMATE_PENDING_COMPACTION_BYTES: &PropName =
187 property!("estimate-pending-compaction-bytes");
188
189/// "rocksdb.aggregated-table-properties" - returns a string representation
190/// of the aggregated table properties of the target column family.
191pub const AGGREGATED_TABLE_PROPERTIES: &PropName = property!("aggregated-table-properties");
192
193/// "rocksdb.aggregated-table-properties-at-`level<N>`", same as the previous
194/// one but only returns the aggregated table properties of the
195/// specified level "N" at the target column family.
196pub fn aggregated_table_properties_at_level(level: usize) -> PropertyName {
197 unsafe { level_property("aggregated-table-properties-at-level", level) }
198}
199
200/// "rocksdb.actual-delayed-write-rate" - returns the current actual delayed
201/// write rate. 0 means no delay.
202pub const ACTUAL_DELAYED_WRITE_RATE: &PropName = property!("actual-delayed-write-rate");
203
204/// "rocksdb.is-write-stopped" - Return 1 if write has been stopped.
205pub const IS_WRITE_STOPPED: &PropName = property!("is-write-stopped");
206
207/// "rocksdb.estimate-oldest-key-time" - returns an estimation of
208/// oldest key timestamp in the DB. Currently only available for
209/// FIFO compaction with
210/// compaction_options_fifo.allow_compaction = false.
211pub const ESTIMATE_OLDEST_KEY_TIME: &PropName = property!("estimate-oldest-key-time");
212
213/// "rocksdb.block-cache-capacity" - returns block cache capacity.
214pub const BLOCK_CACHE_CAPACITY: &PropName = property!("block-cache-capacity");
215
216/// "rocksdb.block-cache-usage" - returns the memory size for the entries
217/// residing in block cache.
218pub const BLOCK_CACHE_USAGE: &PropName = property!("block-cache-usage");
219
220/// "rocksdb.block-cache-pinned-usage" - returns the memory size for the
221/// entries being pinned.
222pub const BLOCK_CACHE_PINNED_USAGE: &PropName = property!("block-cache-pinned-usage");
223
224/// "rocksdb.options-statistics" - returns multi-line string
225/// of options.statistics
226pub const OPTIONS_STATISTICS: &PropName = property!("options-statistics");