logging: improve for RecoveryStrategy

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1296839 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2012-03-04 17:23:38 +00:00
parent ce099776fd
commit 8c7c6890ad
1 changed files with 13 additions and 16 deletions

View File

@ -201,7 +201,9 @@ public class RecoveryStrategy extends Thread implements SafeStopThread {
SolrQueryRequest req = new LocalSolrQueryRequest(core, new ModifiableSolrParams()); SolrQueryRequest req = new LocalSolrQueryRequest(core, new ModifiableSolrParams());
SolrQueryResponse rsp = new SolrQueryResponse(); SolrQueryResponse rsp = new SolrQueryResponse();
SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, rsp)); SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, rsp));
log.info("Starting recovery process. recoveringAfterStartup=" + recoveringAfterStartup);
try { try {
doRecovery(core); doRecovery(core);
} finally { } finally {
@ -247,11 +249,10 @@ public class RecoveryStrategy extends Thread implements SafeStopThread {
if (oldIdx > 0) { if (oldIdx > 0) {
log.info("####### Found new versions added after startup: num=" + oldIdx); log.info("####### Found new versions added after startup: num=" + oldIdx);
log.info("###### currentVersions=" + startingRecentVersions);
} }
// TODO: only log at debug level in the future (or move to oldIdx > 0 block)
log.info("###### startupVersions=" + reallyStartingVersions); log.info("###### startupVersions=" + reallyStartingVersions);
log.info("###### currentVersions=" + startingRecentVersions);
} }
if (recoveringAfterStartup) { if (recoveringAfterStartup) {
@ -355,7 +356,7 @@ public class RecoveryStrategy extends Thread implements SafeStopThread {
log.warn("Recovery was interrupted", e); log.warn("Recovery was interrupted", e);
retries = INTERRUPTED; retries = INTERRUPTED;
} catch (Throwable t) { } catch (Throwable t) {
SolrException.log(log, "Error while trying to recover", t); log.error("Error while trying to recover", t);
} finally { } finally {
if (!replayed) { if (!replayed) {
try { try {
@ -368,11 +369,9 @@ public class RecoveryStrategy extends Thread implements SafeStopThread {
} }
} catch (Throwable t) { } catch (Throwable t) {
SolrException.log(log, "Error while trying to recover", t); log.error("Error while trying to recover... closing core.", t);
} finally { } finally {
if (core != null) { core.close();
core.close();
}
} }
if (!successfulRecovery) { if (!successfulRecovery) {
@ -381,21 +380,20 @@ public class RecoveryStrategy extends Thread implements SafeStopThread {
// Or do a fall off retry... // Or do a fall off retry...
try { try {
SolrException.log(log, "Recovery failed - trying again..."); log.error("Recovery failed - trying again...");
retries++; retries++;
if (retries >= MAX_RETRIES) { if (retries >= MAX_RETRIES) {
if (retries == INTERRUPTED) { if (retries == INTERRUPTED) {
} else { } else {
log.error("Recovery failed - max retries exceeded.");
// TODO: for now, give up after X tries - should we do more? // TODO: for now, give up after X tries - should we do more?
core = cc.getCore(coreName); core = cc.getCore(coreName);
try { try {
recoveryFailed(core, zkController, baseUrl, coreZkNodeName, recoveryFailed(core, zkController, baseUrl, coreZkNodeName,
core.getCoreDescriptor()); core.getCoreDescriptor());
} finally { } finally {
if (core != null) { core.close();
core.close();
}
} }
} }
break; break;
@ -413,11 +411,10 @@ public class RecoveryStrategy extends Thread implements SafeStopThread {
retries = INTERRUPTED; retries = INTERRUPTED;
} }
} }
log.info("Finished recovery process");
} }
log.info("Finished recovery process");
} }
private Future<RecoveryInfo> replay(UpdateLog ulog) private Future<RecoveryInfo> replay(UpdateLog ulog)