From 92e04ea9f4e0eb3f6cd88a72497a026cbd348280 Mon Sep 17 00:00:00 2001 From: David Steele Date: Tue, 4 Jun 2019 10:34:19 -0400 Subject: [PATCH] Remove per-stanza repo cache clear during testing. This was not being used and is not supported by the equivalent C code. --- lib/pgBackRest/Protocol/Storage/Helper.pm | 21 +++++-------------- src/perl/embed.auto.c | 20 ++++-------------- .../Command/CommandArchiveGetPerlTest.pm | 2 +- .../Module/Info/InfoInfoArchivePerlTest.pm | 6 +++--- .../Module/Info/InfoInfoBackupPerlTest.pm | 4 ++-- .../Module/Stanza/StanzaAllPerlTest.pm | 14 ++++++------- 6 files changed, 22 insertions(+), 45 deletions(-) diff --git a/lib/pgBackRest/Protocol/Storage/Helper.pm b/lib/pgBackRest/Protocol/Storage/Helper.pm index 571571311..288d4efd1 100644 --- a/lib/pgBackRest/Protocol/Storage/Helper.pm +++ b/lib/pgBackRest/Protocol/Storage/Helper.pm @@ -240,28 +240,17 @@ sub storageRepo push @EXPORT, qw(storageRepo); #################################################################################################################################### -# storageRepoCacheClear - FOR TESTING ONLY! +# Clear the repo storage cache - FOR TESTING ONLY! #################################################################################################################################### sub storageRepoCacheClear { # Assign function parameters, defaults, and log debug info - my - ( - $strOperation, - $strStanza, - ) = - logDebugParam - ( - __PACKAGE__ . '::storageRepoCacheClear', \@_, - {name => 'strStanza'}, - ); + my ($strOperation) = logDebugParam(__PACKAGE__ . '::storageRepoCacheClear'); - if (defined($hStorage->{&STORAGE_REPO}{$strStanza})) - { - delete($hStorage->{&STORAGE_REPO}{$strStanza}); - } + delete($hStorage->{&STORAGE_REPO}); - return; + # Return from function and log return values if any + return logDebugReturn($strOperation); } push @EXPORT, qw(storageRepoCacheClear); diff --git a/src/perl/embed.auto.c b/src/perl/embed.auto.c index e3bb789d6..8482e9b0f 100644 --- a/src/perl/embed.auto.c +++ b/src/perl/embed.auto.c @@ -13510,23 +13510,11 @@ static const EmbeddedModule embeddedModule[] = "sub storageRepoCacheClear\n" "{\n" "\n" - "my\n" - "(\n" - "$strOperation,\n" - "$strStanza,\n" - ") =\n" - "logDebugParam\n" - "(\n" - "__PACKAGE__ . '::storageRepoCacheClear', \\@_,\n" - "{name => 'strStanza'},\n" - ");\n" + "my ($strOperation) = logDebugParam(__PACKAGE__ . '::storageRepoCacheClear');\n" "\n" - "if (defined($hStorage->{&STORAGE_REPO}{$strStanza}))\n" - "{\n" - "delete($hStorage->{&STORAGE_REPO}{$strStanza});\n" - "}\n" - "\n" - "return;\n" + "delete($hStorage->{&STORAGE_REPO});\n" + "\n\n" + "return logDebugReturn($strOperation);\n" "}\n" "\n" "push @EXPORT, qw(storageRepoCacheClear);\n" diff --git a/test/lib/pgBackRestTest/Module/Command/CommandArchiveGetPerlTest.pm b/test/lib/pgBackRestTest/Module/Command/CommandArchiveGetPerlTest.pm index 9b995620a..96a6efc60 100644 --- a/test/lib/pgBackRestTest/Module/Command/CommandArchiveGetPerlTest.pm +++ b/test/lib/pgBackRestTest/Module/Command/CommandArchiveGetPerlTest.pm @@ -52,7 +52,7 @@ sub initTest my $self = shift; # Clear cache from the previous test - storageRepoCacheClear($self->stanza()); + storageRepoCacheClear(); # Load options $self->configTestClear(); diff --git a/test/lib/pgBackRestTest/Module/Info/InfoInfoArchivePerlTest.pm b/test/lib/pgBackRestTest/Module/Info/InfoInfoArchivePerlTest.pm index b9bc11e39..5831c25c1 100644 --- a/test/lib/pgBackRestTest/Module/Info/InfoInfoArchivePerlTest.pm +++ b/test/lib/pgBackRestTest/Module/Info/InfoInfoArchivePerlTest.pm @@ -51,7 +51,7 @@ sub initTest my $self = shift; # Clear cache from the previous test - storageRepoCacheClear($self->stanza()); + storageRepoCacheClear(); # Load options $self->configTestClear(); @@ -116,7 +116,7 @@ sub run # Attempt to reconstruct from an encypted archived WAL with an encrypted repo #--------------------------------------------------------------------------------------------------------------------------- - storageRepoCacheClear($self->stanza()); + storageRepoCacheClear(); $self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC); $self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'x'); $self->configTestLoad(CFGCMD_ARCHIVE_PUSH); @@ -222,7 +222,7 @@ sub run $self->configTestLoad(CFGCMD_ARCHIVE_PUSH); # Clear the storage repo settings - storageRepoCacheClear($self->stanza()); + storageRepoCacheClear(); # Create an encrypted storage and generate an encyption sub passphrase to store in the file my $strCipherPassSub = cipherPassGen(); diff --git a/test/lib/pgBackRestTest/Module/Info/InfoInfoBackupPerlTest.pm b/test/lib/pgBackRestTest/Module/Info/InfoInfoBackupPerlTest.pm index 35212e6e5..7bfa35156 100644 --- a/test/lib/pgBackRestTest/Module/Info/InfoInfoBackupPerlTest.pm +++ b/test/lib/pgBackRestTest/Module/Info/InfoInfoBackupPerlTest.pm @@ -223,7 +223,7 @@ sub run executeTest('sudo rm ' . $oBackupInfo->{strFileName} . '*'); # Clear the storage repo settings and change the passphrase - storageRepoCacheClear($self->stanza()); + storageRepoCacheClear(); my $strCipherPass = 'x'; $self->configTestClear(); @@ -246,7 +246,7 @@ sub run $oBackupInfo->create(PG_VERSION_93, $self->dbSysId(PG_VERSION_93), $i93ControlVersion, $i93CatalogVersion, true); # Clear the storage repo settings and change the passphrase - storageRepoCacheClear($self->stanza()); + storageRepoCacheClear(); $self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC); $self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, BOGUS); $self->optionTestSet(CFGOPT_STANZA, $self->stanza()); diff --git a/test/lib/pgBackRestTest/Module/Stanza/StanzaAllPerlTest.pm b/test/lib/pgBackRestTest/Module/Stanza/StanzaAllPerlTest.pm index 9ce33317e..b17e035de 100644 --- a/test/lib/pgBackRestTest/Module/Stanza/StanzaAllPerlTest.pm +++ b/test/lib/pgBackRestTest/Module/Stanza/StanzaAllPerlTest.pm @@ -284,7 +284,7 @@ sub run executeTest('sudo chmod 644 ' . $strArchivedFile); # Clear the cached repo settings and change repo settings to encrypted - storageRepoCacheClear($self->stanza()); + storageRepoCacheClear(); $self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC); $self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'x'); $self->configTestLoad(CFGCMD_STANZA_CREATE); @@ -402,7 +402,7 @@ sub run # Change repo encryption settings to unencrypted - stanza create is not allowed even with force #--------------------------------------------------------------------------------------------------------------------------- # Clear the cached repo settings and change repo settings to unencrypted - storageRepoCacheClear($self->stanza()); + storageRepoCacheClear(); $self->optionTestClear(CFGOPT_REPO_CIPHER_TYPE); $self->optionTestClear(CFGOPT_REPO_CIPHER_PASS); $self->configTestLoad(CFGCMD_STANZA_CREATE); @@ -520,7 +520,7 @@ sub run # Attempt to change the encryption settings #--------------------------------------------------------------------------------------------------------------------------- # Clear the cached repo settings and change repo settings to encrypted - storageRepoCacheClear($self->stanza()); + storageRepoCacheClear(); $self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC); $self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'x'); $self->configTestLoad(CFGCMD_STANZA_UPGRADE); @@ -543,7 +543,7 @@ sub run $oBackupInfo->create(PG_VERSION_93, $self->dbSysId(PG_VERSION_93), '937', '201306121', true); # Attempt to upgrade with a different passphrase - storageRepoCacheClear($self->stanza()); + storageRepoCacheClear(); $self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC); $self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'y'); $self->configTestLoad(CFGCMD_STANZA_UPGRADE); @@ -552,7 +552,7 @@ sub run "unable to parse '" . $self->{strArchivePath} . "/archive.info'" . "\nHINT: Is or was the repo encrypted?"); - storageRepoCacheClear($self->stanza()); + storageRepoCacheClear(); $self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC); $self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'x'); $self->configTestLoad(CFGCMD_STANZA_UPGRADE); @@ -592,7 +592,7 @@ sub run ' encrypted archive and backup info files upgraded'); # Clear configuration - storageRepoCacheClear($self->stanza()); + storageRepoCacheClear(); $self->optionTestClear(CFGOPT_REPO_CIPHER_TYPE); $self->optionTestClear(CFGOPT_REPO_CIPHER_PASS); } @@ -770,7 +770,7 @@ sub run # Clear the cached repo settings and change repo settings to encrypted #--------------------------------------------------------------------------------------------------------------------------- - storageRepoCacheClear($self->stanza()); + storageRepoCacheClear(); $self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC); $self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'x'); $self->configTestLoad(CFGCMD_STANZA_CREATE);