mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
[RocksDB] Use raw pointer instead of shared pointer when passing Statistics object internally
Summary: liveness of the statistics object is already ensured by the shared pointer in DB options. There's no reason to pass again shared pointer among internal functions. Raw pointer is sufficient and efficient. Test Plan: make check Reviewers: dhruba, MarkCallaghan, igor Reviewed By: dhruba CC: leveldb, reconnect.grayhat Differential Revision: https://reviews.facebook.net/D14289
This commit is contained in:
@@ -290,7 +290,7 @@ struct Saver {
|
||||
std::deque<std::string>* merge_operands; // the merge operations encountered
|
||||
Logger* logger;
|
||||
bool didIO; // did we do any disk io?
|
||||
shared_ptr<Statistics> statistics;
|
||||
Statistics* statistics;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ void Version::Get(const ReadOptions& options,
|
||||
saver.merge_operands = operands;
|
||||
saver.logger = logger.get();
|
||||
saver.didIO = false;
|
||||
saver.statistics = db_options.statistics;
|
||||
saver.statistics = db_options.statistics.get();
|
||||
|
||||
stats->seek_file = nullptr;
|
||||
stats->seek_file_level = -1;
|
||||
@@ -566,7 +566,7 @@ void Version::Get(const ReadOptions& options,
|
||||
value, logger.get())) {
|
||||
*status = Status::OK();
|
||||
} else {
|
||||
RecordTick(db_options.statistics, NUMBER_MERGE_FAILURES);
|
||||
RecordTick(db_options.statistics.get(), NUMBER_MERGE_FAILURES);
|
||||
*status = Status::Corruption("could not perform end-of-key merge for ",
|
||||
user_key);
|
||||
}
|
||||
@@ -1296,10 +1296,12 @@ Status VersionSet::LogAndApply(VersionEdit* edit, port::Mutex* mu,
|
||||
}
|
||||
if (s.ok()) {
|
||||
if (options_->use_fsync) {
|
||||
StopWatch sw(env_, options_->statistics, MANIFEST_FILE_SYNC_MICROS);
|
||||
StopWatch sw(env_, options_->statistics.get(),
|
||||
MANIFEST_FILE_SYNC_MICROS);
|
||||
s = descriptor_log_->file()->Fsync();
|
||||
} else {
|
||||
StopWatch sw(env_, options_->statistics, MANIFEST_FILE_SYNC_MICROS);
|
||||
StopWatch sw(env_, options_->statistics.get(),
|
||||
MANIFEST_FILE_SYNC_MICROS);
|
||||
s = descriptor_log_->file()->Sync();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user