mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-3.0' into cassandra-3.11
This commit is contained in:
commit
bc30a6f733
|
|
@ -10,6 +10,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)
|
||||
* Deprecate background repair and probablistic read_repair_chance table options
|
||||
|
|
|
|||
|
|
@ -42,6 +42,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;
|
||||
|
|
@ -312,7 +313,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 static enum Unit
|
||||
{
|
||||
BYTES("bytes"), RANGES("ranges"), KEYS("keys");
|
||||
|
||||
private final String name;
|
||||
|
||||
private Unit(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public static boolean isFileSize(String unit)
|
||||
{
|
||||
return BYTES.toString().equals(unit);
|
||||
}
|
||||
}
|
||||
|
||||
public CompactionInfo(CFMetaData cfm, OperationType tasktype, long bytesComplete, long totalBytes, UUID compactionId)
|
||||
{
|
||||
this(cfm, tasktype, bytesComplete, totalBytes, "bytes", compactionId);
|
||||
this(cfm, tasktype, bytesComplete, totalBytes, Unit.BYTES, compactionId);
|
||||
}
|
||||
|
||||
public CompactionInfo(OperationType tasktype, long completed, long total, String unit, UUID compactionId)
|
||||
public CompactionInfo(OperationType tasktype, long completed, long total, Unit unit, UUID compactionId)
|
||||
{
|
||||
this(null, tasktype, completed, total, unit, compactionId);
|
||||
}
|
||||
|
||||
public CompactionInfo(CFMetaData cfm, OperationType tasktype, long completed, long total, String unit, UUID compactionId)
|
||||
public CompactionInfo(CFMetaData cfm, 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,18 +25,21 @@ import java.util.UUID;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.cassandra.concurrent.ScheduledExecutors;
|
||||
import org.apache.cassandra.db.*;
|
||||
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.db.lifecycle.SSTableSet;
|
||||
import org.apache.cassandra.db.partitions.*;
|
||||
import org.apache.cassandra.db.rows.*;
|
||||
|
|
@ -208,7 +211,7 @@ public class ViewBuilder extends CompactionInfo.Holder
|
|||
|
||||
public CompactionInfo getCompactionInfo()
|
||||
{
|
||||
long rangesLeft = 0, rangesTotal = 0;
|
||||
long rangesCompleted = 0, rangesTotal = 0;
|
||||
Token lastToken = prevToken;
|
||||
|
||||
// This approximation is not very accurate, but since we do not have a method which allows us to calculate the
|
||||
|
|
@ -218,15 +221,11 @@ public class ViewBuilder extends CompactionInfo.Holder
|
|||
// has.
|
||||
for (Range<Token> range : StorageService.instance.getLocalRanges(baseCfs.keyspace.getName()))
|
||||
{
|
||||
rangesLeft++;
|
||||
rangesTotal++;
|
||||
// This will reset rangesLeft, so that the number of ranges left will be less than the total ranges at the
|
||||
// end of the method.
|
||||
if (lastToken == null || range.contains(lastToken))
|
||||
rangesLeft = 0;
|
||||
}
|
||||
|
||||
return new CompactionInfo(baseCfs.metadata, OperationType.VIEW_BUILD, rangesLeft, rangesTotal, "ranges", compactionId);
|
||||
if ((lastToken != null) && lastToken.compareTo(range.right) > 0)
|
||||
rangesCompleted++;
|
||||
}
|
||||
return new CompactionInfo(baseCfs.metadata, OperationType.VIEW_BUILD, rangesCompleted, rangesTotal, Unit.RANGES, compactionId);
|
||||
}
|
||||
|
||||
public void stop()
|
||||
|
|
|
|||
|
|
@ -30,14 +30,15 @@ import java.util.UUID;
|
|||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
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.utils.FBUtilities;
|
||||
|
|
@ -310,7 +311,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.command.Command;
|
||||
import io.airlift.command.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