| From: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
|---|---|
| To: | 'Jan Nidzwetzki' <jan(at)planetscale(dot)com>, 'Fujii Masao' <masao(dot)fujii(at)gmail(dot)com> |
| Cc: | Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>, ♂π≌26218 <1991230470(at)qq(dot)com>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
| Subject: | RE: START_REPLICATION silently truncates an overlong LSN component |
| Date: | 2026-10-28 03:18:31 |
| Message-ID: | OS7PR01MB18317807F36995E27C57C915AF56F2@OS7PR01MB18317.jpnprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi Jan,
> Patch 0001
> ==========
>
> I have just a small comment on the moved MAXPG_LSNLEN. It's currently a
> hard-coded 17. It could make sense to export MAXPG_LSNCOMPONENT as well
> and define MAXPG_LSNLEN as (2 * MAXPG_LSNCOMPONENT + 1), which
> would
> document where the value comes from.
I feel the notation cannot be used. CppAsString2() converts the argument to the
string, but it does not evaluate arithmetic at that time. So your suggestion
would be "%(2 * 8 + 1)s" and it won't work well. You can find that the compiler
raises warnings.
I feel we can add a static assert to ensure they remain consistent. I put in
pg_parse_lsn.c and it will be checked at compilation time. See new 0002 patch.
I separated them because it may be the independent improvement.
> Patch 0002
> ==========
>
> Kuroda-san wrote in the v5 mail:
>
> > I also attached the test code to check invalid strings can be
> rejected, see 0002.
> > I'm not intended to be pushed.
>
> I think this test is worth committing. As far as I can see, nothing else
> covers the "this is an incremental backup, not a data directory" error,
> and the new LSN checks would otherwise remain untested. However, we test
> only an overlong high component. It could make sense to add this test
> for the low component as well (e.g., using 0/123456789).
Hmm. But 5ffb8c74 also did not have any tests and the error "syntax error in history file:"
is nor verified, right? I still feel we can follow the manner.
Best regards,
Hayato Kuroda
FUJITSU LIMITED
| Attachment | Content-Type | Size |
|---|---|---|
| v7-0001-Use-pg_parse_lsn-for-reading-backup-label.patch | application/octet-stream | 4.5 KB |
| v7-0002-Add-static_assert-for-MAXPG_LSNLEN-and-MAXPG_LSNC.patch | application/octet-stream | 692 bytes |
| v7-0003-Add-fuzzy-test.patch | application/octet-stream | 4.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Haibo Yan | 2026-10-28 03:40:20 | Re: BUG #19799: Self-join elimination: "failed to build any 3-way joins" with LATERAL |
| Previous Message | Michael Paquier | 2026-10-27 23:35:06 | Re: pg_stat_statements stores WITH HOLD cursor query with literals |