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 @Override
public void close() throws ElasticsearchException { public void close() throws ElasticsearchException {
try (InternalLock _ = writeLock.acquire()) { try (InternalLock _ = writeLock.acquire()) {
logger.debug("close acquired writeLock");
if (!closed) { if (!closed) {
try { try {
closed = true; closed = true;
indexSettingsService.removeListener(applySettings); indexSettingsService.removeListener(applySettings);
this.versionMap.clear(); this.versionMap.clear();
this.failedEngineListeners.clear(); this.failedEngineListeners.clear();
logger.debug("close searcherManager");
try { try {
IOUtils.close(searcherManager); IOUtils.close(searcherManager);
} catch (Throwable t) { } 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 // no need to commit in this case!, we snapshot before we close the shard, so translog and all sync'ed
if (indexWriter != null) { if (indexWriter != null) {
long t0 = System.nanoTime(); logger.debug("rollback indexWriter");
try { try {
indexWriter.rollback(); indexWriter.rollback();
} catch (AlreadyClosedException e) { } catch (AlreadyClosedException e) {
// ignore // ignore
} }
long t1 = System.nanoTime(); logger.debug("rollback indexWriter done");
if (logger.isDebugEnabled()) {
logger.debug("indexWriter.rollback took {} nanoseconds", t1-t0);
}
} }
} catch (Throwable e) { } catch (Throwable e) {
logger.warn("failed to rollback writer on close", e); logger.warn("failed to rollback writer on close", e);