-
Notifications
You must be signed in to change notification settings - Fork 491
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
write page headers on the first xlog segment #1341
Conversation
I'm a little nervous of making a WAL segment that looks valid, but isn't. I'm afraid that it will accidentally get streamed over to safekeepers or elsewhere, and overwrite or take the place of actual valid WAL. Maybe I'm just paranoid. I agree it would be very nice if pg_waldump worked on our WAL files. But it's something to consider. How valid does the canned block look like? Would xlogreader.c accept it? Would our safekeeper code accept it? |
The original intent is to enable this mode optionally (e.g. for desktop debugging); this is happening on the Safekeepers themselves
The page header is in XLog[Long]PageHeaderData format, so reading the canned page works just fine (pg_waldump runs the validation that Postgres was reader code does) this code change is mostly a conversation starter, I'm happy with morphing it into a working solution. The motivation is to aid debugging as it could be painful without ability to read transaction log |
You shouldn't do that at Also not sure why you call write_canned_page twice, once should be enough. Regarding the whole safety of the approach -- it should be ok, as currently no one ever reads that (zeros before first record in the first segment) part of WAL. At least safekeeper remembers LSN of the first record and starts there. But it would be nice to add some description how it works and safety checks that first valid LSN is after that crafted record and within the first segment. |
I couldn't find a correct place to do that without introducing a state variable, I may need some guidance here
This is due to the way XLog is read and validated, first page in the segment should always be present regardless of the reading position (header contains block size and segment size "needed" for reading the rest of the data), then the page we going to start dumping log records from needs to have a header as well |
I think you do need a state variable =( |
retired in favor of a change to pg_waldump neondatabase/postgres#145 |
This is not meant for production (yet?)
with this change pg_waldump will be able to dump log records starting with the first record written by compute.
gotchas