This is an automated email from the ASF dual-hosted git repository.

timoninmaxim pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new aefdcc72677 IGNITE-26973 Remove redundant maps in IndexProcessor 
(#12507)
aefdcc72677 is described below

commit aefdcc72677406bce1dfb320bb79a3dce7ee023e
Author: Ashesha <[email protected]>
AuthorDate: Wed Nov 12 19:31:28 2025 +0700

    IGNITE-26973 Remove redundant maps in IndexProcessor (#12507)
---
 .../integration/IndexDdlIntegrationTest.java       |  2 +-
 .../internal/cache/query/index/IndexProcessor.java | 30 +++-------------------
 .../cache/query/index/IndexQueryProcessor.java     |  6 ++---
 .../defragmentation/IndexingDefragmentation.java   |  4 +--
 4 files changed, 10 insertions(+), 32 deletions(-)

diff --git 
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexDdlIntegrationTest.java
 
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexDdlIntegrationTest.java
index a8b0e42c881..936a052f7ac 100644
--- 
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexDdlIntegrationTest.java
+++ 
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexDdlIntegrationTest.java
@@ -203,6 +203,6 @@ public class IndexDdlIntegrationTest extends 
AbstractDdlIntegrationTest {
 
     /** */
     private LinkedHashMap<String, IndexKeyDefinition> 
indexKeyDefinitions(Index idx) {
-        return 
grid(0).context().indexProcessor().indexDefinition(idx.id()).indexKeyDefinitions();
+        return idx.indexDefinition().indexKeyDefinitions();
     }
 }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/IndexProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/IndexProcessor.java
index 35ae189f8e7..5feb6478adf 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/IndexProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/IndexProcessor.java
@@ -23,8 +23,6 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
@@ -112,12 +110,7 @@ public class IndexProcessor extends GridProcessorAdapter {
     /**
      * Registry of all indexes. High key is a cache name, lower key is an 
unique index name.
      */
-    private final Map<String, Map<String, Index>> cacheToIdx = new 
ConcurrentHashMap<>();
-
-    /**
-     * Registry of all index definitions. Key is {@link Index#id()}, value is 
IndexDefinition used for creating index.
-     */
-    private final Map<UUID, IndexDefinition> idxDefs = new 
ConcurrentHashMap<>();
+    private final Map<String, Map<String, Index>> cacheToIdx = new HashMap<>();
 
     /** Exclusive lock for DDL operations. */
     private final ReentrantReadWriteLock ddlLock = new 
ReentrantReadWriteLock();
@@ -242,7 +235,7 @@ public class IndexProcessor extends GridProcessorAdapter {
         try {
             String cacheName = definition.idxName().cacheName();
 
-            cacheToIdx.putIfAbsent(cacheName, new ConcurrentHashMap<>());
+            cacheToIdx.putIfAbsent(cacheName, new HashMap<>());
 
             String uniqIdxName = definition.idxName().fullName();
 
@@ -253,8 +246,6 @@ public class IndexProcessor extends GridProcessorAdapter {
 
             cacheToIdx.get(cacheName).put(uniqIdxName, idx);
 
-            idxDefs.put(idx.id(), definition);
-
             return idx;
 
         }
@@ -281,11 +272,8 @@ public class IndexProcessor extends GridProcessorAdapter {
 
             Index idx = idxs.remove(idxName.fullName());
 
-            if (idx != null) {
+            if (idx != null)
                 idx.destroy(softDelete);
-                idxDefs.remove(idx.id());
-            }
-
         }
         finally {
             ddlLock.writeLock().unlock();
@@ -421,16 +409,6 @@ public class IndexProcessor extends GridProcessorAdapter {
         }
     }
 
-    /**
-     * Returns IndexDefinition used for creating index specified id.
-     *
-     * @param idxId UUID of index.
-     * @return IndexDefinition used for creating index with id {@code idxId}.
-     */
-    public IndexDefinition indexDefinition(UUID idxId) {
-        return idxDefs.get(idxId);
-    }
-
     /**
      * Unregisters cache.
      *
@@ -638,7 +616,7 @@ public class IndexProcessor extends GridProcessorAdapter {
                 for (Index idx : idxs.values()) {
                     if (idx instanceof InlineIndex && 
!QueryUtils.PRIMARY_KEY_INDEX.equals(idx.name())) {
                         InlineIndex idx0 = (InlineIndex)idx;
-                        IndexDefinition idxDef = indexDefinition(idx.id());
+                        IndexDefinition idxDef = idx.indexDefinition();
                         IndexName idxName = idxDef.idxName();
 
                         map.put(
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/IndexQueryProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/IndexQueryProcessor.java
index 27dd4176c22..5b2b1637577 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/IndexQueryProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/IndexQueryProcessor.java
@@ -93,7 +93,7 @@ public class IndexQueryProcessor {
 
         GridCursor<IndexRow> cursor = queryMultipleRanges(idx, cacheFilter, 
qry);
 
-        SortedIndexDefinition def = 
(SortedIndexDefinition)idxProc.indexDefinition(idx.id());
+        SortedIndexDefinition def = idx.indexDefinition();
 
         IndexQueryResultMeta meta = new IndexQueryResultMeta(def, 
qry.critSize());
 
@@ -274,7 +274,7 @@ public class IndexQueryProcessor {
      * Criteria fields have to match to a prefix of the index. Order of fields 
in criteria doesn't matter.
      */
     private boolean checkIndex(SortedSegmentedIndex idx, String tblName, 
Map<String, String> criteriaFlds) {
-        IndexDefinition idxDef = idxProc.indexDefinition(idx.id());
+        IndexDefinition idxDef = idx.indexDefinition();
 
         if (!tblName.equals(idxDef.idxName().tableName()))
             return false;
@@ -411,7 +411,7 @@ public class IndexQueryProcessor {
         IndexingQueryFilter cacheFilter,
         IndexSingleRangeQuery qry
     ) throws IgniteCheckedException {
-        IndexRowComparator rowCmp = 
((SortedIndexDefinition)idxProc.indexDefinition(idx.id())).rowComparator();
+        IndexRowComparator rowCmp = idx.indexDefinition().rowComparator();
 
         BPlusTree.TreeRowClosure<IndexRow, IndexRow> treeFilter = 
qry.filter(rowCmp);
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/defragmentation/IndexingDefragmentation.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/defragmentation/IndexingDefragmentation.java
index 6269b7ab90e..63950cda95a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/defragmentation/IndexingDefragmentation.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/defragmentation/IndexingDefragmentation.java
@@ -145,7 +145,7 @@ public class IndexingDefragmentation {
             for (InlineIndex oldIdx : indexes.idxs) {
                 InlineIndexRowHandler oldRowHnd = 
oldIdx.segment(0).rowHandler();
 
-                SortedIndexDefinition idxDef = 
(SortedIndexDefinition)indexing.indexDefinition(oldIdx.id());
+                SortedIndexDefinition idxDef = oldIdx.indexDefinition();
 
                 InlineIndexImpl newIdx = new 
DefragIndexFactory(newCtx.offheap(), newCachePageMemory, oldIdx)
                     .createIndex(cctx, idxDef)
@@ -224,7 +224,7 @@ public class IndexingDefragmentation {
             List<InlineIndex> indexes = indexing.treeIndexes(cctx.name(), 
false);
 
             for (InlineIndex idx: indexes) {
-                String table = 
indexing.indexDefinition(idx.id()).idxName().tableName();
+                String table = idx.indexDefinition().idxName().tableName();
 
                 idxs.putIfAbsent(table, new TableIndexes(cctx, table));
 

Reply via email to