oak-run compact reports success even when it was cancelled
Print a message and return 1 on cancellation
@@ -31,10 +31,10 @@ import static org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.fileStoreB
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
-import java.io.RandomAccessFile;
import java.util.Date;
import java.util.Set;
import java.util.concurrent.TimeUnit;
+
import javax.annotation.Nullable;
import com.google.common.base.Stopwatch;
@@ -272,7 +272,10 @@ public class Compact {
Stopwatch watch = Stopwatch.createStarted();
try (FileStore store = newFileStore()) {
- store.compactFull();
+ if (!store.compactFull()) {
+ System.out.printf("Compaction cancelled after %s.\n", printableStopwatch(watch));
+ return 1;
+ }
System.out.printf(" -> cleaning up\n");
store.cleanup();
JournalFile journal = new LocalJournalFile(path, "journal.log");
@@ -289,7 +292,7 @@ public class Compact {
} catch (Exception e) {
watch.stop();
e.printStackTrace(System.err);
- System.out.printf("Compaction failed in %s.\n", printableStopwatch(watch));
+ System.out.printf("Compaction failed after %s.\n", printableStopwatch(watch));
return 1;
}
