From 934f26979a21df51cb3e9e81022293a274667c24 Mon Sep 17 00:00:00 2001 From: Christopher Tubbs Date: Fri, 27 Feb 2026 17:59:35 -0500 Subject: [PATCH] Support building with java 21 * Require Java 21 for build (does not change runtime requirements) * Update GitHub Actions workflows * Update ASF Parent POM to latest and update some plugins * Fix some issues caught by the new compiler and/or spotbugs * Suppress 'this-escape' category of compiler checks, because of too many false-positive issues, including with generated thrift code that is hard to suppress on a case-by-case basis * Add dependency exclusion analysis (checks for unnecessary exclusions) * Update errorprone to work with Java 21 --- .github/workflows/maven-full-its.yaml | 25 ++++---- .github/workflows/maven-on-demand.yaml | 17 +++--- .github/workflows/maven.yaml | 28 +++++---- .github/workflows/scripts.yaml | 2 - core/pom.xml | 5 -- .../core/fate/zookeeper/ZooSession.java | 2 +- .../core/security/Authorizations.java | 31 ++++------ .../core/spi/balancer/GroupBalancerTest.java | 8 +-- minicluster/pom.xml | 5 -- pom.xml | 57 ++++++++++++------- server/base/pom.xml | 5 -- .../zookeeper/DistributedWorkQueue.java | 4 ++ .../master/balancer/GroupBalancerTest.java | 16 ++++-- server/compaction-coordinator/pom.xml | 5 -- server/compactor/pom.xml | 5 -- server/gc/pom.xml | 5 -- server/manager/pom.xml | 5 -- .../org/apache/accumulo/manager/Manager.java | 9 ++- .../accumulo/manager/tableOps/TableInfo.java | 4 +- .../manager/tableOps/clone/CloneInfo.java | 12 ++-- .../manager/tableOps/create/CreateTable.java | 5 +- .../namespace/create/CreateNamespace.java | 5 +- .../namespace/create/NamespaceInfo.java | 4 +- .../tableOps/tableImport/ImportTable.java | 10 ++-- .../tableImport/ImportedTableInfo.java | 4 +- server/monitor/pom.xml | 5 -- server/tserver/pom.xml | 5 -- shell/pom.xml | 5 -- test/pom.xml | 5 -- 29 files changed, 133 insertions(+), 165 deletions(-) diff --git a/.github/workflows/maven-full-its.yaml b/.github/workflows/maven-full-its.yaml index 4f75f306d0f..2f26cad1829 100644 --- a/.github/workflows/maven-full-its.yaml +++ b/.github/workflows/maven-full-its.yaml @@ -19,7 +19,6 @@ # This workflow will build a Java project with Maven # See also: -# https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven # https://docs.github.com/en/actions/reference/events-that-trigger-workflows#manual-events # https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#fromjson @@ -45,14 +44,14 @@ jobs: fastbuild: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: ref: ${{ github.event.inputs.buildRef }} - - name: Set up JDK 17 - uses: actions/setup-java@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v5 with: distribution: temurin - java-version: 17 + java-version: 21 cache: 'maven' - name: Show the first log message run: git log -n1 @@ -68,7 +67,7 @@ jobs: matrix: ${{ steps.set-matrix.outputs.CUSTOM_MATRIX }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: ref: ${{ github.event.inputs.buildRef }} - id: set-matrix @@ -82,14 +81,14 @@ jobs: fail-fast: false runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: ref: ${{ github.event.inputs.buildRef }} - - name: Set up JDK 17 - uses: actions/setup-java@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v5 with: distribution: temurin - java-version: 17 + java-version: 21 cache: 'maven' - name: Override DNS to fix IP address for hostname run: | @@ -113,21 +112,21 @@ jobs: MAVEN_OPTS: -Djansi.force=true - name: Upload unit test results if: ${{ failure() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: surefire-reports-${{ matrix.profile.name }} path: ./**/target/surefire-reports/ if-no-files-found: ignore - name: Upload integration test results if: ${{ failure() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: failsafe-reports-${{ matrix.profile.name }} path: ./**/target/failsafe-reports/ if-no-files-found: ignore - name: Upload mini test logs if: ${{ failure() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: mini-tests-logs-${{ matrix.profile.name }} path: ./**/target/**/mini-tests/**/logs/ diff --git a/.github/workflows/maven-on-demand.yaml b/.github/workflows/maven-on-demand.yaml index 0d82f398442..101b3672fd5 100644 --- a/.github/workflows/maven-on-demand.yaml +++ b/.github/workflows/maven-on-demand.yaml @@ -18,9 +18,6 @@ # # This workflow will build a Java project with Maven -# See also: -# https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven -# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#manual-events name: Manual Build @@ -62,14 +59,14 @@ jobs: name: mvn (triggered by ${{ github.event.sender.login }}) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: ref: ${{ github.event.inputs.buildRef }} - - name: Set up JDK 17 - uses: actions/setup-java@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v5 with: distribution: temurin - java-version: 17 + java-version: 21 cache: 'maven' - name: Show the first log message run: git log -n1 @@ -95,21 +92,21 @@ jobs: MAVEN_OPTS: -Djansi.force=true - name: Upload unit test results if: ${{ failure() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: surefire-reports path: ./**/target/surefire-reports/ if-no-files-found: ignore - name: Upload integration test results if: ${{ failure() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: failsafe-reports path: ./**/target/failsafe-reports/ if-no-files-found: ignore - name: Upload mini test logs if: ${{ failure() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: mini-tests-logs path: ./**/target/**/mini-tests/**/logs/ diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml index a07ea51e9fa..91c98caed06 100644 --- a/.github/workflows/maven.yaml +++ b/.github/workflows/maven.yaml @@ -18,8 +18,6 @@ # # This workflow will build a Java project with Maven -# See also: -# https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven name: QA @@ -37,12 +35,12 @@ jobs: fastbuild: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 + - uses: actions/checkout@v6 + - name: Set up JDK 21 + uses: actions/setup-java@v5 with: distribution: temurin - java-version: 17 + java-version: 21 cache: 'maven' - name: Show the first log message run: git log -n1 @@ -65,16 +63,16 @@ jobs: strategy: matrix: profile: - - {name: 'unit-tests', javaver: 17, args: 'verify -PskipQA -DskipTests=false'} - - {name: 'qa-checks', javaver: 17, args: 'verify javadoc:jar -Psec-bugs -DskipTests -Dspotbugs.timeout=3600000'} - - {name: 'compat', javaver: 17, args: 'package -DskipTests -Dversion.hadoop=3.0.3 -Dversion.zookeeper=3.5.10'} - - {name: 'errorprone', javaver: 17, args: 'verify -Derrorprone -PskipQA'} + - {name: 'unit-tests', javaver: 21, args: 'verify -PskipQA -DskipTests=false'} + - {name: 'qa-checks', javaver: 21, args: 'verify javadoc:jar -Psec-bugs -DskipTests -Dspotbugs.timeout=3600000'} + - {name: 'compat', javaver: 21, args: 'package -DskipTests -Dversion.hadoop=3.0.3 -Dversion.zookeeper=3.5.10'} + - {name: 'errorprone', javaver: 21, args: 'verify -Derrorprone -PskipQA'} fail-fast: false runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up JDK ${{ matrix.profile.javaver }} - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: distribution: temurin java-version: ${{ matrix.profile.javaver }} @@ -101,21 +99,21 @@ jobs: MAVEN_OPTS: -Djansi.force=true - name: Upload unit test results if: ${{ failure() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: surefire-reports-${{ matrix.profile.name }} path: ./**/target/surefire-reports/ if-no-files-found: ignore - name: Upload integration test results if: ${{ failure() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: failsafe-reports-${{ matrix.profile.name }} path: ./**/target/failsafe-reports/ if-no-files-found: ignore - name: Upload mini test logs if: ${{ failure() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: mini-tests-logs-${{ matrix.profile.name }} path: ./**/target/**/mini-tests/**/logs/ diff --git a/.github/workflows/scripts.yaml b/.github/workflows/scripts.yaml index 7e534047473..2911dcb1a0b 100644 --- a/.github/workflows/scripts.yaml +++ b/.github/workflows/scripts.yaml @@ -18,8 +18,6 @@ # # This workflow will build a Java project with Maven -# See also: -# https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven name: ScriptQA diff --git a/core/pom.xml b/core/pom.xml index 78945cc5dd2..d0efea0cb00 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -42,11 +42,6 @@ com.github.ben-manes.caffeine caffeine - - com.google.auto.service - auto-service - true - com.google.code.gson gson diff --git a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooSession.java b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooSession.java index 2f94173f700..00db63999c9 100644 --- a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooSession.java +++ b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooSession.java @@ -110,7 +110,7 @@ public void process(WatchedEvent event) { */ static ZooKeeper connect(String host, int timeout, String scheme, byte[] auth, Watcher watcher) { final int TIME_BETWEEN_CONNECT_CHECKS_MS = 100; - int connectTimeWait = Math.min(10_000, timeout); + long connectTimeWait = Math.min(10_000, timeout); boolean tryAgain = true; long sleepTime = 100; ZooKeeper zooKeeper = null; diff --git a/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java b/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java index 1cfeebb8b97..8dcc239a586 100644 --- a/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java +++ b/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java @@ -43,11 +43,9 @@ public class Authorizations implements Iterable, Serializable, AuthorizationContainer { private static final long serialVersionUID = 1L; - private static final Set EMPTY_AUTH_SET = Collections.emptySet(); - private static final List EMPTY_AUTH_LIST = Collections.emptyList(); - private final Set auths; - private final List authsList; // sorted order + private final HashSet auths; // type must be serializable + private final ArrayList authsList; // sorted order; type must be serializable /** * An empty set of authorizations. @@ -103,21 +101,12 @@ private void checkAuths() { } } - private static Set createInternalSet(int size) { - if (size < 1) { - return EMPTY_AUTH_SET; - } else { - return new HashSet<>(size); - } + private static HashSet createInternalSet(int size) { + return new HashSet<>(size); } - private static List createInternalList(int size) { - if (size < 1) { - return EMPTY_AUTH_LIST; - } else { - return new ArrayList<>(size); - } - + private static ArrayList createInternalList(int size) { + return new ArrayList<>(size); } /** @@ -195,8 +184,8 @@ public Authorizations(byte[] authorizations) { this.authsList = createInternalList(parts.length); setAuthorizations(parts); } else { - this.auths = EMPTY_AUTH_SET; - this.authsList = EMPTY_AUTH_LIST; + this.auths = createInternalSet(0); + this.authsList = createInternalList(0); } } } @@ -207,8 +196,8 @@ public Authorizations(byte[] authorizations) { * @see #Authorizations(String...) */ public Authorizations() { - this.auths = EMPTY_AUTH_SET; - this.authsList = EMPTY_AUTH_LIST; + this.auths = createInternalSet(0); + this.authsList = createInternalList(0); } /** diff --git a/core/src/test/java/org/apache/accumulo/core/spi/balancer/GroupBalancerTest.java b/core/src/test/java/org/apache/accumulo/core/spi/balancer/GroupBalancerTest.java index a198bd217dc..b00cbcffb55 100644 --- a/core/src/test/java/org/apache/accumulo/core/spi/balancer/GroupBalancerTest.java +++ b/core/src/test/java/org/apache/accumulo/core/spi/balancer/GroupBalancerTest.java @@ -166,7 +166,7 @@ void checkBalance() { Map expectedCounts = new HashMap<>(); - int totalExtra = 0; + long totalExtra = 0; for (String group : groupCounts.keySet()) { long groupCount = groupCounts.get(group); totalExtra += groupCount % tservers.size(); @@ -174,12 +174,12 @@ void checkBalance() { } // The number of extra tablets from all groups that each tserver must have. - int expectedExtra = totalExtra / tservers.size(); - int maxExtraGroups = expectedExtra + ((totalExtra % tservers.size() > 0) ? 1 : 0); + long expectedExtra = totalExtra / tservers.size(); + long maxExtraGroups = expectedExtra + ((totalExtra % tservers.size() > 0) ? 1 : 0); for (Entry> entry : tserverGroupCounts.entrySet()) { MapCounter tgc = entry.getValue(); - int tserverExtra = 0; + long tserverExtra = 0; for (String group : groupCounts.keySet()) { assertTrue(tgc.get(group) >= expectedCounts.get(group)); assertTrue(tgc.get(group) <= expectedCounts.get(group) + 1, diff --git a/minicluster/pom.xml b/minicluster/pom.xml index 409cc31fd03..bcec0beb563 100644 --- a/minicluster/pom.xml +++ b/minicluster/pom.xml @@ -34,11 +34,6 @@ com.beust jcommander - - com.google.auto.service - auto-service - true - com.google.guava guava diff --git a/pom.xml b/pom.xml index c99b4a2a29e..462f6653965 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.apache apache - 35 + 37 org.apache.accumulo accumulo-project @@ -143,9 +143,9 @@ under the License. 1 false + 11 true - 11 true true true @@ -153,8 +153,9 @@ under the License. true .+-SNAPSHOT,(?i).*(alpha|beta)[0-9.-]*,(?i).*[.-](m|rc)[0-9]+ - 17 + 21 3.9 + ${javaVersion} 2025-08-13T01:30:03Z true @@ -280,7 +281,7 @@ under the License. com.google.auto.service - auto-service + auto-service-annotations ${version.auto-service} @@ -721,6 +722,12 @@ under the License. spotbugs-annotations true + + + com.google.auto.service + auto-service-annotations + true + @@ -729,7 +736,7 @@ under the License. org.codehaus.mojo versions-maven-plugin - 2.19.0 + 2.21.0 com.mycila @@ -774,14 +781,11 @@ under the License. modernizer-maven-plugin 2.9.0 - - ${maven.compiler.target} - com.github.spotbugs spotbugs-maven-plugin - 4.9.5.0 + 4.9.8.2 true Max @@ -820,7 +824,7 @@ under the License. com.github.koraktor mavanagaiata - 1.1.1 + 1.1.2 true @@ -836,6 +840,8 @@ under the License. -Xlint:-processing -Xlint:-try + + -Xlint:-this-escape -Xmaxwarns 5 @@ -882,11 +888,11 @@ under the License. org.apache.maven.plugins maven-release-plugin - -P !autoformat,verifyformat,thrift -DskipTests clean deploy clean package rel/@{project.version} - apache-release,accumulo-release + apache-release,accumulo-release,!autoformat,verifyformat,thrift + apache-release,accumulo-release,!autoformat,verifyformat,thrift false false true @@ -929,7 +935,7 @@ under the License. org.codehaus.mojo exec-maven-plugin - 3.5.1 + 3.6.3 net.revelc.code @@ -941,6 +947,9 @@ under the License. formatter-maven-plugin 2.29.0 + ${javaVersion} + ${javaVersion} + ${javaVersion} ${rootlocation}/src/build/eclipse-codestyle.xml **/thrift/*.java @@ -985,7 +994,7 @@ under the License. net.revelc.code impsort-maven-plugin - 1.12.0 + 1.13.0 true java.,javax.,jakarta.,org.,com. @@ -1008,9 +1017,7 @@ under the License. true - - - com.google.auto.service:auto-service-annotations:jar:* + org.apache.curator:curator-client:jar:* org.apache.hadoop:hadoop-common:jar:* @@ -1023,9 +1030,9 @@ under the License. junit:junit:jar:* - - - com.google.auto.service:auto-service:jar:* + + + com.google.auto.service:auto-service-annotations:jar:* org.apache.hadoop:hadoop-client:jar:* org.apache.hadoop:hadoop-client-runtime:jar:* @@ -1052,6 +1059,15 @@ under the License. + + analyze-exclusions + + analyze-exclusions + + + true + + @@ -1785,6 +1801,7 @@ under the License. -XDcompilePolicy=simple + -XDaddTypeAnnotationsToSymbol=true --should-stop=ifError=FLOW -Xplugin:ErrorProne \ diff --git a/server/base/pom.xml b/server/base/pom.xml index bef6dd39600..6397fc0a146 100644 --- a/server/base/pom.xml +++ b/server/base/pom.xml @@ -39,11 +39,6 @@ com.github.ben-manes.caffeine caffeine - - com.google.auto.service - auto-service - true - com.google.code.gson gson diff --git a/server/base/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java b/server/base/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java index c916090982d..968f45618c9 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java +++ b/server/base/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java @@ -45,6 +45,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + /** * Provides a way to push work out to tablet servers via zookeeper and wait for that work to be * done. Any tablet server can pick up a work item and process it. @@ -278,6 +280,8 @@ public void waitUntilDone(Set workIDs) throws KeeperException, Interrupt final Object condVar = new Object(); Watcher watcher = new Watcher() { + @SuppressFBWarnings(value = "NN_NAKED_NOTIFY", + justification = "Monitored object was updated in a ZK thread.") @Override public void process(WatchedEvent event) { switch (event.getType()) { diff --git a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/GroupBalancerTest.java b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/GroupBalancerTest.java index a25bfcf798c..c488f30e2f1 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/GroupBalancerTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/GroupBalancerTest.java @@ -56,6 +56,7 @@ public String apply(KeyExtent input) { } }; + @Deprecated public static class TabletServers { private final Set tservers = new HashSet<>(); private final Map tabletLocs = new HashMap<>(); @@ -159,7 +160,7 @@ void checkBalance() { Map expectedCounts = new HashMap<>(); - int totalExtra = 0; + long totalExtra = 0; for (String group : groupCounts.keySet()) { long groupCount = groupCounts.get(group); totalExtra += groupCount % tservers.size(); @@ -167,12 +168,12 @@ void checkBalance() { } // The number of extra tablets from all groups that each tserver must have. - int expectedExtra = totalExtra / tservers.size(); - int maxExtraGroups = expectedExtra + ((totalExtra % tservers.size() > 0) ? 1 : 0); + long expectedExtra = totalExtra / tservers.size(); + long maxExtraGroups = expectedExtra + ((totalExtra % tservers.size() > 0) ? 1 : 0); for (Entry> entry : tserverGroupCounts.entrySet()) { MapCounter tgc = entry.getValue(); - int tserverExtra = 0; + long tserverExtra = 0; for (String group : groupCounts.keySet()) { assertTrue(tgc.get(group) >= expectedCounts.get(group)); assertTrue(tgc.get(group) <= expectedCounts.get(group) + 1, @@ -187,6 +188,7 @@ void checkBalance() { } } + @Deprecated @Test public void testSingleGroup() { @@ -211,6 +213,7 @@ public void testSingleGroup() { } } + @Deprecated @Test public void testTwoGroups() { String[][] tests = {new String[] {"a", "b", "c", "d"}, new String[] {"a", "b", "c"}, @@ -240,6 +243,7 @@ public void testTwoGroups() { } } + @Deprecated @Test public void testThreeGroups() { String[][] tests = {new String[] {"a", "b", "c", "d"}, new String[] {"a", "b", "c"}, @@ -275,6 +279,7 @@ public void testThreeGroups() { } } + @Deprecated @Test public void testManySingleTabletGroups() { @@ -297,6 +302,7 @@ public void testManySingleTabletGroups() { } } + @Deprecated @Test public void testMaxMigrations() { @@ -321,6 +327,7 @@ public void testMaxMigrations() { } } + @Deprecated @Test public void bigTest() { TabletServers tservers = new TabletServers(); @@ -339,6 +346,7 @@ public void bigTest() { tservers.balance(1000); } + @Deprecated @Test public void bigTest2() { TabletServers tservers = new TabletServers(); diff --git a/server/compaction-coordinator/pom.xml b/server/compaction-coordinator/pom.xml index 9b3c51dd2f8..bf610d2d0fb 100644 --- a/server/compaction-coordinator/pom.xml +++ b/server/compaction-coordinator/pom.xml @@ -34,11 +34,6 @@ com.github.ben-manes.caffeine caffeine - - com.google.auto.service - auto-service - true - com.google.guava guava diff --git a/server/compactor/pom.xml b/server/compactor/pom.xml index 903e3d3aae0..25d3fde5a6b 100644 --- a/server/compactor/pom.xml +++ b/server/compactor/pom.xml @@ -34,11 +34,6 @@ com.beust jcommander - - com.google.auto.service - auto-service - true - com.google.guava guava diff --git a/server/gc/pom.xml b/server/gc/pom.xml index 148e63b58e7..b2861d706fa 100644 --- a/server/gc/pom.xml +++ b/server/gc/pom.xml @@ -31,11 +31,6 @@ Apache Accumulo GC Server The garbage collecting server for Apache Accumulo to clean up unused files. - - com.google.auto.service - auto-service - true - com.google.guava guava diff --git a/server/manager/pom.xml b/server/manager/pom.xml index 5f1516cb2e4..b2280f88f46 100644 --- a/server/manager/pom.xml +++ b/server/manager/pom.xml @@ -31,11 +31,6 @@ Apache Accumulo Manager Server The manager server for Apache Accumulo for load balancing and other system-wide operations. - - com.google.auto.service - auto-service - true - com.google.code.gson gson diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java b/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java index 1bb15169914..6e758d6ebcb 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java @@ -899,7 +899,7 @@ public void run() { break; } } - } catch (Exception t) { + } catch (RuntimeException t) { log.error("Error occurred reading / switching manager goal state. Will" + " continue with attempt to update status", t); } @@ -908,7 +908,7 @@ public void run() { try (Scope scope = span.makeCurrent()) { wait = updateStatus(); eventListener.waitForEvents(wait); - } catch (Exception t) { + } catch (RuntimeException t) { TraceUtil.setException(span, t, false); log.error("Error balancing tablets, will wait for {} (seconds) and then retry ", WAIT_BETWEEN_ERRORS / ONE_SECOND, t); @@ -1030,6 +1030,8 @@ private Map getTablesForLevel(DataLevel dataLevel) { } } + @SuppressFBWarnings(value = "NN_NAKED_NOTIFY", + justification = "balance state checked before notification") private long balanceTablets() { // Check for balancer property change @@ -1844,7 +1846,8 @@ public void assignedTablet(KeyExtent extent) { } } - @SuppressFBWarnings(value = "UW_UNCOND_WAIT", justification = "TODO needs triage") + @SuppressFBWarnings(value = "UW_UNCOND_WAIT", + justification = "balance condition is modified in another thread") public void waitForBalance() { synchronized (balancedNotifier) { long eventCounter; diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/TableInfo.java b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/TableInfo.java index 4abb9452fb9..c23bd831580 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/TableInfo.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/TableInfo.java @@ -19,7 +19,7 @@ package org.apache.accumulo.manager.tableOps; import java.io.Serializable; -import java.util.Map; +import java.util.HashMap; import org.apache.accumulo.core.client.admin.InitialTableState; import org.apache.accumulo.core.client.admin.TimeType; @@ -46,7 +46,7 @@ public class TableInfo implements Serializable { private String splitFile; private String splitDirsFile; - public Map props; + public HashMap props; // type must be serializable public String getTableName() { return tableName; diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/clone/CloneInfo.java b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/clone/CloneInfo.java index 2a697827ad1..87d4c9ea79f 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/clone/CloneInfo.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/clone/CloneInfo.java @@ -18,7 +18,11 @@ */ package org.apache.accumulo.manager.tableOps.clone; +import static java.util.Objects.requireNonNull; + import java.io.Serializable; +import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -35,8 +39,8 @@ class CloneInfo implements Serializable { // TODO: Make final in 3.1 private NamespaceId namespaceId; private final NamespaceId srcNamespaceId; - private final Map propertiesToSet; - private final Set propertiesToExclude; + private final HashMap propertiesToSet; // type must be serializable + private final HashSet propertiesToExclude; // type must be serializable private final boolean keepOffline; private final String user; @@ -48,8 +52,8 @@ public CloneInfo(NamespaceId srcNamespaceId, TableId srcTableId, NamespaceId dst this.srcTableId = srcTableId; this.tableName = dstTableName; this.namespaceId = dstNamespaceId; - this.propertiesToSet = propertiesToSet; - this.propertiesToExclude = propertiesToExclude; + this.propertiesToSet = new HashMap<>(requireNonNull(propertiesToSet)); + this.propertiesToExclude = new HashSet<>(requireNonNull(propertiesToExclude)); this.keepOffline = keepOffline; this.user = user; } diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/create/CreateTable.java b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/create/CreateTable.java index ec3f0dc9fd1..87fda25fa5d 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/create/CreateTable.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/create/CreateTable.java @@ -18,7 +18,10 @@ */ package org.apache.accumulo.manager.tableOps.create; +import static java.util.Objects.requireNonNull; + import java.io.IOException; +import java.util.HashMap; import java.util.Map; import org.apache.accumulo.core.client.admin.InitialTableState; @@ -49,7 +52,7 @@ public CreateTable(String user, String tableName, TimeType timeType, Map(requireNonNull(props)); tableInfo.setNamespaceId(namespaceId); tableInfo.setSplitPath(splitPath); tableInfo.setInitialSplitSize(splitCount); diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/namespace/create/CreateNamespace.java b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/namespace/create/CreateNamespace.java index 1d00945b3db..976c0b766d9 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/namespace/create/CreateNamespace.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/namespace/create/CreateNamespace.java @@ -18,6 +18,9 @@ */ package org.apache.accumulo.manager.tableOps.namespace.create; +import static java.util.Objects.requireNonNull; + +import java.util.HashMap; import java.util.Map; import org.apache.accumulo.core.data.NamespaceId; @@ -35,7 +38,7 @@ public CreateNamespace(String user, String namespaceName, Map pro namespaceInfo = new NamespaceInfo(); namespaceInfo.namespaceName = namespaceName; namespaceInfo.user = user; - namespaceInfo.props = props; + namespaceInfo.props = new HashMap<>(requireNonNull(props)); } @Override diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/namespace/create/NamespaceInfo.java b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/namespace/create/NamespaceInfo.java index 18953c31d94..51b7cae2b80 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/namespace/create/NamespaceInfo.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/namespace/create/NamespaceInfo.java @@ -19,7 +19,7 @@ package org.apache.accumulo.manager.tableOps.namespace.create; import java.io.Serializable; -import java.util.Map; +import java.util.HashMap; import org.apache.accumulo.core.data.NamespaceId; @@ -31,5 +31,5 @@ class NamespaceInfo implements Serializable { NamespaceId namespaceId; String user; - public Map props; + public HashMap props; // type must be serializable } diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/ImportTable.java b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/ImportTable.java index 484db2b9636..4ed5649b5d5 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/ImportTable.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/ImportTable.java @@ -24,8 +24,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -import java.util.Collections; -import java.util.List; +import java.util.ArrayList; import java.util.Set; import java.util.stream.Collectors; import java.util.zip.ZipEntry; @@ -164,12 +163,13 @@ public void undo(long tid, Manager env) throws Exception { Utils.unreserveNamespace(env, tableInfo.namespaceId, tid, false); } - static List parseExportDir(Set exportDirs) { + static ArrayList parseExportDir(Set exportDirs) { if (exportDirs == null || exportDirs.isEmpty()) { - return Collections.emptyList(); + return new ArrayList<>(); } return exportDirs.stream().filter(not(String::isEmpty)) - .map(ImportedTableInfo.DirectoryMapping::new).collect(Collectors.toList()); + .map(ImportedTableInfo.DirectoryMapping::new) + .collect(Collectors.toCollection(ArrayList::new)); } } diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/ImportedTableInfo.java b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/ImportedTableInfo.java index 306c7a38e52..4bb617d0d20 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/ImportedTableInfo.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/ImportedTableInfo.java @@ -19,7 +19,7 @@ package org.apache.accumulo.manager.tableOps.tableImport; import java.io.Serializable; -import java.util.List; +import java.util.ArrayList; import org.apache.accumulo.core.data.NamespaceId; import org.apache.accumulo.core.data.TableId; @@ -32,7 +32,7 @@ class ImportedTableInfo implements Serializable { public String tableName; public TableId tableId; public NamespaceId namespaceId; - public List directories; + public ArrayList directories; // type must be serializable public String exportFile; public boolean keepMappings; public boolean keepOffline; diff --git a/server/monitor/pom.xml b/server/monitor/pom.xml index a8a4dbdb3f9..56002681e3d 100644 --- a/server/monitor/pom.xml +++ b/server/monitor/pom.xml @@ -39,11 +39,6 @@ com.github.ben-manes.caffeine caffeine - - com.google.auto.service - auto-service - true - com.google.code.gson gson diff --git a/server/tserver/pom.xml b/server/tserver/pom.xml index 40622e37a18..7a23dda2623 100644 --- a/server/tserver/pom.xml +++ b/server/tserver/pom.xml @@ -39,11 +39,6 @@ com.github.ben-manes.caffeine caffeine - - com.google.auto.service - auto-service - true - com.google.guava guava diff --git a/shell/pom.xml b/shell/pom.xml index 945fe86aba8..787959690d4 100644 --- a/shell/pom.xml +++ b/shell/pom.xml @@ -34,11 +34,6 @@ com.beust jcommander - - com.google.auto.service - auto-service - true - com.google.code.gson gson diff --git a/test/pom.xml b/test/pom.xml index 30f5cf3d3c9..27bdfd8dfca 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -41,11 +41,6 @@ com.github.ben-manes.caffeine caffeine - - com.google.auto.service - auto-service - true - com.google.code.gson gson