databasekey-value-storekyotocabinet

In Kyoto Cabinet Database using File Hash Database, how can avoid file size increasing?


I am using the follow to open:

db.open("db.kch#tune_defrag=10000", DB.OWRITER | DB.OCREATE)

I am putting and removing elements. At the end of execution, the database is "empty", the count() function returns 0, because I remove all elements. Why the file size always increase when I repeat the test? Is it possible to run something like "garbage collector" to clean the removed registers? If I execute the same test 100 times, I have a 500 MB size database, even I have only 2 records.

I tried to put the "tune_defrag=10000" but I think it didn't work fine.

Obs.: a only register is less than 1K, I don't understand why the registers take so much space in disk.

Thanks for any help


Solution

  • Try this:

    db.kch#dfunit=8
    

    That means the KC runs defrag for every 8 fragmentation detected, and 8 is actually recommended by Mikio.

    Available options are listed here, however it could use some polish.

    http://fallabs.com/kyotocabinet/command.html