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

Replicator documentation #91

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

youyuanwu
Copy link
Collaborator

@youyuanwu youyuanwu commented Nov 11, 2024

Add unofficial documentation for replicator apis.

@youyuanwu youyuanwu marked this pull request as ready for review November 11, 2024 21:14
/// Change the replicator role.
///
/// Remarks:
/// Replicator change_role is called before Replica change_role.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any broader commentary to offer on the relationship between Replica and Replicator?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Replica is for setting up listener for user connections and manage its life cycle.
Replicator is for replication listener and LSN management in the background.

/// Called on primary to inform the set of active secondary replicas that may
/// begin to catchup. Idle secondary replicas are not included here.
///
/// The total number of replica marked with must_catchup will not exceed the write quorum.
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the significance of the must_catchup flag when provided as true?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it is only used in graceful swap of primary and secondary. The old primary gets updated with the catch up configuration with all the secondary replicas, must_catch up is set to true for the new candidate primary, so that it must catch up, and wait_for_catchup_quorum should return if the must catch up replica successfully caught up. The other secondaries catch up can lag, and the partition can fix any problem in the background without affect the primary promotion workflow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If the catchup mode is write, it is upto the replicator to pick a quorum of the replicas that includes the must_catch up replica. Wait_for_catchup_quorum complete can return if the quorum of replica has caught up, and can leave other slow replica still running in background.

crates/libs/core/src/runtime/stateful.rs Outdated Show resolved Hide resolved
@youyuanwu youyuanwu force-pushed the users/youyuanwu/replicator-doc branch from e63badb to f46d12c Compare November 12, 2024 21:20
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.

2 participants