Re: SELECT ... FOR UPDATE [WAIT integer | NOWAIT] for 8.5

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Hans-Juergen Schoenig <postgres(at)cybertec(dot)at>, Josh Berkus <josh(at)agliodbs(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Sándor Miglécz <sandor(at)cybertec(dot)at>
Subject: Re: SELECT ... FOR UPDATE [WAIT integer | NOWAIT] for 8.5
Date: 2009-09-21 09:40:04
Message-ID: 4AB749F4.2050100@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeff Janes írta:
> On Thu, Sep 3, 2009 at 6:47 AM, Boszormenyi Zoltan <zb(at)cybertec(dot)at
> <mailto:zb(at)cybertec(dot)at>> wrote:
>
> Boszormenyi Zoltan írta:
> >
> > Okay, we implemented only the lock_timeout GUC.
> > Patch attached, hopefully in an acceptable form.
> > Documentation included in the patch, lock_timeout
> > works the same way as statement_timeout, takes
> > value in milliseconds and 0 disables the timeout.
> >
> > Best regards,
> > Zoltán Böszörményi
> >
>
> New patch attached. It's only regenerated for current CVS
> so it should apply cleanly.
>
>
> I'm getting segfaults, built in 32 bit linux with gcc
>
> bin/pg_ctl -D data start -l logfile -o "--lock_timeout=5"
>
> Session 1:
> jjanes=# begin;
> BEGIN
> jjanes=# select * from pgbench_branches where bid=3 for update;
> bid | bbalance | filler
> -----+----------+--------
> 3 | -3108950 |
> (1 row)
>
> Session 2:
> jjanes=# select * from pgbench_branches where bid=3 for update;
> ERROR: could not obtain lock on row in relation "pgbench_branches"
> jjanes=# select * from pgbench_branches where bid=3 for update;
> ERROR: could not obtain lock on row in relation "pgbench_branches"
> jjanes=# select * from pgbench_branches where bid=3 for update;
> ERROR: could not obtain lock on row in relation "pgbench_branches"
> jjanes=# set lock_timeout = 0 ;
> SET
> jjanes=# select * from pgbench_branches where bid=3 for update;
>
> <Session 2 is now blocked>
>
> Session1:
> jjanes=# commit;
> <long pause>
> server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.
>
> I just realized I should have built with asserts turned on. I'll do
> that tomorrow, but don't want to delay this info until then, so I am
> sending it now.
>
> Cheers,
>
> Jeff

Thanks for the test. The same test worked perfectly at the time
I posted it and it also works perfectly on 8.4.1 *now*. So
something has changed between then and the current CVS,
because I was able to reproduce the segfault with the current
CVS HEAD. We'll have to update the patch obviously...

Best regards,
Zoltán Böszörményi

--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Boszormenyi Zoltan 2009-09-21 10:07:06 Re: SELECT ... FOR UPDATE [WAIT integer | NOWAIT] for 8.5
Previous Message Heikki Linnakangas 2009-09-21 07:51:53 Re: Streaming Replication patch for CommitFest 2009-09