Example #1
0
        private void PullTransactions()
        {
            MemberId upstream;

            try
            {
                upstream = _selectionStrategy.bestUpstreamDatabase();
            }
            catch (UpstreamDatabaseSelectionException e)
            {
                _log.warn("Could not find upstream database from which to pull.", e);
                return;
            }

            StoreId localStoreId = _localDatabase.storeId();

            bool moreToPull = true;
            int  batchCount = 1;

            while (moreToPull)
            {
                moreToPull = PullAndApplyBatchOfTransactions(upstream, localStoreId, batchCount);
                batchCount++;
            }
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void start() throws java.io.IOException, org.neo4j.causalclustering.catchup.storecopy.DatabaseShutdownException
        public override void Start()
        {
            bool syncedWithUpstream = false;

            Org.Neo4j.causalclustering.helper.TimeoutStrategy_Timeout timeout = _timeoutStrategy.newTimeout();
            int attempt = 0;

            while (!syncedWithUpstream)
            {
                attempt++;
                MemberId source = null;
                try
                {
                    source = _selectionStrategy.bestUpstreamDatabase();
                    SyncStoreWithUpstream(source);
                    syncedWithUpstream = true;
                }
                catch (UpstreamDatabaseSelectionException)
                {
                    _lastIssue = IssueOf("finding upstream member", attempt);
                    _debugLog.warn(_lastIssue);
                }
                catch (StoreCopyFailedException)
                {
                    _lastIssue = IssueOf(format("copying store files from %s", source), attempt);
                    _debugLog.warn(_lastIssue);
                }
                catch (StoreIdDownloadFailedException)
                {
                    _lastIssue = IssueOf(format("getting store id from %s", source), attempt);
                    _debugLog.warn(_lastIssue);
                }
                catch (TopologyLookupException)
                {
                    _lastIssue = IssueOf(format("getting address of %s", source), attempt);
                    _debugLog.warn(_lastIssue);
                }

                try
                {
                    Thread.Sleep(timeout.Millis);
                    timeout.Increment();
                }
                catch (InterruptedException)
                {
                    Thread.interrupted();
                    _lastIssue = "Interrupted while trying to start read replica";
                    _debugLog.warn(_lastIssue);
                    break;
                }
            }

            if (!syncedWithUpstream)
            {
                _userLog.error(_lastIssue);
                throw new Exception(_lastIssue);
            }

            try
            {
                _localDatabase.start();
                _txPulling.start();
            }
            catch (Exception e)
            {
                throw new Exception(e);
            }
        }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void before() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Before()
        {
            when(_idStore.LastCommittedTransactionId).thenReturn(BASE_TX_ID);
            when(_strategyPipeline.bestUpstreamDatabase()).thenReturn(_coreMemberId);
        }