Return-Path: X-Original-To: apmail-jackrabbit-oak-commits-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F2D1010FCC for ; Tue, 4 Feb 2014 16:13:16 +0000 (UTC) Received: (qmail 59638 invoked by uid 500); 4 Feb 2014 16:13:15 -0000 Delivered-To: apmail-jackrabbit-oak-commits-archive@jackrabbit.apache.org Received: (qmail 59577 invoked by uid 500); 4 Feb 2014 16:13:10 -0000 Mailing-List: contact oak-commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-dev@jackrabbit.apache.org Delivered-To: mailing list oak-commits@jackrabbit.apache.org Received: (qmail 59558 invoked by uid 99); 4 Feb 2014 16:13:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Feb 2014 16:13:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Feb 2014 16:13:05 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id F391323888E2; Tue, 4 Feb 2014 16:12:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1564366 - /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java Date: Tue, 04 Feb 2014 16:12:43 -0000 To: oak-commits@jackrabbit.apache.org From: jukka@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140204161243.F391323888E2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jukka Date: Tue Feb 4 16:12:43 2014 New Revision: 1564366 URL: http://svn.apache.org/r1564366 Log: OAK-1374: Async indexer fails on the SegmentMK Add a test case Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java?rev=1564366&r1=1564365&r2=1564366&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java (original) +++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java Tue Feb 4 16:12:43 2014 @@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.plugin import static com.google.common.collect.Lists.newArrayList; import static junit.framework.Assert.fail; +import static org.apache.jackrabbit.oak.api.Type.BINARIES; import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE; import static org.apache.jackrabbit.oak.plugins.segment.ListRecord.LEVEL_SIZE; import static org.junit.Assert.assertEquals; @@ -326,4 +327,33 @@ public class RecordTest { assertEquals(builder.getNodeState(), after); } + @Test + public void testMultiValuedBinaryPropertyAcrossSegments() + throws IOException { + // biggest possible inlined value record + byte[] data = new byte[Segment.MEDIUM_LIMIT - 1]; + random.nextBytes(data); + + // create enough copies of the value to fill a full segment + List blobs = newArrayList(); + while (blobs.size() * data.length < Segment.MAX_SEGMENT_SIZE) { + blobs.add(writer.writeStream(new ByteArrayInputStream(data))); + } + + // write a simple node that'll now be stored in a separate segment + NodeBuilder builder = EMPTY_NODE.builder(); + builder.setProperty("test", blobs, BINARIES); + NodeState state = writer.writeNode(builder.getNodeState()); + + // all the blobs should still be accessible, even if they're + // referenced from another segment + for (Blob blob : state.getProperty("test").getValue(BINARIES)) { + try { + blob.getNewStream().close(); + } catch (IllegalStateException e) { + fail("OAK-1374"); + } + } + } + }