Author: jbellis
Date: Mon May  4 15:59:12 2009
New Revision: 771339

URL: http://svn.apache.org/viewvc?rev=771339&view=rev
Log:
clean up anticompaction code a little.
patch by jbellis; reveiewed by Eric Evans for CASSANDRA-78

Modified:
    
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTable.java

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=771339&r1=771338&r2=771339&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
 Mon May  4 15:59:12 2009
@@ -1027,8 +1027,6 @@
                /* in the worst case a node will be giving out alf of its data 
so we take a chance */
                expectedRangeFileSize = expectedRangeFileSize / 2;
                rangeFileLocation = 
DatabaseDescriptor.getCompactionFileLocation(expectedRangeFileSize);
-//             boolean isLoop = isLoopAround( ranges );
-//             Range maxRange = getMaxRange( ranges );
                // If the compaction file path is null that means we have no 
space left for this compaction.
                if( rangeFileLocation == null )
                {
@@ -1157,13 +1155,6 @@
                                                {
                                                        break;
                                                }
-                                           /* check if we need to continue , 
if we are done with ranges empty the queue and close all file handles and exit 
*/
-                                           //if( !isLoop && 
StorageService.token(filestruct.key).compareTo(maxRange.right()) > 0 && 
!filestruct.key.equals(""))
-                                           //{
-                                           //filestruct.reader.close();
-                                           //filestruct = null;
-                                           //break;
-                                           //}
                                    }
                                    if (!filestruct.isExhausted())
                                    {
@@ -1190,19 +1181,20 @@
                            }
                        }
                    }
+
                    if( ssTableRange != null )
                    {
-                    if ( fileList == null )
-                        fileList = new ArrayList<String>();
-                    ssTableRange.closeRename(compactedRangeBloomFilter, 
fileList);
-                    if(compactedBloomFilters != null)
+                    ssTableRange.closeRename(compactedRangeBloomFilter);
+                    if (fileList != null)
+                        fileList.add(ssTableRange.getDataFileLocation());
+                    if (compactedBloomFilters != null)
                        compactedBloomFilters.add(compactedRangeBloomFilter);
                    }
                }
         }
         catch ( Exception ex)
         {
-            logger_.warn( LogUtil.throwableToString(ex) );
+            logger_.error( LogUtil.throwableToString(ex) );
         }
         logger_.debug("Total time taken for range split   ..."
                 + (System.currentTimeMillis() - startTime));

Modified: 
incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTable.java
URL: 
http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTable.java?rev=771339&r1=771338&r2=771339&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTable.java 
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTable.java Mon 
May  4 15:59:12 2009
@@ -102,8 +102,8 @@
      */
     private static Map<String, BloomFilter> bfs_ = new Hashtable<String, 
BloomFilter>();
     /* Maintains a touched set of keys */
-    private static LinkedHashMap<String, Long> touchCache_ = new 
TouchedKeyCache(DatabaseDescriptor.getTouchKeyCacheSize());        
-    
+    private static LinkedHashMap<String, Long> touchCache_ = new 
TouchedKeyCache(DatabaseDescriptor.getTouchKeyCacheSize());
+
     /**
      * This class holds the position of a key in a block
      * and the size of the data associated with this key. 
@@ -807,24 +807,7 @@
        List<KeyPositionInfo> keyPositionInfos = 
SSTable.indexMetadataMap_.remove(tmpDataFile);                                 
        SSTable.indexMetadataMap_.put(dataFile_, keyPositionInfos);
     }
-    
-    public void closeRename(BloomFilter bf, List<String> files) throws 
IOException
-    {
-        close( bf);
-        String tmpDataFile = dataFile_;
-        String dataFileName = dataFile_.replace("-" + temporaryFile_,"");
-        File dataFile = new File(dataFile_);
-        dataFile.renameTo(new File(dataFileName));
-        dataFile_ = dataFileName;
-        /* Now repair the in memory index associated with the old name */
-        List<KeyPositionInfo> keyPositionInfos = 
SSTable.indexMetadataMap_.remove(tmpDataFile);                         
-        SSTable.indexMetadataMap_.put(dataFile_, keyPositionInfos);
-        if ( files != null )
-        {            
-            files.add(dataFile_);
-        }
-    }
-    
+
     private void close(byte[] footer, int size) throws IOException
     {
         /*


Reply via email to