debug logging

This commit is contained in:
Jonathan Ellis 2012-05-25 16:15:19 -05:00
parent 00a5534386
commit 99ad7d6001
4 changed files with 26 additions and 4 deletions

View File

@ -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 + ")";
}
}

View File

@ -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

View File

@ -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);
}
}

View File

@ -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)
{