From b7492caceae817cfdb50a1a71d42de9d16c4a234 Mon Sep 17 00:00:00 2001 From: HeYuchen <377710264@qq.com> Date: Thu, 20 Feb 2020 14:12:44 +0800 Subject: [PATCH] feat(split): add partition_version (#474) --- rdsn | 2 +- src/server/pegasus_server_impl.cpp | 12 +++++++++++- src/server/pegasus_server_impl.h | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/rdsn b/rdsn index 7a46628cbf..07f2e659a9 160000 --- a/rdsn +++ b/rdsn @@ -1 +1 @@ -Subproject commit 7a46628cbff56daac65442ce4b173e9c881c45ed +Subproject commit 07f2e659a9330c16421cc6ea6eb34282bf48d7eb diff --git a/src/server/pegasus_server_impl.cpp b/src/server/pegasus_server_impl.cpp index 1d9ff02c37..14a7a5cf78 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(PEGASUS_DATA_VERSION_MAX), _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(); @@ -2774,5 +2775,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 6abf1ca1e7..357c8edb75 100644 --- a/src/server/pegasus_server_impl.h +++ b/src/server/pegasus_server_impl.h @@ -153,6 +153,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; @@ -340,6 +342,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