v5_0001_timelineid_hexadecimal_format.patch
text/x-patch
Filename: v5_0001_timelineid_hexadecimal_format.patch
Type: text/x-patch
Part: 0
Message:
Re: Timeline ID hexadecimal format
Patch
Format: unified
Series: patch v5
| File | + | − |
|---|---|---|
| doc/src/sgml/backup.sgml | 2 | 1 |
| doc/src/sgml/config.sgml | 5 | 1 |
| doc/src/sgml/ref/pg_waldump.sgml | 3 | 1 |
| src/bin/pg_waldump/pg_waldump.c | 2 | 1 |
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index be05a33205..fb86a3fec5 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -1332,7 +1332,8 @@ restore_command = 'cp /mnt/server/archivedir/%f %p'
you like, add comments to a history file to record your own notes about
how and why this particular timeline was created. Such comments will be
especially valuable when you have a thicket of different timelines as
- a result of experimentation.
+ a result of experimentation. The timeline identifier is an integer which
+ is used in hexadecimal format in both WAL segment file names and history files.
</para>
<para>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index e5c41cc6c6..6c0d63b73d 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -4110,7 +4110,11 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
current when the base backup was taken. The
value <literal>latest</literal> recovers
to the latest timeline found in the archive, which is useful in
- a standby server. <literal>latest</literal> is the default.
+ a standby server. A numerical value expressed in hexadecimal, by exemple
+ from WAL filename or history file, must be prefixed with <literal>0x</literal>,
+ for example <literal>0x11</literal> if the WAL filename
+ is <filename>00000011000000A10000004F</filename>.
+ <literal>latest</literal> is the default.
</para>
<para>
diff --git a/doc/src/sgml/ref/pg_waldump.sgml b/doc/src/sgml/ref/pg_waldump.sgml
index 343f0482a9..d92948c68a 100644
--- a/doc/src/sgml/ref/pg_waldump.sgml
+++ b/doc/src/sgml/ref/pg_waldump.sgml
@@ -215,7 +215,9 @@ PostgreSQL documentation
<para>
Timeline from which to read WAL records. The default is to use the
value in <replaceable>startseg</replaceable>, if that is specified; otherwise, the
- default is 1.
+ default is 1. The value can be expressed in decimal or hexadecimal format.
+ The hexadecimal format, given by WAL filename, must be preceded by <literal>0x</literal>,
+ by example <literal>0x11</literal>.
</para>
</listitem>
</varlistentry>
diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c
index 44b5c8726e..b29d5223ce 100644
--- a/src/bin/pg_waldump/pg_waldump.c
+++ b/src/bin/pg_waldump/pg_waldump.c
@@ -770,6 +770,7 @@ usage(void)
printf(_(" -R, --relation=T/D/R only show records that modify blocks in relation T/D/R\n"));
printf(_(" -s, --start=RECPTR start reading at WAL location RECPTR\n"));
printf(_(" -t, --timeline=TLI timeline from which to read WAL records\n"
+ " hexadecimal value, from WAL filename, must be preceded by 0x\n"
" (default: 1 or the value used in STARTSEG)\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -w, --fullpage only show records with a full page write\n"));
@@ -1007,7 +1008,7 @@ main(int argc, char **argv)
private.startptr = (uint64) xlogid << 32 | xrecoff;
break;
case 't':
- if (sscanf(optarg, "%u", &private.timeline) != 1)
+ if ( !(private.timeline = strtoul(optarg, NULL, 0)) )
{
pg_log_error("invalid timeline specification: \"%s\"", optarg);
goto bad_argument;