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

Remove obsolete function pageChecksumBufferTest().

This function made validation faster in Perl because fewer calls (and buffer transformations) were required when all checksums were valid.

In C calling pageChecksumTest() directly is just as efficient so there is no longer a need for pageChecksumBufferTest().
This commit is contained in:
David Steele
2020-03-04 14:12:02 -05:00
parent 9d48882268
commit a86253f112
4 changed files with 1 additions and 89 deletions

View File

@ -206,42 +206,3 @@ pageChecksumTest(
// Checksum is valid if a full page
(pageSize == PG_PAGE_SIZE_DEFAULT && ((PageHeader)page)->pd_checksum == pageChecksum(page, blockNo, pageSize)));
}
/***********************************************************************************************************************************
pageChecksumBufferTest - test if checksums are valid for all pages in a buffer
***********************************************************************************************************************************/
bool
pageChecksumBufferTest(
const unsigned char *pageBuffer, unsigned int pageBufferSize, unsigned int blockNoBegin, unsigned int pageSize,
uint32_t ignoreWalId, uint32_t ignoreWalOffset)
{
FUNCTION_LOG_BEGIN(logLevelTrace);
FUNCTION_LOG_PARAM_P(UCHARDATA, pageBuffer);
FUNCTION_LOG_PARAM(UINT, pageBufferSize);
FUNCTION_LOG_PARAM(UINT, blockNoBegin);
FUNCTION_LOG_PARAM(UINT, pageSize);
FUNCTION_LOG_PARAM(UINT32, ignoreWalId);
FUNCTION_LOG_PARAM(UINT32, ignoreWalOffset);
FUNCTION_LOG_END();
ASSERT(pageBuffer != NULL);
ASSERT(pageBufferSize > 0);
ASSERT(pageBufferSize % pageSize == 0);
bool result = true;
// Loop through all pages in the buffer
for (unsigned int pageIdx = 0; pageIdx < pageBufferSize / pageSize; pageIdx++)
{
const unsigned char *page = pageBuffer + (pageIdx * pageSize);
// Return false if the checksums do not match
if (!pageChecksumTest(page, blockNoBegin + pageIdx, pageSize, ignoreWalId, ignoreWalOffset))
{
result = false;
break;
}
}
FUNCTION_LOG_RETURN(BOOL, result);
}