1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-17 01:12:23 +02:00

Use PG_PAGE_SIZE_DEFAULT constant instead of pageSize variable.

Page size is passed around a lot but in fact it can only have one value, PG_PAGE_SIZE_DEFAULT, which is checked when pg_control is loaded. There may be an argument for supporting multiple page sizes in the future but for now just use the constant to simplify the code.

There is also a significant performance benefit.  Because pageSize was being used in pageChecksumBlock() the main loop was neither unrolled nor vectorized (-funroll-loops -ftree-vectorize) as it is now with a constant loop boundary.
This commit is contained in:
David Steele
2020-03-05 09:14:27 -05:00
parent 91f321fb86
commit 4ab8943ca8
13 changed files with 48 additions and 65 deletions

View File

@ -49,7 +49,7 @@ sub pageBuild
my $iWalOffset = shift;
my $tPage = defined($iWalId) ? pack('I', $iWalId) . pack('I', $iWalOffset) . substr($tPageSource, 8) : $tPageSource;
my $iChecksum = pgPageChecksum($tPage, $iBlockNo, length($tPage));
my $iChecksum = pgPageChecksum($tPage, $iBlockNo);
return substr($tPage, 0, 8) . pack('S', $iChecksum) . substr($tPage, 10);
}