@ -125,9 +125,8 @@ DBPropertyType GetPropertyType(const Slice& property) {
}
}
bool InternalStats : : GetProperty ( DBPropertyType property_type ,
bool InternalStats : : GetProperty ( DBPropertyType property_type ,
const Slice & property , std : : string * value ,
const Slice & property , std : : string * value ) {
ColumnFamilyData * cfd ) {
Version * current = cfd_ - > current ( ) ;
Version * current = cfd - > current ( ) ;
Slice in = property ;
Slice in = property ;
switch ( property_type ) {
switch ( property_type ) {
@ -161,16 +160,16 @@ bool InternalStats::GetProperty(DBPropertyType property_type,
return true ;
return true ;
}
}
case kStats : {
case kStats : {
if ( ! GetProperty ( kCFStats , " rocksdb.cfstats " , value , cfd ) ) {
if ( ! GetProperty ( kCFStats , " rocksdb.cfstats " , value ) ) {
return false ;
return false ;
}
}
if ( ! GetProperty ( kDBStats , " rocksdb.dbstats " , value , cfd ) ) {
if ( ! GetProperty ( kDBStats , " rocksdb.dbstats " , value ) ) {
return false ;
return false ;
}
}
return true ;
return true ;
}
}
case kCFStats : {
case kCFStats : {
DumpCFStats ( value , cfd ) ;
DumpCFStats ( value ) ;
return true ;
return true ;
}
}
case kDBStats : {
case kDBStats : {
@ -181,11 +180,11 @@ bool InternalStats::GetProperty(DBPropertyType property_type,
* value = current - > DebugString ( ) ;
* value = current - > DebugString ( ) ;
return true ;
return true ;
case kNumImmutableMemTable :
case kNumImmutableMemTable :
* value = std : : to_string ( cfd - > imm ( ) - > size ( ) ) ;
* value = std : : to_string ( cfd_ - > imm ( ) - > size ( ) ) ;
return true ;
return true ;
case kMemtableFlushPending :
case kMemtableFlushPending :
// Return number of mem tables that are ready to flush (made immutable)
// Return number of mem tables that are ready to flush (made immutable)
* value = std : : to_string ( cfd - > imm ( ) - > IsFlushPending ( ) ? 1 : 0 ) ;
* value = std : : to_string ( cfd_ - > imm ( ) - > IsFlushPending ( ) ? 1 : 0 ) ;
return true ;
return true ;
case kCompactionPending :
case kCompactionPending :
// 1 if the system already determines at least one compacdtion is needed.
// 1 if the system already determines at least one compacdtion is needed.
@ -198,15 +197,15 @@ bool InternalStats::GetProperty(DBPropertyType property_type,
return true ;
return true ;
case kCurSizeActiveMemTable :
case kCurSizeActiveMemTable :
// Current size of the active memtable
// Current size of the active memtable
* value = std : : to_string ( cfd - > mem ( ) - > ApproximateMemoryUsage ( ) ) ;
* value = std : : to_string ( cfd_ - > mem ( ) - > ApproximateMemoryUsage ( ) ) ;
return true ;
return true ;
case kNumEntriesInMutableMemtable :
case kNumEntriesInMutableMemtable :
// Current size of the active memtable
// Current size of the active memtable
* value = std : : to_string ( cfd - > mem ( ) - > GetNumEntries ( ) ) ;
* value = std : : to_string ( cfd_ - > mem ( ) - > GetNumEntries ( ) ) ;
return true ;
return true ;
case kNumEntriesInImmutableMemtable :
case kNumEntriesInImmutableMemtable :
// Current size of the active memtable
// Current size of the active memtable
* value = std : : to_string ( cfd - > imm ( ) - > current ( ) - > GetTotalNumEntries ( ) ) ;
* value = std : : to_string ( cfd_ - > imm ( ) - > current ( ) - > GetTotalNumEntries ( ) ) ;
return true ;
return true ;
default :
default :
return false ;
return false ;
@ -283,12 +282,12 @@ void InternalStats::DumpDBStats(std::string* value) {
db_stats_snapshot_ . write_with_wal = write_with_wal ;
db_stats_snapshot_ . write_with_wal = write_with_wal ;
}
}
void InternalStats : : DumpCFStats ( std : : string * value , ColumnFamilyData * cfd ) {
void InternalStats : : DumpCFStats ( std : : string * value ) {
Version * current = cfd - > current ( ) ;
Version * current = cfd_ - > current ( ) ;
int num_levels_to_check =
int num_levels_to_check =
( cfd - > options ( ) - > compaction_style ! = kCompactionStyleUniversal & &
( cfd_ - > options ( ) - > compaction_style ! = kCompactionStyleUniversal & &
cfd - > options ( ) - > compaction_style ! = kCompactionStyleFIFO )
cfd_ - > options ( ) - > compaction_style ! = kCompactionStyleFIFO )
? current - > NumberLevels ( ) - 1
? current - > NumberLevels ( ) - 1
: 1 ;
: 1 ;
// Compaction scores are sorted base on its value. Restore them to the
// Compaction scores are sorted base on its value. Restore them to the
@ -310,7 +309,7 @@ void InternalStats::DumpCFStats(std::string* value, ColumnFamilyData* cfd) {
char buf [ 1000 ] ;
char buf [ 1000 ] ;
// Per-ColumnFamily stats
// Per-ColumnFamily stats
PrintLevelStatsHeader ( buf , sizeof ( buf ) , cfd - > GetName ( ) ) ;
PrintLevelStatsHeader ( buf , sizeof ( buf ) , cfd_ - > GetName ( ) ) ;
value - > append ( buf ) ;
value - > append ( buf ) ;
CompactionStats stats_sum ( 0 ) ;
CompactionStats stats_sum ( 0 ) ;