org.apache.cassandra.io.sstable.metadata

## Class MetadataCollector

- java.lang.Object
- - org.apache.cassandra.io.sstable.metadata.MetadataCollector

    public class MetadataCollector
    extends java.lang.Object

### Field Summary

Fields
`protected java.util.Set<java.lang.Integer>` `ancestors`
`protected com.clearspring.analytics.stream.cardinality.ICardinality` `cardinality` Default cardinality estimation method is to use HyperLogLog++.
`protected ReplayPosition` `commitLogLowerBound`
`protected ReplayPosition` `commitLogUpperBound`
`protected double` `compressionRatio`
`protected EstimatedHistogram` `estimatedColumnCount`
`protected EstimatedHistogram` `estimatedRowSize`
`protected StreamingHistogram` `estimatedTombstoneDropTime`
`protected boolean` `hasLegacyCounterShards`
`protected java.util.List<java.nio.ByteBuffer>` `maxColumnNames`
`protected int` `maxLocalDeletionTime`
`protected long` `maxTimestamp`
`protected java.util.List<java.nio.ByteBuffer>` `minColumnNames`
`protected long` `minTimestamp`
`static double` `NO_COMPRESSION_RATIO`
`protected int` `sstableLevel`

### Constructor Summary

Constructors
Constructor and Description
`MetadataCollector(CellNameType columnNameComparator)`
`MetadataCollector(java.lang.Iterable<SSTableReader> sstables, CellNameType columnNameComparator, int level)`
`MetadataCollector(java.lang.Iterable<SSTableReader> sstables, CellNameType columnNameComparator, int level, boolean skipAncestors)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`MetadataCollector` `addAncestor(int generation)`
`MetadataCollector` `addColumnCount(long columnCount)`
`MetadataCollector` `addCompressionRatio(long compressed, long uncompressed)` Ratio is compressed/uncompressed and it is if you have 1.x then compression isn't helping
`MetadataCollector` `addKey(java.nio.ByteBuffer key)`
`MetadataCollector` `addRowSize(long rowSize)`
`MetadataCollector` `commitLogLowerBound(ReplayPosition commitLogLowerBound)`
`MetadataCollector` `commitLogUpperBound(ReplayPosition commitLogUpperBound)`
`static StatsMetadata` `defaultStatsMetadata()`
`MetadataCollector` `estimatedColumnCount(EstimatedHistogram estimatedColumnCount)`
`MetadataCollector` `estimatedRowSize(EstimatedHistogram estimatedRowSize)`
`java.util.Map<MetadataType,MetadataComponent>` `finalizeMetadata(java.lang.String partitioner, double bloomFilterFPChance, long repairedAt)`
`MetadataCollector` `mergeTombstoneHistogram(StreamingHistogram histogram)`
`MetadataCollector` `sstableLevel(int sstableLevel)`
`MetadataCollector` `update(long rowSize, ColumnStats stats)`
`MetadataCollector` `updateHasLegacyCounterShards(boolean hasLegacyCounterShards)`
`MetadataCollector` `updateMaxColumnNames(java.util.List<java.nio.ByteBuffer> maxColumnNames)`
`MetadataCollector` `updateMaxLocalDeletionTime(int maxLocalDeletionTime)`
`MetadataCollector` `updateMaxTimestamp(long potentialMax)`
`MetadataCollector` `updateMinColumnNames(java.util.List<java.nio.ByteBuffer> minColumnNames)`
`MetadataCollector` `updateMinTimestamp(long potentialMin)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### NO_COMPRESSION_RATIO

    public static final double NO_COMPRESSION_RATIO

See Also:
  Constant Field Values

#### estimatedRowSize

    protected EstimatedHistogram estimatedRowSize

#### estimatedColumnCount

    protected EstimatedHistogram estimatedColumnCount

#### commitLogLowerBound

    protected ReplayPosition commitLogLowerBound

#### commitLogUpperBound

    protected ReplayPosition commitLogUpperBound

#### minTimestamp

    protected long minTimestamp

#### maxTimestamp

    protected long maxTimestamp

#### maxLocalDeletionTime

    protected int maxLocalDeletionTime

#### compressionRatio

    protected double compressionRatio

#### ancestors

    protected java.util.Set<java.lang.Integer> ancestors

#### estimatedTombstoneDropTime

    protected StreamingHistogram estimatedTombstoneDropTime

#### sstableLevel

    protected int sstableLevel

#### minColumnNames

    protected java.util.List<java.nio.ByteBuffer> minColumnNames

#### maxColumnNames

    protected java.util.List<java.nio.ByteBuffer> maxColumnNames

#### hasLegacyCounterShards

    protected boolean hasLegacyCounterShards

#### cardinality

    protected com.clearspring.analytics.stream.cardinality.ICardinality cardinality

Default cardinality estimation method is to use HyperLogLog++. Parameter here(p=13, sp=25) should give reasonable estimation while lowering bytes required to hold information. See CASSANDRA-5906 for detail.

### Constructor Detail

#### MetadataCollector

    public MetadataCollector(CellNameType columnNameComparator)

#### MetadataCollector

    public MetadataCollector(java.lang.Iterable<SSTableReader> sstables,
                             CellNameType columnNameComparator,
                             int level,
                             boolean skipAncestors)

#### MetadataCollector

    public MetadataCollector(java.lang.Iterable<SSTableReader> sstables,
                             CellNameType columnNameComparator,
                             int level)

### Method Detail

#### defaultStatsMetadata

    public static StatsMetadata defaultStatsMetadata()

#### addKey

    public MetadataCollector addKey(java.nio.ByteBuffer key)

#### addRowSize

    public MetadataCollector addRowSize(long rowSize)

#### addColumnCount

    public MetadataCollector addColumnCount(long columnCount)

#### mergeTombstoneHistogram

    public MetadataCollector mergeTombstoneHistogram(StreamingHistogram histogram)

#### addCompressionRatio

    public MetadataCollector addCompressionRatio(long compressed,
                                                 long uncompressed)

Ratio is compressed/uncompressed and it is if you have 1.x then compression isn't helping

#### updateMinTimestamp

    public MetadataCollector updateMinTimestamp(long potentialMin)

#### updateMaxTimestamp

    public MetadataCollector updateMaxTimestamp(long potentialMax)

#### updateMaxLocalDeletionTime

    public MetadataCollector updateMaxLocalDeletionTime(int maxLocalDeletionTime)

#### estimatedRowSize

    public MetadataCollector estimatedRowSize(EstimatedHistogram estimatedRowSize)

#### estimatedColumnCount

    public MetadataCollector estimatedColumnCount(EstimatedHistogram estimatedColumnCount)

#### commitLogLowerBound

    public MetadataCollector commitLogLowerBound(ReplayPosition commitLogLowerBound)

#### commitLogUpperBound

    public MetadataCollector commitLogUpperBound(ReplayPosition commitLogUpperBound)

#### addAncestor

    public MetadataCollector addAncestor(int generation)

#### sstableLevel

    public MetadataCollector sstableLevel(int sstableLevel)

#### updateMinColumnNames

    public MetadataCollector updateMinColumnNames(java.util.List<java.nio.ByteBuffer> minColumnNames)

#### updateMaxColumnNames

    public MetadataCollector updateMaxColumnNames(java.util.List<java.nio.ByteBuffer> maxColumnNames)

#### updateHasLegacyCounterShards

    public MetadataCollector updateHasLegacyCounterShards(boolean hasLegacyCounterShards)

#### update

    public MetadataCollector update(long rowSize,
                                    ColumnStats stats)

#### finalizeMetadata

    public java.util.Map<MetadataType,MetadataComponent> finalizeMetadata(java.lang.String partitioner,
                                                                          double bloomFilterFPChance,
                                                                          long repairedAt)