korlov42 commented on code in PR #5113: URL: https://github.com/apache/ignite-3/pull/5113#discussion_r1930429861
########## modules/catalog/src/main/java/org/apache/ignite/internal/catalog/UpdateContext.java: ########## @@ -0,0 +1,66 @@ +/* + * 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.catalog; + +import java.util.HashSet; +import java.util.Set; +import java.util.function.Function; +import org.jetbrains.annotations.Nullable; + +/** + * Context contains the catalog to be updated. + * It is used by {@link BulkUpdateProducer} when executing a batch of catalog commands Review Comment: ```suggestion * Context contains the catalog to be updated. * * <p>It is used by {@link BulkUpdateProducer} when executing a batch of catalog commands ``` Besides, javadoc is not quite correct. It states context is used in BulkUpdateProducer, but in fact it used for every update producer ########## modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CreateTableCommand.java: ########## @@ -142,6 +144,8 @@ public List<UpdateEntry> get(Catalog catalog) { storageProfile ); + updateContext.registerTableCreation(tableId); Review Comment: personally, I don't like the idea of maintaining a particular in one command to use in another. It must be done automatically outside of command processing. The simplest way to address the issue is to keep two different versions of catalog: base one and current one. Base version should be used in CreateIndexCommand to make sure table wasn't presented before, while current is used to apply update entries. Another option is to analyze UpdateEntries produced -- 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]
