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


##########
src/java/org/apache/cassandra/service/StorageService.java:
##########
@@ -1855,14 +1855,21 @@ public Collection<InetAddressAndPort> 
prepareForBootstrap(long schemaTimeoutMill
                 }
 
                 // check for operator errors...
+                long nanoDelay = MILLISECONDS.toNanos(ringTimeoutMillis);
                 for (Token token : bootstrapTokens)
                 {
                     InetAddressAndPort existing = 
tokenMetadata.getEndpoint(token);
                     if (existing != null)
                     {
-                        long nanoDelay = ringTimeoutMillis * 1000000L;
-                        if 
(Gossiper.instance.getEndpointStateForEndpoint(existing).getUpdateTimestamp() > 
(nanoTime() - nanoDelay))
+                        EndpointState endpointStateForExisting = 
Gossiper.instance.getEndpointStateForEndpoint(existing);
+                        long updateTimestamp = 
endpointStateForExisting.getUpdateTimestamp();
+                        long allowedDelay = nanoTime() - nanoDelay;
+                        if (updateTimestamp > allowedDelay && 
endpointStateForExisting.isAlive())

Review Comment:
   should be `||`. If it was updated within the last ring delay or we think its 
alive, then fail



##########
src/java/org/apache/cassandra/service/StorageService.java:
##########
@@ -1855,14 +1855,21 @@ public Collection<InetAddressAndPort> 
prepareForBootstrap(long schemaTimeoutMill
                 }
 
                 // check for operator errors...
+                long nanoDelay = MILLISECONDS.toNanos(ringTimeoutMillis);
                 for (Token token : bootstrapTokens)
                 {
                     InetAddressAndPort existing = 
tokenMetadata.getEndpoint(token);
                     if (existing != null)
                     {
-                        long nanoDelay = ringTimeoutMillis * 1000000L;
-                        if 
(Gossiper.instance.getEndpointStateForEndpoint(existing).getUpdateTimestamp() > 
(nanoTime() - nanoDelay))
+                        EndpointState endpointStateForExisting = 
Gossiper.instance.getEndpointStateForEndpoint(existing);
+                        long updateTimestamp = 
endpointStateForExisting.getUpdateTimestamp();
+                        long allowedDelay = nanoTime() - nanoDelay;

Review Comment:
   don't need to save to a local variable, can keep in the if statement



-- 
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