skoppu22 commented on code in PR #332:
URL: https://github.com/apache/cassandra-sidecar/pull/332#discussion_r3015261296


##########
server/src/main/java/org/apache/cassandra/sidecar/cdc/CdcManager.java:
##########
@@ -207,20 +209,18 @@ public void stopConsumers()
         consumers.forEach(SidecarCdc::stop);
     }
 
-    private Integer getInstanceId(String instanceIp)
+    @VisibleForTesting
+    Integer getInstanceId(String instanceIp)
     {
-        for (InstanceMetadata instance : instanceFetcher.allLocalInstances())
+        try
         {
-            String configuredIpAddress = instance.ipAddress();
-
-            // Option 1a: Normalize both to InetAddress and compare
-            if (resolveToSameAddress(instanceIp, configuredIpAddress))
-            {
-                return instance.id();
-            }
+            return instanceFetcher.instance(instanceIp).id();
+        }
+        catch (NoSuchCassandraInstanceException e)

Review Comment:
   I believe we need to catch broader exception like Exception or 
RuntimeException to ensure the same behaviour when other kinds of exceptions 
are thrown, for example NullPointerException from a corrupted metadata state



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to