Add HINT to error when creating shards but there aren't enough workers.

Previously we returned this:

brian=# select master_create_empty_shard('tablz');
ERROR:  could only find 1 of 2 possible nodes

Now we return this:

brian=# select master_create_empty_shard('tablz');
ERROR:  could only find 1 of 2 possible nodes
HINT:  If this is a development cluster, consider running SET citus.shard_replication_factor = 1;

Which I think could be useful for newer users.
pull/415/head
Brian Cloutier 2016-03-29 08:49:06 -07:00
parent ac05e561ed
commit aa6cefacca
2 changed files with 9 additions and 3 deletions

View File

@ -359,7 +359,9 @@ master_get_local_first_candidate_nodes(PG_FUNCTION_ARGS)
if (candidateNode == NULL) if (candidateNode == NULL)
{ {
ereport(ERROR, (errmsg("could only find %u of %u required nodes", ereport(ERROR, (errmsg("could only find %u of %u required nodes",
currentNodeCount, desiredNodeCount))); currentNodeCount, desiredNodeCount),
errhint("If you're running a development cluster, consider running"
" SET citus.shard_replication_factor = %u;", currentNodeCount)));
} }
} }
@ -449,7 +451,9 @@ master_get_round_robin_candidate_nodes(PG_FUNCTION_ARGS)
if (candidateNode == NULL) if (candidateNode == NULL)
{ {
ereport(ERROR, (errmsg("could only find %u of %u required nodes", ereport(ERROR, (errmsg("could only find %u of %u required nodes",
currentNodeCount, desiredNodeCount))); currentNodeCount, desiredNodeCount),
errhint("If you're running a development cluster, consider running"
" SET citus.shard_replication_factor = %u;", currentNodeCount)));
} }
candidateDatum = WorkerNodeGetDatum(candidateNode, functionContext->tuple_desc); candidateDatum = WorkerNodeGetDatum(candidateNode, functionContext->tuple_desc);

View File

@ -120,7 +120,9 @@ master_create_empty_shard(PG_FUNCTION_ARGS)
if (candidateNode == NULL) if (candidateNode == NULL)
{ {
ereport(ERROR, (errmsg("could only find %u of %u possible nodes", ereport(ERROR, (errmsg("could only find %u of %u possible nodes",
candidateNodeCount, attemptableNodeCount))); candidateNodeCount, attemptableNodeCount),
errhint("If this is a development cluster, consider running"
" SET citus.shard_replication_factor = %u;", candidateNodeCount)));
} }
candidateNodeList = lappend(candidateNodeList, candidateNode); candidateNodeList = lappend(candidateNodeList, candidateNode);