Re: Logical Replication of sequences

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Euler Taveira <euler(at)eulerto(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>
Subject: Re: Logical Replication of sequences
Date: 2025-09-08 06:34:54
Message-ID: BFF62CAB-90A3-40D3-8C78-FDAFD49615F6@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Sep 8, 2025, at 14:00, vignesh C <vignesh21(at)gmail(dot)com> wrote:
>>
>>
>> 1 - 0001
>> ```
>> diff --git a/src/test/regress/sql/sequence.sql b/src/test/regress/sql/sequence.sql
>> index 2c220b60749..c8adddbfa31 100644
>> --- a/src/test/regress/sql/sequence.sql
>> +++ b/src/test/regress/sql/sequence.sql
>> @@ -414,6 +414,6 @@ SELECT nextval('test_seq1');
>> SELECT nextval('test_seq1');
>>
>> -- pg_get_sequence_data
>> -SELECT * FROM pg_get_sequence_data('test_seq1');
>> +SELECT last_value, is_called, log_cnt, page_lsn <= pg_current_wal_lsn() as lsn FROM pg_get_sequence_data('test_seq1');
>>
>> DROP SEQUENCE test_seq1;
>> ```
>>
>> As it shows log_cnt now, after calling pg_get_sequence_data(), I suggest add 8 nextval(), so that sequence goes to 11, and log_cnt should become to 22.
>
> Could you please explain the reason you’d like this to be done?
>

Because log_cnt is newly exposed, we want to verify its value in the test. When I first time ran the test code, I saw initial value of log_cnt was 32, then I thought log_cnt might get decreased if I ran nextval() again, but it didn’t. Only after I ran 10 (cache size) more nextval(), log_cnt got decreased by 10 to 22. The test code is a place for people to look for expected behavior. So I think adding more nextval() to verify and show the change of log_cnt is helpful.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sophie Alpert 2025-09-08 06:57:21 Re: Fix missing EvalPlanQual recheck for TID scans
Previous Message Dilip Kumar 2025-09-08 06:31:28 Re: Proposal: Conflict log history table for Logical Replication