This is an automated email from the ASF dual-hosted git repository.

benedict pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit db2ad0f7c59d9deb1f8755858cd630d640c5baa9
Author: Jordan West <jorda...@gmail.com>
AuthorDate: Mon Aug 19 10:10:37 2019 -0700

    Rename StatsMetadata estimatedColumnCount to estimatedCellPerPartitionCount
    
    patch by Jordan West; reviewed by Benedict for CASSANDRA-15285
---
 .../org/apache/cassandra/db/ColumnFamilyStore.java   |  8 ++++----
 .../db/columniterator/SSTableReversedIterator.java   |  2 +-
 .../db/compaction/AbstractCompactionStrategy.java    |  6 ++----
 .../org/apache/cassandra/db/filter/DataLimits.java   |  2 +-
 .../cassandra/index/SecondaryIndexManager.java       |  4 +---
 .../cassandra/io/sstable/format/SSTableReader.java   |  4 ++--
 .../cassandra/io/sstable/metadata/StatsMetadata.java | 20 ++++++++++----------
 .../org/apache/cassandra/metrics/TableMetrics.java   |  2 +-
 .../cassandra/tools/SSTableMetadataViewer.java       |  2 +-
 .../index/internal/CustomCassandraIndex.java         |  3 +--
 10 files changed, 24 insertions(+), 29 deletions(-)

diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java 
b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 2ef5a76..075ebac 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -2380,14 +2380,14 @@ public class ColumnFamilyStore implements 
ColumnFamilyStoreMBean
 
     // End JMX get/set.
 
-    public int getMeanColumns()
+    public int getMeanEstimatedCellPerPartitionCount()
     {
         long sum = 0;
         long count = 0;
         for (SSTableReader sstable : getSSTables(SSTableSet.CANONICAL))
         {
-            long n = sstable.getEstimatedColumnCount().count();
-            sum += sstable.getEstimatedColumnCount().mean() * n;
+            long n = sstable.getEstimatedCellPerPartitionCount().count();
+            sum += sstable.getEstimatedCellPerPartitionCount().mean() * n;
             count += n;
         }
         return count > 0 ? (int) (sum / count) : 0;
@@ -2559,7 +2559,7 @@ public class ColumnFamilyStore implements 
ColumnFamilyStoreMBean
         for (SSTableReader sstable : getSSTables(SSTableSet.LIVE))
         {
             allDroppable += sstable.getDroppableTombstonesBefore(localTime - 
metadata().params.gcGraceSeconds);
-            allColumns += sstable.getEstimatedColumnCount().mean() * 
sstable.getEstimatedColumnCount().count();
+            allColumns += sstable.getEstimatedCellPerPartitionCount().mean() * 
sstable.getEstimatedCellPerPartitionCount().count();
         }
         return allColumns > 0 ? allDroppable / allColumns : 0;
     }
diff --git 
a/src/java/org/apache/cassandra/db/columniterator/SSTableReversedIterator.java 
b/src/java/org/apache/cassandra/db/columniterator/SSTableReversedIterator.java
index 60a6f70..1e1030c 100644
--- 
a/src/java/org/apache/cassandra/db/columniterator/SSTableReversedIterator.java
+++ 
b/src/java/org/apache/cassandra/db/columniterator/SSTableReversedIterator.java
@@ -108,7 +108,7 @@ public class SSTableReversedIterator extends 
AbstractSSTableIterator
                     // FIXME: so far we only keep stats on cells, so to get a 
rough estimate on the number of rows,
                     // we divide by the number of regular columns the table 
has. We should fix once we collect the
                     // stats on rows
-                    int estimatedRowsPerPartition = 
(int)(sstable.getEstimatedColumnCount().percentile(0.75) / columnCount);
+                    int estimatedRowsPerPartition = 
(int)(sstable.getEstimatedCellPerPartitionCount().percentile(0.75) / 
columnCount);
                     estimatedRowCount = Math.max(estimatedRowsPerPartition / 
blocksCount, 1);
                 }
                 catch (IllegalStateException e)
diff --git 
a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java 
b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
index 74c154d..ad494b1 100644
--- 
a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
+++ 
b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
@@ -21,8 +21,6 @@ import java.util.*;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.ImmutableMap;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
 
 import org.apache.cassandra.db.Directories;
 import org.apache.cassandra.db.SerializationHeader;
@@ -412,8 +410,8 @@ public abstract class AbstractCompactionStrategy
                 ranges.add(new Range<>(overlap.first.getToken(), 
overlap.last.getToken()));
             long remainingKeys = keys - sstable.estimatedKeysForRanges(ranges);
             // next, calculate what percentage of columns we have within those 
keys
-            long columns = sstable.getEstimatedColumnCount().mean() * 
remainingKeys;
-            double remainingColumnsRatio = ((double) columns) / 
(sstable.getEstimatedColumnCount().count() * 
sstable.getEstimatedColumnCount().mean());
+            long columns = sstable.getEstimatedCellPerPartitionCount().mean() 
* remainingKeys;
+            double remainingColumnsRatio = ((double) columns) / 
(sstable.getEstimatedCellPerPartitionCount().count() * 
sstable.getEstimatedCellPerPartitionCount().mean());
 
             // return if we still expect to have droppable tombstones in rest 
of columns
             return remainingColumnsRatio * droppableRatio > tombstoneThreshold;
diff --git a/src/java/org/apache/cassandra/db/filter/DataLimits.java 
b/src/java/org/apache/cassandra/db/filter/DataLimits.java
index 246cc08..3a766e0 100644
--- a/src/java/org/apache/cassandra/db/filter/DataLimits.java
+++ b/src/java/org/apache/cassandra/db/filter/DataLimits.java
@@ -446,7 +446,7 @@ public abstract class DataLimits
         {
             // TODO: we should start storing stats on the number of rows 
(instead of the number of cells, which
             // is what getMeanColumns returns)
-            float rowsPerPartition = ((float) cfs.getMeanColumns()) / 
cfs.metadata().regularColumns().size();
+            float rowsPerPartition = ((float) 
cfs.getMeanEstimatedCellPerPartitionCount()) / 
cfs.metadata().regularColumns().size();
             return rowsPerPartition * (cfs.estimateKeys());
         }
 
diff --git a/src/java/org/apache/cassandra/index/SecondaryIndexManager.java 
b/src/java/org/apache/cassandra/index/SecondaryIndexManager.java
index b37251a..60fc3ba 100644
--- a/src/java/org/apache/cassandra/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/index/SecondaryIndexManager.java
@@ -71,10 +71,8 @@ import org.apache.cassandra.schema.Indexes;
 import org.apache.cassandra.service.pager.SinglePartitionPager;
 import org.apache.cassandra.tracing.Tracing;
 import org.apache.cassandra.transport.ProtocolVersion;
-import org.apache.cassandra.utils.ExecutorUtils;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.JVMStabilityInspector;
-import org.apache.cassandra.utils.concurrent.OpOrder;
 import org.apache.cassandra.utils.concurrent.Refs;
 
 import static org.apache.cassandra.utils.ExecutorUtils.awaitTermination;
@@ -929,7 +927,7 @@ public class SecondaryIndexManager implements 
IndexRegistry, INotificationConsum
         if (meanPartitionSize <= 0)
             return DEFAULT_PAGE_SIZE;
 
-        int meanCellsPerPartition = baseCfs.getMeanColumns();
+        int meanCellsPerPartition = 
baseCfs.getMeanEstimatedCellPerPartitionCount();
         if (meanCellsPerPartition <= 0)
             return DEFAULT_PAGE_SIZE;
 
diff --git a/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java 
b/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
index aa4ca55..36a1e63 100644
--- a/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
@@ -1943,9 +1943,9 @@ public abstract class SSTableReader extends SSTable 
implements SelfRefCounted<SS
         return sstableMetadata.estimatedPartitionSize;
     }
 
-    public EstimatedHistogram getEstimatedColumnCount()
+    public EstimatedHistogram getEstimatedCellPerPartitionCount()
     {
-        return sstableMetadata.estimatedColumnCount;
+        return sstableMetadata.estimatedCellPerPartitionCount;
     }
 
     public double getEstimatedDroppableTombstoneRatio(int gcBefore)
diff --git 
a/src/java/org/apache/cassandra/io/sstable/metadata/StatsMetadata.java 
b/src/java/org/apache/cassandra/io/sstable/metadata/StatsMetadata.java
index 5d464fe..f4e5beb 100755
--- a/src/java/org/apache/cassandra/io/sstable/metadata/StatsMetadata.java
+++ b/src/java/org/apache/cassandra/io/sstable/metadata/StatsMetadata.java
@@ -47,7 +47,7 @@ public class StatsMetadata extends MetadataComponent
     public static final ISerializer<IntervalSet<CommitLogPosition>> 
commitLogPositionSetSerializer = 
IntervalSet.serializer(CommitLogPosition.serializer);
 
     public final EstimatedHistogram estimatedPartitionSize;
-    public final EstimatedHistogram estimatedColumnCount;
+    public final EstimatedHistogram estimatedCellPerPartitionCount;
     public final IntervalSet<CommitLogPosition> commitLogIntervals;
     public final long minTimestamp;
     public final long maxTimestamp;
@@ -70,7 +70,7 @@ public class StatsMetadata extends MetadataComponent
     public final EncodingStats encodingStats;
 
     public StatsMetadata(EstimatedHistogram estimatedPartitionSize,
-                         EstimatedHistogram estimatedColumnCount,
+                         EstimatedHistogram estimatedCellPerPartitionCount,
                          IntervalSet<CommitLogPosition> commitLogIntervals,
                          long minTimestamp,
                          long maxTimestamp,
@@ -91,7 +91,7 @@ public class StatsMetadata extends MetadataComponent
                          boolean isTransient)
     {
         this.estimatedPartitionSize = estimatedPartitionSize;
-        this.estimatedColumnCount = estimatedColumnCount;
+        this.estimatedCellPerPartitionCount = estimatedCellPerPartitionCount;
         this.commitLogIntervals = commitLogIntervals;
         this.minTimestamp = minTimestamp;
         this.maxTimestamp = maxTimestamp;
@@ -124,7 +124,7 @@ public class StatsMetadata extends MetadataComponent
      */
     public double getEstimatedDroppableTombstoneRatio(int gcBefore)
     {
-        long estimatedColumnCount = this.estimatedColumnCount.mean() * 
this.estimatedColumnCount.count();
+        long estimatedColumnCount = this.estimatedCellPerPartitionCount.mean() 
* this.estimatedCellPerPartitionCount.count();
         if (estimatedColumnCount > 0)
         {
             double droppable = getDroppableTombstonesBefore(gcBefore);
@@ -145,7 +145,7 @@ public class StatsMetadata extends MetadataComponent
     public StatsMetadata mutateLevel(int newLevel)
     {
         return new StatsMetadata(estimatedPartitionSize,
-                                 estimatedColumnCount,
+                                 estimatedCellPerPartitionCount,
                                  commitLogIntervals,
                                  minTimestamp,
                                  maxTimestamp,
@@ -169,7 +169,7 @@ public class StatsMetadata extends MetadataComponent
     public StatsMetadata mutateRepairedMetadata(long newRepairedAt, UUID 
newPendingRepair, boolean newIsTransient)
     {
         return new StatsMetadata(estimatedPartitionSize,
-                                 estimatedColumnCount,
+                                 estimatedCellPerPartitionCount,
                                  commitLogIntervals,
                                  minTimestamp,
                                  maxTimestamp,
@@ -199,7 +199,7 @@ public class StatsMetadata extends MetadataComponent
         StatsMetadata that = (StatsMetadata) o;
         return new EqualsBuilder()
                        .append(estimatedPartitionSize, 
that.estimatedPartitionSize)
-                       .append(estimatedColumnCount, that.estimatedColumnCount)
+                       .append(estimatedCellPerPartitionCount, 
that.estimatedCellPerPartitionCount)
                        .append(commitLogIntervals, that.commitLogIntervals)
                        .append(minTimestamp, that.minTimestamp)
                        .append(maxTimestamp, that.maxTimestamp)
@@ -225,7 +225,7 @@ public class StatsMetadata extends MetadataComponent
     {
         return new HashCodeBuilder()
                        .append(estimatedPartitionSize)
-                       .append(estimatedColumnCount)
+                       .append(estimatedCellPerPartitionCount)
                        .append(commitLogIntervals)
                        .append(minTimestamp)
                        .append(maxTimestamp)
@@ -252,7 +252,7 @@ public class StatsMetadata extends MetadataComponent
         {
             int size = 0;
             size += 
EstimatedHistogram.serializer.serializedSize(component.estimatedPartitionSize);
-            size += 
EstimatedHistogram.serializer.serializedSize(component.estimatedColumnCount);
+            size += 
EstimatedHistogram.serializer.serializedSize(component.estimatedCellPerPartitionCount);
             size += 
CommitLogPosition.serializer.serializedSize(component.commitLogIntervals.upperBound().orElse(CommitLogPosition.NONE));
             size += 8 + 8 + 4 + 4 + 4 + 4 + 8 + 8; // mix/max timestamp(long), 
min/maxLocalDeletionTime(int), min/max TTL, compressionRatio(double), 
repairedAt (long)
             size += 
TombstoneHistogram.serializer.serializedSize(component.estimatedTombstoneDropTime);
@@ -290,7 +290,7 @@ public class StatsMetadata extends MetadataComponent
         public void serialize(Version version, StatsMetadata component, 
DataOutputPlus out) throws IOException
         {
             
EstimatedHistogram.serializer.serialize(component.estimatedPartitionSize, out);
-            
EstimatedHistogram.serializer.serialize(component.estimatedColumnCount, out);
+            
EstimatedHistogram.serializer.serialize(component.estimatedCellPerPartitionCount,
 out);
             
CommitLogPosition.serializer.serialize(component.commitLogIntervals.upperBound().orElse(CommitLogPosition.NONE),
 out);
             out.writeLong(component.minTimestamp);
             out.writeLong(component.maxTimestamp);
diff --git a/src/java/org/apache/cassandra/metrics/TableMetrics.java 
b/src/java/org/apache/cassandra/metrics/TableMetrics.java
index beb6d2e..d8330cc 100644
--- a/src/java/org/apache/cassandra/metrics/TableMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/TableMetrics.java
@@ -523,7 +523,7 @@ public class TableMetrics
                                                                  {
                                                                      public 
EstimatedHistogram getHistogram(SSTableReader reader)
                                                                      {
-                                                                         
return reader.getEstimatedColumnCount();
+                                                                         
return reader.getEstimatedCellPerPartitionCount();
                                                                      }
                                                                  });
             }
diff --git a/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java 
b/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
index 8ff964f..8f7e8a5 100755
--- a/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
+++ b/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
@@ -398,7 +398,7 @@ public class SSTableMetadataViewer
                                                       String::valueOf);
             rowSize.printHistogram(out, color, unicode);
             field("Column Count", "");
-            TermHistogram cellCount = new 
TermHistogram(stats.estimatedColumnCount,
+            TermHistogram cellCount = new 
TermHistogram(stats.estimatedCellPerPartitionCount,
                                                         "Columns",
                                                         String::valueOf,
                                                         String::valueOf);
diff --git 
a/test/unit/org/apache/cassandra/index/internal/CustomCassandraIndex.java 
b/test/unit/org/apache/cassandra/index/internal/CustomCassandraIndex.java
index 1c07760..04db7f6 100644
--- a/test/unit/org/apache/cassandra/index/internal/CustomCassandraIndex.java
+++ b/test/unit/org/apache/cassandra/index/internal/CustomCassandraIndex.java
@@ -59,7 +59,6 @@ import org.apache.cassandra.io.sstable.format.SSTableReader;
 import org.apache.cassandra.schema.IndexMetadata;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.Pair;
-import org.apache.cassandra.utils.concurrent.OpOrder;
 import org.apache.cassandra.utils.concurrent.Refs;
 
 import static org.apache.cassandra.index.internal.CassandraIndex.getFunctions;
@@ -207,7 +206,7 @@ public class CustomCassandraIndex implements Index
 
     public long getEstimatedResultRows()
     {
-        return indexCfs.getMeanColumns();
+        return indexCfs.getMeanEstimatedCellPerPartitionCount();
     }
 
     /**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to