[sqlite] Concerns about checkin 1879

2004-08-16 Thread Ned Batchelder
I'm confused about checkin 1879: "Do not invoke the busy callback when
trying to promote a lock from SHARED to RESERVED. This avoids a
deadlock."

 

Consider two threads that are deadlocking.  Thread A has made changes,
and is preparing to commit, so promotes its lock from reserved to
pending.  Thread B begins making changes, and wants to promote its lock
from shared to reserved.  At that point, no more progress can be made.
Thread A can't go from pending to exclusive because B still has a shared
lock.  Thread B can't go from shared to reserved because Thread A has a
pending lock.

 

My experience with the code up to 3.0.3 is that both thread A and B will
begin calling the busy handler.  I've written my application so that my
busy handler can choose which thread to force to rollback, using
application-specific knowledge about the precedence of the threads (UI
threads are given preference, and background threads roll back).  It may
happen that thread A is actually a background thread, so even if it has
the more advanced lock, I will choose to roll it back, letting thread B
continue on.

 

With the change in checkin 1879, it looks like my busy handler doesn't
get a chance to make a choice any more.  Now thread B immediately gets a
BUSY error, without invoking the busy handler.

 

Personally, I was very pleased that the busy handler allowed me so much
control.  I can see the other side of the argument: for users who don't
want to be bothered implementing a fancy busy handler, the fewer
deadlocks the better.  My application will continue to work (because all
threads are prepared for deadlock errors), but I liked being able to
make an intelligent choice.

 

Wouldn't it be better to invoke the busy handler in all cases?  Have I
gotten something wrong?

 

--Ned.

http://nedbatchelder.com



[sqlite] Re: www.sqlite.org broken?

2004-08-16 Thread D. Richard Hipp
Christian Smith wrote:
Richard,
Non of the cvstrac links work, so the bugs, wiki etc. are unavailable.
Just in case you didn't know.
There is a denial-of-service attack underway from 210.120.128.117.
I'm working on the problem now.  Thanks
--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565


Re: [sqlite] Update in SQLite

2004-08-16 Thread cai yuan
Hi all,
Many thanks for your kindly reply. I will start using SQLite today.. ;-)

Cai Yuan
- Original Message - 
From: "Darren Duncan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 16, 2004 7:13 AM
Subject: Re: [sqlite] Update in SQLite


> At 1:28 AM +0800 8/15/04, cai yuan wrote:
> >Hi,
> >I would like to test the SQLite in some linux embedded system.
> >I read the limitation document and it says
> >"To change a table you have to delete it (saving its contents to a 
> >temporary table) and recreate it from scratch." (Stated in 
> >http://www.hwaci.com/sw/sqlite/omitted.html)
> >Does it mean when I use the "UPDATE ..." SQL statement, the table 
> >will actually be deleted and recreated by SQLite automatically?
> >Thanks!
> >
> >Regards,
> >Cai Yuan
> 
> UPDATE ... works fine.
> 
> ALTER ... is what does not work.  The comment you were looking at was 
> talking about ALTER.
> 
> -- Darren Duncan