Author: mduerig
Date: Mon Nov 20 09:21:25 2017
New Revision: 1815783
URL: http://svn.apache.org/viewvc?rev=1815783&view=rev
Log:
OAK-6931: Enable the -Dcache of offline compaction
merged r1815201
Modified:
jackrabbit/oak/branches/1.6/ (props changed)
jackrabbit/oak/branches/1.6/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentTarUtils.java
jackrabbit/oak/branches/1.6/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Compact.java
Propchange: jackrabbit/oak/branches/1.6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 20 09:21:25 2017
@@ -1,3 +1,3 @@
/jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1781068,1781075,1781248,1781386,1781846,1781907,1782000,1782029,1782196,1782447,1782476,1782770,1782945,1782966,1782973,1782990,1783061,1783066,1783089,1783104-1783105,1783110,1783619,1783720,1783731,1783733,1783738,1783742,1783773,1783855,1783891,1784023,1784034,1784130,1784162,1784251,1784401,1784551,1784574,1784689,1785095,1785108,1785283,1785838,1785917,1785919,1785946,1786122,1787074,1787145,1787151,1787217,1787425,1788056,1788378,1788387-1788389,1788463,1788476,1788850,1789056,1789534,1790382,1792049,1792463,1792483,1792742,1792746,1793013,1793088,1793618,1793627,1793644,1794393,1794417,1794683,1795138,1795314,1795330,1795475,1795488,1795491,1795502,1795594,1795613,1795618,1796144,1796230,1796239,1796274,1796278,1796988,1797378,1798035,1798834,1799219,1799389,1799393,1799924,1800244,1800269,1800606,1800613,1800974,1801011,1801013,1801118-1801119,1801675,1802260,1802262,1802286,1802548,1802934,1802938,1802973,1803026,1803247-1803249,1803951,1803953-1803955
,1805851-1805852,1806668,1807308,1807688,1808125,1808128,1808142,1808240,1808246,1809024,1809026,1809131,1809163,1809253,1809255-1809256,1809289,1809745,1811071-1811072,1811155,1811380,1811655,1811952,1811963,1811986,1813192,1814189,1814332,1814397,1815426
+/jackrabbit/oak/trunk:1781068,1781075,1781248,1781386,1781846,1781907,1782000,1782029,1782196,1782447,1782476,1782770,1782945,1782966,1782973,1782990,1783061,1783066,1783089,1783104-1783105,1783110,1783619,1783720,1783731,1783733,1783738,1783742,1783773,1783855,1783891,1784023,1784034,1784130,1784162,1784251,1784401,1784551,1784574,1784689,1785095,1785108,1785283,1785838,1785917,1785919,1785946,1786122,1787074,1787145,1787151,1787217,1787425,1788056,1788378,1788387-1788389,1788463,1788476,1788850,1789056,1789534,1790382,1792049,1792463,1792483,1792742,1792746,1793013,1793088,1793618,1793627,1793644,1794393,1794417,1794683,1795138,1795314,1795330,1795475,1795488,1795491,1795502,1795594,1795613,1795618,1796144,1796230,1796239,1796274,1796278,1796988,1797378,1798035,1798834,1799219,1799389,1799393,1799924,1800244,1800269,1800606,1800613,1800974,1801011,1801013,1801118-1801119,1801675,1802260,1802262,1802286,1802548,1802934,1802938,1802973,1803026,1803247-1803249,1803951,1803953-1803955
,1805851-1805852,1806668,1807308,1807688,1808125,1808128,1808142,1808240,1808246,1809024,1809026,1809131,1809163,1809253,1809255-1809256,1809289,1809745,1811071-1811072,1811155,1811380,1811655,1811952,1811963,1811986,1813192,1814189,1814332,1814397,1815201,1815426
/jackrabbit/trunk:1345480
Modified:
jackrabbit/oak/branches/1.6/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentTarUtils.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.6/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentTarUtils.java?rev=1815783&r1=1815782&r2=1815783&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.6/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentTarUtils.java
(original)
+++
jackrabbit/oak/branches/1.6/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentTarUtils.java
Mon Nov 20 09:21:25 2017
@@ -202,6 +202,7 @@ final class SegmentTarUtils {
Compact.builder()
.withPath(directory)
.withMmap(mmap)
+ .withSegmentCacheSize(TAR_SEGMENT_CACHE_SIZE)
.build()
.run();
}
Modified:
jackrabbit/oak/branches/1.6/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Compact.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.6/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Compact.java?rev=1815783&r1=1815782&r2=1815783&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.6/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Compact.java
(original)
+++
jackrabbit/oak/branches/1.6/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Compact.java
Mon Nov 20 09:21:25 2017
@@ -17,7 +17,9 @@
package org.apache.jackrabbit.oak.segment.tool;
+import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
+import static
org.apache.jackrabbit.oak.segment.SegmentCache.DEFAULT_SEGMENT_CACHE_MB;
import static
org.apache.jackrabbit.oak.segment.compaction.SegmentGCOptions.defaultGCOptions;
import static
org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.fileStoreBuilder;
@@ -28,6 +30,7 @@ import java.io.RandomAccessFile;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
+import org.apache.jackrabbit.oak.segment.SegmentCache;
import org.apache.jackrabbit.oak.segment.file.FileStore;
import org.apache.jackrabbit.oak.segment.file.FileStoreBuilder;
import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException;
@@ -57,6 +60,8 @@ public class Compact implements Runnable
@CheckForNull
private Boolean mmap;
+ private int segmentCacheSize = DEFAULT_SEGMENT_CACHE_MB;
+
private Builder() {
// Prevent external instantiation.
}
@@ -85,6 +90,19 @@ public class Compact implements Runnable
}
/**
+ * The size of the segment cache in MB. The default of {@link
SegmentCache#DEFAULT_SEGMENT_CACHE_MB}
+ * when this method is not invoked.
+ * @param segmentCacheSize cache size in MB
+ * @return this builder
+ * @throws IllegalArgumentException if {@code segmentCacheSize} is
not a positive integer.
+ */
+ public Builder withSegmentCacheSize(int segmentCacheSize) {
+ checkArgument(segmentCacheSize > 0, "segmentCacheSize must be
positive");
+ this.segmentCacheSize = segmentCacheSize;
+ return this;
+ }
+
+ /**
* Create an executable version of the {@link Compact} command.
*
* @return an instance of {@link Runnable}.
@@ -101,9 +119,12 @@ public class Compact implements Runnable
@CheckForNull
private final Boolean mmap;
+ private final int segmentCacheSize;
+
private Compact(Builder builder) {
this.path = builder.path;
this.mmap = builder.mmap;
+ this.segmentCacheSize = builder.segmentCacheSize;
}
@Override
@@ -140,6 +161,7 @@ public class Compact implements Runnable
private FileStore newFileStore() throws IOException,
InvalidFileStoreVersionException {
FileStoreBuilder fileStoreBuilder =
fileStoreBuilder(path.getAbsoluteFile())
+ .withSegmentCacheSize(segmentCacheSize)
.withGCOptions(defaultGCOptions().setOffline());
return mmap == null