Neo4j Enterprise

org.neo4j.backup.check
Class ConsistencyCheck

java.lang.Object
  extended by org.neo4j.kernel.impl.nioneo.store.RecordStore.Processor
      extended by org.neo4j.backup.check.ConsistencyCheck
All Implemented Interfaces:
Iterable<org.neo4j.kernel.impl.nioneo.store.RecordStore<?>>, Runnable

public abstract class ConsistencyCheck
extends org.neo4j.kernel.impl.nioneo.store.RecordStore.Processor
implements Runnable, Iterable<org.neo4j.kernel.impl.nioneo.store.RecordStore<?>>

Finds inconsistency in a Neo4j store. Warning: will not find "dangling" records, i.e. records that are correct but not referenced. Warning: will only find multiple references to the same property chain or dynamic record chain for incremental checks (if the stores are diff stores). Also, this checking is very incomplete.


Constructor Summary
ConsistencyCheck(org.neo4j.kernel.impl.nioneo.store.StoreAccess stores)
          Creates a standard checker.
ConsistencyCheck(org.neo4j.kernel.impl.nioneo.store.StoreAccess stores, boolean checkPropertyOwners)
          Creates a standard checker or a checker that validates property owners.
 
Method Summary
 void checkResult()
          Check if any inconsistencies was found by the checker.
 Iterator<org.neo4j.kernel.impl.nioneo.store.RecordStore<?>> iterator()
           
static void main(String... args)
          Run a full consistency check on the specified store.
 void processArray(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.DynamicRecord> store, org.neo4j.kernel.impl.nioneo.store.DynamicRecord array)
           
 void processNode(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.NodeRecord> store, org.neo4j.kernel.impl.nioneo.store.NodeRecord node)
           
 void processProperty(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.PropertyRecord> store, org.neo4j.kernel.impl.nioneo.store.PropertyRecord property)
           
 void processPropertyIndex(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.PropertyIndexRecord> store, org.neo4j.kernel.impl.nioneo.store.PropertyIndexRecord index)
           
 void processRelationship(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.RelationshipRecord> store, org.neo4j.kernel.impl.nioneo.store.RelationshipRecord rel)
           
 void processRelationshipType(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.RelationshipTypeRecord> store, org.neo4j.kernel.impl.nioneo.store.RelationshipTypeRecord type)
           
 void processString(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.DynamicRecord> store, org.neo4j.kernel.impl.nioneo.store.DynamicRecord string)
           
protected abstract
<R extends org.neo4j.kernel.impl.nioneo.store.AbstractBaseRecord>
void
report(org.neo4j.kernel.impl.nioneo.store.RecordStore<R> recordStore, R record, InconsistencyType inconsistency)
          Report an internal inconsistency in a single record.
protected abstract
<R1 extends org.neo4j.kernel.impl.nioneo.store.AbstractBaseRecord,R2 extends org.neo4j.kernel.impl.nioneo.store.AbstractBaseRecord>
void
report(org.neo4j.kernel.impl.nioneo.store.RecordStore<R1> recordStore, R1 record, org.neo4j.kernel.impl.nioneo.store.RecordStore<? extends R2> referredStore, R2 referred, InconsistencyType inconsistency)
          Report an inconsistency between two records.
 void run()
           
static void run(ProgressIndicator.Factory progressFactory, org.neo4j.kernel.impl.nioneo.store.StoreAccess stores, boolean propowner)
           
static void run(ProgressIndicator.Factory progressFactory, String storeDir, Config config)
           
static void run(org.neo4j.kernel.impl.nioneo.store.StoreAccess stores, boolean propowner)
           
static void run(String storeDir, Config config)
           
 
Methods inherited from class org.neo4j.kernel.impl.nioneo.store.RecordStore.Processor
applyById, applyFiltered, applyFiltered, processDynamic, processRecord, progressInit, scan, scanById
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsistencyCheck

public ConsistencyCheck(org.neo4j.kernel.impl.nioneo.store.StoreAccess stores)
Creates a standard checker.

Parameters:
stores - the stores to check.

ConsistencyCheck

public ConsistencyCheck(org.neo4j.kernel.impl.nioneo.store.StoreAccess stores,
                        boolean checkPropertyOwners)
Creates a standard checker or a checker that validates property owners. Property ownership validation validates that each property record is only referenced once. This check has a bit of memory overhead.

Parameters:
stores - the stores to check.
checkPropertyOwners - if true ownership validation will be performed.
Method Detail

main

public static void main(String... args)
Run a full consistency check on the specified store.

Parameters:
args - The arguments to the checker, the first is taken as the path to the store to check.

run

public static void run(String storeDir,
                       Config config)

run

public static void run(ProgressIndicator.Factory progressFactory,
                       String storeDir,
                       Config config)

run

public static void run(org.neo4j.kernel.impl.nioneo.store.StoreAccess stores,
                       boolean propowner)

run

public static void run(ProgressIndicator.Factory progressFactory,
                       org.neo4j.kernel.impl.nioneo.store.StoreAccess stores,
                       boolean propowner)

iterator

public Iterator<org.neo4j.kernel.impl.nioneo.store.RecordStore<?>> iterator()
Specified by:
iterator in interface Iterable<org.neo4j.kernel.impl.nioneo.store.RecordStore<?>>

run

public void run()
Specified by:
run in interface Runnable

checkResult

public void checkResult()
                 throws AssertionError
Check if any inconsistencies was found by the checker. This method should be invoked at the end of the check. If inconsistencies were found an AssertionError summarizing the number of inconsistencies will be thrown.

Throws:
AssertionError - if any inconsistencies were found.

processNode

public void processNode(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.NodeRecord> store,
                        org.neo4j.kernel.impl.nioneo.store.NodeRecord node)
Overrides:
processNode in class org.neo4j.kernel.impl.nioneo.store.RecordStore.Processor

processRelationship

public void processRelationship(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.RelationshipRecord> store,
                                org.neo4j.kernel.impl.nioneo.store.RelationshipRecord rel)
Overrides:
processRelationship in class org.neo4j.kernel.impl.nioneo.store.RecordStore.Processor

processProperty

public void processProperty(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.PropertyRecord> store,
                            org.neo4j.kernel.impl.nioneo.store.PropertyRecord property)
Overrides:
processProperty in class org.neo4j.kernel.impl.nioneo.store.RecordStore.Processor

processString

public void processString(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.DynamicRecord> store,
                          org.neo4j.kernel.impl.nioneo.store.DynamicRecord string)
Overrides:
processString in class org.neo4j.kernel.impl.nioneo.store.RecordStore.Processor

processArray

public void processArray(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.DynamicRecord> store,
                         org.neo4j.kernel.impl.nioneo.store.DynamicRecord array)
Overrides:
processArray in class org.neo4j.kernel.impl.nioneo.store.RecordStore.Processor

processRelationshipType

public void processRelationshipType(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.RelationshipTypeRecord> store,
                                    org.neo4j.kernel.impl.nioneo.store.RelationshipTypeRecord type)
Overrides:
processRelationshipType in class org.neo4j.kernel.impl.nioneo.store.RecordStore.Processor

processPropertyIndex

public void processPropertyIndex(org.neo4j.kernel.impl.nioneo.store.RecordStore<org.neo4j.kernel.impl.nioneo.store.PropertyIndexRecord> store,
                                 org.neo4j.kernel.impl.nioneo.store.PropertyIndexRecord index)
Overrides:
processPropertyIndex in class org.neo4j.kernel.impl.nioneo.store.RecordStore.Processor

report

protected abstract <R1 extends org.neo4j.kernel.impl.nioneo.store.AbstractBaseRecord,R2 extends org.neo4j.kernel.impl.nioneo.store.AbstractBaseRecord> void report(org.neo4j.kernel.impl.nioneo.store.RecordStore<R1> recordStore,
                                                                                                                                                                   R1 record,
                                                                                                                                                                   org.neo4j.kernel.impl.nioneo.store.RecordStore<? extends R2> referredStore,
                                                                                                                                                                   R2 referred,
                                                                                                                                                                   InconsistencyType inconsistency)
Report an inconsistency between two records.

Parameters:
recordStore - the store containing the record found to be inconsistent.
record - the record found to be inconsistent.
referredStore - the store containing the record the inconsistent record references.
referred - the record the inconsistent record references.
inconsistency - a description of the inconsistency.

report

protected abstract <R extends org.neo4j.kernel.impl.nioneo.store.AbstractBaseRecord> void report(org.neo4j.kernel.impl.nioneo.store.RecordStore<R> recordStore,
                                                                                                 R record,
                                                                                                 InconsistencyType inconsistency)
Report an internal inconsistency in a single record.

Parameters:
recordStore - the store the inconsistent record is stored in.
record - the inconsistent record.
inconsistency - a description of the inconsistency.

Neo4j Enterprise

Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.