1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-05 00:28:52 +02:00

Allow alternative WAL segment sizes for PostgreSQL <= 10.

Alternative WAL segment sizes can be configured in PostgreSQL <= 10 with compile-time options. We have not allowed these before since it was not a well-tested feature of PostgreSQL.

However, forks such as Greenplum allow alternative WAL segment sizes at initdb time (which are presumably well-tested) so it makes sense to allow it.

Since the PostgreSQL versions in question are all EOL it is not important to have this restriction in place anymore.
This commit is contained in:
Viktor Kurilko
2024-06-11 12:08:52 +10:00
committed by David Steele
parent e8b965756c
commit 4ac3b82c99
8 changed files with 31 additions and 43 deletions

View File

@ -169,20 +169,12 @@ pgDbIsSystemId(const unsigned int id)
Check expected WAL segment size for older PostgreSQL versions
***********************************************************************************************************************************/
static void
pgWalSegmentSizeCheck(const unsigned int pgVersion, const unsigned int walSegmentSize)
pgWalSegmentSizeCheck(const unsigned int walSegmentSize)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(UINT, pgVersion);
FUNCTION_TEST_PARAM(UINT, walSegmentSize);
FUNCTION_TEST_END();
if (pgVersion < PG_VERSION_11 && walSegmentSize != PG_WAL_SEGMENT_SIZE_DEFAULT)
{
THROW_FMT(
FormatError, "wal segment size is %u but must be %u for " PG_NAME " <= " PG_VERSION_10_Z, walSegmentSize,
PG_WAL_SEGMENT_SIZE_DEFAULT);
}
// Check that the WAL segment size is valid
if (!IsValidWalSegSize(walSegmentSize))
{
@ -326,7 +318,7 @@ pgControlFromBuffer(const Buffer *const controlFile, const String *const pgVersi
pgControlCrcValidate(controlFile, interface, pgVersionForce != NULL);
// Check the segment size
pgWalSegmentSizeCheck(result.version, result.walSegmentSize);
pgWalSegmentSizeCheck(result.walSegmentSize);
// Check the page size
pgPageSizeCheck(result.pageSize);
@ -529,7 +521,7 @@ pgWalFromBuffer(const Buffer *const walBuffer, const String *const pgVersionForc
result.version = interface->version;
// Check the segment size
pgWalSegmentSizeCheck(result.version, result.size);
pgWalSegmentSizeCheck(result.size);
FUNCTION_LOG_RETURN(PG_WAL, result);
}

View File

@ -86,14 +86,6 @@ something far larger needed but <= the minimum read size on just about any syste
***********************************************************************************************************************************/
#define PG_WAL_HEADER_SIZE ((unsigned int)(512))
/***********************************************************************************************************************************
Define default wal segment size
Before PostgreSQL 11 WAL segment size could only be changed at compile time and is not known to be well-tested, so only the default
WAL segment size is supported for versions below 11.
***********************************************************************************************************************************/
#define PG_WAL_SEGMENT_SIZE_DEFAULT ((unsigned int)(16 * 1024 * 1024))
/***********************************************************************************************************************************
Checkpoint written into pg_control on restore. This will prevent PostgreSQL from starting if backup_label is not present.
***********************************************************************************************************************************/