Add standalone test for high concurrency#4115
Draft
Josipmrden wants to merge 1 commit into
Draft
Conversation
|
pull Bot
pushed a commit
to weslien/memgraph
that referenced
this pull request
May 11, 2026
Optimises the case of severing the `next` link when unlinking a non-sequential delta in `CollectGarbage`. Consider the case of `TxA`'s deltas being unlinked, and one of `TxA`'s delta to be downstream from an inactive non-sequential delta from `TxB`, i.e.: ``` (vertex) ->...->[TxB's delta]->[TxA's delta]->... ``` memgraph#4020 fixed a correctness issue by ensuring that TxB's `next` was correctly set to `nullptr`, but it did so in a way that required both an `O(n)` walk up the chain to locate the vertex, and for the vertex's lock to be acquired. Correct, but regressive from a performance standpoint. This approach instead just sets `TxB`'s delta's `.next` to `nullptr` atomically, bypassing the `O(n)` walk and the lock. Doing so is safe because: - There can be no concurrent modification of `TxB's` `delta->next`. Prepends only happen at the chain head, garbage collection is serialized by `gc_lock_`, and the abort path only operates on active deltas. We know both the deltas in this operation are inactive because they cannot escape `waiting_gc_deltas_` unless all downstream contributors are committed, so we can be the only thing modifying `next`. - No concurrent reader needs to read anything beyond `TxB`'s delta, as any deltas that would be needed are protected by the `oldest_active_start_timestamp` horizon. Regession discovered by stress test memgraph#4115.
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.



Git commit description, explain the changes you made here
Leave above in PR description, copy the below into a comment
Tracking
Standard development
CI Testing Labels
Documentation checklist