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

fix: reduce delay when stop replica #3020 #3028

Merged
merged 3 commits into from May 12, 2024

Conversation

BorysTheDev
Copy link
Contributor

@BorysTheDev BorysTheDev commented May 8, 2024

this should fix the problem: Running replicaof no one on replica in full sync state returns after more than 20 seconds
the problem was that after we shutdown the socket the buffer still contained data and we processed it.

Copy link
Contributor

@dranikpg dranikpg left a comment

Choose a reason for hiding this comment

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

Please provide a description of what the problem is and what your solution does 🙂 We had similar code previously, but we chose to have a unfiied cleanup procedure because otherwise it becomes unmanageable

src/server/replica.cc Outdated Show resolved Hide resolved
src/server/replica.cc Outdated Show resolved Hide resolved
@dranikpg
Copy link
Contributor

dranikpg commented May 8, 2024

Actually it might be that we need just to switch those two lines 🤔

cntx_.Cancel(); // Context is fully resposible for cleanup.
state_mask_.store(0); // Specifically ~R_ENABLED.

With this order, the loop continues working and blocks because ENABLE is still set

With an inverse order we should be cautious that nothing overrides it before cancel started

@BorysTheDev BorysTheDev force-pushed the fix_delay_when_stop_replica branch from 68ac9d6 to 659dab3 Compare May 9, 2024 17:00
@BorysTheDev BorysTheDev merged commit 4cd142d into main May 12, 2024
10 checks passed
@BorysTheDev BorysTheDev deleted the fix_delay_when_stop_replica branch May 12, 2024 14:30
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

4 participants