mirror of https://github.com/apache/cassandra
fix NPE in compactionstats
patch by jbellis; reviewed by xedin for CASSANDRA-4318
This commit is contained in:
parent
8fd3f49e84
commit
6352edb3fe
|
|
@ -1,4 +1,5 @@
|
|||
1.1.2
|
||||
* fix NPE in compactionstats (CASSANDRA-4318)
|
||||
* enforce 1m min keycache for auto (CASSANDRA-4306)
|
||||
* Have DeletedColumn.isMFD always return true (CASSANDRA-4307)
|
||||
* ex msg for cql3 order by constraints says primary filter can be an IN clause
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.cassandra.config.CFMetaData;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.db.compaction.CompactionInfo;
|
||||
import org.apache.cassandra.db.compaction.CompactionManager;
|
||||
|
|
@ -192,7 +193,10 @@ public class AutoSavingCache<K extends CacheKey, V> extends InstrumentingCache<K
|
|||
else
|
||||
type = OperationType.UNKNOWN;
|
||||
|
||||
info = new CompactionInfo(type, 0, estimatedTotalBytes);
|
||||
info = new CompactionInfo(new CFMetaData("system", cacheType.toString(), null, null, null),
|
||||
type,
|
||||
0,
|
||||
estimatedTotalBytes);
|
||||
}
|
||||
|
||||
public CompactionInfo getCompactionInfo()
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public abstract class AbstractCompactionIterable extends CompactionInfo.Holder i
|
|||
|
||||
public CompactionInfo getCompactionInfo()
|
||||
{
|
||||
return new CompactionInfo(this.hashCode(),
|
||||
return new CompactionInfo(controller.cfs.metadata,
|
||||
type,
|
||||
bytesRead,
|
||||
totalBytes);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class CompactionController
|
|||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(CompactionController.class);
|
||||
|
||||
private final ColumnFamilyStore cfs;
|
||||
public final ColumnFamilyStore cfs;
|
||||
private final boolean deserializeRequired;
|
||||
private final IntervalTree<SSTableReader> overlappingTree;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,38 +34,33 @@ public final class CompactionInfo implements Serializable
|
|||
private final long bytesComplete;
|
||||
private final long totalBytes;
|
||||
|
||||
public CompactionInfo(OperationType tasktype, long bytesComplete, long totalBytes)
|
||||
{
|
||||
this(null, tasktype, bytesComplete, totalBytes);
|
||||
}
|
||||
|
||||
public CompactionInfo(Integer id, OperationType tasktype, long bytesComplete, long totalBytes)
|
||||
public CompactionInfo(CFMetaData cfm, OperationType tasktype, long bytesComplete, long totalBytes)
|
||||
{
|
||||
this.tasktype = tasktype;
|
||||
this.bytesComplete = bytesComplete;
|
||||
this.totalBytes = totalBytes;
|
||||
this.cfm = id == null ? null : Schema.instance.getCFMetaData(id);
|
||||
this.cfm = cfm;
|
||||
}
|
||||
|
||||
/** @return A copy of this CompactionInfo with updated progress. */
|
||||
public CompactionInfo forProgress(long bytesComplete, long totalBytes)
|
||||
{
|
||||
return new CompactionInfo(cfm == null ? null : cfm.cfId, tasktype, bytesComplete, totalBytes);
|
||||
return new CompactionInfo(cfm, tasktype, bytesComplete, totalBytes);
|
||||
}
|
||||
|
||||
public Integer getId()
|
||||
{
|
||||
return cfm == null ? null : cfm.cfId;
|
||||
return cfm.cfId;
|
||||
}
|
||||
|
||||
public String getKeyspace()
|
||||
{
|
||||
return cfm == null ? null : cfm.ksName;
|
||||
return cfm.ksName;
|
||||
}
|
||||
|
||||
public String getColumnFamily()
|
||||
{
|
||||
return cfm == null ? null : cfm.cfName;
|
||||
return cfm.cfName;
|
||||
}
|
||||
|
||||
public CFMetaData getCFMetaData()
|
||||
|
|
|
|||
|
|
@ -1204,7 +1204,7 @@ public class CompactionManager implements CompactionManagerMBean
|
|||
{
|
||||
try
|
||||
{
|
||||
return new CompactionInfo(this.hashCode(),
|
||||
return new CompactionInfo(sstable.metadata,
|
||||
OperationType.CLEANUP,
|
||||
scanner.getCurrentPosition(),
|
||||
scanner.getLengthInBytes());
|
||||
|
|
@ -1230,7 +1230,7 @@ public class CompactionManager implements CompactionManagerMBean
|
|||
{
|
||||
try
|
||||
{
|
||||
return new CompactionInfo(this.hashCode(),
|
||||
return new CompactionInfo(sstable.metadata,
|
||||
OperationType.SCRUB,
|
||||
dataFile.getFilePointer(),
|
||||
dataFile.length());
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class SecondaryIndexBuilder extends CompactionInfo.Holder
|
|||
|
||||
public CompactionInfo getCompactionInfo()
|
||||
{
|
||||
return new CompactionInfo(this.hashCode(),
|
||||
return new CompactionInfo(cfs.metadata,
|
||||
OperationType.INDEX_BUILD,
|
||||
iter.getBytesRead(),
|
||||
iter.getTotalBytes());
|
||||
|
|
|
|||
Loading…
Reference in New Issue