[Date Prev][Date Next]
Re: LMDB: mdb_cursor_put() and the rest of page in case MDB_RESERVE
On 30. mars 2016 19:25, Леонид Юрьев wrote:
2016-03-30 19:46 GMT+03:00 Howard Chu <firstname.lastname@example.org>:
Леонид Юрьев wrote:
Why mdb_cursor_put() doesn't copy the rest of page in case MDB_RESERVE?
For MDB_RESERVE the caller is going to supply their own data later, so
nothing on the page is valid data.
Yes, it's obvious. But I asked not about of a user data.
In other words - why we should copy or not copy an end of page in
dependence from MDB_RESERVE?
That logic is backwards because I was preserving existing behavior,
i.e. make the page - including unused portions - look the same with
put() in the child txn as put() in the parent. So with MDB_RESERVE
the entire page must be copied in case the user peeks at it before
writing to it. Without MDB_RESERVE, the initial part of the page
body need not be copied since LMDB is about to overwrite it.
I'll comment that, unless that code should just go away. Don't know
if this is the best behavior or it was just easier to code it than
to decide whether to cater to such obscure user behavior. But
people do come up with special things do do about overflow pages.
It is here (current mdb.master, mdb.c line 7479)