send request to release search context in finally block to be on the save side

This commit is contained in:
Britta Weber 2015-05-31 12:48:56 +02:00
parent 7a082cea4f
commit ff119f3dff
2 changed files with 16 additions and 10 deletions

View File

@ -104,12 +104,15 @@ public class TransportSearchDfsQueryAndFetchAction extends TransportSearchTypeAc
@Override
public void onFailure(Throwable t) {
try {
onSecondPhaseFailure(t, querySearchRequest, shardIndex, dfsResult, counter);
} finally {
// the query might not have been executed at all (for example because thread pool rejected execution)
// and the search context that was created in dfs phase might not be released.
// release it again to be in the safe side
sendReleaseSearchContext(querySearchRequest.id(), node);
}
}
});
}

View File

@ -113,12 +113,15 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA
@Override
public void onFailure(Throwable t) {
try {
onQueryFailure(t, querySearchRequest, shardIndex, dfsResult, counter);
} finally {
// the query might not have been executed at all (for example because thread pool rejected execution)
// and the search context that was created in dfs phase might not be released.
// release it again to be in the safe side
sendReleaseSearchContext(querySearchRequest.id(), node);
}
}
});
}