diff --git a/src/java/org/apache/cassandra/db/ReadCommand.java b/src/java/org/apache/cassandra/db/ReadCommand.java index f5f9105602ab..a47dc5cd72a1 100644 --- a/src/java/org/apache/cassandra/db/ReadCommand.java +++ b/src/java/org/apache/cassandra/db/ReadCommand.java @@ -644,12 +644,15 @@ public Row applyToStatic(Row row) public Row applyToRow(Row row) { boolean hasTombstones = false; - for (Cell cell : row.cells()) + if (row.hasDeletion(ReadCommand.this.nowInSec())) // perf optimization, to avoid iteration if all cells are alive { - if (!cell.isLive(ReadCommand.this.nowInSec())) + for (Cell cell : row.cells()) { - countTombstone(row.clustering()); - hasTombstones = true; // allows to avoid counting an extra tombstone if the whole row expired + if (!cell.isLive(ReadCommand.this.nowInSec())) + { + countTombstone(row.clustering()); + hasTombstones = true; // allows to avoid counting an extra tombstone if the whole row expired + } } }