You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-17 01:12:23 +02:00
Add walSegmentNext() and walSegmentRange().
This commit is contained in:
@ -87,4 +87,52 @@ testRun()
|
||||
|
||||
unlink(strPtr(storagePathNP(storageSpool(), strNewFmt(STORAGE_SPOOL_ARCHIVE_OUT "/%s.error", strPtr(segment)))));
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("walSegmentNext()"))
|
||||
{
|
||||
TEST_RESULT_STR(
|
||||
strPtr(walSegmentNext(strNew("000000010000000100000001"), 16 * 1024 * 1024, PG_VERSION_10)),
|
||||
"000000010000000100000002", "get next");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(walSegmentNext(strNew("0000000100000001000000FE"), 16 * 1024 * 1024, PG_VERSION_93)),
|
||||
"0000000100000001000000FF", "get next");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(walSegmentNext(strNew("0000009900000001000000FF"), 16 * 1024 * 1024, PG_VERSION_93)),
|
||||
"000000990000000200000000", "get next overflow >= 9.3");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(walSegmentNext(strNew("0000000100000001000000FE"), 16 * 1024 * 1024, PG_VERSION_92)),
|
||||
"000000010000000200000000", "get next overflow < 9.3");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(walSegmentNext(strNew("000000010000000100000003"), 1024 * 1024 * 1024, PG_VERSION_11)),
|
||||
"000000010000000200000000", "get next overflow >= 11/1GB");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(walSegmentNext(strNew("000000010000006700000FFF"), 1024 * 1024, PG_VERSION_11)),
|
||||
"000000010000006800000000", "get next overflow >= 11/1MB");
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("walSegmentRange()"))
|
||||
{
|
||||
TEST_RESULT_STR(
|
||||
strPtr(strLstJoin(walSegmentRange(strNew("000000010000000100000000"), 16 * 1024 * 1024, PG_VERSION_92, 1), "|")),
|
||||
"000000010000000100000000", "get single");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(strLstJoin(walSegmentRange(strNew("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_92, 4), "|")),
|
||||
"0000000100000001000000FD|0000000100000001000000FE|000000010000000200000000|000000010000000200000001",
|
||||
"get range < 9.3");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(strLstJoin(walSegmentRange(strNew("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_93, 4), "|")),
|
||||
"0000000100000001000000FD|0000000100000001000000FE|0000000100000001000000FF|000000010000000200000000",
|
||||
"get range >= 9.3");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(strLstJoin(walSegmentRange(strNew("000000080000000A00000000"), 1024 * 1024 * 1024, PG_VERSION_11, 8), "|")),
|
||||
"000000080000000A00000000|000000080000000A00000001|000000080000000A00000002|000000080000000A00000003|"
|
||||
"000000080000000B00000000|000000080000000B00000001|000000080000000B00000002|000000080000000B00000003",
|
||||
"get range >= 11/1GB");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(strLstJoin(walSegmentRange(strNew("000000070000000700000FFE"), 1024 * 1024, PG_VERSION_11, 4), "|")),
|
||||
"000000070000000700000FFE|000000070000000700000FFF|000000070000000800000000|000000070000000800000001",
|
||||
"get range >= 11/1MB");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user