pgbackrest.git / summary / log / commit / refs
commit 25cea0bd0a22de2f83a2ded786e2facc86ff4b10
Author: David Steele <david@pgmasters.net>
Date: Tue Apr 09 15:08:27 2019 +0000
Add process id to C archive-get and archive-push logging.
This was missed in the original migration. There was no functional issue, but logging the process ids is useful for debugging.
doc/xml/release.xml | 4 ++++
src/command/archive/get/get.c | 8 +++++---
src/command/archive/push/push.c | 6 ++++--
test/src/module/command/archiveGetTest.c | 8 ++++----
test/src/module/command/archivePushTest.c | 6 +++---
5 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/doc/xml/release.xml b/doc/xml/release.xml
index dcd14b867..76bca7033 100644
--- a/doc/xml/release.xml
+++ b/doc/xml/release.xml
@@ -105,6 +105,10 @@
<p>Add process id to <code>ProtocolParallelJob</code>.</p>
</release-item>
+ <release-item>
+ <p>Add process id to C <cmd>archive-get</cmd> and <cmd>archive-push</cmd> logging.</p>
+ </release-item>
+
<release-item>
<p>Close log file before <code>exec()</code>.</p>
</release-item>
diff --git a/src/command/archive/get/get.c b/src/command/archive/get/get.c
index 080123af2..68b72d6f2 100644
--- a/src/command/archive/get/get.c
+++ b/src/command/archive/get/get.c
@@ -332,6 +332,7 @@ cmdArchiveGetAsync(void)
{
// Get the job and job key
ProtocolParallelJob *job = protocolParallelResult(parallelExec);
+ unsigned int processId = protocolParallelJobProcessId(job);
const String *walSegment = varStr(protocolParallelJobKey(job));
// The job was successful
@@ -340,19 +341,20 @@ cmdArchiveGetAsync(void)
// Get the archive file
if (varIntForce(protocolParallelJobResult(job)) == 0)
{
- LOG_DETAIL("found %s in the archive", strPtr(walSegment));
+ LOG_DETAIL_PID(processId, "found %s in the archive", strPtr(walSegment));
}
// If it does not exist write an ok file to indicate that it was checked
else
{
- LOG_DETAIL("unable to find %s in the archive", strPtr(walSegment));
+ LOG_DETAIL_PID(processId, "unable to find %s in the archive", strPtr(walSegment));
archiveAsyncStatusOkWrite(archiveModeGet, walSegment, NULL);
}
}
// Else the job errored
else
{
- LOG_WARN(
+ LOG_WARN_PID(
+ processId,
"could not get %s from the archive (will be retried): [%d] %s", strPtr(walSegment),
protocolParallelJobErrorCode(job), strPtr(protocolParallelJobErrorMessage(job)));
diff --git a/src/command/archive/push/push.c b/src/command/archive/push/push.c
index 7f7b12572..6693dedfd 100644
--- a/src/command/archive/push/push.c
+++ b/src/command/archive/push/push.c
@@ -478,18 +478,20 @@ cmdArchivePushAsync(void)
// Get the job and job key
ProtocolParallelJob *job = protocolParallelResult(parallelExec);
+ unsigned int processId = protocolParallelJobProcessId(job);
const String *walFile = varStr(protocolParallelJobKey(job));
// The job was successful
if (protocolParallelJobErrorCode(job) == 0)
{
- LOG_DETAIL("pushed WAL file '%s' to the archive", strPtr(walFile));
+ LOG_DETAIL_PID(processId, "pushed WAL file '%s' to the archive", strPtr(walFile));
archiveAsyncStatusOkWrite(archiveModePush, walFile, varStr(protocolParallelJobResult(job)));
}
// Else the job errored
else
{
- LOG_WARN(
+ LOG_WARN_PID(
+ processId,
"could not push WAL file '%s' to the archive (will be retried): [%d] %s", strPtr(walFile),
protocolParallelJobErrorCode(job), strPtr(protocolParallelJobErrorMessage(job)));
diff --git a/test/src/module/command/archiveGetTest.c b/test/src/module/command/archiveGetTest.c
index 2ac3f738d..c38c91d73 100644
--- a/test/src/module/command/archiveGetTest.c
+++ b/test/src/module/command/archiveGetTest.c
@@ -405,7 +405,7 @@ testRun(void)
TEST_RESULT_VOID(cmdArchiveGetAsync(), "archive async");
harnessLogResult(
"P00 INFO: get 1 WAL file(s) from archive: 000000010000000100000001\n"
- "P00 DETAIL: found 000000010000000100000001 in the archive");
+ "P01 DETAIL: found 000000010000000100000001 in the archive");
TEST_RESULT_BOOL(
storageExistsNP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_IN "/000000010000000100000001")), true,
@@ -444,9 +444,9 @@ testRun(void)
TEST_RESULT_VOID(cmdArchiveGetAsync(), "archive async");
harnessLogResult(
"P00 INFO: get 3 WAL file(s) from archive: 000000010000000100000001...000000010000000100000003\n"
- "P00 DETAIL: found 000000010000000100000001 in the archive\n"
- "P00 DETAIL: unable to find 000000010000000100000002 in the archive\n"
- "P00 WARN: could not get 000000010000000100000003 from the archive (will be retried): "
+ "P01 DETAIL: found 000000010000000100000001 in the archive\n"
+ "P01 DETAIL: unable to find 000000010000000100000002 in the archive\n"
+ "P01 WARN: could not get 000000010000000100000003 from the archive (will be retried): "
"[45] raised from local-1 protocol: duplicates found in archive for WAL segment 000000010000000100000003: "
"000000010000000100000003-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, "
"000000010000000100000003-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n"
diff --git a/test/src/module/command/archivePushTest.c b/test/src/module/command/archivePushTest.c
index fdbf50b35..0b7b32c89 100644
--- a/test/src/module/command/archivePushTest.c
+++ b/test/src/module/command/archivePushTest.c
@@ -640,8 +640,8 @@ testRun(void)
strPtr(
strNewFmt(
"P00 INFO: push 2 WAL file(s) to archive: 000000010000000100000001...000000010000000100000002\n"
- "P00 DETAIL: pushed WAL file '000000010000000100000001' to the archive\n"
- "P00 WARN: could not push WAL file '000000010000000100000002' to the archive (will be retried): "
+ "P01 DETAIL: pushed WAL file '000000010000000100000001' to the archive\n"
+ "P01 WARN: could not push WAL file '000000010000000100000002' to the archive (will be retried): "
"[55] raised from local-1 protocol: unable to open '%s/pg/pg_xlog/000000010000000100000002' for read: "
"[2] No such file or directory", testPath())));
@@ -672,7 +672,7 @@ testRun(void)
TEST_RESULT_VOID(cmdArchivePushAsync(), "push WAL segments");
harnessLogResult(
"P00 INFO: push 1 WAL file(s) to archive: 000000010000000100000002\n"
- "P00 DETAIL: pushed WAL file '000000010000000100000002' to the archive");
+ "P01 DETAIL: pushed WAL file '000000010000000100000002' to the archive");
TEST_RESULT_BOOL(
storageExistsNP(
[parent: 8c202c77dac7]