Core: add debug logging to InternalEngine.close

This commit is contained in:
Michael McCandless 2014-11-08 05:49:20 -05:00 committed by mikemccand
parent 0298b6c3dd
commit 37baba0f18
1 changed files with 4 additions and 5 deletions

View File

@ -1314,12 +1314,14 @@ public class InternalEngine extends AbstractIndexShardComponent implements Engin
@Override
public void close() throws ElasticsearchException {
try (InternalLock _ = writeLock.acquire()) {
logger.debug("close acquired writeLock");
if (!closed) {
try {
closed = true;
indexSettingsService.removeListener(applySettings);
this.versionMap.clear();
this.failedEngineListeners.clear();
logger.debug("close searcherManager");
try {
IOUtils.close(searcherManager);
} catch (Throwable t) {
@ -1327,16 +1329,13 @@ public class InternalEngine extends AbstractIndexShardComponent implements Engin
}
// no need to commit in this case!, we snapshot before we close the shard, so translog and all sync'ed
if (indexWriter != null) {
long t0 = System.nanoTime();
logger.debug("rollback indexWriter");
try {
indexWriter.rollback();
} catch (AlreadyClosedException e) {
// ignore
}
long t1 = System.nanoTime();
if (logger.isDebugEnabled()) {
logger.debug("indexWriter.rollback took {} nanoseconds", t1-t0);
}
logger.debug("rollback indexWriter done");
}
} catch (Throwable e) {
logger.warn("failed to rollback writer on close", e);