You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "tkalkirill (via GitHub)" <gi...@apache.org> on 2023/06/05 09:42:06 UTC

[GitHub] [ignite-3] tkalkirill opened a new pull request, #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

tkalkirill opened a new pull request, #2143:
URL: https://github.com/apache/ignite-3/pull/2143

   https://issues.apache.org/jira/browse/IGNITE-19646


-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1220947816


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -436,31 +436,39 @@ private CompletableFuture<?> onIndexCreate(ConfigurationNotificationEvent<TableI
         }
 
         try {
-            return createIndexLocally(evt.storageRevision(), tableId, evt.newValue(), evt.newValue(TablesView.class));
+            TablesView tablesView = evt.newValue(TablesView.class);
+
+            TableView tableView = findTableView(tableId, (NamedListView<TableView>) tablesView.tables());

Review Comment:
   fix it



-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1221149497


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ClusterPerClassIntegrationTest.java:
##########
@@ -526,7 +526,7 @@ protected static Map<Integer, List<Ignite>> waitForIndexBuild(String tableName,
 
                 IndexStorage index = internalTable.storage().getOrCreateIndex(
                         partitionId,
-                        createIndexDescriptor(catalogTableDescriptor, catalogIndexDescriptor)
+                        create(catalogTableDescriptor, catalogIndexDescriptor)

Review Comment:
   Fix it



-- 
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


[GitHub] [ignite-3] AMashenkov commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "AMashenkov (via GitHub)" <gi...@apache.org>.
AMashenkov commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1219612516


##########
modules/catalog/build.gradle:
##########
@@ -28,6 +28,7 @@ dependencies {
     implementation project(':ignite-configuration')
     implementation project(':ignite-metastorage-api')
     implementation project(':ignite-vault')
+    implementation project(':ignite-schema')

Review Comment:
   I think `ignite-schema` should depends on `ignite-catalog`,
   because `ignite-schema` contains classes related to storage format/protocol that should be build based on Catalog information.



-- 
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


[GitHub] [ignite-3] ademakov commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "ademakov (via GitHub)" <gi...@apache.org>.
ademakov commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1219355838


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -70,14 +70,14 @@
 import org.apache.ignite.lang.IndexNotFoundException;
 import org.apache.ignite.lang.NodeStoppingException;
 import org.apache.ignite.lang.TableNotFoundException;
-import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * An Ignite component that is responsible for handling index-related commands like CREATE or DROP
  * as well as managing indexes' lifecycle.
  */
 // TODO: IGNITE-19082 Delete this class
+// TODO: IGNITE-19646 избавиться от конфигурации таблицы и индексов

Review Comment:
   Oops, comment in Russian.



-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1219388180


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -70,14 +70,14 @@
 import org.apache.ignite.lang.IndexNotFoundException;
 import org.apache.ignite.lang.NodeStoppingException;
 import org.apache.ignite.lang.TableNotFoundException;
-import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * An Ignite component that is responsible for handling index-related commands like CREATE or DROP
  * as well as managing indexes' lifecycle.
  */
 // TODO: IGNITE-19082 Delete this class
+// TODO: IGNITE-19646 избавиться от конфигурации таблицы и индексов

Review Comment:
   Fix it



-- 
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


[GitHub] [ignite-3] ibessonov commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "ibessonov (via GitHub)" <gi...@apache.org>.
ibessonov commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1219391835


##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorage.java:
##########
@@ -1007,4 +1020,18 @@ IndexMeta createIndexMetaForNewIndex(int indexId) {
             return sortedIndexes.get(indexId);
         });
     }
+
+    private static @Nullable TableIndexView findIndexView(TablesView tablesView, int indexId) {
+        return tablesView.indexes().stream()
+                .filter(tableIndexView -> indexId == tableIndexView.id())
+                .findFirst()
+                .orElse(null);
+    }
+
+    private static @Nullable TableView findTableView(TablesView tablesView, int tableId) {
+        return tablesView.tables().stream()
+                .filter(tableIndexView -> tableId == tableIndexView.id())

Review Comment:
   ```suggestion
                   .filter(tableView -> tableId == tableView.id())
   ```



-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1220968252


##########
modules/storage-api/src/main/java/org/apache/ignite/internal/storage/index/IndexDescriptor.java:
##########
@@ -59,23 +55,23 @@ interface ColumnDescriptor {
     List<? extends ColumnDescriptor> columns();
 
     /**
-     * Creates an index description based on the configuration.
+     * Creates an index description based on the catalog descriptors.
      *
-     * @param tablesView Tables configuration.
-     * @param indexId Index ID.
+     * @param table Catalog table descriptor.
+     * @param index Catalog index descriptor.
      */
-    static IndexDescriptor createIndexDescriptor(TablesView tablesView, int indexId) {
-        TableIndexView indexView = tablesView.indexes().stream()
-                .filter(tableIndexView -> indexId == tableIndexView.id())
-                .findFirst()
-                .orElse(null);
+    static IndexDescriptor createIndexDescriptor(

Review Comment:
   fix it



-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1220950577


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -436,31 +436,39 @@ private CompletableFuture<?> onIndexCreate(ConfigurationNotificationEvent<TableI
         }
 
         try {
-            return createIndexLocally(evt.storageRevision(), tableId, evt.newValue(), evt.newValue(TablesView.class));
+            TablesView tablesView = evt.newValue(TablesView.class);
+
+            TableView tableView = findTableView(tableId, (NamedListView<TableView>) tablesView.tables());
+
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor = toTableDescriptor(tableView);

Review Comment:
   It seems that it looks more visually and uniformly, I can remove it. wdyt?



-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1221125474


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -436,31 +436,39 @@ private CompletableFuture<?> onIndexCreate(ConfigurationNotificationEvent<TableI
         }
 
         try {
-            return createIndexLocally(evt.storageRevision(), tableId, evt.newValue(), evt.newValue(TablesView.class));
+            TablesView tablesView = evt.newValue(TablesView.class);
+
+            TableView tableView = findTableView(tableId, (NamedListView<TableView>) tablesView.tables());
+
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor = toTableDescriptor(tableView);

Review Comment:
   Fix it



-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1221128770


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -608,4 +599,54 @@ public CompletableFuture<?> onUpdate(ConfigurationNotificationEvent<TableIndexVi
             return failedFuture(new IllegalStateException("Should not be called"));
         }
     }
+
+    /**
+     * Converts a catalog index descriptor to an event index descriptor.
+     *
+     * @param descriptor Catalog index descriptor.
+     */
+    static IndexDescriptor toEventIndexDescriptor(org.apache.ignite.internal.catalog.descriptors.IndexDescriptor descriptor) {

Review Comment:
   fix it



-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1221126692


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -436,31 +436,39 @@ private CompletableFuture<?> onIndexCreate(ConfigurationNotificationEvent<TableI
         }
 
         try {
-            return createIndexLocally(evt.storageRevision(), tableId, evt.newValue(), evt.newValue(TablesView.class));
+            TablesView tablesView = evt.newValue(TablesView.class);
+
+            TableView tableView = findTableView(tableId, (NamedListView<TableView>) tablesView.tables());
+
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor = toTableDescriptor(tableView);
+            org.apache.ignite.internal.catalog.descriptors.IndexDescriptor catalogIndexDescriptor = toIndexDescriptor(indexConfig);
+
+            return createIndexLocally(evt.storageRevision(), catalogTableDescriptor, catalogIndexDescriptor);
         } finally {
             busyLock.leaveBusy();
         }
     }
 
     private CompletableFuture<?> createIndexLocally(
             long causalityToken,
-            int tableId,
-            TableIndexView tableIndexView,
-            TablesView tablesView
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor,

Review Comment:
   fix it



-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1220967308


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ClusterPerClassIntegrationTest.java:
##########
@@ -574,4 +585,15 @@ public static TablesConfiguration getTablesConfiguration(Ignite node) {
 
         return indexConfig == null ? null : indexConfig.id().value();
     }
+
+    /**
+     * Returns table configuration of the given table at the given node, or {@code null} if no such table exists.
+     *
+     * @param node Node.
+     * @param tableName Table name.
+     * @return Table configuration.
+     */
+    public static @Nullable TableConfiguration getTableConfiguration(Ignite node, String tableName) {

Review Comment:
   fix it



-- 
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


[GitHub] [ignite-3] sashapolo commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1221086830


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -608,4 +599,54 @@ public CompletableFuture<?> onUpdate(ConfigurationNotificationEvent<TableIndexVi
             return failedFuture(new IllegalStateException("Should not be called"));
         }
     }
+
+    /**
+     * Converts a catalog index descriptor to an event index descriptor.
+     *
+     * @param descriptor Catalog index descriptor.
+     */
+    static IndexDescriptor toEventIndexDescriptor(org.apache.ignite.internal.catalog.descriptors.IndexDescriptor descriptor) {

Review Comment:
   These methods should be private



-- 
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


[GitHub] [ignite-3] sashapolo commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1221088319


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ClusterPerClassIntegrationTest.java:
##########
@@ -526,7 +526,7 @@ protected static Map<Integer, List<Ignite>> waitForIndexBuild(String tableName,
 
                 IndexStorage index = internalTable.storage().getOrCreateIndex(
                         partitionId,
-                        createIndexDescriptor(catalogTableDescriptor, catalogIndexDescriptor)
+                        create(catalogTableDescriptor, catalogIndexDescriptor)

Review Comment:
   The idea was that you would use a fully qualified name instead: `IndexDescriptor.create`



-- 
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


[GitHub] [ignite-3] tkalkirill merged pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill merged PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143


-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1220960858


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -436,31 +436,39 @@ private CompletableFuture<?> onIndexCreate(ConfigurationNotificationEvent<TableI
         }
 
         try {
-            return createIndexLocally(evt.storageRevision(), tableId, evt.newValue(), evt.newValue(TablesView.class));
+            TablesView tablesView = evt.newValue(TablesView.class);
+
+            TableView tableView = findTableView(tableId, (NamedListView<TableView>) tablesView.tables());
+
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor = toTableDescriptor(tableView);
+            org.apache.ignite.internal.catalog.descriptors.IndexDescriptor catalogIndexDescriptor = toIndexDescriptor(indexConfig);
+
+            return createIndexLocally(evt.storageRevision(), catalogTableDescriptor, catalogIndexDescriptor);
         } finally {
             busyLock.leaveBusy();
         }
     }
 
     private CompletableFuture<?> createIndexLocally(
             long causalityToken,
-            int tableId,
-            TableIndexView tableIndexView,
-            TablesView tablesView
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor,
+            org.apache.ignite.internal.catalog.descriptors.IndexDescriptor catalogIndexDescriptor
     ) {
-        assert tableIndexView != null;
-
-        int indexId = tableIndexView.id();
+        int tableId = catalogTableDescriptor.id();
+        int indexId = catalogIndexDescriptor.id();
 
         LOG.trace("Creating local index: name={}, id={}, tableId={}, token={}",
-                tableIndexView.name(), indexId, tableId, causalityToken);
+                catalogIndexDescriptor.name(), indexId, tableId, causalityToken);
 
-        IndexDescriptor descriptor = newDescriptor(tableIndexView);
+        IndexDescriptor eventIndexDescriptor = toEventIndexDescriptor(catalogIndexDescriptor);

Review Comment:
   Yes, we all need them in one class and they are not quite compatible with each other if we redo it in a separate task.



-- 
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


[GitHub] [ignite-3] sashapolo commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1220091157


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -436,31 +436,39 @@ private CompletableFuture<?> onIndexCreate(ConfigurationNotificationEvent<TableI
         }
 
         try {
-            return createIndexLocally(evt.storageRevision(), tableId, evt.newValue(), evt.newValue(TablesView.class));
+            TablesView tablesView = evt.newValue(TablesView.class);
+
+            TableView tableView = findTableView(tableId, (NamedListView<TableView>) tablesView.tables());
+
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor = toTableDescriptor(tableView);
+            org.apache.ignite.internal.catalog.descriptors.IndexDescriptor catalogIndexDescriptor = toIndexDescriptor(indexConfig);
+
+            return createIndexLocally(evt.storageRevision(), catalogTableDescriptor, catalogIndexDescriptor);
         } finally {
             busyLock.leaveBusy();
         }
     }
 
     private CompletableFuture<?> createIndexLocally(
             long causalityToken,
-            int tableId,
-            TableIndexView tableIndexView,
-            TablesView tablesView
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor,

Review Comment:
   Why do you call these parameters `catalog*`, isn't that obvious from their type?



##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ClusterPerClassIntegrationTest.java:
##########
@@ -574,4 +585,15 @@ public static TablesConfiguration getTablesConfiguration(Ignite node) {
 
         return indexConfig == null ? null : indexConfig.id().value();
     }
+
+    /**
+     * Returns table configuration of the given table at the given node, or {@code null} if no such table exists.
+     *
+     * @param node Node.
+     * @param tableName Table name.
+     * @return Table configuration.
+     */
+    public static @Nullable TableConfiguration getTableConfiguration(Ignite node, String tableName) {

Review Comment:
   can be private



##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -436,31 +436,39 @@ private CompletableFuture<?> onIndexCreate(ConfigurationNotificationEvent<TableI
         }
 
         try {
-            return createIndexLocally(evt.storageRevision(), tableId, evt.newValue(), evt.newValue(TablesView.class));
+            TablesView tablesView = evt.newValue(TablesView.class);
+
+            TableView tableView = findTableView(tableId, (NamedListView<TableView>) tablesView.tables());
+
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor = toTableDescriptor(tableView);

Review Comment:
   IDEA tells me that `TableDescriptor` can still be imported. Do you use the fully qualified name on purpose?



##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -436,31 +436,39 @@ private CompletableFuture<?> onIndexCreate(ConfigurationNotificationEvent<TableI
         }
 
         try {
-            return createIndexLocally(evt.storageRevision(), tableId, evt.newValue(), evt.newValue(TablesView.class));
+            TablesView tablesView = evt.newValue(TablesView.class);
+
+            TableView tableView = findTableView(tableId, (NamedListView<TableView>) tablesView.tables());

Review Comment:
   `findTableView` can return `null`, looks like you do not handle this situation



##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexUtils.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.index;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Helper class for working with indexes.
+ */
+class IndexUtils {

Review Comment:
   What's the point of this class? It's only used in the `IndexManager`, can we move these methods there?



##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -436,31 +436,39 @@ private CompletableFuture<?> onIndexCreate(ConfigurationNotificationEvent<TableI
         }
 
         try {
-            return createIndexLocally(evt.storageRevision(), tableId, evt.newValue(), evt.newValue(TablesView.class));
+            TablesView tablesView = evt.newValue(TablesView.class);
+
+            TableView tableView = findTableView(tableId, (NamedListView<TableView>) tablesView.tables());
+
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor = toTableDescriptor(tableView);
+            org.apache.ignite.internal.catalog.descriptors.IndexDescriptor catalogIndexDescriptor = toIndexDescriptor(indexConfig);
+
+            return createIndexLocally(evt.storageRevision(), catalogTableDescriptor, catalogIndexDescriptor);
         } finally {
             busyLock.leaveBusy();
         }
     }
 
     private CompletableFuture<?> createIndexLocally(
             long causalityToken,
-            int tableId,
-            TableIndexView tableIndexView,
-            TablesView tablesView
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor,
+            org.apache.ignite.internal.catalog.descriptors.IndexDescriptor catalogIndexDescriptor
     ) {
-        assert tableIndexView != null;
-
-        int indexId = tableIndexView.id();
+        int tableId = catalogTableDescriptor.id();
+        int indexId = catalogIndexDescriptor.id();
 
         LOG.trace("Creating local index: name={}, id={}, tableId={}, token={}",
-                tableIndexView.name(), indexId, tableId, causalityToken);
+                catalogIndexDescriptor.name(), indexId, tableId, causalityToken);
 
-        IndexDescriptor descriptor = newDescriptor(tableIndexView);
+        IndexDescriptor eventIndexDescriptor = toEventIndexDescriptor(catalogIndexDescriptor);

Review Comment:
   Jesus, do we have 3 `IndexDescriptor` types which are all used here? Can we at least get rid of this one?



##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbTableStorage.java:
##########
@@ -765,4 +781,18 @@ private List<RocksDbSortedIndexStorage> getSortedIndexStorages(int partitionId)
             return (IndexStorage) null;
         });
     }
+
+    private static @Nullable TableIndexView findIndexView(TablesView tablesView, int indexId) {

Review Comment:
   This stuff is copy-pasted everywhere, can it be extracted somewhere?



##########
modules/storage-api/src/main/java/org/apache/ignite/internal/storage/index/IndexDescriptor.java:
##########
@@ -59,23 +55,23 @@ interface ColumnDescriptor {
     List<? extends ColumnDescriptor> columns();
 
     /**
-     * Creates an index description based on the configuration.
+     * Creates an index description based on the catalog descriptors.
      *
-     * @param tablesView Tables configuration.
-     * @param indexId Index ID.
+     * @param table Catalog table descriptor.
+     * @param index Catalog index descriptor.
      */
-    static IndexDescriptor createIndexDescriptor(TablesView tablesView, int indexId) {
-        TableIndexView indexView = tablesView.indexes().stream()
-                .filter(tableIndexView -> indexId == tableIndexView.id())
-                .findFirst()
-                .orElse(null);
+    static IndexDescriptor createIndexDescriptor(

Review Comment:
   `IndexDescriptor.createIndexDescriptor` is a bit of a mouthful, I think it can simply be called `IndexDescriptor.create`



-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1221022352


##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbTableStorage.java:
##########
@@ -765,4 +781,18 @@ private List<RocksDbSortedIndexStorage> getSortedIndexStorages(int partitionId)
             return (IndexStorage) null;
         });
     }
+
+    private static @Nullable TableIndexView findIndexView(TablesView tablesView, int indexId) {

Review Comment:
   fix it



-- 
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


[GitHub] [ignite-3] sashapolo commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1221084523


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -436,31 +436,39 @@ private CompletableFuture<?> onIndexCreate(ConfigurationNotificationEvent<TableI
         }
 
         try {
-            return createIndexLocally(evt.storageRevision(), tableId, evt.newValue(), evt.newValue(TablesView.class));
+            TablesView tablesView = evt.newValue(TablesView.class);
+
+            TableView tableView = findTableView(tableId, (NamedListView<TableView>) tablesView.tables());
+
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor = toTableDescriptor(tableView);
+            org.apache.ignite.internal.catalog.descriptors.IndexDescriptor catalogIndexDescriptor = toIndexDescriptor(indexConfig);
+
+            return createIndexLocally(evt.storageRevision(), catalogTableDescriptor, catalogIndexDescriptor);
         } finally {
             busyLock.leaveBusy();
         }
     }
 
     private CompletableFuture<?> createIndexLocally(
             long causalityToken,
-            int tableId,
-            TableIndexView tableIndexView,
-            TablesView tablesView
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor,
+            org.apache.ignite.internal.catalog.descriptors.IndexDescriptor catalogIndexDescriptor
     ) {
-        assert tableIndexView != null;
-
-        int indexId = tableIndexView.id();
+        int tableId = catalogTableDescriptor.id();
+        int indexId = catalogIndexDescriptor.id();
 
         LOG.trace("Creating local index: name={}, id={}, tableId={}, token={}",
-                tableIndexView.name(), indexId, tableId, causalityToken);
+                catalogIndexDescriptor.name(), indexId, tableId, causalityToken);
 
-        IndexDescriptor descriptor = newDescriptor(tableIndexView);
+        IndexDescriptor eventIndexDescriptor = toEventIndexDescriptor(catalogIndexDescriptor);

Review Comment:
   Do we have such a task? Current situation is very strange. I understand the purpose of having a catalog and a storage descriptor, but why do we need this one?



-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1219393134


##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorage.java:
##########
@@ -1007,4 +1020,18 @@ IndexMeta createIndexMetaForNewIndex(int indexId) {
             return sortedIndexes.get(indexId);
         });
     }
+
+    private static @Nullable TableIndexView findIndexView(TablesView tablesView, int indexId) {
+        return tablesView.indexes().stream()
+                .filter(tableIndexView -> indexId == tableIndexView.id())
+                .findFirst()
+                .orElse(null);
+    }
+
+    private static @Nullable TableView findTableView(TablesView tablesView, int tableId) {
+        return tablesView.tables().stream()
+                .filter(tableIndexView -> tableId == tableIndexView.id())

Review Comment:
   Fix it



-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1220965627


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexUtils.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.index;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Helper class for working with indexes.
+ */
+class IndexUtils {

Review Comment:
   Move it



-- 
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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1220957932


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -436,31 +436,39 @@ private CompletableFuture<?> onIndexCreate(ConfigurationNotificationEvent<TableI
         }
 
         try {
-            return createIndexLocally(evt.storageRevision(), tableId, evt.newValue(), evt.newValue(TablesView.class));
+            TablesView tablesView = evt.newValue(TablesView.class);
+
+            TableView tableView = findTableView(tableId, (NamedListView<TableView>) tablesView.tables());
+
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor = toTableDescriptor(tableView);
+            org.apache.ignite.internal.catalog.descriptors.IndexDescriptor catalogIndexDescriptor = toIndexDescriptor(indexConfig);
+
+            return createIndexLocally(evt.storageRevision(), catalogTableDescriptor, catalogIndexDescriptor);
         } finally {
             busyLock.leaveBusy();
         }
     }
 
     private CompletableFuture<?> createIndexLocally(
             long causalityToken,
-            int tableId,
-            TableIndexView tableIndexView,
-            TablesView tablesView
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor,

Review Comment:
   Just for clarity, for example, we have several index descriptors (storage, event, catalog), so as not to get confused, I think the prefix is enough.
   Also in the plans to get rid of the table configuration, so I think there will be several table descriptors.
   
   Do you want me to remove the **catalog*** prefix?



-- 
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


[GitHub] [ignite-3] sashapolo commented on a diff in pull request #2143: IGNITE-19646 Transform IndexManager to internally work against Catalog event types

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #2143:
URL: https://github.com/apache/ignite-3/pull/2143#discussion_r1221082188


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -436,31 +436,39 @@ private CompletableFuture<?> onIndexCreate(ConfigurationNotificationEvent<TableI
         }
 
         try {
-            return createIndexLocally(evt.storageRevision(), tableId, evt.newValue(), evt.newValue(TablesView.class));
+            TablesView tablesView = evt.newValue(TablesView.class);
+
+            TableView tableView = findTableView(tableId, (NamedListView<TableView>) tablesView.tables());
+
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor = toTableDescriptor(tableView);

Review Comment:
   I would propose to remove it, because IDEA's warnings are annoying



##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -436,31 +436,39 @@ private CompletableFuture<?> onIndexCreate(ConfigurationNotificationEvent<TableI
         }
 
         try {
-            return createIndexLocally(evt.storageRevision(), tableId, evt.newValue(), evt.newValue(TablesView.class));
+            TablesView tablesView = evt.newValue(TablesView.class);
+
+            TableView tableView = findTableView(tableId, (NamedListView<TableView>) tablesView.tables());
+
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor = toTableDescriptor(tableView);
+            org.apache.ignite.internal.catalog.descriptors.IndexDescriptor catalogIndexDescriptor = toIndexDescriptor(indexConfig);
+
+            return createIndexLocally(evt.storageRevision(), catalogTableDescriptor, catalogIndexDescriptor);
         } finally {
             busyLock.leaveBusy();
         }
     }
 
     private CompletableFuture<?> createIndexLocally(
             long causalityToken,
-            int tableId,
-            TableIndexView tableIndexView,
-            TablesView tablesView
+            org.apache.ignite.internal.catalog.descriptors.TableDescriptor catalogTableDescriptor,

Review Comment:
   yep



-- 
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