cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1095770 - in /cassandra/trunk: ./ contrib/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/gms/ src/java/org/apache/cassandra/locator...
Date Thu, 21 Apr 2011 16:20:48 GMT
Author: jbellis
Date: Thu Apr 21 16:20:47 2011
New Revision: 1095770

URL: http://svn.apache.org/viewvc?rev=1095770&view=rev
Log:
merge from 0.8

Modified:
    cassandra/trunk/   (props changed)
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/contrib/   (props changed)
    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/CliUtils.java
    cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java
    cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
    cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java
    cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamIn.java
    cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java
    cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java
    cassandra/trunk/test/unit/org/apache/cassandra/streaming/BootstrapTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/streaming/SerializationsTest.java

Propchange: cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 21 16:20:47 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7:1026516-1094195,1094604,1094647,1094796,1094809,1094818,1094831,1095250,1095438,1095473,1095696
+/cassandra/branches/cassandra-0.7:1026516-1095767
 /cassandra/branches/cassandra-0.7.0:1053690-1055654
-/cassandra/branches/cassandra-0.8:1090935-1095491,1095699
+/cassandra/branches/cassandra-0.8:1090935-1095769
 /cassandra/tags/cassandra-0.7.0-rc3:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3:774578-796573
 /incubator/cassandra/branches/cassandra-0.4:810145-834239,834349-834350

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1095770&r1=1095769&r2=1095770&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Thu Apr 21 16:20:47 2011
@@ -57,10 +57,13 @@
  * use 64KB flush buffer instead of in_memory_compaction_limit (CASSANDRA-2463)
  * fix duplicate results from CFS.scan (CASSANDRA-2406)
  * avoid caching token-only decoratedkeys (CASSANDRA-2416)
+ * preserve version when streaming data from old sstables (CASSANDRA-2283)
+ * fix backslash substitutions in CLI (CASSANDRA-2492)
  * count a row deletion as one operation towards memtable threshold 
    (CASSANDRA-2519)
  * fixes for verifying destination availability under hinted conditions
    so UE can be thrown intead of timing out (CASSANDRA-2514)
+ * support LOCAL_QUORUM, EACH_QUORUM CLs outside of NTS (CASSANDRA-2516)
 
 
 0.7.4

Propchange: cassandra/trunk/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 21 16:20:47 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/contrib:922689-1052356,1052358-1053452,1053454,1053456-1068009
-/cassandra/branches/cassandra-0.7/contrib:1026516-1094195,1094481,1094604,1094647,1094796,1094809,1094818,1094831,1095250,1095438,1095473,1095696
+/cassandra/branches/cassandra-0.7/contrib:1026516-1095767
 /cassandra/branches/cassandra-0.7.0/contrib:1053690-1055654
-/cassandra/branches/cassandra-0.8/contrib:1090935-1095491,1095699
+/cassandra/branches/cassandra-0.8/contrib:1090935-1095769
 /cassandra/tags/cassandra-0.7.0-rc3/contrib:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3/contrib:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/contrib:810145-810987,810994-834239,834349-834350

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 21 16:20:47 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1094195,1094481,1094604,1094647,1094796,1094809,1094818,1094831,1095250,1095438,1095473,1095696
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1095767
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090935-1095491,1095699
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090935-1095769
 /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
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Cassandra.java:810145-834239,834349-834350

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 21 16:20:47 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1094195,1094481,1094604,1094647,1094796,1094809,1094818,1094831,1095250,1095438,1095473,1095696
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1095767
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090935-1095491,1095699
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090935-1095769
 /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
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Column.java:810145-834239,834349-834350

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 21 16:20:47 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1094195,1094481,1094604,1094647,1094796,1094809,1094818,1094831,1095250,1095438,1095473,1095696
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1095767
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090935-1095491,1095699
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090935-1095769
 /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
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:810145-834239,834349-834350

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 21 16:20:47 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1094195,1094481,1094604,1094647,1094796,1094809,1094818,1094831,1095250,1095438,1095473,1095696
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1095767
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090935-1095491,1095699
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090935-1095769
 /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
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:810145-834239,834349-834350

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 21 16:20:47 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1094195,1094481,1094604,1094647,1094796,1094809,1094818,1094831,1095250,1095438,1095473,1095696
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1095767
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090935-1095491,1095699
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090935-1095769
 /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
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:810145-834239,834349-834350

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliUtils.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliUtils.java?rev=1095770&r1=1095769&r2=1095770&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliUtils.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliUtils.java Thu Apr 21 16:20:47 2011
@@ -6,6 +6,7 @@ import java.util.Set;
 import org.apache.cassandra.thrift.CfDef;
 import org.apache.cassandra.thrift.IndexOperator;
 import org.apache.cassandra.thrift.KsDef;
+import org.apache.commons.lang.StringEscapeUtils;
 /*
  * 
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -38,70 +39,16 @@ public class CliUtils
      */
     public static String unescapeSQLString(String b)
     {
-        int j = 1;
-        final char start = b.charAt(0);
-        final char end = b.charAt(b.length() - 1);
-
-        if (start != '\'' && end != '\'')
-        {
-            j = 0;
-        }
-
-        StringBuilder sb = new StringBuilder(b.length());
-
-        for (int i = j; ((j == 0) ? i : i + 1) < b.length(); i++)
-        {
-            if (b.charAt(i) == '\\' && i + 2 < b.length())
-            {
-                char n = b.charAt(i + 1);
-                switch (n)
-                {
-                    case '0':
-                        sb.append("\0");
-                        break;
-                    case '\'':
-                        sb.append("'");
-                        break;
-                    case '"':
-                        sb.append("\"");
-                        break;
-                    case 'b':
-                        sb.append("\b");
-                        break;
-                    case 'n':
-                        sb.append("\n");
-                        break;
-                    case 'r':
-                        sb.append("\r");
-                        break;
-                    case 't':
-                        sb.append("\t");
-                        break;
-                    case 'Z':
-                        sb.append("\u001A");
-                        break;
-                    case '\\':
-                        sb.append("\\");
-                        break;
-                    case '%':
-                        sb.append("%");
-                        break;
-                    case '_':
-                        sb.append("_");
-                        break;
-                    default:
-                        sb.append(n);
-                }
-            }
-            else
-            {
-                sb.append(b.charAt(i));
-            }
-        }
-
-        return sb.toString();
+        if (b.charAt(0) == '\'' && b.charAt(b.length()-1) == '\'')
+            b = b.substring(1, b.length()-1);
+        return StringEscapeUtils.unescapeJava(b);
     }
 
+    public static String escapeSQLString(String b)
+    {
+        // single quotes are not escaped in java, need to be for cli
+        return StringEscapeUtils.escapeJava(b).replace("\'", "\\'");
+    }
     /**
      * Returns IndexOperator from string representation
      * @param operator - string representing IndexOperator (=, >=, >, <, <=)

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1095770&r1=1095769&r2=1095770&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Thu Apr 21 16:20:47
2011
@@ -590,17 +590,18 @@ public class ColumnFamilyStore implement
      * When the sstable object is closed, it will be renamed to a non-temporary
      * format, so incomplete sstables can be recognized and removed on startup.
      */
-    public String getFlushPath(long estimatedSize)
+    public String getFlushPath(long estimatedSize, String version)
     {
         String location = DatabaseDescriptor.getDataFileLocationForTable(table.name, estimatedSize);
         if (location == null)
             throw new RuntimeException("Insufficient disk space to flush " + estimatedSize
+ " bytes");
-        return getTempSSTablePath(location);
+        return getTempSSTablePath(location, version);
     }
 
-    public String getTempSSTablePath(String directory)
+    public String getTempSSTablePath(String directory, String version)
     {
-        Descriptor desc = new Descriptor(new File(directory),
+        Descriptor desc = new Descriptor(version,
+                                         new File(directory),
                                          table.name,
                                          columnFamily,
                                          fileIndexGenerator.incrementAndGet(),
@@ -608,6 +609,11 @@ public class ColumnFamilyStore implement
         return desc.filenameFor(Component.DATA);
     }
 
+    public String getTempSSTablePath(String directory)
+    {
+        return getTempSSTablePath(directory, Descriptor.CURRENT_VERSION);
+    }
+
     /** flush the given memtable and swap in a new one for its CFS, if it hasn't been frozen
already.  threadsafe. */
     Future<?> maybeSwitchMemtable(Memtable oldMemtable, final boolean writeCommitLog)
     {
@@ -2097,7 +2103,7 @@ public class ColumnFamilyStore implement
 
     public SSTableWriter createFlushWriter(long estimatedRows, long estimatedSize) throws
IOException
     {
-        return new SSTableWriter(getFlushPath(estimatedSize), estimatedRows, metadata, partitioner);
+        return new SSTableWriter(getFlushPath(estimatedSize, Descriptor.CURRENT_VERSION),
estimatedRows, metadata, partitioner);
     }
 
     public SSTableWriter createCompactionWriter(long estimatedRows, String location) throws
IOException

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=1095770&r1=1095769&r2=1095770&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java Thu Apr 21 16:20:47 2011
@@ -254,18 +254,17 @@ public class Gossiper implements IFailur
     }
 
     /**
-     * Removes the endpoint from gossip completely
+     * Removes the endpoint from unreachable endpoint set
      *
      * @param endpoint endpoint to be removed from the current membership.
     */
     private void evictFromMembership(InetAddress endpoint)
     {
         unreachableEndpoints.remove(endpoint);
-        endpointStateMap.remove(endpoint);
     }
 
     /**
-     * Removes the endpoint from Gossip but retains endpoint state
+     * Removes the endpoint completely from Gossip
      */
     public void removeEndpoint(InetAddress endpoint)
     {
@@ -447,15 +446,20 @@ public class Gossiper implements IFailur
             {
                 long duration = now - epState.getUpdateTimestamp();
 
-                if (StorageService.instance.getTokenMetadata().isMember(endpoint))
-                    epState.setHasToken(true);
                 // check if this is a fat client. fat clients are removed automatically from
                 // gosip after FatClientTimeout
-                if (!epState.getHasToken() && !epState.isAlive() && !justRemovedEndpoints.containsKey(endpoint)
&& (duration > FatClientTimeout))
+                if (!epState.getHasToken() && !epState.isAlive() && (duration
> FatClientTimeout))
                 {
-                    logger.info("FatClient " + endpoint + " has been silent for " + FatClientTimeout
+ "ms, removing from gossip");
-                    removeEndpoint(endpoint); // will put it in justRemovedEndpoints to respect
quarantine delay
-                    evictFromMembership(endpoint); // can get rid of the state immediately
+                    if (StorageService.instance.getTokenMetadata().isMember(endpoint))
+                        epState.setHasToken(true);
+                    else
+                    {
+                        if (!justRemovedEndpoints.containsKey(endpoint)) // if the node was
decommissioned, it will have been removed but still appear as a fat client
+                        {
+                            logger.info("FatClient " + endpoint + " has been silent for "
+ FatClientTimeout + "ms, removing from gossip");
+                            removeEndpoint(endpoint); // after quarantine justRemoveEndpoints
will remove the state
+                        }
+                    }
                 }
 
                 if ( !epState.isAlive() && (duration > aVeryLongTime) )
@@ -474,6 +478,7 @@ public class Gossiper implements IFailur
                     if (logger.isDebugEnabled())
                         logger.debug(QUARANTINE_DELAY + " elapsed, " + entry.getKey() + "
gossip quarantine over");
                     justRemovedEndpoints.remove(entry.getKey());
+                    endpointStateMap.remove(entry.getKey());
                 }
             }
         }

Modified: cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java?rev=1095770&r1=1095769&r2=1095770&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
Thu Apr 21 16:20:47 2011
@@ -121,9 +121,18 @@ public abstract class AbstractReplicatio
 
     public IWriteResponseHandler getWriteResponseHandler(Collection<InetAddress> writeEndpoints,
                                                          Multimap<InetAddress, InetAddress>
hintedEndpoints,
-                                                         ConsistencyLevel consistencyLevel)
+                                                         ConsistencyLevel consistency_level)
     {
-        return WriteResponseHandler.create(writeEndpoints, hintedEndpoints, consistencyLevel,
table);
+        if (consistency_level == ConsistencyLevel.LOCAL_QUORUM)
+        {
+            // block for in this context will be localnodes block.
+            return DatacenterWriteResponseHandler.create(writeEndpoints, hintedEndpoints,
consistency_level, table);
+        }
+        else if (consistency_level == ConsistencyLevel.EACH_QUORUM)
+        {
+            return DatacenterSyncWriteResponseHandler.create(writeEndpoints, hintedEndpoints,
consistency_level, table);
+        }
+        return WriteResponseHandler.create(writeEndpoints, hintedEndpoints, consistency_level,
table);
     }
 
     /**

Modified: cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java?rev=1095770&r1=1095769&r2=1095770&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java Thu
Apr 21 16:20:47 2011
@@ -144,27 +144,6 @@ public class NetworkTopologyStrategy ext
         return datacenters.keySet();
     }
 
-    /**
-     * This method will generate the QRH object and returns. If the Consistency
-     * level is LOCAL_QUORUM then it will return a DCQRH with a map of local rep
-     * factor alone. If the consistency level is EACH_QUORUM then it will
-     * return a DCQRH with a map of all the DC rep factor.
-     */
-    @Override
-    public IWriteResponseHandler getWriteResponseHandler(Collection<InetAddress> writeEndpoints,
Multimap<InetAddress, InetAddress> hintedEndpoints, ConsistencyLevel consistency_level)
-    {
-        if (consistency_level == ConsistencyLevel.LOCAL_QUORUM)
-        {
-            // block for in this context will be localnodes block.
-            return DatacenterWriteResponseHandler.create(writeEndpoints, hintedEndpoints,
consistency_level, table);
-        }
-        else if (consistency_level == ConsistencyLevel.EACH_QUORUM)
-        {
-            return DatacenterSyncWriteResponseHandler.create(writeEndpoints, hintedEndpoints,
consistency_level, table);
-        }
-        return super.getWriteResponseHandler(writeEndpoints, hintedEndpoints, consistency_level);
-    }
-
     public void validateOptions() throws ConfigurationException
     {
         for (Entry<String,String> e : this.configOptions.entrySet())

Modified: cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamIn.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamIn.java?rev=1095770&r1=1095769&r2=1095770&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamIn.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamIn.java Thu Apr 21 16:20:47
2011
@@ -50,11 +50,6 @@ public class StreamIn
     /**
      * Request ranges to be transferred from source to local node
      */
-    public static void requestRanges(InetAddress source, String tableName, Collection<Range>
ranges, OperationType type)
-    {
-        requestRanges(source, tableName, ranges, null, type);
-    }
-
     public static void requestRanges(InetAddress source, String tableName, Collection<Range>
ranges, Runnable callback, OperationType type)
     {
         assert ranges.size() > 0;
@@ -80,7 +75,7 @@ public class StreamIn
         // new local sstable
         Table table = Table.open(remotedesc.ksname);
         ColumnFamilyStore cfStore = table.getColumnFamilyStore(remotedesc.cfname);
-        Descriptor localdesc = Descriptor.fromFilename(cfStore.getFlushPath(remote.size));
+        Descriptor localdesc = Descriptor.fromFilename(cfStore.getFlushPath(remote.size,
remote.desc.version));
 
         return new PendingFile(localdesc, remote);
      }

Modified: cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java?rev=1095770&r1=1095769&r2=1095770&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java Thu Apr 21 16:20:47
2011
@@ -602,7 +602,7 @@ public class FBUtilities
 
     public static String toString(Map<?,?> map)
     {
-        Joiner.MapJoiner joiner = Joiner.on(",").withKeyValueSeparator(":");
+        Joiner.MapJoiner joiner = Joiner.on(", ").withKeyValueSeparator(":");
         return joiner.join(map);
     }
 

Modified: cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java?rev=1095770&r1=1095769&r2=1095770&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java Thu Apr 21 16:20:47 2011
@@ -245,4 +245,17 @@ public class CliTest extends CleanupHelp
             errStream.reset(); // no errors to the end user.
         }
     }
-}
+
+    @Test
+    public void testEscape()
+    {
+        //escaped is the string read from the cli.
+        String escaped = "backspace \\b tab \\t linefeed \\n form feed \\f carriage return
\\r duble quote \\\" " +
+                "single quote \\' backslash \\\\";
+        String unescaped = "backspace \b tab \t linefeed \n form feed \f carriage return
\r duble quote \" " +
+                "single quote ' backslash \\";
+        // when read from the cli may have single quotes around it
+        assertEquals(unescaped, CliUtils.unescapeSQLString("'" + escaped + "'"));
+        assertEquals(escaped, CliUtils.escapeSQLString(unescaped));
+    }
+}
\ No newline at end of file

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java?rev=1095770&r1=1095769&r2=1095770&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java Thu Apr 21 16:20:47 2011
@@ -55,6 +55,7 @@ import org.apache.cassandra.db.migration
 import org.apache.cassandra.db.migration.UpdateColumnFamily;
 import org.apache.cassandra.db.migration.UpdateKeyspace;
 import org.apache.cassandra.io.SerDeUtils;
+import org.apache.cassandra.io.sstable.Descriptor;
 import org.apache.cassandra.locator.OldNetworkTopologyStrategy;
 import org.apache.cassandra.locator.SimpleStrategy;
 import org.apache.cassandra.net.MessagingService;
@@ -319,7 +320,7 @@ public class DefsTest extends CleanupHel
         ColumnFamilyStore store = Table.open(cfm.ksName).getColumnFamilyStore(cfm.cfName);
         assert store != null;
         store.forceBlockingFlush();
-        store.getFlushPath(1024);
+        store.getFlushPath(1024, Descriptor.CURRENT_VERSION);
         assert DefsTable.getFiles(cfm.ksName, cfm.cfName).size() > 0;
         
         new DropColumnFamily(ks.name, cfm.cfName).apply();

Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java?rev=1095770&r1=1095769&r2=1095770&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java
(original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java
Thu Apr 21 16:20:47 2011
@@ -106,7 +106,7 @@ public abstract class AntiEntropyService
         Gossiper.instance.initializeNodeUnsafe(REMOTE, 1);
 
         local_range = StorageService.instance.getLocalPrimaryRange();
-        
+
         // random session id for each test
         request = new TreeRequest(UUID.randomUUID().toString(), LOCAL, local_range, new CFPair(tablename,
cfname));
     }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/streaming/BootstrapTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/streaming/BootstrapTest.java?rev=1095770&r1=1095769&r2=1095770&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/streaming/BootstrapTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/streaming/BootstrapTest.java Thu Apr 21
16:20:47 2011
@@ -37,6 +37,7 @@ public class BootstrapTest extends Schem
     public void testGetNewNames() throws IOException
     {
         Descriptor desc = Descriptor.fromFilename(new File("Keyspace1", "Standard1-500-Data.db").toString());
+        assert !desc.isLatestVersion; // deliberately test old version; see CASSANDRA-2283
         PendingFile inContext = new PendingFile(null, desc, "Data.db", Arrays.asList(new
Pair<Long,Long>(0L, 1L)), OperationType.BOOTSTRAP);
 
         PendingFile outContext = StreamIn.getContextMapping(inContext);
@@ -45,7 +46,8 @@ public class BootstrapTest extends Schem
 
         // nothing else should
         assertEquals(inContext.component, outContext.component);
-        assertEquals(inContext.desc.ksname, outContext.desc.ksname);
-        assertEquals(inContext.desc.cfname, outContext.desc.cfname);
+        assertEquals(desc.ksname, outContext.desc.ksname);
+        assertEquals(desc.cfname, outContext.desc.cfname);
+        assertEquals(desc.version, outContext.desc.version);
     }
 }

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=1095770&r1=1095769&r2=1095770&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/streaming/SerializationsTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/streaming/SerializationsTest.java Thu Apr
21 16:20:47 2011
@@ -50,10 +50,10 @@ public class SerializationsTest extends 
     private void testPendingFileWrite() throws IOException
     {
         // make sure to test serializing null and a pf with no sstable.
-        PendingFile normal = makePendingFile(true, "fake_component", 100, OperationType.BOOTSTRAP);
-        PendingFile noSections = makePendingFile(true, "not_real", 0, OperationType.AES);
-        PendingFile noSST = makePendingFile(false, "also_fake", 100, OperationType.RESTORE_REPLICA_COUNT);
-        
+        PendingFile normal = makePendingFile(true, 100, OperationType.BOOTSTRAP);
+        PendingFile noSections = makePendingFile(true, 0, OperationType.AES);
+        PendingFile noSST = makePendingFile(false, 100, OperationType.RESTORE_REPLICA_COUNT);
+
         DataOutputStream out = getOutput("streaming.PendingFile.bin");
         PendingFile.serializer().serialize(normal, out, getVersion());
         PendingFile.serializer().serialize(noSections, out, getVersion());
@@ -78,15 +78,15 @@ public class SerializationsTest extends 
     
     private void testStreamHeaderWrite() throws IOException
     {
-        StreamHeader sh0 = new StreamHeader("Keyspace1", 123L, makePendingFile(true, "zz",
100, OperationType.BOOTSTRAP));
-        StreamHeader sh1 = new StreamHeader("Keyspace1", 124L, makePendingFile(false, "zz",
100, OperationType.BOOTSTRAP));
+        StreamHeader sh0 = new StreamHeader("Keyspace1", 123L, makePendingFile(true, 100,
OperationType.BOOTSTRAP));
+        StreamHeader sh1 = new StreamHeader("Keyspace1", 124L, makePendingFile(false, 100,
OperationType.BOOTSTRAP));
         Collection<PendingFile> files = new ArrayList<PendingFile>();
         for (int i = 0; i < 50; i++)
-            files.add(makePendingFile(i % 2 == 0, "aa", 100, OperationType.BOOTSTRAP));
-        StreamHeader sh2 = new StreamHeader("Keyspace1", 125L, makePendingFile(true, "bb",
100, OperationType.BOOTSTRAP), files);
+            files.add(makePendingFile(i % 2 == 0, 100, OperationType.BOOTSTRAP));
+        StreamHeader sh2 = new StreamHeader("Keyspace1", 125L, makePendingFile(true, 100,
OperationType.BOOTSTRAP), files);
         StreamHeader sh3 = new StreamHeader("Keyspace1", 125L, null, files);
-        StreamHeader sh4 = new StreamHeader("Keyspace1", 125L, makePendingFile(true, "bb",
100, OperationType.BOOTSTRAP), new ArrayList<PendingFile>());
-        
+        StreamHeader sh4 = new StreamHeader("Keyspace1", 125L, makePendingFile(true, 100,
OperationType.BOOTSTRAP), new ArrayList<PendingFile>());
+
         DataOutputStream out = getOutput("streaming.StreamHeader.bin");
         StreamHeader.serializer().serialize(sh0, out, getVersion());
         StreamHeader.serializer().serialize(sh1, out, getVersion());
@@ -132,13 +132,13 @@ public class SerializationsTest extends 
         in.close();
     }
     
-    private static PendingFile makePendingFile(boolean sst, String comp, int numSecs, OperationType
op)
+    private static PendingFile makePendingFile(boolean sst, int numSecs, OperationType op)
     {
         Descriptor desc = new Descriptor("z", new File("path/doesn't/matter"), "Keyspace1",
"Standard1", 23, false);
         List<Pair<Long, Long>> sections = new ArrayList<Pair<Long, Long>>();
         for (int i = 0; i < numSecs; i++)
             sections.add(new Pair<Long, Long>(new Long(i), new Long(i * i)));
-        return new PendingFile(sst ? makeSSTable() : null, desc, comp, sections, op);
+        return new PendingFile(sst ? makeSSTable() : null, desc, SSTable.COMPONENT_DATA,
sections, op);
     }
     
     private void testStreamRequestMessageWrite() throws IOException
@@ -147,9 +147,9 @@ public class SerializationsTest extends 
         for (int i = 0; i < 5; i++)
             ranges.add(new Range(new BytesToken(ByteBufferUtil.bytes(Integer.toString(10*i))),
new BytesToken(ByteBufferUtil.bytes(Integer.toString(10*i+5)))));
         StreamRequestMessage msg0 = new StreamRequestMessage(FBUtilities.getLocalAddress(),
ranges, "Keyspace1", 123L, OperationType.RESTORE_REPLICA_COUNT);
-        StreamRequestMessage msg1 = new StreamRequestMessage(FBUtilities.getLocalAddress(),
makePendingFile(true, "aa", 100, OperationType.BOOTSTRAP), 124L);
-        StreamRequestMessage msg2 = new StreamRequestMessage(FBUtilities.getLocalAddress(),
makePendingFile(false, "aa", 100, OperationType.BOOTSTRAP), 124L);
-        
+        StreamRequestMessage msg1 = new StreamRequestMessage(FBUtilities.getLocalAddress(),
makePendingFile(true, 100, OperationType.BOOTSTRAP), 124L);
+        StreamRequestMessage msg2 = new StreamRequestMessage(FBUtilities.getLocalAddress(),
makePendingFile(false, 100, OperationType.BOOTSTRAP), 124L);
+
         DataOutputStream out = getOutput("streaming.StreamRequestMessage.bin");
         StreamRequestMessage.serializer().serialize(msg0, out, getVersion());
         StreamRequestMessage.serializer().serialize(msg1, out, getVersion());



Mime
View raw message