예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void slaveListIsCorrectAfterMasterSwitch()
        public virtual void SlaveListIsCorrectAfterMasterSwitch()
        {
            ManagedCluster cluster = StartCluster(3, 1, HaSettings.TxPushStrategy.FixedAscending);

            cluster.Shutdown(cluster.Master);
            cluster.Await(masterAvailable());
            HighlyAvailableGraphDatabase newMaster = cluster.Master;

            cluster.Await(masterSeesSlavesAsAvailable(1));
            int missed = CreateTransaction(cluster, newMaster);

            AssertLastTransactions(cluster, LastTx(FIRST_SLAVE, BASE_TX_ID + 1, missed), LastTx(SECOND_SLAVE, BASE_TX_ID + 1, missed));
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void slavesListGetsUpdatedWhenSlaveLeavesNicely()
        public virtual void SlavesListGetsUpdatedWhenSlaveLeavesNicely()
        {
            ManagedCluster cluster = StartCluster(3, 1, HaSettings.TxPushStrategy.FixedAscending);

            cluster.Shutdown(cluster.AnySlave);
            cluster.Await(masterSeesSlavesAsAvailable(1));
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotSeeFreedIdsCrossRoleSwitch() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotSeeFreedIdsCrossRoleSwitch()
        {
            // GIVEN
            ManagedCluster cluster = ClusterRule.startCluster();
            HighlyAvailableGraphDatabase firstMaster = cluster.Master;

            // WHEN
            // a node with a property
            Node node = CreateNodeWithProperties(firstMaster, 1);

            // sync cluster
            cluster.Sync();
            // a transaction on master which deletes the property
            DeleteNode(node, firstMaster);
            TriggerIdMaintenance(firstMaster);
            CreateNodeWithProperties(firstMaster, 1);                 // <-- this one reuses the same property id 0
            // a transaction T on slave which will be kept open using a barrier
            GraphDatabaseAPI slave = cluster.AnySlave;

            Org.Neo4j.Test.Barrier_Control barrier = new Org.Neo4j.Test.Barrier_Control();
            Future <Void> t = T2.execute(BarrierControlledReadTransaction(slave, barrier));

            // pull updates on slave
            barrier.Await();
            slave.DependencyResolver.resolveDependency(typeof(UpdatePuller)).pullUpdates();
            // a role switch
            cluster.Shutdown(firstMaster);
            cluster.Await(masterAvailable(firstMaster));
            // close T
            barrier.Release();
            t.get();
            TriggerIdMaintenance(slave);

            // THEN the deleted property record should now not be in freelist on new master
            CreateNodeWithProperties(slave, 10); // <-- this transaction should introduce inconsistencies
            cluster.Stop();                      // <-- CC will be run here since that's configured above ^^^
        }