Do not specify local address on outgoing connection when listen_on_broadcast_address is set

Patch by Milan Majercik; Reviewed by Paulo Motta for CASSANDRA-12673
This commit is contained in:
mmajercik 2016-12-07 10:52:02 -02:00 committed by Paulo Motta
parent 0b97c5d1f7
commit dd415263cc
4 changed files with 13 additions and 3 deletions

View File

@ -1,4 +1,5 @@
2.2.9
* Do not specify local address on outgoing connection when listen_on_broadcast_address is set (CASSANDRA-12673)
* Use saved tokens when setting local tokens on StorageService.joinRing (CASSANDRA-12935)
* cqlsh: fix DESC TYPES errors (CASSANDRA-12914)
* Fix leak on skipped SSTables in sstableupgrade (CASSANDRA-12899)

View File

@ -250,7 +250,11 @@ public class Config
public MemtableAllocationType memtable_allocation_type = MemtableAllocationType.heap_buffers;
private static boolean outboundBindAny = false;
/**
* @deprecated No longer needed for streaming protocol. See CASSANDRA-12673 for details.
*/
@Deprecated
protected static boolean outboundBindAny = false;
public volatile int tombstone_warn_threshold = 1000;
public volatile int tombstone_failure_threshold = 100000;

View File

@ -1752,6 +1752,11 @@ public class DatabaseDescriptor
}
}
public static boolean getOutboundBindAny()
{
return Config.outboundBindAny || conf.listen_on_broadcast_address;
}
public static int getIndexSummaryResizeIntervalInMinutes()
{
return conf.index_summary_resize_interval_in_minutes;

View File

@ -129,7 +129,7 @@ public class OutboundTcpConnectionPool
// zero means 'bind on any available port.'
if (isEncryptedChannel(endpoint))
{
if (Config.getOutboundBindAny())
if (DatabaseDescriptor.getOutboundBindAny())
return SSLFactory.getSocket(DatabaseDescriptor.getServerEncryptionOptions(), endpoint, DatabaseDescriptor.getSSLStoragePort());
else
return SSLFactory.getSocket(DatabaseDescriptor.getServerEncryptionOptions(), endpoint, DatabaseDescriptor.getSSLStoragePort(), FBUtilities.getLocalAddress(), 0);
@ -137,7 +137,7 @@ public class OutboundTcpConnectionPool
else
{
SocketChannel channel = SocketChannel.open();
if (!Config.getOutboundBindAny())
if (!DatabaseDescriptor.getOutboundBindAny())
channel.bind(new InetSocketAddress(FBUtilities.getLocalAddress(), 0));
channel.connect(new InetSocketAddress(endpoint, DatabaseDescriptor.getStoragePort()));
return channel.socket();