Esempio n. 1
0
        public override Fallible <BackupStageOutcome> PerformFullBackup(DatabaseLayout targetDatabaseLayout, Config config, OptionalHostnamePort userProvidedAddress)
        {
            AdvertisedSocketAddress fromAddress = _addressResolver.resolveCorrectCCAddress(config, userProvidedAddress);

            _log.info("Resolved address for catchup protocol is " + fromAddress);
            StoreId storeId;

            try
            {
                storeId = _backupDelegator.fetchStoreId(fromAddress);
                _log.info("Remote store id is " + storeId);
            }
            catch (StoreIdDownloadFailedException e)
            {
                return(new Fallible <BackupStageOutcome>(BackupStageOutcome.WrongProtocol, e));
            }

            Optional <StoreId> expectedStoreId = ReadLocalStoreId(targetDatabaseLayout);

            if (expectedStoreId.Present)
            {
                return(new Fallible <BackupStageOutcome>(BackupStageOutcome.Failure, new StoreIdDownloadFailedException(format("Cannot perform a full backup onto preexisting backup. Remote store id was %s but local is %s", storeId, expectedStoreId))));
            }

            try
            {
                _backupDelegator.copy(fromAddress, storeId, targetDatabaseLayout);
                return(new Fallible <BackupStageOutcome>(BackupStageOutcome.Success, null));
            }
            catch (StoreCopyFailedException e)
            {
                return(new Fallible <BackupStageOutcome>(BackupStageOutcome.Failure, e));
            }
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void retrieveStoreDelegatesToStoreCopyService() throws org.neo4j.causalclustering.catchup.storecopy.StoreCopyFailedException, org.neo4j.causalclustering.catchup.CatchupAddressResolutionException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void RetrieveStoreDelegatesToStoreCopyService()
        {
            // given
            StoreId        storeId        = new StoreId(92, 5, 7, 32);
            DatabaseLayout databaseLayout = DatabaseLayout.of(new File("."));

            // when
            Subject.copy(_anyAddress, storeId, databaseLayout);

            // then
            ArgumentCaptor <CatchupAddressProvider> argumentCaptor = ArgumentCaptor.forClass(typeof(CatchupAddressProvider));

            verify(_remoteStore).copy(argumentCaptor.capture(), eq(storeId), eq(databaseLayout), eq(true));

            //and
            assertEquals(_anyAddress, argumentCaptor.Value.primary());
        }