Stats sender and 2pc minor problem - Mailing list pgsql-hackers

From Stas Kelvich
Subject Stats sender and 2pc minor problem
Date
Msg-id EB57BF68-C06D-4737-BDDC-4BA778F4E62B@postgrespro.ru
Whole thread Raw
Responses Re: Stats sender and 2pc minor problem  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hello.

Statistics sender logic during usual commit and two-phase commit do not strictly matches each other and that leads to
delta_live_tuples added to n_live_tup in case of truncate in two phase commit.

That can be see in following example:

CREATE TABLE trunc_stats_test5(id serial);
INSERT INTO trunc_stats_test5 DEFAULT VALUES;
INSERT INTO trunc_stats_test5 DEFAULT VALUES;
INSERT INTO trunc_stats_test5 DEFAULT VALUES;
BEGIN;
TRUNCATE trunc_stats_test5;
PREPARE TRANSACTION 'twophase_stats';
COMMIT PREPARED 'twophase_stats';

After that pg_stat_user_tables will have n_live_tup = 3 instead of 0.

Fix along with test is attached.


--
Stas Kelvich
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company


Attachment

pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Add PGDLLEXPORT to PG_FUNCTION_INFO_V1
Next
From: Peter Eisentraut
Date:
Subject: pg_dump: Simplify internal archive version handling