From: | Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | pg_xlogdump fails to handle WAL file with multi-page XLP_FIRST_IS_CONTRECORD data |
Date: | 2016-03-23 06:43:19 |
Message-ID: | CABOikdPsPByMiG6J01DKq6om2+BNkxHTPkOyqHM2a4oYwGKsqQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
While investigating some issue, I found that pg_xlogdump fails to dump
contents from a WAL file if the file has continuation data from previous
WAL record and the data spans more than one page. In such cases,
XLogFindNextRecord() fails to take into account that there will be more
than one xlog page headers (long and short) and thus tries to read from an
offset where no valid record exists. That results in pg_xlogdump throwing
error such as:
pg_xlogdump: FATAL: could not find a valid record after 0/46000000
Attached WAL file from master branch demonstrates the issue, generated
using synthetic data. Also, attached patch fixes it for me.
While we could have deduced the number of short and long headers and
skipped directly to the offset, I found reading one page at a time and
using XLogPageHeaderSize() to find header size of each page separately, a
much cleaner way. Also, the continuation data is not going to span many
pages. So I don't see any harm in doing it that way.
I encountered this on 9.3, but the patch applies to both 9.3 and master. I
haven't tested it on other branches, but I have no reason to believe it
won't apply or work. I believe we should back patch it all supported
branches.
Thanks,
Pavan
--
Pavan Deolasee http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachment | Content-Type | Size |
---|---|---|
xlogdump_multipage_cont_record.patch | application/octet-stream | 3.1 KB |
000000010000000000000046.gz | application/x-gzip | 255.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2016-03-23 06:56:35 | Re: Speed up Clog Access by increasing CLOG buffers |
Previous Message | Michael Paquier | 2016-03-23 06:01:03 | Re: Some messages of pg_rewind --debug not getting translated |