[Xapian-tickets] [Xapian] #275: Opening a writable database should retry if database is locked

Xapian nobody at xapian.org
Sun Mar 21 10:55:57 GMT 2010


#275: Opening a writable database should retry if database is locked
-------------------------+--------------------------------------------------
 Reporter:  richard      |       Owner:  olly     
     Type:  enhancement  |      Status:  new      
 Priority:  low          |   Milestone:  1.2.x    
Component:  Library API  |     Version:  SVN trunk
 Severity:  minor        |    Keywords:           
Blockedby:               |    Platform:  All      
 Blocking:               |  
-------------------------+--------------------------------------------------
Changes (by olly):

  * component:  Other => Library API
  * milestone:  => 1.2.x


Old description:

> Writable databases currently fail to open with a DatabaseLocked exception
> if the database is already opened by a different process.  In situations
> where multiple processes (or threads) want to open a database for
> writing, this forces users to implement a retry mechanism to handle these
> errors.  It might be helpful if databases had an option which would cause
> them to retry (until a timeout was reached) if the database was locked,
> to avoid users having to implement retry mechanisms in every application
> wanting this feature.
>
> Alternatively, it might be better to continue with our current approach
> of suggesting that users structure applications such that database writes
> are marshalled into a single location and performed on a single
> WritableDatabase object.

New description:

 Writable databases currently fail to open with a !DatabaseLockedError
 exception if the database is already opened by a different process.  In
 situations where multiple processes (or threads) want to open a database
 for writing, this forces users to implement a retry mechanism to handle
 these errors.  It might be helpful if databases had an option which would
 cause them to retry (until a timeout was reached) if the database was
 locked, to avoid users having to implement retry mechanisms in every
 application wanting this feature.

 Alternatively, it might be better to continue with our current approach of
 suggesting that users structure applications such that database writes are
 marshalled into a single location and performed on a single
 !WritableDatabase object.

--

Comment:

 Fixed wikimarkup in description.

 The "single writer" design works well, but it isn't going to work for
 everyone, and it's impossible to achieve the efficiency of a blocking
 attempt to lock the lockfile by polling the API, so I think this is a
 change worth considering.

 For a remote database, we would ideally retry with a protocol level
 blocking-open message.  Probably with a retry if the link drops (e.g.
 timed out).

 That should be doable as a minor protocol version change, and the API part
 should be backward compatible, as should the ABI, so marking for 1.2.x.

-- 
Ticket URL: <http://trac.xapian.org/ticket/275#comment:2>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list