Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(split): add partition_version #474

Merged
merged 4 commits into from
Feb 20, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
{
ddebug_replica(
hycdong marked this conversation as resolved.
Show resolved Hide resolved
"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
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

放到基类replication_app_base里面是不是更合理?毕竟pegasus_server_impl不应该知道partition这个概念

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pegasus_server_impl也需要partition_version这个变量,split会让parent拥有child的数据,child也拥有parent的数据,在split完成之后这些无效数据应该要被删除,partition_version就被用于这个无效数据的清理,后续pr会交这部分的代码

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现在还看不出来她的必要性,后面的pr我再看吧


dsn::task_tracker _tracker;

// perf counters
Expand Down