scylla-jmx/src/main/java/org/apache/cassandra/service
Amnon Heiman 94f144e9b3 StorageService: Get the broadcast address from the API
When getting the tokens of the current node, we use the get_token api
call with the local broadcast address.

The current implementation that tries to figure it out from the
configuration is prone to error.

Currently in a configuration where the broadcast address is set to the
local API and the listening API is set to 127.0.0.1 we get a call to
nodetool info will return an exception:
ID                     : 54185d5d-6f62-4884-814c-5d17c2776de9
Gossip active          : true
Thrift active          : true
Native Transport active: true
Load                   : 178.09 KB
Generation No          : 1458349593
Uptime (seconds)       : 11
Heap Memory (MB)       : 47.23 / 247.50
Off Heap Memory (MB)   : 2.75
error: Index: 0, Size: 0
-- StackTrace --
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at org.apache.cassandra.tools.NodeProbe.getEndpoint(NodeProbe.java:812)
	at org.apache.cassandra.tools.NodeProbe.getDataCenter(NodeProbe.java:830)
	at org.apache.cassandra.tools.NodeTool$Info.execute(NodeTool.java:425)
	at org.apache.cassandra.tools.NodeTool$NodeToolCmd.run(NodeTool.java:288)
	at org.apache.cassandra.tools.NodeTool.main(NodeTool.java:202)

Becasue getTokens will return an empty list.

This patch changed how broadcast address is deduct. It Adds a reverse
mapping from hostid to ip address and use it with the get local id to
find the ip address in use.

This implementation would probably be replaced by a single API call in
the future.

After the change a call to nodetool info works.

Fixes scylladb/scylla#1027

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <1458405434-8491-3-git-send-email-amnon@scylladb.com>
2016-03-22 09:43:13 +02:00
..
CacheService.java Clean the jmxproxy output 2015-12-30 09:27:33 +02:00
CacheServiceMBean.java Adding the CacheServiceMBean and CacheService 2015-06-24 16:48:56 +03:00
GCInspector.java Clean the jmxproxy output 2015-12-30 09:27:33 +02:00
GCInspectorMXBean.java Import the GCInspectorMXBean from origin 2015-12-07 13:00:07 +02:00
StorageProxy.java Clean the jmxproxy output 2015-12-30 09:27:33 +02:00
StorageProxyMBean.java Moving the MBean to 2.1 (8) 2015-07-30 12:01:05 +03:00
StorageService.java StorageService: Get the broadcast address from the API 2016-03-22 09:43:13 +02:00
StorageServiceMBean.java StorageService: Add notification suport for the repair command 2015-08-27 21:02:28 +03:00