Added version to reduce stale reads and writes and prepare for optimistic locking

This commit is contained in:
Andrew Kane
2023-08-20 17:08:20 -07:00
parent 687263ccd4
commit ef1209eaf4
4 changed files with 16 additions and 6 deletions

View File

@@ -476,10 +476,12 @@ MarkDeleted(HnswVacuumState * vacuumstate)
ntup = (HnswNeighborTuple) PageGetItem(npage, PageGetItemId(npage, neighborOffno));
/* Overwrite element */
etup->version++;
etup->deleted = 1;
MemSet(&etup->vec.x, 0, etup->vec.dim * sizeof(float));
/* Overwrite neighbors */
ntup->version = etup->version;
for (int i = 0; i < ntup->count; i++)
ItemPointerSetInvalid(&ntup->indextids[i]);