pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14360: snapshot too old bug? cann't reclaim dead tuple after has only xmin's transaction.
2+ messages / 2 participants
[nested] [flat]

* BUG #14360: snapshot too old bug? cann't reclaim dead tuple after has only xmin's transaction.
@ 2016-10-07 14:54 digoal@126.com
  2016-10-07 21:10 ` Re: BUG #14360: snapshot too old bug? cann't reclaim dead tuple after has only xmin's transaction. Kevin Grittner <kgrittn@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: digoal@126.com @ 2016-10-07 14:54 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      14360
Logged by:          Zhou Digoal
Email address:      digoal@126.com
PostgreSQL version: 9.6.0
Operating system:   CentOS 6.x x64
Description:        

```
session a:  
postgres=# select pg_sleep(1000);

then : 
session b:  
postgres=# insert into tbl1 values (1);
INSERT 0 1
postgres=# delete from tbl1;
DELETE 1
postgres=# insert into tbl1 values (1);
INSERT 0 1
postgres=# delete from tbl1;
DELETE 1

after old_snapshot_threshold: 
cann't reclaim tbl1's dead tuple


but when it scan tbl1 , and then after old_snapshot_threshold again, it's ok
now. 

postgres=# vacuum verbose tbl1;
INFO:  vacuuming "public.tbl1"
INFO:  "tbl1": found 0 removable, 2 nonremovable row versions in 1 out of 1
pages
DETAIL:  2 dead row versions cannot be removed yet.
There were 2 unused item pointers.
Skipped 0 pages due to buffer pins.
0 pages are entirely empty.
CPU 0.00s/0.00u sec elapsed 0.00 sec.
VACUUM


postgres=# vacuum verbose tbl1;
INFO:  vacuuming "public.tbl1"
INFO:  "tbl1": found 0 removable, 0 nonremovable row versions in 1 out of 1
pages
DETAIL:  0 dead row versions cannot be removed yet.
There were 4 unused item pointers.
Skipped 0 pages due to buffer pins.
0 pages are entirely empty.
CPU 0.00s/0.00u sec elapsed 0.00 sec.
```


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #14360: snapshot too old bug? cann't reclaim dead tuple after has only xmin's transaction.
  2016-10-07 14:54 BUG #14360: snapshot too old bug? cann't reclaim dead tuple after has only xmin's transaction. digoal@126.com
@ 2016-10-07 21:10 ` Kevin Grittner <kgrittn@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Kevin Grittner @ 2016-10-07 21:10 UTC (permalink / raw)
  To: digoal@126.com; +Cc: pgsql-bugs

On Fri, Oct 7, 2016 at 9:54 AM,  <digoal@126.com> wrote:

> [tuple visible to "old snapshot" is vacuumed early, but not at
> the first vacuum where the age could allow it]

Not a bug.

Note that the documentation here:

https://www.postgresql.org/docs/9.6/static/runtime-config-resource.html#GUC-OLD-SNAPSHOT-THRESHOLD

Says:

| This setting does not attempt to guarantee that an error will be
| generated under any particular circumstances.

To perform the early cleanup more eagerly would require more
locking of internal structures, which would cause a noticeable
performance hit.  Since the point of this setting is to improve
performance (by limiting bloat), there is a trade-off; heuristics
are used to balance the need for cleanup with the need to avoid as
much lock contention as possible.

If you have a realistic workload which allows enough bloat to have
a significant affect on performance because this heuristic seems
not to be striking the right balance, I would be interested in
seeing the details; but this simple case seems to get there quickly
enough to not pose such a risk.

Even in such a case, it would likely fall more under the rubric of
tuning than something that would be considered a bug.  To be a bug,
it would need to have some affect when disabled, prune away tuples
modified by a transaction which is still active, generate an error
on a snapshot not past the threshold, generate an error on access
to a page which was not modified after the snapshot was taken, or
something similar.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-10-07 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-10-07 14:54 BUG #14360: snapshot too old bug? cann't reclaim dead tuple after has only xmin's transaction. digoal@126.com
2016-10-07 21:10 ` Kevin Grittner <kgrittn@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox