add cassandra.default_messaging_version

patch by Minh Do; reviewed by jbellis for CASSANDRA-6619
This commit is contained in:
Jonathan Ellis 2014-01-29 09:48:41 -06:00
parent 35c78d6a94
commit 1d81765daa
3 changed files with 35 additions and 5 deletions

View File

@ -1,4 +1,6 @@
1.2.14
* add cassandra.default_messaging_version property to allow easier
upgrading from 1.1 (CASSANDRA-6619)
* Allow executing CREATE statements multiple times (CASSANDRA-6471)
* Don't send confusing info with timeouts (CASSANDRA-6491)
* Don't resubmit counter mutation runnables internally (CASSANDRA-6427)

View File

@ -22,6 +22,15 @@ Features
- Batchlog replay can be, and is throttled by default now.
See batchlog_replay_throttle_in_kb setting in cassandra.yaml.
Upgrading
---------
- The system property cassandra.default_messaging_version has been added
to allow faster upgrades from 1.1. Normally, a 1.2 node will need to
wait until a 1.1 node connects to it to discover that the 1.1 node uses
an older internal message protocol; setting this property (to 5,
corresponding to 1.1.7+) will allow newly upgraded 1.2 nodes to
participate in a mostly-1.1 cluster faster.
1.2.13
======

View File

@ -36,15 +36,14 @@ import java.util.concurrent.atomic.AtomicLong;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.cassandra.config.Config;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.tracing.TraceState;
import org.apache.cassandra.tracing.Tracing;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.UUIDGen;
import org.xerial.snappy.SnappyOutputStream;
import org.apache.cassandra.config.Config;
import org.apache.cassandra.config.DatabaseDescriptor;
public class OutboundTcpConnection extends Thread
{
private static final Logger logger = LoggerFactory.getLogger(OutboundTcpConnection.class);
@ -322,6 +321,8 @@ public class OutboundTcpConnection extends Thread
}
out = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 4096));
// (MS defaults to assuming everyone else is on the same version as us until proven otherwise, so this
// code will run once even for older nodes, which allows us to reset the version to the correct one)
if (targetVersion >= MessagingService.VERSION_12)
{
out.writeInt(MessagingService.PROTOCOL_MAGIC);
@ -335,8 +336,26 @@ public class OutboundTcpConnection extends Thread
// no version is returned, so disconnect an try again: we will either get
// a different target version (targetVersion < MessagingService.VERSION_12)
// or if the same version the handshake will finally succeed
logger.debug("Target max version is {}; no version information yet, will retry", maxTargetVersion);
disconnect();
//Try to downgrade to the version passed in from the env variable
if (System.getProperty("cassandra.default_messaging_version") != null)
{
try
{
int defaultVersion = Integer.parseInt(System.getProperty("cassandra.default_messaging_version"));
logger.debug("No messaging version received; assuming default of {} ", defaultVersion);
MessagingService.instance().setVersion(poolReference.endPoint(), defaultVersion);
}
catch (NumberFormatException e)
{
logger.debug("Unable to parse the value of cassandra.default_messaging_version");
}
}
else
{
logger.debug("No messaging version received; will retry", maxTargetVersion);
}
disconnect(); //do we need to disconnect?
continue;
}
if (targetVersion > maxTargetVersion)