Search code examples
appendattrleveldbrocksdb

What files in the LevelDB folder are append-only?


In my LevelDB-folder at some stage I have the following files:

000004.log  000005.ldb  CURRENT  LOCK  LOG  MANIFEST-000002

I don't think they are all append-only? So it's certainly not possible to run " chattr +a * " on all files in the database folder, because some are deleted, while running leveldb. My question is which files won't be deleted and are append only during a normal LevelDB session and during compaction and are those files which are deleted before deletion append-only?


Solution

  • *.log: append-only while WAL, the filename will change
    .ldb: static once generate, the filename will change
    MANIFEST-
    : static once generate, the suffix will change
    LOG: append-only, rotate per day by default
    CURRENT: rewrite after version change
    LOCK: only change when open or close

    to answer your question:

    Q1: is which files won't be deleted and are append only during a normal LevelDB session?
    A1: No, there isn't such file(maybe LOG, but it will rotate)


    Q2: are those files which are deleted before deletion append-only
    A2: *.log is append only before deletion