mirror of
https://github.com/apache/lucene.git
synced 2025-03-05 07:49:22 +00:00
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:
parent
2210749fbd
commit
97b0066023
solr/core/src/java/org/apache/solr
@ -209,8 +209,14 @@ public final class SolrCore implements SolrInfoMBean {
|
|||||||
result = dataDir + s;
|
result = dataDir + s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!result.equals(lastNewIndexDir)) {
|
||||||
|
log.warn("New index directory detected: old="+lastNewIndexDir + " new=" + result);
|
||||||
|
}
|
||||||
|
lastNewIndexDir = result;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
private String lastNewIndexDir; // for debugging purposes only... access not synchronized, but that's ok
|
||||||
|
|
||||||
|
|
||||||
public DirectoryFactory getDirectoryFactory() {
|
public DirectoryFactory getDirectoryFactory() {
|
||||||
return directoryFactory;
|
return directoryFactory;
|
||||||
|
@ -341,6 +341,7 @@ public class SnapPuller {
|
|||||||
File tmpIndexDir = createTempindexDir(core);
|
File tmpIndexDir = createTempindexDir(core);
|
||||||
if (isIndexStale())
|
if (isIndexStale())
|
||||||
isFullCopyNeeded = true;
|
isFullCopyNeeded = true;
|
||||||
|
LOG.info("Starting download to " + tmpIndexDir + " fullCopy=" + isFullCopyNeeded);
|
||||||
successfulInstall = false;
|
successfulInstall = false;
|
||||||
boolean deleteTmpIdxDir = true;
|
boolean deleteTmpIdxDir = true;
|
||||||
File indexDir = null ;
|
File indexDir = null ;
|
||||||
@ -387,8 +388,13 @@ public class SnapPuller {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Index fetch failed : ", e);
|
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Index fetch failed : ", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (deleteTmpIdxDir) delTree(tmpIndexDir);
|
if (deleteTmpIdxDir) {
|
||||||
else delTree(indexDir);
|
LOG.info("removing temporary index download directory " + tmpIndexDir);
|
||||||
|
delTree(tmpIndexDir);
|
||||||
|
} else {
|
||||||
|
LOG.info("removing old index directory " + indexDir);
|
||||||
|
delTree(indexDir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (!successfulInstall) {
|
if (!successfulInstall) {
|
||||||
@ -606,8 +612,9 @@ public class SnapPuller {
|
|||||||
* @param latestGeneration the version number
|
* @param latestGeneration the version number
|
||||||
*/
|
*/
|
||||||
private void downloadIndexFiles(boolean downloadCompleteIndex, File tmpIdxDir, long latestGeneration) throws Exception {
|
private void downloadIndexFiles(boolean downloadCompleteIndex, File tmpIdxDir, long latestGeneration) throws Exception {
|
||||||
|
String indexDir = solrCore.getIndexDir();
|
||||||
for (Map<String, Object> file : filesToDownload) {
|
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) {
|
if (!localIndexFile.exists() || downloadCompleteIndex) {
|
||||||
fileFetcher = new FileFetcher(tmpIdxDir, file, (String) file.get(NAME), false, latestGeneration);
|
fileFetcher = new FileFetcher(tmpIdxDir, file, (String) file.get(NAME), false, latestGeneration);
|
||||||
currentFile = file;
|
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.
|
* If the index is stale by any chance, load index from a different dir in the data dir.
|
||||||
*/
|
*/
|
||||||
private boolean modifyIndexProps(String tmpIdxDirName) {
|
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");
|
File idxprops = new File(solrCore.getDataDir() + "index.properties");
|
||||||
Properties p = new Properties();
|
Properties p = new Properties();
|
||||||
if (idxprops.exists()) {
|
if (idxprops.exists()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user