Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void createTransactionLogWithCheckpoint(org.neo4j.kernel.configuration.Config config, boolean logsInStoreDir) throws java.io.IOException
        private void CreateTransactionLogWithCheckpoint(Config config, bool logsInStoreDir)
        {
            Org.Neo4j.Storageengine.Api.StoreId storeId = SimulateStoreCopy();

            int fromTxId = 37;
            int endTxId  = fromTxId + 5;

            TransactionLogCatchUpWriter catchUpWriter = new TransactionLogCatchUpWriter(_databaseLayout, _fs, _pageCache, config, NullLogProvider.Instance, fromTxId, PartOfStoreCopyConflict, logsInStoreDir, true);

            // when
            for (int i = fromTxId; i <= endTxId; i++)
            {
                catchUpWriter.OnTxReceived(new TxPullResponse(ToCasualStoreId(storeId), Tx(i)));
            }

            catchUpWriter.Close();

            // then
            LogFilesBuilder logFilesBuilder = LogFilesBuilder.activeFilesBuilder(_databaseLayout, _fs, _pageCache);

            if (!logsInStoreDir)
            {
                logFilesBuilder.WithConfig(config);
            }
            LogFiles logFiles = logFilesBuilder.Build();

            VerifyTransactionsInLog(logFiles, fromTxId, endTxId);
            VerifyCheckpointInLog(logFiles, PartOfStoreCopyConflict);
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void pullRotatesWhenThresholdCrossedAndExplicitlySet() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PullRotatesWhenThresholdCrossedAndExplicitlySet()
        {
            // given
            Config config = Config.defaults();

            config.Augment(GraphDatabaseSettings.logical_log_rotation_threshold, "1M");                 // 1 mebibyte

            // and
            Org.Neo4j.Storageengine.Api.StoreId storeId = SimulateStoreCopy();

            // and
            long fromTxId = BASE_TX_ID;
            TransactionLogCatchUpWriter subject = new TransactionLogCatchUpWriter(_databaseLayout, _fs, _pageCache, config, NullLogProvider.Instance, fromTxId, PartOfStoreCopyConflict, false, true);

            // when a bunch of transactions received
            LongStream.range(fromTxId, _manyTransactions).mapToObj(TransactionLogCatchUpWriterTest.tx).map(tx => new TxPullResponse(ToCasualStoreId(storeId), tx)).forEach(subject.onTxReceived);
            subject.Close();

            // then there was a rotation
            LogFilesBuilder logFilesBuilder = LogFilesBuilder.activeFilesBuilder(_databaseLayout, _fs, _pageCache);
            LogFiles        logFiles        = logFilesBuilder.Build();

            assertNotEquals(logFiles.LowestLogVersion, logFiles.HighestLogVersion);
            VerifyTransactionsInLog(logFiles, fromTxId, _manyTransactions);
            VerifyCheckpointInLog(logFiles, PartOfStoreCopyConflict);
        }