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 2015/10/05 18:00:43 UTC

svn commit: r1706864 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/RecordUsageAnalyser.java oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java

Author: mduerig
Date: Mon Oct  5 16:00:42 2015
New Revision: 1706864

URL: http://svn.apache.org/viewvc?rev=1706864&view=rev
Log:
OAK-3475: Confusing SNFE whith oak-run debug
Better handling, recording and reporting of SNFE while analysing segments

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/RecordUsageAnalyser.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/RecordUsageAnalyser.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/RecordUsageAnalyser.java?rev=1706864&r1=1706863&r2=1706864&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/RecordUsageAnalyser.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/RecordUsageAnalyser.java Mon Oct  5 16:00:42 2015
@@ -20,6 +20,7 @@
 package org.apache.jackrabbit.oak.plugins.segment;
 
 import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.collect.Sets.newHashSet;
 import static org.apache.commons.io.FileUtils.byteCountToDisplaySize;
 import static org.apache.jackrabbit.oak.api.Type.BINARY;
 import static org.apache.jackrabbit.oak.plugins.segment.ListRecord.LEVEL_SIZE;
@@ -32,6 +33,7 @@ import static org.apache.jackrabbit.oak.
 import static org.apache.jackrabbit.oak.plugins.segment.Template.ZERO_CHILD_NODES;
 
 import java.util.Formatter;
+import java.util.Set;
 
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
@@ -47,6 +49,7 @@ import org.apache.jackrabbit.oak.spi.sta
  */
 public class RecordUsageAnalyser {
     private final RecordIdSet seenIds = new RecordIdSet();
+    private final Set<String> deadLinks = newHashSet();
 
     private long mapSize;       // leaf and branch
     private long listSize;      // list and bucket
@@ -196,56 +199,60 @@ public class RecordUsageAnalyser {
     }
 
     public void analyseNode(RecordId nodeId) {
-        if (seenIds.addIfNotPresent(nodeId)) {
-            nodeCount++;
-            Segment segment = nodeId.getSegment();
-            int offset = nodeId.getOffset();
-            RecordId templateId = segment.readRecordId(offset);
-            analyseTemplate(templateId);
-
-            Template template = segment.readTemplate(templateId);
-
-            // Recurses into child nodes in this segment
-            if (template.getChildName() == MANY_CHILD_NODES) {
-                RecordId childMapId = segment.readRecordId(offset + RECORD_ID_BYTES);
-                MapRecord childMap = segment.readMap(childMapId);
-                analyseMap(childMapId, childMap);
-                for (ChildNodeEntry childNodeEntry : childMap.getEntries()) {
-                    NodeState child = childNodeEntry.getNodeState();
-                    if (child instanceof SegmentNodeState) {
-                        RecordId childId = ((SegmentNodeState) child).getRecordId();
-                        analyseNode(childId);
+        try {
+            if (seenIds.addIfNotPresent(nodeId)) {
+                nodeCount++;
+                Segment segment = nodeId.getSegment();
+                int offset = nodeId.getOffset();
+                RecordId templateId = segment.readRecordId(offset);
+                analyseTemplate(templateId);
+
+                Template template = segment.readTemplate(templateId);
+
+                // Recurses into child nodes in this segment
+                if (template.getChildName() == MANY_CHILD_NODES) {
+                    RecordId childMapId = segment.readRecordId(offset + RECORD_ID_BYTES);
+                    MapRecord childMap = segment.readMap(childMapId);
+                    analyseMap(childMapId, childMap);
+                    for (ChildNodeEntry childNodeEntry : childMap.getEntries()) {
+                        NodeState child = childNodeEntry.getNodeState();
+                        if (child instanceof SegmentNodeState) {
+                            RecordId childId = ((SegmentNodeState) child).getRecordId();
+                            analyseNode(childId);
+                        }
                     }
+                } else if (template.getChildName() != ZERO_CHILD_NODES) {
+                    RecordId childId = segment.readRecordId(offset + RECORD_ID_BYTES);
+                    analyseNode(childId);
                 }
-            } else if (template.getChildName() != ZERO_CHILD_NODES) {
-                RecordId childId = segment.readRecordId(offset + RECORD_ID_BYTES);
-                analyseNode(childId);
-            }
 
-            // Recurse into properties
-            int ids = template.getChildName() == ZERO_CHILD_NODES ? 1 : 2;
-            nodeSize += ids * RECORD_ID_BYTES;
-            PropertyTemplate[] propertyTemplates = template.getPropertyTemplates();
-            if (segment.getSegmentVersion().onOrAfter(V_11)) {
-                if (propertyTemplates.length > 0) {
-                    nodeSize += RECORD_ID_BYTES;
-                    RecordId id = segment.readRecordId(offset + ids * RECORD_ID_BYTES);
-                    ListRecord pIds = new ListRecord(id,
-                            propertyTemplates.length);
-                    for (int i = 0; i < propertyTemplates.length; i++) {
-                        RecordId propertyId = pIds.getEntry(i);
-                        analyseProperty(propertyId, propertyTemplates[i]);
+                // Recurse into properties
+                int ids = template.getChildName() == ZERO_CHILD_NODES ? 1 : 2;
+                nodeSize += ids * RECORD_ID_BYTES;
+                PropertyTemplate[] propertyTemplates = template.getPropertyTemplates();
+                if (segment.getSegmentVersion().onOrAfter(V_11)) {
+                    if (propertyTemplates.length > 0) {
+                        nodeSize += RECORD_ID_BYTES;
+                        RecordId id = segment.readRecordId(offset + ids * RECORD_ID_BYTES);
+                        ListRecord pIds = new ListRecord(id,
+                                propertyTemplates.length);
+                        for (int i = 0; i < propertyTemplates.length; i++) {
+                            RecordId propertyId = pIds.getEntry(i);
+                            analyseProperty(propertyId, propertyTemplates[i]);
+                        }
+                        analyseList(id, propertyTemplates.length);
+                    }
+                } else {
+                    for (PropertyTemplate propertyTemplate : propertyTemplates) {
+                        nodeSize += RECORD_ID_BYTES;
+                        RecordId propertyId = segment.readRecordId(offset + ids++
+                                * RECORD_ID_BYTES);
+                        analyseProperty(propertyId, propertyTemplate);
                     }
-                    analyseList(id, propertyTemplates.length);
-                }
-            } else {
-                for (PropertyTemplate propertyTemplate : propertyTemplates) {
-                    nodeSize += RECORD_ID_BYTES;
-                    RecordId propertyId = segment.readRecordId(offset + ids++
-                            * RECORD_ID_BYTES);
-                    analyseProperty(propertyId, propertyTemplate);
                 }
             }
+        } catch (SegmentNotFoundException snfe) {
+            deadLinks.add(snfe.getSegmentId());
         }
     }
 
@@ -272,211 +279,252 @@ public class RecordUsageAnalyser {
         formatter.format(
                 "%s in nodes (%s node records)%n",
                 byteCountToDisplaySize(nodeSize), nodeCount);
+        formatter.format("links to non existing segments: %s", deadLinks);
         return sb.toString();
     }
 
     private void analyseTemplate(RecordId templateId) {
-        if (seenIds.addIfNotPresent(templateId)) {
-            templateCount++;
-            Segment segment = templateId.getSegment();
-            int size = 0;
-            int offset = templateId.getOffset();
-            int head = segment.readInt(offset + size);
-            boolean hasPrimaryType = (head & (1 << 31)) != 0;
-            boolean hasMixinTypes = (head & (1 << 30)) != 0;
-            boolean zeroChildNodes = (head & (1 << 29)) != 0;
-            boolean manyChildNodes = (head & (1 << 28)) != 0;
-            int mixinCount = (head >> 18) & ((1 << 10) - 1);
-            int propertyCount = head & ((1 << 18) - 1);
-            size += 4;
-
-            if (hasPrimaryType) {
-                RecordId primaryId = segment.readRecordId(offset + size);
-                analyseString(primaryId);
-                size += RECORD_ID_BYTES;
-            }
-
-            if (hasMixinTypes) {
-                for (int i = 0; i < mixinCount; i++) {
-                    RecordId mixinId = segment.readRecordId(offset + size);
-                    analyseString(mixinId);
+        try {
+            if (seenIds.addIfNotPresent(templateId)) {
+                templateCount++;
+                Segment segment = templateId.getSegment();
+                int size = 0;
+                int offset = templateId.getOffset();
+                int head = segment.readInt(offset + size);
+                boolean hasPrimaryType = (head & (1 << 31)) != 0;
+                boolean hasMixinTypes = (head & (1 << 30)) != 0;
+                boolean zeroChildNodes = (head & (1 << 29)) != 0;
+                boolean manyChildNodes = (head & (1 << 28)) != 0;
+                int mixinCount = (head >> 18) & ((1 << 10) - 1);
+                int propertyCount = head & ((1 << 18) - 1);
+                size += 4;
+
+                if (hasPrimaryType) {
+                    RecordId primaryId = segment.readRecordId(offset + size);
+                    analyseString(primaryId);
                     size += RECORD_ID_BYTES;
                 }
-            }
 
-            if (!zeroChildNodes && !manyChildNodes) {
-                RecordId childNameId = segment.readRecordId(offset + size);
-                analyseString(childNameId);
-                size += RECORD_ID_BYTES;
-            }
+                if (hasMixinTypes) {
+                    for (int i = 0; i < mixinCount; i++) {
+                        RecordId mixinId = segment.readRecordId(offset + size);
+                        analyseString(mixinId);
+                        size += RECORD_ID_BYTES;
+                    }
+                }
 
-            if (segment.getSegmentVersion().onOrAfter(V_11)) {
-                if (propertyCount > 0) {
-                    RecordId listId = segment.readRecordId(offset + size);
+                if (!zeroChildNodes && !manyChildNodes) {
+                    RecordId childNameId = segment.readRecordId(offset + size);
+                    analyseString(childNameId);
                     size += RECORD_ID_BYTES;
-                    ListRecord propertyNames = new ListRecord(listId, propertyCount);
+                }
+
+                if (segment.getSegmentVersion().onOrAfter(V_11)) {
+                    if (propertyCount > 0) {
+                        RecordId listId = segment.readRecordId(offset + size);
+                        size += RECORD_ID_BYTES;
+                        ListRecord propertyNames = new ListRecord(listId, propertyCount);
+                        for (int i = 0; i < propertyCount; i++) {
+                            RecordId propertyNameId = propertyNames.getEntry(i);
+                            size++; // type
+                            analyseString(propertyNameId);
+                        }
+                        analyseList(listId, propertyCount);
+                    }
+                } else {
                     for (int i = 0; i < propertyCount; i++) {
-                        RecordId propertyNameId = propertyNames.getEntry(i);
-                        size++; // type
+                        RecordId propertyNameId = segment.readRecordId(offset + size);
+                        size += RECORD_ID_BYTES;
+                        size++;  // type
                         analyseString(propertyNameId);
                     }
-                    analyseList(listId, propertyCount);
-                }
-            } else {
-                for (int i = 0; i < propertyCount; i++) {
-                    RecordId propertyNameId = segment.readRecordId(offset + size);
-                    size += RECORD_ID_BYTES;
-                    size++;  // type
-                    analyseString(propertyNameId);
                 }
+                templateSize += size;
             }
-            templateSize += size;
+        } catch (SegmentNotFoundException snfe) {
+            deadLinks.add(snfe.getSegmentId());
         }
     }
 
     private void analyseMap(RecordId mapId, MapRecord map) {
-        if (seenIds.addIfNotPresent(mapId)) {
-            mapCount++;
-            if (map.isDiff()) {
-                analyseDiff(mapId, map);
-            } else if (map.isLeaf()) {
-                analyseLeaf(map);
-            } else {
-                analyseBranch(map);
+        try {
+            if (seenIds.addIfNotPresent(mapId)) {
+                mapCount++;
+                if (map.isDiff()) {
+                    analyseDiff(mapId, map);
+                } else if (map.isLeaf()) {
+                    analyseLeaf(map);
+                } else {
+                    analyseBranch(map);
+                }
             }
+        } catch (SegmentNotFoundException snfe) {
+            deadLinks.add(snfe.getSegmentId());
         }
     }
 
     private void analyseDiff(RecordId mapId, MapRecord map) {
-        mapSize += 4;                                // -1
-        mapSize += 4;                                // hash of changed key
-        mapSize += RECORD_ID_BYTES;                  // key
-        mapSize += RECORD_ID_BYTES;                  // value
-        mapSize += RECORD_ID_BYTES;                  // base
-
-        RecordId baseId = mapId.getSegment().readRecordId(
-                mapId.getOffset() + 8 + 2 * RECORD_ID_BYTES);
-        analyseMap(baseId, new MapRecord(baseId));
+        try {
+            mapSize += 4;                                // -1
+            mapSize += 4;                                // hash of changed key
+            mapSize += RECORD_ID_BYTES;                  // key
+            mapSize += RECORD_ID_BYTES;                  // value
+            mapSize += RECORD_ID_BYTES;                  // base
+
+            RecordId baseId = mapId.getSegment().readRecordId(
+                    mapId.getOffset() + 8 + 2 * RECORD_ID_BYTES);
+            analyseMap(baseId, new MapRecord(baseId));
+        } catch (SegmentNotFoundException snfe) {
+            deadLinks.add(snfe.getSegmentId());
+        }
     }
 
     private void analyseLeaf(MapRecord map) {
-        mapSize += 4;                                 // size
-        mapSize += map.size() * 4;                    // key hashes
-
-        for (MapEntry entry : map.getEntries()) {
-            mapSize += 2 * RECORD_ID_BYTES;           // key value pairs
-            analyseString(entry.getKey());
+        try {
+            mapSize += 4;                                 // size
+            mapSize += map.size() * 4;                    // key hashes
+
+            for (MapEntry entry : map.getEntries()) {
+                mapSize += 2 * RECORD_ID_BYTES;           // key value pairs
+                analyseString(entry.getKey());
+            }
+        }  catch (SegmentNotFoundException snfe) {
+            deadLinks.add(snfe.getSegmentId());
         }
     }
 
     private void analyseBranch(MapRecord map) {
-        mapSize += 4;                                 // level/size
-        mapSize += 4;                                 // bitmap
-        for (MapRecord bucket : map.getBuckets()) {
-            if (bucket != null) {
-                mapSize += RECORD_ID_BYTES;
-                analyseMap(bucket.getRecordId(), bucket);
+        try {
+            mapSize += 4;                                 // level/size
+            mapSize += 4;                                 // bitmap
+            for (MapRecord bucket : map.getBuckets()) {
+                if (bucket != null) {
+                    mapSize += RECORD_ID_BYTES;
+                    analyseMap(bucket.getRecordId(), bucket);
+                }
             }
+        } catch (SegmentNotFoundException snfe) {
+            deadLinks.add(snfe.getSegmentId());
         }
     }
 
     private void analyseProperty(RecordId propertyId, PropertyTemplate template) {
-        if (!seenIds.contains(propertyId)) {
-            propertyCount++;
-            Segment segment = propertyId.getSegment();
-            int offset = propertyId.getOffset();
-            Type<?> type = template.getType();
-
-            if (type.isArray()) {
-                seenIds.addIfNotPresent(propertyId);
-                int size = segment.readInt(offset);
-                valueSize += 4;
-
-                if (size > 0) {
-                    RecordId listId = segment.readRecordId(offset + 4);
-                    valueSize += RECORD_ID_BYTES;
-                    for (RecordId valueId : new ListRecord(listId, size).getEntries()) {
-                        analyseValue(valueId, type.getBaseType());
+        try {
+            if (!seenIds.contains(propertyId)) {
+                propertyCount++;
+                Segment segment = propertyId.getSegment();
+                int offset = propertyId.getOffset();
+                Type<?> type = template.getType();
+
+                if (type.isArray()) {
+                    seenIds.addIfNotPresent(propertyId);
+                    int size = segment.readInt(offset);
+                    valueSize += 4;
+
+                    if (size > 0) {
+                        RecordId listId = segment.readRecordId(offset + 4);
+                        valueSize += RECORD_ID_BYTES;
+                        for (RecordId valueId : new ListRecord(listId, size).getEntries()) {
+                            analyseValue(valueId, type.getBaseType());
+                        }
+                        analyseList(listId, size);
                     }
-                    analyseList(listId, size);
+                } else {
+                    analyseValue(propertyId, type);
                 }
-            } else {
-                analyseValue(propertyId, type);
             }
+        } catch (SegmentNotFoundException snfe) {
+            deadLinks.add(snfe.getSegmentId());
         }
     }
 
     private void analyseValue(RecordId valueId, Type<?> type) {
-        checkArgument(!type.isArray());
-        if (type == BINARY) {
-            analyseBlob(valueId);
-        } else {
-            analyseString(valueId);
+        try {
+            checkArgument(!type.isArray());
+            if (type == BINARY) {
+                analyseBlob(valueId);
+            } else {
+                analyseString(valueId);
+            }
+        } catch (SegmentNotFoundException snfe) {
+            deadLinks.add(snfe.getSegmentId());
         }
     }
 
     private void analyseBlob(RecordId blobId) {
-        if (seenIds.addIfNotPresent(blobId)) {
-            Segment segment = blobId.getSegment();
-            int offset = blobId.getOffset();
-            byte head = segment.readByte(offset);
-            if ((head & 0x80) == 0x00) {
-                // 0xxx xxxx: small value
-                valueSize += (1 + head);
-                smallBlobCount++;
-            } else if ((head & 0xc0) == 0x80) {
-                // 10xx xxxx: medium value
-                int length = (segment.readShort(offset) & 0x3fff) + SMALL_LIMIT;
-                valueSize += (2 + length);
-                mediumBlobCount++;
-            } else if ((head & 0xe0) == 0xc0) {
-                // 110x xxxx: long value
-                long length = (segment.readLong(offset) & 0x1fffffffffffffffL) + MEDIUM_LIMIT;
-                int size = (int) ((length + BLOCK_SIZE - 1) / BLOCK_SIZE);
-                RecordId listId = segment.readRecordId(offset + 8);
-                analyseList(listId, size);
-                valueSize += (8 + RECORD_ID_BYTES + length);
-                longBlobCount++;
-            } else if ((head & 0xf0) == 0xe0) {
-                // 1110 xxxx: external value
-                int length = (head & 0x0f) << 8 | (segment.readByte(offset + 1) & 0xff);
-                valueSize += (2 + length);
-                externalBlobCount++;
-            } else {
-                throw new IllegalStateException(String.format(
-                        "Unexpected value record type: %02x", head & 0xff));
+        try {
+            if (seenIds.addIfNotPresent(blobId)) {
+                Segment segment = blobId.getSegment();
+                int offset = blobId.getOffset();
+                byte head = segment.readByte(offset);
+                if ((head & 0x80) == 0x00) {
+                    // 0xxx xxxx: small value
+                    valueSize += (1 + head);
+                    smallBlobCount++;
+                } else if ((head & 0xc0) == 0x80) {
+                    // 10xx xxxx: medium value
+                    int length = (segment.readShort(offset) & 0x3fff) + SMALL_LIMIT;
+                    valueSize += (2 + length);
+                    mediumBlobCount++;
+                } else if ((head & 0xe0) == 0xc0) {
+                    // 110x xxxx: long value
+                    long length = (segment.readLong(offset) & 0x1fffffffffffffffL) + MEDIUM_LIMIT;
+                    int size = (int) ((length + BLOCK_SIZE - 1) / BLOCK_SIZE);
+                    RecordId listId = segment.readRecordId(offset + 8);
+                    analyseList(listId, size);
+                    valueSize += (8 + RECORD_ID_BYTES + length);
+                    longBlobCount++;
+                } else if ((head & 0xf0) == 0xe0) {
+                    // 1110 xxxx: external value
+                    int length = (head & 0x0f) << 8 | (segment.readByte(offset + 1) & 0xff);
+                    valueSize += (2 + length);
+                    externalBlobCount++;
+                } else {
+                    throw new IllegalStateException(String.format(
+                            "Unexpected value record type: %02x", head & 0xff));
+                }
             }
+        } catch (SegmentNotFoundException snfe) {
+            deadLinks.add(snfe.getSegmentId());
         }
     }
 
     private void analyseString(RecordId stringId) {
-        if (seenIds.addIfNotPresent(stringId)) {
-            Segment segment = stringId.getSegment();
-            int offset = stringId.getOffset();
-
-            long length = segment.readLength(offset);
-            if (length < Segment.SMALL_LIMIT) {
-                valueSize += (1 + length);
-                smallStringCount++;
-            } else if (length < Segment.MEDIUM_LIMIT) {
-                valueSize += (2 + length);
-                mediumStringCount++;
-            } else if (length < Integer.MAX_VALUE) {
-                int size = (int) ((length + BLOCK_SIZE - 1) / BLOCK_SIZE);
-                RecordId listId = segment.readRecordId(offset + 8);
-                analyseList(listId, size);
-                valueSize += (8 + RECORD_ID_BYTES + length);
-                longStringCount++;
-            } else {
-                throw new IllegalStateException("String is too long: " + length);
+        try {
+            if (seenIds.addIfNotPresent(stringId)) {
+                Segment segment = stringId.getSegment();
+                int offset = stringId.getOffset();
+
+                long length = segment.readLength(offset);
+                if (length < Segment.SMALL_LIMIT) {
+                    valueSize += (1 + length);
+                    smallStringCount++;
+                } else if (length < Segment.MEDIUM_LIMIT) {
+                    valueSize += (2 + length);
+                    mediumStringCount++;
+                } else if (length < Integer.MAX_VALUE) {
+                    int size = (int) ((length + BLOCK_SIZE - 1) / BLOCK_SIZE);
+                    RecordId listId = segment.readRecordId(offset + 8);
+                    analyseList(listId, size);
+                    valueSize += (8 + RECORD_ID_BYTES + length);
+                    longStringCount++;
+                } else {
+                    throw new IllegalStateException("String is too long: " + length);
+                }
             }
+        } catch (SegmentNotFoundException snfe) {
+            deadLinks.add(snfe.getSegmentId());
         }
     }
 
     private void analyseList(RecordId listId, int size) {
-        if (seenIds.addIfNotPresent(listId)) {
-            listCount++;
-            listSize += noOfListSlots(size) * RECORD_ID_BYTES;
+        try {
+            if (seenIds.addIfNotPresent(listId)) {
+                listCount++;
+                listSize += noOfListSlots(size) * RECORD_ID_BYTES;
+            }
+        } catch (SegmentNotFoundException snfe) {
+            deadLinks.add(snfe.getSegmentId());
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java?rev=1706864&r1=1706863&r2=1706864&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java Mon Oct  5 16:00:42 2015
@@ -21,7 +21,9 @@ import static java.util.Arrays.asList;
 import static org.apache.commons.io.FileUtils.byteCountToDisplaySize;
 import static org.apache.jackrabbit.oak.checkpoint.Checkpoints.CP;
 import static org.apache.jackrabbit.oak.plugins.segment.RecordType.NODE;
+import static org.apache.jackrabbit.oak.plugins.segment.file.FileStore.newFileStore;
 import static org.apache.jackrabbit.oak.plugins.segment.file.tooling.ConsistencyChecker.checkConsistency;
+import static org.slf4j.LoggerFactory.getLogger;
 
 import java.io.Closeable;
 import java.io.File;
@@ -48,6 +50,8 @@ import java.util.regex.Pattern;
 
 import javax.jcr.Repository;
 
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
 import com.google.common.base.Joiner;
 import com.google.common.base.Stopwatch;
 import com.google.common.collect.Maps;
@@ -61,7 +65,6 @@ import joptsimple.ArgumentAcceptingOptio
 import joptsimple.OptionParser;
 import joptsimple.OptionSet;
 import joptsimple.OptionSpec;
-
 import org.apache.commons.io.FileUtils;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
@@ -97,14 +100,15 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.segment.SegmentId;
 import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeState;
 import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore;
+import org.apache.jackrabbit.oak.plugins.segment.SegmentTracker;
 import org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy;
 import org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy.CleanupType;
 import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
 import org.apache.jackrabbit.oak.plugins.segment.standby.client.StandbyClient;
 import org.apache.jackrabbit.oak.plugins.segment.standby.server.StandbyServer;
+import org.apache.jackrabbit.oak.plugins.tika.TextExtractorMain;
 import org.apache.jackrabbit.oak.remote.content.ContentRemoteRepository;
 import org.apache.jackrabbit.oak.remote.http.RemoteServlet;
-import org.apache.jackrabbit.oak.plugins.tika.TextExtractorMain;
 import org.apache.jackrabbit.oak.scalability.ScalabilityRunner;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
@@ -529,8 +533,7 @@ public final class Main {
     }
 
     private static FileStore openFileStore(File directory) throws IOException {
-        return FileStore
-                .newFileStore(directory)
+        return newFileStore(directory)
                 .withCacheSize(256)
                 .withMemoryMapping(TAR_STORAGE_MEMORY_MAPPED)
                 .create();
@@ -733,7 +736,10 @@ public final class Main {
             // TODO: enable debug information for other node store implementations
             System.out.println("Debug " + args[0]);
             File file = new File(args[0]);
-            FileStore store = new FileStore(file, 256, TAR_STORAGE_MEMORY_MAPPED);
+            FileStore store = newFileStore(file)
+                .withMaxFileSize(256)
+                .withMemoryMapping(false)
+                .create();
             try {
                 if (args.length == 1) {
                     debugFileStore(store);
@@ -897,6 +903,8 @@ public final class Main {
         long dataSize = 0;
         int bulkCount = 0;
         long bulkSize = 0;
+
+        ((Logger) getLogger(SegmentTracker.class)).setLevel(Level.OFF);
         RecordUsageAnalyser analyser = new RecordUsageAnalyser();
 
         for (SegmentId id : store.getSegmentIds()) {