FW: Question about HEAP_XMIN_COMMITTED

From: haiming <sun373738013(at)163(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: FW: Question about HEAP_XMIN_COMMITTED
Date: 2021-12-21 04:01:52
Message-ID: 47a130fc.9196.17ddb2717df.Coremail.sun373738013@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, hackers.
I have the same question.
Hope to reply, thanks.

-----Original Message-----
From: liuhuailing(at)fujitsu(dot)com <liuhuailing(at)fujitsu(dot)com>
Sent: Tuesday, December 14, 2021 4:55 PM
To: pgsql-hackers(at)postgresql(dot)org
Subject: Question about HEAP_XMIN_COMMITTED

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-21 04:20:03 Re: row filtering for logical replication
Previous Message Andres Freund 2021-12-21 03:46:30 Re: do only critical work during single-user vacuum?