You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Valentin Olteanu (JIRA)" <ji...@apache.org> on 2017/10/05 14:17:00 UTC

[jira] [Created] (OAK-6784) Exceptions are inhibited in oak-run compact

Valentin Olteanu created OAK-6784:
-------------------------------------

             Summary: Exceptions are inhibited in oak-run compact
                 Key: OAK-6784
                 URL: https://issues.apache.org/jira/browse/OAK-6784
             Project: Jackrabbit Oak
          Issue Type: Bug
          Components: run, segment-tar
    Affects Versions: 1.7.8
            Reporter: Valentin Olteanu
             Fix For: 1.8


Exceptions thrown by {{oak-run compact}} are inhibited so the exit code of the command is not correct in case of error. 

Example: 
{code}
$ java -jar oak-run-1.7.8-R1809845.jar compact test-oak-run/
Apache Jackrabbit Oak 1.7.8-R1809845
Compacting test-oak-run-6.3.0
With default access mode
    before
        Thu Oct 05 15:14:22 CEST 2017, journal.log
        Thu Oct 05 15:14:23 CEST 2017, data00000a.tar
        Thu Oct 05 15:14:23 CEST 2017, manifest
        Thu Oct 05 15:14:23 CEST 2017, repo.lock
    size 119.1 MB (119133142 bytes)
    -> compacting
org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException: Using a too recent version of oak-segment-tar
	at org.apache.jackrabbit.oak.segment.file.ManifestChecker.checkStoreVersion(ManifestChecker.java:81)
	at org.apache.jackrabbit.oak.segment.file.ManifestChecker.checkManifest(ManifestChecker.java:70)
	at org.apache.jackrabbit.oak.segment.file.ManifestChecker.checkAndUpdateManifest(ManifestChecker.java:51)
	at org.apache.jackrabbit.oak.segment.file.FileStore.<init>(FileStore.java:191)
	at org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.build(FileStoreBuilder.java:343)
	at org.apache.jackrabbit.oak.segment.tool.Compact.newFileStore(Compact.java:165)
	at org.apache.jackrabbit.oak.segment.tool.Compact.compact(Compact.java:135)
	at org.apache.jackrabbit.oak.segment.tool.Compact.run(Compact.java:128)
	at org.apache.jackrabbit.oak.run.SegmentTarUtils.compact(SegmentTarUtils.java:183)
	at org.apache.jackrabbit.oak.run.CompactCommand.execute(CompactCommand.java:93)
	at org.apache.jackrabbit.oak.run.Main.main(Main.java:49)
    after
        Thu Oct 05 15:14:22 CEST 2017, journal.log
        Thu Oct 05 15:14:23 CEST 2017, data00000a.tar
        Thu Oct 05 15:14:23 CEST 2017, manifest
        Thu Oct 05 15:14:23 CEST 2017, repo.lock
    size 119.1 MB (119133142 bytes)
    removed files []
    added files []
Compaction succeeded in 211.9 ms (0s).
{code}

A quick fix would be to wrap the exception into a {{RuntimeException}}:
{code}
--- a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Compact.java
+++ b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Compact.java
@@ -127,7 +127,7 @@ public class Compact implements Runnable {
         try {
             compact();
         } catch (Exception e) {
-            e.printStackTrace();
+            throw new RuntimeException("Failed to run compact", e);
         }
     }
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)