Skip to content

Commit

Permalink
Archive test improvements:
Browse files Browse the repository at this point in the history
* Fixed flapping archive-stop test with testResult() retries.
* Added final test of archive contents to archive-push test.
  • Loading branch information
dwsteele committed Mar 2, 2017
1 parent 5eb585c commit 5957f85
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 79 deletions.
8 changes: 8 additions & 0 deletions doc/xml/release.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@
<p>Improved truncation when outputting errors logs in the <code>ExecuteTest</code> module.</p>
</release-item>

<release-item>
<p>Fixed flapping archive-stop test with <code>testResult()</code> retries.</p>
</release-item>

<release-item>
<p>Added final test of archive contents to archive-push test.</p>
</release-item>

<release-item>
<p>Temporarily disable flapping keep-alive test.</p>
</release-item>
Expand Down
11 changes: 0 additions & 11 deletions test/expect/archive-stop-001.log
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,5 @@ P00 ERROR: [119]: raised on local-1 host: WAL segment version 9.4 does not matc
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: dropped WAL file 000000010000000100000004 because archive queue exceeded 33554432 bytes

> ls -1R [TEST_PATH]/db-master/repo/archive/db/9.4-1/0000000100000001
------------------------------------------------------------------------------------------------------------------------------------
[TEST_PATH]/db-master/repo/archive/db/9.4-1/0000000100000001:
000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7

> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn --archive-queue-max=33554432 --stanza=db archive-push [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000005
------------------------------------------------------------------------------------------------------------------------------------

> ls -1R [TEST_PATH]/db-master/repo/archive/db/9.4-1/0000000100000001
------------------------------------------------------------------------------------------------------------------------------------
[TEST_PATH]/db-master/repo/archive/db/9.4-1/0000000100000001:
000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7
000000010000000100000005-72b9da071c13957fb4ca31f05dbd5c644297c2f7
11 changes: 0 additions & 11 deletions test/expect/archive-stop-002.log
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,5 @@ P00 ERROR: [119]: raised on local-1 host: WAL segment version 9.4 does not matc
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: dropped WAL file 000000010000000100000004 because archive queue exceeded 33554432 bytes

> ls -1R [TEST_PATH]/db-master/repo/archive/db/9.4-1/0000000100000001
------------------------------------------------------------------------------------------------------------------------------------
[TEST_PATH]/db-master/repo/archive/db/9.4-1/0000000100000001:
000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7.gz

> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn --archive-queue-max=33554432 --stanza=db archive-push [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000005
------------------------------------------------------------------------------------------------------------------------------------

> ls -1R [TEST_PATH]/db-master/repo/archive/db/9.4-1/0000000100000001
------------------------------------------------------------------------------------------------------------------------------------
[TEST_PATH]/db-master/repo/archive/db/9.4-1/0000000100000001:
000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7.gz
000000010000000100000005-72b9da071c13957fb4ca31f05dbd5c644297c2f7.gz
12 changes: 0 additions & 12 deletions test/expect/archive-stop-003.log
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,5 @@ P00 ERROR: [119]: raised on local-1 host: raised on backup host: WAL segment ve
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: dropped WAL file 000000010000000100000004 because archive queue exceeded 33554432 bytes

> ls -1R [TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001
------------------------------------------------------------------------------------------------------------------------------------
[TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001:
000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7

> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn --archive-queue-max=33554432 --stanza=db archive-push [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000005
------------------------------------------------------------------------------------------------------------------------------------

> ls -1R [TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001
------------------------------------------------------------------------------------------------------------------------------------
[TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001:
000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7
000000010000000100000002-72b9da071c13957fb4ca31f05dbd5c644297c2f7
000000010000000100000005-72b9da071c13957fb4ca31f05dbd5c644297c2f7
12 changes: 0 additions & 12 deletions test/expect/archive-stop-004.log
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,5 @@ P00 ERROR: [124]: remote process terminated on local-1 host: remote process ter
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: dropped WAL file 000000010000000100000004 because archive queue exceeded 33554432 bytes

> ls -1R [TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001
------------------------------------------------------------------------------------------------------------------------------------
[TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001:
000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7

> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn --archive-queue-max=33554432 --stanza=db archive-push [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000005
------------------------------------------------------------------------------------------------------------------------------------

> ls -1R [TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001
------------------------------------------------------------------------------------------------------------------------------------
[TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001:
000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7
000000010000000100000002-72b9da071c13957fb4ca31f05dbd5c644297c2f7
000000010000000100000005-72b9da071c13957fb4ca31f05dbd5c644297c2f7
12 changes: 0 additions & 12 deletions test/expect/archive-stop-005.log
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,5 @@ P00 ERROR: [119]: raised on local-1 host: raised on backup host: WAL segment ve
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: dropped WAL file 000000010000000100000004 because archive queue exceeded 33554432 bytes

> ls -1R [TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001
------------------------------------------------------------------------------------------------------------------------------------
[TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001:
000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7.gz

> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn --archive-queue-max=33554432 --stanza=db archive-push [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000005
------------------------------------------------------------------------------------------------------------------------------------

> ls -1R [TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001
------------------------------------------------------------------------------------------------------------------------------------
[TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001:
000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7.gz
000000010000000100000002-72b9da071c13957fb4ca31f05dbd5c644297c2f7.gz
000000010000000100000005-72b9da071c13957fb4ca31f05dbd5c644297c2f7.gz
12 changes: 0 additions & 12 deletions test/expect/archive-stop-006.log
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,5 @@ P00 ERROR: [124]: remote process terminated on local-1 host: remote process ter
------------------------------------------------------------------------------------------------------------------------------------
P00 WARN: dropped WAL file 000000010000000100000004 because archive queue exceeded 33554432 bytes

> ls -1R [TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001
------------------------------------------------------------------------------------------------------------------------------------
[TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001:
000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7.gz

> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn --archive-queue-max=33554432 --stanza=db archive-push [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000005
------------------------------------------------------------------------------------------------------------------------------------

> ls -1R [TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001
------------------------------------------------------------------------------------------------------------------------------------
[TEST_PATH]/backup/repo/archive/db/9.4-1/0000000100000001:
000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7.gz
000000010000000100000002-72b9da071c13957fb4ca31f05dbd5c644297c2f7.gz
000000010000000100000005-72b9da071c13957fb4ca31f05dbd5c644297c2f7.gz
16 changes: 16 additions & 0 deletions test/lib/pgBackRestTest/Archive/ArchivePushTest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ sub run
$oHostBackup->stanzaCreate('create required data for stanza',
{strOptionalParam => '--no-' . OPTION_ONLINE . ' --' . OPTION_FORCE});

my @stryExpectedWAL;

# Loop through backups
for (my $iBackup = 1; $iBackup <= 3; $iBackup++)
{
Expand Down Expand Up @@ -174,6 +176,9 @@ sub run
$strCommand . ($bRemote && $iBackup == $iArchive ? ' --cmd-ssh=/usr/bin/ssh' : '') .
" ${strXlogPath}/${strSourceFile}",
{oLogTest => $self->expect()});
push(
@stryExpectedWAL, "${strSourceFile}-${strArchiveChecksum}" .
($bCompress ? ".$oFile->{strCompressExtension}" : ''));

# Make sure the temp file no longer exists
if (defined($strArchiveTmp))
Expand Down Expand Up @@ -282,6 +287,10 @@ sub run
$oFile, "${strSourceFile}.partial", $strArchiveChecksum, $bCompress,
$bArchiveAsync ? $oHostDbMaster->spoolPath() : undef);

push(
@stryExpectedWAL, "${strSourceFile}.partial-${strArchiveChecksum}" .
($bCompress ? ".$oFile->{strCompressExtension}" : ''));

# Test .partial archive duplicate
&log(INFO, ' test .partial archive duplicate');
$oHostDbMaster->executeSimple(
Expand All @@ -308,6 +317,13 @@ sub run
}
}

#---------------------------------------------------------------------------------------------------------------------------
$self->testResult(
sub {$oFile->list(PATH_BACKUP_ARCHIVE, PG_VERSION_94 . '-1/0000000100000001')},
'(' . join(', ', @stryExpectedWAL) . ')',
'all WAL in archive', 5);

#---------------------------------------------------------------------------------------------------------------------------
if (defined($self->expect()))
{
sleep(1); # Ugly hack to ensure repo is stable before checking files - replace in new tests
Expand Down
24 changes: 15 additions & 9 deletions test/lib/pgBackRestTest/Archive/ArchiveStopTest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ sub run
my ($oHostDbMaster, $oHostDbStandby, $oHostBackup, $oFile) = $self->setup(
true, $self->expect(), {bHostBackup => $bRemote, bCompress => $bCompress, bArchiveAsync => true});

# Create compression extension
my $strCompressExt = $bCompress ? ".$oFile->{strCompressExtension}" : '';

# Create the xlog path
my $strXlogPath = $oHostDbMaster->dbBasePath() . '/pg_xlog';
filePathCreate($strXlogPath, undef, false, true);
Expand Down Expand Up @@ -91,18 +94,21 @@ sub run
$oHostBackup->infoRestore($oFile->pathGet(PATH_BACKUP_ARCHIVE, ARCHIVE_INFO_FILE));
}

# Check the dir to be sure that segment 2 and 3 were not pushed yet
executeTest(
'ls -1R ' . $oHostBackup->repoPath() . '/archive/' . $self->stanza() . '/' . PG_VERSION_94 . "-1/0000000100000001",
{oLogTest => $self->expect(), bRemote => $bRemote});
#---------------------------------------------------------------------------------------------------------------------------
$self->testResult(
sub {$oFile->list(PATH_BACKUP_ARCHIVE, PG_VERSION_94 . '-1/0000000100000001')},
"000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7${strCompressExt}",
'segment 2-4 are not pushed', 5);

# Push segment 5
#---------------------------------------------------------------------------------------------------------------------------
$oHostDbMaster->archivePush($strXlogPath, $strArchiveTestFile, 5);

# Check that 5 is pushed
executeTest(
'ls -1R ' . $oHostBackup->repoPath() . '/archive/' . $self->stanza() . '/' . PG_VERSION_94 . "-1/0000000100000001",
{oLogTest => $self->expect(), bRemote => $bRemote});
$self->testResult(
sub {$oFile->list(PATH_BACKUP_ARCHIVE, PG_VERSION_94 . '-1/0000000100000001')},
"(000000010000000100000001-72b9da071c13957fb4ca31f05dbd5c644297c2f7${strCompressExt}, " .
($bRemote ? "000000010000000100000002-72b9da071c13957fb4ca31f05dbd5c644297c2f7${strCompressExt}, " : '') .
"000000010000000100000005-72b9da071c13957fb4ca31f05dbd5c644297c2f7${strCompressExt})",
'segment 5 (and 2 if remote) is pushed', 5);
}
}
}
Expand Down

0 comments on commit 5957f85

Please sign in to comment.