cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1148468 - in /cassandra/trunk: ./ contrib/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/cql/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/db/m...
Date Tue, 19 Jul 2011 18:13:52 GMT
Author: jbellis
Date: Tue Jul 19 18:13:51 2011
New Revision: 1148468

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

Added:
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
      - copied unchanged from r1148467, cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
      - copied unchanged from r1148467, cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableSimpleWriter.java
      - copied unchanged from r1148467, cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/io/sstable/SSTableSimpleWriter.java
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/config/KSMetaData.java
    cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g
    cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java
    cassandra/trunk/src/java/org/apache/cassandra/cql/SelectStatement.java
    cassandra/trunk/src/java/org/apache/cassandra/cql/Term.java
    cassandra/trunk/src/java/org/apache/cassandra/cql/WhereClause.java
    cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateKeyspace.java
    cassandra/trunk/test/system/test_cql.py

Propchange: cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 19 18:13:51 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6:922689-1052356,1052358-1053452,1053454,1053456-1131291
-/cassandra/branches/cassandra-0.7:1026516-1147623
+/cassandra/branches/cassandra-0.7:1026516-1148466
 /cassandra/branches/cassandra-0.7.0:1053690-1055654
-/cassandra/branches/cassandra-0.8:1090934-1125013,1125019-1147853
+/cassandra/branches/cassandra-0.8:1090934-1125013,1125019-1148467
 /cassandra/branches/cassandra-0.8.0:1125021-1130369
 /cassandra/branches/cassandra-0.8.1:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3:1051699-1053689

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1148468&r1=1148467&r2=1148468&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Tue Jul 19 18:13:51 2011
@@ -46,6 +46,12 @@
  * support spaces in path to log4j configuration (CASSANDRA-2383)
  * avoid including inferred types in CF update (CASSANDRA-2809)
  * fix JMX bulkload call (CASSANDRA-2908)
+ * fix updating KS with durable_writes=false (CASSANDRA-2907)
+ * add simplified facade to SSTableWriter for bulk loading use
+   (CASSANDRA-2911)
+ * CQL: include only one row per unique key for IN queries
+   (CASSANDRA-2717)
+ * fix re-using index CF sstable names after drop/recreate (CASSANDRA-2872)
 
 
 0.8.1

Propchange: cassandra/trunk/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 19 18:13:51 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-1147623
+/cassandra/branches/cassandra-0.7/contrib:1026516-1148466
 /cassandra/branches/cassandra-0.7.0/contrib:1053690-1055654
-/cassandra/branches/cassandra-0.8/contrib:1090934-1125013,1125019-1147853
+/cassandra/branches/cassandra-0.8/contrib:1090934-1125013,1125019-1148467
 /cassandra/branches/cassandra-0.8.0/contrib:1125021-1130369
 /cassandra/branches/cassandra-0.8.1/contrib:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3/contrib:1051699-1053689

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 19 18:13:51 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-1131291
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1147623
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1148466
 /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:1090934-1125013,1125019-1147853
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090934-1125013,1125019-1148467
 /cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1125021-1130369
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1051699-1053689

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 19 18:13:51 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-1131291
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1147623
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1148466
 /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:1090934-1125013,1125019-1147853
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090934-1125013,1125019-1148467
 /cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1125021-1130369
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1051699-1053689

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 19 18:13:51 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-1131291
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1147623
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1148466
 /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:1090934-1125013,1125019-1147853
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090934-1125013,1125019-1148467
 /cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1125021-1130369
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1051699-1053689

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 19 18:13:51 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-1131291
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1147623
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1148466
 /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:1090934-1125013,1125019-1147853
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090934-1125013,1125019-1148467
 /cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1125021-1130369
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1051699-1053689

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 19 18:13:51 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-1131291
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1147623
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1148466
 /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:1090934-1125013,1125019-1147853
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090934-1125013,1125019-1148467
 /cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1125021-1130369
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1051699-1053689

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java?rev=1148468&r1=1148467&r2=1148468&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java Tue Jul 19 18:13:51
2011
@@ -133,12 +133,12 @@ public final class KSMetaData
     {
         StringBuilder sb = new StringBuilder();
         sb.append(name)
-          .append("rep strategy:")
+          .append(", rep strategy:")
           .append(strategyClass.getSimpleName())
           .append("{")
           .append(StringUtils.join(cfMetaData.values(), ", "))
           .append("}")
-          .append("durable_writes: ").append(durable_writes);
+          .append(", durable_writes: ").append(durable_writes);
         return sb.toString();
     }
 
@@ -205,8 +205,8 @@ public final class KSMetaData
         ksdef.setStrategy_options(ksm.strategyOptions);
         if (ksm.strategyOptions != null && ksm.strategyOptions.containsKey("replication_factor"))
             ksdef.setReplication_factor(Integer.parseInt(ksm.strategyOptions.get("replication_factor")));
-        ksdef.durable_writes = ksm.durable_writes;
-        
+        ksdef.setDurable_writes(ksm.durable_writes);
+
         return ksdef;
     }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g?rev=1148468&r1=1148467&r2=1148468&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g Tue Jul 19 18:13:51 2011
@@ -188,7 +188,7 @@ whereClause returns [WhereClause clause]
       | key_alias=term { inClause.setKeyAlias(key_alias.getText()); }
            K_IN '(' f1=term { inClause.andKeyEquals(f1); }
                   (',' fN=term { inClause.andKeyEquals(fN); } )* ')'
-        { $clause = inClause; }
+        { inClause.setMultiKey(true); $clause = inClause; }
     ;
 
 /**

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java?rev=1148468&r1=1148467&r2=1148468&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java Tue Jul 19 18:13:51
2011
@@ -334,6 +334,10 @@ public class QueryProcessor
         if (select.isKeyRange() && (select.getKeyFinish() != null) && (select.getColumnRelations().size()
> 0))
             throw new InvalidRequestException("You cannot combine key range and by-column
clauses in a SELECT");
         
+        // Can't use more than one KEY =
+        if (!select.isMultiKey() && select.getKeys().size() > 1)
+            throw new InvalidRequestException("You cannot use more than one KEY = in a SELECT");
+
         AbstractType<?> comparator = select.getComparator(keyspace);
         
         if (select.getColumnRelations().size() > 0)

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/SelectStatement.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/SelectStatement.java?rev=1148468&r1=1148467&r2=1148468&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/SelectStatement.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/SelectStatement.java Tue Jul 19 18:13:51
2011
@@ -22,6 +22,7 @@ package org.apache.cassandra.cql;
 
 import java.nio.ByteBuffer;
 import java.util.List;
+import java.util.Set;
 
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.DatabaseDescriptor;
@@ -58,7 +59,7 @@ public class SelectStatement
         return clause.isKeyRange();
     }
     
-    public List<Term> getKeys()
+    public Set<Term> getKeys()
     {
         return clause.getKeys();
     }
@@ -148,6 +149,11 @@ public class SelectStatement
         return clause.getKeyAlias();
     }
 
+    public boolean isMultiKey()
+    {
+        return clause.isMultiKey();
+    }
+
     public void extractKeyAliasFromColumns(CFMetaData cfm)
     {
         clause.extractKeysFromColumns(cfm);
@@ -162,4 +168,5 @@ public class SelectStatement
     {
         return DatabaseDescriptor.getValueValidator(keyspace, columnFamily, column);
     }
+
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/Term.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/Term.java?rev=1148468&r1=1148467&r2=1148468&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/Term.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/Term.java Tue Jul 19 18:13:51 2011
@@ -130,6 +130,38 @@ public class Term
     {
         return String.format("Term(%s, type=%s)", getText(), type);
     }
+
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((text == null) ? 0 : text.hashCode());
+        result = prime * result + ((type == null) ? 0 : type.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Term other = (Term) obj;
+        if (text == null)
+        {
+            if (other.text != null)
+                return false;
+        } else if (!text.equals(other.text))
+            return false;
+        if (type != other.type)
+            return false;
+        return true;
+    }
+
     
 }
 

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/WhereClause.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/WhereClause.java?rev=1148468&r1=1148467&r2=1148468&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/WhereClause.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/WhereClause.java Tue Jul 19 18:13:51
2011
@@ -22,15 +22,14 @@ package org.apache.cassandra.cql;
 
 
 import org.apache.cassandra.config.CFMetaData;
-import org.apache.cassandra.db.marshal.AbstractType;
-import org.apache.cassandra.thrift.InvalidRequestException;
-import org.apache.cassandra.thrift.ThriftValidation;
 import org.apache.cassandra.utils.ByteBufferUtil;
 
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Set;
 
 /**
  * WhereClauses encapsulate all of the predicates of a SELECT query.
@@ -39,10 +38,10 @@ import java.util.List;
 public class WhereClause
 {
     // added to either by the parser, e.g. from an IN clause, or by extractKeysFromColumns
-    private List<Term> keys = new ArrayList<Term>();
+    private Set<Term> keys = new LinkedHashSet<Term>();
     private Term startKey, finishKey;
     private List<Relation> columns = new ArrayList<Relation>();
-    private boolean includeStartKey = false, includeFinishKey = false;
+    private boolean includeStartKey = false, includeFinishKey = false, multiKey = false;
     // set by extractKeysFromColumns
     private String keyAlias = null;
 
@@ -117,7 +116,7 @@ public class WhereClause
         return finishKey;
     }
     
-    public List<Term> getKeys()
+    public Set<Term> getKeys()
     {
         return keys;
     }
@@ -137,6 +136,15 @@ public class WhereClause
         keyAlias = alias.toUpperCase();
     }
 
+    public boolean isMultiKey() {
+        return multiKey;
+    }
+
+    public void setMultiKey(boolean multiKey)
+    {
+        this.multiKey = multiKey;
+    }
+
     public String getKeyAlias()
     {
         // TODO fix special casing here, key alias should always be set post-extract

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=1148468&r1=1148467&r2=1148468&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Tue Jul 19 18:13:51
2011
@@ -424,13 +424,24 @@ public class ColumnFamilyStore implement
     {
         // get the max generation number, to prevent generation conflicts
         List<Integer> generations = new ArrayList<Integer>();
-        for (Descriptor desc : files(table.name, columnFamily, true).keySet())
+        for (String path : DatabaseDescriptor.getAllDataFileLocationsForTable(table.name))
         {
-            generations.add(desc.generation);
-            if (desc.isFromTheFuture())
+            Iterable<Pair<Descriptor, Component>> pairs = files(new File(path));
+            File incrementalsPath = new File(path, "backups");
+            if (incrementalsPath.exists())
+                pairs = Iterables.concat(pairs, files(incrementalsPath));
+
+            for (Pair<Descriptor, Component> pair : pairs)
             {
-                throw new RuntimeException(String.format("Can't open sstables from the future!
Current version %s, found file: %s",
-                                                         Descriptor.CURRENT_VERSION, desc));
+                Descriptor desc = pair.left;
+                if (!desc.cfname.equals(columnFamily))
+                    continue;
+                generations.add(desc.generation);
+                if (desc.isFromTheFuture())
+                {
+                    throw new RuntimeException(String.format("Can't open sstables from the
future! Current version %s, found file: %s",
+                                                             Descriptor.CURRENT_VERSION,
desc));
+                }
             }
         }
         Collections.sort(generations);
@@ -543,34 +554,45 @@ public class ColumnFamilyStore implement
         final Map<Descriptor,Set<Component>> sstables = new HashMap<Descriptor,Set<Component>>();
         for (String directory : DatabaseDescriptor.getAllDataFileLocationsForTable(keyspace))
         {
-            // NB: we never "accept" a file in the FilenameFilter sense: they are added to
the sstable map
-            new File(directory).list(new FilenameFilter()
+            for (Pair<Descriptor, Component> component : files(new File(directory)))
             {
-                public boolean accept(File dir, String name)
+                if (component != null && component.left.cfname.equals(columnFamily))
                 {
-                    Pair<Descriptor,Component> component = SSTable.tryComponentFromFilename(dir,
name);
-                    if (component != null && component.left.cfname.equals(columnFamily))
+                    if (includeCompacted || !new File(component.left.filenameFor(Component.COMPACTED_MARKER)).exists())
                     {
-                        if (includeCompacted || !new File(component.left.filenameFor(Component.COMPACTED_MARKER)).exists())
+                        Set<Component> components = sstables.get(component.left);
+                        if (components == null)
                         {
-                            Set<Component> components = sstables.get(component.left);
-                            if (components == null)
-                            {
-                                components = new HashSet<Component>();
-                                sstables.put(component.left, components);
-                            }
-                            components.add(component.right);
+                            components = new HashSet<Component>();
+                            sstables.put(component.left, components);
                         }
-                        else
-                            logger.debug("not including compacted sstable " + component.left.cfname
+ "-" + component.left.generation);
+                        components.add(component.right);
                     }
-                    return false;
+                    else
+                        logger.debug("not including compacted sstable " + component.left.cfname
+ "-" + component.left.generation);
                 }
-            });
+            }
         }
         return sstables;
     }
 
+    private static List<Pair<Descriptor, Component>> files(File path)
+    {
+        final List<Pair<Descriptor, Component>> sstables = new ArrayList<Pair<Descriptor,
Component>>();
+        // NB: we never "accept" a file in the FilenameFilter sense: they are added to the
sstable map
+        path.list(new FilenameFilter()
+        {
+            public boolean accept(File dir, String name)
+            {
+                Pair<Descriptor, Component> pair = SSTable.tryComponentFromFilename(dir,
name);
+                if (pair != null)
+                    sstables.add(pair);
+                return false;
+            }
+        });
+        return sstables;
+    }
+
     /**
      * @return the name of the column family
      */

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateKeyspace.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateKeyspace.java?rev=1148468&r1=1148467&r2=1148468&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateKeyspace.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateKeyspace.java Tue Jul
19 18:13:51 2011
@@ -51,7 +51,8 @@ public class UpdateKeyspace extends Migr
         oldKsm = DatabaseDescriptor.getKSMetaData(ksm.name);
         if (oldKsm == null)
             throw new ConfigurationException(ksm.name + " cannot be updated because it doesn't
exist.");
-        this.newKsm = new KSMetaData(ksm.name, ksm.strategyClass, ksm.strategyOptions, oldKsm.cfMetaData().values().toArray(new
CFMetaData[]{}));
+
+        this.newKsm = new KSMetaData(ksm.name, ksm.strategyClass, ksm.strategyOptions, ksm.isDurableWrites(),
oldKsm.cfMetaData().values().toArray(new CFMetaData[]{}));
         rm = makeDefinitionMutation(newKsm, oldKsm, newVersion);
     }
     
@@ -60,7 +61,6 @@ public class UpdateKeyspace extends Migr
         DatabaseDescriptor.clearTableDefinition(oldKsm, newVersion);
         DatabaseDescriptor.setTableDefinition(newKsm, newVersion);
 
-
         Table table = Table.open(newKsm.name);
         try
         {

Modified: cassandra/trunk/test/system/test_cql.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_cql.py?rev=1148468&r1=1148467&r2=1148468&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_cql.py (original)
+++ cassandra/trunk/test/system/test_cql.py Tue Jul 19 18:13:51 2011
@@ -881,6 +881,19 @@ class TestCql(ThriftTester):
             assert r[2] == "p4ssw0rd", \
                    "unrecognized value '%s'" % r[1]
 
+        # select with same KEY AND'ed (see CASSANDRA-2717)
+        cursor.execute("SELECT * FROM StandardString1 WHERE KEY = 'mUser1' AND KEY = 'mUser1'")
+        assert cursor.rowcount == 1, "expected 1 result, got %d" % cursor.rowcount
+
+        # select with different KEYs AND'ed
+        assert_raises(cql.ProgrammingError,
+                      cursor.execute,
+                      "SELECT * FROM StandardString1 WHERE KEY = 'mUser1' AND KEY = 'mUser2'")
+
+        # select with same KEY repeated in IN
+        cursor.execute("SELECT * FROM StandardString1 WHERE KEY IN ('mUser1', 'mUser1')")
+        assert cursor.rowcount == 1, "expected 1 result, got %d" % cursor.rowcount
+
     def test_insert_with_timestamp_and_ttl(self):
         "insert statement should support setting timestamp"
         cursor = init()



Mime
View raw message