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;