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 fr...@apache.org on 2016/05/23 10:59:45 UTC
svn commit: r1745138 - in
/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run:
HistoryCommand.java SegmentTarUtils.java SegmentUtils.java
Author: frm
Date: Mon May 23 10:59:45 2016
New Revision: 1745138
URL: http://svn.apache.org/viewvc?rev=1745138&view=rev
Log:
OAK-4332 - Add a flag to choose between segment store implementations in the "history" command
Modified:
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/HistoryCommand.java
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentTarUtils.java
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentUtils.java
Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/HistoryCommand.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/HistoryCommand.java?rev=1745138&r1=1745137&r2=1745138&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/HistoryCommand.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/HistoryCommand.java Mon May 23 10:59:45 2016
@@ -24,7 +24,6 @@ import java.io.File;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
-import org.apache.jackrabbit.oak.plugins.segment.file.tooling.RevisionHistory;
class HistoryCommand implements Command {
@@ -42,6 +41,7 @@ class HistoryCommand implements Command
OptionSpec<Integer> depthArg = parser.accepts(
"depth", "Depth up to which to dump node states").withRequiredArg().ofType(Integer.class)
.defaultsTo(0);
+ OptionSpec segmentTar = parser.accepts("segment-tar", "Use oak-segment-tar instead of oak-segment");
OptionSet options = parser.parse(args);
File directory = directoryArg.value(options);
@@ -56,9 +56,10 @@ class HistoryCommand implements Command
String journalName = journalArg.value(options);
File journal = new File(isValidFileStoreOrFail(directory), journalName);
- Iterable<RevisionHistory.HistoryElement> history = new RevisionHistory(directory).getHistory(journal, path);
- for (RevisionHistory.HistoryElement historyElement : history) {
- System.out.println(historyElement.toString(depth));
+ if (options.has(segmentTar)) {
+ SegmentTarUtils.history(directory, journal, path, depth);
+ } else {
+ SegmentUtils.history(directory, journal, path, depth);
}
}
Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentTarUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentTarUtils.java?rev=1745138&r1=1745137&r2=1745138&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentTarUtils.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentTarUtils.java Mon May 23 10:59:45 2016
@@ -71,6 +71,7 @@ import org.apache.jackrabbit.oak.segment
import org.apache.jackrabbit.oak.segment.SegmentTracker;
import org.apache.jackrabbit.oak.segment.file.FileStore;
import org.apache.jackrabbit.oak.segment.file.FileStore.ReadOnlyStore;
+import org.apache.jackrabbit.oak.segment.file.tooling.RevisionHistory;
import org.apache.jackrabbit.oak.spi.blob.BlobStore;
import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -140,6 +141,13 @@ class SegmentTarUtils {
}
}
+ static void history(File directory, File journal, String path, int depth) throws IOException {
+ Iterable<RevisionHistory.HistoryElement> history = new RevisionHistory(directory).getHistory(journal, path);
+ for (RevisionHistory.HistoryElement historyElement : history) {
+ System.out.println(historyElement.toString(depth));
+ }
+ }
+
private static void debugFileStore(FileStore store) {
Map<SegmentId, List<SegmentId>> idmap = Maps.newHashMap();
int dataCount = 0;
Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentUtils.java?rev=1745138&r1=1745137&r2=1745138&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentUtils.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentUtils.java Mon May 23 10:59:45 2016
@@ -62,6 +62,7 @@ import org.apache.jackrabbit.oak.plugins
import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore;
import org.apache.jackrabbit.oak.plugins.segment.SegmentTracker;
import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
+import org.apache.jackrabbit.oak.plugins.segment.file.tooling.RevisionHistory;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.apache.jackrabbit.oak.spi.state.NodeStore;
@@ -123,6 +124,13 @@ class SegmentUtils {
}
}
+ static void history(File directory, File journal, String path, int depth) throws IOException {
+ Iterable<RevisionHistory.HistoryElement> history = new RevisionHistory(directory).getHistory(journal, path);
+ for (RevisionHistory.HistoryElement historyElement : history) {
+ System.out.println(historyElement.toString(depth));
+ }
+ }
+
private static void debugFileStore(FileStore store) {
Map<SegmentId, List<SegmentId>> idmap = Maps.newHashMap();
int dataCount = 0;