cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [20/22] git commit: debug logging
Date Sat, 26 May 2012 05:25:46 GMT
debug logging


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/99ad7d60
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/99ad7d60
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/99ad7d60

Branch: refs/heads/cassandra-1.0
Commit: 99ad7d60012c05e98754ca8c5730d865ffe024e8
Parents: 00a5534
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Fri May 25 16:15:19 2012 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Fri May 25 16:15:19 2012 -0500

----------------------------------------------------------------------
 .../db/compaction/AbstractCompactionTask.java      |    5 +++++
 .../cassandra/db/compaction/CompactionManager.java |   12 ++++++++++++
 .../cassandra/db/compaction/LeveledManifest.java   |   10 +++++++---
 .../compaction/SizeTieredCompactionStrategy.java   |    3 ++-
 4 files changed, 26 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/99ad7d60/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java
index dbcd8cd..1449c87 100644
--- a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java
+++ b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java
@@ -84,4 +84,9 @@ public abstract class AbstractCompactionTask
     // Can be overriden for action that need to be performed if the task won't
     // execute (if sstable can't be marked successfully)
     protected void cancel() {}
+
+    public String toString()
+    {
+        return "CompactionTask(" + sstables + ")";
+    }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/99ad7d60/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index 55fab3c..872ce0b 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@ -111,6 +111,10 @@ public class CompactionManager implements CompactionManagerMBean
      */
     public Future<Integer> submitBackground(final ColumnFamilyStore cfs)
     {
+        logger.debug("Scheduling a background task check for {}.{} with {}",
+                     new Object[] {cfs.table.name,
+                                   cfs.columnFamily,
+                                   cfs.getCompactionStrategy().getClass().getSimpleName()});
         Callable<Integer> callable = new Callable<Integer>()
         {
             public Integer call() throws IOException
@@ -118,16 +122,24 @@ public class CompactionManager implements CompactionManagerMBean
                 compactionLock.readLock().lock();
                 try
                 {
+                    logger.debug("Checking {}.{}", cfs.table.name, cfs.columnFamily); //
log after we get the lock so we can see delays from that if any
                     if (!cfs.isValid())
+                    {
+                        logger.debug("Aborting compaction for dropped CF");
                         return 0;
+                    }
 
                     boolean taskExecuted = false;
                     AbstractCompactionStrategy strategy = cfs.getCompactionStrategy();
                     List<AbstractCompactionTask> tasks = strategy.getBackgroundTasks(getDefaultGcBefore(cfs));
+                    logger.debug("{} minor compaction tasks available", tasks.size());
                     for (AbstractCompactionTask task : tasks)
                     {
                         if (!task.markSSTablesForCompaction())
+                        {
+                            logger.debug("Skipping {}; sstables are busy", task);
                             continue;
+                        }
 
                         taskExecuted = true;
                         try

http://git-wip-us.apache.org/repos/asf/cassandra/blob/99ad7d60/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
index 4e13640..7e06848 100644
--- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
+++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
@@ -448,13 +448,17 @@ public class LeveledManifest
     public synchronized int getEstimatedTasks()
     {
         long tasks = 0;
+        long[] estimated = new long[generations.length];
+
         for (int i = generations.length - 1; i >= 0; i--)
         {
             List<SSTableReader> sstables = generations[i];
-            long n = Math.max(0L, SSTableReader.getTotalBytes(sstables) - maxBytesForLevel(i))
/ (maxSSTableSizeInMB * 1024 * 1024);
-            logger.debug("Estimating " + n + " compaction tasks in level " + i);
-            tasks += n;
+            estimated[i] = Math.max(0L, SSTableReader.getTotalBytes(sstables) - maxBytesForLevel(i))
/ (maxSSTableSizeInMB * 1024 * 1024);
+            tasks += estimated[i];
         }
+
+        logger.debug("Estimating {} compactions to do for {}.{}",
+                     new Object[] {Arrays.asList(estimated), cfs.table.name, cfs.columnFamily});
         return Ints.checkedCast(tasks);
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/99ad7d60/src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategy.java
b/src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategy.java
index 6f6adbc..15cc01d 100644
--- a/src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategy.java
+++ b/src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategy.java
@@ -53,11 +53,12 @@ public class SizeTieredCompactionStrategy extends AbstractCompactionStrategy
         if (cfs.isCompactionDisabled())
         {
             logger.debug("Compaction is currently disabled.");
-            return Collections.<AbstractCompactionTask>emptyList();
+            return Collections.emptyList();
         }
 
         List<AbstractCompactionTask> tasks = new LinkedList<AbstractCompactionTask>();
         List<List<SSTableReader>> buckets = getBuckets(createSSTableAndLengthPairs(cfs.getSSTables()),
minSSTableSize);
+        logger.debug("Compaction buckets are {}", buckets);
 
         for (List<SSTableReader> bucket : buckets)
         {


Mime
View raw message