- Notifications
You must be signed in to change notification settings - Fork124
Open
Description
I use LMDB on Linux and the database file is always small, but I create the Env with 10 GB map size. I test now to Windows 11, but it appears that sparse files are not working. The database files are always the size I set in map size. I looked into sparse files and LMDB, and it seems to be that it should work since 2016. I also tested the file withdu -h
andstats
like in the Wiki, but it all states that the file is big. The compacted copy is a small file.
@Testvoid test_buffer_direct(@TempDir Path tmp, @TempDir Path copy) {final long mapSize = (long) (100 * pow(10, 6));final var env = create(DirectBufferProxy.PROXY_DB).setMapSize(mapSize).setMaxDbs(2).open(tmp.toFile(),MDB_WRITEMAP);final var db = env.openDbi("chunks", MDB_CREATE, MDB_INTEGERKEY);System.out.println(tmp);db.close();System.out.println(env.info());System.out.println(env.stat());env.copy(copy.toFile(), MDB_CP_COMPACT);env.close();System.out.println(copy);}
$ du -h data.mdb96M data.mdb$ stat data.mdb File: data.mdb Size: 100000000 Blocks: 97660 IO Block: 65536 regular file