Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void doWorkOnMember(org.neo4j.causalclustering.discovery.ClusterMember oldMember) throws Exception
        public override void DoWorkOnMember(ClusterMember oldMember)
        {
            bool replaceFromBackup = ThreadLocalRandom.current().nextBoolean();

            File backup = null;

            if (replaceFromBackup)
            {
                backup = CreateBackupWithRetries(oldMember);
            }

            _log.info("Stopping: " + oldMember);
            oldMember.shutdown();

            ClusterMember newMember = (oldMember is CoreClusterMember) ? _cluster.newCoreMember() : _cluster.newReadReplica();

            if (replaceFromBackup)
            {
                _log.info("Restoring backup: " + backup.Name + " to: " + newMember);
                restoreFromBackup(backup, _fs, newMember);
                _fs.deleteRecursively(backup);
            }

            _log.info("Starting: " + newMember);
            newMember.start();

            _successfulReplacements++;
        }
Beispiel #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void doWorkOnMember(org.neo4j.causalclustering.discovery.ClusterMember member) throws Exception
        public override void DoWorkOnMember(ClusterMember member)
        {
            File databaseDirectory = member.database().DatabaseLayout().databaseDirectory();

            _log.info("Stopping: " + member);
            member.shutdown();

            assertStoreConsistent(_fileSystem, databaseDirectory);

            Thread.Sleep(5000);
            _log.info("Starting: " + member);
            member.start();
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnUnavailableStatusWhenShutdown()
        public virtual void ShouldReturnUnavailableStatusWhenShutdown()
        {
            // given
            ClusterMember member = _cluster.getCoreMemberById(1);

            // when
            GraphDatabaseAPI db = member.database();

            member.shutdown();

            // then
            try
            {
                using (Transaction tx = Db.beginTx())
                {
                    tx.Success();
                    fail();
                }
            }
            catch (Exception e)
            {
                assertEquals(Org.Neo4j.Kernel.Api.Exceptions.Status_General.DatabaseUnavailable, statusCodeOf(e));
            }
        }