fix(P0): SSTable rangeScan 尾块漏读 — 索引块记录块尾 key 但二分按块首语义定位,endKey 落在块尾时下一块被排除导致二级索引查询丢数据(5万行丢106~771条);endBlockIdx 多扫一块 + 4 个 sstable 边界回归 + 重建二级索引大数据量回归(含崩溃恢复)。附带:checkpoint 同步 flush 二级索引 LSM(P1)、kv 后端页面化 + SharedMemoryBackend chunk 化、生产负载验证测试
This commit is contained in:
@@ -252,7 +252,17 @@ export class AriaEngine implements IStorageEngine {
|
||||
getBufferedBytes: () => this.wal.getBufferedBytes(),
|
||||
getBufferedCount: () => this.wal.getBufferedCount(),
|
||||
} as unknown as WAL,
|
||||
{ flushAll: async () => { await this.lsm.flush(); } } as any,
|
||||
{
|
||||
flushAll: async () => {
|
||||
// v0.6.1-fix: checkpoint 必须同时落盘二级索引 LSM —
|
||||
// 此前只 flush 主 LSM,checkpoint 截断 WAL 后崩溃时索引 memtable 未落盘、
|
||||
// WAL 为空跳过重建 → 二级索引静默丢失最后一批条目(生产数据一致性问题)
|
||||
await this.lsm.flush();
|
||||
for (const idxLsm of this.secondaryIndexes.values()) {
|
||||
await idxLsm.flush();
|
||||
}
|
||||
},
|
||||
} as any,
|
||||
this.config.checkpointInterval,
|
||||
this.config.walSizeThreshold,
|
||||
);
|
||||
@@ -1471,11 +1481,13 @@ export class AriaEngine implements IStorageEngine {
|
||||
};
|
||||
}
|
||||
|
||||
/** v0.4.5: 是否启用页面化物理存储(默认 OPFS 后端启用,显式配置可覆盖) */
|
||||
/** v0.4.5: 是否启用页面化物理存储(默认 OPFS / KVStore 后端启用,显式配置可覆盖) */
|
||||
private isPageStorage(): boolean {
|
||||
if (this.config.pageStorage === true) return true;
|
||||
if (this.config.pageStorage === false) return false;
|
||||
return this.config.storageBackend === 'opfs';
|
||||
// v0.6.1: kv 后端同样页面化 — 整 value SSTable(4MB)超过 1MB 页面缓存时
|
||||
// 每次读取全量重载;拆 4KB 页面后缓存按页命中,大数据量读放大消除
|
||||
return this.config.storageBackend === 'opfs' || this.config.storageBackend === 'kv';
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
||||
Reference in New Issue
Block a user