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

Reset replica flags after stable state fail #1013

Merged
merged 2 commits into from
Mar 30, 2023

Conversation

adiholden
Copy link
Collaborator

reset replica state to R_ENABLED after stable state exit inorder to start reconnecting to master with new sync id

Signed-off-by: adi_holden <adi@dragonflydb.io>
Signed-off-by: adi_holden <adi@dragonflydb.io>
@adiholden adiholden requested a review from dranikpg March 30, 2023 07:31
LOG(INFO) << "Error greeting " << ec;
state_mask_ &= ~R_TCP_CONNECTED;
LOG(INFO) << "Error greeting " << ec << " " << ec.message();
state_mask_ &= R_ENABLED;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this change has the same affect as ~R_TCP_CONNECTED because the only flag enabled in this state is R_TCP_CONNECTED and R_ENABLED, but this change makes it more readable and if we add new state between connect and greet we will not need to do any change here so this is more robust

@@ -249,7 +247,8 @@ void Replica::MainReplicationFb() {
else
ec = ConsumeRedisStream();

state_mask_ &= ~R_SYNC_OK;
LOG(WARNING) << "Error full sync " << ec << " " << ec.message();
state_mask_ &= R_ENABLED;
Copy link
Collaborator Author

@adiholden adiholden Mar 30, 2023

Choose a reason for hiding this comment

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

This is the fix. After full sync exit we start from beginning

Comment on lines 764 to +765
LOG(ERROR) << "Bad FLOW response " << ToSV(leftover_buf_->InputBuffer());
return make_error_code(errc::bad_message);
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow... I never noticed we skipped this error return

@adiholden adiholden merged commit 9e68570 into main Mar 30, 2023
@romange romange deleted the reset_replica_flags_after_stable_state_fail branch April 1, 2023 10:34
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