Skip to content

Commit 93c0ec1

Browse files
Green-Chanemelsimsek
authored andcommitted
Fix server crash when trying to execute activate_node_snapshot() on a single-node cluster (#7552)
This fixes #7551 reported by Egor Chindyaskin Function activate_node_snapshot() is not meant to be called on a cluster without worker nodes. This commit adds ERROR report for such case to prevent server crash.
1 parent 34883d6 commit 93c0ec1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/backend/distributed/test/metadata_sync.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ activate_node_snapshot(PG_FUNCTION_ARGS)
5050
* so we are using first primary worker node just for test purposes.
5151
*/
5252
WorkerNode *dummyWorkerNode = GetFirstPrimaryWorkerNode();
53+
if (dummyWorkerNode == NULL)
54+
{
55+
ereport(ERROR, (errmsg("no worker nodes found"),
56+
errdetail("Function activate_node_snapshot is meant to be "
57+
"used when running tests on a multi-node cluster "
58+
"with workers.")));
59+
}
5360

5461
/*
5562
* Create MetadataSyncContext which is used throughout nodes' activation.

0 commit comments

Comments
 (0)