From fdc0ef63923e46e8a19fa53ae8c46577fc10563b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Wed, 31 Jul 2019 20:41:54 +0000 Subject: [PATCH] Adaptive executor: use 2PC when replication_factor > 1 --- .../distributed/executor/adaptive_executor.c | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/src/backend/distributed/executor/adaptive_executor.c b/src/backend/distributed/executor/adaptive_executor.c index 49e37596c..64310c836 100644 --- a/src/backend/distributed/executor/adaptive_executor.c +++ b/src/backend/distributed/executor/adaptive_executor.c @@ -938,33 +938,14 @@ DistributedExecutionRequiresRollback(DistributedExecution *execution) return true; } - /* - * Checking the first task's placement list is not sufficient for all purposes since - * for append/range distributed tables we might have unequal number of placements for - * shards. However, it is safe to do here, because we're searching for a reference - * table. All other cases return false for this purpose. - */ - task = (Task *) linitial(taskList); if (list_length(task->taskPlacementList) > 1) { /* - * Some tasks don't set replicationModel thus we only - * rely on the anchorShardId, not replicationModel. - * - * TODO: Do we ever need replicationModel in the Task structure? - * Can't we always rely on anchorShardId? + * Adaptive executor opts to error out on queries if a placement is unhealthy, + * not marking the placement itself unhealthy in the process. + * Use 2PC to rollback placements before the unhealthy shard failed. */ - uint64 anchorShardId = task->anchorShardId; - if (anchorShardId != INVALID_SHARD_ID && ReferenceTableShardId(anchorShardId)) - { - return true; - } - - /* - * Single DML/DDL tasks with replicated tables (non-reference) - * should not require BEGIN/COMMIT/ROLLBACK. - */ - return false; + return true; } return false;