keith-turner commented on code in PR #5775:
URL: https://github.com/apache/accumulo/pull/5775#discussion_r2252296376
##########
core/src/main/java/org/apache/accumulo/core/rpc/clients/TServerClient.java:
##########
@@ -60,16 +63,45 @@
public interface TServerClient<C extends TServiceClient> {
static final String DEBUG_HOST = "org.apache.accumulo.client.rpc.debug.host";
+ static final String DEBUG_RG = "org.apache.accumulo.client.rpc.debug.group";
- Pair<String,C> getThriftServerConnection(ClientContext context, boolean
preferCachedConnections)
- throws TTransportException;
+ Pair<String,C> getThriftServerConnection(ClientContext context, boolean
preferCachedConnections,
+ ResourceGroupPredicate rgp) throws TTransportException;
default Pair<String,C> getThriftServerConnection(Logger LOG,
ThriftClientTypes<C> type,
ClientContext context, boolean preferCachedConnections, AtomicBoolean
warned,
- ThriftService service) throws TTransportException {
+ ThriftService service, ResourceGroupPredicate rgp) throws
TTransportException {
checkArgument(context != null, "context is null");
final String debugHost = System.getProperty(DEBUG_HOST, null);
+ final String debugRG = System.getProperty(DEBUG_RG, null);
+
+ if (debugHost != null && debugRG != null) {
+ LOG.warn("System properties {} and {} are both set. If set incorrectly
then"
+ + " this client may not find a server to connect to.", DEBUG_HOST,
DEBUG_RG);
+ }
+
+ if (debugRG != null) {
+ if (type == ThriftClientTypes.CLIENT || type ==
ThriftClientTypes.COMPACTOR
+ || type == ThriftClientTypes.SERVER_PROCESS || type ==
ThriftClientTypes.TABLET_INGEST
+ || type == ThriftClientTypes.TABLET_MGMT || type ==
ThriftClientTypes.TABLET_SCAN
+ || type == ThriftClientTypes.TABLET_SERVER) {
+ final ResourceGroupId dgid = ResourceGroupId.of(debugRG);
+ if (rgp.test(dgid)) {
+ // its safe to potentially narrow the predicate
+ LOG.debug("System property '{}' set to '{}' overriding predicate
argument", DEBUG_RG,
+ debugRG);
+ rgp = r -> r.equals(dgid);
+ } else {
+ LOG.warn("System property '{}' set to '{}' does not intersect with
predicate argument."
+ + " Ignoring degug system property.", DEBUG_RG, debugRG);
+ }
+ } else {
+ LOG.debug(
+ "System property '{}' set to '{}' but ignored when making RPCs to
management servers",
+ DEBUG_RG, debugRG);
+ }
+ }
Review Comment:
A few lines after this there is code to get a cached connection, if that
finds something it could be from a different RG than what is needed.
--
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]