InetSocketAddress translateAddress(InetAddress address) { InetSocketAddress sa = new InetSocketAddress(address, connectionFactory.getPort()); return translateAddress(sa); }
InetAddress nativeAddress = peersRow.getInet("native_address"); int nativePort = peersRow.getInt("native_port"); return cluster.translateAddress(new InetSocketAddress(nativeAddress, nativePort)); } else { rpcAddress = broadcastAddress; return cluster.translateAddress(rpcAddress);
case TOPOLOGY_CHANGE: ProtocolEvent.TopologyChange tpc = (ProtocolEvent.TopologyChange) event; InetSocketAddress tpAddr = translateAddress(tpc.node.getAddress()); Host.statesLogger.debug("[{}] received event {}", tpAddr, tpc.change); switch (tpc.change) { case STATUS_CHANGE: ProtocolEvent.StatusChange stc = (ProtocolEvent.StatusChange) event; InetSocketAddress stAddr = translateAddress(stc.node.getAddress()); Host.statesLogger.debug("[{}] received event {}", stAddr, stc.status); switch (stc.status) {
case TOPOLOGY_CHANGE: ProtocolEvent.TopologyChange tpc = (ProtocolEvent.TopologyChange) event; InetSocketAddress tpAddr = translateAddress(tpc.node.getAddress()); Host.statesLogger.debug("[{}] received event {}", tpAddr, tpc.change); switch (tpc.change) { case STATUS_CHANGE: ProtocolEvent.StatusChange stc = (ProtocolEvent.StatusChange) event; InetSocketAddress stAddr = translateAddress(stc.node.getAddress()); Host.statesLogger.debug("[{}] received event {}", stAddr, stc.status); switch (stc.status) {
case TOPOLOGY_CHANGE: ProtocolEvent.TopologyChange tpc = (ProtocolEvent.TopologyChange) event; InetSocketAddress tpAddr = translateAddress(tpc.node.getAddress()); Host.statesLogger.debug("[{}] received event {}", tpAddr, tpc.change); switch (tpc.change) { case STATUS_CHANGE: ProtocolEvent.StatusChange stc = (ProtocolEvent.StatusChange) event; InetSocketAddress stAddr = translateAddress(stc.node.getAddress()); Host.statesLogger.debug("[{}] received event {}", stAddr, stc.status); switch (stc.status) {
case TOPOLOGY_CHANGE: ProtocolEvent.TopologyChange tpc = (ProtocolEvent.TopologyChange) event; InetSocketAddress tpAddr = translateAddress(tpc.node.getAddress()); Host.statesLogger.debug("[{}] received event {}", tpAddr, tpc.change); switch (tpc.change) { case STATUS_CHANGE: ProtocolEvent.StatusChange stc = (ProtocolEvent.StatusChange) event; InetSocketAddress stAddr = translateAddress(stc.node.getAddress()); Host.statesLogger.debug("[{}] received event {}", stAddr, stc.status); switch (stc.status) {
case TOPOLOGY_CHANGE: ProtocolEvent.TopologyChange tpc = (ProtocolEvent.TopologyChange)event; InetSocketAddress tpAddr = translateAddress(tpc.node.getAddress()); switch (tpc.change) { case NEW_NODE: case STATUS_CHANGE: ProtocolEvent.StatusChange stc = (ProtocolEvent.StatusChange)event; InetSocketAddress stAddr = translateAddress(stc.node.getAddress()); switch (stc.status) { case UP:
private static InetSocketAddress rpcAddressForPeerHost(Row peersRow, InetSocketAddress connectedHost, Cluster.Manager cluster) { // after CASSANDRA-9436, system.peers contains the following inet columns: // - peer: this is actually broadcast_address // - rpc_address: the address we are looking for (this corresponds to broadcast_rpc_address in the peer's cassandra yaml file; // if this setting if unset, it defaults to the value for rpc_address or rpc_interface) // - preferred_ip: used by Ec2MultiRegionSnitch and GossipingPropertyFileSnitch, possibly others; contents unclear InetAddress broadcastAddress = peersRow.getInet("peer"); InetAddress rpcAddress = peersRow.getInet("rpc_address"); if (broadcastAddress == null) { return null; } else if (broadcastAddress.equals(connectedHost.getAddress()) || (rpcAddress != null && rpcAddress.equals(connectedHost.getAddress()))) { // Some DSE versions were inserting a line for the local node in peers (with mostly null values). This has been fixed, but if we // detect that's the case, ignore it as it's not really a big deal. logger.debug("System.peers on node {} has a line for itself. This is not normal but is a known problem of some DSE version. Ignoring the entry.", connectedHost); return null; } else if (rpcAddress == null) { return null; } else if (rpcAddress.equals(bindAllAddress)) { logger.warn("Found host with 0.0.0.0 as rpc_address, using broadcast_address ({}) to contact it instead. If this is incorrect you should avoid the use of 0.0.0.0 server side.", broadcastAddress); rpcAddress = broadcastAddress; } return cluster.translateAddress(rpcAddress); }
private static InetSocketAddress rpcAddressForPeerHost(Row peersRow, InetSocketAddress connectedHost, Cluster.Manager cluster) { // after CASSANDRA-9436, system.peers contains the following inet columns: // - peer: this is actually broadcast_address // - rpc_address: the address we are looking for (this corresponds to broadcast_rpc_address in the peer's cassandra yaml file; // if this setting if unset, it defaults to the value for rpc_address or rpc_interface) // - preferred_ip: used by Ec2MultiRegionSnitch and GossipingPropertyFileSnitch, possibly others; contents unclear InetAddress broadcastAddress = peersRow.getInet("peer"); InetAddress rpcAddress = peersRow.getInet("rpc_address"); if (broadcastAddress == null) { return null; } else if (broadcastAddress.equals(connectedHost.getAddress()) || (rpcAddress != null && rpcAddress.equals(connectedHost.getAddress()))) { // Some DSE versions were inserting a line for the local node in peers (with mostly null values). This has been fixed, but if we // detect that's the case, ignore it as it's not really a big deal. logger.debug("System.peers on node {} has a line for itself. This is not normal but is a known problem of some DSE version. Ignoring the entry.", connectedHost); return null; } else if (rpcAddress == null) { return null; } else if (rpcAddress.equals(bindAllAddress)) { logger.warn("Found host with 0.0.0.0 as rpc_address, using broadcast_address ({}) to contact it instead. If this is incorrect you should avoid the use of 0.0.0.0 server side.", broadcastAddress); rpcAddress = broadcastAddress; } return cluster.translateAddress(rpcAddress); }
private static InetSocketAddress rpcAddressForPeerHost(Row peersRow, InetSocketAddress connectedHost, Cluster.Manager cluster) { // after CASSANDRA-9436, system.peers contains the following inet columns: // - peer: this is actually broadcast_address // - rpc_address: the address we are looking for (this corresponds to broadcast_rpc_address in the peer's cassandra yaml file; // if this setting if unset, it defaults to the value for rpc_address or rpc_interface) // - preferred_ip: used by Ec2MultiRegionSnitch and GossipingPropertyFileSnitch, possibly others; contents unclear InetAddress broadcastAddress = peersRow.getInet("peer"); InetAddress rpcAddress = peersRow.getInet("rpc_address"); if (broadcastAddress == null) { return null; } else if (broadcastAddress.equals(connectedHost.getAddress()) || (rpcAddress != null && rpcAddress.equals(connectedHost.getAddress()))) { // Some DSE versions were inserting a line for the local node in peers (with mostly null values). This has been fixed, but if we // detect that's the case, ignore it as it's not really a big deal. logger.debug("System.peers on node {} has a line for itself. This is not normal but is a known problem of some DSE version. Ignoring the entry.", connectedHost); return null; } else if (rpcAddress == null) { return null; } else if (rpcAddress.equals(bindAllAddress)) { logger.warn("Found host with 0.0.0.0 as rpc_address, using broadcast_address ({}) to contact it instead. If this is incorrect you should avoid the use of 0.0.0.0 server side.", broadcastAddress); rpcAddress = broadcastAddress; } return cluster.translateAddress(rpcAddress); }
private static InetSocketAddress addressToUseForPeerHost(Row peersRow, InetSocketAddress connectedHost, Cluster.Manager cluster) { InetAddress peer = peersRow.getInet("peer"); InetAddress addr = peersRow.getInet("rpc_address"); if (peer.equals(connectedHost.getAddress()) || (addr != null && addr.equals(connectedHost.getAddress()))) { // Some DSE versions were inserting a line for the local node in peers (with mostly null values). This has been fixed, but if we // detect that's the case, ignore it as it's not really a big deal. logger.debug("System.peers on node {} has a line for itself. This is not normal but is a known problem of some DSE version. Ignoring the entry.", connectedHost); return null; } else if (addr == null) { logger.error("No rpc_address found for host {} in {}'s peers system table. That should not happen but using address {} instead", peer, connectedHost, peer); addr = peer; } else if (addr.equals(bindAllAddress)) { logger.warn("Found host with 0.0.0.0 as rpc_address, using listen_address ({}) to contact it instead. If this is incorrect you should avoid the use of 0.0.0.0 server side.", peer); addr = peer; } return cluster.translateAddress(addr); }