Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9d0bd95

Browse files
committed
Add block information in error context of WAL REDO apply loop
Providing this information can be useful for example when diagnosingproblems related to recovery conflicts or for recovery issues withouthaving to go through the output generated by pg_waldump to get someinformation about the blocks a WAL record works on.The block information is printed in the same format as pg_waldump. Thisalready existed in xlog.c for debugging purposes with -DWAL_DEBUG, soadding the block information in the callback has required just a smallrefactoring.Author: Bertrand DrouvotReviewed-by: Michael Paquier, Masahiko SawadaDiscussion:https://postgr.es/m/c31e2cba-efda-762c-f4ad-5c25e5dac3d0@amazon.com
1 parent4964253 commit9d0bd95

File tree

1 file changed

+15
-1
lines changed
  • src/backend/access/transam

1 file changed

+15
-1
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,7 @@ static bool CheckForStandbyTrigger(void);
940940
#ifdefWAL_DEBUG
941941
staticvoidxlog_outrec(StringInfobuf,XLogReaderState*record);
942942
#endif
943+
staticvoidxlog_block_info(StringInfobuf,XLogReaderState*record);
943944
staticvoidxlog_outdesc(StringInfobuf,XLogReaderState*record);
944945
staticvoidpg_start_backup_callback(intcode,Datumarg);
945946
staticvoidpg_stop_backup_callback(intcode,Datumarg);
@@ -10258,6 +10259,19 @@ xlog_outrec(StringInfo buf, XLogReaderState *record)
1025810259
appendStringInfo(buf,"; len %u",
1025910260
XLogRecGetDataLen(record));
1026010261

10262+
xlog_block_info(buf,record);
10263+
}
10264+
#endif/* WAL_DEBUG */
10265+
10266+
/*
10267+
* Returns a string giving information about all the blocks in an
10268+
* XLogRecord.
10269+
*/
10270+
staticvoid
10271+
xlog_block_info(StringInfobuf,XLogReaderState*record)
10272+
{
10273+
intblock_id;
10274+
1026110275
/* decode block references */
1026210276
for (block_id=0;block_id <=record->max_block_id;block_id++)
1026310277
{
@@ -10284,7 +10298,6 @@ xlog_outrec(StringInfo buf, XLogReaderState *record)
1028410298
appendStringInfoString(buf," FPW");
1028510299
}
1028610300
}
10287-
#endif/* WAL_DEBUG */
1028810301

1028910302
/*
1029010303
* Returns a string describing an XLogRecord, consisting of its identity
@@ -11765,6 +11778,7 @@ rm_redo_error_callback(void *arg)
1176511778

1176611779
initStringInfo(&buf);
1176711780
xlog_outdesc(&buf,record);
11781+
xlog_block_info(&buf,record);
1176811782

1176911783
/* translator: %s is a WAL record description */
1177011784
errcontext("WAL redo at %X/%X for %s",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp