From 2025b917f5de0dcba6286d19db3276f55643d979 Mon Sep 17 00:00:00 2001 From: heyuchen Date: Wed, 19 Feb 2020 11:12:16 +0800 Subject: [PATCH] fix by comment --- include/dsn/dist/replication/replication_app_base.h | 5 +++++ src/dist/replication/lib/replica.h | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/dsn/dist/replication/replication_app_base.h b/include/dsn/dist/replication/replication_app_base.h index 2536d0d8e9..ecdd4ceb87 100644 --- a/include/dsn/dist/replication/replication_app_base.h +++ b/include/dsn/dist/replication/replication_app_base.h @@ -228,6 +228,11 @@ class replication_app_base : public replica_base // query app envs. virtual void query_app_envs(/*out*/ std::map &envs) = 0; + // `partition_version` is used to guarantee data consistency during partition split. + // In normal cases, partition_version = partition_count-1, when this replica rejects read + // and write request, partition_version = -1. + // + // Thread-safe. virtual void set_partition_version(int32_t partition_version) = 0; public: diff --git a/src/dist/replication/lib/replica.h b/src/dist/replication/lib/replica.h index 5576f73940..1c38df9b86 100644 --- a/src/dist/replication/lib/replica.h +++ b/src/dist/replication/lib/replica.h @@ -494,8 +494,8 @@ class replica : public serverlet, public ref_counter, public replica_ba // ballot when starting partition split and split will stop if ballot changed // _child_init_ballot = 0 if partition not in partition split ballot _child_init_ballot{0}; - // in normal case _partition_version = partition_count-1 - // when parent register child, _partition_version = -1, will reject client read write request + // in normal cases, _partition_version = partition_count-1 + // when replica reject client read write request, partition_version = -1 std::atomic _partition_version; // perf counters