denis-chudov commented on code in PR #838:
URL: https://github.com/apache/ignite-3/pull/838#discussion_r886701394
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -502,23 +502,19 @@ private void dropTableLocally(long causalityToken, String
name, UUID tblId, List
raftMgr.stopRaftGroup(raftGroupName(tblId, p));
}
- AtomicReference<TableImpl> tableHolder = new AtomicReference<>();
-
tablesByIdVv.update(causalityToken, (previousVal, e) -> {
if (e != null) {
return failedFuture(e);
}
var map = new HashMap<>(previousVal);
- TableImpl table = map.remove(tblId);
-
- tableHolder.set(table);
+ map.remove(tblId);
return completedFuture(map);
});
- TableImpl table = tableHolder.get();
+ TableImpl table = tablesByIdVv.latest().get(tblId);
assert table != null : "There is no table with the name specified
[name=" + name + ']';
Review Comment:
is it correct text for assertion error? I suggest to at least add a table id
here.
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -461,14 +465,10 @@ private CompletableFuture<?> createTableLocally(long
causalityToken, String name
return completedFuture(val);
});
- // TODO should be reworked in IGNITE-16763
- return tablesByIdVv.get(causalityToken)
- .thenCompose(v -> schemaFut)
- .thenRun(() -> {
- fireEvent(TableEvent.CREATE, new
TableEventParameters(causalityToken, table), null);
+ schemaFut.thenRun(() -> fireEvent(TableEvent.CREATE, new
TableEventParameters(causalityToken, table), null));
Review Comment:
seems that now there is no need in creating the variable like schemaFut
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImpl.java:
##########
@@ -76,7 +76,11 @@ public SqlSchemaManagerImpl(
return newCalciteSchema;
});
- calciteSchemaVv.whenComplete((token, schema, e) ->
listeners.forEach(SchemaUpdateListener::onSchemaUpdated));
+ calciteSchemaVv.whenComplete((token, schema, e) -> {
Review Comment:
I'd rather you complete `calciteSchemaVv` after completion of `schemasVv` to
provide clear sequence.
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -192,12 +191,6 @@ public TableManager(
clusterNodeResolver = topologyService::getByAddress;
tablesByIdVv = new VersionedValue<>(null, HashMap::new);
-
- this.schemaManager.listen(SchemaEvent.COMPLETE, (parameters, e) -> {
Review Comment:
`SchemaEvent.COMPLETE` is never used anymore.
--
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]