logging: improve replication logging

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1349378 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2012-06-12 14:48:16 +00:00
parent 2210749fbd
commit 97b0066023
2 changed files with 17 additions and 4 deletions

View File

@ -209,8 +209,14 @@ public final class SolrCore implements SolrInfoMBean {
result = dataDir + s;
}
}
if (!result.equals(lastNewIndexDir)) {
log.warn("New index directory detected: old="+lastNewIndexDir + " new=" + result);
}
lastNewIndexDir = result;
return result;
}
private String lastNewIndexDir; // for debugging purposes only... access not synchronized, but that's ok
public DirectoryFactory getDirectoryFactory() {
return directoryFactory;

View File

@ -341,6 +341,7 @@ public class SnapPuller {
File tmpIndexDir = createTempindexDir(core);
if (isIndexStale())
isFullCopyNeeded = true;
LOG.info("Starting download to " + tmpIndexDir + " fullCopy=" + isFullCopyNeeded);
successfulInstall = false;
boolean deleteTmpIdxDir = true;
File indexDir = null ;
@ -387,8 +388,13 @@ public class SnapPuller {
} catch (Exception e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Index fetch failed : ", e);
} finally {
if (deleteTmpIdxDir) delTree(tmpIndexDir);
else delTree(indexDir);
if (deleteTmpIdxDir) {
LOG.info("removing temporary index download directory " + tmpIndexDir);
delTree(tmpIndexDir);
} else {
LOG.info("removing old index directory " + indexDir);
delTree(indexDir);
}
}
} finally {
if (!successfulInstall) {
@ -606,8 +612,9 @@ public class SnapPuller {
* @param latestGeneration the version number
*/
private void downloadIndexFiles(boolean downloadCompleteIndex, File tmpIdxDir, long latestGeneration) throws Exception {
String indexDir = solrCore.getIndexDir();
for (Map<String, Object> file : filesToDownload) {
File localIndexFile = new File(solrCore.getIndexDir(), (String) file.get(NAME));
File localIndexFile = new File(indexDir, (String) file.get(NAME));
if (!localIndexFile.exists() || downloadCompleteIndex) {
fileFetcher = new FileFetcher(tmpIdxDir, file, (String) file.get(NAME), false, latestGeneration);
currentFile = file;
@ -742,7 +749,7 @@ public class SnapPuller {
* If the index is stale by any chance, load index from a different dir in the data dir.
*/
private boolean modifyIndexProps(String tmpIdxDirName) {
LOG.info("New index installed. Updating index properties...");
LOG.info("New index installed. Updating index properties... index="+tmpIdxDirName);
File idxprops = new File(solrCore.getDataDir() + "index.properties");
Properties p = new Properties();
if (idxprops.exists()) {