From ecddde963a012b973458ca9391ba79ecf7894771 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Tue, 30 Jun 2026 01:15:38 -0700 Subject: [PATCH] Added check to confirm in deletion list before marking as deleted --- src/hnswvacuum.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/hnswvacuum.c b/src/hnswvacuum.c index 3952c57..5f84fb6 100644 --- a/src/hnswvacuum.c +++ b/src/hnswvacuum.c @@ -637,6 +637,7 @@ MarkDeleted(HnswVacuumState * vacuumstate) Page npage; BlockNumber neighborPage; OffsetNumber neighborOffno; + ItemPointerData indextid; /* Skip neighbor tuples */ if (!HnswIsElementTuple(etup)) @@ -656,6 +657,18 @@ MarkDeleted(HnswVacuumState * vacuumstate) if (ItemPointerIsValid(&etup->heaptids[0])) continue; + /* Confirm in deletion list */ + ItemPointerSet(&indextid, blkno, offno); + if (!DeletingElement(vacuumstate->deleting, &indextid)) + { + /* + * Should not happen, but skip if it does since there may be + * connections from other elements + */ + elog(INFO, "hnsw element not in deletion list"); + continue; + } + /* Get neighbor page */ neighborPage = ItemPointerGetBlockNumber(&etup->neighbortid); neighborOffno = ItemPointerGetOffsetNumber(&etup->neighbortid);