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 md...@apache.org on 2017/01/26 17:04:20 UTC
svn commit: r1780429 - in /jackrabbit/oak/trunk/oak-segment-tar/src:
main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java
test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java
Author: mduerig
Date: Thu Jan 26 17:04:19 2017
New Revision: 1780429
URL: http://svn.apache.org/viewvc?rev=1780429&view=rev
Log:
OAK-5517: SNFE when running compaction after a cancelled gc
Correctly evict the deduplication cache for nodes whenever a compaction run is aborted
Modified:
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java?rev=1780429&r1=1780428&r2=1780429&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java Thu Jan 26 17:04:19 2017
@@ -831,6 +831,16 @@ public class FileStore extends AbstractF
}
}
+ private int compactionAborted(int generation) {
+ gcListener.compactionFailed(generation);
+ return -generation;
+ }
+
+ private int compactionSucceeded(int generation) {
+ gcListener.compactionSucceeded(generation);
+ return generation;
+ }
+
synchronized int compact() {
final int newGeneration = getGcGeneration() + 1;
try {
@@ -854,7 +864,7 @@ public class FileStore extends AbstractF
SegmentNodeState after = compact(before, writer, cancel);
if (after == null) {
gcListener.warn("TarMK GC #{}: compaction cancelled: {}.", GC_COUNT, cancel);
- return -newGeneration;
+ return compactionAborted(newGeneration);
}
gcListener.info("TarMK GC #{}: compaction cycle 0 completed in {} ({} ms). Compacted {} to {}",
@@ -878,7 +888,7 @@ public class FileStore extends AbstractF
after = compact(head, writer, cancel);
if (after == null) {
gcListener.warn("TarMK GC #{}: compaction cancelled: {}.", GC_COUNT, cancel);
- return -newGeneration;
+ return compactionAborted(newGeneration);
}
gcListener.info("TarMK GC #{}: compaction cycle {} completed in {} ({} ms). Compacted {} against {} to {}",
@@ -920,23 +930,21 @@ public class FileStore extends AbstractF
if (success) {
writer.flush();
- gcListener.compactionSucceeded(newGeneration);
gcListener.info("TarMK GC #{}: compaction succeeded in {} ({} ms), after {} cycles",
GC_COUNT, watch, watch.elapsed(MILLISECONDS), cycles);
- return newGeneration;
+ return compactionSucceeded(newGeneration);
} else {
- gcListener.compactionFailed(newGeneration);
gcListener.info("TarMK GC #{}: compaction failed after {} ({} ms), and {} cycles",
GC_COUNT, watch, watch.elapsed(MILLISECONDS), cycles);
- return -newGeneration;
+ return compactionAborted(newGeneration);
}
} catch (InterruptedException e) {
gcListener.error("TarMK GC #" + GC_COUNT + ": compaction interrupted", e);
currentThread().interrupt();
- return -newGeneration;
- } catch (Exception e) {
+ return compactionAborted(newGeneration);
+ } catch (IOException e) {
gcListener.error("TarMK GC #" + GC_COUNT + ": compaction encountered an error", e);
- return -newGeneration;
+ return compactionAborted(newGeneration);
}
}
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java?rev=1780429&r1=1780428&r2=1780429&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactionAndCleanupIT.java Thu Jan 26 17:04:19 2017
@@ -77,7 +77,6 @@ import org.apache.jackrabbit.oak.stats.C
import org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider;
import org.apache.jackrabbit.oak.stats.StatisticsProvider;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -563,7 +562,6 @@ public class CompactionAndCleanupIT {
/**
* See OAK-5517: SNFE when running compaction after a cancelled gc
*/
- @Ignore("OAK-5517") // FIXME OAK-5517: SNFE when running compaction after a cancelled gc
@Test
public void testCancelCompactionSNFE()
throws Throwable {