-
Notifications
You must be signed in to change notification settings - Fork 479
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(pageserver): handle dup layers during gc-compaction #10430
Conversation
7414 tests run: 7027 passed, 0 failed, 387 skipped (full report)Flaky tests (5)Postgres 17
Postgres 16
Postgres 15
Postgres 14
Code coverage* (full report)
* collected from Rust tests only The comment gets automatically updated with the latest test results
1bb54ef at 2025-01-23T22:03:06.285Z :recycle: |
This deserves a test, as it was a near-miss data loss issue. I think we talked about doing something like just gc-compacting, then restarting and doing it again being enough to repro the issue? |
c6d2e49
to
2a2ecce
Compare
@jcsp I added two test cases plus one chaos test. The two test cases ensures |
2a2ecce
to
097e0a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more risky to fully fix the index-part bug so I'd like to work around it by asking gc-compaction not producing such updates.
Shard ancestor compaction already does this in a safe manner, with the important caveat that the current generation is greater than the generation of the layer being re-written (see compact_shard_ancestors
and the call to rewrite_layers
).
The trick is in how you call schedule_compaction_update
. compacted_from
arg must contain only dropped layers (no re-writes) and compacted_to
must contain only re-writes or new layers. I see that you were already discarding re-writes within the same generation in KeyHistoryRetention::discard_key
, so this should work fine.
Yeah I thought I was doing it in the correct way that same layer in same generations are discarded... so I assume there's still a bug around remote_client |
Signed-off-by: Alex Chi Z <chi@neon.tech>
Signed-off-by: Alex Chi Z <chi@neon.tech>
Signed-off-by: Alex Chi Z <chi@neon.tech>
fc494a6
to
9b1a107
Compare
Oh well on a second read I realized that I misread something. So if the code rewrites a layer, it should only appear in the |
...even if the rewritten layer has a different generation than the original one? |
9b1a107
to
60310f6
Compare
Signed-off-by: Alex Chi Z <chi@neon.tech>
Signed-off-by: Alex Chi Z <chi@neon.tech>
fixed all test flakyness and ready for review :) |
b3743ca
to
1bd9d6a
Compare
…mote_client Signed-off-by: Alex Chi Z <chi@neon.tech> fix overwriting layers Signed-off-by: Alex Chi Z <chi@neon.tech>
a8c8769
to
20c5edc
Compare
888d744
to
bfbd1c2
Compare
Signed-off-by: Alex Chi Z <chi@neon.tech>
bfbd1c2
to
bd921de
Compare
Signed-off-by: Alex Chi Z <chi@neon.tech>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my comment on the duplication of rewrite_layers
logic.
Signed-off-by: Alex Chi Z <chi@neon.tech>
Problem
If gc-compaction decides to rewrite an image layer, it will now cause index_part to lose reference to that layer. In details,
On the remote storage / local disk side, this is fine -- it unlinks things correctly and uploads the new file. However, the
index_part.json
itself doesn't record generations. The buggy procedure is as follows:Therefore, the correct update result process for gc-compaction should be as follows:
Summary of changes
finish_gc_compaction
to correctly order insertions and deletions.