-
Notifications
You must be signed in to change notification settings - Fork 485
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
Preserve HEAP_COMBOCID when restoring t_cid from WAL #8503
Conversation
2144 tests run: 2075 passed, 0 failed, 69 skipped (full report)Code coverage* (full report)
* collected from Rust tests only The comment gets automatically updated with the latest test results
2b569a4 at 2024-08-13T20:13:25.776Z :recycle: |
b20f670
to
333678c
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.
LGTM
5dbd642
to
e6fa1f3
Compare
Hmm, so let's look at the case that you UPDATE a row that has been inserted earlier in the same transaction. In that case:
The combocid stored on the old tuple, and the cmin stored on the new tuple are fundamentally two different values. But we only have one t_cid field in the WAL record. That's bad news :-(. I don't see how this can possibly work without changing the WAL record format. |
I added a test that fails without the fixes from this PR, and passes with them. It only covers the DELETE case, but it should be straightforward to exercise the other cases with a copy-paste of this test. |
Sorry, I do not understand it. We really have two |
Oh ok. Good, never mind then :-). |
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.
This looks correct. TODOs:
- Add tests to cover each of the cases, INSERT, UPDATE, DELETE, LOCK, MULTI_INSERT
- There's a funny case within heap_update, where it writes a LOCK record for the tuple first, if it has a toast tuple. Not sure of the details, but it looks correct. Let's just make sure we have a test to cover that too.
- There's some unrelated smgrexists() changes in the postgres branches. Need to rebase, I guess
The compute_infobits function is also used by the LOCK_UPDATED record. That means that we will set the XLHL_COMBOCID flag on those records too, even though we don't use the custom neon rmgr for that. That's a bit dirty. So what happens if you feed such a record to vanilla Postgres? It will work, but vanilla fix_infomask_from_infobits() won't set the COMBOCID flag. That's OK, the COMBOCID flag is irrelevant in that scenario.
f47ddbc
to
126a2d6
Compare
Can somebody also approve correspondent Postgres PRs? |
3b2ba62
to
89605c0
Compare
Problem
See #8499
Summary of changes
Save HEAP_COMBOCID flag in WAL and do not clear it in redo handlers.
Related Postgres PRs:
neondatabase/postgres#457
neondatabase/postgres#458
neondatabase/postgres#459
Checklist before requesting a review
Checklist before merging