Question about HEAP_XMIN_COMMITTED

From: "liuhuailing(at)fujitsu(dot)com" <liuhuailing(at)fujitsu(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Question about HEAP_XMIN_COMMITTED
Date: 2021-12-14 08:54:57
Message-ID: OSZPR01MB6215EC0B01A61AF8881778DDBE759@OSZPR01MB6215.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

I did the following steps on PG.

1. Building a synchronous streaming replication environment.
2. Executing the following SQL statements on primary
(1) postgres=# CREATE EXTENSION pageinspect;
(2) postgres=# begin;
(3) postgres=# select txid_current();
(4) postgres=# create table mytest6(i int);
(6) postgres=# insert into mytest6 values(1);
(7) postgres=# commit;
3. Executing the following SQL statements on standby
(8) postgres=# select * from mytest6;
i
---
1
(1 row)
(9) postgres=# SELECT t_infomask FROM heap_page_items(get_raw_page('pg_class', 0)) where t_xmin=502※;
   t_infomask
------------
2049
(1 row)
※502 is the transaction ID returned by step (3) above.

In the result of step (9),the value of the t_infomask field is 2049(0x801) which means that HEAP_XMAX_INVALID
and HEAP_HASNULL flags were setted, but HEAP_XMIN_COMMITTED flag was not setted.

According to source , when step (8) was executed,SetHintBits function were called to set HEAP_XMIN_COMMITTED.
however, the minRecoveryPoint value was not updated. So HEAP_XMIN_COMMITTED flag was not setted successfully.

After CheckPoint, select from mytest6 again in another session, we can see HEAP_XMIN_COMMITTED flag was setted.

So my question is that before checkpoint, HEAP_XMIN_COMMITTED flag was not setted correctly, right?

Or we need to move minRecoveryPoint forword to make HEAP_XMIN_COMMITTED flag setted correctly when first select
from mytest6.

Best Regards, LiuHuailing
--
以上
Liu Huailing
--------------------------------------------------
Liu Huailing
Development Department III
Software Division II
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
ADDR.: No.6 Wenzhu Road, Software Avenue,
Nanjing, 210012, China
TEL : +86+25-86630566-8439
COINS: 7998-8439
FAX : +86+25-83317685
MAIL : liuhuailing(at)cn(dot)fujitsu(dot)com
--------------------------------------------------

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-12-14 09:05:50 Re: Skipping logical replication transactions on subscriber side
Previous Message houzj.fnst@fujitsu.com 2021-12-14 07:41:49 RE: pg_get_publication_tables() output duplicate relid