rocksdb

Safe to delete zero-byte .log file in RocksDB to preventing error_if_wal_file_exists error in rocksdb


Is it safe to delete a zero-sized write ahead log (WAL) .log file in RocksDB?

Is there a way to do this through the RocksDB API?

Context

I want to open a RocksDB database in read-only mode and set the error_if_wal_file_exists parameter to true.

When creating this database (a large lookup table), I already trigger the compaction of the database and wait for all pending compactions and all compaction jobs to finish. I only have one zero-byte sized log file in my RocksDB dirctory (001776.log), the rest are .sst files.

When I delete this .log file, the RocksDB can be opened successfully. When it still exists, RocksDB complains about it being there.


Solution

  • After going ahead and doing this for a couple of databases of different sizes, I have seen no issues so far. I guess it is thus safe to delete the empty .log WAL file.