diff --git a/src/server/pegasus_server_impl.cpp b/src/server/pegasus_server_impl.cpp index ff221e20e6..c00098bbb4 100644 --- a/src/server/pegasus_server_impl.cpp +++ b/src/server/pegasus_server_impl.cpp @@ -56,7 +56,8 @@ pegasus_server_impl::pegasus_server_impl(dsn::replication::replica *r) _pegasus_data_version(0), _last_durable_decree(0), _is_checkpointing(false), - _manual_compact_svc(this) + _manual_compact_svc(this), + _partition_version(0) { _primary_address = dsn::rpc_address(dsn_primary_address()).to_string(); _gpid = get_gpid(); @@ -2773,5 +2774,14 @@ std::string pegasus_server_impl::query_compact_state() const return _manual_compact_svc.query_compact_state(); } +void pegasus_server_impl::set_partition_version(int32_t partition_version) +{ + int32_t old_partition_version = _partition_version.exchange(partition_version); + ddebug_replica( + "update partition version from {} to {}", old_partition_version, partition_version); + + // TODO(heyuchen): set filter _partition_version in further pr +} + } // namespace server } // namespace pegasus diff --git a/src/server/pegasus_server_impl.h b/src/server/pegasus_server_impl.h index 678be026ff..cee70e3afd 100644 --- a/src/server/pegasus_server_impl.h +++ b/src/server/pegasus_server_impl.h @@ -152,6 +152,8 @@ class pegasus_server_impl : public ::dsn::apps::rrdb_service virtual void query_app_envs(/*out*/ std::map &envs) override; + virtual void set_partition_version(int32_t partition_version) override; + private: friend class manual_compact_service_test; friend class pegasus_compression_options_test; @@ -338,6 +340,8 @@ class pegasus_server_impl : public ::dsn::apps::rrdb_service pegasus_manual_compact_service _manual_compact_svc; + std::atomic _partition_version; + dsn::task_tracker _tracker; // perf counters