@ -3375,7 +3375,7 @@ Status DBImpl::GetImpl(const ReadOptions& options,
ColumnFamilyHandle * column_family , const Slice & key ,
ColumnFamilyHandle * column_family , const Slice & key ,
std : : string * value , bool * value_found ) {
std : : string * value , bool * value_found ) {
StopWatch sw ( env_ , stats_ , DB_GET ) ;
StopWatch sw ( env_ , stats_ , DB_GET ) ;
PERF_TIMER_AUTO ( get_snapshot_time ) ;
PERF_TIMER_GUARD ( get_snapshot_time ) ;
auto cfh = reinterpret_cast < ColumnFamilyHandleImpl * > ( column_family ) ;
auto cfh = reinterpret_cast < ColumnFamilyHandleImpl * > ( column_family ) ;
auto cfd = cfh - > cfd ( ) ;
auto cfd = cfh - > cfd ( ) ;
@ -3399,6 +3399,7 @@ Status DBImpl::GetImpl(const ReadOptions& options,
// merge_operands will contain the sequence of merges in the latter case.
// merge_operands will contain the sequence of merges in the latter case.
LookupKey lkey ( key , snapshot ) ;
LookupKey lkey ( key , snapshot ) ;
PERF_TIMER_STOP ( get_snapshot_time ) ;
PERF_TIMER_STOP ( get_snapshot_time ) ;
if ( sv - > mem - > Get ( lkey , value , & s , merge_context , * cfd - > options ( ) ) ) {
if ( sv - > mem - > Get ( lkey , value , & s , merge_context , * cfd - > options ( ) ) ) {
// Done
// Done
RecordTick ( stats_ , MEMTABLE_HIT ) ;
RecordTick ( stats_ , MEMTABLE_HIT ) ;
@ -3406,20 +3407,19 @@ Status DBImpl::GetImpl(const ReadOptions& options,
// Done
// Done
RecordTick ( stats_ , MEMTABLE_HIT ) ;
RecordTick ( stats_ , MEMTABLE_HIT ) ;
} else {
} else {
PERF_TIMER_START ( get_from_output_files_time ) ;
PERF_TIMER_GUARD ( get_from_output_files_time ) ;
sv - > current - > Get ( options , lkey , value , & s , & merge_context , value_found ) ;
sv - > current - > Get ( options , lkey , value , & s , & merge_context , value_found ) ;
PERF_TIMER_STOP ( get_from_output_files_time ) ;
RecordTick ( stats_ , MEMTABLE_MISS ) ;
RecordTick ( stats_ , MEMTABLE_MISS ) ;
}
}
PERF_TIMER_START ( get_post_process_time ) ;
{
PERF_TIMER_GUARD ( get_post_process_time ) ;
ReturnAndCleanupSuperVersion ( cfd , sv ) ;
ReturnAndCleanupSuperVersion ( cfd , sv ) ;
RecordTick ( stats_ , NUMBER_KEYS_READ ) ;
RecordTick ( stats_ , NUMBER_KEYS_READ ) ;
RecordTick ( stats_ , BYTES_READ , value - > size ( ) ) ;
RecordTick ( stats_ , BYTES_READ , value - > size ( ) ) ;
PERF_TIMER_STOP ( get_post_process_time ) ;
}
return s ;
return s ;
}
}
@ -3429,7 +3429,7 @@ std::vector<Status> DBImpl::MultiGet(
const std : : vector < Slice > & keys , std : : vector < std : : string > * values ) {
const std : : vector < Slice > & keys , std : : vector < std : : string > * values ) {
StopWatch sw ( env_ , stats_ , DB_MULTIGET ) ;
StopWatch sw ( env_ , stats_ , DB_MULTIGET ) ;
PERF_TIMER_AUTO ( get_snapshot_time ) ;
PERF_TIMER_GUARD ( get_snapshot_time ) ;
SequenceNumber snapshot ;
SequenceNumber snapshot ;
@ -3505,7 +3505,7 @@ std::vector<Status> DBImpl::MultiGet(
}
}
// Post processing (decrement reference counts and record statistics)
// Post processing (decrement reference counts and record statistics)
PERF_TIMER_START ( get_post_process_time ) ;
PERF_TIMER_GUARD ( get_post_process_time ) ;
autovector < SuperVersion * > superversions_to_delete ;
autovector < SuperVersion * > superversions_to_delete ;
// TODO(icanadi) do we need lock here or just around Cleanup()?
// TODO(icanadi) do we need lock here or just around Cleanup()?
@ -3878,7 +3878,7 @@ Status DBImpl::Write(const WriteOptions& options, WriteBatch* my_batch) {
if ( my_batch = = nullptr ) {
if ( my_batch = = nullptr ) {
return Status : : Corruption ( " Batch is nullptr! " ) ;
return Status : : Corruption ( " Batch is nullptr! " ) ;
}
}
PERF_TIMER_AUTO ( write_pre_and_post_process_time ) ;
PERF_TIMER_GUARD ( write_pre_and_post_process_time ) ;
Writer w ( & mutex_ ) ;
Writer w ( & mutex_ ) ;
w . batch = my_batch ;
w . batch = my_batch ;
w . sync = options . sync ;
w . sync = options . sync ;
@ -4011,7 +4011,7 @@ Status DBImpl::Write(const WriteOptions& options, WriteBatch* my_batch) {
uint64_t log_size = 0 ;
uint64_t log_size = 0 ;
if ( ! options . disableWAL ) {
if ( ! options . disableWAL ) {
PERF_TIMER_START ( write_wal_time ) ;
PERF_TIMER_GUARD ( write_wal_time ) ;
Slice log_entry = WriteBatchInternal : : Contents ( updates ) ;
Slice log_entry = WriteBatchInternal : : Contents ( updates ) ;
status = log_ - > AddRecord ( log_entry ) ;
status = log_ - > AddRecord ( log_entry ) ;
total_log_size_ + = log_entry . size ( ) ;
total_log_size_ + = log_entry . size ( ) ;
@ -4029,10 +4029,9 @@ Status DBImpl::Write(const WriteOptions& options, WriteBatch* my_batch) {
status = log_ - > file ( ) - > Sync ( ) ;
status = log_ - > file ( ) - > Sync ( ) ;
}
}
}
}
PERF_TIMER_STOP ( write_wal_time ) ;
}
}
if ( status . ok ( ) ) {
if ( status . ok ( ) ) {
PERF_TIMER_START ( write_memtable_time ) ;
PERF_TIMER_GUARD ( write_memtable_time ) ;
status = WriteBatchInternal : : InsertInto (
status = WriteBatchInternal : : InsertInto (
updates , column_family_memtables_ . get ( ) , false , 0 , this , false ) ;
updates , column_family_memtables_ . get ( ) , false , 0 , this , false ) ;
@ -4044,8 +4043,6 @@ Status DBImpl::Write(const WriteOptions& options, WriteBatch* my_batch) {
// into the memtable would result in a state that some write ops might
// into the memtable would result in a state that some write ops might
// have succeeded in memtable but Status reports error for all writes.
// have succeeded in memtable but Status reports error for all writes.
PERF_TIMER_STOP ( write_memtable_time ) ;
SetTickerCount ( stats_ , SEQUENCE_NUMBER , last_sequence ) ;
SetTickerCount ( stats_ , SEQUENCE_NUMBER , last_sequence ) ;
}
}
PERF_TIMER_START ( write_pre_and_post_process_time ) ;
PERF_TIMER_START ( write_pre_and_post_process_time ) ;
@ -4079,7 +4076,6 @@ Status DBImpl::Write(const WriteOptions& options, WriteBatch* my_batch) {
RecordTick ( stats_ , WRITE_TIMEDOUT ) ;
RecordTick ( stats_ , WRITE_TIMEDOUT ) ;
}
}
PERF_TIMER_STOP ( write_pre_and_post_process_time ) ;
return status ;
return status ;
}
}