pgvector.git / summary / log / commit / refs

commit    ffe28bb954cb5d7af7bfe7842600eccf3f87c2ce
Author:   Bhagyesh Chaturvedi <bhagyeshc@google.com>
Date:     Tue Jun 23 06:00:23 2026 +0000

    Fix HNSW insert and vacuum race


src/hnswvacuum.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hnswvacuum.c b/src/hnswvacuum.c index 8361b315..40e8588c 100644 --- a/src/hnswvacuum.c +++ b/src/hnswvacuum.c @@ -584,13 +584,16 @@ MarkDeleted(HnswVacuumState * vacuumstate) BufferAccessStrategy bas = vacuumstate->bas; /* - * Wait for index scans to complete. Scans before this point may contain - * tuples about to be deleted. Scans after this point will not, since the - * graph has been repaired. + * Wait for index scans and inserts to complete. Scans and inserts before + * this point may contain tuples about to be deleted. Scans and inserts + * after this point will not, since the graph has been repaired. */ LockPage(index, HNSW_SCAN_LOCK, ExclusiveLock); UnlockPage(index, HNSW_SCAN_LOCK, ExclusiveLock); + LockPage(index, HNSW_UPDATE_LOCK, ExclusiveLock); + UnlockPage(index, HNSW_UPDATE_LOCK, ExclusiveLock); + while (BlockNumberIsValid(blkno)) { Buffer buf; [parent: 0dbc1a27c05f]