On 01/06/2015 03:18 PM, Howard Chu wrote:
Hallvard Breien Furuseth wrote:
(....)
If the new pages below mt_next_pgno were freed instead of
written, me_size becomes too big.
Huh? mt_next_pgno definitively tells how many pages have ever been used in
the DB file.
No, see ITS#7886:
"Allocate an ovpage from mt_next_pgno, mdb_ovpage_free() it
and commit: The datafile may end before MDB_meta.mm_last_pg
since the ovpage was never written. mdb_env_copyfd() & co
break when they read the file to mm_last_pg."
Later when the file does
grow, me_size may be >= actual filesize so it fdatasync()s.
Similar to b09e46904c1c059bd5086243e3915b6be510e57d
"ITS#7886 fix mdb_copy write size".
We can fix me_size, grow the file anyway (ftruncate), or
give the pages back to mt_next_pgno in mdb_freelist_save().
--
Hallvard