-
Notifications
You must be signed in to change notification settings - Fork 3.7k
CASSANDRA-20291 Filter unreachable private IPs from batch log writing #4155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: cassandra-4.1
Are you sure you want to change the base?
Conversation
Add filtering logic to remove reachable private IPs from list of nodes to be selected for batch log writes. Patch By Manish Khandelwal, Reviewed by TBD for CASSANDRA-20291
@@ -45,7 +49,8 @@ | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
|
|||
|
|||
import com.carrotsearch.hppc.ObjectIntHashMap; | |||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the imports should be moved back.
@@ -269,7 +281,7 @@ public static ReplicaPlan.ForWrite forBatchlogWrite(boolean isAny) throws Unavai | |||
} | |||
|
|||
@VisibleForTesting | |||
public static Collection<InetAddressAndPort> filterBatchlogEndpoints(boolean preferLocalRack, String localRack, | |||
public static Collection<InetAddressAndPort> filterBatchlogEndpoints(boolean preferLocalRack, String localRack, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indentation.
continue; | ||
|
||
// Check for intra dc connectivity on private network. Cache the result for 30 seconds. | ||
// Valid for topology where two newtwork interfaces are used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove line
@@ -414,13 +446,86 @@ public static Collection<InetAddressAndPort> filterBatchlogEndpointsDynamic(bool | |||
if (result.contains(endpoint)) | |||
continue; | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove line
} | ||
} | ||
@VisibleForTesting | ||
public static class CacheEntry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
} | ||
|
||
// Check reachability with cache | ||
private static boolean isReachableWithCache(InetAddressAndPort address, int timeoutMs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ on new line.
return reachable; | ||
} | ||
|
||
private static boolean isReachableOnce(InetAddressAndPort address, int timeoutMs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ on new line
Add filtering logic to remove reachable private IPs from list of nodes to be selected for batch log writes. Patch By Manish Khandelwal, Reviewed by TBD for CASSANDRA-20291
This patch handles batch log writing in case of loss of private IP connectivity with multi interface enabled ( public ip for multi data center). This logic is