Re: 回复: [PATCH] BUG FIX: Core dump could happen when VACUUM FULL in standalone mode

Поиск
Список
Период
Сортировка
Yulin PEI <ypeiae@connect.ust.hk> writes:
> Yes, I agree because (IsNormalProcessingMode() ) means that current process is not in bootstrap mode and postmaster
processwill not build index. 
> So my new modified patch is attached.

This is a good catch, but the proposed fix still seems pretty random
and unlike how it's done elsewhere.  It seems to me that since
index_build() is relying on plan_create_index_workers() to assess
parallel safety, that's where to check IsUnderPostmaster.  Moreover,
the existing code in compute_parallel_vacuum_workers (which gets
this right) associates the IsUnderPostmaster check with the initial
check on max_parallel_maintenance_workers.  So I think that the
right fix is to adopt the compute_parallel_vacuum_workers coding
in plan_create_index_workers, and thereby create a model for future
uses of max_parallel_maintenance_workers to follow.

            regards, tom lane

diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 247f7d4625..1a94b58f8b 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -6375,8 +6375,11 @@ plan_create_index_workers(Oid tableOid, Oid indexOid)
     double        reltuples;
     double        allvisfrac;

-    /* Return immediately when parallelism disabled */
-    if (max_parallel_maintenance_workers == 0)
+    /*
+     * We don't allow performing parallel operation in standalone backend or
+     * when parallelism is disabled.
+     */
+    if (!IsUnderPostmaster || max_parallel_maintenance_workers == 0)
         return 0;

     /* Set up largely-dummy planner state */

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Anastasia Lubennikova
Дата:
Сообщение: Re: [PATCH] remove deprecated v8.2 containment operators
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] remove deprecated v8.2 containment operators