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

Remove invalid const in pgPageChecksum() parameter.

pgPageChecksum() must modify the page header in order to calculate the checksum.  The modification is temporary but make it clear that it happens by removing the const.

Also make a note about our non-entirely-kosher usage of a const Buffer in the PageChecksum filter.  This is safe as currently coded but at the least we need to be aware of what is going on.
This commit is contained in:
David Steele
2020-03-05 11:14:53 -05:00
parent 4ab8943ca8
commit 77853d3c13
4 changed files with 11 additions and 7 deletions

View File

@ -101,7 +101,7 @@ do { \
} while (0)
static uint32_t
pageChecksumBlock(const unsigned char *page)
pageChecksumBlock(unsigned char *page)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM_P(UCHARDATA, page);
@ -141,7 +141,7 @@ The checksum includes the block number (to detect the case where a page is someh
(excluding the checksum itself), and the page data.
***********************************************************************************************************************************/
uint16_t
pgPageChecksum(const unsigned char *page, unsigned int blockNo)
pgPageChecksum(unsigned char *page, unsigned int blockNo)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM_P(UCHARDATA, page);
@ -184,7 +184,7 @@ pageChecksumTest - test if checksum is valid for a single page
***********************************************************************************************************************************/
bool
pgPageChecksumTest(
const unsigned char *page, unsigned int blockNo, unsigned int pageSize, uint32_t ignoreWalId, uint32_t ignoreWalOffset)
unsigned char *page, unsigned int blockNo, unsigned int pageSize, uint32_t ignoreWalId, uint32_t ignoreWalOffset)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM_P(UCHARDATA, page);

View File

@ -9,9 +9,9 @@ Checksum Implementation for Data Pages
/***********************************************************************************************************************************
Functions
***********************************************************************************************************************************/
uint16_t pgPageChecksum(const unsigned char *page, unsigned int blockNo);
uint16_t pgPageChecksum(unsigned char *page, unsigned int blockNo);
uint64_t pgPageLsn(const unsigned char *page);
bool pgPageChecksumTest(
const unsigned char *page, unsigned int blockNo, unsigned int pageSize, uint32_t ignoreWalId, uint32_t ignoreWalOffset);
unsigned char *page, unsigned int blockNo, unsigned int pageSize, uint32_t ignoreWalId, uint32_t ignoreWalOffset);
#endif