Revert "Added IndexTuple to HNSW elements (first step to support multiple attributes)"

This reverts commit 53a8734bac.
This commit is contained in:
Andrew Kane
2024-10-11 14:57:57 -07:00
parent 53a8734bac
commit a2408e60fa
4 changed files with 23 additions and 51 deletions

View File

@@ -687,7 +687,7 @@ UpdateGraphOnDisk(Relation index, HnswSupport * support, HnswElement element, in
* Insert a tuple into the index
*/
bool
HnswInsertTupleOnDisk(Relation index, HnswSupport * support, TupleDesc tupdesc, IndexTuple itup, ItemPointer heaptid, bool building)
HnswInsertTupleOnDisk(Relation index, HnswSupport * support, Datum value, ItemPointer heaptid, bool building)
{
HnswElement entryPoint;
HnswElement element;
@@ -695,7 +695,6 @@ HnswInsertTupleOnDisk(Relation index, HnswSupport * support, TupleDesc tupdesc,
int efConstruction = HnswGetEfConstruction(index);
LOCKMODE lockmode = ShareLock;
char *base = NULL;
bool unused;
/*
* Get a shared lock. This allows vacuum to ensure no in-flight inserts
@@ -709,8 +708,7 @@ HnswInsertTupleOnDisk(Relation index, HnswSupport * support, TupleDesc tupdesc,
/* Create an element */
element = HnswInitElement(base, heaptid, m, HnswGetMl(m), HnswGetMaxLevel(m), NULL);
HnswPtrStore(base, element->itup, itup);
HnswPtrStore(base, element->value, DatumGetPointer(index_getattr(itup, 1, tupdesc, &unused)));
HnswPtrStore(base, element->value, DatumGetPointer(value));
/* Prevent concurrent inserts when likely updating entry point */
if (entryPoint == NULL || element->level > entryPoint->level)
@@ -744,18 +742,17 @@ HnswInsertTupleOnDisk(Relation index, HnswSupport * support, TupleDesc tupdesc,
static void
HnswInsertTuple(Relation index, Datum *values, bool *isnull, ItemPointer heaptid)
{
IndexTuple itup;
Datum value;
const HnswTypeInfo *typeInfo = HnswGetTypeInfo(index);
HnswSupport support;
TupleDesc tupdesc = HnswTupleDesc(index);
HnswInitSupport(&support, index);
/* Form index tuple */
if (!HnswFormIndexTuple(&itup, values, isnull, typeInfo, &support, tupdesc))
/* Form index value */
if (!HnswFormIndexValue(&value, values, isnull, typeInfo, &support))
return;
HnswInsertTupleOnDisk(index, &support, tupdesc, itup, heaptid, false);
HnswInsertTupleOnDisk(index, &support, value, heaptid, false);
}
/*