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