release: v0.6.0 — 完全移除 IndexedDB,自研 KVStore 事务存储引擎(多key原子写/快照日志恢复/CRC自愈)+ KVStoreEngine + 旧库迁移工具 + 10万级压力验证 + 崩溃注入e2e
This commit is contained in:
@@ -13,7 +13,10 @@ import { SegmentedWALStore } from '../../src/engine/aria/wal/segmented_store';
|
||||
import { MemoryBackend } from '../../src/engine/aria/store/backend';
|
||||
import { AriaEngine } from '../../src/engine/aria/index';
|
||||
import { createSchema } from '../../src/table/schema';
|
||||
import 'fake-indexeddb/auto';
|
||||
|
||||
import { installOPFSMock } from '../helpers/opfs-mock';
|
||||
|
||||
beforeEach(() => { installOPFSMock(new Map()); });
|
||||
|
||||
let idbCounter = 0;
|
||||
function uniqueDB(): string {
|
||||
@@ -153,7 +156,7 @@ describe('AriaEngine — 分片 WAL 集成', () => {
|
||||
it('高频写入(多条 WAL 记录)→ close → reopen 数据完整', async () => {
|
||||
const dbName = uniqueDB();
|
||||
const engine = new AriaEngine({
|
||||
storageBackend: 'indexeddb',
|
||||
storageBackend: 'opfs',
|
||||
checkpointInterval: 100000,
|
||||
walSyncMode: 'full',
|
||||
});
|
||||
@@ -171,7 +174,7 @@ describe('AriaEngine — 分片 WAL 集成', () => {
|
||||
(engine as any).opened = false;
|
||||
|
||||
const engine2 = new AriaEngine({
|
||||
storageBackend: 'indexeddb',
|
||||
storageBackend: 'opfs',
|
||||
checkpointInterval: 100000,
|
||||
walSyncMode: 'full',
|
||||
});
|
||||
@@ -185,7 +188,7 @@ describe('AriaEngine — 分片 WAL 集成', () => {
|
||||
it('分片结构落盘验证(backend 中是分片文件而非旧单记录键)', async () => {
|
||||
const dbName = uniqueDB();
|
||||
const engine = new AriaEngine({
|
||||
storageBackend: 'indexeddb',
|
||||
storageBackend: 'opfs',
|
||||
checkpointInterval: 100000,
|
||||
walSyncMode: 'full',
|
||||
});
|
||||
@@ -208,7 +211,7 @@ describe('AriaEngine — 分片 WAL 集成', () => {
|
||||
it('WAL 分片部分残留(空洞)→ 重开恢复已落盘数据,不丢已 checkpoint 数据', async () => {
|
||||
const dbName = uniqueDB();
|
||||
const engine = new AriaEngine({
|
||||
storageBackend: 'indexeddb',
|
||||
storageBackend: 'opfs',
|
||||
checkpointInterval: 100000,
|
||||
walSyncMode: 'full',
|
||||
});
|
||||
@@ -228,7 +231,7 @@ describe('AriaEngine — 分片 WAL 集成', () => {
|
||||
await backend.delete('__wal_000000.bin');
|
||||
|
||||
await engine.close();
|
||||
const engine2 = new AriaEngine({ storageBackend: 'indexeddb', checkpointInterval: 100000 });
|
||||
const engine2 = new AriaEngine({ storageBackend: 'opfs', checkpointInterval: 100000 });
|
||||
await engine2.open(dbName, 1);
|
||||
// 已落盘的 a/b 必须保留;c/d 在 WAL 中且文件被删 → 恢复不到(可接受的保守丢弃)
|
||||
const rows = await engine2.find('t', { table: 't' });
|
||||
@@ -241,7 +244,7 @@ describe('AriaEngine — 分片 WAL 集成', () => {
|
||||
const dbName = uniqueDB();
|
||||
// 手工构造旧格式 WAL 库:直接写旧键(模拟 v0.4.4 库崩溃现场)
|
||||
const engine = new AriaEngine({
|
||||
storageBackend: 'indexeddb',
|
||||
storageBackend: 'opfs',
|
||||
checkpointInterval: 100000,
|
||||
walSyncMode: 'full',
|
||||
});
|
||||
@@ -262,7 +265,7 @@ describe('AriaEngine — 分片 WAL 集成', () => {
|
||||
await (engine as any).backend.close();
|
||||
(engine as any).opened = false;
|
||||
|
||||
const engine2 = new AriaEngine({ storageBackend: 'indexeddb', checkpointInterval: 100000 });
|
||||
const engine2 = new AriaEngine({ storageBackend: 'opfs', checkpointInterval: 100000 });
|
||||
await engine2.open(dbName, 1);
|
||||
const rows = await engine2.find('t', { table: 't' });
|
||||
expect(rows).toHaveLength(1);
|
||||
|
||||
Reference in New Issue
Block a user