refactor(storage): 删除未接入写路径的 storage WAL#112
Conversation
storage/zstorage/WAL.go 只在恢复时被 Read, Write 仅测试调用—— 实际写路径 Engine.Put→MemTable.Put→skiplist.insert 从不落 WAL, 持久性由 Raft 日志提供。移除该死代码及 IWal 接口、wal_test, 并清理 MemTable 中 wal 字段/recoverFromWAL/Sync/Clear 及 Flush 内 的 WAL 清除调用; Close 保留 stopCh 关闭。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR removes the write-ahead log (WAL) feature entirely from the storage subsystem. The IWal interface contract is deleted, the WAL implementation file is removed, and MemTable is decoupled from WAL state initialization, recovery, syncing, and clearing operations. ChangesWAL Feature Removal
Possibly related PRs
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🐯 BanGD 数据库内核评审整体风险:🟢 低 变更总结:该 PR 对外科手术式删除了
架构问题(共 3 项)
本次评审消耗 token:共 13155 tokens(输入 7310,输出 1365,缓存命中 4480,缓存写入 0)|维度 [concurrency, memory, lock, storage, performance] |
@
背景
排查写路径优化 (#111) 时发现:
storage/zstorage/WAL.go并未接入实际写路径。Engine.Put → MemTable.Put → skiplist.insert全程不写 WAL;WAL.Write仅wal_test.go调用;recoverFromWAL读到的永远是空文件;Raft/raft_wal.go) 提供。该 WAL 属死代码, 留着误导"持久性靠它"。删除。
改动 (外科手术式)
storage/zstorage/WAL.go、storage/zstorage/wal_test.go、storage/istorage/IWal.gomemtable.go: 移除wal字段、NewWAL()、recoverFromWAL、Sync、Clear, 及Flush内 WAL 清除调用;Close保留stopCh关闭LogEntry(SSTable 共用)、config.WALPath保留, 不顺带改动验证
go build ./.../go vet ./storage/...干净go test ./storage/...全绿🤖 Generated with Claude Code
@
Summary by CodeRabbit
Refactor
Tests