cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1167317 - in /cassandra/branches/cassandra-1.0.0: ./ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/io/sstable/
Date Fri, 09 Sep 2011 18:11:59 GMT
Author: jbellis
Date: Fri Sep  9 18:11:58 2011
New Revision: 1167317

URL: http://svn.apache.org/viewvc?rev=1167317&view=rev
Log:
re-clone slab-allocated keys in indexsummary
patch by jbellis; reviewed by brandonwilliams for CASSANDRA-3163

Modified:
    cassandra/branches/cassandra-1.0.0/CHANGES.txt
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/MeteredFlusher.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/IndexSummary.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTable.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java

Modified: cassandra/branches/cassandra-1.0.0/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/CHANGES.txt?rev=1167317&r1=1167316&r2=1167317&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/CHANGES.txt (original)
+++ cassandra/branches/cassandra-1.0.0/CHANGES.txt Fri Sep  9 18:11:58 2011
@@ -67,7 +67,7 @@
  * fix inconsistency of the CLI syntax when {} should be used instead of [{}]
    (CASSANDRA-3119)
  * rename CQL type names to match expected SQL behavior (CASSANDRA-3149, 3031)
- * Arena-based allocation for memtables (CASSANDRA-2252, 3162)
+ * Arena-based allocation for memtables (CASSANDRA-2252, 3162, 3163)
 
 
 0.8.6

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/MeteredFlusher.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/MeteredFlusher.java?rev=1167317&r1=1167316&r2=1167317&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/MeteredFlusher.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/MeteredFlusher.java
Fri Sep  9 18:11:58 2011
@@ -59,7 +59,7 @@ class MeteredFlusher implements Runnable
                                                   / (1 + cfs.indexManager.getIndexedColumns().size()));
                 if (size > (DatabaseDescriptor.getTotalMemtableSpaceInMB() * 1048576L
- flushingBytes) / maxInFlight)
                 {
-                    logger.info("flushing high-traffic column family {}", cfs);
+                    logger.info("flushing high-traffic column family {} (estimated {} bytes)",
cfs, size);
                     cfs.forceFlush();
                 }
                 else

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/IndexSummary.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/IndexSummary.java?rev=1167317&r1=1167316&r2=1167317&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/IndexSummary.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/IndexSummary.java
Fri Sep  9 18:11:58 2011
@@ -56,9 +56,9 @@ public class IndexSummary
         return keysWritten % DatabaseDescriptor.getIndexInterval() == 0;
     }
 
-    public void addEntry(DecoratedKey<?> decoratedKey, long indexPosition)
+    public void addEntry(DecoratedKey<?> key, long indexPosition)
     {
-        indexPositions.add(new KeyPosition(decoratedKey, indexPosition));
+        indexPositions.add(new KeyPosition(SSTable.getMinimalKey(key), indexPosition));
     }
 
     public void maybeAddEntry(DecoratedKey<?> decoratedKey, long indexPosition)

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTable.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTable.java?rev=1167317&r1=1167316&r2=1167317&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTable.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTable.java
Fri Sep  9 18:11:58 2011
@@ -34,6 +34,7 @@ import org.apache.cassandra.dht.IPartiti
 import org.apache.cassandra.io.util.FileUtils;
 import org.apache.cassandra.io.util.RandomAccessReader;
 import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.HeapAllocator;
 import org.apache.cassandra.utils.Pair;
 
 /**
@@ -143,6 +144,17 @@ public abstract class SSTable
         return true;
     }
 
+    /**
+     * If the given @param key occupies only part of a larger buffer, allocate a new buffer
that is only
+     * as large as necessary.
+     */
+    public static DecoratedKey<?> getMinimalKey(DecoratedKey<?> key)
+    {
+        return key.key.position() > 0 || key.key.hasRemaining()
+                                       ? new DecoratedKey(key.token, HeapAllocator.instance.clone(key.key))
+                                       : key;
+    }
+
     public String getFilename()
     {
         return descriptor.filenameFor(COMPONENT_DATA);

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableReader.java?rev=1167317&r1=1167316&r2=1167317&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
Fri Sep  9 18:11:58 2011
@@ -127,7 +127,7 @@ public class SSTableReader extends SSTab
         assert components.contains(Component.PRIMARY_INDEX);
 
         long start = System.currentTimeMillis();
-        logger.info("Opening " + descriptor);
+        logger.info("Opening {} ({} bytes)", descriptor, new File(descriptor.filenameFor(COMPONENT_DATA)).length());
 
         SSTableMetadata sstableMetadata = components.contains(Component.STATS)
                                         ? SSTableMetadata.serializer.deserialize(descriptor)
@@ -315,8 +315,8 @@ public class SSTableReader extends SSTab
         {
             FileUtils.closeQuietly(input);
         }
-        this.first = left;
-        this.last = right;
+        this.first = getMinimalKey(left);
+        this.last = getMinimalKey(right);
 
         // finalize the state of the reader
         ifile = ibuilder.complete(descriptor.filenameFor(Component.PRIMARY_INDEX));

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java?rev=1167317&r1=1167316&r2=1167317&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
Fri Sep  9 18:11:58 2011
@@ -316,8 +316,8 @@ public class SSTableWriter extends SSTab
                                                            iwriter.bf,
                                                            maxDataAge,
                                                            sstableMetadata);
-        sstable.first = this.first;
-        sstable.last = this.last;
+        sstable.first = getMinimalKey(first);
+        sstable.last = getMinimalKey(last);
         iwriter = null;
         dbuilder = null;
         return sstable;



Mime
View raw message