Author: mduerig
Date: Tue Jun 30 08:35:46 2015
New Revision: 1688397
URL: http://svn.apache.org/r1688397
Log:
OAK-3044: Backport OAK-2945 to 1.2 branch
merged revision 1683059
Modified:
jackrabbit/oak/branches/1.2/ (props changed)
jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionGainEstimate.java
Propchange: jackrabbit/oak/branches/1.2/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 30 08:35:46 2015
@@ -1,3 +1,3 @@
/jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1672350,1672468,1672537,1672603,1672642,1672644,1672834-1672835,1673351,1673410,1673414-1673415,1673436,1673644,1673662-1673664,1673669,1673695,1673738,1673787,1673791,1674046,1674065,1674075,1674107,1674228,1674780,1674880,1675054-1675055,1675319,1675332,1675354,1675357,1675382,1675555,1675566,1675593,1676198,1676237,1676407,1676458,1676539,1676670,1676693,1676703,1676725,1677579,1677581,1677609,1677611,1677774,1677788,1677797,1677804,1677806,1677939,1677991,1678173,1678323,1678758,1678938,1678954,1679144,1679165,1679191,1679232,1679235,1679958,1679961,1680182,1680222,1680232,1680236,1680461,1680633,1680643,1680805-1680806,1680903,1681282,1681767,1681918,1682218,1682235,1682437,1682494,1682555,1682855,1682904,1683089,1683213,1683249,1683259,1683278,1683323,1683687,1683700,1684174-1684175,1684186,1684376,1684442,1684561,1684570,1684601,1684618,1684868,1685023,1685370,1685552,1685589,1685840,1685999,1686097,1686162,1686229,1686234,1686253,1686414,1686780,1686854
,1686857,1686971,1687053-1687055,1687198,1687220,1687239-1687240,1687301,1687441,1687553,1688089-1688090,1688349
+/jackrabbit/oak/trunk:1672350,1672468,1672537,1672603,1672642,1672644,1672834-1672835,1673351,1673410,1673414-1673415,1673436,1673644,1673662-1673664,1673669,1673695,1673738,1673787,1673791,1674046,1674065,1674075,1674107,1674228,1674780,1674880,1675054-1675055,1675319,1675332,1675354,1675357,1675382,1675555,1675566,1675593,1676198,1676237,1676407,1676458,1676539,1676670,1676693,1676703,1676725,1677579,1677581,1677609,1677611,1677774,1677788,1677797,1677804,1677806,1677939,1677991,1678173,1678323,1678758,1678938,1678954,1679144,1679165,1679191,1679232,1679235,1679958,1679961,1680182,1680222,1680232,1680236,1680461,1680633,1680643,1680805-1680806,1680903,1681282,1681767,1681918,1682218,1682235,1682437,1682494,1682555,1682855,1682904,1683059,1683089,1683213,1683249,1683259,1683278,1683323,1683687,1683700,1684174-1684175,1684186,1684376,1684442,1684561,1684570,1684601,1684618,1684868,1685023,1685370,1685552,1685589,1685840,1685999,1686097,1686162,1686229,1686234,1686253,1686414,1686780
,1686854,1686857,1686971,1687053-1687055,1687198,1687220,1687239-1687240,1687301,1687441,1687553,1688089-1688090,1688349
/jackrabbit/trunk:1345480
Modified:
jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionGainEstimate.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionGainEstimate.java?rev=1688397&r1=1688396&r2=1688397&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionGainEstimate.java
(original)
+++
jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/CompactionGainEstimate.java
Tue Jun 30 08:35:46 2015
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.segment.file;
-import static java.lang.Integer.getInteger;
import static org.apache.jackrabbit.oak.api.Type.BINARIES;
import java.io.File;
@@ -36,17 +35,6 @@ import org.apache.jackrabbit.oak.spi.sta
class CompactionGainEstimate implements TarEntryVisitor {
- /**
- * The sampling rate of the compaction estimation process.
- * For a value of {@code n} only a random sample containing
- * every n-th segment is taken into account for estimating the
- * compaction gain.
- * <p>
- * Defaults to 1.
- */
- public static final int UUID_SAMPLING_RATE =
- getInteger("compaction.estimate.sampling.rate", 1);
-
private static final Funnel<UUID> UUID_FUNNEL = new Funnel<UUID>() {
@Override
public void funnel(UUID from, PrimitiveSink into) {
@@ -68,15 +56,15 @@ class CompactionGainEstimate implements
private void collectReferencedSegments(SegmentNodeState node, RecordIdSet
visited) {
if (visited.addIfNotPresent(node.getRecordId())) {
- collectUUID(asUUID(node.getRecordId().getSegmentId()));
+ collectUUID(node.getRecordId().getSegmentId());
for (PropertyState property : node.getProperties()) {
if (property instanceof SegmentPropertyState) {
- collectUUID(asUUID(((SegmentPropertyState) property)
- .getRecordId().getSegmentId()));
+ collectUUID(((SegmentPropertyState) property)
+ .getRecordId().getSegmentId());
}
for (Blob blob : property.getValue(BINARIES)) {
for (SegmentId id : SegmentBlob.getBulkSegmentIds(blob)) {
- collectUUID(asUUID(id));
+ collectUUID(id);
}
}
}
@@ -87,19 +75,10 @@ class CompactionGainEstimate implements
}
}
- private void collectUUID(UUID uuid) {
- if (includeUUID(uuid)) {
- uuids.put(uuid);
- }
- }
-
- private static boolean includeUUID(UUID uuid) {
- return uuid.getLeastSignificantBits() % UUID_SAMPLING_RATE == 0;
- }
-
- private static UUID asUUID(SegmentId id) {
- return new UUID(id.getMostSignificantBits(),
- id.getLeastSignificantBits());
+ private void collectUUID(SegmentId segmentId) {
+ uuids.put(new UUID(
+ segmentId.getMostSignificantBits(),
+ segmentId.getLeastSignificantBits()));
}
/**
@@ -128,12 +107,10 @@ class CompactionGainEstimate implements
@Override
public void visit(long msb, long lsb, File file, int offset, int size) {
UUID uuid = new UUID(msb, lsb);
- if (includeUUID(uuid)) {
- int entrySize = TarReader.getEntrySize(size);
- totalSize += entrySize;
- if (uuids.mightContain(uuid)) {
- reachableSize += entrySize;
- }
+ int entrySize = TarReader.getEntrySize(size);
+ totalSize += entrySize;
+ if (uuids.mightContain(uuid)) {
+ reachableSize += entrySize;
}
}