mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-03-07 19:47:50 +08:00
Improve error messages for some callers of XLogReadRecord()
A couple of code paths related to logical decoding (WAL sender, slot advancing, etc.) use XLogReadRecord(), feeding on error messages generated by walreader.c on a failure. All those messages have no context, making it harder to spot from where an error could come even if these should not happen. All the other callers of XLogReadRecord() do that already. Reviewed-by: Kyotaro Horiguchi Discussion: https://postgr.es/m/YYnTH6OyOwQcAdkw@paquier.xyz
This commit is contained in:
parent
4168a47454
commit
c9c401a5e1
@ -605,9 +605,9 @@ DecodingContextFindStartpoint(LogicalDecodingContext *ctx)
|
||||
/* the read_page callback waits for new WAL */
|
||||
record = XLogReadRecord(ctx->reader, &err);
|
||||
if (err)
|
||||
elog(ERROR, "%s", err);
|
||||
elog(ERROR, "could not find logical decoding starting point: %s", err);
|
||||
if (!record)
|
||||
elog(ERROR, "no record found"); /* shouldn't happen */
|
||||
elog(ERROR, "could not find logical decoding starting point");
|
||||
|
||||
LogicalDecodingProcessRecord(ctx, ctx->reader);
|
||||
|
||||
|
@ -276,7 +276,7 @@ pg_logical_slot_get_changes_guts(FunctionCallInfo fcinfo, bool confirm, bool bin
|
||||
|
||||
record = XLogReadRecord(ctx->reader, &errm);
|
||||
if (errm)
|
||||
elog(ERROR, "%s", errm);
|
||||
elog(ERROR, "could not find record for logical decoding: %s", errm);
|
||||
|
||||
/*
|
||||
* The {begin_txn,change,commit_txn}_wrapper callbacks above will
|
||||
|
@ -529,7 +529,8 @@ pg_logical_replication_slot_advance(XLogRecPtr moveto)
|
||||
*/
|
||||
record = XLogReadRecord(ctx->reader, &errm);
|
||||
if (errm)
|
||||
elog(ERROR, "%s", errm);
|
||||
elog(ERROR, "could not find record while advancing replication slot: %s",
|
||||
errm);
|
||||
|
||||
/*
|
||||
* Process the record. Storage-level changes are ignored in
|
||||
|
@ -2979,7 +2979,8 @@ XLogSendLogical(void)
|
||||
|
||||
/* xlog record was invalid */
|
||||
if (errm != NULL)
|
||||
elog(ERROR, "%s", errm);
|
||||
elog(ERROR, "could not find record while sending logically-decoded data: %s",
|
||||
errm);
|
||||
|
||||
if (record != NULL)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user