RE: t/035_standby_logical_decoding.pl might fail on attempt to read wrong timeline

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Bertrand Drouvot' <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, "xunengzhou(at)gmail(dot)com" <xunengzhou(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: t/035_standby_logical_decoding.pl might fail on attempt to read wrong timeline
Date: 2026-06-09 07:05:20
Message-ID: TYRPR01MB12156D183BE5344DAA5F3ED1DF51D2@TYRPR01MB12156.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Bertrand,

Thanks for re-posting. Let's focus on the logical decoding stuff.

> > 0004: Add a test for 0003

I found a comment for the test.

```
+# Issue SQL decoding (read_local_xlog_page_guts path) on the pre-connected
+# session.
+$decode_session->query_until(
+ qr/decoding_started/, qq(
+ \\echo decoding_started
+ SELECT count(*) FROM pg_logical_slot_peek_changes('race_slot_sql', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
+));
```

Not sure, pg_logical_slot_peek_changes() can be finished without waiting anything,
right? So why do we use query_until() and check the output here?
IIUC, the command can immediately raise an ERROR if the race happened. So isn't it
enough to use safe_psql() to ensure the SQL function can work?

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-06-09 07:08:26 Re: Fix unqualified catalog references in psql describe queries
Previous Message Tingchuan Sun 2026-06-09 07:01:21 Re: Fix unqualified catalog references in psql describe queries