mirror of
https://github.com/pgvector/pgvector.git
synced 2026-06-06 05:51:21 +08:00
Improved locking code
This commit is contained in:
@@ -432,21 +432,18 @@ BuildCallback(Relation index, CALLBACK_ITEM_POINTER, Datum *values,
|
||||
return;
|
||||
|
||||
/* Flush pages if needed */
|
||||
HnswLockAcquire(hnswshared);
|
||||
if (!graph->flushed && graph->memoryUsed >= graph->memoryTotal)
|
||||
{
|
||||
HnswLockAcquire(hnswshared);
|
||||
|
||||
if (!hnswshared)
|
||||
ereport(NOTICE,
|
||||
(errmsg("hnsw graph no longer fits into maintenance_work_mem after " INT64_FORMAT " tuples", (int64) graph->indtuples),
|
||||
errdetail("Building will take significantly more time."),
|
||||
errhint("Increase maintenance_work_mem to speed up builds.")));
|
||||
|
||||
if (!graph->flushed)
|
||||
FlushPages(buildstate);
|
||||
|
||||
HnswLockRelease(hnswshared);
|
||||
FlushPages(buildstate);
|
||||
}
|
||||
HnswLockRelease(hnswshared);
|
||||
|
||||
oldCtx = MemoryContextSwitchTo(buildstate->tmpCtx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user