sliftutils 1.4.69 → 1.4.70
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
|
@@ -42,11 +42,11 @@ const MAX_INDEX_RELOAD_ATTEMPTS = 3;
|
|
|
42
42
|
const FIRST_MERGE_BYTES = TARGET_FILE_BYTES / 2;
|
|
43
43
|
const KEY_GROUP_BYTES = 800 * 1024 * 1024;
|
|
44
44
|
const DUP_THRESHOLD = 0.4;
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
const
|
|
49
|
-
const
|
|
45
|
+
// Whole-tier dedup short-circuit (after Pass 1): when the bulk tier is over this size AND the overall
|
|
46
|
+
// key duplication fraction is over this threshold, fold every bulk file in one merge instead of the
|
|
47
|
+
// per-key-group walk (which spaces merges 5 min apart — 16 h for 200 groups).
|
|
48
|
+
const DEDUP_TRIGGER_BYTES = 512 * 1024 * 1024;
|
|
49
|
+
const DEDUP_TRIGGER_FRACTION = 0.5;
|
|
50
50
|
const WRITE_FLUSH_FIRST_STEP_MS = 250;
|
|
51
51
|
|
|
52
52
|
export const bulkDatabase2Timing = {
|
|
@@ -941,9 +941,9 @@ export class BulkDatabaseBase<T extends { key: string }> {
|
|
|
941
941
|
}
|
|
942
942
|
}
|
|
943
943
|
|
|
944
|
-
//
|
|
945
|
-
//
|
|
946
|
-
//
|
|
944
|
+
// Whole-tier dedup short-circuit (between Pass 1 and the per-group Pass 2): when the bulk tier
|
|
945
|
+
// is big enough AND mostly duplicates, fold every bulk file in one merge. Avoids the per-group
|
|
946
|
+
// walk's 5-min spacing × N-groups latency.
|
|
947
947
|
{
|
|
948
948
|
const { bulkFiles } = await this.listFiles();
|
|
949
949
|
if (bulkFiles.length >= 2) {
|
|
@@ -960,8 +960,8 @@ export class BulkDatabaseBase<T extends { key: string }> {
|
|
|
960
960
|
} catch { /* skip unreadable */ }
|
|
961
961
|
}
|
|
962
962
|
const dupFraction = totalSlots ? (totalSlots - uniqueKeys.size) / totalSlots : 0;
|
|
963
|
-
if (totalBytes >
|
|
964
|
-
console.log(`${blue(this.name)} ${magenta("
|
|
963
|
+
if (totalBytes > DEDUP_TRIGGER_BYTES && dupFraction > DEDUP_TRIGGER_FRACTION) {
|
|
964
|
+
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`);
|
|
965
965
|
if (!await runMerge(bulkFiles, [])) return merged;
|
|
966
966
|
return merged;
|
|
967
967
|
}
|