Skip to content

Commit

Permalink
feat(split): add partition_version (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
hycdong authored Feb 20, 2020
1 parent 6b2a270 commit b7492ca
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/server/pegasus_server_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions src/server/pegasus_server_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ class pegasus_server_impl : public ::dsn::apps::rrdb_service

virtual void query_app_envs(/*out*/ std::map<std::string, std::string> &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;
Expand Down Expand Up @@ -340,6 +342,8 @@ class pegasus_server_impl : public ::dsn::apps::rrdb_service

pegasus_manual_compact_service _manual_compact_svc;

std::atomic<int32_t> _partition_version;

dsn::task_tracker _tracker;

// perf counters
Expand Down

0 comments on commit b7492ca

Please sign in to comment.