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

Commitb452900

Browse files
committed
Revert "Add single-item cache when looking at topmost XID of a subtrans XID"
This reverts commit06f5295 as per issues with this approach, both interms of efficiency impact and stability. First, contrary to thesingle-item cache for transaction IDs in transam.c, the cache may finishby not be hit for a long time, and without an invalidation mechanism toclear it, it would cause inconsistent results on wraparound forexample. Second, the use of SubTransGetTopmostTransaction() for thecaching has a limited impact on performance. SubTransGetParent() couldhave more impact, though the benchmarking of the single-item approachstill needs to be proved, particularly under the conditions where SLRUlookups are stressed in parallel with overflowed snapshots (aka morethan 64 subxids generated, for example).After discussion with Andres Freund.Discussion:https://postgr.es/m/20220524235250.gtt3uu5zktfkr4hv@alap3.anarazel.de
1 parentf1431f3 commitb452900

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

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

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@
5454
#defineTransactionIdToPage(xid) ((xid) / (TransactionId) SUBTRANS_XACTS_PER_PAGE)
5555
#defineTransactionIdToEntry(xid) ((xid) % (TransactionId) SUBTRANS_XACTS_PER_PAGE)
5656

57-
/*
58-
* Single-item cache for results of SubTransGetTopmostTransaction(). It's
59-
* worth having such a cache because we frequently find ourselves repeatedly
60-
* checking the same XID, for example when scanning a table just after a
61-
* bulk insert, update, or delete.
62-
*/
63-
staticTransactionIdcachedFetchSubXid=InvalidTransactionId;
64-
staticTransactionIdcachedFetchTopmostXid=InvalidTransactionId;
6557

6658
/*
6759
* Link to shared-memory data structures for SUBTRANS control
@@ -163,13 +155,6 @@ SubTransGetTopmostTransaction(TransactionId xid)
163155
/* Can't ask about stuff that might not be around anymore */
164156
Assert(TransactionIdFollowsOrEquals(xid,TransactionXmin));
165157

166-
/*
167-
* Before going to the subtrans log, check our single item cache to see if
168-
* we know the result from a previous/recent request.
169-
*/
170-
if (TransactionIdEquals(xid,cachedFetchSubXid))
171-
returncachedFetchTopmostXid;
172-
173158
while (TransactionIdIsValid(parentXid))
174159
{
175160
previousXid=parentXid;
@@ -189,9 +174,6 @@ SubTransGetTopmostTransaction(TransactionId xid)
189174

190175
Assert(TransactionIdIsValid(previousXid));
191176

192-
cachedFetchSubXid=xid;
193-
cachedFetchTopmostXid=previousXid;
194-
195177
returnpreviousXid;
196178
}
197179

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp