mirror of https://github.com/apache/lucene.git
SOLR-4467: Ephemeral directory implementations may not recover correctly because the code to clear the tlog files on startup is off.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1446928 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7dd591ba5d
commit
b800d08400
|
@ -22,6 +22,8 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.SolrException.ErrorCode;
|
||||
import org.apache.solr.core.PluginInfo;
|
||||
import org.apache.solr.core.SolrCore;
|
||||
import org.apache.solr.core.SolrEventListener;
|
||||
|
@ -87,13 +89,14 @@ public abstract class UpdateHandler implements SolrInfoMBean {
|
|||
private void clearLog(PluginInfo ulogPluginInfo) {
|
||||
if (ulogPluginInfo == null) return;
|
||||
File tlogDir = UpdateLog.getTlogDir(core, ulogPluginInfo);
|
||||
log.info("Clearing tlog files, tlogDir=" + tlogDir);
|
||||
if (tlogDir.exists()) {
|
||||
String[] files = UpdateLog.getLogList(tlogDir);
|
||||
for (String file : files) {
|
||||
File f = new File(file);
|
||||
File f = new File(tlogDir, file);
|
||||
boolean s = f.delete();
|
||||
if (!s) {
|
||||
log.error("Could not remove tlog file:" + f);
|
||||
throw new SolrException(ErrorCode.SERVER_ERROR, "Could not remove tlog file:" + f.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1398,7 +1398,7 @@ public class UpdateLog implements PluginInfoInitialized {
|
|||
|
||||
public static File getTlogDir(SolrCore core, PluginInfo info) {
|
||||
String dataDir = (String) info.initArgs.get("dir");
|
||||
if (dataDir == null) {
|
||||
|
||||
String ulogDir = core.getCoreDescriptor().getUlogDir();
|
||||
if (ulogDir != null) {
|
||||
dataDir = ulogDir;
|
||||
|
@ -1407,7 +1407,7 @@ public class UpdateLog implements PluginInfoInitialized {
|
|||
if (dataDir == null || dataDir.length() == 0) {
|
||||
dataDir = core.getDataDir();
|
||||
}
|
||||
}
|
||||
|
||||
return new File(dataDir, TLOG_NAME);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue