MB-60971: Avoiding work on persister side on no-op notifs from merger#2006
Merged
abhinavdangeti merged 5 commits intomasterfrom Apr 4, 2024
Merged
MB-60971: Avoiding work on persister side on no-op notifs from merger#2006abhinavdangeti merged 5 commits intomasterfrom
abhinavdangeti merged 5 commits intomasterfrom
Conversation
abhinavdangeti
commented
Mar 27, 2024
Thejas-bhat
approved these changes
Apr 2, 2024
abhinavdangeti
commented
Apr 2, 2024
|
|
||
| case ew := <-s.persisterNotifier: | ||
| s.rootLock.RLock() | ||
| currRootEpoch := s.root.epoch |
Member
Author
There was a problem hiding this comment.
@Thejas-bhat Shouldn't we be checking the epoch from the persisterNotifier epochWatcher instead or somewhere?
Member
Author
There was a problem hiding this comment.
I understand why we're comparing this epoch here, but is there any possibility of a race here -
- the merger updates the root epoch, sets up an epoch watcher
- the persister then records the lastRootEpoch in line 271 above
- the comparison in line 289 below passes because no other change since, and the persister sleeps longer than it should have.
Member
There was a problem hiding this comment.
from what i understand that shouldn't happen, this is because
- when the merger has some changes to introduce, the introducer will get the message of the newly merged segments to be introduced. the introducer now updates the root epoch after acquiring a lock. after this, the merger notifies the persister. so the updating of the rootEpoch followed by notifying the persister is happening in a sequential manner.
- the lastRootEpoch value at 271 is still the pre-merged snapshot and now at 289 when we get the currRootEpoch at that instance using the read lock, the currRootEpoch value would be the new root epoch - so the check would fail and the persister continues to do the work (instead of sleeping)
Member
Author
|
Ok, let's go ahead with this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Authored-by: @Thejas-bhat
Original: #2003
be merged in the current iteration which causes the tasks list to be
empty. In this situation, merger which didn't update the root snapshot
would notify the persister.
there were mutations coming into the system (so the root snapshot would
be updated by the introducer) would lead to the persister to be awoken
and start flushing out the in-memory segments to disk.
duration such and then let the persister do some work. This would also help in merger
waiting for the notification reply (which is like an interrupt fashion type of wait)
rather than doing something more expensive of letting merger continue to do work
(which the earlier commits of this PR was doing).
Some numbers on local testing (~4.18M dataset with lorem ipsum content)
With patch
Without patch