From 7b55554605194671de9992572e4959f5c70f94c1 Mon Sep 17 00:00:00 2001 From: Qizhong Mao Date: Tue, 31 Aug 2021 10:56:08 -0700 Subject: [PATCH] Replace `std::shared_ptr` by `SystemClock*` in `TraceExecutionHandler` (#8729) Summary: All/most trace related APIs directly use `SystemClock*` (https://github.com/facebook/rocksdb/pull/8033). Do the same in `TraceExecutionHandler`. Pull Request resolved: https://github.com/facebook/rocksdb/pull/8729 Test Plan: None Reviewed By: zhichao-cao Differential Revision: D30672159 Pulled By: autopear fbshipit-source-id: 017db4912c6ac1cfede842b8b122cf569a394f25 --- trace_replay/trace_record_handler.cc | 4 ++-- trace_replay/trace_record_handler.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/trace_replay/trace_record_handler.cc b/trace_replay/trace_record_handler.cc index 8f5371622..ca179e870 100644 --- a/trace_replay/trace_record_handler.cc +++ b/trace_replay/trace_record_handler.cc @@ -17,8 +17,7 @@ TraceExecutionHandler::TraceExecutionHandler( : TraceRecord::Handler(), db_(db), write_opts_(WriteOptions()), - read_opts_(ReadOptions()), - clock_(SystemClock::Default()) { + read_opts_(ReadOptions()) { assert(db != nullptr); assert(!handles.empty()); cf_map_.reserve(handles.size()); @@ -26,6 +25,7 @@ TraceExecutionHandler::TraceExecutionHandler( assert(handle != nullptr); cf_map_.insert({handle->GetID(), handle}); } + clock_ = db_->GetEnv()->GetSystemClock().get(); } TraceExecutionHandler::~TraceExecutionHandler() { cf_map_.clear(); } diff --git a/trace_replay/trace_record_handler.h b/trace_replay/trace_record_handler.h index 0d9f1d629..88cf317dd 100644 --- a/trace_replay/trace_record_handler.h +++ b/trace_replay/trace_record_handler.h @@ -38,7 +38,7 @@ class TraceExecutionHandler : public TraceRecord::Handler { std::unordered_map cf_map_; WriteOptions write_opts_; ReadOptions read_opts_; - std::shared_ptr clock_; + SystemClock* clock_; }; // To do: Handler for trace_analyzer.