1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-03 00:26:59 +02:00

Support configurable WAL segment size.

PostgreSQL 11 introduces configurable WAL segment sizes, from 1MB to 1GB.

There are two areas that needed to be updated to support this: building the archive-get queue and checking that WAL has been archived after a backup.  Both operations require the WAL segment size to properly build a list.

Checking the archive after a backup is still implemented in Perl and has an active database connection, so just get the WAL segment size from the database.

The archive-get command does not have a connection to the database, so get the WAL segment size from pg_control instead.  This requires a deeper inspection of pg_control than has been done in the past, so it seemed best to copy the relevant data structures from each version of PostgreSQL and build a generic interface layer to address them.  While this approach is a bit verbose, it has the advantage of being relatively simple, and can easily be updated for new versions of PostgreSQL.

Since the integration tests generate pg_control files for testing, teach Perl how to generate files with the correct offsets for both 32-bit and 64-bit architectures.
This commit is contained in:
David Steele
2018-09-25 10:24:42 +01:00
parent c0b0b4e541
commit d038b9a029
68 changed files with 4949 additions and 486 deletions

View File

@ -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();