Skip to content

Commit

Permalink
Update the clock of position upon finishing bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
jingwei committed Feb 10, 2012
1 parent 6fe501c commit bf061e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/retention/java/krati/retention/Position.java
Expand Up @@ -42,7 +42,7 @@ public interface Position extends Serializable {
public long getOffset();

/**
* @return the index to snapshot.
* @return the index to the underlying snapshot or store.
*/
public int getIndex();

Expand Down
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit bf061e9

Please sign in to comment.