Skip to content

Add standalone test for high concurrency#4115

Draft
Josipmrden wants to merge 1 commit into
masterfrom
high-concurrency-standalone-test
Draft

Add standalone test for high concurrency#4115
Josipmrden wants to merge 1 commit into
masterfrom
high-concurrency-standalone-test

Conversation

@Josipmrden
Copy link
Copy Markdown
Contributor

Git commit description, explain the changes you made here


Leave above in PR description, copy the below into a comment


Tracking

  • [Link to Epic/Issue]

Standard development

CI Testing Labels

  • Select the appropriate CI test labels (CI -build=build-name -test=test-suite)

Documentation checklist

  • Add the documentation label
  • Add the bug / feature label
  • Add the milestone for which this feature is intended
    • If not known, set for a later milestone
  • Write a release note, including added/changed clauses
    • What has changed? What does it mean for a user? What should a user do with it? [#{{PR_number}}]({{link to the PR}})
  • [ Documentation PR link memgraph/documentation#XXXX ]
    • Is back linked to this development PR

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 6, 2026

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.
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.

1 participant