mirror of https://github.com/citusdata/citus.git
Adaptive executor: use 2PC when replication_factor > 1
parent
19bcb1b4f7
commit
fdc0ef6392
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue