[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Question regarding MDB_NOLOCK



David Barbour wrote:


On Fri, Jan 30, 2015 at 3:57 PM, David Barbour <dmbarbour@gmail.com
<mailto:dmbarbour@gmail.com>> wrote:


    For my current use case, I believe that I can still achieve a
    sufficient level of parallelism even if limited to double-buffering
    (whereas two snapshots would give me triple-buffering). I'm not
    going to press for any changes at this time.


After having examined this further, I've changed my mind.

With triple buffering, I can guarantee that the writer *almost* never
waits on a short-running reader, and that the readers never wait on the
writer. With double buffering, the probability of the writer waiting on
even short-running readers, assuming they are frequent, is nearly 100%.
Triple buffering is thus a huge advantage for users of MDB_NOLOCK.

The update to support this is almost trivial: tweak `mdb_find_oldest`
such that both meta-page snapshots are considered to have active
readers. I'm willing to develop and submit a patch, but only if this
change also sounds good to the main LMDB developers.

That is supposed to be its current behavior already. I.e., no page that either of the two meta pages points to is ever allowed to be reclaimed.

--
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/