Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void pruningStrategyShouldBeDynamic() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PruningStrategyShouldBeDynamic()
        {
            CheckPointer          checkPointer = GetInstanceFromDb(typeof(CheckPointer));
            Config                config       = GetInstanceFromDb(typeof(Config));
            FileSystemAbstraction fs           = GetInstanceFromDb(typeof(FileSystemAbstraction));

            LogFiles logFiles = LogFilesBuilder.builder(Db.databaseLayout(), fs).withLogVersionRepository(new SimpleLogVersionRepository()).withLastCommittedTransactionIdSupplier(() => 1).withTransactionIdStore(new SimpleTransactionIdStore()).build();

            // Force transaction log rotation
            WriteTransactionsAndRotateTwice();

            // Checkpoint to make sure strategy is evaluated
            checkPointer.ForceCheckPoint(_triggerInfo);

            // Make sure file is still there since we have disable pruning
            assertThat(CountTransactionLogs(logFiles), @is(3));

            // Change pruning to true
            config.UpdateDynamicSetting(keep_logical_logs.name(), "false", "test");

            // Checkpoint to make sure strategy is evaluated
            checkPointer.ForceCheckPoint(_triggerInfo);

            // Make sure file is removed
            assertThat(CountTransactionLogs(logFiles), @is(2));
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void generateTransactionsAndRotate(org.neo4j.kernel.internal.GraphDatabaseAPI database, int logFilesToGenerate, boolean checkpoint) throws java.io.IOException
        private static void GenerateTransactionsAndRotate(GraphDatabaseAPI database, int logFilesToGenerate, bool checkpoint)
        {
            DependencyResolver resolver     = database.DependencyResolver;
            LogFiles           logFiles     = resolver.ResolveDependency(typeof(TransactionLogFiles));
            CheckPointer       checkpointer = resolver.ResolveDependency(typeof(CheckPointer));

            while (logFiles.HighestLogVersion < logFilesToGenerate)
            {
                logFiles.LogFile.rotate();
                GenerateTransaction(database);
                if (checkpoint)
                {
                    checkpointer.ForceCheckPoint(new SimpleTriggerInfo("testForcedCheckpoint"));
                }
            }
        }
Example #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void checkpoint(org.neo4j.graphdb.GraphDatabaseService db) throws java.io.IOException
        private void Checkpoint(GraphDatabaseService db)
        {
            CheckPointer checkPointer = checkPointer(db);

            checkPointer.ForceCheckPoint(new SimpleTriggerInfo("test"));
        }
Example #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void forceCheckpoint(org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointer checkPointer) throws java.io.IOException
        private static void ForceCheckpoint(CheckPointer checkPointer)
        {
            checkPointer.ForceCheckPoint(new SimpleTriggerInfo("testForceCheckPoint"));
        }