cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1100041 - in /cassandra/trunk: ./ contrib/ drivers/py/cql/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/db/filter/ src/java/org/apache/cassandra/io/sstable/ src/java...
Date Fri, 06 May 2011 04:17:18 GMT
Author: jbellis
Date: Fri May  6 04:17:17 2011
New Revision: 1100041

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

Modified:
    cassandra/trunk/   (props changed)
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/contrib/   (props changed)
    cassandra/trunk/drivers/py/cql/decoders.py
    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/db/ColumnFamilyStore.java
    cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java
    cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
    cassandra/trunk/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
    cassandra/trunk/src/java/org/apache/cassandra/streaming/PendingFile.java
    cassandra/trunk/test/system/test_cql.py
    cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java

Propchange: cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri May  6 04:17:17 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7:1026516-1099096,1099363,1099816
+/cassandra/branches/cassandra-0.7:1026516-1099892
 /cassandra/branches/cassandra-0.7.0:1053690-1055654
-/cassandra/branches/cassandra-0.8:1090935-1099101,1099341,1099366,1099724,1099818,1099920-1099921
+/cassandra/branches/cassandra-0.8:1090935-1100040
 /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=1100041&r1=1100040&r2=1100041&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Fri May  6 04:17:17 2011
@@ -9,6 +9,9 @@
    rebuffering in BRAF (CASSANDRA-2581)
  * fix merkle tree splitting exiting early (CASSANDRA-2605)
  * Disable compaction throttling during bootstrap (CASSANDRA-2612) 
+ * fix returning null column values in the python cql driver (CASSANDRA-2593)
+ * snapshot_before_compaction directory name fix (CASSANDRA-2598)
+ 
 
 0.8.0-beta2
  * fix NPE compacting index CFs (CASSANDRA-2528)
@@ -31,6 +34,7 @@
    schema (CASSANDRA-2536)
  * remove unframed Thrift transport option
  * include indexes in snapshots (CASSANDRA-2596)
+ * improve ignoring of obsolete mutations in index maintenance (CASSANDRA-2401)
 
 
 0.8.0-beta1

Propchange: cassandra/trunk/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri May  6 04:17:17 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-1099096,1099363,1099816
+/cassandra/branches/cassandra-0.7/contrib:1026516-1099892
 /cassandra/branches/cassandra-0.7.0/contrib:1053690-1055654
-/cassandra/branches/cassandra-0.8/contrib:1090935-1099101,1099341,1099366,1099724,1099818,1099920-1099921
+/cassandra/branches/cassandra-0.8/contrib:1090935-1100040
 /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

Modified: cassandra/trunk/drivers/py/cql/decoders.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/drivers/py/cql/decoders.py?rev=1100041&r1=1100040&r2=1100041&view=diff
==============================================================================
--- cassandra/trunk/drivers/py/cql/decoders.py (original)
+++ cassandra/trunk/drivers/py/cql/decoders.py Fri May  6 04:17:17 2011
@@ -59,6 +59,9 @@ class SchemaDecoder(object):
         unmarshal = unmarshallers.get(comparator, unmarshal_noop)
         values = [key]
         for column in row.columns:
+            if column.value == None:
+                continue
+
             description.append((unmarshal(column.name), comparator, None, None, None, None,
True))
             validator = self.__validator_for(keyspace, column_family, column.name)
             values.append(unmarshallers.get(validator, unmarshal_noop)(column.value))

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri May  6 04:17:17 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-1099096,1099363,1099816
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1099892
 /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-1099101,1099341,1099366,1099724,1099818,1099920-1099921
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090935-1100040
 /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 Fri May  6 04:17:17 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-1099096,1099363,1099816
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1099892
 /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-1099101,1099341,1099366,1099724,1099818,1099920-1099921
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090935-1100040
 /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 Fri May  6 04:17:17 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-1099096,1099363,1099816
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1099892
 /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-1099101,1099341,1099366,1099724,1099818,1099920-1099921
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090935-1100040
 /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 Fri May  6 04:17:17 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-1099096,1099363,1099816
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1099892
 /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-1099101,1099341,1099366,1099724,1099818,1099920-1099921
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090935-1100040
 /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 Fri May  6 04:17:17 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-1099096,1099363,1099816
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1099892
 /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-1099101,1099341,1099366,1099724,1099818,1099920-1099921
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090935-1100040
 /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/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1100041&r1=1100040&r2=1100041&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Fri May  6 04:17:17
2011
@@ -1479,8 +1479,8 @@ public class ColumnFamilyStore implement
              * But, if the calling StorageProxy is doing a good job estimating data from
each range, the range
              * should be pretty close to `start_key`. */
             if (logger.isDebugEnabled())
-                logger.debug(String.format("Scanning index row %s:%s starting with %s",
-                                           indexCFS.columnFamily, indexKey, indexCFS.getComparator().getString(startKey)));
+                logger.debug(String.format("Scanning index %s starting with %s",
+                                           expressionString(primary), indexCFS.getComparator().getString(startKey)));
             QueryFilter indexFilter = QueryFilter.getSliceFilter(indexKey,
                                                                  new QueryPath(indexCFS.getColumnFamilyName()),
                                                                  startKey,
@@ -1509,6 +1509,8 @@ public class ColumnFamilyStore implement
 
                 // get the row columns requested, and additional columns for the expressions
if necessary
                 ColumnFamily data = getColumnFamily(new QueryFilter(dk, path, firstFilter));
+                assert data != null : String.format("No data found for %s in %s:%s (original
filter %s) from expression %s",
+                                                    firstFilter, dk, path, dataFilter, expressionString(primary));
                 logger.debug("fetched data row {}", data);
                 if (extraFilter != null)
                 {
@@ -1552,6 +1554,15 @@ public class ColumnFamilyStore implement
         return rows;
     }
 
+    private String expressionString(IndexExpression expr)
+    {
+        return String.format("'%s.%s %s %s'",
+                             columnFamily,
+                             getComparator().getString(expr.column_name),
+                             expr.op,
+                             metadata.getColumn_metadata().get(expr.column_name).getValidator().getString(expr.value));
+    }
+
     private IndexExpression highestSelectivityPredicate(IndexClause clause)
     {
         IndexExpression best = null;

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java?rev=1100041&r1=1100040&r2=1100041&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java Fri May  6 04:17:17
2011
@@ -523,7 +523,7 @@ public class CompactionManager implement
 
         Table table = cfs.table;
         if (DatabaseDescriptor.isSnapshotBeforeCompaction())
-            table.snapshot("compact-" + cfs.columnFamily);
+            table.snapshot(System.currentTimeMillis() + "-" + "compact-" + cfs.columnFamily);
 
         // sanity check: all sstables must belong to the same cfs
         for (SSTableReader sstable : sstables)

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java?rev=1100041&r1=1100040&r2=1100041&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/Table.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/Table.java Fri May  6 04:17:17 2011
@@ -485,23 +485,26 @@ public class Table
         if (oldIndexedColumns == null)
             return;
 
-        ColumnFamily cf2 = cf.cloneMe();
-        for (IColumn oldColumn : oldIndexedColumns)
+        for (Iterator<ByteBuffer> iter = mutatedIndexedColumns.iterator(); iter.hasNext();
)
         {
-            cf2.addColumn(oldColumn);
-        }
-        ColumnFamily resolved = ColumnFamilyStore.removeDeleted(cf2, Integer.MAX_VALUE);
-
-        for (IColumn oldColumn : oldIndexedColumns)
-        {
-            IColumn resolvedColumn = resolved == null ? null : resolved.getColumn(oldColumn.name());
-            if (resolvedColumn != null && resolvedColumn.equals(oldColumn))
+            ByteBuffer name = iter.next();
+            IColumn newColumn = cf.getColumn(name); // null == row delete or it wouldn't
be marked Mutated
+            if (newColumn != null && cf.isMarkedForDelete())
+                throw new UnsupportedOperationException("Index manager cannot support deleting
and inserting into a row in the same mutation");
+            IColumn oldColumn = oldIndexedColumns.getColumn(name);
+
+            // deletions are irrelevant to the index unless we're changing state from live
-> deleted, i.e.,
+            // just updating w/ a newer tombstone doesn't matter
+            boolean bothDeleted = (newColumn == null || newColumn.isMarkedForDelete())
+                                  && (oldColumn == null || oldColumn.isMarkedForDelete());
+            // obsolete means either the row or the column timestamp we're applying is older
than existing data
+            boolean obsoleteRowTombstone = newColumn == null && oldColumn != null
&& cf.getMarkedForDeleteAt() < oldColumn.timestamp();
+            boolean obsoleteColumn = newColumn != null && (newColumn.timestamp()
<= oldIndexedColumns.getMarkedForDeleteAt()
+                                                           || (oldColumn != null &&
oldColumn.reconcile(newColumn) == oldColumn));
+            if (bothDeleted || obsoleteRowTombstone || obsoleteColumn)
             {
-                if (logger.isDebugEnabled())
-                    logger.debug("ignoring obsolete mutation of " + cf.getComparator().getString(oldColumn.name()));
-                cf.remove(oldColumn.name());
-                mutatedIndexedColumns.remove(oldColumn.name());
-                oldIndexedColumns.remove(oldColumn.name());
+                iter.remove();
+                oldIndexedColumns.remove(name);
             }
         }
     }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java?rev=1100041&r1=1100040&r2=1100041&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java Fri May
 6 04:17:17 2011
@@ -26,6 +26,8 @@ import java.util.Comparator;
 import java.util.Iterator;
 import java.util.SortedSet;
 
+import org.apache.commons.lang.StringUtils;
+
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.columniterator.IColumnIterator;
 import org.apache.cassandra.db.columniterator.SSTableNamesIterator;
@@ -89,4 +91,12 @@ public class NamesQueryFilter implements
     {
         return comparator.columnComparator;
     }
+
+    @Override
+    public String toString()
+    {
+        return "NamesQueryFilter(" +
+               "columns=" + StringUtils.join(columns, ",") +
+               ')';
+    }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java?rev=1100041&r1=1100040&r2=1100041&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java Fri May  6 04:17:17
2011
@@ -183,7 +183,7 @@ public abstract class SSTable
     /**
      * Discovers existing components for the descriptor. Slow: only intended for use outside
the critical path.
      */
-    static Set<Component> componentsFor(final Descriptor desc) 
+    static Set<Component> componentsFor(final Descriptor desc, final boolean liveOnly)
     {
         final Set<Component> components = new HashSet<Component>();
         desc.directory.list(new FilenameFilter()
@@ -191,7 +191,7 @@ public abstract class SSTable
             public boolean accept(File dir, String name)
             {
                 Pair<Descriptor,Component> component = tryComponentFromFilename(dir,
name);
-                if (component != null && component.left.equals(desc))
+                if (component != null && component.left.equals(desc) && (!liveOnly
|| !component.left.temporary))
                     components.add(component.right);
                 return false;
             }

Modified: cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java?rev=1100041&r1=1100040&r2=1100041&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java Fri May  6
04:17:17 2011
@@ -137,7 +137,7 @@ public class SSTableReader extends SSTab
 
     public static SSTableReader open(Descriptor desc) throws IOException
     {
-        Set<Component> components = SSTable.componentsFor(desc);
+        Set<Component> components = componentsFor(desc, false);
         return open(desc, components, DatabaseDescriptor.getCFMetaData(desc.ksname, desc.cfname),
StorageService.getPartitioner());
     }
 

Modified: cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java?rev=1100041&r1=1100040&r2=1100041&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java Fri May  6
04:17:17 2011
@@ -312,7 +312,7 @@ public class SSTableWriter extends SSTab
             long rows = indexer.index();
 
             logger.debug("estimated row count was {} of real count", ((double)estimatedRows)
/ rows);
-            return SSTableReader.open(rename(desc, SSTable.componentsFor(desc)));
+            return SSTableReader.open(rename(desc, SSTable.componentsFor(desc, false)));
         }
     }
 

Modified: cassandra/trunk/src/java/org/apache/cassandra/streaming/PendingFile.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/streaming/PendingFile.java?rev=1100041&r1=1100040&r2=1100041&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/streaming/PendingFile.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/streaming/PendingFile.java Fri May  6 04:17:17
2011
@@ -27,12 +27,10 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.cassandra.net.MessagingService;
-import org.apache.commons.lang.StringUtils;
-
 import org.apache.cassandra.io.ICompactSerializer;
 import org.apache.cassandra.io.sstable.Descriptor;
 import org.apache.cassandra.io.sstable.SSTable;
+import org.apache.cassandra.net.MessagingService;
 import org.apache.cassandra.utils.Pair;
 
 /**

Modified: cassandra/trunk/test/system/test_cql.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_cql.py?rev=1100041&r1=1100040&r2=1100041&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_cql.py (original)
+++ cassandra/trunk/test/system/test_cql.py Fri May  6 04:17:17 2011
@@ -44,6 +44,10 @@ def load_sample(dbconn):
             WITH comparator = ascii AND default_validation = ascii;
     """)
     dbconn.execute("""
+        CREATE COLUMNFAMILY StandardString2 (KEY text PRIMARY KEY)
+            WITH comparator = ascii AND default_validation = ascii;
+    """)
+    dbconn.execute("""
         CREATE COLUMNFAMILY StandardUtf82 (KEY text PRIMARY KEY)
             WITH comparator = text AND default_validation = ascii;
     """)
@@ -220,6 +224,35 @@ class TestCql(ThriftTester):
         assert r[0] == "aa"
         assert r[1] == "1"
 
+    def test_select_range_with_single_column_results(self):
+        "range should not fail when keys were not set"
+        cursor = init()
+        cursor.execute("""
+          BEGIN BATCH
+            UPDATE StandardString2 SET name='1',password='pass1' WHERE KEY = 'user1'
+            UPDATE StandardString2 SET name='2',password='pass2' WHERE KEY = 'user2'
+            UPDATE StandardString2 SET password='pass3' WHERE KEY = 'user3'
+          APPLY BATCH
+        """)
+
+        cursor.execute("""
+          SELECT name FROM StandardString2
+        """)
+
+        assert cursor.rowcount == 3, "expected 3 results, got %d" % cursor.rowcount
+
+        # two of three results should contain one column "name", third should be empty
+        for i in range(1, 3):
+            r = cursor.fetchone()
+            assert len(r) == 2
+            assert r[0] == "user%d" % i
+            assert r[1] == "%s" % i
+
+        r = cursor.fetchone()
+        assert len(r) == 2
+        assert r[0] == "user3"
+        assert r[1] == None
+
     def test_select_columns_slice_reversed(self):
         "range of columns (slice) by row reversed"
         cursor= init()

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java?rev=1100041&r1=1100040&r2=1100041&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java Fri May 
6 04:17:17 2011
@@ -260,7 +260,7 @@ public class ColumnFamilyStoreTest exten
         assert rows.size() == 1 : StringUtils.join(rows, ",");
         String key = new String(rows.get(0).key.key.array(),rows.get(0).key.key.position(),rows.get(0).key.key.remaining());

         assert "k1".equals( key );
-    
+
         // delete the column directly
         rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
         rm.delete(new QueryPath("Indexed1", null, ByteBufferUtil.bytes("birthdate")), 1);
@@ -282,15 +282,40 @@ public class ColumnFamilyStoreTest exten
         rm.apply();
         rows = cfs.scan(clause, range, filter);
         assert rows.size() == 1 : StringUtils.join(rows, ",");
-        key = new String(rows.get(0).key.key.array(),rows.get(0).key.key.position(),rows.get(0).key.key.remaining());

-        assert "k1".equals( key );  
+        key = new String(rows.get(0).key.key.array(),rows.get(0).key.key.position(),rows.get(0).key.key.remaining());
+        assert "k1".equals( key );
+
+        // verify that row and delete w/ older timestamp does nothing
+        rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
+        rm.delete(new QueryPath("Indexed1"), 1);
+        rm.apply();
+        rows = cfs.scan(clause, range, filter);
+        assert rows.size() == 1 : StringUtils.join(rows, ",");
+        key = new String(rows.get(0).key.key.array(),rows.get(0).key.key.position(),rows.get(0).key.key.remaining());
+        assert "k1".equals( key );
+
+        // similarly, column delete w/ older timestamp should do nothing
+        rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
+        rm.delete(new QueryPath("Indexed1", null, ByteBufferUtil.bytes("birthdate")), 1);
+        rm.apply();
+        rows = cfs.scan(clause, range, filter);
+        assert rows.size() == 1 : StringUtils.join(rows, ",");
+        key = new String(rows.get(0).key.key.array(),rows.get(0).key.key.position(),rows.get(0).key.key.remaining());
+        assert "k1".equals( key );
 
-        // delete the entire row
+        // delete the entire row (w/ newer timestamp this time)
         rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
         rm.delete(new QueryPath("Indexed1"), 3);
         rm.apply();
         rows = cfs.scan(clause, range, filter);
         assert rows.isEmpty() : StringUtils.join(rows, ",");
+
+        // make sure obsolete mutations don't generate an index entry
+        rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
+        rm.add(new QueryPath("Indexed1", null, ByteBufferUtil.bytes("birthdate")), ByteBufferUtil.bytes(1L),
3);
+        rm.apply();
+        rows = cfs.scan(clause, range, filter);
+        assert rows.isEmpty() : StringUtils.join(rows, ",");
     }
 
     @Test

Modified: cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java?rev=1100041&r1=1100040&r2=1100041&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java Fri May  6
04:17:17 2011
@@ -74,6 +74,13 @@ public class SSTableTest extends Cleanup
         verifyMany(ssTable, map);
         ssTable = SSTableReader.open(ssTable.descriptor); // read the index from disk
         verifyMany(ssTable, map);
+
+        Set<Component> live = SSTable.componentsFor(ssTable.descriptor, true);
+        assert !live.isEmpty() : "SSTable has live components";
+        Set<Component> all = SSTable.componentsFor(ssTable.descriptor, false);
+        assert live.equals(all) : "live components same as all components";
+        all.removeAll(live);
+        assert all.isEmpty() : "SSTable has no temp components";
     }
 
     private void verifyMany(SSTableReader sstable, Map<ByteBuffer, ByteBuffer> map)
throws IOException



Mime
View raw message