mirror of https://github.com/citusdata/citus.git
Adaptive executor: use 2PC when replication_factor > 1
parent
19bcb1b4f7
commit
fdc0ef6392
|
@ -938,35 +938,16 @@ DistributedExecutionRequiresRollback(DistributedExecution *execution)
|
||||||
return true;
|
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)
|
if (list_length(task->taskPlacementList) > 1)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Some tasks don't set replicationModel thus we only
|
* Adaptive executor opts to error out on queries if a placement is unhealthy,
|
||||||
* rely on the anchorShardId, not replicationModel.
|
* not marking the placement itself unhealthy in the process.
|
||||||
*
|
* Use 2PC to rollback placements before the unhealthy shard failed.
|
||||||
* TODO: Do we ever need replicationModel in the Task structure?
|
|
||||||
* Can't we always rely on anchorShardId?
|
|
||||||
*/
|
*/
|
||||||
uint64 anchorShardId = task->anchorShardId;
|
|
||||||
if (anchorShardId != INVALID_SHARD_ID && ReferenceTableShardId(anchorShardId))
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Single DML/DDL tasks with replicated tables (non-reference)
|
|
||||||
* should not require BEGIN/COMMIT/ROLLBACK.
|
|
||||||
*/
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue