diff --git a/gateway-ha/src/main/java/io/trino/gateway/ha/clustermonitor/ActiveClusterMonitor.java b/gateway-ha/src/main/java/io/trino/gateway/ha/clustermonitor/ActiveClusterMonitor.java index bc3a6842e..35fd4c026 100644 --- a/gateway-ha/src/main/java/io/trino/gateway/ha/clustermonitor/ActiveClusterMonitor.java +++ b/gateway-ha/src/main/java/io/trino/gateway/ha/clustermonitor/ActiveClusterMonitor.java @@ -17,7 +17,6 @@ import io.dropwizard.lifecycle.Managed; import io.trino.gateway.ha.config.MonitorConfiguration; import io.trino.gateway.ha.config.ProxyBackendConfiguration; -import io.trino.gateway.ha.router.BackendStateManager; import io.trino.gateway.ha.router.GatewayBackendManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,7 +38,6 @@ public class ActiveClusterMonitor private final List clusterStatsObservers; private final GatewayBackendManager gatewayBackendManager; - private final BackendStateManager backendStateManager; private final int connectionTimeout; private final int taskDelayMin; private final ClusterStatsMonitor clusterStatsMonitor; @@ -52,14 +50,12 @@ public ActiveClusterMonitor( List clusterStatsObservers, GatewayBackendManager gatewayBackendManager, MonitorConfiguration monitorConfiguration, - BackendStateManager backendStateManager, ClusterStatsMonitor clusterStatsMonitor) { this.clusterStatsObservers = clusterStatsObservers; this.gatewayBackendManager = gatewayBackendManager; this.connectionTimeout = monitorConfiguration.getConnectionTimeout(); this.taskDelayMin = monitorConfiguration.getTaskDelayMin(); - this.backendStateManager = backendStateManager; this.clusterStatsMonitor = clusterStatsMonitor; log.info("Running cluster monitor with connection timeout of {} and task delay of {}", connectionTimeout, taskDelayMin); diff --git a/gateway-ha/src/main/java/io/trino/gateway/ha/clustermonitor/ClusterStatsHttpMonitor.java b/gateway-ha/src/main/java/io/trino/gateway/ha/clustermonitor/ClusterStatsHttpMonitor.java index f94ac921e..e2b2c4fc5 100644 --- a/gateway-ha/src/main/java/io/trino/gateway/ha/clustermonitor/ClusterStatsHttpMonitor.java +++ b/gateway-ha/src/main/java/io/trino/gateway/ha/clustermonitor/ClusterStatsHttpMonitor.java @@ -65,8 +65,7 @@ public ClusterStats monitor(ProxyBackendConfiguration backend) } try { - HashMap result = null; - result = new ObjectMapper().readValue(response, HashMap.class); + HashMap result = new ObjectMapper().readValue(response, HashMap.class); clusterStats.setNumWorkerNodes((int) result.get("activeWorkers")); clusterStats.setQueuedQueryCount((int) result.get("queuedQueries")); diff --git a/gateway-ha/src/main/java/io/trino/gateway/ha/router/TrinoQueueLengthRoutingTable.java b/gateway-ha/src/main/java/io/trino/gateway/ha/router/TrinoQueueLengthRoutingTable.java index 59ff9f92d..7ed110a15 100644 --- a/gateway-ha/src/main/java/io/trino/gateway/ha/router/TrinoQueueLengthRoutingTable.java +++ b/gateway-ha/src/main/java/io/trino/gateway/ha/router/TrinoQueueLengthRoutingTable.java @@ -83,10 +83,10 @@ public TrinoQueueLengthRoutingTable(GatewayBackendManager gatewayBackendManager, */ private int getWeightForMaxQueueCluster(LinkedHashMap sortedByQueueLength) { - int queueSum = 0; - int numBuckets = 1; - int equalDistribution = 0; - int calculatedWtMaxQueue = 0; + int queueSum; + int numBuckets; + int equalDistribution; + int calculatedWtMaxQueue; numBuckets = sortedByQueueLength.size(); queueSum = sortedByQueueLength.values().stream().mapToInt(Integer::intValue).sum(); @@ -133,12 +133,8 @@ private void computeWeightsBasedOnQueueLength(ConcurrentHashMap e1, LinkedHashMap::new)); numBuckets = sortedByQueueLength.size(); - queueSum = sortedByQueueLength.values().stream().mapToInt(Integer::intValue).sum(); Object[] queueLengths = sortedByQueueLength.values().toArray(); Object[] clusterNames = sortedByQueueLength.keySet().toArray(); diff --git a/gateway-ha/src/main/java/io/trino/gateway/ha/security/LbFormAuthManager.java b/gateway-ha/src/main/java/io/trino/gateway/ha/security/LbFormAuthManager.java index 73d09267a..0c97ccb0e 100644 --- a/gateway-ha/src/main/java/io/trino/gateway/ha/security/LbFormAuthManager.java +++ b/gateway-ha/src/main/java/io/trino/gateway/ha/security/LbFormAuthManager.java @@ -38,7 +38,6 @@ public class LbFormAuthManager */ private final LbKeyProvider lbKeyProvider; Map presetUsers; - private LdapConfiguration ldapConfiguration; private final LbLdapClient lbLdapClient; public LbFormAuthManager(FormAuthConfiguration configuration, diff --git a/gateway-ha/src/test/java/io/trino/gateway/ha/router/TestSpecificDbResourceGroupsManager.java b/gateway-ha/src/test/java/io/trino/gateway/ha/router/TestSpecificDbResourceGroupsManager.java index e17f2da2f..b5fe4515f 100644 --- a/gateway-ha/src/test/java/io/trino/gateway/ha/router/TestSpecificDbResourceGroupsManager.java +++ b/gateway-ha/src/test/java/io/trino/gateway/ha/router/TestSpecificDbResourceGroupsManager.java @@ -62,8 +62,7 @@ private void createResourceGroup() resourceGroup.setJmxExport(true); resourceGroup.setSoftMemoryLimit("80%"); - ResourceGroupsDetail newResourceGroup = resourceGroupManager.createResourceGroup(resourceGroup, - specificDb); + resourceGroupManager.createResourceGroup(resourceGroup, specificDb); } @Test diff --git a/gateway-ha/src/test/java/io/trino/gateway/ha/router/TestTrinoQueueLengthRoutingTable.java b/gateway-ha/src/test/java/io/trino/gateway/ha/router/TestTrinoQueueLengthRoutingTable.java index b1bdc2c5b..ddfb9a3e4 100644 --- a/gateway-ha/src/test/java/io/trino/gateway/ha/router/TestTrinoQueueLengthRoutingTable.java +++ b/gateway-ha/src/test/java/io/trino/gateway/ha/router/TestTrinoQueueLengthRoutingTable.java @@ -135,7 +135,6 @@ private void registerBackEndsWithUserQueue(String groupName, int numBackends, int mockRunningLength = 0; String backend; - Map queueLengths = new HashMap<>(); Map runningLengths = new HashMap<>(); Table userClusterQueue = HashBasedTable.create(); diff --git a/pom.xml b/pom.xml index e35cd9137..49cefe062 100644 --- a/pom.xml +++ b/pom.xml @@ -120,7 +120,8 @@ false -XDcompilePolicy=simple - -Xplugin:ErrorProne + -Xplugin:ErrorProne \ + -Xep:UnusedVariable:ERROR