From: | Andres Freund <andres(at)2ndquadrant(dot)com> |
---|---|
To: | Kevin Grittner <kgrittn(at)ymail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Inaccuracy in VACUUM's tuple count estimates |
Date: | 2014-06-09 15:57:23 |
Message-ID: | 20140609155723.GC8406@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2014-06-09 08:00:52 -0700, Kevin Grittner wrote:
> I'm not actually sure yet whether the current state of affairs
> causes a problem for the serializable transaction isolation level
> implementation.
I'd replied in the other thread before noticing you'd replied
here... From what I understand right now it's not affected at all.
I tried to make things a bit clearer there - but I am not sure I've
succeed. I'm certainly willing to explain things further if you can tell
me which are is unclear.
> Right now the HTSV
> embedded code comments suggest that the enum names and comments
> don't accurately describe the conditions under which they are
> returned, but I can't find anything else which does, short of
> reverse-engineering that from some fairly complex code.
Not really. You could even argue the current code more correctly
represents the (old) comments:
HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */
HEAPTUPLE_DELETE_IN_PROGRESS /* deleting xact is still in progress */
the current code will return INSERT_IN_PROGRESS even if the tuple has
*also* been deleted in another xact...
I think the problem here is that there's simply no way to really
represent that case accurately with the current API.
> Perhaps it would be good if you could provide a concise description
> of the conditions under which value could currently be returned on
> this (or the related) thread before we talk about what changes
> might be needed? Maybe this is clear to others involved in the
> discussion, but I am not confident that I fully understand what
> gets returned under what conditions.
HEAPTUPLE_DEAD, /* tuple is dead and deletable */
1) xmin has committed, xmax has committed and wasn't just a locker. Xmax
precedes OldestXmin.
HEAPTUPLE_LIVE, /* tuple is live (committed, no deleter) */
1) xmin has committed, xmax unset
2) xmin has committed, xmax is locked only. Status of xmax is irrelevant
3) xmin has committed, xmax has aborted.
HEAPTUPLE_RECENTLY_DEAD, /* tuple is dead, but not deletable yet */
1) xmin has committed, xmax has committed and wasn't only a locker. But
xmax doesn't precede OldestXmin.
HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */
new:
1) xmin is in progress, xmin is the current backend, xmax is invalid
2) xmin is in progress, xmin is the current backend, xmax only a locker
3) xmin is in progress, xmin is the current backend, xmax aborted
4) xmin is in progress, xmin is *not* current backend, xmax is irrelevant
old:
1) xmin is in progress, xmax is invalid
2) xmin is in progress, xmax is only a locker
HEAPTUPLE_DELETE_IN_PROGRESS /* deleting xact is still in progress */
new:
1) xmin has committed, xmax is in progress, xmax is not just a locker
2) xmin is in progress, xmin is the current backend, xmax is not just a
locker and in progress.
old:
1) xmin has committed, xmax is in progress, xmax is not just a locker
2) xmin is in progress, xmax is set and not not just a locker
Note that the 2) case here never checked xmax's status.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2014-06-09 15:59:03 | Re: NUMA packaging and patch |
Previous Message | Linos | 2014-06-09 15:35:33 | Re: performance regression in 9.2/9.3 |