You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2011/09/19 14:38:01 UTC

svn commit: r1172591 - in /cassandra/branches/cassandra-0.8: CHANGES.txt src/java/org/apache/cassandra/service/AntiEntropyService.java src/java/org/apache/cassandra/service/StorageService.java

Author: slebresne
Date: Mon Sep 19 12:38:00 2011
New Revision: 1172591

URL: http://svn.apache.org/viewvc?rev=1172591&view=rev
Log:
Log message at INFO when a global or keyspace level repair operation completes
patch by slebresne; reviewed by jbellis for CASSANDRA-3207

Modified:
    cassandra/branches/cassandra-0.8/CHANGES.txt
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/AntiEntropyService.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/StorageService.java

Modified: cassandra/branches/cassandra-0.8/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/CHANGES.txt?rev=1172591&r1=1172590&r2=1172591&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.8/CHANGES.txt Mon Sep 19 12:38:00 2011
@@ -1,6 +1,8 @@
 0.8.7
  * Kill server on wrapped OOME such as from FileChannel.map (CASSANDRA-3201)
  * Allow using quotes in "USE <keyspace>;" CLI command (CASSANDRA-3208)
+ * Log message when a full repair operation completes (CASSANDRA-3207)
+
 
 0.8.6
  * revert CASSANDRA-2388

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/AntiEntropyService.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/AntiEntropyService.java?rev=1172591&r1=1172590&r2=1172591&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/AntiEntropyService.java (original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/AntiEntropyService.java Mon Sep 19 12:38:00 2011
@@ -678,8 +678,15 @@ public class AntiEntropyService
                 // block whatever thread started this session until all requests have been returned:
                 // if this thread dies, the session will still complete in the background
                 completed.await();
-                if (exception != null)
+                if (exception == null)
+                {
+                    logger.info(String.format("Repair session %s (on cfs %s, range %s) completed successfully", getName()), cfnames, range);
+                }
+                else
+                {
+                    logger.error(String.format("Repair session %s (on cfs %s, range %s) failed with the following error", getName(), cfnames, range), exception);
                     throw exception;
+                }
             }
             catch (InterruptedException e)
             {

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/StorageService.java?rev=1172591&r1=1172590&r2=1172591&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/StorageService.java (original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/StorageService.java Mon Sep 19 12:38:00 2011
@@ -27,6 +27,7 @@ import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
 import java.util.*;
 import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicInteger;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
@@ -199,6 +200,8 @@ public class StorageService implements I
     /* Used for tracking drain progress */
     private volatile int totalCFs, remainingCFs;
 
+    private static final AtomicInteger nextRepairCommand = new AtomicInteger();
+
     public void finishBootstrapping()
     {
         isBootstrapMode = false;
@@ -1590,8 +1593,13 @@ public class StorageService implements I
         {
             return;
         }
-        List<AntiEntropyService.RepairFuture> futures = new ArrayList<AntiEntropyService.RepairFuture>();
-        for (Range range : getLocalRanges(tableName))
+
+        Collection<Range> ranges = getLocalRanges(tableName);
+        int cmd = nextRepairCommand.incrementAndGet();
+        logger_.info("Starting repair command #{}, repairing {} ranges.", cmd, ranges.size());
+
+        List<AntiEntropyService.RepairFuture> futures = new ArrayList<AntiEntropyService.RepairFuture>(ranges.size());
+        for (Range range : ranges)
         {
             AntiEntropyService.RepairFuture future = forceTableRepair(range, tableName, columnFamilies);
             futures.add(future);
@@ -1623,7 +1631,9 @@ public class StorageService implements I
         }
 
         if (failedSession)
-            throw new IOException("Some repair session(s) failed (see log for details).");
+            throw new IOException("Repair command #" + cmd + ": some repair session(s) failed (see log for details).");
+        else
+            logger_.info("Repair command #{} completed successfully", cmd);
     }
 
     public AntiEntropyService.RepairFuture forceTableRepair(final Range range, final String tableName, final String... columnFamilies) throws IOException