Re: New vacuum option to do only freezing
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>,
Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>,
"Bossart,
Nathan" <bossartn@amazon.com>,
Alvaro Herrera <alvherre@2ndquadrant.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2019-04-15T17:13:01Z
Lists: pgsql-hackers
Masahiko Sawada <sawada.mshk@gmail.com> writes: >> Ugh, I think the assertion is right but the above condition is >> completely wrong. We should increment nleft_dead_tuples when index >> cleanup is *not* enabled. > Here is a draft patch to fix this issue. So the real issue here, I fear, is that we've got no consistent testing of the whole case block for HEAPTUPLE_DEAD, as you can easily confirm by checking the code coverage report at https://coverage.postgresql.org/src/backend/access/heap/vacuumlazy.c.gcov.html This is perhaps unsurprising, given the code comment that points out that we can only reach that block if the tuple's state changed since heap_page_prune() a few lines above. Still, it means that this patch hasn't been tested in that scenario, until we were lucky enough for a slow buildfarm machine like topminnow to hit it. What's more, because that block is the only way for "tupgone" to be set, we also don't reach the "if (tupgone)" block at lines 1183ff. And I think this patch has probably broken that, too. Surely, if we are not going to remove the tuple, we should not increment tups_vacuumed? And maybe we have to freeze it instead? How is it that we can, or should, treat this situation as different from a dead-but-not-removable tuple? I have a very strong feeling that this patch was not fully baked. BTW, I can reproduce the crash fairly easily (within a few cycles of the regression tests) by (a) inserting pg_usleep(10000) after the heap_page_prune call, and (b) making autovacuum much more aggressive. regards, tom lane
Commits
-
Add toast-level reloption for vacuum_index_cleanup
- ce59b75d449d 12.0 landed
-
heap_prepare_freeze_tuple: Simplify coding
- 2bf372a4ae26 12.0 landed
-
Fix missing word.
- 6665305e17ed 12.0 landed
-
Allow VACUUM to be run with index cleanup disabled.
- a96c41feec6b 12.0 landed
-
Don't mark pages all-visible spuriously
- d2599ecfcc74 11.0 cited