NIHVIVO-2052 Check more explicitly for failure to delete the live index.
This commit is contained in:
parent
500d71aafe
commit
2ad4348870
1 changed files with 17 additions and 7 deletions
|
@ -277,19 +277,27 @@ public class LuceneIndexer implements IndexerIface {
|
||||||
|
|
||||||
private synchronized void bringRebuildOnLine() {
|
private synchronized void bringRebuildOnLine() {
|
||||||
closeWriter();
|
closeWriter();
|
||||||
deleteDir(new File(liveIndexDir));
|
|
||||||
File offLineDir = new File(currentOffLineDir);
|
File offLineDir = new File(currentOffLineDir);
|
||||||
File liveDir = new File(liveIndexDir);
|
File liveDir = new File(liveIndexDir);
|
||||||
|
|
||||||
|
boolean deleted = deleteDir(liveDir);
|
||||||
|
if (! deleted ){
|
||||||
|
log.error("failed to delete live index directory "
|
||||||
|
+ liveDir.getAbsolutePath());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean success = offLineDir.renameTo( liveDir );
|
boolean success = offLineDir.renameTo( liveDir );
|
||||||
if( ! success ){
|
if( ! success ){
|
||||||
log.error("could not move off line index at "
|
log.error("could not move off line index at "
|
||||||
+ offLineDir.getAbsolutePath() + " to live index directory "
|
+ offLineDir.getAbsolutePath() + " to live index directory "
|
||||||
+ liveDir.getAbsolutePath());
|
+ liveDir.getAbsolutePath());
|
||||||
}else{
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
deleteDir(new File(currentOffLineDir));
|
deleteDir(new File(currentOffLineDir));
|
||||||
currentOffLineDir = null;
|
currentOffLineDir = null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized String getOffLineBuildDir(){
|
private synchronized String getOffLineBuildDir(){
|
||||||
File baseDir = new File(baseIndexDir);
|
File baseDir = new File(baseIndexDir);
|
||||||
|
@ -323,8 +331,10 @@ public class LuceneIndexer implements IndexerIface {
|
||||||
if (dir.isDirectory()) {
|
if (dir.isDirectory()) {
|
||||||
String[] children = dir.list();
|
String[] children = dir.list();
|
||||||
for (int i=0; i<children.length; i++) {
|
for (int i=0; i<children.length; i++) {
|
||||||
boolean success = deleteDir(new File(dir, children[i]));
|
File child = new File(dir, children[i]);
|
||||||
|
boolean success = deleteDir(child);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
log.warn("failed to delete " + child.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue