예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void makeSureBackupCanBePerformed() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MakeSureBackupCanBePerformed()
        {
            // Run backup
            CoreGraphDatabase leader = createSomeData(_cluster);

            ReadReplicaGraphDatabase readReplica = _cluster.findAnyReadReplica().database();

            awaitEx(() => ReadReplicasUpToDateAsTheLeader(leader, readReplica), 1, TimeUnit.MINUTES);

            DbRepresentation beforeChange  = DbRepresentation.of(readReplica);
            string           backupAddress = transactionAddress(readReplica);

            string[] args = backupArguments(backupAddress, _backupPath, "readreplica");

            File configFile = ConfigFileBuilder.builder(ClusterRule.clusterDirectory()).build();

            assertEquals(STATUS_SUCCESS, runBackupToolFromOtherJvmToGetExitCode(ClusterRule.clusterDirectory(), args));

            // Add some new data
            DbRepresentation afterChange = DbRepresentation.of(createSomeData(_cluster));

            // Verify that backed up database can be started and compare representation
            DbRepresentation backupRepresentation = DbRepresentation.of(DatabaseLayout.of(_backupPath, "readreplica").databaseDirectory(), Config);

            assertEquals(beforeChange, backupRepresentation);
            assertNotEquals(backupRepresentation, afterChange);
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: public ReadReplicaDatabaseAvailabilityService(@Context OutputFormat output, @Context GraphDatabaseService db)
        public ReadReplicaDatabaseAvailabilityService(OutputFormat output, GraphDatabaseService db)
        {
            if (db is ReadReplicaGraphDatabase)
            {
                this._readReplica = ( ReadReplicaGraphDatabase )db;
            }
            else
            {
                this._readReplica = null;
            }
        }
예제 #3
0
        private static bool ReadReplicasUpToDateAsTheLeader(CoreGraphDatabase leader, ReadReplicaGraphDatabase readReplica)
        {
            long leaderTxId     = leader.DependencyResolver.resolveDependency(typeof(TransactionIdStore)).LastClosedTransactionId;
            long lastClosedTxId = readReplica.DependencyResolver.resolveDependency(typeof(TransactionIdStore)).LastClosedTransactionId;

            return(lastClosedTxId == leaderTxId);
        }