cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject svn commit: r1164634 - in /cassandra/branches/cassandra-0.8: CHANGES.txt src/java/org/apache/cassandra/db/ColumnFamilyStore.java src/java/org/apache/cassandra/streaming/StreamInSession.java
Date Fri, 02 Sep 2011 17:12:57 GMT
Author: slebresne
Date: Fri Sep  2 17:12:56 2011
New Revision: 1164634

URL: http://svn.apache.org/viewvc?rev=1164634&view=rev
Log:
Don't try to build secondary indexes when there is none
patch by slebresne; reviewed by jbellis for CASSANDRA-3123

Modified:
    cassandra/branches/cassandra-0.8/CHANGES.txt
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/streaming/StreamInSession.java

Modified: cassandra/branches/cassandra-0.8/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/CHANGES.txt?rev=1164634&r1=1164633&r2=1164634&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.8/CHANGES.txt Fri Sep  2 17:12:56 2011
@@ -51,6 +51,8 @@
  * fix handling of the empty byte buffer by ReversedType (CASSANDRA-3111)
  * optionally skip log4j configuration (CASSANDRA-3061)
  * bundle sstableloader with the debian package (CASSANDRA-3113)
+ * don't try to build secondary indexes when there is none (CASSANDRA-3123)
+
 
 0.8.4
  * include files-to-be-streamed in StreamInSession.getSources (CASSANDRA-2972)

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1164634&r1=1164633&r2=1164634&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
Fri Sep  2 17:12:56 2011
@@ -343,7 +343,7 @@ public class ColumnFamilyStore implement
                 {
                     throw new AssertionError(e);
                 }
-                buildSecondaryIndexes(getSSTables(), FBUtilities.singleton(info.name));
+                maybeBuildSecondaryIndexes(getSSTables(), FBUtilities.singleton(info.name));
                 SystemTable.setIndexBuilt(table.name, indexedCfMetadata.cfName);
             }
         };
@@ -360,8 +360,15 @@ public class ColumnFamilyStore implement
                                         : new LocalByPartionerType(StorageService.getPartitioner());
     }
 
-    public void buildSecondaryIndexes(Collection<SSTableReader> sstables, SortedSet<ByteBuffer>
columns)
+    /**
+     * Build secondary indexes for the provided {@code columns}.
+     * This does nothing if {@code columns} is empty.
+     */
+    public void maybeBuildSecondaryIndexes(Collection<SSTableReader> sstables, SortedSet<ByteBuffer>
columns)
     {
+        if (columns.isEmpty())
+            return;
+
         logger.info(String.format("Submitting index build of %s for data in %s",
                                   metadata.comparator.getString(columns), StringUtils.join(sstables,
", ")));
         Table.IndexBuilder builder = table.createIndexBuilder(this, columns, new ReducingKeyIterator(sstables));
@@ -542,7 +549,7 @@ public class ColumnFamilyStore implement
         data.addSSTables(sstables); // this will call updateCacheSizes() for us
 
         logger.info("Requesting a full secondary index re-build for " + table.name + "/"
+ columnFamily);
-        buildSecondaryIndexes(sstables, getIndexedColumns());
+        maybeBuildSecondaryIndexes(sstables, getIndexedColumns());
 
         logger.info("Setting up new generation: " + generation);
         fileIndexGenerator.set(generation);

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/streaming/StreamInSession.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/streaming/StreamInSession.java?rev=1164634&r1=1164633&r2=1164634&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/streaming/StreamInSession.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/streaming/StreamInSession.java
Fri Sep  2 17:12:56 2011
@@ -158,8 +158,8 @@ public class StreamInSession
             // build secondary indexes
             for (Map.Entry<ColumnFamilyStore, List<SSTableReader>> entry : cfstores.entrySet())
             {
-                if (entry.getKey() != null && !entry.getKey().getIndexedColumns().isEmpty())
-                    entry.getKey().buildSecondaryIndexes(entry.getValue(), entry.getKey().getIndexedColumns());
+                if (entry.getKey() != null)
+                    entry.getKey().maybeBuildSecondaryIndexes(entry.getValue(), entry.getKey().getIndexedColumns());
             }
 
             // send reply to source that we're done



Mime
View raw message