SOLR-3749: Allow default UpdateLog syncLevel to be configured by solrconfig.xml.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1385150 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-09-15 18:47:35 +00:00
parent f8cd9fe1c4
commit 9a7f34fc24
2 changed files with 17 additions and 1 deletions

View File

@ -276,6 +276,9 @@ Other Changes
* SOLR-3826: Test framework improvements for specifying coreName on initCore
(Amit Nithian, hossman)
* SOLR-3749: Allow default UpdateLog syncLevel to be configured by
solrconfig.xml (Raintung Li, Mark Miller)
================== 4.0.0-BETA ===================

View File

@ -62,7 +62,19 @@ public class UpdateLog implements PluginInfoInitialized {
public boolean trace = log.isTraceEnabled();
public enum SyncLevel { NONE, FLUSH, FSYNC }
public enum SyncLevel { NONE, FLUSH, FSYNC;
public static SyncLevel getSyncLevel(String level){
if (level == null) {
return SyncLevel.FLUSH;
}
try{
return SyncLevel.valueOf(level.toUpperCase());
} catch(Exception ex){
log.warn("There was an error reading the SyncLevel - default to " + SyncLevel.FLUSH, ex);
return SyncLevel.FLUSH;
}
}
}
public enum State { REPLAYING, BUFFERING, APPLYING_BUFFERED, ACTIVE }
public static final int ADD = 0x01;
@ -168,6 +180,7 @@ public class UpdateLog implements PluginInfoInitialized {
public void init(PluginInfo info) {
dataDir = (String)info.initArgs.get("dir");
defaultSyncLevel = SyncLevel.getSyncLevel((String)info.initArgs.get("syncLevel"));
}
public void init(UpdateHandler uhandler, SolrCore core) {