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

Commitfbc0d07

Browse files
committed
Partially roll back overenthusiastic SSI optimization.
When a regular lock is held, SSI can use that in lieu of a predicate lockto detect rw conflicts; but if the regular lock is being taken by asubtransaction, we can't assume that it'll commit, so releasing theparent transaction's lock in that case is a no-no.Kevin Grittner
1 parent9c38bce commitfbc0d07

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3638,14 +3638,20 @@ CheckTargetForConflictsIn(PREDICATELOCKTARGETTAG *targettag)
36383638
if (sxact==MySerializableXact)
36393639
{
36403640
/*
3641-
* If we're getting a write lock on the tuple, we don't need a
3642-
* predicate (SIREAD) lock. At this point our transaction already
3643-
* has an ExclusiveRowLock on the relation, so we are OK to drop
3644-
* the predicate lock on the tuple, if found, without fearing that
3645-
* another write against the tuple will occur before the MVCC
3646-
* information makes it to the buffer.
3641+
* If we're getting a write lock on the tuple and we're not in a
3642+
* subtransaction, we don't need a predicate (SIREAD) lock. We
3643+
* can't use this optimization within a subtransaction because
3644+
* the subtransaction could be rolled back, and we would be left
3645+
* without any lock at the top level.
3646+
*
3647+
* At this point our transaction already has an ExclusiveRowLock
3648+
* on the relation, so we are OK to drop the predicate lock on
3649+
* the tuple, if found, without fearing that another write
3650+
* against the tuple will occur before the MVCC information
3651+
* makes it to the buffer.
36473652
*/
3648-
if (GET_PREDICATELOCKTARGETTAG_OFFSET(*targettag))
3653+
if (!IsSubTransaction()
3654+
&&GET_PREDICATELOCKTARGETTAG_OFFSET(*targettag))
36493655
{
36503656
uint32predlockhashcode;
36513657
PREDICATELOCKTARGET*rmtarget=NULL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp