Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java (revision 1678045) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java (working copy) @@ -263,8 +263,8 @@ } public void registerNodeStore() throws IOException { - if (registerSegmentStore()) { - boolean standby = toBoolean(lookup(context, STANDBY), false); + boolean standby = toBoolean(lookup(context, STANDBY), false); + if (registerSegmentStore(standby)) { providerRegistration = context.getBundleContext().registerService( SegmentStoreProvider.class.getName(), this, null); if (!standby) { @@ -277,7 +277,7 @@ } } - public synchronized boolean registerSegmentStore() throws IOException { + public synchronized boolean registerSegmentStore(boolean standby) throws IOException { if (context == null) { log.info("Component still not activated. Ignoring the initialization call"); return false; @@ -369,9 +369,10 @@ scheduleWithFixedDelay(whiteboard, fsgcMonitor, 1)); delegate = new SegmentNodeStore(store); - observerTracker = new ObserverTracker(delegate); - observerTracker.start(context.getBundleContext()); - + if (!standby) { + observerTracker = new ObserverTracker(delegate); + observerTracker.start(context.getBundleContext()); + } executor = new WhiteboardExecutor(); executor.start(whiteboard); Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java (revision 1678045) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java (working copy) @@ -19,7 +19,6 @@ import static com.google.common.collect.Lists.newLinkedList; import static com.google.common.collect.Queues.newArrayDeque; import static com.google.common.collect.Sets.newHashSet; -import static com.google.common.collect.Sets.newIdentityHashSet; import java.security.SecureRandom; import java.util.LinkedList; @@ -29,7 +28,6 @@ import javax.annotation.Nonnull; -import com.google.common.collect.Sets; import org.apache.jackrabbit.oak.plugins.blob.ReferenceCollector; import org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy; import org.slf4j.Logger; @@ -256,4 +254,8 @@ } } + public synchronized void clearCache() { + segments.clear(); + currentSize = 0; + } } Index: oak-tarmk-standby/src/main/java/org/apache/jackrabbit/oak/plugins/segment/standby/store/StandbyStore.java =================================================================== --- oak-tarmk-standby/src/main/java/org/apache/jackrabbit/oak/plugins/segment/standby/store/StandbyStore.java (revision 1678045) +++ oak-tarmk-standby/src/main/java/org/apache/jackrabbit/oak/plugins/segment/standby/store/StandbyStore.java (working copy) @@ -243,7 +243,17 @@ public void cleanup() { if (delegate instanceof FileStore) { try { - ((FileStore) delegate).cleanup(); + FileStore store = (FileStore) delegate; + + store.getTracker().clearCache(); + store.getTracker().getWriter().dropCache(); + store.getTracker().getWriter().flush(); + + tracker.clearCache(); + tracker.getWriter().dropCache(); + tracker.getWriter().flush(); + + store.cleanup(); } catch (IOException e) { log.error("Error running cleanup", e); }