mirror of https://github.com/apache/cassandra
Avoid Cell iterator for alive rows in MetricsRecording transformation of ReadCommand
patch by Dmitry Konstantinov; reviewed by Francisco Guerrero for CASSANDRA-21288
This commit is contained in:
parent
536504969c
commit
9bcdf5d746
|
|
@ -1,4 +1,5 @@
|
|||
6.0-alpha2
|
||||
* Avoid Cell iterator for alive rows in MetricsRecording transformation of ReadCommand (CASSANDRA-21288)
|
||||
* Reuse a single TrackedDataInputPlus instance per UnfilteredSerializer (CASSANDRA-21296)
|
||||
* In-tree docs are included in binary artifacts (tarball, deb, rpm) as html and man pages (CASSANDRA-17260)
|
||||
* Add tooling to repair system peers and peers_v2 if inconsistent with cluster metadata (CASSANDRA-21187)
|
||||
|
|
|
|||
|
|
@ -644,19 +644,24 @@ public abstract class ReadCommand extends AbstractReadQuery
|
|||
public Row applyToRow(Row row)
|
||||
{
|
||||
boolean hasTombstones = false;
|
||||
for (Cell<?> cell : row.cells())
|
||||
final long nowInSec = ReadCommand.this.nowInSec();
|
||||
final boolean rowHasDeletion = row.hasDeletion(nowInSec);
|
||||
if (rowHasDeletion) // 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(nowInSec))
|
||||
{
|
||||
countTombstone(row.clustering());
|
||||
hasTombstones = true; // allows to avoid counting an extra tombstone if the whole row expired
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (row.hasLiveData(ReadCommand.this.nowInSec(), enforceStrictLiveness))
|
||||
if (row.hasLiveData(nowInSec, enforceStrictLiveness))
|
||||
++liveRows;
|
||||
else if (!row.primaryKeyLivenessInfo().isLive(ReadCommand.this.nowInSec())
|
||||
&& row.hasDeletion(ReadCommand.this.nowInSec())
|
||||
else if (!row.primaryKeyLivenessInfo().isLive(nowInSec)
|
||||
&& rowHasDeletion
|
||||
&& !hasTombstones)
|
||||
{
|
||||
// We're counting primary key deletions only here.
|
||||
|
|
|
|||
Loading…
Reference in New Issue