mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-11 15:16:54 +08:00
Leave space for other objects in shared memory
This commit is contained in:
@@ -931,6 +931,7 @@ HnswBeginParallel(HnswBuildState * buildstate, bool isconcurrent, int request)
|
|||||||
Snapshot snapshot;
|
Snapshot snapshot;
|
||||||
Size esthnswshared;
|
Size esthnswshared;
|
||||||
Size esthnswarea;
|
Size esthnswarea;
|
||||||
|
Size estother;
|
||||||
HnswShared *hnswshared;
|
HnswShared *hnswshared;
|
||||||
char *hnswarea;
|
char *hnswarea;
|
||||||
HnswLeader *hnswleader = (HnswLeader *) palloc0(sizeof(HnswLeader));
|
HnswLeader *hnswleader = (HnswLeader *) palloc0(sizeof(HnswLeader));
|
||||||
@@ -961,7 +962,15 @@ HnswBeginParallel(HnswBuildState * buildstate, bool isconcurrent, int request)
|
|||||||
/* Estimate size of workspaces */
|
/* Estimate size of workspaces */
|
||||||
esthnswshared = ParallelEstimateShared(buildstate->heap, snapshot);
|
esthnswshared = ParallelEstimateShared(buildstate->heap, snapshot);
|
||||||
shm_toc_estimate_chunk(&pcxt->estimator, esthnswshared);
|
shm_toc_estimate_chunk(&pcxt->estimator, esthnswshared);
|
||||||
|
|
||||||
|
/* Leave space for other objects in shared memory */
|
||||||
|
/* Docker has a default limit of 64 MB for shm_size */
|
||||||
|
/* which happens to be the default value of maintenance_work_mem */
|
||||||
esthnswarea = maintenance_work_mem * 1024L;
|
esthnswarea = maintenance_work_mem * 1024L;
|
||||||
|
estother = 2 * 1024 * 1024;
|
||||||
|
if (esthnswarea > estother)
|
||||||
|
esthnswarea -= estother;
|
||||||
|
|
||||||
shm_toc_estimate_chunk(&pcxt->estimator, esthnswarea);
|
shm_toc_estimate_chunk(&pcxt->estimator, esthnswarea);
|
||||||
shm_toc_estimate_keys(&pcxt->estimator, 2);
|
shm_toc_estimate_keys(&pcxt->estimator, 2);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user