feat(wal,memtable): implement segment writer, block writer, and MemTable

- wal/block_writer.go: 32KB block buffer with padding and flush
- wal/segment_writer.go: WAL segment file with durable-ready protocol
- memtable/memtable.go: Arena+SkipList wrapper with publish/abort semantics
- Comprehensive tests for all modules, all pass with -race
This commit is contained in:
dailz
2026-06-12 13:43:24 +08:00
parent 3c0e3b14ff
commit 349063968b
8 changed files with 1407 additions and 4 deletions
+28 -2
View File
@@ -8,7 +8,7 @@
"plan_name": "phase1-wal",
"status": "active",
"started_at": "2026-06-12T05:09:32.588Z",
"updated_at": "2026-06-12T05:33:52.854Z",
"updated_at": "2026-06-12T05:43:11.052Z",
"session_ids": [
"opencode:ses_145c3bae9ffeTB2zbsTym0Cev8"
],
@@ -68,6 +68,19 @@
"status": "completed",
"ended_at": "2026-06-12T05:33:52.854Z",
"elapsed_ms": 64624
},
"todo:10": {
"task_key": "todo:10",
"task_label": "10",
"task_title": "Segment writer (file write + block writer)",
"session_id": "opencode:ses_145acc017ffe2fra67VT2L28LQ",
"agent": "Sisyphus-Junior",
"category": "unspecified-high",
"updated_at": "2026-06-12T05:43:11.052Z",
"started_at": "2026-06-12T05:42:38.284Z",
"status": "completed",
"ended_at": "2026-06-12T05:43:11.052Z",
"elapsed_ms": 32768
}
}
}
@@ -75,7 +88,7 @@
"active_plan": "/home/dailz/workspace/src/go-kv/.omo/plans/phase1-wal.md",
"started_at": "2026-06-12T05:09:32.588Z",
"status": "active",
"updated_at": "2026-06-12T05:33:52.854Z",
"updated_at": "2026-06-12T05:43:11.052Z",
"session_ids": [
"opencode:ses_145c3bae9ffeTB2zbsTym0Cev8"
],
@@ -135,6 +148,19 @@
"status": "completed",
"ended_at": "2026-06-12T05:33:52.854Z",
"elapsed_ms": 64624
},
"todo:10": {
"task_key": "todo:10",
"task_label": "10",
"task_title": "Segment writer (file write + block writer)",
"session_id": "opencode:ses_145acc017ffe2fra67VT2L28LQ",
"agent": "Sisyphus-Junior",
"category": "unspecified-high",
"updated_at": "2026-06-12T05:43:11.052Z",
"started_at": "2026-06-12T05:42:38.284Z",
"status": "completed",
"ended_at": "2026-06-12T05:43:11.052Z",
"elapsed_ms": 32768
}
},
"agent": "atlas"
+2 -2
View File
@@ -823,7 +823,7 @@ Max Concurrent: 6 (Wave 1b)
**Commit**: YES (group with Task 6)
- [ ] 10. Segment writer (file write + block writer)
- [x] 10. Segment writer (file write + block writer)
**What to do**:
- 创建 `wal/block_writer.go``BlockWriter` — 管理 32KB block 的 Physical Record 写入
@@ -1105,7 +1105,7 @@ Max Concurrent: 6 (Wave 1b)
**Commit**: YES (with Task 12)
- Message: `feat(wal): implement WAL writer with group commit`
- [ ] 14. MemTable (wrap skiplist + arena + publish/abort)
- [x] 14. MemTable (wrap skiplist + arena + publish/abort)
**What to do**:
- 创建 `memtable/memtable.go``MemTable` 结构体