Adaptive executor: use 2PC when replication_factor > 1

pull/2858/head
Philip Dubé 2019-07-31 20:41:54 +00:00
parent 19bcb1b4f7
commit fdc0ef6392
1 changed files with 4 additions and 23 deletions

View File

@ -938,35 +938,16 @@ 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 false;
}