| From: | Zhijie Hou <houzhijie22(at)gmail(dot)com> |
|---|---|
| To: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
| Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Rogers Wang <rogers(dot)ww(at)qq(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Andres Freund <andres(at)anarazel(dot)de> |
| Subject: | Re: WAL_LOG CREATE DATABASE strategy broken for non-standard page layouts |
| Date: | 2026-11-17 15:20:54 |
| Message-ID: | 2889116c-7da1-4ab0-b10a-3fadb99c24e7@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Tue, Nov17, 2026 at 01:35 AM Melanie Plageman wrote:
> On Sat, Nov 14, 2026 at 8:08 AM Zhijie Hou <houzhijie22(at)gmail(dot)com> wrote:
> >
> > I just have one minor comment on the TAP test in 0001. IIUC, the
> > pre-existing test in 034_create_database.pl was added by commit
> > 8a8661828ae to verify that when CREATE DATABASE loads the template's
> > pg_class into shared_buffers, it marks those buffers as permanent so
> > that a subsequent checkpoint flushes them to disk.
> >
> > But with 0001, the modified test vacuuming tab_db_before_create_1 in
> > template1 beforehand loads template1's pg_class into shared_buffers
> > with BM_PERMANENT already set before CREATE DATABASE runs. If we
> > want to keep the original regression coverage, maybe we could run
> > the new test steps after the pre-existing test.
>
> Ah, thanks so much for catching this. I read the test and not the
> commit message adding it and thought it was just trying to make sure
> that tables added after the copy didn't end up in the copied database
> -- which, if I think about it, would have been a silly test. I've
> changed it in attached v3 to retain the coverage in the initial test.
>
> I also realized while editing this that I'll have to make a wrapper
> version of CreateAndCopyRelationData() for the backports since it is
> public. A bit annoying but I think better than the alternatives.
Thanks for updating the patch.
I think we also need to increase shared_buffers (e.g., to 16MB), because
$node->init(allows_streaming => 1) sets shared_buffers to 1MB
internally, causing the pg_class pages to be evicted from shared_buffers
before CREATE TABLE runs, so the test could not reach the old bug path.
BTW, while looking into why the wal_consistency_checking test didn't
catch this bug, I noticed that verifyBackupPageConsistency() also masks
out all the bits in VM pages via heap_mask() (somewhat similar to this
bug, since it treats pd_lower..pd_upper as unused space), so the
consistency check for VM pages always "passes". Once we avoid masking
the VM bitmap there (see the attached draft patch for reference), the
existing test catches this CREATE DB WAL_LOG bug right away:
PG_TEST_EXTRA=wal_consistency_checking meson test -C build
recovery/027_stream_regress
So if it's worth increasing the possibility of catching similar VM bugs,
maybe we could improve that as well (in a separate patch or thread).
--
Best Regards,
Zhijie Hou
| Attachment | Content-Type | Size |
|---|---|---|
| nocfbot-0001-Fix-WAL-consistency-checking-for-visibility-map-p.patch | text/plain | 2.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Maksim.Melnikov | 2026-11-17 14:40:32 | Re: Init connection time grows quadratically |