Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit08aa89b

Browse files
committed
Remove COMMIT_TS_SETTS record.
Commit438fc4a prevented the WAL replay from writingCOMMIT_TS_SETTS record. By this change there is no code thatgenerates COMMIT_TS_SETTS record in PostgreSQL core.Also we can think that there are no extensions using the recordbecause we've not received so far any complaints about the issuethat commit438fc4a fixed. Therefore this commit removesCOMMIT_TS_SETTS record and its related code. Even withoutthis record, the timestamp required for commit timestamp featurecan be acquired from the COMMIT record.Bump WAL page magic.Reported-by: lx zou <zoulx1982@163.com>Author: Fujii MasaoReviewed-by: Alvaro HerreraDiscussion:https://postgr.es/m/16931-620d0f2fdc6108f1@postgresql.org
1 parentdf5efaf commit08aa89b

File tree

6 files changed

+6
-96
lines changed

6 files changed

+6
-96
lines changed

‎src/backend/access/rmgrdesc/committsdesc.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,6 @@ commit_ts_desc(StringInfo buf, XLogReaderState *record)
3838
appendStringInfo(buf,"pageno %d, oldestXid %u",
3939
trunc->pageno,trunc->oldestXid);
4040
}
41-
elseif (info==COMMIT_TS_SETTS)
42-
{
43-
xl_commit_ts_set*xlrec= (xl_commit_ts_set*)rec;
44-
intnsubxids;
45-
46-
appendStringInfo(buf,"set %s/%d for: %u",
47-
timestamptz_to_str(xlrec->timestamp),
48-
xlrec->nodeid,
49-
xlrec->mainxid);
50-
nsubxids= ((XLogRecGetDataLen(record)-SizeOfCommitTsSet) /
51-
sizeof(TransactionId));
52-
if (nsubxids>0)
53-
{
54-
inti;
55-
TransactionId*subxids;
56-
57-
subxids=palloc(sizeof(TransactionId)*nsubxids);
58-
memcpy(subxids,
59-
XLogRecGetData(record)+SizeOfCommitTsSet,
60-
sizeof(TransactionId)*nsubxids);
61-
for (i=0;i<nsubxids;i++)
62-
appendStringInfo(buf,", %u",subxids[i]);
63-
pfree(subxids);
64-
}
65-
}
6641
}
6742

6843
constchar*
@@ -74,8 +49,6 @@ commit_ts_identify(uint8 info)
7449
return"ZEROPAGE";
7550
caseCOMMIT_TS_TRUNCATE:
7651
return"TRUNCATE";
77-
caseCOMMIT_TS_SETTS:
78-
return"SETTS";
7952
default:
8053
returnNULL;
8154
}

‎src/backend/access/transam/commit_ts.c

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,6 @@ static void ActivateCommitTs(void);
114114
staticvoidDeactivateCommitTs(void);
115115
staticvoidWriteZeroPageXlogRec(intpageno);
116116
staticvoidWriteTruncateXlogRec(intpageno,TransactionIdoldestXid);
117-
staticvoidWriteSetTimestampXlogRec(TransactionIdmainxid,intnsubxids,
118-
TransactionId*subxids,TimestampTztimestamp,
119-
RepOriginIdnodeid);
120117

121118
/*
122119
* TransactionTreeSetCommitTsData
@@ -133,18 +130,11 @@ static void WriteSetTimestampXlogRec(TransactionId mainxid, int nsubxids,
133130
* permanent) so we need to keep the information about them here. If the
134131
* subtrans implementation changes in the future, we might want to revisit the
135132
* decision of storing timestamp info for each subxid.
136-
*
137-
* The write_xlog parameter tells us whether to include an XLog record of this
138-
* or not. Normally, this is called from transaction commit routines (both
139-
* normal and prepared) and the information will be stored in the transaction
140-
* commit XLog record, and so they should pass "false" for this. The XLog redo
141-
* code should use "false" here as well. Other callers probably want to pass
142-
* true, so that the given values persist in case of crashes.
143133
*/
144134
void
145135
TransactionTreeSetCommitTsData(TransactionIdxid,intnsubxids,
146136
TransactionId*subxids,TimestampTztimestamp,
147-
RepOriginIdnodeid,boolwrite_xlog)
137+
RepOriginIdnodeid)
148138
{
149139
inti;
150140
TransactionIdheadxid;
@@ -161,13 +151,6 @@ TransactionTreeSetCommitTsData(TransactionId xid, int nsubxids,
161151
if (!commitTsShared->commitTsActive)
162152
return;
163153

164-
/*
165-
* Comply with the WAL-before-data rule: if caller specified it wants this
166-
* value to be recorded in WAL, do so before touching the data.
167-
*/
168-
if (write_xlog)
169-
WriteSetTimestampXlogRec(xid,nsubxids,subxids,timestamp,nodeid);
170-
171154
/*
172155
* Figure out the latest Xid in this batch: either the last subxid if
173156
* there's any, otherwise the parent xid.
@@ -993,28 +976,6 @@ WriteTruncateXlogRec(int pageno, TransactionId oldestXid)
993976
(void)XLogInsert(RM_COMMIT_TS_ID,COMMIT_TS_TRUNCATE);
994977
}
995978

996-
/*
997-
* Write a SETTS xlog record
998-
*/
999-
staticvoid
1000-
WriteSetTimestampXlogRec(TransactionIdmainxid,intnsubxids,
1001-
TransactionId*subxids,TimestampTztimestamp,
1002-
RepOriginIdnodeid)
1003-
{
1004-
xl_commit_ts_setrecord;
1005-
1006-
record.timestamp=timestamp;
1007-
record.nodeid=nodeid;
1008-
record.mainxid=mainxid;
1009-
1010-
XLogBeginInsert();
1011-
XLogRegisterData((char*)&record,
1012-
offsetof(xl_commit_ts_set,mainxid)+
1013-
sizeof(TransactionId));
1014-
XLogRegisterData((char*)subxids,nsubxids*sizeof(TransactionId));
1015-
XLogInsert(RM_COMMIT_TS_ID,COMMIT_TS_SETTS);
1016-
}
1017-
1018979
/*
1019980
* CommitTS resource manager's routines
1020981
*/
@@ -1055,29 +1016,6 @@ commit_ts_redo(XLogReaderState *record)
10551016

10561017
SimpleLruTruncate(CommitTsCtl,trunc->pageno);
10571018
}
1058-
elseif (info==COMMIT_TS_SETTS)
1059-
{
1060-
xl_commit_ts_set*setts= (xl_commit_ts_set*)XLogRecGetData(record);
1061-
intnsubxids;
1062-
TransactionId*subxids;
1063-
1064-
nsubxids= ((XLogRecGetDataLen(record)-SizeOfCommitTsSet) /
1065-
sizeof(TransactionId));
1066-
if (nsubxids>0)
1067-
{
1068-
subxids=palloc(sizeof(TransactionId)*nsubxids);
1069-
memcpy(subxids,
1070-
XLogRecGetData(record)+SizeOfCommitTsSet,
1071-
sizeof(TransactionId)*nsubxids);
1072-
}
1073-
else
1074-
subxids=NULL;
1075-
1076-
TransactionTreeSetCommitTsData(setts->mainxid,nsubxids,subxids,
1077-
setts->timestamp,setts->nodeid, false);
1078-
if (subxids)
1079-
pfree(subxids);
1080-
}
10811019
else
10821020
elog(PANIC,"commit_ts_redo: unknown op code %u",info);
10831021
}

‎src/backend/access/transam/twophase.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2246,7 +2246,7 @@ RecordTransactionCommitPrepared(TransactionId xid,
22462246

22472247
TransactionTreeSetCommitTsData(xid,nchildren,children,
22482248
replorigin_session_origin_timestamp,
2249-
replorigin_session_origin, false);
2249+
replorigin_session_origin);
22502250

22512251
/*
22522252
* We don't currently try to sleep before flush here ... nor is there any

‎src/backend/access/transam/xact.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ RecordTransactionCommit(void)
13661366

13671367
TransactionTreeSetCommitTsData(xid,nchildren,children,
13681368
replorigin_session_origin_timestamp,
1369-
replorigin_session_origin, false);
1369+
replorigin_session_origin);
13701370
}
13711371

13721372
/*
@@ -5804,7 +5804,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
58045804

58055805
/* Set the transaction commit timestamp and metadata */
58065806
TransactionTreeSetCommitTsData(xid,parsed->nsubxacts,parsed->subxacts,
5807-
commit_time,origin_id, false);
5807+
commit_time,origin_id);
58085808

58095809
if (standbyState==STANDBY_DISABLED)
58105810
{

‎src/include/access/commit_ts.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern bool check_track_commit_timestamp(bool *newval, void **extra,
2525

2626
externvoidTransactionTreeSetCommitTsData(TransactionIdxid,intnsubxids,
2727
TransactionId*subxids,TimestampTztimestamp,
28-
RepOriginIdnodeid,boolwrite_xlog);
28+
RepOriginIdnodeid);
2929
externboolTransactionIdGetCommitTsData(TransactionIdxid,
3030
TimestampTz*ts,RepOriginId*nodeid);
3131
externTransactionIdGetLatestCommitTsData(TimestampTz*ts,
@@ -50,7 +50,6 @@ extern intcommittssyncfiletag(const FileTag *ftag, char *path);
5050
/* XLOG stuff */
5151
#defineCOMMIT_TS_ZEROPAGE0x00
5252
#defineCOMMIT_TS_TRUNCATE0x10
53-
#defineCOMMIT_TS_SETTS0x20
5453

5554
typedefstructxl_commit_ts_set
5655
{

‎src/include/access/xlog_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/*
3232
* Each page of XLOG file has a header like this:
3333
*/
34-
#defineXLOG_PAGE_MAGIC0xD10C/* can be used as WAL version indicator */
34+
#defineXLOG_PAGE_MAGIC0xD10D/* can be used as WAL version indicator */
3535

3636
typedefstructXLogPageHeaderData
3737
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp