Emmanuel Lécharny wrote:
Hi guys,
we have had long discussions with Howard on LMDB about the release of pages that are not anymore in use. This is a critical part of a MVCC based B-tree, as each update will copy many pages, and we want to re-use the copied pages.
The problem is that those copied pages may be still in use by older readers. Let's quickly explain how it all works.
This is a good analysis, but I have to state that the investigation down this path has stalled for a major reason:
The current reader/writer interaction depends on the fact that we only need to know the oldest reader, and that we can be lazy about determining what the oldest reader is. Once you start looking at intervals between ordered ages of readers, that means you require continuously up to date reader status, which means you require highly consistent updating and reading of the readers table. That imposes memory consistency guarantees that we currently don't require, and adding those guarantees has a significant performance cost.