You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/04/06 16:21:51 UTC

[GitHub] [ignite-3] AMashenkov commented on a diff in pull request #672: IGNITE-16266 Add unique id for indexes

AMashenkov commented on code in PR #672:
URL: https://github.com/apache/ignite-3/pull/672#discussion_r844143333


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImpl.java:
##########
@@ -262,20 +293,28 @@ private IgniteIndex createIndex(InternalSortedIndex idx, InternalIgniteTable tbl
                         )
                 ).collect(Collectors.toList());
 
-        return new IgniteIndex(
-                RelCollations.of(idxFieldsCollation),
-                idx,
-                tbl
-        );
+        IgniteIndex idx0 = new IgniteIndex(RelCollations.of(idxFieldsCollation), idx, tbl);
+
+        indexById.put(idx0.id(), idx0);
+
+        return idx0;
     }
 
     /**
      * Build new SQL schema when existed index is dropped.
      */
     public void onIndexDropped(String schema, String tblName, String idxName) {
-        InternalIgniteTable tbl = igniteSchemas.get(schema).internalTable(removeSchema(schema, tblName));
+        InternalIgniteTable tbl = igniteSchemas.get(schema).internalTable(normalizeSchema(schema, tblName));
+
+        IgniteIndex idx0 = tbl.removeIndex(idxName);
 
-        tbl.removeIndex(idxName);
+        if (idx0 != null) {
+            IgniteIndex old = indexById.remove(idx0.id());
+
+            if (old == null) {
+                LOG.trace(IgniteStringFormatter.format("Index [name={}] not found in inner store.", idxName));

Review Comment:
   Let's avoid string creation if the TRACE log-level is disabled.
   ```suggestion
                   LOG.trace(() -> IgniteStringFormatter.format("Index [name={}] not found in inner store.", idxName));
   ```



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org