Removed /v4 suffix from module path and all internal imports.
Go module is now github.com/luxfi/zapdb (no major version suffix).
Import as: import "github.com/luxfi/zapdb"
No code changes — only module path and import rewrite.
- Rename module from github.com/dgraph-io/badger/v4 to github.com/luxfi/zapdb/v4
- Update all internal imports to use new module path
- Preserve all ZAP enhancements from badger fork
Our current metrics are outdated, and some of them are not being invoked
at all right now. Added new metrics, and fixed old ones. Note that this PR
removes all the old metrics (because of the prefix change) and introduces
new improved metrics.
This PR fixes the following issues/tests
- Deadlock in writes batch - Use atomic to set value of `writebatch.error`
- Vlog Truncate test - Fix issues with empty memtables
- Test options - Set memtable size.
- Compaction tests - Acquire lock before updating level tables
- Vlog Write - Truncate the file size if the transaction cannot fit in vlog size
- TestPersistLFDiscardStats - Set numLevelZeroTables=1 to force compaction.
This PR also fixes the failing bank test by adding an index cache to the bank test.
This PR significantly improves Badger's disk usage behavior.
Breaking: This PR increases the magic version from 7 to 8. So, no older Badger directories would work with this change.
With this PR, we no longer use value log as write-ahead log. Instead, each MemTable has its own WAL. Value logs now only write values which are greater than ValueThreshold, while MemTable WAL only writes smaller values and value pointers.
On a crash and restart, the MemTable WALs are replayed to apply updates to Skiplist. When MemTables are flushed to L0, the corresponding WALs are deleted.
This PR makes big changes to how value log GC works:
- Discard stats are now stored in a separate file, instead of within the LSM tree.
- GC only picks up value logs based off discard stats.
- GC no longer does sampling, it uses discard stats to inform when a value log needs to be GCed.
- Value log would now no longer grow indefinitely, because of the shift to MemTable WAL.
- Removed the `badger gc` tool.
- Value Log Head pointer tracking is removed.
- Only the last value log file is replayed on every start, and truncated as necessary.
This PR also makes a bunch of other changes:
- Removes ValueLogLoadingMode (always uses mmap now).
- Removes TableLoadingMode (always uses mmap now).
- Removes Truncate option.
- Removes KeepL0InMemory option.