rpuch commented on code in PR #7273:
URL: https://github.com/apache/ignite-3/pull/7273#discussion_r2635189316
##########
modules/index/src/main/java/org/apache/ignite/internal/index/IndexBuildController.java:
##########
@@ -435,23 +458,63 @@ private void scheduleBuildIndexAfterDisasterRecovery(
MvTableStorage mvTableStorage,
long enlistmentConsistencyToken
) {
+ ZonePartitionId zonePartitionId = new ZonePartitionId(zoneId,
partitionId);
+ ZonePartitionResources resources =
partitionReplicaLifecycleManager.zonePartitionResourcesOrNull(zonePartitionId);
+ if (resources == null) {
+ // Already stopped/destroyed, ignore.
+ return;
+ }
+
MvPartitionStorage mvPartition = mvPartitionStorage(mvTableStorage,
zoneId, tableId, partitionId);
IndexStorage indexStorage = indexStorage(mvTableStorage, partitionId,
indexDescriptor);
+ @Nullable ReplicaTableSegment segment =
replicaTableSegment(zonePartitionId, tableId, resources, indexDescriptor);
+ if (segment == null) {
+ return;
+ }
+
indexBuilder.scheduleBuildIndexAfterDisasterRecovery(
zoneId,
tableId,
partitionId,
indexDescriptor.id(),
indexStorage,
mvPartition,
+ segment.txRwOperationTracker(),
+ segment.safeTime(),
localNode(),
enlistmentConsistencyToken,
clockService.current()
);
}
+ private static @Nullable ReplicaTableSegment replicaTableSegment(
+ ZonePartitionId zonePartitionId,
+ int tableId,
+ ZonePartitionResources resources,
+ CatalogIndexDescriptor indexDescriptor
+ ) {
+ CompletableFuture<ZonePartitionReplicaListener> replicaListenerFuture
= resources.replicaListenerFuture();
+ assert replicaListenerFuture.isDone() : "Replica listener future is
not done for [zonePartitionId=" + zonePartitionId + "].";
+
+ ZonePartitionReplicaListener replicaListener =
replicaListenerFuture.join();
+ @Nullable ReplicaTableSegment segment =
replicaListener.segmentFor(tableId);
Review Comment:
It's an artifact of IDE refactoring, but I liked it: it makes it clear that
it may be null
--
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]