From: Ashutosh B. <ash...@en...> - 2014-01-09 05:27:59
|
A patch is a patch! You can not expect people to pull code out of email and try it out. Also, we need regression results with the patch, which are absent in the mail. On Thu, Jan 9, 2014 at 10:52 AM, Michael Paquier <mic...@gm...>wrote: > >> According to the stack of the session which holds the TwoPhaseStateLock, > >> the error is in the function of > >> LockGXact: > >> > >> static GlobalTransaction > >> LockGXact(const char *gid, Oid user) > >> { > >> ...... > >> LWLockAcquire(TwoPhaseStateLock, LW_EXCLUSIVE); > >> > >> for (i = 0; i < TwoPhaseState->numPrepXacts; i++) > >> { > >> ...... > >> gxact->locking_xid = GetTopTransactionId(); > >> > >> LWLockRelease(TwoPhaseStateLock); > >> > >> return gxact; > >> } > >> > >> LWLockRelease(TwoPhaseStateLock); > >> ...... > >> } > >> > >> > >> GetTopTransactionId() is blocked by acquiring another lock, but it is > >> invoked between the TwoPhaseStatLock's Acquire and Release. > >> > >> To fix it, I just call GetTopTransactionId() before > >> "LWLockAcquire(TwoPhaseStateLock, LW_EXCLUSIVE)" to enable the > >> TopTransactionId can be got directly later. > >> > >> diff --git a/src/backend/access/transam/twophase.c > >> b/src/backend/access/transam/twophase.c > >> index c39d9e6..1312e88 100644 > >> --- a/src/backend/access/transam/twophase.c > >> +++ b/src/backend/access/transam/twophase.c > >> @@ -414,6 +414,8 @@ LockGXact(const char *gid, Oid user) > >> { > >> int i; > >> > >> + GetTopTransactionId(); > >> + > >> LWLockAcquire(TwoPhaseStateLock, LW_EXCLUSIVE); > >> > >> for (i = 0; i < TwoPhaseState->numPrepXacts; i++) > >> > >> > >> Any commiter can help to review it and commit it to the Github master > >> branch? > > Can you please provide and patch, which fixes this problem? > The patch is a one-line fix and is in the email content... There is > even an analysis and backtraces. There is enough content to review it. > Regards, > -- > Michael > -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company |