diff options
author | Fujii Masao <fujii@postgresql.org> | 2021-04-12 00:00:18 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2021-04-12 00:04:30 +0900 |
commit | 08aa89b326261b669648df97d4f2a6edba22d26a (patch) | |
tree | 87f43f33fc3aaf2162da331b332dc1a30527c6d4 /src/backend/access/transam/commit_ts.c | |
parent | df5efaf4410f94cc1b69e8ade1d64dc92232ec1d (diff) | |
download | postgresql-08aa89b326261b669648df97d4f2a6edba22d26a.tar.gz postgresql-08aa89b326261b669648df97d4f2a6edba22d26a.zip |
Remove COMMIT_TS_SETTS record.
Commit 438fc4a39c prevented the WAL replay from writing
COMMIT_TS_SETTS record. By this change there is no code that
generates COMMIT_TS_SETTS record in PostgreSQL core.
Also we can think that there are no extensions using the record
because we've not received so far any complaints about the issue
that commit 438fc4a39c fixed. Therefore this commit removes
COMMIT_TS_SETTS record and its related code. Even without
this record, the timestamp required for commit timestamp feature
can be acquired from the COMMIT record.
Bump WAL page magic.
Reported-by: lx zou <zoulx1982@163.com>
Author: Fujii Masao
Reviewed-by: Alvaro Herrera
Discussion: https://postgr.es/m/16931-620d0f2fdc6108f1@postgresql.org
Diffstat (limited to 'src/backend/access/transam/commit_ts.c')
-rw-r--r-- | src/backend/access/transam/commit_ts.c | 64 |
1 files changed, 1 insertions, 63 deletions
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c index 268bdba3398..0985fa155ca 100644 --- a/src/backend/access/transam/commit_ts.c +++ b/src/backend/access/transam/commit_ts.c @@ -114,9 +114,6 @@ static void ActivateCommitTs(void); static void DeactivateCommitTs(void); static void WriteZeroPageXlogRec(int pageno); static void WriteTruncateXlogRec(int pageno, TransactionId oldestXid); -static void WriteSetTimestampXlogRec(TransactionId mainxid, int nsubxids, - TransactionId *subxids, TimestampTz timestamp, - RepOriginId nodeid); /* * TransactionTreeSetCommitTsData @@ -133,18 +130,11 @@ static void WriteSetTimestampXlogRec(TransactionId mainxid, int nsubxids, * permanent) so we need to keep the information about them here. If the * subtrans implementation changes in the future, we might want to revisit the * decision of storing timestamp info for each subxid. - * - * The write_xlog parameter tells us whether to include an XLog record of this - * or not. Normally, this is called from transaction commit routines (both - * normal and prepared) and the information will be stored in the transaction - * commit XLog record, and so they should pass "false" for this. The XLog redo - * code should use "false" here as well. Other callers probably want to pass - * true, so that the given values persist in case of crashes. */ void TransactionTreeSetCommitTsData(TransactionId xid, int nsubxids, TransactionId *subxids, TimestampTz timestamp, - RepOriginId nodeid, bool write_xlog) + RepOriginId nodeid) { int i; TransactionId headxid; @@ -162,13 +152,6 @@ TransactionTreeSetCommitTsData(TransactionId xid, int nsubxids, return; /* - * Comply with the WAL-before-data rule: if caller specified it wants this - * value to be recorded in WAL, do so before touching the data. - */ - if (write_xlog) - WriteSetTimestampXlogRec(xid, nsubxids, subxids, timestamp, nodeid); - - /* * Figure out the latest Xid in this batch: either the last subxid if * there's any, otherwise the parent xid. */ @@ -994,28 +977,6 @@ WriteTruncateXlogRec(int pageno, TransactionId oldestXid) } /* - * Write a SETTS xlog record - */ -static void -WriteSetTimestampXlogRec(TransactionId mainxid, int nsubxids, - TransactionId *subxids, TimestampTz timestamp, - RepOriginId nodeid) -{ - xl_commit_ts_set record; - - record.timestamp = timestamp; - record.nodeid = nodeid; - record.mainxid = mainxid; - - XLogBeginInsert(); - XLogRegisterData((char *) &record, - offsetof(xl_commit_ts_set, mainxid) + - sizeof(TransactionId)); - XLogRegisterData((char *) subxids, nsubxids * sizeof(TransactionId)); - XLogInsert(RM_COMMIT_TS_ID, COMMIT_TS_SETTS); -} - -/* * CommitTS resource manager's routines */ void @@ -1055,29 +1016,6 @@ commit_ts_redo(XLogReaderState *record) SimpleLruTruncate(CommitTsCtl, trunc->pageno); } - else if (info == COMMIT_TS_SETTS) - { - xl_commit_ts_set *setts = (xl_commit_ts_set *) XLogRecGetData(record); - int nsubxids; - TransactionId *subxids; - - nsubxids = ((XLogRecGetDataLen(record) - SizeOfCommitTsSet) / - sizeof(TransactionId)); - if (nsubxids > 0) - { - subxids = palloc(sizeof(TransactionId) * nsubxids); - memcpy(subxids, - XLogRecGetData(record) + SizeOfCommitTsSet, - sizeof(TransactionId) * nsubxids); - } - else - subxids = NULL; - - TransactionTreeSetCommitTsData(setts->mainxid, nsubxids, subxids, - setts->timestamp, setts->nodeid, false); - if (subxids) - pfree(subxids); - } else elog(PANIC, "commit_ts_redo: unknown op code %u", info); } |