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

Commit9be6556

Browse files
committed
Properly terminate the array returned by GetLockConflicts().
GetLockConflicts() has for a long time not properly terminated thereturned array. During normal processing the returned array is zeroinitialized which, while not pretty, is sufficient to be recognized asa invalid virtual transaction id. But the HotStandby case is more thanaesthetically broken: The allocated (and reused) array is neitherzeroed upon allocation, nor reinitialized, nor terminated.Not having a terminating element means that the end of the array willnot be recognized and that recovery conflict handling will thus readahead into adjacent memory. Only terminating when hitting memorycontent that looks like a invalid virtual transaction id. Luckilythis seems so far not have caused significant problems, besides makingrecovery conflict more expensive.Discussion: 20150127142713.GD29457@awork2.anarazel.deBackpatch into all supported branches.
1 parent1c2774f commit9be6556

File tree

1 file changed

+4
-0
lines changed
  • src/backend/storage/lmgr

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2808,6 +2808,8 @@ GetLockConflicts(const LOCKTAG *locktag, LOCKMODE lockmode)
28082808
* on this lockable object.
28092809
*/
28102810
LWLockRelease(partitionLock);
2811+
vxids[count].backendId=InvalidBackendId;
2812+
vxids[count].localTransactionId=InvalidLocalTransactionId;
28112813
returnvxids;
28122814
}
28132815

@@ -2861,6 +2863,8 @@ GetLockConflicts(const LOCKTAG *locktag, LOCKMODE lockmode)
28612863
if (count>MaxBackends)/* should never happen */
28622864
elog(PANIC,"too many conflicting locks found");
28632865

2866+
vxids[count].backendId=InvalidBackendId;
2867+
vxids[count].localTransactionId=InvalidLocalTransactionId;
28642868
returnvxids;
28652869
}
28662870

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp