CommitLog: update to c3 compat

This commit is contained in:
Calle Wilund 2016-08-17 08:30:46 +00:00
parent 85b39d7fbe
commit 39e4cd8f3f
2 changed files with 45 additions and 62 deletions

View File

@ -22,9 +22,14 @@
*/
package org.apache.cassandra.db.commitlog;
import java.io.*;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.management.MBeanServer;
import javax.management.ObjectName;
@ -65,39 +70,6 @@ public class CommitLog implements CommitLogMBean {
}
}
/**
* Get the number of completed tasks
*
* @see org.apache.cassandra.metrics.CommitLogMetrics#completedTasks
*/
@Deprecated
public long getCompletedTasks() {
log(" getCompletedTasks()");
return c.getLongValue("");
}
/**
* Get the number of tasks waiting to be executed
*
* @see org.apache.cassandra.metrics.CommitLogMetrics#pendingTasks
*/
@Deprecated
public long getPendingTasks() {
log(" getPendingTasks()");
return c.getLongValue("");
}
/**
* Get the current size used by all the commitlog segments.
*
* @see org.apache.cassandra.metrics.CommitLogMetrics#totalCommitLogSize
*/
@Deprecated
public long getTotalCommitlogSize() {
log(" getTotalCommitlogSize()");
return c.getLongValue("");
}
/**
* Recover a single file.
*/
@ -170,4 +142,23 @@ public class CommitLog implements CommitLogMBean {
return c.getStringValue("");
}
@Override
public long getActiveContentSize() {
// scylla does not compress commit log, so this is equivalent
return getActiveOnDiskSize();
}
@Override
public long getActiveOnDiskSize() {
return c.getLongValue("/commitlog/metrics/total_commit_log_size");
}
@Override
public Map<String, Double> getActiveSegmentCompressionRatios() {
HashMap<String, Double> res = new HashMap<>();
for (String name : getActiveSegmentNames()) {
res.put(name, 1.0);
}
return res;
}
}

View File

@ -17,36 +17,14 @@
*/
package org.apache.cassandra.db.commitlog;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public interface CommitLogMBean {
/**
* Get the number of completed tasks
*
* @see org.apache.cassandra.metrics.CommitLogMetrics#completedTasks
*/
@Deprecated
public long getCompletedTasks();
/**
* Get the number of tasks waiting to be executed
*
* @see org.apache.cassandra.metrics.CommitLogMetrics#pendingTasks
*/
@Deprecated
public long getPendingTasks();
/**
* Get the current size used by all the commitlog segments.
*
* @see org.apache.cassandra.metrics.CommitLogMetrics#totalCommitLogSize
*/
@Deprecated
public long getTotalCommitlogSize();
/**
* Command to execute to archive a commitlog segment. Blank to disabled.
* Command to execute to archive a commitlog segment. Blank to disabled.
*/
public String getArchiveCommand();
@ -88,8 +66,22 @@ public interface CommitLogMBean {
public List<String> getActiveSegmentNames();
/**
* @return Files which are pending for archival attempt. Does NOT include
* failed archive attempts.
* @return Files which are pending for archival attempt. Does NOT include failed archive attempts.
*/
public List<String> getArchivingSegmentNames();
/**
* @return The size of the mutations in all active commit log segments (uncompressed).
*/
public long getActiveContentSize();
/**
* @return The space taken on disk by the commit log (compressed).
*/
public long getActiveOnDiskSize();
/**
* @return A map between active log segments and the compression ratio achieved for each.
*/
public Map<String, Double> getActiveSegmentCompressionRatios();
}