mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-02-09 13:46:51 +02:00
Stabilize async archiving in integration tests.
The integration tests could fail if: 1. After restoring the PostgreSQL instance the recovery process starts, which calls asynchronous archive-get. 2. After archive-get checks the existence of the queue directory, but before writing the WAL file, there are restores when the next test is begun, which leads to the deletion of the queue directory. 3. Since the directory no longer exists, writing the WAL file will fail, and archive-get will write the error file to the queue. 4. A new PostgreSQL instance will start and the recovery process will begin, which requests the WAL file. 5. The new archive-get looks into the queue directory, finds the error file, and throws out the error, after which the PostgreSQL recovery fails because the previous archive-get background process has not finished yet. This patch fixes the problem by using a separate spool directory for each test.
This commit is contained in:
parent
db912c049c
commit
274bb24a5a
@ -40,4 +40,20 @@
|
||||
</release-item>
|
||||
</release-improvement-list>
|
||||
</release-core-list>
|
||||
|
||||
<release-test-list>
|
||||
<release-improvement-list>
|
||||
<release-item>
|
||||
<github-issue id="2463"/>
|
||||
<github-pull-request id="2481"/>
|
||||
|
||||
<release-item-contributor-list>
|
||||
<release-item-contributor id="viktor.kurilko"/>
|
||||
<release-item-reviewer id="david.steele"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Stabilize async archiving in integration tests.</p>
|
||||
</release-item>
|
||||
</release-improvement-list>
|
||||
</release-test-list>
|
||||
</release>
|
||||
|
@ -85,6 +85,7 @@ static struct HrnHostLocal
|
||||
CipherType cipherType; // Cipher type
|
||||
const String *cipherPass; // Cipher passphrase
|
||||
unsigned int repoTotal; // Repository total
|
||||
unsigned int restoreTotal; // Restore counter used to name spool path
|
||||
bool tls; // Use TLS instead of SSH?
|
||||
bool bundle; // Bundling enabled?
|
||||
bool blockIncr; // Block incremental enabled?
|
||||
@ -144,7 +145,7 @@ hrnHostNew(const StringId id, const String *const container, const String *const
|
||||
this->pub.pgLogFile = strNewFmt("%s/postgresql.log", strZ(hrnHostLogPath(this)));
|
||||
this->pub.repo1Path = strNewFmt("%s/repo1", strZ(hrnHostDataPath(this)));
|
||||
this->pub.repo2Path = strNewFmt("%s/repo2", strZ(hrnHostDataPath(this)));
|
||||
this->pub.spoolPath = strNewFmt("%s/spool", strZ(hrnHostDataPath(this)));
|
||||
this->pub.spoolPath = strNewFmt("%s/spool/0000", strZ(hrnHostDataPath(this)));
|
||||
}
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
@ -288,6 +289,13 @@ hrnHostExecBr(HrnHost *const this, const char *const command, const HrnHostExecB
|
||||
|
||||
strCatFmt(commandStr, " %s", command);
|
||||
|
||||
// Set unique spool path
|
||||
if (strcmp(command, CFGCMD_RESTORE) == 0 && hrnHostLocal.archiveAsync)
|
||||
{
|
||||
this->pub.spoolPath = strNewFmt("%s/spool/%04u", strZ(hrnHostDataPath(this)), hrnHostLocal.restoreTotal++);
|
||||
hrnHostConfigUpdateP();
|
||||
}
|
||||
|
||||
if (param.param != NULL)
|
||||
strCatFmt(commandStr, " %s", param.param);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user