示例#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
            ManagedCluster               cluster      = ClusterRule.startCluster();
            DbRepresentation             beforeChange = DbRepresentation.of(cluster.Master);
            HighlyAvailableGraphDatabase hagdb        = cluster.AllMembers.GetEnumerator().next();
            HostnamePort address      = cluster.GetBackupAddress(hagdb);
            string       databaseName = "basic";

            assertEquals(0, runBackupToolFromOtherJvmToGetExitCode(_backupPath, BackupArguments(address.ToString(), _backupPath, databaseName)));

            // Add some new data
            DbRepresentation afterChange = createSomeData(cluster.Master);

            cluster.Sync();

            // Verify that backed up database can be started and compare representation
            Config           config = Config.builder().withSetting(OnlineBackupSettings.online_backup_enabled, Settings.FALSE).withSetting(GraphDatabaseSettings.active_database, databaseName).build();
            DbRepresentation backupRepresentation = DbRepresentation.of(DatabaseLayout.of(_backupPath, databaseName).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: @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 ^^^
        }