fix: 修复 CI 卡死 + LZ4/SSTable/Checkpoint 多项 bug — 526 测试全通过
CI / test (18.x) (push) Successful in 10m1s
CI / test (20.x) (push) Successful in 10m6s
CI / test (22.x) (push) Successful in 10m2s
CI / test (24.x) (push) Successful in 10m6s

This commit is contained in:
thzxx
2026-07-27 20:28:23 +08:00
parent bc69d8f500
commit 620cd11521
16 changed files with 175 additions and 157 deletions
+12 -8
View File
@@ -1768,8 +1768,8 @@ class SSTableReader {
// 查询
// -----------------------------------------------------------------------
/** 精确查找 key */
get(key) {
const blockIdx = this.locateBlock(key);
get(targetKey) {
const blockIdx = this.locateBlock(targetKey);
if (blockIdx < 0)
return null;
const entry = this.indexEntries[blockIdx];
@@ -1777,8 +1777,7 @@ class SSTableReader {
const blockView = new DataView(blockData.buffer, blockData.byteOffset, blockData.byteLength);
const entryCount = blockView.getUint32(0, false);
let offset = 4;
// 二分查找 block 内的 key
// 为简单起见,这里使用顺序扫描(生产中应二分查找)
// 顺序扫描 block 内的条目(生产中应二分查找)
for (let i = 0; i < entryCount; i++) {
const keyLen = blockView.getUint16(offset, false);
offset += 2;
@@ -1788,8 +1787,13 @@ class SSTableReader {
offset += 2;
const valBytes = blockData.slice(offset, offset + valLen);
offset += valLen;
if (key === key) {
return JSON.parse(new TextDecoder().decode(valBytes));
if (key === targetKey) {
try {
return JSON.parse(new TextDecoder().decode(valBytes));
}
catch {
return null;
}
}
}
return null;
@@ -2297,8 +2301,8 @@ class LSM {
this.freezeMemtable();
this.flushImmutableSync();
}
// 等待存储完成
await new Promise((r) => setTimeout(r, 10));
// 确保所有微任务完成(不使用 setTimeout,避免额外 timer 阻止进程退出)
await Promise.resolve();
}
async clear() {
this.memtable.clear();
+1 -1
View File
File diff suppressed because one or more lines are too long
+12 -8
View File
@@ -1764,8 +1764,8 @@ class SSTableReader {
// 查询
// -----------------------------------------------------------------------
/** 精确查找 key */
get(key) {
const blockIdx = this.locateBlock(key);
get(targetKey) {
const blockIdx = this.locateBlock(targetKey);
if (blockIdx < 0)
return null;
const entry = this.indexEntries[blockIdx];
@@ -1773,8 +1773,7 @@ class SSTableReader {
const blockView = new DataView(blockData.buffer, blockData.byteOffset, blockData.byteLength);
const entryCount = blockView.getUint32(0, false);
let offset = 4;
// 二分查找 block 内的 key
// 为简单起见,这里使用顺序扫描(生产中应二分查找)
// 顺序扫描 block 内的条目(生产中应二分查找)
for (let i = 0; i < entryCount; i++) {
const keyLen = blockView.getUint16(offset, false);
offset += 2;
@@ -1784,8 +1783,13 @@ class SSTableReader {
offset += 2;
const valBytes = blockData.slice(offset, offset + valLen);
offset += valLen;
if (key === key) {
return JSON.parse(new TextDecoder().decode(valBytes));
if (key === targetKey) {
try {
return JSON.parse(new TextDecoder().decode(valBytes));
}
catch {
return null;
}
}
}
return null;
@@ -2293,8 +2297,8 @@ class LSM {
this.freezeMemtable();
this.flushImmutableSync();
}
// 等待存储完成
await new Promise((r) => setTimeout(r, 10));
// 确保所有微任务完成(不使用 setTimeout,避免额外 timer 阻止进程退出)
await Promise.resolve();
}
async clear() {
this.memtable.clear();
+1 -1
View File
File diff suppressed because one or more lines are too long
+12 -8
View File
@@ -1770,8 +1770,8 @@
// 查询
// -----------------------------------------------------------------------
/** 精确查找 key */
get(key) {
const blockIdx = this.locateBlock(key);
get(targetKey) {
const blockIdx = this.locateBlock(targetKey);
if (blockIdx < 0)
return null;
const entry = this.indexEntries[blockIdx];
@@ -1779,8 +1779,7 @@
const blockView = new DataView(blockData.buffer, blockData.byteOffset, blockData.byteLength);
const entryCount = blockView.getUint32(0, false);
let offset = 4;
// 二分查找 block 内的 key
// 为简单起见,这里使用顺序扫描(生产中应二分查找)
// 顺序扫描 block 内的条目(生产中应二分查找)
for (let i = 0; i < entryCount; i++) {
const keyLen = blockView.getUint16(offset, false);
offset += 2;
@@ -1790,8 +1789,13 @@
offset += 2;
const valBytes = blockData.slice(offset, offset + valLen);
offset += valLen;
if (key === key) {
return JSON.parse(new TextDecoder().decode(valBytes));
if (key === targetKey) {
try {
return JSON.parse(new TextDecoder().decode(valBytes));
}
catch {
return null;
}
}
}
return null;
@@ -2299,8 +2303,8 @@
this.freezeMemtable();
this.flushImmutableSync();
}
// 等待存储完成
await new Promise((r) => setTimeout(r, 10));
// 确保所有微任务完成(不使用 setTimeout,避免额外 timer 阻止进程退出)
await Promise.resolve();
}
async clear() {
this.memtable.clear();
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long