From b9780956c3752cdbb92ecac69fb7f3f1ed094a7a Mon Sep 17 00:00:00 2001 From: Hadi Moshayedi Date: Thu, 26 Apr 2018 12:05:24 -0400 Subject: [PATCH] Fail task in real-time executor if no placements found. (#2133) --- .../executor/multi_real_time_executor.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/backend/distributed/executor/multi_real_time_executor.c b/src/backend/distributed/executor/multi_real_time_executor.c index c13c41a78..0cab7de7b 100644 --- a/src/backend/distributed/executor/multi_real_time_executor.c +++ b/src/backend/distributed/executor/multi_real_time_executor.c @@ -300,8 +300,20 @@ ManageTaskExecution(Task *task, TaskExecution *taskExecution, placementAccessList = BuildPlacementSelectList(taskPlacement->groupId, relationShardList); - /* should at least have an entry for the anchor shard */ - Assert(list_length(placementAccessList) > 0); + /* + * Should at least have an entry for the anchor shard. If this is not the + * case, we should have errored out in the physical planner. We are + * rechecking here until we find the root cause of + * https://github.com/citusdata/citus/issues/2092. + */ + if (placementAccessList == NIL) + { + ereport(WARNING, (errmsg("could not find any placements for task %d", + task->taskId))); + taskStatusArray[currentIndex] = EXEC_TASK_FAILED; + + break; + } connectionId = MultiClientPlacementConnectStart(placementAccessList, NULL);