Author: alexparvulescu Date: Wed Nov 23 15:31:51 2016 New Revision: 1770983
URL: http://svn.apache.org/viewvc?rev=1770983&view=rev Log: OAK-5130 Prevent FileStore wrapping the segment buffer twice for the generation info Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java?rev=1770983&r1=1770982&r2=1770983&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java (original) +++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java Wed Nov 23 15:31:51 2016 @@ -26,7 +26,6 @@ import static com.google.common.collect. import static java.lang.String.format; import static java.lang.System.currentTimeMillis; import static java.lang.Thread.currentThread; -import static java.nio.ByteBuffer.wrap; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MINUTES; import static java.util.concurrent.TimeUnit.SECONDS; @@ -603,6 +602,7 @@ public class FileStore extends AbstractF // access some internal information stored in the segment and to store // in an in-memory cache for later use. + int generation = 0; if (id.isDataSegmentId()) { ByteBuffer data; @@ -615,12 +615,11 @@ public class FileStore extends AbstractF } segment = new Segment(this, segmentReader, id, data); + generation = segment.getGcGeneration(); } fileStoreLock.writeLock().lock(); try { - int generation = Segment.getGcGeneration(wrap(buffer, offset, length), id.asUUID()); - // Flush the segment to disk long size = tarWriter.writeEntry(
