ibessonov commented on code in PR #6730:
URL: https://github.com/apache/ignite-3/pull/6730#discussion_r2418973945


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -3329,6 +3340,13 @@ private CompletableFuture<Void> recoverTables(long 
recoveryRevision, @Nullable H
                             tableDescriptor,
                             schemaDescriptor
                     );
+
+                    if (destroyTableEventFired) {
+                        // prepareTableResourcesOnRecovery registers a table 
metric source, so we need to unregister it here,
+                        // just because the table is being dropped and there 
is no need to keep the metric source.
+                        QualifiedName tableName = 
QualifiedNameHelper.fromNormalized(schemaDescriptor.name(), 
tableDescriptor.name());
+                        
metricManager.unregisterSource(TableMetricSource.sourceName(tableName));

Review Comment:
   There are also storage engine metrics that I added recently. Please consider 
extracting this code into a method, and to unregister other sources too. And 
please handle a potential exception from `unregisterSource`. Too bad it's 
unchecked



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -3307,9 +3318,9 @@ private CompletableFuture<Void> recoverTables(long 
recoveryRevision, @Nullable H
                 // Handle missed table drop event.
                 int tableId = tableDescriptor.id();
 
+                boolean destroyTableEventFired = false;

Review Comment:
   ```suggestion
                   boolean destroyTableEventFired = nextCatalog != null && 
nextCatalog.table(tableId) == null;
   ```



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -3307,9 +3318,9 @@ private CompletableFuture<Void> recoverTables(long 
recoveryRevision, @Nullable H
                 // Handle missed table drop event.
                 int tableId = tableDescriptor.id();
 
+                boolean destroyTableEventFired = false;

Review Comment:
   Or something like that. Having a `foo = true` inside of an `if` looks weird 
to me



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