mirror of
https://github.com/pgvector/pgvector.git
synced 2026-06-06 05:51:21 +08:00
Added check for MVCC-compliant snapshot for HNSW index scans - closes #281
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
## 0.5.1 (unreleased)
|
||||
|
||||
- Added check for MVCC-compliant snapshot for HNSW index scans
|
||||
- Improved performance of index scans for IVFFlat after updates and deletes
|
||||
|
||||
## 0.5.0 (2023-08-28)
|
||||
|
||||
@@ -160,6 +160,11 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir)
|
||||
if (scan->orderByData == NULL)
|
||||
elog(ERROR, "cannot scan hnsw index without order");
|
||||
|
||||
/* Requires MVCC-compliant snapshot as not able to maintain a pin */
|
||||
/* https://www.postgresql.org/docs/current/index-locking.html */
|
||||
if (!IsMVCCSnapshot(scan->xs_snapshot))
|
||||
elog(ERROR, "non-MVCC snapshots are not supported with hnsw");
|
||||
|
||||
/* Get scan value */
|
||||
value = GetScanValue(scan);
|
||||
|
||||
@@ -201,15 +206,6 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir)
|
||||
scan->xs_ctup.t_self = *heaptid;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Typically, an index scan must maintain a pin on the index page
|
||||
* holding the item last returned by amgettuple. However, this is not
|
||||
* needed with the current vacuum strategy, which ensures scans do not
|
||||
* visit tuples in danger of being marked as deleted.
|
||||
*
|
||||
* https://www.postgresql.org/docs/current/index-locking.html
|
||||
*/
|
||||
|
||||
scan->xs_recheckorderby = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user