Skip to content

Commit

Permalink
Ignore closed exception on refresh pending location listener
Browse files Browse the repository at this point in the history
This newly added listener should catch closed exceptions when
accessing the internal engine.

Closes elastic#55792
  • Loading branch information
jimczi committed Apr 27, 2020
1 parent 25cea2f commit d7fcca7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3222,12 +3222,17 @@ private class RefreshPendingLocationListener implements ReferenceManager.Refresh

@Override
public void beforeRefresh() {
lastWriteLocation = getEngine().getTranslogLastWriteLocation();
try {
lastWriteLocation = getEngine().getTranslogLastWriteLocation();
} catch (AlreadyClosedException exc) {
// shard is closed - no location is fine
lastWriteLocation = null;
}
}

@Override
public void afterRefresh(boolean didRefresh) {
if (didRefresh) {
if (didRefresh && lastWriteLocation != null) {
pendingRefreshLocation.updateAndGet(pendingLocation -> {
if (pendingLocation == null || pendingLocation.compareTo(lastWriteLocation) <= 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ public void testTermsAggregation() throws Exception {
}
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/55792")
public void testRestartAfterCompletion() throws Exception {
final AsyncSearchResponse initial;
try (SearchResponseIterator it =
Expand Down Expand Up @@ -208,7 +207,6 @@ public void testDeleteCleanupIndex() throws Exception {
ensureTaskRemoval(response.getId());
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/55792")
public void testCleanupOnFailure() throws Exception {
final AsyncSearchResponse initial;
try (SearchResponseIterator it =
Expand Down

0 comments on commit d7fcca7

Please sign in to comment.