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 tiered compaction k-merge bugs and use in-memory alternative #7661

Merged
merged 6 commits into from
May 9, 2024

Conversation

arpad-m
Copy link
Member

@arpad-m arpad-m commented May 8, 2024

This PR does two things:

First, it fixes a bug with tiered compaction's k-merge implementation. It ignored the lsn of a key during ordering, so multiple updates of the same key could be read in arbitrary order, say from different layers. For example there is layers [(a, 2),(b, 3)] and [(a, 1),(c, 2)] in the heap, they might return (a,2) and (a,1).

Ultimately, this change wasn't enough to fix the ordering issues in #7296, in other words there is likely still bugs in the k-merge. So as the second thing, we switch away from the k-merge to an in-memory based one, similar to #4839, but leave the code around to be improved and maybe switched to later on.

Part of #7296

Copy link
Member

@skyzh skyzh left a comment

Choose a reason for hiding this comment

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

Rest LGTM

pageserver/compaction/src/helpers.rs Outdated Show resolved Hide resolved
pageserver/compaction/src/helpers.rs Outdated Show resolved Hide resolved
pageserver/compaction/src/helpers.rs Outdated Show resolved Hide resolved
Copy link

github-actions bot commented May 8, 2024

3024 tests run: 2891 passed, 0 failed, 133 skipped (full report)


Flaky tests (1)

Postgres 15

  • test_gc_aggressive: debug

Code coverage* (full report)

  • functions: 31.4% (6318 of 20130 functions)
  • lines: 47.3% (47601 of 100683 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
496879b at 2024-05-09T03:17:11.155Z :recycle:

@arpad-m arpad-m merged commit 41fb838 into main May 9, 2024
53 checks passed
@arpad-m arpad-m deleted the arpad/compaction_delta_order branch May 9, 2024 14:01
arpad-m added a commit that referenced this pull request May 15, 2024
Adds a test that is a reproducer for many tiered compaction bugs,
both ones that have since been fixed as well as still unfxied ones:
* (now fixed) #7296 
* #7707 
* #7759
* Likely also #7244 but I haven't tried that.

The key ordering bug can be reproduced by switching to
`merge_delta_keys` instead of `merge_delta_keys_buffered`, so reverting
a big part of #7661, although it only sometimes reproduces (30-50% of
cases).

part of #7554
a-masterov pushed a commit that referenced this pull request May 20, 2024
This PR does two things:

First, it fixes a bug with tiered compaction's k-merge implementation.
It ignored the lsn of a key during ordering, so multiple updates of the
same key could be read in arbitrary order, say from different layers.
For example there is layers `[(a, 2),(b, 3)]` and `[(a, 1),(c, 2)]` in
the heap, they might return `(a,2)` and `(a,1)`.

Ultimately, this change wasn't enough to fix the ordering issues in
#7296, in other words there is likely still bugs in the k-merge. So as
the second thing, we switch away from the k-merge to an in-memory based
one, similar to #4839, but leave the code around to be improved and
maybe switched to later on.

Part of #7296
a-masterov pushed a commit that referenced this pull request May 20, 2024
Adds a test that is a reproducer for many tiered compaction bugs,
both ones that have since been fixed as well as still unfxied ones:
* (now fixed) #7296 
* #7707 
* #7759
* Likely also #7244 but I haven't tried that.

The key ordering bug can be reproduced by switching to
`merge_delta_keys` instead of `merge_delta_keys_buffered`, so reverting
a big part of #7661, although it only sometimes reproduces (30-50% of
cases).

part of #7554
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