You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-11-05 04:30:41 +03:00
Add timeline and checkpoint checks to backup.
Add the following checks: * Checkpoint is updated in pg_control after pg_start_backup(). This helps ensure that PostgreSQL and pgBackRest have a consistent view of the storage and that PGDATA paths match. * Timeline of backup start WAL file matches pg_control. Hard to see how this one could get hit, but we have the power... * Standby is on the same timeline as the primary. If not, this standby is not following the primary. * Last standby checkpoint is not greater than the backup checkpoint. If so, this standby is not following the primary. This also requires some additional plumbing to read/write timeline/checkpoint from pg_control and parse timelines from WAL filenames. There were some changes in the backup tests caused by the fact that pg_control now has different contents for each backup. The check to ensure that the required checkpoint was reached on the standby should also be updated to use pg_control (it currently uses pg_control_checkpoint()), but that requires non-trivial changes to the test harness and will need to wait.
This commit is contained in:
@@ -540,6 +540,25 @@ pgLsnFromWalSegment(const String *walSegment, unsigned int walSegmentSize)
|
||||
(cvtZToUInt64Base(strZ(strSubN(walSegment, 16, 8)), 16) * walSegmentSize));
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
uint32_t
|
||||
pgTimelineFromWalSegment(const String *const walSegment)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STRING, walSegment);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(walSegment != NULL);
|
||||
ASSERT(strSize(walSegment) == 24);
|
||||
|
||||
char buffer[9];
|
||||
|
||||
strncpy(buffer, strZ(walSegment), sizeof(buffer) - 1);
|
||||
buffer[sizeof(buffer) - 1] = '\0';
|
||||
|
||||
FUNCTION_TEST_RETURN(cvtZToUIntBase(buffer, 16));
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
StringList *
|
||||
pgLsnRangeToWalSegmentList(
|
||||
|
||||
Reference in New Issue
Block a user