cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1080718 - in /cassandra/branches/cassandra-0.7: CHANGES.txt src/java/org/apache/cassandra/config/CFMetaData.java src/java/org/apache/cassandra/db/ColumnFamilyStore.java src/java/org/apache/cassandra/service/StorageService.java
Date Fri, 11 Mar 2011 18:39:14 GMT
Author: jbellis
Date: Fri Mar 11 18:39:13 2011
New Revision: 1080718

URL: http://svn.apache.org/viewvc?rev=1080718&view=rev
Log:
make2ary indexes use parentCF flush thresholds during initial build
patch by jbellis; reviewed by slebresne for CASSANDRA-2294

Modified:
    cassandra/branches/cassandra-0.7/CHANGES.txt
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/CFMetaData.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java

Modified: cassandra/branches/cassandra-0.7/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1080718&r1=1080717&r2=1080718&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.7/CHANGES.txt Fri Mar 11 18:39:13 2011
@@ -24,6 +24,8 @@
  * allow zero replicas in a NTS datacenter (CASSANDRA-1924)
  * make range queries respect snitch for local replicas (CASSANDRA-2286)
  * fix HH delivery when column index is larger than 2GB (CASSANDRA-2297)
+ * make 2ary indexes use parent CF flush thresholds during initial build
+   (CASSANDRA-2294)
 
 
 0.7.3

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/CFMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/CFMetaData.java?rev=1080718&r1=1080717&r2=1080718&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/CFMetaData.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/CFMetaData.java
Fri Mar 11 18:39:13 2011
@@ -270,10 +270,10 @@ public final class CFMetaData
              column_metadata);
     }
     
-    public static CFMetaData newIndexMetadata(String table, String parentCf, ColumnDefinition
info, AbstractType columnComparator)
+    public static CFMetaData newIndexMetadata(CFMetaData parent, ColumnDefinition info, AbstractType
columnComparator)
     {
-        return new CFMetaData(table,
-                              indexName(parentCf, info),
+        return new CFMetaData(parent.tableName,
+                              indexName(parent.cfName, info),
                               ColumnFamilyType.Standard,
                               columnComparator,
                               null,
@@ -281,15 +281,15 @@ public final class CFMetaData
                               0,
                               0,
                               0,
-                              DEFAULT_GC_GRACE_SECONDS,
+                              parent.gcGraceSeconds,
                               BytesType.instance,
-                              DEFAULT_MIN_COMPACTION_THRESHOLD,
-                              DEFAULT_MAX_COMPACTION_THRESHOLD,
-                              DEFAULT_ROW_CACHE_SAVE_PERIOD_IN_SECONDS,
-                              DEFAULT_KEY_CACHE_SAVE_PERIOD_IN_SECONDS,
-                              DEFAULT_MEMTABLE_LIFETIME_IN_MINS,
-                              DEFAULT_MEMTABLE_THROUGHPUT_IN_MB,
-                              DEFAULT_MEMTABLE_OPERATIONS_IN_MILLIONS,
+                              parent.minCompactionThreshold,
+                              parent.maxCompactionThreshold,
+                              0,
+                              0,
+                              parent.memtableFlushAfterMins,
+                              parent.memtableThroughputInMb,
+                              parent.memtableOperationsInMillions,
                               Collections.<ByteBuffer, ColumnDefinition>emptyMap());
     }
 

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1080718&r1=1080717&r2=1080718&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
Fri Mar 11 18:39:13 2011
@@ -148,15 +148,20 @@ public class ColumnFamilyStore implement
         
         // only update these runtime-modifiable settings if they have not been modified.
         if (!minCompactionThreshold.isModified())
-            minCompactionThreshold = new DefaultInteger(metadata.getMinCompactionThreshold());
+            for (ColumnFamilyStore cfs : concatWithIndexes())
+                cfs.minCompactionThreshold = new DefaultInteger(metadata.getMinCompactionThreshold());
         if (!maxCompactionThreshold.isModified())
-            maxCompactionThreshold = new DefaultInteger(metadata.getMaxCompactionThreshold());
+            for (ColumnFamilyStore cfs : concatWithIndexes())
+                cfs.maxCompactionThreshold = new DefaultInteger(metadata.getMaxCompactionThreshold());
         if (!memtime.isModified())
-            memtime = new DefaultInteger(metadata.getMemtableFlushAfterMins());
+            for (ColumnFamilyStore cfs : concatWithIndexes())
+                cfs.memtime = new DefaultInteger(metadata.getMemtableFlushAfterMins());
         if (!memsize.isModified())
-            memsize = new DefaultInteger(metadata.getMemtableThroughputInMb());
+            for (ColumnFamilyStore cfs : concatWithIndexes())
+                cfs.memsize = new DefaultInteger(metadata.getMemtableThroughputInMb());
         if (!memops.isModified())
-            memops = new DefaultDouble(metadata.getMemtableOperationsInMillions());
+            for (ColumnFamilyStore cfs : concatWithIndexes())
+                cfs.memops = new DefaultDouble(metadata.getMemtableOperationsInMillions());
         if (!rowCacheSaveInSeconds.isModified())
             rowCacheSaveInSeconds = new DefaultInteger(metadata.getRowCacheSavePeriodInSeconds());
         if (!keyCacheSaveInSeconds.isModified())
@@ -313,7 +318,7 @@ public class ColumnFamilyStore implement
         AbstractType columnComparator = (rowPartitioner instanceof OrderPreservingPartitioner
|| rowPartitioner instanceof ByteOrderedPartitioner)
                                         ? BytesType.instance
                                         : new LocalByPartionerType(StorageService.getPartitioner());
-        final CFMetaData indexedCfMetadata = CFMetaData.newIndexMetadata(table.name, columnFamily,
info, columnComparator);
+        final CFMetaData indexedCfMetadata = CFMetaData.newIndexMetadata(metadata, info,
columnComparator);
         ColumnFamilyStore indexedCfs = ColumnFamilyStore.createColumnFamilyStore(table,
                                                                                  indexedCfMetadata.cfName,
                                                                                  new LocalPartitioner(metadata.getColumn_metadata().get(info.name).validator),
@@ -706,7 +711,7 @@ public class ColumnFamilyStore implement
             // submit the memtable for any indexed sub-cfses, and our own.
             List<ColumnFamilyStore> icc = new ArrayList<ColumnFamilyStore>(indexedColumns.size());
             // don't assume that this.memtable is dirty; forceFlush can bring us here during
index build even if it is not
-            for (ColumnFamilyStore cfs : Iterables.concat(Collections.singleton(this), indexedColumns.values()))
+            for (ColumnFamilyStore cfs : concatWithIndexes())
             {
                 if (!cfs.memtable.isClean())
                     icc.add(cfs);
@@ -767,7 +772,7 @@ public class ColumnFamilyStore implement
         // during index build, 2ary index memtables can be dirty even if parent is not. 
if so,
         // we want flushLargestMemtables to flush the 2ary index ones too.
         boolean clean = true;
-        for (ColumnFamilyStore cfs : Iterables.concat(Collections.singleton(this), getIndexColumnFamilyStores()))
+        for (ColumnFamilyStore cfs : concatWithIndexes())
             clean &= cfs.memtable.isClean();
 
         if (clean)
@@ -1852,7 +1857,7 @@ public class ColumnFamilyStore implement
             {
                 // putting markCompacted on the commitlogUpdater thread ensures it will run
                 // after any compactions that were in progress when truncate was called,
are finished
-                for (ColumnFamilyStore cfs : Iterables.concat(indexedColumns.values(), Arrays.asList(ColumnFamilyStore.this)))
+                for (ColumnFamilyStore cfs : concatWithIndexes())
                 {
                     List<SSTableReader> truncatedSSTables = new ArrayList<SSTableReader>();
                     for (SSTableReader sstable : cfs.getSSTables())
@@ -1956,11 +1961,6 @@ public class ColumnFamilyStore implement
         return indexedColumns.get(column);
     }
 
-    public Collection<ColumnFamilyStore> getIndexColumnFamilyStores()
-    {
-        return indexedColumns.values();
-    }
-
     public ColumnFamily newIndexedColumnFamily(ByteBuffer column)
     {
         return ColumnFamily.create(indexedColumns.get(column).metadata);
@@ -2192,4 +2192,9 @@ public class ColumnFamilyStore implement
     {
         return new SSTableWriter(getTempSSTablePath(location), estimatedRows, metadata, partitioner);
     }
+
+    public Iterable<ColumnFamilyStore> concatWithIndexes()
+    {
+        return Iterables.concat(Collections.singleton(this), indexedColumns.values());
+    }
 }

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java?rev=1080718&r1=1080717&r2=1080718&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
Fri Mar 11 18:39:13 2011
@@ -2198,7 +2198,7 @@ public class StorageService implements I
         {
             long ops = 0;
             long throughput = 0;
-            for (ColumnFamilyStore subordinate : Iterables.concat(Collections.singleton(cfs),
cfs.getIndexColumnFamilyStores()))
+            for (ColumnFamilyStore subordinate : cfs.concatWithIndexes())
             {
                 ops += subordinate.getMemtableColumnsCount();
                 throughput = subordinate.getMemtableThroughputInMB();



Mime
View raw message