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

Commite5eb4fa

Browse files
committed
Remove obsolete SLRU wrapping and warnings from predicate.c.
When SSI was developed, slru.c was limited to segment files with names inthe range 0000-FFFF. This didn't allow enough space for predicate.c tostore every possible XID when spilling old transactions to disk, so itwould wrap around sooner and print warnings. Since commits638cf09 and73c986a increased the number of segment files slru.c could manage, thatbehavior is unnecessary. Therefore remove that code.Also remove the macro OldSerXidSegment, which has been unused since4cd3fb6.Thomas Munro, reviewed by Anastasia LubennikovaDiscussion:https://postgr.es/m/CAEepm=3XfsTSxgEbEOmxu0QDiXy0o18NUg2nC89JZcCGE+XFPA@mail.gmail.com
1 parent1bb9e73 commite5eb4fa

File tree

1 file changed

+3
-49
lines changed

1 file changed

+3
-49
lines changed

‎src/backend/storage/lmgr/predicate.c

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -318,27 +318,23 @@ static SlruCtlData OldSerXidSlruCtlData;
318318
#defineOLDSERXID_ENTRIESPERPAGE(OLDSERXID_PAGESIZE / OLDSERXID_ENTRYSIZE)
319319

320320
/*
321-
* Set maximum pages based on the lesser of the number needed to track all
322-
* transactions and the maximum that SLRU supports.
321+
* Set maximum pages based on the number needed to track all transactions.
323322
*/
324-
#defineOLDSERXID_MAX_PAGEMin(SLRU_PAGES_PER_SEGMENT * 0x10000 - 1, \
325-
(MaxTransactionId) / OLDSERXID_ENTRIESPERPAGE)
323+
#defineOLDSERXID_MAX_PAGE(MaxTransactionId / OLDSERXID_ENTRIESPERPAGE)
326324

327325
#defineOldSerXidNextPage(page) (((page) >= OLDSERXID_MAX_PAGE) ? 0 : (page) + 1)
328326

329327
#defineOldSerXidValue(slotno,xid) (*((SerCommitSeqNo *) \
330328
(OldSerXidSlruCtl->shared->page_buffer[slotno] + \
331329
((((uint32) (xid)) % OLDSERXID_ENTRIESPERPAGE) * OLDSERXID_ENTRYSIZE))))
332330

333-
#defineOldSerXidPage(xid)((((uint32) (xid)) / OLDSERXID_ENTRIESPERPAGE) % (OLDSERXID_MAX_PAGE + 1))
334-
#defineOldSerXidSegment(page)((page) / SLRU_PAGES_PER_SEGMENT)
331+
#defineOldSerXidPage(xid)(((uint32) (xid)) / OLDSERXID_ENTRIESPERPAGE)
335332

336333
typedefstructOldSerXidControlData
337334
{
338335
intheadPage;/* newest initialized page */
339336
TransactionIdheadXid;/* newest valid Xid in the SLRU */
340337
TransactionIdtailXid;/* oldest xmin we might be interested in */
341-
boolwarningIssued;/* have we issued SLRU wrap-around warning? */
342338
}OldSerXidControlData;
343339

344340
typedefstructOldSerXidControlData*OldSerXidControl;
@@ -826,7 +822,6 @@ OldSerXidInit(void)
826822
oldSerXidControl->headPage=-1;
827823
oldSerXidControl->headXid=InvalidTransactionId;
828824
oldSerXidControl->tailXid=InvalidTransactionId;
829-
oldSerXidControl->warningIssued= false;
830825
}
831826
}
832827

@@ -882,47 +877,6 @@ OldSerXidAdd(TransactionId xid, SerCommitSeqNo minConflictCommitSeqNo)
882877
if (isNewPage)
883878
oldSerXidControl->headPage=targetPage;
884879

885-
/*
886-
* Give a warning if we're about to run out of SLRU pages.
887-
*
888-
* slru.c has a maximum of 64k segments, with 32 (SLRU_PAGES_PER_SEGMENT)
889-
* pages each. We need to store a 64-bit integer for each Xid, and with
890-
* default 8k block size, 65536*32 pages is only enough to cover 2^30
891-
* XIDs. If we're about to hit that limit and wrap around, warn the user.
892-
*
893-
* To avoid spamming the user, we only give one warning when we've used 1
894-
* billion XIDs, and stay silent until the situation is fixed and the
895-
* number of XIDs used falls below 800 million again.
896-
*
897-
* XXX: We have no safeguard to actually *prevent* the wrap-around,
898-
* though. All you get is a warning.
899-
*/
900-
if (oldSerXidControl->warningIssued)
901-
{
902-
TransactionIdlowWatermark;
903-
904-
lowWatermark=tailXid+800000000;
905-
if (lowWatermark<FirstNormalTransactionId)
906-
lowWatermark=FirstNormalTransactionId;
907-
if (TransactionIdPrecedes(xid,lowWatermark))
908-
oldSerXidControl->warningIssued= false;
909-
}
910-
else
911-
{
912-
TransactionIdhighWatermark;
913-
914-
highWatermark=tailXid+1000000000;
915-
if (highWatermark<FirstNormalTransactionId)
916-
highWatermark=FirstNormalTransactionId;
917-
if (TransactionIdFollows(xid,highWatermark))
918-
{
919-
oldSerXidControl->warningIssued= true;
920-
ereport(WARNING,
921-
(errmsg("memory for serializable conflict tracking is nearly exhausted"),
922-
errhint("There might be an idle transaction or a forgotten prepared transaction causing this.")));
923-
}
924-
}
925-
926880
if (isNewPage)
927881
{
928882
/* Initialize intervening pages. */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp