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

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

Introduction

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

Prototype

@Deprecated
public String getColumnFamilyName();

Source Link

Usage

From source file:com.spotify.reaper.cassandra.JmxProxy.java

License:Apache License

public Set<String> getTableNamesForKeyspace(String keyspace) throws ReaperException {
    Set<String> tableNames = new HashSet<>();
    Iterator<Map.Entry<String, ColumnFamilyStoreMBean>> proxies;
    try {//from  www  .  ja v  a 2 s. c o  m
        proxies = ColumnFamilyStoreMBeanIterator.getColumnFamilyStoreMBeanProxies(mbeanServer);
    } catch (IOException | MalformedObjectNameException e) {
        e.printStackTrace();
        throw new ReaperException("failed to get ColumnFamilyStoreMBean instances from JMX");
    }
    while (proxies.hasNext()) {
        Map.Entry<String, ColumnFamilyStoreMBean> proxyEntry = proxies.next();
        String keyspaceName = proxyEntry.getKey();
        if (keyspace.equalsIgnoreCase(keyspaceName)) {
            ColumnFamilyStoreMBean columnFamilyMBean = proxyEntry.getValue();
            tableNames.add(columnFamilyMBean.getColumnFamilyName());
        }
    }
    return tableNames;
}

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();
                }/*from w  w  w.  j a  va 2s.c o m*/
            }
        }
    }
    return number;
}

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

License:Apache License

public ColumnFamilyStoreMBean getColumnFamilyStatics(String keyspace, String columnFamily) {
    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())) {
                    return cfstore;
                }//  w ww . jav a2s.c  o  m
            }
        }
    }
    return null;
}

From source file:io.cassandrareaper.jmx.JmxProxyImpl.java

License:Apache License

@Override
public Set<String> getTableNamesForKeyspace(String keyspace) throws ReaperException {
    Set<String> tableNames = new HashSet<>();
    Iterator<Map.Entry<String, ColumnFamilyStoreMBean>> proxies;
    try {//from  w w  w  . j a v  a  2s  .  co m
        proxies = ColumnFamilyStoreMBeanIterator.getColumnFamilyStoreMBeanProxies(mbeanServer);
    } catch (IOException | MalformedObjectNameException e) {
        throw new ReaperException("failed to get ColumnFamilyStoreMBean instances from JMX", e);
    }
    while (proxies.hasNext()) {
        Map.Entry<String, ColumnFamilyStoreMBean> proxyEntry = proxies.next();
        String keyspaceName = proxyEntry.getKey();
        if (keyspace.equalsIgnoreCase(keyspaceName)) {
            ColumnFamilyStoreMBean columnFamilyMBean = proxyEntry.getValue();
            tableNames.add(columnFamilyMBean.getColumnFamilyName());
        }
    }
    return tableNames;
}

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

License:Open Source License

public ColumnFamilyInformation getSingleColumnFamilyStats(String keyspace, String columnFamily)
        throws ClusterDataAdminException {
    clusterColumnFamilyMBeanService = ClusterMBeanProxy.getClusterColumnFamilyMBeanService();
    // get a list of column family stores
    Iterator<Map.Entry<String, ColumnFamilyStoreMBean>> cfamilies = clusterColumnFamilyMBeanService
            .getColumnFamilyStoreMBeanProxies();

    while (cfamilies.hasNext()) {
        Map.Entry<String, ColumnFamilyStoreMBean> entry = cfamilies.next();
        String tableName = entry.getKey();
        ColumnFamilyStoreMBean cfsProxy = entry.getValue();

        if (keyspace.equals(tableName) && columnFamily.equals(cfsProxy.getColumnFamilyName())) {
            return getColumnFamilyStats(cfsProxy);
        }/*ww  w.  j  a  va2s .  co  m*/
    }
    return null;
}

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

License:Open Source License

public String[] getColumnFamiliesForKeyspace(String keyspace) throws ClusterDataAdminException {
    clusterColumnFamilyMBeanService = ClusterMBeanProxy.getClusterColumnFamilyMBeanService();
    List<String> keyspaceColumnFamilies = new ArrayList<String>();
    // get a list of column family stores
    Iterator<Map.Entry<String, ColumnFamilyStoreMBean>> cfamilies = clusterColumnFamilyMBeanService
            .getColumnFamilyStoreMBeanProxies();
    while (cfamilies.hasNext()) {
        Map.Entry<String, ColumnFamilyStoreMBean> entry = cfamilies.next();
        String tableName = entry.getKey();
        ColumnFamilyStoreMBean cfsProxy = entry.getValue();
        if (keyspace.equals(tableName)) {
            keyspaceColumnFamilies.add(cfsProxy.getColumnFamilyName());
        }//from  w ww.  j a  v  a  2 s.  co m
    }
    return keyspaceColumnFamilies.toArray(new String[keyspaceColumnFamilies.size()]);
}

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;
}