@ -294,18 +294,19 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
// We're optimistic, updating the stats before we successfully
// We're optimistic, updating the stats before we successfully
// commit. That lets us release our leader status early.
// commit. That lets us release our leader status early.
auto stats = default_cf_internal_stats_ ;
auto stats = default_cf_internal_stats_ ;
stats - > AddDBStats ( InternalStats : : NUMBER_KEYS_WRITTEN , total_count ,
stats - > AddDBStats ( InternalStats : : kIntStatsNumKeysWritten , total_count ,
concurrent_update ) ;
concurrent_update ) ;
RecordTick ( stats_ , NUMBER_KEYS_WRITTEN , total_count ) ;
RecordTick ( stats_ , NUMBER_KEYS_WRITTEN , total_count ) ;
stats - > AddDBStats ( InternalStats : : BYTES_WRITTEN , total_byte_size ,
stats - > AddDBStats ( InternalStats : : kIntStatsBytesWritten , total_byte_size ,
concurrent_update ) ;
concurrent_update ) ;
RecordTick ( stats_ , BYTES_WRITTEN , total_byte_size ) ;
RecordTick ( stats_ , BYTES_WRITTEN , total_byte_size ) ;
stats - > AddDBStats ( InternalStats : : WRITE_DONE_BY_SELF , 1 , concurrent_update ) ;
stats - > AddDBStats ( InternalStats : : kIntStatsWriteDoneBySelf , 1 ,
concurrent_update ) ;
RecordTick ( stats_ , WRITE_DONE_BY_SELF ) ;
RecordTick ( stats_ , WRITE_DONE_BY_SELF ) ;
auto write_done_by_other = write_group . size - 1 ;
auto write_done_by_other = write_group . size - 1 ;
if ( write_done_by_other > 0 ) {
if ( write_done_by_other > 0 ) {
stats - > AddDBStats ( InternalStats : : WRITE_DONE_BY_OTHER , write_done_by_o ther,
stats - > AddDBStats ( InternalStats : : kIntStatsWriteDoneByO ther,
concurrent_update ) ;
write_done_by_other , concurrent_update ) ;
RecordTick ( stats_ , WRITE_DONE_BY_OTHER , write_done_by_other ) ;
RecordTick ( stats_ , WRITE_DONE_BY_OTHER , write_done_by_other ) ;
}
}
RecordInHistogram ( stats_ , BYTES_PER_WRITE , total_byte_size ) ;
RecordInHistogram ( stats_ , BYTES_PER_WRITE , total_byte_size ) ;
@ -503,9 +504,9 @@ Status DBImpl::PipelinedWriteImpl(const WriteOptions& write_options,
}
}
auto stats = default_cf_internal_stats_ ;
auto stats = default_cf_internal_stats_ ;
stats - > AddDBStats ( InternalStats : : NUMBER_KEYS_WRITTEN , total_count ) ;
stats - > AddDBStats ( InternalStats : : kIntStatsNumKeysWritten , total_count ) ;
RecordTick ( stats_ , NUMBER_KEYS_WRITTEN , total_count ) ;
RecordTick ( stats_ , NUMBER_KEYS_WRITTEN , total_count ) ;
stats - > AddDBStats ( InternalStats : : BYTES_WRITTEN , total_byte_size ) ;
stats - > AddDBStats ( InternalStats : : kIntStatsBytesWritten , total_byte_size ) ;
RecordTick ( stats_ , BYTES_WRITTEN , total_byte_size ) ;
RecordTick ( stats_ , BYTES_WRITTEN , total_byte_size ) ;
RecordInHistogram ( stats_ , BYTES_PER_WRITE , total_byte_size ) ;
RecordInHistogram ( stats_ , BYTES_PER_WRITE , total_byte_size ) ;
@ -513,10 +514,10 @@ Status DBImpl::PipelinedWriteImpl(const WriteOptions& write_options,
if ( w . status . ok ( ) & & ! write_options . disableWAL ) {
if ( w . status . ok ( ) & & ! write_options . disableWAL ) {
PERF_TIMER_GUARD ( write_wal_time ) ;
PERF_TIMER_GUARD ( write_wal_time ) ;
stats - > AddDBStats ( InternalStats : : WRITE_DONE_BY_SELF , 1 ) ;
stats - > AddDBStats ( InternalStats : : kIntStatsWriteDoneBySelf , 1 ) ;
RecordTick ( stats_ , WRITE_DONE_BY_SELF , 1 ) ;
RecordTick ( stats_ , WRITE_DONE_BY_SELF , 1 ) ;
if ( wal_write_group . size > 1 ) {
if ( wal_write_group . size > 1 ) {
stats - > AddDBStats ( InternalStats : : WRITE_DONE_BY_OTHER ,
stats - > AddDBStats ( InternalStats : : kIntStatsWriteDoneByOther ,
wal_write_group . size - 1 ) ;
wal_write_group . size - 1 ) ;
RecordTick ( stats_ , WRITE_DONE_BY_OTHER , wal_write_group . size - 1 ) ;
RecordTick ( stats_ , WRITE_DONE_BY_OTHER , wal_write_group . size - 1 ) ;
}
}
@ -593,7 +594,7 @@ Status DBImpl::UnorderedWriteMemtable(const WriteOptions& write_options,
w . sequence = seq ;
w . sequence = seq ;
size_t total_count = WriteBatchInternal : : Count ( my_batch ) ;
size_t total_count = WriteBatchInternal : : Count ( my_batch ) ;
InternalStats * stats = default_cf_internal_stats_ ;
InternalStats * stats = default_cf_internal_stats_ ;
stats - > AddDBStats ( InternalStats : : NUMBER_KEYS_WRITTEN , total_count ) ;
stats - > AddDBStats ( InternalStats : : kIntStatsNumKeysWritten , total_count ) ;
RecordTick ( stats_ , NUMBER_KEYS_WRITTEN , total_count ) ;
RecordTick ( stats_ , NUMBER_KEYS_WRITTEN , total_count ) ;
ColumnFamilyMemTablesImpl column_family_memtables (
ColumnFamilyMemTablesImpl column_family_memtables (
@ -703,15 +704,16 @@ Status DBImpl::WriteImplWALOnly(
// We're optimistic, updating the stats before we successfully
// We're optimistic, updating the stats before we successfully
// commit. That lets us release our leader status early.
// commit. That lets us release our leader status early.
auto stats = default_cf_internal_stats_ ;
auto stats = default_cf_internal_stats_ ;
stats - > AddDBStats ( InternalStats : : BYTES_WRITTEN , total_byte_size ,
stats - > AddDBStats ( InternalStats : : kIntStatsBytesWritten , total_byte_size ,
concurrent_update ) ;
concurrent_update ) ;
RecordTick ( stats_ , BYTES_WRITTEN , total_byte_size ) ;
RecordTick ( stats_ , BYTES_WRITTEN , total_byte_size ) ;
stats - > AddDBStats ( InternalStats : : WRITE_DONE_BY_SELF , 1 , concurrent_update ) ;
stats - > AddDBStats ( InternalStats : : kIntStatsWriteDoneBySelf , 1 ,
concurrent_update ) ;
RecordTick ( stats_ , WRITE_DONE_BY_SELF ) ;
RecordTick ( stats_ , WRITE_DONE_BY_SELF ) ;
auto write_done_by_other = write_group . size - 1 ;
auto write_done_by_other = write_group . size - 1 ;
if ( write_done_by_other > 0 ) {
if ( write_done_by_other > 0 ) {
stats - > AddDBStats ( InternalStats : : WRITE_DONE_BY_OTHER , write_done_by_o ther,
stats - > AddDBStats ( InternalStats : : kIntStatsWriteDoneByO ther,
concurrent_update ) ;
write_done_by_other , concurrent_update ) ;
RecordTick ( stats_ , WRITE_DONE_BY_OTHER , write_done_by_other ) ;
RecordTick ( stats_ , WRITE_DONE_BY_OTHER , write_done_by_other ) ;
}
}
RecordInHistogram ( stats_ , BYTES_PER_WRITE , total_byte_size ) ;
RecordInHistogram ( stats_ , BYTES_PER_WRITE , total_byte_size ) ;
@ -1043,12 +1045,12 @@ Status DBImpl::WriteToWAL(const WriteThread::WriteGroup& write_group,
if ( status . ok ( ) ) {
if ( status . ok ( ) ) {
auto stats = default_cf_internal_stats_ ;
auto stats = default_cf_internal_stats_ ;
if ( need_log_sync ) {
if ( need_log_sync ) {
stats - > AddDBStats ( InternalStats : : WAL_FILE_SYNCED , 1 ) ;
stats - > AddDBStats ( InternalStats : : kIntStatsWalFileSynced , 1 ) ;
RecordTick ( stats_ , WAL_FILE_SYNCED ) ;
RecordTick ( stats_ , WAL_FILE_SYNCED ) ;
}
}
stats - > AddDBStats ( InternalStats : : WAL_FILE_BYTES , log_size ) ;
stats - > AddDBStats ( InternalStats : : kIntStatsWalFileBytes , log_size ) ;
RecordTick ( stats_ , WAL_FILE_BYTES , log_size ) ;
RecordTick ( stats_ , WAL_FILE_BYTES , log_size ) ;
stats - > AddDBStats ( InternalStats : : WRITE_WITH_WAL , write_with_wal ) ;
stats - > AddDBStats ( InternalStats : : kIntStatsWriteWithWal , write_with_wal ) ;
RecordTick ( stats_ , WRITE_WITH_WAL , write_with_wal ) ;
RecordTick ( stats_ , WRITE_WITH_WAL , write_with_wal ) ;
}
}
return status ;
return status ;
@ -1094,9 +1096,10 @@ Status DBImpl::ConcurrentWriteToWAL(const WriteThread::WriteGroup& write_group,
if ( status . ok ( ) ) {
if ( status . ok ( ) ) {
const bool concurrent = true ;
const bool concurrent = true ;
auto stats = default_cf_internal_stats_ ;
auto stats = default_cf_internal_stats_ ;
stats - > AddDBStats ( InternalStats : : WAL_FILE_BYTES , log_size , concurrent ) ;
stats - > AddDBStats ( InternalStats : : kIntStatsWalFileBytes , log_size ,
concurrent ) ;
RecordTick ( stats_ , WAL_FILE_BYTES , log_size ) ;
RecordTick ( stats_ , WAL_FILE_BYTES , log_size ) ;
stats - > AddDBStats ( InternalStats : : WRITE_WITH_WAL , write_with_wal ,
stats - > AddDBStats ( InternalStats : : kIntStatsWriteWithWal , write_with_wal ,
concurrent ) ;
concurrent ) ;
RecordTick ( stats_ , WRITE_WITH_WAL , write_with_wal ) ;
RecordTick ( stats_ , WRITE_WITH_WAL , write_with_wal ) ;
}
}
@ -1398,8 +1401,8 @@ Status DBImpl::DelayWrite(uint64_t num_bytes,
}
}
assert ( ! delayed | | ! write_options . no_slowdown ) ;
assert ( ! delayed | | ! write_options . no_slowdown ) ;
if ( delayed ) {
if ( delayed ) {
default_cf_internal_stats_ - > AddDBStats ( InternalStats : : WRITE_STALL_MICROS ,
default_cf_internal_stats_ - > AddDBStats (
time_delayed ) ;
InternalStats : : kIntStatsWriteStallMicros , time_delayed ) ;
RecordTick ( stats_ , STALL_MICROS , time_delayed ) ;
RecordTick ( stats_ , STALL_MICROS , time_delayed ) ;
}
}