sergeyuttsel commented on code in PR #1729:
URL: https://github.com/apache/ignite-3/pull/1729#discussion_r1163726630
##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java:
##########
@@ -505,6 +543,148 @@ public int getZoneId(String name) {
}
}
+ /**
+ * The method for obtaining the data nodes of the specified zone.
+ * If {@link
DistributionZoneConfigurationSchema#dataNodesAutoAdjustScaleUp} and
+ * {@link
DistributionZoneConfigurationSchema#dataNodesAutoAdjustScaleDown} are immediate
then it waits that the data nodes
+ * are up-to-date for the passed topology version.
+ *
+ * <p>If the values of auto adjust scale up and auto adjust scale down are
zero, then on the cluster topology changes
+ * the data nodes for the zone should be updated immediately. Therefore,
this method must return the data nodes which is calculated
+ * based on the topology with passed or greater version. Since the date
nodes value is updated asynchronously, this method waits for
+ * the date nodes to be updated with new nodes in the topology if the
value of auto adjust scale up is 0. And also waits for
+ * the date nodes to be updated with nodes that have left the topology if
the value of auto adjust scale down is 0.
+ * After the zone manager has observed the logical topology change and the
data nodes value is updated according to cluster topology,
+ * then this method completes the returned future with the current value
of data nodes.
+ *
+ * <p>If the value of auto adjust scale up is greater than zero, then it
is not necessary to wait for the data nodes update triggered
+ * by new nodes in cluster topology. Similarly if the value of auto adjust
scale down is greater than zero, then it is not necessary to
+ * wait for the data nodes update triggered by new nodes that have left
the topology in cluster topology.
+ *
+ * <p>The returned future can be completed with {@link
DistributionZoneNotFoundException} and
+ * {@link DistributionZoneWasRemovedException} in case when the
distribution zone was removed during method execution.
+ *
+ * @param zoneId Zone id.
+ * @param topVer Topology version.
+ * @return The data nodes future which will be completed with data nodes
for the zoneId or with exception.
+ */
+ public CompletableFuture<Set<String>> topologyVersionedDataNodes(int
zoneId, long topVer) {
+ CompletableFuture<IgniteBiTuple<Boolean, Boolean>> timerValuesFut =
awaitTopologyVersion(topVer)
+ .thenCompose(ignored -> getImmediateTimers(zoneId));
+
+ return allOf(
+ timerValuesFut.thenCompose(timerValues ->
scaleUpAwaiting(zoneId, timerValues.get1())),
+ timerValuesFut.thenCompose(timerValues ->
scaleDownAwaiting(zoneId, timerValues.get2()))
+ ).thenCompose(ignored -> getDataNodesFuture(zoneId));
+ }
+
+ /**
+ * Waits for DistributionZoneManager waits for observing passed topology
version or greater version
Review Comment:
fixed.
--
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]