Is a badger Commit lazy? even with SyncWrite = true?

Reading the docs on badger’s Close()

they say,

“Close closes a DB. It’s crucial to call it to ensure all the pending updates make their way to disk.”

However, should not a simple Commit() with SyncWrites=true be sufficient? The docs imply writes to disk are not ensured without Close() too.

@gargan It’s always a good idea to close badger so that memtables (in-memory written data store) are flushed to the disk. If they’re not flushed, badger will recreate the tables using the WAL (vlog file).

The commit will ensure that your data will always be read after the commit completes. Maybe we should reword the docs but close is necessary only to perform successful cleanup. The data will be replayed from the WAL file if badger is not closed (or it has crashed).