public void refresh(List<String> keyspaces) throws IOException, ExecutionException, InterruptedException { Iterator<Entry<String, ColumnFamilyStoreMBean>> it = super.getColumnFamilyStoreMBeanProxies(); while (it.hasNext()) { Entry<String, ColumnFamilyStoreMBean> entry = it.next(); if (keyspaces.contains(entry.getKey())) { logger.info( "Refreshing {} {}", entry.getKey(), entry.getValue().getColumnFamilyName()); loadNewSSTables(entry.getKey(), entry.getValue().getColumnFamilyName()); } } }
/** * You must do the compaction before running this to remove the duplicate tokens out of the * server. TODO code it. */ @SuppressWarnings("unchecked") public JSONObject estimateKeys() throws JSONException { Iterator<Entry<String, ColumnFamilyStoreMBean>> it = super.getColumnFamilyStoreMBeanProxies(); JSONObject object = new JSONObject(); while (it.hasNext()) { Entry<String, ColumnFamilyStoreMBean> entry = it.next(); object.put("keyspace", entry.getKey()); object.put("column_family", entry.getValue().getColumnFamilyName()); object.put("estimated_size", entry.getValue().estimateKeys()); } return object; }
if (filter.isTableIncluded(keyspaceName, tableProxy.getTableName())) selectedTableMbeans.put(keyspaceName, tableProxy); String tableName = table.getTableName(); StatsTable statsTable = new StatsTable(); statsTable.name = tableName; statsTable.isIndex = tableName.contains("."); statsTable.sstableCount = probe.getColumnFamilyMetric(keyspaceName, tableName, "LiveSSTableCount"); int[] leveledSStables = table.getSSTableCountPerLevel(); if (leveledSStables != null) long maxCount = 4L; // for L0 if (level > 0) maxCount = (long) Math.pow(table.getLevelFanoutSize(), level);
@Override public void execute(NodeProbe probe) { checkArgument(args.size() == 2, "getcompactionthreshold requires ks and cf args"); String ks = args.get(0); String cf = args.get(1); ColumnFamilyStoreMBean cfsProxy = probe.getCfsProxy(ks, cf); System.out.println("Current compaction thresholds for " + ks + "/" + cf + ": \n" + " min = " + cfsProxy.getMinimumCompactionThreshold() + ", " + " max = " + cfsProxy.getMaximumCompactionThreshold()); } }
public Map<Sampler, CompositeData> getPartitionSample(String ks, String cf, int capacity, int duration, int count, List<Sampler> samplers) throws OpenDataException { ColumnFamilyStoreMBean cfsProxy = getCfsProxy(ks, cf); for(Sampler sampler : samplers) { cfsProxy.beginLocalSampling(sampler.name(), capacity); } Uninterruptibles.sleepUninterruptibly(duration, TimeUnit.MILLISECONDS); Map<Sampler, CompositeData> result = Maps.newHashMap(); for(Sampler sampler : samplers) { result.put(sampler, cfsProxy.finishLocalSampling(sampler.name(), count)); } return result; }
ColumnFamilyStoreMBean cfsProxy = entry.getValue(); if (!cfstoreMap.containsKey(keyspaceName) && filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName())) } else if (filter.isColumnFamilyIncluded(entry.getKey(), cfsProxy.getColumnFamilyName())) for (ColumnFamilyStoreMBean cfstore : columnFamilies) String cfName = cfstore.getColumnFamilyName(); long writeCount = ((JmxReporter.TimerMBean) probe.getColumnFamilyMetric(keyspaceName, cfName, "WriteLatency")).getCount(); long readCount = ((JmxReporter.TimerMBean) probe.getColumnFamilyMetric(keyspaceName, cfName, "ReadLatency")).getCount(); String cfName = cfstore.getColumnFamilyName(); if (cfName.contains(".")) System.out.println("\t\tTable (index): " + cfName); int[] leveledSStables = cfstore.getSSTableCountPerLevel(); if (leveledSStables != null)
/** * 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); }
public List<String> getSSTables(String keyspace, String cf, String key, boolean hexFormat) { ColumnFamilyStoreMBean cfsProxy = getCfsProxy(keyspace, cf); return cfsProxy.getSSTablesForKey(key, hexFormat); }
public void add(ColumnFamilyStoreMBean table) { String tableName = table.getTableName(); long tableWriteCount = ((CassandraMetricsRegistry.JmxTimerMBean) probe.getColumnFamilyMetric(name, tableName, "WriteLatency")).getCount(); long tableReadCount = ((CassandraMetricsRegistry.JmxTimerMBean) probe.getColumnFamilyMetric(name, tableName, "ReadLatency")).getCount(); if (tableReadCount > 0) { readCount += tableReadCount; totalReadTime += (long) probe.getColumnFamilyMetric(name, tableName, "ReadTotalLatency"); } if (tableWriteCount > 0) { writeCount += tableWriteCount; totalWriteTime += (long) probe.getColumnFamilyMetric(name, tableName, "WriteTotalLatency"); } pendingFlushes += (long) probe.getColumnFamilyMetric(name, tableName, "PendingFlushes"); }
if (filter.isTableIncluded(keyspaceName, tableProxy.getTableName())) selectedTableMbeans.put(keyspaceName, tableProxy); String tableName = table.getTableName(); StatsTable statsTable = new StatsTable(); statsTable.name = tableName; statsTable.isIndex = tableName.contains("."); statsTable.sstableCount = probe.getColumnFamilyMetric(keyspaceName, tableName, "LiveSSTableCount"); int[] leveledSStables = table.getSSTableCountPerLevel(); if (leveledSStables != null) long maxCount = 4L; // for L0 if (level > 0) maxCount = (long) Math.pow(table.getLevelFanoutSize(), level);
@Override public void execute(NodeProbe probe) { checkArgument(args.size() == 2, "getcompactionthreshold requires ks and cf args"); String ks = args.get(0); String cf = args.get(1); ColumnFamilyStoreMBean cfsProxy = probe.getCfsProxy(ks, cf); System.out.println("Current compaction thresholds for " + ks + "/" + cf + ": \n" + " min = " + cfsProxy.getMinimumCompactionThreshold() + ", " + " max = " + cfsProxy.getMaximumCompactionThreshold()); } }
public Map<Sampler, CompositeData> getPartitionSample(String ks, String cf, int capacity, int duration, int count, List<Sampler> samplers) throws OpenDataException { ColumnFamilyStoreMBean cfsProxy = getCfsProxy(ks, cf); for(Sampler sampler : samplers) { cfsProxy.beginLocalSampling(sampler.name(), capacity); } Uninterruptibles.sleepUninterruptibly(duration, TimeUnit.MILLISECONDS); Map<Sampler, CompositeData> result = Maps.newHashMap(); for(Sampler sampler : samplers) { result.put(sampler, cfsProxy.finishLocalSampling(sampler.name(), count)); } return result; }
/** * 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); }
public List<String> getSSTables(String keyspace, String cf, String key, boolean hexFormat) { ColumnFamilyStoreMBean cfsProxy = getCfsProxy(keyspace, cf); return cfsProxy.getSSTablesForKey(key, hexFormat); }
public void add(ColumnFamilyStoreMBean table) { String tableName = table.getTableName(); long tableWriteCount = ((CassandraMetricsRegistry.JmxTimerMBean) probe.getColumnFamilyMetric(name, tableName, "WriteLatency")).getCount(); long tableReadCount = ((CassandraMetricsRegistry.JmxTimerMBean) probe.getColumnFamilyMetric(name, tableName, "ReadLatency")).getCount(); if (tableReadCount > 0) { readCount += tableReadCount; totalReadTime += (long) probe.getColumnFamilyMetric(name, tableName, "ReadTotalLatency"); } if (tableWriteCount > 0) { writeCount += tableWriteCount; totalWriteTime += (long) probe.getColumnFamilyMetric(name, tableName, "WriteTotalLatency"); } pendingFlushes += (long) probe.getColumnFamilyMetric(name, tableName, "PendingFlushes"); }
if (filter.isTableIncluded(keyspaceName, tableProxy.getTableName())) selectedTableMbeans.put(keyspaceName, tableProxy); String tableName = table.getTableName(); StatsTable statsTable = new StatsTable(); statsTable.name = tableName; statsTable.isIndex = tableName.contains("."); statsTable.sstableCount = probe.getColumnFamilyMetric(keyspaceName, tableName, "LiveSSTableCount"); int[] leveledSStables = table.getSSTableCountPerLevel(); if (leveledSStables != null) long maxCount = 4L; // for L0 if (level > 0) maxCount = (long) Math.pow(table.getLevelFanoutSize(), level);
@Override public void execute(NodeProbe probe) { checkArgument(args.size() == 2, "getcompactionthreshold requires ks and cf args"); String ks = args.get(0); String cf = args.get(1); ColumnFamilyStoreMBean cfsProxy = probe.getCfsProxy(ks, cf); System.out.println("Current compaction thresholds for " + ks + "/" + cf + ": \n" + " min = " + cfsProxy.getMinimumCompactionThreshold() + ", " + " max = " + cfsProxy.getMaximumCompactionThreshold()); } }
public Map<Sampler, CompositeData> getPartitionSample(String ks, String cf, int capacity, int duration, int count, List<Sampler> samplers) throws OpenDataException { ColumnFamilyStoreMBean cfsProxy = getCfsProxy(ks, cf); for(Sampler sampler : samplers) { cfsProxy.beginLocalSampling(sampler.name(), capacity); } Uninterruptibles.sleepUninterruptibly(duration, TimeUnit.MILLISECONDS); Map<Sampler, CompositeData> result = Maps.newHashMap(); for(Sampler sampler : samplers) { result.put(sampler, cfsProxy.finishLocalSampling(sampler.name(), count)); } return result; }
public Map<String, List<String>> retriableCall() throws Exception { try (JMXNodeTool nodeTool = JMXNodeTool.instance(configuration)) { final Map<String, List<String>> columnfamilies = new HashMap<>(); Iterator<Map.Entry<String, ColumnFamilyStoreMBean>> columnfamilyStoreMBean = nodeTool.getColumnFamilyStoreMBeanProxies(); columnfamilyStoreMBean.forEachRemaining( entry -> { columnfamilies.putIfAbsent(entry.getKey(), new ArrayList<>()); columnfamilies .get(entry.getKey()) .add(entry.getValue().getColumnFamilyName()); }); return columnfamilies; } } }.call();
/** * 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); }