diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 922b886c7..004ab4476 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -38,7 +38,7 @@ -

11 Beta 4 support.

+

11 Beta 4 support, including configurable WAL segment size.

diff --git a/lib/pgBackRest/Archive/Common.pm b/lib/pgBackRest/Archive/Common.pm index b6e118d6a..fe6de439b 100644 --- a/lib/pgBackRest/Archive/Common.pm +++ b/lib/pgBackRest/Archive/Common.pm @@ -125,6 +125,7 @@ sub lsnFileRange $strLsnStart, $strLsnStop, $strDbVersion, + $iWalSegmentSize, ) = logDebugParam ( @@ -132,6 +133,7 @@ sub lsnFileRange {name => 'strLsnStart'}, {name => 'strLsnStop'}, {name => '$strDbVersion'}, + {name => '$iWalSegmentSize'}, ); # Working variables @@ -142,11 +144,11 @@ sub lsnFileRange # Iterate through all archive logs between start and stop my @stryArchiveSplit = split('/', $strLsnStart); my $iStartMajor = hex($stryArchiveSplit[0]); - my $iStartMinor = hex(substr(sprintf("%08s", $stryArchiveSplit[1]), 0, 2)); + my $iStartMinor = int(hex($stryArchiveSplit[1]) / $iWalSegmentSize); @stryArchiveSplit = split('/', $strLsnStop); my $iStopMajor = hex($stryArchiveSplit[0]); - my $iStopMinor = hex(substr(sprintf("%08s", $stryArchiveSplit[1]), 0, 2)); + my $iStopMinor = int(hex($stryArchiveSplit[1]) / $iWalSegmentSize); $stryArchive[$iArchiveIdx] = uc(sprintf("%08x%08x", $iStartMajor, $iStartMinor)); $iArchiveIdx += 1; @@ -155,7 +157,7 @@ sub lsnFileRange { $iStartMinor += 1; - if ($bSkipFF && $iStartMinor == 255 || !$bSkipFF && $iStartMinor == 256) + if ($bSkipFF && $iStartMinor == 255 || !$bSkipFF && $iStartMinor > int(0xFFFFFFFF / $iWalSegmentSize)) { $iStartMajor += 1; $iStartMinor = 0; diff --git a/lib/pgBackRest/Backup/Backup.pm b/lib/pgBackRest/Backup/Backup.pm index 331395a83..72384032d 100644 --- a/lib/pgBackRest/Backup/Backup.pm +++ b/lib/pgBackRest/Backup/Backup.pm @@ -723,6 +723,7 @@ sub process # Start backup (unless --no-online is set) my $strArchiveStart = undef; my $strLsnStart = undef; + my $iWalSegmentSize = undef; my $hTablespaceMap = undef; my $hDatabaseMap = undef; @@ -757,7 +758,7 @@ sub process else { # Start the backup - ($strArchiveStart, $strLsnStart) = + ($strArchiveStart, $strLsnStart, $iWalSegmentSize) = $oDbMaster->backupStart( BACKREST_NAME . ' backup started at ' . timestampFormat(undef, $lTimestampStart), cfgOption(CFGOPT_START_FAST)); @@ -929,7 +930,7 @@ sub process my $oArchiveInfo = new pgBackRest::Archive::Info(storageRepo()->pathGet(STORAGE_REPO_ARCHIVE), true); my $strArchiveId = $oArchiveInfo->archiveId(); - my @stryArchive = lsnFileRange($strLsnStart, $strLsnStop, $strDbVersion); + my @stryArchive = lsnFileRange($strLsnStart, $strLsnStop, $strDbVersion, $iWalSegmentSize); foreach my $strArchive (@stryArchive) { diff --git a/lib/pgBackRest/Db.pm b/lib/pgBackRest/Db.pm index 118258ebd..b8145d839 100644 --- a/lib/pgBackRest/Db.pm +++ b/lib/pgBackRest/Db.pm @@ -680,8 +680,13 @@ sub backupStart "exclusive pg_start_backup() with label \"${strLabel}\": backup begins after " . ($bStartFast ? "the requested immediate checkpoint" : "the next regular checkpoint") . " completes"); - my ($strTimestampDbStart, $strArchiveStart, $strLsnStart) = $self->executeSqlRow( - "select to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS.US TZ'), pg_" . $self->walId() . "file_name(lsn), lsn::text" . + my ($strTimestampDbStart, $strArchiveStart, $strLsnStart, $iWalSegmentSize) = $self->executeSqlRow( + "select to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS.US TZ'), pg_" . $self->walId() . "file_name(lsn), lsn::text," . + ($self->{strDbVersion} < PG_VERSION_84 ? PG_WAL_SIZE : + " (select setting::int8 from pg_settings where name = 'wal_segment_size')" . + # In Pre-11 versions the wal_segment_sise was expressed in terms of blocks rather than total size + ($self->{strDbVersion} < PG_VERSION_11 ? + " * (select setting::int8 from pg_settings where name = 'wal_block_size')" : '')) . " from pg_start_backup('${strLabel}'" . ($bStartFast ? ', true' : $self->{strDbVersion} >= PG_VERSION_84 ? ', false' : '') . ($self->{strDbVersion} >= PG_VERSION_96 ? ', false' : '') . ') as lsn'); @@ -692,6 +697,7 @@ sub backupStart $strOperation, {name => 'strArchiveStart', value => $strArchiveStart}, {name => 'strLsnStart', value => $strLsnStart}, + {name => 'iWalSegmentSize', value => $iWalSegmentSize}, {name => 'strTimestampDbStart', value => $strTimestampDbStart} ); } diff --git a/src/Makefile b/src/Makefile index 45eed2c6d..29a2bae10 100644 --- a/src/Makefile +++ b/src/Makefile @@ -110,7 +110,18 @@ SRCS = \ info/infoPg.c \ perl/config.c \ perl/exec.c \ - postgres/info.c \ + postgres/interface.c \ + postgres/interface/v083.c \ + postgres/interface/v084.c \ + postgres/interface/v090.c \ + postgres/interface/v091.c \ + postgres/interface/v092.c \ + postgres/interface/v093.c \ + postgres/interface/v094.c \ + postgres/interface/v095.c \ + postgres/interface/v096.c \ + postgres/interface/v100.c \ + postgres/interface/v110.c \ postgres/pageChecksum.c \ storage/driver/posix/storage.c \ storage/driver/posix/common.c \ @@ -144,10 +155,10 @@ install: pgbackrest command/archive/common.o: command/archive/common.c command/archive/common.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h $(CC) $(CFLAGS) -c command/archive/common.c -o command/archive/common.o -command/archive/get/file.o: command/archive/get/file.c command/archive/common.h command/archive/get/file.h command/control/control.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h compress/gzip.h compress/gzipDecompress.h config/config.auto.h config/config.h config/define.auto.h config/define.h info/infoArchive.h info/infoPg.h postgres/info.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h +command/archive/get/file.o: command/archive/get/file.c command/archive/common.h command/archive/get/file.h command/control/control.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h compress/gzip.h compress/gzipDecompress.h config/config.auto.h config/config.h config/define.auto.h config/define.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h $(CC) $(CFLAGS) -c command/archive/get/file.c -o command/archive/get/file.o -command/archive/get/get.o: command/archive/get/get.c command/archive/common.h command/archive/get/file.h command/command.h common/assert.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h postgres/info.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h +command/archive/get/get.o: command/archive/get/get.c command/archive/common.h command/archive/get/file.h command/command.h common/assert.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h $(CC) $(CFLAGS) -c command/archive/get/get.c -o command/archive/get/get.o command/archive/push/push.o: command/archive/push/push.c command/archive/common.h command/command.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h @@ -300,10 +311,10 @@ info/info.o: info/info.c common/debug.h common/error.auto.h common/error.h commo info/infoArchive.o: info/infoArchive.c common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/infoArchive.h info/infoPg.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h $(CC) $(CFLAGS) -c info/infoArchive.c -o info/infoArchive.o -info/infoPg.o: info/infoPg.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/hash.h info/info.h info/infoPg.h postgres/info.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h +info/infoPg.o: info/infoPg.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/hash.h info/info.h info/infoPg.h postgres/interface.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h $(CC) $(CFLAGS) -c info/infoPg.c -o info/infoPg.o -main.o: main.c command/archive/get/get.h command/archive/push/push.h command/command.h command/help/help.h common/debug.h common/error.auto.h common/error.h common/exit.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h version.h +main.o: main.c command/archive/get/get.h command/archive/push/push.h command/command.h command/help/help.h common/debug.h common/error.auto.h common/error.h common/exit.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h postgres/interface.h version.h $(CC) $(CFLAGS) -c main.c -o main.o perl/config.o: perl/config.c common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h @@ -312,10 +323,43 @@ perl/config.o: perl/config.c common/debug.h common/error.auto.h common/error.h c perl/exec.o: perl/exec.c ../libc/LibC.h common/debug.h common/encode.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h config/parse.h crypto/cipher.h crypto/cipherBlock.h crypto/hash.h crypto/random.h perl/config.h perl/embed.auto.c perl/exec.h perl/libc.auto.c postgres/pageChecksum.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h version.h ../libc/xs/common/encode.xsh ../libc/xs/crypto/cipherBlock.xsh ../libc/xs/crypto/hash.xsh $(CC) $(CFLAGS) -c perl/exec.c -o perl/exec.o -postgres/info.o: postgres/info.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h postgres/info.h postgres/type.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h - $(CC) $(CFLAGS) -c postgres/info.c -o postgres/info.o +postgres/interface.o: postgres/interface.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/v083.h postgres/interface/v084.h postgres/interface/v090.h postgres/interface/v091.h postgres/interface/v092.h postgres/interface/v093.h postgres/interface/v094.h postgres/interface/v095.h postgres/interface/v096.h postgres/interface/v100.h postgres/interface/v110.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h + $(CC) $(CFLAGS) -c postgres/interface.c -o postgres/interface.o -postgres/pageChecksum.o: postgres/pageChecksum.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h postgres/pageChecksum.h postgres/type.h +postgres/interface/v083.o: postgres/interface/v083.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v083.auto.c postgres/interface/v083.h + $(CC) $(CFLAGS) -c postgres/interface/v083.c -o postgres/interface/v083.o + +postgres/interface/v084.o: postgres/interface/v084.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v084.auto.c postgres/interface/v084.h + $(CC) $(CFLAGS) -c postgres/interface/v084.c -o postgres/interface/v084.o + +postgres/interface/v090.o: postgres/interface/v090.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v090.auto.c postgres/interface/v090.h + $(CC) $(CFLAGS) -c postgres/interface/v090.c -o postgres/interface/v090.o + +postgres/interface/v091.o: postgres/interface/v091.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v091.auto.c postgres/interface/v091.h + $(CC) $(CFLAGS) -c postgres/interface/v091.c -o postgres/interface/v091.o + +postgres/interface/v092.o: postgres/interface/v092.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v092.auto.c postgres/interface/v092.h + $(CC) $(CFLAGS) -c postgres/interface/v092.c -o postgres/interface/v092.o + +postgres/interface/v093.o: postgres/interface/v093.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v093.auto.c postgres/interface/v093.h + $(CC) $(CFLAGS) -c postgres/interface/v093.c -o postgres/interface/v093.o + +postgres/interface/v094.o: postgres/interface/v094.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v094.auto.c postgres/interface/v094.h + $(CC) $(CFLAGS) -c postgres/interface/v094.c -o postgres/interface/v094.o + +postgres/interface/v095.o: postgres/interface/v095.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v095.auto.c postgres/interface/v095.h + $(CC) $(CFLAGS) -c postgres/interface/v095.c -o postgres/interface/v095.o + +postgres/interface/v096.o: postgres/interface/v096.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v096.auto.c postgres/interface/v096.h + $(CC) $(CFLAGS) -c postgres/interface/v096.c -o postgres/interface/v096.o + +postgres/interface/v100.o: postgres/interface/v100.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v100.auto.c postgres/interface/v100.h + $(CC) $(CFLAGS) -c postgres/interface/v100.c -o postgres/interface/v100.o + +postgres/interface/v110.o: postgres/interface/v110.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/v110.auto.c postgres/interface/v110.h + $(CC) $(CFLAGS) -c postgres/interface/v110.c -o postgres/interface/v110.o + +postgres/pageChecksum.o: postgres/pageChecksum.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h postgres/pageChecksum.h $(CC) $(CFLAGS) -funroll-loops -ftree-vectorize -c postgres/pageChecksum.c -o postgres/pageChecksum.o storage/driver/posix/common.o: storage/driver/posix/common.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h storage/driver/posix/common.h diff --git a/src/command/archive/common.h b/src/command/archive/common.h index 8aab50eba..fbb48935c 100644 --- a/src/command/archive/common.h +++ b/src/command/archive/common.h @@ -35,12 +35,9 @@ WAL segment constants // Match on a WAL segment with partial allowed #define WAL_SEGMENT_PARTIAL_REGEXP WAL_SEGMENT_PREFIX_REGEXP "(\\.partial){0,1}$" -// Defines the size of standard WAL segment name -- this should never changed +// Defines the size of standard WAL segment name -- hopefully this won't change #define WAL_SEGMENT_NAME_SIZE ((unsigned int)24) -// Default size of a WAL segment -#define WAL_SEGMENT_DEFAULT_SIZE ((size_t)(16 * 1024 * 1024)) - /*********************************************************************************************************************************** Functions ***********************************************************************************************************************************/ diff --git a/src/command/archive/get/file.c b/src/command/archive/get/file.c index 1f903adb9..8474759ce 100644 --- a/src/command/archive/get/file.c +++ b/src/command/archive/get/file.c @@ -11,7 +11,7 @@ Archive Get File #include "compress/gzipDecompress.h" #include "config/config.h" #include "info/infoArchive.h" -#include "postgres/info.h" +#include "postgres/interface.h" #include "storage/helper.h" #include "storage/helper.h" @@ -32,7 +32,7 @@ archiveGetCheck(const String *archiveFile) MEM_CONTEXT_TEMP_BEGIN() { // Get pg control info - PgControlInfo controlInfo = pgControlInfo(cfgOptionStr(cfgOptPgPath)); + PgControl controlInfo = pgControlFromFile(cfgOptionStr(cfgOptPgPath)); // Attempt to load the archive info file InfoArchive *info = infoArchiveNew(storageRepo(), strNew(STORAGE_REPO_ARCHIVE "/" INFO_ARCHIVE_FILE), false); diff --git a/src/command/archive/get/get.c b/src/command/archive/get/get.c index 1d902ce48..de55e7bf6 100644 --- a/src/command/archive/get/get.c +++ b/src/command/archive/get/get.c @@ -17,7 +17,7 @@ Archive Get Command #include "config/config.h" #include "config/load.h" #include "perl/exec.h" -#include "postgres/info.h" +#include "postgres/interface.h" #include "storage/helper.h" #include "storage/helper.h" @@ -220,11 +220,8 @@ cmdArchiveGet(void) if (lockAcquire( // {uncoverable - almost impossible to make this lock fail} cfgOptionStr(cfgOptLockPath), cfgOptionStr(cfgOptStanza), cfgLockType(), 0, false)) { - // Get the version of PostgreSQL - unsigned int pgVersion = pgControlInfo(cfgOptionStr(cfgOptPgPath)).version; - - // Determine WAL segment size -- for now this is the default but for PG11 it will be configurable - unsigned int walSegmentSize = WAL_SEGMENT_DEFAULT_SIZE; + // Get control info + PgControl pgControl = pgControlFromFile(cfgOptionStr(cfgOptPgPath)); // Create the queue storagePathCreateNP(storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN)); @@ -233,8 +230,8 @@ cmdArchiveGet(void) // will return the list of WAL needed to fill the queue and this will be passed to the async process. cfgCommandParamSet( queueNeed( - walSegment, found, (size_t)cfgOptionInt64(cfgOptArchiveGetQueueMax), walSegmentSize, - pgVersion)); + walSegment, found, (size_t)cfgOptionInt64(cfgOptArchiveGetQueueMax), pgControl.walSegmentSize, + pgControl.version)); // The async process should not output on the console at all cfgOptionSet(cfgOptLogLevelConsole, cfgSourceParam, varNewStrZ("off")); diff --git a/src/info/infoPg.c b/src/info/infoPg.c index 5b18f04c7..e5f4e1151 100644 --- a/src/info/infoPg.c +++ b/src/info/infoPg.c @@ -16,7 +16,7 @@ PostgreSQL Info Handler #include "common/type/list.h" #include "info/info.h" #include "info/infoPg.h" -#include "postgres/info.h" +#include "postgres/interface.h" #include "postgres/version.h" #include "storage/helper.h" diff --git a/src/main.c b/src/main.c index a3560844d..a976100a5 100644 --- a/src/main.c +++ b/src/main.c @@ -13,6 +13,7 @@ Main #include "common/exit.h" #include "config/config.h" #include "config/load.h" +#include "postgres/interface.h" #include "perl/exec.h" #include "version.h" @@ -76,6 +77,13 @@ main(int argListSize, const char *argList[]) // ------------------------------------------------------------------------------------------------------------------------- else if (cfgCommand() == cfgCmdBackup) { +#ifdef DEBUG + // Check pg_control during testing so errors are more obvious. Otherwise errors only happen in archive-get/archive-push + // and end up in the PostgreSQL log which is not output in CI. This can be removed once backup is written in C. + if (cfgOptionBool(cfgOptOnline) && !cfgOptionBool(cfgOptBackupStandby) && !cfgOptionTest(cfgOptPgHost)) + pgControlFromFile(cfgOptionStr(cfgOptPgPath)); +#endif + // Run backup perlExec(); diff --git a/src/perl/embed.auto.c b/src/perl/embed.auto.c index f131c01cc..e97907eee 100644 --- a/src/perl/embed.auto.c +++ b/src/perl/embed.auto.c @@ -162,6 +162,7 @@ static const EmbeddedModule embeddedModule[] = "$strLsnStart,\n" "$strLsnStop,\n" "$strDbVersion,\n" + "$iWalSegmentSize,\n" ") =\n" "logDebugParam\n" "(\n" @@ -169,6 +170,7 @@ static const EmbeddedModule embeddedModule[] = "{name => 'strLsnStart'},\n" "{name => 'strLsnStop'},\n" "{name => '$strDbVersion'},\n" + "{name => '$iWalSegmentSize'},\n" ");\n" "\n\n" "my @stryArchive;\n" @@ -177,11 +179,11 @@ static const EmbeddedModule embeddedModule[] = "\n\n" "my @stryArchiveSplit = split('/', $strLsnStart);\n" "my $iStartMajor = hex($stryArchiveSplit[0]);\n" - "my $iStartMinor = hex(substr(sprintf(\"%08s\", $stryArchiveSplit[1]), 0, 2));\n" + "my $iStartMinor = int(hex($stryArchiveSplit[1]) / $iWalSegmentSize);\n" "\n" "@stryArchiveSplit = split('/', $strLsnStop);\n" "my $iStopMajor = hex($stryArchiveSplit[0]);\n" - "my $iStopMinor = hex(substr(sprintf(\"%08s\", $stryArchiveSplit[1]), 0, 2));\n" + "my $iStopMinor = int(hex($stryArchiveSplit[1]) / $iWalSegmentSize);\n" "\n" "$stryArchive[$iArchiveIdx] = uc(sprintf(\"%08x%08x\", $iStartMajor, $iStartMinor));\n" "$iArchiveIdx += 1;\n" @@ -190,7 +192,7 @@ static const EmbeddedModule embeddedModule[] = "{\n" "$iStartMinor += 1;\n" "\n" - "if ($bSkipFF && $iStartMinor == 255 || !$bSkipFF && $iStartMinor == 256)\n" + "if ($bSkipFF && $iStartMinor == 255 || !$bSkipFF && $iStartMinor > int(0xFFFFFFFF / $iWalSegmentSize))\n" "{\n" "$iStartMajor += 1;\n" "$iStartMinor = 0;\n" @@ -2604,6 +2606,7 @@ static const EmbeddedModule embeddedModule[] = "\n\n" "my $strArchiveStart = undef;\n" "my $strLsnStart = undef;\n" + "my $iWalSegmentSize = undef;\n" "my $hTablespaceMap = undef;\n" "my $hDatabaseMap = undef;\n" "\n\n" @@ -2634,7 +2637,7 @@ static const EmbeddedModule embeddedModule[] = "else\n" "{\n" "\n" - "($strArchiveStart, $strLsnStart) =\n" + "($strArchiveStart, $strLsnStart, $iWalSegmentSize) =\n" "$oDbMaster->backupStart(\n" "BACKREST_NAME . ' backup started at ' . timestampFormat(undef, $lTimestampStart), cfgOption(CFGOPT_START_FAST));\n" "\n\n" @@ -2777,7 +2780,7 @@ static const EmbeddedModule embeddedModule[] = "\n" "my $oArchiveInfo = new pgBackRest::Archive::Info(storageRepo()->pathGet(STORAGE_REPO_ARCHIVE), true);\n" "my $strArchiveId = $oArchiveInfo->archiveId();\n" - "my @stryArchive = lsnFileRange($strLsnStart, $strLsnStop, $strDbVersion);\n" + "my @stryArchive = lsnFileRange($strLsnStart, $strLsnStop, $strDbVersion, $iWalSegmentSize);\n" "\n" "foreach my $strArchive (@stryArchive)\n" "{\n" @@ -9333,8 +9336,13 @@ static const EmbeddedModule embeddedModule[] = "\"exclusive pg_start_backup() with label \\\"${strLabel}\\\": backup begins after \" .\n" "($bStartFast ? \"the requested immediate checkpoint\" : \"the next regular checkpoint\") . \" completes\");\n" "\n" - "my ($strTimestampDbStart, $strArchiveStart, $strLsnStart) = $self->executeSqlRow(\n" - "\"select to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS.US TZ'), pg_\" . $self->walId() . \"file_name(lsn), lsn::text\" .\n" + "my ($strTimestampDbStart, $strArchiveStart, $strLsnStart, $iWalSegmentSize) = $self->executeSqlRow(\n" + "\"select to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS.US TZ'), pg_\" . $self->walId() . \"file_name(lsn), lsn::text,\" .\n" + "($self->{strDbVersion} < PG_VERSION_84 ? PG_WAL_SIZE :\n" + "\" (select setting::int8 from pg_settings where name = 'wal_segment_size')\" .\n" + "\n" + "($self->{strDbVersion} < PG_VERSION_11 ?\n" + "\" * (select setting::int8 from pg_settings where name = 'wal_block_size')\" : '')) .\n" "\" from pg_start_backup('${strLabel}'\" .\n" "($bStartFast ? ', true' : $self->{strDbVersion} >= PG_VERSION_84 ? ', false' : '') .\n" "($self->{strDbVersion} >= PG_VERSION_96 ? ', false' : '') . ') as lsn');\n" @@ -9344,6 +9352,7 @@ static const EmbeddedModule embeddedModule[] = "$strOperation,\n" "{name => 'strArchiveStart', value => $strArchiveStart},\n" "{name => 'strLsnStart', value => $strLsnStart},\n" + "{name => 'iWalSegmentSize', value => $iWalSegmentSize},\n" "{name => 'strTimestampDbStart', value => $strTimestampDbStart}\n" ");\n" "}\n" diff --git a/src/postgres/info.c b/src/postgres/info.c deleted file mode 100644 index e0e289018..000000000 --- a/src/postgres/info.c +++ /dev/null @@ -1,155 +0,0 @@ -/*********************************************************************************************************************************** -PostgreSQL Info -***********************************************************************************************************************************/ -#include "common/debug.h" -#include "common/log.h" -#include "common/memContext.h" -#include "common/type/convert.h" -#include "common/regExp.h" -#include "postgres/info.h" -#include "postgres/type.h" -#include "postgres/version.h" -#include "storage/helper.h" - -/*********************************************************************************************************************************** -Set control data size. The control file is actually 8192 bytes but only the first 512 bytes are used to prevent torn pages even on -really old storage with 512-byte sectors. -***********************************************************************************************************************************/ -#define PG_CONTROL_DATA_SIZE 512 - -/*********************************************************************************************************************************** -Map control/catalog version to PostgreSQL version -***********************************************************************************************************************************/ -static unsigned int -pgVersionMap(uint32_t controlVersion, uint32_t catalogVersion) -{ - FUNCTION_TEST_BEGIN(); - FUNCTION_TEST_PARAM(UINT32, controlVersion); - FUNCTION_TEST_PARAM(UINT32, catalogVersion); - FUNCTION_TEST_END(); - - unsigned int result = 0; - - if (controlVersion == 1100 && catalogVersion == 201809051) - result = PG_VERSION_11; - else if (controlVersion == 1002 && catalogVersion == 201707211) - result = PG_VERSION_10; - else if (controlVersion == 960 && catalogVersion == 201608131) - result = PG_VERSION_96; - else if (controlVersion == 942 && catalogVersion == 201510051) - result = PG_VERSION_95; - else if (controlVersion == 942 && catalogVersion == 201409291) - result = PG_VERSION_94; - else if (controlVersion == 937 && catalogVersion == 201306121) - result = PG_VERSION_93; - else if (controlVersion == 922 && catalogVersion == 201204301) - result = PG_VERSION_92; - else if (controlVersion == 903 && catalogVersion == 201105231) - result = PG_VERSION_91; - else if (controlVersion == 903 && catalogVersion == 201008051) - result = PG_VERSION_90; - else if (controlVersion == 843 && catalogVersion == 200904091) - result = PG_VERSION_84; - else if (controlVersion == 833 && catalogVersion == 200711281) - result = PG_VERSION_83; - else - { - THROW_FMT( - VersionNotSupportedError, - "unexpected control version = %u and catalog version = %u\n" - "HINT: is this version of PostgreSQL supported?", - controlVersion, catalogVersion); - } - - FUNCTION_TEST_RESULT(UINT, result); -} - -/*********************************************************************************************************************************** -Convert version string to version number -***********************************************************************************************************************************/ -unsigned int -pgVersionFromStr(const String *version) -{ - FUNCTION_DEBUG_BEGIN(logLevelTrace); - FUNCTION_DEBUG_PARAM(STRING, version); - - FUNCTION_DEBUG_ASSERT(version != NULL); - FUNCTION_DEBUG_END(); - - unsigned int result = 0; - - MEM_CONTEXT_TEMP_BEGIN() - { - // If format is not number.number (9.4) or number only (10) then error - if (!regExpMatchOne(strNew("^[0-9]+[.]*[0-9]+$"), version)) - THROW_FMT(AssertError, "version %s format is invalid", strPtr(version)); - - // If there is a dot set the major and minor versions, else just the major - int idxStart = strChr(version, '.'); - unsigned int major; - unsigned int minor = 0; - - if (idxStart != -1) - { - major = cvtZToUInt(strPtr(strSubN(version, 0, (size_t)idxStart))); - minor = cvtZToUInt(strPtr(strSub(version, (size_t)idxStart + 1))); - } - else - major = cvtZToUInt(strPtr(version)); - - // No check to see if valid/supported PG version is on purpose - result = major * 10000 + minor * 100; - } - MEM_CONTEXT_TEMP_END(); - - FUNCTION_DEBUG_RESULT(UINT, result); -} - -/*********************************************************************************************************************************** -Convert version number to string -***********************************************************************************************************************************/ -String * -pgVersionToStr(unsigned int version) -{ - FUNCTION_DEBUG_BEGIN(logLevelTrace); - FUNCTION_DEBUG_PARAM(UINT, version); - FUNCTION_DEBUG_END(); - - String *result = version >= PG_VERSION_10 ? - strNewFmt("%u", version / 10000) : strNewFmt("%u.%u", version / 10000, version % 10000 / 100); - - FUNCTION_DEBUG_RESULT(STRING, result); -} - -/*********************************************************************************************************************************** -Get info from pg_control -***********************************************************************************************************************************/ -PgControlInfo -pgControlInfo(const String *pgPath) -{ - FUNCTION_DEBUG_BEGIN(logLevelDebug); - FUNCTION_DEBUG_PARAM(STRING, pgPath); - - FUNCTION_TEST_ASSERT(pgPath != NULL); - FUNCTION_DEBUG_END(); - - PgControlInfo result = {0}; - - MEM_CONTEXT_TEMP_BEGIN() - { - // Read control file - PgControlFile *control = (PgControlFile *)bufPtr( - storageGetP( - storageNewReadNP(storageLocal(), strNewFmt("%s/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL, strPtr(pgPath))), - .exactSize = PG_CONTROL_DATA_SIZE)); - - // Get PostgreSQL version - result.systemId = control->systemId; - result.controlVersion = control->controlVersion; - result.catalogVersion = control->catalogVersion; - result.version = pgVersionMap(result.controlVersion, result.catalogVersion); - } - MEM_CONTEXT_TEMP_END(); - - FUNCTION_DEBUG_RESULT(PG_CONTROL_INFO, result); -} diff --git a/src/postgres/interface.c b/src/postgres/interface.c new file mode 100644 index 000000000..3a6d9ffc6 --- /dev/null +++ b/src/postgres/interface.c @@ -0,0 +1,365 @@ +/*********************************************************************************************************************************** +PostgreSQL Interface +***********************************************************************************************************************************/ +#include + +#include "common/debug.h" +#include "common/log.h" +#include "common/memContext.h" +#include "common/regExp.h" +#include "postgres/interface.h" +#include "postgres/interface/v083.h" +#include "postgres/interface/v084.h" +#include "postgres/interface/v090.h" +#include "postgres/interface/v091.h" +#include "postgres/interface/v092.h" +#include "postgres/interface/v093.h" +#include "postgres/interface/v094.h" +#include "postgres/interface/v095.h" +#include "postgres/interface/v096.h" +#include "postgres/interface/v100.h" +#include "postgres/interface/v110.h" +#include "postgres/version.h" +#include "storage/helper.h" + +/*********************************************************************************************************************************** +Define default page size + +Page size can only be changed at compile time and is not known to be well-tested, so only the default page size is supported. +***********************************************************************************************************************************/ +#define PG_PAGE_SIZE_DEFAULT ((unsigned int)(8 * 1024)) + +/*********************************************************************************************************************************** +Define default wal segment size + +Page size can only be changed at compile time and and is not known to be well-tested, so only the default page size is supported. +***********************************************************************************************************************************/ +#define PG_WAL_SEGMENT_SIZE_DEFAULT ((unsigned int)(16 * 1024 * 1024)) + +/*********************************************************************************************************************************** +Control file size. The control file is actually 8192 bytes but only the first 512 bytes are used to prevent torn pages even on +really old storage with 512-byte sectors. This is true across all versions of PostgreSQL. +***********************************************************************************************************************************/ +#define PG_CONTROL_SIZE ((unsigned int)(8 * 1024)) +#define PG_CONTROL_DATA_SIZE ((unsigned int)(512)) + +/*********************************************************************************************************************************** +PostgreSQL interface definitions +***********************************************************************************************************************************/ +typedef struct PgInterface +{ + unsigned int version; + PgControl (*control)(const Buffer *); + bool (*is)(const Buffer *); + void (*controlTest)(PgControl, Buffer *); +} PgInterface; + +static const PgInterface pgInterface[] = +{ + { + .version = PG_VERSION_11, + .control = pgInterfaceControl110, + .is = pgInterfaceIs110, + +#ifdef DEBUG + .controlTest = pgInterfaceControlTest110, +#endif + }, + { + .version = PG_VERSION_10, + .control = pgInterfaceControl100, + .is = pgInterfaceIs100, + +#ifdef DEBUG + .controlTest = pgInterfaceControlTest100, +#endif + }, + { + .version = PG_VERSION_96, + .control = pgInterfaceControl096, + .is = pgInterfaceIs096, + +#ifdef DEBUG + .controlTest = pgInterfaceControlTest096, +#endif + }, + { + .version = PG_VERSION_95, + .control = pgInterfaceControl095, + .is = pgInterfaceIs095, + +#ifdef DEBUG + .controlTest = pgInterfaceControlTest095, +#endif + }, + { + .version = PG_VERSION_94, + .control = pgInterfaceControl094, + .is = pgInterfaceIs094, + +#ifdef DEBUG + .controlTest = pgInterfaceControlTest094, +#endif + }, + { + .version = PG_VERSION_93, + .control = pgInterfaceControl093, + .is = pgInterfaceIs093, + +#ifdef DEBUG + .controlTest = pgInterfaceControlTest093, +#endif + }, + { + .version = PG_VERSION_92, + .control = pgInterfaceControl092, + .is = pgInterfaceIs092, + +#ifdef DEBUG + .controlTest = pgInterfaceControlTest092, +#endif + }, + { + .version = PG_VERSION_91, + .control = pgInterfaceControl091, + .is = pgInterfaceIs091, + +#ifdef DEBUG + .controlTest = pgInterfaceControlTest091, +#endif + }, + { + .version = PG_VERSION_90, + .control = pgInterfaceControl090, + .is = pgInterfaceIs090, + +#ifdef DEBUG + .controlTest = pgInterfaceControlTest090, +#endif + }, + { + .version = PG_VERSION_84, + .control = pgInterfaceControl084, + .is = pgInterfaceIs084, + +#ifdef DEBUG + .controlTest = pgInterfaceControlTest084, +#endif + }, + { + .version = PG_VERSION_83, + .control = pgInterfaceControl083, + .is = pgInterfaceIs083, + +#ifdef DEBUG + .controlTest = pgInterfaceControlTest083, +#endif + }, +}; + +/*********************************************************************************************************************************** +These pg_control fields are common to all versions of PostgreSQL, so we can use them to generate error messages when the pg_control +version cannot be found. +***********************************************************************************************************************************/ +typedef struct PgControlCommon +{ + uint64_t systemId; + uint32_t controlVersion; + uint32_t catalogVersion; +} PgControlCommon; + +/*********************************************************************************************************************************** +Get info from pg_control +***********************************************************************************************************************************/ +PgControl +pgControlFromBuffer(const Buffer *controlFile) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_DEBUG_END(); + + // Search for the version of PostgreSQL that uses this control file + const PgInterface *interface = NULL; + + for (unsigned int interfaceIdx = 0; interfaceIdx < sizeof(pgInterface) / sizeof(PgInterface); interfaceIdx++) + { + if (pgInterface[interfaceIdx].is(controlFile)) + { + interface = &pgInterface[interfaceIdx]; + break; + } + } + + // If the version was not found then error with the control and catalog version that were found + if (interface == NULL) + { + PgControlCommon *controlCommon = (PgControlCommon *)bufPtr(controlFile); + + THROW_FMT( + VersionNotSupportedError, + "unexpected control version = %u and catalog version = %u\n" + "HINT: is this version of PostgreSQL supported?", + controlCommon->controlVersion, controlCommon->catalogVersion); + } + + // Get info from the control file + PgControl result = interface->control(controlFile); + result.version = interface->version; + + // Check the segment size + if (result.version < PG_VERSION_11 && result.walSegmentSize != PG_WAL_SEGMENT_SIZE_DEFAULT) + { + THROW_FMT( + FormatError, "wal segment size is %u but must be %u for " PG_NAME " <= " PG_VERSION_10_STR, result.walSegmentSize, + PG_WAL_SEGMENT_SIZE_DEFAULT); + } + + // Check the page size + if (result.pageSize != PG_PAGE_SIZE_DEFAULT) + THROW_FMT(FormatError, "page size is %u but must be %u", result.pageSize, PG_PAGE_SIZE_DEFAULT); + + FUNCTION_DEBUG_RESULT(PG_CONTROL, result); +} + +/*********************************************************************************************************************************** +Get info from pg_control +***********************************************************************************************************************************/ +PgControl +pgControlFromFile(const String *pgPath) +{ + FUNCTION_DEBUG_BEGIN(logLevelDebug); + FUNCTION_DEBUG_PARAM(STRING, pgPath); + + FUNCTION_TEST_ASSERT(pgPath != NULL); + FUNCTION_DEBUG_END(); + + PgControl result = {0}; + + MEM_CONTEXT_TEMP_BEGIN() + { + // Read control file + Buffer *controlFile = storageGetP( + storageNewReadNP(storageLocal(), strNewFmt("%s/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL, strPtr(pgPath))), + .exactSize = PG_CONTROL_DATA_SIZE); + + result = pgControlFromBuffer(controlFile); + } + MEM_CONTEXT_TEMP_END(); + + FUNCTION_DEBUG_RESULT(PG_CONTROL, result); +} + +/*********************************************************************************************************************************** +Create pg_control for testing +***********************************************************************************************************************************/ +#ifdef DEBUG + +Buffer * +pgControlTestToBuffer(PgControl pgControl) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(PG_CONTROL, pgControl); + FUNCTION_TEST_END(); + + // Set defaults if values are not passed + pgControl.pageSize = pgControl.pageSize == 0 ? PG_PAGE_SIZE_DEFAULT : pgControl.pageSize; + pgControl.walSegmentSize = pgControl.walSegmentSize == 0 ? PG_WAL_SEGMENT_SIZE_DEFAULT : pgControl.walSegmentSize; + + // Create the buffer and clear it + Buffer *result = bufNew(PG_CONTROL_SIZE); + memset(bufPtr(result), 0, bufSize(result)); + bufUsedSet(result, bufSize(result)); + + // Find the interface for the version of PostgreSQL + const PgInterface *interface = NULL; + + for (unsigned int interfaceIdx = 0; interfaceIdx < sizeof(pgInterface) / sizeof(PgInterface); interfaceIdx++) + { + if (pgInterface[interfaceIdx].version == pgControl.version) + { + interface = &pgInterface[interfaceIdx]; + break; + } + } + + // If the version was not found then error + if (interface == NULL) + THROW_FMT(AssertError, "invalid version %u", pgControl.version); + + // Generate pg_control + interface->controlTest(pgControl, result); + + FUNCTION_TEST_RESULT(BUFFER, result); +} + +#endif + +/*********************************************************************************************************************************** +Convert version string to version number +***********************************************************************************************************************************/ +unsigned int +pgVersionFromStr(const String *version) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(STRING, version); + + FUNCTION_DEBUG_ASSERT(version != NULL); + FUNCTION_DEBUG_END(); + + unsigned int result = 0; + + MEM_CONTEXT_TEMP_BEGIN() + { + // If format is not number.number (9.4) or number only (10) then error + if (!regExpMatchOne(strNew("^[0-9]+[.]*[0-9]+$"), version)) + THROW_FMT(AssertError, "version %s format is invalid", strPtr(version)); + + // If there is a dot set the major and minor versions, else just the major + int idxStart = strChr(version, '.'); + unsigned int major; + unsigned int minor = 0; + + if (idxStart != -1) + { + major = cvtZToUInt(strPtr(strSubN(version, 0, (size_t)idxStart))); + minor = cvtZToUInt(strPtr(strSub(version, (size_t)idxStart + 1))); + } + else + major = cvtZToUInt(strPtr(version)); + + // No check to see if valid/supported PG version is on purpose + result = major * 10000 + minor * 100; + } + MEM_CONTEXT_TEMP_END(); + + FUNCTION_DEBUG_RESULT(UINT, result); +} + +/*********************************************************************************************************************************** +Convert version number to string +***********************************************************************************************************************************/ +String * +pgVersionToStr(unsigned int version) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(UINT, version); + FUNCTION_DEBUG_END(); + + String *result = version >= PG_VERSION_10 ? + strNewFmt("%u", version / 10000) : strNewFmt("%u.%u", version / 10000, version % 10000 / 100); + + FUNCTION_DEBUG_RESULT(STRING, result); +} + +/*********************************************************************************************************************************** +Render as string for logging +***********************************************************************************************************************************/ +String * +pgControlToLog(const PgControl *pgControl) +{ + return strNewFmt( + "{version: %u, systemId: %" PRIu64 ", walSegmentSize: %u, pageChecksum: %s}", pgControl->version, pgControl->systemId, + pgControl->walSegmentSize, cvtBoolToConstZ(pgControl->pageChecksum)); +} diff --git a/src/postgres/info.h b/src/postgres/interface.h similarity index 50% rename from src/postgres/info.h rename to src/postgres/interface.h index 81125ac41..a31f08903 100644 --- a/src/postgres/info.h +++ b/src/postgres/interface.h @@ -1,38 +1,61 @@ /*********************************************************************************************************************************** -PostgreSQL Info +PostgreSQL Interface ***********************************************************************************************************************************/ -#ifndef POSTGRES_INFO_H -#define POSTGRES_INFO_H +#ifndef POSTGRES_INTERFACE_H +#define POSTGRES_INTERFACE_H #include #include +#include "common/type/string.h" + +/*********************************************************************************************************************************** +Defines for various Postgres paths and files +***********************************************************************************************************************************/ +#define PG_FILE_PGCONTROL "pg_control" + +#define PG_PATH_GLOBAL "global" + /*********************************************************************************************************************************** PostgreSQL Control File Info ***********************************************************************************************************************************/ -typedef struct PgControlInfo +typedef struct PgControl { + unsigned int version; uint64_t systemId; + uint32_t controlVersion; uint32_t catalogVersion; - unsigned int version; -} PgControlInfo; -#include "common/type/string.h" + unsigned int pageSize; + unsigned int walSegmentSize; + + bool pageChecksum; +} PgControl; /*********************************************************************************************************************************** Functions ***********************************************************************************************************************************/ -PgControlInfo pgControlInfo(const String *pgPath); +PgControl pgControlFromFile(const String *pgPath); +PgControl pgControlFromBuffer(const Buffer *controlFile); unsigned int pgVersionFromStr(const String *version); String *pgVersionToStr(unsigned int version); +/*********************************************************************************************************************************** +Test Functions +***********************************************************************************************************************************/ +#ifdef DEBUG + Buffer *pgControlTestToBuffer(PgControl pgControl); +#endif + /*********************************************************************************************************************************** Macros for function logging ***********************************************************************************************************************************/ -#define FUNCTION_DEBUG_PG_CONTROL_INFO_TYPE \ - PgControlInfo -#define FUNCTION_DEBUG_PG_CONTROL_INFO_FORMAT(value, buffer, bufferSize) \ - objToLog(&value, "PgControlInfo", buffer, bufferSize) +String *pgControlToLog(const PgControl *pgControl); + +#define FUNCTION_DEBUG_PG_CONTROL_TYPE \ + PgControl +#define FUNCTION_DEBUG_PG_CONTROL_FORMAT(value, buffer, bufferSize) \ + FUNCTION_DEBUG_STRING_OBJECT_FORMAT(&value, pgControlToLog, buffer, bufferSize) #endif diff --git a/src/postgres/interface/v083.auto.c b/src/postgres/interface/v083.auto.c new file mode 100644 index 000000000..cbdeff4d1 --- /dev/null +++ b/src/postgres/interface/v083.auto.c @@ -0,0 +1,203 @@ +/*********************************************************************************************************************************** +PostgreSQL 8.3 Types +***********************************************************************************************************************************/ + +/*********************************************************************************************************************************** +Types from src/include/c.h +***********************************************************************************************************************************/ +typedef int64_t int64; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef uint32 TransactionId; + +/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ +typedef TransactionId MultiXactId; + +typedef uint32 MultiXactOffset; + +/*********************************************************************************************************************************** +Types from src/include/postgres_ext.h +***********************************************************************************************************************************/ +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +/*********************************************************************************************************************************** +Types from src/include/utils/pg_crc32.h +***********************************************************************************************************************************/ +typedef uint32 pg_crc32; + +/*********************************************************************************************************************************** +Types from src/include/access/xlogdefs.h +***********************************************************************************************************************************/ +/* + * Pointer to a location in the XLOG. These pointers are 64 bits wide, + * because we don't want them ever to overflow. + * + * NOTE: xrecoff == 0 is used to indicate an invalid pointer. This is OK + * because we use page headers in the XLOG, so no XLOG record can start + * right at the beginning of a file. + * + * NOTE: the "log file number" is somewhat misnamed, since the actual files + * making up the XLOG are much smaller than 4Gb. Each actual file is an + * XLogSegSize-byte "segment" of a logical log file having the indicated + * xlogid. The log file number and segment number together identify a + * physical XLOG file. Segment number and offset within the physical file + * are computed from xrecoff div and mod XLogSegSize. + */ +typedef struct XLogRecPtr +{ + uint32 xlogid; /* log file #, 0 based */ + uint32 xrecoff; /* byte offset of location in log file */ +} XLogRecPtr; + +/* + * TimeLineID (TLI) - identifies different database histories to prevent + * confusion after restoring a prior state of a database installation. + * TLI does not change in a normal stop/restart of the database (including + * crash-and-recover cases); but we must assign a new TLI after doing + * a recovery to a prior state, a/k/a point-in-time recovery. This makes + * the new WAL logfile sequence we generate distinguishable from the + * sequence that was generated in the previous incarnation. + */ +typedef uint32 TimeLineID; + +/*********************************************************************************************************************************** +Types from src/include/catalog/catversion.h +***********************************************************************************************************************************/ +/* + * We could use anything we wanted for version numbers, but I recommend + * following the "YYYYMMDDN" style often used for DNS zone serial numbers. + * YYYYMMDD are the date of the change, and N is the number of the change + * on that day. (Hopefully we'll never commit ten independent sets of + * catalog changes on the same day...) + */ + +/* yyyymmddN */ +#define CATALOG_VERSION_NO 200711281 + +/*********************************************************************************************************************************** +Types from src/include/catalog/pg_control.h +***********************************************************************************************************************************/ +/* Version identifier for this pg_control format */ +#define PG_CONTROL_VERSION 833 + +/* + * Body of CheckPoint XLOG records. This is declared here because we keep + * a copy of the latest one in pg_control for possible disaster recovery. + */ +typedef struct CheckPoint +{ + XLogRecPtr redo; /* next RecPtr available when we began to + * create CheckPoint (i.e. REDO start point) */ + TimeLineID ThisTimeLineID; /* current TLI */ + uint32 nextXidEpoch; /* higher-order bits of nextXid */ + TransactionId nextXid; /* next free XID */ + Oid nextOid; /* next free OID */ + MultiXactId nextMulti; /* next free MultiXactId */ + MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ + time_t time; /* time stamp of checkpoint */ +} CheckPoint; + +/* System status indicator */ +typedef enum DBState +{ + DB_STARTUP = 0, + DB_SHUTDOWNED, + DB_SHUTDOWNING, + DB_IN_CRASH_RECOVERY, + DB_IN_ARCHIVE_RECOVERY, + DB_IN_PRODUCTION +} DBState; + +#define LOCALE_NAME_BUFLEN 128 + +/* + * Contents of pg_control. + * + * NOTE: try to keep this under 512 bytes so that it will fit on one physical + * sector of typical disk drives. This reduces the odds of corruption due to + * power failure midway through a write. Currently it fits comfortably, + * but we could probably reduce LOCALE_NAME_BUFLEN if things get tight. + */ + +typedef struct ControlFileData +{ + /* + * Unique system identifier --- to ensure we match up xlog files with the + * installation that produced them. + */ + uint64 system_identifier; + + /* + * Version identifier information. Keep these fields at the same offset, + * especially pg_control_version; they won't be real useful if they move + * around. (For historical reasons they must be 8 bytes into the file + * rather than immediately at the front.) + * + * pg_control_version identifies the format of pg_control itself. + * catalog_version_no identifies the format of the system catalogs. + * + * There are additional version identifiers in individual files; for + * example, WAL logs contain per-page magic numbers that can serve as + * version cues for the WAL log. + */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ + + /* + * System status data + */ + DBState state; /* see enum above */ + time_t time; /* time stamp of last pg_control update */ + XLogRecPtr checkPoint; /* last check point record ptr */ + XLogRecPtr prevCheckPoint; /* previous check point record ptr */ + + CheckPoint checkPointCopy; /* copy of last check point record */ + + XLogRecPtr minRecoveryPoint; /* must replay xlog to here */ + + /* + * This data is used to check for hardware-architecture compatibility of + * the database and the backend executable. We need not check endianness + * explicitly, since the pg_control version will surely look wrong to a + * machine of different endianness, but we do need to worry about MAXALIGN + * and floating-point format. (Note: storage layout nominally also + * depends on SHORTALIGN and INTALIGN, but in practice these are the same + * on all architectures of interest.) + * + * Testing just one double value is not a very bulletproof test for + * floating-point compatibility, but it will catch most cases. + */ + uint32 maxAlign; /* alignment requirement for tuples */ + double floatFormat; /* constant 1234567.0 */ +#define FLOATFORMAT_VALUE 1234567.0 + + /* + * This data is used to make sure that configuration of this database is + * compatible with the backend executable. + */ + uint32 blcksz; /* data block size for this DB */ + uint32 relseg_size; /* blocks per segment of large relation */ + + uint32 xlog_blcksz; /* block size within WAL files */ + uint32 xlog_seg_size; /* size of each WAL segment */ + + uint32 nameDataLen; /* catalog name field width */ + uint32 indexMaxKeys; /* max number of columns in an index */ + + uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + + /* flag indicating internal format of timestamp, interval, time */ + uint32 enableIntTimes; /* int64 storage enabled? */ + + /* active locales */ + uint32 localeBuflen; + char lc_collate[LOCALE_NAME_BUFLEN]; + char lc_ctype[LOCALE_NAME_BUFLEN]; + + /* CRC of all above ... MUST BE LAST! */ + pg_crc32 crc; +} ControlFileData; diff --git a/src/postgres/interface/v083.c b/src/postgres/interface/v083.c new file mode 100644 index 000000000..64c1c3f24 --- /dev/null +++ b/src/postgres/interface/v083.c @@ -0,0 +1,81 @@ +/*********************************************************************************************************************************** +PostgreSQL 8.3 Interface +***********************************************************************************************************************************/ +#include "common/debug.h" +#include "common/log.h" +#include "postgres/interface/v083.h" + +/*********************************************************************************************************************************** +Include PostgreSQL Types +***********************************************************************************************************************************/ +#include "postgres/interface/v083.auto.c" + +/*********************************************************************************************************************************** +Is the control file for this version of PostgreSQL? +***********************************************************************************************************************************/ +bool +pgInterfaceIs083(const Buffer *controlFile) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + FUNCTION_TEST_RESULT( + BOOL, controlData->pg_control_version == PG_CONTROL_VERSION && controlData->catalog_version_no == CATALOG_VERSION_NO); +} + +/*********************************************************************************************************************************** +Get information from pg_control in a common format +***********************************************************************************************************************************/ +PgControl +pgInterfaceControl083(const Buffer *controlFile) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_ASSERT(pgInterfaceIs083(controlFile)); + FUNCTION_DEBUG_END(); + + PgControl result = {0}; + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + result.systemId = controlData->system_identifier; + result.controlVersion = controlData->pg_control_version; + result.catalogVersion = controlData->catalog_version_no; + + result.pageSize = controlData->blcksz; + result.walSegmentSize = controlData->xlog_seg_size; + + FUNCTION_DEBUG_RESULT(PG_CONTROL, result); +} + +/*********************************************************************************************************************************** +Create pg_control for testing +***********************************************************************************************************************************/ +#ifdef DEBUG + +void +pgInterfaceControlTest083(PgControl pgControl, Buffer *buffer) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(PG_CONTROL, pgControl); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(buffer); + + controlData->system_identifier = pgControl.systemId; + controlData->pg_control_version = pgControl.controlVersion == 0 ? PG_CONTROL_VERSION : pgControl.controlVersion; + controlData->catalog_version_no = pgControl.catalogVersion == 0 ? CATALOG_VERSION_NO : pgControl.catalogVersion; + + controlData->blcksz = pgControl.pageSize; + controlData->xlog_seg_size = pgControl.walSegmentSize; + + FUNCTION_TEST_RESULT_VOID(); +} + +#endif diff --git a/src/postgres/interface/v083.h b/src/postgres/interface/v083.h new file mode 100644 index 000000000..377f3c132 --- /dev/null +++ b/src/postgres/interface/v083.h @@ -0,0 +1,22 @@ +/*********************************************************************************************************************************** +PostgreSQL 8.3 Interface +***********************************************************************************************************************************/ +#ifndef POSTGRES_INTERFACE_INTERFACE083_H +#define POSTGRES_INTERFACE_INTERFACE083_H + +#include "postgres/interface.h" + +/*********************************************************************************************************************************** +Functions +***********************************************************************************************************************************/ +bool pgInterfaceIs083(const Buffer *controlFile); +PgControl pgInterfaceControl083(const Buffer *controlFile); + +/*********************************************************************************************************************************** +Test Functions +***********************************************************************************************************************************/ +#ifdef DEBUG + void pgInterfaceControlTest083(PgControl pgControl, Buffer *buffer); +#endif + +#endif diff --git a/src/postgres/interface/v084.auto.c b/src/postgres/interface/v084.auto.c new file mode 100644 index 000000000..0471b55f2 --- /dev/null +++ b/src/postgres/interface/v084.auto.c @@ -0,0 +1,208 @@ +/*********************************************************************************************************************************** +PostgreSQL 8.4 Types +***********************************************************************************************************************************/ + +/*********************************************************************************************************************************** +Types from src/include/c.h +***********************************************************************************************************************************/ +typedef int64_t int64; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef uint32 TransactionId; + +/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ +typedef TransactionId MultiXactId; + +typedef uint32 MultiXactOffset; + +/*********************************************************************************************************************************** +Types from src/include/pgtime.h +***********************************************************************************************************************************/ +/* + * The API of this library is generally similar to the corresponding + * C library functions, except that we use pg_time_t which (we hope) is + * 64 bits wide, and which is most definitely signed not unsigned. + */ +typedef int64 pg_time_t; + +/*********************************************************************************************************************************** +Types from src/include/postgres_ext.h +***********************************************************************************************************************************/ +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +/*********************************************************************************************************************************** +Types from src/include/utils/pg_crc32.h +***********************************************************************************************************************************/ +typedef uint32 pg_crc32; + +/*********************************************************************************************************************************** +Types from src/include/access/xlogdefs.h +***********************************************************************************************************************************/ +/* + * Pointer to a location in the XLOG. These pointers are 64 bits wide, + * because we don't want them ever to overflow. + * + * NOTE: xrecoff == 0 is used to indicate an invalid pointer. This is OK + * because we use page headers in the XLOG, so no XLOG record can start + * right at the beginning of a file. + * + * NOTE: the "log file number" is somewhat misnamed, since the actual files + * making up the XLOG are much smaller than 4Gb. Each actual file is an + * XLogSegSize-byte "segment" of a logical log file having the indicated + * xlogid. The log file number and segment number together identify a + * physical XLOG file. Segment number and offset within the physical file + * are computed from xrecoff div and mod XLogSegSize. + */ +typedef struct XLogRecPtr +{ + uint32 xlogid; /* log file #, 0 based */ + uint32 xrecoff; /* byte offset of location in log file */ +} XLogRecPtr; + +/* + * TimeLineID (TLI) - identifies different database histories to prevent + * confusion after restoring a prior state of a database installation. + * TLI does not change in a normal stop/restart of the database (including + * crash-and-recover cases); but we must assign a new TLI after doing + * a recovery to a prior state, a/k/a point-in-time recovery. This makes + * the new WAL logfile sequence we generate distinguishable from the + * sequence that was generated in the previous incarnation. + */ +typedef uint32 TimeLineID; + +/*********************************************************************************************************************************** +Types from src/include/catalog/catversion.h +***********************************************************************************************************************************/ +/* + * We could use anything we wanted for version numbers, but I recommend + * following the "YYYYMMDDN" style often used for DNS zone serial numbers. + * YYYYMMDD are the date of the change, and N is the number of the change + * on that day. (Hopefully we'll never commit ten independent sets of + * catalog changes on the same day...) + */ + +/* yyyymmddN */ +#define CATALOG_VERSION_NO 200904091 + +/*********************************************************************************************************************************** +Types from src/include/catalog/pg_control.h +***********************************************************************************************************************************/ +/* Version identifier for this pg_control format */ +#define PG_CONTROL_VERSION 843 + +/* + * Body of CheckPoint XLOG records. This is declared here because we keep + * a copy of the latest one in pg_control for possible disaster recovery. + */ +typedef struct CheckPoint +{ + XLogRecPtr redo; /* next RecPtr available when we began to + * create CheckPoint (i.e. REDO start point) */ + TimeLineID ThisTimeLineID; /* current TLI */ + uint32 nextXidEpoch; /* higher-order bits of nextXid */ + TransactionId nextXid; /* next free XID */ + Oid nextOid; /* next free OID */ + MultiXactId nextMulti; /* next free MultiXactId */ + MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ + pg_time_t time; /* time stamp of checkpoint */ +} CheckPoint; + +/* System status indicator */ +typedef enum DBState +{ + DB_STARTUP = 0, + DB_SHUTDOWNED, + DB_SHUTDOWNING, + DB_IN_CRASH_RECOVERY, + DB_IN_ARCHIVE_RECOVERY, + DB_IN_PRODUCTION +} DBState; + +/* + * Contents of pg_control. + * + * NOTE: try to keep this under 512 bytes so that it will fit on one physical + * sector of typical disk drives. This reduces the odds of corruption due to + * power failure midway through a write. + */ +typedef struct ControlFileData +{ + /* + * Unique system identifier --- to ensure we match up xlog files with the + * installation that produced them. + */ + uint64 system_identifier; + + /* + * Version identifier information. Keep these fields at the same offset, + * especially pg_control_version; they won't be real useful if they move + * around. (For historical reasons they must be 8 bytes into the file + * rather than immediately at the front.) + * + * pg_control_version identifies the format of pg_control itself. + * catalog_version_no identifies the format of the system catalogs. + * + * There are additional version identifiers in individual files; for + * example, WAL logs contain per-page magic numbers that can serve as + * version cues for the WAL log. + */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ + + /* + * System status data + */ + DBState state; /* see enum above */ + pg_time_t time; /* time stamp of last pg_control update */ + XLogRecPtr checkPoint; /* last check point record ptr */ + XLogRecPtr prevCheckPoint; /* previous check point record ptr */ + + CheckPoint checkPointCopy; /* copy of last check point record */ + + XLogRecPtr minRecoveryPoint; /* must replay xlog to here */ + + /* + * This data is used to check for hardware-architecture compatibility of + * the database and the backend executable. We need not check endianness + * explicitly, since the pg_control version will surely look wrong to a + * machine of different endianness, but we do need to worry about MAXALIGN + * and floating-point format. (Note: storage layout nominally also + * depends on SHORTALIGN and INTALIGN, but in practice these are the same + * on all architectures of interest.) + * + * Testing just one double value is not a very bulletproof test for + * floating-point compatibility, but it will catch most cases. + */ + uint32 maxAlign; /* alignment requirement for tuples */ + double floatFormat; /* constant 1234567.0 */ +#define FLOATFORMAT_VALUE 1234567.0 + + /* + * This data is used to make sure that configuration of this database is + * compatible with the backend executable. + */ + uint32 blcksz; /* data block size for this DB */ + uint32 relseg_size; /* blocks per segment of large relation */ + + uint32 xlog_blcksz; /* block size within WAL files */ + uint32 xlog_seg_size; /* size of each WAL segment */ + + uint32 nameDataLen; /* catalog name field width */ + uint32 indexMaxKeys; /* max number of columns in an index */ + + uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + + /* flag indicating internal format of timestamp, interval, time */ + bool enableIntTimes; /* int64 storage enabled? */ + + /* flags indicating pass-by-value status of various types */ + bool float4ByVal; /* float4 pass-by-value? */ + bool float8ByVal; /* float8, int8, etc pass-by-value? */ + + /* CRC of all above ... MUST BE LAST! */ + pg_crc32 crc; +} ControlFileData; diff --git a/src/postgres/interface/v084.c b/src/postgres/interface/v084.c new file mode 100644 index 000000000..5bc2534ba --- /dev/null +++ b/src/postgres/interface/v084.c @@ -0,0 +1,81 @@ +/*********************************************************************************************************************************** +PostgreSQL 8.4 Interface +***********************************************************************************************************************************/ +#include "common/debug.h" +#include "common/log.h" +#include "postgres/interface/v084.h" + +/*********************************************************************************************************************************** +Include PostgreSQL Types +***********************************************************************************************************************************/ +#include "postgres/interface/v084.auto.c" + +/*********************************************************************************************************************************** +Is the control file for this version of PostgreSQL? +***********************************************************************************************************************************/ +bool +pgInterfaceIs084(const Buffer *controlFile) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + FUNCTION_TEST_RESULT( + BOOL, controlData->pg_control_version == PG_CONTROL_VERSION && controlData->catalog_version_no == CATALOG_VERSION_NO); +} + +/*********************************************************************************************************************************** +Get information from pg_control in a common format +***********************************************************************************************************************************/ +PgControl +pgInterfaceControl084(const Buffer *controlFile) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_ASSERT(pgInterfaceIs084(controlFile)); + FUNCTION_DEBUG_END(); + + PgControl result = {0}; + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + result.systemId = controlData->system_identifier; + result.controlVersion = controlData->pg_control_version; + result.catalogVersion = controlData->catalog_version_no; + + result.pageSize = controlData->blcksz; + result.walSegmentSize = controlData->xlog_seg_size; + + FUNCTION_DEBUG_RESULT(PG_CONTROL, result); +} + +/*********************************************************************************************************************************** +Create pg_control for testing +***********************************************************************************************************************************/ +#ifdef DEBUG + +void +pgInterfaceControlTest084(PgControl pgControl, Buffer *buffer) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(PG_CONTROL, pgControl); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(buffer); + + controlData->system_identifier = pgControl.systemId; + controlData->pg_control_version = pgControl.controlVersion == 0 ? PG_CONTROL_VERSION : pgControl.controlVersion; + controlData->catalog_version_no = pgControl.catalogVersion == 0 ? CATALOG_VERSION_NO : pgControl.catalogVersion; + + controlData->blcksz = pgControl.pageSize; + controlData->xlog_seg_size = pgControl.walSegmentSize; + + FUNCTION_TEST_RESULT_VOID(); +} + +#endif diff --git a/src/postgres/interface/v084.h b/src/postgres/interface/v084.h new file mode 100644 index 000000000..1a7e1827c --- /dev/null +++ b/src/postgres/interface/v084.h @@ -0,0 +1,22 @@ +/*********************************************************************************************************************************** +PostgreSQL 8.4 Interface +***********************************************************************************************************************************/ +#ifndef POSTGRES_INTERFACE_INTERFACE084_H +#define POSTGRES_INTERFACE_INTERFACE084_H + +#include "postgres/interface.h" + +/*********************************************************************************************************************************** +Functions +***********************************************************************************************************************************/ +bool pgInterfaceIs084(const Buffer *controlFile); +PgControl pgInterfaceControl084(const Buffer *controlFile); + +/*********************************************************************************************************************************** +Test Functions +***********************************************************************************************************************************/ +#ifdef DEBUG + void pgInterfaceControlTest084(PgControl pgControl, Buffer *buffer); +#endif + +#endif diff --git a/src/postgres/interface/v090.auto.c b/src/postgres/interface/v090.auto.c new file mode 100644 index 000000000..ef66c7f78 --- /dev/null +++ b/src/postgres/interface/v090.auto.c @@ -0,0 +1,252 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.0 Types +***********************************************************************************************************************************/ + +/*********************************************************************************************************************************** +Types from src/include/c.h +***********************************************************************************************************************************/ +typedef int64_t int64; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef uint32 TransactionId; + +/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ +typedef TransactionId MultiXactId; + +typedef uint32 MultiXactOffset; + +/*********************************************************************************************************************************** +Types from src/include/pgtime.h +***********************************************************************************************************************************/ +/* + * The API of this library is generally similar to the corresponding + * C library functions, except that we use pg_time_t which (we hope) is + * 64 bits wide, and which is most definitely signed not unsigned. + */ +typedef int64 pg_time_t; + +/*********************************************************************************************************************************** +Types from src/include/postgres_ext.h +***********************************************************************************************************************************/ +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +/*********************************************************************************************************************************** +Types from src/include/utils/pg_crc32.h +***********************************************************************************************************************************/ +typedef uint32 pg_crc32; + +/*********************************************************************************************************************************** +Types from src/include/access/xlogdefs.h +***********************************************************************************************************************************/ +/* + * Pointer to a location in the XLOG. These pointers are 64 bits wide, + * because we don't want them ever to overflow. + * + * NOTE: xrecoff == 0 is used to indicate an invalid pointer. This is OK + * because we use page headers in the XLOG, so no XLOG record can start + * right at the beginning of a file. + * + * NOTE: the "log file number" is somewhat misnamed, since the actual files + * making up the XLOG are much smaller than 4Gb. Each actual file is an + * XLogSegSize-byte "segment" of a logical log file having the indicated + * xlogid. The log file number and segment number together identify a + * physical XLOG file. Segment number and offset within the physical file + * are computed from xrecoff div and mod XLogSegSize. + */ +typedef struct XLogRecPtr +{ + uint32 xlogid; /* log file #, 0 based */ + uint32 xrecoff; /* byte offset of location in log file */ +} XLogRecPtr; + +/* + * TimeLineID (TLI) - identifies different database histories to prevent + * confusion after restoring a prior state of a database installation. + * TLI does not change in a normal stop/restart of the database (including + * crash-and-recover cases); but we must assign a new TLI after doing + * a recovery to a prior state, a/k/a point-in-time recovery. This makes + * the new WAL logfile sequence we generate distinguishable from the + * sequence that was generated in the previous incarnation. + */ +typedef uint32 TimeLineID; + +/*********************************************************************************************************************************** +Types from src/include/catalog/catversion.h +***********************************************************************************************************************************/ +/* + * We could use anything we wanted for version numbers, but I recommend + * following the "YYYYMMDDN" style often used for DNS zone serial numbers. + * YYYYMMDD are the date of the change, and N is the number of the change + * on that day. (Hopefully we'll never commit ten independent sets of + * catalog changes on the same day...) + */ + +/* yyyymmddN */ +#define CATALOG_VERSION_NO 201008051 + +/*********************************************************************************************************************************** +Types from src/include/catalog/pg_control.h +***********************************************************************************************************************************/ +/* Version identifier for this pg_control format */ +#define PG_CONTROL_VERSION 903 + +/* + * Body of CheckPoint XLOG records. This is declared here because we keep + * a copy of the latest one in pg_control for possible disaster recovery. + * Changing this struct requires a PG_CONTROL_VERSION bump. + */ +typedef struct CheckPoint +{ + XLogRecPtr redo; /* next RecPtr available when we began to + * create CheckPoint (i.e. REDO start point) */ + TimeLineID ThisTimeLineID; /* current TLI */ + uint32 nextXidEpoch; /* higher-order bits of nextXid */ + TransactionId nextXid; /* next free XID */ + Oid nextOid; /* next free OID */ + MultiXactId nextMulti; /* next free MultiXactId */ + MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ + TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ + Oid oldestXidDB; /* database with minimum datfrozenxid */ + pg_time_t time; /* time stamp of checkpoint */ + + /* + * Oldest XID still running. This is only needed to initialize hot standby + * mode from an online checkpoint, so we only bother calculating this for + * online checkpoints and only when wal_level is hot_standby. Otherwise it's + * set to InvalidTransactionId. + */ + TransactionId oldestActiveXid; +} CheckPoint; + +/* + * System status indicator. Note this is stored in pg_control; if you change + * it, you must bump PG_CONTROL_VERSION + */ +typedef enum DBState +{ + DB_STARTUP = 0, + DB_SHUTDOWNED, + DB_SHUTDOWNED_IN_RECOVERY, + DB_SHUTDOWNING, + DB_IN_CRASH_RECOVERY, + DB_IN_ARCHIVE_RECOVERY, + DB_IN_PRODUCTION +} DBState; + +/* + * Contents of pg_control. + * + * NOTE: try to keep this under 512 bytes so that it will fit on one physical + * sector of typical disk drives. This reduces the odds of corruption due to + * power failure midway through a write. + */ +typedef struct ControlFileData +{ + /* + * Unique system identifier --- to ensure we match up xlog files with the + * installation that produced them. + */ + uint64 system_identifier; + + /* + * Version identifier information. Keep these fields at the same offset, + * especially pg_control_version; they won't be real useful if they move + * around. (For historical reasons they must be 8 bytes into the file + * rather than immediately at the front.) + * + * pg_control_version identifies the format of pg_control itself. + * catalog_version_no identifies the format of the system catalogs. + * + * There are additional version identifiers in individual files; for + * example, WAL logs contain per-page magic numbers that can serve as + * version cues for the WAL log. + */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ + + /* + * System status data + */ + DBState state; /* see enum above */ + pg_time_t time; /* time stamp of last pg_control update */ + XLogRecPtr checkPoint; /* last check point record ptr */ + XLogRecPtr prevCheckPoint; /* previous check point record ptr */ + + CheckPoint checkPointCopy; /* copy of last check point record */ + + /* + * These two values determine the minimum point we must recover up to + * before starting up: + * + * minRecoveryPoint is updated to the latest replayed LSN whenever we + * flush a data change during archive recovery. That guards against + * starting archive recovery, aborting it, and restarting with an earlier + * stop location. If we've already flushed data changes from WAL record X + * to disk, we mustn't start up until we reach X again. Zero when not + * doing archive recovery. + * + * backupStartPoint is the redo pointer of the backup start checkpoint, if + * we are recovering from an online backup and haven't reached the end of + * backup yet. It is reset to zero when the end of backup is reached, and + * we mustn't start up before that. A boolean would suffice otherwise, but + * we use the redo pointer as a cross-check when we see an end-of-backup + * record, to make sure the end-of-backup record corresponds the base + * backup we're recovering from. + */ + XLogRecPtr minRecoveryPoint; + XLogRecPtr backupStartPoint; + + /* + * Parameter settings that determine if the WAL can be used for archival + * or hot standby. + */ + int wal_level; + int MaxConnections; + int max_prepared_xacts; + int max_locks_per_xact; + + /* + * This data is used to check for hardware-architecture compatibility of + * the database and the backend executable. We need not check endianness + * explicitly, since the pg_control version will surely look wrong to a + * machine of different endianness, but we do need to worry about MAXALIGN + * and floating-point format. (Note: storage layout nominally also + * depends on SHORTALIGN and INTALIGN, but in practice these are the same + * on all architectures of interest.) + * + * Testing just one double value is not a very bulletproof test for + * floating-point compatibility, but it will catch most cases. + */ + uint32 maxAlign; /* alignment requirement for tuples */ + double floatFormat; /* constant 1234567.0 */ +#define FLOATFORMAT_VALUE 1234567.0 + + /* + * This data is used to make sure that configuration of this database is + * compatible with the backend executable. + */ + uint32 blcksz; /* data block size for this DB */ + uint32 relseg_size; /* blocks per segment of large relation */ + + uint32 xlog_blcksz; /* block size within WAL files */ + uint32 xlog_seg_size; /* size of each WAL segment */ + + uint32 nameDataLen; /* catalog name field width */ + uint32 indexMaxKeys; /* max number of columns in an index */ + + uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + + /* flag indicating internal format of timestamp, interval, time */ + bool enableIntTimes; /* int64 storage enabled? */ + + /* flags indicating pass-by-value status of various types */ + bool float4ByVal; /* float4 pass-by-value? */ + bool float8ByVal; /* float8, int8, etc pass-by-value? */ + + /* CRC of all above ... MUST BE LAST! */ + pg_crc32 crc; +} ControlFileData; diff --git a/src/postgres/interface/v090.c b/src/postgres/interface/v090.c new file mode 100644 index 000000000..230eea7d7 --- /dev/null +++ b/src/postgres/interface/v090.c @@ -0,0 +1,81 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.0 Interface +***********************************************************************************************************************************/ +#include "common/debug.h" +#include "common/log.h" +#include "postgres/interface/v090.h" + +/*********************************************************************************************************************************** +Include PostgreSQL Types +***********************************************************************************************************************************/ +#include "postgres/interface/v090.auto.c" + +/*********************************************************************************************************************************** +Is the control file for this version of PostgreSQL? +***********************************************************************************************************************************/ +bool +pgInterfaceIs090(const Buffer *controlFile) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + FUNCTION_TEST_RESULT( + BOOL, controlData->pg_control_version == PG_CONTROL_VERSION && controlData->catalog_version_no == CATALOG_VERSION_NO); +} + +/*********************************************************************************************************************************** +Get information from pg_control in a common format +***********************************************************************************************************************************/ +PgControl +pgInterfaceControl090(const Buffer *controlFile) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_ASSERT(pgInterfaceIs090(controlFile)); + FUNCTION_DEBUG_END(); + + PgControl result = {0}; + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + result.systemId = controlData->system_identifier; + result.controlVersion = controlData->pg_control_version; + result.catalogVersion = controlData->catalog_version_no; + + result.pageSize = controlData->blcksz; + result.walSegmentSize = controlData->xlog_seg_size; + + FUNCTION_DEBUG_RESULT(PG_CONTROL, result); +} + +/*********************************************************************************************************************************** +Create pg_control for testing +***********************************************************************************************************************************/ +#ifdef DEBUG + +void +pgInterfaceControlTest090(PgControl pgControl, Buffer *buffer) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(PG_CONTROL, pgControl); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(buffer); + + controlData->system_identifier = pgControl.systemId; + controlData->pg_control_version = pgControl.controlVersion == 0 ? PG_CONTROL_VERSION : pgControl.controlVersion; + controlData->catalog_version_no = pgControl.catalogVersion == 0 ? CATALOG_VERSION_NO : pgControl.catalogVersion; + + controlData->blcksz = pgControl.pageSize; + controlData->xlog_seg_size = pgControl.walSegmentSize; + + FUNCTION_TEST_RESULT_VOID(); +} + +#endif diff --git a/src/postgres/interface/v090.h b/src/postgres/interface/v090.h new file mode 100644 index 000000000..e590e9a20 --- /dev/null +++ b/src/postgres/interface/v090.h @@ -0,0 +1,22 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.0 Interface +***********************************************************************************************************************************/ +#ifndef POSTGRES_INTERFACE_INTERFACE090_H +#define POSTGRES_INTERFACE_INTERFACE090_H + +#include "postgres/interface.h" + +/*********************************************************************************************************************************** +Functions +***********************************************************************************************************************************/ +bool pgInterfaceIs090(const Buffer *controlFile); +PgControl pgInterfaceControl090(const Buffer *controlFile); + +/*********************************************************************************************************************************** +Test Functions +***********************************************************************************************************************************/ +#ifdef DEBUG + void pgInterfaceControlTest090(PgControl pgControl, Buffer *buffer); +#endif + +#endif diff --git a/src/postgres/interface/v091.auto.c b/src/postgres/interface/v091.auto.c new file mode 100644 index 000000000..5929de710 --- /dev/null +++ b/src/postgres/interface/v091.auto.c @@ -0,0 +1,252 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.1 Types +***********************************************************************************************************************************/ + +/*********************************************************************************************************************************** +Types from src/include/c.h +***********************************************************************************************************************************/ +typedef int64_t int64; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef uint32 TransactionId; + +/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ +typedef TransactionId MultiXactId; + +typedef uint32 MultiXactOffset; + +/*********************************************************************************************************************************** +Types from src/include/pgtime.h +***********************************************************************************************************************************/ +/* + * The API of this library is generally similar to the corresponding + * C library functions, except that we use pg_time_t which (we hope) is + * 64 bits wide, and which is most definitely signed not unsigned. + */ +typedef int64 pg_time_t; + +/*********************************************************************************************************************************** +Types from src/include/postgres_ext.h +***********************************************************************************************************************************/ +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +/*********************************************************************************************************************************** +Types from src/include/utils/pg_crc32.h +***********************************************************************************************************************************/ +typedef uint32 pg_crc32; + +/*********************************************************************************************************************************** +Types from src/include/access/xlogdefs.h +***********************************************************************************************************************************/ +/* + * Pointer to a location in the XLOG. These pointers are 64 bits wide, + * because we don't want them ever to overflow. + * + * NOTE: xrecoff == 0 is used to indicate an invalid pointer. This is OK + * because we use page headers in the XLOG, so no XLOG record can start + * right at the beginning of a file. + * + * NOTE: the "log file number" is somewhat misnamed, since the actual files + * making up the XLOG are much smaller than 4Gb. Each actual file is an + * XLogSegSize-byte "segment" of a logical log file having the indicated + * xlogid. The log file number and segment number together identify a + * physical XLOG file. Segment number and offset within the physical file + * are computed from xrecoff div and mod XLogSegSize. + */ +typedef struct XLogRecPtr +{ + uint32 xlogid; /* log file #, 0 based */ + uint32 xrecoff; /* byte offset of location in log file */ +} XLogRecPtr; + +/* + * TimeLineID (TLI) - identifies different database histories to prevent + * confusion after restoring a prior state of a database installation. + * TLI does not change in a normal stop/restart of the database (including + * crash-and-recover cases); but we must assign a new TLI after doing + * a recovery to a prior state, a/k/a point-in-time recovery. This makes + * the new WAL logfile sequence we generate distinguishable from the + * sequence that was generated in the previous incarnation. + */ +typedef uint32 TimeLineID; + +/*********************************************************************************************************************************** +Types from src/include/catalog/catversion.h +***********************************************************************************************************************************/ +/* + * We could use anything we wanted for version numbers, but I recommend + * following the "YYYYMMDDN" style often used for DNS zone serial numbers. + * YYYYMMDD are the date of the change, and N is the number of the change + * on that day. (Hopefully we'll never commit ten independent sets of + * catalog changes on the same day...) + */ + +/* yyyymmddN */ +#define CATALOG_VERSION_NO 201105231 + +/*********************************************************************************************************************************** +Types from src/include/catalog/pg_control.h +***********************************************************************************************************************************/ +/* Version identifier for this pg_control format */ +#define PG_CONTROL_VERSION 903 + +/* + * Body of CheckPoint XLOG records. This is declared here because we keep + * a copy of the latest one in pg_control for possible disaster recovery. + * Changing this struct requires a PG_CONTROL_VERSION bump. + */ +typedef struct CheckPoint +{ + XLogRecPtr redo; /* next RecPtr available when we began to + * create CheckPoint (i.e. REDO start point) */ + TimeLineID ThisTimeLineID; /* current TLI */ + uint32 nextXidEpoch; /* higher-order bits of nextXid */ + TransactionId nextXid; /* next free XID */ + Oid nextOid; /* next free OID */ + MultiXactId nextMulti; /* next free MultiXactId */ + MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ + TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ + Oid oldestXidDB; /* database with minimum datfrozenxid */ + pg_time_t time; /* time stamp of checkpoint */ + + /* + * Oldest XID still running. This is only needed to initialize hot standby + * mode from an online checkpoint, so we only bother calculating this for + * online checkpoints and only when wal_level is hot_standby. Otherwise + * it's set to InvalidTransactionId. + */ + TransactionId oldestActiveXid; +} CheckPoint; + +/* + * System status indicator. Note this is stored in pg_control; if you change + * it, you must bump PG_CONTROL_VERSION + */ +typedef enum DBState +{ + DB_STARTUP = 0, + DB_SHUTDOWNED, + DB_SHUTDOWNED_IN_RECOVERY, + DB_SHUTDOWNING, + DB_IN_CRASH_RECOVERY, + DB_IN_ARCHIVE_RECOVERY, + DB_IN_PRODUCTION +} DBState; + +/* + * Contents of pg_control. + * + * NOTE: try to keep this under 512 bytes so that it will fit on one physical + * sector of typical disk drives. This reduces the odds of corruption due to + * power failure midway through a write. + */ +typedef struct ControlFileData +{ + /* + * Unique system identifier --- to ensure we match up xlog files with the + * installation that produced them. + */ + uint64 system_identifier; + + /* + * Version identifier information. Keep these fields at the same offset, + * especially pg_control_version; they won't be real useful if they move + * around. (For historical reasons they must be 8 bytes into the file + * rather than immediately at the front.) + * + * pg_control_version identifies the format of pg_control itself. + * catalog_version_no identifies the format of the system catalogs. + * + * There are additional version identifiers in individual files; for + * example, WAL logs contain per-page magic numbers that can serve as + * version cues for the WAL log. + */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ + + /* + * System status data + */ + DBState state; /* see enum above */ + pg_time_t time; /* time stamp of last pg_control update */ + XLogRecPtr checkPoint; /* last check point record ptr */ + XLogRecPtr prevCheckPoint; /* previous check point record ptr */ + + CheckPoint checkPointCopy; /* copy of last check point record */ + + /* + * These two values determine the minimum point we must recover up to + * before starting up: + * + * minRecoveryPoint is updated to the latest replayed LSN whenever we + * flush a data change during archive recovery. That guards against + * starting archive recovery, aborting it, and restarting with an earlier + * stop location. If we've already flushed data changes from WAL record X + * to disk, we mustn't start up until we reach X again. Zero when not + * doing archive recovery. + * + * backupStartPoint is the redo pointer of the backup start checkpoint, if + * we are recovering from an online backup and haven't reached the end of + * backup yet. It is reset to zero when the end of backup is reached, and + * we mustn't start up before that. A boolean would suffice otherwise, but + * we use the redo pointer as a cross-check when we see an end-of-backup + * record, to make sure the end-of-backup record corresponds the base + * backup we're recovering from. + */ + XLogRecPtr minRecoveryPoint; + XLogRecPtr backupStartPoint; + + /* + * Parameter settings that determine if the WAL can be used for archival + * or hot standby. + */ + int wal_level; + int MaxConnections; + int max_prepared_xacts; + int max_locks_per_xact; + + /* + * This data is used to check for hardware-architecture compatibility of + * the database and the backend executable. We need not check endianness + * explicitly, since the pg_control version will surely look wrong to a + * machine of different endianness, but we do need to worry about MAXALIGN + * and floating-point format. (Note: storage layout nominally also + * depends on SHORTALIGN and INTALIGN, but in practice these are the same + * on all architectures of interest.) + * + * Testing just one double value is not a very bulletproof test for + * floating-point compatibility, but it will catch most cases. + */ + uint32 maxAlign; /* alignment requirement for tuples */ + double floatFormat; /* constant 1234567.0 */ +#define FLOATFORMAT_VALUE 1234567.0 + + /* + * This data is used to make sure that configuration of this database is + * compatible with the backend executable. + */ + uint32 blcksz; /* data block size for this DB */ + uint32 relseg_size; /* blocks per segment of large relation */ + + uint32 xlog_blcksz; /* block size within WAL files */ + uint32 xlog_seg_size; /* size of each WAL segment */ + + uint32 nameDataLen; /* catalog name field width */ + uint32 indexMaxKeys; /* max number of columns in an index */ + + uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + + /* flag indicating internal format of timestamp, interval, time */ + bool enableIntTimes; /* int64 storage enabled? */ + + /* flags indicating pass-by-value status of various types */ + bool float4ByVal; /* float4 pass-by-value? */ + bool float8ByVal; /* float8, int8, etc pass-by-value? */ + + /* CRC of all above ... MUST BE LAST! */ + pg_crc32 crc; +} ControlFileData; diff --git a/src/postgres/interface/v091.c b/src/postgres/interface/v091.c new file mode 100644 index 000000000..80661bcad --- /dev/null +++ b/src/postgres/interface/v091.c @@ -0,0 +1,81 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.1 Interface +***********************************************************************************************************************************/ +#include "common/debug.h" +#include "common/log.h" +#include "postgres/interface/v091.h" + +/*********************************************************************************************************************************** +Include PostgreSQL Types +***********************************************************************************************************************************/ +#include "postgres/interface/v091.auto.c" + +/*********************************************************************************************************************************** +Is the control file for this version of PostgreSQL? +***********************************************************************************************************************************/ +bool +pgInterfaceIs091(const Buffer *controlFile) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + FUNCTION_TEST_RESULT( + BOOL, controlData->pg_control_version == PG_CONTROL_VERSION && controlData->catalog_version_no == CATALOG_VERSION_NO); +} + +/*********************************************************************************************************************************** +Get information from pg_control in a common format +***********************************************************************************************************************************/ +PgControl +pgInterfaceControl091(const Buffer *controlFile) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_ASSERT(pgInterfaceIs091(controlFile)); + FUNCTION_DEBUG_END(); + + PgControl result = {0}; + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + result.systemId = controlData->system_identifier; + result.controlVersion = controlData->pg_control_version; + result.catalogVersion = controlData->catalog_version_no; + + result.pageSize = controlData->blcksz; + result.walSegmentSize = controlData->xlog_seg_size; + + FUNCTION_DEBUG_RESULT(PG_CONTROL, result); +} + +/*********************************************************************************************************************************** +Create pg_control for testing +***********************************************************************************************************************************/ +#ifdef DEBUG + +void +pgInterfaceControlTest091(PgControl pgControl, Buffer *buffer) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(PG_CONTROL, pgControl); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(buffer); + + controlData->system_identifier = pgControl.systemId; + controlData->pg_control_version = pgControl.controlVersion == 0 ? PG_CONTROL_VERSION : pgControl.controlVersion; + controlData->catalog_version_no = pgControl.catalogVersion == 0 ? CATALOG_VERSION_NO : pgControl.catalogVersion; + + controlData->blcksz = pgControl.pageSize; + controlData->xlog_seg_size = pgControl.walSegmentSize; + + FUNCTION_TEST_RESULT_VOID(); +} + +#endif diff --git a/src/postgres/interface/v091.h b/src/postgres/interface/v091.h new file mode 100644 index 000000000..62d111e7f --- /dev/null +++ b/src/postgres/interface/v091.h @@ -0,0 +1,22 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.1 Interface +***********************************************************************************************************************************/ +#ifndef POSTGRES_INTERFACE_INTERFACE091_H +#define POSTGRES_INTERFACE_INTERFACE091_H + +#include "postgres/interface.h" + +/*********************************************************************************************************************************** +Functions +***********************************************************************************************************************************/ +bool pgInterfaceIs091(const Buffer *controlFile); +PgControl pgInterfaceControl091(const Buffer *controlFile); + +/*********************************************************************************************************************************** +Test Functions +***********************************************************************************************************************************/ +#ifdef DEBUG + void pgInterfaceControlTest091(PgControl pgControl, Buffer *buffer); +#endif + +#endif diff --git a/src/postgres/interface/v092.auto.c b/src/postgres/interface/v092.auto.c new file mode 100644 index 000000000..913fb38c4 --- /dev/null +++ b/src/postgres/interface/v092.auto.c @@ -0,0 +1,267 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.2 Types +***********************************************************************************************************************************/ + +/*********************************************************************************************************************************** +Types from src/include/c.h +***********************************************************************************************************************************/ +typedef int64_t int64; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef uint32 TransactionId; + +/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ +typedef TransactionId MultiXactId; + +typedef uint32 MultiXactOffset; + +/*********************************************************************************************************************************** +Types from src/include/pgtime.h +***********************************************************************************************************************************/ +/* + * The API of this library is generally similar to the corresponding + * C library functions, except that we use pg_time_t which (we hope) is + * 64 bits wide, and which is most definitely signed not unsigned. + */ +typedef int64 pg_time_t; + +/*********************************************************************************************************************************** +Types from src/include/postgres_ext.h +***********************************************************************************************************************************/ +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +/*********************************************************************************************************************************** +Types from src/include/utils/pg_crc32.h +***********************************************************************************************************************************/ +typedef uint32 pg_crc32; + +/*********************************************************************************************************************************** +Types from src/include/access/xlogdefs.h +***********************************************************************************************************************************/ +/* + * Pointer to a location in the XLOG. These pointers are 64 bits wide, + * because we don't want them ever to overflow. + * + * NOTE: xrecoff == 0 is used to indicate an invalid pointer. This is OK + * because we use page headers in the XLOG, so no XLOG record can start + * right at the beginning of a file. + * + * NOTE: the "log file number" is somewhat misnamed, since the actual files + * making up the XLOG are much smaller than 4Gb. Each actual file is an + * XLogSegSize-byte "segment" of a logical log file having the indicated + * xlogid. The log file number and segment number together identify a + * physical XLOG file. Segment number and offset within the physical file + * are computed from xrecoff div and mod XLogSegSize. + */ +typedef struct XLogRecPtr +{ + uint32 xlogid; /* log file #, 0 based */ + uint32 xrecoff; /* byte offset of location in log file */ +} XLogRecPtr; + +/* + * TimeLineID (TLI) - identifies different database histories to prevent + * confusion after restoring a prior state of a database installation. + * TLI does not change in a normal stop/restart of the database (including + * crash-and-recover cases); but we must assign a new TLI after doing + * a recovery to a prior state, a/k/a point-in-time recovery. This makes + * the new WAL logfile sequence we generate distinguishable from the + * sequence that was generated in the previous incarnation. + */ +typedef uint32 TimeLineID; + +/*********************************************************************************************************************************** +Types from src/include/catalog/catversion.h +***********************************************************************************************************************************/ +/* + * We could use anything we wanted for version numbers, but I recommend + * following the "YYYYMMDDN" style often used for DNS zone serial numbers. + * YYYYMMDD are the date of the change, and N is the number of the change + * on that day. (Hopefully we'll never commit ten independent sets of + * catalog changes on the same day...) + */ + +/* yyyymmddN */ +#define CATALOG_VERSION_NO 201204301 + +/*********************************************************************************************************************************** +Types from src/include/catalog/pg_control.h +***********************************************************************************************************************************/ +/* Version identifier for this pg_control format */ +#define PG_CONTROL_VERSION 922 + +/* + * Body of CheckPoint XLOG records. This is declared here because we keep + * a copy of the latest one in pg_control for possible disaster recovery. + * Changing this struct requires a PG_CONTROL_VERSION bump. + */ +typedef struct CheckPoint +{ + XLogRecPtr redo; /* next RecPtr available when we began to + * create CheckPoint (i.e. REDO start point) */ + TimeLineID ThisTimeLineID; /* current TLI */ + bool fullPageWrites; /* current full_page_writes */ + uint32 nextXidEpoch; /* higher-order bits of nextXid */ + TransactionId nextXid; /* next free XID */ + Oid nextOid; /* next free OID */ + MultiXactId nextMulti; /* next free MultiXactId */ + MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ + TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ + Oid oldestXidDB; /* database with minimum datfrozenxid */ + pg_time_t time; /* time stamp of checkpoint */ + + /* + * Oldest XID still running. This is only needed to initialize hot standby + * mode from an online checkpoint, so we only bother calculating this for + * online checkpoints and only when wal_level is hot_standby. Otherwise + * it's set to InvalidTransactionId. + */ + TransactionId oldestActiveXid; +} CheckPoint; + +/* + * System status indicator. Note this is stored in pg_control; if you change + * it, you must bump PG_CONTROL_VERSION + */ +typedef enum DBState +{ + DB_STARTUP = 0, + DB_SHUTDOWNED, + DB_SHUTDOWNED_IN_RECOVERY, + DB_SHUTDOWNING, + DB_IN_CRASH_RECOVERY, + DB_IN_ARCHIVE_RECOVERY, + DB_IN_PRODUCTION +} DBState; + +/* + * Contents of pg_control. + * + * NOTE: try to keep this under 512 bytes so that it will fit on one physical + * sector of typical disk drives. This reduces the odds of corruption due to + * power failure midway through a write. + */ +typedef struct ControlFileData +{ + /* + * Unique system identifier --- to ensure we match up xlog files with the + * installation that produced them. + */ + uint64 system_identifier; + + /* + * Version identifier information. Keep these fields at the same offset, + * especially pg_control_version; they won't be real useful if they move + * around. (For historical reasons they must be 8 bytes into the file + * rather than immediately at the front.) + * + * pg_control_version identifies the format of pg_control itself. + * catalog_version_no identifies the format of the system catalogs. + * + * There are additional version identifiers in individual files; for + * example, WAL logs contain per-page magic numbers that can serve as + * version cues for the WAL log. + */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ + + /* + * System status data + */ + DBState state; /* see enum above */ + pg_time_t time; /* time stamp of last pg_control update */ + XLogRecPtr checkPoint; /* last check point record ptr */ + XLogRecPtr prevCheckPoint; /* previous check point record ptr */ + + CheckPoint checkPointCopy; /* copy of last check point record */ + + /* + * These two values determine the minimum point we must recover up to + * before starting up: + * + * minRecoveryPoint is updated to the latest replayed LSN whenever we + * flush a data change during archive recovery. That guards against + * starting archive recovery, aborting it, and restarting with an earlier + * stop location. If we've already flushed data changes from WAL record X + * to disk, we mustn't start up until we reach X again. Zero when not + * doing archive recovery. + * + * backupStartPoint is the redo pointer of the backup start checkpoint, if + * we are recovering from an online backup and haven't reached the end of + * backup yet. It is reset to zero when the end of backup is reached, and + * we mustn't start up before that. A boolean would suffice otherwise, but + * we use the redo pointer as a cross-check when we see an end-of-backup + * record, to make sure the end-of-backup record corresponds the base + * backup we're recovering from. + * + * backupEndPoint is the backup end location, if we are recovering from an + * online backup which was taken from the standby and haven't reached the + * end of backup yet. It is initialized to the minimum recovery point in + * pg_control which was backed up last. It is reset to zero when the end + * of backup is reached, and we mustn't start up before that. + * + * If backupEndRequired is true, we know for sure that we're restoring + * from a backup, and must see a backup-end record before we can safely + * start up. If it's false, but backupStartPoint is set, a backup_label + * file was found at startup but it may have been a leftover from a stray + * pg_start_backup() call, not accompanied by pg_stop_backup(). + */ + XLogRecPtr minRecoveryPoint; + XLogRecPtr backupStartPoint; + XLogRecPtr backupEndPoint; + bool backupEndRequired; + + /* + * Parameter settings that determine if the WAL can be used for archival + * or hot standby. + */ + int wal_level; + int MaxConnections; + int max_prepared_xacts; + int max_locks_per_xact; + + /* + * This data is used to check for hardware-architecture compatibility of + * the database and the backend executable. We need not check endianness + * explicitly, since the pg_control version will surely look wrong to a + * machine of different endianness, but we do need to worry about MAXALIGN + * and floating-point format. (Note: storage layout nominally also + * depends on SHORTALIGN and INTALIGN, but in practice these are the same + * on all architectures of interest.) + * + * Testing just one double value is not a very bulletproof test for + * floating-point compatibility, but it will catch most cases. + */ + uint32 maxAlign; /* alignment requirement for tuples */ + double floatFormat; /* constant 1234567.0 */ +#define FLOATFORMAT_VALUE 1234567.0 + + /* + * This data is used to make sure that configuration of this database is + * compatible with the backend executable. + */ + uint32 blcksz; /* data block size for this DB */ + uint32 relseg_size; /* blocks per segment of large relation */ + + uint32 xlog_blcksz; /* block size within WAL files */ + uint32 xlog_seg_size; /* size of each WAL segment */ + + uint32 nameDataLen; /* catalog name field width */ + uint32 indexMaxKeys; /* max number of columns in an index */ + + uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + + /* flag indicating internal format of timestamp, interval, time */ + bool enableIntTimes; /* int64 storage enabled? */ + + /* flags indicating pass-by-value status of various types */ + bool float4ByVal; /* float4 pass-by-value? */ + bool float8ByVal; /* float8, int8, etc pass-by-value? */ + + /* CRC of all above ... MUST BE LAST! */ + pg_crc32 crc; +} ControlFileData; diff --git a/src/postgres/interface/v092.c b/src/postgres/interface/v092.c new file mode 100644 index 000000000..71ec7f05d --- /dev/null +++ b/src/postgres/interface/v092.c @@ -0,0 +1,81 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.2 Interface +***********************************************************************************************************************************/ +#include "common/debug.h" +#include "common/log.h" +#include "postgres/interface/v092.h" + +/*********************************************************************************************************************************** +Include PostgreSQL Types +***********************************************************************************************************************************/ +#include "postgres/interface/v092.auto.c" + +/*********************************************************************************************************************************** +Is the control file for this version of PostgreSQL? +***********************************************************************************************************************************/ +bool +pgInterfaceIs092(const Buffer *controlFile) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + FUNCTION_TEST_RESULT( + BOOL, controlData->pg_control_version == PG_CONTROL_VERSION && controlData->catalog_version_no == CATALOG_VERSION_NO); +} + +/*********************************************************************************************************************************** +Get information from pg_control in a common format +***********************************************************************************************************************************/ +PgControl +pgInterfaceControl092(const Buffer *controlFile) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_ASSERT(pgInterfaceIs092(controlFile)); + FUNCTION_DEBUG_END(); + + PgControl result = {0}; + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + result.systemId = controlData->system_identifier; + result.controlVersion = controlData->pg_control_version; + result.catalogVersion = controlData->catalog_version_no; + + result.pageSize = controlData->blcksz; + result.walSegmentSize = controlData->xlog_seg_size; + + FUNCTION_DEBUG_RESULT(PG_CONTROL, result); +} + +/*********************************************************************************************************************************** +Create pg_control for testing +***********************************************************************************************************************************/ +#ifdef DEBUG + +void +pgInterfaceControlTest092(PgControl pgControl, Buffer *buffer) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(PG_CONTROL, pgControl); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(buffer); + + controlData->system_identifier = pgControl.systemId; + controlData->pg_control_version = pgControl.controlVersion == 0 ? PG_CONTROL_VERSION : pgControl.controlVersion; + controlData->catalog_version_no = pgControl.catalogVersion == 0 ? CATALOG_VERSION_NO : pgControl.catalogVersion; + + controlData->blcksz = pgControl.pageSize; + controlData->xlog_seg_size = pgControl.walSegmentSize; + + FUNCTION_TEST_RESULT_VOID(); +} + +#endif diff --git a/src/postgres/interface/v092.h b/src/postgres/interface/v092.h new file mode 100644 index 000000000..411c6a2f6 --- /dev/null +++ b/src/postgres/interface/v092.h @@ -0,0 +1,22 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.2 Interface +***********************************************************************************************************************************/ +#ifndef POSTGRES_INTERFACE_INTERFACE092_H +#define POSTGRES_INTERFACE_INTERFACE092_H + +#include "postgres/interface.h" + +/*********************************************************************************************************************************** +Functions +***********************************************************************************************************************************/ +bool pgInterfaceIs092(const Buffer *controlFile); +PgControl pgInterfaceControl092(const Buffer *controlFile); + +/*********************************************************************************************************************************** +Test Functions +***********************************************************************************************************************************/ +#ifdef DEBUG + void pgInterfaceControlTest092(PgControl pgControl, Buffer *buffer); +#endif + +#endif diff --git a/src/postgres/interface/v093.auto.c b/src/postgres/interface/v093.auto.c new file mode 100644 index 000000000..924c9ff4f --- /dev/null +++ b/src/postgres/interface/v093.auto.c @@ -0,0 +1,262 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.3 Types +***********************************************************************************************************************************/ + +/*********************************************************************************************************************************** +Types from src/include/c.h +***********************************************************************************************************************************/ +typedef int64_t int64; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef uint32 TransactionId; + +/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ +typedef TransactionId MultiXactId; + +typedef uint32 MultiXactOffset; + +/*********************************************************************************************************************************** +Types from src/include/pgtime.h +***********************************************************************************************************************************/ +/* + * The API of this library is generally similar to the corresponding + * C library functions, except that we use pg_time_t which (we hope) is + * 64 bits wide, and which is most definitely signed not unsigned. + */ +typedef int64 pg_time_t; + +/*********************************************************************************************************************************** +Types from src/include/postgres_ext.h +***********************************************************************************************************************************/ +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +/*********************************************************************************************************************************** +Types from src/include/utils/pg_crc32.h +***********************************************************************************************************************************/ +typedef uint32 pg_crc32; + +/*********************************************************************************************************************************** +Types from src/include/access/xlogdefs.h +***********************************************************************************************************************************/ +/* + * Pointer to a location in the XLOG. These pointers are 64 bits wide, + * because we don't want them ever to overflow. + */ +typedef uint64 XLogRecPtr; + +/* + * TimeLineID (TLI) - identifies different database histories to prevent + * confusion after restoring a prior state of a database installation. + * TLI does not change in a normal stop/restart of the database (including + * crash-and-recover cases); but we must assign a new TLI after doing + * a recovery to a prior state, a/k/a point-in-time recovery. This makes + * the new WAL logfile sequence we generate distinguishable from the + * sequence that was generated in the previous incarnation. + */ +typedef uint32 TimeLineID; + +/*********************************************************************************************************************************** +Types from src/include/catalog/catversion.h +***********************************************************************************************************************************/ +/* + * We could use anything we wanted for version numbers, but I recommend + * following the "YYYYMMDDN" style often used for DNS zone serial numbers. + * YYYYMMDD are the date of the change, and N is the number of the change + * on that day. (Hopefully we'll never commit ten independent sets of + * catalog changes on the same day...) + */ + +/* yyyymmddN */ +#define CATALOG_VERSION_NO 201306121 + +/*********************************************************************************************************************************** +Types from src/include/catalog/pg_control.h +***********************************************************************************************************************************/ +/* Version identifier for this pg_control format */ +#define PG_CONTROL_VERSION 937 + +/* + * Body of CheckPoint XLOG records. This is declared here because we keep + * a copy of the latest one in pg_control for possible disaster recovery. + * Changing this struct requires a PG_CONTROL_VERSION bump. + */ +typedef struct CheckPoint +{ + XLogRecPtr redo; /* next RecPtr available when we began to + * create CheckPoint (i.e. REDO start point) */ + TimeLineID ThisTimeLineID; /* current TLI */ + TimeLineID PrevTimeLineID; /* previous TLI, if this record begins a new + * timeline (equals ThisTimeLineID otherwise) */ + bool fullPageWrites; /* current full_page_writes */ + uint32 nextXidEpoch; /* higher-order bits of nextXid */ + TransactionId nextXid; /* next free XID */ + Oid nextOid; /* next free OID */ + MultiXactId nextMulti; /* next free MultiXactId */ + MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ + TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ + Oid oldestXidDB; /* database with minimum datfrozenxid */ + MultiXactId oldestMulti; /* cluster-wide minimum datminmxid */ + Oid oldestMultiDB; /* database with minimum datminmxid */ + pg_time_t time; /* time stamp of checkpoint */ + + /* + * Oldest XID still running. This is only needed to initialize hot standby + * mode from an online checkpoint, so we only bother calculating this for + * online checkpoints and only when wal_level is hot_standby. Otherwise + * it's set to InvalidTransactionId. + */ + TransactionId oldestActiveXid; +} CheckPoint; + +/* + * System status indicator. Note this is stored in pg_control; if you change + * it, you must bump PG_CONTROL_VERSION + */ +typedef enum DBState +{ + DB_STARTUP = 0, + DB_SHUTDOWNED, + DB_SHUTDOWNED_IN_RECOVERY, + DB_SHUTDOWNING, + DB_IN_CRASH_RECOVERY, + DB_IN_ARCHIVE_RECOVERY, + DB_IN_PRODUCTION +} DBState; + +/* + * Contents of pg_control. + * + * NOTE: try to keep this under 512 bytes so that it will fit on one physical + * sector of typical disk drives. This reduces the odds of corruption due to + * power failure midway through a write. + */ +typedef struct ControlFileData +{ + /* + * Unique system identifier --- to ensure we match up xlog files with the + * installation that produced them. + */ + uint64 system_identifier; + + /* + * Version identifier information. Keep these fields at the same offset, + * especially pg_control_version; they won't be real useful if they move + * around. (For historical reasons they must be 8 bytes into the file + * rather than immediately at the front.) + * + * pg_control_version identifies the format of pg_control itself. + * catalog_version_no identifies the format of the system catalogs. + * + * There are additional version identifiers in individual files; for + * example, WAL logs contain per-page magic numbers that can serve as + * version cues for the WAL log. + */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ + + /* + * System status data + */ + DBState state; /* see enum above */ + pg_time_t time; /* time stamp of last pg_control update */ + XLogRecPtr checkPoint; /* last check point record ptr */ + XLogRecPtr prevCheckPoint; /* previous check point record ptr */ + + CheckPoint checkPointCopy; /* copy of last check point record */ + + XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */ + + /* + * These two values determine the minimum point we must recover up to + * before starting up: + * + * minRecoveryPoint is updated to the latest replayed LSN whenever we + * flush a data change during archive recovery. That guards against + * starting archive recovery, aborting it, and restarting with an earlier + * stop location. If we've already flushed data changes from WAL record X + * to disk, we mustn't start up until we reach X again. Zero when not + * doing archive recovery. + * + * backupStartPoint is the redo pointer of the backup start checkpoint, if + * we are recovering from an online backup and haven't reached the end of + * backup yet. It is reset to zero when the end of backup is reached, and + * we mustn't start up before that. A boolean would suffice otherwise, but + * we use the redo pointer as a cross-check when we see an end-of-backup + * record, to make sure the end-of-backup record corresponds the base + * backup we're recovering from. + * + * backupEndPoint is the backup end location, if we are recovering from an + * online backup which was taken from the standby and haven't reached the + * end of backup yet. It is initialized to the minimum recovery point in + * pg_control which was backed up last. It is reset to zero when the end + * of backup is reached, and we mustn't start up before that. + * + * If backupEndRequired is true, we know for sure that we're restoring + * from a backup, and must see a backup-end record before we can safely + * start up. If it's false, but backupStartPoint is set, a backup_label + * file was found at startup but it may have been a leftover from a stray + * pg_start_backup() call, not accompanied by pg_stop_backup(). + */ + XLogRecPtr minRecoveryPoint; + TimeLineID minRecoveryPointTLI; + XLogRecPtr backupStartPoint; + XLogRecPtr backupEndPoint; + bool backupEndRequired; + + /* + * Parameter settings that determine if the WAL can be used for archival + * or hot standby. + */ + int wal_level; + int MaxConnections; + int max_prepared_xacts; + int max_locks_per_xact; + + /* + * This data is used to check for hardware-architecture compatibility of + * the database and the backend executable. We need not check endianness + * explicitly, since the pg_control version will surely look wrong to a + * machine of different endianness, but we do need to worry about MAXALIGN + * and floating-point format. (Note: storage layout nominally also + * depends on SHORTALIGN and INTALIGN, but in practice these are the same + * on all architectures of interest.) + * + * Testing just one double value is not a very bulletproof test for + * floating-point compatibility, but it will catch most cases. + */ + uint32 maxAlign; /* alignment requirement for tuples */ + double floatFormat; /* constant 1234567.0 */ +#define FLOATFORMAT_VALUE 1234567.0 + + /* + * This data is used to make sure that configuration of this database is + * compatible with the backend executable. + */ + uint32 blcksz; /* data block size for this DB */ + uint32 relseg_size; /* blocks per segment of large relation */ + + uint32 xlog_blcksz; /* block size within WAL files */ + uint32 xlog_seg_size; /* size of each WAL segment */ + + uint32 nameDataLen; /* catalog name field width */ + uint32 indexMaxKeys; /* max number of columns in an index */ + + uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + + /* flag indicating internal format of timestamp, interval, time */ + bool enableIntTimes; /* int64 storage enabled? */ + + /* flags indicating pass-by-value status of various types */ + bool float4ByVal; /* float4 pass-by-value? */ + bool float8ByVal; /* float8, int8, etc pass-by-value? */ + + /* Are data pages protected by checksums? Zero if no checksum version */ + uint32 data_checksum_version; + + /* CRC of all above ... MUST BE LAST! */ + pg_crc32 crc; +} ControlFileData; diff --git a/src/postgres/interface/v093.c b/src/postgres/interface/v093.c new file mode 100644 index 000000000..b9be17a4f --- /dev/null +++ b/src/postgres/interface/v093.c @@ -0,0 +1,85 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.3 Interface +***********************************************************************************************************************************/ +#include "common/debug.h" +#include "common/log.h" +#include "postgres/interface/v093.h" + +/*********************************************************************************************************************************** +Include PostgreSQL Types +***********************************************************************************************************************************/ +#include "postgres/interface/v093.auto.c" + +/*********************************************************************************************************************************** +Is the control file for this version of PostgreSQL? +***********************************************************************************************************************************/ +bool +pgInterfaceIs093(const Buffer *controlFile) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + FUNCTION_TEST_RESULT( + BOOL, controlData->pg_control_version == PG_CONTROL_VERSION && controlData->catalog_version_no == CATALOG_VERSION_NO); +} + +/*********************************************************************************************************************************** +Get information from pg_control in a common format +***********************************************************************************************************************************/ +PgControl +pgInterfaceControl093(const Buffer *controlFile) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_ASSERT(pgInterfaceIs093(controlFile)); + FUNCTION_DEBUG_END(); + + PgControl result = {0}; + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + result.systemId = controlData->system_identifier; + result.controlVersion = controlData->pg_control_version; + result.catalogVersion = controlData->catalog_version_no; + + result.pageSize = controlData->blcksz; + result.walSegmentSize = controlData->xlog_seg_size; + + result.pageChecksum = controlData->data_checksum_version != 0; + + FUNCTION_DEBUG_RESULT(PG_CONTROL, result); +} + +/*********************************************************************************************************************************** +Create pg_control for testing +***********************************************************************************************************************************/ +#ifdef DEBUG + +void +pgInterfaceControlTest093(PgControl pgControl, Buffer *buffer) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(PG_CONTROL, pgControl); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(buffer); + + controlData->system_identifier = pgControl.systemId; + controlData->pg_control_version = pgControl.controlVersion == 0 ? PG_CONTROL_VERSION : pgControl.controlVersion; + controlData->catalog_version_no = pgControl.catalogVersion == 0 ? CATALOG_VERSION_NO : pgControl.catalogVersion; + + controlData->blcksz = pgControl.pageSize; + controlData->xlog_seg_size = pgControl.walSegmentSize; + + controlData->data_checksum_version = pgControl.pageChecksum; + + FUNCTION_TEST_RESULT_VOID(); +} + +#endif diff --git a/src/postgres/interface/v093.h b/src/postgres/interface/v093.h new file mode 100644 index 000000000..7f80911ee --- /dev/null +++ b/src/postgres/interface/v093.h @@ -0,0 +1,22 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.3 Interface +***********************************************************************************************************************************/ +#ifndef POSTGRES_INTERFACE_INTERFACE093_H +#define POSTGRES_INTERFACE_INTERFACE093_H + +#include "postgres/interface.h" + +/*********************************************************************************************************************************** +Functions +***********************************************************************************************************************************/ +bool pgInterfaceIs093(const Buffer *controlFile); +PgControl pgInterfaceControl093(const Buffer *controlFile); + +/*********************************************************************************************************************************** +Test Functions +***********************************************************************************************************************************/ +#ifdef DEBUG + void pgInterfaceControlTest093(PgControl pgControl, Buffer *buffer); +#endif + +#endif diff --git a/src/postgres/interface/v094.auto.c b/src/postgres/interface/v094.auto.c new file mode 100644 index 000000000..a50905df1 --- /dev/null +++ b/src/postgres/interface/v094.auto.c @@ -0,0 +1,265 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.4 Types +***********************************************************************************************************************************/ + +/*********************************************************************************************************************************** +Types from src/include/c.h +***********************************************************************************************************************************/ +typedef int64_t int64; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef uint32 TransactionId; + +/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ +typedef TransactionId MultiXactId; + +typedef uint32 MultiXactOffset; + +/*********************************************************************************************************************************** +Types from src/include/pgtime.h +***********************************************************************************************************************************/ +/* + * The API of this library is generally similar to the corresponding + * C library functions, except that we use pg_time_t which (we hope) is + * 64 bits wide, and which is most definitely signed not unsigned. + */ +typedef int64 pg_time_t; + +/*********************************************************************************************************************************** +Types from src/include/postgres_ext.h +***********************************************************************************************************************************/ +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +/*********************************************************************************************************************************** +Types from src/include/utils/pg_crc32.h +***********************************************************************************************************************************/ +typedef uint32 pg_crc32; + +/*********************************************************************************************************************************** +Types from src/include/access/xlogdefs.h +***********************************************************************************************************************************/ +/* + * Pointer to a location in the XLOG. These pointers are 64 bits wide, + * because we don't want them ever to overflow. + */ +typedef uint64 XLogRecPtr; + +/* + * TimeLineID (TLI) - identifies different database histories to prevent + * confusion after restoring a prior state of a database installation. + * TLI does not change in a normal stop/restart of the database (including + * crash-and-recover cases); but we must assign a new TLI after doing + * a recovery to a prior state, a/k/a point-in-time recovery. This makes + * the new WAL logfile sequence we generate distinguishable from the + * sequence that was generated in the previous incarnation. + */ +typedef uint32 TimeLineID; + +/*********************************************************************************************************************************** +Types from src/include/catalog/catversion.h +***********************************************************************************************************************************/ +/* + * We could use anything we wanted for version numbers, but I recommend + * following the "YYYYMMDDN" style often used for DNS zone serial numbers. + * YYYYMMDD are the date of the change, and N is the number of the change + * on that day. (Hopefully we'll never commit ten independent sets of + * catalog changes on the same day...) + */ + +/* yyyymmddN */ +#define CATALOG_VERSION_NO 201409291 + +/*********************************************************************************************************************************** +Types from src/include/catalog/pg_control.h +***********************************************************************************************************************************/ +/* Version identifier for this pg_control format */ +#define PG_CONTROL_VERSION 942 + +/* + * Body of CheckPoint XLOG records. This is declared here because we keep + * a copy of the latest one in pg_control for possible disaster recovery. + * Changing this struct requires a PG_CONTROL_VERSION bump. + */ +typedef struct CheckPoint +{ + XLogRecPtr redo; /* next RecPtr available when we began to + * create CheckPoint (i.e. REDO start point) */ + TimeLineID ThisTimeLineID; /* current TLI */ + TimeLineID PrevTimeLineID; /* previous TLI, if this record begins a new + * timeline (equals ThisTimeLineID otherwise) */ + bool fullPageWrites; /* current full_page_writes */ + uint32 nextXidEpoch; /* higher-order bits of nextXid */ + TransactionId nextXid; /* next free XID */ + Oid nextOid; /* next free OID */ + MultiXactId nextMulti; /* next free MultiXactId */ + MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ + TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ + Oid oldestXidDB; /* database with minimum datfrozenxid */ + MultiXactId oldestMulti; /* cluster-wide minimum datminmxid */ + Oid oldestMultiDB; /* database with minimum datminmxid */ + pg_time_t time; /* time stamp of checkpoint */ + + /* + * Oldest XID still running. This is only needed to initialize hot standby + * mode from an online checkpoint, so we only bother calculating this for + * online checkpoints and only when wal_level is hot_standby. Otherwise + * it's set to InvalidTransactionId. + */ + TransactionId oldestActiveXid; +} CheckPoint; + +/* + * System status indicator. Note this is stored in pg_control; if you change + * it, you must bump PG_CONTROL_VERSION + */ +typedef enum DBState +{ + DB_STARTUP = 0, + DB_SHUTDOWNED, + DB_SHUTDOWNED_IN_RECOVERY, + DB_SHUTDOWNING, + DB_IN_CRASH_RECOVERY, + DB_IN_ARCHIVE_RECOVERY, + DB_IN_PRODUCTION +} DBState; + +/* + * Contents of pg_control. + * + * NOTE: try to keep this under 512 bytes so that it will fit on one physical + * sector of typical disk drives. This reduces the odds of corruption due to + * power failure midway through a write. + */ +typedef struct ControlFileData +{ + /* + * Unique system identifier --- to ensure we match up xlog files with the + * installation that produced them. + */ + uint64 system_identifier; + + /* + * Version identifier information. Keep these fields at the same offset, + * especially pg_control_version; they won't be real useful if they move + * around. (For historical reasons they must be 8 bytes into the file + * rather than immediately at the front.) + * + * pg_control_version identifies the format of pg_control itself. + * catalog_version_no identifies the format of the system catalogs. + * + * There are additional version identifiers in individual files; for + * example, WAL logs contain per-page magic numbers that can serve as + * version cues for the WAL log. + */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ + + /* + * System status data + */ + DBState state; /* see enum above */ + pg_time_t time; /* time stamp of last pg_control update */ + XLogRecPtr checkPoint; /* last check point record ptr */ + XLogRecPtr prevCheckPoint; /* previous check point record ptr */ + + CheckPoint checkPointCopy; /* copy of last check point record */ + + XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */ + + /* + * These two values determine the minimum point we must recover up to + * before starting up: + * + * minRecoveryPoint is updated to the latest replayed LSN whenever we + * flush a data change during archive recovery. That guards against + * starting archive recovery, aborting it, and restarting with an earlier + * stop location. If we've already flushed data changes from WAL record X + * to disk, we mustn't start up until we reach X again. Zero when not + * doing archive recovery. + * + * backupStartPoint is the redo pointer of the backup start checkpoint, if + * we are recovering from an online backup and haven't reached the end of + * backup yet. It is reset to zero when the end of backup is reached, and + * we mustn't start up before that. A boolean would suffice otherwise, but + * we use the redo pointer as a cross-check when we see an end-of-backup + * record, to make sure the end-of-backup record corresponds the base + * backup we're recovering from. + * + * backupEndPoint is the backup end location, if we are recovering from an + * online backup which was taken from the standby and haven't reached the + * end of backup yet. It is initialized to the minimum recovery point in + * pg_control which was backed up last. It is reset to zero when the end + * of backup is reached, and we mustn't start up before that. + * + * If backupEndRequired is true, we know for sure that we're restoring + * from a backup, and must see a backup-end record before we can safely + * start up. If it's false, but backupStartPoint is set, a backup_label + * file was found at startup but it may have been a leftover from a stray + * pg_start_backup() call, not accompanied by pg_stop_backup(). + */ + XLogRecPtr minRecoveryPoint; + TimeLineID minRecoveryPointTLI; + XLogRecPtr backupStartPoint; + XLogRecPtr backupEndPoint; + bool backupEndRequired; + + /* + * Parameter settings that determine if the WAL can be used for archival + * or hot standby. + */ + int wal_level; + bool wal_log_hints; + int MaxConnections; + int max_worker_processes; + int max_prepared_xacts; + int max_locks_per_xact; + + /* + * This data is used to check for hardware-architecture compatibility of + * the database and the backend executable. We need not check endianness + * explicitly, since the pg_control version will surely look wrong to a + * machine of different endianness, but we do need to worry about MAXALIGN + * and floating-point format. (Note: storage layout nominally also + * depends on SHORTALIGN and INTALIGN, but in practice these are the same + * on all architectures of interest.) + * + * Testing just one double value is not a very bulletproof test for + * floating-point compatibility, but it will catch most cases. + */ + uint32 maxAlign; /* alignment requirement for tuples */ + double floatFormat; /* constant 1234567.0 */ +#define FLOATFORMAT_VALUE 1234567.0 + + /* + * This data is used to make sure that configuration of this database is + * compatible with the backend executable. + */ + uint32 blcksz; /* data block size for this DB */ + uint32 relseg_size; /* blocks per segment of large relation */ + + uint32 xlog_blcksz; /* block size within WAL files */ + uint32 xlog_seg_size; /* size of each WAL segment */ + + uint32 nameDataLen; /* catalog name field width */ + uint32 indexMaxKeys; /* max number of columns in an index */ + + uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + uint32 loblksize; /* chunk size in pg_largeobject */ + + /* flag indicating internal format of timestamp, interval, time */ + bool enableIntTimes; /* int64 storage enabled? */ + + /* flags indicating pass-by-value status of various types */ + bool float4ByVal; /* float4 pass-by-value? */ + bool float8ByVal; /* float8, int8, etc pass-by-value? */ + + /* Are data pages protected by checksums? Zero if no checksum version */ + uint32 data_checksum_version; + + /* CRC of all above ... MUST BE LAST! */ + pg_crc32 crc; +} ControlFileData; diff --git a/src/postgres/interface/v094.c b/src/postgres/interface/v094.c new file mode 100644 index 000000000..63bcff512 --- /dev/null +++ b/src/postgres/interface/v094.c @@ -0,0 +1,85 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.4 Interface +***********************************************************************************************************************************/ +#include "common/debug.h" +#include "common/log.h" +#include "postgres/interface/v094.h" + +/*********************************************************************************************************************************** +Include PostgreSQL Types +***********************************************************************************************************************************/ +#include "postgres/interface/v094.auto.c" + +/*********************************************************************************************************************************** +Is the control file for this version of PostgreSQL? +***********************************************************************************************************************************/ +bool +pgInterfaceIs094(const Buffer *controlFile) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + FUNCTION_TEST_RESULT( + BOOL, controlData->pg_control_version == PG_CONTROL_VERSION && controlData->catalog_version_no == CATALOG_VERSION_NO); +} + +/*********************************************************************************************************************************** +Get information from pg_control in a common format +***********************************************************************************************************************************/ +PgControl +pgInterfaceControl094(const Buffer *controlFile) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_ASSERT(pgInterfaceIs094(controlFile)); + FUNCTION_DEBUG_END(); + + PgControl result = {0}; + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + result.systemId = controlData->system_identifier; + result.controlVersion = controlData->pg_control_version; + result.catalogVersion = controlData->catalog_version_no; + + result.pageSize = controlData->blcksz; + result.walSegmentSize = controlData->xlog_seg_size; + + result.pageChecksum = controlData->data_checksum_version != 0; + + FUNCTION_DEBUG_RESULT(PG_CONTROL, result); +} + +/*********************************************************************************************************************************** +Create pg_control for testing +***********************************************************************************************************************************/ +#ifdef DEBUG + +void +pgInterfaceControlTest094(PgControl pgControl, Buffer *buffer) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(PG_CONTROL, pgControl); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(buffer); + + controlData->system_identifier = pgControl.systemId; + controlData->pg_control_version = pgControl.controlVersion == 0 ? PG_CONTROL_VERSION : pgControl.controlVersion; + controlData->catalog_version_no = pgControl.catalogVersion == 0 ? CATALOG_VERSION_NO : pgControl.catalogVersion; + + controlData->blcksz = pgControl.pageSize; + controlData->xlog_seg_size = pgControl.walSegmentSize; + + controlData->data_checksum_version = pgControl.pageChecksum; + + FUNCTION_TEST_RESULT_VOID(); +} + +#endif diff --git a/src/postgres/interface/v094.h b/src/postgres/interface/v094.h new file mode 100644 index 000000000..90c575ce5 --- /dev/null +++ b/src/postgres/interface/v094.h @@ -0,0 +1,22 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.4 Interface +***********************************************************************************************************************************/ +#ifndef POSTGRES_INTERFACE_INTERFACE094_H +#define POSTGRES_INTERFACE_INTERFACE094_H + +#include "postgres/interface.h" + +/*********************************************************************************************************************************** +Functions +***********************************************************************************************************************************/ +bool pgInterfaceIs094(const Buffer *controlFile); +PgControl pgInterfaceControl094(const Buffer *controlFile); + +/*********************************************************************************************************************************** +Test Functions +***********************************************************************************************************************************/ +#ifdef DEBUG + void pgInterfaceControlTest094(PgControl pgControl, Buffer *buffer); +#endif + +#endif diff --git a/src/postgres/interface/v095.auto.c b/src/postgres/interface/v095.auto.c new file mode 100644 index 000000000..0ca268ce6 --- /dev/null +++ b/src/postgres/interface/v095.auto.c @@ -0,0 +1,270 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.5 Types +***********************************************************************************************************************************/ + +/*********************************************************************************************************************************** +Types from src/include/c.h +***********************************************************************************************************************************/ +typedef int64_t int64; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef uint32 TransactionId; + +/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ +typedef TransactionId MultiXactId; + +typedef uint32 MultiXactOffset; + +/*********************************************************************************************************************************** +Types from src/include/pgtime.h +***********************************************************************************************************************************/ +/* + * The API of this library is generally similar to the corresponding + * C library functions, except that we use pg_time_t which (we hope) is + * 64 bits wide, and which is most definitely signed not unsigned. + */ +typedef int64 pg_time_t; + +/*********************************************************************************************************************************** +Types from src/include/postgres_ext.h +***********************************************************************************************************************************/ +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +/*********************************************************************************************************************************** +Types from src/include/port/pg_crc32c.h +***********************************************************************************************************************************/ +typedef uint32 pg_crc32c; + +/*********************************************************************************************************************************** +Types from src/include/access/xlogdefs.h +***********************************************************************************************************************************/ +/* + * Pointer to a location in the XLOG. These pointers are 64 bits wide, + * because we don't want them ever to overflow. + */ +typedef uint64 XLogRecPtr; + +/* + * TimeLineID (TLI) - identifies different database histories to prevent + * confusion after restoring a prior state of a database installation. + * TLI does not change in a normal stop/restart of the database (including + * crash-and-recover cases); but we must assign a new TLI after doing + * a recovery to a prior state, a/k/a point-in-time recovery. This makes + * the new WAL logfile sequence we generate distinguishable from the + * sequence that was generated in the previous incarnation. + */ +typedef uint32 TimeLineID; + +/*********************************************************************************************************************************** +Types from src/include/catalog/catversion.h +***********************************************************************************************************************************/ +/* + * We could use anything we wanted for version numbers, but I recommend + * following the "YYYYMMDDN" style often used for DNS zone serial numbers. + * YYYYMMDD are the date of the change, and N is the number of the change + * on that day. (Hopefully we'll never commit ten independent sets of + * catalog changes on the same day...) + */ + +/* yyyymmddN */ +#define CATALOG_VERSION_NO 201510051 + +/*********************************************************************************************************************************** +Types from src/include/catalog/pg_control.h +***********************************************************************************************************************************/ +/* Version identifier for this pg_control format */ +#define PG_CONTROL_VERSION 942 + +/* + * Body of CheckPoint XLOG records. This is declared here because we keep + * a copy of the latest one in pg_control for possible disaster recovery. + * Changing this struct requires a PG_CONTROL_VERSION bump. + */ +typedef struct CheckPoint +{ + XLogRecPtr redo; /* next RecPtr available when we began to + * create CheckPoint (i.e. REDO start point) */ + TimeLineID ThisTimeLineID; /* current TLI */ + TimeLineID PrevTimeLineID; /* previous TLI, if this record begins a new + * timeline (equals ThisTimeLineID otherwise) */ + bool fullPageWrites; /* current full_page_writes */ + uint32 nextXidEpoch; /* higher-order bits of nextXid */ + TransactionId nextXid; /* next free XID */ + Oid nextOid; /* next free OID */ + MultiXactId nextMulti; /* next free MultiXactId */ + MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ + TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ + Oid oldestXidDB; /* database with minimum datfrozenxid */ + MultiXactId oldestMulti; /* cluster-wide minimum datminmxid */ + Oid oldestMultiDB; /* database with minimum datminmxid */ + pg_time_t time; /* time stamp of checkpoint */ + TransactionId oldestCommitTsXid; /* oldest Xid with valid commit + * timestamp */ + TransactionId newestCommitTsXid; /* newest Xid with valid commit + * timestamp */ + + /* + * Oldest XID still running. This is only needed to initialize hot standby + * mode from an online checkpoint, so we only bother calculating this for + * online checkpoints and only when wal_level is hot_standby. Otherwise + * it's set to InvalidTransactionId. + */ + TransactionId oldestActiveXid; +} CheckPoint; + +/* + * System status indicator. Note this is stored in pg_control; if you change + * it, you must bump PG_CONTROL_VERSION + */ +typedef enum DBState +{ + DB_STARTUP = 0, + DB_SHUTDOWNED, + DB_SHUTDOWNED_IN_RECOVERY, + DB_SHUTDOWNING, + DB_IN_CRASH_RECOVERY, + DB_IN_ARCHIVE_RECOVERY, + DB_IN_PRODUCTION +} DBState; + +/* + * Contents of pg_control. + * + * NOTE: try to keep this under 512 bytes so that it will fit on one physical + * sector of typical disk drives. This reduces the odds of corruption due to + * power failure midway through a write. + */ +typedef struct ControlFileData +{ + /* + * Unique system identifier --- to ensure we match up xlog files with the + * installation that produced them. + */ + uint64 system_identifier; + + /* + * Version identifier information. Keep these fields at the same offset, + * especially pg_control_version; they won't be real useful if they move + * around. (For historical reasons they must be 8 bytes into the file + * rather than immediately at the front.) + * + * pg_control_version identifies the format of pg_control itself. + * catalog_version_no identifies the format of the system catalogs. + * + * There are additional version identifiers in individual files; for + * example, WAL logs contain per-page magic numbers that can serve as + * version cues for the WAL log. + */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ + + /* + * System status data + */ + DBState state; /* see enum above */ + pg_time_t time; /* time stamp of last pg_control update */ + XLogRecPtr checkPoint; /* last check point record ptr */ + XLogRecPtr prevCheckPoint; /* previous check point record ptr */ + + CheckPoint checkPointCopy; /* copy of last check point record */ + + XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */ + + /* + * These two values determine the minimum point we must recover up to + * before starting up: + * + * minRecoveryPoint is updated to the latest replayed LSN whenever we + * flush a data change during archive recovery. That guards against + * starting archive recovery, aborting it, and restarting with an earlier + * stop location. If we've already flushed data changes from WAL record X + * to disk, we mustn't start up until we reach X again. Zero when not + * doing archive recovery. + * + * backupStartPoint is the redo pointer of the backup start checkpoint, if + * we are recovering from an online backup and haven't reached the end of + * backup yet. It is reset to zero when the end of backup is reached, and + * we mustn't start up before that. A boolean would suffice otherwise, but + * we use the redo pointer as a cross-check when we see an end-of-backup + * record, to make sure the end-of-backup record corresponds the base + * backup we're recovering from. + * + * backupEndPoint is the backup end location, if we are recovering from an + * online backup which was taken from the standby and haven't reached the + * end of backup yet. It is initialized to the minimum recovery point in + * pg_control which was backed up last. It is reset to zero when the end + * of backup is reached, and we mustn't start up before that. + * + * If backupEndRequired is true, we know for sure that we're restoring + * from a backup, and must see a backup-end record before we can safely + * start up. If it's false, but backupStartPoint is set, a backup_label + * file was found at startup but it may have been a leftover from a stray + * pg_start_backup() call, not accompanied by pg_stop_backup(). + */ + XLogRecPtr minRecoveryPoint; + TimeLineID minRecoveryPointTLI; + XLogRecPtr backupStartPoint; + XLogRecPtr backupEndPoint; + bool backupEndRequired; + + /* + * Parameter settings that determine if the WAL can be used for archival + * or hot standby. + */ + int wal_level; + bool wal_log_hints; + int MaxConnections; + int max_worker_processes; + int max_prepared_xacts; + int max_locks_per_xact; + bool track_commit_timestamp; + + /* + * This data is used to check for hardware-architecture compatibility of + * the database and the backend executable. We need not check endianness + * explicitly, since the pg_control version will surely look wrong to a + * machine of different endianness, but we do need to worry about MAXALIGN + * and floating-point format. (Note: storage layout nominally also + * depends on SHORTALIGN and INTALIGN, but in practice these are the same + * on all architectures of interest.) + * + * Testing just one double value is not a very bulletproof test for + * floating-point compatibility, but it will catch most cases. + */ + uint32 maxAlign; /* alignment requirement for tuples */ + double floatFormat; /* constant 1234567.0 */ +#define FLOATFORMAT_VALUE 1234567.0 + + /* + * This data is used to make sure that configuration of this database is + * compatible with the backend executable. + */ + uint32 blcksz; /* data block size for this DB */ + uint32 relseg_size; /* blocks per segment of large relation */ + + uint32 xlog_blcksz; /* block size within WAL files */ + uint32 xlog_seg_size; /* size of each WAL segment */ + + uint32 nameDataLen; /* catalog name field width */ + uint32 indexMaxKeys; /* max number of columns in an index */ + + uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + uint32 loblksize; /* chunk size in pg_largeobject */ + + /* flag indicating internal format of timestamp, interval, time */ + bool enableIntTimes; /* int64 storage enabled? */ + + /* flags indicating pass-by-value status of various types */ + bool float4ByVal; /* float4 pass-by-value? */ + bool float8ByVal; /* float8, int8, etc pass-by-value? */ + + /* Are data pages protected by checksums? Zero if no checksum version */ + uint32 data_checksum_version; + + /* CRC of all above ... MUST BE LAST! */ + pg_crc32c crc; +} ControlFileData; diff --git a/src/postgres/interface/v095.c b/src/postgres/interface/v095.c new file mode 100644 index 000000000..676751d64 --- /dev/null +++ b/src/postgres/interface/v095.c @@ -0,0 +1,85 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.5 Interface +***********************************************************************************************************************************/ +#include "common/debug.h" +#include "common/log.h" +#include "postgres/interface/v095.h" + +/*********************************************************************************************************************************** +Include PostgreSQL Types +***********************************************************************************************************************************/ +#include "postgres/interface/v095.auto.c" + +/*********************************************************************************************************************************** +Is the control file for this version of PostgreSQL? +***********************************************************************************************************************************/ +bool +pgInterfaceIs095(const Buffer *controlFile) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + FUNCTION_TEST_RESULT( + BOOL, controlData->pg_control_version == PG_CONTROL_VERSION && controlData->catalog_version_no == CATALOG_VERSION_NO); +} + +/*********************************************************************************************************************************** +Get information from pg_control in a common format +***********************************************************************************************************************************/ +PgControl +pgInterfaceControl095(const Buffer *controlFile) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_ASSERT(pgInterfaceIs095(controlFile)); + FUNCTION_DEBUG_END(); + + PgControl result = {0}; + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + result.systemId = controlData->system_identifier; + result.controlVersion = controlData->pg_control_version; + result.catalogVersion = controlData->catalog_version_no; + + result.pageSize = controlData->blcksz; + result.walSegmentSize = controlData->xlog_seg_size; + + result.pageChecksum = controlData->data_checksum_version != 0; + + FUNCTION_DEBUG_RESULT(PG_CONTROL, result); +} + +/*********************************************************************************************************************************** +Create pg_control for testing +***********************************************************************************************************************************/ +#ifdef DEBUG + +void +pgInterfaceControlTest095(PgControl pgControl, Buffer *buffer) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(PG_CONTROL, pgControl); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(buffer); + + controlData->system_identifier = pgControl.systemId; + controlData->pg_control_version = pgControl.controlVersion == 0 ? PG_CONTROL_VERSION : pgControl.controlVersion; + controlData->catalog_version_no = pgControl.catalogVersion == 0 ? CATALOG_VERSION_NO : pgControl.catalogVersion; + + controlData->blcksz = pgControl.pageSize; + controlData->xlog_seg_size = pgControl.walSegmentSize; + + controlData->data_checksum_version = pgControl.pageChecksum; + + FUNCTION_TEST_RESULT_VOID(); +} + +#endif diff --git a/src/postgres/interface/v095.h b/src/postgres/interface/v095.h new file mode 100644 index 000000000..76cd208a7 --- /dev/null +++ b/src/postgres/interface/v095.h @@ -0,0 +1,22 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.5 Interface +***********************************************************************************************************************************/ +#ifndef POSTGRES_INTERFACE_INTERFACE095_H +#define POSTGRES_INTERFACE_INTERFACE095_H + +#include "postgres/interface.h" + +/*********************************************************************************************************************************** +Functions +***********************************************************************************************************************************/ +bool pgInterfaceIs095(const Buffer *controlFile); +PgControl pgInterfaceControl095(const Buffer *controlFile); + +/*********************************************************************************************************************************** +Test Functions +***********************************************************************************************************************************/ +#ifdef DEBUG + void pgInterfaceControlTest095(PgControl pgControl, Buffer *buffer); +#endif + +#endif diff --git a/src/postgres/interface/v096.auto.c b/src/postgres/interface/v096.auto.c new file mode 100644 index 000000000..2439e8145 --- /dev/null +++ b/src/postgres/interface/v096.auto.c @@ -0,0 +1,270 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.6 Types +***********************************************************************************************************************************/ + +/*********************************************************************************************************************************** +Types from src/include/c.h +***********************************************************************************************************************************/ +typedef int64_t int64; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef uint32 TransactionId; + +/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ +typedef TransactionId MultiXactId; + +typedef uint32 MultiXactOffset; + +/*********************************************************************************************************************************** +Types from src/include/pgtime.h +***********************************************************************************************************************************/ +/* + * The API of this library is generally similar to the corresponding + * C library functions, except that we use pg_time_t which (we hope) is + * 64 bits wide, and which is most definitely signed not unsigned. + */ +typedef int64 pg_time_t; + +/*********************************************************************************************************************************** +Types from src/include/postgres_ext.h +***********************************************************************************************************************************/ +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +/*********************************************************************************************************************************** +Types from src/include/port/pg_crc32c.h +***********************************************************************************************************************************/ +typedef uint32 pg_crc32c; + +/*********************************************************************************************************************************** +Types from src/include/access/xlogdefs.h +***********************************************************************************************************************************/ +/* + * Pointer to a location in the XLOG. These pointers are 64 bits wide, + * because we don't want them ever to overflow. + */ +typedef uint64 XLogRecPtr; + +/* + * TimeLineID (TLI) - identifies different database histories to prevent + * confusion after restoring a prior state of a database installation. + * TLI does not change in a normal stop/restart of the database (including + * crash-and-recover cases); but we must assign a new TLI after doing + * a recovery to a prior state, a/k/a point-in-time recovery. This makes + * the new WAL logfile sequence we generate distinguishable from the + * sequence that was generated in the previous incarnation. + */ +typedef uint32 TimeLineID; + +/*********************************************************************************************************************************** +Types from src/include/catalog/catversion.h +***********************************************************************************************************************************/ +/* + * We could use anything we wanted for version numbers, but I recommend + * following the "YYYYMMDDN" style often used for DNS zone serial numbers. + * YYYYMMDD are the date of the change, and N is the number of the change + * on that day. (Hopefully we'll never commit ten independent sets of + * catalog changes on the same day...) + */ + +/* yyyymmddN */ +#define CATALOG_VERSION_NO 201608131 + +/*********************************************************************************************************************************** +Types from src/include/catalog/pg_control.h +***********************************************************************************************************************************/ +/* Version identifier for this pg_control format */ +#define PG_CONTROL_VERSION 960 + +/* + * Body of CheckPoint XLOG records. This is declared here because we keep + * a copy of the latest one in pg_control for possible disaster recovery. + * Changing this struct requires a PG_CONTROL_VERSION bump. + */ +typedef struct CheckPoint +{ + XLogRecPtr redo; /* next RecPtr available when we began to + * create CheckPoint (i.e. REDO start point) */ + TimeLineID ThisTimeLineID; /* current TLI */ + TimeLineID PrevTimeLineID; /* previous TLI, if this record begins a new + * timeline (equals ThisTimeLineID otherwise) */ + bool fullPageWrites; /* current full_page_writes */ + uint32 nextXidEpoch; /* higher-order bits of nextXid */ + TransactionId nextXid; /* next free XID */ + Oid nextOid; /* next free OID */ + MultiXactId nextMulti; /* next free MultiXactId */ + MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ + TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ + Oid oldestXidDB; /* database with minimum datfrozenxid */ + MultiXactId oldestMulti; /* cluster-wide minimum datminmxid */ + Oid oldestMultiDB; /* database with minimum datminmxid */ + pg_time_t time; /* time stamp of checkpoint */ + TransactionId oldestCommitTsXid; /* oldest Xid with valid commit + * timestamp */ + TransactionId newestCommitTsXid; /* newest Xid with valid commit + * timestamp */ + + /* + * Oldest XID still running. This is only needed to initialize hot standby + * mode from an online checkpoint, so we only bother calculating this for + * online checkpoints and only when wal_level is replica. Otherwise it's + * set to InvalidTransactionId. + */ + TransactionId oldestActiveXid; +} CheckPoint; + +/* + * System status indicator. Note this is stored in pg_control; if you change + * it, you must bump PG_CONTROL_VERSION + */ +typedef enum DBState +{ + DB_STARTUP = 0, + DB_SHUTDOWNED, + DB_SHUTDOWNED_IN_RECOVERY, + DB_SHUTDOWNING, + DB_IN_CRASH_RECOVERY, + DB_IN_ARCHIVE_RECOVERY, + DB_IN_PRODUCTION +} DBState; + +/* + * Contents of pg_control. + * + * NOTE: try to keep this under 512 bytes so that it will fit on one physical + * sector of typical disk drives. This reduces the odds of corruption due to + * power failure midway through a write. + */ +typedef struct ControlFileData +{ + /* + * Unique system identifier --- to ensure we match up xlog files with the + * installation that produced them. + */ + uint64 system_identifier; + + /* + * Version identifier information. Keep these fields at the same offset, + * especially pg_control_version; they won't be real useful if they move + * around. (For historical reasons they must be 8 bytes into the file + * rather than immediately at the front.) + * + * pg_control_version identifies the format of pg_control itself. + * catalog_version_no identifies the format of the system catalogs. + * + * There are additional version identifiers in individual files; for + * example, WAL logs contain per-page magic numbers that can serve as + * version cues for the WAL log. + */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ + + /* + * System status data + */ + DBState state; /* see enum above */ + pg_time_t time; /* time stamp of last pg_control update */ + XLogRecPtr checkPoint; /* last check point record ptr */ + XLogRecPtr prevCheckPoint; /* previous check point record ptr */ + + CheckPoint checkPointCopy; /* copy of last check point record */ + + XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */ + + /* + * These two values determine the minimum point we must recover up to + * before starting up: + * + * minRecoveryPoint is updated to the latest replayed LSN whenever we + * flush a data change during archive recovery. That guards against + * starting archive recovery, aborting it, and restarting with an earlier + * stop location. If we've already flushed data changes from WAL record X + * to disk, we mustn't start up until we reach X again. Zero when not + * doing archive recovery. + * + * backupStartPoint is the redo pointer of the backup start checkpoint, if + * we are recovering from an online backup and haven't reached the end of + * backup yet. It is reset to zero when the end of backup is reached, and + * we mustn't start up before that. A boolean would suffice otherwise, but + * we use the redo pointer as a cross-check when we see an end-of-backup + * record, to make sure the end-of-backup record corresponds the base + * backup we're recovering from. + * + * backupEndPoint is the backup end location, if we are recovering from an + * online backup which was taken from the standby and haven't reached the + * end of backup yet. It is initialized to the minimum recovery point in + * pg_control which was backed up last. It is reset to zero when the end + * of backup is reached, and we mustn't start up before that. + * + * If backupEndRequired is true, we know for sure that we're restoring + * from a backup, and must see a backup-end record before we can safely + * start up. If it's false, but backupStartPoint is set, a backup_label + * file was found at startup but it may have been a leftover from a stray + * pg_start_backup() call, not accompanied by pg_stop_backup(). + */ + XLogRecPtr minRecoveryPoint; + TimeLineID minRecoveryPointTLI; + XLogRecPtr backupStartPoint; + XLogRecPtr backupEndPoint; + bool backupEndRequired; + + /* + * Parameter settings that determine if the WAL can be used for archival + * or hot standby. + */ + int wal_level; + bool wal_log_hints; + int MaxConnections; + int max_worker_processes; + int max_prepared_xacts; + int max_locks_per_xact; + bool track_commit_timestamp; + + /* + * This data is used to check for hardware-architecture compatibility of + * the database and the backend executable. We need not check endianness + * explicitly, since the pg_control version will surely look wrong to a + * machine of different endianness, but we do need to worry about MAXALIGN + * and floating-point format. (Note: storage layout nominally also + * depends on SHORTALIGN and INTALIGN, but in practice these are the same + * on all architectures of interest.) + * + * Testing just one double value is not a very bulletproof test for + * floating-point compatibility, but it will catch most cases. + */ + uint32 maxAlign; /* alignment requirement for tuples */ + double floatFormat; /* constant 1234567.0 */ +#define FLOATFORMAT_VALUE 1234567.0 + + /* + * This data is used to make sure that configuration of this database is + * compatible with the backend executable. + */ + uint32 blcksz; /* data block size for this DB */ + uint32 relseg_size; /* blocks per segment of large relation */ + + uint32 xlog_blcksz; /* block size within WAL files */ + uint32 xlog_seg_size; /* size of each WAL segment */ + + uint32 nameDataLen; /* catalog name field width */ + uint32 indexMaxKeys; /* max number of columns in an index */ + + uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + uint32 loblksize; /* chunk size in pg_largeobject */ + + /* flag indicating internal format of timestamp, interval, time */ + bool enableIntTimes; /* int64 storage enabled? */ + + /* flags indicating pass-by-value status of various types */ + bool float4ByVal; /* float4 pass-by-value? */ + bool float8ByVal; /* float8, int8, etc pass-by-value? */ + + /* Are data pages protected by checksums? Zero if no checksum version */ + uint32 data_checksum_version; + + /* CRC of all above ... MUST BE LAST! */ + pg_crc32c crc; +} ControlFileData; diff --git a/src/postgres/interface/v096.c b/src/postgres/interface/v096.c new file mode 100644 index 000000000..f68fc1d81 --- /dev/null +++ b/src/postgres/interface/v096.c @@ -0,0 +1,85 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.6 Interface +***********************************************************************************************************************************/ +#include "common/debug.h" +#include "common/log.h" +#include "postgres/interface/v096.h" + +/*********************************************************************************************************************************** +Include PostgreSQL Types +***********************************************************************************************************************************/ +#include "postgres/interface/v096.auto.c" + +/*********************************************************************************************************************************** +Is the control file for this version of PostgreSQL? +***********************************************************************************************************************************/ +bool +pgInterfaceIs096(const Buffer *controlFile) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + FUNCTION_TEST_RESULT( + BOOL, controlData->pg_control_version == PG_CONTROL_VERSION && controlData->catalog_version_no == CATALOG_VERSION_NO); +} + +/*********************************************************************************************************************************** +Get information from pg_control in a common format +***********************************************************************************************************************************/ +PgControl +pgInterfaceControl096(const Buffer *controlFile) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_ASSERT(pgInterfaceIs096(controlFile)); + FUNCTION_DEBUG_END(); + + PgControl result = {0}; + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + result.systemId = controlData->system_identifier; + result.controlVersion = controlData->pg_control_version; + result.catalogVersion = controlData->catalog_version_no; + + result.pageSize = controlData->blcksz; + result.walSegmentSize = controlData->xlog_seg_size; + + result.pageChecksum = controlData->data_checksum_version != 0; + + FUNCTION_DEBUG_RESULT(PG_CONTROL, result); +} + +/*********************************************************************************************************************************** +Create pg_control for testing +***********************************************************************************************************************************/ +#ifdef DEBUG + +void +pgInterfaceControlTest096(PgControl pgControl, Buffer *buffer) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(PG_CONTROL, pgControl); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(buffer); + + controlData->system_identifier = pgControl.systemId; + controlData->pg_control_version = pgControl.controlVersion == 0 ? PG_CONTROL_VERSION : pgControl.controlVersion; + controlData->catalog_version_no = pgControl.catalogVersion == 0 ? CATALOG_VERSION_NO : pgControl.catalogVersion; + + controlData->blcksz = pgControl.pageSize; + controlData->xlog_seg_size = pgControl.walSegmentSize; + + controlData->data_checksum_version = pgControl.pageChecksum; + + FUNCTION_TEST_RESULT_VOID(); +} + +#endif diff --git a/src/postgres/interface/v096.h b/src/postgres/interface/v096.h new file mode 100644 index 000000000..fce4b6786 --- /dev/null +++ b/src/postgres/interface/v096.h @@ -0,0 +1,22 @@ +/*********************************************************************************************************************************** +PostgreSQL 9.6 Interface +***********************************************************************************************************************************/ +#ifndef POSTGRES_INTERFACE_INTERFACE096_H +#define POSTGRES_INTERFACE_INTERFACE096_H + +#include "postgres/interface.h" + +/*********************************************************************************************************************************** +Functions +***********************************************************************************************************************************/ +bool pgInterfaceIs096(const Buffer *controlFile); +PgControl pgInterfaceControl096(const Buffer *controlFile); + +/*********************************************************************************************************************************** +Test Functions +***********************************************************************************************************************************/ +#ifdef DEBUG + void pgInterfaceControlTest096(PgControl pgControl, Buffer *buffer); +#endif + +#endif diff --git a/src/postgres/interface/v100.auto.c b/src/postgres/interface/v100.auto.c new file mode 100644 index 000000000..9202e5637 --- /dev/null +++ b/src/postgres/interface/v100.auto.c @@ -0,0 +1,273 @@ +/*********************************************************************************************************************************** +PostgreSQL 10 Types +***********************************************************************************************************************************/ + +/*********************************************************************************************************************************** +Types from src/include/c.h +***********************************************************************************************************************************/ +typedef int64_t int64; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef uint32 TransactionId; + +/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ +typedef TransactionId MultiXactId; + +typedef uint32 MultiXactOffset; + +/*********************************************************************************************************************************** +Types from src/include/pgtime.h +***********************************************************************************************************************************/ +/* + * The API of this library is generally similar to the corresponding + * C library functions, except that we use pg_time_t which (we hope) is + * 64 bits wide, and which is most definitely signed not unsigned. + */ +typedef int64 pg_time_t; + +/*********************************************************************************************************************************** +Types from src/include/postgres_ext.h +***********************************************************************************************************************************/ +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +/*********************************************************************************************************************************** +Types from src/include/port/pg_crc32c.h +***********************************************************************************************************************************/ +typedef uint32 pg_crc32c; + +/*********************************************************************************************************************************** +Types from src/include/access/xlogdefs.h +***********************************************************************************************************************************/ +/* + * Pointer to a location in the XLOG. These pointers are 64 bits wide, + * because we don't want them ever to overflow. + */ +typedef uint64 XLogRecPtr; + +/* + * TimeLineID (TLI) - identifies different database histories to prevent + * confusion after restoring a prior state of a database installation. + * TLI does not change in a normal stop/restart of the database (including + * crash-and-recover cases); but we must assign a new TLI after doing + * a recovery to a prior state, a/k/a point-in-time recovery. This makes + * the new WAL logfile sequence we generate distinguishable from the + * sequence that was generated in the previous incarnation. + */ +typedef uint32 TimeLineID; + +/*********************************************************************************************************************************** +Types from src/include/catalog/catversion.h +***********************************************************************************************************************************/ +/* + * We could use anything we wanted for version numbers, but I recommend + * following the "YYYYMMDDN" style often used for DNS zone serial numbers. + * YYYYMMDD are the date of the change, and N is the number of the change + * on that day. (Hopefully we'll never commit ten independent sets of + * catalog changes on the same day...) + */ + +/* yyyymmddN */ +#define CATALOG_VERSION_NO 201707211 + +/*********************************************************************************************************************************** +Types from src/include/catalog/pg_control.h +***********************************************************************************************************************************/ +/* Version identifier for this pg_control format */ +#define PG_CONTROL_VERSION 1002 + +/* Nonce key length, see below */ +#define MOCK_AUTH_NONCE_LEN 32 + +/* + * Body of CheckPoint XLOG records. This is declared here because we keep + * a copy of the latest one in pg_control for possible disaster recovery. + * Changing this struct requires a PG_CONTROL_VERSION bump. + */ +typedef struct CheckPoint +{ + XLogRecPtr redo; /* next RecPtr available when we began to + * create CheckPoint (i.e. REDO start point) */ + TimeLineID ThisTimeLineID; /* current TLI */ + TimeLineID PrevTimeLineID; /* previous TLI, if this record begins a new + * timeline (equals ThisTimeLineID otherwise) */ + bool fullPageWrites; /* current full_page_writes */ + uint32 nextXidEpoch; /* higher-order bits of nextXid */ + TransactionId nextXid; /* next free XID */ + Oid nextOid; /* next free OID */ + MultiXactId nextMulti; /* next free MultiXactId */ + MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ + TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ + Oid oldestXidDB; /* database with minimum datfrozenxid */ + MultiXactId oldestMulti; /* cluster-wide minimum datminmxid */ + Oid oldestMultiDB; /* database with minimum datminmxid */ + pg_time_t time; /* time stamp of checkpoint */ + TransactionId oldestCommitTsXid; /* oldest Xid with valid commit + * timestamp */ + TransactionId newestCommitTsXid; /* newest Xid with valid commit + * timestamp */ + + /* + * Oldest XID still running. This is only needed to initialize hot standby + * mode from an online checkpoint, so we only bother calculating this for + * online checkpoints and only when wal_level is replica. Otherwise it's + * set to InvalidTransactionId. + */ + TransactionId oldestActiveXid; +} CheckPoint; + +/* + * System status indicator. Note this is stored in pg_control; if you change + * it, you must bump PG_CONTROL_VERSION + */ +typedef enum DBState +{ + DB_STARTUP = 0, + DB_SHUTDOWNED, + DB_SHUTDOWNED_IN_RECOVERY, + DB_SHUTDOWNING, + DB_IN_CRASH_RECOVERY, + DB_IN_ARCHIVE_RECOVERY, + DB_IN_PRODUCTION +} DBState; + +/* + * Contents of pg_control. + */ +typedef struct ControlFileData +{ + /* + * Unique system identifier --- to ensure we match up xlog files with the + * installation that produced them. + */ + uint64 system_identifier; + + /* + * Version identifier information. Keep these fields at the same offset, + * especially pg_control_version; they won't be real useful if they move + * around. (For historical reasons they must be 8 bytes into the file + * rather than immediately at the front.) + * + * pg_control_version identifies the format of pg_control itself. + * catalog_version_no identifies the format of the system catalogs. + * + * There are additional version identifiers in individual files; for + * example, WAL logs contain per-page magic numbers that can serve as + * version cues for the WAL log. + */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ + + /* + * System status data + */ + DBState state; /* see enum above */ + pg_time_t time; /* time stamp of last pg_control update */ + XLogRecPtr checkPoint; /* last check point record ptr */ + XLogRecPtr prevCheckPoint; /* previous check point record ptr */ + + CheckPoint checkPointCopy; /* copy of last check point record */ + + XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */ + + /* + * These two values determine the minimum point we must recover up to + * before starting up: + * + * minRecoveryPoint is updated to the latest replayed LSN whenever we + * flush a data change during archive recovery. That guards against + * starting archive recovery, aborting it, and restarting with an earlier + * stop location. If we've already flushed data changes from WAL record X + * to disk, we mustn't start up until we reach X again. Zero when not + * doing archive recovery. + * + * backupStartPoint is the redo pointer of the backup start checkpoint, if + * we are recovering from an online backup and haven't reached the end of + * backup yet. It is reset to zero when the end of backup is reached, and + * we mustn't start up before that. A boolean would suffice otherwise, but + * we use the redo pointer as a cross-check when we see an end-of-backup + * record, to make sure the end-of-backup record corresponds the base + * backup we're recovering from. + * + * backupEndPoint is the backup end location, if we are recovering from an + * online backup which was taken from the standby and haven't reached the + * end of backup yet. It is initialized to the minimum recovery point in + * pg_control which was backed up last. It is reset to zero when the end + * of backup is reached, and we mustn't start up before that. + * + * If backupEndRequired is true, we know for sure that we're restoring + * from a backup, and must see a backup-end record before we can safely + * start up. If it's false, but backupStartPoint is set, a backup_label + * file was found at startup but it may have been a leftover from a stray + * pg_start_backup() call, not accompanied by pg_stop_backup(). + */ + XLogRecPtr minRecoveryPoint; + TimeLineID minRecoveryPointTLI; + XLogRecPtr backupStartPoint; + XLogRecPtr backupEndPoint; + bool backupEndRequired; + + /* + * Parameter settings that determine if the WAL can be used for archival + * or hot standby. + */ + int wal_level; + bool wal_log_hints; + int MaxConnections; + int max_worker_processes; + int max_prepared_xacts; + int max_locks_per_xact; + bool track_commit_timestamp; + + /* + * This data is used to check for hardware-architecture compatibility of + * the database and the backend executable. We need not check endianness + * explicitly, since the pg_control version will surely look wrong to a + * machine of different endianness, but we do need to worry about MAXALIGN + * and floating-point format. (Note: storage layout nominally also + * depends on SHORTALIGN and INTALIGN, but in practice these are the same + * on all architectures of interest.) + * + * Testing just one double value is not a very bulletproof test for + * floating-point compatibility, but it will catch most cases. + */ + uint32 maxAlign; /* alignment requirement for tuples */ + double floatFormat; /* constant 1234567.0 */ +#define FLOATFORMAT_VALUE 1234567.0 + + /* + * This data is used to make sure that configuration of this database is + * compatible with the backend executable. + */ + uint32 blcksz; /* data block size for this DB */ + uint32 relseg_size; /* blocks per segment of large relation */ + + uint32 xlog_blcksz; /* block size within WAL files */ + uint32 xlog_seg_size; /* size of each WAL segment */ + + uint32 nameDataLen; /* catalog name field width */ + uint32 indexMaxKeys; /* max number of columns in an index */ + + uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + uint32 loblksize; /* chunk size in pg_largeobject */ + + /* flags indicating pass-by-value status of various types */ + bool float4ByVal; /* float4 pass-by-value? */ + bool float8ByVal; /* float8, int8, etc pass-by-value? */ + + /* Are data pages protected by checksums? Zero if no checksum version */ + uint32 data_checksum_version; + + /* + * Random nonce, used in authentication requests that need to proceed + * based on values that are cluster-unique, like a SASL exchange that + * failed at an early stage. + */ + char mock_authentication_nonce[MOCK_AUTH_NONCE_LEN]; + + /* CRC of all above ... MUST BE LAST! */ + pg_crc32c crc; +} ControlFileData; diff --git a/src/postgres/interface/v100.c b/src/postgres/interface/v100.c new file mode 100644 index 000000000..d05923e9d --- /dev/null +++ b/src/postgres/interface/v100.c @@ -0,0 +1,85 @@ +/*********************************************************************************************************************************** +PostgreSQL 10 Interface +***********************************************************************************************************************************/ +#include "common/debug.h" +#include "common/log.h" +#include "postgres/interface/v100.h" + +/*********************************************************************************************************************************** +Include PostgreSQL Types +***********************************************************************************************************************************/ +#include "postgres/interface/v100.auto.c" + +/*********************************************************************************************************************************** +Is the control file for this version of PostgreSQL? +***********************************************************************************************************************************/ +bool +pgInterfaceIs100(const Buffer *controlFile) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + FUNCTION_TEST_RESULT( + BOOL, controlData->pg_control_version == PG_CONTROL_VERSION && controlData->catalog_version_no == CATALOG_VERSION_NO); +} + +/*********************************************************************************************************************************** +Get information from pg_control in a common format +***********************************************************************************************************************************/ +PgControl +pgInterfaceControl100(const Buffer *controlFile) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_ASSERT(pgInterfaceIs100(controlFile)); + FUNCTION_DEBUG_END(); + + PgControl result = {0}; + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + result.systemId = controlData->system_identifier; + result.controlVersion = controlData->pg_control_version; + result.catalogVersion = controlData->catalog_version_no; + + result.pageSize = controlData->blcksz; + result.walSegmentSize = controlData->xlog_seg_size; + + result.pageChecksum = controlData->data_checksum_version != 0; + + FUNCTION_DEBUG_RESULT(PG_CONTROL, result); +} + +/*********************************************************************************************************************************** +Create pg_control for testing +***********************************************************************************************************************************/ +#ifdef DEBUG + +void +pgInterfaceControlTest100(PgControl pgControl, Buffer *buffer) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(PG_CONTROL, pgControl); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(buffer); + + controlData->system_identifier = pgControl.systemId; + controlData->pg_control_version = pgControl.controlVersion == 0 ? PG_CONTROL_VERSION : pgControl.controlVersion; + controlData->catalog_version_no = pgControl.catalogVersion == 0 ? CATALOG_VERSION_NO : pgControl.catalogVersion; + + controlData->blcksz = pgControl.pageSize; + controlData->xlog_seg_size = pgControl.walSegmentSize; + + controlData->data_checksum_version = pgControl.pageChecksum; + + FUNCTION_TEST_RESULT_VOID(); +} + +#endif diff --git a/src/postgres/interface/v100.h b/src/postgres/interface/v100.h new file mode 100644 index 000000000..c57218d79 --- /dev/null +++ b/src/postgres/interface/v100.h @@ -0,0 +1,22 @@ +/*********************************************************************************************************************************** +PostgreSQL 10 Interface +***********************************************************************************************************************************/ +#ifndef POSTGRES_INTERFACE_INTERFACE100_H +#define POSTGRES_INTERFACE_INTERFACE100_H + +#include "postgres/interface.h" + +/*********************************************************************************************************************************** +Functions +***********************************************************************************************************************************/ +bool pgInterfaceIs100(const Buffer *controlFile); +PgControl pgInterfaceControl100(const Buffer *controlFile); + +/*********************************************************************************************************************************** +Test Functions +***********************************************************************************************************************************/ +#ifdef DEBUG + void pgInterfaceControlTest100(PgControl pgControl, Buffer *buffer); +#endif + +#endif diff --git a/src/postgres/interface/v110.auto.c b/src/postgres/interface/v110.auto.c new file mode 100644 index 000000000..e48fd6d62 --- /dev/null +++ b/src/postgres/interface/v110.auto.c @@ -0,0 +1,272 @@ +/*********************************************************************************************************************************** +PostgreSQL 11 Types +***********************************************************************************************************************************/ + +/*********************************************************************************************************************************** +Types from src/include/c.h +***********************************************************************************************************************************/ +typedef int64_t int64; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef uint32 TransactionId; + +/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ +typedef TransactionId MultiXactId; + +typedef uint32 MultiXactOffset; + +/*********************************************************************************************************************************** +Types from src/include/pgtime.h +***********************************************************************************************************************************/ +/* + * The API of this library is generally similar to the corresponding + * C library functions, except that we use pg_time_t which (we hope) is + * 64 bits wide, and which is most definitely signed not unsigned. + */ +typedef int64 pg_time_t; + +/*********************************************************************************************************************************** +Types from src/include/postgres_ext.h +***********************************************************************************************************************************/ +/* + * Object ID is a fundamental type in Postgres. + */ +typedef unsigned int Oid; + +/*********************************************************************************************************************************** +Types from src/include/port/pg_crc32c.h +***********************************************************************************************************************************/ +typedef uint32 pg_crc32c; + +/*********************************************************************************************************************************** +Types from src/include/access/xlogdefs.h +***********************************************************************************************************************************/ +/* + * Pointer to a location in the XLOG. These pointers are 64 bits wide, + * because we don't want them ever to overflow. + */ +typedef uint64 XLogRecPtr; + +/* + * TimeLineID (TLI) - identifies different database histories to prevent + * confusion after restoring a prior state of a database installation. + * TLI does not change in a normal stop/restart of the database (including + * crash-and-recover cases); but we must assign a new TLI after doing + * a recovery to a prior state, a/k/a point-in-time recovery. This makes + * the new WAL logfile sequence we generate distinguishable from the + * sequence that was generated in the previous incarnation. + */ +typedef uint32 TimeLineID; + +/*********************************************************************************************************************************** +Types from src/include/catalog/catversion.h +***********************************************************************************************************************************/ +/* + * We could use anything we wanted for version numbers, but I recommend + * following the "YYYYMMDDN" style often used for DNS zone serial numbers. + * YYYYMMDD are the date of the change, and N is the number of the change + * on that day. (Hopefully we'll never commit ten independent sets of + * catalog changes on the same day...) + */ + +/* yyyymmddN */ +#define CATALOG_VERSION_NO 201809051 + +/*********************************************************************************************************************************** +Types from src/include/catalog/pg_control.h +***********************************************************************************************************************************/ +/* Version identifier for this pg_control format */ +#define PG_CONTROL_VERSION 1100 + +/* Nonce key length, see below */ +#define MOCK_AUTH_NONCE_LEN 32 + +/* + * Body of CheckPoint XLOG records. This is declared here because we keep + * a copy of the latest one in pg_control for possible disaster recovery. + * Changing this struct requires a PG_CONTROL_VERSION bump. + */ +typedef struct CheckPoint +{ + XLogRecPtr redo; /* next RecPtr available when we began to + * create CheckPoint (i.e. REDO start point) */ + TimeLineID ThisTimeLineID; /* current TLI */ + TimeLineID PrevTimeLineID; /* previous TLI, if this record begins a new + * timeline (equals ThisTimeLineID otherwise) */ + bool fullPageWrites; /* current full_page_writes */ + uint32 nextXidEpoch; /* higher-order bits of nextXid */ + TransactionId nextXid; /* next free XID */ + Oid nextOid; /* next free OID */ + MultiXactId nextMulti; /* next free MultiXactId */ + MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ + TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ + Oid oldestXidDB; /* database with minimum datfrozenxid */ + MultiXactId oldestMulti; /* cluster-wide minimum datminmxid */ + Oid oldestMultiDB; /* database with minimum datminmxid */ + pg_time_t time; /* time stamp of checkpoint */ + TransactionId oldestCommitTsXid; /* oldest Xid with valid commit + * timestamp */ + TransactionId newestCommitTsXid; /* newest Xid with valid commit + * timestamp */ + + /* + * Oldest XID still running. This is only needed to initialize hot standby + * mode from an online checkpoint, so we only bother calculating this for + * online checkpoints and only when wal_level is replica. Otherwise it's + * set to InvalidTransactionId. + */ + TransactionId oldestActiveXid; +} CheckPoint; + +/* + * System status indicator. Note this is stored in pg_control; if you change + * it, you must bump PG_CONTROL_VERSION + */ +typedef enum DBState +{ + DB_STARTUP = 0, + DB_SHUTDOWNED, + DB_SHUTDOWNED_IN_RECOVERY, + DB_SHUTDOWNING, + DB_IN_CRASH_RECOVERY, + DB_IN_ARCHIVE_RECOVERY, + DB_IN_PRODUCTION +} DBState; + +/* + * Contents of pg_control. + */ +typedef struct ControlFileData +{ + /* + * Unique system identifier --- to ensure we match up xlog files with the + * installation that produced them. + */ + uint64 system_identifier; + + /* + * Version identifier information. Keep these fields at the same offset, + * especially pg_control_version; they won't be real useful if they move + * around. (For historical reasons they must be 8 bytes into the file + * rather than immediately at the front.) + * + * pg_control_version identifies the format of pg_control itself. + * catalog_version_no identifies the format of the system catalogs. + * + * There are additional version identifiers in individual files; for + * example, WAL logs contain per-page magic numbers that can serve as + * version cues for the WAL log. + */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ + + /* + * System status data + */ + DBState state; /* see enum above */ + pg_time_t time; /* time stamp of last pg_control update */ + XLogRecPtr checkPoint; /* last check point record ptr */ + + CheckPoint checkPointCopy; /* copy of last check point record */ + + XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */ + + /* + * These two values determine the minimum point we must recover up to + * before starting up: + * + * minRecoveryPoint is updated to the latest replayed LSN whenever we + * flush a data change during archive recovery. That guards against + * starting archive recovery, aborting it, and restarting with an earlier + * stop location. If we've already flushed data changes from WAL record X + * to disk, we mustn't start up until we reach X again. Zero when not + * doing archive recovery. + * + * backupStartPoint is the redo pointer of the backup start checkpoint, if + * we are recovering from an online backup and haven't reached the end of + * backup yet. It is reset to zero when the end of backup is reached, and + * we mustn't start up before that. A boolean would suffice otherwise, but + * we use the redo pointer as a cross-check when we see an end-of-backup + * record, to make sure the end-of-backup record corresponds the base + * backup we're recovering from. + * + * backupEndPoint is the backup end location, if we are recovering from an + * online backup which was taken from the standby and haven't reached the + * end of backup yet. It is initialized to the minimum recovery point in + * pg_control which was backed up last. It is reset to zero when the end + * of backup is reached, and we mustn't start up before that. + * + * If backupEndRequired is true, we know for sure that we're restoring + * from a backup, and must see a backup-end record before we can safely + * start up. If it's false, but backupStartPoint is set, a backup_label + * file was found at startup but it may have been a leftover from a stray + * pg_start_backup() call, not accompanied by pg_stop_backup(). + */ + XLogRecPtr minRecoveryPoint; + TimeLineID minRecoveryPointTLI; + XLogRecPtr backupStartPoint; + XLogRecPtr backupEndPoint; + bool backupEndRequired; + + /* + * Parameter settings that determine if the WAL can be used for archival + * or hot standby. + */ + int wal_level; + bool wal_log_hints; + int MaxConnections; + int max_worker_processes; + int max_prepared_xacts; + int max_locks_per_xact; + bool track_commit_timestamp; + + /* + * This data is used to check for hardware-architecture compatibility of + * the database and the backend executable. We need not check endianness + * explicitly, since the pg_control version will surely look wrong to a + * machine of different endianness, but we do need to worry about MAXALIGN + * and floating-point format. (Note: storage layout nominally also + * depends on SHORTALIGN and INTALIGN, but in practice these are the same + * on all architectures of interest.) + * + * Testing just one double value is not a very bulletproof test for + * floating-point compatibility, but it will catch most cases. + */ + uint32 maxAlign; /* alignment requirement for tuples */ + double floatFormat; /* constant 1234567.0 */ +#define FLOATFORMAT_VALUE 1234567.0 + + /* + * This data is used to make sure that configuration of this database is + * compatible with the backend executable. + */ + uint32 blcksz; /* data block size for this DB */ + uint32 relseg_size; /* blocks per segment of large relation */ + + uint32 xlog_blcksz; /* block size within WAL files */ + uint32 xlog_seg_size; /* size of each WAL segment */ + + uint32 nameDataLen; /* catalog name field width */ + uint32 indexMaxKeys; /* max number of columns in an index */ + + uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + uint32 loblksize; /* chunk size in pg_largeobject */ + + /* flags indicating pass-by-value status of various types */ + bool float4ByVal; /* float4 pass-by-value? */ + bool float8ByVal; /* float8, int8, etc pass-by-value? */ + + /* Are data pages protected by checksums? Zero if no checksum version */ + uint32 data_checksum_version; + + /* + * Random nonce, used in authentication requests that need to proceed + * based on values that are cluster-unique, like a SASL exchange that + * failed at an early stage. + */ + char mock_authentication_nonce[MOCK_AUTH_NONCE_LEN]; + + /* CRC of all above ... MUST BE LAST! */ + pg_crc32c crc; +} ControlFileData; diff --git a/src/postgres/interface/v110.c b/src/postgres/interface/v110.c new file mode 100644 index 000000000..440628f89 --- /dev/null +++ b/src/postgres/interface/v110.c @@ -0,0 +1,85 @@ +/*********************************************************************************************************************************** +PostgreSQL 11 Interface +***********************************************************************************************************************************/ +#include "common/debug.h" +#include "common/log.h" +#include "postgres/interface/v110.h" + +/*********************************************************************************************************************************** +Include PostgreSQL Types +***********************************************************************************************************************************/ +#include "postgres/interface/v110.auto.c" + +/*********************************************************************************************************************************** +Is the control file for this version of PostgreSQL? +***********************************************************************************************************************************/ +bool +pgInterfaceIs110(const Buffer *controlFile) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + FUNCTION_TEST_RESULT( + BOOL, controlData->pg_control_version == PG_CONTROL_VERSION && controlData->catalog_version_no == CATALOG_VERSION_NO); +} + +/*********************************************************************************************************************************** +Get information from pg_control in a common format +***********************************************************************************************************************************/ +PgControl +pgInterfaceControl110(const Buffer *controlFile) +{ + FUNCTION_DEBUG_BEGIN(logLevelTrace); + FUNCTION_DEBUG_PARAM(BUFFER, controlFile); + + FUNCTION_TEST_ASSERT(controlFile != NULL); + FUNCTION_TEST_ASSERT(pgInterfaceIs110(controlFile)); + FUNCTION_DEBUG_END(); + + PgControl result = {0}; + ControlFileData *controlData = (ControlFileData *)bufPtr(controlFile); + + result.systemId = controlData->system_identifier; + result.controlVersion = controlData->pg_control_version; + result.catalogVersion = controlData->catalog_version_no; + + result.pageSize = controlData->blcksz; + result.walSegmentSize = controlData->xlog_seg_size; + + result.pageChecksum = controlData->data_checksum_version != 0; + + FUNCTION_DEBUG_RESULT(PG_CONTROL, result); +} + +/*********************************************************************************************************************************** +Create pg_control for testing +***********************************************************************************************************************************/ +#ifdef DEBUG + +void +pgInterfaceControlTest110(PgControl pgControl, Buffer *buffer) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(PG_CONTROL, pgControl); + FUNCTION_TEST_END(); + + ControlFileData *controlData = (ControlFileData *)bufPtr(buffer); + + controlData->system_identifier = pgControl.systemId; + controlData->pg_control_version = pgControl.controlVersion == 0 ? PG_CONTROL_VERSION : pgControl.controlVersion; + controlData->catalog_version_no = pgControl.catalogVersion == 0 ? CATALOG_VERSION_NO : pgControl.catalogVersion; + + controlData->blcksz = pgControl.pageSize; + controlData->xlog_seg_size = pgControl.walSegmentSize; + + controlData->data_checksum_version = pgControl.pageChecksum; + + FUNCTION_TEST_RESULT_VOID(); +} + +#endif diff --git a/src/postgres/interface/v110.h b/src/postgres/interface/v110.h new file mode 100644 index 000000000..8dc7e521e --- /dev/null +++ b/src/postgres/interface/v110.h @@ -0,0 +1,22 @@ +/*********************************************************************************************************************************** +PostgreSQL 11 Interface +***********************************************************************************************************************************/ +#ifndef POSTGRES_INTERFACE_INTERFACE110_H +#define POSTGRES_INTERFACE_INTERFACE110_H + +#include "postgres/interface.h" + +/*********************************************************************************************************************************** +Functions +***********************************************************************************************************************************/ +bool pgInterfaceIs110(const Buffer *controlFile); +PgControl pgInterfaceControl110(const Buffer *controlFile); + +/*********************************************************************************************************************************** +Test Functions +***********************************************************************************************************************************/ +#ifdef DEBUG + void pgInterfaceControlTest110(PgControl pgControl, Buffer *buffer); +#endif + +#endif diff --git a/src/postgres/pageChecksum.c b/src/postgres/pageChecksum.c index a94d4c707..ed63ef0f8 100644 --- a/src/postgres/pageChecksum.c +++ b/src/postgres/pageChecksum.c @@ -69,7 +69,6 @@ minimize register spilling. For less sophisticated compilers it might be benefic #include "common/error.h" #include "common/log.h" #include "postgres/pageChecksum.h" -#include "postgres/type.h" /*********************************************************************************************************************************** For historical reasons, the 64-bit LSN value is stored as two 32-bit values. @@ -143,7 +142,6 @@ pageChecksumBlock(const unsigned char *page, unsigned int pageSize) FUNCTION_TEST_PARAM(UINT, pageSize); FUNCTION_TEST_ASSERT(page != NULL); - FUNCTION_TEST_ASSERT(pageSize == PG_PAGE_SIZE); FUNCTION_TEST_END(); uint32_t sums[N_SUMS]; @@ -186,7 +184,6 @@ pageChecksum(const unsigned char *page, unsigned int blockNo, unsigned int pageS FUNCTION_TEST_PARAM(UINT, pageSize); FUNCTION_TEST_ASSERT(page != NULL); - FUNCTION_TEST_ASSERT(pageSize == PG_PAGE_SIZE); FUNCTION_TEST_END(); // Save pd_checksum and temporarily set it to zero, so that the checksum calculation isn't affected by the old checksum stored @@ -220,7 +217,6 @@ pageChecksumTest( FUNCTION_TEST_PARAM(UINT32, ignoreWalOffset); FUNCTION_TEST_ASSERT(page != NULL); - FUNCTION_TEST_ASSERT(pageSize == PG_PAGE_SIZE); FUNCTION_TEST_END(); FUNCTION_TEST_RESULT( @@ -251,7 +247,6 @@ pageChecksumBufferTest( FUNCTION_TEST_ASSERT(pageBuffer != NULL); FUNCTION_DEBUG_ASSERT(pageBufferSize > 0); - FUNCTION_DEBUG_ASSERT(pageSize == PG_PAGE_SIZE); FUNCTION_DEBUG_ASSERT(pageBufferSize % pageSize == 0); FUNCTION_DEBUG_END(); diff --git a/src/postgres/type.h b/src/postgres/type.h deleted file mode 100644 index 5f01f8b85..000000000 --- a/src/postgres/type.h +++ /dev/null @@ -1,31 +0,0 @@ -/*********************************************************************************************************************************** -PostreSQL Types -***********************************************************************************************************************************/ -#ifndef POSTGRES_TYPE_H -#define POSTGRES_TYPE_H - -/*********************************************************************************************************************************** -Define page size - -Page size can only be changed at compile time and and is not known to be well-tested, so only the default page size is supported. -***********************************************************************************************************************************/ -#define PG_PAGE_SIZE 8192 - -/*********************************************************************************************************************************** -Defines for various Postgres paths and files -***********************************************************************************************************************************/ -#define PG_FILE_PGCONTROL "pg_control" - -#define PG_PATH_GLOBAL "global" - -/*********************************************************************************************************************************** -pg_control file data -***********************************************************************************************************************************/ -typedef struct PgControlFile -{ - uint64_t systemId; - uint32_t controlVersion; - uint32_t catalogVersion; -} PgControlFile; - -#endif diff --git a/src/postgres/version.h b/src/postgres/version.h index 6ca48a376..f9038fd53 100644 --- a/src/postgres/version.h +++ b/src/postgres/version.h @@ -4,6 +4,11 @@ PostreSQL Version Constants #ifndef POSTGRES_VERSION_H #define POSTGRES_VERSION_H +/*********************************************************************************************************************************** +PostgreSQL name +***********************************************************************************************************************************/ +#define PG_NAME "PostgreSQL" + /*********************************************************************************************************************************** PostgreSQL version constants ***********************************************************************************************************************************/ @@ -19,4 +24,19 @@ PostgreSQL version constants #define PG_VERSION_10 100000 #define PG_VERSION_11 110000 +/*********************************************************************************************************************************** +PostgreSQL version string constants for use in error messages +***********************************************************************************************************************************/ +#define PG_VERSION_83_STR "8.3" +#define PG_VERSION_84_STR "8.4" +#define PG_VERSION_90_STR "9.0" +#define PG_VERSION_91_STR "9.1" +#define PG_VERSION_92_STR "9.2" +#define PG_VERSION_93_STR "9.3" +#define PG_VERSION_94_STR "9.4" +#define PG_VERSION_95_STR "9.5" +#define PG_VERSION_96_STR "9.6" +#define PG_VERSION_10_STR "10" +#define PG_VERSION_11_STR "11" + #endif diff --git a/test/code-count/file-type.yaml b/test/code-count/file-type.yaml index d06a42e80..c2602a289 100644 --- a/test/code-count/file-type.yaml +++ b/test/code-count/file-type.yaml @@ -523,6 +523,14 @@ src/command/archive/common.h: class: core type: c/h +src/command/archive/get/file.c: + class: core + type: c + +src/command/archive/get/file.h: + class: core + type: c/h + src/command/archive/get/get.c: class: core type: c @@ -547,6 +555,14 @@ src/command/command.h: class: core type: c/h +src/command/control/control.c: + class: core + type: c + +src/command/control/control.h: + class: core + type: c/h + src/command/help/help.c: class: core type: c @@ -655,6 +671,10 @@ src/common/io/filter/filter.h: class: core type: c/h +src/common/io/filter/filter.intern.h: + class: core + type: c/h + src/common/io/filter/group.c: class: core type: c @@ -695,6 +715,10 @@ src/common/io/read.h: class: core type: c/h +src/common/io/read.intern.h: + class: core + type: c/h + src/common/io/write.c: class: core type: c @@ -703,6 +727,10 @@ src/common/io/write.h: class: core type: c/h +src/common/io/write.intern.h: + class: core + type: c/h + src/common/lock.c: class: core type: c @@ -999,11 +1027,143 @@ src/perl/libc.auto.c: class: core/auto type: c -src/postgres/info.c: +src/postgres/interface.c: class: core type: c -src/postgres/info.h: +src/postgres/interface.h: + class: core + type: c/h + +src/postgres/interface/v083.auto.c: + class: core/auto + type: c + +src/postgres/interface/v083.c: + class: core + type: c + +src/postgres/interface/v083.h: + class: core + type: c/h + +src/postgres/interface/v084.auto.c: + class: core/auto + type: c + +src/postgres/interface/v084.c: + class: core + type: c + +src/postgres/interface/v084.h: + class: core + type: c/h + +src/postgres/interface/v090.auto.c: + class: core/auto + type: c + +src/postgres/interface/v090.c: + class: core + type: c + +src/postgres/interface/v090.h: + class: core + type: c/h + +src/postgres/interface/v091.auto.c: + class: core/auto + type: c + +src/postgres/interface/v091.c: + class: core + type: c + +src/postgres/interface/v091.h: + class: core + type: c/h + +src/postgres/interface/v092.auto.c: + class: core/auto + type: c + +src/postgres/interface/v092.c: + class: core + type: c + +src/postgres/interface/v092.h: + class: core + type: c/h + +src/postgres/interface/v093.auto.c: + class: core/auto + type: c + +src/postgres/interface/v093.c: + class: core + type: c + +src/postgres/interface/v093.h: + class: core + type: c/h + +src/postgres/interface/v094.auto.c: + class: core/auto + type: c + +src/postgres/interface/v094.c: + class: core + type: c + +src/postgres/interface/v094.h: + class: core + type: c/h + +src/postgres/interface/v095.auto.c: + class: core/auto + type: c + +src/postgres/interface/v095.c: + class: core + type: c + +src/postgres/interface/v095.h: + class: core + type: c/h + +src/postgres/interface/v096.auto.c: + class: core/auto + type: c + +src/postgres/interface/v096.c: + class: core + type: c + +src/postgres/interface/v096.h: + class: core + type: c/h + +src/postgres/interface/v100.auto.c: + class: core/auto + type: c + +src/postgres/interface/v100.c: + class: core + type: c + +src/postgres/interface/v100.h: + class: core + type: c/h + +src/postgres/interface/v110.auto.c: + class: core/auto + type: c + +src/postgres/interface/v110.c: + class: core + type: c + +src/postgres/interface/v110.h: class: core type: c/h @@ -1015,22 +1175,10 @@ src/postgres/pageChecksum.h: class: core type: c/h -src/postgres/type.h: - class: core - type: c/h - src/postgres/version.h: class: core type: c/h -src/storage/driver/posix/storage.c: - class: core - type: c - -src/storage/driver/posix/storage.h: - class: core - type: c/h - src/storage/driver/posix/common.c: class: core type: c @@ -1055,6 +1203,14 @@ src/storage/driver/posix/fileWrite.h: class: core type: c/h +src/storage/driver/posix/storage.c: + class: core + type: c + +src/storage/driver/posix/storage.h: + class: core + type: c/h + src/storage/fileRead.c: class: core type: c @@ -1063,6 +1219,10 @@ src/storage/fileRead.h: class: core type: c/h +src/storage/fileRead.intern.h: + class: core + type: c/h + src/storage/fileWrite.c: class: core type: c @@ -1071,6 +1231,10 @@ src/storage/fileWrite.h: class: core type: c/h +src/storage/fileWrite.intern.h: + class: core + type: c/h + src/storage/helper.c: class: core type: c @@ -1091,6 +1255,10 @@ src/storage/storage.h: class: core type: c/h +src/storage/storage.intern.h: + class: core + type: c/h + src/version.h: class: core type: c/h @@ -1215,6 +1383,10 @@ test/lib/pgBackRestTest/Module/Archive/ArchivePushPerlTest.pm: class: test/module type: perl +test/lib/pgBackRestTest/Module/Backup/BackupFileUnitPerlTest.pm: + class: test/module + type: perl + test/lib/pgBackRestTest/Module/Backup/BackupInfoUnitPerlTest.pm: class: test/module type: perl @@ -1391,6 +1563,10 @@ test/src/module/command/commandTest.c: class: test/module type: c +test/src/module/command/controlTest.c: + class: test/module + type: c + test/src/module/common/assertOffTest.c: class: test/module type: c @@ -1559,7 +1735,7 @@ test/src/module/perl/execTest.c: class: test/module type: c -test/src/module/postgres/infoTest.c: +test/src/module/postgres/interfaceTest.c: class: test/module type: c @@ -1567,15 +1743,7 @@ test/src/module/postgres/pageChecksumTest.c: class: test/module type: c -test/src/module/storage/fileTest.c: - class: test/module - type: c - -test/src/module/storage/helperTest.c: - class: test/module - type: c - -test/src/module/storage/storageTest.c: +test/src/module/storage/posixTest.c: class: test/module type: c diff --git a/test/define.yaml b/test/define.yaml index 4d3b38000..68e7bbad9 100644 --- a/test/define.yaml +++ b/test/define.yaml @@ -333,11 +333,11 @@ unit: test: # ---------------------------------------------------------------------------------------------------------------------------- - - name: info - total: 3 + - name: interface + total: 2 coverage: - postgres/info: full + postgres/interface: full # ---------------------------------------------------------------------------------------------------------------------------- - name: page-checksum @@ -588,7 +588,7 @@ unit: # ---------------------------------------------------------------------------------------------------------------------------- - name: common-perl - total: 5 + total: 6 coverage: Archive/Common: partial diff --git a/test/expect/mock-all-001.log b/test/expect/mock-all-001.log index 1914fe0e7..faa5437ae 100644 --- a/test/expect/mock-all-001.log +++ b/test/expect/mock-all-001.log @@ -235,9 +235,9 @@ P00 DEBUG: Storage::Local->exists(): strFileExp = [TEST_PATH]/db-master/rep P00 DEBUG: Storage::Local->exists=>: bExists = false P00 DEBUG: Storage::Local->openWrite(): bAtomic = , bPathCreate = , lTimestamp = [undef], rhyFilter = [undef], strCipherPass = [undef], strGroup = [undef], strMode = <0640>, strUser = [undef], xFileExp = [TEST_PATH]/db-master/repo/backup/db/[BACKUP-FULL-1]/backup.manifest.copy P00 DEBUG: Backup::File::backupManifestUpdate: save manifest: lManifestSaveCurrent = 16384, lManifestSaveSize = 3 -P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (1, 8192, 8192, b4a3adade1e81ebfc7e9a27bca0887a347d81522, [undef]), strKey = pg_data/global/pg_control +P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (1, 8192, 8192, 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, [undef]), strKey = pg_data/global/pg_control P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/base/1/12000, strQueueIdx = 0 -P01 INFO: backup file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: backup file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P00 DEBUG: Storage::Local->exists(): strFileExp = [TEST_PATH]/db-master/repo/backup/db/[BACKUP-FULL-1]/backup.manifest P00 DEBUG: Storage::Local->exists=>: bExists = false P00 DEBUG: Storage::Local->openWrite(): bAtomic = , bPathCreate = , lTimestamp = [undef], rhyFilter = [undef], strCipherPass = [undef], strGroup = [undef], strMode = <0640>, strUser = [undef], xFileExp = [TEST_PATH]/db-master/repo/backup/db/[BACKUP-FULL-1]/backup.manifest.copy @@ -441,7 +441,7 @@ pg_data/base/32768/33000.32767={"checksum":"21e2c7c1a326682c07053b7d6a5a40dbd49c pg_data/base/32768/33001={"checksum":"6bf316f11d28c28914ea9be92c00de9bea6d9a6b","checksum-page":false,"checksum-page-error":[0,[3,5],7],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/base/32768/44000_init={"checksum":"4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f","checksum-page":true,"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356f29","size":[SIZE],"timestamp":[TIMESTAMP-1]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_hba.conf={"checksum":"dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} @@ -895,7 +895,7 @@ P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/32768/33000.32767, pg_data/base/32768/33000.32767, 32768, 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5, 1, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-1], 1, {iWalId => 65535, iWalOffset => 65535}, 1, 0), rParamSecure = [undef], strKey = pg_data/base/32768/33000.32767, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/32768/33000, pg_data/base/32768/33000, 32768, 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f, 1, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-1], 1, {iWalId => 65535, iWalOffset => 65535}, 1, 0), rParamSecure = [undef], strKey = pg_data/base/32768/33000, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/16384/17000, pg_data/base/16384/17000, 16384, e0101dd8ffb910c9c202ca35b5f828bcb9697bed, 1, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-1], 1, {iWalId => 65535, iWalOffset => 65535}, 1, 0), rParamSecure = [undef], strKey = pg_data/base/16384/17000, strOp = backupFile, strQueue = pg_data -P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/global/pg_control, pg_data/global/pg_control, 8192, b4a3adade1e81ebfc7e9a27bca0887a347d81522, 0, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-2], 0, [undef], 1, 0), rParamSecure = [undef], strKey = pg_data/global/pg_control, strOp = backupFile, strQueue = pg_data +P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/global/pg_control, pg_data/global/pg_control, 8192, 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, 0, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-2], 0, [undef], 1, 0), rParamSecure = [undef], strKey = pg_data/global/pg_control, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/1/12000, pg_data/base/1/12000, 8192, 22c98d248ff548311eda88559e4a8405ed77c003, 1, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-1], 1, {iWalId => 65535, iWalOffset => 65535}, 1, 0), rParamSecure = [undef], strKey = pg_data/base/1/12000, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/postgresql.conf, pg_data/postgresql.conf, 21, 6721d92c9fcdf4248acff1f9a1377127d9064807, 0, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-2], 1, [undef], 1, 0), rParamSecure = [undef], strKey = pg_data/postgresql.conf, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/pg_hba.conf, pg_data/pg_hba.conf, 9, dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b, 0, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-2], 1, [undef], 1, 0), rParamSecure = [undef], strKey = pg_data/pg_hba.conf, strOp = backupFile, strQueue = pg_data @@ -930,9 +930,9 @@ P01 DETAIL: checksum resumed file [TEST_PATH]/db-master/db/base/base/32768/33000 P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (0, 16384, 16384, e0101dd8ffb910c9c202ca35b5f828bcb9697bed, [undef]), strKey = pg_data/base/16384/17000 P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/global/pg_control, strQueueIdx = 0 P01 DETAIL: checksum resumed file [TEST_PATH]/db-master/db/base/base/16384/17000 (16KB, 91%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (0, 8192, 8192, b4a3adade1e81ebfc7e9a27bca0887a347d81522, [undef]), strKey = pg_data/global/pg_control +P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (0, 8192, 8192, 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, [undef]), strKey = pg_data/global/pg_control P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/base/1/12000, strQueueIdx = 0 -P01 DETAIL: checksum resumed file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 DETAIL: checksum resumed file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (0, 8192, 8192, 22c98d248ff548311eda88559e4a8405ed77c003, [undef]), strKey = pg_data/base/1/12000 P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/postgresql.conf, strQueueIdx = 0 P01 DETAIL: checksum resumed file [TEST_PATH]/db-master/db/base/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 @@ -1133,7 +1133,7 @@ pg_data/base/32768/44000_init={"checksum":"4a383e4fb8b5cd2a4e8fab91ef63dce48e532 pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356f29","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-1]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_hba.conf={"checksum":"dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} @@ -1430,7 +1430,7 @@ P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/32768/33000.32767, 32768, [MODIFICATION-TIME-1], 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5, 0, 0, pg_data/base/32768/33000.32767, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/base/32768/33000.32767, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/32768/33000, 32768, [MODIFICATION-TIME-1], 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f, 0, 0, pg_data/base/32768/33000, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/base/32768/33000, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/16384/17000, 16384, [MODIFICATION-TIME-1], e0101dd8ffb910c9c202ca35b5f828bcb9697bed, 0, 0, pg_data/base/16384/17000, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/base/16384/17000, strOp = restoreFile, strQueue = pg_data -P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp, 8192, [MODIFICATION-TIME-2], b4a3adade1e81ebfc7e9a27bca0887a347d81522, 0, 0, pg_data/global/pg_control, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/global/pg_control, strOp = restoreFile, strQueue = pg_data +P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp, 8192, [MODIFICATION-TIME-2], 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, 0, 0, pg_data/global/pg_control, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/global/pg_control, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/1/12000, 8192, [MODIFICATION-TIME-1], 22c98d248ff548311eda88559e4a8405ed77c003, 0, 0, pg_data/base/1/12000, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/base/1/12000, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/postgresql.conf, 21, [MODIFICATION-TIME-2], 6721d92c9fcdf4248acff1f9a1377127d9064807, 0, 0, pg_data/postgresql.conf, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/postgresql.conf, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/pg_hba.conf, 9, [MODIFICATION-TIME-2], dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b, 0, 0, pg_data/pg_hba.conf, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/pg_hba.conf, strOp = restoreFile, strQueue = pg_data @@ -1472,8 +1472,8 @@ P00 DEBUG: RestoreFile::restoreLog(): bCopy = true, bForce = false, bZero = P01 INFO: restore file [TEST_PATH]/db-master/db/base/base/16384/17000 (16KB, 91%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (1), strKey = pg_data/global/pg_control P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/base/1/12000, strQueueIdx = 0 -P00 DEBUG: RestoreFile::restoreLog(): bCopy = true, bForce = false, bZero = false, iLocalId = 1, lModificationTime = [MODIFICATION-TIME-2], lSize = 8192, lSizeCurrent = 180224, lSizeTotal = 196666, strChecksum = b4a3adade1e81ebfc7e9a27bca0887a347d81522, strDbFile = [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp -P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P00 DEBUG: RestoreFile::restoreLog(): bCopy = true, bForce = false, bZero = false, iLocalId = 1, lModificationTime = [MODIFICATION-TIME-2], lSize = 8192, lSizeCurrent = 180224, lSizeTotal = 196666, strChecksum = 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, strDbFile = [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp +P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (0), strKey = pg_data/base/1/12000 P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/postgresql.conf, strQueueIdx = 0 P00 DEBUG: RestoreFile::restoreLog(): bCopy = false, bForce = false, bZero = false, iLocalId = 1, lModificationTime = [MODIFICATION-TIME-1], lSize = 8192, lSizeCurrent = 188416, lSizeTotal = 196666, strChecksum = 22c98d248ff548311eda88559e4a8405ed77c003, strDbFile = [TEST_PATH]/db-master/db/base/base/1/12000 @@ -1591,7 +1591,7 @@ P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/44000_init - e P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000.32767 - exists and matches backup (32KB, 66%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000 - exists and matches backup (32KB, 83%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/16384/17000 - exists and matches backup (16KB, 91%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/1/12000 - exists and matches backup (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/postgresql.conf - exists and matches backup (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/pg_hba.conf - exists and matches backup (9B, 99%) checksum dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b @@ -1634,7 +1634,7 @@ P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/44000_init - e P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000.32767 - exists and matches backup (32KB, 66%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000 - exists and matches backup (32KB, 83%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/16384/17000 - exists and matches backup (16KB, 91%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/1/12000 - exists and matches backup (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/postgresql.conf - exists and matches backup (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/pg_hba.conf - exists and matches backup (9B, 99%) checksum dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b @@ -1679,7 +1679,7 @@ P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/44000_init - e P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000.32767 - exists and matches backup (32KB, 66%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000 - exists and matches backup (32KB, 83%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/16384/17000 - exists and matches backup (16KB, 91%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/1/12000 - exists and matches backup (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/postgresql.conf - exists and matches backup (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/pg_hba.conf - exists and matches backup (9B, 99%) checksum dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b @@ -1747,7 +1747,7 @@ P01 INFO: restore file [TEST_PATH]/db-master/db/base/base/32768/44000_init (32 P01 INFO: restore file [TEST_PATH]/db-master/db/base/base/32768/33000.32767 (32KB, 66%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 INFO: restore file [TEST_PATH]/db-master/db/base/base/32768/33000 (32KB, 83%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 INFO: restore file [TEST_PATH]/db-master/db/base/base/16384/17000 (16KB, 91%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 INFO: restore file [TEST_PATH]/db-master/db/base/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/postgresql.conf - exists and matches backup (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 INFO: restore file [TEST_PATH]/db-master/db/base/pg_hba.conf (9B, 99%) checksum dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b @@ -1807,7 +1807,7 @@ P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/44000_init - e P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000.32767 - exists and matches size 32768 and modification time [MODIFICATION-TIME-1] (32KB, 66%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000 - exists and matches size 32768 and modification time [MODIFICATION-TIME-1] (32KB, 83%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/16384/17000 - exists and matches size 16384 and modification time [MODIFICATION-TIME-1] (16KB, 91%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/1/12000 - exists and matches size 8192 and modification time [MODIFICATION-TIME-1] (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 INFO: restore file [TEST_PATH]/db-master/db/base/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 INFO: restore file [TEST_PATH]/db-master/db/base/pg_hba.conf (9B, 99%) checksum dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b @@ -2303,7 +2303,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -2500,7 +2500,7 @@ P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/32768/33000.32767, pg_data/base/32768/33000.32767, 32768, 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5, 1, [BACKUP-INCR-2], 0, 3, [MODIFICATION-TIME-1], 1, {iWalId => 65535, iWalOffset => 65535}, 1, 1), rParamSecure = [undef], strKey = pg_data/base/32768/33000.32767, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/32768/33000, pg_data/base/32768/33000, 32768, 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f, 1, [BACKUP-INCR-2], 0, 3, [MODIFICATION-TIME-1], 1, {iWalId => 65535, iWalOffset => 65535}, 1, 1), rParamSecure = [undef], strKey = pg_data/base/32768/33000, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/16384/17000, pg_data/base/16384/17000, 16384, e0101dd8ffb910c9c202ca35b5f828bcb9697bed, 1, [BACKUP-INCR-2], 0, 3, [MODIFICATION-TIME-1], 1, {iWalId => 65535, iWalOffset => 65535}, 1, 1), rParamSecure = [undef], strKey = pg_data/base/16384/17000, strOp = backupFile, strQueue = pg_data -P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/global/pg_control, pg_data/global/pg_control, 8192, b4a3adade1e81ebfc7e9a27bca0887a347d81522, 0, [BACKUP-INCR-2], 0, 3, [MODIFICATION-TIME-2], 0, [undef], 1, 1), rParamSecure = [undef], strKey = pg_data/global/pg_control, strOp = backupFile, strQueue = pg_data +P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/global/pg_control, pg_data/global/pg_control, 8192, 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, 0, [BACKUP-INCR-2], 0, 3, [MODIFICATION-TIME-2], 0, [undef], 1, 1), rParamSecure = [undef], strKey = pg_data/global/pg_control, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/1/12000, pg_data/base/1/12000, 8192, 22c98d248ff548311eda88559e4a8405ed77c003, 1, [BACKUP-INCR-2], 0, 3, [MODIFICATION-TIME-1], 1, {iWalId => 65535, iWalOffset => 65535}, 1, 1), rParamSecure = [undef], strKey = pg_data/base/1/12000, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/postgresql.conf, pg_data/postgresql.conf, 21, 6721d92c9fcdf4248acff1f9a1377127d9064807, 0, [BACKUP-INCR-2], 0, 3, [MODIFICATION-TIME-2], 1, [undef], 1, 1), rParamSecure = [undef], strKey = pg_data/postgresql.conf, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/badchecksum.txt, pg_data/badchecksum.txt, 11, f927212cd08d11a42a666b2f04235398e9ceeb51, 0, [BACKUP-INCR-2], 0, 3, [MODIFICATION-TIME-1], 1, [undef], 1, 0), rParamSecure = [undef], strKey = pg_data/badchecksum.txt, strOp = backupFile, strQueue = pg_data @@ -2537,9 +2537,9 @@ P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/base/3276 P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (4, 16384, [undef], e0101dd8ffb910c9c202ca35b5f828bcb9697bed, [undef]), strKey = pg_data/base/16384/17000 P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/global/pg_control, strQueueIdx = 0 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/base/16384/17000 (16KB, 91%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (4, 8192, [undef], b4a3adade1e81ebfc7e9a27bca0887a347d81522, [undef]), strKey = pg_data/global/pg_control +P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (4, 8192, [undef], 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, [undef]), strKey = pg_data/global/pg_control P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/base/1/12000, strQueueIdx = 0 -P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (4, 8192, [undef], 22c98d248ff548311eda88559e4a8405ed77c003, [undef]), strKey = pg_data/base/1/12000 P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/postgresql.conf, strQueueIdx = 0 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 @@ -2820,7 +2820,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -2914,7 +2914,7 @@ P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/base/3276 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/base/32768/33000.32767 (32KB, 66%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/base/32768/33000 (32KB, 83%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/base/16384/17000 (16KB, 91%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 INFO: backup file [TEST_PATH]/db-master/db/base/badchecksum.txt (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -3015,7 +3015,7 @@ pg_data/base/32768/44000_init={"checksum":"4a383e4fb8b5cd2a4e8fab91ef63dce48e532 pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356f29","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -3106,7 +3106,7 @@ P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/base/3276 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/base/32768/33000.32767 (32KB, 66%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/base/32768/33000 (32KB, 83%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/base/16384/17000 (16KB, 91%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 INFO: backup file [TEST_PATH]/db-master/db/base/badchecksum.txt (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -3207,7 +3207,7 @@ pg_data/base/32768/44000_init={"checksum":"4a383e4fb8b5cd2a4e8fab91ef63dce48e532 pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356f29","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -3488,7 +3488,7 @@ P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base-2/base/32768/33000.32767, 32768, [MODIFICATION-TIME-1], 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5, 0, 0, pg_data/base/32768/33000.32767, [BACKUP-FULL-2], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-4], 0, [BACKUP-DIFF-2], 0), rParamSecure = [undef], strKey = pg_data/base/32768/33000.32767, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base-2/base/32768/33000, 32768, [MODIFICATION-TIME-1], 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f, 0, 0, pg_data/base/32768/33000, [BACKUP-FULL-2], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-4], 0, [BACKUP-DIFF-2], 0), rParamSecure = [undef], strKey = pg_data/base/32768/33000, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base-2/base/16384/17000, 16384, [MODIFICATION-TIME-1], e0101dd8ffb910c9c202ca35b5f828bcb9697bed, 0, 0, pg_data/base/16384/17000, [BACKUP-FULL-2], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-4], 0, [BACKUP-DIFF-2], 0), rParamSecure = [undef], strKey = pg_data/base/16384/17000, strOp = restoreFile, strQueue = pg_data -P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp, 8192, [MODIFICATION-TIME-2], b4a3adade1e81ebfc7e9a27bca0887a347d81522, 0, 0, pg_data/global/pg_control, [BACKUP-FULL-2], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-4], 0, [BACKUP-DIFF-2], 0), rParamSecure = [undef], strKey = pg_data/global/pg_control, strOp = restoreFile, strQueue = pg_data +P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp, 8192, [MODIFICATION-TIME-2], 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, 0, 0, pg_data/global/pg_control, [BACKUP-FULL-2], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-4], 0, [BACKUP-DIFF-2], 0), rParamSecure = [undef], strKey = pg_data/global/pg_control, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base-2/base/1/12000, 8192, [MODIFICATION-TIME-1], 22c98d248ff548311eda88559e4a8405ed77c003, 0, 0, pg_data/base/1/12000, [BACKUP-FULL-2], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-4], 0, [BACKUP-DIFF-2], 0), rParamSecure = [undef], strKey = pg_data/base/1/12000, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base-2/postgresql.conf, 21, [MODIFICATION-TIME-2], 6721d92c9fcdf4248acff1f9a1377127d9064807, 0, 0, pg_data/postgresql.conf, [BACKUP-FULL-2], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-4], 0, [BACKUP-DIFF-2], 0), rParamSecure = [undef], strKey = pg_data/postgresql.conf, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base-2/badchecksum.txt, 11, [MODIFICATION-TIME-1], f927212cd08d11a42a666b2f04235398e9ceeb51, 0, 0, pg_data/badchecksum.txt, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-4], 0, [BACKUP-DIFF-2], 0), rParamSecure = [undef], strKey = pg_data/badchecksum.txt, strOp = restoreFile, strQueue = pg_data @@ -3533,8 +3533,8 @@ P00 DEBUG: RestoreFile::restoreLog(): bCopy = true, bForce = false, bZero = P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/16384/17000 (16KB, 91%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (1), strKey = pg_data/global/pg_control P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/base/1/12000, strQueueIdx = 0 -P00 DEBUG: RestoreFile::restoreLog(): bCopy = true, bForce = false, bZero = false, iLocalId = 1, lModificationTime = [MODIFICATION-TIME-2], lSize = 8192, lSizeCurrent = 180224, lSizeTotal = 196682, strChecksum = b4a3adade1e81ebfc7e9a27bca0887a347d81522, strDbFile = [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp -P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P00 DEBUG: RestoreFile::restoreLog(): bCopy = true, bForce = false, bZero = false, iLocalId = 1, lModificationTime = [MODIFICATION-TIME-2], lSize = 8192, lSizeCurrent = 180224, lSizeTotal = 196682, strChecksum = 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, strDbFile = [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp +P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (1), strKey = pg_data/base/1/12000 P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/postgresql.conf, strQueueIdx = 0 P00 DEBUG: RestoreFile::restoreLog(): bCopy = true, bForce = false, bZero = false, iLocalId = 1, lModificationTime = [MODIFICATION-TIME-1], lSize = 8192, lSizeCurrent = 188416, lSizeTotal = 196682, strChecksum = 22c98d248ff548311eda88559e4a8405ed77c003, strDbFile = [TEST_PATH]/db-master/db/base-2/base/1/12000 @@ -3663,7 +3663,7 @@ P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/32768/44000_init - P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33000.32767 - exists and matches backup (32KB, 66%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33000 - exists and matches backup (32KB, 83%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/16384/17000 - exists and matches backup (16KB, 91%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/1/12000 - exists and matches backup (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/postgresql.conf - exists and matches backup (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/badchecksum.txt - exists and matches backup (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -3788,7 +3788,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/base/base2.txt={"checksum":"09b5e31766be1dba1ec27de82f975c1b6eea2a92","checksum-page":false,"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"reference":"[BACKUP-DIFF-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -4036,7 +4036,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/base/base2.txt={"checksum":"09b5e31766be1dba1ec27de82f975c1b6eea2a92","checksum-page":false,"reference":"[BACKUP-INCR-3]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"reference":"[BACKUP-DIFF-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -4121,7 +4121,7 @@ P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/base/32 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/base/32768/44000_init (32KB, 54%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/base/32768/33000.32767 (32KB, 72%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/base/32768/33000 (32KB, 90%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f -P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/global/pg_control (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/global/pg_control (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/badchecksum.txt (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -4230,7 +4230,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/base/base2.txt={"checksum":"09b5e31766be1dba1ec27de82f975c1b6eea2a92","checksum-page":false,"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -4403,7 +4403,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/base/base2.txt={"checksum":"09b5e31766be1dba1ec27de82f975c1b6eea2a92","checksum-page":false,"reference":"[BACKUP-DIFF-3]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"reference":"[BACKUP-DIFF-3]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -4493,7 +4493,7 @@ P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/base/32 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/base/32768/44000_init (32KB, 54%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/base/32768/33000.32767 (32KB, 72%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/base/32768/33000 (32KB, 90%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f -P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/global/pg_control (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/global/pg_control (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/badchecksum.txt (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -4598,7 +4598,7 @@ pg_data/base/32768/44000_init={"checksum":"4a383e4fb8b5cd2a4e8fab91ef63dce48e532 pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356f29","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -4684,7 +4684,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/base/32768/33001 (64KB, P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/base/32768/44000_init (32KB, 54%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/base/32768/33000.32767 (32KB, 72%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/base/32768/33000 (32KB, 90%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f -P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/global/pg_control (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/global/pg_control (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/badchecksum.txt (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -4789,7 +4789,7 @@ pg_data/base/32768/44000_init={"checksum":"4a383e4fb8b5cd2a4e8fab91ef63dce48e532 pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356f29","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -5344,7 +5344,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/base/base2.txt={"checksum":"cafac3c59553f2cfde41ce2e62e7662295f108c0","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -5432,7 +5432,7 @@ P01 DETAIL: restore zeroed file [TEST_PATH]/db-master/db/base-2/base/32768/33001 P01 DETAIL: restore zeroed file [TEST_PATH]/db-master/db/base-2/base/32768/44000_init (32KB, 54%) P01 DETAIL: restore zeroed file [TEST_PATH]/db-master/db/base-2/base/32768/33000.32767 (32KB, 72%) P01 DETAIL: restore zeroed file [TEST_PATH]/db-master/db/base-2/base/32768/33000 (32KB, 90%) -P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/1/12000 - exists and matches backup (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/postgresql.conf - exists and matches backup (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/badchecksum.txt - exists and matches backup (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -5475,7 +5475,7 @@ P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33001 (64KB, P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/32768/44000_init (32KB, 54%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33000.32767 (32KB, 72%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33000 (32KB, 90%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f -P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/1/12000 - exists and matches backup (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/postgresql.conf - exists and matches backup (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/badchecksum.txt - exists and matches backup (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -5536,7 +5536,7 @@ P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/base/32768/33001 ( P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/base/32768/44000_init (32KB, 54%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/base/32768/33000.32767 (32KB, 72%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/base/32768/33000 (32KB, 90%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f -P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/global/pg_control.pgbackrest.tmp (8KB, 95%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/badchecksum.txt (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -5832,7 +5832,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/base/base2.txt={"checksum":"cafac3c59553f2cfde41ce2e62e7662295f108c0","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -6001,7 +6001,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/base/base2.txt={"checksum":"cafac3c59553f2cfde41ce2e62e7662295f108c0","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} diff --git a/test/expect/mock-all-002.log b/test/expect/mock-all-002.log index 3aefe7181..20baea277 100644 --- a/test/expect/mock-all-002.log +++ b/test/expect/mock-all-002.log @@ -204,9 +204,9 @@ P00 DEBUG: Storage::Local->exists(): strFileExp = [TEST_PATH]/backup/repo/b P00 DEBUG: Storage::Local->exists=>: bExists = false P00 DEBUG: Storage::Local->openWrite(): bAtomic = , bPathCreate = , lTimestamp = [undef], rhyFilter = [undef], strCipherPass = [undef], strGroup = [undef], strMode = <0640>, strUser = [undef], xFileExp = [TEST_PATH]/backup/repo/backup/db/[BACKUP-FULL-1]/backup.manifest.copy P00 DEBUG: Backup::File::backupManifestUpdate: save manifest: lManifestSaveCurrent = 16384, lManifestSaveSize = 3 -P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (1, 8192, 8192, b4a3adade1e81ebfc7e9a27bca0887a347d81522, [undef]), strKey = pg_data/global/pg_control +P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (1, 8192, 8192, 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, [undef]), strKey = pg_data/global/pg_control P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/base/1/12000, strQueueIdx = 0 -P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/global/pg_control (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/global/pg_control (8KB, 94%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P00 DEBUG: Storage::Local->exists(): strFileExp = [TEST_PATH]/backup/repo/backup/db/[BACKUP-FULL-1]/backup.manifest P00 DEBUG: Storage::Local->exists=>: bExists = false P00 DEBUG: Storage::Local->openWrite(): bAtomic = , bPathCreate = , lTimestamp = [undef], rhyFilter = [undef], strCipherPass = [undef], strGroup = [undef], strMode = <0640>, strUser = [undef], xFileExp = [TEST_PATH]/backup/repo/backup/db/[BACKUP-FULL-1]/backup.manifest.copy @@ -436,7 +436,7 @@ pg_data/base/32768/33000={"checksum":"4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f", pg_data/base/32768/33000.32767={"checksum":"21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5","checksum-page":true,"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/base/32768/33001={"checksum":"6bf316f11d28c28914ea9be92c00de9bea6d9a6b","checksum-page":false,"checksum-page-error":[0,[3,5],7],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356f29","size":[SIZE],"timestamp":[TIMESTAMP-1]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_hba.conf={"checksum":"dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} @@ -1140,7 +1140,7 @@ P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/32768/33000.32767, pg_data/base/32768/33000.32767, 32768, 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5, 1, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-1], 1, {iWalId => 65535, iWalOffset => 65535}, 0, 0), rParamSecure = [undef], strKey = pg_data/base/32768/33000.32767, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/32768/33000, pg_data/base/32768/33000, 32768, 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f, 1, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-1], 1, {iWalId => 65535, iWalOffset => 65535}, 0, 0), rParamSecure = [undef], strKey = pg_data/base/32768/33000, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/16384/17000, pg_data/base/16384/17000, 16384, e0101dd8ffb910c9c202ca35b5f828bcb9697bed, 1, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-1], 1, {iWalId => 65535, iWalOffset => 65535}, 0, 0), rParamSecure = [undef], strKey = pg_data/base/16384/17000, strOp = backupFile, strQueue = pg_data -P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/global/pg_control, pg_data/global/pg_control, 8192, b4a3adade1e81ebfc7e9a27bca0887a347d81522, 0, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-2], 0, [undef], 0, 0), rParamSecure = [undef], strKey = pg_data/global/pg_control, strOp = backupFile, strQueue = pg_data +P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/global/pg_control, pg_data/global/pg_control, 8192, 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, 0, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-2], 0, [undef], 0, 0), rParamSecure = [undef], strKey = pg_data/global/pg_control, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/1/12000, pg_data/base/1/12000, 8192, 22c98d248ff548311eda88559e4a8405ed77c003, 1, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-1], 1, {iWalId => 65535, iWalOffset => 65535}, 0, 0), rParamSecure = [undef], strKey = pg_data/base/1/12000, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/postgresql.conf, pg_data/postgresql.conf, 21, 6721d92c9fcdf4248acff1f9a1377127d9064807, 0, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-2], 1, [undef], 0, 0), rParamSecure = [undef], strKey = pg_data/postgresql.conf, strOp = backupFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/pg_hba.conf, pg_data/pg_hba.conf, 9, dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b, 0, [BACKUP-FULL-2], 0, 3, [MODIFICATION-TIME-2], 1, [undef], 0, 0), rParamSecure = [undef], strKey = pg_data/pg_hba.conf, strOp = backupFile, strQueue = pg_data @@ -1172,9 +1172,9 @@ P01 DETAIL: checksum resumed file [TEST_PATH]/db-master/db/base/base/32768/33000 P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (0, 16384, 16384, e0101dd8ffb910c9c202ca35b5f828bcb9697bed, [undef]), strKey = pg_data/base/16384/17000 P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/global/pg_control, strQueueIdx = 0 P01 DETAIL: checksum resumed file [TEST_PATH]/db-master/db/base/base/16384/17000 (16KB, 89%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (0, 8192, 8192, b4a3adade1e81ebfc7e9a27bca0887a347d81522, [undef]), strKey = pg_data/global/pg_control +P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (0, 8192, 8192, 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, [undef]), strKey = pg_data/global/pg_control P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/base/1/12000, strQueueIdx = 0 -P01 DETAIL: checksum resumed file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 DETAIL: checksum resumed file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 94%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (0, 8192, 8192, 22c98d248ff548311eda88559e4a8405ed77c003, [undef]), strKey = pg_data/base/1/12000 P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/postgresql.conf, strQueueIdx = 0 P01 DETAIL: checksum resumed file [TEST_PATH]/db-master/db/base/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 @@ -1393,7 +1393,7 @@ pg_data/base/32768/33001={"checksum":"6bf316f11d28c28914ea9be92c00de9bea6d9a6b", pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356f29","master":false,"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","size":[SIZE],"timestamp":[TIMESTAMP-1]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_hba.conf={"checksum":"dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","size":[SIZE],"timestamp":[TIMESTAMP-2]} @@ -1610,7 +1610,7 @@ P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/32768/33000.32767, 32768, [MODIFICATION-TIME-1], 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5, 0, 0, pg_data/base/32768/33000.32767, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/base/32768/33000.32767, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/32768/33000, 32768, [MODIFICATION-TIME-1], 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f, 0, 0, pg_data/base/32768/33000, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/base/32768/33000, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/16384/17000, 16384, [MODIFICATION-TIME-1], e0101dd8ffb910c9c202ca35b5f828bcb9697bed, 0, 0, pg_data/base/16384/17000, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/base/16384/17000, strOp = restoreFile, strQueue = pg_data -P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp, 8192, [MODIFICATION-TIME-2], b4a3adade1e81ebfc7e9a27bca0887a347d81522, 0, 0, pg_data/global/pg_control, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/global/pg_control, strOp = restoreFile, strQueue = pg_data +P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp, 8192, [MODIFICATION-TIME-2], 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, 0, 0, pg_data/global/pg_control, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/global/pg_control, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/1/12000, 8192, [MODIFICATION-TIME-1], 22c98d248ff548311eda88559e4a8405ed77c003, 0, 0, pg_data/base/1/12000, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/base/1/12000, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/postgresql.conf, 21, [MODIFICATION-TIME-2], 6721d92c9fcdf4248acff1f9a1377127d9064807, 0, 0, pg_data/postgresql.conf, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/postgresql.conf, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/pg_hba.conf, 9, [MODIFICATION-TIME-2], dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b, 0, 0, pg_data/pg_hba.conf, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/pg_hba.conf, strOp = restoreFile, strQueue = pg_data @@ -1648,8 +1648,8 @@ P00 DEBUG: RestoreFile::restoreLog(): bCopy = true, bForce = false, bZero = P01 INFO: restore file [TEST_PATH]/db-master/db/base/base/16384/17000 (16KB, 89%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (1), strKey = pg_data/global/pg_control P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/base/1/12000, strQueueIdx = 0 -P00 DEBUG: RestoreFile::restoreLog(): bCopy = true, bForce = false, bZero = false, iLocalId = 1, lModificationTime = [MODIFICATION-TIME-2], lSize = 8192, lSizeCurrent = 147456, lSizeTotal = 163898, strChecksum = b4a3adade1e81ebfc7e9a27bca0887a347d81522, strDbFile = [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp -P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P00 DEBUG: RestoreFile::restoreLog(): bCopy = true, bForce = false, bZero = false, iLocalId = 1, lModificationTime = [MODIFICATION-TIME-2], lSize = 8192, lSizeCurrent = 147456, lSizeTotal = 163898, strChecksum = 4c77c900f7af0d9ab13fa9982051a42e0b637f6c, strDbFile = [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp +P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P00 DEBUG: Protocol::Local::Process->process: job complete: iProcessId = 1, rResult = (0), strKey = pg_data/base/1/12000 P00 DEBUG: Protocol::Local::Process->process: get job from queue: iHostIdx = 0, iProcessId = 1, strKey = pg_data/postgresql.conf, strQueueIdx = 0 P00 DEBUG: RestoreFile::restoreLog(): bCopy = false, bForce = false, bZero = false, iLocalId = 1, lModificationTime = [MODIFICATION-TIME-1], lSize = 8192, lSizeCurrent = 155648, lSizeTotal = 163898, strChecksum = 22c98d248ff548311eda88559e4a8405ed77c003, strDbFile = [TEST_PATH]/db-master/db/base/base/1/12000 @@ -1757,7 +1757,7 @@ P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33001 - exists P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000.32767 - exists and matches backup (32KB, 59%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000 - exists and matches backup (32KB, 79%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/16384/17000 - exists and matches backup (16KB, 89%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/1/12000 - exists and matches backup (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/postgresql.conf - exists and matches backup (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/pg_hba.conf - exists and matches backup (9B, 99%) checksum dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b @@ -1797,7 +1797,7 @@ P01 INFO: restore file [TEST_PATH]/backup/db/base/32768/33001 (64KB, 39%) chec P01 INFO: restore file [TEST_PATH]/backup/db/base/32768/33000.32767 (32KB, 59%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 INFO: restore file [TEST_PATH]/backup/db/base/32768/33000 (32KB, 79%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 INFO: restore file [TEST_PATH]/backup/db/base/16384/17000 (16KB, 89%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P01 INFO: restore file [TEST_PATH]/backup/db/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/backup/db/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 INFO: restore file [TEST_PATH]/backup/db/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 INFO: restore file [TEST_PATH]/backup/db/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 INFO: restore file [TEST_PATH]/backup/db/pg_hba.conf (9B, 99%) checksum dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b @@ -1859,7 +1859,7 @@ P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33001 - exists P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000.32767 - exists and matches size 32768 and modification time [MODIFICATION-TIME-1] (32KB, 59%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000 - exists and matches size 32768 and modification time [MODIFICATION-TIME-1] (32KB, 79%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/16384/17000 - exists and matches size 16384 and modification time [MODIFICATION-TIME-1] (16KB, 89%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/1/12000 - exists and matches size 8192 and modification time [MODIFICATION-TIME-1] (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 INFO: restore file [TEST_PATH]/db-master/db/base/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 INFO: restore file [TEST_PATH]/db-master/db/base/pg_hba.conf (9B, 99%) checksum dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b @@ -2307,7 +2307,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -2779,7 +2779,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -2978,7 +2978,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -3174,7 +3174,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -3265,7 +3265,7 @@ P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33001 (64KB, P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33000.32767 (32KB, 59%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33000 (32KB, 79%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/16384/17000 (16KB, 89%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/badchecksum.txt (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -3309,7 +3309,7 @@ P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33001 - exis P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33000.32767 - exists and matches backup (32KB, 59%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33000 - exists and matches backup (32KB, 79%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/16384/17000 - exists and matches backup (16KB, 89%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed -P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/1/12000 - exists and matches backup (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/postgresql.conf - exists and matches backup (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/badchecksum.txt - exists and matches backup (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -3460,7 +3460,7 @@ pg_data/base/base2.txt={"checksum":"09b5e31766be1dba1ec27de82f975c1b6eea2a92","c pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"reference":"[BACKUP-DIFF-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-DIFF-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -3691,7 +3691,7 @@ pg_data/base/base2.txt={"checksum":"09b5e31766be1dba1ec27de82f975c1b6eea2a92","c pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"reference":"[BACKUP-DIFF-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-DIFF-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -3890,7 +3890,7 @@ pg_data/base/base2.txt={"checksum":"09b5e31766be1dba1ec27de82f975c1b6eea2a92","c pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -4080,7 +4080,7 @@ pg_data/base/base2.txt={"checksum":"09b5e31766be1dba1ec27de82f975c1b6eea2a92","c pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"reference":"[BACKUP-DIFF-3]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-DIFF-3]","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -4280,7 +4280,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"reference":"[BACKUP-FULL-2]","size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -4357,7 +4357,7 @@ P00 WARN: option repo1-retention-full is not set, the repository may run out o P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base-2/base/32768/33001 (64KB, 44%) checksum 6bf316f11d28c28914ea9be92c00de9bea6d9a6b P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base-2/base/32768/33000.32767 (32KB, 66%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base-2/base/32768/33000 (32KB, 88%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f -P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base-2/global/pg_control (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base-2/global/pg_control (8KB, 94%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base-2/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base-2/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base-2/badchecksum.txt (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -4488,7 +4488,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -5060,7 +5060,7 @@ pg_data/base/base2.txt={"checksum":"cafac3c59553f2cfde41ce2e62e7662295f108c0","r pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -5139,7 +5139,7 @@ P00 DETAIL: database filter: (^pg_data\/base\/32768\/)|(^pg_tblspc/2\/[TS_PATH-1 P01 DETAIL: restore zeroed file [TEST_PATH]/db-master/db/base-2/base/32768/33001 (64KB, 44%) P01 DETAIL: restore zeroed file [TEST_PATH]/db-master/db/base-2/base/32768/33000.32767 (32KB, 66%) P01 DETAIL: restore zeroed file [TEST_PATH]/db-master/db/base-2/base/32768/33000 (32KB, 88%) -P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/1/12000 - exists and matches backup (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/postgresql.conf - exists and matches backup (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/badchecksum.txt - exists and matches backup (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -5182,7 +5182,7 @@ P00 DETAIL: database filter: (^pg_data\/base\/16384\/)|(^pg_tblspc/2\/[TS_PATH-1 P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33001 (64KB, 44%) checksum 6bf316f11d28c28914ea9be92c00de9bea6d9a6b P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33000.32767 (32KB, 66%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/32768/33000 (32KB, 88%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f -P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/base/1/12000 - exists and matches backup (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/postgresql.conf - exists and matches backup (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 DETAIL: restore file [TEST_PATH]/db-master/db/base-2/badchecksum.txt - exists and matches backup (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -5243,7 +5243,7 @@ P00 DETAIL: check [TEST_PATH]/db-master/db/base-2/tablespace exists P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/base/32768/33001 (64KB, 44%) checksum 6bf316f11d28c28914ea9be92c00de9bea6d9a6b P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/base/32768/33000.32767 (32KB, 66%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/base/32768/33000 (32KB, 88%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f -P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 P01 INFO: restore file [TEST_PATH]/db-master/db/base-2/base/badchecksum.txt (11B, 99%) checksum f927212cd08d11a42a666b2f04235398e9ceeb51 @@ -5544,7 +5544,7 @@ pg_data/base/base2.txt={"checksum":"cafac3c59553f2cfde41ce2e62e7662295f108c0","r pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -5730,7 +5730,7 @@ pg_data/base/base2.txt={"checksum":"cafac3c59553f2cfde41ce2e62e7662295f108c0","r pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} diff --git a/test/expect/mock-all-003.log b/test/expect/mock-all-003.log index 550962eb8..71d803f9c 100644 --- a/test/expect/mock-all-003.log +++ b/test/expect/mock-all-003.log @@ -190,7 +190,7 @@ pg_data/base/32768/33000={"checksum":"4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f", pg_data/base/32768/33000.32767={"checksum":"21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5","checksum-page":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/base/32768/33001={"checksum":"6bf316f11d28c28914ea9be92c00de9bea6d9a6b","checksum-page":false,"checksum-page-error":[0,[3,5],7],"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356f29","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_hba.conf={"checksum":"dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b","master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} @@ -375,7 +375,7 @@ pg_data/base/32768/33001={"checksum":"6bf316f11d28c28914ea9be92c00de9bea6d9a6b", pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356f29","master":false,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_hba.conf={"checksum":"dd4cea0cae348309f9de28ad4ded8ee2cc2e6d5b","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} @@ -663,7 +663,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"238a131a3e8eb98d1fc5b27d882ca40b7618fd2a","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -858,7 +858,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -1060,7 +1060,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -1259,7 +1259,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -1480,7 +1480,7 @@ pg_data/base/base2.txt={"checksum":"09b5e31766be1dba1ec27de82f975c1b6eea2a92","c pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"reference":"[BACKUP-DIFF-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"reference":"[BACKUP-DIFF-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -1701,7 +1701,7 @@ pg_data/base/base2.txt={"checksum":"09b5e31766be1dba1ec27de82f975c1b6eea2a92","c pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"reference":"[BACKUP-DIFF-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"reference":"[BACKUP-DIFF-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -1901,7 +1901,7 @@ pg_data/base/base2.txt={"checksum":"09b5e31766be1dba1ec27de82f975c1b6eea2a92","c pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -2100,7 +2100,7 @@ pg_data/base/base2.txt={"checksum":"09b5e31766be1dba1ec27de82f975c1b6eea2a92","c pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"reference":"[BACKUP-DIFF-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"reference":"[BACKUP-DIFF-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -2300,7 +2300,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"reference":"[BACKUP-FULL-2]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -2496,7 +2496,7 @@ pg_data/base/32768/PG_VERSION={"checksum":"184473f470864e067ee3a22e64b47b0a1c356 pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -3053,7 +3053,7 @@ pg_data/base/base2.txt={"checksum":"cafac3c59553f2cfde41ce2e62e7662295f108c0","r pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -3430,7 +3430,7 @@ pg_data/base/base2.txt={"checksum":"cafac3c59553f2cfde41ce2e62e7662295f108c0","r pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} @@ -3632,7 +3632,7 @@ pg_data/base/base2.txt={"checksum":"cafac3c59553f2cfde41ce2e62e7662295f108c0","r pg_data/changecontent.txt={"checksum":"a094d94583e209556d03c3c5da33131a065f1689","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changesize.txt={"checksum":"3905d5be2ec8d67f41435dab5e0dcda3ae47455d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} pg_data/changetime.txt={"checksum":"88087292ed82e26f3eb824d0bffc05ccf7a30f8d","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} -pg_data/global/pg_control={"checksum":"b4a3adade1e81ebfc7e9a27bca0887a347d81522","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} +pg_data/global/pg_control={"checksum":"4c77c900f7af0d9ab13fa9982051a42e0b637f6c","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/pg_stat/global.stat={"checksum":"e350d5ce0153f3e22d5db21cf2a4eff00f3ee877","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/postgresql.conf={"checksum":"6721d92c9fcdf4248acff1f9a1377127d9064807","master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-2]} pg_data/special-@!#$^&*()-_+~`{}[]\|:;"<>',.?%={"master":true,"reference":"[BACKUP-FULL-3]","repo-size":[SIZE],"size":[SIZE],"timestamp":[TIMESTAMP-1]} diff --git a/test/expect/mock-archive-001.log b/test/expect/mock-archive-001.log index 82a8c2be8..45e0673f3 100644 --- a/test/expect/mock-archive-001.log +++ b/test/expect/mock-archive-001.log @@ -125,10 +125,10 @@ P00 DEBUG: storage/storage::storageExists: (this: {type: posix, path: {"/"} P00 DEBUG: storage/storage::storageExists: => false P00 DEBUG: command/control/control::lockStopTest: => void P00 DEBUG: command/archive/get/file::archiveGetCheck: (archiveFile: {"700000007000000070000000"}) -P00 DEBUG: postgres/info::pgControlInfo: (pgPath: {"[TEST_PATH]/db-master/db/base"}) +P00 DEBUG: postgres/interface::pgControlFromFile: (pgPath: {"[TEST_PATH]/db-master/db/base"}) P00 DEBUG: storage/storage::storageGet: (file: {type: posix, name: {"[TEST_PATH]/db-master/db/base/global/pg_control"}, ignoreMissing: false}, param.exactSize: 512) P00 DEBUG: storage/storage::storageGet: => {used: 512, size: 512} -P00 DEBUG: postgres/info::pgControlInfo: => {PgControlInfo} +P00 DEBUG: postgres/interface::pgControlFromFile: => {version: 90400, systemId: 1000000000000000094, walSegmentSize: 16777216, pageChecksum: true} P00 DEBUG: storage/driver/posix/storage::storageDriverPosixNew: (path: {"[TEST_PATH]/db-master/repo"}, modeFile: 0640, modePath: 0750, write: false, pathExpressionFunction: (function *)) P00 DEBUG: storage/driver/posix/storage::storageDriverPosixNew: => {StorageDriverPosix} P00 DEBUG: info/infoArchive::infoArchiveNew: (fileName: {"/archive.info"}, ignoreMissing: false) @@ -169,10 +169,10 @@ P00 DEBUG: storage/storage::storageExists: (this: {type: posix, path: {"/"} P00 DEBUG: storage/storage::storageExists: => false P00 DEBUG: command/control/control::lockStopTest: => void P00 DEBUG: command/archive/get/file::archiveGetCheck: (archiveFile: {"000000010000000100000001"}) -P00 DEBUG: postgres/info::pgControlInfo: (pgPath: {"[TEST_PATH]/db-master/db/base"}) +P00 DEBUG: postgres/interface::pgControlFromFile: (pgPath: {"[TEST_PATH]/db-master/db/base"}) P00 DEBUG: storage/storage::storageGet: (file: {type: posix, name: {"[TEST_PATH]/db-master/db/base/global/pg_control"}, ignoreMissing: false}, param.exactSize: 512) P00 DEBUG: storage/storage::storageGet: => {used: 512, size: 512} -P00 DEBUG: postgres/info::pgControlInfo: => {PgControlInfo} +P00 DEBUG: postgres/interface::pgControlFromFile: => {version: 90400, systemId: 1000000000000000094, walSegmentSize: 16777216, pageChecksum: true} P00 DEBUG: storage/driver/posix/storage::storageDriverPosixNew: (path: {"[TEST_PATH]/db-master/repo"}, modeFile: 0640, modePath: 0750, write: false, pathExpressionFunction: (function *)) P00 DEBUG: storage/driver/posix/storage::storageDriverPosixNew: => {StorageDriverPosix} P00 DEBUG: info/infoArchive::infoArchiveNew: (fileName: {"/archive.info"}, ignoreMissing: false) diff --git a/test/expect/mock-stanza-001.log b/test/expect/mock-stanza-001.log index 223ef8a8f..8b02343c0 100644 --- a/test/expect/mock-stanza-001.log +++ b/test/expect/mock-stanza-001.log @@ -542,10 +542,10 @@ P00 DEBUG: storage/storage::storageExists: (this: {type: posix, path: {"/"} P00 DEBUG: storage/storage::storageExists: => false P00 DEBUG: command/control/control::lockStopTest: => void P00 DEBUG: command/archive/get/file::archiveGetCheck: (archiveFile: {"000000010000000100000002"}) -P00 DEBUG: postgres/info::pgControlInfo: (pgPath: {"[TEST_PATH]/db-master/db/base"}) +P00 DEBUG: postgres/interface::pgControlFromFile: (pgPath: {"[TEST_PATH]/db-master/db/base"}) P00 DEBUG: storage/storage::storageGet: (file: {type: posix, name: {"[TEST_PATH]/db-master/db/base/global/pg_control"}, ignoreMissing: false}, param.exactSize: 512) P00 DEBUG: storage/storage::storageGet: => {used: 512, size: 512} -P00 DEBUG: postgres/info::pgControlInfo: => {PgControlInfo} +P00 DEBUG: postgres/interface::pgControlFromFile: => {version: 90300, systemId: 1000000000000000093, walSegmentSize: 16777216, pageChecksum: true} P00 DEBUG: storage/driver/posix/storage::storageDriverPosixNew: (path: {"[TEST_PATH]/db-master/repo"}, modeFile: 0640, modePath: 0750, write: false, pathExpressionFunction: (function *)) P00 DEBUG: storage/driver/posix/storage::storageDriverPosixNew: => {StorageDriverPosix} P00 DEBUG: info/infoArchive::infoArchiveNew: (fileName: {"/archive.info"}, ignoreMissing: false) @@ -670,7 +670,7 @@ P00 INFO: backup command begin [BACKREST-VERSION]: --compress-level=3 --config P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG (16MB, 33%) checksum 488ba4b8b98acc510bce86b8f16e3c1ed9886a29 P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000002 (16MB, 66%) checksum 488ba4b8b98acc510bce86b8f16e3c1ed9886a29 P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001 (16MB, 99%) checksum e40de8cea99dd469c3efb47f5f33a73c7390fb9c -P01 INFO: backup file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 100%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: backup file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 100%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000000010000000100000002.ready (0B, 100%) P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000000010000000100000001.ready (0B, 100%) P00 INFO: full backup size = 48MB @@ -826,7 +826,7 @@ P00 WARN: no prior backup exists, diff backup has been changed to full P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG (16MB, 33%) checksum 488ba4b8b98acc510bce86b8f16e3c1ed9886a29 P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000002 (16MB, 66%) checksum 488ba4b8b98acc510bce86b8f16e3c1ed9886a29 P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001 (16MB, 99%) checksum 65b64687e7bfd1a918c6144f84a133f03e50ac57 -P01 INFO: backup file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 100%) checksum b03a64b1be549a32d53d41dd40ab394ba82fa1c1 +P01 INFO: backup file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 100%) checksum 4969435f3b36bfaa0f5a486bef97f1988a135520 P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000000010000000100000002.ready (0B, 100%) P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000000010000000100000001.ready (0B, 100%) P00 INFO: full backup size = 48MB diff --git a/test/expect/mock-stanza-002.log b/test/expect/mock-stanza-002.log index 6447feba6..a00897922 100644 --- a/test/expect/mock-stanza-002.log +++ b/test/expect/mock-stanza-002.log @@ -452,7 +452,7 @@ P00 INFO: backup command begin [BACKREST-VERSION]: --compress-level=3 --compre P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG (16MB, 33%) checksum 488ba4b8b98acc510bce86b8f16e3c1ed9886a29 P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000002 (16MB, 66%) checksum 488ba4b8b98acc510bce86b8f16e3c1ed9886a29 P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001 (16MB, 99%) checksum e40de8cea99dd469c3efb47f5f33a73c7390fb9c -P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/global/pg_control (8KB, 100%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/global/pg_control (8KB, 100%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000000010000000100000002.ready (0B, 100%) P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000000010000000100000001.ready (0B, 100%) P00 INFO: full backup size = 48MB @@ -630,7 +630,7 @@ P00 WARN: no prior backup exists, diff backup has been changed to full P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG (16MB, 33%) checksum 488ba4b8b98acc510bce86b8f16e3c1ed9886a29 P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000002 (16MB, 66%) checksum 488ba4b8b98acc510bce86b8f16e3c1ed9886a29 P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001 (16MB, 99%) checksum 65b64687e7bfd1a918c6144f84a133f03e50ac57 -P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/global/pg_control (8KB, 100%) checksum b03a64b1be549a32d53d41dd40ab394ba82fa1c1 +P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/global/pg_control (8KB, 100%) checksum 4969435f3b36bfaa0f5a486bef97f1988a135520 P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000000010000000100000002.ready (0B, 100%) P01 INFO: backup file db-master:[TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000000010000000100000001.ready (0B, 100%) P00 INFO: full backup size = 48MB diff --git a/test/expect/mock-stanza-003.log b/test/expect/mock-stanza-003.log index e3f12a8b7..19159ae3b 100644 --- a/test/expect/mock-stanza-003.log +++ b/test/expect/mock-stanza-003.log @@ -647,7 +647,7 @@ P00 INFO: backup command begin [BACKREST-VERSION]: --compress-level=3 --config P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG (16MB, 33%) checksum 488ba4b8b98acc510bce86b8f16e3c1ed9886a29 P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000002 (16MB, 66%) checksum 488ba4b8b98acc510bce86b8f16e3c1ed9886a29 P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001 (16MB, 99%) checksum e40de8cea99dd469c3efb47f5f33a73c7390fb9c -P01 INFO: backup file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 100%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: backup file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 100%) checksum 4c77c900f7af0d9ab13fa9982051a42e0b637f6c P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000000010000000100000002.ready (0B, 100%) P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000000010000000100000001.ready (0B, 100%) P00 INFO: full backup size = 48MB @@ -810,7 +810,7 @@ P00 WARN: no prior backup exists, diff backup has been changed to full P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG (16MB, 33%) checksum 488ba4b8b98acc510bce86b8f16e3c1ed9886a29 P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000002 (16MB, 66%) checksum 488ba4b8b98acc510bce86b8f16e3c1ed9886a29 P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001 (16MB, 99%) checksum 65b64687e7bfd1a918c6144f84a133f03e50ac57 -P01 INFO: backup file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 100%) checksum b03a64b1be549a32d53d41dd40ab394ba82fa1c1 +P01 INFO: backup file [TEST_PATH]/db-master/db/base/global/pg_control (8KB, 100%) checksum 4969435f3b36bfaa0f5a486bef97f1988a135520 P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000000010000000100000002.ready (0B, 100%) P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000000010000000100000001.ready (0B, 100%) P00 INFO: full backup size = 48MB diff --git a/test/lib/pgBackRestTest/Env/ExpireEnvTest.pm b/test/lib/pgBackRestTest/Env/ExpireEnvTest.pm index 301dd63d0..077bee9b8 100644 --- a/test/lib/pgBackRestTest/Env/ExpireEnvTest.pm +++ b/test/lib/pgBackRestTest/Env/ExpireEnvTest.pm @@ -62,6 +62,8 @@ sub new {name => 'oRunTest', required => false, trace => true}, ); + $self->{strVm} = $self->{oRunTest}->vm(); + # Return from function and log return values if any return logDebugReturn ( diff --git a/test/lib/pgBackRestTest/Env/Host/HostDbTest.pm b/test/lib/pgBackRestTest/Env/Host/HostDbTest.pm index f43c2d8fd..2cd82f690 100644 --- a/test/lib/pgBackRestTest/Env/Host/HostDbTest.pm +++ b/test/lib/pgBackRestTest/Env/Host/HostDbTest.pm @@ -351,6 +351,7 @@ sub clusterCreate $self->pgBinPath() . '/initdb ' . ($self->pgVersion() >= PG_VERSION_93 ? ' -k' : '') . ($self->pgVersion() >= PG_VERSION_92 ? ' --' . $self->walId() . "dir=${strWalPath}" : '') . + ($self->pgVersion() >= PG_VERSION_11 ? ' --wal-segsize=1' : '') . ' --pgdata=' . $self->dbBasePath() . ' --auth=trust'); if (!$self->standby() && $self->pgVersion() >= PG_VERSION_HOT_STANDBY) diff --git a/test/lib/pgBackRestTest/Env/HostEnvTest.pm b/test/lib/pgBackRestTest/Env/HostEnvTest.pm index 66e4dc650..d9f2ae4a8 100644 --- a/test/lib/pgBackRestTest/Env/HostEnvTest.pm +++ b/test/lib/pgBackRestTest/Env/HostEnvTest.pm @@ -319,6 +319,48 @@ sub controlGenerateContent $tControlContent .= pack('L', $self->dbControlVersion($strPgVersion)); $tControlContent .= pack('L', $self->dbCatalogVersion($strPgVersion)); + # Offset to page size by archecture bits and version + my $rhOffsetToPageSize = + { + 32 => + { + '8.3' => 96 - length($tControlContent), + '8.4' => 104 - length($tControlContent), + '9.0' => 140 - length($tControlContent), + '9.1' => 140 - length($tControlContent), + '9.2' => 156 - length($tControlContent), + '9.3' => 180 - length($tControlContent), + '9.4' => 188 - length($tControlContent), + '9.5' => 200 - length($tControlContent), + '9.6' => 200 - length($tControlContent), + '10' => 200 - length($tControlContent), + '11' => 192 - length($tControlContent), + }, + + 64 => + { + '8.3' => 112 - length($tControlContent), + '8.4' => 112 - length($tControlContent), + '9.0' => 152 - length($tControlContent), + '9.1' => 152 - length($tControlContent), + '9.2' => 168 - length($tControlContent), + '9.3' => 192 - length($tControlContent), + '9.4' => 200 - length($tControlContent), + '9.5' => 216 - length($tControlContent), + '9.6' => 216 - length($tControlContent), + '10' => 216 - length($tControlContent), + '11' => 208 - length($tControlContent), + }, + }; + + # Fill up to page size and set page size + $tControlContent .= ('C' x $rhOffsetToPageSize->{$self->archBits()}{$strPgVersion}); + $tControlContent .= pack('L', 8192); + + # Fill up to wal segment size and set wal segment size + $tControlContent .= ('C' x 8); + $tControlContent .= pack('L', 16 * 1024 * 1024); + # Pad bytes $tControlContent .= ('C' x (8192 - length($tControlContent))); diff --git a/test/lib/pgBackRestTest/Module/Archive/ArchiveCommonPerlTest.pm b/test/lib/pgBackRestTest/Module/Archive/ArchiveCommonPerlTest.pm index 18d51a012..c4b4ba0ec 100644 --- a/test/lib/pgBackRestTest/Module/Archive/ArchiveCommonPerlTest.pm +++ b/test/lib/pgBackRestTest/Module/Archive/ArchiveCommonPerlTest.pm @@ -17,6 +17,7 @@ use pgBackRest::Archive::Common; use pgBackRest::Common::Exception; use pgBackRest::Common::Log; use pgBackRest::Config::Config; +use pgBackRest::DbVersion; use pgBackRest::Protocol::Storage::Helper; use pgBackRestTest::Env::Host::HostBackupTest; @@ -29,6 +30,26 @@ sub run my $self = shift; my $strModule = 'ArchiveCommon'; + ################################################################################################################################ + if ($self->begin("${strModule}::lsnFileRange()")) + { + $self->testResult(sub {lsnFileRange("1/60", "1/60", PG_VERSION_92, 16 * 1024 * 1024)}, "0000000100000000", 'get single'); + $self->testResult( + sub {lsnFileRange("1/FD000000", "2/1000000", PG_VERSION_92, 16 * 1024 * 1024)}, + "(00000001000000FD, 00000001000000FE, 0000000200000000, 0000000200000001)", 'get range < 9.3'); + $self->testResult( + sub {lsnFileRange("1/FD000000", "2/60", PG_VERSION_93, 16 * 1024 * 1024)}, + "(00000001000000FD, 00000001000000FE, 00000001000000FF, 0000000200000000)", 'get range >= 9.3'); + $self->testResult( + sub {lsnFileRange("A/800", "B/C0000000", PG_VERSION_11, 1024 * 1024 * 1024)}, + '(0000000A00000000, 0000000A00000001, 0000000A00000002, 0000000A00000003, 0000000B00000000, 0000000B00000001, ' . + '0000000B00000002, 0000000B00000003)', + 'get range >= 11/1GB'); + $self->testResult( + sub {lsnFileRange("7/FFEFFFFF", "8/001AAAAA", PG_VERSION_11, 1024 * 1024)}, + '(0000000700000FFE, 0000000700000FFF, 0000000800000000, 0000000800000001)', 'get range >= 11/1MB'); + } + ################################################################################################################################ if ($self->begin("${strModule}::walPath()")) { diff --git a/test/lib/pgBackRestTest/Module/Backup/BackupFileUnitPerlTest.pm b/test/lib/pgBackRestTest/Module/Backup/BackupFileUnitPerlTest.pm index 0f92d8825..da5908ca8 100644 --- a/test/lib/pgBackRestTest/Module/Backup/BackupFileUnitPerlTest.pm +++ b/test/lib/pgBackRestTest/Module/Backup/BackupFileUnitPerlTest.pm @@ -84,7 +84,8 @@ sub run my $strRepoFile = MANIFEST_TARGET_PGDATA . "/$strFileName"; my $strRepoPgControl = MANIFEST_FILE_PGCONTROL; my $strPgControlRepo = storageRepo()->pathGet(STORAGE_REPO_BACKUP . "/$strBackupLabel/$strRepoPgControl"); - my $strPgControlHash = 'b4a3adade1e81ebfc7e9a27bca0887a347d81522'; + my $strPgControlHash = + $self->archBits() == 32 ? '8107e546c59c72a8c1818fc3610d7cc1e5623660' : '4c77c900f7af0d9ab13fa9982051a42e0b637f6c'; # Copy file to db path executeTest('cp ' . $self->dataPath() . "/filecopy.archive2.bin ${strFileDb}"); @@ -123,7 +124,6 @@ sub run ################################################################################################################################ if ($self->begin('backupFile(), backupManifestUpdate()')) { - #--------------------------------------------------------------------------------------------------------------------------- # Copy pg_control and confirm manifestUpdate does not save the manifest yet ($iResultCopyResult, $lResultCopySize, $lResultRepoSize, $strResultCopyChecksum, $rResultExtra) = diff --git a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm index d848f654b..4b94031f8 100644 --- a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm +++ b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm @@ -207,8 +207,10 @@ sub run # Create global path $oHostDbMaster->manifestPathCreate(\%oManifest, MANIFEST_TARGET_PGDATA, 'global'); - $oHostDbMaster->manifestFileCreate(\%oManifest, MANIFEST_TARGET_PGDATA, DB_FILE_PGCONTROL, '[replaceme]', - 'b4a3adade1e81ebfc7e9a27bca0887a347d81522', $lTime - 100, undef, true); + $oHostDbMaster->manifestFileCreate( + \%oManifest, MANIFEST_TARGET_PGDATA, DB_FILE_PGCONTROL, '[replaceme]', + $self->archBits() == 32 ? '8107e546c59c72a8c1818fc3610d7cc1e5623660' : '4c77c900f7af0d9ab13fa9982051a42e0b637f6c', + $lTime - 100, undef, true); # Copy pg_control $self->controlGenerate($oHostDbMaster->dbBasePath(), PG_VERSION_94); diff --git a/test/src/module/archive/getTest.c b/test/src/module/archive/getTest.c index 62028ffeb..3019337c6 100644 --- a/test/src/module/archive/getTest.c +++ b/test/src/module/archive/getTest.c @@ -1,7 +1,7 @@ /*********************************************************************************************************************************** Test Archive Get Command ***********************************************************************************************************************************/ -#include "postgres/type.h" +#include "postgres/interface.h" #include "postgres/version.h" #include "common/harnessConfig.h" @@ -9,19 +9,6 @@ Test Archive Get Command #include "compress/gzipCompress.h" #include "storage/driver/posix/storage.h" -/*********************************************************************************************************************************** -Create test pg_control file -***********************************************************************************************************************************/ -static void -testPgControlCreate(const Storage *storage, const String *controlFile, PgControlFile control) -{ - Buffer *controlBuffer = bufNew(8192); - memset(bufPtr(controlBuffer), 0, bufSize(controlBuffer)); - memcpy(bufPtr(controlBuffer), &control, sizeof(PgControlFile)); - bufUsedSet(controlBuffer, bufSize(controlBuffer)); - storagePutNP(storageNewWriteNP(storage, controlFile), controlBuffer); -} - /*********************************************************************************************************************************** Test Run ***********************************************************************************************************************************/ @@ -46,9 +33,9 @@ testRun(void) harnessCfgLoad(strLstSize(argList), strLstPtr(argList)); // Create pg_control file - testPgControlCreate( - storageTest, strNew("db/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL), - (PgControlFile){.systemId = 0xFACEFACEFACEFACE, .controlVersion = 1002, .catalogVersion = 201707211}); + storagePutNP( + storageNewWriteNP(storageTest, strNew("db/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL)), + pgControlTestToBuffer((PgControl){.version = PG_VERSION_10, .systemId = 0xFACEFACEFACEFACE})); // Control and archive info mismatch // ------------------------------------------------------------------------------------------------------------------------- @@ -135,9 +122,9 @@ testRun(void) harnessCfgLoad(strLstSize(argList), strLstPtr(argList)); // Create pg_control file - testPgControlCreate( - storageTest, strNew("db/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL), - (PgControlFile){.systemId = 0xFACEFACEFACEFACE, .controlVersion = 1002, .catalogVersion = 201707211}); + storagePutNP( + storageNewWriteNP(storageTest, strNew("db/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL)), + pgControlTestToBuffer((PgControl){.version = PG_VERSION_10, .systemId = 0xFACEFACEFACEFACE})); // Create archive.info storagePutNP( @@ -211,8 +198,8 @@ testRun(void) strLstAddZ(argList, "archive-get"); harnessCfgLoad(strLstSize(argList), strLstPtr(argList)); - size_t queueSize = WAL_SEGMENT_DEFAULT_SIZE; - size_t walSegmentSize = WAL_SEGMENT_DEFAULT_SIZE; + size_t queueSize = 16 * 1024 * 1024; + size_t walSegmentSize = 16 * 1024 * 1024; TEST_ERROR_FMT( queueNeed(strNew("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92), @@ -226,7 +213,7 @@ testRun(void) "000000010000000100000001|000000010000000100000002", "queue size smaller than min"); // ------------------------------------------------------------------------------------------------------------------------- - queueSize = WAL_SEGMENT_DEFAULT_SIZE * 3; + queueSize = (16 * 1024 * 1024) * 3; TEST_RESULT_STR( strPtr(strLstJoin(queueNeed(strNew("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92), "|")), @@ -296,9 +283,9 @@ testRun(void) TEST_ERROR(cmdArchiveGet(), ParamRequiredError, "path to copy WAL segment required"); // ------------------------------------------------------------------------------------------------------------------------- - testPgControlCreate( - storageTest, strNew("db/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL), - (PgControlFile){.systemId = 0xFACEFACEFACEFACE, .controlVersion = 1002, .catalogVersion = 201707211}); + storagePutNP( + storageNewWriteNP(storageTest, strNew("db/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL)), + pgControlTestToBuffer((PgControl){.version = PG_VERSION_10, .systemId = 0xFACEFACEFACEFACE})); storagePathCreateNP(storageTest, strNewFmt("%s/db/pg_wal", testPath())); diff --git a/test/src/module/postgres/infoTest.c b/test/src/module/postgres/infoTest.c deleted file mode 100644 index 2ed10a47e..000000000 --- a/test/src/module/postgres/infoTest.c +++ /dev/null @@ -1,85 +0,0 @@ -/*********************************************************************************************************************************** -Test PostgreSQL Info -***********************************************************************************************************************************/ -#include "storage/driver/posix/storage.h" - -/*********************************************************************************************************************************** -Test Run -***********************************************************************************************************************************/ -void -testRun(void) -{ - FUNCTION_HARNESS_VOID(); - - Storage *storageTest = storageDriverPosixInterface( - storageDriverPosixNew(strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL)); - - // ***************************************************************************************************************************** - if (testBegin("pgVersionMap()")) - { - TEST_RESULT_INT(pgVersionMap( 833, 200711281), PG_VERSION_83, " check version 8.3"); - TEST_RESULT_INT(pgVersionMap( 843, 200904091), PG_VERSION_84, " check version 8.4"); - TEST_RESULT_INT(pgVersionMap( 903, 201008051), PG_VERSION_90, " check version 9.0"); - TEST_RESULT_INT(pgVersionMap( 903, 201105231), PG_VERSION_91, " check version 9.1"); - TEST_RESULT_INT(pgVersionMap( 922, 201204301), PG_VERSION_92, " check version 9.2"); - TEST_RESULT_INT(pgVersionMap( 937, 201306121), PG_VERSION_93, " check version 9.3"); - TEST_RESULT_INT(pgVersionMap( 942, 201409291), PG_VERSION_94, " check version 9.4"); - TEST_RESULT_INT(pgVersionMap( 942, 201510051), PG_VERSION_95, " check version 9.5"); - TEST_RESULT_INT(pgVersionMap( 960, 201608131), PG_VERSION_96, " check version 9.6"); - TEST_RESULT_INT(pgVersionMap(1002, 201707211), PG_VERSION_10, " check version 10"); - TEST_RESULT_INT(pgVersionMap(1100, 201809051), PG_VERSION_11, " check version 11"); - - // ------------------------------------------------------------------------------------------------------------------------- - #define MAP_ERROR \ - "unexpected control version = %d and catalog version = 0\n" \ - "HINT: is this version of PostgreSQL supported?" - - TEST_ERROR_FMT(pgVersionMap( 0, 0), VersionNotSupportedError, MAP_ERROR, 0); - TEST_ERROR_FMT(pgVersionMap( 833, 0), VersionNotSupportedError, MAP_ERROR, 833); - TEST_ERROR_FMT(pgVersionMap( 843, 0), VersionNotSupportedError, MAP_ERROR, 843); - TEST_ERROR_FMT(pgVersionMap( 903, 0), VersionNotSupportedError, MAP_ERROR, 903); - TEST_ERROR_FMT(pgVersionMap( 922, 0), VersionNotSupportedError, MAP_ERROR, 922); - TEST_ERROR_FMT(pgVersionMap( 937, 0), VersionNotSupportedError, MAP_ERROR, 937); - TEST_ERROR_FMT(pgVersionMap( 942, 0), VersionNotSupportedError, MAP_ERROR, 942); - TEST_ERROR_FMT(pgVersionMap( 960, 0), VersionNotSupportedError, MAP_ERROR, 960); - TEST_ERROR_FMT(pgVersionMap(1002, 0), VersionNotSupportedError, MAP_ERROR, 1002); - TEST_ERROR_FMT(pgVersionMap(1100, 0), VersionNotSupportedError, MAP_ERROR, 1100); - } - - // ***************************************************************************************************************************** - if (testBegin("pgVersionFromStr() and pgVersionToStr()")) - { - TEST_ERROR(pgVersionFromStr(strNew("9.3.4")), AssertError, "version 9.3.4 format is invalid"); - TEST_ERROR(pgVersionFromStr(strNew("abc")), AssertError, "version abc format is invalid"); - TEST_ERROR(pgVersionFromStr(NULL), AssertError, "function debug assertion 'version != NULL' failed"); - - TEST_RESULT_INT(pgVersionFromStr(strNew("10")), PG_VERSION_10, "valid pg version 10"); - TEST_RESULT_INT(pgVersionFromStr(strNew("9.6")), 90600, "valid pg version 9.6"); - - //-------------------------------------------------------------------------------------------------------------------------- - TEST_RESULT_STR(strPtr(pgVersionToStr(PG_VERSION_11)), "11", "infoPgVersionToString 11"); - TEST_RESULT_STR(strPtr(pgVersionToStr(PG_VERSION_96)), "9.6", "infoPgVersionToString 9.6"); - TEST_RESULT_STR(strPtr(pgVersionToStr(83456)), "8.34", "infoPgVersionToString 83456"); - } - - // ***************************************************************************************************************************** - if (testBegin("pgControlInfo()")) - { - String *controlFile = strNew(PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL); - PgControlFile control = {.systemId = 0xFACEFACE, .controlVersion = 833, .catalogVersion = 200711281}; - Buffer *controlBuffer = bufNew(512); - memset(bufPtr(controlBuffer), 0, bufSize(controlBuffer)); - memcpy(bufPtr(controlBuffer), &control, sizeof(PgControlFile)); - bufUsedSet(controlBuffer, bufSize(controlBuffer)); - storagePutNP(storageNewWriteNP(storageTest, controlFile), controlBuffer); - - PgControlInfo info = {0}; - TEST_ASSIGN(info, pgControlInfo(strNew(testPath())), "get control info"); - TEST_RESULT_INT(info.systemId, 0xFACEFACE, " check system id"); - TEST_RESULT_INT(info.controlVersion, 833, " check control version"); - TEST_RESULT_INT(info.catalogVersion, 200711281, " check catalog version"); - TEST_RESULT_INT(info.version, PG_VERSION_83, " check version"); - } - - FUNCTION_HARNESS_RESULT_VOID(); -} diff --git a/test/src/module/postgres/interfaceTest.c b/test/src/module/postgres/interfaceTest.c new file mode 100644 index 000000000..d60bb910f --- /dev/null +++ b/test/src/module/postgres/interfaceTest.c @@ -0,0 +1,93 @@ +/*********************************************************************************************************************************** +Test PostgreSQL Interface +***********************************************************************************************************************************/ +#include "storage/driver/posix/storage.h" + +/*********************************************************************************************************************************** +Test Run +***********************************************************************************************************************************/ +void +testRun(void) +{ + FUNCTION_HARNESS_VOID(); + + Storage *storageTest = storageDriverPosixInterface( + storageDriverPosixNew(strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL)); + + // ***************************************************************************************************************************** + if (testBegin("pgVersionFromStr() and pgVersionToStr()")) + { + TEST_ERROR(pgVersionFromStr(strNew("9.3.4")), AssertError, "version 9.3.4 format is invalid"); + TEST_ERROR(pgVersionFromStr(strNew("abc")), AssertError, "version abc format is invalid"); + TEST_ERROR(pgVersionFromStr(NULL), AssertError, "function debug assertion 'version != NULL' failed"); + + TEST_RESULT_INT(pgVersionFromStr(strNew("10")), PG_VERSION_10, "valid pg version 10"); + TEST_RESULT_INT(pgVersionFromStr(strNew("9.6")), 90600, "valid pg version 9.6"); + + //-------------------------------------------------------------------------------------------------------------------------- + TEST_RESULT_STR(strPtr(pgVersionToStr(PG_VERSION_11)), "11", "infoPgVersionToString 11"); + TEST_RESULT_STR(strPtr(pgVersionToStr(PG_VERSION_96)), "9.6", "infoPgVersionToString 9.6"); + TEST_RESULT_STR(strPtr(pgVersionToStr(83456)), "8.34", "infoPgVersionToString 83456"); + } + + // ***************************************************************************************************************************** + if (testBegin("pgControlFromBuffer() and pgControlFromFile()")) + { + String *controlFile = strNew(PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL); + + // Create a bogus control file + Buffer *result = bufNew(PG_CONTROL_SIZE); + memset(bufPtr(result), 0, bufSize(result)); + bufUsedSet(result, bufSize(result)); + ((PgControlCommon *)bufPtr(result))->controlVersion = 501; + ((PgControlCommon *)bufPtr(result))->catalogVersion = 19780101; + + TEST_ERROR( + pgControlFromBuffer(result), VersionNotSupportedError, + "unexpected control version = 501 and catalog version = 19780101\nHINT: is this version of PostgreSQL supported?"); + + //-------------------------------------------------------------------------------------------------------------------------- + TEST_ERROR(pgControlTestToBuffer((PgControl){.version = 0}), AssertError, "invalid version 0"); + + //-------------------------------------------------------------------------------------------------------------------------- + storagePutNP( + storageNewWriteNP(storageTest, controlFile), + pgControlTestToBuffer((PgControl){.version = PG_VERSION_11, .systemId = 0xFACEFACE, .walSegmentSize = 1024 * 1024})); + + PgControl info = {0}; + TEST_ASSIGN(info, pgControlFromFile(strNew(testPath())), "get control info v11"); + TEST_RESULT_INT(info.systemId, 0xFACEFACE, " check system id"); + TEST_RESULT_INT(info.controlVersion, 1100, " check control version"); + TEST_RESULT_INT(info.catalogVersion, 201809051, " check catalog version"); + TEST_RESULT_INT(info.version, PG_VERSION_11, " check version"); + + //-------------------------------------------------------------------------------------------------------------------------- + storagePutNP( + storageNewWriteNP(storageTest, controlFile), + pgControlTestToBuffer((PgControl){.version = PG_VERSION_93, .walSegmentSize = 1024 * 1024})); + + TEST_ERROR( + pgControlFromFile(strNew(testPath())), FormatError, + "wal segment size is 1048576 but must be 16777216 for PostgreSQL <= 10"); + + //-------------------------------------------------------------------------------------------------------------------------- + storagePutNP( + storageNewWriteNP(storageTest, controlFile), + pgControlTestToBuffer((PgControl){.version = PG_VERSION_95, .pageSize = 32 * 1024})); + + TEST_ERROR(pgControlFromFile(strNew(testPath())), FormatError, "page size is 32768 but must be 8192"); + + //-------------------------------------------------------------------------------------------------------------------------- + storagePutNP( + storageNewWriteNP(storageTest, controlFile), + pgControlTestToBuffer((PgControl){.version = PG_VERSION_83, .systemId = 0xEFEFEFEFEF})); + + TEST_ASSIGN(info, pgControlFromFile(strNew(testPath())), "get control info v83"); + TEST_RESULT_INT(info.systemId, 0xEFEFEFEFEF, " check system id"); + TEST_RESULT_INT(info.controlVersion, 833, " check control version"); + TEST_RESULT_INT(info.catalogVersion, 200711281, " check catalog version"); + TEST_RESULT_INT(info.version, PG_VERSION_83, " check version"); + } + + FUNCTION_HARNESS_RESULT_VOID(); +}