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

HA: Disable replication from old main #1674

Merged
merged 23 commits into from Feb 7, 2024

Conversation

antoniofilipovic
Copy link
Collaborator

@antoniofilipovic antoniofilipovic commented Jan 29, 2024

The goal of this PR is to disable replication from the old main once it comes back up. We are introducing uuid as a discriminating factor between databases (not just storages but whole databases). When the old main dies, we first swap uuid and set it to uuid of the new main, then we proceed with failover to avoid the old main still replicating data to the instance.

The coordinator will now be the owner of the information of the main uuid. This means the coordinator will generate uuid and send it to the main on PromoteReplicaToMainRpc.

In regular replication without a coordinator, each time a replica is registered, the main will send its own id.

TODO:

  • On replica restart set uuid to none to not accept messages in HA cluster

[master < Task] PR

  • Check, and update documentation if necessary
  • Provide the full content or a guide for the final git message

To keep docs changelog up to date, one more thing to do:

  • Write a release note here, including added/changed clauses
  • Tag someone from docs team in the comments

@antoniofilipovic antoniofilipovic force-pushed the replication-high-availability-handling branch 2 times, most recently from ab1943f to b4082a4 Compare February 2, 2024 17:38
@antoniofilipovic antoniofilipovic self-assigned this Feb 2, 2024
@antoniofilipovic antoniofilipovic added the Docs needed Docs needed label Feb 2, 2024
@antoniofilipovic antoniofilipovic added this to the mg-v2.15.0 milestone Feb 2, 2024
@antoniofilipovic antoniofilipovic marked this pull request as ready for review February 2, 2024 18:22
Copy link
Contributor

@as51340 as51340 left a comment

Choose a reason for hiding this comment

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

Great work, however I would spend some time in making code more consistent and readable 💪

src/coordination/coordinator_client.cpp Outdated Show resolved Hide resolved
src/coordination/coordinator_client.cpp Show resolved Hide resolved
src/coordination/coordinator_data.cpp Show resolved Hide resolved
src/coordination/coordinator_data.cpp Show resolved Hide resolved
src/coordination/coordinator_instance.cpp Show resolved Hide resolved
src/replication/state.cpp Outdated Show resolved Hide resolved
src/replication/status.cpp Show resolved Hide resolved
src/replication/status.cpp Outdated Show resolved Hide resolved
src/replication/status.cpp Outdated Show resolved Hide resolved
src/replication_coordination_glue/handler.hpp Show resolved Hide resolved
Copy link
Contributor

@andrejtonev andrejtonev left a comment

Choose a reason for hiding this comment

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

💪

@antoniofilipovic antoniofilipovic force-pushed the replication-high-availability-handling branch from 22359da to 82c4eb8 Compare February 7, 2024 09:11
@antoniofilipovic antoniofilipovic merged commit c15b62a into master Feb 7, 2024
8 checks passed
@antoniofilipovic antoniofilipovic deleted the replication-high-availability-handling branch February 7, 2024 10:20
as51340 pushed a commit that referenced this pull request Feb 7, 2024
as51340 pushed a commit that referenced this pull request Feb 7, 2024
@antoniofilipovic
Copy link
Collaborator Author

@kgolubic RN: REPLICAs now listen only to one MAIN instance. When using replication as part of high availability, coordinator orchestrates which instance is REPLICA listening to. When using only replication without HA, main sends its ID to each REPLICA which REPLICA listens to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs needed Docs needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants