use of org.apache.cassandra.db.compaction.CompactionManagerMBean in project eiger by wlloyd.
the class CliClient method describeKeySpace.
private void describeKeySpace(String keySpaceName, KsDef metadata) throws TException {
NodeProbe probe = sessionState.getNodeProbe();
// getting compaction manager MBean to displaying index building information
CompactionManagerMBean compactionManagerMBean = (probe == null) ? null : probe.getCompactionManagerProxy();
// Describe and display
sessionState.out.println("Keyspace: " + keySpaceName + ":");
try {
KsDef ks_def;
ks_def = metadata == null ? thriftClient.describe_keyspace(keySpaceName) : metadata;
sessionState.out.println(" Replication Strategy: " + ks_def.strategy_class);
sessionState.out.println(" Durable Writes: " + ks_def.durable_writes);
Map<String, String> options = ks_def.strategy_options;
sessionState.out.println(" Options: [" + ((options == null) ? "" : FBUtilities.toString(options)) + "]");
sessionState.out.println(" Column Families:");
Collections.sort(ks_def.cf_defs, new CfDefNamesComparator());
for (CfDef cf_def : ks_def.cf_defs) describeColumnFamily(ks_def, cf_def, probe);
// compaction manager information
if (compactionManagerMBean != null) {
for (Map<String, String> info : compactionManagerMBean.getCompactions()) {
// if ongoing compaction type is index build
if (info.get("taskType").equals(OperationType.INDEX_BUILD.toString()))
continue;
sessionState.out.printf("%nCurrently building index %s, completed %d of %d bytes.%n", info.get("columnfamily"), info.get("bytesComplete"), info.get("totalBytes"));
}
}
// closing JMX connection
if (probe != null)
probe.close();
} catch (InvalidRequestException e) {
sessionState.out.println("Invalid request: " + e);
} catch (NotFoundException e) {
sessionState.out.println("Keyspace " + keySpaceName + " could not be found.");
} catch (IOException e) {
sessionState.out.println("Error while closing JMX connection: " + e.getMessage());
}
}
use of org.apache.cassandra.db.compaction.CompactionManagerMBean in project eiger by wlloyd.
the class NodeCmd method printCompactionStats.
public void printCompactionStats(PrintStream outs) {
CompactionManagerMBean cm = probe.getCompactionManagerProxy();
outs.println("pending tasks: " + cm.getPendingTasks());
if (cm.getCompactions().size() > 0)
outs.printf("%25s%16s%16s%16s%16s%10s%n", "compaction type", "keyspace", "column family", "bytes compacted", "bytes total", "progress");
for (Map<String, String> c : cm.getCompactions()) {
String percentComplete = new Long(c.get("totalBytes")) == 0 ? "n/a" : new DecimalFormat("0.00").format((double) new Long(c.get("bytesComplete")) / new Long(c.get("totalBytes")) * 100) + "%";
outs.printf("%25s%16s%16s%16s%16s%10s%n", c.get("taskType"), c.get("keyspace"), c.get("columnfamily"), c.get("bytesComplete"), c.get("totalBytes"), percentComplete);
}
}
use of org.apache.cassandra.db.compaction.CompactionManagerMBean in project cassandra by apache.
the class CompactionStats method execute.
@Override
public void execute(NodeProbe probe) {
CompactionManagerMBean cm = probe.getCompactionManagerProxy();
Map<String, Map<String, Integer>> pendingTaskNumberByTable = (Map<String, Map<String, Integer>>) probe.getCompactionMetric("PendingTasksByTableName");
int numTotalPendingTask = 0;
for (Entry<String, Map<String, Integer>> ksEntry : pendingTaskNumberByTable.entrySet()) {
for (Entry<String, Integer> tableEntry : ksEntry.getValue().entrySet()) numTotalPendingTask += tableEntry.getValue();
}
System.out.println("pending tasks: " + numTotalPendingTask);
for (Entry<String, Map<String, Integer>> ksEntry : pendingTaskNumberByTable.entrySet()) {
String ksName = ksEntry.getKey();
for (Entry<String, Integer> tableEntry : ksEntry.getValue().entrySet()) {
String tableName = tableEntry.getKey();
int pendingTaskCount = tableEntry.getValue();
System.out.println("- " + ksName + '.' + tableName + ": " + pendingTaskCount);
}
}
System.out.println();
reportCompactionTable(cm.getCompactions(), probe.getCompactionThroughput(), humanReadable);
}
Aggregations