From b5689580ccdd1b48805ea5bbe51aba0c05d86b2d Mon Sep 17 00:00:00 2001 From: HeYuchen <377710264@qq.com> Date: Wed, 12 Feb 2020 15:38:20 +0800 Subject: [PATCH 1/3] add partition_version --- rdsn | 2 +- src/server/pegasus_server_impl.cpp | 11 ++++++++++- src/server/pegasus_server_impl.h | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/rdsn b/rdsn index 0941e768a0..3d124f7000 160000 --- a/rdsn +++ b/rdsn @@ -1 +1 @@ -Subproject commit 0941e768a07b9e18f5eeea606eeb57a24071a87c +Subproject commit 3d124f700012b4f563d3e377f2a93f6bb9780720 diff --git a/src/server/pegasus_server_impl.cpp b/src/server/pegasus_server_impl.cpp index 3b9176da9b..16fcb541ee 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(); @@ -2765,5 +2766,13 @@ std::string pegasus_server_impl::query_compact_state() const return _manual_compact_svc.query_compact_state(); } +void pegasus_server_impl::set_partition_version(uint32_t partition_version) +{ + ddebug_replica("update partition version from {} to {}", _partition_version.load(), partition_version); + _partition_version.store(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..3510f52728 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(uint32_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 From 176430e5ed094630e6b6b999dcbfdc72e476cdab Mon Sep 17 00:00:00 2001 From: heyuchen Date: Wed, 12 Feb 2020 16:22:41 +0800 Subject: [PATCH 2/3] format code --- rdsn | 2 +- src/server/pegasus_server_impl.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rdsn b/rdsn index 3d124f7000..9662e858e6 160000 --- a/rdsn +++ b/rdsn @@ -1 +1 @@ -Subproject commit 3d124f700012b4f563d3e377f2a93f6bb9780720 +Subproject commit 9662e858e63ffcbe8f0501bacdcd333aa83be997 diff --git a/src/server/pegasus_server_impl.cpp b/src/server/pegasus_server_impl.cpp index 16fcb541ee..41410a0b77 100644 --- a/src/server/pegasus_server_impl.cpp +++ b/src/server/pegasus_server_impl.cpp @@ -2768,7 +2768,8 @@ std::string pegasus_server_impl::query_compact_state() const void pegasus_server_impl::set_partition_version(uint32_t partition_version) { - ddebug_replica("update partition version from {} to {}", _partition_version.load(), partition_version); + ddebug_replica( + "update partition version from {} to {}", _partition_version.load(), partition_version); _partition_version.store(partition_version); // TODO(heyuchen): set filter _partition_version in further pr From 631a1ab7d07ef21bbe331d0a6d8300519e28eae2 Mon Sep 17 00:00:00 2001 From: heyuchen Date: Thu, 20 Feb 2020 11:57:36 +0800 Subject: [PATCH 3/3] small fix --- src/server/pegasus_server_impl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/pegasus_server_impl.cpp b/src/server/pegasus_server_impl.cpp index 61f36f4ea3..14a7a5cf78 100644 --- a/src/server/pegasus_server_impl.cpp +++ b/src/server/pegasus_server_impl.cpp @@ -2777,9 +2777,9 @@ std::string pegasus_server_impl::query_compact_state() const 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 {}", _partition_version.load(), partition_version); - _partition_version.store(partition_version); + "update partition version from {} to {}", old_partition_version, partition_version); // TODO(heyuchen): set filter _partition_version in further pr }