release: v0.5.1 — 存储后端生产级硬化(CRC-32/全库加密/WAL分片/页面化存储/多标签页锁/e2e)+ 深度审查修复(假实现接线/死代码清理)
CI / test (18.x) (push) Successful in 10m10s
CI / test (20.x) (push) Successful in 10m10s
CI / test (22.x) (push) Successful in 10m6s
CI / e2e (push) Successful in 9m51s
CI / test (24.x) (push) Successful in 10m28s

This commit is contained in:
thzxx
2026-08-10 12:07:00 +08:00
parent cff98b0903
commit 334067d89e
88 changed files with 15713 additions and 10626 deletions
+5 -7
View File
@@ -287,14 +287,13 @@ describe('[v0.3.1] WAL 批量组提交', () => {
await db.defineTable('users', { id: { type: 'string', primaryKey: true }, name: { type: 'string' } });
const engine = db.getEngine() as any;
// v0.4.2: WAL 记录与 count 改用 writeMany 单事务原子写入(记录仍合并为 1 次落盘)
const origWriteMany = engine.backend.writeMany.bind(engine.backend);
// v0.4.5: WAL 改用分片存储(SegmentedWALStore,无 append 接口的后端回退单 key write);
// 组提交语义保持:批量记录仍合并为 1 次底层落盘
const origWrite = engine.backend.write.bind(engine.backend);
let walWrites = 0;
engine.backend.writeMany = async (entries: Record<string, ArrayBuffer>) => {
const keys = Object.keys(entries);
if (keys.some((k) => k.startsWith('__wal_') && !k.startsWith('__wal_count'))) walWrites++;
return origWriteMany(entries);
engine.backend.write = async (key: string, data: ArrayBuffer) => {
if (key.startsWith('__wal_')) walWrites++;
return origWrite(key, data);
};
await db.table('users').insertMany([
@@ -305,7 +304,6 @@ describe('[v0.3.1] WAL 批量组提交', () => {
]);
expect(walWrites).toBe(1); // 4 行合并为 1 次 WAL 落盘
void origWrite;
const rows = await db.query('SELECT * FROM users') as Record<string, unknown>[];
expect(rows).toHaveLength(4);
await db.close();