Re: COPY FREEZE and setting PD_ALL_VISIBLE/visibility map bits

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>
Cc: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, lubennikovaav(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org, pavan(dot)deolasee(at)gmail(dot)com, ibrar(dot)ahmad(at)gmail(dot)com
Subject: Re: COPY FREEZE and setting PD_ALL_VISIBLE/visibility map bits
Date: 2021-01-10 22:35:03
Message-ID: 7e6a006f-c59a-93fc-3ddf-f9c661319bc8@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I started looking at this patch again, hoping to get it committed in
this CF, but I think there's a regression in handling TOAST tables
(compared to the v3 patch submitted by Pavan in February 2019).

The test I'm running a very simple test (see test.sql):

1) start a transaction
2) create a table with a text column
3) copy freeze data into it
4) use pg_visibility to see how many blocks are all_visible both in the
main table and it's TOAST table

For v3 patch (applied on top of 278584b526 and s/hi_options/ti_options)
I get this:

pages NOT all_visible
------------------------------------------
main 637 0
toast 50001 3

There was some discussion about relcache invalidations causing a couple
TOAST pages not be marked as all_visible, etc.

However, for this patch on master I get this

pages NOT all_visible
------------------------------------------
main 637 0
toast 50001 50001

So no pages in TOAST are marked as all_visible. I haven't investigated
what's causing this, but IMO that needs fixing to make ths patch RFC.

Attached is the test script I'm using, and a v5 of the patch - rebased
on current master, with some minor tweaks to comments etc.

regards

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
0001-Set-PD_ALL_VISIBLE-and-visibility-map-bits-in-COP-v5.patch text/x-patch 12.8 KB
test.sql application/sql 776 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-01-10 22:38:50 Re: Multiple hosts in connection string failed to failover in non-hot standby mode
Previous Message Justin Pryzby 2021-01-10 22:15:41 Re: ALTER TABLE .. DETACH PARTITION CONCURRENTLY