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

Dont run append if @followers is empty #684

Merged
merged 5 commits into from
May 24, 2024

Conversation

viktorerlingsson
Copy link
Member

@viktorerlingsson viktorerlingsson commented May 22, 2024

WHAT is this pull request doing?

Replication::Server#append is called from several places, that runs some code even though there are no followers, using unnecessary resources. This returns early from append if the follower array is empty.

HOW can this pull request be tested?

Run specs

@viktorerlingsson viktorerlingsson marked this pull request as ready for review May 23, 2024 08:17
Copy link
Member

@spuun spuun left a comment

Choose a reason for hiding this comment

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

IMO this shows that we should refactor something; it looks kind of strange to have that if statement in only one of the "action" methods.

@viktorerlingsson viktorerlingsson merged commit 1de4c18 into main May 24, 2024
24 of 27 checks passed
@viktorerlingsson viktorerlingsson deleted the return_early_unless_followers branch May 24, 2024 12:24
@carlhoerberg
Copy link
Member

this introduced a bug, if a follower is currently syncing the publish is not blocked (as before this PR), and can cause data loss at the follower

@carlhoerberg
Copy link
Member

IMO this shows that we should refactor something; it looks kind of strange to have that if statement in only one of the "action" methods.

same could be added to all actions, but append is the only one in the hot path.

@viktorerlingsson
Copy link
Member Author

this introduced a bug, if a follower is currently syncing the publish is not blocked (as before this PR), and can cause data loss at the follower

Ah, yes. Reverted

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

3 participants