jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1446051 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java
Date Thu, 14 Feb 2013 07:00:38 GMT
Author: jukka
Date: Thu Feb 14 07:00:37 2013
New Revision: 1446051

URL: http://svn.apache.org/r1446051
Log:
OAK-593: Segment-based MK

Fix segment buffer reallocation logic

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

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java?rev=1446051&r1=1446050&r2=1446051&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java
Thu Feb 14 07:00:37 2013
@@ -113,6 +113,9 @@ public class SegmentWriter {
         }
         if (fullSize > buffer.remaining()) {
             int n = Math.min(buffer.capacity() * 2, store.getMaxSegmentSize());
+            while (n < buffer.position() + fullSize) {
+                n = Math.min(n * 2, store.getMaxSegmentSize());
+            }
             ByteBuffer newBuffer = ByteBuffer.allocate(n);
             buffer.flip();
             newBuffer.put(buffer);



Mime
View raw message