Ignore closed exception on refresh pending location listener (#55799)
This newly added listener should catch closed exceptions when accessing the internal engine. Closes #55792
This commit is contained in:
parent
abab4c4d4f
commit
b5916ac455
|
@ -3288,12 +3288,17 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
|||
|
||||
@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;
|
||||
|
|
Loading…
Reference in New Issue