Question about WAL and XID

Started by Boszormenyi Zoltanalmost 16 years ago3 messages
#1Boszormenyi Zoltan
zb@cybertec.at

Hi,

am I right that an XID is global across the whole DB cluster
under the same $PGDATA? I am asking because in the WAL
record, the first thing sent is an XLogRecord which contains

TransactionId xl_xid;

and as the comment in access/xlog.h says:

/*
* The overall layout of an XLOG record is:
* Fixed-size header (XLogRecord struct)
* rmgr-specific data
* BkpBlock
* backup block data
* BkpBlock
* backup block data
* ...

And the BkpBlock structure contains the RelFileNode info,
the triplet for tablespace/database/relation.

Or is it completely backwards?

I am asking this because I need to check
TransactionIdDidCommit(XLogRecord->xl_xid)
from the walreciver. Can I expect it to work on any
xl_xid that walreceiver encounters?

Best regards,
Zolt�n B�sz�rm�nyi

--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zolt�n B�sz�rm�nyi
Cybertec Sch�nig & Sch�nig GmbH
http://www.postgresql.at/

#2Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Boszormenyi Zoltan (#1)
Re: Question about WAL and XID

Boszormenyi Zoltan wrote:

am I right that an XID is global across the whole DB cluster
under the same $PGDATA?

Yes.

I am asking this because I need to check
TransactionIdDidCommit(XLogRecord->xl_xid)
from the walreciver. Can I expect it to work on any
xl_xid that walreceiver encounters?

Walreceiver is only responsible for receiving the WAL from the master
server, and write to disk. It doesn't apply the log, it doesn't look
into the contents at all. So TransactionIdDidCommit(XLogRecord->xl_xid)
always returns false on WAL it has received, because it hasn't been
applied yet.

What are you trying to do?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

#3Boszormenyi Zoltan
zb@cybertec.at
In reply to: Heikki Linnakangas (#2)
Re: Question about WAL and XID

Hi,

Heikki Linnakangas �rta:

Boszormenyi Zoltan wrote:

am I right that an XID is global across the whole DB cluster
under the same $PGDATA?

Yes.

I am asking this because I need to check
TransactionIdDidCommit(XLogRecord->xl_xid)
from the walreciver. Can I expect it to work on any
xl_xid that walreceiver encounters?

Walreceiver is only responsible for receiving the WAL from the master
server, and write to disk. It doesn't apply the log, it doesn't look
into the contents at all. So TransactionIdDidCommit(XLogRecord->xl_xid)
always returns false on WAL it has received, because it hasn't been
applied yet.

I guessed so, I intended to collect the xl_xid values in a cache array
and check periodically.

What are you trying to do?

Synchronous replication. :-)

Best regards,
Zolt�n B�sz�rm�nyi

--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zolt�n B�sz�rm�nyi
Cybertec Sch�nig & Sch�nig GmbH
http://www.postgresql.at/