Rework activation of commit timestamps during recovery

Enterprise / PostgreSQL - Michael Paquier [] - 26 September 2018 01:25 EDT

The activation and deactivation of commit timestamp tracking has not been handled consistently for a primary or standbys at recovery. The facility can be activated at three different moments of recovery:- The beginning, where a primary would use the GUC value for the decision-making, and where a standby relies on the contents of the control file.
- When replaying a XLOG_PARAMETER_CHANGE record at redo.
- The end, where both primary and standby rely on the GUC value.

Using the GUC value for a primary at the beginning of recovery causes problems with commit timestamp access when doing crash recovery. Particularly, when replaying transaction commits, it could be possible that an attempt to read commit timestamps is done for a transaction which committed at a moment when track_commit_timestamp was disabled.

A test case is added to reproduce the failure. The test works down to
v11 as it takes advantage of transaction commits within procedures.

8d28bf500f Rework activation of commit timestamps during recovery
src/backend/access/transam/commit_ts.c | 9 ++++----
src/backend/access/transam/xlog.c | 9 ++++----
src/test/modules/commit_ts/t/ | 36 +++++++++++++++++++++++++----
3 files changed, 40 insertions(+), 14 deletions(-)


  • Share