Re: [PATCH] LockAcquireExtended improvement

2024-05-18 Thread Michael Paquier
On Fri, May 17, 2024 at 11:38:35PM -0700, Will Mortensen wrote: > On Tue, Mar 26, 2024 at 7:14 PM Will Mortensen wrote: >> This comment on ProcSleep() seems to have the values of dontWait >> backward (double negatives are tricky): >> >> * Result: PROC_WAIT_STATUS_OK if we acquired the lock,

Re: [PATCH] LockAcquireExtended improvement

2024-05-18 Thread Jingxian Li
On 2024/5/18 14:38, Will Mortensen wrote: > On Tue, Mar 26, 2024 at 7:14 PM Will Mortensen wrote: >> This comment on ProcSleep() seems to have the values of dontWait >> backward (double negatives are tricky): >> >> * Result: PROC_WAIT_STATUS_OK if we acquired the lock, >>

Re: [PATCH] LockAcquireExtended improvement

2024-05-18 Thread Will Mortensen
On Tue, Mar 26, 2024 at 7:14 PM Will Mortensen wrote: > This comment on ProcSleep() seems to have the values of dontWait > backward (double negatives are tricky): > > * Result: PROC_WAIT_STATUS_OK if we acquired the lock, > PROC_WAIT_STATUS_ERROR > * if not (if dontWait = true, this is a

Re: [PATCH] LockAcquireExtended improvement

2024-03-26 Thread Will Mortensen
On Thu, Mar 14, 2024 at 1:15 PM Robert Haas wrote: > Seeing no further discussion, I have committed my version of this > patch, with your test case. This comment on ProcSleep() seems to have the values of dontWait backward (double negatives are tricky): * Result: PROC_WAIT_STATUS_OK if we

Re: [PATCH] LockAcquireExtended improvement

2024-03-14 Thread Robert Haas
On Tue, Mar 12, 2024 at 9:33 AM Robert Haas wrote: > On Mon, Mar 11, 2024 at 11:11 PM Jingxian Li wrote: > > Your version changes less code than mine by pushing the nowait flag down > > into ProcSleep(). This looks fine in general, except for a little advice, > > which I don't think there is

Re: [PATCH] LockAcquireExtended improvement

2024-03-12 Thread Robert Haas
On Mon, Mar 11, 2024 at 11:11 PM Jingxian Li wrote: > Your version changes less code than mine by pushing the nowait flag down > into ProcSleep(). This looks fine in general, except for a little advice, > which I don't think there is necessary to add 'waiting' suffix to the > process name in

Re: [PATCH] LockAcquireExtended improvement

2024-03-11 Thread Jingxian Li
Hello Robert, On 2024/3/8 1:02, Robert Haas wrote: > > But instead of just complaining, I decided to try writing a version of > the patch that seemed acceptable to me. Here it is. I took a different > approach than you. Instead of splitting up ProcSleep(), I just passed > down the dontWait flag to

Re: [PATCH] LockAcquireExtended improvement

2024-03-07 Thread Robert Haas
On Thu, Feb 8, 2024 at 5:28 AM Jingxian Li wrote: > Based on your comments above, I improve the commit message and comment for > InsertSelfIntoWaitQueue in new patch. Well, I had a look at this patch today, and even after reading the new commit message, I couldn't really convince myself that it

Re: [PATCH] LockAcquireExtended improvement

2024-02-08 Thread Jingxian Li
Hello Robert, On 2024/2/2 5:05, Robert Haas wrote: > On Thu, Feb 1, 2024 at 2:16 AM Jingxian Li wrote: >> According to what you said, I resubmitted a patch which splits the ProcSleep >> logic into two parts, the former is responsible for inserting self to >> WaitQueue, >> the latter is

Re: [PATCH] LockAcquireExtended improvement

2024-02-08 Thread Jingxian Li
Hello Robert, On 2024/2/2 5:05, Robert Haas wrote: > On Thu, Feb 1, 2024 at 2:16 AM Jingxian Li wrote: >> According to what you said, I resubmitted a patch which splits the ProcSleep >> logic into two parts, the former is responsible for inserting self to >> WaitQueue, >> the latter is

Re: [PATCH] LockAcquireExtended improvement

2024-02-01 Thread Robert Haas
On Thu, Feb 1, 2024 at 2:16 AM Jingxian Li wrote: > According to what you said, I resubmitted a patch which splits the ProcSleep > logic into two parts, the former is responsible for inserting self to > WaitQueue, > the latter is responsible for deadlock detection and processing, and the > former

Re: [PATCH] LockAcquireExtended improvement

2024-01-31 Thread Jingxian Li
Hello Robert, Thank you for your advice. It is very helpful to me. On 2024/1/16 3:07, Robert Haas wrote: > Hello Jingxian Li! > > I agree with you that this behavior seems surprising. I don't think > it's quite a bug, more of a limitation. However, I think it would be > nice to fix it if we can

Re: [PATCH] LockAcquireExtended improvement

2024-01-15 Thread Robert Haas
Hello Jingxian Li! I agree with you that this behavior seems surprising. I don't think it's quite a bug, more of a limitation. However, I think it would be nice to fix it if we can find a good way to do that. On Wed, Nov 29, 2023 at 10:43 PM Jingxian Li wrote: > Transaction A already holds an

Re: [PATCH] LockAcquireExtended improvement

2024-01-11 Thread vignesh C
On Tue, 28 Nov 2023 at 18:23, Jingxian Li wrote: > > Hi hackers, > > I found a problem when doing the test shown below: > > Time > > Session A > > Session B > > T1 > > postgres=# create table test(a int); > > CREATE TABLE > > postgres=# insert into test values (1); > > INSERT 0 1 > > > > T2 > >

Re: [PATCH] LockAcquireExtended improvement

2023-11-29 Thread Jingxian Li
Hi Andres, Thanks for your quick reply! On 2023/11/29 0:51, Andres Freund wrote: > Hi, > > On 2023-11-28 20:52:31 +0800, Jingxian Li wrote: >> postgres=*# lock table test in exclusive mode ; >> >> >> T4 >> >> Case 1: >> >> postgres=*# lock table test in share row exclusive mode nowait; >> >>

Re: [PATCH] LockAcquireExtended improvement

2023-11-28 Thread Andres Freund
Hi, On 2023-11-28 20:52:31 +0800, Jingxian Li wrote: > postgres=*# lock table test in exclusive mode ; > > > T4 > > Case 1: > > postgres=*# lock table test in share row exclusive mode nowait; > > ERROR: could not obtain lock on relation > "test" > >

[PATCH] LockAcquireExtended improvement

2023-11-28 Thread Jingxian Li
Hi hackers, I found a problem when doing the test shown below: Time Session A Session B T1 postgres=# create table test(a int); CREATE TABLE postgres=# insert into test values (1); INSERT 0 1 T2