From c7e472e8c1eb5739866e8c93957738676cc744bc Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Tue, 6 May 2014 22:41:20 -0500 Subject: [PATCH 1/2] Set keepalive on MessagingService connections patch by Jianwei Zhang; reviewed by jbellis for CASSANDRA-7170 --- CHANGES.txt | 1 + src/java/org/apache/cassandra/net/MessagingService.java | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 1c6171e202..8c1d234faa 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 1.2.17 + * Set keepalive on MessagingService connections (CASSANDRA-7170) * Add Cloudstack snitch (CASSANDRA-7147) * Update system.peers correctly when relocating tokens (CASSANDRA-7126) * Add Google Compute Engine snitch (CASSANDRA-7132) diff --git a/src/java/org/apache/cassandra/net/MessagingService.java b/src/java/org/apache/cassandra/net/MessagingService.java index 5e4a1173ae..41553b1f49 100644 --- a/src/java/org/apache/cassandra/net/MessagingService.java +++ b/src/java/org/apache/cassandra/net/MessagingService.java @@ -904,9 +904,14 @@ public final class MessagingService implements MessagingServiceMBean { Socket socket = server.accept(); if (authenticate(socket)) + { + socket.setKeepAlive(true); new IncomingTcpConnection(socket).start(); + } else + { socket.close(); + } } catch (AsynchronousCloseException e) { From 0132e546b55b67f68fca230c9e0ca1ccef6aa273 Mon Sep 17 00:00:00 2001 From: Dave Brosius Date: Wed, 7 May 2014 01:34:02 -0400 Subject: [PATCH 2/2] remove duplicate queries for local tokens patch by dbrosius reviewed by ayeschenko for cassandra-7182 --- CHANGES.txt | 1 + src/java/org/apache/cassandra/service/StorageService.java | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 8c1d234faa..d7b7f00531 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -20,6 +20,7 @@ * fix npe when doing -Dcassandra.fd_initial_value_ms (CASSANDRA-6751) * Preserves CQL metadata when updating table from thrift (CASSANDRA-6831) * fix time conversion to milliseconds in SimpleCondition.await (CASSANDRA-7149) + * remove duplicate query for local tokens (CASSANDRA-7182) 1.2.16 diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java index ed6d031fa8..7cecec99a3 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -209,8 +209,9 @@ public class StorageService extends NotificationBroadcasterSupport implements IE SystemTable.updateTokens(tokens); tokenMetadata.updateNormalTokens(tokens, FBUtilities.getBroadcastAddress()); // order is important here, the gossiper can fire in between adding these two states. It's ok to send TOKENS without STATUS, but *not* vice versa. - Gossiper.instance.addLocalApplicationState(ApplicationState.TOKENS, valueFactory.tokens(getLocalTokens())); - Gossiper.instance.addLocalApplicationState(ApplicationState.STATUS, valueFactory.normal(getLocalTokens())); + Collection localTokens = getLocalTokens(); + Gossiper.instance.addLocalApplicationState(ApplicationState.TOKENS, valueFactory.tokens(localTokens)); + Gossiper.instance.addLocalApplicationState(ApplicationState.STATUS, valueFactory.normal(localTokens)); setMode(Mode.NORMAL, false); }