Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
fix by comment
Browse files Browse the repository at this point in the history
  • Loading branch information
hycdong committed Feb 19, 2020
1 parent 59fcced commit 2025b91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions include/dsn/dist/replication/replication_app_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ class replication_app_base : public replica_base
// query app envs.
virtual void query_app_envs(/*out*/ std::map<std::string, std::string> &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:
Expand Down
4 changes: 2 additions & 2 deletions src/dist/replication/lib/replica.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,8 @@ class replica : public serverlet<replica>, 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<int32_t> _partition_version;

// perf counters
Expand Down

0 comments on commit 2025b91

Please sign in to comment.