Index: src/main/java/org/apache/jackrabbit/oak/plugins/segment/CompactionMap.java =================================================================== --- src/main/java/org/apache/jackrabbit/oak/plugins/segment/CompactionMap.java (revision 1706957) +++ src/main/java/org/apache/jackrabbit/oak/plugins/segment/CompactionMap.java (working copy) @@ -40,12 +40,20 @@ * An empty map. */ public static final CompactionMap EMPTY = - new CompactionMap(Collections.emptyList()); + new CompactionMap(Collections.emptyList(), 0); private final List maps; - private CompactionMap(@Nonnull List maps) { + /** + * Generation represents the number of compaction cycles since the system + * came online. This is not persisted so it will be reset to 0 on each + * restart + */ + private final int generation; + + private CompactionMap(@Nonnull List maps, int generation) { this.maps = maps; + this.generation = generation; } /** @@ -122,7 +130,7 @@ maps.add(map); } } - return new CompactionMap(maps); + return new CompactionMap(maps, generation + 1); } /** @@ -149,6 +157,10 @@ return maps.size(); } + public int getGeneration() { + return generation; + } + /** * The weight of the compaction map is its memory consumption bytes * @return Estimated weight of the compaction map