mirror of
https://github.com/postgres/postgres.git
synced 2025-11-25 12:03: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:
@@ -14,6 +14,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/clog.h"
|
||||
#include "access/commit_ts.h"
|
||||
#include "access/subtrans.h"
|
||||
#include "access/transam.h"
|
||||
#include "access/xact.h"
|
||||
@@ -158,9 +159,10 @@ GetNewTransactionId(bool isSubXact)
|
||||
* XID before we zero the page. Fortunately, a page of the commit log
|
||||
* holds 32K or more transactions, so we don't have to do this very often.
|
||||
*
|
||||
* Extend pg_subtrans too.
|
||||
* Extend pg_subtrans and pg_commit_ts too.
|
||||
*/
|
||||
ExtendCLOG(xid);
|
||||
ExtendCommitTs(xid);
|
||||
ExtendSUBTRANS(xid);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user