Skip to content

Commit

Permalink
Added BDB cleaner threads
Browse files Browse the repository at this point in the history
  • Loading branch information
rsumbaly committed Dec 13, 2010
1 parent 1577667 commit ffdfca9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/java/voldemort/server/VoldemortConfig.java
Expand Up @@ -70,6 +70,7 @@ public class VoldemortConfig implements Serializable {
private int bdbCleanerMinFileUtilization;
private int bdbCleanerMinUtilization;
private boolean bdbCursorPreload;
private int bdbCleanerThreads;

private String mysqlUsername;
private String mysqlPassword;
Expand Down Expand Up @@ -190,6 +191,7 @@ public VoldemortConfig(Props props) {
this.bdbOneEnvPerStore = props.getBoolean("bdb.one.env.per.store", false);
this.bdbCleanerMinFileUtilization = props.getInt("bdb.cleaner.min.file.utilization", 5);
this.bdbCleanerMinUtilization = props.getInt("bdb.cleaner.minUtilization", 50);
this.bdbCleanerThreads = props.getInt("bdb.cleaner.threads", 1);

// enabling preload make cursor slow for insufficient bdb cache size.
this.bdbCursorPreload = props.getBoolean("bdb.cursor.preload", false);
Expand Down Expand Up @@ -525,6 +527,26 @@ public final void setBdbCleanerMinFileUtilization(int minFileUtilization) {
this.bdbCleanerMinFileUtilization = minFileUtilization;
}

/**
*
* The number of cleaner threads
*
* <ul>
* <li>property: "bdb.cleaner.threads"</li>
* <li>default: 1</li>
* <li>minimum: 1</li>
* </ul>
*/
public int getBdbCleanerThreads() {
return bdbCleanerThreads;
}

public final void setBdbCleanerThreads(int bdbCleanerThreads) {
if(bdbCleanerThreads <= 0)
throw new IllegalArgumentException("bdbCleanerThreads should be greater than 0");
this.bdbCleanerThreads = bdbCleanerThreads;
}

/**
*
* The cleaner will keep the total disk space utilization percentage above
Expand Down
2 changes: 2 additions & 0 deletions src/java/voldemort/store/bdb/BdbStorageConfiguration.java
Expand Up @@ -87,6 +87,8 @@ public BdbStorageConfiguration(VoldemortConfig config) {
Integer.toString(config.getBdbCleanerMinFileUtilization()));
environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_MIN_UTILIZATION,
Integer.toString(config.getBdbCleanerMinUtilization()));
environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_THREADS,
Integer.toString(config.getBdbCleanerThreads()));
databaseConfig = new DatabaseConfig();
databaseConfig.setAllowCreate(true);
databaseConfig.setSortedDuplicates(config.isBdbSortedDuplicatesEnabled());
Expand Down

0 comments on commit ffdfca9

Please sign in to comment.