Commit e852c5df authored by Peter Eisentraut's avatar Peter Eisentraut

pg_dump: Formatting cleanup of new messages

parent 886c05d8
...@@ -140,7 +140,7 @@ init_parallel_dump_utils(void) ...@@ -140,7 +140,7 @@ init_parallel_dump_utils(void)
err = WSAStartup(MAKEWORD(2, 2), &wsaData); err = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (err != 0) if (err != 0)
{ {
fprintf(stderr, _("WSAStartup failed: %d\n"), err); fprintf(stderr, _("%s: WSAStartup failed: %d\n"), progname, err);
exit_nicely(1); exit_nicely(1);
} }
on_exit_nicely(shutdown_parallel_dump_utils, NULL); on_exit_nicely(shutdown_parallel_dump_utils, NULL);
...@@ -532,7 +532,7 @@ ParallelBackupStart(ArchiveHandle *AH, RestoreOptions *ropt) ...@@ -532,7 +532,7 @@ ParallelBackupStart(ArchiveHandle *AH, RestoreOptions *ropt)
if (pgpipe(pipeMW) < 0 || pgpipe(pipeWM) < 0) if (pgpipe(pipeMW) < 0 || pgpipe(pipeWM) < 0)
exit_horribly(modulename, exit_horribly(modulename,
"Cannot create communication channels: %s\n", "could not create communication channels: %s\n",
strerror(errno)); strerror(errno));
pstate->parallelSlot[i].workerStatus = WRKR_IDLE; pstate->parallelSlot[i].workerStatus = WRKR_IDLE;
...@@ -819,7 +819,7 @@ lockTableNoWait(ArchiveHandle *AH, TocEntry *te) ...@@ -819,7 +819,7 @@ lockTableNoWait(ArchiveHandle *AH, TocEntry *te)
if (!res || PQresultStatus(res) != PGRES_TUPLES_OK) if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
exit_horribly(modulename, exit_horribly(modulename,
"could not get relation name for oid %d: %s\n", "could not get relation name for OID %u: %s\n",
te->catalogId.oid, PQerrorMessage(AH->connection)); te->catalogId.oid, PQerrorMessage(AH->connection));
resetPQExpBuffer(query); resetPQExpBuffer(query);
...@@ -836,9 +836,9 @@ lockTableNoWait(ArchiveHandle *AH, TocEntry *te) ...@@ -836,9 +836,9 @@ lockTableNoWait(ArchiveHandle *AH, TocEntry *te)
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
exit_horribly(modulename, exit_horribly(modulename,
"could not obtain lock on relation \"%s\". This " "could not obtain lock on relation \"%s\"\n"
"usually means that someone requested an ACCESS EXCLUSIVE lock " "This usually means that someone requested an ACCESS EXCLUSIVE lock "
"on the table after the pg_dump parent process has gotten the " "on the table after the pg_dump parent process had gotten the "
"initial ACCESS SHARE lock on the table.\n", qualId); "initial ACCESS SHARE lock on the table.\n", qualId);
PQclear(res); PQclear(res);
...@@ -920,7 +920,7 @@ WaitForCommands(ArchiveHandle *AH, int pipefd[2]) ...@@ -920,7 +920,7 @@ WaitForCommands(ArchiveHandle *AH, int pipefd[2])
} }
else else
exit_horribly(modulename, exit_horribly(modulename,
"Unknown command on communication channel: %s\n", "unrecognized command on communication channel: %s\n",
command); command);
} }
} }
...@@ -950,7 +950,7 @@ ListenToWorkers(ArchiveHandle *AH, ParallelState *pstate, bool do_wait) ...@@ -950,7 +950,7 @@ ListenToWorkers(ArchiveHandle *AH, ParallelState *pstate, bool do_wait)
if (!msg) if (!msg)
{ {
if (do_wait) if (do_wait)
exit_horribly(modulename, "A worker process died unexpectedly\n"); exit_horribly(modulename, "a worker process died unexpectedly\n");
return; return;
} }
...@@ -977,7 +977,7 @@ ListenToWorkers(ArchiveHandle *AH, ParallelState *pstate, bool do_wait) ...@@ -977,7 +977,7 @@ ListenToWorkers(ArchiveHandle *AH, ParallelState *pstate, bool do_wait)
} }
else else
exit_horribly(modulename, exit_horribly(modulename,
"Invalid message received from worker: %s\n", msg); "invalid message received from worker: %s\n", msg);
} }
else if (messageStartsWith(msg, "ERROR ")) else if (messageStartsWith(msg, "ERROR "))
{ {
...@@ -986,7 +986,7 @@ ListenToWorkers(ArchiveHandle *AH, ParallelState *pstate, bool do_wait) ...@@ -986,7 +986,7 @@ ListenToWorkers(ArchiveHandle *AH, ParallelState *pstate, bool do_wait)
exit_horribly(modulename, "%s", msg + strlen("ERROR ")); exit_horribly(modulename, "%s", msg + strlen("ERROR "));
} }
else else
exit_horribly(modulename, "Invalid message received from worker: %s\n", msg); exit_horribly(modulename, "invalid message received from worker: %s\n", msg);
/* both Unix and Win32 return pg_malloc()ed space, so we free it */ /* both Unix and Win32 return pg_malloc()ed space, so we free it */
free(msg); free(msg);
...@@ -1035,7 +1035,7 @@ EnsureIdleWorker(ArchiveHandle *AH, ParallelState *pstate) ...@@ -1035,7 +1035,7 @@ EnsureIdleWorker(ArchiveHandle *AH, ParallelState *pstate)
while ((ret_worker = ReapWorkerStatus(pstate, &work_status)) != NO_SLOT) while ((ret_worker = ReapWorkerStatus(pstate, &work_status)) != NO_SLOT)
{ {
if (work_status != 0) if (work_status != 0)
exit_horribly(modulename, "Error processing a parallel work item.\n"); exit_horribly(modulename, "error processing a parallel work item\n");
nTerm++; nTerm++;
} }
...@@ -1079,7 +1079,7 @@ EnsureWorkersFinished(ArchiveHandle *AH, ParallelState *pstate) ...@@ -1079,7 +1079,7 @@ EnsureWorkersFinished(ArchiveHandle *AH, ParallelState *pstate)
ListenToWorkers(AH, pstate, true); ListenToWorkers(AH, pstate, true);
else if (work_status != 0) else if (work_status != 0)
exit_horribly(modulename, exit_horribly(modulename,
"Error processing a parallel work item\n"); "error processing a parallel work item\n");
} }
} }
...@@ -1107,7 +1107,7 @@ sendMessageToMaster(int pipefd[2], const char *str) ...@@ -1107,7 +1107,7 @@ sendMessageToMaster(int pipefd[2], const char *str)
if (pipewrite(pipefd[PIPE_WRITE], str, len) != len) if (pipewrite(pipefd[PIPE_WRITE], str, len) != len)
exit_horribly(modulename, exit_horribly(modulename,
"Error writing to the communication channel: %s\n", "could not write to the communication channel: %s\n",
strerror(errno)); strerror(errno));
} }
...@@ -1208,7 +1208,7 @@ getMessageFromWorker(ParallelState *pstate, bool do_wait, int *worker) ...@@ -1208,7 +1208,7 @@ getMessageFromWorker(ParallelState *pstate, bool do_wait, int *worker)
} }
if (i < 0) if (i < 0)
exit_horribly(modulename, "Error in ListenToWorkers(): %s", strerror(errno)); exit_horribly(modulename, "error in ListenToWorkers(): %s\n", strerror(errno));
for (i = 0; i < pstate->numWorkers; i++) for (i = 0; i < pstate->numWorkers; i++)
{ {
...@@ -1245,7 +1245,7 @@ sendMessageToWorker(ParallelState *pstate, int worker, const char *str) ...@@ -1245,7 +1245,7 @@ sendMessageToWorker(ParallelState *pstate, int worker, const char *str)
if (!aborting) if (!aborting)
#endif #endif
exit_horribly(modulename, exit_horribly(modulename,
"Error writing to the communication channel: %s\n", "could not write to the communication channel: %s\n",
strerror(errno)); strerror(errno));
} }
} }
...@@ -1319,7 +1319,7 @@ pgpipe(int handles[2]) ...@@ -1319,7 +1319,7 @@ pgpipe(int handles[2])
if ((s = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) if ((s = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
{ {
write_msg(modulename, "pgpipe could not create socket: %ui", write_msg(modulename, "pgpipe: could not create socket: error code %d\n",
WSAGetLastError()); WSAGetLastError());
return -1; return -1;
} }
...@@ -1330,28 +1330,28 @@ pgpipe(int handles[2]) ...@@ -1330,28 +1330,28 @@ pgpipe(int handles[2])
serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
if (bind(s, (SOCKADDR *) &serv_addr, len) == SOCKET_ERROR) if (bind(s, (SOCKADDR *) &serv_addr, len) == SOCKET_ERROR)
{ {
write_msg(modulename, "pgpipe could not bind: %ui", write_msg(modulename, "pgpipe: could not bind: error code %d\n",
WSAGetLastError()); WSAGetLastError());
closesocket(s); closesocket(s);
return -1; return -1;
} }
if (listen(s, 1) == SOCKET_ERROR) if (listen(s, 1) == SOCKET_ERROR)
{ {
write_msg(modulename, "pgpipe could not listen: %ui", write_msg(modulename, "pgpipe: could not listen: error code %d\n",
WSAGetLastError()); WSAGetLastError());
closesocket(s); closesocket(s);
return -1; return -1;
} }
if (getsockname(s, (SOCKADDR *) &serv_addr, &len) == SOCKET_ERROR) if (getsockname(s, (SOCKADDR *) &serv_addr, &len) == SOCKET_ERROR)
{ {
write_msg(modulename, "pgpipe could not getsockname: %ui", write_msg(modulename, "pgpipe: getsockname() failed: error code %d\n",
WSAGetLastError()); WSAGetLastError());
closesocket(s); closesocket(s);
return -1; return -1;
} }
if ((handles[1] = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) if ((handles[1] = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
{ {
write_msg(modulename, "pgpipe could not create socket 2: %ui", write_msg(modulename, "pgpipe: could not create second socket: error code %d\n",
WSAGetLastError()); WSAGetLastError());
closesocket(s); closesocket(s);
return -1; return -1;
...@@ -1359,14 +1359,14 @@ pgpipe(int handles[2]) ...@@ -1359,14 +1359,14 @@ pgpipe(int handles[2])
if (connect(handles[1], (SOCKADDR *) &serv_addr, len) == SOCKET_ERROR) if (connect(handles[1], (SOCKADDR *) &serv_addr, len) == SOCKET_ERROR)
{ {
write_msg(modulename, "pgpipe could not connect socket: %ui", write_msg(modulename, "pgpipe: could not connect socket: error code %d\n",
WSAGetLastError()); WSAGetLastError());
closesocket(s); closesocket(s);
return -1; return -1;
} }
if ((handles[0] = accept(s, (SOCKADDR *) &serv_addr, &len)) == INVALID_SOCKET) if ((handles[0] = accept(s, (SOCKADDR *) &serv_addr, &len)) == INVALID_SOCKET)
{ {
write_msg(modulename, "pgpipe could not accept socket: %ui", write_msg(modulename, "pgpipe: could not accept connection: error code %d\n",
WSAGetLastError()); WSAGetLastError());
closesocket(handles[1]); closesocket(handles[1]);
handles[1] = INVALID_SOCKET; handles[1] = INVALID_SOCKET;
......
...@@ -797,7 +797,7 @@ _WorkerJobDumpDirectory(ArchiveHandle *AH, TocEntry *te) ...@@ -797,7 +797,7 @@ _WorkerJobDumpDirectory(ArchiveHandle *AH, TocEntry *te)
/* This should never happen */ /* This should never happen */
if (!tctx) if (!tctx)
exit_horribly(modulename, "Error during backup\n"); exit_horribly(modulename, "error during backup\n");
/* /*
* This function returns void. We either fail and die horribly or * This function returns void. We either fail and die horribly or
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment