pgsql: Initialize tsId and dbId fields in WAL record of COMMIT PREPARED

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Initialize tsId and dbId fields in WAL record of COMMIT PREPARED
Date: 2014-05-16 07:13:59
Message-ID: E1WlCL9-0004P9-11@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Initialize tsId and dbId fields in WAL record of COMMIT PREPARED.

Commit dd428c79 added dbId and tsId to the xl_xact_commit struct but missed
that prepared transaction commits reuse that struct. Fix that.

Because those fields were left unitialized, replaying a commit prepared WAL
record in a hot standby node would fail to remove the relcache init file.
That can lead to "could not open file" errors on the standby. Relcache init
file only needs to be removed when a system table/index is rewritten in the
transaction using two phase commit, so that should be rare in practice. In
HEAD, the incorrect dbId/tsId values are also used for filtering in logical
replication code, causing the transaction to always be filtered out.

Analysis and fix by Andres Freund. Backpatch to 9.0 where hot standby was
introduced.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/d6a9767404cfee7f037a58e445b601af5837e4a5

Modified Files
--------------
src/backend/access/transam/twophase.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-05-16 07:23:22 pgsql: Open output file before sleeping in pg_recvlogical.
Previous Message Heikki Linnakangas 2014-05-16 07:13:58 pgsql: Initialize tsId and dbId fields in WAL record of COMMIT PREPARED