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 al...@apache.org on 2014/08/20 22:42:56 UTC
svn commit: r1619222 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java
Author: alexparvulescu
Date: Wed Aug 20 20:42:56 2014
New Revision: 1619222
URL: http://svn.apache.org/r1619222
Log:
OAK-2042 TarMK CompactionMap should include more nodes
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java?rev=1619222&r1=1619221&r2=1619222&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java Wed Aug 20 20:42:56 2014
@@ -52,6 +52,11 @@ public class Compactor {
private static final Logger log = LoggerFactory.getLogger(Compactor.class);
/**
+ * over 64K in size, not will be included in the compaction map
+ */
+ private static final long threshold = 65536;
+
+ /**
* Locks down the RecordId persistence structure
*/
static long[] recordAsKey(RecordId r) {
@@ -127,7 +132,7 @@ public class Compactor {
if (success) {
SegmentNodeState state = writer.writeNode(child.getNodeState());
builder.setChildNode(name, state);
- if (id != null && state.getChildNodeCount(2) > 1) {
+ if (id != null && includeInMap(state)) {
map.put(id, state.getRecordId());
}
}
@@ -135,6 +140,22 @@ public class Compactor {
return success;
}
+ private boolean includeInMap(SegmentNodeState state) {
+ if (state.getChildNodeCount(2) > 1) {
+ return true;
+ }
+ int count = 0;
+ for (PropertyState ps : state.getProperties()) {
+ for (int i = 0; i < ps.count(); i++) {
+ count += ps.size(i);
+ if (count >= threshold) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
@Override
public boolean childNodeChanged(
String name, NodeState before, NodeState after) {