sashapolo commented on code in PR #6685:
URL: https://github.com/apache/ignite-3/pull/6685#discussion_r2768682696


##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/AbstractPageMemoryStorageEngine.java:
##########
@@ -17,26 +17,173 @@
 
 package org.apache.ignite.internal.storage.pagememory;
 
+import static java.util.Comparator.comparing;
+import static 
org.apache.ignite.internal.util.IgniteUtils.lexicographicListComparator;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentSkipListMap;
 import java.util.concurrent.atomic.AtomicLong;
+import org.apache.ignite.internal.catalog.descriptors.CatalogColumnCollation;
+import org.apache.ignite.internal.configuration.SystemLocalConfiguration;
+import org.apache.ignite.internal.configuration.SystemPropertyView;
 import org.apache.ignite.internal.hlc.HybridClock;
 import org.apache.ignite.internal.pagememory.PageMemory;
 import org.apache.ignite.internal.pagememory.tree.BplusTree;
+import org.apache.ignite.internal.storage.StorageException;
 import org.apache.ignite.internal.storage.engine.StorageEngine;
+import org.apache.ignite.internal.storage.index.StorageSortedIndexDescriptor;
+import 
org.apache.ignite.internal.storage.index.StorageSortedIndexDescriptor.StorageSortedIndexColumnDescriptor;
+import 
org.apache.ignite.internal.storage.pagememory.index.sorted.comparator.JitComparator;
+import 
org.apache.ignite.internal.storage.pagememory.index.sorted.comparator.JitComparatorGenerator;
+import 
org.apache.ignite.internal.storage.pagememory.index.sorted.comparator.JitComparatorOptions;
+import org.apache.ignite.internal.type.NativeType;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.VisibleForTesting;
 
 /** Abstract implementation of the storage engine based on memory {@link 
PageMemory}. */
 public abstract class AbstractPageMemoryStorageEngine implements StorageEngine 
{
+    public static final String 
LEGACY_PAGE_MEMERY_SORTED_INDEX_COMPARATOR_PROPERTY = 
"legacyPageMemorySortedIndexComparator";
+
+    protected final @Nullable SystemLocalConfiguration systemLocalConfig;
+
     private final HybridClock clock;
 
+    private boolean useLegacySortedIndexComparator = false;
+
+    /**
+     * This map is used to reuse comparators for sorted indexes with the same 
set of columns and their collations. It is beneficial to reuse
+     * comparators because otherwise every comparator will use its own 
generated class, which bloats metaspace and doesn't allow JVM's JIT
+     * to be as efficient.
+     */
+    private final ConcurrentMap<StorageSortedIndexDescriptor, 
CachedComparator> cachedSortedIndexComparators
+            = new ConcurrentSkipListMap<>(comparing(

Review Comment:
   > Java's HashMaps don't support custom hash/equals functions
   
   What do you mean? You implement hashCode and equals yourself



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to