You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2020/05/28 14:28:50 UTC
[cassandra] branch trunk updated: Add completion_ratio column to
sstable_tasks virtual table
This is an automated email from the ASF dual-hosted git repository.
aleksey pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new 38f5f9c Add completion_ratio column to sstable_tasks virtual table
38f5f9c is described below
commit 38f5f9caccabee2601ca5e95884d83857d22bf33
Author: Stefan Miklosovic <st...@instaclustr.com>
AuthorDate: Sat Apr 25 21:00:15 2020 +0200
Add completion_ratio column to sstable_tasks virtual table
patch by Stefan Miklosovic; reviewed by Aleksey Yeschenko for
CASANDRA-15759
---
CHANGES.txt | 1 +
.../org/apache/cassandra/db/virtual/SSTableTasksTable.java | 13 +++++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index 2a35318..9b62b06 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
4.0-alpha5
+ * Add completion_ratio column to sstable_tasks virtual table (CASANDRA-15759)
* Add support for adding custom Verbs (CASSANDRA-15725)
* Speed up entire-file-streaming file containment check and allow entire-file-streaming for all compaction strategies (CASSANDRA-15657,CASSANDRA-15783)
* Provide ability to configure IAuditLogger (CASSANDRA-15748)
diff --git a/src/java/org/apache/cassandra/db/virtual/SSTableTasksTable.java b/src/java/org/apache/cassandra/db/virtual/SSTableTasksTable.java
index b387b88..20033df 100644
--- a/src/java/org/apache/cassandra/db/virtual/SSTableTasksTable.java
+++ b/src/java/org/apache/cassandra/db/virtual/SSTableTasksTable.java
@@ -19,6 +19,7 @@ package org.apache.cassandra.db.virtual;
import org.apache.cassandra.db.compaction.CompactionInfo;
import org.apache.cassandra.db.compaction.CompactionManager;
+import org.apache.cassandra.db.marshal.DoubleType;
import org.apache.cassandra.db.marshal.LongType;
import org.apache.cassandra.db.marshal.UTF8Type;
import org.apache.cassandra.db.marshal.UUIDType;
@@ -30,6 +31,7 @@ final class SSTableTasksTable extends AbstractVirtualTable
private final static String KEYSPACE_NAME = "keyspace_name";
private final static String TABLE_NAME = "table_name";
private final static String TASK_ID = "task_id";
+ private final static String COMPLETION_RATIO = "completion_ratio";
private final static String KIND = "kind";
private final static String PROGRESS = "progress";
private final static String TOTAL = "total";
@@ -44,6 +46,7 @@ final class SSTableTasksTable extends AbstractVirtualTable
.addPartitionKeyColumn(KEYSPACE_NAME, UTF8Type.instance)
.addClusteringColumn(TABLE_NAME, UTF8Type.instance)
.addClusteringColumn(TASK_ID, UUIDType.instance)
+ .addRegularColumn(COMPLETION_RATIO, DoubleType.instance)
.addRegularColumn(KIND, UTF8Type.instance)
.addRegularColumn(PROGRESS, LongType.instance)
.addRegularColumn(TOTAL, LongType.instance)
@@ -57,12 +60,18 @@ final class SSTableTasksTable extends AbstractVirtualTable
for (CompactionInfo task : CompactionManager.instance.getSSTableTasks())
{
+ long completed = task.getCompleted();
+ long total = task.getTotal();
+
+ double completionRatio = total == 0L ? 1.0 : (((double) completed) / total);
+
result.row(task.getKeyspace().orElse("*"),
task.getTable().orElse("*"),
task.getTaskId())
+ .column(COMPLETION_RATIO, completionRatio)
.column(KIND, task.getTaskType().toString().toLowerCase())
- .column(PROGRESS, task.getCompleted())
- .column(TOTAL, task.getTotal())
+ .column(PROGRESS, completed)
+ .column(TOTAL, total)
.column(UNIT, task.getUnit().toString().toLowerCase());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org