jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1448727 - /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentSizeTest.java
Date Thu, 21 Feb 2013 17:19:13 GMT
Author: jukka
Date: Thu Feb 21 17:19:13 2013
New Revision: 1448727

URL: http://svn.apache.org/r1448727
Log:
OAK-632: SegmentMK: Efficient updates of flat nodes

Add a flat node size check to verify that the whole node doesn't need to be changed

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentSizeTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentSizeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentSizeTest.java?rev=1448727&r1=1448726&r2=1448727&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentSizeTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentSizeTest.java
Thu Feb 21 17:19:13 2013
@@ -142,6 +142,30 @@ public class SegmentSizeTest {
         assertEquals(136, getAmortizedSize(builder));
     }
 
+    @Test
+    public void testFlatNodeUpdate() {
+        SegmentStore store = new MemoryStore();
+        SegmentReader reader = new SegmentReader(store);
+        SegmentWriter writer = new SegmentWriter(store, reader);
+
+        NodeBuilder builder = MemoryNodeState.EMPTY_NODE.builder();
+        for (int i = 0; i < 1000; i++) {
+            builder.child("child" + i);
+        }
+
+        RecordId id = writer.writeNode(builder.getNodeState());
+        writer.flush();
+        Segment segment = store.readSegment(id.getSegmentId());
+        assertEquals(26040, segment.getData().length);
+
+        builder = new SegmentNodeState(reader, id).builder();
+        builder.child("child1000");
+        id = writer.writeNode(builder.getNodeState());
+        writer.flush();
+        segment = store.readSegment(id.getSegmentId());
+        assertEquals(576, segment.getData().length);
+    }
+
     private int getSize(NodeBuilder builder) {
         SegmentStore store = new MemoryStore();
         SegmentWriter writer = new SegmentWriter(store, new SegmentReader(store));



Mime
View raw message