You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jj...@apache.org on 2017/02/10 23:56:01 UTC

[3/6] cassandra git commit: CASSANDRA-13205: Hint message should also include IP address of the destination

CASSANDRA-13205: Hint message should also include IP address of the destination

Patch by Jeff Jirsa; Reviewed by Blake Eggleston for CASSANDRA-13205


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0cc1c1b2
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0cc1c1b2
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0cc1c1b2

Branch: refs/heads/trunk
Commit: 0cc1c1b2a8e66905d3f672645e820664d2220e10
Parents: 4e669cf
Author: Jeff Jirsa <jj...@apple.com>
Authored: Wed Feb 8 09:53:36 2017 -0800
Committer: Jeff Jirsa <je...@jeffjirsa.net>
Committed: Fri Feb 10 15:52:49 2017 -0800

----------------------------------------------------------------------
 CHANGES.txt                                            |  2 ++
 .../org/apache/cassandra/hints/HintVerbHandler.java    |  6 ++++--
 .../apache/cassandra/hints/HintsDispatchExecutor.java  | 13 +++++++------
 src/java/org/apache/cassandra/hints/HintsReader.java   |  7 +++++--
 4 files changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/0cc1c1b2/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 91bfe12..007d06c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 3.0.11
+ * Hint related logging should include the IP address of the destination in addition to 
+   host ID (CASSANDRA-13205)
  * Reloading logback.xml does not work (CASSANDRA-13173)
  * Lightweight transactions temporarily fail after upgrade from 2.1 to 3.0 (CASSANDRA-13109)
  * Duplicate rows after upgrading from 2.1.16 to 3.0.10/3.9 (CASSANDRA-13125)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0cc1c1b2/src/java/org/apache/cassandra/hints/HintVerbHandler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintVerbHandler.java b/src/java/org/apache/cassandra/hints/HintVerbHandler.java
index 1fa479c..2b92a42 100644
--- a/src/java/org/apache/cassandra/hints/HintVerbHandler.java
+++ b/src/java/org/apache/cassandra/hints/HintVerbHandler.java
@@ -47,6 +47,7 @@ public final class HintVerbHandler implements IVerbHandler<HintMessage>
     {
         UUID hostId = message.payload.hostId;
         Hint hint = message.payload.hint;
+        InetAddress address = StorageService.instance.getEndpointForHostId(hostId);
 
         // If we see an unknown table id, it means the table, or one of the tables in the mutation, had been dropped.
         // In that case there is nothing we can really do, or should do, other than log it go on.
@@ -54,7 +55,8 @@ public final class HintVerbHandler implements IVerbHandler<HintMessage>
         // is schema agreement between the sender and the receiver.
         if (hint == null)
         {
-            logger.trace("Failed to decode and apply a hint for {} - table with id {} is unknown",
+            logger.trace("Failed to decode and apply a hint for {}: {} - table with id {} is unknown",
+                         address,
                          hostId,
                          message.payload.unknownTableID);
             reply(id, message.from);
@@ -68,7 +70,7 @@ public final class HintVerbHandler implements IVerbHandler<HintMessage>
         }
         catch (MarshalException e)
         {
-            logger.warn("Failed to validate a hint for {} (table id {}) - skipped", hostId);
+            logger.warn("Failed to validate a hint for {}: {} - skipped", address, hostId);
             reply(id, message.from);
             return;
         }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0cc1c1b2/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java b/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
index 5292dc1..333232d 100644
--- a/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
+++ b/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
@@ -137,11 +137,12 @@ final class HintsDispatchExecutor
         public void run()
         {
             UUID hostId = hostIdSupplier.get();
-            logger.info("Transferring all hints to {}", hostId);
+            InetAddress address = StorageService.instance.getEndpointForHostId(hostId);
+            logger.info("Transferring all hints to {}: {}", address, hostId);
             if (transfer(hostId))
                 return;
 
-            logger.warn("Failed to transfer all hints to {}; will retry in {} seconds", hostId, 10);
+            logger.warn("Failed to transfer all hints to {}: {}; will retry in {} seconds", address, hostId, 10);
 
             try
             {
@@ -153,10 +154,10 @@ final class HintsDispatchExecutor
             }
 
             hostId = hostIdSupplier.get();
-            logger.info("Transferring all hints to {}", hostId);
+            logger.info("Transferring all hints to {}: {}", address, hostId);
             if (!transfer(hostId))
             {
-                logger.error("Failed to transfer all hints to {}", hostId);
+                logger.error("Failed to transfer all hints to {}: {}", address, hostId);
                 throw new RuntimeException("Failed to transfer all hints to " + hostId);
             }
         }
@@ -260,14 +261,14 @@ final class HintsDispatchExecutor
                 {
                     store.delete(descriptor);
                     store.cleanUp(descriptor);
-                    logger.info("Finished hinted handoff of file {} to endpoint {}", descriptor.fileName(), hostId);
+                    logger.info("Finished hinted handoff of file {} to endpoint {}: {}", descriptor.fileName(), address, hostId);
                     return true;
                 }
                 else
                 {
                     store.markDispatchOffset(descriptor, dispatcher.dispatchOffset());
                     store.offerFirst(descriptor);
-                    logger.info("Finished hinted handoff of file {} to endpoint {}, partially", descriptor.fileName(), hostId);
+                    logger.info("Finished hinted handoff of file {} to endpoint {}: {}, partially", descriptor.fileName(), address, hostId);
                     return false;
                 }
             }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0cc1c1b2/src/java/org/apache/cassandra/hints/HintsReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintsReader.java b/src/java/org/apache/cassandra/hints/HintsReader.java
index fe2b57a..ef24aca 100644
--- a/src/java/org/apache/cassandra/hints/HintsReader.java
+++ b/src/java/org/apache/cassandra/hints/HintsReader.java
@@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.db.UnknownColumnFamilyException;
 import org.apache.cassandra.io.FSReadError;
+import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.AbstractIterator;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.CLibrary;
@@ -225,7 +226,8 @@ class HintsReader implements AutoCloseable, Iterable<HintsReader.Page>
             }
             catch (UnknownColumnFamilyException e)
             {
-                logger.warn("Failed to read a hint for {} - table with id {} is unknown in file {}",
+                logger.warn("Failed to read a hint for {}: {} - table with id {} is unknown in file {}",
+                            StorageService.instance.getEndpointForHostId(descriptor.hostId),
                             descriptor.hostId,
                             e.cfId,
                             descriptor.fileName());
@@ -238,7 +240,8 @@ class HintsReader implements AutoCloseable, Iterable<HintsReader.Page>
                 return hint;
 
             // log a warning and skip the corrupted entry
-            logger.warn("Failed to read a hint for {} - digest mismatch for hint at position {} in file {}",
+            logger.warn("Failed to read a hint for {}: {} - digest mismatch for hint at position {} in file {}",
+                        StorageService.instance.getEndpointForHostId(descriptor.hostId),
                         descriptor.hostId,
                         input.getPosition() - size - 4,
                         descriptor.fileName());