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

Re: LMDB physical file size



--On Monday, November 09, 2015 11:00 PM +0100 Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no> wrote:

On 09/11/15 18:47, Christian Sell wrote:
To create the environment, we are using a mapsize of 1 GiB and the flags
MDB_NOSUBDIR | MDB_NOLOCK. Under Linux, this results in one file with a
size that seems to correspond to the size of the data actually stored.
However, under Windows, the file size is the same as the mapsize, namely
1 GiB. (...) The same issue surfaced under Linux (...) with the
MDB_WRITEMAP option

That's the logical size, which can be bigger than the physical
size. In lmdb's case, the end of the file doesn't use any disk
space. On filesystems which support this, anyway. Most do.
So, nevermind mdb_copy - there is no problem to fix.

On Unix, 'du <file>' shows disk usage. Don't know about Windows.

When you want to copy the file anyway, you should use mdb_copy
rather than plain filecopy.  And MDB_COMPACT does shrink the file
somewhat since it drops pages which LMDB has freed and not yet
reused, but that's another matter.  The DB would grow later
anyway, LDMB does need pages it can write to.

Here's a real world example:

[zimbra@ldap01 db]$ ls -l data.mdb
-rw------- 1 zimbra zimbra 17967149056 Nov  9 16:19 data.mdb
[zimbra@ldap01 db]$ du -c -h data.mdb
76M     data.mdb
76M     total

I.e., real usage is 76MB vs the approximately 17GB configured max size.

--Quanah



--

Quanah Gibson-Mount
Platform Architect
Zimbra, Inc.
--------------------
Zimbra ::  the leader in open source messaging and collaboration