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

Commit6830cae

Browse files
Correct StartupSUBTRANS for page wraparound
StartupSUBTRANS() incorrectly handled cases near the max pageid in the subtransdata structure, which in some cases could lead to errors in startup for HotStandby.This patch wraps the pageids correctly, avoiding any such errors.Identified by exhaustive crash testing by Jeff Janes.Jeff Janes
1 parentbec4d0f commit6830cae

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
* 0xFFFFFFFF/SUBTRANS_XACTS_PER_PAGE, and segment numbering at
4545
* 0xFFFFFFFF/SUBTRANS_XACTS_PER_PAGE/SLRU_PAGES_PER_SEGMENT. We need take no
4646
* explicit notice of that fact in this module, except when comparing segment
47-
* and page numbers in TruncateSUBTRANS (see SubTransPagePrecedes).
47+
* and page numbers in TruncateSUBTRANS (see SubTransPagePrecedes) and zeroing
48+
* them in StartupSUBTRANS.
4849
*/
4950

5051
/* We need four bytes per xact */
@@ -253,6 +254,9 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
253254
{
254255
(void)ZeroSUBTRANSPage(startPage);
255256
startPage++;
257+
/* must account for wraparound */
258+
if (startPage>TransactionIdToPage(MaxTransactionId))
259+
startPage=0;
256260
}
257261
(void)ZeroSUBTRANSPage(startPage);
258262

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp