Sort items on load to fix O(N^2) startup

This commit is contained in:
Vitaliy Filippov
2026-02-17 01:12:26 +03:00
parent 3a057ed5af
commit 4fa442a5de
5 changed files with 82 additions and 50 deletions
+2 -1
View File
@@ -239,6 +239,7 @@ resume_4:
return 1;
}
// metadata read finished
bs->heap->finish_load();
printf("Metadata entries loaded: %ju, used blocks: %ju / %ju\n", entries_loaded, bs->heap->get_data_used_space() / bs->dsk.data_block_size, bs->dsk.block_count);
if (zero_on_init && !bs->dsk.disable_meta_fsync)
{
@@ -284,7 +285,7 @@ resume_6:
}, bs->meta_write_recheck_parallelism);
return 1;
resume_7:
if (bs->heap->finish_load() != 0)
if (bs->heap->finish_recheck() != 0)
{
exit(1);
}