dcapwell commented on code in PR #3842:
URL: https://github.com/apache/cassandra/pull/3842#discussion_r1936395268


##########
src/java/org/apache/cassandra/service/accord/FetchTopology.java:
##########
@@ -122,19 +114,26 @@ public Response(long epoch, Topology topology)
     public static final IVerbHandler<FetchTopology> handler = message -> {
         long epoch = message.payload.epoch;
         Topology topology = 
AccordService.instance().topology().maybeGlobalForEpoch(epoch);
-        if (topology == null)
-            MessagingService.instance().respond(Response.UNKNOWN, message);
-        else
+        if (topology != null)
             MessagingService.instance().respond(new Response(epoch, topology), 
message);
+        else
+            throw new IllegalStateException("Unknown topology: " + epoch);
     };
 
     public static Future<Topology> fetch(SharedContext context, 
Collection<InetAddressAndPort> peers, long epoch)
     {
-        FetchTopology req = new FetchTopology(epoch);
-        return context.messaging().<FetchTopology, 
Response>sendWithRetries(Verb.ACCORD_FETCH_TOPOLOGY_REQ, req, 
MessagingUtils.tryAliveFirst(SharedContext.Global.instance, peers),
-                                                                               
           // If the epoch is already discovered, no need to retry
-                                                                               
           (attempt, from, failure) -> AccordService.instance().currentEpoch() 
< epoch,
-                                                                               
           MessageDelivery.RetryErrorMessage.EMPTY)
+        FetchTopology request = new FetchTopology(epoch);
+        Backoff backoff = Backoff.fromConfig(context, 
DatabaseDescriptor.getAccord().fetchRetry);
+        return context.messaging().<FetchTopology, 
Response>sendWithRetries(backoff,
+                                                                            
context.optionalTasks()::schedule,
+                                                                            
Verb.ACCORD_FETCH_TOPOLOGY_REQ,
+                                                                            
request,
+                                                                            
MessagingUtils.tryAliveFirst(SharedContext.Global.instance, peers, 
Verb.ACCORD_FETCH_TOPOLOGY_REQ.name()),
+                                                                            
(attempt, from, failure) -> {
+                                                                               
 System.out.println("Got " + failure + " from " + from + " while fetching " + 
request);

Review Comment:
   please use a `logger`



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to