Using fair locks may have negative performance impact, so such changes
should be tested in that regard first.
Wednesday, February 27, 2013 11:10:57 AM UTC+4, Noel Grandin wrote:
>
> HI
>
> Since we now require Java1.5, perhaps we should be using
>
> java.util.concurrent.locks.ReentrantLock(true/*fair*/)
>
> (note the use of the fairness parameter.)
>
> instead of using the synchronized keyword?
>
> I suspect it would reduce the incidence of "Timeout trying to lock
> table" when using MVCC mode, because we'd be executing the incoming
> queries in the order in which they arrived, instead of in semi-random
> order.
>
> Personally, I don't use MVCC or MULTI_THREADED, so I'm not inclined to
> pursue this, but other people seem to be using those modes, so maybe
> they'd like to try?
>
> Regards,
> Noel Grandin
>
> Specifically, in the code I talking about here lives in
> org.h2.command.Command
>
> public int executeUpdate() {
> Object sync = database.isMultiThreaded() ? (Object) session :
> (Object) database;
> ....
> synchronized (sync) {
> ....
> }
> }
>
> private long filterConcurrentUpdate(DbException e, long start) {
> ....
> database.wait(sleep);
> ....
> }
>
>
> and in org.h2.table.RegularTable
>
> private void doLock(Session session, int lockMode, boolean exclusive)
> {
> ....
> database.wait(sleep);
> ....
> }
>
> and in org.h2.mvstore.db.MVTable#doLock(Session session, int lockMode,
> boolean exclusive)
> and in org.h2.mvstore.db.MVStore.Writer#run()
>
>
>
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.