[Xapian-tickets] [Xapian] #769: Provide more options for lock retrying

Xapian nobody at xapian.org
Tue Sep 11 05:35:20 BST 2018


#769: Provide more options for lock retrying
-------------------------+-------------------------
 Reporter:  bremner      |             Owner:  olly
     Type:  enhancement  |            Status:  new
 Priority:  normal       |         Milestone:
Component:  Other        |           Version:
 Severity:  normal       |        Resolution:
 Keywords:               |        Blocked By:
 Blocking:               |  Operating System:  All
-------------------------+-------------------------

Comment (by olly):

 On Unix-like platforms, `DB_RETRY_LOCK` maps to a blocking request for a
 lock in `fcntl()` and so there isn't a "number of retries" there.  A major
 motivation for adding this flag was to allow taking advantage of OS-level
 "block waiting for lock" where possible.

 `fcntl()` doesn't directly support a timeout on a blocking lock.

 One option is to repeatedly poll for the lock until the timeout expires,
 but that seems crude.

 Another is to try a blocking lock but interrupt it (with `alarm()` or a
 timer like that in matcher/matchtimeout.h but using `SIGEV_SIGNAL`).
 Problem is that this signal is visible to the application.

 It might be possible to call `fcntl()` from a thread and terminate that
 thread via a second thread launched via `SIGEV_THREAD` if the timer
 expires or something like that.

 When there's a timeout we could first try a non-blocking request for the
 lock so at least that common case is handled without extra overhead.

--
Ticket URL: <https://trac.xapian.org/ticket/769#comment:1>
Xapian <https://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list