Merge branch 'cassandra-1.1' into cassandra-1.2

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

Branch: refs/heads/trunk
Commit: 361aca59f9adc58b9b6b3af32e3e4647b6d86f4d
Parents: 0d30c8c 9828c63
Author: Dave Brosius <dbros...@apache.org>
Authored: Fri Feb 15 01:35:56 2013 -0500
Committer: Dave Brosius <dbros...@apache.org>
Committed: Fri Feb 15 01:35:56 2013 -0500

----------------------------------------------------------------------
 .../cassandra/db/compaction/CompactionTask.java    |   49 ++++++++-------
 1 files changed, 26 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/361aca59/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/compaction/CompactionTask.java
index 3893f1c,02d20cf..3d5aebf
--- a/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
@@@ -240,31 -215,25 +240,34 @@@ public class CompactionTask extends Abs
                 sstable.cacheKey(entry.getKey(), entry.getValue());
          }
  
-         // log a bunch of statistics about the result
-         long dTime = System.currentTimeMillis() - startTime;
-         long startsize = SSTable.getTotalBytes(toCompact);
-         long endsize = SSTable.getTotalBytes(sstables);
-         double ratio = (double)endsize / (double)startsize;
- 
-         StringBuilder builder = new StringBuilder();
-         for (SSTableReader reader : sstables)
-             builder.append(reader.descriptor.baseFilename()).append(",");
- 
-         double mbps = dTime > 0 ? 
(double)endsize/(1024*1024)/((double)dTime/1000) : 0;
-         long totalSourceRows = 0;
-         String mergeSummary = "";
-         long[] counts = ci.getMergedRowCounts();
-         for (int i = 0; i < counts.length; i++)
+         if (logger.isInfoEnabled())
          {
-             int rows = i + 1;
-             long count = counts[i];
-             totalSourceRows += rows * count;
-             mergeSummary += String.format("%d:%d, ", rows, count);
-         }
++            // log a bunch of statistics about the result
+             long dTime = System.currentTimeMillis() - startTime;
+             long startsize = SSTable.getTotalBytes(toCompact);
+             long endsize = SSTable.getTotalBytes(sstables);
+             double ratio = (double)endsize / (double)startsize;
+ 
+             StringBuilder builder = new StringBuilder();
 -            builder.append("[");
+             for (SSTableReader reader : sstables)
 -                builder.append(reader.getFilename()).append(",");
 -            builder.append("]");
++                builder.append(reader.descriptor.baseFilename()).append(",");
+ 
+             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 %fMB/s.  Time: %,dms.",
 -                                      builder.toString(), startsize, endsize, 
(int) (ratio * 100), totalkeysWritten, mbps, dTime));
++            long totalSourceRows = 0;
++            long[] counts = ci.getMergedRowCounts();
++            StringBuilder mergeSummary = new StringBuilder(counts.length * 
10);
++            for (int i = 0; i < counts.length; i++)
++            {
++                int rows = i + 1;
++                long count = counts[i];
++                totalSourceRows += rows * count;
++                mergeSummary.append(String.format("%d:%d, ", rows, count));
++            }
 +
-         logger.info(String.format("Compacted %d sstables to [%s].  %,d bytes 
to %,d (~%d%% of original) in %,dms = %fMB/s.  %,d total rows, %,d unique.  Row 
merge counts were {%s}",
-                                   toCompact.size(), builder.toString(), 
startsize, endsize, (int) (ratio * 100), dTime, mbps, totalSourceRows, 
totalkeysWritten, mergeSummary));
-         logger.debug(String.format("CF Total Bytes Compacted: %,d", 
CompactionTask.addToTotalBytesCompacted(endsize)));
++            logger.info(String.format("Compacted %d sstables to [%s].  %,d 
bytes to %,d (~%d%% of original) in %,dms = %fMB/s.  %,d total rows, %,d 
unique.  Row merge counts were {%s}",
++                                      toCompact.size(), builder.toString(), 
startsize, endsize, (int) (ratio * 100), dTime, mbps, totalSourceRows, 
totalkeysWritten, mergeSummary.toString()));
+             logger.debug(String.format("CF Total Bytes Compacted: %,d", 
CompactionTask.addToTotalBytesCompacted(endsize)));
+         }
 -        return toCompact.size();
      }
  
      protected boolean partialCompactionsAcceptable()

Reply via email to