Repository: cassandra
Updated Branches:
  refs/heads/trunk 518ddbf9d -> 834f2a6ec


Fix comparison of address and port for repair and messages

Patch by Dave Brosius; Reviewed by Ariel Weisberg for CASSANDRA-14225


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

Branch: refs/heads/trunk
Commit: 834f2a6ecdb8974839762bf4e9c5fed32163f9c8
Parents: 518ddbf
Author: Dave Brosius <dbros...@mebigfatguy.com>
Authored: Tue Feb 13 12:30:59 2018 -0500
Committer: Ariel Weisberg <aweisb...@apple.com>
Committed: Tue Feb 13 17:46:44 2018 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/net/MessageIn.java         | 4 +++-
 src/java/org/apache/cassandra/repair/RepairRunnable.java | 9 +++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/834f2a6e/src/java/org/apache/cassandra/net/MessageIn.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/MessageIn.java 
b/src/java/org/apache/cassandra/net/MessageIn.java
index ab77f33..1cd7547 100644
--- a/src/java/org/apache/cassandra/net/MessageIn.java
+++ b/src/java/org/apache/cassandra/net/MessageIn.java
@@ -32,6 +32,8 @@ import org.apache.cassandra.io.util.DataInputBuffer;
 import org.apache.cassandra.io.util.DataInputPlus;
 import org.apache.cassandra.locator.InetAddressAndPort;
 import org.apache.cassandra.net.MessagingService.Verb;
+import org.apache.cassandra.utils.FBUtilities;
+
 /**
  * The receiving node's view of a {@link MessageOut}. See documentation on 
{@link MessageOut} for details on the
  * serialization format.
@@ -180,7 +182,7 @@ public class MessageIn<T>
      */
     public boolean isCrossNode()
     {
-        return !from.address.equals(DatabaseDescriptor.getBroadcastAddress());
+        return !from.equals(FBUtilities.getBroadcastAddressAndPort());
     }
 
     public Stage getMessageType()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/834f2a6e/src/java/org/apache/cassandra/repair/RepairRunnable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/repair/RepairRunnable.java 
b/src/java/org/apache/cassandra/repair/RepairRunnable.java
index ebe736d..89177ee 100644
--- a/src/java/org/apache/cassandra/repair/RepairRunnable.java
+++ b/src/java/org/apache/cassandra/repair/RepairRunnable.java
@@ -46,6 +46,7 @@ import org.slf4j.LoggerFactory;
 import com.codahale.metrics.Timer;
 import org.apache.cassandra.concurrent.JMXConfigurableThreadPoolExecutor;
 import org.apache.cassandra.concurrent.NamedThreadFactory;
+import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.gms.FailureDetector;
 import org.apache.cassandra.repair.consistent.SyncStatSummary;
 import org.apache.cassandra.schema.SchemaConstants;
@@ -704,7 +705,7 @@ public class RepairRunnable extends WrappedRunnable 
implements ProgressEventNoti
                 if (state == null)
                     throw new Exception("no tracestate");
 
-                String format = "select event_id, source, activity from %s.%s 
where session_id = ? and event_id > ? and event_id < ?;";
+                String format = "select event_id, source, source_port, 
activity from %s.%s where session_id = ? and event_id > ? and event_id < ?;";
                 String query = String.format(format, 
SchemaConstants.TRACE_KEYSPACE_NAME, TraceKeyspace.EVENTS);
                 SelectStatement statement = (SelectStatement) 
QueryProcessor.parseStatement(query).prepare().statement;
 
@@ -745,7 +746,11 @@ public class RepairRunnable extends WrappedRunnable 
implements ProgressEventNoti
 
                     for (UntypedResultSet.Row r : result)
                     {
-                        if (source.address.equals(r.getInetAddress("source")))
+                        int port = DatabaseDescriptor.getStoragePort();
+                        if (r.has("source_port"))
+                            port = r.getInt("source_port");
+                        InetAddressAndPort eventNode = 
InetAddressAndPort.getByAddressOverrideDefaults(r.getInetAddress("source"), 
port);
+                        if (source.equals(eventNode))
                             continue;
                         if ((uuid = r.getUUID("event_id")).timestamp() > (tcur 
- 1000) * 10000)
                             seen[si].add(uuid);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to