From 8dbfe7a488fe16b40297f36a435995a98b1419f4 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Fri, 27 Sep 2024 00:32:34 +0200 Subject: [PATCH] Start from low levels --- .../dbengine/database/collections/DatabaseMapDictionary.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionary.java b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionary.java index 6236228..d63a5aa 100644 --- a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionary.java +++ b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionary.java @@ -35,6 +35,7 @@ import it.cavallium.dbengine.utils.StreamUtils; import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectSortedMap; import it.unimi.dsi.fastutil.objects.Object2ObjectSortedMaps; +import java.util.Comparator; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; @@ -567,8 +568,10 @@ public class DatabaseMapDictionary extends DatabaseMapDictionaryDeep Stream>> getAllEntriesFastUnsafe(DatabaseMapDictionary dict) { try { + Comparator comparator = Comparator.comparingInt(x -> x.getMetadata().level()).reversed(); return ((LLLocalDictionary) dict.dictionary) .getAllLiveFiles() + .sorted(comparator) .map(file -> file.iterate(new SSTRangeFull()).map(state -> switch (state) { case RocksDBFileIterationStateBegin rocksDBFileIterationStateBegin: yield null;