tkalkirill commented on code in PR #3216: URL: https://github.com/apache/ignite-3/pull/3216#discussion_r1491993055
########## modules/index/src/main/java/org/apache/ignite/internal/index/IndexTaskManager.java: ########## @@ -0,0 +1,207 @@ +/* + * 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.index; + +import static java.util.concurrent.CompletableFuture.failedFuture; +import static org.apache.ignite.internal.index.IndexManagementUtils.isLocalNode; +import static org.apache.ignite.internal.util.CompletableFutures.falseCompletedFuture; +import static org.apache.ignite.internal.util.IgniteUtils.inBusyLock; + +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Consumer; +import org.apache.ignite.internal.catalog.CatalogManager; +import org.apache.ignite.internal.catalog.CatalogService; +import org.apache.ignite.internal.catalog.descriptors.CatalogIndexDescriptor; +import org.apache.ignite.internal.catalog.descriptors.CatalogIndexStatus; +import org.apache.ignite.internal.catalog.events.CatalogEvent; +import org.apache.ignite.internal.catalog.events.CreateIndexEventParameters; +import org.apache.ignite.internal.catalog.events.RemoveIndexEventParameters; +import org.apache.ignite.internal.catalog.events.StoppingIndexEventParameters; +import org.apache.ignite.internal.close.ManuallyCloseable; +import org.apache.ignite.internal.event.EventListener; +import org.apache.ignite.internal.event.EventParameters; +import org.apache.ignite.internal.network.ClusterService; +import org.apache.ignite.internal.placementdriver.PlacementDriver; +import org.apache.ignite.internal.placementdriver.ReplicaMeta; +import org.apache.ignite.internal.placementdriver.event.PrimaryReplicaEvent; +import org.apache.ignite.internal.placementdriver.event.PrimaryReplicaEventParameters; +import org.apache.ignite.internal.replicator.TablePartitionId; +import org.apache.ignite.internal.util.IgniteSpinBusyLock; + +/** + * Component that reacts to certain Catalog changes and starts or stops corresponding {@link ChangeIndexStatusTask}s via the + * {@link ChangeIndexStatusTaskScheduler}. + * + * <p>Tasks will be started only if the local node is the primary replica for the {@code 0} partition of the table which indexes have been + * modified in the Catalog. + * + * <p>The following events are being monitored: + * <ul> + * <li>{@link CatalogEvent#INDEX_CREATE} - when an index is created, a task will be started to move the index to the + * {@link CatalogIndexStatus#BUILDING} state; </li> Review Comment: In `onIndexDropped` you add a task, in `onIndexRemoved` you stop it. It turns out to be fairer then in `onIndexCreated` to add a task and in `onIndexStartBuilding` (does not exist yet) to stop it and describe it in the javadoc. Or am I wrong somewhere? which is not possible =) -- 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]
