jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1584259 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java
Date Thu, 03 Apr 2014 04:47:39 GMT
Author: jukka
Date: Thu Apr  3 04:47:39 2014
New Revision: 1584259

URL: http://svn.apache.org/r1584259
Log:
OAK-631: SegmentMK: Implement garbage collection

Flush the segment writer before and after a checkpoint to reduce the chance
of a checkpoint ending up in a segment together with some unrelated changes
which would then prevent that checkpoint from being garbage collected

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java?rev=1584259&r1=1584258&r2=1584259&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java
Thu Apr  3 04:47:39 2014
@@ -206,6 +206,7 @@ public class SegmentNodeStore implements
             if (commitSemaphore.tryAcquire()) {
                 try {
                     refreshHead();
+                    store.getTracker().getWriter().flush();
 
                     SegmentNodeState state = head.get();
                     SegmentNodeBuilder builder = state.builder();
@@ -225,7 +226,9 @@ public class SegmentNodeStore implements
                     cp.setProperty("timestamp",  now + lifetime);
                     cp.setChildNode(ROOT, state.getChildNode(ROOT));
 
-                    if (store.setHead(state, builder.getNodeState())) {
+                    SegmentNodeState newState = builder.getNodeState();
+                    store.getTracker().getWriter().flush();
+                    if (store.setHead(state, newState)) {
                         refreshHead();
                         return name;
                     }



Mime
View raw message