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

Make remote setting updates support diff strategies #47891

Merged
merged 25 commits into from
Oct 24, 2019
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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 @@ -45,6 +45,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.BiFunction;
Expand Down Expand Up @@ -236,7 +237,23 @@ private synchronized void updateSkipUnavailable(String clusterAlias, Boolean ski

@Override
protected void updateRemoteCluster(String clusterAlias, Settings settings) {
updateRemoteCluster(clusterAlias, settings, noopListener);
if (remoteClusters.containsKey(clusterAlias) == false) {
CountDownLatch latch = new CountDownLatch(1);
updateRemoteCluster(clusterAlias, settings, ActionListener.wrap(latch::countDown));

try {
// Wait 10 seconds for a new connection. We must use a latch instead of a future because we
// are on the cluster state thread and our custom future implementation will throw an
// assertion.
if (latch.await(10, TimeUnit.SECONDS) == false) {
logger.warn("failed to connect to updated remote cluster {} within {}", clusterAlias, TimeValue.timeValueSeconds(3));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

failed to connect to new remote cluster

also note that you're using 3 seconds in the message here 🗡

}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
} else {
updateRemoteCluster(clusterAlias, settings, noopListener);
}
}

/**
Expand Down