Re: transaction abort

Lists: pgsql-hackers
From: postgresql <postgresql(at)db(dot)pku(dot)edu(dot)cn>
To: pgsql-hackers(at)postgresql(dot)org <pgsql-hackers(at)postgresql(dot)org>
Subject: transaction abort
Date: 2003-03-17 09:35:45
Message-ID: 200303171726375.SM01104@gaojun
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi all.
I have read some codes on transaction abort operation. When the transaction abort, it seem that
all the tuples related in the transaction have not been deal with. it XMIN equals to the tuple create transaction
ID. Its XMAX equals null. Of cource , It make some records on the pg_log.
So I have one question, how the system know which tuple is valid? do it need the help of pg_log? That is
,we check for a tuple with XMIN is valid and the sign in pg_log means COMMIT?
Thank for any comments
Josh


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: postgresql <postgresql(at)db(dot)pku(dot)edu(dot)cn>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: transaction abort
Date: 2003-03-17 14:13:52
Message-ID: 5799.1047910432@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

postgresql <postgresql(at)db(dot)pku(dot)edu(dot)cn> writes:
> SGkgYWxsLg0KICAgIEkgaGF2ZSByZWFkIHNvbWUgY29kZXMgb24gdHJhbnNh
> Y3Rpb24gYWJvcnQgb3BlcmF0aW9uLiAgV2hlbiB0aGUgdHJhbnNhY3Rpb24g
> YWJvcnQsIGl0IHNlZW0gdGhhdCANCmFsbCB0aGUgdHVwbGVzIHJlbGF0ZWQg
> aW4gdGhlIHRyYW5zYWN0aW9uIGhhdmUgbm90IGJlZW4gZGVhbCB3aXRoLiBp
> dCBYTUlOIGVxdWFscyB0byB0aGUgdHVwbGUgY3JlYXRlIHRyYW5zYWN0aW9u
> [snip]

Please don't MIME-encode your mail unnecessarily. It makes it difficult
to quote it :-(

Anyway, to answer your question: tuples inserted by a failed transaction
need not be deleted right away. No other transaction will consider them
good, since their XMIN isn't committed (and yes, we need pg_log for that).
The next VACUUM will get rid of them.

regards, tom lane