cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r817927 - in /incubator/cassandra/trunk/src/java/org/apache/cassandra/db: BinaryMemtable.java ColumnFamilyStore.java CommitLog.java Memtable.java
Date Wed, 23 Sep 2009 01:57:28 GMT
Author: jbellis
Date: Wed Sep 23 01:57:27 2009
New Revision: 817927

URL: http://svn.apache.org/viewvc?rev=817927&view=rev
Log:
r/m unused commitlogcontext arg to flush. synchronize getTempSSTablePath
patch by jbellis; reviewed by goffinet for CASSANDRA-401

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtable.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtable.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtable.java?rev=817927&r1=817926&r2=817927&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtable.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtable.java Wed Sep
23 01:57:27 2009
@@ -134,7 +134,7 @@
     */
     void flush() throws IOException
     {
-        if ( columnFamilies_.size() == 0 )
+        if (columnFamilies_.size() == 0)
             return;
 
         /*
@@ -146,20 +146,8 @@
         SSTableWriter writer;
         ColumnFamilyStore cfStore = Table.open(table_).getColumnFamilyStore(cfName_);
         List<DecoratedKey> keys = new ArrayList<DecoratedKey>( columnFamilies_.keySet()
);
-        /*
-            Adding a lock here so data directories are evenly used. By default currentIndex
-            is incremented, not an AtomicInteger. Let's fix this!
-         */
-        lock_.lock();
-        try
-        {
-            path = cfStore.getTempSSTablePath();
-            writer = new SSTableWriter(path, keys.size(), StorageService.getPartitioner());
-        }
-        finally
-        {
-            lock_.unlock();
-        }
+        path = cfStore.getTempSSTablePath();
+        writer = new SSTableWriter(path, keys.size(), StorageService.getPartitioner());
 
         Collections.sort(keys, partitioner_.getDecoratedKeyObjComparator());
 

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=817927&r1=817926&r2=817927&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Wed
Sep 23 01:57:27 2009
@@ -310,7 +310,7 @@
      * When the sstable object is closed, it will be renamed to a non-temporary
      * format, so incomplete sstables can be recognized and removed on startup.
      */
-    String getTempSSTablePath()
+    synchronized String getTempSSTablePath()
     {
         String fname = getTempSSTableFileName();
         return new File(DatabaseDescriptor.getDataFileLocationForTable(table_), fname).getAbsolutePath();
@@ -343,7 +343,7 @@
             logger_.info(columnFamily_ + " has reached its threshold; switching in a fresh
Memtable");
             oldMemtable.freeze();
             getMemtablesPendingFlushNotNull(columnFamily_).add(oldMemtable); // it's ok for
the MT to briefly be both active and pendingFlush
-            final Future<?> future = submitFlush(oldMemtable, ctx);
+            final Future<?> future = submitFlush(oldMemtable);
             memtable_ = new Memtable(table_, columnFamily_);
             // a second executor that makes sure the onMemtableFlushes get called in the
right order,
             // while keeping the wait-for-flush (future.get) out of anything latency-sensitive.
@@ -888,7 +888,7 @@
     }
 
     /* Submit memtables to be flushed to disk */
-    private static Future<?> submitFlush(final Memtable memtable, final CommitLog.CommitLogContext
cLogCtx)
+    private static Future<?> submitFlush(final Memtable memtable)
     {
         logger_.info("Enqueuing flush of " + memtable);
         return flusher_.submit(new Runnable()
@@ -897,7 +897,7 @@
             {
                 try
                 {
-                    memtable.flush(cLogCtx);
+                    memtable.flush();
                 }
                 catch (IOException e)
                 {

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java?rev=817927&r1=817926&r2=817927&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java Wed Sep 23 01:57:27
2009
@@ -81,7 +81,6 @@
 
     public static final class CommitLogContext
     {
-        static CommitLogContext NULL = new CommitLogContext(null, -1L);
         /* Commit Log associated with this operation */
         public final String file;
         /* Offset within the Commit Log where this row as added */

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java?rev=817927&r1=817926&r2=817927&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java Wed Sep 23 01:57:27
2009
@@ -171,7 +171,7 @@
      *  only the recover code should call this. */
     void flushOnRecovery() throws IOException {
         if (!isClean())
-            flush(CommitLog.CommitLogContext.NULL);
+            flush();
     }
 
     // for debugging
@@ -187,7 +187,7 @@
         return builder.toString();
     }
 
-    void flush(CommitLog.CommitLogContext cLogCtx) throws IOException
+    void flush() throws IOException
     {
         logger_.info("Flushing " + this);
         ColumnFamilyStore cfStore = Table.open(table_).getColumnFamilyStore(cfName_);



Mime
View raw message