vldpyatkov commented on a change in pull request #399:
URL: https://github.com/apache/ignite-3/pull/399#discussion_r733584706
##########
File path:
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
##########
@@ -199,144 +195,199 @@ public TableManager(
listenElements(new ConfigurationNamedListListener<TableView>() {
@Override
public @NotNull CompletableFuture<?> onCreate(@NotNull
ConfigurationNotificationEvent<TableView> ctx) {
- // Empty assignments might be a valid case if tables are
created from within cluster init HOCON
- // configuration, which is not supported now.
- assert ((ExtendedTableView)ctx.newValue()).assignments() !=
null :
- "Table =[" + ctx.newValue().name() + "] has empty
assignments.";
-
- final IgniteUuid tblId =
IgniteUuid.fromString(((ExtendedTableView)ctx.newValue()).id());
-
- // TODO: IGNITE-15409 Listener with any placeholder should be
used instead.
-
((ExtendedTableConfiguration)tablesCfg.tables().get(ctx.newValue().name())).schemas().
- listenElements(new ConfigurationNamedListListener<>() {
- @Override public @NotNull CompletableFuture<?>
onCreate(
- @NotNull
ConfigurationNotificationEvent<SchemaView> schemasCtx) {
- try {
-
((SchemaRegistryImpl)tables.get(ctx.newValue().name()).schemaView()).
- onSchemaRegistered(
-
SchemaSerializerImpl.INSTANCE.deserialize((schemasCtx.newValue().schema()))
- );
+ if (!busyLock.enterBusy()) {
+ String tblName = ctx.newValue().name();
+ IgniteUuid tblId =
IgniteUuid.fromString(((ExtendedTableView)ctx.newValue()).id());
+
+ fireEvent(TableEvent.CREATE,
+ new TableEventParameters(tblId, tblName),
+ new NodeStoppingException("Operation has been
cancelled (node is stopping)."));
+ }
+ try {
+ onTableCreateInternal(ctx);
+ }
+ finally {
+ busyLock.leaveBusy();
+ }
- fireEvent(TableEvent.ALTER, new
TableEventParameters(tablesById.get(tblId)), null);
+ return CompletableFuture.completedFuture(null);
+ }
+
+ /**
+ * Method for handle a table configuration event.
+ *
+ * @param ctx Configuration event.
+ */
+ private void onTableCreateInternal(@NotNull
ConfigurationNotificationEvent<TableView> ctx) {
+ String tblName = ctx.newValue().name();
+ IgniteUuid tblId =
IgniteUuid.fromString(((ExtendedTableView)ctx.newValue()).id());
+
+ // Empty assignments might be a valid case if tables are
created from within cluster init HOCON
+ // configuration, which is not supported now.
+ assert ((ExtendedTableView)ctx.newValue()).assignments()
!= null :
+ LoggerMessageHelper.format("Table [id={}, name={}] has
empty assignments.", tblId, tblName);
+
+ // TODO: IGNITE-15409 Listener with any placeholder should
be used instead.
+
((ExtendedTableConfiguration)tablesCfg.tables().get(tblName)).schemas().
+ listenElements(new ConfigurationNamedListListener<>() {
+ @Override public @NotNull CompletableFuture<?>
onCreate(
+ @NotNull
ConfigurationNotificationEvent<SchemaView> schemasCtx) {
+ if (!busyLock.enterBusy()) {
+ fireEvent(TableEvent.ALTER, new
TableEventParameters(tblId, tblName),
+ new NodeStoppingException("Operation
has been cancelled (node is stopping)."));
+ }
+ try {
Review comment:
Fixed.
--
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]