Permalink
Browse files

Update the clock of position upon finishing bootstrap

  • Loading branch information...
1 parent 6fe501c commit bf061e97f95966554a98352d7bcbd2b00ad7696e @jingwei committed Feb 10, 2012
@@ -42,7 +42,7 @@
public long getOffset();
/**
- * @return the index to snapshot.
+ * @return the index to the underlying snapshot or store.
*/
public int getIndex();
@@ -38,6 +38,7 @@
* 08/23, 2011 - Created <br/>
* 11/20, 2011 - Updated for SimpleRetention <br/>
* 01/25, 2012 - Fixed bootstrap scan logging info <br/>
+ * 02/08, 2012 - Update the clock of position upon finishing bootstrap <br/>
*/
public class SimpleRetentionStoreReader<K, V> implements RetentionStoreReader<K, V> {
private final static Logger _logger = Logger.getLogger(SimpleRetentionStoreReader.class);
@@ -171,9 +172,14 @@ public Position get(Position pos, List<Event<K>> list) {
_logger.info("Read[" + pos.getIndex() + "," + index + ") " + cnt);
}
- return iter.hasNext() ?
- new SimplePosition(_retention.getId(), pos.getOffset(), index, pos.getClock()) :
- new SimplePosition(_retention.getId(), pos.getOffset(), pos.getClock());
+ if(iter.hasNext()) {
+ return new SimplePosition(_retention.getId(), pos.getOffset(), index, pos.getClock());
+ } else {
+ Clock newClock;
+ newClock = _retention.getClock(pos.getOffset());
+ if (newClock == null) newClock = pos.getClock();
+ return new SimplePosition(_retention.getId(), pos.getOffset(), newClock);
+ }
} else {
return nextPos;
}

0 comments on commit bf061e9

Please sign in to comment.