Search in sources :

Example 6 with ColumnFamilyStoreMBean

use of org.apache.cassandra.db.ColumnFamilyStoreMBean in project eiger by wlloyd.

the class ThreadPoolProxyMBeanIterator method getCompactionThreshold.

/**
     * Get the compaction threshold
     *
     * @param outs the stream to write to
     */
public void getCompactionThreshold(PrintStream outs, String ks, String cf) {
    ColumnFamilyStoreMBean cfsProxy = getCfsProxy(ks, cf);
    outs.println("Current compaction thresholds for " + ks + "/" + cf + ": \n" + " min = " + cfsProxy.getMinimumCompactionThreshold() + ", " + " max = " + cfsProxy.getMaximumCompactionThreshold());
}
Also used : ColumnFamilyStoreMBean(org.apache.cassandra.db.ColumnFamilyStoreMBean)

Example 7 with ColumnFamilyStoreMBean

use of org.apache.cassandra.db.ColumnFamilyStoreMBean in project cassandra by apache.

the class ColumnFamilyStoreMBeanIterator method getCFSMBeans.

private List<Entry<String, ColumnFamilyStoreMBean>> getCFSMBeans(MBeanServerConnection mbeanServerConn, String type) throws MalformedObjectNameException, IOException {
    ObjectName query = new ObjectName("org.apache.cassandra.db:type=" + type + ",*");
    Set<ObjectName> cfObjects = mbeanServerConn.queryNames(query, null);
    List<Entry<String, ColumnFamilyStoreMBean>> mbeans = new ArrayList<Entry<String, ColumnFamilyStoreMBean>>(cfObjects.size());
    for (ObjectName n : cfObjects) {
        String keyspaceName = n.getKeyProperty("keyspace");
        ColumnFamilyStoreMBean cfsProxy = JMX.newMBeanProxy(mbeanServerConn, n, ColumnFamilyStoreMBean.class);
        mbeans.add(new AbstractMap.SimpleImmutableEntry<String, ColumnFamilyStoreMBean>(keyspaceName, cfsProxy));
    }
    return mbeans;
}
Also used : AbstractMap(java.util.AbstractMap) Entry(java.util.Map.Entry) ArrayList(java.util.ArrayList) ColumnFamilyStoreMBean(org.apache.cassandra.db.ColumnFamilyStoreMBean) ObjectName(javax.management.ObjectName)

Example 8 with ColumnFamilyStoreMBean

use of org.apache.cassandra.db.ColumnFamilyStoreMBean in project cassandra by apache.

the class ColumnFamilyStoreMBeanIterator method getCfsProxy.

public ColumnFamilyStoreMBean getCfsProxy(String ks, String cf) {
    ColumnFamilyStoreMBean cfsProxy = null;
    try {
        String type = cf.contains(".") ? "IndexColumnFamilies" : "ColumnFamilies";
        Set<ObjectName> beans = mbeanServerConn.queryNames(new ObjectName("org.apache.cassandra.db:type=*" + type + ",keyspace=" + ks + ",columnfamily=" + cf), null);
        if (beans.isEmpty())
            throw new MalformedObjectNameException("couldn't find that bean");
        assert beans.size() == 1;
        for (ObjectName bean : beans) cfsProxy = JMX.newMBeanProxy(mbeanServerConn, bean, ColumnFamilyStoreMBean.class);
    } catch (MalformedObjectNameException mone) {
        System.err.println("ColumnFamilyStore for " + ks + "/" + cf + " not found.");
        System.exit(1);
    } catch (IOException e) {
        System.err.println("ColumnFamilyStore for " + ks + "/" + cf + " not found: " + e);
        System.exit(1);
    }
    return cfsProxy;
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) ColumnFamilyStoreMBean(org.apache.cassandra.db.ColumnFamilyStoreMBean) IOException(java.io.IOException) ObjectName(javax.management.ObjectName)

Example 9 with ColumnFamilyStoreMBean

use of org.apache.cassandra.db.ColumnFamilyStoreMBean in project cassandra by apache.

the class ColumnFamilyStoreMBeanIterator method setCompactionThreshold.

/**
     * Set the compaction threshold
     *
     * @param minimumCompactionThreshold minimum compaction threshold
     * @param maximumCompactionThreshold maximum compaction threshold
     */
public void setCompactionThreshold(String ks, String cf, int minimumCompactionThreshold, int maximumCompactionThreshold) {
    ColumnFamilyStoreMBean cfsProxy = getCfsProxy(ks, cf);
    cfsProxy.setCompactionThresholds(minimumCompactionThreshold, maximumCompactionThreshold);
}
Also used : ColumnFamilyStoreMBean(org.apache.cassandra.db.ColumnFamilyStoreMBean)

Example 10 with ColumnFamilyStoreMBean

use of org.apache.cassandra.db.ColumnFamilyStoreMBean in project cassandra by apache.

the class JMXAuthTest method executeMethod.

@Test
public void executeMethod() throws Throwable {
    ColumnFamilyStoreMBean proxy = JMX.newMBeanProxy(connection, ObjectName.getInstance(tableMBean.getObjectName()), ColumnFamilyStoreMBean.class);
    // grant EXECUTE on a single specific Table mbean
    assertPermissionOnResource(Permission.EXECUTE, tableMBean, proxy::estimateKeys);
    // grant EXECUTE on all Table mbeans in named keyspace
    clearAllPermissions();
    JMXResource allTablesInKeyspace = JMXResource.mbean(String.format("org.apache.cassandra.db:type=Tables,keyspace=%s,*", KEYSPACE));
    assertPermissionOnResource(Permission.EXECUTE, allTablesInKeyspace, proxy::estimateKeys);
    // grant EXECUTE on all Table mbeans
    clearAllPermissions();
    JMXResource allTables = JMXResource.mbean("org.apache.cassandra.db:type=Tables,*");
    assertPermissionOnResource(Permission.EXECUTE, allTables, proxy::estimateKeys);
    // grant EXECUTE ON ALL MBEANS
    clearAllPermissions();
    assertPermissionOnResource(Permission.EXECUTE, JMXResource.root(), proxy::estimateKeys);
}
Also used : ColumnFamilyStoreMBean(org.apache.cassandra.db.ColumnFamilyStoreMBean) Test(org.junit.Test)

Aggregations

ColumnFamilyStoreMBean (org.apache.cassandra.db.ColumnFamilyStoreMBean)13 Test (org.junit.Test)3 Entry (java.util.Map.Entry)2 ObjectName (javax.management.ObjectName)2 IOException (java.io.IOException)1 AbstractMap (java.util.AbstractMap)1 ArrayList (java.util.ArrayList)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1 CompositeData (javax.management.openmbean.CompositeData)1 Sampler (org.apache.cassandra.metrics.TableMetrics.Sampler)1 StreamStateCompositeData (org.apache.cassandra.streaming.management.StreamStateCompositeData)1 EstimatedHistogram (org.apache.cassandra.utils.EstimatedHistogram)1