cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1163691 - in /cassandra/trunk/src/java/org/apache/cassandra: cache/AutoSavingCache.java db/compaction/CompactionInfo.java db/compaction/CompactionIterable.java db/compaction/CompactionManager.java db/index/SecondaryIndexBuilder.java
Date Wed, 31 Aug 2011 16:41:27 GMT
Author: jbellis
Date: Wed Aug 31 16:41:26 2011
New Revision: 1163691

URL: http://svn.apache.org/viewvc?rev=1163691&view=rev
Log:
add CompactionInfo.id field
patch by Stu Hood; reviewed by jbellis for CASSANDRA-3107

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/cache/AutoSavingCache.java
    cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionInfo.java
    cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java
    cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
    cassandra/trunk/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/cache/AutoSavingCache.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cache/AutoSavingCache.java?rev=1163691&r1=1163690&r2=1163691&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cache/AutoSavingCache.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cache/AutoSavingCache.java Wed Aug 31 16:41:26
2011
@@ -216,7 +216,8 @@ public abstract class AutoSavingCache<K,
             else
                 type = CompactionType.UNKNOWN;
 
-            info = new CompactionInfo(ksname,
+            info = new CompactionInfo(this.hashCode(),
+                                      ksname,
                                       cfname,
                                       type,
                                       0,

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionInfo.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionInfo.java?rev=1163691&r1=1163690&r2=1163691&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionInfo.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionInfo.java Wed Aug
31 16:41:26 2011
@@ -23,16 +23,18 @@ import java.io.Serializable;
 /** Implements serializable to allow structured info to be returned via JMX. */
 public final class CompactionInfo implements Serializable
 {
+    private static final long serialVersionUID = 3695381572726744816L;
 
-
+    private final int id;
     private final String ksname;
     private final String cfname;
     private final CompactionType tasktype;
     private final long bytesComplete;
     private final long totalBytes;
 
-    public CompactionInfo(String ksname, String cfname, CompactionType tasktype, long bytesComplete,
long totalBytes)
+    public CompactionInfo(int id, String ksname, String cfname, CompactionType tasktype,
long bytesComplete, long totalBytes)
     {
+        this.id = id;
         this.ksname = ksname;
         this.cfname = cfname;
         this.tasktype = tasktype;
@@ -43,7 +45,12 @@ public final class CompactionInfo implem
     /** @return A copy of this CompactionInfo with updated progress. */
     public CompactionInfo forProgress(long bytesComplete, long totalBytes)
     {
-        return new CompactionInfo(ksname, cfname, tasktype, bytesComplete, totalBytes);
+        return new CompactionInfo(id, ksname, cfname, tasktype, bytesComplete, totalBytes);
+    }
+
+    public int getId()
+    {
+        return id;
     }
 
     public String getKeyspace()
@@ -74,7 +81,7 @@ public final class CompactionInfo implem
     public String toString()
     {
         StringBuilder buff = new StringBuilder();
-        buff.append(getTaskType()).append('@').append(hashCode());
+        buff.append(getTaskType()).append('@').append(id);
         buff.append('(').append(getKeyspace()).append(", ").append(getColumnFamily());
         buff.append(", ").append(getBytesComplete()).append('/').append(getTotalBytes());
         return buff.append(')').toString();

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java?rev=1163691&r1=1163690&r2=1163691&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java Wed
Aug 31 16:41:26 2011
@@ -88,7 +88,8 @@ implements Iterable<AbstractCompactedRow
 
     public CompactionInfo getCompactionInfo()
     {
-        return new CompactionInfo(controller.getKeyspace(),
+        return new CompactionInfo(this.hashCode(),
+                                  controller.getKeyspace(),
                                   controller.getColumnFamily(),
                                   type,
                                   bytesRead,

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionManager.java?rev=1163691&r1=1163690&r2=1163691&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionManager.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionManager.java Wed
Aug 31 16:41:26 2011
@@ -1094,7 +1094,8 @@ public class CompactionManager implement
         {
             try
             {
-                return new CompactionInfo(sstable.descriptor.ksname,
+                return new CompactionInfo(this.hashCode(),
+                                          sstable.descriptor.ksname,
                                           sstable.descriptor.cfname,
                                           CompactionType.CLEANUP,
                                           scanner.getFilePointer(),
@@ -1121,7 +1122,8 @@ public class CompactionManager implement
         {
             try
             {
-                return new CompactionInfo(sstable.descriptor.ksname,
+                return new CompactionInfo(this.hashCode(),
+                                          sstable.descriptor.ksname,
                                           sstable.descriptor.cfname,
                                           CompactionType.SCRUB,
                                           dataFile.getFilePointer(),

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java?rev=1163691&r1=1163690&r2=1163691&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java Wed
Aug 31 16:41:26 2011
@@ -48,7 +48,8 @@ public class SecondaryIndexBuilder imple
 
     public CompactionInfo getCompactionInfo()
     {
-        return new CompactionInfo(cfs.table.name,
+        return new CompactionInfo(this.hashCode(),
+                                  cfs.table.name,
                                   cfs.columnFamily,
                                   CompactionType.INDEX_BUILD,
                                   iter.getBytesRead(),
@@ -72,4 +73,4 @@ public class SecondaryIndexBuilder imple
             throw new RuntimeException(e);
         }
     }
-}
\ No newline at end of file
+}



Mime
View raw message