sliftutils 1.4.71 → 1.4.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -262,7 +262,7 @@ export class BulkDatabaseBase<T extends { key: string }> {
|
|
|
262
262
|
db.reloadFromDisk();
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
if (flushed.length) console.log(`[bulk2] heap ${fmtBytes(usedHeapBytes)} over ${fmtBytes(bulkDatabase2Timing.memoryFlushHeapBytes)}
|
|
265
|
+
if (flushed.length) console.log(`[bulk2] heap ${fmtBytes(usedHeapBytes)} over ${fmtBytes(bulkDatabase2Timing.memoryFlushHeapBytes)} - flushed ${flushed.length} large collection(s): ${flushed.join(", ")}`);
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
public static clearCache() {
|
|
@@ -618,9 +618,7 @@ export class BulkDatabaseBase<T extends { key: string }> {
|
|
|
618
618
|
this.mergeInFlight = true;
|
|
619
619
|
const stopHeartbeat = startMergeFileLockHeartbeat(storage, writerId);
|
|
620
620
|
try {
|
|
621
|
-
let t = Date.now();
|
|
622
621
|
await this.testMergeINTERNAL_DO_NOT_CALL();
|
|
623
|
-
console.log(` [autocompact] ${this.name}: merged (${Date.now() - t}ms)`);
|
|
624
622
|
} finally {
|
|
625
623
|
stopHeartbeat();
|
|
626
624
|
await releaseMergeFileLock(storage, writerId);
|
|
@@ -708,7 +706,7 @@ export class BulkDatabaseBase<T extends { key: string }> {
|
|
|
708
706
|
}
|
|
709
707
|
return;
|
|
710
708
|
}
|
|
711
|
-
console.warn(`${this.name}: skipping unreadable bulk file ${file.fileName} (recent
|
|
709
|
+
console.warn(`${this.name}: skipping unreadable bulk file ${file.fileName} (recent - may be in-progress): ${message}`);
|
|
712
710
|
}
|
|
713
711
|
|
|
714
712
|
// The one merge primitive. Reads + plans + writes outputs before deleting any input, so a crash
|
|
@@ -817,7 +815,7 @@ export class BulkDatabaseBase<T extends { key: string }> {
|
|
|
817
815
|
const outTotal = outputs.reduce((a, f) => a + f.size, 0);
|
|
818
816
|
log(`${magenta("wrote")}: ${outputs.length} output file(s), ${fmtBytes(outTotal)}${carriedDeletes ? `, ${carriedDeletes} tombstones carried` : ""}`);
|
|
819
817
|
|
|
820
|
-
console.group(`${blue(this.name)} ${magenta("merge")}: ${fmtBytes(inTotal)}
|
|
818
|
+
console.group(`${blue(this.name)} ${magenta("merge")}: ${fmtBytes(inTotal)} -> ${fmtBytes(outTotal)} (${inputs.length}->${outputs.length} files) in ${formatTime(Date.now() - mergeStartMs)}`);
|
|
821
819
|
for (const line of steps) console.log(line);
|
|
822
820
|
console.groupEnd();
|
|
823
821
|
|
|
@@ -898,7 +896,7 @@ export class BulkDatabaseBase<T extends { key: string }> {
|
|
|
898
896
|
const sizes = await Promise.all(streamFiles.map(async f => { try { return (await storage.getInfo(f.fileName))?.size ?? 0; } catch { return 0; } }));
|
|
899
897
|
const totalStreamBytes = sizes.reduce((a, b) => a + b, 0);
|
|
900
898
|
if (totalStreamBytes > bulkDatabase2Timing.streamFoldHardLimitBytes) {
|
|
901
|
-
console.log(`${blue(this.name)} ${magenta("fold")} stream tier ${fmtBytes(totalStreamBytes)} over hard limit ${fmtBytes(bulkDatabase2Timing.streamFoldHardLimitBytes)}
|
|
899
|
+
console.log(`${blue(this.name)} ${magenta("fold")} stream tier ${fmtBytes(totalStreamBytes)} over hard limit ${fmtBytes(bulkDatabase2Timing.streamFoldHardLimitBytes)} - folding all streams now`);
|
|
902
900
|
if (await this.mergeFileSet([], streamFiles, false, true)) merged = true;
|
|
903
901
|
}
|
|
904
902
|
}
|
|
@@ -966,7 +964,7 @@ export class BulkDatabaseBase<T extends { key: string }> {
|
|
|
966
964
|
}
|
|
967
965
|
const dupFraction = totalSlots ? (totalSlots - uniqueKeys.size) / totalSlots : 0;
|
|
968
966
|
if (totalBytes > DEDUP_TRIGGER_BYTES && dupFraction > DEDUP_TRIGGER_FRACTION) {
|
|
969
|
-
console.log(`${blue(this.name)} ${magenta("dedup")}: ${fmtBytes(totalBytes)} across ${bulkFiles.length} bulk file(s), ${Math.round(dupFraction * 100)}% duplicate key-slots
|
|
967
|
+
console.log(`${blue(this.name)} ${magenta("dedup")}: ${fmtBytes(totalBytes)} across ${bulkFiles.length} bulk file(s), ${Math.round(dupFraction * 100)}% duplicate key-slots - folding all at once`);
|
|
970
968
|
if (!await runMerge(bulkFiles, [])) return merged;
|
|
971
969
|
return merged;
|
|
972
970
|
}
|
|
@@ -608,10 +608,13 @@ export async function autocompactBulkDatabases(root: string): Promise<void> {
|
|
|
608
608
|
.filter(d => d.isDirectory()).map(d => d.name);
|
|
609
609
|
} catch { continue; } // no bulkDatabases2 here
|
|
610
610
|
for (const name of names) {
|
|
611
|
+
const start = Date.now();
|
|
612
|
+
console.log(` [autocompact] ${name}: starting merge`);
|
|
611
613
|
try {
|
|
612
614
|
await getCompactor(baseDir, name).tryMergeNow();
|
|
615
|
+
console.log(` [autocompact] ${name}: done (${Date.now() - start}ms)`);
|
|
613
616
|
} catch (e) {
|
|
614
|
-
console.warn(` [autocompact] ${name}: failed
|
|
617
|
+
console.warn(` [autocompact] ${name}: failed after ${Date.now() - start}ms - ${(e as Error).message}`);
|
|
615
618
|
}
|
|
616
619
|
}
|
|
617
620
|
}
|