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 and neverchanje committed Mar 31, 2020
1 parent b41c693 commit c5e98eb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
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(0),
_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 @@ -2773,5 +2774,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 @@ -152,6 +152,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 @@ -338,6 +340,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 c5e98eb

Please sign in to comment.