From 4be69bbf6f443aaabdb7b28a4e7ba6350aa4d09b Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Mon, 6 Jan 2020 14:34:19 +0100 Subject: [PATCH] Fix reference table issue --- .../distributed/connection/placement_connection.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/backend/distributed/connection/placement_connection.c b/src/backend/distributed/connection/placement_connection.c index cb13ebfcc..b40232492 100644 --- a/src/backend/distributed/connection/placement_connection.c +++ b/src/backend/distributed/connection/placement_connection.c @@ -1051,7 +1051,14 @@ CheckShardPlacements(ConnectionShardHashEntry *shardEntry) } } - if (failures > 0 && successes == 0) + /* + * If there were any failures we want to bail on a commit in two situations: + * there were no successes, or there was a failure with a reference table shard. + * Ideally issues with a reference table will've errored out earlier, + * but if not, we abort now to avoid an unhealthy reference table shard. + */ + if (failures > 0 && + (successes == 0 || ReferenceTableShardId(shardEntry->key.shardId))) { return false; }