1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +03:00

Standardize LSN formatting by zero padding

This commit standardizes the output format for LSNs to ensure consistent
representation across various tools and messages.  Previously, LSNs were
inconsistently printed as `%X/%X` in some contexts, while others used
zero-padding.  This often led to confusion when comparing.

To address this, the LSN format is now uniformly set to `%X/%08X`,
ensuring the lower 32-bit part is always zero-padded to eight
hexadecimal digits.

Author: Japin Li <japinli@hotmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/ME0P300MB0445CA53CA0E4B8C1879AF84B641A@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM
This commit is contained in:
Álvaro Herrera
2025-07-07 13:57:43 +02:00
parent 62a17a9283
commit 2633dae2e4
67 changed files with 681 additions and 681 deletions

View File

@ -913,7 +913,7 @@ bt_report_duplicate(BtreeCheckState *state,
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("index uniqueness is violated for index \"%s\"", errmsg("index uniqueness is violated for index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail("Index %s%s and%s%s (point to heap %s and %s) page lsn=%X/%X.", errdetail("Index %s%s and%s%s (point to heap %s and %s) page lsn=%X/%08X.",
itid, pposting, nitid, pnposting, htid, nhtid, itid, pposting, nitid, pnposting, htid, nhtid,
LSN_FORMAT_ARGS(state->targetlsn)))); LSN_FORMAT_ARGS(state->targetlsn))));
} }
@ -1058,7 +1058,7 @@ bt_leftmost_ignoring_half_dead(BtreeCheckState *state,
(errcode(ERRCODE_NO_DATA), (errcode(ERRCODE_NO_DATA),
errmsg_internal("harmless interrupted page deletion detected in index \"%s\"", errmsg_internal("harmless interrupted page deletion detected in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Block=%u right block=%u page lsn=%X/%X.", errdetail_internal("Block=%u right block=%u page lsn=%X/%08X.",
reached, reached_from, reached, reached_from,
LSN_FORMAT_ARGS(pagelsn)))); LSN_FORMAT_ARGS(pagelsn))));
@ -1283,7 +1283,7 @@ bt_target_page_check(BtreeCheckState *state)
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("wrong number of high key index tuple attributes in index \"%s\"", errmsg("wrong number of high key index tuple attributes in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Index block=%u natts=%u block type=%s page lsn=%X/%X.", errdetail_internal("Index block=%u natts=%u block type=%s page lsn=%X/%08X.",
state->targetblock, state->targetblock,
BTreeTupleGetNAtts(itup, state->rel), BTreeTupleGetNAtts(itup, state->rel),
P_ISLEAF(topaque) ? "heap" : "index", P_ISLEAF(topaque) ? "heap" : "index",
@ -1332,7 +1332,7 @@ bt_target_page_check(BtreeCheckState *state)
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("index tuple size does not equal lp_len in index \"%s\"", errmsg("index tuple size does not equal lp_len in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Index tid=(%u,%u) tuple size=%zu lp_len=%u page lsn=%X/%X.", errdetail_internal("Index tid=(%u,%u) tuple size=%zu lp_len=%u page lsn=%X/%08X.",
state->targetblock, offset, state->targetblock, offset,
tupsize, ItemIdGetLength(itemid), tupsize, ItemIdGetLength(itemid),
LSN_FORMAT_ARGS(state->targetlsn)), LSN_FORMAT_ARGS(state->targetlsn)),
@ -1356,7 +1356,7 @@ bt_target_page_check(BtreeCheckState *state)
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("wrong number of index tuple attributes in index \"%s\"", errmsg("wrong number of index tuple attributes in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Index tid=%s natts=%u points to %s tid=%s page lsn=%X/%X.", errdetail_internal("Index tid=%s natts=%u points to %s tid=%s page lsn=%X/%08X.",
itid, itid,
BTreeTupleGetNAtts(itup, state->rel), BTreeTupleGetNAtts(itup, state->rel),
P_ISLEAF(topaque) ? "heap" : "index", P_ISLEAF(topaque) ? "heap" : "index",
@ -1406,7 +1406,7 @@ bt_target_page_check(BtreeCheckState *state)
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("could not find tuple using search from root page in index \"%s\"", errmsg("could not find tuple using search from root page in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Index tid=%s points to heap tid=%s page lsn=%X/%X.", errdetail_internal("Index tid=%s points to heap tid=%s page lsn=%X/%08X.",
itid, htid, itid, htid,
LSN_FORMAT_ARGS(state->targetlsn)))); LSN_FORMAT_ARGS(state->targetlsn))));
} }
@ -1435,7 +1435,7 @@ bt_target_page_check(BtreeCheckState *state)
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg_internal("posting list contains misplaced TID in index \"%s\"", errmsg_internal("posting list contains misplaced TID in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Index tid=%s posting list offset=%d page lsn=%X/%X.", errdetail_internal("Index tid=%s posting list offset=%d page lsn=%X/%08X.",
itid, i, itid, i,
LSN_FORMAT_ARGS(state->targetlsn)))); LSN_FORMAT_ARGS(state->targetlsn))));
} }
@ -1488,7 +1488,7 @@ bt_target_page_check(BtreeCheckState *state)
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("index row size %zu exceeds maximum for index \"%s\"", errmsg("index row size %zu exceeds maximum for index \"%s\"",
tupsize, RelationGetRelationName(state->rel)), tupsize, RelationGetRelationName(state->rel)),
errdetail_internal("Index tid=%s points to %s tid=%s page lsn=%X/%X.", errdetail_internal("Index tid=%s points to %s tid=%s page lsn=%X/%08X.",
itid, itid,
P_ISLEAF(topaque) ? "heap" : "index", P_ISLEAF(topaque) ? "heap" : "index",
htid, htid,
@ -1595,7 +1595,7 @@ bt_target_page_check(BtreeCheckState *state)
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("high key invariant violated for index \"%s\"", errmsg("high key invariant violated for index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Index tid=%s points to %s tid=%s page lsn=%X/%X.", errdetail_internal("Index tid=%s points to %s tid=%s page lsn=%X/%08X.",
itid, itid,
P_ISLEAF(topaque) ? "heap" : "index", P_ISLEAF(topaque) ? "heap" : "index",
htid, htid,
@ -1641,9 +1641,7 @@ bt_target_page_check(BtreeCheckState *state)
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("item order invariant violated for index \"%s\"", errmsg("item order invariant violated for index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Lower index tid=%s (points to %s tid=%s) " errdetail_internal("Lower index tid=%s (points to %s tid=%s) higher index tid=%s (points to %s tid=%s) page lsn=%X/%08X.",
"higher index tid=%s (points to %s tid=%s) "
"page lsn=%X/%X.",
itid, itid,
P_ISLEAF(topaque) ? "heap" : "index", P_ISLEAF(topaque) ? "heap" : "index",
htid, htid,
@ -1760,7 +1758,7 @@ bt_target_page_check(BtreeCheckState *state)
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("cross page item order invariant violated for index \"%s\"", errmsg("cross page item order invariant violated for index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Last item on page tid=(%u,%u) page lsn=%X/%X.", errdetail_internal("Last item on page tid=(%u,%u) page lsn=%X/%08X.",
state->targetblock, offset, state->targetblock, offset,
LSN_FORMAT_ARGS(state->targetlsn)))); LSN_FORMAT_ARGS(state->targetlsn))));
} }
@ -1813,7 +1811,7 @@ bt_target_page_check(BtreeCheckState *state)
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("right block of leaf block is non-leaf for index \"%s\"", errmsg("right block of leaf block is non-leaf for index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Block=%u page lsn=%X/%X.", errdetail_internal("Block=%u page lsn=%X/%08X.",
state->targetblock, state->targetblock,
LSN_FORMAT_ARGS(state->targetlsn)))); LSN_FORMAT_ARGS(state->targetlsn))));
@ -2237,7 +2235,7 @@ bt_child_highkey_check(BtreeCheckState *state,
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("the first child of leftmost target page is not leftmost of its level in index \"%s\"", errmsg("the first child of leftmost target page is not leftmost of its level in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.", errdetail_internal("Target block=%u child block=%u target page lsn=%X/%08X.",
state->targetblock, blkno, state->targetblock, blkno,
LSN_FORMAT_ARGS(state->targetlsn)))); LSN_FORMAT_ARGS(state->targetlsn))));
@ -2323,7 +2321,7 @@ bt_child_highkey_check(BtreeCheckState *state,
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("child high key is greater than rightmost pivot key on target level in index \"%s\"", errmsg("child high key is greater than rightmost pivot key on target level in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.", errdetail_internal("Target block=%u child block=%u target page lsn=%X/%08X.",
state->targetblock, blkno, state->targetblock, blkno,
LSN_FORMAT_ARGS(state->targetlsn)))); LSN_FORMAT_ARGS(state->targetlsn))));
pivotkey_offset = P_HIKEY; pivotkey_offset = P_HIKEY;
@ -2353,7 +2351,7 @@ bt_child_highkey_check(BtreeCheckState *state,
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("can't find left sibling high key in index \"%s\"", errmsg("can't find left sibling high key in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.", errdetail_internal("Target block=%u child block=%u target page lsn=%X/%08X.",
state->targetblock, blkno, state->targetblock, blkno,
LSN_FORMAT_ARGS(state->targetlsn)))); LSN_FORMAT_ARGS(state->targetlsn))));
itup = state->lowkey; itup = state->lowkey;
@ -2365,7 +2363,7 @@ bt_child_highkey_check(BtreeCheckState *state,
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("mismatch between parent key and child high key in index \"%s\"", errmsg("mismatch between parent key and child high key in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Target block=%u child block=%u target page lsn=%X/%X.", errdetail_internal("Target block=%u child block=%u target page lsn=%X/%08X.",
state->targetblock, blkno, state->targetblock, blkno,
LSN_FORMAT_ARGS(state->targetlsn)))); LSN_FORMAT_ARGS(state->targetlsn))));
} }
@ -2505,7 +2503,7 @@ bt_child_check(BtreeCheckState *state, BTScanInsert targetkey,
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("downlink to deleted page found in index \"%s\"", errmsg("downlink to deleted page found in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Parent block=%u child block=%u parent page lsn=%X/%X.", errdetail_internal("Parent block=%u child block=%u parent page lsn=%X/%08X.",
state->targetblock, childblock, state->targetblock, childblock,
LSN_FORMAT_ARGS(state->targetlsn)))); LSN_FORMAT_ARGS(state->targetlsn))));
@ -2546,7 +2544,7 @@ bt_child_check(BtreeCheckState *state, BTScanInsert targetkey,
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("down-link lower bound invariant violated for index \"%s\"", errmsg("down-link lower bound invariant violated for index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Parent block=%u child index tid=(%u,%u) parent page lsn=%X/%X.", errdetail_internal("Parent block=%u child index tid=(%u,%u) parent page lsn=%X/%08X.",
state->targetblock, childblock, offset, state->targetblock, childblock, offset,
LSN_FORMAT_ARGS(state->targetlsn)))); LSN_FORMAT_ARGS(state->targetlsn))));
} }
@ -2616,7 +2614,7 @@ bt_downlink_missing_check(BtreeCheckState *state, bool rightsplit,
(errcode(ERRCODE_NO_DATA), (errcode(ERRCODE_NO_DATA),
errmsg_internal("harmless interrupted page split detected in index \"%s\"", errmsg_internal("harmless interrupted page split detected in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Block=%u level=%u left sibling=%u page lsn=%X/%X.", errdetail_internal("Block=%u level=%u left sibling=%u page lsn=%X/%08X.",
blkno, opaque->btpo_level, blkno, opaque->btpo_level,
opaque->btpo_prev, opaque->btpo_prev,
LSN_FORMAT_ARGS(pagelsn)))); LSN_FORMAT_ARGS(pagelsn))));
@ -2638,7 +2636,7 @@ bt_downlink_missing_check(BtreeCheckState *state, bool rightsplit,
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("leaf index block lacks downlink in index \"%s\"", errmsg("leaf index block lacks downlink in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Block=%u page lsn=%X/%X.", errdetail_internal("Block=%u page lsn=%X/%08X.",
blkno, blkno,
LSN_FORMAT_ARGS(pagelsn)))); LSN_FORMAT_ARGS(pagelsn))));
@ -2704,7 +2702,7 @@ bt_downlink_missing_check(BtreeCheckState *state, bool rightsplit,
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg_internal("downlink to deleted leaf page found in index \"%s\"", errmsg_internal("downlink to deleted leaf page found in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Top parent/target block=%u leaf block=%u top parent/under check lsn=%X/%X.", errdetail_internal("Top parent/target block=%u leaf block=%u top parent/under check lsn=%X/%08X.",
blkno, childblk, blkno, childblk,
LSN_FORMAT_ARGS(pagelsn)))); LSN_FORMAT_ARGS(pagelsn))));
@ -2730,7 +2728,7 @@ bt_downlink_missing_check(BtreeCheckState *state, bool rightsplit,
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("internal index block lacks downlink in index \"%s\"", errmsg("internal index block lacks downlink in index \"%s\"",
RelationGetRelationName(state->rel)), RelationGetRelationName(state->rel)),
errdetail_internal("Block=%u level=%u page lsn=%X/%X.", errdetail_internal("Block=%u level=%u page lsn=%X/%08X.",
blkno, opaque->btpo_level, blkno, opaque->btpo_level,
LSN_FORMAT_ARGS(pagelsn)))); LSN_FORMAT_ARGS(pagelsn))));
} }

View File

@ -5,21 +5,21 @@ CREATE UNLOGGED TABLE test_gist AS SELECT point(i,i) p, i::text t FROM
CREATE INDEX test_gist_idx ON test_gist USING gist (p); CREATE INDEX test_gist_idx ON test_gist USING gist (p);
-- Page 0 is the root, the rest are leaf pages -- Page 0 is the root, the rest are leaf pages
SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 0)); SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 0));
lsn | nsn | rightlink | flags lsn | nsn | rightlink | flags
-----+-----+------------+------- ------------+------------+------------+-------
0/1 | 0/0 | 4294967295 | {} 0/00000001 | 0/00000000 | 4294967295 | {}
(1 row) (1 row)
SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 1)); SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 1));
lsn | nsn | rightlink | flags lsn | nsn | rightlink | flags
-----+-----+------------+-------- ------------+------------+------------+--------
0/1 | 0/0 | 4294967295 | {leaf} 0/00000001 | 0/00000000 | 4294967295 | {leaf}
(1 row) (1 row)
SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 2)); SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 2));
lsn | nsn | rightlink | flags lsn | nsn | rightlink | flags
-----+-----+-----------+-------- ------------+------------+-----------+--------
0/1 | 0/0 | 1 | {leaf} 0/00000001 | 0/00000000 | 1 | {leaf}
(1 row) (1 row)
SELECT * FROM gist_page_items(get_raw_page('test_gist_idx', 0), 'test_gist_idx'); SELECT * FROM gist_page_items(get_raw_page('test_gist_idx', 0), 'test_gist_idx');

View File

@ -265,9 +265,9 @@ SELECT fsm_page_contents(decode(repeat('00', :block_size), 'hex'));
(1 row) (1 row)
SELECT page_header(decode(repeat('00', :block_size), 'hex')); SELECT page_header(decode(repeat('00', :block_size), 'hex'));
page_header page_header
----------------------- ------------------------------
(0/0,0,0,0,0,0,0,0,0) (0/00000000,0,0,0,0,0,0,0,0)
(1 row) (1 row)
SELECT page_checksum(decode(repeat('00', :block_size), 'hex'), 1); SELECT page_checksum(decode(repeat('00', :block_size), 'hex'), 1);

View File

@ -282,7 +282,7 @@ page_header(PG_FUNCTION_ARGS)
{ {
char lsnchar[64]; char lsnchar[64];
snprintf(lsnchar, sizeof(lsnchar), "%X/%X", LSN_FORMAT_ARGS(lsn)); snprintf(lsnchar, sizeof(lsnchar), "%X/%08X", LSN_FORMAT_ARGS(lsn));
values[0] = CStringGetTextDatum(lsnchar); values[0] = CStringGetTextDatum(lsnchar);
} }
else else

View File

@ -19,14 +19,14 @@ INSERT INTO sample_tbl SELECT * FROM generate_series(3, 4);
-- =================================================================== -- ===================================================================
-- Invalid input LSN. -- Invalid input LSN.
SELECT * FROM pg_get_wal_record_info('0/0'); SELECT * FROM pg_get_wal_record_info('0/0');
ERROR: could not read WAL at LSN 0/0 ERROR: could not read WAL at LSN 0/00000000
-- Invalid start LSN. -- Invalid start LSN.
SELECT * FROM pg_get_wal_records_info('0/0', :'wal_lsn1'); SELECT * FROM pg_get_wal_records_info('0/0', :'wal_lsn1');
ERROR: could not read WAL at LSN 0/0 ERROR: could not read WAL at LSN 0/00000000
SELECT * FROM pg_get_wal_stats('0/0', :'wal_lsn1'); SELECT * FROM pg_get_wal_stats('0/0', :'wal_lsn1');
ERROR: could not read WAL at LSN 0/0 ERROR: could not read WAL at LSN 0/00000000
SELECT * FROM pg_get_wal_block_info('0/0', :'wal_lsn1'); SELECT * FROM pg_get_wal_block_info('0/0', :'wal_lsn1');
ERROR: could not read WAL at LSN 0/0 ERROR: could not read WAL at LSN 0/00000000
-- Start LSN > End LSN. -- Start LSN > End LSN.
SELECT * FROM pg_get_wal_records_info(:'wal_lsn2', :'wal_lsn1'); SELECT * FROM pg_get_wal_records_info(:'wal_lsn2', :'wal_lsn1');
ERROR: WAL start LSN must be less than end LSN ERROR: WAL start LSN must be less than end LSN

View File

@ -105,7 +105,7 @@ InitXLogReaderState(XLogRecPtr lsn)
if (lsn < XLOG_BLCKSZ) if (lsn < XLOG_BLCKSZ)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not read WAL at LSN %X/%X", errmsg("could not read WAL at LSN %X/%08X",
LSN_FORMAT_ARGS(lsn)))); LSN_FORMAT_ARGS(lsn))));
private_data = (ReadLocalXLogPageNoWaitPrivate *) private_data = (ReadLocalXLogPageNoWaitPrivate *)
@ -128,8 +128,8 @@ InitXLogReaderState(XLogRecPtr lsn)
if (XLogRecPtrIsInvalid(first_valid_record)) if (XLogRecPtrIsInvalid(first_valid_record))
ereport(ERROR, ereport(ERROR,
(errmsg("could not find a valid record after %X/%X", errmsg("could not find a valid record after %X/%08X",
LSN_FORMAT_ARGS(lsn)))); LSN_FORMAT_ARGS(lsn)));
return xlogreader; return xlogreader;
} }
@ -168,12 +168,12 @@ ReadNextXLogRecord(XLogReaderState *xlogreader)
if (errormsg) if (errormsg)
ereport(ERROR, ereport(ERROR,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("could not read WAL at %X/%X: %s", errmsg("could not read WAL at %X/%08X: %s",
LSN_FORMAT_ARGS(xlogreader->EndRecPtr), errormsg))); LSN_FORMAT_ARGS(xlogreader->EndRecPtr), errormsg)));
else else
ereport(ERROR, ereport(ERROR,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("could not read WAL at %X/%X", errmsg("could not read WAL at %X/%08X",
LSN_FORMAT_ARGS(xlogreader->EndRecPtr)))); LSN_FORMAT_ARGS(xlogreader->EndRecPtr))));
} }
@ -479,7 +479,7 @@ pg_get_wal_record_info(PG_FUNCTION_ARGS)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("WAL input LSN must be less than current LSN"), errmsg("WAL input LSN must be less than current LSN"),
errdetail("Current WAL LSN on the database system is at %X/%X.", errdetail("Current WAL LSN on the database system is at %X/%08X.",
LSN_FORMAT_ARGS(curr_lsn)))); LSN_FORMAT_ARGS(curr_lsn))));
/* Build a tuple descriptor for our result type. */ /* Build a tuple descriptor for our result type. */
@ -491,7 +491,7 @@ pg_get_wal_record_info(PG_FUNCTION_ARGS)
if (!ReadNextXLogRecord(xlogreader)) if (!ReadNextXLogRecord(xlogreader))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not read WAL at %X/%X", errmsg("could not read WAL at %X/%08X",
LSN_FORMAT_ARGS(xlogreader->EndRecPtr)))); LSN_FORMAT_ARGS(xlogreader->EndRecPtr))));
GetWALRecordInfo(xlogreader, values, nulls, PG_GET_WAL_RECORD_INFO_COLS); GetWALRecordInfo(xlogreader, values, nulls, PG_GET_WAL_RECORD_INFO_COLS);
@ -521,7 +521,7 @@ ValidateInputLSNs(XLogRecPtr start_lsn, XLogRecPtr *end_lsn)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("WAL start LSN must be less than current LSN"), errmsg("WAL start LSN must be less than current LSN"),
errdetail("Current WAL LSN on the database system is at %X/%X.", errdetail("Current WAL LSN on the database system is at %X/%08X.",
LSN_FORMAT_ARGS(curr_lsn)))); LSN_FORMAT_ARGS(curr_lsn))));
if (start_lsn > *end_lsn) if (start_lsn > *end_lsn)
@ -827,7 +827,7 @@ pg_get_wal_records_info_till_end_of_wal(PG_FUNCTION_ARGS)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("WAL start LSN must be less than current LSN"), errmsg("WAL start LSN must be less than current LSN"),
errdetail("Current WAL LSN on the database system is at %X/%X.", errdetail("Current WAL LSN on the database system is at %X/%08X.",
LSN_FORMAT_ARGS(end_lsn)))); LSN_FORMAT_ARGS(end_lsn))));
GetWALRecordsInfo(fcinfo, start_lsn, end_lsn); GetWALRecordsInfo(fcinfo, start_lsn, end_lsn);
@ -846,7 +846,7 @@ pg_get_wal_stats_till_end_of_wal(PG_FUNCTION_ARGS)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("WAL start LSN must be less than current LSN"), errmsg("WAL start LSN must be less than current LSN"),
errdetail("Current WAL LSN on the database system is at %X/%X.", errdetail("Current WAL LSN on the database system is at %X/%08X.",
LSN_FORMAT_ARGS(end_lsn)))); LSN_FORMAT_ARGS(end_lsn))));
GetWalStats(fcinfo, start_lsn, end_lsn, stats_per_record); GetWalStats(fcinfo, start_lsn, end_lsn, stats_per_record);

View File

@ -7971,7 +7971,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
</para> </para>
<para> <para>
Finish LSN of the transaction whose changes are to be skipped, if a valid Finish LSN of the transaction whose changes are to be skipped, if a valid
LSN; otherwise <literal>0/0</literal>. LSN; otherwise <literal>0/0000000</literal>.
</para></entry> </para></entry>
</row> </row>

View File

@ -575,8 +575,8 @@ HINT: To initiate replication, you must manually create the replication slot, e
<programlisting> <programlisting>
/* pub # */ SELECT * FROM pg_create_logical_replication_slot('sub1', 'pgoutput'); /* pub # */ SELECT * FROM pg_create_logical_replication_slot('sub1', 'pgoutput');
slot_name | lsn slot_name | lsn
-----------+----------- -----------+------------
sub1 | 0/19404D0 sub1 | 0/019404D0
(1 row) (1 row)
</programlisting></para> </programlisting></para>
</listitem> </listitem>
@ -617,8 +617,8 @@ HINT: To initiate replication, you must manually create the replication slot, e
<programlisting> <programlisting>
/* pub # */ SELECT * FROM pg_create_logical_replication_slot('myslot', 'pgoutput'); /* pub # */ SELECT * FROM pg_create_logical_replication_slot('myslot', 'pgoutput');
slot_name | lsn slot_name | lsn
-----------+----------- -----------+------------
myslot | 0/19059A0 myslot | 0/019059A0
(1 row) (1 row)
</programlisting></para> </programlisting></para>
</listitem> </listitem>
@ -655,8 +655,8 @@ HINT: To initiate replication, you must manually create the replication slot, e
<programlisting> <programlisting>
/* pub # */ SELECT * FROM pg_create_logical_replication_slot('myslot', 'pgoutput'); /* pub # */ SELECT * FROM pg_create_logical_replication_slot('myslot', 'pgoutput');
slot_name | lsn slot_name | lsn
-----------+----------- -----------+------------
myslot | 0/1905930 myslot | 0/01905930
(1 row) (1 row)
</programlisting></para> </programlisting></para>
</listitem> </listitem>
@ -1965,15 +1965,15 @@ DETAIL: <replaceable class="parameter">detailed_explanation</replaceable>.
ERROR: conflict detected on relation "public.test": conflict=insert_exists ERROR: conflict detected on relation "public.test": conflict=insert_exists
DETAIL: Key already exists in unique index "t_pkey", which was modified locally in transaction 740 at 2024-06-26 10:47:04.727375+08. DETAIL: Key already exists in unique index "t_pkey", which was modified locally in transaction 740 at 2024-06-26 10:47:04.727375+08.
Key (c)=(1); existing local tuple (1, 'local'); remote tuple (1, 'remote'). Key (c)=(1); existing local tuple (1, 'local'); remote tuple (1, 'remote').
CONTEXT: processing remote data for replication origin "pg_16395" during "INSERT" for replication target relation "public.test" in transaction 725 finished at 0/14C0378 CONTEXT: processing remote data for replication origin "pg_16395" during "INSERT" for replication target relation "public.test" in transaction 725 finished at 0/014C0378
</screen> </screen>
The LSN of the transaction that contains the change violating the constraint and The LSN of the transaction that contains the change violating the constraint and
the replication origin name can be found from the server log (LSN 0/14C0378 and the replication origin name can be found from the server log (LSN 0/014C0378 and
replication origin <literal>pg_16395</literal> in the above case). The replication origin <literal>pg_16395</literal> in the above case). The
transaction that produced the conflict can be skipped by using transaction that produced the conflict can be skipped by using
<link linkend="sql-altersubscription-params-skip"><command>ALTER SUBSCRIPTION ... SKIP</command></link> <link linkend="sql-altersubscription-params-skip"><command>ALTER SUBSCRIPTION ... SKIP</command></link>
with the finish LSN with the finish LSN
(i.e., LSN 0/14C0378). The finish LSN could be an LSN at which the transaction (i.e., LSN 0/014C0378). The finish LSN could be an LSN at which the transaction
is committed or prepared on the publisher. Alternatively, the transaction can is committed or prepared on the publisher. Alternatively, the transaction can
also be skipped by calling the <link linkend="pg-replication-origin-advance"> also be skipped by calling the <link linkend="pg-replication-origin-advance">
<function>pg_replication_origin_advance()</function></link> function. <function>pg_replication_origin_advance()</function></link> function.
@ -1984,7 +1984,7 @@ CONTEXT: processing remote data for replication origin "pg_16395" during "INSER
<link linkend="sql-createsubscription-params-with-disable-on-error"><literal>disable_on_error</literal></link> <link linkend="sql-createsubscription-params-with-disable-on-error"><literal>disable_on_error</literal></link>
option. Then, you can use <function>pg_replication_origin_advance()</function> option. Then, you can use <function>pg_replication_origin_advance()</function>
function with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>) function with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
and the next LSN of the finish LSN (i.e., 0/14C0379). The current position of and the next LSN of the finish LSN (i.e., 0/014C0379). The current position of
origins can be seen in the <link linkend="view-pg-replication-origin-status"> origins can be seen in the <link linkend="view-pg-replication-origin-status">
<structname>pg_replication_origin_status</structname></link> system view. <structname>pg_replication_origin_status</structname></link> system view.
Please note that skipping the whole transaction includes skipping changes that Please note that skipping the whole transaction includes skipping changes that

View File

@ -57,14 +57,14 @@
postgres=# -- Create a slot named 'regression_slot' using the output plugin 'test_decoding' postgres=# -- Create a slot named 'regression_slot' using the output plugin 'test_decoding'
postgres=# SELECT * FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding', false, true); postgres=# SELECT * FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding', false, true);
slot_name | lsn slot_name | lsn
-----------------+----------- -----------------+------------
regression_slot | 0/16B1970 regression_slot | 0/016B1970
(1 row) (1 row)
postgres=# SELECT slot_name, plugin, slot_type, database, active, restart_lsn, confirmed_flush_lsn FROM pg_replication_slots; postgres=# SELECT slot_name, plugin, slot_type, database, active, restart_lsn, confirmed_flush_lsn FROM pg_replication_slots;
slot_name | plugin | slot_type | database | active | restart_lsn | confirmed_flush_lsn slot_name | plugin | slot_type | database | active | restart_lsn | confirmed_flush_lsn
-----------------+---------------+-----------+----------+--------+-------------+----------------- -----------------+---------------+-----------+----------+--------+-------------+---------------------
regression_slot | test_decoding | logical | postgres | f | 0/16A4408 | 0/16A4440 regression_slot | test_decoding | logical | postgres | f | 0/016A4408 | 0/016A4440
(1 row) (1 row)
postgres=# -- There are no changes to see yet postgres=# -- There are no changes to see yet
@ -78,10 +78,10 @@ CREATE TABLE
postgres=# -- DDL isn't replicated, so all you'll see is the transaction postgres=# -- DDL isn't replicated, so all you'll see is the transaction
postgres=# SELECT * FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL); postgres=# SELECT * FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL);
lsn | xid | data lsn | xid | data
-----------+-------+-------------- ------------+-------+--------------
0/BA2DA58 | 10297 | BEGIN 10297 0/0BA2DA58 | 10297 | BEGIN 10297
0/BA5A5A0 | 10297 | COMMIT 10297 0/0BA5A5A0 | 10297 | COMMIT 10297
(2 rows) (2 rows)
postgres=# -- Once changes are read, they're consumed and not emitted postgres=# -- Once changes are read, they're consumed and not emitted
@ -97,41 +97,41 @@ postgres=*# INSERT INTO data(data) VALUES('2');
postgres=*# COMMIT; postgres=*# COMMIT;
postgres=# SELECT * FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL); postgres=# SELECT * FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL);
lsn | xid | data lsn | xid | data
-----------+-------+--------------------------------------------------------- ------------+-------+---------------------------------------------------------
0/BA5A688 | 10298 | BEGIN 10298 0/0BA5A688 | 10298 | BEGIN 10298
0/BA5A6F0 | 10298 | table public.data: INSERT: id[integer]:1 data[text]:'1' 0/0BA5A6F0 | 10298 | table public.data: INSERT: id[integer]:1 data[text]:'1'
0/BA5A7F8 | 10298 | table public.data: INSERT: id[integer]:2 data[text]:'2' 0/0BA5A7F8 | 10298 | table public.data: INSERT: id[integer]:2 data[text]:'2'
0/BA5A8A8 | 10298 | COMMIT 10298 0/0BA5A8A8 | 10298 | COMMIT 10298
(4 rows) (4 rows)
postgres=# INSERT INTO data(data) VALUES('3'); postgres=# INSERT INTO data(data) VALUES('3');
postgres=# -- You can also peek ahead in the change stream without consuming changes postgres=# -- You can also peek ahead in the change stream without consuming changes
postgres=# SELECT * FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL); postgres=# SELECT * FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL);
lsn | xid | data lsn | xid | data
-----------+-------+--------------------------------------------------------- ------------+-------+---------------------------------------------------------
0/BA5A8E0 | 10299 | BEGIN 10299 0/0BA5A8E0 | 10299 | BEGIN 10299
0/BA5A8E0 | 10299 | table public.data: INSERT: id[integer]:3 data[text]:'3' 0/0BA5A8E0 | 10299 | table public.data: INSERT: id[integer]:3 data[text]:'3'
0/BA5A990 | 10299 | COMMIT 10299 0/0BA5A990 | 10299 | COMMIT 10299
(3 rows) (3 rows)
postgres=# -- The next call to pg_logical_slot_peek_changes() returns the same changes again postgres=# -- The next call to pg_logical_slot_peek_changes() returns the same changes again
postgres=# SELECT * FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL); postgres=# SELECT * FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL);
lsn | xid | data lsn | xid | data
-----------+-------+--------------------------------------------------------- ------------+-------+---------------------------------------------------------
0/BA5A8E0 | 10299 | BEGIN 10299 0/0BA5A8E0 | 10299 | BEGIN 10299
0/BA5A8E0 | 10299 | table public.data: INSERT: id[integer]:3 data[text]:'3' 0/0BA5A8E0 | 10299 | table public.data: INSERT: id[integer]:3 data[text]:'3'
0/BA5A990 | 10299 | COMMIT 10299 0/0BA5A990 | 10299 | COMMIT 10299
(3 rows) (3 rows)
postgres=# -- options can be passed to output plugin, to influence the formatting postgres=# -- options can be passed to output plugin, to influence the formatting
postgres=# SELECT * FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'include-timestamp', 'on'); postgres=# SELECT * FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'include-timestamp', 'on');
lsn | xid | data lsn | xid | data
-----------+-------+--------------------------------------------------------- ------------+-------+---------------------------------------------------------
0/BA5A8E0 | 10299 | BEGIN 10299 0/0BA5A8E0 | 10299 | BEGIN 10299
0/BA5A8E0 | 10299 | table public.data: INSERT: id[integer]:3 data[text]:'3' 0/0BA5A8E0 | 10299 | table public.data: INSERT: id[integer]:3 data[text]:'3'
0/BA5A990 | 10299 | COMMIT 10299 (at 2017-05-10 12:07:21.272494-04) 0/0BA5A990 | 10299 | COMMIT 10299 (at 2017-05-10 12:07:21.272494-04)
(3 rows) (3 rows)
postgres=# -- Remember to destroy a slot you no longer need to stop it consuming postgres=# -- Remember to destroy a slot you no longer need to stop it consuming
@ -200,18 +200,18 @@ postgres=*# INSERT INTO data(data) VALUES('5');
postgres=*# PREPARE TRANSACTION 'test_prepared1'; postgres=*# PREPARE TRANSACTION 'test_prepared1';
postgres=# SELECT * FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL); postgres=# SELECT * FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL);
lsn | xid | data lsn | xid | data
-----------+-----+--------------------------------------------------------- ------------+-----+---------------------------------------------------------
0/1689DC0 | 529 | BEGIN 529 0/01689DC0 | 529 | BEGIN 529
0/1689DC0 | 529 | table public.data: INSERT: id[integer]:3 data[text]:'5' 0/01689DC0 | 529 | table public.data: INSERT: id[integer]:3 data[text]:'5'
0/1689FC0 | 529 | PREPARE TRANSACTION 'test_prepared1', txid 529 0/01689FC0 | 529 | PREPARE TRANSACTION 'test_prepared1', txid 529
(3 rows) (3 rows)
postgres=# COMMIT PREPARED 'test_prepared1'; postgres=# COMMIT PREPARED 'test_prepared1';
postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NULL); postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NULL);
lsn | xid | data lsn | xid | data
-----------+-----+-------------------------------------------- ------------+-----+--------------------------------------------
0/168A060 | 529 | COMMIT PREPARED 'test_prepared1', txid 529 0/0168A060 | 529 | COMMIT PREPARED 'test_prepared1', txid 529
(4 row) (4 row)
postgres=#-- you can also rollback a prepared transaction postgres=#-- you can also rollback a prepared transaction
@ -219,18 +219,18 @@ postgres=# BEGIN;
postgres=*# INSERT INTO data(data) VALUES('6'); postgres=*# INSERT INTO data(data) VALUES('6');
postgres=*# PREPARE TRANSACTION 'test_prepared2'; postgres=*# PREPARE TRANSACTION 'test_prepared2';
postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NULL); postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NULL);
lsn | xid | data lsn | xid | data
-----------+-----+--------------------------------------------------------- ------------+-----+---------------------------------------------------------
0/168A180 | 530 | BEGIN 530 0/0168A180 | 530 | BEGIN 530
0/168A1E8 | 530 | table public.data: INSERT: id[integer]:4 data[text]:'6' 0/0168A1E8 | 530 | table public.data: INSERT: id[integer]:4 data[text]:'6'
0/168A430 | 530 | PREPARE TRANSACTION 'test_prepared2', txid 530 0/0168A430 | 530 | PREPARE TRANSACTION 'test_prepared2', txid 530
(3 rows) (3 rows)
postgres=# ROLLBACK PREPARED 'test_prepared2'; postgres=# ROLLBACK PREPARED 'test_prepared2';
postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NULL); postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NULL);
lsn | xid | data lsn | xid | data
-----------+-----+---------------------------------------------- ------------+-----+----------------------------------------------
0/168A4B8 | 530 | ROLLBACK PREPARED 'test_prepared2', txid 530 0/0168A4B8 | 530 | ROLLBACK PREPARED 'test_prepared2', txid 530
(1 row) (1 row)
</programlisting> </programlisting>
</sect1> </sect1>
@ -431,7 +431,7 @@ postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NU
cases, the following log message may appear: cases, the following log message may appear:
<programlisting> <programlisting>
LOG: could not synchronize replication slot "failover_slot" LOG: could not synchronize replication slot "failover_slot"
DETAIL: Synchronization could lead to data loss as the remote slot needs WAL at LSN 0/3003F28 and catalog xmin 754, but the standby has LSN 0/3003F28 and catalog xmin 756 DETAIL: Synchronization could lead to data loss as the remote slot needs WAL at LSN 0/03003F28 and catalog xmin 754, but the standby has LSN 0/03003F28 and catalog xmin 756
</programlisting> </programlisting>
If the logical replication slot is actively used by a consumer, no If the logical replication slot is actively used by a consumer, no
manual intervention is needed; the slot will advance automatically, manual intervention is needed; the slot will advance automatically,

View File

@ -73,9 +73,9 @@
passed as argument. For example: passed as argument. For example:
<screen> <screen>
test=# SELECT * FROM page_header(get_raw_page('pg_class', 0)); test=# SELECT * FROM page_header(get_raw_page('pg_class', 0));
lsn | checksum | flags | lower | upper | special | pagesize | version | prune_xid lsn | checksum | flags | lower | upper | special | pagesize | version | prune_xid
-----------+----------+--------+-------+-------+---------+----------+---------+----------- ------------+----------+--------+-------+-------+---------+----------+---------+-----------
0/24A1B50 | 0 | 1 | 232 | 368 | 8192 | 8192 | 4 | 0 0/024A1B50 | 0 | 1 | 232 | 368 | 8192 | 8192 | 4 | 0
</screen> </screen>
The returned columns correspond to the fields in the The returned columns correspond to the fields in the
<structname>PageHeaderData</structname> struct. <structname>PageHeaderData</structname> struct.
@ -741,9 +741,9 @@ test=# SELECT first_tid, nbytes, tids[0:5] AS some_tids
For example: For example:
<screen> <screen>
test=# SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 2)); test=# SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 2));
lsn | nsn | rightlink | flags lsn │ nsn │ rightlink flags
-----+-----+-----------+-------- ────────────┼────────────┼───────────┼────────
0/1 | 0/0 | 1 | {leaf} 0/0B5FE088 │ 0/00000000 │ 1 {leaf}
(1 row) (1 row)
</screen> </screen>
</para> </para>

View File

@ -95,7 +95,7 @@ two_phase_at | 0/40796AF8
initial_xmin_horizon | 0 initial_xmin_horizon | 0
building_full_snapshot | f building_full_snapshot | f
in_slot_creation | f in_slot_creation | f
last_serialized_snapshot | 0/0 last_serialized_snapshot | 0/00000000
next_phase_at | 0 next_phase_at | 0
committed_count | 0 committed_count | 0
committed_xip | committed_xip |
@ -114,7 +114,7 @@ two_phase_at | 0/40796AF8
initial_xmin_horizon | 0 initial_xmin_horizon | 0
building_full_snapshot | f building_full_snapshot | f
in_slot_creation | f in_slot_creation | f
last_serialized_snapshot | 0/0 last_serialized_snapshot | 0/00000000
next_phase_at | 0 next_phase_at | 0
committed_count | 0 committed_count | 0
committed_xip | committed_xip |

View File

@ -73,9 +73,9 @@
<screen> <screen>
postgres=# SELECT * FROM pg_get_wal_record_info('0/E419E28'); postgres=# SELECT * FROM pg_get_wal_record_info('0/E419E28');
-[ RECORD 1 ]----+------------------------------------------------- -[ RECORD 1 ]----+-------------------------------------------------
start_lsn | 0/E419E28 start_lsn | 0/0E419E28
end_lsn | 0/E419E68 end_lsn | 0/0E419E68
prev_lsn | 0/E419D78 prev_lsn | 0/0E419D78
xid | 0 xid | 0
resource_manager | Heap2 resource_manager | Heap2
record_type | VACUUM record_type | VACUUM
@ -146,9 +146,9 @@ block_ref |
<screen> <screen>
postgres=# SELECT * FROM pg_get_wal_block_info('0/1230278', '0/12302B8'); postgres=# SELECT * FROM pg_get_wal_block_info('0/1230278', '0/12302B8');
-[ RECORD 1 ]-----+----------------------------------- -[ RECORD 1 ]-----+-----------------------------------
start_lsn | 0/1230278 start_lsn | 0/01230278
end_lsn | 0/12302B8 end_lsn | 0/012302B8
prev_lsn | 0/122FD40 prev_lsn | 0/0122FD40
block_id | 0 block_id | 0
reltablespace | 1663 reltablespace | 1663
reldatabase | 1 reldatabase | 1

View File

@ -25,16 +25,16 @@
<programlisting> <programlisting>
postgres=# SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'include-xids', '0'); postgres=# SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'include-xids', '0');
lsn | xid | data lsn | xid | data
-----------+-----+-------------------------------------------------- ------------+-----+--------------------------------------------------
0/16D30F8 | 691 | BEGIN 0/016D30F8 | 691 | BEGIN
0/16D32A0 | 691 | table public.data: INSERT: id[int4]:2 data[text]:'arg' 0/016D32A0 | 691 | table public.data: INSERT: id[int4]:2 data[text]:'arg'
0/16D32A0 | 691 | table public.data: INSERT: id[int4]:3 data[text]:'demo' 0/016D32A0 | 691 | table public.data: INSERT: id[int4]:3 data[text]:'demo'
0/16D32A0 | 691 | COMMIT 0/016D32A0 | 691 | COMMIT
0/16D32D8 | 692 | BEGIN 0/016D32D8 | 692 | BEGIN
0/16D3398 | 692 | table public.data: DELETE: id[int4]:2 0/016D3398 | 692 | table public.data: DELETE: id[int4]:2
0/16D3398 | 692 | table public.data: DELETE: id[int4]:3 0/016D3398 | 692 | table public.data: DELETE: id[int4]:3
0/16D3398 | 692 | COMMIT 0/016D3398 | 692 | COMMIT
(8 rows) (8 rows)
</programlisting> </programlisting>
</para> </para>
@ -45,18 +45,18 @@ postgres=# SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'i
<programlisting> <programlisting>
postgres[33712]=#* SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'stream-changes', '1'); postgres[33712]=#* SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'stream-changes', '1');
lsn | xid | data lsn | xid | data
-----------+-----+-------------------------------------------------- ------------+-----+--------------------------------------------------
0/16B21F8 | 503 | opening a streamed block for transaction TXN 503 0/016B21F8 | 503 | opening a streamed block for transaction TXN 503
0/16B21F8 | 503 | streaming change for TXN 503 0/016B21F8 | 503 | streaming change for TXN 503
0/16B2300 | 503 | streaming change for TXN 503 0/016B2300 | 503 | streaming change for TXN 503
0/16B2408 | 503 | streaming change for TXN 503 0/016B2408 | 503 | streaming change for TXN 503
0/16BEBA0 | 503 | closing a streamed block for transaction TXN 503 0/016BEBA0 | 503 | closing a streamed block for transaction TXN 503
0/16B21F8 | 503 | opening a streamed block for transaction TXN 503 0/016B21F8 | 503 | opening a streamed block for transaction TXN 503
0/16BECA8 | 503 | streaming change for TXN 503 0/016BECA8 | 503 | streaming change for TXN 503
0/16BEDB0 | 503 | streaming change for TXN 503 0/016BEDB0 | 503 | streaming change for TXN 503
0/16BEEB8 | 503 | streaming change for TXN 503 0/016BEEB8 | 503 | streaming change for TXN 503
0/16BEBA0 | 503 | closing a streamed block for transaction TXN 503 0/016BEBA0 | 503 | closing a streamed block for transaction TXN 503
(10 rows) (10 rows)
</programlisting> </programlisting>
</para> </para>

View File

@ -29,7 +29,7 @@ replorigin_desc(StringInfo buf, XLogReaderState *record)
xlrec = (xl_replorigin_set *) rec; xlrec = (xl_replorigin_set *) rec;
appendStringInfo(buf, "set %u; lsn %X/%X; force: %d", appendStringInfo(buf, "set %u; lsn %X/%08X; force: %d",
xlrec->node_id, xlrec->node_id,
LSN_FORMAT_ARGS(xlrec->remote_lsn), LSN_FORMAT_ARGS(xlrec->remote_lsn),
xlrec->force); xlrec->force);

View File

@ -359,7 +359,7 @@ xact_desc_commit(StringInfo buf, uint8 info, xl_xact_commit *xlrec, RepOriginId
if (parsed.xinfo & XACT_XINFO_HAS_ORIGIN) if (parsed.xinfo & XACT_XINFO_HAS_ORIGIN)
{ {
appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s", appendStringInfo(buf, "; origin: node %u, lsn %X/%08X, at %s",
origin_id, origin_id,
LSN_FORMAT_ARGS(parsed.origin_lsn), LSN_FORMAT_ARGS(parsed.origin_lsn),
timestamptz_to_str(parsed.origin_timestamp)); timestamptz_to_str(parsed.origin_timestamp));
@ -384,7 +384,7 @@ xact_desc_abort(StringInfo buf, uint8 info, xl_xact_abort *xlrec, RepOriginId or
if (parsed.xinfo & XACT_XINFO_HAS_ORIGIN) if (parsed.xinfo & XACT_XINFO_HAS_ORIGIN)
{ {
appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s", appendStringInfo(buf, "; origin: node %u, lsn %X/%08X, at %s",
origin_id, origin_id,
LSN_FORMAT_ARGS(parsed.origin_lsn), LSN_FORMAT_ARGS(parsed.origin_lsn),
timestamptz_to_str(parsed.origin_timestamp)); timestamptz_to_str(parsed.origin_timestamp));
@ -418,7 +418,7 @@ xact_desc_prepare(StringInfo buf, uint8 info, xl_xact_prepare *xlrec, RepOriginI
* way as PrepareRedoAdd(). * way as PrepareRedoAdd().
*/ */
if (origin_id != InvalidRepOriginId) if (origin_id != InvalidRepOriginId)
appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s", appendStringInfo(buf, "; origin: node %u, lsn %X/%08X, at %s",
origin_id, origin_id,
LSN_FORMAT_ARGS(parsed.origin_lsn), LSN_FORMAT_ARGS(parsed.origin_lsn),
timestamptz_to_str(parsed.origin_timestamp)); timestamptz_to_str(parsed.origin_timestamp));

View File

@ -65,7 +65,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
{ {
CheckPoint *checkpoint = (CheckPoint *) rec; CheckPoint *checkpoint = (CheckPoint *) rec;
appendStringInfo(buf, "redo %X/%X; " appendStringInfo(buf, "redo %X/%08X; "
"tli %u; prev tli %u; fpw %s; wal_level %s; xid %u:%u; oid %u; multi %u; offset %u; " "tli %u; prev tli %u; fpw %s; wal_level %s; xid %u:%u; oid %u; multi %u; offset %u; "
"oldest xid %u in DB %u; oldest multi %u in DB %u; " "oldest xid %u in DB %u; oldest multi %u in DB %u; "
"oldest/newest commit timestamp xid: %u/%u; " "oldest/newest commit timestamp xid: %u/%u; "
@ -111,7 +111,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
XLogRecPtr startpoint; XLogRecPtr startpoint;
memcpy(&startpoint, rec, sizeof(XLogRecPtr)); memcpy(&startpoint, rec, sizeof(XLogRecPtr));
appendStringInfo(buf, "%X/%X", LSN_FORMAT_ARGS(startpoint)); appendStringInfo(buf, "%X/%08X", LSN_FORMAT_ARGS(startpoint));
} }
else if (info == XLOG_PARAMETER_CHANGE) else if (info == XLOG_PARAMETER_CHANGE)
{ {
@ -156,7 +156,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
xl_overwrite_contrecord xlrec; xl_overwrite_contrecord xlrec;
memcpy(&xlrec, rec, sizeof(xl_overwrite_contrecord)); memcpy(&xlrec, rec, sizeof(xl_overwrite_contrecord));
appendStringInfo(buf, "lsn %X/%X; time %s", appendStringInfo(buf, "lsn %X/%08X; time %s",
LSN_FORMAT_ARGS(xlrec.overwritten_lsn), LSN_FORMAT_ARGS(xlrec.overwritten_lsn),
timestamptz_to_str(xlrec.overwrite_time)); timestamptz_to_str(xlrec.overwrite_time));
} }

View File

@ -154,7 +154,7 @@ readTimeLineHistory(TimeLineID targetTLI)
if (*ptr == '\0' || *ptr == '#') if (*ptr == '\0' || *ptr == '#')
continue; continue;
nfields = sscanf(fline, "%u\t%X/%X", &tli, &switchpoint_hi, &switchpoint_lo); nfields = sscanf(fline, "%u\t%X/%08X", &tli, &switchpoint_hi, &switchpoint_lo);
if (nfields < 1) if (nfields < 1)
{ {
@ -399,7 +399,7 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI,
* parent file failed to end with one. * parent file failed to end with one.
*/ */
snprintf(buffer, sizeof(buffer), snprintf(buffer, sizeof(buffer),
"%s%u\t%X/%X\t%s\n", "%s%u\t%X/%08X\t%s\n",
(srcfd < 0) ? "" : "\n", (srcfd < 0) ? "" : "\n",
parentTLI, parentTLI,
LSN_FORMAT_ARGS(switchpoint), LSN_FORMAT_ARGS(switchpoint),

View File

@ -1429,12 +1429,12 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len)
if (errormsg) if (errormsg)
ereport(ERROR, ereport(ERROR,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("could not read two-phase state from WAL at %X/%X: %s", errmsg("could not read two-phase state from WAL at %X/%08X: %s",
LSN_FORMAT_ARGS(lsn), errormsg))); LSN_FORMAT_ARGS(lsn), errormsg)));
else else
ereport(ERROR, ereport(ERROR,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("could not read two-phase state from WAL at %X/%X", errmsg("could not read two-phase state from WAL at %X/%08X",
LSN_FORMAT_ARGS(lsn)))); LSN_FORMAT_ARGS(lsn))));
} }
@ -1442,7 +1442,7 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len)
(XLogRecGetInfo(xlogreader) & XLOG_XACT_OPMASK) != XLOG_XACT_PREPARE) (XLogRecGetInfo(xlogreader) & XLOG_XACT_OPMASK) != XLOG_XACT_PREPARE)
ereport(ERROR, ereport(ERROR,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("expected two-phase state data is not present in WAL at %X/%X", errmsg("expected two-phase state data is not present in WAL at %X/%08X",
LSN_FORMAT_ARGS(lsn)))); LSN_FORMAT_ARGS(lsn))));
if (len != NULL) if (len != NULL)
@ -2533,7 +2533,7 @@ PrepareRedoAdd(FullTransactionId fxid, char *buf,
ereport(reachedConsistency ? ERROR : WARNING, ereport(reachedConsistency ? ERROR : WARNING,
(errmsg("could not recover two-phase state file for transaction %u", (errmsg("could not recover two-phase state file for transaction %u",
hdr->xid), hdr->xid),
errdetail("Two-phase state file has been found in WAL record %X/%X, but this transaction has already been restored from disk.", errdetail("Two-phase state file has been found in WAL record %X/%08X, but this transaction has already been restored from disk.",
LSN_FORMAT_ARGS(start_lsn)))); LSN_FORMAT_ARGS(start_lsn))));
return; return;
} }

View File

@ -1028,7 +1028,7 @@ XLogInsertRecord(XLogRecData *rdata,
oldCxt = MemoryContextSwitchTo(walDebugCxt); oldCxt = MemoryContextSwitchTo(walDebugCxt);
initStringInfo(&buf); initStringInfo(&buf);
appendStringInfo(&buf, "INSERT @ %X/%X: ", LSN_FORMAT_ARGS(EndPos)); appendStringInfo(&buf, "INSERT @ %X/%08X: ", LSN_FORMAT_ARGS(EndPos));
/* /*
* We have to piece together the WAL record data from the XLogRecData * We have to piece together the WAL record data from the XLogRecData
@ -1549,8 +1549,8 @@ WaitXLogInsertionsToFinish(XLogRecPtr upto)
if (upto > reservedUpto) if (upto > reservedUpto)
{ {
ereport(LOG, ereport(LOG,
(errmsg("request to flush past end of generated WAL; request %X/%X, current position %X/%X", errmsg("request to flush past end of generated WAL; request %X/%08X, current position %X/%08X",
LSN_FORMAT_ARGS(upto), LSN_FORMAT_ARGS(reservedUpto)))); LSN_FORMAT_ARGS(upto), LSN_FORMAT_ARGS(reservedUpto)));
upto = reservedUpto; upto = reservedUpto;
} }
@ -1716,7 +1716,7 @@ GetXLogBuffer(XLogRecPtr ptr, TimeLineID tli)
endptr = pg_atomic_read_u64(&XLogCtl->xlblocks[idx]); endptr = pg_atomic_read_u64(&XLogCtl->xlblocks[idx]);
if (expectedEndPtr != endptr) if (expectedEndPtr != endptr)
elog(PANIC, "could not find WAL buffer for %X/%X", elog(PANIC, "could not find WAL buffer for %X/%08X",
LSN_FORMAT_ARGS(ptr)); LSN_FORMAT_ARGS(ptr));
} }
else else
@ -1776,7 +1776,7 @@ WALReadFromBuffers(char *dstbuf, XLogRecPtr startptr, Size count,
inserted = pg_atomic_read_u64(&XLogCtl->logInsertResult); inserted = pg_atomic_read_u64(&XLogCtl->logInsertResult);
if (startptr + count > inserted) if (startptr + count > inserted)
ereport(ERROR, ereport(ERROR,
errmsg("cannot read past end of generated WAL: requested %X/%X, current position %X/%X", errmsg("cannot read past end of generated WAL: requested %X/%08X, current position %X/%08X",
LSN_FORMAT_ARGS(startptr + count), LSN_FORMAT_ARGS(startptr + count),
LSN_FORMAT_ARGS(inserted))); LSN_FORMAT_ARGS(inserted)));
@ -2281,7 +2281,7 @@ AdvanceXLInsertBuffer(XLogRecPtr upto, TimeLineID tli, bool opportunistic)
#ifdef WAL_DEBUG #ifdef WAL_DEBUG
if (XLOG_DEBUG && npages > 0) if (XLOG_DEBUG && npages > 0)
{ {
elog(DEBUG1, "initialized %d pages, up to %X/%X", elog(DEBUG1, "initialized %d pages, up to %X/%08X",
npages, LSN_FORMAT_ARGS(NewPageEndPtr)); npages, LSN_FORMAT_ARGS(NewPageEndPtr));
} }
#endif #endif
@ -2492,7 +2492,7 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible)
XLogRecPtr EndPtr = pg_atomic_read_u64(&XLogCtl->xlblocks[curridx]); XLogRecPtr EndPtr = pg_atomic_read_u64(&XLogCtl->xlblocks[curridx]);
if (LogwrtResult.Write >= EndPtr) if (LogwrtResult.Write >= EndPtr)
elog(PANIC, "xlog write request %X/%X is past end of log %X/%X", elog(PANIC, "xlog write request %X/%08X is past end of log %X/%08X",
LSN_FORMAT_ARGS(LogwrtResult.Write), LSN_FORMAT_ARGS(LogwrtResult.Write),
LSN_FORMAT_ARGS(EndPtr)); LSN_FORMAT_ARGS(EndPtr));
@ -2892,7 +2892,7 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
newMinRecoveryPoint = GetCurrentReplayRecPtr(&newMinRecoveryPointTLI); newMinRecoveryPoint = GetCurrentReplayRecPtr(&newMinRecoveryPointTLI);
if (!force && newMinRecoveryPoint < lsn) if (!force && newMinRecoveryPoint < lsn)
elog(WARNING, elog(WARNING,
"xlog min recovery request %X/%X is past current point %X/%X", "xlog min recovery request %X/%08X is past current point %X/%08X",
LSN_FORMAT_ARGS(lsn), LSN_FORMAT_ARGS(newMinRecoveryPoint)); LSN_FORMAT_ARGS(lsn), LSN_FORMAT_ARGS(newMinRecoveryPoint));
/* update control file */ /* update control file */
@ -2905,9 +2905,9 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
LocalMinRecoveryPointTLI = newMinRecoveryPointTLI; LocalMinRecoveryPointTLI = newMinRecoveryPointTLI;
ereport(DEBUG2, ereport(DEBUG2,
(errmsg_internal("updated min recovery point to %X/%X on timeline %u", errmsg_internal("updated min recovery point to %X/%08X on timeline %u",
LSN_FORMAT_ARGS(newMinRecoveryPoint), LSN_FORMAT_ARGS(newMinRecoveryPoint),
newMinRecoveryPointTLI))); newMinRecoveryPointTLI));
} }
} }
LWLockRelease(ControlFileLock); LWLockRelease(ControlFileLock);
@ -2945,7 +2945,7 @@ XLogFlush(XLogRecPtr record)
#ifdef WAL_DEBUG #ifdef WAL_DEBUG
if (XLOG_DEBUG) if (XLOG_DEBUG)
elog(LOG, "xlog flush request %X/%X; write %X/%X; flush %X/%X", elog(LOG, "xlog flush request %X/%08X; write %X/%08X; flush %X/%08X",
LSN_FORMAT_ARGS(record), LSN_FORMAT_ARGS(record),
LSN_FORMAT_ARGS(LogwrtResult.Write), LSN_FORMAT_ARGS(LogwrtResult.Write),
LSN_FORMAT_ARGS(LogwrtResult.Flush)); LSN_FORMAT_ARGS(LogwrtResult.Flush));
@ -3078,7 +3078,7 @@ XLogFlush(XLogRecPtr record)
*/ */
if (LogwrtResult.Flush < record) if (LogwrtResult.Flush < record)
elog(ERROR, elog(ERROR,
"xlog flush request %X/%X is not satisfied --- flushed only to %X/%X", "xlog flush request %X/%08X is not satisfied --- flushed only to %X/%08X",
LSN_FORMAT_ARGS(record), LSN_FORMAT_ARGS(record),
LSN_FORMAT_ARGS(LogwrtResult.Flush)); LSN_FORMAT_ARGS(LogwrtResult.Flush));
} }
@ -3205,7 +3205,7 @@ XLogBackgroundFlush(void)
#ifdef WAL_DEBUG #ifdef WAL_DEBUG
if (XLOG_DEBUG) if (XLOG_DEBUG)
elog(LOG, "xlog bg flush request write %X/%X; flush: %X/%X, current is write %X/%X; flush %X/%X", elog(LOG, "xlog bg flush request write %X/%08X; flush: %X/%08X, current is write %X/%08X; flush %X/%08X",
LSN_FORMAT_ARGS(WriteRqst.Write), LSN_FORMAT_ARGS(WriteRqst.Write),
LSN_FORMAT_ARGS(WriteRqst.Flush), LSN_FORMAT_ARGS(WriteRqst.Flush),
LSN_FORMAT_ARGS(LogwrtResult.Write), LSN_FORMAT_ARGS(LogwrtResult.Write),
@ -6921,7 +6921,7 @@ LogCheckpointEnd(bool restartpoint)
"%d removed, %d recycled; write=%ld.%03d s, " "%d removed, %d recycled; write=%ld.%03d s, "
"sync=%ld.%03d s, total=%ld.%03d s; sync files=%d, " "sync=%ld.%03d s, total=%ld.%03d s; sync files=%d, "
"longest=%ld.%03d s, average=%ld.%03d s; distance=%d kB, " "longest=%ld.%03d s, average=%ld.%03d s; distance=%d kB, "
"estimate=%d kB; lsn=%X/%X, redo lsn=%X/%X", "estimate=%d kB; lsn=%X/%08X, redo lsn=%X/%08X",
CheckpointStats.ckpt_bufs_written, CheckpointStats.ckpt_bufs_written,
(double) CheckpointStats.ckpt_bufs_written * 100 / NBuffers, (double) CheckpointStats.ckpt_bufs_written * 100 / NBuffers,
CheckpointStats.ckpt_slru_written, CheckpointStats.ckpt_slru_written,
@ -6945,7 +6945,7 @@ LogCheckpointEnd(bool restartpoint)
"%d removed, %d recycled; write=%ld.%03d s, " "%d removed, %d recycled; write=%ld.%03d s, "
"sync=%ld.%03d s, total=%ld.%03d s; sync files=%d, " "sync=%ld.%03d s, total=%ld.%03d s; sync files=%d, "
"longest=%ld.%03d s, average=%ld.%03d s; distance=%d kB, " "longest=%ld.%03d s, average=%ld.%03d s; distance=%d kB, "
"estimate=%d kB; lsn=%X/%X, redo lsn=%X/%X", "estimate=%d kB; lsn=%X/%08X, redo lsn=%X/%08X",
CheckpointStats.ckpt_bufs_written, CheckpointStats.ckpt_bufs_written,
(double) CheckpointStats.ckpt_bufs_written * 100 / NBuffers, (double) CheckpointStats.ckpt_bufs_written * 100 / NBuffers,
CheckpointStats.ckpt_slru_written, CheckpointStats.ckpt_slru_written,
@ -7641,7 +7641,7 @@ CreateOverwriteContrecordRecord(XLogRecPtr aborted_lsn, XLogRecPtr pagePtr,
if (!RecoveryInProgress()) if (!RecoveryInProgress())
elog(ERROR, "can only be used at end of recovery"); elog(ERROR, "can only be used at end of recovery");
if (pagePtr % XLOG_BLCKSZ != 0) if (pagePtr % XLOG_BLCKSZ != 0)
elog(ERROR, "invalid position for missing continuation record %X/%X", elog(ERROR, "invalid position for missing continuation record %X/%08X",
LSN_FORMAT_ARGS(pagePtr)); LSN_FORMAT_ARGS(pagePtr));
/* The current WAL insert position should be right after the page header */ /* The current WAL insert position should be right after the page header */
@ -7652,7 +7652,7 @@ CreateOverwriteContrecordRecord(XLogRecPtr aborted_lsn, XLogRecPtr pagePtr,
startPos += SizeOfXLogShortPHD; startPos += SizeOfXLogShortPHD;
recptr = GetXLogInsertRecPtr(); recptr = GetXLogInsertRecPtr();
if (recptr != startPos) if (recptr != startPos)
elog(ERROR, "invalid WAL insert position %X/%X for OVERWRITE_CONTRECORD", elog(ERROR, "invalid WAL insert position %X/%08X for OVERWRITE_CONTRECORD",
LSN_FORMAT_ARGS(recptr)); LSN_FORMAT_ARGS(recptr));
START_CRIT_SECTION(); START_CRIT_SECTION();
@ -7682,7 +7682,7 @@ CreateOverwriteContrecordRecord(XLogRecPtr aborted_lsn, XLogRecPtr pagePtr,
/* check that the record was inserted to the right place */ /* check that the record was inserted to the right place */
if (ProcLastRecPtr != startPos) if (ProcLastRecPtr != startPos)
elog(ERROR, "OVERWRITE_CONTRECORD was inserted to unexpected position %X/%X", elog(ERROR, "OVERWRITE_CONTRECORD was inserted to unexpected position %X/%08X",
LSN_FORMAT_ARGS(ProcLastRecPtr)); LSN_FORMAT_ARGS(ProcLastRecPtr));
XLogFlush(recptr); XLogFlush(recptr);
@ -7751,8 +7751,7 @@ RecoveryRestartPoint(const CheckPoint *checkPoint, XLogReaderState *record)
if (XLogHaveInvalidPages()) if (XLogHaveInvalidPages())
{ {
elog(DEBUG2, elog(DEBUG2,
"could not record restart point at %X/%X because there " "could not record restart point at %X/%08X because there are unresolved references to invalid pages",
"are unresolved references to invalid pages",
LSN_FORMAT_ARGS(checkPoint->redo)); LSN_FORMAT_ARGS(checkPoint->redo));
return; return;
} }
@ -7832,8 +7831,8 @@ CreateRestartPoint(int flags)
lastCheckPoint.redo <= ControlFile->checkPointCopy.redo) lastCheckPoint.redo <= ControlFile->checkPointCopy.redo)
{ {
ereport(DEBUG2, ereport(DEBUG2,
(errmsg_internal("skipping restartpoint, already performed at %X/%X", errmsg_internal("skipping restartpoint, already performed at %X/%08X",
LSN_FORMAT_ARGS(lastCheckPoint.redo)))); LSN_FORMAT_ARGS(lastCheckPoint.redo)));
UpdateMinRecoveryPoint(InvalidXLogRecPtr, true); UpdateMinRecoveryPoint(InvalidXLogRecPtr, true);
if (flags & CHECKPOINT_IS_SHUTDOWN) if (flags & CHECKPOINT_IS_SHUTDOWN)
@ -8017,10 +8016,10 @@ CreateRestartPoint(int flags)
xtime = GetLatestXTime(); xtime = GetLatestXTime();
ereport((log_checkpoints ? LOG : DEBUG2), ereport((log_checkpoints ? LOG : DEBUG2),
(errmsg("recovery restart point at %X/%X", errmsg("recovery restart point at %X/%08X",
LSN_FORMAT_ARGS(lastCheckPoint.redo)), LSN_FORMAT_ARGS(lastCheckPoint.redo)),
xtime ? errdetail("Last completed transaction was at log time %s.", xtime ? errdetail("Last completed transaction was at log time %s.",
timestamptz_to_str(xtime)) : 0)); timestamptz_to_str(xtime)) : 0);
/* /*
* Finally, execute archive_cleanup_command, if any. * Finally, execute archive_cleanup_command, if any.
@ -8281,8 +8280,8 @@ XLogRestorePoint(const char *rpName)
RecPtr = XLogInsert(RM_XLOG_ID, XLOG_RESTORE_POINT); RecPtr = XLogInsert(RM_XLOG_ID, XLOG_RESTORE_POINT);
ereport(LOG, ereport(LOG,
(errmsg("restore point \"%s\" created at %X/%X", errmsg("restore point \"%s\" created at %X/%08X",
rpName, LSN_FORMAT_ARGS(RecPtr)))); rpName, LSN_FORMAT_ARGS(RecPtr)));
return RecPtr; return RecPtr;
} }

View File

@ -42,7 +42,7 @@ build_backup_content(BackupState *state, bool ishistoryfile)
XLByteToSeg(state->startpoint, startsegno, wal_segment_size); XLByteToSeg(state->startpoint, startsegno, wal_segment_size);
XLogFileName(startxlogfile, state->starttli, startsegno, wal_segment_size); XLogFileName(startxlogfile, state->starttli, startsegno, wal_segment_size);
appendStringInfo(result, "START WAL LOCATION: %X/%X (file %s)\n", appendStringInfo(result, "START WAL LOCATION: %X/%08X (file %s)\n",
LSN_FORMAT_ARGS(state->startpoint), startxlogfile); LSN_FORMAT_ARGS(state->startpoint), startxlogfile);
if (ishistoryfile) if (ishistoryfile)
@ -52,11 +52,11 @@ build_backup_content(BackupState *state, bool ishistoryfile)
XLByteToSeg(state->stoppoint, stopsegno, wal_segment_size); XLByteToSeg(state->stoppoint, stopsegno, wal_segment_size);
XLogFileName(stopxlogfile, state->stoptli, stopsegno, wal_segment_size); XLogFileName(stopxlogfile, state->stoptli, stopsegno, wal_segment_size);
appendStringInfo(result, "STOP WAL LOCATION: %X/%X (file %s)\n", appendStringInfo(result, "STOP WAL LOCATION: %X/%08X (file %s)\n",
LSN_FORMAT_ARGS(state->stoppoint), stopxlogfile); LSN_FORMAT_ARGS(state->stoppoint), stopxlogfile);
} }
appendStringInfo(result, "CHECKPOINT LOCATION: %X/%X\n", appendStringInfo(result, "CHECKPOINT LOCATION: %X/%08X\n",
LSN_FORMAT_ARGS(state->checkpointloc)); LSN_FORMAT_ARGS(state->checkpointloc));
appendStringInfoString(result, "BACKUP METHOD: streamed\n"); appendStringInfoString(result, "BACKUP METHOD: streamed\n");
appendStringInfo(result, "BACKUP FROM: %s\n", appendStringInfo(result, "BACKUP FROM: %s\n",
@ -81,7 +81,7 @@ build_backup_content(BackupState *state, bool ishistoryfile)
Assert(XLogRecPtrIsInvalid(state->istartpoint) == (state->istarttli == 0)); Assert(XLogRecPtrIsInvalid(state->istartpoint) == (state->istarttli == 0));
if (!XLogRecPtrIsInvalid(state->istartpoint)) if (!XLogRecPtrIsInvalid(state->istartpoint))
{ {
appendStringInfo(result, "INCREMENTAL FROM LSN: %X/%X\n", appendStringInfo(result, "INCREMENTAL FROM LSN: %X/%08X\n",
LSN_FORMAT_ARGS(state->istartpoint)); LSN_FORMAT_ARGS(state->istartpoint));
appendStringInfo(result, "INCREMENTAL FROM TLI: %u\n", appendStringInfo(result, "INCREMENTAL FROM TLI: %u\n",
state->istarttli); state->istarttli);

View File

@ -546,7 +546,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
#ifdef XLOGPREFETCHER_DEBUG_LEVEL #ifdef XLOGPREFETCHER_DEBUG_LEVEL
elog(XLOGPREFETCHER_DEBUG_LEVEL, elog(XLOGPREFETCHER_DEBUG_LEVEL,
"suppressing all readahead until %X/%X is replayed due to possible TLI change", "suppressing all readahead until %X/%08X is replayed due to possible TLI change",
LSN_FORMAT_ARGS(record->lsn)); LSN_FORMAT_ARGS(record->lsn));
#endif #endif
@ -579,7 +579,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
#ifdef XLOGPREFETCHER_DEBUG_LEVEL #ifdef XLOGPREFETCHER_DEBUG_LEVEL
elog(XLOGPREFETCHER_DEBUG_LEVEL, elog(XLOGPREFETCHER_DEBUG_LEVEL,
"suppressing prefetch in database %u until %X/%X is replayed due to raw file copy", "suppressing prefetch in database %u until %X/%08X is replayed due to raw file copy",
rlocator.dbOid, rlocator.dbOid,
LSN_FORMAT_ARGS(record->lsn)); LSN_FORMAT_ARGS(record->lsn));
#endif #endif
@ -607,7 +607,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
#ifdef XLOGPREFETCHER_DEBUG_LEVEL #ifdef XLOGPREFETCHER_DEBUG_LEVEL
elog(XLOGPREFETCHER_DEBUG_LEVEL, elog(XLOGPREFETCHER_DEBUG_LEVEL,
"suppressing prefetch in relation %u/%u/%u until %X/%X is replayed, which creates the relation", "suppressing prefetch in relation %u/%u/%u until %X/%08X is replayed, which creates the relation",
xlrec->rlocator.spcOid, xlrec->rlocator.spcOid,
xlrec->rlocator.dbOid, xlrec->rlocator.dbOid,
xlrec->rlocator.relNumber, xlrec->rlocator.relNumber,
@ -630,7 +630,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
#ifdef XLOGPREFETCHER_DEBUG_LEVEL #ifdef XLOGPREFETCHER_DEBUG_LEVEL
elog(XLOGPREFETCHER_DEBUG_LEVEL, elog(XLOGPREFETCHER_DEBUG_LEVEL,
"suppressing prefetch in relation %u/%u/%u from block %u until %X/%X is replayed, which truncates the relation", "suppressing prefetch in relation %u/%u/%u from block %u until %X/%08X is replayed, which truncates the relation",
xlrec->rlocator.spcOid, xlrec->rlocator.spcOid,
xlrec->rlocator.dbOid, xlrec->rlocator.dbOid,
xlrec->rlocator.relNumber, xlrec->rlocator.relNumber,
@ -729,7 +729,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
{ {
#ifdef XLOGPREFETCHER_DEBUG_LEVEL #ifdef XLOGPREFETCHER_DEBUG_LEVEL
elog(XLOGPREFETCHER_DEBUG_LEVEL, elog(XLOGPREFETCHER_DEBUG_LEVEL,
"suppressing all prefetch in relation %u/%u/%u until %X/%X is replayed, because the relation does not exist on disk", "suppressing all prefetch in relation %u/%u/%u until %X/%08X is replayed, because the relation does not exist on disk",
reln->smgr_rlocator.locator.spcOid, reln->smgr_rlocator.locator.spcOid,
reln->smgr_rlocator.locator.dbOid, reln->smgr_rlocator.locator.dbOid,
reln->smgr_rlocator.locator.relNumber, reln->smgr_rlocator.locator.relNumber,
@ -750,7 +750,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
{ {
#ifdef XLOGPREFETCHER_DEBUG_LEVEL #ifdef XLOGPREFETCHER_DEBUG_LEVEL
elog(XLOGPREFETCHER_DEBUG_LEVEL, elog(XLOGPREFETCHER_DEBUG_LEVEL,
"suppressing prefetch in relation %u/%u/%u from block %u until %X/%X is replayed, because the relation is too small", "suppressing prefetch in relation %u/%u/%u from block %u until %X/%08X is replayed, because the relation is too small",
reln->smgr_rlocator.locator.spcOid, reln->smgr_rlocator.locator.spcOid,
reln->smgr_rlocator.locator.dbOid, reln->smgr_rlocator.locator.dbOid,
reln->smgr_rlocator.locator.relNumber, reln->smgr_rlocator.locator.relNumber,
@ -928,7 +928,7 @@ XLogPrefetcherIsFiltered(XLogPrefetcher *prefetcher, RelFileLocator rlocator,
{ {
#ifdef XLOGPREFETCHER_DEBUG_LEVEL #ifdef XLOGPREFETCHER_DEBUG_LEVEL
elog(XLOGPREFETCHER_DEBUG_LEVEL, elog(XLOGPREFETCHER_DEBUG_LEVEL,
"prefetch of %u/%u/%u block %u suppressed; filtering until LSN %X/%X is replayed (blocks >= %u filtered)", "prefetch of %u/%u/%u block %u suppressed; filtering until LSN %X/%08X is replayed (blocks >= %u filtered)",
rlocator.spcOid, rlocator.dbOid, rlocator.relNumber, blockno, rlocator.spcOid, rlocator.dbOid, rlocator.relNumber, blockno,
LSN_FORMAT_ARGS(filter->filter_until_replayed), LSN_FORMAT_ARGS(filter->filter_until_replayed),
filter->filter_from_block); filter->filter_from_block);
@ -944,7 +944,7 @@ XLogPrefetcherIsFiltered(XLogPrefetcher *prefetcher, RelFileLocator rlocator,
{ {
#ifdef XLOGPREFETCHER_DEBUG_LEVEL #ifdef XLOGPREFETCHER_DEBUG_LEVEL
elog(XLOGPREFETCHER_DEBUG_LEVEL, elog(XLOGPREFETCHER_DEBUG_LEVEL,
"prefetch of %u/%u/%u block %u suppressed; filtering until LSN %X/%X is replayed (whole database)", "prefetch of %u/%u/%u block %u suppressed; filtering until LSN %X/%08X is replayed (whole database)",
rlocator.spcOid, rlocator.dbOid, rlocator.relNumber, blockno, rlocator.spcOid, rlocator.dbOid, rlocator.relNumber, blockno,
LSN_FORMAT_ARGS(filter->filter_until_replayed)); LSN_FORMAT_ARGS(filter->filter_until_replayed));
#endif #endif

View File

@ -617,7 +617,7 @@ restart:
} }
else if (targetRecOff < pageHeaderSize) else if (targetRecOff < pageHeaderSize)
{ {
report_invalid_record(state, "invalid record offset at %X/%X: expected at least %u, got %u", report_invalid_record(state, "invalid record offset at %X/%08X: expected at least %u, got %u",
LSN_FORMAT_ARGS(RecPtr), LSN_FORMAT_ARGS(RecPtr),
pageHeaderSize, targetRecOff); pageHeaderSize, targetRecOff);
goto err; goto err;
@ -626,7 +626,7 @@ restart:
if ((((XLogPageHeader) state->readBuf)->xlp_info & XLP_FIRST_IS_CONTRECORD) && if ((((XLogPageHeader) state->readBuf)->xlp_info & XLP_FIRST_IS_CONTRECORD) &&
targetRecOff == pageHeaderSize) targetRecOff == pageHeaderSize)
{ {
report_invalid_record(state, "contrecord is requested by %X/%X", report_invalid_record(state, "contrecord is requested by %X/%08X",
LSN_FORMAT_ARGS(RecPtr)); LSN_FORMAT_ARGS(RecPtr));
goto err; goto err;
} }
@ -667,7 +667,7 @@ restart:
if (total_len < SizeOfXLogRecord) if (total_len < SizeOfXLogRecord)
{ {
report_invalid_record(state, report_invalid_record(state,
"invalid record length at %X/%X: expected at least %u, got %u", "invalid record length at %X/%08X: expected at least %u, got %u",
LSN_FORMAT_ARGS(RecPtr), LSN_FORMAT_ARGS(RecPtr),
(uint32) SizeOfXLogRecord, total_len); (uint32) SizeOfXLogRecord, total_len);
goto err; goto err;
@ -756,7 +756,7 @@ restart:
if (!(pageHeader->xlp_info & XLP_FIRST_IS_CONTRECORD)) if (!(pageHeader->xlp_info & XLP_FIRST_IS_CONTRECORD))
{ {
report_invalid_record(state, report_invalid_record(state,
"there is no contrecord flag at %X/%X", "there is no contrecord flag at %X/%08X",
LSN_FORMAT_ARGS(RecPtr)); LSN_FORMAT_ARGS(RecPtr));
goto err; goto err;
} }
@ -769,7 +769,7 @@ restart:
total_len != (pageHeader->xlp_rem_len + gotlen)) total_len != (pageHeader->xlp_rem_len + gotlen))
{ {
report_invalid_record(state, report_invalid_record(state,
"invalid contrecord length %u (expected %lld) at %X/%X", "invalid contrecord length %u (expected %lld) at %X/%08X",
pageHeader->xlp_rem_len, pageHeader->xlp_rem_len,
((long long) total_len) - gotlen, ((long long) total_len) - gotlen,
LSN_FORMAT_ARGS(RecPtr)); LSN_FORMAT_ARGS(RecPtr));
@ -1132,7 +1132,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
if (record->xl_tot_len < SizeOfXLogRecord) if (record->xl_tot_len < SizeOfXLogRecord)
{ {
report_invalid_record(state, report_invalid_record(state,
"invalid record length at %X/%X: expected at least %u, got %u", "invalid record length at %X/%08X: expected at least %u, got %u",
LSN_FORMAT_ARGS(RecPtr), LSN_FORMAT_ARGS(RecPtr),
(uint32) SizeOfXLogRecord, record->xl_tot_len); (uint32) SizeOfXLogRecord, record->xl_tot_len);
return false; return false;
@ -1140,7 +1140,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
if (!RmgrIdIsValid(record->xl_rmid)) if (!RmgrIdIsValid(record->xl_rmid))
{ {
report_invalid_record(state, report_invalid_record(state,
"invalid resource manager ID %u at %X/%X", "invalid resource manager ID %u at %X/%08X",
record->xl_rmid, LSN_FORMAT_ARGS(RecPtr)); record->xl_rmid, LSN_FORMAT_ARGS(RecPtr));
return false; return false;
} }
@ -1153,7 +1153,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
if (!(record->xl_prev < RecPtr)) if (!(record->xl_prev < RecPtr))
{ {
report_invalid_record(state, report_invalid_record(state,
"record with incorrect prev-link %X/%X at %X/%X", "record with incorrect prev-link %X/%08X at %X/%08X",
LSN_FORMAT_ARGS(record->xl_prev), LSN_FORMAT_ARGS(record->xl_prev),
LSN_FORMAT_ARGS(RecPtr)); LSN_FORMAT_ARGS(RecPtr));
return false; return false;
@ -1169,7 +1169,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
if (record->xl_prev != PrevRecPtr) if (record->xl_prev != PrevRecPtr)
{ {
report_invalid_record(state, report_invalid_record(state,
"record with incorrect prev-link %X/%X at %X/%X", "record with incorrect prev-link %X/%08X at %X/%08X",
LSN_FORMAT_ARGS(record->xl_prev), LSN_FORMAT_ARGS(record->xl_prev),
LSN_FORMAT_ARGS(RecPtr)); LSN_FORMAT_ARGS(RecPtr));
return false; return false;
@ -1207,7 +1207,7 @@ ValidXLogRecord(XLogReaderState *state, XLogRecord *record, XLogRecPtr recptr)
if (!EQ_CRC32C(record->xl_crc, crc)) if (!EQ_CRC32C(record->xl_crc, crc))
{ {
report_invalid_record(state, report_invalid_record(state,
"incorrect resource manager data checksum in record at %X/%X", "incorrect resource manager data checksum in record at %X/%08X",
LSN_FORMAT_ARGS(recptr)); LSN_FORMAT_ARGS(recptr));
return false; return false;
} }
@ -1241,7 +1241,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
XLogFileName(fname, state->seg.ws_tli, segno, state->segcxt.ws_segsize); XLogFileName(fname, state->seg.ws_tli, segno, state->segcxt.ws_segsize);
report_invalid_record(state, report_invalid_record(state,
"invalid magic number %04X in WAL segment %s, LSN %X/%X, offset %u", "invalid magic number %04X in WAL segment %s, LSN %X/%08X, offset %u",
hdr->xlp_magic, hdr->xlp_magic,
fname, fname,
LSN_FORMAT_ARGS(recptr), LSN_FORMAT_ARGS(recptr),
@ -1256,7 +1256,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
XLogFileName(fname, state->seg.ws_tli, segno, state->segcxt.ws_segsize); XLogFileName(fname, state->seg.ws_tli, segno, state->segcxt.ws_segsize);
report_invalid_record(state, report_invalid_record(state,
"invalid info bits %04X in WAL segment %s, LSN %X/%X, offset %u", "invalid info bits %04X in WAL segment %s, LSN %X/%08X, offset %u",
hdr->xlp_info, hdr->xlp_info,
fname, fname,
LSN_FORMAT_ARGS(recptr), LSN_FORMAT_ARGS(recptr),
@ -1298,7 +1298,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
/* hmm, first page of file doesn't have a long header? */ /* hmm, first page of file doesn't have a long header? */
report_invalid_record(state, report_invalid_record(state,
"invalid info bits %04X in WAL segment %s, LSN %X/%X, offset %u", "invalid info bits %04X in WAL segment %s, LSN %X/%08X, offset %u",
hdr->xlp_info, hdr->xlp_info,
fname, fname,
LSN_FORMAT_ARGS(recptr), LSN_FORMAT_ARGS(recptr),
@ -1318,7 +1318,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
XLogFileName(fname, state->seg.ws_tli, segno, state->segcxt.ws_segsize); XLogFileName(fname, state->seg.ws_tli, segno, state->segcxt.ws_segsize);
report_invalid_record(state, report_invalid_record(state,
"unexpected pageaddr %X/%X in WAL segment %s, LSN %X/%X, offset %u", "unexpected pageaddr %X/%08X in WAL segment %s, LSN %X/%08X, offset %u",
LSN_FORMAT_ARGS(hdr->xlp_pageaddr), LSN_FORMAT_ARGS(hdr->xlp_pageaddr),
fname, fname,
LSN_FORMAT_ARGS(recptr), LSN_FORMAT_ARGS(recptr),
@ -1344,7 +1344,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
XLogFileName(fname, state->seg.ws_tli, segno, state->segcxt.ws_segsize); XLogFileName(fname, state->seg.ws_tli, segno, state->segcxt.ws_segsize);
report_invalid_record(state, report_invalid_record(state,
"out-of-sequence timeline ID %u (after %u) in WAL segment %s, LSN %X/%X, offset %u", "out-of-sequence timeline ID %u (after %u) in WAL segment %s, LSN %X/%08X, offset %u",
hdr->xlp_tli, hdr->xlp_tli,
state->latestPageTLI, state->latestPageTLI,
fname, fname,
@ -1756,7 +1756,7 @@ DecodeXLogRecord(XLogReaderState *state,
if (block_id <= decoded->max_block_id) if (block_id <= decoded->max_block_id)
{ {
report_invalid_record(state, report_invalid_record(state,
"out-of-order block_id %u at %X/%X", "out-of-order block_id %u at %X/%08X",
block_id, block_id,
LSN_FORMAT_ARGS(state->ReadRecPtr)); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
@ -1780,14 +1780,14 @@ DecodeXLogRecord(XLogReaderState *state,
if (blk->has_data && blk->data_len == 0) if (blk->has_data && blk->data_len == 0)
{ {
report_invalid_record(state, report_invalid_record(state,
"BKPBLOCK_HAS_DATA set, but no data included at %X/%X", "BKPBLOCK_HAS_DATA set, but no data included at %X/%08X",
LSN_FORMAT_ARGS(state->ReadRecPtr)); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
} }
if (!blk->has_data && blk->data_len != 0) if (!blk->has_data && blk->data_len != 0)
{ {
report_invalid_record(state, report_invalid_record(state,
"BKPBLOCK_HAS_DATA not set, but data length is %u at %X/%X", "BKPBLOCK_HAS_DATA not set, but data length is %u at %X/%08X",
(unsigned int) blk->data_len, (unsigned int) blk->data_len,
LSN_FORMAT_ARGS(state->ReadRecPtr)); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
@ -1823,7 +1823,7 @@ DecodeXLogRecord(XLogReaderState *state,
blk->bimg_len == BLCKSZ)) blk->bimg_len == BLCKSZ))
{ {
report_invalid_record(state, report_invalid_record(state,
"BKPIMAGE_HAS_HOLE set, but hole offset %u length %u block image length %u at %X/%X", "BKPIMAGE_HAS_HOLE set, but hole offset %u length %u block image length %u at %X/%08X",
(unsigned int) blk->hole_offset, (unsigned int) blk->hole_offset,
(unsigned int) blk->hole_length, (unsigned int) blk->hole_length,
(unsigned int) blk->bimg_len, (unsigned int) blk->bimg_len,
@ -1839,7 +1839,7 @@ DecodeXLogRecord(XLogReaderState *state,
(blk->hole_offset != 0 || blk->hole_length != 0)) (blk->hole_offset != 0 || blk->hole_length != 0))
{ {
report_invalid_record(state, report_invalid_record(state,
"BKPIMAGE_HAS_HOLE not set, but hole offset %u length %u at %X/%X", "BKPIMAGE_HAS_HOLE not set, but hole offset %u length %u at %X/%08X",
(unsigned int) blk->hole_offset, (unsigned int) blk->hole_offset,
(unsigned int) blk->hole_length, (unsigned int) blk->hole_length,
LSN_FORMAT_ARGS(state->ReadRecPtr)); LSN_FORMAT_ARGS(state->ReadRecPtr));
@ -1853,7 +1853,7 @@ DecodeXLogRecord(XLogReaderState *state,
blk->bimg_len == BLCKSZ) blk->bimg_len == BLCKSZ)
{ {
report_invalid_record(state, report_invalid_record(state,
"BKPIMAGE_COMPRESSED set, but block image length %u at %X/%X", "BKPIMAGE_COMPRESSED set, but block image length %u at %X/%08X",
(unsigned int) blk->bimg_len, (unsigned int) blk->bimg_len,
LSN_FORMAT_ARGS(state->ReadRecPtr)); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
@ -1868,7 +1868,7 @@ DecodeXLogRecord(XLogReaderState *state,
blk->bimg_len != BLCKSZ) blk->bimg_len != BLCKSZ)
{ {
report_invalid_record(state, report_invalid_record(state,
"neither BKPIMAGE_HAS_HOLE nor BKPIMAGE_COMPRESSED set, but block image length is %u at %X/%X", "neither BKPIMAGE_HAS_HOLE nor BKPIMAGE_COMPRESSED set, but block image length is %u at %X/%08X",
(unsigned int) blk->data_len, (unsigned int) blk->data_len,
LSN_FORMAT_ARGS(state->ReadRecPtr)); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
@ -1884,7 +1884,7 @@ DecodeXLogRecord(XLogReaderState *state,
if (rlocator == NULL) if (rlocator == NULL)
{ {
report_invalid_record(state, report_invalid_record(state,
"BKPBLOCK_SAME_REL set but no previous rel at %X/%X", "BKPBLOCK_SAME_REL set but no previous rel at %X/%08X",
LSN_FORMAT_ARGS(state->ReadRecPtr)); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
} }
@ -1896,7 +1896,7 @@ DecodeXLogRecord(XLogReaderState *state,
else else
{ {
report_invalid_record(state, report_invalid_record(state,
"invalid block_id %u at %X/%X", "invalid block_id %u at %X/%08X",
block_id, LSN_FORMAT_ARGS(state->ReadRecPtr)); block_id, LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
} }
@ -1963,7 +1963,7 @@ DecodeXLogRecord(XLogReaderState *state,
shortdata_err: shortdata_err:
report_invalid_record(state, report_invalid_record(state,
"record with invalid length at %X/%X", "record with invalid length at %X/%08X",
LSN_FORMAT_ARGS(state->ReadRecPtr)); LSN_FORMAT_ARGS(state->ReadRecPtr));
err: err:
*errormsg = state->errormsg_buf; *errormsg = state->errormsg_buf;
@ -2073,14 +2073,14 @@ RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
!record->record->blocks[block_id].in_use) !record->record->blocks[block_id].in_use)
{ {
report_invalid_record(record, report_invalid_record(record,
"could not restore image at %X/%X with invalid block %d specified", "could not restore image at %X/%08X with invalid block %d specified",
LSN_FORMAT_ARGS(record->ReadRecPtr), LSN_FORMAT_ARGS(record->ReadRecPtr),
block_id); block_id);
return false; return false;
} }
if (!record->record->blocks[block_id].has_image) if (!record->record->blocks[block_id].has_image)
{ {
report_invalid_record(record, "could not restore image at %X/%X with invalid state, block %d", report_invalid_record(record, "could not restore image at %X/%08X with invalid state, block %d",
LSN_FORMAT_ARGS(record->ReadRecPtr), LSN_FORMAT_ARGS(record->ReadRecPtr),
block_id); block_id);
return false; return false;
@ -2107,7 +2107,7 @@ RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
bkpb->bimg_len, BLCKSZ - bkpb->hole_length) <= 0) bkpb->bimg_len, BLCKSZ - bkpb->hole_length) <= 0)
decomp_success = false; decomp_success = false;
#else #else
report_invalid_record(record, "could not restore image at %X/%X compressed with %s not supported by build, block %d", report_invalid_record(record, "could not restore image at %X/%08X compressed with %s not supported by build, block %d",
LSN_FORMAT_ARGS(record->ReadRecPtr), LSN_FORMAT_ARGS(record->ReadRecPtr),
"LZ4", "LZ4",
block_id); block_id);
@ -2124,7 +2124,7 @@ RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
if (ZSTD_isError(decomp_result)) if (ZSTD_isError(decomp_result))
decomp_success = false; decomp_success = false;
#else #else
report_invalid_record(record, "could not restore image at %X/%X compressed with %s not supported by build, block %d", report_invalid_record(record, "could not restore image at %X/%08X compressed with %s not supported by build, block %d",
LSN_FORMAT_ARGS(record->ReadRecPtr), LSN_FORMAT_ARGS(record->ReadRecPtr),
"zstd", "zstd",
block_id); block_id);
@ -2133,7 +2133,7 @@ RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
} }
else else
{ {
report_invalid_record(record, "could not restore image at %X/%X compressed with unknown method, block %d", report_invalid_record(record, "could not restore image at %X/%08X compressed with unknown method, block %d",
LSN_FORMAT_ARGS(record->ReadRecPtr), LSN_FORMAT_ARGS(record->ReadRecPtr),
block_id); block_id);
return false; return false;
@ -2141,7 +2141,7 @@ RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
if (!decomp_success) if (!decomp_success)
{ {
report_invalid_record(record, "could not decompress image at %X/%X, block %d", report_invalid_record(record, "could not decompress image at %X/%08X, block %d",
LSN_FORMAT_ARGS(record->ReadRecPtr), LSN_FORMAT_ARGS(record->ReadRecPtr),
block_id); block_id);
return false; return false;

View File

@ -620,10 +620,10 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
* than ControlFile->checkPoint is used. * than ControlFile->checkPoint is used.
*/ */
ereport(LOG, ereport(LOG,
(errmsg("starting backup recovery with redo LSN %X/%X, checkpoint LSN %X/%X, on timeline ID %u", errmsg("starting backup recovery with redo LSN %X/%08X, checkpoint LSN %X/%08X, on timeline ID %u",
LSN_FORMAT_ARGS(RedoStartLSN), LSN_FORMAT_ARGS(RedoStartLSN),
LSN_FORMAT_ARGS(CheckPointLoc), LSN_FORMAT_ARGS(CheckPointLoc),
CheckPointTLI))); CheckPointTLI));
/* /*
* When a backup_label file is present, we want to roll forward from * When a backup_label file is present, we want to roll forward from
@ -636,8 +636,8 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
memcpy(&checkPoint, XLogRecGetData(xlogreader), sizeof(CheckPoint)); memcpy(&checkPoint, XLogRecGetData(xlogreader), sizeof(CheckPoint));
wasShutdown = ((record->xl_info & ~XLR_INFO_MASK) == XLOG_CHECKPOINT_SHUTDOWN); wasShutdown = ((record->xl_info & ~XLR_INFO_MASK) == XLOG_CHECKPOINT_SHUTDOWN);
ereport(DEBUG1, ereport(DEBUG1,
(errmsg_internal("checkpoint record is at %X/%X", errmsg_internal("checkpoint record is at %X/%08X",
LSN_FORMAT_ARGS(CheckPointLoc)))); LSN_FORMAT_ARGS(CheckPointLoc)));
InRecovery = true; /* force recovery even if SHUTDOWNED */ InRecovery = true; /* force recovery even if SHUTDOWNED */
/* /*
@ -652,23 +652,23 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
if (!ReadRecord(xlogprefetcher, LOG, false, if (!ReadRecord(xlogprefetcher, LOG, false,
checkPoint.ThisTimeLineID)) checkPoint.ThisTimeLineID))
ereport(FATAL, ereport(FATAL,
(errmsg("could not find redo location %X/%X referenced by checkpoint record at %X/%X", errmsg("could not find redo location %X/%08X referenced by checkpoint record at %X/%08X",
LSN_FORMAT_ARGS(checkPoint.redo), LSN_FORMAT_ARGS(CheckPointLoc)), LSN_FORMAT_ARGS(checkPoint.redo), LSN_FORMAT_ARGS(CheckPointLoc)),
errhint("If you are restoring from a backup, touch \"%s/recovery.signal\" or \"%s/standby.signal\" and add required recovery options.\n" errhint("If you are restoring from a backup, touch \"%s/recovery.signal\" or \"%s/standby.signal\" and add required recovery options.\n"
"If you are not restoring from a backup, try removing the file \"%s/backup_label\".\n" "If you are not restoring from a backup, try removing the file \"%s/backup_label\".\n"
"Be careful: removing \"%s/backup_label\" will result in a corrupt cluster if restoring from a backup.", "Be careful: removing \"%s/backup_label\" will result in a corrupt cluster if restoring from a backup.",
DataDir, DataDir, DataDir, DataDir))); DataDir, DataDir, DataDir, DataDir));
} }
} }
else else
{ {
ereport(FATAL, ereport(FATAL,
(errmsg("could not locate required checkpoint record at %X/%X", errmsg("could not locate required checkpoint record at %X/%08X",
LSN_FORMAT_ARGS(CheckPointLoc)), LSN_FORMAT_ARGS(CheckPointLoc)),
errhint("If you are restoring from a backup, touch \"%s/recovery.signal\" or \"%s/standby.signal\" and add required recovery options.\n" errhint("If you are restoring from a backup, touch \"%s/recovery.signal\" or \"%s/standby.signal\" and add required recovery options.\n"
"If you are not restoring from a backup, try removing the file \"%s/backup_label\".\n" "If you are not restoring from a backup, try removing the file \"%s/backup_label\".\n"
"Be careful: removing \"%s/backup_label\" will result in a corrupt cluster if restoring from a backup.", "Be careful: removing \"%s/backup_label\" will result in a corrupt cluster if restoring from a backup.",
DataDir, DataDir, DataDir, DataDir))); DataDir, DataDir, DataDir, DataDir));
wasShutdown = false; /* keep compiler quiet */ wasShutdown = false; /* keep compiler quiet */
} }
@ -773,8 +773,8 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
*/ */
if (!XLogRecPtrIsInvalid(ControlFile->backupStartPoint)) if (!XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
ereport(LOG, ereport(LOG,
(errmsg("restarting backup recovery with redo LSN %X/%X", errmsg("restarting backup recovery with redo LSN %X/%08X",
LSN_FORMAT_ARGS(ControlFile->backupStartPoint)))); LSN_FORMAT_ARGS(ControlFile->backupStartPoint)));
/* Get the last valid checkpoint record. */ /* Get the last valid checkpoint record. */
CheckPointLoc = ControlFile->checkPoint; CheckPointLoc = ControlFile->checkPoint;
@ -786,8 +786,8 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
if (record != NULL) if (record != NULL)
{ {
ereport(DEBUG1, ereport(DEBUG1,
(errmsg_internal("checkpoint record is at %X/%X", errmsg_internal("checkpoint record is at %X/%08X",
LSN_FORMAT_ARGS(CheckPointLoc)))); LSN_FORMAT_ARGS(CheckPointLoc)));
} }
else else
{ {
@ -798,8 +798,8 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
* simplify processing around checkpoints. * simplify processing around checkpoints.
*/ */
ereport(PANIC, ereport(PANIC,
(errmsg("could not locate a valid checkpoint record at %X/%X", errmsg("could not locate a valid checkpoint record at %X/%08X",
LSN_FORMAT_ARGS(CheckPointLoc)))); LSN_FORMAT_ARGS(CheckPointLoc)));
} }
memcpy(&checkPoint, XLogRecGetData(xlogreader), sizeof(CheckPoint)); memcpy(&checkPoint, XLogRecGetData(xlogreader), sizeof(CheckPoint));
wasShutdown = ((record->xl_info & ~XLR_INFO_MASK) == XLOG_CHECKPOINT_SHUTDOWN); wasShutdown = ((record->xl_info & ~XLR_INFO_MASK) == XLOG_CHECKPOINT_SHUTDOWN);
@ -824,8 +824,8 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
recoveryTargetName))); recoveryTargetName)));
else if (recoveryTarget == RECOVERY_TARGET_LSN) else if (recoveryTarget == RECOVERY_TARGET_LSN)
ereport(LOG, ereport(LOG,
(errmsg("starting point-in-time recovery to WAL location (LSN) \"%X/%X\"", errmsg("starting point-in-time recovery to WAL location (LSN) \"%X/%08X\"",
LSN_FORMAT_ARGS(recoveryTargetLSN)))); LSN_FORMAT_ARGS(recoveryTargetLSN)));
else if (recoveryTarget == RECOVERY_TARGET_IMMEDIATE) else if (recoveryTarget == RECOVERY_TARGET_IMMEDIATE)
ereport(LOG, ereport(LOG,
(errmsg("starting point-in-time recovery to earliest consistent point"))); (errmsg("starting point-in-time recovery to earliest consistent point")));
@ -855,7 +855,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
(errmsg("requested timeline %u is not a child of this server's history", (errmsg("requested timeline %u is not a child of this server's history",
recoveryTargetTLI), recoveryTargetTLI),
/* translator: %s is a backup_label file or a pg_control file */ /* translator: %s is a backup_label file or a pg_control file */
errdetail("Latest checkpoint in file \"%s\" is at %X/%X on timeline %u, but in the history of the requested timeline, the server forked off from that timeline at %X/%X.", errdetail("Latest checkpoint in file \"%s\" is at %X/%08X on timeline %u, but in the history of the requested timeline, the server forked off from that timeline at %X/%08X.",
haveBackupLabel ? "backup_label" : "pg_control", haveBackupLabel ? "backup_label" : "pg_control",
LSN_FORMAT_ARGS(CheckPointLoc), LSN_FORMAT_ARGS(CheckPointLoc),
CheckPointTLI, CheckPointTLI,
@ -870,15 +870,15 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
tliOfPointInHistory(ControlFile->minRecoveryPoint - 1, expectedTLEs) != tliOfPointInHistory(ControlFile->minRecoveryPoint - 1, expectedTLEs) !=
ControlFile->minRecoveryPointTLI) ControlFile->minRecoveryPointTLI)
ereport(FATAL, ereport(FATAL,
(errmsg("requested timeline %u does not contain minimum recovery point %X/%X on timeline %u", errmsg("requested timeline %u does not contain minimum recovery point %X/%08X on timeline %u",
recoveryTargetTLI, recoveryTargetTLI,
LSN_FORMAT_ARGS(ControlFile->minRecoveryPoint), LSN_FORMAT_ARGS(ControlFile->minRecoveryPoint),
ControlFile->minRecoveryPointTLI))); ControlFile->minRecoveryPointTLI));
ereport(DEBUG1, ereport(DEBUG1,
(errmsg_internal("redo record is at %X/%X; shutdown %s", errmsg_internal("redo record is at %X/%08X; shutdown %s",
LSN_FORMAT_ARGS(checkPoint.redo), LSN_FORMAT_ARGS(checkPoint.redo),
wasShutdown ? "true" : "false"))); wasShutdown ? "true" : "false"));
ereport(DEBUG1, ereport(DEBUG1,
(errmsg_internal("next transaction ID: " UINT64_FORMAT "; next OID: %u", (errmsg_internal("next transaction ID: " UINT64_FORMAT "; next OID: %u",
U64FromFullTransactionId(checkPoint.nextXid), U64FromFullTransactionId(checkPoint.nextXid),
@ -1253,14 +1253,14 @@ read_backup_label(XLogRecPtr *checkPointLoc, TimeLineID *backupLabelTLI,
* is pretty crude, but we are not expecting any variability in the file * is pretty crude, but we are not expecting any variability in the file
* format). * format).
*/ */
if (fscanf(lfp, "START WAL LOCATION: %X/%X (file %08X%16s)%c", if (fscanf(lfp, "START WAL LOCATION: %X/%08X (file %08X%16s)%c",
&hi, &lo, &tli_from_walseg, startxlogfilename, &ch) != 5 || ch != '\n') &hi, &lo, &tli_from_walseg, startxlogfilename, &ch) != 5 || ch != '\n')
ereport(FATAL, ereport(FATAL,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("invalid data in file \"%s\"", BACKUP_LABEL_FILE))); errmsg("invalid data in file \"%s\"", BACKUP_LABEL_FILE)));
RedoStartLSN = ((uint64) hi) << 32 | lo; RedoStartLSN = ((uint64) hi) << 32 | lo;
RedoStartTLI = tli_from_walseg; RedoStartTLI = tli_from_walseg;
if (fscanf(lfp, "CHECKPOINT LOCATION: %X/%X%c", if (fscanf(lfp, "CHECKPOINT LOCATION: %X/%08X%c",
&hi, &lo, &ch) != 3 || ch != '\n') &hi, &lo, &ch) != 3 || ch != '\n')
ereport(FATAL, ereport(FATAL,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
@ -1332,7 +1332,7 @@ read_backup_label(XLogRecPtr *checkPointLoc, TimeLineID *backupLabelTLI,
tli_from_file, BACKUP_LABEL_FILE))); tli_from_file, BACKUP_LABEL_FILE)));
} }
if (fscanf(lfp, "INCREMENTAL FROM LSN: %X/%X\n", &hi, &lo) > 0) if (fscanf(lfp, "INCREMENTAL FROM LSN: %X/%08X\n", &hi, &lo) > 0)
ereport(FATAL, ereport(FATAL,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("this is an incremental backup, not a data directory"), errmsg("this is an incremental backup, not a data directory"),
@ -1722,8 +1722,8 @@ PerformWalRecovery(void)
if (record->xl_rmid != RM_XLOG_ID || if (record->xl_rmid != RM_XLOG_ID ||
(record->xl_info & ~XLR_INFO_MASK) != XLOG_CHECKPOINT_REDO) (record->xl_info & ~XLR_INFO_MASK) != XLOG_CHECKPOINT_REDO)
ereport(FATAL, ereport(FATAL,
(errmsg("unexpected record type found at redo point %X/%X", errmsg("unexpected record type found at redo point %X/%08X",
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr)))); LSN_FORMAT_ARGS(xlogreader->ReadRecPtr)));
} }
else else
{ {
@ -1745,8 +1745,8 @@ PerformWalRecovery(void)
RmgrStartup(); RmgrStartup();
ereport(LOG, ereport(LOG,
(errmsg("redo starts at %X/%X", errmsg("redo starts at %X/%08X",
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr)))); LSN_FORMAT_ARGS(xlogreader->ReadRecPtr)));
/* Prepare to report progress of the redo phase. */ /* Prepare to report progress of the redo phase. */
if (!StandbyMode) if (!StandbyMode)
@ -1758,7 +1758,7 @@ PerformWalRecovery(void)
do do
{ {
if (!StandbyMode) if (!StandbyMode)
ereport_startup_progress("redo in progress, elapsed time: %ld.%02d s, current LSN: %X/%X", ereport_startup_progress("redo in progress, elapsed time: %ld.%02d s, current LSN: %X/%08X",
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr)); LSN_FORMAT_ARGS(xlogreader->ReadRecPtr));
#ifdef WAL_DEBUG #ifdef WAL_DEBUG
@ -1767,7 +1767,7 @@ PerformWalRecovery(void)
StringInfoData buf; StringInfoData buf;
initStringInfo(&buf); initStringInfo(&buf);
appendStringInfo(&buf, "REDO @ %X/%X; LSN %X/%X: ", appendStringInfo(&buf, "REDO @ %X/%08X; LSN %X/%08X: ",
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr), LSN_FORMAT_ARGS(xlogreader->ReadRecPtr),
LSN_FORMAT_ARGS(xlogreader->EndRecPtr)); LSN_FORMAT_ARGS(xlogreader->EndRecPtr));
xlog_outrec(&buf, xlogreader); xlog_outrec(&buf, xlogreader);
@ -1880,9 +1880,9 @@ PerformWalRecovery(void)
RmgrCleanup(); RmgrCleanup();
ereport(LOG, ereport(LOG,
(errmsg("redo done at %X/%X system usage: %s", errmsg("redo done at %X/%08X system usage: %s",
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr), LSN_FORMAT_ARGS(xlogreader->ReadRecPtr),
pg_rusage_show(&ru0)))); pg_rusage_show(&ru0)));
xtime = GetLatestXTime(); xtime = GetLatestXTime();
if (xtime) if (xtime)
ereport(LOG, ereport(LOG,
@ -2092,7 +2092,7 @@ xlogrecovery_redo(XLogReaderState *record, TimeLineID replayTLI)
memcpy(&xlrec, XLogRecGetData(record), sizeof(xl_overwrite_contrecord)); memcpy(&xlrec, XLogRecGetData(record), sizeof(xl_overwrite_contrecord));
if (xlrec.overwritten_lsn != record->overwrittenRecPtr) if (xlrec.overwritten_lsn != record->overwrittenRecPtr)
elog(FATAL, "mismatching overwritten LSN %X/%X -> %X/%X", elog(FATAL, "mismatching overwritten LSN %X/%08X -> %X/%08X",
LSN_FORMAT_ARGS(xlrec.overwritten_lsn), LSN_FORMAT_ARGS(xlrec.overwritten_lsn),
LSN_FORMAT_ARGS(record->overwrittenRecPtr)); LSN_FORMAT_ARGS(record->overwrittenRecPtr));
@ -2101,9 +2101,9 @@ xlogrecovery_redo(XLogReaderState *record, TimeLineID replayTLI)
missingContrecPtr = InvalidXLogRecPtr; missingContrecPtr = InvalidXLogRecPtr;
ereport(LOG, ereport(LOG,
(errmsg("successfully skipped missing contrecord at %X/%X, overwritten at %s", errmsg("successfully skipped missing contrecord at %X/%08X, overwritten at %s",
LSN_FORMAT_ARGS(xlrec.overwritten_lsn), LSN_FORMAT_ARGS(xlrec.overwritten_lsn),
timestamptz_to_str(xlrec.overwrite_time)))); timestamptz_to_str(xlrec.overwrite_time)));
/* Verifying the record should only happen once */ /* Verifying the record should only happen once */
record->overwrittenRecPtr = InvalidXLogRecPtr; record->overwrittenRecPtr = InvalidXLogRecPtr;
@ -2129,7 +2129,7 @@ xlogrecovery_redo(XLogReaderState *record, TimeLineID replayTLI)
backupEndPoint = lsn; backupEndPoint = lsn;
} }
else else
elog(DEBUG1, "saw end-of-backup record for backup starting at %X/%X, waiting for %X/%X", elog(DEBUG1, "saw end-of-backup record for backup starting at %X/%08X, waiting for %X/%08X",
LSN_FORMAT_ARGS(startpoint), LSN_FORMAT_ARGS(backupStartPoint)); LSN_FORMAT_ARGS(startpoint), LSN_FORMAT_ARGS(backupStartPoint));
} }
} }
@ -2224,9 +2224,9 @@ CheckRecoveryConsistency(void)
backupEndRequired = false; backupEndRequired = false;
ereport(LOG, ereport(LOG,
(errmsg("completed backup recovery with redo LSN %X/%X and end LSN %X/%X", errmsg("completed backup recovery with redo LSN %X/%08X and end LSN %X/%08X",
LSN_FORMAT_ARGS(saveBackupStartPoint), LSN_FORMAT_ARGS(saveBackupStartPoint),
LSN_FORMAT_ARGS(saveBackupEndPoint)))); LSN_FORMAT_ARGS(saveBackupEndPoint)));
} }
/* /*
@ -2255,8 +2255,8 @@ CheckRecoveryConsistency(void)
reachedConsistency = true; reachedConsistency = true;
SendPostmasterSignal(PMSIGNAL_RECOVERY_CONSISTENT); SendPostmasterSignal(PMSIGNAL_RECOVERY_CONSISTENT);
ereport(LOG, ereport(LOG,
(errmsg("consistent recovery state reached at %X/%X", errmsg("consistent recovery state reached at %X/%08X",
LSN_FORMAT_ARGS(lastReplayedEndRecPtr)))); LSN_FORMAT_ARGS(lastReplayedEndRecPtr)));
} }
/* /*
@ -2293,7 +2293,7 @@ rm_redo_error_callback(void *arg)
xlog_block_info(&buf, record); xlog_block_info(&buf, record);
/* translator: %s is a WAL record description */ /* translator: %s is a WAL record description */
errcontext("WAL redo at %X/%X for %s", errcontext("WAL redo at %X/%08X for %s",
LSN_FORMAT_ARGS(record->ReadRecPtr), LSN_FORMAT_ARGS(record->ReadRecPtr),
buf.data); buf.data);
@ -2328,7 +2328,7 @@ xlog_outdesc(StringInfo buf, XLogReaderState *record)
static void static void
xlog_outrec(StringInfo buf, XLogReaderState *record) xlog_outrec(StringInfo buf, XLogReaderState *record)
{ {
appendStringInfo(buf, "prev %X/%X; xid %u", appendStringInfo(buf, "prev %X/%08X; xid %u",
LSN_FORMAT_ARGS(XLogRecGetPrev(record)), LSN_FORMAT_ARGS(XLogRecGetPrev(record)),
XLogRecGetXid(record)); XLogRecGetXid(record));
@ -2416,10 +2416,10 @@ checkTimeLineSwitch(XLogRecPtr lsn, TimeLineID newTLI, TimeLineID prevTLI,
lsn < minRecoveryPoint && lsn < minRecoveryPoint &&
newTLI > minRecoveryPointTLI) newTLI > minRecoveryPointTLI)
ereport(PANIC, ereport(PANIC,
(errmsg("unexpected timeline ID %u in checkpoint record, before reaching minimum recovery point %X/%X on timeline %u", errmsg("unexpected timeline ID %u in checkpoint record, before reaching minimum recovery point %X/%08X on timeline %u",
newTLI, newTLI,
LSN_FORMAT_ARGS(minRecoveryPoint), LSN_FORMAT_ARGS(minRecoveryPoint),
minRecoveryPointTLI))); minRecoveryPointTLI));
/* Looks good */ /* Looks good */
} }
@ -2621,8 +2621,8 @@ recoveryStopsBefore(XLogReaderState *record)
recoveryStopTime = 0; recoveryStopTime = 0;
recoveryStopName[0] = '\0'; recoveryStopName[0] = '\0';
ereport(LOG, ereport(LOG,
(errmsg("recovery stopping before WAL location (LSN) \"%X/%X\"", errmsg("recovery stopping before WAL location (LSN) \"%X/%08X\"",
LSN_FORMAT_ARGS(recoveryStopLSN)))); LSN_FORMAT_ARGS(recoveryStopLSN)));
return true; return true;
} }
@ -2789,8 +2789,8 @@ recoveryStopsAfter(XLogReaderState *record)
recoveryStopTime = 0; recoveryStopTime = 0;
recoveryStopName[0] = '\0'; recoveryStopName[0] = '\0';
ereport(LOG, ereport(LOG,
(errmsg("recovery stopping after WAL location (LSN) \"%X/%X\"", errmsg("recovery stopping after WAL location (LSN) \"%X/%08X\"",
LSN_FORMAT_ARGS(recoveryStopLSN)))); LSN_FORMAT_ARGS(recoveryStopLSN)));
return true; return true;
} }
@ -2910,7 +2910,7 @@ getRecoveryStopReason(void)
timestamptz_to_str(recoveryStopTime)); timestamptz_to_str(recoveryStopTime));
else if (recoveryTarget == RECOVERY_TARGET_LSN) else if (recoveryTarget == RECOVERY_TARGET_LSN)
snprintf(reason, sizeof(reason), snprintf(reason, sizeof(reason),
"%s LSN %X/%X\n", "%s LSN %X/%08X\n",
recoveryStopAfter ? "after" : "before", recoveryStopAfter ? "after" : "before",
LSN_FORMAT_ARGS(recoveryStopLSN)); LSN_FORMAT_ARGS(recoveryStopLSN));
else if (recoveryTarget == RECOVERY_TARGET_NAME) else if (recoveryTarget == RECOVERY_TARGET_NAME)
@ -3213,11 +3213,11 @@ ReadRecord(XLogPrefetcher *xlogprefetcher, int emode,
XLogFileName(fname, xlogreader->seg.ws_tli, segno, XLogFileName(fname, xlogreader->seg.ws_tli, segno,
wal_segment_size); wal_segment_size);
ereport(emode_for_corrupt_record(emode, xlogreader->EndRecPtr), ereport(emode_for_corrupt_record(emode, xlogreader->EndRecPtr),
(errmsg("unexpected timeline ID %u in WAL segment %s, LSN %X/%X, offset %u", errmsg("unexpected timeline ID %u in WAL segment %s, LSN %X/%08X, offset %u",
xlogreader->latestPageTLI, xlogreader->latestPageTLI,
fname, fname,
LSN_FORMAT_ARGS(xlogreader->latestPagePtr), LSN_FORMAT_ARGS(xlogreader->latestPagePtr),
offset))); offset));
record = NULL; record = NULL;
} }
@ -3429,14 +3429,14 @@ retry:
errno = save_errno; errno = save_errno;
ereport(emode_for_corrupt_record(emode, targetPagePtr + reqLen), ereport(emode_for_corrupt_record(emode, targetPagePtr + reqLen),
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("could not read from WAL segment %s, LSN %X/%X, offset %u: %m", errmsg("could not read from WAL segment %s, LSN %X/%08X, offset %u: %m",
fname, LSN_FORMAT_ARGS(targetPagePtr), fname, LSN_FORMAT_ARGS(targetPagePtr),
readOff))); readOff)));
} }
else else
ereport(emode_for_corrupt_record(emode, targetPagePtr + reqLen), ereport(emode_for_corrupt_record(emode, targetPagePtr + reqLen),
(errcode(ERRCODE_DATA_CORRUPTED), (errcode(ERRCODE_DATA_CORRUPTED),
errmsg("could not read from WAL segment %s, LSN %X/%X, offset %u: read %d of %zu", errmsg("could not read from WAL segment %s, LSN %X/%08X, offset %u: read %d of %zu",
fname, LSN_FORMAT_ARGS(targetPagePtr), fname, LSN_FORMAT_ARGS(targetPagePtr),
readOff, r, (Size) XLOG_BLCKSZ))); readOff, r, (Size) XLOG_BLCKSZ)));
goto next_record_is_invalid; goto next_record_is_invalid;
@ -3718,7 +3718,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
wait_time = wal_retrieve_retry_interval - wait_time = wal_retrieve_retry_interval -
TimestampDifferenceMilliseconds(last_fail_time, now); TimestampDifferenceMilliseconds(last_fail_time, now);
elog(LOG, "waiting for WAL to become available at %X/%X", elog(LOG, "waiting for WAL to become available at %X/%08X",
LSN_FORMAT_ARGS(RecPtr)); LSN_FORMAT_ARGS(RecPtr));
/* Do background tasks that might benefit us later. */ /* Do background tasks that might benefit us later. */
@ -3864,7 +3864,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
tli = tliOfPointInHistory(tliRecPtr, expectedTLEs); tli = tliOfPointInHistory(tliRecPtr, expectedTLEs);
if (curFileTLI > 0 && tli < curFileTLI) if (curFileTLI > 0 && tli < curFileTLI)
elog(ERROR, "according to history file, WAL location %X/%X belongs to timeline %u, but previous recovered WAL file came from timeline %u", elog(ERROR, "according to history file, WAL location %X/%08X belongs to timeline %u, but previous recovered WAL file came from timeline %u",
LSN_FORMAT_ARGS(tliRecPtr), LSN_FORMAT_ARGS(tliRecPtr),
tli, curFileTLI); tli, curFileTLI);
} }
@ -4177,10 +4177,10 @@ rescanLatestTimeLine(TimeLineID replayTLI, XLogRecPtr replayLSN)
if (currentTle->end < replayLSN) if (currentTle->end < replayLSN)
{ {
ereport(LOG, ereport(LOG,
(errmsg("new timeline %u forked off current database system timeline %u before current recovery point %X/%X", errmsg("new timeline %u forked off current database system timeline %u before current recovery point %X/%08X",
newtarget, newtarget,
replayTLI, replayTLI,
LSN_FORMAT_ARGS(replayLSN)))); LSN_FORMAT_ARGS(replayLSN)));
return false; return false;
} }

View File

@ -795,7 +795,7 @@ XLogReadDetermineTimeline(XLogReaderState *state, XLogRecPtr wantPage,
list_free_deep(timelineHistory); list_free_deep(timelineHistory);
elog(DEBUG3, "switched to timeline %u valid until %X/%X", elog(DEBUG3, "switched to timeline %u valid until %X/%08X",
state->currTLI, state->currTLI,
LSN_FORMAT_ARGS(state->currTLIValidUntil)); LSN_FORMAT_ARGS(state->currTLIValidUntil));
} }

View File

@ -281,7 +281,7 @@ AddWALInfoToBackupManifest(backup_manifest_info *manifest, XLogRecPtr startptr,
} }
AppendToManifest(manifest, AppendToManifest(manifest,
"%s{ \"Timeline\": %u, \"Start-LSN\": \"%X/%X\", \"End-LSN\": \"%X/%X\" }", "%s{ \"Timeline\": %u, \"Start-LSN\": \"%X/%08X\", \"End-LSN\": \"%X/%08X\" }",
first_wal_range ? "" : ",\n", first_wal_range ? "" : ",\n",
entry->tli, entry->tli,
LSN_FORMAT_ARGS(tl_beginptr), LSN_FORMAT_ARGS(tl_beginptr),

View File

@ -361,7 +361,7 @@ SendXlogRecPtrResult(XLogRecPtr ptr, TimeLineID tli)
tstate = begin_tup_output_tupdesc(dest, tupdesc, &TTSOpsVirtual); tstate = begin_tup_output_tupdesc(dest, tupdesc, &TTSOpsVirtual);
/* Data row */ /* Data row */
values[0] = CStringGetTextDatum(psprintf("%X/%X", LSN_FORMAT_ARGS(ptr))); values[0] = CStringGetTextDatum(psprintf("%X/%08X", LSN_FORMAT_ARGS(ptr)));
values[1] = Int64GetDatum(tli); values[1] = Int64GetDatum(tli);
do_tup_output(tstate, values, nulls); do_tup_output(tstate, values, nulls);

View File

@ -409,7 +409,7 @@ PrepareForIncrementalBackup(IncrementalBackupInfo *ib,
if (range->start_lsn < tlep[i]->begin) if (range->start_lsn < tlep[i]->begin)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("manifest requires WAL from initial timeline %u starting at %X/%X, but that timeline begins at %X/%X", errmsg("manifest requires WAL from initial timeline %u starting at %X/%08X, but that timeline begins at %X/%08X",
range->tli, range->tli,
LSN_FORMAT_ARGS(range->start_lsn), LSN_FORMAT_ARGS(range->start_lsn),
LSN_FORMAT_ARGS(tlep[i]->begin)))); LSN_FORMAT_ARGS(tlep[i]->begin))));
@ -419,7 +419,7 @@ PrepareForIncrementalBackup(IncrementalBackupInfo *ib,
if (range->start_lsn != tlep[i]->begin) if (range->start_lsn != tlep[i]->begin)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("manifest requires WAL from continuation timeline %u starting at %X/%X, but that timeline begins at %X/%X", errmsg("manifest requires WAL from continuation timeline %u starting at %X/%08X, but that timeline begins at %X/%08X",
range->tli, range->tli,
LSN_FORMAT_ARGS(range->start_lsn), LSN_FORMAT_ARGS(range->start_lsn),
LSN_FORMAT_ARGS(tlep[i]->begin)))); LSN_FORMAT_ARGS(tlep[i]->begin))));
@ -430,7 +430,7 @@ PrepareForIncrementalBackup(IncrementalBackupInfo *ib,
if (range->end_lsn > backup_state->startpoint) if (range->end_lsn > backup_state->startpoint)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("manifest requires WAL from final timeline %u ending at %X/%X, but this backup starts at %X/%X", errmsg("manifest requires WAL from final timeline %u ending at %X/%08X, but this backup starts at %X/%08X",
range->tli, range->tli,
LSN_FORMAT_ARGS(range->end_lsn), LSN_FORMAT_ARGS(range->end_lsn),
LSN_FORMAT_ARGS(backup_state->startpoint)), LSN_FORMAT_ARGS(backup_state->startpoint)),
@ -441,7 +441,7 @@ PrepareForIncrementalBackup(IncrementalBackupInfo *ib,
if (range->end_lsn != tlep[i]->end) if (range->end_lsn != tlep[i]->end)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("manifest requires WAL from non-final timeline %u ending at %X/%X, but this server switched timelines at %X/%X", errmsg("manifest requires WAL from non-final timeline %u ending at %X/%08X, but this server switched timelines at %X/%08X",
range->tli, range->tli,
LSN_FORMAT_ARGS(range->end_lsn), LSN_FORMAT_ARGS(range->end_lsn),
LSN_FORMAT_ARGS(tlep[i]->end)))); LSN_FORMAT_ARGS(tlep[i]->end))));
@ -522,18 +522,18 @@ PrepareForIncrementalBackup(IncrementalBackupInfo *ib,
if (XLogRecPtrIsInvalid(tli_missing_lsn)) if (XLogRecPtrIsInvalid(tli_missing_lsn))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("WAL summaries are required on timeline %u from %X/%X to %X/%X, but no summaries for that timeline and LSN range exist", errmsg("WAL summaries are required on timeline %u from %X/%08X to %X/%08X, but no summaries for that timeline and LSN range exist",
tle->tli, tle->tli,
LSN_FORMAT_ARGS(tli_start_lsn), LSN_FORMAT_ARGS(tli_start_lsn),
LSN_FORMAT_ARGS(tli_end_lsn)))); LSN_FORMAT_ARGS(tli_end_lsn))));
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("WAL summaries are required on timeline %u from %X/%X to %X/%X, but the summaries for that timeline and LSN range are incomplete", errmsg("WAL summaries are required on timeline %u from %X/%08X to %X/%08X, but the summaries for that timeline and LSN range are incomplete",
tle->tli, tle->tli,
LSN_FORMAT_ARGS(tli_start_lsn), LSN_FORMAT_ARGS(tli_start_lsn),
LSN_FORMAT_ARGS(tli_end_lsn)), LSN_FORMAT_ARGS(tli_end_lsn)),
errdetail("The first unsummarized LSN in this range is %X/%X.", errdetail("The first unsummarized LSN in this range is %X/%08X.",
LSN_FORMAT_ARGS(tli_missing_lsn)))); LSN_FORMAT_ARGS(tli_missing_lsn))));
} }

View File

@ -1539,7 +1539,7 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
if (!XLogRecPtrIsInvalid(remote_lsn) && opts.lsn < remote_lsn) if (!XLogRecPtrIsInvalid(remote_lsn) && opts.lsn < remote_lsn)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("skip WAL location (LSN %X/%X) must be greater than origin LSN %X/%X", errmsg("skip WAL location (LSN %X/%08X) must be greater than origin LSN %X/%08X",
LSN_FORMAT_ARGS(opts.lsn), LSN_FORMAT_ARGS(opts.lsn),
LSN_FORMAT_ARGS(remote_lsn)))); LSN_FORMAT_ARGS(remote_lsn))));
} }

View File

@ -385,7 +385,7 @@ WalSummarizerMain(const void *startup_data, size_t startup_data_len)
switch_lsn = tliSwitchPoint(current_tli, tles, &switch_tli); switch_lsn = tliSwitchPoint(current_tli, tles, &switch_tli);
ereport(DEBUG1, ereport(DEBUG1,
errmsg_internal("switch point from TLI %u to TLI %u is at %X/%X", errmsg_internal("switch point from TLI %u to TLI %u is at %X/%08X",
current_tli, switch_tli, LSN_FORMAT_ARGS(switch_lsn))); current_tli, switch_tli, LSN_FORMAT_ARGS(switch_lsn)));
} }
@ -741,7 +741,7 @@ WaitForWalSummarization(XLogRecPtr lsn)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("WAL summarization is not progressing"), errmsg("WAL summarization is not progressing"),
errdetail("Summarization is needed through %X/%X, but is stuck at %X/%X on disk and %X/%X in memory.", errdetail("Summarization is needed through %X/%08X, but is stuck at %X/%08X on disk and %X/%08X in memory.",
LSN_FORMAT_ARGS(lsn), LSN_FORMAT_ARGS(lsn),
LSN_FORMAT_ARGS(summarized_lsn), LSN_FORMAT_ARGS(summarized_lsn),
LSN_FORMAT_ARGS(pending_lsn)))); LSN_FORMAT_ARGS(pending_lsn))));
@ -755,12 +755,12 @@ WaitForWalSummarization(XLogRecPtr lsn)
current_time) / 1000; current_time) / 1000;
ereport(WARNING, ereport(WARNING,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg_plural("still waiting for WAL summarization through %X/%X after %ld second", errmsg_plural("still waiting for WAL summarization through %X/%08X after %ld second",
"still waiting for WAL summarization through %X/%X after %ld seconds", "still waiting for WAL summarization through %X/%08X after %ld seconds",
elapsed_seconds, elapsed_seconds,
LSN_FORMAT_ARGS(lsn), LSN_FORMAT_ARGS(lsn),
elapsed_seconds), elapsed_seconds),
errdetail("Summarization has reached %X/%X on disk and %X/%X in memory.", errdetail("Summarization has reached %X/%08X on disk and %X/%08X in memory.",
LSN_FORMAT_ARGS(summarized_lsn), LSN_FORMAT_ARGS(summarized_lsn),
LSN_FORMAT_ARGS(pending_lsn)))); LSN_FORMAT_ARGS(pending_lsn))));
} }
@ -981,7 +981,7 @@ SummarizeWAL(TimeLineID tli, XLogRecPtr start_lsn, bool exact,
if (private_data->end_of_wal) if (private_data->end_of_wal)
{ {
ereport(DEBUG1, ereport(DEBUG1,
errmsg_internal("could not read WAL from timeline %u at %X/%X: end of WAL at %X/%X", errmsg_internal("could not read WAL from timeline %u at %X/%08X: end of WAL at %X/%08X",
tli, tli,
LSN_FORMAT_ARGS(start_lsn), LSN_FORMAT_ARGS(start_lsn),
LSN_FORMAT_ARGS(private_data->read_upto))); LSN_FORMAT_ARGS(private_data->read_upto)));
@ -1000,8 +1000,8 @@ SummarizeWAL(TimeLineID tli, XLogRecPtr start_lsn, bool exact,
} }
else else
ereport(ERROR, ereport(ERROR,
(errmsg("could not find a valid record after %X/%X", errmsg("could not find a valid record after %X/%08X",
LSN_FORMAT_ARGS(start_lsn)))); LSN_FORMAT_ARGS(start_lsn)));
} }
/* We shouldn't go backward. */ /* We shouldn't go backward. */
@ -1034,7 +1034,7 @@ SummarizeWAL(TimeLineID tli, XLogRecPtr start_lsn, bool exact,
* able to read a complete record. * able to read a complete record.
*/ */
ereport(DEBUG1, ereport(DEBUG1,
errmsg_internal("could not read WAL from timeline %u at %X/%X: end of WAL at %X/%X", errmsg_internal("could not read WAL from timeline %u at %X/%08X: end of WAL at %X/%08X",
tli, tli,
LSN_FORMAT_ARGS(xlogreader->EndRecPtr), LSN_FORMAT_ARGS(xlogreader->EndRecPtr),
LSN_FORMAT_ARGS(private_data->read_upto))); LSN_FORMAT_ARGS(private_data->read_upto)));
@ -1045,13 +1045,13 @@ SummarizeWAL(TimeLineID tli, XLogRecPtr start_lsn, bool exact,
if (errormsg) if (errormsg)
ereport(ERROR, ereport(ERROR,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("could not read WAL from timeline %u at %X/%X: %s", errmsg("could not read WAL from timeline %u at %X/%08X: %s",
tli, LSN_FORMAT_ARGS(xlogreader->EndRecPtr), tli, LSN_FORMAT_ARGS(xlogreader->EndRecPtr),
errormsg))); errormsg)));
else else
ereport(ERROR, ereport(ERROR,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("could not read WAL from timeline %u at %X/%X", errmsg("could not read WAL from timeline %u at %X/%08X",
tli, LSN_FORMAT_ARGS(xlogreader->EndRecPtr)))); tli, LSN_FORMAT_ARGS(xlogreader->EndRecPtr))));
} }
@ -1222,7 +1222,7 @@ SummarizeWAL(TimeLineID tli, XLogRecPtr start_lsn, bool exact,
/* Tell the user what we did. */ /* Tell the user what we did. */
ereport(DEBUG1, ereport(DEBUG1,
errmsg_internal("summarized WAL on TLI %u from %X/%X to %X/%X", errmsg_internal("summarized WAL on TLI %u from %X/%08X to %X/%08X",
tli, tli,
LSN_FORMAT_ARGS(summary_start_lsn), LSN_FORMAT_ARGS(summary_start_lsn),
LSN_FORMAT_ARGS(summary_end_lsn))); LSN_FORMAT_ARGS(summary_end_lsn)));
@ -1234,7 +1234,7 @@ SummarizeWAL(TimeLineID tli, XLogRecPtr start_lsn, bool exact,
/* If we skipped a non-zero amount of WAL, log a debug message. */ /* If we skipped a non-zero amount of WAL, log a debug message. */
if (summary_end_lsn > summary_start_lsn && fast_forward) if (summary_end_lsn > summary_start_lsn && fast_forward)
ereport(DEBUG1, ereport(DEBUG1,
errmsg_internal("skipped summarizing WAL on TLI %u from %X/%X to %X/%X", errmsg_internal("skipped summarizing WAL on TLI %u from %X/%08X to %X/%08X",
tli, tli,
LSN_FORMAT_ARGS(summary_start_lsn), LSN_FORMAT_ARGS(summary_start_lsn),
LSN_FORMAT_ARGS(summary_end_lsn))); LSN_FORMAT_ARGS(summary_end_lsn)));
@ -1580,7 +1580,7 @@ summarizer_read_local_xlog_page(XLogReaderState *state,
/* Debugging output. */ /* Debugging output. */
ereport(DEBUG1, ereport(DEBUG1,
errmsg_internal("timeline %u became historic, can read up to %X/%X", errmsg_internal("timeline %u became historic, can read up to %X/%08X",
private_data->tli, LSN_FORMAT_ARGS(private_data->read_upto))); private_data->tli, LSN_FORMAT_ARGS(private_data->read_upto)));
} }

View File

@ -534,7 +534,7 @@ libpqrcv_startstreaming(WalReceiverConn *conn,
if (options->logical) if (options->logical)
appendStringInfoString(&cmd, " LOGICAL"); appendStringInfoString(&cmd, " LOGICAL");
appendStringInfo(&cmd, " %X/%X", LSN_FORMAT_ARGS(options->startpoint)); appendStringInfo(&cmd, " %X/%08X", LSN_FORMAT_ARGS(options->startpoint));
/* /*
* Additional options are different depending on if we are doing logical * Additional options are different depending on if we are doing logical

View File

@ -567,7 +567,7 @@ CreateDecodingContext(XLogRecPtr start_lsn,
* kinds of client errors; so the client may wish to check that * kinds of client errors; so the client may wish to check that
* confirmed_flush_lsn matches its expectations. * confirmed_flush_lsn matches its expectations.
*/ */
elog(LOG, "%X/%X has been already streamed, forwarding to %X/%X", elog(LOG, "%X/%08X has been already streamed, forwarding to %X/%08X",
LSN_FORMAT_ARGS(start_lsn), LSN_FORMAT_ARGS(start_lsn),
LSN_FORMAT_ARGS(slot->data.confirmed_flush)); LSN_FORMAT_ARGS(slot->data.confirmed_flush));
@ -610,7 +610,7 @@ CreateDecodingContext(XLogRecPtr start_lsn,
ereport(LOG, ereport(LOG,
(errmsg("starting logical decoding for slot \"%s\"", (errmsg("starting logical decoding for slot \"%s\"",
NameStr(slot->data.name)), NameStr(slot->data.name)),
errdetail("Streaming transactions committing after %X/%X, reading WAL from %X/%X.", errdetail("Streaming transactions committing after %X/%08X, reading WAL from %X/%08X.",
LSN_FORMAT_ARGS(slot->data.confirmed_flush), LSN_FORMAT_ARGS(slot->data.confirmed_flush),
LSN_FORMAT_ARGS(slot->data.restart_lsn)))); LSN_FORMAT_ARGS(slot->data.restart_lsn))));
@ -637,7 +637,7 @@ DecodingContextFindStartpoint(LogicalDecodingContext *ctx)
/* Initialize from where to start reading WAL. */ /* Initialize from where to start reading WAL. */
XLogBeginRead(ctx->reader, slot->data.restart_lsn); XLogBeginRead(ctx->reader, slot->data.restart_lsn);
elog(DEBUG1, "searching for logical decoding starting point, starting at %X/%X", elog(DEBUG1, "searching for logical decoding starting point, starting at %X/%08X",
LSN_FORMAT_ARGS(slot->data.restart_lsn)); LSN_FORMAT_ARGS(slot->data.restart_lsn));
/* Wait for a consistent starting point */ /* Wait for a consistent starting point */
@ -758,7 +758,7 @@ output_plugin_error_callback(void *arg)
/* not all callbacks have an associated LSN */ /* not all callbacks have an associated LSN */
if (state->report_location != InvalidXLogRecPtr) if (state->report_location != InvalidXLogRecPtr)
errcontext("slot \"%s\", output plugin \"%s\", in the %s callback, associated LSN %X/%X", errcontext("slot \"%s\", output plugin \"%s\", in the %s callback, associated LSN %X/%08X",
NameStr(state->ctx->slot->data.name), NameStr(state->ctx->slot->data.name),
NameStr(state->ctx->slot->data.plugin), NameStr(state->ctx->slot->data.plugin),
state->callback_name, state->callback_name,
@ -1725,7 +1725,7 @@ LogicalIncreaseXminForSlot(XLogRecPtr current_lsn, TransactionId xmin)
SpinLockRelease(&slot->mutex); SpinLockRelease(&slot->mutex);
if (got_new_xmin) if (got_new_xmin)
elog(DEBUG1, "got new catalog xmin %u at %X/%X", xmin, elog(DEBUG1, "got new catalog xmin %u at %X/%08X", xmin,
LSN_FORMAT_ARGS(current_lsn)); LSN_FORMAT_ARGS(current_lsn));
/* candidate already valid with the current flush position, apply */ /* candidate already valid with the current flush position, apply */
@ -1785,7 +1785,7 @@ LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart
slot->candidate_restart_lsn = restart_lsn; slot->candidate_restart_lsn = restart_lsn;
SpinLockRelease(&slot->mutex); SpinLockRelease(&slot->mutex);
elog(DEBUG1, "got new restart lsn %X/%X at %X/%X", elog(DEBUG1, "got new restart lsn %X/%08X at %X/%08X",
LSN_FORMAT_ARGS(restart_lsn), LSN_FORMAT_ARGS(restart_lsn),
LSN_FORMAT_ARGS(current_lsn)); LSN_FORMAT_ARGS(current_lsn));
} }
@ -1800,7 +1800,7 @@ LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart
confirmed_flush = slot->data.confirmed_flush; confirmed_flush = slot->data.confirmed_flush;
SpinLockRelease(&slot->mutex); SpinLockRelease(&slot->mutex);
elog(DEBUG1, "failed to increase restart lsn: proposed %X/%X, after %X/%X, current candidate %X/%X, current after %X/%X, flushed up to %X/%X", elog(DEBUG1, "failed to increase restart lsn: proposed %X/%08X, after %X/%08X, current candidate %X/%08X, current after %X/%08X, flushed up to %X/%08X",
LSN_FORMAT_ARGS(restart_lsn), LSN_FORMAT_ARGS(restart_lsn),
LSN_FORMAT_ARGS(current_lsn), LSN_FORMAT_ARGS(current_lsn),
LSN_FORMAT_ARGS(candidate_restart_lsn), LSN_FORMAT_ARGS(candidate_restart_lsn),

View File

@ -826,9 +826,9 @@ StartupReplicationOrigin(void)
last_state++; last_state++;
ereport(LOG, ereport(LOG,
(errmsg("recovered replication state of node %d to %X/%X", errmsg("recovered replication state of node %d to %X/%08X",
disk_state.roident, disk_state.roident,
LSN_FORMAT_ARGS(disk_state.remote_lsn)))); LSN_FORMAT_ARGS(disk_state.remote_lsn)));
} }
/* now check checksum */ /* now check checksum */

View File

@ -213,7 +213,7 @@ update_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid,
ereport(slot->data.persistency == RS_TEMPORARY ? LOG : DEBUG1, ereport(slot->data.persistency == RS_TEMPORARY ? LOG : DEBUG1,
errmsg("could not synchronize replication slot \"%s\"", errmsg("could not synchronize replication slot \"%s\"",
remote_slot->name), remote_slot->name),
errdetail("Synchronization could lead to data loss, because the remote slot needs WAL at LSN %X/%X and catalog xmin %u, but the standby has LSN %X/%X and catalog xmin %u.", errdetail("Synchronization could lead to data loss, because the remote slot needs WAL at LSN %X/%08X and catalog xmin %u, but the standby has LSN %X/%08X and catalog xmin %u.",
LSN_FORMAT_ARGS(remote_slot->restart_lsn), LSN_FORMAT_ARGS(remote_slot->restart_lsn),
remote_slot->catalog_xmin, remote_slot->catalog_xmin,
LSN_FORMAT_ARGS(slot->data.restart_lsn), LSN_FORMAT_ARGS(slot->data.restart_lsn),
@ -275,7 +275,7 @@ update_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid,
ereport(ERROR, ereport(ERROR,
errmsg_internal("synchronized confirmed_flush for slot \"%s\" differs from remote slot", errmsg_internal("synchronized confirmed_flush for slot \"%s\" differs from remote slot",
remote_slot->name), remote_slot->name),
errdetail_internal("Remote slot has LSN %X/%X but local slot has LSN %X/%X.", errdetail_internal("Remote slot has LSN %X/%08X but local slot has LSN %X/%08X.",
LSN_FORMAT_ARGS(remote_slot->confirmed_lsn), LSN_FORMAT_ARGS(remote_slot->confirmed_lsn),
LSN_FORMAT_ARGS(slot->data.confirmed_flush))); LSN_FORMAT_ARGS(slot->data.confirmed_flush)));
} }
@ -593,7 +593,7 @@ update_and_persist_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid)
{ {
ereport(LOG, ereport(LOG,
errmsg("could not synchronize replication slot \"%s\"", remote_slot->name), errmsg("could not synchronize replication slot \"%s\"", remote_slot->name),
errdetail("Synchronization could lead to data loss, because the standby could not build a consistent snapshot to decode WALs at LSN %X/%X.", errdetail("Synchronization could lead to data loss, because the standby could not build a consistent snapshot to decode WALs at LSN %X/%08X.",
LSN_FORMAT_ARGS(slot->data.restart_lsn))); LSN_FORMAT_ARGS(slot->data.restart_lsn)));
return false; return false;
@ -642,7 +642,7 @@ synchronize_one_slot(RemoteSlot *remote_slot, Oid remote_dbid)
ereport(AmLogicalSlotSyncWorkerProcess() ? LOG : ERROR, ereport(AmLogicalSlotSyncWorkerProcess() ? LOG : ERROR,
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("skipping slot synchronization because the received slot sync" errmsg("skipping slot synchronization because the received slot sync"
" LSN %X/%X for slot \"%s\" is ahead of the standby position %X/%X", " LSN %X/%08X for slot \"%s\" is ahead of the standby position %X/%08X",
LSN_FORMAT_ARGS(remote_slot->confirmed_lsn), LSN_FORMAT_ARGS(remote_slot->confirmed_lsn),
remote_slot->name, remote_slot->name,
LSN_FORMAT_ARGS(latestFlushPtr))); LSN_FORMAT_ARGS(latestFlushPtr)));
@ -733,7 +733,7 @@ synchronize_one_slot(RemoteSlot *remote_slot, Oid remote_dbid)
ereport(ERROR, ereport(ERROR,
errmsg_internal("cannot synchronize local slot \"%s\"", errmsg_internal("cannot synchronize local slot \"%s\"",
remote_slot->name), remote_slot->name),
errdetail_internal("Local slot's start streaming location LSN(%X/%X) is ahead of remote slot's LSN(%X/%X).", errdetail_internal("Local slot's start streaming location LSN(%X/%08X) is ahead of remote slot's LSN(%X/%08X).",
LSN_FORMAT_ARGS(slot->data.confirmed_flush), LSN_FORMAT_ARGS(slot->data.confirmed_flush),
LSN_FORMAT_ARGS(remote_slot->confirmed_lsn))); LSN_FORMAT_ARGS(remote_slot->confirmed_lsn)));

View File

@ -774,7 +774,7 @@ SnapBuildDistributeSnapshotAndInval(SnapBuild *builder, XLogRecPtr lsn, Transact
if (rbtxn_is_prepared(txn)) if (rbtxn_is_prepared(txn))
continue; continue;
elog(DEBUG2, "adding a new snapshot and invalidations to %u at %X/%X", elog(DEBUG2, "adding a new snapshot and invalidations to %u at %X/%08X",
txn->xid, LSN_FORMAT_ARGS(lsn)); txn->xid, LSN_FORMAT_ARGS(lsn));
/* /*
@ -1271,10 +1271,10 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn
builder->initial_xmin_horizon)) builder->initial_xmin_horizon))
{ {
ereport(DEBUG1, ereport(DEBUG1,
(errmsg_internal("skipping snapshot at %X/%X while building logical decoding snapshot, xmin horizon too low", errmsg_internal("skipping snapshot at %X/%08X while building logical decoding snapshot, xmin horizon too low",
LSN_FORMAT_ARGS(lsn)), LSN_FORMAT_ARGS(lsn)),
errdetail_internal("initial xmin horizon of %u vs the snapshot's %u", errdetail_internal("initial xmin horizon of %u vs the snapshot's %u",
builder->initial_xmin_horizon, running->oldestRunningXid))); builder->initial_xmin_horizon, running->oldestRunningXid));
SnapBuildWaitSnapshot(running, builder->initial_xmin_horizon); SnapBuildWaitSnapshot(running, builder->initial_xmin_horizon);
@ -1310,9 +1310,9 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn
builder->next_phase_at = InvalidTransactionId; builder->next_phase_at = InvalidTransactionId;
ereport(LOG, ereport(LOG,
(errmsg("logical decoding found consistent point at %X/%X", errmsg("logical decoding found consistent point at %X/%08X",
LSN_FORMAT_ARGS(lsn)), LSN_FORMAT_ARGS(lsn)),
errdetail("There are no running transactions."))); errdetail("There are no running transactions."));
return false; return false;
} }
@ -1359,10 +1359,10 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn
Assert(TransactionIdIsNormal(builder->xmax)); Assert(TransactionIdIsNormal(builder->xmax));
ereport(LOG, ereport(LOG,
(errmsg("logical decoding found initial starting point at %X/%X", errmsg("logical decoding found initial starting point at %X/%08X",
LSN_FORMAT_ARGS(lsn)), LSN_FORMAT_ARGS(lsn)),
errdetail("Waiting for transactions (approximately %d) older than %u to end.", errdetail("Waiting for transactions (approximately %d) older than %u to end.",
running->xcnt, running->nextXid))); running->xcnt, running->nextXid));
SnapBuildWaitSnapshot(running, running->nextXid); SnapBuildWaitSnapshot(running, running->nextXid);
} }
@ -1383,10 +1383,10 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn
builder->next_phase_at = running->nextXid; builder->next_phase_at = running->nextXid;
ereport(LOG, ereport(LOG,
(errmsg("logical decoding found initial consistent point at %X/%X", errmsg("logical decoding found initial consistent point at %X/%08X",
LSN_FORMAT_ARGS(lsn)), LSN_FORMAT_ARGS(lsn)),
errdetail("Waiting for transactions (approximately %d) older than %u to end.", errdetail("Waiting for transactions (approximately %d) older than %u to end.",
running->xcnt, running->nextXid))); running->xcnt, running->nextXid));
SnapBuildWaitSnapshot(running, running->nextXid); SnapBuildWaitSnapshot(running, running->nextXid);
} }
@ -1407,9 +1407,9 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn
builder->next_phase_at = InvalidTransactionId; builder->next_phase_at = InvalidTransactionId;
ereport(LOG, ereport(LOG,
(errmsg("logical decoding found consistent point at %X/%X", errmsg("logical decoding found consistent point at %X/%08X",
LSN_FORMAT_ARGS(lsn)), LSN_FORMAT_ARGS(lsn)),
errdetail("There are no old transactions anymore."))); errdetail("There are no old transactions anymore."));
} }
/* /*
@ -1913,9 +1913,9 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
Assert(builder->state == SNAPBUILD_CONSISTENT); Assert(builder->state == SNAPBUILD_CONSISTENT);
ereport(LOG, ereport(LOG,
(errmsg("logical decoding found consistent point at %X/%X", errmsg("logical decoding found consistent point at %X/%08X",
LSN_FORMAT_ARGS(lsn)), LSN_FORMAT_ARGS(lsn)),
errdetail("Logical decoding will begin using saved snapshot."))); errdetail("Logical decoding will begin using saved snapshot."));
return true; return true;
snapshot_not_interesting: snapshot_not_interesting:
@ -2061,7 +2061,7 @@ SnapBuildSnapshotExists(XLogRecPtr lsn)
int ret; int ret;
struct stat stat_buf; struct stat stat_buf;
sprintf(path, "%s/%X-%X.snap", sprintf(path, "%s/%08X-%08X.snap",
PG_LOGICAL_SNAPSHOTS_DIR, PG_LOGICAL_SNAPSHOTS_DIR,
LSN_FORMAT_ARGS(lsn)); LSN_FORMAT_ARGS(lsn));

View File

@ -1553,7 +1553,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
copy_table_done: copy_table_done:
elog(DEBUG1, elog(DEBUG1,
"LogicalRepSyncTableStart: '%s' origin_startpos lsn %X/%X", "LogicalRepSyncTableStart: '%s' origin_startpos lsn %X/%08X",
originname, LSN_FORMAT_ARGS(*origin_startpos)); originname, LSN_FORMAT_ARGS(*origin_startpos));
/* /*

View File

@ -1016,7 +1016,7 @@ apply_handle_commit(StringInfo s)
if (commit_data.commit_lsn != remote_final_lsn) if (commit_data.commit_lsn != remote_final_lsn)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION), (errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg_internal("incorrect commit LSN %X/%X in commit message (expected %X/%X)", errmsg_internal("incorrect commit LSN %X/%08X in commit message (expected %X/%08X)",
LSN_FORMAT_ARGS(commit_data.commit_lsn), LSN_FORMAT_ARGS(commit_data.commit_lsn),
LSN_FORMAT_ARGS(remote_final_lsn)))); LSN_FORMAT_ARGS(remote_final_lsn))));
@ -1108,7 +1108,7 @@ apply_handle_prepare(StringInfo s)
if (prepare_data.prepare_lsn != remote_final_lsn) if (prepare_data.prepare_lsn != remote_final_lsn)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION), (errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg_internal("incorrect prepare LSN %X/%X in prepare message (expected %X/%X)", errmsg_internal("incorrect prepare LSN %X/%08X in prepare message (expected %X/%08X)",
LSN_FORMAT_ARGS(prepare_data.prepare_lsn), LSN_FORMAT_ARGS(prepare_data.prepare_lsn),
LSN_FORMAT_ARGS(remote_final_lsn)))); LSN_FORMAT_ARGS(remote_final_lsn))));
@ -3903,7 +3903,7 @@ send_feedback(XLogRecPtr recvpos, bool force, bool requestReply)
pq_sendint64(reply_message, now); /* sendTime */ pq_sendint64(reply_message, now); /* sendTime */
pq_sendbyte(reply_message, requestReply); /* replyRequested */ pq_sendbyte(reply_message, requestReply); /* replyRequested */
elog(DEBUG2, "sending feedback (force %d) to recv %X/%X, write %X/%X, flush %X/%X", elog(DEBUG2, "sending feedback (force %d) to recv %X/%08X, write %X/%08X, flush %X/%08X",
force, force,
LSN_FORMAT_ARGS(recvpos), LSN_FORMAT_ARGS(recvpos),
LSN_FORMAT_ARGS(writepos), LSN_FORMAT_ARGS(writepos),
@ -4909,7 +4909,7 @@ maybe_start_skipping_changes(XLogRecPtr finish_lsn)
skip_xact_finish_lsn = finish_lsn; skip_xact_finish_lsn = finish_lsn;
ereport(LOG, ereport(LOG,
errmsg("logical replication starts skipping transaction at LSN %X/%X", errmsg("logical replication starts skipping transaction at LSN %X/%08X",
LSN_FORMAT_ARGS(skip_xact_finish_lsn))); LSN_FORMAT_ARGS(skip_xact_finish_lsn)));
} }
@ -4923,8 +4923,8 @@ stop_skipping_changes(void)
return; return;
ereport(LOG, ereport(LOG,
(errmsg("logical replication completed skipping transaction at LSN %X/%X", errmsg("logical replication completed skipping transaction at LSN %X/%08X",
LSN_FORMAT_ARGS(skip_xact_finish_lsn)))); LSN_FORMAT_ARGS(skip_xact_finish_lsn)));
/* Stop skipping changes */ /* Stop skipping changes */
skip_xact_finish_lsn = InvalidXLogRecPtr; skip_xact_finish_lsn = InvalidXLogRecPtr;
@ -5012,7 +5012,7 @@ clear_subscription_skip_lsn(XLogRecPtr finish_lsn)
if (myskiplsn != finish_lsn) if (myskiplsn != finish_lsn)
ereport(WARNING, ereport(WARNING,
errmsg("skip-LSN of subscription \"%s\" cleared", MySubscription->name), errmsg("skip-LSN of subscription \"%s\" cleared", MySubscription->name),
errdetail("Remote transaction's finish WAL location (LSN) %X/%X did not match skip-LSN %X/%X.", errdetail("Remote transaction's finish WAL location (LSN) %X/%08X did not match skip-LSN %X/%08X.",
LSN_FORMAT_ARGS(finish_lsn), LSN_FORMAT_ARGS(finish_lsn),
LSN_FORMAT_ARGS(myskiplsn))); LSN_FORMAT_ARGS(myskiplsn)));
} }
@ -5049,7 +5049,7 @@ apply_error_callback(void *arg)
logicalrep_message_type(errarg->command), logicalrep_message_type(errarg->command),
errarg->remote_xid); errarg->remote_xid);
else else
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" in transaction %u, finished at %X/%X", errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" in transaction %u, finished at %X/%08X",
errarg->origin_name, errarg->origin_name,
logicalrep_message_type(errarg->command), logicalrep_message_type(errarg->command),
errarg->remote_xid, errarg->remote_xid,
@ -5067,7 +5067,7 @@ apply_error_callback(void *arg)
errarg->rel->remoterel.relname, errarg->rel->remoterel.relname,
errarg->remote_xid); errarg->remote_xid);
else else
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" for replication target relation \"%s.%s\" in transaction %u, finished at %X/%X", errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" for replication target relation \"%s.%s\" in transaction %u, finished at %X/%08X",
errarg->origin_name, errarg->origin_name,
logicalrep_message_type(errarg->command), logicalrep_message_type(errarg->command),
errarg->rel->remoterel.nspname, errarg->rel->remoterel.nspname,
@ -5086,7 +5086,7 @@ apply_error_callback(void *arg)
errarg->rel->remoterel.attnames[errarg->remote_attnum], errarg->rel->remoterel.attnames[errarg->remote_attnum],
errarg->remote_xid); errarg->remote_xid);
else else
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" for replication target relation \"%s.%s\" column \"%s\" in transaction %u, finished at %X/%X", errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" for replication target relation \"%s.%s\" column \"%s\" in transaction %u, finished at %X/%08X",
errarg->origin_name, errarg->origin_name,
logicalrep_message_type(errarg->command), logicalrep_message_type(errarg->command),
errarg->rel->remoterel.nspname, errarg->rel->remoterel.nspname,

View File

@ -279,7 +279,7 @@ alter_replication_slot:
; ;
/* /*
* START_REPLICATION [SLOT slot] [PHYSICAL] %X/%X [TIMELINE %u] * START_REPLICATION [SLOT slot] [PHYSICAL] %X/%08X [TIMELINE %u]
*/ */
start_replication: start_replication:
K_START_REPLICATION opt_slot opt_physical RECPTR opt_timeline K_START_REPLICATION opt_slot opt_physical RECPTR opt_timeline
@ -295,7 +295,7 @@ start_replication:
} }
; ;
/* START_REPLICATION SLOT slot LOGICAL %X/%X options */ /* START_REPLICATION SLOT slot LOGICAL %X/%08X options */
start_logical_replication: start_logical_replication:
K_START_REPLICATION K_SLOT IDENT K_LOGICAL RECPTR plugin_options K_START_REPLICATION K_SLOT IDENT K_LOGICAL RECPTR plugin_options
{ {

View File

@ -155,7 +155,7 @@ UPLOAD_MANIFEST { return K_UPLOAD_MANIFEST; }
{hexdigit}+\/{hexdigit}+ { {hexdigit}+\/{hexdigit}+ {
uint32 hi, uint32 hi,
lo; lo;
if (sscanf(yytext, "%X/%X", &hi, &lo) != 2) if (sscanf(yytext, "%X/%08X", &hi, &lo) != 2)
replication_yyerror(NULL, yyscanner, "invalid streaming start location"); replication_yyerror(NULL, yyscanner, "invalid streaming start location");
yylval->recptr = ((uint64) hi) << 32 | lo; yylval->recptr = ((uint64) hi) << 32 | lo;
return RECPTR; return RECPTR;

View File

@ -1591,8 +1591,8 @@ ReportSlotInvalidation(ReplicationSlotInvalidationCause cause,
uint64 ex = oldestLSN - restart_lsn; uint64 ex = oldestLSN - restart_lsn;
appendStringInfo(&err_detail, appendStringInfo(&err_detail,
ngettext("The slot's restart_lsn %X/%X exceeds the limit by %" PRIu64 " byte.", ngettext("The slot's restart_lsn %X/%08X exceeds the limit by %" PRIu64 " byte.",
"The slot's restart_lsn %X/%X exceeds the limit by %" PRIu64 " bytes.", "The slot's restart_lsn %X/%08X exceeds the limit by %" PRIu64 " bytes.",
ex), ex),
LSN_FORMAT_ARGS(restart_lsn), LSN_FORMAT_ARGS(restart_lsn),
ex); ex);

View File

@ -566,7 +566,7 @@ pg_replication_slot_advance(PG_FUNCTION_ARGS)
if (moveto < minlsn) if (moveto < minlsn)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("cannot advance replication slot to %X/%X, minimum is %X/%X", errmsg("cannot advance replication slot to %X/%08X, minimum is %X/%08X",
LSN_FORMAT_ARGS(moveto), LSN_FORMAT_ARGS(minlsn)))); LSN_FORMAT_ARGS(moveto), LSN_FORMAT_ARGS(minlsn))));
/* Do the actual slot update, depending on the slot type */ /* Do the actual slot update, depending on the slot type */

View File

@ -258,7 +258,7 @@ SyncRepWaitForLSN(XLogRecPtr lsn, bool commit)
{ {
char buffer[32]; char buffer[32];
sprintf(buffer, "waiting for %X/%X", LSN_FORMAT_ARGS(lsn)); sprintf(buffer, "waiting for %X/%08X", LSN_FORMAT_ARGS(lsn));
set_ps_display_suffix(buffer); set_ps_display_suffix(buffer);
} }
@ -566,7 +566,7 @@ SyncRepReleaseWaiters(void)
LWLockRelease(SyncRepLock); LWLockRelease(SyncRepLock);
elog(DEBUG3, "released %d procs up to write %X/%X, %d procs up to flush %X/%X, %d procs up to apply %X/%X", elog(DEBUG3, "released %d procs up to write %X/%08X, %d procs up to flush %X/%08X, %d procs up to apply %X/%08X",
numwrite, LSN_FORMAT_ARGS(writePtr), numwrite, LSN_FORMAT_ARGS(writePtr),
numflush, LSN_FORMAT_ARGS(flushPtr), numflush, LSN_FORMAT_ARGS(flushPtr),
numapply, LSN_FORMAT_ARGS(applyPtr)); numapply, LSN_FORMAT_ARGS(applyPtr));

View File

@ -386,12 +386,12 @@ WalReceiverMain(const void *startup_data, size_t startup_data_len)
{ {
if (first_stream) if (first_stream)
ereport(LOG, ereport(LOG,
(errmsg("started streaming WAL from primary at %X/%X on timeline %u", errmsg("started streaming WAL from primary at %X/%08X on timeline %u",
LSN_FORMAT_ARGS(startpoint), startpointTLI))); LSN_FORMAT_ARGS(startpoint), startpointTLI));
else else
ereport(LOG, ereport(LOG,
(errmsg("restarted WAL streaming at %X/%X on timeline %u", errmsg("restarted WAL streaming at %X/%08X on timeline %u",
LSN_FORMAT_ARGS(startpoint), startpointTLI))); LSN_FORMAT_ARGS(startpoint), startpointTLI));
first_stream = false; first_stream = false;
/* Initialize LogstreamResult and buffers for processing messages */ /* Initialize LogstreamResult and buffers for processing messages */
@ -470,7 +470,7 @@ WalReceiverMain(const void *startup_data, size_t startup_data_len)
{ {
ereport(LOG, ereport(LOG,
(errmsg("replication terminated by primary server"), (errmsg("replication terminated by primary server"),
errdetail("End of WAL reached on timeline %u at %X/%X.", errdetail("End of WAL reached on timeline %u at %X/%08X.",
startpointTLI, startpointTLI,
LSN_FORMAT_ARGS(LogstreamResult.Write)))); LSN_FORMAT_ARGS(LogstreamResult.Write))));
endofwal = true; endofwal = true;
@ -711,7 +711,7 @@ WalRcvWaitForStartPosition(XLogRecPtr *startpoint, TimeLineID *startpointTLI)
{ {
char activitymsg[50]; char activitymsg[50];
snprintf(activitymsg, sizeof(activitymsg), "restarting at %X/%X", snprintf(activitymsg, sizeof(activitymsg), "restarting at %X/%08X",
LSN_FORMAT_ARGS(*startpoint)); LSN_FORMAT_ARGS(*startpoint));
set_ps_display(activitymsg); set_ps_display(activitymsg);
} }
@ -1014,7 +1014,7 @@ XLogWalRcvFlush(bool dying, TimeLineID tli)
{ {
char activitymsg[50]; char activitymsg[50];
snprintf(activitymsg, sizeof(activitymsg), "streaming %X/%X", snprintf(activitymsg, sizeof(activitymsg), "streaming %X/%08X",
LSN_FORMAT_ARGS(LogstreamResult.Write)); LSN_FORMAT_ARGS(LogstreamResult.Write));
set_ps_display(activitymsg); set_ps_display(activitymsg);
} }
@ -1138,7 +1138,7 @@ XLogWalRcvSendReply(bool force, bool requestReply)
pq_sendbyte(&reply_message, requestReply ? 1 : 0); pq_sendbyte(&reply_message, requestReply ? 1 : 0);
/* Send it */ /* Send it */
elog(DEBUG2, "sending write %X/%X flush %X/%X apply %X/%X%s", elog(DEBUG2, "sending write %X/%08X flush %X/%08X apply %X/%08X%s",
LSN_FORMAT_ARGS(writePtr), LSN_FORMAT_ARGS(writePtr),
LSN_FORMAT_ARGS(flushPtr), LSN_FORMAT_ARGS(flushPtr),
LSN_FORMAT_ARGS(applyPtr), LSN_FORMAT_ARGS(applyPtr),

View File

@ -408,7 +408,7 @@ IdentifySystem(void)
else else
logptr = GetFlushRecPtr(&currTLI); logptr = GetFlushRecPtr(&currTLI);
snprintf(xloc, sizeof(xloc), "%X/%X", LSN_FORMAT_ARGS(logptr)); snprintf(xloc, sizeof(xloc), "%X/%08X", LSN_FORMAT_ARGS(logptr));
if (MyDatabaseId != InvalidOid) if (MyDatabaseId != InvalidOid)
{ {
@ -515,7 +515,7 @@ ReadReplicationSlot(ReadReplicationSlotCmd *cmd)
{ {
char xloc[64]; char xloc[64];
snprintf(xloc, sizeof(xloc), "%X/%X", snprintf(xloc, sizeof(xloc), "%X/%08X",
LSN_FORMAT_ARGS(slot_contents.data.restart_lsn)); LSN_FORMAT_ARGS(slot_contents.data.restart_lsn));
values[i] = CStringGetTextDatum(xloc); values[i] = CStringGetTextDatum(xloc);
nulls[i] = false; nulls[i] = false;
@ -892,12 +892,12 @@ StartReplication(StartReplicationCmd *cmd)
switchpoint < cmd->startpoint) switchpoint < cmd->startpoint)
{ {
ereport(ERROR, ereport(ERROR,
(errmsg("requested starting point %X/%X on timeline %u is not in this server's history", errmsg("requested starting point %X/%08X on timeline %u is not in this server's history",
LSN_FORMAT_ARGS(cmd->startpoint), LSN_FORMAT_ARGS(cmd->startpoint),
cmd->timeline), cmd->timeline),
errdetail("This server's history forked from timeline %u at %X/%X.", errdetail("This server's history forked from timeline %u at %X/%08X.",
cmd->timeline, cmd->timeline,
LSN_FORMAT_ARGS(switchpoint)))); LSN_FORMAT_ARGS(switchpoint)));
} }
sendTimeLineValidUpto = switchpoint; sendTimeLineValidUpto = switchpoint;
} }
@ -939,9 +939,9 @@ StartReplication(StartReplicationCmd *cmd)
if (FlushPtr < cmd->startpoint) if (FlushPtr < cmd->startpoint)
{ {
ereport(ERROR, ereport(ERROR,
(errmsg("requested starting point %X/%X is ahead of the WAL flush position of this server %X/%X", errmsg("requested starting point %X/%08X is ahead of the WAL flush position of this server %X/%08X",
LSN_FORMAT_ARGS(cmd->startpoint), LSN_FORMAT_ARGS(cmd->startpoint),
LSN_FORMAT_ARGS(FlushPtr)))); LSN_FORMAT_ARGS(FlushPtr)));
} }
/* Start streaming from the requested point */ /* Start streaming from the requested point */
@ -983,7 +983,7 @@ StartReplication(StartReplicationCmd *cmd)
Datum values[2]; Datum values[2];
bool nulls[2] = {0}; bool nulls[2] = {0};
snprintf(startpos_str, sizeof(startpos_str), "%X/%X", snprintf(startpos_str, sizeof(startpos_str), "%X/%08X",
LSN_FORMAT_ARGS(sendTimeLineValidUpto)); LSN_FORMAT_ARGS(sendTimeLineValidUpto));
dest = CreateDestReceiver(DestRemoteSimple); dest = CreateDestReceiver(DestRemoteSimple);
@ -1324,7 +1324,7 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
ReplicationSlotPersist(); ReplicationSlotPersist();
} }
snprintf(xloc, sizeof(xloc), "%X/%X", snprintf(xloc, sizeof(xloc), "%X/%08X",
LSN_FORMAT_ARGS(MyReplicationSlot->data.confirmed_flush)); LSN_FORMAT_ARGS(MyReplicationSlot->data.confirmed_flush));
dest = CreateDestReceiver(DestRemoteSimple); dest = CreateDestReceiver(DestRemoteSimple);
@ -2429,7 +2429,7 @@ ProcessStandbyReplyMessage(void)
/* Copy because timestamptz_to_str returns a static buffer */ /* Copy because timestamptz_to_str returns a static buffer */
replyTimeStr = pstrdup(timestamptz_to_str(replyTime)); replyTimeStr = pstrdup(timestamptz_to_str(replyTime));
elog(DEBUG2, "write %X/%X flush %X/%X apply %X/%X%s reply_time %s", elog(DEBUG2, "write %X/%08X flush %X/%08X apply %X/%08X%s reply_time %s",
LSN_FORMAT_ARGS(writePtr), LSN_FORMAT_ARGS(writePtr),
LSN_FORMAT_ARGS(flushPtr), LSN_FORMAT_ARGS(flushPtr),
LSN_FORMAT_ARGS(applyPtr), LSN_FORMAT_ARGS(applyPtr),
@ -3251,7 +3251,7 @@ XLogSendPhysical(void)
WalSndCaughtUp = true; WalSndCaughtUp = true;
elog(DEBUG1, "walsender reached end of timeline at %X/%X (sent up to %X/%X)", elog(DEBUG1, "walsender reached end of timeline at %X/%08X (sent up to %X/%08X)",
LSN_FORMAT_ARGS(sendTimeLineValidUpto), LSN_FORMAT_ARGS(sendTimeLineValidUpto),
LSN_FORMAT_ARGS(sentPtr)); LSN_FORMAT_ARGS(sentPtr));
return; return;
@ -3392,7 +3392,7 @@ retry:
{ {
char activitymsg[50]; char activitymsg[50];
snprintf(activitymsg, sizeof(activitymsg), "streaming %X/%X", snprintf(activitymsg, sizeof(activitymsg), "streaming %X/%08X",
LSN_FORMAT_ARGS(sentPtr)); LSN_FORMAT_ARGS(sentPtr));
set_ps_display(activitymsg); set_ps_display(activitymsg);
} }

View File

@ -1376,7 +1376,7 @@ LogCurrentRunningXacts(RunningTransactions CurrRunningXacts)
if (xlrec.subxid_overflow) if (xlrec.subxid_overflow)
elog(DEBUG2, elog(DEBUG2,
"snapshot of %d running transactions overflowed (lsn %X/%X oldest xid %u latest complete %u next xid %u)", "snapshot of %d running transactions overflowed (lsn %X/%08X oldest xid %u latest complete %u next xid %u)",
CurrRunningXacts->xcnt, CurrRunningXacts->xcnt,
LSN_FORMAT_ARGS(recptr), LSN_FORMAT_ARGS(recptr),
CurrRunningXacts->oldestRunningXid, CurrRunningXacts->oldestRunningXid,
@ -1384,7 +1384,7 @@ LogCurrentRunningXacts(RunningTransactions CurrRunningXacts)
CurrRunningXacts->nextXid); CurrRunningXacts->nextXid);
else else
elog(DEBUG2, elog(DEBUG2,
"snapshot of %d+%d running transaction ids (lsn %X/%X oldest xid %u latest complete %u next xid %u)", "snapshot of %d+%d running transaction ids (lsn %X/%08X oldest xid %u latest complete %u next xid %u)",
CurrRunningXacts->xcnt, CurrRunningXacts->subxcnt, CurrRunningXacts->xcnt, CurrRunningXacts->subxcnt,
LSN_FORMAT_ARGS(recptr), LSN_FORMAT_ARGS(recptr),
CurrRunningXacts->oldestRunningXid, CurrRunningXacts->oldestRunningXid,

View File

@ -83,7 +83,7 @@ pg_lsn_out(PG_FUNCTION_ARGS)
char buf[MAXPG_LSNLEN + 1]; char buf[MAXPG_LSNLEN + 1];
char *result; char *result;
snprintf(buf, sizeof buf, "%X/%X", LSN_FORMAT_ARGS(lsn)); snprintf(buf, sizeof buf, "%X/%08X", LSN_FORMAT_ARGS(lsn));
result = pstrdup(buf); result = pstrdup(buf);
PG_RETURN_CSTRING(result); PG_RETURN_CSTRING(result);
} }

View File

@ -487,7 +487,7 @@ reached_end_position(XLogRecPtr segendpos, uint32 timeline,
if (r < 0) if (r < 0)
pg_fatal("could not read from ready pipe: %m"); pg_fatal("could not read from ready pipe: %m");
if (sscanf(xlogend, "%X/%X", &hi, &lo) != 2) if (sscanf(xlogend, "%X/%08X", &hi, &lo) != 2)
pg_fatal("could not parse write-ahead log location \"%s\"", pg_fatal("could not parse write-ahead log location \"%s\"",
xlogend); xlogend);
xlogendptr = ((uint64) hi) << 32 | lo; xlogendptr = ((uint64) hi) << 32 | lo;
@ -629,7 +629,7 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier,
param->wal_compress_level = wal_compress_level; param->wal_compress_level = wal_compress_level;
/* Convert the starting position */ /* Convert the starting position */
if (sscanf(startpos, "%X/%X", &hi, &lo) != 2) if (sscanf(startpos, "%X/%08X", &hi, &lo) != 2)
pg_fatal("could not parse write-ahead log location \"%s\"", pg_fatal("could not parse write-ahead log location \"%s\"",
startpos); startpos);
param->startptr = ((uint64) hi) << 32 | lo; param->startptr = ((uint64) hi) << 32 | lo;
@ -2255,7 +2255,7 @@ BaseBackup(char *compression_algorithm, char *compression_detail,
* value directly in the variable, and then set the flag that says * value directly in the variable, and then set the flag that says
* it's there. * it's there.
*/ */
if (sscanf(xlogend, "%X/%X", &hi, &lo) != 2) if (sscanf(xlogend, "%X/%08X", &hi, &lo) != 2)
pg_fatal("could not parse write-ahead log location \"%s\"", pg_fatal("could not parse write-ahead log location \"%s\"",
xlogend); xlogend);
xlogendptr = ((uint64) hi) << 32 | lo; xlogendptr = ((uint64) hi) << 32 | lo;

View File

@ -1262,7 +1262,7 @@ setup_recovery(const struct LogicalRepInfo *dbinfo, const char *datadir, const c
{ {
appendPQExpBufferStr(recoveryconfcontents, "# dry run mode"); appendPQExpBufferStr(recoveryconfcontents, "# dry run mode");
appendPQExpBuffer(recoveryconfcontents, appendPQExpBuffer(recoveryconfcontents,
"recovery_target_lsn = '%X/%X'\n", "recovery_target_lsn = '%X/%08X'\n",
LSN_FORMAT_ARGS((XLogRecPtr) InvalidXLogRecPtr)); LSN_FORMAT_ARGS((XLogRecPtr) InvalidXLogRecPtr));
} }
else else
@ -1876,7 +1876,7 @@ set_replication_progress(PGconn *conn, const struct LogicalRepInfo *dbinfo, cons
if (dry_run) if (dry_run)
{ {
suboid = InvalidOid; suboid = InvalidOid;
lsnstr = psprintf("%X/%X", LSN_FORMAT_ARGS((XLogRecPtr) InvalidXLogRecPtr)); lsnstr = psprintf("%X/%08X", LSN_FORMAT_ARGS((XLogRecPtr) InvalidXLogRecPtr));
} }
else else
{ {

View File

@ -188,14 +188,14 @@ stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished)
/* we assume that we get called once at the end of each segment */ /* we assume that we get called once at the end of each segment */
if (verbose && segment_finished) if (verbose && segment_finished)
pg_log_info("finished segment at %X/%X (timeline %u)", pg_log_info("finished segment at %X/%08X (timeline %u)",
LSN_FORMAT_ARGS(xlogpos), LSN_FORMAT_ARGS(xlogpos),
timeline); timeline);
if (!XLogRecPtrIsInvalid(endpos) && endpos < xlogpos) if (!XLogRecPtrIsInvalid(endpos) && endpos < xlogpos)
{ {
if (verbose) if (verbose)
pg_log_info("stopped log streaming at %X/%X (timeline %u)", pg_log_info("stopped log streaming at %X/%08X (timeline %u)",
LSN_FORMAT_ARGS(xlogpos), LSN_FORMAT_ARGS(xlogpos),
timeline); timeline);
time_to_stop = true; time_to_stop = true;
@ -211,7 +211,7 @@ stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished)
* timeline, but it's close enough for reporting purposes. * timeline, but it's close enough for reporting purposes.
*/ */
if (verbose && prevtimeline != 0 && prevtimeline != timeline) if (verbose && prevtimeline != 0 && prevtimeline != timeline)
pg_log_info("switched to timeline %u at %X/%X", pg_log_info("switched to timeline %u at %X/%08X",
timeline, timeline,
LSN_FORMAT_ARGS(prevpos)); LSN_FORMAT_ARGS(prevpos));
@ -575,7 +575,7 @@ StreamLog(void)
* Start the replication * Start the replication
*/ */
if (verbose) if (verbose)
pg_log_info("starting log streaming at %X/%X (timeline %u)", pg_log_info("starting log streaming at %X/%08X (timeline %u)",
LSN_FORMAT_ARGS(stream.startpos), LSN_FORMAT_ARGS(stream.startpos),
stream.timeline); stream.timeline);
@ -689,7 +689,7 @@ main(int argc, char **argv)
basedir = pg_strdup(optarg); basedir = pg_strdup(optarg);
break; break;
case 'E': case 'E':
if (sscanf(optarg, "%X/%X", &hi, &lo) != 2) if (sscanf(optarg, "%X/%08X", &hi, &lo) != 2)
pg_fatal("could not parse end position \"%s\"", optarg); pg_fatal("could not parse end position \"%s\"", optarg);
endpos = ((uint64) hi) << 32 | lo; endpos = ((uint64) hi) << 32 | lo;
break; break;

View File

@ -144,7 +144,7 @@ sendFeedback(PGconn *conn, TimestampTz now, bool force, bool replyRequested)
return true; return true;
if (verbose) if (verbose)
pg_log_info("confirming write up to %X/%X, flush to %X/%X (slot %s)", pg_log_info("confirming write up to %X/%08X, flush to %X/%08X (slot %s)",
LSN_FORMAT_ARGS(output_written_lsn), LSN_FORMAT_ARGS(output_written_lsn),
LSN_FORMAT_ARGS(output_fsync_lsn), LSN_FORMAT_ARGS(output_fsync_lsn),
replication_slot); replication_slot);
@ -238,13 +238,13 @@ StreamLogicalLog(void)
* Start the replication * Start the replication
*/ */
if (verbose) if (verbose)
pg_log_info("starting log streaming at %X/%X (slot %s)", pg_log_info("starting log streaming at %X/%08X (slot %s)",
LSN_FORMAT_ARGS(startpos), LSN_FORMAT_ARGS(startpos),
replication_slot); replication_slot);
/* Initiate the replication stream at specified location */ /* Initiate the replication stream at specified location */
query = createPQExpBuffer(); query = createPQExpBuffer();
appendPQExpBuffer(query, "START_REPLICATION SLOT \"%s\" LOGICAL %X/%X", appendPQExpBuffer(query, "START_REPLICATION SLOT \"%s\" LOGICAL %X/%08X",
replication_slot, LSN_FORMAT_ARGS(startpos)); replication_slot, LSN_FORMAT_ARGS(startpos));
/* print options if there are any */ /* print options if there are any */
@ -800,12 +800,12 @@ main(int argc, char **argv)
break; break;
/* replication options */ /* replication options */
case 'I': case 'I':
if (sscanf(optarg, "%X/%X", &hi, &lo) != 2) if (sscanf(optarg, "%X/%08X", &hi, &lo) != 2)
pg_fatal("could not parse start position \"%s\"", optarg); pg_fatal("could not parse start position \"%s\"", optarg);
startpos = ((uint64) hi) << 32 | lo; startpos = ((uint64) hi) << 32 | lo;
break; break;
case 'E': case 'E':
if (sscanf(optarg, "%X/%X", &hi, &lo) != 2) if (sscanf(optarg, "%X/%08X", &hi, &lo) != 2)
pg_fatal("could not parse end position \"%s\"", optarg); pg_fatal("could not parse end position \"%s\"", optarg);
endpos = ((uint64) hi) << 32 | lo; endpos = ((uint64) hi) << 32 | lo;
break; break;
@ -1075,12 +1075,12 @@ prepareToTerminate(PGconn *conn, XLogRecPtr endpos, StreamStopReason reason,
pg_log_info("received interrupt signal, exiting"); pg_log_info("received interrupt signal, exiting");
break; break;
case STREAM_STOP_KEEPALIVE: case STREAM_STOP_KEEPALIVE:
pg_log_info("end position %X/%X reached by keepalive", pg_log_info("end position %X/%08X reached by keepalive",
LSN_FORMAT_ARGS(endpos)); LSN_FORMAT_ARGS(endpos));
break; break;
case STREAM_STOP_END_OF_WAL: case STREAM_STOP_END_OF_WAL:
Assert(!XLogRecPtrIsInvalid(lsn)); Assert(!XLogRecPtrIsInvalid(lsn));
pg_log_info("end position %X/%X reached by WAL record at %X/%X", pg_log_info("end position %X/%08X reached by WAL record at %X/%08X",
LSN_FORMAT_ARGS(endpos), LSN_FORMAT_ARGS(lsn)); LSN_FORMAT_ARGS(endpos), LSN_FORMAT_ARGS(lsn));
break; break;
case STREAM_STOP_NONE: case STREAM_STOP_NONE:

View File

@ -571,7 +571,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
return true; return true;
/* Initiate the replication stream at specified location */ /* Initiate the replication stream at specified location */
snprintf(query, sizeof(query), "START_REPLICATION %s%X/%X TIMELINE %u", snprintf(query, sizeof(query), "START_REPLICATION %s%X/%08X TIMELINE %u",
slotcmd, slotcmd,
LSN_FORMAT_ARGS(stream->startpos), LSN_FORMAT_ARGS(stream->startpos),
stream->timeline); stream->timeline);
@ -628,7 +628,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
} }
if (stream->startpos > stoppos) if (stream->startpos > stoppos)
{ {
pg_log_error("server stopped streaming timeline %u at %X/%X, but reported next timeline %u to begin at %X/%X", pg_log_error("server stopped streaming timeline %u at %X/%08X, but reported next timeline %u to begin at %X/%08X",
stream->timeline, LSN_FORMAT_ARGS(stoppos), stream->timeline, LSN_FORMAT_ARGS(stoppos),
newtimeline, LSN_FORMAT_ARGS(stream->startpos)); newtimeline, LSN_FORMAT_ARGS(stream->startpos));
goto error; goto error;
@ -720,7 +720,7 @@ ReadEndOfStreamingResult(PGresult *res, XLogRecPtr *startpos, uint32 *timeline)
} }
*timeline = atoi(PQgetvalue(res, 0, 0)); *timeline = atoi(PQgetvalue(res, 0, 0));
if (sscanf(PQgetvalue(res, 0, 1), "%X/%X", &startpos_xlogid, if (sscanf(PQgetvalue(res, 0, 1), "%X/%08X", &startpos_xlogid,
&startpos_xrecoff) != 2) &startpos_xrecoff) != 2)
{ {
pg_log_error("could not parse next timeline's starting point \"%s\"", pg_log_error("could not parse next timeline's starting point \"%s\"",

View File

@ -445,7 +445,7 @@ RunIdentifySystem(PGconn *conn, char **sysid, TimeLineID *starttli,
/* Get LSN start position if necessary */ /* Get LSN start position if necessary */
if (startpos != NULL) if (startpos != NULL)
{ {
if (sscanf(PQgetvalue(res, 0, 2), "%X/%X", &hi, &lo) != 2) if (sscanf(PQgetvalue(res, 0, 2), "%X/%08X", &hi, &lo) != 2)
{ {
pg_log_error("could not parse write-ahead log location \"%s\"", pg_log_error("could not parse write-ahead log location \"%s\"",
PQgetvalue(res, 0, 2)); PQgetvalue(res, 0, 2));
@ -551,7 +551,7 @@ GetSlotInformation(PGconn *conn, const char *slot_name,
uint32 hi, uint32 hi,
lo; lo;
if (sscanf(PQgetvalue(res, 0, 1), "%X/%X", &hi, &lo) != 2) if (sscanf(PQgetvalue(res, 0, 1), "%X/%08X", &hi, &lo) != 2)
{ {
pg_log_error("could not parse restart_lsn \"%s\" for replication slot \"%s\"", pg_log_error("could not parse restart_lsn \"%s\" for replication slot \"%s\"",
PQgetvalue(res, 0, 1), slot_name); PQgetvalue(res, 0, 1), slot_name);

View File

@ -247,7 +247,7 @@ parse_lsn(char *s, char *e, XLogRecPtr *lsn, char **c)
unsigned lo; unsigned lo;
*e = '\0'; *e = '\0';
success = (sscanf(s, "%X/%X%n", &hi, &lo, &nchars) == 2); success = (sscanf(s, "%X/%08X%n", &hi, &lo, &nchars) == 2);
*e = save; *e = save;
if (success) if (success)

View File

@ -569,7 +569,7 @@ check_backup_label_files(int n_backups, char **backup_dirs)
pg_fatal("backup at \"%s\" starts on timeline %u, but expected %u", pg_fatal("backup at \"%s\" starts on timeline %u, but expected %u",
backup_dirs[i], start_tli, check_tli); backup_dirs[i], start_tli, check_tli);
if (i < n_backups - 1 && start_lsn != check_lsn) if (i < n_backups - 1 && start_lsn != check_lsn)
pg_fatal("backup at \"%s\" starts at LSN %X/%X, but expected %X/%X", pg_fatal("backup at \"%s\" starts at LSN %X/%08X, but expected %X/%08X",
backup_dirs[i], backup_dirs[i],
LSN_FORMAT_ARGS(start_lsn), LSN_FORMAT_ARGS(start_lsn),
LSN_FORMAT_ARGS(check_lsn)); LSN_FORMAT_ARGS(check_lsn));

View File

@ -155,7 +155,7 @@ finalize_manifest(manifest_writer *mwriter,
for (wal_range = first_wal_range; wal_range != NULL; for (wal_range = first_wal_range; wal_range != NULL;
wal_range = wal_range->next) wal_range = wal_range->next)
appendStringInfo(&mwriter->buf, appendStringInfo(&mwriter->buf,
"%s{ \"Timeline\": %u, \"Start-LSN\": \"%X/%X\", \"End-LSN\": \"%X/%X\" }", "%s{ \"Timeline\": %u, \"Start-LSN\": \"%X/%08X\", \"End-LSN\": \"%X/%08X\" }",
wal_range == first_wal_range ? "" : ",\n", wal_range == first_wal_range ? "" : ",\n",
wal_range->tli, wal_range->tli,
LSN_FORMAT_ARGS(wal_range->start_lsn), LSN_FORMAT_ARGS(wal_range->start_lsn),

View File

@ -245,9 +245,9 @@ main(int argc, char *argv[])
dbState(ControlFile->state)); dbState(ControlFile->state));
printf(_("pg_control last modified: %s\n"), printf(_("pg_control last modified: %s\n"),
pgctime_str); pgctime_str);
printf(_("Latest checkpoint location: %X/%X\n"), printf(_("Latest checkpoint location: %X/%08X\n"),
LSN_FORMAT_ARGS(ControlFile->checkPoint)); LSN_FORMAT_ARGS(ControlFile->checkPoint));
printf(_("Latest checkpoint's REDO location: %X/%X\n"), printf(_("Latest checkpoint's REDO location: %X/%08X\n"),
LSN_FORMAT_ARGS(ControlFile->checkPointCopy.redo)); LSN_FORMAT_ARGS(ControlFile->checkPointCopy.redo));
printf(_("Latest checkpoint's REDO WAL file: %s\n"), printf(_("Latest checkpoint's REDO WAL file: %s\n"),
xlogfilename); xlogfilename);
@ -282,15 +282,15 @@ main(int argc, char *argv[])
ControlFile->checkPointCopy.newestCommitTsXid); ControlFile->checkPointCopy.newestCommitTsXid);
printf(_("Time of latest checkpoint: %s\n"), printf(_("Time of latest checkpoint: %s\n"),
ckpttime_str); ckpttime_str);
printf(_("Fake LSN counter for unlogged rels: %X/%X\n"), printf(_("Fake LSN counter for unlogged rels: %X/%08X\n"),
LSN_FORMAT_ARGS(ControlFile->unloggedLSN)); LSN_FORMAT_ARGS(ControlFile->unloggedLSN));
printf(_("Minimum recovery ending location: %X/%X\n"), printf(_("Minimum recovery ending location: %X/%08X\n"),
LSN_FORMAT_ARGS(ControlFile->minRecoveryPoint)); LSN_FORMAT_ARGS(ControlFile->minRecoveryPoint));
printf(_("Min recovery ending loc's timeline: %u\n"), printf(_("Min recovery ending loc's timeline: %u\n"),
ControlFile->minRecoveryPointTLI); ControlFile->minRecoveryPointTLI);
printf(_("Backup start location: %X/%X\n"), printf(_("Backup start location: %X/%08X\n"),
LSN_FORMAT_ARGS(ControlFile->backupStartPoint)); LSN_FORMAT_ARGS(ControlFile->backupStartPoint));
printf(_("Backup end location: %X/%X\n"), printf(_("Backup end location: %X/%08X\n"),
LSN_FORMAT_ARGS(ControlFile->backupEndPoint)); LSN_FORMAT_ARGS(ControlFile->backupEndPoint));
printf(_("End-of-backup record required: %s\n"), printf(_("End-of-backup record required: %s\n"),
ControlFile->backupEndRequired ? _("yes") : _("no")); ControlFile->backupEndRequired ? _("yes") : _("no"));

View File

@ -215,7 +215,7 @@ libpq_get_current_wal_insert_lsn(rewind_source *source)
val = run_simple_query(conn, "SELECT pg_current_wal_insert_lsn()"); val = run_simple_query(conn, "SELECT pg_current_wal_insert_lsn()");
if (sscanf(val, "%X/%X", &hi, &lo) != 2) if (sscanf(val, "%X/%08X", &hi, &lo) != 2)
pg_fatal("unrecognized result \"%s\" for current WAL insert location", val); pg_fatal("unrecognized result \"%s\" for current WAL insert location", val);
result = ((uint64) hi) << 32 | lo; result = ((uint64) hi) << 32 | lo;

View File

@ -89,11 +89,11 @@ extractPageMap(const char *datadir, XLogRecPtr startpoint, int tliIndex,
XLogRecPtr errptr = xlogreader->EndRecPtr; XLogRecPtr errptr = xlogreader->EndRecPtr;
if (errormsg) if (errormsg)
pg_fatal("could not read WAL record at %X/%X: %s", pg_fatal("could not read WAL record at %X/%08X: %s",
LSN_FORMAT_ARGS(errptr), LSN_FORMAT_ARGS(errptr),
errormsg); errormsg);
else else
pg_fatal("could not read WAL record at %X/%X", pg_fatal("could not read WAL record at %X/%08X",
LSN_FORMAT_ARGS(errptr)); LSN_FORMAT_ARGS(errptr));
} }
@ -105,7 +105,7 @@ extractPageMap(const char *datadir, XLogRecPtr startpoint, int tliIndex,
* messed up. * messed up.
*/ */
if (xlogreader->EndRecPtr != endpoint) if (xlogreader->EndRecPtr != endpoint)
pg_fatal("end pointer %X/%X is not a valid end point; expected %X/%X", pg_fatal("end pointer %X/%08X is not a valid end point; expected %X/%08X",
LSN_FORMAT_ARGS(endpoint), LSN_FORMAT_ARGS(xlogreader->EndRecPtr)); LSN_FORMAT_ARGS(endpoint), LSN_FORMAT_ARGS(xlogreader->EndRecPtr));
XLogReaderFree(xlogreader); XLogReaderFree(xlogreader);
@ -143,10 +143,10 @@ readOneRecord(const char *datadir, XLogRecPtr ptr, int tliIndex,
if (record == NULL) if (record == NULL)
{ {
if (errormsg) if (errormsg)
pg_fatal("could not read WAL record at %X/%X: %s", pg_fatal("could not read WAL record at %X/%08X: %s",
LSN_FORMAT_ARGS(ptr), errormsg); LSN_FORMAT_ARGS(ptr), errormsg);
else else
pg_fatal("could not read WAL record at %X/%X", pg_fatal("could not read WAL record at %X/%08X",
LSN_FORMAT_ARGS(ptr)); LSN_FORMAT_ARGS(ptr));
} }
endptr = xlogreader->EndRecPtr; endptr = xlogreader->EndRecPtr;
@ -211,11 +211,11 @@ findLastCheckpoint(const char *datadir, XLogRecPtr forkptr, int tliIndex,
if (record == NULL) if (record == NULL)
{ {
if (errormsg) if (errormsg)
pg_fatal("could not find previous WAL record at %X/%X: %s", pg_fatal("could not find previous WAL record at %X/%08X: %s",
LSN_FORMAT_ARGS(searchptr), LSN_FORMAT_ARGS(searchptr),
errormsg); errormsg);
else else
pg_fatal("could not find previous WAL record at %X/%X", pg_fatal("could not find previous WAL record at %X/%08X",
LSN_FORMAT_ARGS(searchptr)); LSN_FORMAT_ARGS(searchptr));
} }
@ -458,8 +458,8 @@ extractPageInfo(XLogReaderState *record)
* we don't recognize the type. That's bad - we don't know how to * we don't recognize the type. That's bad - we don't know how to
* track that change. * track that change.
*/ */
pg_fatal("WAL record modifies a relation, but record type is not recognized: " pg_fatal("WAL record modifies a relation, but record type is not recognized:\n"
"lsn: %X/%X, rmid: %d, rmgr: %s, info: %02X", "lsn: %X/%08X, rmid: %d, rmgr: %s, info: %02X",
LSN_FORMAT_ARGS(record->ReadRecPtr), LSN_FORMAT_ARGS(record->ReadRecPtr),
rmid, RmgrName(rmid), info); rmid, RmgrName(rmid), info);
} }

View File

@ -393,7 +393,7 @@ main(int argc, char **argv)
targetHistory, targetNentries, targetHistory, targetNentries,
&divergerec, &lastcommontliIndex); &divergerec, &lastcommontliIndex);
pg_log_info("servers diverged at WAL location %X/%X on timeline %u", pg_log_info("servers diverged at WAL location %X/%08X on timeline %u",
LSN_FORMAT_ARGS(divergerec), LSN_FORMAT_ARGS(divergerec),
targetHistory[lastcommontliIndex].tli); targetHistory[lastcommontliIndex].tli);
@ -461,7 +461,7 @@ main(int argc, char **argv)
findLastCheckpoint(datadir_target, divergerec, lastcommontliIndex, findLastCheckpoint(datadir_target, divergerec, lastcommontliIndex,
&chkptrec, &chkpttli, &chkptredo, restore_command); &chkptrec, &chkpttli, &chkptredo, restore_command);
pg_log_info("rewinding from last common checkpoint at %X/%X on timeline %u", pg_log_info("rewinding from last common checkpoint at %X/%08X on timeline %u",
LSN_FORMAT_ARGS(chkptrec), chkpttli); LSN_FORMAT_ARGS(chkptrec), chkpttli);
/* Initialize the hash table to track the status of each file */ /* Initialize the hash table to track the status of each file */
@ -902,7 +902,7 @@ getTimelineHistory(TimeLineID tli, bool is_source, int *nentries)
TimeLineHistoryEntry *entry; TimeLineHistoryEntry *entry;
entry = &history[i]; entry = &history[i];
pg_log_debug("%u: %X/%X - %X/%X", entry->tli, pg_log_debug("%u: %X/%08X - %X/%08X", entry->tli,
LSN_FORMAT_ARGS(entry->begin), LSN_FORMAT_ARGS(entry->begin),
LSN_FORMAT_ARGS(entry->end)); LSN_FORMAT_ARGS(entry->end));
} }
@ -981,8 +981,8 @@ createBackupLabel(XLogRecPtr startpoint, TimeLineID starttli, XLogRecPtr checkpo
strftime(strfbuf, sizeof(strfbuf), "%Y-%m-%d %H:%M:%S %Z", tmp); strftime(strfbuf, sizeof(strfbuf), "%Y-%m-%d %H:%M:%S %Z", tmp);
len = snprintf(buf, sizeof(buf), len = snprintf(buf, sizeof(buf),
"START WAL LOCATION: %X/%X (file %s)\n" "START WAL LOCATION: %X/%08X (file %s)\n"
"CHECKPOINT LOCATION: %X/%X\n" "CHECKPOINT LOCATION: %X/%08X\n"
"BACKUP METHOD: pg_rewind\n" "BACKUP METHOD: pg_rewind\n"
"BACKUP FROM: standby\n" "BACKUP FROM: standby\n"
"START TIME: %s\n", "START TIME: %s\n",

View File

@ -66,7 +66,7 @@ rewind_parseTimeLineHistory(char *buffer, TimeLineID targetTLI, int *nentries)
if (*ptr == '\0' || *ptr == '#') if (*ptr == '\0' || *ptr == '#')
continue; continue;
nfields = sscanf(fline, "%u\t%X/%X", &tli, &switchpoint_hi, &switchpoint_lo); nfields = sscanf(fline, "%u\t%X/%08X", &tli, &switchpoint_hi, &switchpoint_lo);
if (nfields < 1) if (nfields < 1)
{ {

View File

@ -1207,7 +1207,7 @@ parse_required_wal(verifier_context *context, char *pg_waldump_path,
{ {
char *pg_waldump_cmd; char *pg_waldump_cmd;
pg_waldump_cmd = psprintf("\"%s\" --quiet --path=\"%s\" --timeline=%u --start=%X/%X --end=%X/%X\n", pg_waldump_cmd = psprintf("\"%s\" --quiet --path=\"%s\" --timeline=%u --start=%X/%08X --end=%X/%08X\n",
pg_waldump_path, wal_directory, this_wal_range->tli, pg_waldump_path, wal_directory, this_wal_range->tli,
LSN_FORMAT_ARGS(this_wal_range->start_lsn), LSN_FORMAT_ARGS(this_wal_range->start_lsn),
LSN_FORMAT_ARGS(this_wal_range->end_lsn)); LSN_FORMAT_ARGS(this_wal_range->end_lsn));

View File

@ -656,7 +656,7 @@ XLogDumpDisplayStats(XLogDumpConfig *config, XLogStats *stats)
} }
total_len = total_rec_len + total_fpi_len; total_len = total_rec_len + total_fpi_len;
printf("WAL statistics between %X/%X and %X/%X:\n", printf("WAL statistics between %X/%08X and %X/%08X:\n",
LSN_FORMAT_ARGS(stats->startptr), LSN_FORMAT_ARGS(stats->endptr)); LSN_FORMAT_ARGS(stats->startptr), LSN_FORMAT_ARGS(stats->endptr));
/* /*
@ -904,7 +904,7 @@ main(int argc, char **argv)
config.filter_by_extended = true; config.filter_by_extended = true;
break; break;
case 'e': case 'e':
if (sscanf(optarg, "%X/%X", &xlogid, &xrecoff) != 2) if (sscanf(optarg, "%X/%08X", &xlogid, &xrecoff) != 2)
{ {
pg_log_error("invalid WAL location: \"%s\"", pg_log_error("invalid WAL location: \"%s\"",
optarg); optarg);
@ -1002,7 +1002,7 @@ main(int argc, char **argv)
config.filter_by_extended = true; config.filter_by_extended = true;
break; break;
case 's': case 's':
if (sscanf(optarg, "%X/%X", &xlogid, &xrecoff) != 2) if (sscanf(optarg, "%X/%08X", &xlogid, &xrecoff) != 2)
{ {
pg_log_error("invalid WAL location: \"%s\"", pg_log_error("invalid WAL location: \"%s\"",
optarg); optarg);
@ -1140,7 +1140,7 @@ main(int argc, char **argv)
XLogSegNoOffsetToRecPtr(segno, 0, WalSegSz, private.startptr); XLogSegNoOffsetToRecPtr(segno, 0, WalSegSz, private.startptr);
else if (!XLByteInSeg(private.startptr, segno, WalSegSz)) else if (!XLByteInSeg(private.startptr, segno, WalSegSz))
{ {
pg_log_error("start WAL location %X/%X is not inside file \"%s\"", pg_log_error("start WAL location %X/%08X is not inside file \"%s\"",
LSN_FORMAT_ARGS(private.startptr), LSN_FORMAT_ARGS(private.startptr),
fname); fname);
goto bad_argument; goto bad_argument;
@ -1182,7 +1182,7 @@ main(int argc, char **argv)
if (!XLByteInSeg(private.endptr, segno, WalSegSz) && if (!XLByteInSeg(private.endptr, segno, WalSegSz) &&
private.endptr != (segno + 1) * WalSegSz) private.endptr != (segno + 1) * WalSegSz)
{ {
pg_log_error("end WAL location %X/%X is not inside file \"%s\"", pg_log_error("end WAL location %X/%08X is not inside file \"%s\"",
LSN_FORMAT_ARGS(private.endptr), LSN_FORMAT_ARGS(private.endptr),
argv[argc - 1]); argv[argc - 1]);
goto bad_argument; goto bad_argument;
@ -1214,7 +1214,7 @@ main(int argc, char **argv)
first_record = XLogFindNextRecord(xlogreader_state, private.startptr); first_record = XLogFindNextRecord(xlogreader_state, private.startptr);
if (first_record == InvalidXLogRecPtr) if (first_record == InvalidXLogRecPtr)
pg_fatal("could not find a valid record after %X/%X", pg_fatal("could not find a valid record after %X/%08X",
LSN_FORMAT_ARGS(private.startptr)); LSN_FORMAT_ARGS(private.startptr));
/* /*
@ -1224,8 +1224,8 @@ main(int argc, char **argv)
*/ */
if (first_record != private.startptr && if (first_record != private.startptr &&
XLogSegmentOffset(private.startptr, WalSegSz) != 0) XLogSegmentOffset(private.startptr, WalSegSz) != 0)
pg_log_info(ngettext("first record is after %X/%X, at %X/%X, skipping over %u byte", pg_log_info(ngettext("first record is after %X/%08X, at %X/%08X, skipping over %u byte",
"first record is after %X/%X, at %X/%X, skipping over %u bytes", "first record is after %X/%08X, at %X/%08X, skipping over %u bytes",
(first_record - private.startptr)), (first_record - private.startptr)),
LSN_FORMAT_ARGS(private.startptr), LSN_FORMAT_ARGS(private.startptr),
LSN_FORMAT_ARGS(first_record), LSN_FORMAT_ARGS(first_record),
@ -1309,7 +1309,7 @@ main(int argc, char **argv)
exit(0); exit(0);
if (errormsg) if (errormsg)
pg_fatal("error in WAL record at %X/%X: %s", pg_fatal("error in WAL record at %X/%08X: %s",
LSN_FORMAT_ARGS(xlogreader_state->ReadRecPtr), LSN_FORMAT_ARGS(xlogreader_state->ReadRecPtr),
errormsg); errormsg);

View File

@ -942,7 +942,7 @@ parse_xlogrecptr(XLogRecPtr *result, char *input)
uint32 hi; uint32 hi;
uint32 lo; uint32 lo;
if (sscanf(input, "%X/%X", &hi, &lo) != 2) if (sscanf(input, "%X/%08X", &hi, &lo) != 2)
return false; return false;
*result = ((uint64) hi) << 32 | lo; *result = ((uint64) hi) << 32 | lo;
return true; return true;

View File

@ -38,7 +38,10 @@ typedef uint64 XLogRecPtr;
/* /*
* Handy macro for printing XLogRecPtr in conventional format, e.g., * Handy macro for printing XLogRecPtr in conventional format, e.g.,
* *
* printf("%X/%X", LSN_FORMAT_ARGS(lsn)); * printf("%X/08X", LSN_FORMAT_ARGS(lsn));
*
* To avoid breaking translatable messages, we're directly applying the
* LSN format instead of using a macro.
*/ */
#define LSN_FORMAT_ARGS(lsn) (AssertVariableIsOfTypeMacro((lsn), XLogRecPtr), (uint32) ((lsn) >> 32)), ((uint32) (lsn)) #define LSN_FORMAT_ARGS(lsn) (AssertVariableIsOfTypeMacro((lsn), XLogRecPtr), (uint32) ((lsn) >> 32)), ((uint32) (lsn))

View File

@ -39,7 +39,7 @@ sub find_largest_lsn
defined($len) or die "read error on $filename: $!"; defined($len) or die "read error on $filename: $!";
close($fh); close($fh);
return sprintf("%X/%X", $max_hi, $max_lo); return sprintf("%X/%08X", $max_hi, $max_lo);
} }
# Initialize primary node # Initialize primary node

View File

@ -3872,15 +3872,15 @@ ERROR: factorial of a negative number is undefined
-- Tests for pg_lsn() -- Tests for pg_lsn()
-- --
SELECT pg_lsn(23783416::numeric); SELECT pg_lsn(23783416::numeric);
pg_lsn pg_lsn
----------- ------------
0/16AE7F8 0/016AE7F8
(1 row) (1 row)
SELECT pg_lsn(0::numeric); SELECT pg_lsn(0::numeric);
pg_lsn pg_lsn
-------- ------------
0/0 0/00000000
(1 row) (1 row)
SELECT pg_lsn(18446744073709551615::numeric); SELECT pg_lsn(18446744073709551615::numeric);

View File

@ -41,9 +41,9 @@ SELECT * FROM pg_input_error_info('16AE7F7', 'pg_lsn');
-- Min/Max aggregation -- Min/Max aggregation
SELECT MIN(f1), MAX(f1) FROM PG_LSN_TBL; SELECT MIN(f1), MAX(f1) FROM PG_LSN_TBL;
min | max min | max
-----+------------------- ------------+-------------------
0/0 | FFFFFFFF/FFFFFFFF 0/00000000 | FFFFFFFF/FFFFFFFF
(1 row) (1 row)
DROP TABLE PG_LSN_TBL; DROP TABLE PG_LSN_TBL;
@ -85,21 +85,21 @@ SELECT '0/16AE7F8'::pg_lsn - '0/16AE7F7'::pg_lsn;
(1 row) (1 row)
SELECT '0/16AE7F7'::pg_lsn + 16::numeric; SELECT '0/16AE7F7'::pg_lsn + 16::numeric;
?column? ?column?
----------- ------------
0/16AE807 0/016AE807
(1 row) (1 row)
SELECT 16::numeric + '0/16AE7F7'::pg_lsn; SELECT 16::numeric + '0/16AE7F7'::pg_lsn;
?column? ?column?
----------- ------------
0/16AE807 0/016AE807
(1 row) (1 row)
SELECT '0/16AE7F7'::pg_lsn - 16::numeric; SELECT '0/16AE7F7'::pg_lsn - 16::numeric;
?column? ?column?
----------- ------------
0/16AE7E7 0/016AE7E7
(1 row) (1 row)
SELECT 'FFFFFFFF/FFFFFFFE'::pg_lsn + 1::numeric; SELECT 'FFFFFFFF/FFFFFFFE'::pg_lsn + 1::numeric;
@ -111,9 +111,9 @@ SELECT 'FFFFFFFF/FFFFFFFE'::pg_lsn + 1::numeric;
SELECT 'FFFFFFFF/FFFFFFFE'::pg_lsn + 2::numeric; -- out of range error SELECT 'FFFFFFFF/FFFFFFFE'::pg_lsn + 2::numeric; -- out of range error
ERROR: pg_lsn out of range ERROR: pg_lsn out of range
SELECT '0/1'::pg_lsn - 1::numeric; SELECT '0/1'::pg_lsn - 1::numeric;
?column? ?column?
---------- ------------
0/0 0/00000000
(1 row) (1 row)
SELECT '0/1'::pg_lsn - 2::numeric; -- out of range error SELECT '0/1'::pg_lsn - 2::numeric; -- out of range error
@ -125,9 +125,9 @@ SELECT '0/0'::pg_lsn + ('FFFFFFFF/FFFFFFFF'::pg_lsn - '0/0'::pg_lsn);
(1 row) (1 row)
SELECT 'FFFFFFFF/FFFFFFFF'::pg_lsn - ('FFFFFFFF/FFFFFFFF'::pg_lsn - '0/0'::pg_lsn); SELECT 'FFFFFFFF/FFFFFFFF'::pg_lsn - ('FFFFFFFF/FFFFFFFF'::pg_lsn - '0/0'::pg_lsn);
?column? ?column?
---------- ------------
0/0 0/00000000
(1 row) (1 row)
SELECT '0/16AE7F7'::pg_lsn + 'NaN'::numeric; SELECT '0/16AE7F7'::pg_lsn + 'NaN'::numeric;
@ -164,107 +164,107 @@ SELECT DISTINCT (i || '/' || j)::pg_lsn f
generate_series(1, 5) k generate_series(1, 5) k
WHERE i <= 10 AND j > 0 AND j <= 10 WHERE i <= 10 AND j > 0 AND j <= 10
ORDER BY f; ORDER BY f;
f f
------- -------------
1/1 1/00000001
1/2 1/00000002
1/3 1/00000003
1/4 1/00000004
1/5 1/00000005
1/6 1/00000006
1/7 1/00000007
1/8 1/00000008
1/9 1/00000009
1/10 1/00000010
2/1 2/00000001
2/2 2/00000002
2/3 2/00000003
2/4 2/00000004
2/5 2/00000005
2/6 2/00000006
2/7 2/00000007
2/8 2/00000008
2/9 2/00000009
2/10 2/00000010
3/1 3/00000001
3/2 3/00000002
3/3 3/00000003
3/4 3/00000004
3/5 3/00000005
3/6 3/00000006
3/7 3/00000007
3/8 3/00000008
3/9 3/00000009
3/10 3/00000010
4/1 4/00000001
4/2 4/00000002
4/3 4/00000003
4/4 4/00000004
4/5 4/00000005
4/6 4/00000006
4/7 4/00000007
4/8 4/00000008
4/9 4/00000009
4/10 4/00000010
5/1 5/00000001
5/2 5/00000002
5/3 5/00000003
5/4 5/00000004
5/5 5/00000005
5/6 5/00000006
5/7 5/00000007
5/8 5/00000008
5/9 5/00000009
5/10 5/00000010
6/1 6/00000001
6/2 6/00000002
6/3 6/00000003
6/4 6/00000004
6/5 6/00000005
6/6 6/00000006
6/7 6/00000007
6/8 6/00000008
6/9 6/00000009
6/10 6/00000010
7/1 7/00000001
7/2 7/00000002
7/3 7/00000003
7/4 7/00000004
7/5 7/00000005
7/6 7/00000006
7/7 7/00000007
7/8 7/00000008
7/9 7/00000009
7/10 7/00000010
8/1 8/00000001
8/2 8/00000002
8/3 8/00000003
8/4 8/00000004
8/5 8/00000005
8/6 8/00000006
8/7 8/00000007
8/8 8/00000008
8/9 8/00000009
8/10 8/00000010
9/1 9/00000001
9/2 9/00000002
9/3 9/00000003
9/4 9/00000004
9/5 9/00000005
9/6 9/00000006
9/7 9/00000007
9/8 9/00000008
9/9 9/00000009
9/10 9/00000010
10/1 10/00000001
10/2 10/00000002
10/3 10/00000003
10/4 10/00000004
10/5 10/00000005
10/6 10/00000006
10/7 10/00000007
10/8 10/00000008
10/9 10/00000009
10/10 10/00000010
(100 rows) (100 rows)

View File

@ -116,18 +116,18 @@ CREATE SUBSCRIPTION regress_testsub4 CONNECTION 'dbname=regress_doesnotexist' PU
WARNING: subscription was created, but is not connected WARNING: subscription was created, but is not connected
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription. HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
\dRs+ regress_testsub4 \dRs+ regress_testsub4
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
------------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- ------------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub4 | regress_subscription_user | f | {testpub} | f | parallel | d | f | none | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub4 | regress_subscription_user | f | {testpub} | f | parallel | d | f | none | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
ALTER SUBSCRIPTION regress_testsub4 SET (origin = any); ALTER SUBSCRIPTION regress_testsub4 SET (origin = any);
\dRs+ regress_testsub4 \dRs+ regress_testsub4
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
------------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- ------------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub4 | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub4 | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
DROP SUBSCRIPTION regress_testsub3; DROP SUBSCRIPTION regress_testsub3;
@ -145,10 +145,10 @@ ALTER SUBSCRIPTION regress_testsub CONNECTION 'foobar';
ERROR: invalid connection string syntax: missing "=" after "foobar" in connection info string ERROR: invalid connection string syntax: missing "=" after "foobar" in connection info string
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- -----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
ALTER SUBSCRIPTION regress_testsub SET PUBLICATION testpub2, testpub3 WITH (refresh = false); ALTER SUBSCRIPTION regress_testsub SET PUBLICATION testpub2, testpub3 WITH (refresh = false);
@ -157,10 +157,10 @@ ALTER SUBSCRIPTION regress_testsub SET (slot_name = 'newname');
ALTER SUBSCRIPTION regress_testsub SET (password_required = false); ALTER SUBSCRIPTION regress_testsub SET (password_required = false);
ALTER SUBSCRIPTION regress_testsub SET (run_as_owner = true); ALTER SUBSCRIPTION regress_testsub SET (run_as_owner = true);
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------------+---------- -----------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | f | t | f | off | dbname=regress_doesnotexist2 | 0/0 regress_testsub | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | f | t | f | off | dbname=regress_doesnotexist2 | 0/00000000
(1 row) (1 row)
ALTER SUBSCRIPTION regress_testsub SET (password_required = true); ALTER SUBSCRIPTION regress_testsub SET (password_required = true);
@ -176,10 +176,10 @@ ERROR: unrecognized subscription parameter: "create_slot"
-- ok -- ok
ALTER SUBSCRIPTION regress_testsub SKIP (lsn = '0/12345'); ALTER SUBSCRIPTION regress_testsub SKIP (lsn = '0/12345');
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------------+---------- -----------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist2 | 0/12345 regress_testsub | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist2 | 0/00012345
(1 row) (1 row)
-- ok - with lsn = NONE -- ok - with lsn = NONE
@ -188,10 +188,10 @@ ALTER SUBSCRIPTION regress_testsub SKIP (lsn = NONE);
ALTER SUBSCRIPTION regress_testsub SKIP (lsn = '0/0'); ALTER SUBSCRIPTION regress_testsub SKIP (lsn = '0/0');
ERROR: invalid WAL location (LSN): 0/0 ERROR: invalid WAL location (LSN): 0/0
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------------+---------- -----------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist2 | 0/0 regress_testsub | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist2 | 0/00000000
(1 row) (1 row)
BEGIN; BEGIN;
@ -223,10 +223,10 @@ ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = foobar);
ERROR: invalid value for parameter "synchronous_commit": "foobar" ERROR: invalid value for parameter "synchronous_commit": "foobar"
HINT: Available values: local, remote_write, remote_apply, on, off. HINT: Available values: local, remote_write, remote_apply, on, off.
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
---------------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------------+---------- ---------------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------------+------------
regress_testsub_foo | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | t | f | f | local | dbname=regress_doesnotexist2 | 0/0 regress_testsub_foo | regress_subscription_user | f | {testpub2,testpub3} | f | parallel | d | f | any | t | f | f | local | dbname=regress_doesnotexist2 | 0/00000000
(1 row) (1 row)
-- rename back to keep the rest simple -- rename back to keep the rest simple
@ -255,19 +255,19 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUB
WARNING: subscription was created, but is not connected WARNING: subscription was created, but is not connected
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription. HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- -----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub} | t | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub | regress_subscription_user | f | {testpub} | t | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
ALTER SUBSCRIPTION regress_testsub SET (binary = false); ALTER SUBSCRIPTION regress_testsub SET (binary = false);
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE); ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- -----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
DROP SUBSCRIPTION regress_testsub; DROP SUBSCRIPTION regress_testsub;
@ -279,27 +279,27 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUB
WARNING: subscription was created, but is not connected WARNING: subscription was created, but is not connected
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription. HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- -----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub} | f | on | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub | regress_subscription_user | f | {testpub} | f | on | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
ALTER SUBSCRIPTION regress_testsub SET (streaming = parallel); ALTER SUBSCRIPTION regress_testsub SET (streaming = parallel);
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- -----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
ALTER SUBSCRIPTION regress_testsub SET (streaming = false); ALTER SUBSCRIPTION regress_testsub SET (streaming = false);
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE); ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- -----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub} | f | off | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub | regress_subscription_user | f | {testpub} | f | off | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
-- fail - publication already exists -- fail - publication already exists
@ -314,10 +314,10 @@ ALTER SUBSCRIPTION regress_testsub ADD PUBLICATION testpub1, testpub2 WITH (refr
ALTER SUBSCRIPTION regress_testsub ADD PUBLICATION testpub1, testpub2 WITH (refresh = false); ALTER SUBSCRIPTION regress_testsub ADD PUBLICATION testpub1, testpub2 WITH (refresh = false);
ERROR: publication "testpub1" is already in subscription "regress_testsub" ERROR: publication "testpub1" is already in subscription "regress_testsub"
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+-----------------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- -----------------+---------------------------+---------+-----------------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub,testpub1,testpub2} | f | off | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub | regress_subscription_user | f | {testpub,testpub1,testpub2} | f | off | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
-- fail - publication used more than once -- fail - publication used more than once
@ -332,10 +332,10 @@ ERROR: publication "testpub3" is not in subscription "regress_testsub"
-- ok - delete publications -- ok - delete publications
ALTER SUBSCRIPTION regress_testsub DROP PUBLICATION testpub1, testpub2 WITH (refresh = false); ALTER SUBSCRIPTION regress_testsub DROP PUBLICATION testpub1, testpub2 WITH (refresh = false);
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- -----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub} | f | off | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub | regress_subscription_user | f | {testpub} | f | off | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
DROP SUBSCRIPTION regress_testsub; DROP SUBSCRIPTION regress_testsub;
@ -371,19 +371,19 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUB
WARNING: subscription was created, but is not connected WARNING: subscription was created, but is not connected
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription. HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- -----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | p | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | p | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
-- we can alter streaming when two_phase enabled -- we can alter streaming when two_phase enabled
ALTER SUBSCRIPTION regress_testsub SET (streaming = true); ALTER SUBSCRIPTION regress_testsub SET (streaming = true);
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- -----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub} | f | on | p | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub | regress_subscription_user | f | {testpub} | f | on | p | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE); ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
@ -393,10 +393,10 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUB
WARNING: subscription was created, but is not connected WARNING: subscription was created, but is not connected
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription. HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- -----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub} | f | on | p | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub | regress_subscription_user | f | {testpub} | f | on | p | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE); ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
@ -409,18 +409,18 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUB
WARNING: subscription was created, but is not connected WARNING: subscription was created, but is not connected
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription. HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- -----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | f | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
ALTER SUBSCRIPTION regress_testsub SET (disable_on_error = true); ALTER SUBSCRIPTION regress_testsub SET (disable_on_error = true);
\dRs+ \dRs+
List of subscriptions List of subscriptions
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Password required | Run as owner? | Failover | Synchronous commit | Conninfo | Skip LSN
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+---------- -----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+-----------------------------+------------
regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | t | any | t | f | f | off | dbname=regress_doesnotexist | 0/0 regress_testsub | regress_subscription_user | f | {testpub} | f | parallel | d | t | any | t | f | f | off | dbname=regress_doesnotexist | 0/00000000
(1 row) (1 row)
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE); ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);