pgbackrest.git / summary / log / commit / refs

commit    3181cd0ab8f09cbeca87d97e670e0901feb412a3
Author:   David Steele <david@pgmasters.net>
Date:     Tue Mar 26 16:46:44 2019 +0000

    Set WAL long header flag in test function missed in e938a892.
    
    This was missed because the unit tests were reusing a buffer without resetting it to zero, so this flag ended up still set when the test function was called.
    
    This was not a live issue since it only expressed in tests and this code is not used in master yet.


src/postgres/interface/version.intern.h | 1 + test/src/module/postgres/interfaceTest.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/postgres/interface/version.intern.h b/src/postgres/interface/version.intern.h index 8221fb0df..3421dd985 100644 --- a/src/postgres/interface/version.intern.h +++ b/src/postgres/interface/version.intern.h @@ -178,6 +178,7 @@ Create a WAL file file for testing pgInterfaceWalTest##version(PgWal pgWal, unsigned char *buffer) \ { \ ((XLogLongPageHeaderData *)buffer)->std.xlp_magic = XLOG_PAGE_MAGIC; \ + ((XLogLongPageHeaderData *)buffer)->std.xlp_info = XLP_LONG_HEADER; \ ((XLogLongPageHeaderData *)buffer)->xlp_sysid = pgWal.systemId; \ } diff --git a/test/src/module/postgres/interfaceTest.c b/test/src/module/postgres/interfaceTest.c index 813a67e83..3f7126dd2 100644 --- a/test/src/module/postgres/interfaceTest.c +++ b/test/src/module/postgres/interfaceTest.c @@ -118,9 +118,11 @@ testRun(void) "HINT: is this version of PostgreSQL supported?"); //-------------------------------------------------------------------------------------------------------------------------- + memset(bufPtr(result), 0, bufSize(result)); TEST_ERROR(pgWalTestToBuffer((PgWal){.version = 0}, result), AssertError, "invalid version 0"); //-------------------------------------------------------------------------------------------------------------------------- + memset(bufPtr(result), 0, bufSize(result)); pgWalTestToBuffer((PgWal){.version = PG_VERSION_11, .systemId = 0xECAFECAF}, result); storagePutNP(storageNewWriteNP(storageTest, walFile), result); @@ -130,6 +132,7 @@ testRun(void) TEST_RESULT_INT(info.version, PG_VERSION_11, " check version"); //-------------------------------------------------------------------------------------------------------------------------- + memset(bufPtr(result), 0, bufSize(result)); pgWalTestToBuffer((PgWal){.version = PG_VERSION_83, .systemId = 0xEAEAEAEA}, result); storagePutNP(storageNewWriteNP(storageTest, walFile), result); [parent: 7364d859da8b]