Skip to content

Commit

Permalink
Clean up error messages
Browse files Browse the repository at this point in the history
Made them conform to PostgreSQL style suggestions and added hints where
appropriate (sourced directly from similar PostgreSQL hints).
  • Loading branch information
jasonmp85 committed Mar 5, 2015
1 parent 9f5ebad commit da8c7b1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions repair_shards.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ master_copy_shard_placement(PG_FUNCTION_ARGS)
ddlCommandList);
if (!recreated)
{
ereport(ERROR, (errmsg("could not recreate table to receive placement data")));
ereport(ERROR, (errmsg("could not recreate shard table"),
errhint("Consult recent messages in the server logs for "
"details.")));
}

HOLD_INTERRUPTS();
Expand All @@ -121,7 +123,9 @@ master_copy_shard_placement(PG_FUNCTION_ARGS)
sourcePlacement, targetPlacement);
if (!dataCopied)
{
ereport(ERROR, (errmsg("failed to copy placement data")));
ereport(ERROR, (errmsg("could not copy shard data"),
errhint("Consult recent messages in the server logs for "
"details.")));
}

/* the placement is repaired, so return to finalized state */
Expand Down Expand Up @@ -175,7 +179,9 @@ worker_copy_shard_placement(PG_FUNCTION_ARGS)
fetchSuccessful = ExecuteTaskAndStoreResults(task, tupleDescriptor, tupleStore);
if (!fetchSuccessful)
{
ereport(ERROR, (errmsg("could not receive query results")));
ereport(ERROR, (errmsg("could not store shard rows from healthy placement"),
errhint("Consult recent messages in the server logs for "
"details.")));
}

CopyDataFromTupleStoreToRelation(tupleStore, shardTable);
Expand Down Expand Up @@ -215,7 +221,8 @@ SearchShardPlacementInList(List *shardPlacementList, text *nodeNameText, int32 n
if (matchingPlacement == NULL)
{
ereport(ERROR, (errmsg("could not find placement matching %s:%d", nodeName,
nodePort)));
nodePort),
errhint("Confirm the placement still exists and try again.")));
}

return matchingPlacement;
Expand Down

0 comments on commit da8c7b1

Please sign in to comment.