handle also illegal state case to see if OOM happened within the index writer
This commit is contained in:
parent
6444335f06
commit
721f315210
|
@ -359,6 +359,11 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
} catch (OutOfMemoryError e) {
|
} catch (OutOfMemoryError e) {
|
||||||
failEngine(e);
|
failEngine(e);
|
||||||
throw new CreateFailedEngineException(shardId, create, e);
|
throw new CreateFailedEngineException(shardId, create, e);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
if (e.getMessage().contains("OutOfMemoryError")) {
|
||||||
|
failEngine(e);
|
||||||
|
}
|
||||||
|
throw new CreateFailedEngineException(shardId, create, e);
|
||||||
} finally {
|
} finally {
|
||||||
rwl.readLock().unlock();
|
rwl.readLock().unlock();
|
||||||
}
|
}
|
||||||
|
@ -478,6 +483,11 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
} catch (OutOfMemoryError e) {
|
} catch (OutOfMemoryError e) {
|
||||||
failEngine(e);
|
failEngine(e);
|
||||||
throw new IndexFailedEngineException(shardId, index, e);
|
throw new IndexFailedEngineException(shardId, index, e);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
if (e.getMessage().contains("OutOfMemoryError")) {
|
||||||
|
failEngine(e);
|
||||||
|
}
|
||||||
|
throw new IndexFailedEngineException(shardId, index, e);
|
||||||
} finally {
|
} finally {
|
||||||
rwl.readLock().unlock();
|
rwl.readLock().unlock();
|
||||||
}
|
}
|
||||||
|
@ -593,6 +603,11 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
} catch (OutOfMemoryError e) {
|
} catch (OutOfMemoryError e) {
|
||||||
failEngine(e);
|
failEngine(e);
|
||||||
throw new DeleteFailedEngineException(shardId, delete, e);
|
throw new DeleteFailedEngineException(shardId, delete, e);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
if (e.getMessage().contains("OutOfMemoryError")) {
|
||||||
|
failEngine(e);
|
||||||
|
}
|
||||||
|
throw new DeleteFailedEngineException(shardId, delete, e);
|
||||||
} finally {
|
} finally {
|
||||||
rwl.readLock().unlock();
|
rwl.readLock().unlock();
|
||||||
}
|
}
|
||||||
|
@ -757,6 +772,14 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
}
|
}
|
||||||
} catch (AlreadyClosedException e) {
|
} catch (AlreadyClosedException e) {
|
||||||
// an index writer got replaced on us, ignore
|
// an index writer got replaced on us, ignore
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
failEngine(e);
|
||||||
|
throw new RefreshFailedEngineException(shardId, e);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
if (e.getMessage().contains("OutOfMemoryError")) {
|
||||||
|
failEngine(e);
|
||||||
|
}
|
||||||
|
throw new RefreshFailedEngineException(shardId, e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (indexWriter == null) {
|
if (indexWriter == null) {
|
||||||
throw new EngineClosedException(shardId, failedEngine);
|
throw new EngineClosedException(shardId, failedEngine);
|
||||||
|
@ -765,9 +788,6 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
} else {
|
} else {
|
||||||
throw new RefreshFailedEngineException(shardId, e);
|
throw new RefreshFailedEngineException(shardId, e);
|
||||||
}
|
}
|
||||||
} catch (OutOfMemoryError e) {
|
|
||||||
failEngine(e);
|
|
||||||
throw new RefreshFailedEngineException(shardId, e);
|
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
rwl.readLock().unlock();
|
rwl.readLock().unlock();
|
||||||
|
@ -821,11 +841,16 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
current.markForClose();
|
current.markForClose();
|
||||||
|
|
||||||
refreshVersioningTable(threadPool.estimatedTimeInMillis());
|
refreshVersioningTable(threadPool.estimatedTimeInMillis());
|
||||||
} catch (Exception e) {
|
|
||||||
throw new FlushFailedEngineException(shardId, e);
|
|
||||||
} catch (OutOfMemoryError e) {
|
} catch (OutOfMemoryError e) {
|
||||||
failEngine(e);
|
failEngine(e);
|
||||||
throw new FlushFailedEngineException(shardId, e);
|
throw new FlushFailedEngineException(shardId, e);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
if (e.getMessage().contains("OutOfMemoryError")) {
|
||||||
|
failEngine(e);
|
||||||
|
}
|
||||||
|
throw new FlushFailedEngineException(shardId, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new FlushFailedEngineException(shardId, e);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
rwl.writeLock().unlock();
|
rwl.writeLock().unlock();
|
||||||
|
@ -866,13 +891,18 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
// when tans overrides it
|
// when tans overrides it
|
||||||
translog.makeTransientCurrent();
|
translog.makeTransientCurrent();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
translog.revertTransient();
|
|
||||||
throw new FlushFailedEngineException(shardId, e);
|
|
||||||
} catch (OutOfMemoryError e) {
|
} catch (OutOfMemoryError e) {
|
||||||
translog.revertTransient();
|
translog.revertTransient();
|
||||||
failEngine(e);
|
failEngine(e);
|
||||||
throw new FlushFailedEngineException(shardId, e);
|
throw new FlushFailedEngineException(shardId, e);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
if (e.getMessage().contains("OutOfMemoryError")) {
|
||||||
|
failEngine(e);
|
||||||
|
}
|
||||||
|
throw new FlushFailedEngineException(shardId, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
translog.revertTransient();
|
||||||
|
throw new FlushFailedEngineException(shardId, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -931,11 +961,16 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
((EnableMergePolicy) indexWriter.getConfig().getMergePolicy()).enableMerge();
|
((EnableMergePolicy) indexWriter.getConfig().getMergePolicy()).enableMerge();
|
||||||
}
|
}
|
||||||
indexWriter.maybeMerge();
|
indexWriter.maybeMerge();
|
||||||
} catch (Exception e) {
|
|
||||||
throw new OptimizeFailedEngineException(shardId, e);
|
|
||||||
} catch (OutOfMemoryError e) {
|
} catch (OutOfMemoryError e) {
|
||||||
failEngine(e);
|
failEngine(e);
|
||||||
throw new OptimizeFailedEngineException(shardId, e);
|
throw new OptimizeFailedEngineException(shardId, e);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
if (e.getMessage().contains("OutOfMemoryError")) {
|
||||||
|
failEngine(e);
|
||||||
|
}
|
||||||
|
throw new OptimizeFailedEngineException(shardId, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OptimizeFailedEngineException(shardId, e);
|
||||||
} finally {
|
} finally {
|
||||||
rwl.readLock().unlock();
|
rwl.readLock().unlock();
|
||||||
if (indexWriter != null && indexWriter.getConfig().getMergePolicy() instanceof EnableMergePolicy) {
|
if (indexWriter != null && indexWriter.getConfig().getMergePolicy() instanceof EnableMergePolicy) {
|
||||||
|
@ -965,11 +1000,16 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
} else {
|
} else {
|
||||||
indexWriter.optimize(optimize.maxNumSegments(), false);
|
indexWriter.optimize(optimize.maxNumSegments(), false);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
throw new OptimizeFailedEngineException(shardId, e);
|
|
||||||
} catch (OutOfMemoryError e) {
|
} catch (OutOfMemoryError e) {
|
||||||
failEngine(e);
|
failEngine(e);
|
||||||
throw new OptimizeFailedEngineException(shardId, e);
|
throw new OptimizeFailedEngineException(shardId, e);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
if (e.getMessage().contains("OutOfMemoryError")) {
|
||||||
|
failEngine(e);
|
||||||
|
}
|
||||||
|
throw new OptimizeFailedEngineException(shardId, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OptimizeFailedEngineException(shardId, e);
|
||||||
} finally {
|
} finally {
|
||||||
rwl.readLock().unlock();
|
rwl.readLock().unlock();
|
||||||
if (indexWriter != null && indexWriter.getConfig().getMergePolicy() instanceof EnableMergePolicy) {
|
if (indexWriter != null && indexWriter.getConfig().getMergePolicy() instanceof EnableMergePolicy) {
|
||||||
|
|
Loading…
Reference in New Issue