]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/db/internal_stats.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / rocksdb / db / internal_stats.h
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
5 //
6 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
7 // Use of this source code is governed by a BSD-style license that can be
8 // found in the LICENSE file. See the AUTHORS file for names of contributors.
9 //
10
11 #pragma once
12 #include <map>
13 #include <string>
14 #include <vector>
15
16 #include "db/version_set.h"
17
18 class ColumnFamilyData;
19
20 namespace ROCKSDB_NAMESPACE {
21
22 class DBImpl;
23 class MemTableList;
24
25 // Config for retrieving a property's value.
26 struct DBPropertyInfo {
27 bool need_out_of_mutex;
28
29 // gcc had an internal error for initializing union of pointer-to-member-
30 // functions. Workaround is to populate exactly one of the following function
31 // pointers with a non-nullptr value.
32
33 // @param value Value-result argument for storing the property's string value
34 // @param suffix Argument portion of the property. For example, suffix would
35 // be "5" for the property "rocksdb.num-files-at-level5". So far, only
36 // certain string properties take an argument.
37 bool (InternalStats::*handle_string)(std::string* value, Slice suffix);
38
39 // @param value Value-result argument for storing the property's uint64 value
40 // @param db Many of the int properties rely on DBImpl methods.
41 // @param version Version is needed in case the property is retrieved without
42 // holding db mutex, which is only supported for int properties.
43 bool (InternalStats::*handle_int)(uint64_t* value, DBImpl* db,
44 Version* version);
45
46 // @param props Map of general properties to populate
47 bool (InternalStats::*handle_map)(std::map<std::string, std::string>* props);
48
49 // handle the string type properties rely on DBImpl methods
50 // @param value Value-result argument for storing the property's string value
51 bool (DBImpl::*handle_string_dbimpl)(std::string* value);
52 };
53
54 extern const DBPropertyInfo* GetPropertyInfo(const Slice& property);
55
56 #ifndef ROCKSDB_LITE
57 #undef SCORE
58 enum class LevelStatType {
59 INVALID = 0,
60 NUM_FILES,
61 COMPACTED_FILES,
62 SIZE_BYTES,
63 SCORE,
64 READ_GB,
65 RN_GB,
66 RNP1_GB,
67 WRITE_GB,
68 W_NEW_GB,
69 MOVED_GB,
70 WRITE_AMP,
71 READ_MBPS,
72 WRITE_MBPS,
73 COMP_SEC,
74 COMP_CPU_SEC,
75 COMP_COUNT,
76 AVG_SEC,
77 KEY_IN,
78 KEY_DROP,
79 TOTAL // total number of types
80 };
81
82 struct LevelStat {
83 // This what will be L?.property_name in the flat map returned to the user
84 std::string property_name;
85 // This will be what we will print in the header in the cli
86 std::string header_name;
87 };
88
89 class InternalStats {
90 public:
91 static const std::map<LevelStatType, LevelStat> compaction_level_stats;
92
93 enum InternalCFStatsType {
94 L0_FILE_COUNT_LIMIT_SLOWDOWNS,
95 LOCKED_L0_FILE_COUNT_LIMIT_SLOWDOWNS,
96 MEMTABLE_LIMIT_STOPS,
97 MEMTABLE_LIMIT_SLOWDOWNS,
98 L0_FILE_COUNT_LIMIT_STOPS,
99 LOCKED_L0_FILE_COUNT_LIMIT_STOPS,
100 PENDING_COMPACTION_BYTES_LIMIT_SLOWDOWNS,
101 PENDING_COMPACTION_BYTES_LIMIT_STOPS,
102 WRITE_STALLS_ENUM_MAX,
103 BYTES_FLUSHED,
104 BYTES_INGESTED_ADD_FILE,
105 INGESTED_NUM_FILES_TOTAL,
106 INGESTED_LEVEL0_NUM_FILES_TOTAL,
107 INGESTED_NUM_KEYS_TOTAL,
108 INTERNAL_CF_STATS_ENUM_MAX,
109 };
110
111 enum InternalDBStatsType {
112 kIntStatsWalFileBytes,
113 kIntStatsWalFileSynced,
114 kIntStatsBytesWritten,
115 kIntStatsNumKeysWritten,
116 kIntStatsWriteDoneByOther,
117 kIntStatsWriteDoneBySelf,
118 kIntStatsWriteWithWal,
119 kIntStatsWriteStallMicros,
120 kIntStatsNumMax,
121 };
122
123 InternalStats(int num_levels, Env* env, ColumnFamilyData* cfd)
124 : db_stats_{},
125 cf_stats_value_{},
126 cf_stats_count_{},
127 comp_stats_(num_levels),
128 comp_stats_by_pri_(Env::Priority::TOTAL),
129 file_read_latency_(num_levels),
130 bg_error_count_(0),
131 number_levels_(num_levels),
132 env_(env),
133 cfd_(cfd),
134 started_at_(env->NowMicros()) {}
135
136 // Per level compaction stats. comp_stats_[level] stores the stats for
137 // compactions that produced data for the specified "level".
138 struct CompactionStats {
139 uint64_t micros;
140 uint64_t cpu_micros;
141
142 // The number of bytes read from all non-output levels
143 uint64_t bytes_read_non_output_levels;
144
145 // The number of bytes read from the compaction output level.
146 uint64_t bytes_read_output_level;
147
148 // Total number of bytes written during compaction
149 uint64_t bytes_written;
150
151 // Total number of bytes moved to the output level
152 uint64_t bytes_moved;
153
154 // The number of compaction input files in all non-output levels.
155 int num_input_files_in_non_output_levels;
156
157 // The number of compaction input files in the output level.
158 int num_input_files_in_output_level;
159
160 // The number of compaction output files.
161 int num_output_files;
162
163 // Total incoming entries during compaction between levels N and N+1
164 uint64_t num_input_records;
165
166 // Accumulated diff number of entries
167 // (num input entries - num output entires) for compaction levels N and N+1
168 uint64_t num_dropped_records;
169
170 // Number of compactions done
171 int count;
172
173 // Number of compactions done per CompactionReason
174 int counts[static_cast<int>(CompactionReason::kNumOfReasons)];
175
176 explicit CompactionStats()
177 : micros(0),
178 cpu_micros(0),
179 bytes_read_non_output_levels(0),
180 bytes_read_output_level(0),
181 bytes_written(0),
182 bytes_moved(0),
183 num_input_files_in_non_output_levels(0),
184 num_input_files_in_output_level(0),
185 num_output_files(0),
186 num_input_records(0),
187 num_dropped_records(0),
188 count(0) {
189 int num_of_reasons = static_cast<int>(CompactionReason::kNumOfReasons);
190 for (int i = 0; i < num_of_reasons; i++) {
191 counts[i] = 0;
192 }
193 }
194
195 explicit CompactionStats(CompactionReason reason, int c)
196 : micros(0),
197 cpu_micros(0),
198 bytes_read_non_output_levels(0),
199 bytes_read_output_level(0),
200 bytes_written(0),
201 bytes_moved(0),
202 num_input_files_in_non_output_levels(0),
203 num_input_files_in_output_level(0),
204 num_output_files(0),
205 num_input_records(0),
206 num_dropped_records(0),
207 count(c) {
208 int num_of_reasons = static_cast<int>(CompactionReason::kNumOfReasons);
209 for (int i = 0; i < num_of_reasons; i++) {
210 counts[i] = 0;
211 }
212 int r = static_cast<int>(reason);
213 if (r >= 0 && r < num_of_reasons) {
214 counts[r] = c;
215 } else {
216 count = 0;
217 }
218 }
219
220 explicit CompactionStats(const CompactionStats& c)
221 : micros(c.micros),
222 cpu_micros(c.cpu_micros),
223 bytes_read_non_output_levels(c.bytes_read_non_output_levels),
224 bytes_read_output_level(c.bytes_read_output_level),
225 bytes_written(c.bytes_written),
226 bytes_moved(c.bytes_moved),
227 num_input_files_in_non_output_levels(
228 c.num_input_files_in_non_output_levels),
229 num_input_files_in_output_level(c.num_input_files_in_output_level),
230 num_output_files(c.num_output_files),
231 num_input_records(c.num_input_records),
232 num_dropped_records(c.num_dropped_records),
233 count(c.count) {
234 int num_of_reasons = static_cast<int>(CompactionReason::kNumOfReasons);
235 for (int i = 0; i < num_of_reasons; i++) {
236 counts[i] = c.counts[i];
237 }
238 }
239
240 CompactionStats& operator=(const CompactionStats& c) {
241 micros = c.micros;
242 cpu_micros = c.cpu_micros;
243 bytes_read_non_output_levels = c.bytes_read_non_output_levels;
244 bytes_read_output_level = c.bytes_read_output_level;
245 bytes_written = c.bytes_written;
246 bytes_moved = c.bytes_moved;
247 num_input_files_in_non_output_levels =
248 c.num_input_files_in_non_output_levels;
249 num_input_files_in_output_level = c.num_input_files_in_output_level;
250 num_output_files = c.num_output_files;
251 num_input_records = c.num_input_records;
252 num_dropped_records = c.num_dropped_records;
253 count = c.count;
254
255 int num_of_reasons = static_cast<int>(CompactionReason::kNumOfReasons);
256 for (int i = 0; i < num_of_reasons; i++) {
257 counts[i] = c.counts[i];
258 }
259 return *this;
260 }
261
262 void Clear() {
263 this->micros = 0;
264 this->cpu_micros = 0;
265 this->bytes_read_non_output_levels = 0;
266 this->bytes_read_output_level = 0;
267 this->bytes_written = 0;
268 this->bytes_moved = 0;
269 this->num_input_files_in_non_output_levels = 0;
270 this->num_input_files_in_output_level = 0;
271 this->num_output_files = 0;
272 this->num_input_records = 0;
273 this->num_dropped_records = 0;
274 this->count = 0;
275 int num_of_reasons = static_cast<int>(CompactionReason::kNumOfReasons);
276 for (int i = 0; i < num_of_reasons; i++) {
277 counts[i] = 0;
278 }
279 }
280
281 void Add(const CompactionStats& c) {
282 this->micros += c.micros;
283 this->cpu_micros += c.cpu_micros;
284 this->bytes_read_non_output_levels += c.bytes_read_non_output_levels;
285 this->bytes_read_output_level += c.bytes_read_output_level;
286 this->bytes_written += c.bytes_written;
287 this->bytes_moved += c.bytes_moved;
288 this->num_input_files_in_non_output_levels +=
289 c.num_input_files_in_non_output_levels;
290 this->num_input_files_in_output_level +=
291 c.num_input_files_in_output_level;
292 this->num_output_files += c.num_output_files;
293 this->num_input_records += c.num_input_records;
294 this->num_dropped_records += c.num_dropped_records;
295 this->count += c.count;
296 int num_of_reasons = static_cast<int>(CompactionReason::kNumOfReasons);
297 for (int i = 0; i< num_of_reasons; i++) {
298 counts[i] += c.counts[i];
299 }
300 }
301
302 void Subtract(const CompactionStats& c) {
303 this->micros -= c.micros;
304 this->cpu_micros -= c.cpu_micros;
305 this->bytes_read_non_output_levels -= c.bytes_read_non_output_levels;
306 this->bytes_read_output_level -= c.bytes_read_output_level;
307 this->bytes_written -= c.bytes_written;
308 this->bytes_moved -= c.bytes_moved;
309 this->num_input_files_in_non_output_levels -=
310 c.num_input_files_in_non_output_levels;
311 this->num_input_files_in_output_level -=
312 c.num_input_files_in_output_level;
313 this->num_output_files -= c.num_output_files;
314 this->num_input_records -= c.num_input_records;
315 this->num_dropped_records -= c.num_dropped_records;
316 this->count -= c.count;
317 int num_of_reasons = static_cast<int>(CompactionReason::kNumOfReasons);
318 for (int i = 0; i < num_of_reasons; i++) {
319 counts[i] -= c.counts[i];
320 }
321 }
322 };
323
324 void Clear() {
325 for (int i = 0; i < kIntStatsNumMax; i++) {
326 db_stats_[i].store(0);
327 }
328 for (int i = 0; i < INTERNAL_CF_STATS_ENUM_MAX; i++) {
329 cf_stats_count_[i] = 0;
330 cf_stats_value_[i] = 0;
331 }
332 for (auto& comp_stat : comp_stats_) {
333 comp_stat.Clear();
334 }
335 for (auto& h : file_read_latency_) {
336 h.Clear();
337 }
338 blob_file_read_latency_.Clear();
339 cf_stats_snapshot_.Clear();
340 db_stats_snapshot_.Clear();
341 bg_error_count_ = 0;
342 started_at_ = env_->NowMicros();
343 }
344
345 void AddCompactionStats(int level, Env::Priority thread_pri,
346 const CompactionStats& stats) {
347 comp_stats_[level].Add(stats);
348 comp_stats_by_pri_[thread_pri].Add(stats);
349 }
350
351 void IncBytesMoved(int level, uint64_t amount) {
352 comp_stats_[level].bytes_moved += amount;
353 }
354
355 void AddCFStats(InternalCFStatsType type, uint64_t value) {
356 cf_stats_value_[type] += value;
357 ++cf_stats_count_[type];
358 }
359
360 void AddDBStats(InternalDBStatsType type, uint64_t value,
361 bool concurrent = false) {
362 auto& v = db_stats_[type];
363 if (concurrent) {
364 v.fetch_add(value, std::memory_order_relaxed);
365 } else {
366 v.store(v.load(std::memory_order_relaxed) + value,
367 std::memory_order_relaxed);
368 }
369 }
370
371 uint64_t GetDBStats(InternalDBStatsType type) {
372 return db_stats_[type].load(std::memory_order_relaxed);
373 }
374
375 HistogramImpl* GetFileReadHist(int level) {
376 return &file_read_latency_[level];
377 }
378
379 HistogramImpl* GetBlobFileReadHist() { return &blob_file_read_latency_; }
380
381 uint64_t GetBackgroundErrorCount() const { return bg_error_count_; }
382
383 uint64_t BumpAndGetBackgroundErrorCount() { return ++bg_error_count_; }
384
385 bool GetStringProperty(const DBPropertyInfo& property_info,
386 const Slice& property, std::string* value);
387
388 bool GetMapProperty(const DBPropertyInfo& property_info,
389 const Slice& property,
390 std::map<std::string, std::string>* value);
391
392 bool GetIntProperty(const DBPropertyInfo& property_info, uint64_t* value,
393 DBImpl* db);
394
395 bool GetIntPropertyOutOfMutex(const DBPropertyInfo& property_info,
396 Version* version, uint64_t* value);
397
398 const uint64_t* TEST_GetCFStatsValue() const { return cf_stats_value_; }
399
400 const std::vector<CompactionStats>& TEST_GetCompactionStats() const {
401 return comp_stats_;
402 }
403
404 // Store a mapping from the user-facing DB::Properties string to our
405 // DBPropertyInfo struct used internally for retrieving properties.
406 static const std::unordered_map<std::string, DBPropertyInfo> ppt_name_to_info;
407
408 private:
409 void DumpDBStats(std::string* value);
410 void DumpCFMapStats(std::map<std::string, std::string>* cf_stats);
411 void DumpCFMapStats(
412 std::map<int, std::map<LevelStatType, double>>* level_stats,
413 CompactionStats* compaction_stats_sum);
414 void DumpCFMapStatsByPriority(
415 std::map<int, std::map<LevelStatType, double>>* priorities_stats);
416 void DumpCFMapStatsIOStalls(std::map<std::string, std::string>* cf_stats);
417 void DumpCFStats(std::string* value);
418 void DumpCFStatsNoFileHistogram(std::string* value);
419 void DumpCFFileHistogram(std::string* value);
420
421 bool HandleBlockCacheStat(Cache** block_cache);
422
423 // Per-DB stats
424 std::atomic<uint64_t> db_stats_[kIntStatsNumMax];
425 // Per-ColumnFamily stats
426 uint64_t cf_stats_value_[INTERNAL_CF_STATS_ENUM_MAX];
427 uint64_t cf_stats_count_[INTERNAL_CF_STATS_ENUM_MAX];
428 // Per-ColumnFamily/level compaction stats
429 std::vector<CompactionStats> comp_stats_;
430 std::vector<CompactionStats> comp_stats_by_pri_;
431 std::vector<HistogramImpl> file_read_latency_;
432 HistogramImpl blob_file_read_latency_;
433
434 // Used to compute per-interval statistics
435 struct CFStatsSnapshot {
436 // ColumnFamily-level stats
437 CompactionStats comp_stats;
438 uint64_t ingest_bytes_flush; // Bytes written to L0 (Flush)
439 uint64_t stall_count; // Stall count
440 // Stats from compaction jobs - bytes written, bytes read, duration.
441 uint64_t compact_bytes_write;
442 uint64_t compact_bytes_read;
443 uint64_t compact_micros;
444 double seconds_up;
445
446 // AddFile specific stats
447 uint64_t ingest_bytes_addfile; // Total Bytes ingested
448 uint64_t ingest_files_addfile; // Total number of files ingested
449 uint64_t ingest_l0_files_addfile; // Total number of files ingested to L0
450 uint64_t ingest_keys_addfile; // Total number of keys ingested
451
452 CFStatsSnapshot()
453 : ingest_bytes_flush(0),
454 stall_count(0),
455 compact_bytes_write(0),
456 compact_bytes_read(0),
457 compact_micros(0),
458 seconds_up(0),
459 ingest_bytes_addfile(0),
460 ingest_files_addfile(0),
461 ingest_l0_files_addfile(0),
462 ingest_keys_addfile(0) {}
463
464 void Clear() {
465 comp_stats.Clear();
466 ingest_bytes_flush = 0;
467 stall_count = 0;
468 compact_bytes_write = 0;
469 compact_bytes_read = 0;
470 compact_micros = 0;
471 seconds_up = 0;
472 ingest_bytes_addfile = 0;
473 ingest_files_addfile = 0;
474 ingest_l0_files_addfile = 0;
475 ingest_keys_addfile = 0;
476 }
477 } cf_stats_snapshot_;
478
479 struct DBStatsSnapshot {
480 // DB-level stats
481 uint64_t ingest_bytes; // Bytes written by user
482 uint64_t wal_bytes; // Bytes written to WAL
483 uint64_t wal_synced; // Number of times WAL is synced
484 uint64_t write_with_wal; // Number of writes that request WAL
485 // These count the number of writes processed by the calling thread or
486 // another thread.
487 uint64_t write_other;
488 uint64_t write_self;
489 // Total number of keys written. write_self and write_other measure number
490 // of write requests written, Each of the write request can contain updates
491 // to multiple keys. num_keys_written is total number of keys updated by all
492 // those writes.
493 uint64_t num_keys_written;
494 // Total time writes delayed by stalls.
495 uint64_t write_stall_micros;
496 double seconds_up;
497
498 DBStatsSnapshot()
499 : ingest_bytes(0),
500 wal_bytes(0),
501 wal_synced(0),
502 write_with_wal(0),
503 write_other(0),
504 write_self(0),
505 num_keys_written(0),
506 write_stall_micros(0),
507 seconds_up(0) {}
508
509 void Clear() {
510 ingest_bytes = 0;
511 wal_bytes = 0;
512 wal_synced = 0;
513 write_with_wal = 0;
514 write_other = 0;
515 write_self = 0;
516 num_keys_written = 0;
517 write_stall_micros = 0;
518 seconds_up = 0;
519 }
520 } db_stats_snapshot_;
521
522 // Handler functions for getting property values. They use "value" as a value-
523 // result argument, and return true upon successfully setting "value".
524 bool HandleNumFilesAtLevel(std::string* value, Slice suffix);
525 bool HandleCompressionRatioAtLevelPrefix(std::string* value, Slice suffix);
526 bool HandleLevelStats(std::string* value, Slice suffix);
527 bool HandleStats(std::string* value, Slice suffix);
528 bool HandleCFMapStats(std::map<std::string, std::string>* compaction_stats);
529 bool HandleCFStats(std::string* value, Slice suffix);
530 bool HandleCFStatsNoFileHistogram(std::string* value, Slice suffix);
531 bool HandleCFFileHistogram(std::string* value, Slice suffix);
532 bool HandleDBStats(std::string* value, Slice suffix);
533 bool HandleSsTables(std::string* value, Slice suffix);
534 bool HandleAggregatedTableProperties(std::string* value, Slice suffix);
535 bool HandleAggregatedTablePropertiesAtLevel(std::string* value, Slice suffix);
536 bool HandleNumImmutableMemTable(uint64_t* value, DBImpl* db,
537 Version* version);
538 bool HandleNumImmutableMemTableFlushed(uint64_t* value, DBImpl* db,
539 Version* version);
540 bool HandleMemTableFlushPending(uint64_t* value, DBImpl* db,
541 Version* version);
542 bool HandleNumRunningFlushes(uint64_t* value, DBImpl* db, Version* version);
543 bool HandleCompactionPending(uint64_t* value, DBImpl* db, Version* version);
544 bool HandleNumRunningCompactions(uint64_t* value, DBImpl* db,
545 Version* version);
546 bool HandleBackgroundErrors(uint64_t* value, DBImpl* db, Version* version);
547 bool HandleCurSizeActiveMemTable(uint64_t* value, DBImpl* db,
548 Version* version);
549 bool HandleCurSizeAllMemTables(uint64_t* value, DBImpl* db, Version* version);
550 bool HandleSizeAllMemTables(uint64_t* value, DBImpl* db, Version* version);
551 bool HandleNumEntriesActiveMemTable(uint64_t* value, DBImpl* db,
552 Version* version);
553 bool HandleNumEntriesImmMemTables(uint64_t* value, DBImpl* db,
554 Version* version);
555 bool HandleNumDeletesActiveMemTable(uint64_t* value, DBImpl* db,
556 Version* version);
557 bool HandleNumDeletesImmMemTables(uint64_t* value, DBImpl* db,
558 Version* version);
559 bool HandleEstimateNumKeys(uint64_t* value, DBImpl* db, Version* version);
560 bool HandleNumSnapshots(uint64_t* value, DBImpl* db, Version* version);
561 bool HandleOldestSnapshotTime(uint64_t* value, DBImpl* db, Version* version);
562 bool HandleOldestSnapshotSequence(uint64_t* value, DBImpl* db,
563 Version* version);
564 bool HandleNumLiveVersions(uint64_t* value, DBImpl* db, Version* version);
565 bool HandleCurrentSuperVersionNumber(uint64_t* value, DBImpl* db,
566 Version* version);
567 bool HandleIsFileDeletionsEnabled(uint64_t* value, DBImpl* db,
568 Version* version);
569 bool HandleBaseLevel(uint64_t* value, DBImpl* db, Version* version);
570 bool HandleTotalSstFilesSize(uint64_t* value, DBImpl* db, Version* version);
571 bool HandleLiveSstFilesSize(uint64_t* value, DBImpl* db, Version* version);
572 bool HandleEstimatePendingCompactionBytes(uint64_t* value, DBImpl* db,
573 Version* version);
574 bool HandleEstimateTableReadersMem(uint64_t* value, DBImpl* db,
575 Version* version);
576 bool HandleEstimateLiveDataSize(uint64_t* value, DBImpl* db,
577 Version* version);
578 bool HandleMinLogNumberToKeep(uint64_t* value, DBImpl* db, Version* version);
579 bool HandleMinObsoleteSstNumberToKeep(uint64_t* value, DBImpl* db,
580 Version* version);
581 bool HandleActualDelayedWriteRate(uint64_t* value, DBImpl* db,
582 Version* version);
583 bool HandleIsWriteStopped(uint64_t* value, DBImpl* db, Version* version);
584 bool HandleEstimateOldestKeyTime(uint64_t* value, DBImpl* db,
585 Version* version);
586 bool HandleBlockCacheCapacity(uint64_t* value, DBImpl* db, Version* version);
587 bool HandleBlockCacheUsage(uint64_t* value, DBImpl* db, Version* version);
588 bool HandleBlockCachePinnedUsage(uint64_t* value, DBImpl* db,
589 Version* version);
590 // Total number of background errors encountered. Every time a flush task
591 // or compaction task fails, this counter is incremented. The failure can
592 // be caused by any possible reason, including file system errors, out of
593 // resources, or input file corruption. Failing when retrying the same flush
594 // or compaction will cause the counter to increase too.
595 uint64_t bg_error_count_;
596
597 const int number_levels_;
598 Env* env_;
599 ColumnFamilyData* cfd_;
600 uint64_t started_at_;
601 };
602
603 #else
604
605 class InternalStats {
606 public:
607 enum InternalCFStatsType {
608 L0_FILE_COUNT_LIMIT_SLOWDOWNS,
609 LOCKED_L0_FILE_COUNT_LIMIT_SLOWDOWNS,
610 MEMTABLE_LIMIT_STOPS,
611 MEMTABLE_LIMIT_SLOWDOWNS,
612 L0_FILE_COUNT_LIMIT_STOPS,
613 LOCKED_L0_FILE_COUNT_LIMIT_STOPS,
614 PENDING_COMPACTION_BYTES_LIMIT_SLOWDOWNS,
615 PENDING_COMPACTION_BYTES_LIMIT_STOPS,
616 WRITE_STALLS_ENUM_MAX,
617 BYTES_FLUSHED,
618 BYTES_INGESTED_ADD_FILE,
619 INGESTED_NUM_FILES_TOTAL,
620 INGESTED_LEVEL0_NUM_FILES_TOTAL,
621 INGESTED_NUM_KEYS_TOTAL,
622 INTERNAL_CF_STATS_ENUM_MAX,
623 };
624
625 enum InternalDBStatsType {
626 kIntStatsWalFileBytes,
627 kIntStatsWalFileSynced,
628 kIntStatsBytesWritten,
629 kIntStatsNumKeysWritten,
630 kIntStatsWriteDoneByOther,
631 kIntStatsWriteDoneBySelf,
632 kIntStatsWriteWithWal,
633 kIntStatsWriteStallMicros,
634 kIntStatsNumMax,
635 };
636
637 InternalStats(int /*num_levels*/, Env* /*env*/, ColumnFamilyData* /*cfd*/) {}
638
639 struct CompactionStats {
640 uint64_t micros;
641 uint64_t cpu_micros;
642 uint64_t bytes_read_non_output_levels;
643 uint64_t bytes_read_output_level;
644 uint64_t bytes_written;
645 uint64_t bytes_moved;
646 int num_input_files_in_non_output_levels;
647 int num_input_files_in_output_level;
648 int num_output_files;
649 uint64_t num_input_records;
650 uint64_t num_dropped_records;
651 int count;
652
653 explicit CompactionStats() {}
654
655 explicit CompactionStats(CompactionReason /*reason*/, int /*c*/) {}
656
657 explicit CompactionStats(const CompactionStats& /*c*/) {}
658
659 void Add(const CompactionStats& /*c*/) {}
660
661 void Subtract(const CompactionStats& /*c*/) {}
662 };
663
664 void AddCompactionStats(int /*level*/, Env::Priority /*thread_pri*/,
665 const CompactionStats& /*stats*/) {}
666
667 void IncBytesMoved(int /*level*/, uint64_t /*amount*/) {}
668
669 void AddCFStats(InternalCFStatsType /*type*/, uint64_t /*value*/) {}
670
671 void AddDBStats(InternalDBStatsType /*type*/, uint64_t /*value*/,
672 bool /*concurrent */ = false) {}
673
674 HistogramImpl* GetFileReadHist(int /*level*/) { return nullptr; }
675
676 HistogramImpl* GetBlobFileReadHist() { return nullptr; }
677
678 uint64_t GetBackgroundErrorCount() const { return 0; }
679
680 uint64_t BumpAndGetBackgroundErrorCount() { return 0; }
681
682 bool GetStringProperty(const DBPropertyInfo& /*property_info*/,
683 const Slice& /*property*/, std::string* /*value*/) {
684 return false;
685 }
686
687 bool GetMapProperty(const DBPropertyInfo& /*property_info*/,
688 const Slice& /*property*/,
689 std::map<std::string, std::string>* /*value*/) {
690 return false;
691 }
692
693 bool GetIntProperty(const DBPropertyInfo& /*property_info*/, uint64_t* /*value*/,
694 DBImpl* /*db*/) const {
695 return false;
696 }
697
698 bool GetIntPropertyOutOfMutex(const DBPropertyInfo& /*property_info*/,
699 Version* /*version*/, uint64_t* /*value*/) const {
700 return false;
701 }
702 };
703 #endif // !ROCKSDB_LITE
704
705 } // namespace ROCKSDB_NAMESPACE