mreutegg commented on a change in pull request #280:
URL: https://github.com/apache/jackrabbit-oak/pull/280#discussion_r584814271



##########
File path: 
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/DefaultSegmentWriter.java
##########
@@ -132,14 +134,16 @@ public DefaultSegmentWriter(
             @NotNull SegmentIdProvider idProvider,
             @Nullable BlobStore blobStore,
             @NotNull WriterCacheManager cacheManager,
-            @NotNull WriteOperationHandler writeOperationHandler
+            @NotNull WriteOperationHandler writeOperationHandler,
+            int binariesInlineThreshold

Review comment:
       JavaDoc comment is missing for this parameter.

##########
File path: 
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/DefaultSegmentWriter.java
##########
@@ -132,14 +134,16 @@ public DefaultSegmentWriter(
             @NotNull SegmentIdProvider idProvider,
             @Nullable BlobStore blobStore,
             @NotNull WriterCacheManager cacheManager,
-            @NotNull WriteOperationHandler writeOperationHandler
+            @NotNull WriteOperationHandler writeOperationHandler,
+            int binariesInlineThreshold
     ) {
         this.store = checkNotNull(store);
         this.reader = checkNotNull(reader);
         this.idProvider = checkNotNull(idProvider);
         this.blobStore = blobStore;
         this.cacheManager = checkNotNull(cacheManager);
         this.writeOperationHandler = checkNotNull(writeOperationHandler);
+        this.binariesInlineThreshold = binariesInlineThreshold;

Review comment:
       The FileStoreBuilder checks this argument, but not this public 
constructor. Would it be better to move the check here?

##########
File path: 
oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/BinariesInlineThresholdIT.java
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.segment;
+
+import static 
org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.fileStoreBuilder;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.Random;
+
+import org.apache.jackrabbit.core.data.FileDataStore;
+import org.apache.jackrabbit.oak.api.Blob;
+import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
+import org.apache.jackrabbit.oak.segment.file.FileStore;
+import org.apache.jackrabbit.oak.segment.file.FileStoreBuilder;
+import org.apache.jackrabbit.oak.spi.blob.BlobStore;
+import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
+import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+public class BinariesInlineThresholdIT {
+       private static final int SMALL_BINARIES_INLINE_THRESHOLD = 1024;
+
+       @Rule
+       public TemporaryFolder folder = new TemporaryFolder(new File("target"));
+
+//     private TemporaryBlobStore blobStore = new TemporaryBlobStore(folder);
+//
+//     private TemporaryFileStore fileStore = new TemporaryFileStore(folder, 
blobStore, false);
+       
+//     @Rule
+//     public RuleChain rules = 
RuleChain.outerRule(folder).around(blobStore).around(fileStore);

Review comment:
       Remove commented lines.

##########
File path: 
oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/BinariesInlineThresholdIT.java
##########
@@ -0,0 +1,194 @@
+/*

Review comment:
       General comment about this file. Can you please convert tabs into spaces?

##########
File path: 
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/DefaultSegmentWriter.java
##########
@@ -651,6 +657,17 @@ private RecordId internalWriteStream(@NotNull InputStream 
stream) throws IOExcep
                         new ByteArrayInputStream(data, 0, n), stream));
                 return writeBlobId(blobId);
             }
+            
+            // handle case in which blob store is not configured and
+            // binariesInlineThreshold < Segment.MEDIUM_LIMIT
+            // store the binaries as small or medium sized value records 
+            
+            data = Arrays.copyOf(data, Segment.MEDIUM_LIMIT);
+            n += read(stream, data, n, Segment.MEDIUM_LIMIT - n);
+            
+            if (n < Segment.MEDIUM_LIMIT) {
+                return writeValueRecord(n, data);

Review comment:
       AFAICS, this line is not covered by a unit test.

##########
File path: 
oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/BinariesInlineThresholdIT.java
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.segment;
+
+import static 
org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.fileStoreBuilder;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.Random;
+
+import org.apache.jackrabbit.core.data.FileDataStore;
+import org.apache.jackrabbit.oak.api.Blob;
+import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
+import org.apache.jackrabbit.oak.segment.file.FileStore;
+import org.apache.jackrabbit.oak.segment.file.FileStoreBuilder;
+import org.apache.jackrabbit.oak.spi.blob.BlobStore;
+import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
+import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+public class BinariesInlineThresholdIT {
+       private static final int SMALL_BINARIES_INLINE_THRESHOLD = 1024;
+
+       @Rule
+       public TemporaryFolder folder = new TemporaryFolder(new File("target"));
+
+//     private TemporaryBlobStore blobStore = new TemporaryBlobStore(folder);
+//
+//     private TemporaryFileStore fileStore = new TemporaryFileStore(folder, 
blobStore, false);
+       
+//     @Rule
+//     public RuleChain rules = 
RuleChain.outerRule(folder).around(blobStore).around(fileStore);
+
+       private BlobStore createBlobStore(File dir) throws Throwable {

Review comment:
       Throws clause is unnecessary.

##########
File path: 
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/DefaultSegmentWriter.java
##########
@@ -638,11 +642,13 @@ private RecordId writeStream(@NotNull InputStream stream) 
throws IOException {
         }
 
         private RecordId internalWriteStream(@NotNull InputStream stream) 
throws IOException {
-            // Special case for short binaries (up to about 16kB):
+            // Special case for short binaries (up to about 
binariesInlineThreshold - 16kB default):

Review comment:
       This comment confused me. I interpreted the dash as an arithmetic 
operation, but it's not, right? Maybe remove '- 16kB default' or separate with 
a semicolon.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to