From 439aca70f490fed8f3d89c75edb896fdd84652dc Mon Sep 17 00:00:00 2001 From: chenxiaobin <1025221611@qq.com> Date: Tue, 24 Nov 2020 21:07:48 +0800 Subject: [PATCH] solve conficts --- .../runtime/executor/execParallel.cpp | 5 ++++ .../runtime/executor/nodeIndexonlyscan.cpp | 27 +++++++++---------- src/include/executor/nodeIndexonlyscan.h | 1 + 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/gausskernel/runtime/executor/execParallel.cpp b/src/gausskernel/runtime/executor/execParallel.cpp index a1c592cd4..0c539ad13 100644 --- a/src/gausskernel/runtime/executor/execParallel.cpp +++ b/src/gausskernel/runtime/executor/execParallel.cpp @@ -478,6 +478,11 @@ static bool ExecParallelReInitializeDSM(PlanState* planstate, ParallelContext* p ExecIndexScanReInitializeDSM((IndexScanState*)planstate, pcxt); } break; + case T_IndexOnlyScanState: + if (planstate->plan->parallel_aware) { + ExecIndexOnlyScanReInitializeDSM((IndexOnlyScanState*)planstate, pcxt); + } + break; case T_AppendState: if (planstate->plan->parallel_aware) { ExecAppendReInitializeDSM((AppendState*)planstate, pcxt); diff --git a/src/gausskernel/runtime/executor/nodeIndexonlyscan.cpp b/src/gausskernel/runtime/executor/nodeIndexonlyscan.cpp index 98bd2b791..1fba81e4f 100755 --- a/src/gausskernel/runtime/executor/nodeIndexonlyscan.cpp +++ b/src/gausskernel/runtime/executor/nodeIndexonlyscan.cpp @@ -25,6 +25,7 @@ * parallel index-only scan * ExecIndexOnlyScanInitializeDSM initialize DSM for parallel * index-only scan + * ExecIndexOnlyScanReInitializeDSM reinitialize DSM for fresh scan * ExecIndexOnlyScanInitializeWorker attach to DSM info in parallel worker */ #include "postgres.h" @@ -260,17 +261,6 @@ TupleTableSlot* ExecIndexOnlyScan(IndexOnlyScanState* node) */ void ExecReScanIndexOnlyScan(IndexOnlyScanState* node) { - bool reset_parallel_scan = true; - - /* - * If we are here to just update the scan keys, then don't reset parallel - * scan. For detailed reason behind this look in the comments for - * ExecReScanIndexScan. - */ - if (node->ioss_NumRuntimeKeys != 0 && !node->ioss_RuntimeKeysReady) { - reset_parallel_scan = false; - } - /* * For recursive-stream rescan, if number of RuntimeKeys not euqal zero, * just return without rescan. @@ -331,10 +321,6 @@ void ExecReScanIndexOnlyScan(IndexOnlyScanState* node) node->ioss_NumScanKeys, node->ioss_OrderByKeys, node->ioss_NumOrderByKeys); - - if (reset_parallel_scan && GetIndexScanDesc(node->ioss_ScanDesc)->parallel_scan) { - index_parallelrescan(GetIndexScanDesc(node->ioss_ScanDesc)); - } } ExecScanReScan(&node->ss); @@ -898,6 +884,17 @@ void ExecIndexOnlyScanInitializeDSM(IndexOnlyScanState *node, ParallelContext *p } } +/* ---------------------------------------------------------------- + * ExecIndexOnlyScanReInitializeDSM + * + * Reset shared state before beginning a fresh scan. + * ---------------------------------------------------------------- + */ +void ExecIndexOnlyScanReInitializeDSM(IndexOnlyScanState *node, ParallelContext *pcxt) +{ + index_parallelrescan(GetIndexScanDesc(node->ioss_ScanDesc)); +} + /* ---------------------------------------------------------------- * ExecIndexOnlyScanInitializeWorker * diff --git a/src/include/executor/nodeIndexonlyscan.h b/src/include/executor/nodeIndexonlyscan.h index 7601fe104..c7cde9bac 100644 --- a/src/include/executor/nodeIndexonlyscan.h +++ b/src/include/executor/nodeIndexonlyscan.h @@ -28,5 +28,6 @@ extern void StoreIndexTuple(TupleTableSlot* slot, IndexTuple itup, TupleDesc itu /* Support functions for parallel index-only scans */ extern void ExecIndexOnlyScanEstimate(IndexOnlyScanState *node, ParallelContext *pcxt); extern void ExecIndexOnlyScanInitializeDSM(IndexOnlyScanState *node, ParallelContext *pcxt, int nodeid); +extern void ExecIndexOnlyScanReInitializeDSM(IndexOnlyScanState *node, ParallelContext *pcxt); extern void ExecIndexOnlyScanInitializeWorker(IndexOnlyScanState *node, void *context); #endif /* NODEINDEXONLYSCAN_H */