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

ddl_client: add duplication related commands #235

Merged
merged 5 commits into from
Mar 26, 2019

Conversation

neverchanje
Copy link
Contributor

@neverchanje neverchanje commented Mar 20, 2019

This PR added these 3 ddl commands: add_dup, query_dup, change_dup_status, as well several utilities reside in duplication_common.h/cpp.

To configure a remote cluster for duplication, users need to set a unique "cluster_id" for it under ' [duplication-group]' section:

[duplication-group]
    wuhan-mi-srv-ad = 3
    tianjin-mi-srv-ad = 4

The mapping of "cluster_name" to "cluster_id" is stored internally in class duplication_group_registry, which is a singleton. The implementation is hiding behind the pure function APIs to make our header more cleaner.

hycdong
hycdong previously approved these changes Mar 25, 2019
include/dsn/dist/replication/replication_ddl_client.h Outdated Show resolved Hide resolved
include/dsn/dist/replication/replication_ddl_client.h Outdated Show resolved Hide resolved
src/dist/replication/common/duplication_common.cpp Outdated Show resolved Hide resolved
cluster.data());
_group.emplace(cluster, static_cast<uint8_t>(cluster_id));
}
dassert_f(clusters.size() == _group.size(),
Copy link
Member

Choose a reason for hiding this comment

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

独立集群(一个group里面只有一个cluster)的情况, 这里会fail掉吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里check的是配置错误

[duplication-group]
c3srv-ai=1
c3srv-ai=3

这种就 fail 掉,测试了,只有一个 cluster 不会fail

src/dist/replication/common/duplication_common.cpp Outdated Show resolved Hide resolved
@neverchanje neverchanje merged commit 450ff18 into XiaoMi:master Mar 26, 2019
@neverchanje neverchanje deleted the dup-part branch March 26, 2019 07:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants