disable per-row tracing for index scans
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/015358c1 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/015358c1 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/015358c1 Branch: refs/heads/trunk Commit: 015358c178da70046c2cb9cadc4b39b0142de6c4 Parents: 2fb5e2e Author: Jonathan Ellis <jbel...@apache.org> Authored: Sat Nov 3 13:22:04 2012 -0500 Committer: Jonathan Ellis <jbel...@apache.org> Committed: Sat Nov 3 13:24:46 2012 -0500 ---------------------------------------------------------------------- .../org/apache/cassandra/db/ColumnFamilyStore.java | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/015358c1/src/java/org/apache/cassandra/db/ColumnFamilyStore.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java index a99f540..1338d91 100644 --- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java +++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java @@ -35,6 +35,8 @@ import com.google.common.collect.Sets; import com.google.common.util.concurrent.Futures; import org.apache.cassandra.db.filter.IDiskAtomFilter; +import org.apache.cassandra.tracing.TraceState; +import org.apache.cassandra.tracing.Tracing; import org.cliffc.high_scale_lib.NonBlockingHashMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1459,6 +1461,13 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean List<Row> rows = new ArrayList<Row>(); int columnsCount = 0; int total = 0, matched = 0; + + // disable tracing for the actual scan; otherwise it will log a full trace for each row fetched + // -- since index only contains the key, we have to do a "join" on the main table to get the actual data. + // this could be useful but it obscures the most important information which is the scanned:matched ratio. + TraceState state = Tracing.instance().get(); + Tracing.instance().set(null); + try { while (rowIterator.hasNext() && rows.size() < filter.maxRows() && columnsCount < filter.maxColumns()) @@ -1496,7 +1505,6 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean filter.updateFilter(columnsCount); } - logger.debug("Scanned {} rows and matched {}", total, matched); return rows; } finally @@ -1504,6 +1512,9 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean try { rowIterator.close(); + // re-enable tracing + Tracing.instance().set(state); + logger.debug("Scanned {} rows and matched {}", total, matched); } catch (IOException e) {