tkalkirill commented on code in PR #2500:
URL: https://github.com/apache/ignite-3/pull/2500#discussion_r1313813464


##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java:
##########
@@ -410,21 +394,18 @@ private void startIndexes() {
         int catalogVersion = catalogManager.latestCatalogVersion();
         long causalityToken = recoveryFinishedFuture.join();
 
-        NamedListView<TableView> tableListView = tablesCfg.tables().value();
-
         List<CompletableFuture<?>> startIndexFutures = new ArrayList<>();
 
         for (CatalogIndexDescriptor index : 
catalogManager.indexes(catalogVersion)) {
-            CatalogTableDescriptor table = 
catalogManager.table(index.tableId(), catalogVersion);
+            int tableId = index.tableId();
 
-            assert table != null : "tableId=" + index.tableId() + ", indexId=" 
+ index.id();
+            CatalogTableDescriptor table = catalogManager.table(tableId, 
catalogVersion);
 
-            // TODO: IGNITE-19499 Only catalog should be used
-            int configTableId = getConfigTableId(table.name(), tableListView);
+            assert table != null : "tableId=" + tableId + ", indexId=" + 
index.id();
 
-            CompletableFuture<?> fireCreateIndexEventFuture = 
fireCreateIndexEvent(index, causalityToken, configTableId);
+            CompletableFuture<?> fireCreateIndexEventFuture = 
fireCreateIndexEvent(index, causalityToken, tableId);

Review Comment:
   I looked at the opportunity to get rid of this, I realized that I need to 
make quite a few changes for this, I propose to do it in IGNITE-20339.



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -502,54 +465,44 @@ public TableManager(
 
         indexBuilder = new IndexBuilder(nodeName, cpus);
 
-        configuredTablesCache = new ConfiguredTablesCache(tablesCfg, 
getMetadataLocallyOnly);
-
         raftCommandsMarshaller = new 
ThreadLocalPartitionCommandsMarshaller(clusterService.serializationRegistry());
 
         startVv = new IncrementalVersionedValue<>(registry);
     }
 
     @Override
     public void start() {
-        mvGc.start();
+        inBusyLock(busyLock, () -> {
+            mvGc.start();
 
-        lowWatermark.start();
+            lowWatermark.start();
 
-        fireCreateTablesOnManagerStart();
+            startTables();
 
-        
metaStorageMgr.registerPrefixWatch(ByteArray.fromString(PENDING_ASSIGNMENTS_PREFIX),
 pendingAssignmentsRebalanceListener);
-        
metaStorageMgr.registerPrefixWatch(ByteArray.fromString(STABLE_ASSIGNMENTS_PREFIX),
 stableAssignmentsRebalanceListener);
-        
metaStorageMgr.registerPrefixWatch(ByteArray.fromString(ASSIGNMENTS_SWITCH_REDUCE_PREFIX),
 assignmentsSwitchRebalanceListener);
+            
metaStorageMgr.registerPrefixWatch(ByteArray.fromString(PENDING_ASSIGNMENTS_PREFIX),
 pendingAssignmentsRebalanceListener);
+            
metaStorageMgr.registerPrefixWatch(ByteArray.fromString(STABLE_ASSIGNMENTS_PREFIX),
 stableAssignmentsRebalanceListener);
+            
metaStorageMgr.registerPrefixWatch(ByteArray.fromString(ASSIGNMENTS_SWITCH_REDUCE_PREFIX),
 assignmentsSwitchRebalanceListener);
 
-        tablesCfg.tables().listenElements(new 
ConfigurationNamedListListener<>() {
-            @Override
-            public CompletableFuture<?> 
onCreate(ConfigurationNotificationEvent<TableView> ctx) {
-                return onTableCreate(ctx);
-            }
+            catalogService.listen(CatalogEvent.TABLE_CREATE, (parameters, 
exception) -> {
+                assert exception == null : parameters;
 
-            @Override
-            public CompletableFuture<?> 
onRename(ConfigurationNotificationEvent<TableView> ctx) {
-                // TODO: IGNITE-15485 Support table rename operation.
+                return onTableCreate((CreateTableEventParameters) 
parameters).thenApply(unused -> false);
+            });
 
-                return completedFuture(null);
-            }
+            catalogService.listen(CatalogEvent.TABLE_DROP, (parameters, 
exception) -> {
+                assert exception == null : parameters;
 
-            @Override
-            public CompletableFuture<?> 
onDelete(ConfigurationNotificationEvent<TableView> ctx) {
-                return onTableDelete(ctx);
-            }
-        });
+                return onTableDelete(((DropTableEventParameters) 
parameters)).thenApply(unused -> false);
+            });
 
-        schemaManager.listen(SchemaEvent.CREATE, new EventListener<>() {
-            @Override
-            public CompletableFuture<Boolean> notify(SchemaEventParameters 
parameters, @Nullable Throwable exception) {
+            schemaManager.listen(SchemaEvent.CREATE, (parameters, exception) 
-> inBusyLockAsync(busyLock, () -> {

Review Comment:
   I looked at the opportunity to get rid of this, I realized that I need to 
make quite a few changes for this, I propose to do it in IGNITE-20339.



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