Author: frm
Date: Thu Jun 29 15:51:58 2017
New Revision: 1800297
URL: http://svn.apache.org/viewvc?rev=1800297&view=rev
Log:
OAK-6021 - Remove 'graph' command from oak-run
Removed:
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/GraphCommand.java
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentGraph.java
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/GenerationGraph.java
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/SegmentGraph.java
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentGraphTest.java
Modified:
jackrabbit/oak/trunk/oak-run/README.md
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/AvailableModes.java
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/SegmentTarUtils.java
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/ReadOnlyFileStore.java
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarFiles.java
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarReader.java
Modified: jackrabbit/oak/trunk/oak-run/README.md
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/README.md?rev=1800297&r1=1800296&r2=1800297&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/README.md (original)
+++ jackrabbit/oak/trunk/oak-run/README.md Thu Jun 29 15:51:58 2017
@@ -15,7 +15,6 @@ The following runmodes are currently ava
* debug : Print status information about an Oak repository.
* explore : Starts a GUI browser based on java swing.
* garbage : Identifies blob garbage on a DocumentMK repository
- * graph : Export the segment graph of a segment store to a file.
* help : Print a list of available runmodes
* history : Trace the history of a node
* recovery : Run a _lastRev recovery on a MongoMK repository
@@ -130,33 +129,6 @@ browsing of an existing oak repository.
$ java -jar oak-run-*.jar explore /path/to/oak/repository [skip-size-check]
-Graph
------
-
-The 'graph' mode export the segment graph of a file store to a text file in the
-[Guess GDF
format](https://gephi.github.io/users/supported-graph-formats/gdf-format/),
-which is easily imported into [Gephi](https://gephi.github.io).
-
-As the GDF format only supports integer values but the segment time stamps are
encoded as long
-values an optional 'epoch' argument can be specified. If no epoch is given on
the command line
-the start of the day of the last modified date of the 'journal.log' is used.
The epoch specifies
-a negative offset translating all timestamps into a valid int range.
-
- $ java -jar oak-run-*.jar graph [File] <options>
-
- [File] -- Path to segment store (required)
-
- Option Description
- ------ -----------
- --epoch <Long> Epoch of the segment time stamps
- (derived from journal.log if not
- given)
- --output <File> Output file (default: segments.gdf)
- --gc Write the gc generation graph instead of the full graph
- --pattern Regular exception specifying which
- nodes to include (optional). Ignore
- when --gc is specified.
-
History
-------
Modified:
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/AvailableModes.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/AvailableModes.java?rev=1800297&r1=1800296&r2=1800297&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/AvailableModes.java
(original)
+++
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/AvailableModes.java
Thu Jun 29 15:51:58 2017
@@ -38,7 +38,6 @@ public final class AvailableModes {
.put("debug", new DebugCommand())
.put("explore", new ExploreCommand())
.put("garbage", new GarbageCommand())
- .put("graph", new GraphCommand())
.put("help", new HelpCommand())
.put("history", new HistoryCommand())
.put(JsonIndexCommand.INDEX, new JsonIndexCommand())
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=1800297&r1=1800296&r2=1800297&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
Thu Jun 29 15:51:58 2017
@@ -23,16 +23,15 @@ import static org.apache.jackrabbit.oak.
import java.io.File;
import java.io.IOException;
-import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import com.google.common.io.Closer;
import org.apache.jackrabbit.oak.plugins.blob.BlobReferenceRetriever;
import org.apache.jackrabbit.oak.segment.SegmentBlobReferenceRetriever;
import org.apache.jackrabbit.oak.segment.SegmentNodeStoreBuilders;
@@ -48,15 +47,11 @@ import org.apache.jackrabbit.oak.segment
import org.apache.jackrabbit.oak.segment.tool.DebugStore;
import org.apache.jackrabbit.oak.segment.tool.DebugTars;
import org.apache.jackrabbit.oak.segment.tool.Diff;
-import org.apache.jackrabbit.oak.segment.tool.GenerationGraph;
import org.apache.jackrabbit.oak.segment.tool.History;
import org.apache.jackrabbit.oak.segment.tool.Restore;
import org.apache.jackrabbit.oak.segment.tool.Revisions;
-import org.apache.jackrabbit.oak.segment.tool.SegmentGraph;
import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import com.google.common.io.Closer;
-
final class SegmentTarUtils {
private static final boolean TAR_STORAGE_MEMORY_MAPPED =
Boolean.getBoolean("tar.memoryMapped");
@@ -154,32 +149,6 @@ final class SegmentTarUtils {
;
}
- static void graph(File path, boolean gcGraph, Date epoch, String regex,
OutputStream out) {
- if (gcGraph) {
- generationGraph(path, out);
- } else {
- segmentGraph(path, epoch, regex, out);
- }
- }
-
- private static void generationGraph(File path, OutputStream out) {
- GenerationGraph.builder()
- .withPath(path)
- .withOutput(out)
- .build()
- .run();
- }
-
- private static void segmentGraph(File path, Date epoch, String regex,
OutputStream out) {
- SegmentGraph.builder()
- .withPath(path)
- .withEpoch(epoch)
- .withFilter(regex)
- .withOutput(out)
- .build()
- .run();
- }
-
static void history(File directory, File journal, String path, int depth) {
History.builder()
.withPath(directory)
Modified:
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/ReadOnlyFileStore.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/ReadOnlyFileStore.java?rev=1800297&r1=1800296&r2=1800297&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/ReadOnlyFileStore.java
(original)
+++
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/ReadOnlyFileStore.java
Thu Jun 29 15:51:58 2017
@@ -34,7 +34,6 @@ import javax.annotation.Nonnull;
import com.google.common.io.Closer;
import org.apache.jackrabbit.oak.segment.RecordId;
import org.apache.jackrabbit.oak.segment.Segment;
-import org.apache.jackrabbit.oak.segment.SegmentGraph.SegmentGraphVisitor;
import org.apache.jackrabbit.oak.segment.SegmentId;
import org.apache.jackrabbit.oak.segment.SegmentWriter;
import org.apache.jackrabbit.oak.segment.file.tar.TarFiles;
@@ -100,19 +99,6 @@ public class ReadOnlyFileStore extends A
}
}
- /**
- * Build the graph of segments reachable from an initial set of segments
- *
- * @param roots
- * the initial set of segments
- * @param visitor
- * visitor receiving call back while following the segment graph
- * @throws IOException
- */
- public void traverseSegmentGraph(@Nonnull Set<UUID> roots, @Nonnull
SegmentGraphVisitor visitor) throws IOException {
- tarFiles.traverseSegmentGraph(roots, visitor);
- }
-
@Override
public void writeSegment(SegmentId id, byte[] data, int offset, int
length) {
throw new UnsupportedOperationException("Read Only Store");
Modified:
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarFiles.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarFiles.java?rev=1800297&r1=1800296&r2=1800297&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarFiles.java
(original)
+++
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarFiles.java
Thu Jun 29 15:51:58 2017
@@ -51,7 +51,6 @@ import javax.annotation.Nonnull;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
-import org.apache.jackrabbit.oak.segment.SegmentGraph.SegmentGraphVisitor;
import org.apache.jackrabbit.oak.segment.file.FileStoreStats;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -240,20 +239,6 @@ public class TarFiles implements Closeab
return dataFiles;
}
- private static void includeForwardReferences(Node head, Set<UUID>
referencedIds) throws IOException {
- Set<UUID> references = newHashSet(referencedIds);
- do {
- // Add direct forward references
- for (TarReader reader : iterable(head)) {
- reader.calculateForwardReferences(references);
- if (references.isEmpty()) {
- break; // Optimisation: bail out if no references left
- }
- }
- // ... as long as new forward references are found.
- } while (referencedIds.addAll(references));
- }
-
public static Builder builder() {
return new Builder();
}
@@ -753,20 +738,4 @@ public class TarFiles implements Closeab
return index;
}
- public void traverseSegmentGraph(Set<UUID> roots, SegmentGraphVisitor
visitor) throws IOException {
- Node head;
-
- lock.readLock().lock();
- try {
- head = readers;
- } finally {
- lock.readLock().unlock();
- }
-
- includeForwardReferences(head, roots);
- for (TarReader reader : iterable(head)) {
- reader.traverseSegmentGraph(roots, visitor);
- }
- }
-
}
Modified:
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarReader.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarReader.java?rev=1800297&r1=1800296&r2=1800297&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarReader.java
(original)
+++
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarReader.java
Thu Jun 29 15:51:58 2017
@@ -20,7 +20,6 @@
package org.apache.jackrabbit.oak.segment.file.tar;
import static com.google.common.base.Charsets.UTF_8;
-import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Lists.newArrayListWithCapacity;
import static com.google.common.collect.Maps.newHashMapWithExpectedSize;
@@ -63,7 +62,6 @@ import com.google.common.base.Predicate;
import com.google.common.base.Stopwatch;
import com.google.common.collect.Sets;
import org.apache.commons.io.FileUtils;
-import org.apache.jackrabbit.oak.segment.SegmentGraph.SegmentGraphVisitor;
import org.apache.jackrabbit.oak.segment.SegmentId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -539,6 +537,7 @@ class TarReader implements Closeable {
*
* @return number of segments
*/
+ // TODO frm this method is not used
int count() {
return index.capacity() / TarEntry.SIZE;
}
@@ -549,6 +548,7 @@ class TarReader implements Closeable {
*
* @param visitor entry visitor
*/
+ // TODO frm this method is not used
void accept(TarEntryVisitor visitor) {
int position = index.position();
while (position < index.limit()) {
@@ -709,61 +709,6 @@ class TarReader implements Closeable {
}
/**
- * Build the graph of segments reachable from an initial set of segments
- * @param roots the initial set of segments
- * @param visitor visitor receiving call back while following the
segment graph
- * @throws IOException
- */
- // TODO frm remove this method, see OAK-6021
- public void traverseSegmentGraph(
- @Nonnull Set<UUID> roots,
- @Nonnull SegmentGraphVisitor visitor) throws IOException {
- checkNotNull(roots);
- checkNotNull(visitor);
- Map<UUID, List<UUID>> graph = getGraph(false);
-
- TarEntry[] entries = getEntries();
- for (int i = entries.length - 1; i >= 0; i--) {
- TarEntry entry = entries[i];
- UUID id = new UUID(entry.msb(), entry.lsb());
- if (roots.remove(id) && isDataSegmentId(entry.lsb())) {
- // this is a referenced data segment, so follow the graph
- for (UUID refId : getReferences(entry, id, graph)) {
- visitor.accept(id, refId);
- roots.add(refId);
- }
- } else {
- // this segment is not referenced anywhere
- visitor.accept(id, null);
- }
- }
- }
-
- /**
- * Calculate the ids of the segments directly referenced from {@code
referenceIds}
- * through forward references.
- *
- * @param referencedIds The initial set of ids to start from. On return it
- * contains the set of direct forward references.
- *
- * @throws IOException
- */
- // TODO frm remove this method, see OAK-6021
- void calculateForwardReferences(Set<UUID> referencedIds) throws
IOException {
- Map<UUID, List<UUID>> graph = getGraph(false);
- TarEntry[] entries = getEntries();
- for (int i = entries.length - 1; i >= 0; i--) {
- TarEntry entry = entries[i];
- UUID id = new UUID(entry.msb(), entry.lsb());
- if (referencedIds.remove(id)) {
- if (isDataSegmentId(entry.lsb())) {
- referencedIds.addAll(getReferences(entry, id, graph));
- }
- }
- }
- }
-
- /**
* Collect the references of those BLOBs that are reachable from the
entries
* in this TAR file.
* <p>