Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Vincent Birlouez — — source: Informix-list mailing list archive (1991-1998)
Hello,
Is it possible for more than one process to insert rows into a databse table
at the same time?
I have more than one "C" processes that want to insert rows into the same
table concurrently. Some of them succeed but others fail with an error of
271 (ISAM error 154) which has to do with locking.
I'm using Informix OnLine 7.23.
Any idea ?
Thanks,
Caterina.
↪ replying to Vincent Birlouez
Art S. Kagel — — source: Informix-list mailing list archive (1991-1998)
Vincent Birlouez wrote:
>
> Hello,
>
> Is it possible for more than one process to insert rows into a databse table
> at the same time?
>
> I have more than one "C" processes that want to insert rows into the same
> table concurrently. Some of them succeed but others fail with an error of
> 271 (ISAM error 154) which has to do with locking.
Well, -271 is Could not insert row and -154 is Lock timeout. It looks
like your table is set up with page level locking and the multiple
processes are holding the lock for a relatively long time before
committing. You got a timeout error rather than a row lock error
probably because you have SET LOCK MODE TO WAIT n seconds in your code
but the wait period is not long enough. If the processes are
interactive and you are FETCHING the row FOR UPDATE while a user
modifies it this is a bad strategy for just this concurrency reason.
Rather fetch it without lock and then re-fetch with lock and verify the
record before updating it.
Anyway, change the lock level for the table to row level:
ALTER TABLE mytable LOCK MODE (row);
This will improve concurrency and reduce lockout problems. Also in
the apps increase the LOCK WAIT period.
Art S. Kagel
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.