コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCopyStoreFromMasterIfBranched() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCopyStoreFromMasterIfBranched()
        {
            // GIVEN
            File           dir            = _directory.directory();
            ClusterManager clusterManager = _life.add(new ClusterManager.Builder(dir)
                                                      .withCluster(clusterOfSize(2)).build());

            ClusterManager.ManagedCluster cluster = clusterManager.Cluster;
            cluster.Await(allSeesAllAsAvailable());
            CreateNode(cluster.Master, "A");
            cluster.Sync();

            // WHEN
            HighlyAvailableGraphDatabase slave = cluster.AnySlave;
            File databaseDir = slave.DatabaseLayout().databaseDirectory();

            ClusterManager.RepairKit     starter = cluster.Shutdown(slave);
            HighlyAvailableGraphDatabase master  = cluster.Master;

            CreateNode(master, "B1");
            CreateNode(master, "C");
            CreateNodeOffline(databaseDir, "B2");
            slave = starter.Repair();

            // THEN
            cluster.Await(allSeesAllAsAvailable());
            slave.BeginTx().close();
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void lastTxCommitTimestampShouldBeUnknownAfterStartIfNoFiledOrLogsPresent() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void LastTxCommitTimestampShouldBeUnknownAfterStartIfNoFiledOrLogsPresent()
        {
            ClusterManager clusterManager = (new ClusterManager.Builder(TestDirectory.directory(TestName.MethodName))).withCluster(ClusterManager.clusterOfSize(3)).build();

            try
            {
                clusterManager.Start();
                ClusterManager.ManagedCluster cluster = clusterManager.Cluster;
                cluster.Await(allSeesAllAsAvailable());

                RunSomeTransactions(cluster.Master);
                cluster.Sync();

                HighlyAvailableGraphDatabase slave      = cluster.AnySlave;
                DatabaseLayout           databaseLayout = slave.DatabaseLayout();
                ClusterManager.RepairKit slaveRepairKit = cluster.Shutdown(slave);

                ClearLastTransactionCommitTimestampField(databaseLayout);
                DeleteLogs(databaseLayout);

                HighlyAvailableGraphDatabase repairedSlave = slaveRepairKit.Repair();
                cluster.Await(allSeesAllAsAvailable());

                assertEquals(Org.Neo4j.Kernel.impl.transaction.log.TransactionIdStore_Fields.UNKNOWN_TX_COMMIT_TIMESTAMP, LastCommittedTxTimestamp(repairedSlave));
            }
            finally
            {
                clusterManager.Stop();
            }
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void lastTxCommitTimestampShouldGetInitializedOnSlaveIfNotPresent() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void LastTxCommitTimestampShouldGetInitializedOnSlaveIfNotPresent()
        {
            ClusterManager clusterManager = (new ClusterManager.Builder(TestDirectory.directory(TestName.MethodName))).withCluster(ClusterManager.clusterOfSize(3)).build();

            try
            {
                clusterManager.Start();
                ClusterManager.ManagedCluster cluster = clusterManager.Cluster;
                cluster.Await(allSeesAllAsAvailable());

                RunSomeTransactions(cluster.Master);
                cluster.Sync();

                HighlyAvailableGraphDatabase slave      = cluster.AnySlave;
                DatabaseLayout           databaseLayout = slave.DatabaseLayout();
                ClusterManager.RepairKit slaveRepairKit = cluster.Shutdown(slave);

                ClearLastTransactionCommitTimestampField(databaseLayout);

                HighlyAvailableGraphDatabase repairedSlave = slaveRepairKit.Repair();
                cluster.Await(allSeesAllAsAvailable());

                assertEquals(LastCommittedTxTimestamp(cluster.Master), LastCommittedTxTimestamp(repairedSlave));
            }
            finally
            {
                clusterManager.Stop();
            }
        }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("ResultOfMethodCallIgnored") private org.neo4j.kernel.impl.ha.ClusterManager.RepairKit bringSlaveOfflineAndRemoveStoreFiles(org.neo4j.kernel.impl.ha.ClusterManager.ManagedCluster cluster, org.neo4j.kernel.ha.HighlyAvailableGraphDatabase slave) throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        private ClusterManager.RepairKit BringSlaveOfflineAndRemoveStoreFiles(ClusterManager.ManagedCluster cluster, HighlyAvailableGraphDatabase slave)
        {
            ClusterManager.RepairKit slaveDown = cluster.Shutdown(slave);

            File databaseDir = slave.DatabaseLayout().databaseDirectory();

            deleteRecursively(databaseDir);
            databaseDir.mkdir();
            return(slaveDown);
        }
コード例 #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void deleteAllLogsOn(org.neo4j.kernel.ha.HighlyAvailableGraphDatabase instance) throws java.io.IOException
        private static void DeleteAllLogsOn(HighlyAvailableGraphDatabase instance)
        {
            DeleteAllLogsOn(instance.DatabaseLayout().databaseDirectory());
        }
コード例 #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void deleteAllFilesOn(org.neo4j.kernel.ha.HighlyAvailableGraphDatabase instance) throws java.io.IOException
        private static void DeleteAllFilesOn(HighlyAvailableGraphDatabase instance)
        {
            FileUtils.deleteRecursively(instance.DatabaseLayout().databaseDirectory());
        }