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

chore: Forbid replicating a replica #3779

Merged
merged 2 commits into from
Sep 24, 2024
Merged

chore: Forbid replicating a replica #3779

merged 2 commits into from
Sep 24, 2024

Conversation

chakaz
Copy link
Collaborator

@chakaz chakaz commented Sep 24, 2024

We do not support connecting a replica to a replica, but before this PR we allowed doing so. This PR disables that behavior.

Fixes #3679

We do not support connecting a replica to a replica, but before this PR
we allowed doing so. This PR disables that behavior.

Fixes #3679
@@ -2839,6 +2839,10 @@ void ServerFamily::ReplTakeOver(CmdArgList args, ConnectionContext* cntx) {
}

void ServerFamily::ReplConf(CmdArgList args, ConnectionContext* cntx) {
if (!ServerState::tlocal()->is_master) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that this should be checked with the replicaof_mu_ locked

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why?
It's a thread-local variable, so it can't be read non-atomically.
Also, there are many places that use it, all without that lock. Furthermore, the lock is only available in ServerFamily, while other places use it as well..?

Copy link
Collaborator

Choose a reason for hiding this comment

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

the is_master is eventually consistent. It can be that the server is currenly configured as a replica and did not get to set the is_master flag on this thread right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, updated :)

@chakaz chakaz enabled auto-merge (squash) September 24, 2024 13:30
@chakaz chakaz merged commit 526bce4 into main Sep 24, 2024
12 checks passed
@chakaz chakaz deleted the chakaz/replica-replica branch September 24, 2024 13:42
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.

Replica hangs in full sync
2 participants