@ -3,9 +3,10 @@
// LICENSE file in the root directory of this source tree. An additional grant
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
// of patent rights can be found in the PATENTS file in the same directory.
# include "util/thread_status_util.h"
# include "rocksdb/env.h"
# include "rocksdb/env.h"
# include "util/thread_status_updater.h"
# include "util/thread_status_updater.h"
# include "util/thread_status_util.h"
namespace rocksdb {
namespace rocksdb {
@ -33,12 +34,14 @@ void ThreadStatusUtil::UnregisterThread() {
}
}
}
}
void ThreadStatusUtil : : SetColumnFamily ( const ColumnFamilyData * cfd ) {
void ThreadStatusUtil : : SetColumnFamily ( const ColumnFamilyData * cfd ,
if ( ! MaybeInitThreadLocalUpdater ( cfd - > ioptions ( ) - > env ) ) {
const Env * env ,
bool enable_thread_tracking ) {
if ( ! MaybeInitThreadLocalUpdater ( env ) ) {
return ;
return ;
}
}
assert ( thread_updater_local_cache_ ) ;
assert ( thread_updater_local_cache_ ) ;
if ( cfd ! = nullptr & & cfd - > options ( ) - > enable_thread_tracking ) {
if ( cfd ! = nullptr & & enable_thread_tracking ) {
thread_updater_local_cache_ - > SetColumnFamilyInfoKey ( cfd ) ;
thread_updater_local_cache_ - > SetColumnFamilyInfoKey ( cfd ) ;
} else {
} else {
// When cfd == nullptr or enable_thread_tracking == false, we set
// When cfd == nullptr or enable_thread_tracking == false, we set
@ -118,15 +121,17 @@ void ThreadStatusUtil::ResetThreadStatus() {
thread_updater_local_cache_ - > ResetThreadStatus ( ) ;
thread_updater_local_cache_ - > ResetThreadStatus ( ) ;
}
}
void ThreadStatusUtil : : NewColumnFamilyInfo (
void ThreadStatusUtil : : NewColumnFamilyInfo ( const DB * db ,
const DB * db , const ColumnFamilyData * cfd ) {
const ColumnFamilyData * cfd ,
if ( ! MaybeInitThreadLocalUpdater ( cfd - > ioptions ( ) - > env ) ) {
const std : : string & cf_name ,
const Env * env ) {
if ( ! MaybeInitThreadLocalUpdater ( env ) ) {
return ;
return ;
}
}
assert ( thread_updater_local_cache_ ) ;
assert ( thread_updater_local_cache_ ) ;
if ( thread_updater_local_cache_ ) {
if ( thread_updater_local_cache_ ) {
thread_updater_local_cache_ - > NewColumnFamilyInfo (
thread_updater_local_cache_ - > NewColumnFamilyInfo ( db , db - > GetName ( ) , cfd ,
db , db - > GetName ( ) , cfd , cfd - > GetName ( ) ) ;
cf_name ) ;
}
}
}
}
@ -171,8 +176,9 @@ bool ThreadStatusUtil::MaybeInitThreadLocalUpdater(const Env* env) {
return false ;
return false ;
}
}
void ThreadStatusUtil : : SetColumnFamily ( const ColumnFamilyData * cfd ) {
void ThreadStatusUtil : : SetColumnFamily ( const ColumnFamilyData * cfd ,
}
const Env * env ,
bool enable_thread_tracking ) { }
void ThreadStatusUtil : : SetThreadOperation ( ThreadStatus : : OperationType op ) {
void ThreadStatusUtil : : SetThreadOperation ( ThreadStatus : : OperationType op ) {
}
}
@ -188,9 +194,10 @@ void ThreadStatusUtil::IncreaseThreadOperationProperty(
void ThreadStatusUtil : : SetThreadState ( ThreadStatus : : StateType state ) {
void ThreadStatusUtil : : SetThreadState ( ThreadStatus : : StateType state ) {
}
}
void ThreadStatusUtil : : NewColumnFamilyInfo (
void ThreadStatusUtil : : NewColumnFamilyInfo ( const DB * db ,
const DB * db , const ColumnFamilyData * cfd ) {
const ColumnFamilyData * cfd ,
}
const std : : string & cf_name ,
const Env * env ) { }
void ThreadStatusUtil : : EraseColumnFamilyInfo (
void ThreadStatusUtil : : EraseColumnFamilyInfo (
const ColumnFamilyData * cfd ) {
const ColumnFamilyData * cfd ) {