cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1174766 - in /cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db: ColumnFamilyStore.java compaction/CompactionTask.java compaction/LeveledCompactionStrategy.java compaction/LeveledManifest.java
Date Fri, 23 Sep 2011 13:55:55 GMT
Author: jbellis
Date: Fri Sep 23 13:55:55 2011
New Revision: 1174766

URL: http://svn.apache.org/viewvc?rev=1174766&view=rev
Log:
cleanup LCS logging

Modified:
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1174766&r1=1174765&r2=1174766&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
Fri Sep 23 13:55:55 2011
@@ -321,7 +321,8 @@ public class ColumnFamilyStore implement
      */
     public static void scrubDataDirectories(String table, String columnFamily)
     {
-        logger.info("Removing compacted SSTable files from " + columnFamily + " (see http://wiki.apache.org/cassandra/MemtableSSTable)");
+        logger.debug("Removing compacted SSTable files from {} (see http://wiki.apache.org/cassandra/MemtableSSTable)",
columnFamily);
+
         for (Map.Entry<Descriptor,Set<Component>> sstableFiles : files(table,
columnFamily, true, true).entrySet())
         {
             Descriptor desc = sstableFiles.getKey();

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/CompactionTask.java?rev=1174766&r1=1174765&r2=1174766&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
Fri Sep 23 13:55:55 2011
@@ -72,11 +72,12 @@ public class CompactionTask extends Abst
         Set<SSTableReader> toCompact = new HashSet<SSTableReader>(sstables);
         if (!isUserDefined)
         {
-            if ( !allowSingletonCompaction() && toCompact.size() < 2)
+            if (!allowSingletonCompaction() && toCompact.size() < 2)
             {
-                logger.info("Nothing to compact in " + cfs.getColumnFamilyName() + "." +
-                            "Use forceUserDefinedCompaction if you wish to force compaction
of single sstables " +
-                            "(e.g. for tombstone collection)");
+                String msg = "Nothing to compact in " + cfs.getColumnFamilyName();
+                if (cfs.getCompactionStrategy() instanceof SizeTieredCompactionStrategy)
+                    msg += ".  Use forceUserDefinedCompaction if you wish to force compaction
of single sstables (e.g. for tombstone collection)";
+                logger.info(msg);
                 return 0;
             }
 
@@ -220,7 +221,7 @@ public class CompactionTask extends Abst
         double mbps = dTime > 0 ? (double)endsize/(1024*1024)/((double)dTime/1000) : 0;
         logger.info(String.format("Compacted to %s.  %,d to %,d (~%d%% of original) bytes
for %,d keys at %fMBPS.  Time: %,dms.",
                                   builder.toString(), startsize, endsize, (int) (ratio *
100), totalkeysWritten, mbps, dTime));
-        logger.info(String.format("CF Total Bytes Compacted: %,d", CompactionTask.addToTotalBytesCompacted(endsize)));
+        logger.debug(String.format("CF Total Bytes Compacted: %,d", CompactionTask.addToTotalBytesCompacted(endsize)));
         return toCompact.size();
     }
 

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java?rev=1174766&r1=1174765&r2=1174766&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java
Fri Sep 23 13:55:55 2011
@@ -71,7 +71,7 @@ public class LeveledCompactionStrategy e
         maxSSTableSizeInMB = configuredMaxSSTableSize;
 
         cfs.getDataTracker().subscribe(this);
-        logger.info(this + " subscribed to the data tracker.");
+        logger.debug("{} subscribed to the data tracker.", this);
 
         manifest = LeveledManifest.create(cfs, this.maxSSTableSizeInMB);
         logger.debug("Created {}", manifest);

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java?rev=1174766&r1=1174765&r2=1174766&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
Fri Sep 23 13:55:55 2011
@@ -135,14 +135,16 @@ public class LeveledManifest
         serialize();
     }
 
-    // if the number of SSTables in the current compacted set exeeds the target level, find
an empty level
+    /**
+     * if the number of SSTables in the current compacted set *by itself* exeeds the target
level's
+     * (regardless of the level's current contents), find an empty level instead
+     */
     private int skipLevels(int newLevel, Iterable<SSTableReader> added)
     {
-        // skip newlevel if the resulting sstables exceed newlevel threshold
-        if (maxBytesForLevel(newLevel) < SSTableReader.getTotalBytes(added)
-            && SSTableReader.getTotalBytes(generations[(newLevel + 1)]) == 0)
+        while (maxBytesForLevel(newLevel) < SSTableReader.getTotalBytes(added)
+            && generations[(newLevel + 1)].isEmpty())
         {
-            newLevel = skipLevels(newLevel + 1, added);
+            newLevel++;
         }
         return newLevel;
     }
@@ -171,7 +173,8 @@ public class LeveledManifest
         int newLevel = minimumLevel == maximumLevel ? maximumLevel + 1 : maximumLevel;
         newLevel = skipLevels(newLevel, added);
         assert newLevel > 0;
-        logger.debug("Adding [{}] at L{}", StringUtils.join(added.iterator(), ", "), newLevel);
+        if (logger.isDebugEnabled())
+            logger.debug("Adding [{}] at L{}", toString(added), newLevel);
 
         lastCompactedKeys[minimumLevel] = SSTable.sstableOrdering.max(added).last;
         for (SSTableReader ssTableReader : added)
@@ -185,7 +188,12 @@ public class LeveledManifest
         StringBuilder builder = new StringBuilder();
         for (SSTableReader sstable : sstables)
         {
-            builder.append(sstable.toString()).append(" (L").append(levelOf(sstable)).append("),
");
+            builder.append(sstable.descriptor.cfname)
+                   .append('-')
+                   .append(sstable.descriptor.generation)
+                   .append("(L")
+                   .append(levelOf(sstable))
+                   .append("), ");
         }
         return builder.toString();
     }
@@ -383,7 +391,7 @@ public class LeveledManifest
             File manifestFile = new File(new File(dir, cfs.table.name), cfs.columnFamily
+ ".json");
             if (manifestFile.exists())
             {
-                logger.debug("Loading manifest from {}", manifestFile);
+                logger.debug("Found manifest at {}", manifestFile);
                 return manifestFile;
             }
         }



Mime
View raw message