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

Possible transaction issue with LMDB



Hi there,

While doing some integration testing of LMDB I noticed that there may
be an issue with out of order transaction handling.

The scenario is:

Open Read TXN A
Open Write TXN X, and change values of the DB
Commit X
Open Read TXN B
Open Write TXN Y, and change values of the DB
Commit Y
Open Read TXN C

Abort/Close TXN B.

At this point, because of the page touch between A -> B and B -> C, B
now believes that the pages of A are the "last time" they are available
as they were all subsequently copied for TXN C. The pages of A are then
added to the freelists when B closes. When TXN A is read from the data
may have been altered due to future writes as LMDB attempts to use
previously allocated pages first. 

This situation is more likely to arise on large batch writes, but could
manifest with smaller series of writes. This would be a silent issue,
as the over-written pages may be valid, and could cause data to
"silently vanish" inside of the read transaction A leading to
unpredictable results.

I hope that this report helps you to diagnose and resolve the issue. 

-- 
Sincerely,

William