Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix off-by-one in testDoesNotSubmitRerouteTaskTooFrequently #68316

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected void updateIndicesReadOnly(Set<String> indicesToMarkReadOnly, ActionLi
builder = ImmutableOpenMap.builder();
builder.put("node1", new DiskUsage("node1","node1", "/foo/bar", 100, 4));
builder.put("node2", new DiskUsage("node2","node2", "/foo/bar", 100, 5));
currentTime.addAndGet(randomLongBetween(60001, 120000));
currentTime.addAndGet(randomLongBetween(60000, 120000));
monitor.onNewInfo(clusterInfo(builder.build()));
assertTrue(reroute.get());
assertEquals(new HashSet<>(Arrays.asList("test_1", "test_2")), indices.get());
Expand Down Expand Up @@ -201,7 +201,7 @@ protected void updateIndicesReadOnly(Set<String> indicesToMarkReadOnly, ActionLi

// should reroute again when one disk is still over the watermark
currentTime.addAndGet(randomLongBetween(
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis() + 1, 120000));
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis(), 120000));
monitor.onNewInfo(clusterInfo(oneDiskAboveWatermark));
assertNotNull(listenerReference.get());
final ActionListener<ClusterState> rerouteListener1 = listenerReference.getAndSet(null);
Expand All @@ -217,14 +217,14 @@ protected void updateIndicesReadOnly(Set<String> indicesToMarkReadOnly, ActionLi
if (randomBoolean()) {
// should not re-route again within the reroute interval
currentTime.addAndGet(randomLongBetween(0,
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis()));
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis() - 1));
monitor.onNewInfo(clusterInfo(allDisksOk));
assertNull(listenerReference.get());
}

// should reroute again after the reroute interval
currentTime.addAndGet(randomLongBetween(
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis() + 1, 120000));
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis(), 120000));
monitor.onNewInfo(clusterInfo(allDisksOk));
assertNotNull(listenerReference.get());
listenerReference.getAndSet(null).onResponse(null);
Expand All @@ -241,7 +241,7 @@ protected void updateIndicesReadOnly(Set<String> indicesToMarkReadOnly, ActionLi
final ImmutableOpenMap<ClusterInfo.NodeAndPath, ClusterInfo.ReservedSpace> reservedSpaces = builder.build();

currentTime.addAndGet(randomLongBetween(
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis() + 1, 120000));
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis(), 120000));
monitor.onNewInfo(clusterInfo(allDisksOk, reservedSpaces));
assertNotNull(listenerReference.get());
listenerReference.getAndSet(null).onResponse(null);
Expand Down