Search in sources :

Example 6 with CheckConsistencyConfig

use of org.neo4j.consistency.checking.full.CheckConsistencyConfig in project neo4j by neo4j.

the class RestartIT method readReplicaTest.

@Test
public void readReplicaTest() throws Exception {
    // given
    Cluster cluster = clusterRule.withNumberOfCoreMembers(2).withNumberOfReadReplicas(1).startCluster();
    // when
    final GraphDatabaseService coreDB = cluster.awaitLeader(5, TimeUnit.SECONDS).database();
    try (Transaction tx = coreDB.beginTx()) {
        Node node = coreDB.createNode(label("boo"));
        node.setProperty("foobar", "baz_bat");
        tx.success();
    }
    cluster.addCoreMemberWithId(2).start();
    cluster.shutdown();
    try (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction()) {
        for (CoreClusterMember core : cluster.coreMembers()) {
            ConsistencyCheckService.Result result = new ConsistencyCheckService().runFullConsistencyCheck(core.storeDir(), Config.embeddedDefaults(), ProgressMonitorFactory.NONE, NullLogProvider.getInstance(), fileSystem, false, new CheckConsistencyConfig(true, true, true, false));
            assertTrue("Inconsistent: " + core, result.isSuccessful());
        }
        for (ReadReplica readReplica : cluster.readReplicas()) {
            ConsistencyCheckService.Result result = new ConsistencyCheckService().runFullConsistencyCheck(readReplica.storeDir(), Config.embeddedDefaults(), ProgressMonitorFactory.NONE, NullLogProvider.getInstance(), fileSystem, false, new CheckConsistencyConfig(true, true, true, false));
            assertTrue("Inconsistent: " + readReplica, result.isSuccessful());
        }
    }
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) ReadReplica(org.neo4j.causalclustering.discovery.ReadReplica) CheckConsistencyConfig(org.neo4j.consistency.checking.full.CheckConsistencyConfig) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) Transaction(org.neo4j.graphdb.Transaction) CoreClusterMember(org.neo4j.causalclustering.discovery.CoreClusterMember) Node(org.neo4j.graphdb.Node) Cluster(org.neo4j.causalclustering.discovery.Cluster) ConsistencyCheckService(org.neo4j.consistency.ConsistencyCheckService) Test(org.junit.Test)

Aggregations

CheckConsistencyConfig (org.neo4j.consistency.checking.full.CheckConsistencyConfig)6 File (java.io.File)4 Path (java.nio.file.Path)3 Test (org.junit.Test)3 Config (org.neo4j.kernel.configuration.Config)3 IOException (java.io.IOException)2 CommandFailed (org.neo4j.commandline.admin.CommandFailed)2 IncorrectUsage (org.neo4j.commandline.admin.IncorrectUsage)2 OptionalCanonicalPath (org.neo4j.commandline.arguments.common.OptionalCanonicalPath)2 ConsistencyCheckService (org.neo4j.consistency.ConsistencyCheckService)2 ConsistencyCheckIncompleteException (org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException)2 DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)2 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)2 Cluster (org.neo4j.causalclustering.discovery.Cluster)1 CoreClusterMember (org.neo4j.causalclustering.discovery.CoreClusterMember)1 ReadReplica (org.neo4j.causalclustering.discovery.ReadReplica)1 OutsideWorld (org.neo4j.commandline.admin.OutsideWorld)1 MandatoryCanonicalPath (org.neo4j.commandline.arguments.common.MandatoryCanonicalPath)1 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)1 Node (org.neo4j.graphdb.Node)1