Fixed invalid memory alloc request size error with HNSW - fixes #43

This commit is contained in:
Andrew Kane
2023-12-04 15:00:32 -08:00
parent c653ac524f
commit a156f6c7ae
2 changed files with 4 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
## 0.5.2 (unreleased)
- Added support for on-disk parallel index builds for HNSW
- Fixed `invalid memory alloc request size` error with HNSW
## 0.5.1 (2023-10-10)

View File

@@ -56,6 +56,8 @@
#define PARALLEL_KEY_HNSW_SHARED UINT64CONST(0xA000000000000001)
#define PARALLEL_KEY_QUERY_TEXT UINT64CONST(0xA000000000000002)
#define LIST_MAX_LENGTH ((1 << 26) - 1)
/*
* Create the metapage
*/
@@ -381,7 +383,7 @@ BuildCallback(Relation index, CALLBACK_ITEM_POINTER, Datum *values,
if (isnull[0])
return;
if (buildstate->memoryLeft <= 0)
if (buildstate->memoryLeft <= 0 || list_length(buildstate->elements) == LIST_MAX_LENGTH)
{
if (!buildstate->flushed)
{