cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1073900 - in /cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db: BinaryMemtable.java ColumnFamilyStore.java CompactionManager.java Memtable.java
Date Wed, 23 Feb 2011 19:38:45 GMT
Author: jbellis
Date: Wed Feb 23 19:38:44 2011
New Revision: 1073900

URL: http://svn.apache.org/viewvc?rev=1073900&view=rev
Log:
add CFS.createFlushWriter/createCompactionWriter

Modified:
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/BinaryMemtable.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/CompactionManager.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/Memtable.java

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/BinaryMemtable.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/BinaryMemtable.java?rev=1073900&r1=1073899&r2=1073900&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/BinaryMemtable.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/BinaryMemtable.java
Wed Feb 23 19:38:44 2011
@@ -125,8 +125,7 @@ public class BinaryMemtable implements I
     private SSTableReader writeSortedContents(List<DecoratedKey> sortedKeys) throws
IOException
     {
         logger.info("Writing " + this);
-        String path = cfs.getFlushPath();
-        SSTableWriter writer = new SSTableWriter(path, sortedKeys.size(), cfs.metadata, cfs.partitioner);
+        SSTableWriter writer = cfs.createFlushWriter(sortedKeys.size());
 
         for (DecoratedKey key : sortedKeys)
         {

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=1073900&r1=1073899&r2=1073900&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
Wed Feb 23 19:38:44 2011
@@ -2063,4 +2063,14 @@ public class ColumnFamilyStore implement
             ssTables.getKeyCache().setCapacity(newCapacity);
         }
     }
+
+    public SSTableWriter createFlushWriter(long estimatedRows) throws IOException
+    {
+        return new SSTableWriter(getFlushPath(), estimatedRows, metadata, partitioner);
+    }
+
+    public SSTableWriter createCompactionWriter(long estimatedRows, String location) throws
IOException
+    {
+        return new SSTableWriter(getTempSSTablePath(location), estimatedRows, metadata, partitioner);
+    }
 }

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/CompactionManager.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/CompactionManager.java?rev=1073900&r1=1073899&r2=1073900&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/CompactionManager.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/CompactionManager.java
Wed Feb 23 19:38:44 2011
@@ -444,8 +444,7 @@ public class CompactionManager implement
                 return 0;
             }
 
-            String newFilename = new File(cfs.getTempSSTablePath(compactionFileLocation)).getAbsolutePath();
-            writer = new SSTableWriter(newFilename, expectedBloomFilterSize, cfs.metadata,
cfs.partitioner);
+            writer = cfs.createCompactionWriter(expectedBloomFilterSize, compactionFileLocation);
             while (nni.hasNext())
             {
                 AbstractCompactedRow row = nni.next();
@@ -706,8 +705,7 @@ public class CompactionManager implement
         if (writer == null)
         {
             FileUtils.createDirectory(compactionFileLocation);
-            String newFilename = new File(cfs.getTempSSTablePath(compactionFileLocation)).getAbsolutePath();
-            writer = new SSTableWriter(newFilename, expectedBloomFilterSize, cfs.metadata,
cfs.partitioner);
+            writer = cfs.createCompactionWriter(expectedBloomFilterSize, compactionFileLocation);
         }
         return writer;
     }

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/Memtable.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/Memtable.java?rev=1073900&r1=1073899&r2=1073900&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/Memtable.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/Memtable.java Wed Feb
23 19:38:44 2011
@@ -155,7 +155,7 @@ public class Memtable implements Compara
     private SSTableReader writeSortedContents() throws IOException
     {
         logger.info("Writing " + this);
-        SSTableWriter writer = new SSTableWriter(cfs.getFlushPath(), columnFamilies.size(),
cfs.metadata, cfs.partitioner);
+        SSTableWriter writer = cfs.createFlushWriter(columnFamilies.size());
 
         for (Map.Entry<DecoratedKey, ColumnFamily> entry : columnFamilies.entrySet())
             writer.append(entry.getKey(), entry.getValue());



Mime
View raw message