mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-3.11' into trunk
This commit is contained in:
commit
78ca3447c9
|
|
@ -246,6 +246,7 @@
|
|||
* RateBasedBackPressure unnecessarily invokes a lock on the Guava RateLimiter (CASSANDRA-14163)
|
||||
* Fix wildcard GROUP BY queries (CASSANDRA-14209)
|
||||
Merged from 3.0:
|
||||
* Fix progress stats and units in compactionstats (CASSANDRA-12244)
|
||||
* Better handle missing partition columns in system_schema.columns (CASSANDRA-14379)
|
||||
* Delay hints store excise by write timeout to avoid race with decommission (CASSANDRA-13740)
|
||||
* Add missed CQL keywords to documentation (CASSANDRA-14359)
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import org.apache.cassandra.db.ColumnFamilyStore;
|
|||
import org.apache.cassandra.db.compaction.CompactionInfo;
|
||||
import org.apache.cassandra.db.compaction.CompactionManager;
|
||||
import org.apache.cassandra.db.compaction.OperationType;
|
||||
import org.apache.cassandra.db.compaction.CompactionInfo.Unit;
|
||||
import org.apache.cassandra.io.FSWriteError;
|
||||
import org.apache.cassandra.io.util.*;
|
||||
import org.apache.cassandra.io.util.CorruptFileException;
|
||||
|
|
@ -319,7 +320,7 @@ public class AutoSavingCache<K extends CacheKey, V> extends InstrumentingCache<K
|
|||
type,
|
||||
0,
|
||||
keysEstimate,
|
||||
"keys",
|
||||
Unit.KEYS,
|
||||
UUIDGen.getTimeUUID());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,20 +32,43 @@ public final class CompactionInfo implements Serializable
|
|||
private final OperationType tasktype;
|
||||
private final long completed;
|
||||
private final long total;
|
||||
private final String unit;
|
||||
private final Unit unit;
|
||||
private final UUID compactionId;
|
||||
|
||||
public CompactionInfo(TableMetadata metadata, OperationType tasktype, long bytesComplete, long totalBytes, UUID compactionId)
|
||||
{
|
||||
this(metadata, tasktype, bytesComplete, totalBytes, "bytes", compactionId);
|
||||
this(metadata, tasktype, bytesComplete, totalBytes, Unit.BYTES, compactionId);
|
||||
}
|
||||
|
||||
public CompactionInfo(OperationType tasktype, long completed, long total, String unit, UUID compactionId)
|
||||
public static enum Unit
|
||||
{
|
||||
BYTES("bytes"), RANGES("token range parts"), KEYS("keys");
|
||||
|
||||
private final String name;
|
||||
|
||||
private Unit(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public static boolean isFileSize(String unit)
|
||||
{
|
||||
return BYTES.toString().equals(unit);
|
||||
}
|
||||
}
|
||||
|
||||
public CompactionInfo(OperationType tasktype, long completed, long total, Unit unit, UUID compactionId)
|
||||
{
|
||||
this(null, tasktype, completed, total, unit, compactionId);
|
||||
}
|
||||
|
||||
public CompactionInfo(TableMetadata metadata, OperationType tasktype, long completed, long total, String unit, UUID compactionId)
|
||||
public CompactionInfo(TableMetadata metadata, OperationType tasktype, long completed, long total, Unit unit, UUID compactionId)
|
||||
{
|
||||
this.tasktype = tasktype;
|
||||
this.completed = completed;
|
||||
|
|
@ -127,7 +150,7 @@ public final class CompactionInfo implements Serializable
|
|||
ret.put("completed", Long.toString(completed));
|
||||
ret.put("total", Long.toString(total));
|
||||
ret.put("taskType", tasktype.toString());
|
||||
ret.put("unit", unit);
|
||||
ret.put("unit", unit.toString());
|
||||
ret.put("compactionId", compactionId == null ? "" : compactionId.toString());
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import org.apache.cassandra.db.ReadQuery;
|
|||
import org.apache.cassandra.db.SinglePartitionReadCommand;
|
||||
import org.apache.cassandra.db.SystemKeyspace;
|
||||
import org.apache.cassandra.db.compaction.CompactionInfo;
|
||||
import org.apache.cassandra.db.compaction.CompactionInfo.Unit;
|
||||
import org.apache.cassandra.db.compaction.CompactionInterruptedException;
|
||||
import org.apache.cassandra.db.compaction.OperationType;
|
||||
import org.apache.cassandra.db.lifecycle.SSTableSet;
|
||||
|
|
@ -186,13 +187,13 @@ public class ViewBuilderTask extends CompactionInfo.Holder implements Callable<L
|
|||
if (range.left.getPartitioner().splitter().isPresent())
|
||||
{
|
||||
long progress = prevToken == null ? 0 : Math.round(prevToken.getPartitioner().splitter().get().positionInRange(prevToken, range) * 1000);
|
||||
return new CompactionInfo(baseCfs.metadata(), OperationType.VIEW_BUILD, progress, 1000, "token range parts", compactionId);
|
||||
return new CompactionInfo(baseCfs.metadata(), OperationType.VIEW_BUILD, progress, 1000, Unit.RANGES, compactionId);
|
||||
}
|
||||
|
||||
// When there is no splitter, estimate based on number of total keys but
|
||||
// take the max with keysBuilt + 1 to avoid having more completed than total
|
||||
long keysTotal = Math.max(keysBuilt + 1, baseCfs.estimatedKeysForRange(range));
|
||||
return new CompactionInfo(baseCfs.metadata(), OperationType.VIEW_BUILD, keysBuilt, keysTotal, "keys", compactionId);
|
||||
return new CompactionInfo(baseCfs.metadata(), OperationType.VIEW_BUILD, keysBuilt, keysTotal, Unit.KEYS, compactionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -29,14 +29,15 @@ import java.util.UUID;
|
|||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.cassandra.db.ColumnFamilyStore;
|
||||
import org.apache.cassandra.db.Keyspace;
|
||||
import org.apache.cassandra.db.compaction.CompactionInfo;
|
||||
import org.apache.cassandra.db.compaction.CompactionInterruptedException;
|
||||
import org.apache.cassandra.db.compaction.OperationType;
|
||||
import org.apache.cassandra.db.compaction.CompactionInfo.Unit;
|
||||
import org.apache.cassandra.db.lifecycle.LifecycleTransaction;
|
||||
import org.apache.cassandra.io.sstable.format.SSTableReader;
|
||||
import org.apache.cassandra.schema.TableId;
|
||||
|
|
@ -298,7 +299,7 @@ public class IndexSummaryRedistribution extends CompactionInfo.Holder
|
|||
|
||||
public CompactionInfo getCompactionInfo()
|
||||
{
|
||||
return new CompactionInfo(OperationType.INDEX_SUMMARY, (memoryPoolBytes - remainingSpace), memoryPoolBytes, "bytes", compactionId);
|
||||
return new CompactionInfo(OperationType.INDEX_SUMMARY, (memoryPoolBytes - remainingSpace), memoryPoolBytes, Unit.BYTES, compactionId);
|
||||
}
|
||||
|
||||
/** Utility class for sorting sstables by their read rates. */
|
||||
|
|
|
|||
|
|
@ -25,8 +25,10 @@ import java.util.Map.Entry;
|
|||
import io.airlift.airline.Command;
|
||||
import io.airlift.airline.Option;
|
||||
|
||||
import org.apache.cassandra.db.compaction.CompactionInfo;
|
||||
import org.apache.cassandra.db.compaction.CompactionManagerMBean;
|
||||
import org.apache.cassandra.db.compaction.OperationType;
|
||||
import org.apache.cassandra.db.compaction.CompactionInfo.Unit;
|
||||
import org.apache.cassandra.io.util.FileUtils;
|
||||
import org.apache.cassandra.tools.NodeProbe;
|
||||
import org.apache.cassandra.tools.NodeTool.NodeToolCmd;
|
||||
|
|
@ -85,9 +87,10 @@ public class CompactionStats extends NodeToolCmd
|
|||
String taskType = c.get("taskType");
|
||||
String keyspace = c.get("keyspace");
|
||||
String columnFamily = c.get("columnfamily");
|
||||
String completedStr = humanReadable ? FileUtils.stringifyFileSize(completed) : Long.toString(completed);
|
||||
String totalStr = humanReadable ? FileUtils.stringifyFileSize(total) : Long.toString(total);
|
||||
String unit = c.get("unit");
|
||||
boolean toFileSize = humanReadable && Unit.isFileSize(unit);
|
||||
String completedStr = toFileSize ? FileUtils.stringifyFileSize(completed) : Long.toString(completed);
|
||||
String totalStr = toFileSize ? FileUtils.stringifyFileSize(total) : Long.toString(total);
|
||||
String percentComplete = total == 0 ? "n/a" : new DecimalFormat("0.00").format((double) completed / total * 100) + "%";
|
||||
String id = c.get("compactionId");
|
||||
table.add(id, taskType, keyspace, columnFamily, completedStr, totalStr, unit, percentComplete);
|
||||
|
|
|
|||
Loading…
Reference in New Issue