Return-Path: Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: (qmail 99676 invoked from network); 26 Jan 2011 01:54:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Jan 2011 01:54:41 -0000 Received: (qmail 64116 invoked by uid 500); 26 Jan 2011 01:54:41 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 64091 invoked by uid 500); 26 Jan 2011 01:54:41 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 64083 invoked by uid 99); 26 Jan 2011 01:54:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Jan 2011 01:54:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Jan 2011 01:54:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8F18023889BF; Wed, 26 Jan 2011 01:54:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1063563 - in /cassandra/trunk: ./ debian/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/gms/ src/java/org/apache/cassandra/service/ src/java/org/apache/cassandra/too... Date: Wed, 26 Jan 2011 01:54:18 -0000 To: commits@cassandra.apache.org From: jbellis@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110126015418.8F18023889BF@eris.apache.org> Author: jbellis Date: Wed Jan 26 01:54:17 2011 New Revision: 1063563 URL: http://svn.apache.org/viewvc?rev=1063563&view=rev Log: merge from 0.7 Removed: cassandra/trunk/test/distributed/ivy.xml Modified: cassandra/trunk/ (props changed) cassandra/trunk/.rat-excludes cassandra/trunk/CHANGES.txt cassandra/trunk/build.xml cassandra/trunk/debian/changelog cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java (props changed) cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java (props changed) cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java (props changed) cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java (props changed) cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java (props changed) cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java cassandra/trunk/src/java/org/apache/cassandra/cli/CliOptions.java cassandra/trunk/src/java/org/apache/cassandra/cli/CliSessionState.java cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigestAckVerbHandler.java cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java cassandra/trunk/test/unit/org/apache/cassandra/AbstractSerializationsTester.java cassandra/trunk/test/unit/org/apache/cassandra/db/SerializationsTest.java cassandra/trunk/test/unit/org/apache/cassandra/db/migration/SerializationsTest.java cassandra/trunk/test/unit/org/apache/cassandra/gms/SerializationsTest.java cassandra/trunk/test/unit/org/apache/cassandra/io/CompactSerializerTest.java cassandra/trunk/test/unit/org/apache/cassandra/service/RemoveTest.java cassandra/trunk/test/unit/org/apache/cassandra/service/SerializationsTest.java cassandra/trunk/test/unit/org/apache/cassandra/streaming/SerializationsTest.java cassandra/trunk/test/unit/org/apache/cassandra/utils/SerializationsTest.java Propchange: cassandra/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jan 26 01:54:17 2011 @@ -1,5 +1,5 @@ /cassandra/branches/cassandra-0.6:922689-1052356,1052358-1053452,1053454,1053456-1055311,1056121,1057932 -/cassandra/branches/cassandra-0.7:1026516-1063394 +/cassandra/branches/cassandra-0.7:1026516-1063562 /cassandra/branches/cassandra-0.7.0:1053690-1055654 /cassandra/tags/cassandra-0.7.0-rc3:1051699-1053689 /incubator/cassandra/branches/cassandra-0.3:774578-796573 Modified: cassandra/trunk/.rat-excludes URL: http://svn.apache.org/viewvc/cassandra/trunk/.rat-excludes?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/.rat-excludes (original) +++ cassandra/trunk/.rat-excludes Wed Jan 26 01:54:17 2011 @@ -21,3 +21,5 @@ redhat/cassandra.conf redhat/cassandra.in.sh redhat/default .externalToolBuilders/** +test/data/serialization/*/* +**/*.wpr Modified: cassandra/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/CHANGES.txt (original) +++ cassandra/trunk/CHANGES.txt Wed Jan 26 01:54:17 2011 @@ -7,7 +7,11 @@ * human readable column names in sstable2json output (CASSANDRA-1933) -0.7.1-dev +0.7.2-dev + * fix potential overflow in nodetool cfstats + + +0.7.1 * buffer network stack to avoid inefficient small TCP messages while avoiding the nagle/delayed ack problem (CASSANDRA-1896) * check log4j configuration for changes every 10s (CASSANDRA-1525, 1907) @@ -47,6 +51,8 @@ * add single-line "--" comments to CLI (CASSANDRA-2032) * message serialization tests (CASSANDRA-1923) * switch from ivy to maven-ant-tasks (CASSANDRA-2017) + * CLI attempts to block for new schema to propagate (CASSANDRA-2044) + 0.7.0-final * fix offsets to ByteBuffer.get (CASSANDRA-1939) Modified: cassandra/trunk/build.xml URL: http://svn.apache.org/viewvc/cassandra/trunk/build.xml?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/build.xml (original) +++ cassandra/trunk/build.xml Wed Jan 26 01:54:17 2011 @@ -49,7 +49,7 @@ - + Modified: cassandra/trunk/debian/changelog URL: http://svn.apache.org/viewvc/cassandra/trunk/debian/changelog?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/debian/changelog (original) +++ cassandra/trunk/debian/changelog Wed Jan 26 01:54:17 2011 @@ -1,3 +1,9 @@ +cassandra (0.7.1) unstable; urgency=low + + * New stable point release. + + -- Eric Evans Tue, 25 Jan 2011 15:52:47 -0600 + cassandra (0.7.0~rc4) unstable; urgency=low * Release candidate release. Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jan 26 01:54:17 2011 @@ -1,5 +1,5 @@ /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1052356,1052358-1053452,1053454,1053456-1055311,1056121,1057932 -/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1063394 +/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1063562 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1053690-1055654 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1051699-1053689 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/Cassandra.java:774578-796573 Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jan 26 01:54:17 2011 @@ -1,5 +1,5 @@ /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1052356,1052358-1053452,1053454,1053456-1055311,1056121,1057932 -/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1063394 +/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1063562 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1053690-1055654 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1051699-1053689 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/column_t.java:774578-792198 Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jan 26 01:54:17 2011 @@ -1,5 +1,5 @@ /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1052356,1052358-1053452,1053454,1053456-1055311,1056121,1057932 -/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1063394 +/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1063562 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1053690-1055654 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1051699-1053689 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:774578-796573 Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jan 26 01:54:17 2011 @@ -1,5 +1,5 @@ /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1052356,1052358-1053452,1053454,1053456-1055311,1056121,1057932 -/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1063394 +/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1063562 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1053690-1055654 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1051699-1053689 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:774578-796573 Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jan 26 01:54:17 2011 @@ -1,5 +1,5 @@ /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1052356,1052358-1053452,1053454,1053456-1055311,1056121,1057932 -/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1063394 +/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1063562 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1053690-1055654 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1051699-1053689 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:774578-792198 Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Wed Jan 26 01:54:17 2011 @@ -673,7 +673,10 @@ public class CliClient extends CliUserHe try { - sessionState.out.println(thriftClient.system_add_keyspace(updateKsDefAttributes(statement, ksDef))); + String mySchemaVersion = thriftClient.system_add_keyspace(updateKsDefAttributes(statement, ksDef)); + sessionState.out.println(mySchemaVersion); + validateSchemaIsSettled(mySchemaVersion); + keyspacesMap.put(keyspaceName, thriftClient.describe_keyspace(keyspaceName)); } catch (InvalidRequestException e) @@ -701,7 +704,9 @@ public class CliClient extends CliUserHe try { - sessionState.out.println(thriftClient.system_add_column_family(updateCfDefAttributes(statement, cfDef))); + String mySchemaVersion = thriftClient.system_add_column_family(updateCfDefAttributes(statement, cfDef)); + sessionState.out.println(mySchemaVersion); + validateSchemaIsSettled(mySchemaVersion); keyspacesMap.put(keySpace, thriftClient.describe_keyspace(keySpace)); } catch (InvalidRequestException e) @@ -730,7 +735,9 @@ public class CliClient extends CliUserHe KsDef currentKsDef = getKSMetaData(keyspaceName); KsDef updatedKsDef = updateKsDefAttributes(statement, currentKsDef); - sessionState.out.println(thriftClient.system_update_keyspace(updatedKsDef)); + String mySchemaVersion = thriftClient.system_update_keyspace(updatedKsDef); + validateSchemaIsSettled(mySchemaVersion); + sessionState.out.println(mySchemaVersion); keyspacesMap.put(keyspaceName, thriftClient.describe_keyspace(keyspaceName)); } catch (InvalidRequestException e) @@ -758,7 +765,9 @@ public class CliClient extends CliUserHe try { - sessionState.out.println(thriftClient.system_update_column_family(updateCfDefAttributes(statement, cfDef))); + String mySchemaVersion = thriftClient.system_update_column_family(updateCfDefAttributes(statement, cfDef)); + sessionState.out.println(mySchemaVersion); + validateSchemaIsSettled(mySchemaVersion); keyspacesMap.put(keySpace, thriftClient.describe_keyspace(keySpace)); } catch (InvalidRequestException e) @@ -930,7 +939,9 @@ public class CliClient extends CliUserHe return; String keyspaceName = CliCompiler.getKeySpace(statement, thriftClient.describe_keyspaces()); - sessionState.out.println(thriftClient.system_drop_keyspace(keyspaceName)); + String version = thriftClient.system_drop_keyspace(keyspaceName); + sessionState.out.println(version); + validateSchemaIsSettled(version); } /** @@ -947,7 +958,9 @@ public class CliClient extends CliUserHe return; String cfName = CliCompiler.getColumnFamily(statement, keyspacesMap.get(keySpace).cf_defs); - sessionState.out.println(thriftClient.system_drop_column_family(cfName)); + String mySchemaVersion = thriftClient.system_drop_column_family(cfName); + sessionState.out.println(mySchemaVersion); + validateSchemaIsSettled(mySchemaVersion); } private void executeList(Tree statement) @@ -2009,6 +2022,51 @@ public class CliClient extends CliUserHe } } + /** validates schema is propagated to all nodes */ + private void validateSchemaIsSettled(String currentVersionId) + { + Map> versions; + + long start = System.currentTimeMillis(); + long limit = start + sessionState.schema_mwt; + + boolean inAgreement = false; + while (limit - start >= 0) + { + try + { + versions = thriftClient.describe_schema_versions(); // getting schema version for nodes of the ring + } + catch (Exception e) + { + sessionState.err.println((e instanceof InvalidRequestException) ? ((InvalidRequestException) e).getWhy() : e.getMessage()); + continue; + } + + boolean currentlyInAgreement = true; + for (String version : versions.keySet()) + { + if (!version.equals(currentVersionId)) + { + currentlyInAgreement = false; + break; // only one disagreement is enough + } + } + + if (currentlyInAgreement) + { + inAgreement = true; + break; // all nodes are in agreement no need to loop + } + } + + if (!inAgreement) + { + sessionState.err.printf("The schema has not settled in %d seconds and further migrations are ill-advised until it does.%n", sessionState.schema_mwt / 1000); + System.exit(-1); + } + } + private static class CfDefNamesComparator implements Comparator { public int compare(CfDef a, CfDef b) Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliOptions.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliOptions.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/cli/CliOptions.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliOptions.java Wed Jan 26 01:54:17 2011 @@ -44,6 +44,7 @@ public class CliOptions private static final String FILE_OPTION = "file"; private static final String JMX_PORT_OPTION = "jmxport"; private static final String VERBOSE_OPTION = "verbose"; + private static final String SCHEMA_MIGRATION_WAIT_TIME = "schema-mwt"; // Default values for optional command line arguments private static final int DEFAULT_THRIFT_PORT = 9160; @@ -59,15 +60,16 @@ public class CliOptions options.addOption("u", USERNAME_OPTION, "USERNAME", "user name for cassandra authentication"); options.addOption("pw", PASSWORD_OPTION, "PASSWORD", "password for cassandra authentication"); options.addOption("k", KEYSPACE_OPTION, "KEYSPACE", "cassandra keyspace user is authenticated against"); - options.addOption("f", FILE_OPTION, "FILENAME", "load statements from the specific file."); + options.addOption("f", FILE_OPTION, "FILENAME", "load statements from the specific file"); options.addOption(null, JMX_PORT_OPTION, "JMX-PORT", "JMX service port"); + options.addOption(null, SCHEMA_MIGRATION_WAIT_TIME, "TIME", "Schema migration wait time (secs.), default is 10 secs"); // options without argument options.addOption("B", BATCH_OPTION, "enabled batch mode (suppress output; errors are fatal)"); options.addOption(null, UNFRAME_OPTION, "use cassandra server's unframed transport"); options.addOption(null, DEBUG_OPTION, "display stack traces"); - options.addOption("?", HELP_OPTION, "usage help."); - options.addOption("v", VERBOSE_OPTION, "verbose output when using batch mode."); + options.addOption("?", HELP_OPTION, "usage help"); + options.addOption("v", VERBOSE_OPTION, "verbose output when using batch mode"); } private static void printUsage() @@ -160,6 +162,15 @@ public class CliOptions css.verbose = true; } + if (cmd.hasOption(SCHEMA_MIGRATION_WAIT_TIME)) + { + css.schema_mwt = Integer.parseInt(cmd.getOptionValue(SCHEMA_MIGRATION_WAIT_TIME)) * 1000; + } + else + { + css.schema_mwt = 10 * 1000; + } + // Abort if there are any unrecognized arguments left if (cmd.getArgs().length > 0) { Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliSessionState.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliSessionState.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/cli/CliSessionState.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliSessionState.java Wed Jan 26 01:54:17 2011 @@ -40,6 +40,7 @@ public class CliSessionState public String filename = ""; // file to read commands from public int jmxPort = 8080;// JMX service port public boolean verbose = false; // verbose output + public int schema_mwt; // Schema migration wait time (secs.) /* * Streams to read/write from */ @@ -82,5 +83,4 @@ public class CliSessionState return null; } - } Modified: cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigestAckVerbHandler.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigestAckVerbHandler.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigestAckVerbHandler.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigestAckVerbHandler.java Wed Jan 26 01:54:17 2011 @@ -45,6 +45,12 @@ public class GossipDigestAckVerbHandler InetAddress from = message.getFrom(); if (logger_.isTraceEnabled()) logger_.trace("Received a GossipDigestAckMessage from {}", from); + if (!Gossiper.instance.isEnabled()) + { + if (logger_.isTraceEnabled()) + logger_.trace("Ignoring GossipDigestAckMessage because gossip is disabled"); + return; + } byte[] bytes = message.getMessageBody(); DataInputStream dis = new DataInputStream( new ByteArrayInputStream(bytes) ); Modified: cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java Wed Jan 26 01:54:17 2011 @@ -44,6 +44,12 @@ public class GossipDigestSynVerbHandler InetAddress from = message.getFrom(); if (logger_.isTraceEnabled()) logger_.trace("Received a GossipDigestSynMessage from {}", from); + if (!Gossiper.instance.isEnabled()) + { + if (logger_.isTraceEnabled()) + logger_.trace("Ignoring GossipDigestSynMessage because gossip is disabled"); + return; + } byte[] bytes = message.getMessageBody(); DataInputStream dis = new DataInputStream( new ByteArrayInputStream(bytes) ); Modified: cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java Wed Jan 26 01:54:17 2011 @@ -897,6 +897,11 @@ public class Gossiper implements IFailur scheduledGossipTask.cancel(false); } + public boolean isEnabled() + { + return !scheduledGossipTask.isCancelled(); + } + /** * This should *only* be used for testing purposes. */ Modified: cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java Wed Jan 26 01:54:17 2011 @@ -284,31 +284,29 @@ public class StorageProxy implements Sto { String dataCenter = entry.getKey(); - // Grab a set of all the messages bound for this dataCenter and create an iterator over this set. - Map> messagesForDataCenter = entry.getValue().asMap(); - - for (Map.Entry> messages: messagesForDataCenter.entrySet()) + // send the messages corresponding to this datacenter + for (Map.Entry> messages: entry.getValue().asMap().entrySet()) { Message message = messages.getKey(); - Iterator iter = messages.getValue().iterator(); - assert iter.hasNext(); - - // First endpoint in list is the destination for this group - InetAddress target = iter.next(); + // a single message object is used for unhinted writes, so clean out any forwards + // from previous loop iterations + message.removeHeader(RowMutation.FORWARD_HEADER); - // Add all the other destinations that are bound for the same dataCenter as a header in the primary message. - while (iter.hasNext()) + if (dataCenter.equals(localDataCenter)) { - InetAddress destination = iter.next(); - - if (dataCenter.equals(localDataCenter)) - { - // direct write to local DC - assert message.getHeader(RowMutation.FORWARD_HEADER) == null; + // direct writes to local DC + for (InetAddress destination : messages.getValue()) MessagingService.instance().sendOneWay(message, destination); - } - else + } + else + { + // Non-local DC. First endpoint in list is the destination for this group + Iterator iter = messages.getValue().iterator(); + InetAddress target = iter.next(); + // Add all the other destinations of the same message as a header in the primary message. + while (iter.hasNext()) { + InetAddress destination = iter.next(); // group all nodes in this DC as forward headers on the primary message ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); @@ -321,9 +319,9 @@ public class StorageProxy implements Sto dos.write(destination.getAddress()); message.setHeader(RowMutation.FORWARD_HEADER, bos.toByteArray()); } + // send the combined message + forward headers + MessagingService.instance().sendOneWay(message, target); } - - MessagingService.instance().sendOneWay(message, target); } } } Modified: cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java Wed Jan 26 01:54:17 2011 @@ -332,8 +332,8 @@ public class NodeCmd { { String tableName = entry.getKey(); List columnFamilies = entry.getValue(); - int tableReadCount = 0; - int tableWriteCount = 0; + long tableReadCount = 0; + long tableWriteCount = 0; int tablePendingTasks = 0; double tableTotalReadTime = 0.0f; double tableTotalWriteTime = 0.0f; Modified: cassandra/trunk/test/unit/org/apache/cassandra/AbstractSerializationsTester.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/AbstractSerializationsTester.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/AbstractSerializationsTester.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/AbstractSerializationsTester.java Wed Jan 26 01:54:17 2011 @@ -1,4 +1,25 @@ package org.apache.cassandra; +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + import java.io.DataInputStream; import java.io.DataOutputStream; Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/SerializationsTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/SerializationsTest.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/db/SerializationsTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/db/SerializationsTest.java Wed Jan 26 01:54:17 2011 @@ -1,4 +1,25 @@ package org.apache.cassandra.db; +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + import org.apache.cassandra.AbstractSerializationsTester; import org.apache.cassandra.Util; Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/migration/SerializationsTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/migration/SerializationsTest.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/db/migration/SerializationsTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/db/migration/SerializationsTest.java Wed Jan 26 01:54:17 2011 @@ -1,4 +1,25 @@ package org.apache.cassandra.db.migration; +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + import org.apache.cassandra.AbstractSerializationsTester; import org.apache.cassandra.CleanupHelper; Modified: cassandra/trunk/test/unit/org/apache/cassandra/gms/SerializationsTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/gms/SerializationsTest.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/gms/SerializationsTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/gms/SerializationsTest.java Wed Jan 26 01:54:17 2011 @@ -1,4 +1,25 @@ package org.apache.cassandra.gms; +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + import org.apache.cassandra.AbstractSerializationsTester; import org.apache.cassandra.service.StorageService; Modified: cassandra/trunk/test/unit/org/apache/cassandra/io/CompactSerializerTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/io/CompactSerializerTest.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/io/CompactSerializerTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/io/CompactSerializerTest.java Wed Jan 26 01:54:17 2011 @@ -1,4 +1,25 @@ package org.apache.cassandra.io; +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + import org.apache.cassandra.CleanupHelper; import org.junit.BeforeClass; Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/RemoveTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/RemoveTest.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/service/RemoveTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/service/RemoveTest.java Wed Jan 26 01:54:17 2011 @@ -54,9 +54,11 @@ public class RemoveTest extends CleanupH StorageService ss = StorageService.instance; TokenMetadata tmd = ss.getTokenMetadata(); IPartitioner oldPartitioner; - ArrayList endpointTokens; - ArrayList keyTokens; - List hosts; + ArrayList endpointTokens = new ArrayList(); + ArrayList keyTokens = new ArrayList(); + List hosts = new ArrayList(); + InetAddress removalhost; + Token removaltoken; @Before public void setup() throws IOException, ConfigurationException @@ -66,10 +68,6 @@ public class RemoveTest extends CleanupH oldPartitioner = ss.setPartitionerUnsafe(partitioner); - endpointTokens = new ArrayList(); - keyTokens = new ArrayList(); - hosts = new ArrayList(); - // create a ring of 5 nodes Util.createInitialRing(ss, partitioner, endpointTokens, keyTokens, hosts, 6); @@ -79,6 +77,10 @@ public class RemoveTest extends CleanupH { Gossiper.instance.initializeNodeUnsafe(hosts.get(i), 1); } + removalhost = hosts.get(5); + hosts.remove(removalhost); + removaltoken = endpointTokens.get(5); + endpointTokens.remove(removaltoken); } @After @@ -110,7 +112,7 @@ public class RemoveTest extends CleanupH { IPartitioner partitioner = StorageService.getPartitioner(); - final String token = partitioner.getTokenFactory().toString(endpointTokens.get(5)); + final String token = partitioner.getTokenFactory().toString(removaltoken); ReplicationSink rSink = new ReplicationSink(); SinkManager.add(rSink); @@ -137,7 +139,7 @@ public class RemoveTest extends CleanupH Thread.sleep(1000); // make sure removal is waiting for confirmation - assertTrue(tmd.isLeaving(hosts.get(5))); + assertTrue(tmd.isLeaving(removalhost)); assertEquals(1, tmd.getLeavingEndpoints().size()); for (InetAddress host : hosts) @@ -167,10 +169,10 @@ public class RemoveTest extends CleanupH ss.onChange(hosts.get(1), ApplicationState.STATUS, - valueFactory.removingNonlocal(endpointTokens.get(1), endpointTokens.get(5))); + valueFactory.removingNonlocal(endpointTokens.get(1), removaltoken)); assertEquals(1, nSink.callCount); - assertTrue(tmd.isLeaving(hosts.get(5))); + assertTrue(tmd.isLeaving(removalhost)); assertEquals(1, tmd.getLeavingEndpoints().size()); } @@ -184,10 +186,10 @@ public class RemoveTest extends CleanupH ss.onChange(hosts.get(1), ApplicationState.STATUS, - valueFactory.removedNonlocal(endpointTokens.get(1), endpointTokens.get(5))); + valueFactory.removedNonlocal(endpointTokens.get(1), removaltoken)); - assertFalse(Gossiper.instance.getLiveMembers().contains(hosts.get(5))); - assertFalse(tmd.isMember(hosts.get(5))); + assertFalse(Gossiper.instance.getLiveMembers().contains(removalhost)); + assertFalse(tmd.isMember(removalhost)); } class ReplicationSink implements IMessageSink Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/SerializationsTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/SerializationsTest.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/service/SerializationsTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/service/SerializationsTest.java Wed Jan 26 01:54:17 2011 @@ -1,4 +1,25 @@ package org.apache.cassandra.service; +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + import org.apache.cassandra.AbstractSerializationsTester; import org.apache.cassandra.dht.IPartitioner; Modified: cassandra/trunk/test/unit/org/apache/cassandra/streaming/SerializationsTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/streaming/SerializationsTest.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/streaming/SerializationsTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/streaming/SerializationsTest.java Wed Jan 26 01:54:17 2011 @@ -1,4 +1,25 @@ package org.apache.cassandra.streaming; +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + import org.apache.cassandra.AbstractSerializationsTester; import org.apache.cassandra.db.RowMutation; Modified: cassandra/trunk/test/unit/org/apache/cassandra/utils/SerializationsTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/utils/SerializationsTest.java?rev=1063563&r1=1063562&r2=1063563&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/utils/SerializationsTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/utils/SerializationsTest.java Wed Jan 26 01:54:17 2011 @@ -1,4 +1,25 @@ package org.apache.cassandra.utils; +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + import org.apache.cassandra.AbstractSerializationsTester; import org.apache.cassandra.service.StorageService;