You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by md...@apache.org on 2015/04/15 09:58:12 UTC

svn commit: r1673671 - in /jackrabbit/oak/branches/1.2: ./ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/

Author: mduerig
Date: Wed Apr 15 07:58:12 2015
New Revision: 1673671

URL: http://svn.apache.org/r1673671
Log:
OAK-2662: SegmentOverflowException in HeavyWriteIT on Jenkins
Merged revision 1673663

Modified:
    jackrabbit/oak/branches/1.2/   (props changed)
    jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java
    jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java
    jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentStream.java
    jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java
    jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java

Propchange: jackrabbit/oak/branches/1.2/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Apr 15 07:58:12 2015
@@ -1,3 +1,3 @@
 /jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1672350,1672468,1672537,1672603,1672834-1672835,1673351,1673662
+/jackrabbit/oak/trunk:1672350,1672468,1672537,1672603,1672834-1672835,1673351,1673662-1673663
 /jackrabbit/trunk:1345480

Modified: jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java?rev=1673671&r1=1673670&r2=1673671&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java (original)
+++ jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java Wed Apr 15 07:58:12 2015
@@ -32,7 +32,7 @@ class Record {
     }
 
     static boolean fastEquals(Record a, Record b) {
-        return a.segmentId == b.segmentId && a.offset == b.offset;
+        return a.offset == b.offset && a.segmentId.equals(b.segmentId);
     }
 
     /**

Modified: jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java?rev=1673671&r1=1673670&r2=1673671&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java (original)
+++ jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java Wed Apr 15 07:58:12 2015
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.oak.plugins.segment;
 
 import static com.google.common.base.Charsets.UTF_8;
-import static com.google.common.collect.Sets.newIdentityHashSet;
+import static com.google.common.collect.Sets.newHashSet;
 import static java.util.Collections.emptySet;
 import static org.apache.jackrabbit.oak.plugins.segment.Segment.MEDIUM_LIMIT;
 import static org.apache.jackrabbit.oak.plugins.segment.Segment.SMALL_LIMIT;
@@ -236,7 +236,7 @@ public class SegmentBlob extends Record
             int listSize = (int) ((length + BLOCK_SIZE - 1) / BLOCK_SIZE);
             ListRecord list = new ListRecord(
                     segment.readRecordId(offset + 8), listSize);
-            Set<SegmentId> ids = newIdentityHashSet();
+            Set<SegmentId> ids = newHashSet();
             for (RecordId id : list.getEntries()) {
                 ids.add(id.getSegmentId());
             }

Modified: jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentStream.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentStream.java?rev=1673671&r1=1673670&r2=1673671&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentStream.java (original)
+++ jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentStream.java Wed Apr 15 07:58:12 2015
@@ -160,7 +160,7 @@ public class SegmentStream extends Input
                 }
 
                 if (id != null
-                        && id.getSegmentId() == first.getSegmentId()
+                        && id.getSegmentId().equals(first.getSegmentId())
                         && id.getOffset() == first.getOffset() + count * BLOCK_SIZE) {
                     count++;
                 } else {

Modified: jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java?rev=1673671&r1=1673670&r2=1673671&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java (original)
+++ jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java Wed Apr 15 07:58:12 2015
@@ -29,6 +29,7 @@ import java.util.concurrent.atomic.Atomi
 
 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;
@@ -205,7 +206,7 @@ public class SegmentTracker {
      * running.
      */
     public void collectBlobReferences(ReferenceCollector collector) {
-        Set<SegmentId> processed = newIdentityHashSet();
+        Set<SegmentId> processed = newHashSet();
         Queue<SegmentId> queue = newArrayDeque(getReferencedSegmentIds());
         writer.flush(); // force the current segment to have root record info
         while (!queue.isEmpty()) {

Modified: jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java?rev=1673671&r1=1673670&r2=1673671&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java (original)
+++ jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentWriter.java Wed Apr 15 07:58:12 2015
@@ -27,7 +27,7 @@ import static com.google.common.collect.
 import static com.google.common.collect.Lists.newArrayListWithExpectedSize;
 import static com.google.common.collect.Maps.newHashMap;
 import static com.google.common.collect.Maps.newLinkedHashMap;
-import static com.google.common.collect.Sets.newIdentityHashSet;
+import static com.google.common.collect.Sets.newHashSet;
 import static java.util.Arrays.asList;
 import static java.util.Collections.emptyMap;
 import static java.util.Collections.nCopies;
@@ -52,7 +52,6 @@ import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Set;
 
 import javax.jcr.PropertyType;
@@ -121,7 +120,7 @@ public class SegmentWriter {
     private final Map<Object, RecordId> records =
         new LinkedHashMap<Object, RecordId>(15000, 0.75f, true) {
             @Override
-            protected boolean removeEldestEntry(Entry<Object, RecordId> e) {
+            protected boolean removeEldestEntry(Map.Entry<Object, RecordId> e) {
                 return size() > 10000;
             }
         };
@@ -171,14 +170,6 @@ public class SegmentWriter {
         segment.getSegmentId().setSegment(segment);
     }
 
-    public synchronized Segment getCurrentSegment(SegmentId id) {
-        if (id == segment.getSegmentId()) {
-            return segment;
-        } else {
-            return null;
-        }
-    }
-
     /**
      * Adds a segment header to the buffer and writes a segment to the segment
      * store. This is done automatically (called from prepare) when there is not
@@ -301,8 +292,8 @@ public class SegmentWriter {
                 || refcount > Segment.SEGMENT_REFERENCE_LIMIT) {
             refcount -= idcount;
 
-            Set<SegmentId> segmentIds = newIdentityHashSet();
-            
+            Set<SegmentId> segmentIds = newHashSet();
+
             // The set of old record ids in this segment
             // that were previously root record ids, but will no longer be,
             // because the record to be written references them.
@@ -311,7 +302,7 @@ public class SegmentWriter {
             Set<RecordId> notRoots = new HashSet<RecordId>();
             for (RecordId recordId : ids) {
                 SegmentId segmentId = recordId.getSegmentId();
-                if (segmentId != segment.getSegmentId()) {
+                if (!(segmentId.equals(segment.getSegmentId()))) {
                     segmentIds.add(segmentId);
                 } else if (roots.containsKey(recordId)) {
                     notRoots.add(recordId);
@@ -353,7 +344,7 @@ public class SegmentWriter {
                   "Segment cannot have more than 255 references " + segment.getSegmentId());
         }
         for (int index = 0; index < refcount; index++) {
-            if (segmentId == segment.getRefId(index)) {
+            if (segmentId.equals(segment.getRefId(index))) {
                 return index;
             }
         }