Merge branch 'cassandra-2.2' into cassandra-3.0

This commit is contained in:
Sylvain Lebresne 2015-12-11 17:58:48 +01:00
commit d55a51e952
9 changed files with 59 additions and 10 deletions

View File

@ -1,6 +1,13 @@
3.0.2
Merged from 2.2
* Add property to allow listening on broadcast interface (CASSANDRA-9748)
* Fix regression in split size on CqlInputFormat (CASSANDRA-10835)
* Better handling of SSL connection errors inter-node (CASSANDRA-10816)
* Disable reloading of GossipingPropertyFileSnitch (CASSANDRA-9474)
* Verify tables in pseudo-system keyspaces at startup (CASSANDRA-10761)
Merged from 2.1:
* Allow cancellation of index summary redistribution (CASSANDRA-8805)
3.0.1
* Avoid MV race during node decommission (CASSANDRA-10674)
* Disable reloading of GossipingPropertyFileSnitch (CASSANDRA-9474)

View File

@ -470,6 +470,14 @@ listen_address: localhost
# Leaving this blank will set it to the same value as listen_address
# broadcast_address: 1.2.3.4
# When using multiple physical network interfaces, set this
# to true to listen on broadcast_address in addition to
# the listen_address, allowing nodes to communicate in both
# interfaces.
# Ignore this property if the network configuration automatically
# routes between the public and private networks such as EC2.
# listen_on_broadcast_address: false
# Internode authentication backend, implementing IInternodeAuthenticator;
# used to allow/disallow connections from peer nodes.
# internode_authenticator: org.apache.cassandra.auth.AllowAllInternodeAuthenticator

View File

@ -109,6 +109,7 @@ public class Config
public String listen_interface;
public Boolean listen_interface_prefer_ipv6 = false;
public String broadcast_address;
public Boolean listen_on_broadcast_address = false;
public String internode_authenticator;
/* intentionally left set to true, despite being set to false in stock 2.2 cassandra.yaml

View File

@ -1278,6 +1278,11 @@ public class DatabaseDescriptor
return broadcastAddress;
}
public static Boolean shouldListenOnBroadcastAddress()
{
return conf.listen_on_broadcast_address;
}
public static IInternodeAuthenticator getInternodeAuthenticator()
{
return internodeAuthenticator;

View File

@ -63,7 +63,7 @@ public class ReconnectableSnitchHelper implements IEndpointStateChangeSubscriber
&& !MessagingService.instance().getConnectionPool(publicAddress).endPoint().equals(localAddress))
{
MessagingService.instance().getConnectionPool(publicAddress).reset(localAddress);
logger.trace(String.format("Intiated reconnect to an Internal IP %s for the %s", localAddress, publicAddress));
logger.debug(String.format("Intiated reconnect to an Internal IP %s for the %s", localAddress, publicAddress));
}
}

View File

@ -465,21 +465,31 @@ public final class MessagingService implements MessagingServiceMBean
getConnectionPool(ep).reset();
}
public void listen()
{
callbacks.reset(); // hack to allow tests to stop/restart MS
listen(FBUtilities.getLocalAddress());
if (DatabaseDescriptor.shouldListenOnBroadcastAddress()
&& !FBUtilities.getLocalAddress().equals(FBUtilities.getBroadcastAddress()))
{
listen(FBUtilities.getBroadcastAddress());
}
listenGate.signalAll();
}
/**
* Listen on the specified port.
*
* @param localEp InetAddress whose port to listen on.
*/
public void listen(InetAddress localEp) throws ConfigurationException
private void listen(InetAddress localEp) throws ConfigurationException
{
callbacks.reset(); // hack to allow tests to stop/restart MS
for (ServerSocket ss : getServerSockets(localEp))
{
SocketThread th = new SocketThread(ss, "ACCEPT-" + localEp);
th.start();
socketThreads.add(th);
}
listenGate.signalAll();
}
@SuppressWarnings("resource")
@ -542,7 +552,9 @@ public final class MessagingService implements MessagingServiceMBean
FileUtils.closeQuietly(socket);
throw new RuntimeException(e);
}
logger.info("Starting Messaging Service on port {}", DatabaseDescriptor.getStoragePort());
String nic = FBUtilities.getNetworkInterface(localEp);
logger.info("Starting Messaging Service on {}:{}{}", localEp, DatabaseDescriptor.getStoragePort(),
nic == null? "" : String.format(" (%s)", nic));
ss.add(socket);
}
return ss;

View File

@ -490,7 +490,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
{
logger.info("Gathering node replacement information for {}", DatabaseDescriptor.getReplaceAddress());
if (!MessagingService.instance().isListening())
MessagingService.instance().listen(FBUtilities.getLocalAddress());
MessagingService.instance().listen();
// make magic happen
Gossiper.instance.doShadowRound();
@ -521,7 +521,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
{
logger.debug("Starting shadow gossip round to check for endpoint collision");
if (!MessagingService.instance().isListening())
MessagingService.instance().listen(FBUtilities.getLocalAddress());
MessagingService.instance().listen();
Gossiper.instance.doShadowRound();
if (!Gossiper.instance.isSafeForBootstrap(FBUtilities.getBroadcastAddress()))
{
@ -554,7 +554,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
Gossiper.instance.start((int) (System.currentTimeMillis() / 1000)); // needed for node-ring gathering.
Gossiper.instance.addLocalApplicationState(ApplicationState.NET_VERSION, valueFactory.networkVersion());
if (!MessagingService.instance().isListening())
MessagingService.instance().listen(FBUtilities.getLocalAddress());
MessagingService.instance().listen();
}
public void populateTokenMetadata()
@ -792,7 +792,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
Schema.instance.updateVersionAndAnnounce(); // Ensure we know our own actual Schema UUID in preparation for updates
if (!MessagingService.instance().isListening())
MessagingService.instance().listen(FBUtilities.getLocalAddress());
MessagingService.instance().listen();
LoadBroadcaster.instance.startBroadcasting();
HintsService.instance.startDispatch();

View File

@ -163,6 +163,22 @@ public class FBUtilities
return localAddresses;
}
public static String getNetworkInterface(InetAddress localAddress)
{
try {
for(NetworkInterface ifc : Collections.list(NetworkInterface.getNetworkInterfaces())) {
if(ifc.isUp()) {
for(InetAddress addr : Collections.list(ifc.getInetAddresses())) {
if (addr.equals(localAddress))
return ifc.getDisplayName();
}
}
}
}
catch (SocketException e) {}
return null;
}
/**
* Given two bit arrays represented as BigIntegers, containing the given
* number of significant bits, calculate a midpoint.

View File

@ -78,7 +78,7 @@ public class RemoveTest
// create a ring of 5 nodes
Util.createInitialRing(ss, partitioner, endpointTokens, keyTokens, hosts, hostIds, 6);
MessagingService.instance().listen(FBUtilities.getBroadcastAddress());
MessagingService.instance().listen();
Gossiper.instance.start(1);
removalhost = hosts.get(5);
hosts.remove(removalhost);