Skip to content

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

Open
wants to merge 1 commit into
base: cassandra-4.1
Choose a base branch
from

Conversation

manmagic3
Copy link

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

  1. Check for valid candiates for batch log writing using following logic
  • Skip local node  (already in place)
    
  • Skip if failure detector shows node down ( already in place)
    
  • Check for intra dc connectivity on private network. Cache the result for 30 seconds (hard coded as of now can be made configurable). Valid for topology where two network interfaces are introduced (This logic is freshly introduced.)
    

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
@manmagic3 manmagic3 marked this pull request as draft May 12, 2025 08:26
@manmagic3 manmagic3 marked this pull request as ready for review May 26, 2025 05:45
@@ -45,7 +49,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


import com.carrotsearch.hppc.ObjectIntHashMap;
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
Copy link
Contributor

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,
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

}


Copy link
Contributor

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;


Copy link
Contributor

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
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ on new line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants