Skip to content

Commit 8fd733b

Browse files
committed
Disable pg_standby -l option because the backend doesn't expect the recovered
file to be a symlink. We tried to fix this issue with an earlier server-side patch, but it didn't fix the whole issue. The same bug is present in older releases as well, but the 8.4 train is about to leave the station, and I'm not sure if have consensus on whether we can remove the -l option in back-branches or do we need to attempt a server-side fix to make symlinking safe. Patch by Simon Riggs, per discussion on bug identified by Fujii Masao.
1 parent 6c4637a commit 8fd733b

File tree

2 files changed

+11
-28
lines changed

2 files changed

+11
-28
lines changed

contrib/pg_standby/pg_standby.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/pg_standby/pg_standby.c,v 1.24 2009/06/18 10:08:08 heikki Exp $
2+
* $PostgreSQL: pgsql/contrib/pg_standby/pg_standby.c,v 1.25 2009/06/25 12:03:10 heikki Exp $
33
*
44
*
55
* pg_standby.c
@@ -523,7 +523,7 @@ usage(void)
523523
printf(" -d generate lots of debugging output (testing only)\n");
524524
printf(" -k NUMFILESTOKEEP if RESTARTWALFILE not used, removes files prior to limit\n"
525525
" (0 keeps all)\n");
526-
printf(" -l links into archive (leaves file in archive)\n");
526+
printf(" -l does nothing; use of link is now deprecated\n");
527527
printf(" -r MAXRETRIES max number of times to retry, with progressive wait\n"
528528
" (default=3)\n");
529529
printf(" -s SLEEPTIME seconds to wait between file checks (min=1, max=60,\n"
@@ -610,7 +610,12 @@ main(int argc, char **argv)
610610
}
611611
break;
612612
case 'l': /* Use link */
613-
restoreCommandType = RESTORE_COMMAND_LINK;
613+
/*
614+
* Link feature disabled, possibly permanently. Linking
615+
* causes a problem after recovery ends that is not currently
616+
* resolved by PostgreSQL. 25 Jun 2009
617+
restoreCommandType = RESTORE_COMMAND_LINK;
618+
*/
614619
break;
615620
case 'r': /* Retries */
616621
maxretries = atoi(optarg);

doc/src/sgml/pgstandby.sgml

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/pgstandby.sgml,v 2.9 2009/05/14 21:59:22 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/pgstandby.sgml,v 2.10 2009/06/25 12:03:11 heikki Exp $ -->
22

33
<sect1 id="pgstandby">
44
<title>pg_standby</title>
@@ -25,11 +25,6 @@
2525
<application>pg_standby</application> features include:
2626
</para>
2727
<itemizedlist>
28-
<listitem>
29-
<para>
30-
Supports copy or link for restoring WAL files
31-
</para>
32-
</listitem>
3328
<listitem>
3429
<para>
3530
Written in C, so very portable and easy to install
@@ -171,23 +166,11 @@ pg_standby <optional> <replaceable>option</> ... </optional> <replaceable>archiv
171166
archive space.
172167
</entry>
173168
</row>
174-
<row>
175-
<entry><literal>-l</></entry>
176-
<entry>no</entry>
177-
<entry>
178-
Use <literal>ln</> command to restore WAL files from archive.
179-
Link is more efficient than copy, but the default is copy since link
180-
will not work in all scenarios.
181-
On Windows, this option uses the <literal>mklink</> command
182-
to provide a file-to-file symbolic link. <literal>-l</> will
183-
not work on versions of Windows prior to Vista.
184-
</entry>
185-
</row>
186169
<row>
187170
<entry><literal>-r</> <replaceable>maxretries</></entry>
188171
<entry>3</entry>
189172
<entry>
190-
Set the maximum number of times to retry the copy or link command if it
173+
Set the maximum number of times to retry the copy command if it
191174
fails. After each failure, we wait for <replaceable>sleeptime</> *
192175
<replaceable>num_retries</>
193176
so that the wait time increases progressively. So by default,
@@ -242,7 +225,7 @@ pg_standby <optional> <replaceable>option</> ... </optional> <replaceable>archiv
242225
<programlisting>
243226
archive_command = 'cp %p .../archive/%f'
244227

245-
restore_command = 'pg_standby -l -d -s 2 -t /tmp/pgsql.trigger.5442 .../archive %f %p %r 2>>standby.log'
228+
restore_command = 'pg_standby -d -s 2 -t /tmp/pgsql.trigger.5442 .../archive %f %p %r 2>>standby.log'
246229

247230
recovery_end_command = 'rm -f /tmp/pgsql.trigger.5442'
248231
</programlisting>
@@ -253,11 +236,6 @@ recovery_end_command = 'rm -f /tmp/pgsql.trigger.5442'
253236
This will:
254237
</para>
255238
<itemizedlist>
256-
<listitem>
257-
<para>
258-
use the <literal>ln</> command to restore WAL files from archive
259-
</para>
260-
</listitem>
261239
<listitem>
262240
<para>
263241
produce debugging output in <filename>standby.log</>

0 commit comments

Comments
 (0)