Permalink
Browse files

Fixed constructor to actually take the mlock parameter

made it true by default
  • Loading branch information...
1 parent 2f5e776 commit 7c49c648862b6e6843228703218823a76e78fa7c @abh1nay abh1nay committed Nov 27, 2012
@@ -270,7 +270,8 @@ public VoldemortConfig(Props props) {
this.fetcherBufferSize = (int) props.getBytes("hdfs.fetcher.buffer.size",
DEFAULT_BUFFER_SIZE);
- this.setUseMlock(props.getBoolean("readonly.mlock.index", false));
+ // TODO probably turn to false by default?
+ this.setUseMlock(props.getBoolean("readonly.mlock.index", true));
this.mysqlUsername = props.getString("mysql.user", "root");
this.mysqlPassword = props.getString("mysql.password", "");
@@ -110,21 +110,7 @@ public ReadOnlyStorageEngine(String name,
int nodeId,
File storeDir,
int numBackups) {
- this.storeDir = storeDir;
- this.numBackups = numBackups;
- this.name = Utils.notNull(name);
- this.searchStrategy = searchStrategy;
- this.routingStrategy = Utils.notNull(routingStrategy);
- this.nodeId = nodeId;
- this.fileSet = null;
- this.currentVersionId = 0L;
- /*
- * A lock that blocks reads during swap(), open(), and close()
- * operations
- */
- this.fileModificationLock = new ReentrantReadWriteLock();
- this.isOpen = false;
- open(null);
+ this(name, searchStrategy, routingStrategy, nodeId, storeDir, numBackups, 0, false);
}
/*
@@ -139,8 +125,22 @@ public ReadOnlyStorageEngine(String name,
int deleteBackupMs,
boolean enforceMlock) {
- this(name, searchStrategy, routingStrategy, nodeId, storeDir, numBackups, deleteBackupMs);
this.enforceMlock = enforceMlock;
+ this.storeDir = storeDir;
+ this.numBackups = numBackups;
+ this.name = Utils.notNull(name);
+ this.searchStrategy = searchStrategy;
+ this.routingStrategy = Utils.notNull(routingStrategy);
+ this.nodeId = nodeId;
+ this.fileSet = null;
+ this.currentVersionId = 0L;
+ /*
+ * A lock that blocks reads during swap(), open(), and close()
+ * operations
+ */
+ this.fileModificationLock = new ReentrantReadWriteLock();
+ this.isOpen = false;
+ open(null);
}
/**
@@ -61,11 +61,8 @@ public ChunkedFileSet(File directory,
RoutingStrategy routingStrategy,
int nodeId,
boolean enforceMlock) {
- this(directory, routingStrategy, nodeId);
- this.enforceMlock = enforceMlock;
- }
- public ChunkedFileSet(File directory, RoutingStrategy routingStrategy, int nodeId) {
+ this.enforceMlock = enforceMlock;
this.baseDir = directory;
if(!Utils.isReadableDir(directory))
throw new VoldemortException(directory.getAbsolutePath()
@@ -116,6 +113,11 @@ public ChunkedFileSet(File directory, RoutingStrategy routingStrategy, int nodeI
+ " chunks and format " + storageFormat);
}
+ public ChunkedFileSet(File directory, RoutingStrategy routingStrategy, int nodeId) {
+ this(directory, routingStrategy, nodeId, false);
+
+ }
+
public DataFileChunkSet toDataFileChunkSet() {
// Convert the index file into chunk set
@@ -50,7 +50,6 @@ private void init(File file) throws IOException {
*/
public MappedByteBuffer map(boolean setAutoLock) throws IOException {
- setAutoLock = true; // remove this!
try {
if(mappedByteBuffer == null) {

0 comments on commit 7c49c64

Please sign in to comment.