ibessonov commented on code in PR #2783:
URL: https://github.com/apache/ignite-3/pull/2783#discussion_r1381551894
##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexAvailabilityController.java:
##########
@@ -130,6 +150,31 @@ public void close() {
busyLock.block();
}
+ /**
+ * Recovers index availability on node recovery.
+ *
+ * @param recoveryRevision Metastore revision on recovery.
+ * @return Future of recovery execution.
+ */
+ public CompletableFuture<Void> recover(long recoveryRevision) {
+ return inBusyLockAsync(busyLock, () -> {
+ // It is expected that the method will only be called on recovery,
when the deploy of metastore watches has not yet occurred.
+ int catalogVersion = catalogManager.latestCatalogVersion();
+
+ List<CompletableFuture<?>> futures =
catalogManager.indexes(catalogVersion).stream()
+ .map(indexDescriptor -> {
+ if (indexDescriptor.available()) {
+ return
recoveryForAvailableIndexBusy(indexDescriptor, recoveryRevision);
+ } else {
+ return
recoveryForRegisteredIndexBusy(indexDescriptor, recoveryRevision,
catalogVersion);
+ }
+ })
+ .collect(toList());
+
+ return allOf(futures.toArray(CompletableFuture[]::new));
Review Comment:
On recovery, we will wait until this future is completed, right? I don't
think this it is a good decision. Is it really necessary?
##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexAvailabilityController.java:
##########
@@ -96,7 +98,25 @@
* prefix {@link IndexManagementUtils#PARTITION_BUILD_INDEX_KEY_PREFIX} is
made by the whole cluster (and only one node makes a write to
* the metastore) as these events are global, but only one node (a primary
replica owning a partition) handles
* {@link IndexBuildCompletionListener#onBuildCompletion} (form {@link
IndexBuilder#listen}) event.</li>
- * <li>Restoring index availability occurs in {@link
IndexAvailabilityControllerRestorer}.</li>
+ * <li>Restoring index availability occurs in {@link #recover(long)}.</li>
+ * </ul>
+ *
+ * <p>Approximate recovery algorithm:</p>
Review Comment:
Are we doing it on every single node for every single index?
--
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]