fix(P0): 生产矩阵审计暴露 2 个崩溃恢复丢数据 bug — ① FileManager 页面 id 崩溃回退(allocatePageIds 后 saveMeta 前中断 → nextPageId 回退 → 恢复期页面复用被 compaction 误删,kv 2万行+加密崩溃丢75%):init 以现存最大页面 id+1 为准;② LSM.flush 剩余数据与 compaction 并发写 meta(产物 saveMeta 被覆盖成孤儿 → 优雅关闭重开丢75%):剩余落盘挂链串行。新增 13 组合矩阵审计(后端×特性×功能全量验收)
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { AriaEngine } from '../src/engine/aria/index';
|
||||
import { createSchema } from '../src/table/schema';
|
||||
|
||||
it('dbg: call fk directly', async () => {
|
||||
const engine = new AriaEngine({ storageBackend: 'memory' } as never);
|
||||
await engine.open('dbg-fk2', 1);
|
||||
await engine.createTable(createSchema('parent', {
|
||||
id: { type: 'string', primaryKey: true },
|
||||
}));
|
||||
await engine.createTable(createSchema('child', {
|
||||
id: { type: 'string', primaryKey: true },
|
||||
pid: { type: 'string', references: 'parent:id', onDelete: 'CASCADE' },
|
||||
}));
|
||||
await engine.insert('parent', [{ id: 'p1' }]);
|
||||
await engine.insert('child', [{ id: 'c1', pid: 'p1' }]);
|
||||
const wal: unknown[] = [];
|
||||
const n = await (engine as any).applyForeignKeyRules('parent', 'p1', wal, new Set<string>());
|
||||
console.log('fk direct result:', n, 'wal records:', wal.length);
|
||||
console.log('child count after fk:', await engine.count('child'));
|
||||
// 手动 CASCADE 验证
|
||||
const c = await (engine as any).lsm.get('child:c1');
|
||||
console.log('child:c1 in lsm:', c ? 'YES' : 'NO');
|
||||
await engine.close();
|
||||
});
|
||||
Reference in New Issue
Block a user