1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-19 17:02:53 +03:00

Keep track of transaction commit timestamps

Transactions can now set their commit timestamp directly as they commit,
or an external transaction commit timestamp can be fed from an outside
system using the new function TransactionTreeSetCommitTsData().  This
data is crash-safe, and truncated at Xid freeze point, same as pg_clog.

This module is disabled by default because it causes a performance hit,
but can be enabled in postgresql.conf requiring only a server restart.

A new test in src/test/modules is included.

Catalog version bumped due to the new subdirectory within PGDATA and a
couple of new SQL functions.

Authors: Álvaro Herrera and Petr Jelínek

Reviewed to varying degrees by Michael Paquier, Andres Freund, Robert
Haas, Amit Kapila, Fujii Masao, Jaime Casanova, Simon Riggs, Steven
Singer, Peter Eisentraut
This commit is contained in:
Alvaro Herrera
2014-12-03 11:53:02 -03:00
parent 6597ec9be6
commit 73c986adde
43 changed files with 1458 additions and 28 deletions

View File

@@ -22,6 +22,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<cmdsynopsis>
<command>pg_resetxlog</command>
<arg choice="opt"><option>-c</option> <replaceable class="parameter">xid</replaceable>,<replaceable class="parameter">xid</replaceable></arg>
<arg choice="opt"><option>-f</option></arg>
<arg choice="opt"><option>-n</option></arg>
<arg choice="opt"><option>-o</option> <replaceable class="parameter">oid</replaceable></arg>
@@ -79,9 +80,12 @@ PostgreSQL documentation
<para>
The <option>-o</>, <option>-x</>, <option>-e</>,
<option>-m</>, <option>-O</>,
<option>-c</>
and <option>-l</>
options allow the next OID, next transaction ID, next transaction ID's
epoch, next and oldest multitransaction ID, next multitransaction offset, and WAL
epoch, next and oldest multitransaction ID, next multitransaction offset,
oldest and newest transaction IDs for which the commit time can be retrieved,
and WAL
starting address values to be set manually. These are only needed when
<command>pg_resetxlog</command> is unable to determine appropriate values
by reading <filename>pg_control</>. Safe values can be determined as
@@ -128,6 +132,19 @@ PostgreSQL documentation
</para>
</listitem>
<listitem>
<para>
A safe value for the oldest transaction ID for which the commit time can
be retrieved (first part of <option>-c</>) can be determined by looking
for the numerically smallest file name in the directory
<filename>pg_committs</> under the data directory. Conversely, a safe
value for the newest transaction ID for which the commit time can be
retrieved (second part of <option>-c</>) can be determined by looking for
the numerically greatest file name in the same directory. As above, the
file names are in hexadecimal.
</para>
</listitem>
<listitem>
<para>
The WAL starting address (<option>-l</>) should be