Enable global checkpoint listeners to timeout#33620
Merged
jasontedor merged 5 commits intoelastic:masterfrom Sep 12, 2018
Merged
Enable global checkpoint listeners to timeout#33620jasontedor merged 5 commits intoelastic:masterfrom
jasontedor merged 5 commits intoelastic:masterfrom
Conversation
In cross-cluster replication, we will use global checkpoint listeners to long poll for updates to a shard. However, we do want these polls to wait indefinitely as it could be difficult to discern if the listener is still waiting for updates versus something has gone horribly wrong and cross-cluster replication is stuck. Instead, we want these listeners to timeout after some period (for example, one minute) so that they are notified and we can update status on the following side that cross-cluster replication is still active. After this, we will immediately enter back into a poll mode. To do this, we need the ability to associate a timeout with a global checkpoint listener. This commit adds this capability.
Collaborator
|
Pinging @elastic/es-distributed |
bleskes
approved these changes
Sep 12, 2018
Contributor
bleskes
left a comment
There was a problem hiding this comment.
LGTM. Left some nits to accept or reject.
server/src/main/java/org/elasticsearch/index/shard/GlobalCheckpointListeners.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/shard/GlobalCheckpointListeners.java
Outdated
Show resolved
Hide resolved
| logger.warn("error notifying global checkpoint listener of closed shard", caught); | ||
| } else { | ||
| assert e instanceof TimeoutException : e; | ||
| logger.warn("error notifying global checkpoint listener of timeout", caught); |
Contributor
There was a problem hiding this comment.
nit: why not just always log the exception (to serve as an indicator of what happened) and assert its either IndexShardCloseException or TimeoutException?
Member
Author
There was a problem hiding this comment.
I prefer it as since it's more explicit, and since your approach only saves two lines of code I'll stick with mine. 😇
Member
Author
|
Thanks @bleskes, will merge on green. |
dnhatn
approved these changes
Sep 12, 2018
| // guarded by this | ||
| private boolean closed; | ||
| private volatile List<GlobalCheckpointListener> listeners; | ||
| private volatile Map<GlobalCheckpointListener, ScheduledFuture<?>> listeners; |
Member
There was a problem hiding this comment.
afaics, all accesses to listeners are under lock, but I may miss something.
Member
Author
jasontedor
added a commit
that referenced
this pull request
Sep 12, 2018
In cross-cluster replication, we will use global checkpoint listeners to long poll for updates to a shard. However, we do not want these polls to wait indefinitely as it could be difficult to discern if the listener is still waiting for updates versus something has gone horribly wrong and cross-cluster replication is stuck. Instead, we want these listeners to timeout after some period (for example, one minute) so that they are notified and we can update status on the following side that cross-cluster replication is still active. After this, we will immediately enter back into a poll mode. To do this, we need the ability to associate a timeout with a global checkpoint listener. This commit adds this capability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In cross-cluster replication, we will use global checkpoint listeners to long poll for updates to a shard. However, we do not want these polls to wait indefinitely as it could be difficult to discern if the listener is still waiting for updates versus something has gone horribly wrong and cross-cluster replication is stuck. Instead, we want these listeners to timeout after some period (for example, one minute) so that they are notified and we can update status on the following side that cross-cluster replication is still active. After this, we will immediately enter back into a poll mode.
To do this, we need the ability to associate a timeout with a global checkpoint listener. This commit adds this capability.
Relates #32696