rpuch commented on code in PR #2756: URL: https://github.com/apache/ignite-3/pull/2756#discussion_r1375778678
########## modules/index/src/main/java/org/apache/ignite/internal/index/IndexAvailabilityControllerRestorer.java: ########## @@ -0,0 +1,254 @@ +/* + * 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.allOf; +import static java.util.concurrent.CompletableFuture.completedFuture; +import static java.util.stream.Collectors.toList; +import static org.apache.ignite.internal.index.IndexManagementUtils.getPartitionCountFromCatalog; +import static org.apache.ignite.internal.index.IndexManagementUtils.inProgressBuildIndexMetastoreKey; +import static org.apache.ignite.internal.index.IndexManagementUtils.isLeaseExpire; +import static org.apache.ignite.internal.index.IndexManagementUtils.isMetastoreKeyAbsentLocally; +import static org.apache.ignite.internal.index.IndexManagementUtils.isMetastoreKeysPresentLocally; +import static org.apache.ignite.internal.index.IndexManagementUtils.makeIndexAvailableInCatalogWithoutFuture; +import static org.apache.ignite.internal.index.IndexManagementUtils.partitionBuildIndexMetastoreKey; +import static org.apache.ignite.internal.index.IndexManagementUtils.partitionBuildIndexMetastoreKeyPrefix; +import static org.apache.ignite.internal.index.IndexManagementUtils.putBuildIndexMetastoreKeysIfAbsent; +import static org.apache.ignite.internal.index.IndexManagementUtils.removeMetastoreKeyIfPresent; +import static org.apache.ignite.internal.util.IgniteUtils.inBusyLockAsync; + +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.ignite.internal.catalog.CatalogManager; +import org.apache.ignite.internal.catalog.commands.MakeIndexAvailableCommand; +import org.apache.ignite.internal.catalog.descriptors.CatalogIndexDescriptor; +import org.apache.ignite.internal.close.ManuallyCloseable; +import org.apache.ignite.internal.hlc.HybridClock; +import org.apache.ignite.internal.lang.ByteArray; +import org.apache.ignite.internal.logger.IgniteLogger; +import org.apache.ignite.internal.logger.Loggers; +import org.apache.ignite.internal.metastorage.Entry; +import org.apache.ignite.internal.metastorage.MetaStorageManager; +import org.apache.ignite.internal.placementdriver.PlacementDriver; +import org.apache.ignite.internal.replicator.TablePartitionId; +import org.apache.ignite.internal.storage.index.IndexStorage; +import org.apache.ignite.internal.util.Cursor; +import org.apache.ignite.internal.util.IgniteSpinBusyLock; +import org.apache.ignite.network.ClusterNode; +import org.apache.ignite.network.ClusterService; + +/** + * Component responsible for restoring the algorithm from {@link IndexAvailabilityController} if a node fails at some step. + * + * <p>Approximate recovery algorithm:</p> + * <ul> + * <li>For registered indexes: <ul> + * <li>If the new index did not have time to add + * {@link IndexManagementUtils#putBuildIndexMetastoreKeysIfAbsent(MetaStorageManager, int, int) index building keys}, then add them Review Comment: In the first item it's enough to just name one key (the one about the index as a whole), others are always added with it. -- 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]
