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/07/29 18:26:49 UTC
svn commit: r1614408 - in /jackrabbit/oak/branches/1.0: ./
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
Author: alexparvulescu
Date: Tue Jul 29 16:26:48 2014
New Revision: 1614408
URL: http://svn.apache.org/r1614408
Log:
OAK-2001 TarMk compaction can still cause repository growth
- merged rev 1614405
Modified:
jackrabbit/oak/branches/1.0/ (props changed)
jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java
jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
Propchange: jackrabbit/oak/branches/1.0/
------------------------------------------------------------------------------
Merged /jackrabbit/oak/trunk:r1614405-1614406
Modified: jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java?rev=1614408&r1=1614407&r2=1614408&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java (original)
+++ jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Compactor.java Tue Jul 29 16:26:48 2014
@@ -116,14 +116,16 @@ public class Compactor {
}
}
- NodeBuilder child = builder.setChildNode(name);
- boolean success = EmptyNodeState.compareAgainstEmptyState(
- after, new CompactDiff(child));
-
- if (success && id != null && child.getChildNodeCount(2) > 1) {
- RecordId compactedId =
- writer.writeNode(child.getNodeState()).getRecordId();
- map.put(id, compactedId);
+ NodeBuilder child = EmptyNodeState.EMPTY_NODE.builder();
+ boolean success = EmptyNodeState.compareAgainstEmptyState(after,
+ new CompactDiff(child));
+
+ if (success) {
+ SegmentNodeState state = writer.writeNode(child.getNodeState());
+ builder.setChildNode(name, state);
+ if (id != null && state.getChildNodeCount(2) > 1) {
+ map.put(id, state.getRecordId());
+ }
}
return success;
@@ -203,7 +205,8 @@ public class Compactor {
List<RecordId> ids = binaries.get(key);
if (ids != null) {
for (RecordId duplicateId : ids) {
- if (new SegmentBlob(duplicateId).equals(blob)) {
+ if (new SegmentBlob(duplicateId).equals(sb)) {
+ map.put(id, duplicateId);
return new SegmentBlob(duplicateId);
}
}
@@ -220,7 +223,7 @@ public class Compactor {
return sb;
} catch (IOException e) {
- log.warn("Failed to compcat a blob", e);
+ log.warn("Failed to compact a blob", e);
// fall through
}
}
Modified: jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java?rev=1614408&r1=1614407&r2=1614408&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java (original)
+++ jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java Tue Jul 29 16:26:48 2014
@@ -354,15 +354,15 @@ public class FileStore implements Segmen
cleanup();
}
}
-
- // remove all obsolete tar generations
- Iterator<File> iterator = toBeRemoved.iterator();
- while (iterator.hasNext()) {
- File file = iterator.next();
- if (!file.exists() || file.delete()) {
- log.debug("TarMK GC: Removed old file {}", file);
- iterator.remove();
- }
+ }
+ // remove all obsolete tar generations
+ Iterator<File> iterator = toBeRemoved.iterator();
+ while (iterator.hasNext()) {
+ File file = iterator.next();
+ log.debug("TarMK GC: Attempting to remove old file {}", file);
+ if (!file.exists() || file.delete()) {
+ log.debug("TarMK GC: Removed old file {}", file);
+ iterator.remove();
}
}
}