Re: Reading locked rows
Posted in 1993
In <1993Sep03.061326.21151@wvus.org> sford@wvus.org (Scott Ford) writes:
>We're running online & istar 5.0 on a Sequent 2000 with ptx 2.0.4. We
>talk to it using inet-pc 4.10 and powerbuilder running on windows.
>Today's question #1 is about reading locked records. Here's the
>scenario:
> buffered logging data base "foo" with table "bozo".
> table bozo has two columns "col1" (primary key) & "col2".
> table foo also has row lock mode.
>user 1 -> begin work; update bozo
> set col2 = 10
> where col1 = 'a';
> let's say that the previous value for col2 was 5. note that
> we HAVE NOT yet done a commit work.
>user 2 -> set isolation to dirty read;
> select * from bozo;> user 2 sees the row where col1 = a and shows col2 = 10
>user 3 -> set isolation to committed read;
> select * from bozo;> user 3 errors (probably -244 or -246) due to locked record.
I have a similar question/comment. I've written a standard simple little
form -- It selects all the values from the table, puts them into a record
and displays them on the screen. If a user selects the 'update' option, I
begin a transaction set until the update is complete. Using the example
Scott provided:
user 1 -> begin work; update bozo
let's say that the previous value for col2 was 5. A commit work
hasn't been done yet.
user 2 -> selects update option in program
receives an error message that someone else is modifying the
document.
I thought this was the best way for the program to work -- Since we're
working with a record, I lock the row when the user selects the 'update'
option. However, I have a customer who is worried about concurrency. They
are proposing that I move the commit work statement to just prior to the
actual update. This means:
user 1 -> update bozo
the original value for col2 was 5. user 1 is changing it to 10,
BUT we haven't started the transaction set yet.
user 2 -> update bozo
when user 2 selected the same row for update from bozo, user 2
sees the value for col 2 is 5 and changes it to 7 -- We still
haven't started the transaction set.
user 1 -> begin work and update col2=10
user 2 -> begin work and update col2=7
I'm curious which method others use...
--
Clay Irving N2VKG | See the happy moron
New York, New York | He doesn't give a damn.
clay@panix.com (personal) | I wish I were a moron
clay@garpac.com (work) | Oh God! Perhaps I am!