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

Commit4f1f385

Browse files
michaelpqpull[bot]
authored andcommitted
Add timeline ID to file names generated with pg_waldump --save-fullpage
Not including the timeline IDs to the file names generated by pg_waldumpfor the individual blocks saved could cause some of these files to beoverwritten when scanning segments across multiple timelines. Havingthis information is also as much useful as the LSNs, to be able to knowfrom exactly which WAL segment a block is comes from.While on it, this fixes a few comments in the tests, where the format ofthe file was not described as matching with the reality.Reported-by: Fujii MasaoReviewed-by: Kyotaro Horiguchi, David ChristensenDiscussion:https://postgr.es/m/ZJp921+nITFnvBVS@paquier.xyz
1 parent60bbef0 commit4f1f385

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

‎doc/src/sgml/ref/pg_waldump.sgml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ PostgreSQL documentation
283283
</para>
284284
<para>
285285
The full page images are saved with the following file name format:
286-
<literal><replaceable>LSN</replaceable>.<replaceable>RELTABLESPACE</replaceable>.<replaceable>DATOID</replaceable>.<replaceable>RELNODE</replaceable>.<replaceable>BLKNO</replaceable><replaceable>FORK</replaceable></literal>
286+
<literal><replaceable>TIMELINE</replaceable>-<replaceable>LSN</replaceable>.<replaceable>RELTABLESPACE</replaceable>.<replaceable>DATOID</replaceable>.<replaceable>RELNODE</replaceable>.<replaceable>BLKNO</replaceable><replaceable>FORK</replaceable></literal>
287287

288288
The file names are composed of the following parts:
289289
<informaltable>
@@ -296,6 +296,13 @@ PostgreSQL documentation
296296
</thead>
297297

298298
<tbody>
299+
<row>
300+
<entry>TIMELINE</entry>
301+
<entry>The timeline of the WAL segment file where the record
302+
is located formatted as one 8-character hexadecimal number
303+
<literal>%08X</literal></entry>
304+
</row>
305+
299306
<row>
300307
<entry>LSN</entry>
301308
<entry>The <acronym>LSN</acronym> of the record with this image,

‎src/bin/pg_waldump/pg_waldump.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,8 @@ XLogRecordSaveFPWs(XLogReaderState *record, const char *savepath)
518518
else
519519
pg_fatal("invalid fork number: %u",fork);
520520

521-
snprintf(filename,MAXPGPATH,"%s/%08X-%08X.%u.%u.%u.%u%s",savepath,
521+
snprintf(filename,MAXPGPATH,"%s/%08X-%08X-%08X.%u.%u.%u.%u%s",savepath,
522+
record->seg.ws_tli,
522523
LSN_FORMAT_ARGS(record->ReadRecPtr),
523524
rnode.spcOid,rnode.dbOid,rnode.relNumber,blk,forkname);
524525

‎src/bin/pg_waldump/t/002_save_fullpage.pl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,16 @@ sub get_block_lsn
7979
'pg_waldump with --save-fullpage runs');
8080

8181
# This regexp will match filenames formatted as:
82-
# XXXXXXXX-XXXXXXXX.DBOID.TLOID.NODEOID.dd_fork with the components being:
83-
# - WAL LSN in hex format,
84-
# - Tablespace OID (0 for global)
82+
# TLI-LSNh-LSNl.TBLSPCOID.DBOID.NODEOID.dd_fork with the components being:
83+
# - Timeline ID in hex format.
84+
# - WAL LSN in hex format, as two 8-character numbers.
85+
# - Tablespace OID (0 for global).
8586
# - Database OID.
8687
# - Relfilenode.
8788
# - Block number.
8889
# - Fork this block came from (vm, init, fsm, or main).
8990
my$file_re =
90-
qr/^([0-9A-F]{8})-([0-9A-F]{8})[.][0-9]+[.][0-9]+[.][0-9]+[.][0-9]+(?:_vm|_init|_fsm|_main)?$/;
91+
qr/^[0-9A-F]{8}-([0-9A-F]{8})-([0-9A-F]{8})[.][0-9]+[.][0-9]+[.][0-9]+[.][0-9]+(?:_vm|_init|_fsm|_main)?$/;
9192

9293
my$file_count = 0;
9394

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp