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

Add cluster ID to clock #2871

Merged
merged 4 commits into from
May 20, 2022
Merged

Add cluster ID to clock #2871

merged 4 commits into from
May 20, 2022

Conversation

wxing1292
Copy link
Contributor

What changed?

  • Add cluster ID to clock object

Why?
Business logic can tell the difference (clock generated by cluster a vs cluster b)

How did you test it?
Existing tests

Potential risks
N/A

Is hotfix candidate?
N/A

@wxing1292 wxing1292 requested a review from a team as a code owner May 19, 2022 21:50
@@ -59,6 +59,8 @@ type (
IsGlobalNamespaceEnabled() bool
// IsMasterCluster whether current cluster is master cluster
IsMasterCluster() bool
// GetClusterID return the cluster ID, which is also the initial failover version
GetClusterID() int64
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yiminc @yycptt @yux0 another solution is to use the UUID from cluster metadata table, what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

I think UUID is overkill. Initial failover should be good.

@@ -59,6 +59,8 @@ type (
IsGlobalNamespaceEnabled() bool
// IsMasterCluster whether current cluster is master cluster
IsMasterCluster() bool
// GetClusterID return the cluster ID, which is also the initial failover version
GetClusterID() int64
Copy link
Member

Choose a reason for hiding this comment

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

I think UUID is overkill. Initial failover should be good.

proto/internal/temporal/server/api/clock/v1/message.proto Outdated Show resolved Hide resolved
) (int, error) {
if clock1.GetId() != clock2.GetId() {
if clock1.GetClusterId() != clock2.GetClusterId() || clock1.GetShardId() != clock2.GetShardId() {
Copy link
Member

Choose a reason for hiding this comment

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

We probably need to differentiate those two cases? ShardID not equal is unexpected, while clusterID not equal is expected in some cases (due to auto-forwarding).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, actually even without the cluster ID, clocks generated by different cluster cannot be compared

@wxing1292 wxing1292 merged commit 148630e into master May 20, 2022
@wxing1292 wxing1292 deleted the shard-clock-with-cluster-id branch May 20, 2022 05:09
Sushisource pushed a commit to Sushisource/temporal that referenced this pull request Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants