1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Remove the logId/logSeg fields from pg_control, because they are not needed

in normal operation, and we can avoid rewriting pg_control at every log
segment switch if we don't insist that these values be valid.  Reducing
the number of pg_control updates is a good idea for both performance and
reliability.  It does make pg_resetxlog's life a bit harder, but that seems
a good tradeoff; and anyway the change to pg_resetxlog amounts to automating
something people formerly needed to do by hand, namely look at the existing
pg_xlog files to make sure the new WAL start point was past them.

In passing, change the wording of xlog.c's "database system was interrupted"
messages: describe the pg_control timestamp as "last known up at" rather than
implying it is the exact time of service interruption.  With this change the
timestamp will generally be the time of the last checkpoint, which could be
many minutes before the failure; and we've already seen indications that
people tend to misinterpret the old wording.

initdb forced due to change in pg_control layout.  Simon Riggs and Tom Lane
This commit is contained in:
Tom Lane
2006-12-08 19:50:53 +00:00
parent 98cacd1a0a
commit 0cb91ccba9
5 changed files with 172 additions and 99 deletions

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_resetxlog.sgml,v 1.18 2006/09/16 00:30:19 momjian Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_resetxlog.sgml,v 1.19 2006/12/08 19:50:52 tgl Exp $
PostgreSQL documentation
-->
@ -72,7 +72,7 @@ PostgreSQL documentation
<literal>-f</> can still be used, but
the recovered database must be treated with even more suspicion than
usual: an immediate dump and reload is imperative. <emphasis>Do not</>
execute any data-modifying operations in the database before you dump;
execute any data-modifying operations in the database before you dump,
as any such action is likely to make the corruption worse.
</para>
@ -127,7 +127,7 @@ PostgreSQL documentation
<listitem>
<para>
The WAL starting address (<literal>-l</>) should be
larger than any file name currently existing in
larger than any WAL segment file name currently existing in
the directory <filename>pg_xlog</> under the data directory.
These names are also in hexadecimal and have three parts. The first
part is the <quote>timeline ID</> and should usually be kept the same.
@ -139,6 +139,18 @@ PostgreSQL documentation
<filename>000000010000003A000000FF</>, choose <literal>-l 0x1,0x3B,0x0</>
or more.
</para>
<note>
<para>
<command>pg_resetxlog</command> itself looks at the files in
<filename>pg_xlog</> and chooses a default <literal>-l</> setting
beyond the last existing file name. Therefore, manual adjustment of
<literal>-l</> should only be needed if you are aware of WAL segment
files that are not currently present in <filename>pg_xlog</>, such as
entries in an offline archive; or if the contents of
<filename>pg_xlog</> have been lost entirely.
</para>
</note>
</listitem>
<listitem>