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

Commit0677128

Browse files
committed
Fix releasing ATX locks
1 parent89e1be6 commit0677128

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3545,7 +3545,6 @@ void SuspendTransaction(void)
35453545
MOVELEFT(sus->CurTransactionContext,CurTransactionContext,NULL);
35463546
MOVELEFT(sus->TransactionAbortContext,TransactionAbortContext,NULL);
35473547

3548-
MemoryContextSwitchTo(CurTransactionContext);
35493548
MOVELEFT(sus->CurrentResourceOwner,CurrentResourceOwner,NULL);
35503549
MOVELEFT(sus->CurTransactionResourceOwner,CurTransactionResourceOwner,NULL);
35513550
MOVELEFT(sus->TopTransactionResourceOwner,TopTransactionResourceOwner,NULL);
@@ -3606,9 +3605,7 @@ bool ResumeTransaction(void)
36063605
CurTransactionContext=sus->CurTransactionContext;
36073606
TransactionAbortContext=sus->TransactionAbortContext;
36083607

3609-
//MemoryContextSwitchTo(CurTransactionContext);
36103608
CurrentResourceOwner=sus->CurrentResourceOwner;
3611-
Assert(*(unsigned long long*)CurrentResourceOwner!=0x7f7f7f7f7f7f7f7f);
36123609
CurTransactionResourceOwner=sus->CurTransactionResourceOwner;
36133610
TopTransactionResourceOwner=sus->TopTransactionResourceOwner;
36143611

‎src/backend/utils/resowner/resowner.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include"postgres.h"
2222

2323
#include"access/hash.h"
24+
#include"access/xact.h"
2425
#include"storage/predicate.h"
2526
#include"storage/proc.h"
2627
#include"utils/memutils.h"
@@ -555,7 +556,7 @@ ResourceOwnerReleaseInternal(ResourceOwner owner,
555556
}
556557
elseif (phase==RESOURCE_RELEASE_LOCKS)
557558
{
558-
if (isTopLevel)
559+
if (isTopLevel&&getNestLevelATX()==0)
559560
{
560561
/*
561562
* For a top-level xact we are going to release all locks (or at
@@ -578,7 +579,7 @@ ResourceOwnerReleaseInternal(ResourceOwner owner,
578579
LOCALLOCK**locks;
579580
intnlocks;
580581

581-
Assert(owner->parent!=NULL);
582+
//Assert(owner->parent != NULL);
582583

583584
/*
584585
* Pass the list of locks owned by this resource owner to the lock
@@ -595,7 +596,7 @@ ResourceOwnerReleaseInternal(ResourceOwner owner,
595596
nlocks=owner->nlocks;
596597
}
597598

598-
if (isCommit)
599+
if (isCommit&& !isTopLevel)
599600
LockReassignCurrentOwner(locks,nlocks);
600601
else
601602
LockReleaseCurrentOwner(locks,nlocks);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp