Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.causalclustering.catchup.CatchupResult pullTransactions(org.neo4j.helpers.AdvertisedSocketAddress from, org.neo4j.causalclustering.identity.StoreId expectedStoreId, org.neo4j.io.layout.DatabaseLayout databaseLayout, long fromTxId, boolean asPartOfStoreCopy, boolean keepTxLogsInStoreDir, boolean rotateTransactionsManually) throws java.io.IOException, StoreCopyFailedException
        private CatchupResult PullTransactions(AdvertisedSocketAddress from, StoreId expectedStoreId, DatabaseLayout databaseLayout, long fromTxId, bool asPartOfStoreCopy, bool keepTxLogsInStoreDir, bool rotateTransactionsManually)
        {
            StoreCopyClientMonitor storeCopyClientMonitor = _monitors.newMonitor(typeof(StoreCopyClientMonitor));

            storeCopyClientMonitor.StartReceivingTransactions(fromTxId);
            long previousTxId = fromTxId - 1;

            try
            {
                using (TransactionLogCatchUpWriter writer = _transactionLogFactory.create(databaseLayout, _fs, _pageCache, _config, _logProvider, fromTxId, asPartOfStoreCopy, keepTxLogsInStoreDir, rotateTransactionsManually))
                {
                    _log.info("Pulling transactions from %s starting with txId: %d", from, fromTxId);
                    CatchupResult lastStatus;

                    TxPullRequestResult result = _txPullClient.pullTransactions(from, expectedStoreId, previousTxId, writer);
                    lastStatus   = result.CatchupResult();
                    previousTxId = result.LastTxId();

                    return(lastStatus);
                }
            }
            catch (CatchUpClientException e)
            {
                throw new StoreCopyFailedException(e);
            }
            finally
            {
                storeCopyClientMonitor.FinishReceivingTransactions(previousTxId);
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void copyFilesIndividually(PrepareStoreCopyResponse prepareStoreCopyResponse, org.neo4j.causalclustering.identity.StoreId expectedStoreId, org.neo4j.causalclustering.catchup.CatchupAddressProvider addressProvider, StoreFileStreamProvider storeFileStream, System.Func<TerminationCondition> terminationConditions, java.io.File destDir) throws StoreCopyFailedException
        private void CopyFilesIndividually(PrepareStoreCopyResponse prepareStoreCopyResponse, StoreId expectedStoreId, CatchupAddressProvider addressProvider, StoreFileStreamProvider storeFileStream, System.Func <TerminationCondition> terminationConditions, File destDir)
        {
            StoreCopyClientMonitor storeCopyClientMonitor = _monitors.newMonitor(typeof(StoreCopyClientMonitor));

            storeCopyClientMonitor.StartReceivingStoreFiles();
            long lastTransactionId = prepareStoreCopyResponse.LastTransactionId();

            foreach (File file in prepareStoreCopyResponse.Files)
            {
                storeCopyClientMonitor.StartReceivingStoreFile(Paths.get(destDir.ToString(), file.Name).ToString());
                PersistentCallToSecondary(new GetStoreFileRequest(expectedStoreId, file, lastTransactionId), filesCopyAdaptor(storeFileStream, _log), addressProvider, terminationConditions());
                storeCopyClientMonitor.FinishReceivingStoreFile(Paths.get(destDir.ToString(), file.Name).ToString());
            }
            storeCopyClientMonitor.FinishReceivingStoreFiles();
        }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void copyIndexSnapshotIndividually(PrepareStoreCopyResponse prepareStoreCopyResponse, org.neo4j.causalclustering.identity.StoreId expectedStoreId, org.neo4j.causalclustering.catchup.CatchupAddressProvider addressProvider, StoreFileStreamProvider storeFileStream, System.Func<TerminationCondition> terminationConditions) throws StoreCopyFailedException
        private void CopyIndexSnapshotIndividually(PrepareStoreCopyResponse prepareStoreCopyResponse, StoreId expectedStoreId, CatchupAddressProvider addressProvider, StoreFileStreamProvider storeFileStream, System.Func <TerminationCondition> terminationConditions)
        {
            StoreCopyClientMonitor storeCopyClientMonitor = _monitors.newMonitor(typeof(StoreCopyClientMonitor));
            long         lastTransactionId = prepareStoreCopyResponse.LastTransactionId();
            LongIterator indexIds          = prepareStoreCopyResponse.IndexIds.longIterator();

            storeCopyClientMonitor.StartReceivingIndexSnapshots();
            while (indexIds.hasNext())
            {
                long indexId = indexIds.next();
                storeCopyClientMonitor.StartReceivingIndexSnapshot(indexId);
                PersistentCallToSecondary(new GetIndexFilesRequest(expectedStoreId, indexId, lastTransactionId), filesCopyAdaptor(storeFileStream, _log), addressProvider, terminationConditions());
                storeCopyClientMonitor.FinishReceivingIndexSnapshot(indexId);
            }
            storeCopyClientMonitor.FinishReceivingIndexSnapshots();
        }
Пример #4
0
 public ToFileStoreWriter(File graphDbStoreDir, FileSystemAbstraction fs, StoreCopyClientMonitor storeCopyClientMonitor)
 {
     this._basePath = graphDbStoreDir;
     this._fs       = fs;
     this._monitor  = storeCopyClientMonitor;
 }