Permalink
Browse files

Adding ability to inject any je.properties param into server

* Added cleanerFetchObsoleteSize=true as default
* Removed unused proactive migration param
  • Loading branch information...
1 parent 000c79b commit 662ce355efb8768fd0be83be042dd6b7b071c4a0 @vinothchandar vinothchandar committed Sep 4, 2013
@@ -117,8 +117,9 @@
private boolean bdbMinimizeScanImpact;
private boolean bdbPrefixKeysWithPartitionId;
private boolean bdbLevelBasedEviction;
- private boolean bdbProactiveBackgroundMigration;
private boolean bdbCheckpointerOffForBatchWrites;
+ private boolean bdbCleanerFetchObsoleteSize;
+ private String bdbRawPropertyString;
private String mysqlUsername;
private String mysqlPassword;
@@ -291,10 +292,10 @@ public VoldemortConfig(Props props) {
this.bdbPrefixKeysWithPartitionId = props.getBoolean("bdb.prefix.keys.with.partitionid",
true);
this.bdbLevelBasedEviction = props.getBoolean("bdb.evict.by.level", false);
- this.bdbProactiveBackgroundMigration = props.getBoolean("bdb.proactive.background.migration",
- false);
this.bdbCheckpointerOffForBatchWrites = props.getBoolean("bdb.checkpointer.off.batch.writes",
false);
+ this.bdbCleanerFetchObsoleteSize = props.getBoolean("bdb.cleaner.fetch.obsolete.size", true);
+ this.bdbRawPropertyString = props.getString("bdb.raw.property.string", null);
this.numReadOnlyVersions = props.getInt("readonly.backups", 1);
this.readOnlySearchStrategy = props.getString("readonly.search.strategy",
@@ -763,6 +764,28 @@ public String getBdbDataDirectory() {
public void setBdbDataDirectory(String bdbDataDirectory) {
this.bdbDataDirectory = bdbDataDirectory;
}
+
+ public String getBdbRawPropertyString() {
+ return bdbRawPropertyString;
+ }
+
+ /**
+ * When supplied with comma separated propkey=propvalue strings,
+ * enables admin to arbitrarily set any BDB JE environment property
+ *
+ * eg: bdb.raw.property.string=je.cleaner.threads=1,je.cleaner.lazyMigration=true
+ *
+ * Since this is applied after the regular BDB parameter in this class,
+ * this has the effect of overriding previous configs if they are specified here again.
+ *
+ * <ul>
+ * <li>Property : "bdb.raw.property.string"</li>
+ * <li>Default : null</li>
+ * </ul>
+ */
+ public void setBdbRawPropertyString(String bdbRawPropString) {
+ this.bdbRawPropertyString = bdbRawPropString;
+ }
public long getBdbMaxLogFileSize() {
return this.bdbMaxLogFileSize;
@@ -1048,6 +1071,26 @@ public void setBdbBtreeFanout(int bdbBtreeFanout) {
this.bdbBtreeFanout = bdbBtreeFanout;
}
+ public boolean getBdbCleanerFetchObsoleteSize() {
+ return bdbCleanerFetchObsoleteSize;
+ }
+
+ /**
+ * If true, Cleaner also fetches the old value to determine the size during
+ * an update/delete to compute file utilization. Without this, BDB will
+ * auto compute utilization based on heuristics..
+ * (which may or may not work, depending on your use case)
+ *
+ * <ul>
+ * <li>property: "bdb.cleaner.fetch.obsolete.size"</li>
+ * <li>default : true</li>
+ * </ul>
+ *
+ */
+ public final void setBdbCleanerFetchObsoleteSize(boolean bdbCleanerFetchObsoleteSize) {
+ this.bdbCleanerFetchObsoleteSize = bdbCleanerFetchObsoleteSize;
+ }
+
public boolean getBdbCleanerLazyMigration() {
return bdbCleanerLazyMigration;
}
@@ -1268,23 +1311,6 @@ public void setBdbLevelBasedEviction(boolean bdbLevelBasedEviction) {
this.bdbLevelBasedEviction = bdbLevelBasedEviction;
}
- public boolean getBdbProactiveBackgroundMigration() {
- return bdbProactiveBackgroundMigration;
- }
-
- /**
- * Exposes BDB JE EnvironmentConfig.CLEANER_PROACTIVE_BACKGROUND_MIGRATION.
- *
- * <ul>
- * <li>Property : "bdb.proactive.background.migration"</li>
- * <li>Default : false</li>
- * </ul>
- *
- */
- public void setBdbProactiveBackgroundMigration(boolean bdbProactiveBackgroundMigration) {
- this.bdbProactiveBackgroundMigration = bdbProactiveBackgroundMigration;
- }
-
public int getCoreThreads() {
return coreThreads;
}
@@ -114,11 +114,10 @@ public BdbStorageConfiguration(VoldemortConfig config) {
Integer.toString(config.getBdbLogIteratorReadSize()));
environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_LAZY_MIGRATION,
Boolean.toString(config.getBdbCleanerLazyMigration()));
- environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_BACKGROUND_PROACTIVE_MIGRATION,
- Boolean.toString(config.getBdbProactiveBackgroundMigration()));
environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_BYTES_INTERVAL,
Long.toString(config.getBdbCleanerBytesInterval()));
-
+ environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_FETCH_OBSOLETE_SIZE,
+ Boolean.toString(config.getBdbCleanerFetchObsoleteSize()));
environmentConfig.setLockTimeout(config.getBdbLockTimeoutMs(), TimeUnit.MILLISECONDS);
if(config.getBdbCacheModeEvictLN()) {
environmentConfig.setCacheMode(CacheMode.EVICT_LN);
@@ -127,6 +126,25 @@ public BdbStorageConfiguration(VoldemortConfig config) {
environmentConfig.setConfigParam(EnvironmentConfig.EVICTOR_LRU_ONLY,
Boolean.toString(false));
}
+
+ // Now apply the raw property string overrides
+ if (config.getBdbRawPropertyString() != null){
+ try {
+ String[] props = config.getBdbRawPropertyString().split(",");
+ if (props.length > 0){
+ for (int i=0; i < props.length; i++) {
+ String[] propSplit = props[i].split("=");
+ if (propSplit.length == 2){
+ logger.info("Overriding property "+ propSplit[0] +" to "+ propSplit[1]+
+ " from the raw property string");
+ environmentConfig.setConfigParam(propSplit[0], propSplit[1]);
+ }
+ }
+ }
+ } catch (Exception e){
+ logger.warn("Error when applying raw BDB property string... Ignoring and moving on..", e);
+ }
+ }
databaseConfig = new DatabaseConfig();
databaseConfig.setAllowCreate(true);

0 comments on commit 662ce35

Please sign in to comment.