Make vacuum a bit more verbose to debug BF failure.
authorAndres Freund <andres@anarazel.de>
Sun, 16 Aug 2020 19:57:01 +0000 (12:57 -0700)
committerAndres Freund <andres@anarazel.de>
Sun, 16 Aug 2020 19:57:01 +0000 (12:57 -0700)
This is temporary. While possibly some more error checking / debugging
in this path would be a good thing, it'll not look exactly like this.

Discussion: https://postgr.es/m/20200816181604.l54m6kss5ntd6xow@alap3.anarazel.de

src/backend/access/heap/heapam.c
src/backend/access/heap/vacuumlazy.c

index 9b5f417eac442bfe8e00312f41bbbe0377a1466a..8eb276e46449f6d65fc9ab153b76233471e738d9 100644 (file)
@@ -6048,7 +6048,16 @@ FreezeMultiXactId(MultiXactId multi, uint16 t_infomask,
                                TransactionIdIsInProgress(members[i].xid))
                        {
                                /* running locker cannot possibly be older than the cutoff */
-                               Assert(!TransactionIdPrecedes(members[i].xid, cutoff_xid));
+                               if (TransactionIdPrecedes(members[i].xid, cutoff_xid))
+                               {
+                                       /* temporary on-bf debugging */
+                                       elog(PANIC, "too old alive locker: multi: %u, member xid: %u, memb-current: %d, memb-progress: %d, cutoff: %u, cutoff-multi: %u, relfrozenxid: %u, relminmxid: %u",
+                                                multi, members[i].xid,
+                                                TransactionIdIsCurrentTransactionId(members[i].xid),
+                                                TransactionIdIsInProgress(members[i].xid),
+                                                cutoff_xid, cutoff_multi,
+                                                relfrozenxid, relminmxid);
+                               }
                                newmembers[nnewmembers++] = members[i];
                                has_lockers = true;
                        }
index 44e2224dd557bd693d6e0ee113c51ac893c6ad02..03c8e1ff7ea9f2a7f120d4c1cfa3b9566ef7f861 100644 (file)
@@ -1350,7 +1350,14 @@ lazy_scan_heap(Relation onerel, VacuumParams *params, LVRelStats *vacrelstats,
                                        if (HeapTupleIsHotUpdated(&tuple) ||
                                                HeapTupleIsHeapOnly(&tuple) ||
                                                params->index_cleanup == VACOPT_TERNARY_DISABLED)
+                                       {
+                                               /* temporary on-bf debugging */
+                                               elog(LOG, "treating dead HOT tuple (updated %d, heap only: %d, index cleanup: %d) as alive",
+                                                        HeapTupleIsHotUpdated(&tuple), HeapTupleIsHeapOnly(&tuple),
+                                                        params->index_cleanup == VACOPT_TERNARY_DISABLED);
+
                                                nkeep += 1;
+                                       }
                                        else
                                                tupgone = true; /* we can delete the tuple */
                                        all_visible = false;