Browse files

Allow -ts parameter to set start timetamp

  • Loading branch information...
1 parent a6685ab commit d085c849460b9cf1882e40cb1a0675804399bf16 @dgomezferro committed Sep 25, 2012
View
7 src/main/java/com/yahoo/omid/tso/TSOServerConfig.java
@@ -63,6 +63,9 @@ static public TSOServerConfig parseConfig(String args[]){
@Parameter(names = "-quorum", description = "WAL quorum size")
private int quorum;
+
+ @Parameter(names = "-ts", description = "Initial timestamp. Anything older is assumed to be committed.")
+ private long startTimestamp;
TSOServerConfig(){
this.port = Integer.parseInt(System.getProperty("PORT", "1234"));
@@ -105,4 +108,8 @@ public int getEnsembleSize(){
public int getQuorumSize(){
return quorum;
}
+
+ public long getStartTimestamp() {
+ return startTimestamp;
+ }
}
View
5 src/main/java/com/yahoo/omid/tso/persistence/BookKeeperStateBuilder.java
@@ -72,7 +72,9 @@ public static TSOState getState(TSOServerConfig config){
TSOState returnValue;
if(!config.isRecoveryEnabled()){
LOG.warn("Logger is disabled");
- returnValue = new TSOState(new TimestampOracle());
+ TimestampOracle to = new TimestampOracle();
+ to.initialize(config.getStartTimestamp());
+ returnValue = new TSOState(to);
returnValue.initialize();
} else {
BookKeeperStateBuilder builder = new BookKeeperStateBuilder(config);
@@ -99,6 +101,7 @@ public static TSOState getState(TSOServerConfig config){
BookKeeperStateBuilder(TSOServerConfig config) {
this.timestampOracle = new TimestampOracle();
+ this.timestampOracle.initialize(config.getStartTimestamp());
this.config = config;
this.throttleReads = new Semaphore(PARALLEL_READS);
}

0 comments on commit d085c84

Please sign in to comment.