示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSendAndReceive() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSendAndReceive()
        {
            // given: raft server handler
            int                   port            = PortAuthority.allocatePort();
            Semaphore             messageReceived = new Semaphore(0);
            ChannelInboundHandler nettyHandler    = new ChannelInboundHandlerAdapterAnonymousInnerClass(this, messageReceived);
            Server                raftServer      = raftServer(nettyHandler, port);

            raftServer.Start();

            // given: raft messaging service
            SenderService sender = RaftSender();

            sender.Start();

            // when
            AdvertisedSocketAddress to = new AdvertisedSocketAddress("localhost", port);
            MemberId  memberId         = new MemberId(System.Guid.randomUUID());
            ClusterId clusterId        = new ClusterId(System.Guid.randomUUID());

            Org.Neo4j.causalclustering.core.consensus.RaftMessages_NewEntry_Request newEntryMessage = new Org.Neo4j.causalclustering.core.consensus.RaftMessages_NewEntry_Request(memberId, new MemberIdSet(asSet(memberId)));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.causalclustering.core.consensus.RaftMessages_ClusterIdAwareMessage<?> message = org.neo4j.causalclustering.core.consensus.RaftMessages_ClusterIdAwareMessage.of(clusterId, newEntryMessage);
            Org.Neo4j.causalclustering.core.consensus.RaftMessages_ClusterIdAwareMessage <object> message = Org.Neo4j.causalclustering.core.consensus.RaftMessages_ClusterIdAwareMessage.of(clusterId, newEntryMessage);

            sender.Send(to, message, Blocking);

            // then
            assertTrue(messageReceived.tryAcquire(15, SECONDS));

            // cleanup
            sender.Stop();
            raftServer.Stop();
        }
示例#2
0
        private ReadReplicaInfo ReadReplicaInfo(string dbName)
        {
            ClientConnectorAddresses clientConnectorAddresses = new ClientConnectorAddresses(Collections.emptyList());
            AdvertisedSocketAddress  catchupServerAddress     = new AdvertisedSocketAddress("hostname", 1234);

            return(new ReadReplicaInfo(clientConnectorAddresses, catchupServerAddress, dbName));
        }
示例#3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void persistentCallToSecondary(org.neo4j.causalclustering.messaging.CatchUpRequest request, org.neo4j.causalclustering.catchup.CatchUpResponseAdaptor<StoreCopyFinishedResponse> copyHandler, org.neo4j.causalclustering.catchup.CatchupAddressProvider addressProvider, TerminationCondition terminationCondition) throws StoreCopyFailedException
        private void PersistentCallToSecondary(CatchUpRequest request, CatchUpResponseAdaptor <StoreCopyFinishedResponse> copyHandler, CatchupAddressProvider addressProvider, TerminationCondition terminationCondition)
        {
            Org.Neo4j.causalclustering.helper.TimeoutStrategy_Timeout timeout = _backOffStrategy.newTimeout();
            while (true)
            {
                try
                {
                    AdvertisedSocketAddress address = addressProvider.Secondary();
                    _log.info(format("Sending request '%s' to '%s'", request, address));
                    StoreCopyFinishedResponse response = _catchUpClient.makeBlockingRequest(address, request, copyHandler);
                    if (SuccessfulRequest(response, request))
                    {
                        break;
                    }
                }
                catch (CatchUpClientException e)
                {
                    Exception cause = e.InnerException;
                    if (cause is ConnectException)
                    {
                        _log.warn(cause.Message);
                    }
                    else
                    {
                        _log.warn(format("Request failed exceptionally '%s'.", request), e);
                    }
                }
                catch (CatchupAddressResolutionException e)
                {
                    _log.warn("Unable to resolve address for '%s'. %s", request, e.Message);
                }
                terminationCondition();
                AwaitAndIncrementTimeout(timeout);
            }
        }
示例#4
0
        /// <summary>
        /// Given a hazelcast member id and a set of non-null attribute maps, this method builds a discovery representation of a read replica
        /// (i.e. `Pair<MemberId,ReadReplicaInfo>`). Any missing attributes which are missing for a given hazelcast member id are logged and this
        /// method will return null.
        /// </summary>
        private static Pair <MemberId, ReadReplicaInfo> BuildReadReplicaFromAttrMap(string hzId, IDictionary <string, IMap <string, string> > simpleAttrMaps, MultiMap <string, string> serverGroupsMap, Log log)
        {
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            IDictionary <string, string> memberAttrs = simpleAttrMaps.SetOfKeyValuePairs().Select(e => Pair.of(e.Key, e.Value.get(hzId))).Where(p => HasAttribute(p, hzId, log)).collect(CollectorsUtil.pairsToMap());

//JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the java.util.Collection 'containsAll' method:
            if (!memberAttrs.Keys.containsAll(RrAttrKeys))
            {
                return(null);
            }

            ICollection <string> memberServerGroups = serverGroupsMap.get(hzId);

            if (memberServerGroups == null)
            {
                log.Warn("Missing attribute %s for read replica with hz id %s", SERVER_GROUPS_MULTIMAP, hzId);
                return(null);
            }

            ClientConnectorAddresses boltAddresses = ClientConnectorAddresses.FromString(memberAttrs[READ_REPLICA_BOLT_ADDRESS_MAP]);
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
            AdvertisedSocketAddress catchupAddress = socketAddress(memberAttrs[READ_REPLICA_TRANSACTION_SERVER_ADDRESS_MAP], AdvertisedSocketAddress::new);
            MemberId      memberId       = new MemberId(System.Guid.Parse(memberAttrs[READ_REPLICA_MEMBER_ID_MAP]));
            string        memberDbName   = memberAttrs[READ_REPLICAS_DB_NAME_MAP];
            ISet <string> serverGroupSet = asSet(memberServerGroups);

            ReadReplicaInfo rrInfo = new ReadReplicaInfo(boltAddresses, catchupAddress, serverGroupSet, memberDbName);

            return(Pair.of(memberId, rrInfo));
        }
示例#5
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);
            }
        }
示例#6
0
        /// <summary>
        /// Performs a backup and returns the path to it. Benign failures are swallowed and an empty optional gets returned.
        /// </summary>
        /// <param name="member"> The member to perform the backup against. </param>
        /// <returns> The optional backup. </returns>
        /// <exception cref="Exception"> If any unexpected exceptions happen. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: java.util.Optional<java.io.File> backup(org.neo4j.causalclustering.discovery.ClusterMember member) throws Exception
        internal virtual Optional <File> Backup(ClusterMember member)
        {
            AdvertisedSocketAddress address = member.config().Get(transaction_advertised_address);
            string backupName = "backup-" + BackupNumber.AndIncrement;

            OnlineBackupCommandBuilder backupCommand = (new OnlineBackupCommandBuilder()).withOutput(NULL_OUTPUT_STREAM).withSelectedBackupStrategy(CATCHUP).withConsistencyCheck(true).withHost(address.Hostname).withPort(address.Port);

            try
            {
                backupCommand.Backup(_baseBackupDir, backupName);
                _log.info(string.Format("Created backup {0} from {1}", backupName, member));

                SuccessfulBackups.incrementAndGet();

                return(new File(_baseBackupDir, backupName));
            }
            catch (CommandFailed e)
            {
                Optional <Exception> benignException = findCauseOrSuppressed(e, t => _benignExceptions.Contains(t.GetType()));
                if (benignException.Present)
                {
                    _log.info("Benign failure: " + benignException.get().Message);
                }
                else
                {
                    throw e;
                }
            }
            return(null);
        }
示例#7
0
        internal static MemberAttributeConfig BuildMemberAttributesForCore(MemberId myself, Config config)
        {
            MemberAttributeConfig memberAttributeConfig = new MemberAttributeConfig();

            memberAttributeConfig.setStringAttribute(MEMBER_UUID, myself.Uuid.ToString());

            AdvertisedSocketAddress discoveryAddress = config.Get(CausalClusteringSettings.discovery_advertised_address);

            memberAttributeConfig.setStringAttribute(DISCOVERY_SERVER, discoveryAddress.ToString());

            AdvertisedSocketAddress transactionSource = config.Get(CausalClusteringSettings.transaction_advertised_address);

            memberAttributeConfig.setStringAttribute(TRANSACTION_SERVER, transactionSource.ToString());

            AdvertisedSocketAddress raftAddress = config.Get(CausalClusteringSettings.raft_advertised_address);

            memberAttributeConfig.setStringAttribute(RAFT_SERVER, raftAddress.ToString());

            ClientConnectorAddresses clientConnectorAddresses = ClientConnectorAddresses.ExtractFromConfig(config);

            memberAttributeConfig.setStringAttribute(CLIENT_CONNECTOR_ADDRESSES, clientConnectorAddresses.ToString());

            memberAttributeConfig.setBooleanAttribute(REFUSE_TO_BE_LEADER_KEY, config.Get(refuse_to_be_leader));

            memberAttributeConfig.setStringAttribute(MEMBER_DB_NAME, config.Get(CausalClusteringSettings.database));

            return(memberAttributeConfig);
        }
示例#8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldResolveAndReturnAllConfiguredAddresses()
        public virtual void ShouldResolveAndReturnAllConfiguredAddresses()
        {
            // given
            AdvertisedSocketAddress input1 = new AdvertisedSocketAddress("foo.bar", 123);
            AdvertisedSocketAddress input2 = new AdvertisedSocketAddress("baz.bar", 432);
            AdvertisedSocketAddress input3 = new AdvertisedSocketAddress("quux.bar", 789);

            AdvertisedSocketAddress output1 = new AdvertisedSocketAddress("a.b", 3);
            AdvertisedSocketAddress output2 = new AdvertisedSocketAddress("b.b", 34);
            AdvertisedSocketAddress output3 = new AdvertisedSocketAddress("c.b", 7);

//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            string configString = Stream.of(input1, input2, input3).map(AdvertisedSocketAddress::toString).collect(Collectors.joining(","));

            Config config = Config.builder().withSetting(initial_discovery_members, configString).build();

            when(_hostnameResolver.resolve(input1)).thenReturn(asList(output1, output2));
            when(_hostnameResolver.resolve(input2)).thenReturn(emptyList());
            when(_hostnameResolver.resolve(input3)).thenReturn(singletonList(output3));

            InitialDiscoveryMembersResolver hostnameResolvingInitialDiscoveryMembersResolver = new InitialDiscoveryMembersResolver(_hostnameResolver, config);

            // when
            ICollection <AdvertisedSocketAddress> result = hostnameResolvingInitialDiscoveryMembersResolver.Resolve(identity());

            // then
            assertThat(result, containsInAnyOrder(output1, output2, output3));
        }
示例#9
0
 internal CatchUpChannel(CatchUpClient outerInstance, AdvertisedSocketAddress destination)
 {
     this._outerInstance      = outerInstance;
     this.DestinationConflict = destination;
     Handler   = new TrackingResponseHandler(new CatchUpResponseAdaptor(), outerInstance.clock);
     Bootstrap = (new Bootstrap()).group(outerInstance.eventLoopGroup).channel(typeof(NioSocketChannel)).handler(outerInstance.channelInitializer.apply(Handler));
 }
示例#10
0
 public ReadReplicaInfo(ClientConnectorAddresses clientConnectorAddresses, AdvertisedSocketAddress catchupServerAddress, ISet <string> groups, string dbName)
 {
     this._clientConnectorAddresses = clientConnectorAddresses;
     this._catchupServerAddress     = catchupServerAddress;
     this._groups = groups;
     this._dbName = dbName;
 }
示例#11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertActive(CHANNEL channel, org.neo4j.helpers.AdvertisedSocketAddress address) throws java.net.ConnectException
        private void AssertActive(CHANNEL channel, AdvertisedSocketAddress address)
        {
            if (!channel.Active)
            {
                throw new ConnectException("Unable to connect to " + address);
            }
        }
示例#12
0
        public virtual URI BuildURI(AdvertisedSocketAddress address, bool isSsl)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("http");

            if (isSsl)
            {
                sb.Append("s");
            }
            sb.Append("://");

            sb.Append(address.Hostname);

            int port = address.Port;

            if (port != 80 && port != 443)
            {
                sb.Append(":");
                sb.Append(port);
            }
            sb.Append("/");

            try
            {
                return(new URI(sb.ToString()));
            }
            catch (URISyntaxException e)
            {
                throw new Exception(e);
            }
        }
示例#13
0
        /// <summary>
        /// Later stages of the startup process require at least one transaction to
        /// figure out the mapping between the transaction log and the consensus log.
        ///
        /// If there are no transaction logs then we can pull from and including
        /// the index which the metadata store points to. This would be the case
        /// for example with a backup taken during an idle period of the system.
        ///
        /// However, if there are transaction logs then we want to find out where
        /// they end and pull from there, excluding the last one so that we do not
        /// get duplicate entries.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.causalclustering.catchup.CatchupResult tryCatchingUp(org.neo4j.helpers.AdvertisedSocketAddress from, org.neo4j.causalclustering.identity.StoreId expectedStoreId, org.neo4j.io.layout.DatabaseLayout databaseLayout, boolean keepTxLogsInDir, boolean forceTransactionLogRotation) throws StoreCopyFailedException, java.io.IOException
        public virtual CatchupResult TryCatchingUp(AdvertisedSocketAddress from, StoreId expectedStoreId, DatabaseLayout databaseLayout, bool keepTxLogsInDir, bool forceTransactionLogRotation)
        {
            CommitState commitState = _commitStateHelper.getStoreState(databaseLayout);

            _log.info("Store commit state: " + commitState);

            if (commitState.TransactionLogIndex().HasValue)
            {
                return(PullTransactions(from, expectedStoreId, databaseLayout, commitState.TransactionLogIndex().Value + 1, false, keepTxLogsInDir, forceTransactionLogRotation));
            }
            else
            {
                CatchupResult catchupResult;
                if (commitState.MetaDataStoreIndex() == BASE_TX_ID)
                {
                    return(PullTransactions(from, expectedStoreId, databaseLayout, commitState.MetaDataStoreIndex() + 1, false, keepTxLogsInDir, forceTransactionLogRotation));
                }
                else
                {
                    catchupResult = PullTransactions(from, expectedStoreId, databaseLayout, commitState.MetaDataStoreIndex(), false, keepTxLogsInDir, forceTransactionLogRotation);
                    if (catchupResult == E_TRANSACTION_PRUNED)
                    {
                        return(PullTransactions(from, expectedStoreId, databaseLayout, commitState.MetaDataStoreIndex() + 1, false, keepTxLogsInDir, forceTransactionLogRotation));
                    }
                }
                return(catchupResult);
            }
        }
示例#14
0
            internal static ConnectorUri FromString(string @string)
            {
                URI uri = URI.create(@string);
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
                AdvertisedSocketAddress advertisedSocketAddress = SocketAddressParser.socketAddress(uri.Authority, AdvertisedSocketAddress::new);

                return(new ConnectorUri(Enum.Parse(typeof(Scheme), uri.Scheme), advertisedSocketAddress));
            }
示例#15
0
        public static CoreServerInfo AddressesForCore(int id, bool refuseToBeLeader)
        {
            AdvertisedSocketAddress raftServerAddress    = new AdvertisedSocketAddress("localhost", 3000 + id);
            AdvertisedSocketAddress catchupServerAddress = new AdvertisedSocketAddress("localhost", 4000 + id);
            AdvertisedSocketAddress boltServerAddress    = new AdvertisedSocketAddress("localhost", 5000 + id);

            return(new CoreServerInfo(raftServerAddress, catchupServerAddress, WrapAsClientConnectorAddresses(boltServerAddress), asSet("core", "core" + id), "default", refuseToBeLeader));
        }
示例#16
0
        public static ReadReplicaInfo AddressesForReadReplica(int id)
        {
            AdvertisedSocketAddress  clientConnectorSocketAddress = new AdvertisedSocketAddress("localhost", 6000 + id);
            ClientConnectorAddresses clientConnectorAddresses     = new ClientConnectorAddresses(singletonList(new ClientConnectorAddresses.ConnectorUri(bolt, clientConnectorSocketAddress)));
            AdvertisedSocketAddress  catchupSocketAddress         = new AdvertisedSocketAddress("localhost", 4000 + id);

            return(new ReadReplicaInfo(clientConnectorAddresses, catchupSocketAddress, asSet("replica", "replica" + id), "default"));
        }
示例#17
0
        private static CoreServerInfo CoreServerInfo(params string[] groupNames)
        {
            AdvertisedSocketAddress  anyRaftAddress         = new AdvertisedSocketAddress("hostname", 1234);
            AdvertisedSocketAddress  anyCatchupServer       = new AdvertisedSocketAddress("hostname", 5678);
            ClientConnectorAddresses clientConnectorAddress = new ClientConnectorAddresses(Collections.emptyList());
            ISet <string>            groups = new HashSet <string>(Arrays.asList(groupNames));

            return(new CoreServerInfo(anyRaftAddress, anyCatchupServer, clientConnectorAddress, groups, "dbName", false));
        }
示例#18
0
        private static ReadReplicaInfo ReadReplicaInfo(params string[] groupNames)
        {
            ClientConnectorAddresses clientConnectorAddresses = new ClientConnectorAddresses(Collections.emptyList());
            AdvertisedSocketAddress  catchupServerAddress     = new AdvertisedSocketAddress("hostname", 2468);
            ISet <string>            groups          = new HashSet <string>(Arrays.asList(groupNames));
            ReadReplicaInfo          readReplicaInfo = new ReadReplicaInfo(clientConnectorAddresses, catchupServerAddress, groups, "dbName");

            return(readReplicaInfo);
        }
示例#19
0
 public CoreServerInfo(AdvertisedSocketAddress raftServer, AdvertisedSocketAddress catchupServer, ClientConnectorAddresses clientConnectorAddresses, ISet <string> groups, string dbName, bool refuseToBeLeader)
 {
     this._raftServer               = raftServer;
     this._catchupServer            = catchupServer;
     this._clientConnectorAddresses = clientConnectorAddresses;
     this._groups           = groups;
     this._dbName           = dbName;
     this._refuseToBeLeader = refuseToBeLeader;
 }
示例#20
0
        private CoreServerInfo CoreServerInfo(string dbName)
        {
            AdvertisedSocketAddress  raftServer       = new AdvertisedSocketAddress("hostname", 1234);
            AdvertisedSocketAddress  catchupServer    = new AdvertisedSocketAddress("hostname", 1234);
            ClientConnectorAddresses clientConnectors = new ClientConnectorAddresses(Collections.emptyList());
            bool refuseToBeLeader = false;

            return(new CoreServerInfo(raftServer, catchupServer, clientConnectors, dbName, refuseToBeLeader));
        }
示例#21
0
        public static ReadReplicaInfo From(Config config)
        {
            AdvertisedSocketAddress  transactionSource        = config.Get(CausalClusteringSettings.transaction_advertised_address);
            ClientConnectorAddresses clientConnectorAddresses = ClientConnectorAddresses.ExtractFromConfig(config);
            string         dbName    = config.Get(CausalClusteringSettings.database);
            IList <string> groupList = config.Get(CausalClusteringSettings.server_groups);
            ISet <string>  groups    = new HashSet <string>(groupList);

            return(new ReadReplicaInfo(clientConnectorAddresses, transactionSource, groups, dbName));
        }
示例#22
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private PrepareStoreCopyResponse prepareStoreCopy(org.neo4j.helpers.AdvertisedSocketAddress from, org.neo4j.causalclustering.identity.StoreId expectedStoreId, StoreFileStreamProvider storeFileStream) throws org.neo4j.causalclustering.catchup.CatchUpClientException, StoreCopyFailedException
        private PrepareStoreCopyResponse PrepareStoreCopy(AdvertisedSocketAddress from, StoreId expectedStoreId, StoreFileStreamProvider storeFileStream)
        {
            _log.info("Requesting store listing from: " + from);
            PrepareStoreCopyResponse prepareStoreCopyResponse = _catchUpClient.makeBlockingRequest(from, new PrepareStoreCopyRequest(expectedStoreId), prepareStoreCopyAdaptor(storeFileStream, _log));

            if (prepareStoreCopyResponse.Status() != PrepareStoreCopyResponse.Status.Success)
            {
                throw new StoreCopyFailedException("Preparing store failed due to: " + prepareStoreCopyResponse.Status());
            }
            return(prepareStoreCopyResponse);
        }
示例#23
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void ensureSameStoreIdAs(org.neo4j.causalclustering.identity.MemberId upstream) throws org.neo4j.causalclustering.catchup.storecopy.StoreIdDownloadFailedException, org.neo4j.causalclustering.core.state.snapshot.TopologyLookupException
        private void EnsureSameStoreIdAs(MemberId upstream)
        {
            StoreId localStoreId = _localDatabase.storeId();
            AdvertisedSocketAddress advertisedSocketAddress = _topologyService.findCatchupAddress(upstream).orElseThrow(() => new TopologyLookupException(upstream));
            StoreId remoteStoreId = _remoteStore.getStoreId(advertisedSocketAddress);

            if (!localStoreId.Equals(remoteStoreId))
            {
                throw new System.InvalidOperationException(format("This read replica cannot join the cluster. " + "The local database is not empty and has a mismatching storeId: expected %s actual %s.", remoteStoreId, localStoreId));
            }
        }
示例#24
0
        public static CoreServerInfo From(Config config)
        {
            AdvertisedSocketAddress  raftAddress              = config.Get(CausalClusteringSettings.raft_advertised_address);
            AdvertisedSocketAddress  transactionSource        = config.Get(CausalClusteringSettings.transaction_advertised_address);
            ClientConnectorAddresses clientConnectorAddresses = ClientConnectorAddresses.ExtractFromConfig(config);
            string         dbName           = config.Get(CausalClusteringSettings.database);
            IList <string> groupList        = config.Get(CausalClusteringSettings.server_groups);
            ISet <string>  groups           = new HashSet <string>(groupList);
            bool           refuseToBeLeader = config.Get(CausalClusteringSettings.refuse_to_be_leader);

            return(new CoreServerInfo(raftAddress, transactionSource, clientConnectorAddresses, groups, dbName, refuseToBeLeader));
        }
示例#25
0
 private void RegisterHttpsAddressAfterStartup()
 {
     if (_httpsConnector != null)
     {
         InetSocketAddress localHttpsAddress = WebServerConflict.LocalHttpsAddress;
         _connectorPortRegister.register(_httpsConnector.key(), localHttpsAddress);
         if (_httpsAdvertisedAddress.Port == 0)
         {
             _httpsAdvertisedAddress = new AdvertisedSocketAddress(localHttpsAddress.HostString, localHttpsAddress.Port);
         }
     }
 }
示例#26
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.causalclustering.identity.StoreId fetchStoreId(org.neo4j.helpers.AdvertisedSocketAddress fromAddress) throws StoreIdDownloadFailedException
        public virtual StoreId FetchStoreId(AdvertisedSocketAddress fromAddress)
        {
            try
            {
                CatchUpResponseAdaptor <StoreId> responseHandler = new CatchUpResponseAdaptorAnonymousInnerClass(this);
                return(_catchUpClient.makeBlockingRequest(fromAddress, new GetStoreIdRequest(), responseHandler));
            }
            catch (CatchUpClientException e)
            {
                throw new StoreIdDownloadFailedException(e);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldParseExplicitSettingValueWhenProvided()
        public virtual void ShouldParseExplicitSettingValueWhenProvided()
        {
            // given
            IDictionary <string, string> config = stringMap(GraphDatabaseSettings.default_advertised_address.name(), "server1.example.com", _advertisedAddressSetting.name(), "server1.internal:4000");

            // when
            AdvertisedSocketAddress advertisedSocketAddress = _advertisedAddressSetting.apply(config.get);

            // then
            assertEquals("server1.internal", advertisedSocketAddress.Hostname);
            assertEquals(4000, advertisedSocketAddress.Port);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCombineDefaultHostnameWithPortFromListenAddressSettingWhenNoValueProvided()
        public virtual void ShouldCombineDefaultHostnameWithPortFromListenAddressSettingWhenNoValueProvided()
        {
            // given
            IDictionary <string, string> config = stringMap(GraphDatabaseSettings.default_advertised_address.name(), "server1.example.com");

            // when
            AdvertisedSocketAddress advertisedSocketAddress = _advertisedAddressSetting.apply(config.get);

            // then
            assertEquals("server1.example.com", advertisedSocketAddress.Hostname);
            assertEquals(1234, advertisedSocketAddress.Port);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCombineDefaultHostnameWithExplicitPortWhenOnlyAPortProvided()
        public virtual void ShouldCombineDefaultHostnameWithExplicitPortWhenOnlyAPortProvided()
        {
            // given
            IDictionary <string, string> config = stringMap(GraphDatabaseSettings.default_advertised_address.name(), "server1.example.com", _advertisedAddressSetting.name(), ":4000");

            // when
            AdvertisedSocketAddress advertisedSocketAddress = _advertisedAddressSetting.apply(config.get);

            // then
            assertEquals("server1.example.com", advertisedSocketAddress.Hostname);
            assertEquals(4000, advertisedSocketAddress.Port);
        }
示例#30
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void incrementalBackupsUseCorrectResolvedAddress() throws org.neo4j.causalclustering.catchup.storecopy.StoreCopyFailedException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void IncrementalBackupsUseCorrectResolvedAddress()
        {
            // given
            AdvertisedSocketAddress expectedAddress = new AdvertisedSocketAddress("expected-host", 1298);

            when(AddressResolver.resolveCorrectCCAddress(any(), any())).thenReturn(expectedAddress);

            // when
            Subject.performIncrementalBackup(DesiredBackupLayout, Config, UserProvidedAddress);

            // then
            verify(BackupDelegator).tryCatchingUp(eq(expectedAddress), any(), any());
        }