Example usage for org.apache.cassandra.db ColumnFamilyStoreMBean estimateKeys

List of usage examples for org.apache.cassandra.db ColumnFamilyStoreMBean estimateKeys

Introduction

In this page you can find the example usage for org.apache.cassandra.db ColumnFamilyStoreMBean estimateKeys.

Prototype

public long estimateKeys();

Source Link

Usage

From source file:edu.tsinghua.software.cassandra.tools.ClusterManager.java

License:Apache License

public int getEstimateRowNumber(String keyspace, String columnFamily) {
    int number = -1;
    ArrayList<KsStats> ksStatsList = printColumnFamilyStats();

    for (KsStats ksStats : ksStatsList) {
        if (keyspace.equals(ksStats.getKsName())) {
            List<ColumnFamilyStoreMBean> columnFamilies = ksStats.getColumnFamilies();
            for (ColumnFamilyStoreMBean cfstore : columnFamilies) {
                if (columnFamily.endsWith(cfstore.getColumnFamilyName())) {
                    number = (int) cfstore.estimateKeys();
                }// w w w.  j a v a 2s .c o  m
            }
        }
    }
    return number;
}

From source file:org.wso2.carbon.cassandra.cluster.mgt.query.ClusterMBeanServiceHandler.java

License:Open Source License

private ColumnFamilyInformation getColumnFamilyStats(ColumnFamilyStoreMBean cfsProxy) {
    ColumnFamilyInformation columnFamilyInformation = new ColumnFamilyInformation();
    columnFamilyInformation.setColumnFamilyName(cfsProxy.getColumnFamilyName());
    columnFamilyInformation.setSSTableCount(cfsProxy.getLiveSSTableCount());
    columnFamilyInformation.setLiveDiskSpaceUsed(cfsProxy.getLiveDiskSpaceUsed());
    columnFamilyInformation.setTotalDiskSpaceUsed(cfsProxy.getTotalDiskSpaceUsed());
    columnFamilyInformation.setNumberOfKeys(cfsProxy.estimateKeys());
    columnFamilyInformation.setMemtableSwitchCount(cfsProxy.getMemtableSwitchCount());
    columnFamilyInformation.setReadCount(cfsProxy.getReadCount());
    columnFamilyInformation.setReadLatency(cfsProxy.getRecentReadLatencyMicros());
    columnFamilyInformation.setWriteCount(cfsProxy.getWriteCount());
    columnFamilyInformation.setWriteLatency(cfsProxy.getRecentWriteLatencyMicros());
    columnFamilyInformation.setPendingTasks(cfsProxy.getPendingTasks());
    columnFamilyInformation.setBloomFilterFalsePostives(cfsProxy.getBloomFilterFalsePositives());
    columnFamilyInformation.setBloomFilterFalseRatio(cfsProxy.getRecentBloomFilterFalseRatio());
    columnFamilyInformation.setBloomFilterSpaceUsed(cfsProxy.getBloomFilterDiskSpaceUsed());
    columnFamilyInformation.setCompactedRowMinimumSize(cfsProxy.getMinRowSize());
    columnFamilyInformation.setCompactedRowMeanSize(cfsProxy.getMaxRowSize());
    columnFamilyInformation.setCompactedRowMeanSize(cfsProxy.getMeanRowSize());
    return columnFamilyInformation;
}