You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-13 01:00:23 +02:00
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.
This commit is contained in:
@ -105,6 +105,10 @@
|
|||||||
<p>Add process id to <code>ProtocolParallelJob</code>.</p>
|
<p>Add process id to <code>ProtocolParallelJob</code>.</p>
|
||||||
</release-item>
|
</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>
|
<release-item>
|
||||||
<p>Close log file before <code>exec()</code>.</p>
|
<p>Close log file before <code>exec()</code>.</p>
|
||||||
</release-item>
|
</release-item>
|
||||||
|
@ -332,6 +332,7 @@ cmdArchiveGetAsync(void)
|
|||||||
{
|
{
|
||||||
// Get the job and job key
|
// Get the job and job key
|
||||||
ProtocolParallelJob *job = protocolParallelResult(parallelExec);
|
ProtocolParallelJob *job = protocolParallelResult(parallelExec);
|
||||||
|
unsigned int processId = protocolParallelJobProcessId(job);
|
||||||
const String *walSegment = varStr(protocolParallelJobKey(job));
|
const String *walSegment = varStr(protocolParallelJobKey(job));
|
||||||
|
|
||||||
// The job was successful
|
// The job was successful
|
||||||
@ -340,19 +341,20 @@ cmdArchiveGetAsync(void)
|
|||||||
// Get the archive file
|
// Get the archive file
|
||||||
if (varIntForce(protocolParallelJobResult(job)) == 0)
|
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
|
// If it does not exist write an ok file to indicate that it was checked
|
||||||
else
|
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);
|
archiveAsyncStatusOkWrite(archiveModeGet, walSegment, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Else the job errored
|
// Else the job errored
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_WARN(
|
LOG_WARN_PID(
|
||||||
|
processId,
|
||||||
"could not get %s from the archive (will be retried): [%d] %s", strPtr(walSegment),
|
"could not get %s from the archive (will be retried): [%d] %s", strPtr(walSegment),
|
||||||
protocolParallelJobErrorCode(job), strPtr(protocolParallelJobErrorMessage(job)));
|
protocolParallelJobErrorCode(job), strPtr(protocolParallelJobErrorMessage(job)));
|
||||||
|
|
||||||
|
@ -478,18 +478,20 @@ cmdArchivePushAsync(void)
|
|||||||
|
|
||||||
// Get the job and job key
|
// Get the job and job key
|
||||||
ProtocolParallelJob *job = protocolParallelResult(parallelExec);
|
ProtocolParallelJob *job = protocolParallelResult(parallelExec);
|
||||||
|
unsigned int processId = protocolParallelJobProcessId(job);
|
||||||
const String *walFile = varStr(protocolParallelJobKey(job));
|
const String *walFile = varStr(protocolParallelJobKey(job));
|
||||||
|
|
||||||
// The job was successful
|
// The job was successful
|
||||||
if (protocolParallelJobErrorCode(job) == 0)
|
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)));
|
archiveAsyncStatusOkWrite(archiveModePush, walFile, varStr(protocolParallelJobResult(job)));
|
||||||
}
|
}
|
||||||
// Else the job errored
|
// Else the job errored
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_WARN(
|
LOG_WARN_PID(
|
||||||
|
processId,
|
||||||
"could not push WAL file '%s' to the archive (will be retried): [%d] %s", strPtr(walFile),
|
"could not push WAL file '%s' to the archive (will be retried): [%d] %s", strPtr(walFile),
|
||||||
protocolParallelJobErrorCode(job), strPtr(protocolParallelJobErrorMessage(job)));
|
protocolParallelJobErrorCode(job), strPtr(protocolParallelJobErrorMessage(job)));
|
||||||
|
|
||||||
|
@ -405,7 +405,7 @@ testRun(void)
|
|||||||
TEST_RESULT_VOID(cmdArchiveGetAsync(), "archive async");
|
TEST_RESULT_VOID(cmdArchiveGetAsync(), "archive async");
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 INFO: get 1 WAL file(s) from archive: 000000010000000100000001\n"
|
"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(
|
TEST_RESULT_BOOL(
|
||||||
storageExistsNP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_IN "/000000010000000100000001")), true,
|
storageExistsNP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_IN "/000000010000000100000001")), true,
|
||||||
@ -444,9 +444,9 @@ testRun(void)
|
|||||||
TEST_RESULT_VOID(cmdArchiveGetAsync(), "archive async");
|
TEST_RESULT_VOID(cmdArchiveGetAsync(), "archive async");
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 INFO: get 3 WAL file(s) from archive: 000000010000000100000001...000000010000000100000003\n"
|
"P00 INFO: get 3 WAL file(s) from archive: 000000010000000100000001...000000010000000100000003\n"
|
||||||
"P00 DETAIL: found 000000010000000100000001 in the archive\n"
|
"P01 DETAIL: found 000000010000000100000001 in the archive\n"
|
||||||
"P00 DETAIL: unable to find 000000010000000100000002 in the archive\n"
|
"P01 DETAIL: unable to find 000000010000000100000002 in the archive\n"
|
||||||
"P00 WARN: could not get 000000010000000100000003 from the archive (will be retried): "
|
"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: "
|
"[45] raised from local-1 protocol: duplicates found in archive for WAL segment 000000010000000100000003: "
|
||||||
"000000010000000100000003-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, "
|
"000000010000000100000003-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, "
|
||||||
"000000010000000100000003-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n"
|
"000000010000000100000003-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n"
|
||||||
|
@ -640,8 +640,8 @@ testRun(void)
|
|||||||
strPtr(
|
strPtr(
|
||||||
strNewFmt(
|
strNewFmt(
|
||||||
"P00 INFO: push 2 WAL file(s) to archive: 000000010000000100000001...000000010000000100000002\n"
|
"P00 INFO: push 2 WAL file(s) to archive: 000000010000000100000001...000000010000000100000002\n"
|
||||||
"P00 DETAIL: pushed WAL file '000000010000000100000001' to the archive\n"
|
"P01 DETAIL: pushed WAL file '000000010000000100000001' to the archive\n"
|
||||||
"P00 WARN: could not push WAL file '000000010000000100000002' to the archive (will be retried): "
|
"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: "
|
"[55] raised from local-1 protocol: unable to open '%s/pg/pg_xlog/000000010000000100000002' for read: "
|
||||||
"[2] No such file or directory", testPath())));
|
"[2] No such file or directory", testPath())));
|
||||||
|
|
||||||
@ -672,7 +672,7 @@ testRun(void)
|
|||||||
TEST_RESULT_VOID(cmdArchivePushAsync(), "push WAL segments");
|
TEST_RESULT_VOID(cmdArchivePushAsync(), "push WAL segments");
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 INFO: push 1 WAL file(s) to archive: 000000010000000100000002\n"
|
"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(
|
TEST_RESULT_BOOL(
|
||||||
storageExistsNP(
|
storageExistsNP(
|
||||||
|
Reference in New Issue
Block a user