diff --git a/.github/workflows/cluster-it-1c1d.yml b/.github/workflows/cluster-it-1c1d.yml index 3fc0e6360dc91..f84b149df72b5 100644 --- a/.github/workflows/cluster-it-1c1d.yml +++ b/.github/workflows/cluster-it-1c1d.yml @@ -4,19 +4,19 @@ on: push: branches: - master - - 'rel/*' - - 'rc/*' + - "rel/*" + - "rc/*" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" pull_request: branches: - master - - 'rel/*' - - 'rc/*' + - "rel/*" + - "rc/*" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" # allow manually run the action: workflow_dispatch: @@ -35,7 +35,7 @@ jobs: fail-fast: false max-parallel: 15 matrix: - os: [ ubuntu-latest, windows-latest ] + os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: @@ -43,8 +43,10 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: 17 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -63,10 +65,10 @@ jobs: if: ${{ runner.os == 'Linux' }} shell: bash run: sudo sysctl -w net.core.somaxconn=65535 -# - name: Adjust Mac kernel somaxconn -# if: ${{ runner.os == 'macOS' }} -# shell: bash -# run: sudo sysctl -w kern.ipc.somaxconn=65535 + # - name: Adjust Mac kernel somaxconn + # if: ${{ runner.os == 'macOS' }} + # shell: bash + # run: sudo sysctl -w kern.ipc.somaxconn=65535 - name: IT/UT Test shell: bash # we do not compile client-cpp for saving time, it is tested in client.yml @@ -85,4 +87,3 @@ jobs: name: standalone-log-java${{ matrix.java }}-${{ runner.os }} path: integration-test/target/cluster-logs retention-days: 1 - diff --git a/.github/workflows/cluster-it-1c3d.yml b/.github/workflows/cluster-it-1c3d.yml index b2f179d33a865..a9906db395f5e 100644 --- a/.github/workflows/cluster-it-1c3d.yml +++ b/.github/workflows/cluster-it-1c3d.yml @@ -4,20 +4,20 @@ on: push: branches: - master - - 'rel/*' - - 'rc/*' + - "rel/*" + - "rc/*" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" pull_request: branches: - master - - 'rel/*' - - 'rc/*' - - 'force_ci/**' + - "rel/*" + - "rc/*" + - "force_ci/**" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" # allow manually run the action: workflow_dispatch: @@ -36,10 +36,10 @@ jobs: fail-fast: false max-parallel: 20 matrix: - java: [ 17 ] + java: [17] runs-on: [self-hosted, iotdb] -# group: self-hosted -# labels: iotdb + # group: self-hosted + # labels: iotdb steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} @@ -47,6 +47,8 @@ jobs: with: distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: IT/UT Test shell: bash # we do not compile client-cpp for saving time, it is tested in client.yml diff --git a/.github/workflows/compile-check.yml b/.github/workflows/compile-check.yml index 92522f48970d2..b2aeece10ed59 100644 --- a/.github/workflows/compile-check.yml +++ b/.github/workflows/compile-check.yml @@ -6,20 +6,20 @@ on: push: branches: - master - - 'rel/*' - - 'rc/*' + - "rel/*" + - "rc/*" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" pull_request: branches: - master - - 'rel/*' - - 'rc/*' - - 'force_ci/**' + - "rel/*" + - "rc/*" + - "force_ci/**" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" # allow manually run the action: workflow_dispatch: @@ -38,15 +38,17 @@ jobs: fail-fast: false matrix: java: [8] - os: [ ubuntu-latest ] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: corretto java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Compiler Test shell: bash run: | diff --git a/.github/workflows/daily-it.yml b/.github/workflows/daily-it.yml index c49ef772905fe..03e2ae93b1f8b 100644 --- a/.github/workflows/daily-it.yml +++ b/.github/workflows/daily-it.yml @@ -3,7 +3,7 @@ name: Daily IT on: schedule: # Run at UTC 19:00 every day (CST 03:00 AM) - - cron: '0 19 * * *' + - cron: "0 19 * * *" concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -20,7 +20,7 @@ jobs: fail-fast: false max-parallel: 20 matrix: - java: [ 8, 17 ] + java: [8, 17] runs-on: [self-hosted, iotdb] # group: self-hosted # labels: iotdb @@ -31,6 +31,8 @@ jobs: with: distribution: corretto java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: IT/UT Test shell: bash run: | @@ -52,8 +54,8 @@ jobs: fail-fast: false max-parallel: 15 matrix: - java: [ 8, 17 ] - runs-on: [ self-hosted, iotdb ] + java: [8, 17] + runs-on: [self-hosted, iotdb] # group: self-hosted # labels: iotdb steps: @@ -63,6 +65,8 @@ jobs: with: distribution: corretto java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: IT/UT Test shell: bash # we do not compile client-cpp for saving time, it is tested in client.yml @@ -88,9 +92,21 @@ jobs: matrix: java: [17] # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. - cluster1: [LightWeightStandaloneMode, ScalableSingleNodeMode, HighPerformanceMode, PipeConsensusBatchMode, PipeConsensusStreamMode] - cluster2: [LightWeightStandaloneMode, ScalableSingleNodeMode, HighPerformanceMode] - os: [ ubuntu-latest ] + cluster1: + [ + LightWeightStandaloneMode, + ScalableSingleNodeMode, + HighPerformanceMode, + PipeConsensusBatchMode, + PipeConsensusStreamMode, + ] + cluster2: + [ + LightWeightStandaloneMode, + ScalableSingleNodeMode, + HighPerformanceMode, + ] + os: [ubuntu-latest] exclude: - cluster1: LightWeightStandaloneMode cluster2: LightWeightStandaloneMode @@ -118,8 +134,10 @@ jobs: - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -154,11 +172,11 @@ jobs: echo "==================== BEGIN: ~/run-tests-$attempt.log ====================" echo "$test_output" echo "==================== END: ~/run-tests-$attempt.log ======================" - + if ! mv ~/run-tests-$attempt.log integration-test/target/cluster-logs/ 2>/dev/null; then echo "Failed to move log file ~/run-tests-$attempt.log to integration-test/target/cluster-logs/. Skipping..." fi - + if echo "$test_output" | grep -q "Could not transfer artifact"; then if [ $attempt -lt $max_attempts ]; then echo "Test failed with artifact transfer issue, attempt $attempt. Retrying in $retry_sleep seconds..." @@ -193,16 +211,25 @@ jobs: matrix: java: [17] # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. - cluster: [LightWeightStandaloneMode, ScalableSingleNodeMode, HighPerformanceMode, PipeConsensusBatchMode, PipeConsensusStreamMode] - os: [ ubuntu-latest ] + cluster: + [ + LightWeightStandaloneMode, + ScalableSingleNodeMode, + HighPerformanceMode, + PipeConsensusBatchMode, + PipeConsensusStreamMode, + ] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -233,11 +260,11 @@ jobs: -am -PMultiClusterIT2DualTreeAutoBasic \ -ntp >> ~/run-tests-$attempt.log && return 0 test_output=$(cat ~/run-tests-$attempt.log) - + echo "==================== BEGIN: ~/run-tests-$attempt.log ====================" echo "$test_output" echo "==================== END: ~/run-tests-$attempt.log ======================" - + if ! mv ~/run-tests-$attempt.log integration-test/target/cluster-logs/ 2>/dev/null; then echo "Failed to move log file ~/run-tests-$attempt.log to integration-test/target/cluster-logs/. Skipping..." fi @@ -276,9 +303,21 @@ jobs: matrix: java: [17] # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. - cluster1: [LightWeightStandaloneMode, ScalableSingleNodeMode, HighPerformanceMode, PipeConsensusBatchMode, PipeConsensusStreamMode] - cluster2: [LightWeightStandaloneMode, ScalableSingleNodeMode, HighPerformanceMode] - os: [ ubuntu-latest ] + cluster1: + [ + LightWeightStandaloneMode, + ScalableSingleNodeMode, + HighPerformanceMode, + PipeConsensusBatchMode, + PipeConsensusStreamMode, + ] + cluster2: + [ + LightWeightStandaloneMode, + ScalableSingleNodeMode, + HighPerformanceMode, + ] + os: [ubuntu-latest] exclude: - cluster1: LightWeightStandaloneMode cluster2: LightWeightStandaloneMode @@ -306,8 +345,10 @@ jobs: - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -342,7 +383,7 @@ jobs: echo "==================== BEGIN: ~/run-tests-$attempt.log ====================" echo "$test_output" echo "==================== END: ~/run-tests-$attempt.log ======================" - + if ! mv ~/run-tests-$attempt.log integration-test/target/cluster-logs/ 2>/dev/null; then echo "Failed to move log file ~/run-tests-$attempt.log to integration-test/target/cluster-logs/. Skipping..." fi @@ -381,9 +422,21 @@ jobs: matrix: java: [17] # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. - cluster1: [LightWeightStandaloneMode, ScalableSingleNodeMode, HighPerformanceMode, PipeConsensusBatchMode, PipeConsensusStreamMode] - cluster2: [LightWeightStandaloneMode, ScalableSingleNodeMode, HighPerformanceMode] - os: [ ubuntu-latest ] + cluster1: + [ + LightWeightStandaloneMode, + ScalableSingleNodeMode, + HighPerformanceMode, + PipeConsensusBatchMode, + PipeConsensusStreamMode, + ] + cluster2: + [ + LightWeightStandaloneMode, + ScalableSingleNodeMode, + HighPerformanceMode, + ] + os: [ubuntu-latest] exclude: - cluster1: LightWeightStandaloneMode cluster2: LightWeightStandaloneMode @@ -411,8 +464,10 @@ jobs: - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -447,7 +502,7 @@ jobs: echo "==================== BEGIN: ~/run-tests-$attempt.log ====================" echo "$test_output" echo "==================== END: ~/run-tests-$attempt.log ======================" - + if ! mv ~/run-tests-$attempt.log integration-test/target/cluster-logs/ 2>/dev/null; then echo "Failed to move log file ~/run-tests-$attempt.log to integration-test/target/cluster-logs/. Skipping..." fi @@ -484,19 +539,26 @@ jobs: fail-fast: false max-parallel: 15 matrix: - java: [ 17 ] + java: [17] # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. - cluster1: [ ScalableSingleNodeMode, PipeConsensusBatchMode, PipeConsensusStreamMode ] - cluster2: [ ScalableSingleNodeMode ] - os: [ ubuntu-latest ] + cluster1: + [ + ScalableSingleNodeMode, + PipeConsensusBatchMode, + PipeConsensusStreamMode, + ] + cluster2: [ScalableSingleNodeMode] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -568,19 +630,21 @@ jobs: fail-fast: false max-parallel: 15 matrix: - java: [ 17 ] + java: [17] # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. - cluster1: [ ScalableSingleNodeMode ] - cluster2: [ ScalableSingleNodeMode ] - os: [ ubuntu-latest ] + cluster1: [ScalableSingleNodeMode] + cluster2: [ScalableSingleNodeMode] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -652,19 +716,26 @@ jobs: fail-fast: false max-parallel: 15 matrix: - java: [ 17 ] + java: [17] # do not use HighPerformanceMode here, otherwise some tests will cause the GH runner to receive a shutdown signal - cluster1: [ ScalableSingleNodeMode, PipeConsensusBatchMode, PipeConsensusStreamMode ] - cluster2: [ ScalableSingleNodeMode ] - os: [ ubuntu-latest ] + cluster1: + [ + ScalableSingleNodeMode, + PipeConsensusBatchMode, + PipeConsensusStreamMode, + ] + cluster2: [ScalableSingleNodeMode] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -684,7 +755,7 @@ jobs: local -i attempt=1 local -i retry_sleep=5 local test_output - + while [ $attempt -le $max_attempts ]; do mvn clean verify \ -P with-integration-tests \ @@ -736,19 +807,26 @@ jobs: fail-fast: false max-parallel: 15 matrix: - java: [ 17 ] + java: [17] # do not use HighPerformanceMode here, otherwise some tests will cause the GH runner to receive a shutdown signal - cluster1: [ ScalableSingleNodeMode, PipeConsensusBatchMode, PipeConsensusStreamMode ] - cluster2: [ ScalableSingleNodeMode ] - os: [ ubuntu-latest ] + cluster1: + [ + ScalableSingleNodeMode, + PipeConsensusBatchMode, + PipeConsensusStreamMode, + ] + cluster2: [ScalableSingleNodeMode] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -768,7 +846,7 @@ jobs: local -i attempt=1 local -i retry_sleep=5 local test_output - + while [ $attempt -le $max_attempts ]; do mvn clean verify \ -P with-integration-tests \ @@ -822,16 +900,25 @@ jobs: matrix: java: [17] # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. - cluster: [LightWeightStandaloneMode, ScalableSingleNodeMode, HighPerformanceMode, PipeConsensusBatchMode, PipeConsensusStreamMode] - os: [ ubuntu-latest ] + cluster: + [ + LightWeightStandaloneMode, + ScalableSingleNodeMode, + HighPerformanceMode, + PipeConsensusBatchMode, + PipeConsensusStreamMode, + ] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -851,7 +938,7 @@ jobs: local -i attempt=1 local -i retry_sleep=5 local test_output - + while [ $attempt -le $max_attempts ]; do mvn clean verify \ -P with-integration-tests \ @@ -905,16 +992,25 @@ jobs: matrix: java: [17] # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. - cluster: [LightWeightStandaloneMode, ScalableSingleNodeMode, HighPerformanceMode, PipeConsensusBatchMode, PipeConsensusStreamMode] - os: [ ubuntu-latest ] + cluster: + [ + LightWeightStandaloneMode, + ScalableSingleNodeMode, + HighPerformanceMode, + PipeConsensusBatchMode, + PipeConsensusStreamMode, + ] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -934,7 +1030,7 @@ jobs: local -i attempt=1 local -i retry_sleep=5 local test_output - + while [ $attempt -le $max_attempts ]; do mvn clean verify \ -P with-integration-tests \ @@ -980,4 +1076,4 @@ jobs: with: name: cluster-log-dual-table-manual-enhanced-java${{ matrix.java }}-${{ runner.os }}-${{ matrix.cluster }}-${{ matrix.cluster }} path: integration-test/target/cluster-logs - retention-days: 30 \ No newline at end of file + retention-days: 30 diff --git a/.github/workflows/daily-ut.yml b/.github/workflows/daily-ut.yml index 3ba2538fe7b1a..40715e64c56f4 100644 --- a/.github/workflows/daily-ut.yml +++ b/.github/workflows/daily-ut.yml @@ -3,7 +3,7 @@ name: Daily UT on: schedule: # Run at UTC 19:00 every day (CST 03:00 AM) - - cron: '0 19 * * *' + - cron: "0 19 * * *" concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -20,16 +20,16 @@ jobs: fail-fast: false max-parallel: 15 matrix: - java: [ 8 ] - os: [ ubuntu-latest, windows-latest ] - it_task: [ 'others', 'datanode' ] + java: [8] + os: [ubuntu-latest, windows-latest] + it_task: ["others", "datanode"] include: - java: 17 os: macos-latest - it_task: 'datanode' + it_task: "datanode" - java: 17 os: macos-latest - it_task: 'others' + it_task: "others" runs-on: ${{ matrix.os }} steps: @@ -39,6 +39,8 @@ jobs: with: distribution: corretto java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: diff --git a/.github/workflows/dependency-check.yml b/.github/workflows/dependency-check.yml index 30f29f16090ca..faa7d05f07a42 100644 --- a/.github/workflows/dependency-check.yml +++ b/.github/workflows/dependency-check.yml @@ -6,20 +6,20 @@ on: push: branches: - master - - 'rel/*' + - "rel/*" - "rc/*" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" pull_request: branches: - master - - 'rel/*' + - "rel/*" - "rc/*" - - 'force_ci/**' + - "force_ci/**" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" # allow manually run the action: workflow_dispatch: @@ -38,8 +38,8 @@ jobs: fail-fast: false max-parallel: 15 matrix: - java: [ 17 ] - os: [ ubuntu-latest ] + java: [17] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: @@ -47,8 +47,10 @@ jobs: - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: corretto + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: diff --git a/.github/workflows/pipe-it.yml b/.github/workflows/pipe-it.yml index 97e6fad190387..154cebf968c32 100644 --- a/.github/workflows/pipe-it.yml +++ b/.github/workflows/pipe-it.yml @@ -4,22 +4,22 @@ on: push: branches: - master - - 'rel/*' - - 'rc/*' + - "rel/*" + - "rc/*" paths-ignore: - - 'docs/**' - - 'site/**' - - 'iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/**' #queryengine + - "docs/**" + - "site/**" + - "iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/**" #queryengine pull_request: branches: - master - - 'rel/*' - - 'rc/*' - - 'force_ci/**' + - "rel/*" + - "rc/*" + - "force_ci/**" paths-ignore: - - 'docs/**' - - 'site/**' - - 'iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/**' #queryengine + - "docs/**" + - "site/**" + - "iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/**" #queryengine # allow manually run the action: workflow_dispatch: @@ -42,15 +42,17 @@ jobs: # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. cluster1: [HighPerformanceMode] cluster2: [HighPerformanceMode] - os: [ ubuntu-latest ] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -85,11 +87,11 @@ jobs: echo "==================== BEGIN: ~/run-tests-$attempt.log ====================" echo "$test_output" echo "==================== END: ~/run-tests-$attempt.log ======================" - + if ! mv ~/run-tests-$attempt.log integration-test/target/cluster-logs/ 2>/dev/null; then echo "Failed to move log file ~/run-tests-$attempt.log to integration-test/target/cluster-logs/. Skipping..." fi - + if echo "$test_output" | grep -q "Could not transfer artifact"; then if [ $attempt -lt $max_attempts ]; then echo "Test failed with artifact transfer issue, attempt $attempt. Retrying in $retry_sleep seconds..." @@ -125,15 +127,17 @@ jobs: java: [17] # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. cluster: [HighPerformanceMode] - os: [ ubuntu-latest ] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -164,11 +168,11 @@ jobs: -am -PMultiClusterIT2DualTreeAutoBasic \ -ntp >> ~/run-tests-$attempt.log && return 0 test_output=$(cat ~/run-tests-$attempt.log) - + echo "==================== BEGIN: ~/run-tests-$attempt.log ====================" echo "$test_output" echo "==================== END: ~/run-tests-$attempt.log ======================" - + if ! mv ~/run-tests-$attempt.log integration-test/target/cluster-logs/ 2>/dev/null; then echo "Failed to move log file ~/run-tests-$attempt.log to integration-test/target/cluster-logs/. Skipping..." fi @@ -209,15 +213,17 @@ jobs: # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. cluster1: [HighPerformanceMode] cluster2: [HighPerformanceMode] - os: [ ubuntu-latest ] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -252,7 +258,7 @@ jobs: echo "==================== BEGIN: ~/run-tests-$attempt.log ====================" echo "$test_output" echo "==================== END: ~/run-tests-$attempt.log ======================" - + if ! mv ~/run-tests-$attempt.log integration-test/target/cluster-logs/ 2>/dev/null; then echo "Failed to move log file ~/run-tests-$attempt.log to integration-test/target/cluster-logs/. Skipping..." fi @@ -293,15 +299,17 @@ jobs: # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. cluster1: [HighPerformanceMode] cluster2: [HighPerformanceMode] - os: [ ubuntu-latest ] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -336,7 +344,7 @@ jobs: echo "==================== BEGIN: ~/run-tests-$attempt.log ====================" echo "$test_output" echo "==================== END: ~/run-tests-$attempt.log ======================" - + if ! mv ~/run-tests-$attempt.log integration-test/target/cluster-logs/ 2>/dev/null; then echo "Failed to move log file ~/run-tests-$attempt.log to integration-test/target/cluster-logs/. Skipping..." fi @@ -373,19 +381,21 @@ jobs: fail-fast: false max-parallel: 15 matrix: - java: [ 17 ] + java: [17] # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. - cluster1: [ ScalableSingleNodeMode ] - cluster2: [ ScalableSingleNodeMode ] - os: [ ubuntu-latest ] + cluster1: [ScalableSingleNodeMode] + cluster2: [ScalableSingleNodeMode] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -457,19 +467,21 @@ jobs: fail-fast: false max-parallel: 15 matrix: - java: [ 17 ] + java: [17] # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. - cluster1: [ ScalableSingleNodeMode ] - cluster2: [ ScalableSingleNodeMode ] - os: [ ubuntu-latest ] + cluster1: [ScalableSingleNodeMode] + cluster2: [ScalableSingleNodeMode] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -541,19 +553,21 @@ jobs: fail-fast: false max-parallel: 15 matrix: - java: [ 17 ] + java: [17] # do not use HighPerformanceMode here, otherwise some tests will cause the GH runner to receive a shutdown signal - cluster1: [ ScalableSingleNodeMode ] - cluster2: [ ScalableSingleNodeMode ] - os: [ ubuntu-latest ] + cluster1: [ScalableSingleNodeMode] + cluster2: [ScalableSingleNodeMode] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -573,7 +587,7 @@ jobs: local -i attempt=1 local -i retry_sleep=5 local test_output - + while [ $attempt -le $max_attempts ]; do mvn clean verify \ -P with-integration-tests \ @@ -625,19 +639,21 @@ jobs: fail-fast: false max-parallel: 15 matrix: - java: [ 17 ] + java: [17] # do not use HighPerformanceMode here, otherwise some tests will cause the GH runner to receive a shutdown signal - cluster1: [ ScalableSingleNodeMode ] - cluster2: [ ScalableSingleNodeMode ] - os: [ ubuntu-latest ] + cluster1: [ScalableSingleNodeMode] + cluster2: [ScalableSingleNodeMode] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -657,7 +673,7 @@ jobs: local -i attempt=1 local -i retry_sleep=5 local test_output - + while [ $attempt -le $max_attempts ]; do mvn clean verify \ -P with-integration-tests \ @@ -712,15 +728,17 @@ jobs: java: [17] # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. cluster: [HighPerformanceMode] - os: [ ubuntu-latest ] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -740,7 +758,7 @@ jobs: local -i attempt=1 local -i retry_sleep=5 local test_output - + while [ $attempt -le $max_attempts ]; do mvn clean verify \ -P with-integration-tests \ @@ -795,15 +813,17 @@ jobs: java: [17] # StrongConsistencyClusterMode is ignored now because RatisConsensus has not been supported yet. cluster: [HighPerformanceMode] - os: [ ubuntu-latest ] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -823,7 +843,7 @@ jobs: local -i attempt=1 local -i retry_sleep=5 local test_output - + while [ $attempt -le $max_attempts ]; do mvn clean verify \ -P with-integration-tests \ @@ -869,4 +889,4 @@ jobs: with: name: cluster-log-dual-table-manual-enhanced-java${{ matrix.java }}-${{ runner.os }}-${{ matrix.cluster }}-${{ matrix.cluster }} path: integration-test/target/cluster-logs - retention-days: 30 \ No newline at end of file + retention-days: 30 diff --git a/.github/workflows/sonar-codecov.yml b/.github/workflows/sonar-codecov.yml index 638bf34a3c539..32df2b171c0b5 100644 --- a/.github/workflows/sonar-codecov.yml +++ b/.github/workflows/sonar-codecov.yml @@ -11,17 +11,17 @@ on: - "rc/*" paths-ignore: - "docs/**" - - 'site/**' + - "site/**" pull_request: branches: - master - "rel/*" - "new_*" - "rc/*" - - 'force_ci/**' + - "force_ci/**" paths-ignore: - "docs/**" - - 'site/**' + - "site/**" # allow manually run the action: workflow_dispatch: @@ -49,7 +49,7 @@ jobs: key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2- - name: Test - run: | + run: | mvn -B -P with-code-coverage clean package -pl distribution,iotdb-client/cli,iotdb-client/session,iotdb-client/jdbc -am -Dtest.port.closed=true mvn -B -P with-code-coverage post-integration-test -pl code-coverage - name: Upload coverage reports to codecov @@ -68,6 +68,8 @@ jobs: with: distribution: corretto java-version: 17 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: diff --git a/.github/workflows/table-cluster-it-1c1d.yml b/.github/workflows/table-cluster-it-1c1d.yml index b04101c6479b0..3d9feb4fa969e 100644 --- a/.github/workflows/table-cluster-it-1c1d.yml +++ b/.github/workflows/table-cluster-it-1c1d.yml @@ -4,20 +4,20 @@ on: push: branches: - master - - 'rel/*' - - 'rc/*' + - "rel/*" + - "rc/*" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" pull_request: branches: - master - - 'rel/*' - - 'rc/*' - - 'force_ci/**' + - "rel/*" + - "rc/*" + - "force_ci/**" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" # allow manually run the action: workflow_dispatch: @@ -36,7 +36,7 @@ jobs: fail-fast: false max-parallel: 15 matrix: - os: [ ubuntu-latest, windows-latest ] + os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: @@ -44,8 +44,10 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: - distribution: liberica + distribution: oracle java-version: 17 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: @@ -64,10 +66,10 @@ jobs: if: ${{ runner.os == 'Linux' }} shell: bash run: sudo sysctl -w net.core.somaxconn=65535 -# - name: Adjust Mac kernel somaxconn -# if: ${{ runner.os == 'macOS' }} -# shell: bash -# run: sudo sysctl -w kern.ipc.somaxconn=65535 + # - name: Adjust Mac kernel somaxconn + # if: ${{ runner.os == 'macOS' }} + # shell: bash + # run: sudo sysctl -w kern.ipc.somaxconn=65535 - name: IT/UT Test shell: bash # we do not compile client-cpp for saving time, it is tested in client.yml @@ -86,4 +88,3 @@ jobs: name: table-standalone-log-java${{ matrix.java }}-${{ runner.os }} path: integration-test/target/cluster-logs retention-days: 1 - diff --git a/.github/workflows/table-cluster-it-1c3d.yml b/.github/workflows/table-cluster-it-1c3d.yml index 834c6bff24f22..7ecf310eb2478 100644 --- a/.github/workflows/table-cluster-it-1c3d.yml +++ b/.github/workflows/table-cluster-it-1c3d.yml @@ -4,20 +4,20 @@ on: push: branches: - master - - 'rel/*' - - 'rc/*' + - "rel/*" + - "rc/*" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" pull_request: branches: - master - - 'rel/*' - - 'rc/*' - - 'force_ci/**' + - "rel/*" + - "rc/*" + - "force_ci/**" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" # allow manually run the action: workflow_dispatch: @@ -36,10 +36,10 @@ jobs: fail-fast: false max-parallel: 20 matrix: - java: [ 17 ] + java: [17] runs-on: [self-hosted, iotdb] -# group: self-hosted -# labels: iotdb + # group: self-hosted + # labels: iotdb steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} @@ -47,6 +47,8 @@ jobs: with: distribution: oracle java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: IT/UT Test shell: bash # we do not compile client-cpp for saving time, it is tested in client.yml diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 34fb0262f9952..d5fef5e5fe48f 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -7,20 +7,20 @@ on: push: branches: - master - - 'rel/*' + - "rel/*" - "rc/*" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" pull_request: branches: - master - - 'rel/*' + - "rel/*" - "rc/*" - - 'force_ci/**' + - "force_ci/**" paths-ignore: - - 'docs/**' - - 'site/**' + - "docs/**" + - "site/**" # allow manually run the action: workflow_dispatch: @@ -39,9 +39,9 @@ jobs: fail-fast: false max-parallel: 15 matrix: - java: [ 17 ] - os: [ ubuntu-latest, windows-latest ] - it_task: [ 'others', 'datanode' ] + java: [17] + os: [ubuntu-latest, windows-latest] + it_task: ["others", "datanode"] runs-on: ${{ matrix.os }} steps: @@ -51,6 +51,8 @@ jobs: with: distribution: corretto java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: diff --git a/.github/workflows/vulnerability-check.yml b/.github/workflows/vulnerability-check.yml index b0e7ab86fb7fa..7158da36a547b 100644 --- a/.github/workflows/vulnerability-check.yml +++ b/.github/workflows/vulnerability-check.yml @@ -2,7 +2,7 @@ name: vulnerability-check on: schedule: # Run at UTC 16:00 every week (CST 00:00 AM) - - cron: '0 16 * * 0' + - cron: "0 16 * * 0" workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -19,8 +19,8 @@ jobs: fail-fast: false max-parallel: 15 matrix: - java: [ 17 ] - os: [ ubuntu-latest ] + java: [17] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: @@ -30,6 +30,8 @@ jobs: with: distribution: corretto java-version: ${{ matrix.java }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cache Maven packages uses: actions/cache@v4 with: diff --git a/dependencies.json b/dependencies.json index 1f8f06da726a3..c2a255d7ba4dc 100644 --- a/dependencies.json +++ b/dependencies.json @@ -157,7 +157,6 @@ "org.osgi:osgi.core", "org.ow2.asm:asm", "org.reactivestreams:reactive-streams", - "org.reflections:reflections", "org.slf4j:slf4j-api", "org.slf4j:slf4j-reload4j", "org.tukaani:xz", diff --git a/iotdb-core/confignode/pom.xml b/iotdb-core/confignode/pom.xml index 14d0d71cd3570..d9e75d905a4c7 100644 --- a/iotdb-core/confignode/pom.xml +++ b/iotdb-core/confignode/pom.xml @@ -140,6 +140,17 @@ org.apache.thrift libthrift + + org.reflections + reflections + test + + + org.javassist + javassist + + + com.google.code.findbugs jsr305 diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/pipe/annotation/PipePluginAnnotationTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/pipe/annotation/PipePluginAnnotationTest.java index 1cd3adb8f0e8e..b9936dbff259b 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/pipe/annotation/PipePluginAnnotationTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/pipe/annotation/PipePluginAnnotationTest.java @@ -21,8 +21,13 @@ import org.apache.iotdb.commons.pipe.datastructure.result.Result; import org.apache.iotdb.commons.pipe.datastructure.visibility.VisibilityTestUtils; +import org.apache.iotdb.pipe.api.PipePlugin; import org.junit.Test; +import org.reflections.Reflections; +import org.reflections.scanners.SubTypesScanner; + +import java.util.Set; import static org.junit.Assert.fail; @@ -30,8 +35,12 @@ public class PipePluginAnnotationTest { @Test public void testPipePluginVisibility() { + // Use the Reflections library to scan the classpath + final Reflections reflections = + new Reflections("org.apache.iotdb.confignode", new SubTypesScanner(false)); + final Set> subTypes = reflections.getSubTypesOf(PipePlugin.class); final Result result = - VisibilityTestUtils.testVisibilityCompatibilityEntry("org.apache.iotdb.confignode"); + VisibilityTestUtils.testVisibilityCompatibilityEntry(subTypes); if (result.isErr()) { fail(result.getErr()); } diff --git a/iotdb-core/datanode/pom.xml b/iotdb-core/datanode/pom.xml index ebb1b2807f160..490780a87a738 100644 --- a/iotdb-core/datanode/pom.xml +++ b/iotdb-core/datanode/pom.xml @@ -262,6 +262,13 @@ org.reflections reflections + test + + + org.javassist + javassist + + org.glassfish.jersey.containers diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionLoader.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionLoader.java index 5d47acfda5c25..e702b1e18c772 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionLoader.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionLoader.java @@ -21,16 +21,17 @@ import org.apache.iotdb.commons.exception.MetadataException; import org.apache.iotdb.commons.schema.SchemaConstant; +import org.apache.iotdb.db.schemaengine.schemaregion.impl.SchemaRegionMemoryImpl; +import org.apache.iotdb.db.schemaengine.schemaregion.impl.SchemaRegionPBTreeImpl; import org.apache.iotdb.db.schemaengine.schemaregion.mtree.loader.MNodeFactoryLoader; -import org.reflections.Reflections; -import org.reflections.util.ConfigurationBuilder; -import org.reflections.util.FilterBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; +import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -38,8 +39,6 @@ public class SchemaRegionLoader { private static final Logger logger = LoggerFactory.getLogger(SchemaRegionLoader.class); - private static final String PACKAGE_NAME = "org.apache.iotdb.db.schemaengine"; - private final Map> constructorMap = new ConcurrentHashMap<>(); private String currentMode; @@ -48,13 +47,8 @@ public class SchemaRegionLoader { @SuppressWarnings("unchecked") public SchemaRegionLoader() { - Reflections reflections = - new Reflections( - new ConfigurationBuilder() - .forPackages(PACKAGE_NAME) - .filterInputsBy(new FilterBuilder().includePackage(PACKAGE_NAME))); - - Set> annotatedSchemaRegionSet = reflections.getTypesAnnotatedWith(SchemaRegion.class); + Set> annotatedSchemaRegionSet = + new HashSet<>(Arrays.asList(SchemaRegionMemoryImpl.class, SchemaRegionPBTreeImpl.class)); for (Class annotatedSchemaRegion : annotatedSchemaRegionSet) { boolean isSchemaRegion = false; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/loader/MNodeFactoryLoader.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/loader/MNodeFactoryLoader.java index 9e0fe8c2b7d5a..47c44d6ee6e59 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/loader/MNodeFactoryLoader.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/loader/MNodeFactoryLoader.java @@ -24,21 +24,18 @@ import org.apache.iotdb.commons.schema.node.utils.IMNodeFactory; import org.apache.iotdb.commons.schema.node.utils.MNodeFactory; import org.apache.iotdb.db.schemaengine.schemaregion.mtree.impl.mem.mnode.IMemMNode; +import org.apache.iotdb.db.schemaengine.schemaregion.mtree.impl.mem.mnode.factory.MemMNodeFactory; import org.apache.iotdb.db.schemaengine.schemaregion.mtree.impl.pbtree.mnode.ICachedMNode; - -import org.reflections.Reflections; -import org.reflections.util.ConfigurationBuilder; +import org.apache.iotdb.db.schemaengine.schemaregion.mtree.impl.pbtree.mnode.factory.CacheMNodeFactory; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.List; +import java.util.HashSet; import java.util.Set; @SuppressWarnings({"squid:S6548", "squid:3077"}) public class MNodeFactoryLoader { - private final List scanPackages = new ArrayList<>(); private String env; @SuppressWarnings("java:S3077") @@ -47,14 +44,17 @@ public class MNodeFactoryLoader { @SuppressWarnings("java:S3077") private volatile IMNodeFactory memMNodeIMNodeFactory; + private Set> nodeFactorySet; + private MNodeFactoryLoader() { - addScanPackage("org.apache.iotdb.db.schemaengine.schemaregion.mtree.impl.pbtree.mnode.factory"); - addScanPackage("org.apache.iotdb.db.schemaengine.schemaregion.mtree.impl.mem.mnode.factory"); + nodeFactorySet = new HashSet<>(); + addNodeFactory(MemMNodeFactory.class); + addNodeFactory(CacheMNodeFactory.class); setEnv(SchemaConstant.DEFAULT_MNODE_FACTORY_ENV); } - public void addScanPackage(String scanPackage) { - scanPackages.add(scanPackage); + public void addNodeFactory(Class clazz) { + nodeFactorySet.add(clazz); } public void setEnv(String env) { @@ -87,10 +87,7 @@ public IMNodeFactory getMemMNodeIMNodeFactory() { @SuppressWarnings("squid:S3740") private IMNodeFactory loadMNodeFactory(Class nodeType) { - Reflections reflections = - new Reflections( - new ConfigurationBuilder().forPackages(scanPackages.toArray(new String[0]))); - Set> nodeFactorySet = reflections.getTypesAnnotatedWith(MNodeFactory.class); + for (Class nodeFactory : nodeFactorySet) { if (isGenericMatch(nodeFactory, nodeType) && isEnvMatch(nodeFactory, env)) { try { diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/plugin/annotation/PipePluginAnnotationTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/plugin/annotation/PipePluginAnnotationTest.java index a1c78e499d6d5..5f936b7dd2d76 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/plugin/annotation/PipePluginAnnotationTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/plugin/annotation/PipePluginAnnotationTest.java @@ -21,8 +21,13 @@ import org.apache.iotdb.commons.pipe.datastructure.result.Result; import org.apache.iotdb.commons.pipe.datastructure.visibility.VisibilityTestUtils; +import org.apache.iotdb.pipe.api.PipePlugin; import org.junit.Test; +import org.reflections.Reflections; +import org.reflections.scanners.SubTypesScanner; + +import java.util.Set; import static org.junit.Assert.fail; @@ -30,8 +35,12 @@ public class PipePluginAnnotationTest { @Test public void testPipePluginVisibility() { + // Use the Reflections library to scan the classpath + final Reflections reflections = + new Reflections("org.apache.iotdb.db", new SubTypesScanner(false)); + final Set> subTypes = reflections.getSubTypesOf(PipePlugin.class); final Result result = - VisibilityTestUtils.testVisibilityCompatibilityEntry("org.apache.iotdb.db"); + VisibilityTestUtils.testVisibilityCompatibilityEntry(subTypes); if (result.isErr()) { fail(result.getErr()); } diff --git a/iotdb-core/node-commons/pom.xml b/iotdb-core/node-commons/pom.xml index 91ea3e6e07989..5c5cf963a9cbc 100644 --- a/iotdb-core/node-commons/pom.xml +++ b/iotdb-core/node-commons/pom.xml @@ -170,6 +170,7 @@ org.reflections reflections + test org.checkerframework diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/visibility/VisibilityTestUtils.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/visibility/VisibilityTestUtils.java index 14e268152e67d..1fc25d4c0487b 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/visibility/VisibilityTestUtils.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/visibility/VisibilityTestUtils.java @@ -22,20 +22,14 @@ import org.apache.iotdb.commons.pipe.datastructure.result.Result; import org.apache.iotdb.pipe.api.PipePlugin; -import org.reflections.Reflections; -import org.reflections.scanners.SubTypesScanner; - import java.util.HashMap; import java.util.Map; import java.util.Set; public class VisibilityTestUtils { - public static Result testVisibilityCompatibilityEntry(final String prefix) { - // Use the Reflections library to scan the classpath - final Reflections reflections = new Reflections(prefix, new SubTypesScanner(false)); - final Set> subTypes = reflections.getSubTypesOf(PipePlugin.class); - + public static Result testVisibilityCompatibilityEntry( + final Set> subTypes) { // Create root node final TreeNode root = new TreeNode(PipePlugin.class); diff --git a/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/pipe/plugin/annotation/PipePluginAnnotationTest.java b/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/pipe/plugin/annotation/PipePluginAnnotationTest.java index da693b1d4ab63..69da43ad4b05d 100644 --- a/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/pipe/plugin/annotation/PipePluginAnnotationTest.java +++ b/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/pipe/plugin/annotation/PipePluginAnnotationTest.java @@ -21,8 +21,13 @@ import org.apache.iotdb.commons.pipe.datastructure.result.Result; import org.apache.iotdb.commons.pipe.datastructure.visibility.VisibilityTestUtils; +import org.apache.iotdb.pipe.api.PipePlugin; import org.junit.Test; +import org.reflections.Reflections; +import org.reflections.scanners.SubTypesScanner; + +import java.util.Set; import static org.junit.Assert.fail; @@ -30,8 +35,12 @@ public class PipePluginAnnotationTest { @Test public void testPipePluginVisibility() { + // Use the Reflections library to scan the classpath + final Reflections reflections = + new Reflections("org.apache.iotdb.commons", new SubTypesScanner(false)); + final Set> subTypes = reflections.getSubTypesOf(PipePlugin.class); final Result result = - VisibilityTestUtils.testVisibilityCompatibilityEntry("org.apache.iotdb.commons"); + VisibilityTestUtils.testVisibilityCompatibilityEntry(subTypes); if (result.isErr()) { fail(result.getErr()); } diff --git a/pom.xml b/pom.xml index 17d634cf07f98..dd35c7987f099 100644 --- a/pom.xml +++ b/pom.xml @@ -443,6 +443,7 @@ org.reflections reflections ${reflections.version} + test com.github.moquette-io.moquette