diff --git a/.asf.yaml b/.asf.yaml index 039c08e362581..2bcdaf1d37e4b 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -55,5 +55,6 @@ github: dismiss_stale_reviews: true required_approving_review_count: 1 collaborators: - - zhujunxxxxx - - Mouqiuyu + - zhuruixuan + - TherChenYang + - yydeng626 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50b6bc565d366..7b541227dbd5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,13 +65,13 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup JDK 11 for Build - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 11 - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-${{ hashFiles('**/pom.xml') }} @@ -80,7 +80,7 @@ jobs: - name: Build Project with Maven run: ./mvnw clean install -B -ntp -DskipTests -T1C - name: Setup JDK 8 for Test - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 8 diff --git a/.github/workflows/e2e-agent.yml b/.github/workflows/e2e-agent.yml index c47be81a2eda0..5ed3ae2e3d4d1 100644 --- a/.github/workflows/e2e-agent.yml +++ b/.github/workflows/e2e-agent.yml @@ -59,11 +59,50 @@ jobs: global-environment: name: Import Global Environment uses: ./.github/workflows/required-reusable.yml - + + build-e2e-image: + name: Build E2E Image + needs: global-environment + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 11 + - uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-e2e-cache-${{ github.sha }} + restore-keys: | + ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-e2e-cache- + ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party- + - name: Build Project + run: ./mvnw -B clean install -DskipTests -Prelease + - name: Build Proxy E2E Image + run: ./mvnw clean install -DskipTests -Pit.env.proxy -f test/e2e/agent/plugins/common/pom.xml + - name: Save Proxy E2E Image + run: docker save -o /tmp/${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-proxy-agent-test.tar apache/shardingsphere-proxy-agent-test:latest + - uses: actions/upload-artifact@v4 + with: + name: proxy-e2e-image + path: /tmp/${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-proxy-agent-test.tar + retention-days: 10 + - name: Build JDBC E2E Image + run: ./mvnw clean install -DskipTests -Pit.env.jdbc -f test/e2e/agent/plugins/common/pom.xml + - name: Save JDBC E2E Image + run: docker save -o /tmp/${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-jdbc-agent-test.tar apache/shardingsphere-jdbc-agent-test:latest + - uses: actions/upload-artifact@v4 + with: + name: jdbc-e2e-image + path: /tmp/${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-jdbc-agent-test.tar + retention-days: 10 + agent-mysql: if: ${{ needs.global-environment.outputs.GLOBAL_JOB_ENABLED == 'true' }} name: E2E - Agent with MySQL - needs: global-environment + needs: [ global-environment, build-e2e-image ] runs-on: ubuntu-latest timeout-minutes: 15 strategy: @@ -96,20 +135,36 @@ jobs: feature: tracing plugin: zipkin steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 11 - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party- + - name: Download Proxy E2E Image + if: matrix.adapter == 'proxy' + uses: actions/download-artifact@v4 + with: + name: proxy-e2e-image + path: /tmp/ + - name: Load Proxy E2E Image + if: matrix.adapter == 'proxy' + run: docker load -i /tmp/${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-proxy-agent-test.tar + - name: Download JDBC E2E Image + if: matrix.adapter == 'jdbc' + uses: actions/download-artifact@v4 + with: + name: jdbc-e2e-image + path: /tmp/ + - name: Load JDBC E2E Image + if: matrix.adapter == 'jdbc' + run: docker load -i /tmp/${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-jdbc-agent-test.tar - name: Build Project - run: - ./mvnw -B clean install -DskipITs -DskipTests -Prelease + run: ./mvnw -B clean install -am -pl test/e2e/agent/plugins/${{ matrix.feature }}/${{ matrix.plugin }} -DskipTests - name: Run E2E Test - run: - ./mvnw -B clean install -f test/e2e/agent/plugins/${{ matrix.feature }}/${{ matrix.plugin }}/pom.xml -Dspotless.apply.skip=true -Dit.env.adapter=${{ matrix.adapter }} -Dit.env.type=${{ matrix.plugin }} -Pit.env.${{ matrix.adapter }}.${{ matrix.plugin }} + run: ./mvnw -nsu -B clean install -f test/e2e/agent/plugins/${{ matrix.feature }}/${{ matrix.plugin }}/pom.xml -Dit.env.adapter=${{ matrix.adapter }} -Dit.env.plugin=${{ matrix.plugin }} diff --git a/.github/workflows/e2e-operation.yml b/.github/workflows/e2e-operation.yml index b08ff3d2bd4ed..2c05e27545358 100644 --- a/.github/workflows/e2e-operation.yml +++ b/.github/workflows/e2e-operation.yml @@ -40,8 +40,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - uses: actions/checkout@v3 - - uses: dorny/paths-filter@v2 + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 id: filter with: token: ${{ github.token }} @@ -60,12 +60,14 @@ jobs: fail-fast: false matrix: operation: [ transaction, pipeline, showprocesslist ] - image: [ { type: "it.docker.mysql.version", version: "mysql:5.7" }, { type: "it.docker.postgresql.version", version: "postgres:12-alpine" }, { type: "it.docker.opengauss.version", version: "enmotech/opengauss:2.1.0" } ] + image: [ { type: "it.docker.mysql.version", version: "mysql:5.7" }, { type: "it.docker.postgresql.version", version: "postgres:12-alpine" }, { type: "it.docker.mariadb.version", version: "mariadb:11" } ] exclude: + - operation: transaction + image: { type: "it.docker.mariadb.version", version: "mariadb:11" } - operation: showprocesslist image: { type: "it.docker.postgresql.version", version: "postgres:12-alpine" } - operation: showprocesslist - image: { type: "it.docker.opengauss.version", version: "enmotech/opengauss:2.1.0" } + image: { type: "it.docker.mariadb.version", version: "mariadb:11" } steps: - env: changed_operations: ${{ needs.detect-changed-files.outputs.changed_operations }} @@ -86,10 +88,10 @@ jobs: fi - name: Checkout Project if: (env.skip_current_step == 'false') - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Retrieve Maven Caches if: (env.skip_current_step == 'false') - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-e2e-cache-${{ github.sha }} @@ -97,7 +99,7 @@ jobs: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-e2e-cache- ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party- - if: (env.skip_current_step == 'false') - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 11 diff --git a/.github/workflows/e2e-sql.yml b/.github/workflows/e2e-sql.yml index 971f45e4db585..b32aed8a17996 100644 --- a/.github/workflows/e2e-sql.yml +++ b/.github/workflows/e2e-sql.yml @@ -73,12 +73,12 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 11 - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-e2e-cache-${{ github.sha }} @@ -89,7 +89,7 @@ jobs: run: ./mvnw -B clean install -am -pl test/e2e/sql -Pit.env.docker -DskipTests -Dspotless.apply.skip=true - name: Save E2E Image run: docker save -o /tmp/${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-proxy-test.tar apache/shardingsphere-proxy-test:latest - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: e2e-image path: /tmp/${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-proxy-test.tar @@ -110,13 +110,13 @@ jobs: database: [ MySQL, PostgreSQL ] # Fix me #25051 #scenario: [ dbtbl_with_readwrite_splitting, dbtbl_with_readwrite_splitting_and_encrypt, sharding_and_encrypt, encrypt_and_readwrite_splitting, encrypt_shadow, readwrite_splitting_and_shadow, sharding_and_shadow, sharding_encrypt_shadow, mask_encrypt, mask_sharding, mask_encrypt_sharding ] - scenario: [ empty_rules, rdl_empty_rules, passthrough, tbl, encrypt, readwrite_splitting, shadow, mask, dbtbl_with_readwrite_splitting_and_encrypt, sharding_and_encrypt, encrypt_and_readwrite_splitting, encrypt_shadow, readwrite_splitting_and_shadow, sharding_and_shadow, sharding_encrypt_shadow, mask_encrypt, mask_sharding, mask_encrypt_sharding ] + scenario: [ empty_rules, rdl_empty_rules, passthrough, db, tbl, encrypt, readwrite_splitting, shadow, mask, dbtbl_with_readwrite_splitting_and_encrypt, sharding_and_encrypt, encrypt_and_readwrite_splitting, encrypt_shadow, readwrite_splitting_and_shadow, sharding_and_shadow, sharding_encrypt_shadow, mask_encrypt, mask_sharding, mask_encrypt_sharding, db_tbl_sql_federation, empty_storage_units ] additional-options: [ '' ] include: - adapter: proxy database: MySQL scenario: passthrough - additional-options: '-Dmysql-connector-java.version=8.0.30' + additional-options: '-Dmysql-connector-java.version=8.3.0' exclude: - adapter: jdbc scenario: passthrough @@ -131,19 +131,21 @@ jobs: - adapter: proxy mode: Standalone scenario: passthrough + - adapter: proxy + scenario: empty_storage_units steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-e2e-cache-${{ github.sha }} - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 11 - name: Download E2E Image if: matrix.adapter == 'proxy' - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: e2e-image path: /tmp/ diff --git a/.github/workflows/graalvm.yml b/.github/workflows/graalvm.yml new file mode 100644 index 0000000000000..1d769972ebd21 --- /dev/null +++ b/.github/workflows/graalvm.yml @@ -0,0 +1,58 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name: NativeTest CI - GraalVM Native Image + +# Only execute CI when changes involving GraalVM Reachability Metadata and nativeTest are involved. Because most Contributors don't use GraalVM CE. +on: + pull_request: + branches: [ master ] + paths: + - '.github/workflows/graalvm.yml' + - 'infra/reachability-metadata/src/**' + - 'test/native/native-image-filter/**' + - 'test/native/src/**' + +concurrency: + group: graalvm-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dspotless.apply.skip=true + +jobs: + nativetest: + if: github.repository == 'apache/shardingsphere' + name: GraalVM - GraalVM CE for JDK ${{ matrix.java-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + strategy: + max-parallel: 20 + fail-fast: false + matrix: + os: [ 'ubuntu-latest' ] + java-version: [ '21.0.2' ] + steps: + - uses: actions/checkout@v4 + - uses: graalvm/setup-graalvm@v1 + with: + java-version: ${{ matrix.java-version }} + distribution: 'graalvm-community' + github-token: ${{ secrets.GITHUB_TOKEN }} + cache: 'maven' + - name: Run nativeTest with GraalVM CE for ${{ matrix.java-version }} + run: ./mvnw -PnativeTestInShardingSphere -T1C -e clean test diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 97a903c4e1909..a7a25f57660f1 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -45,15 +45,15 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache-${{ github.sha }} restore-keys: | ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache- ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party- - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 11 @@ -71,7 +71,7 @@ jobs: remote_key: ${{ secrets.NIGHTLIES_RSYNC_KEY }} build-proxy-image: - if: ${{ needs.global-environment.outputs.GLOBAL_IS_NIGHTLY_JOB_EXECUTABLE == 'true' }} + if: github.repository == 'apache/shardingsphere' name: Build Proxy Image needs: global-environment runs-on: ${{ needs.global-environment.outputs.GLOBAL_RUNS_ON }} @@ -80,14 +80,14 @@ jobs: packages: write timeout-minutes: 60 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.commit-id }} - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 11 - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache-${{ github.sha }} @@ -95,48 +95,48 @@ jobs: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache- ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party- - name: Login Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ${{ env.HUB }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 - name: Push Docker Image run: ./mvnw -am -pl distribution/proxy -B -Prelease,docker.buildx.push -DskipTests -Dproxy.image.repository=${{ env.PROXY }} -Dproxy.image.tag=${{ github.sha }} clean install build-proxy-native-image: if: github.repository == 'apache/shardingsphere' - name: Build GraalVM Native Image + name: Build Proxy Native Image + needs: global-environment timeout-minutes: 90 permissions: contents: read packages: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.commit-id }} - uses: graalvm/setup-graalvm@v1 with: - java-version: '17.0.8' + java-version: '21.0.2' distribution: 'graalvm-community' github-token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache-${{ github.sha }} restore-keys: | ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache- ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party- - - uses: docker/login-action@v2 + - uses: docker/login-action@v3 with: registry: ${{ env.HUB }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Push Docker Image run: | - ./mvnw -PgenerateStandardMetadata -DskipNativeTests -B -T1C clean test ./mvnw -am -pl distribution/proxy-native -Prelease.native,docker.buildx.push.native -B -T1C -DskipTests -Dproxy.image.repository=${{ env.PROXY_NATIVE }} -Dproxy.image.tag=${{ github.sha }} clean package build-cache: @@ -146,12 +146,12 @@ jobs: runs-on: ${{ needs.global-environment.outputs.GLOBAL_RUNS_ON }} timeout-minutes: 15 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 11 - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-${{ hashFiles('**/pom.xml') }} @@ -205,12 +205,12 @@ jobs: - 2181:2181 options: --health-cmd="echo ruok | nc localhost 2181" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 11 - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-${{ hashFiles('**/pom.xml') }} @@ -237,14 +237,3 @@ jobs: remote_port: ${{ secrets.NIGHTLIES_RSYNC_PORT }} remote_user: ${{ secrets.NIGHTLIES_RSYNC_USER }} remote_key: ${{ secrets.NIGHTLIES_RSYNC_KEY }} - - generate-contributors-map-image: - runs-on: ubuntu-latest - permissions: write-all - - steps: - - name: Contributor Map - uses: tunaitis/contributor-map@v1 - with: - repository: apache/shardingsphere - output: docs/contributor-map.svg diff --git a/.github/workflows/nightly-check.yml b/.github/workflows/nightly-check.yml index 4f58fb27c1391..ca805bed14303 100644 --- a/.github/workflows/nightly-check.yml +++ b/.github/workflows/nightly-check.yml @@ -23,7 +23,7 @@ on: workflow_dispatch: env: - MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dspotless.apply.skip=true + MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 jobs: global-environment: @@ -37,8 +37,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-${{ hashFiles('**/pom.xml') }} @@ -54,17 +54,17 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 25 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 11 - - uses: actions/cache@v3 + java-version: 17 + - uses: actions/cache@v4 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-${{ hashFiles('**/pom.xml') }} @@ -82,26 +82,27 @@ jobs: name: Checkstyle - SonarCloud needs: global-environment runs-on: ubuntu-latest - timeout-minutes: 60 + timeout-minutes: 100 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 11 - - uses: actions/cache@v3 + java-version: 17 + - uses: actions/cache@v4 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party- - name: Aggregate checkstyle report - run: + run: | + export MAVEN_OPTS='-Xmx6g -Xms512m' ./mvnw clean verify checkstyle:checkstyle-aggregate - name: Upload checkstyle report to SonarCloud env: @@ -115,11 +116,11 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: sudo npm install -g markdown-link-check@3.10.0 - name: Check dead link run: | - IGNORED_PATH_LIST=("./docs/document/themes" "./docs/community/content/powered-by" "./docs/blog/content/material" "./docs/blog/themes") + IGNORED_PATH_LIST=("./docs/document/themes" "./docs/community/content/powered-by" "./docs/blog/content/material" "./docs/blog/themes" "./docs/community/themes") ignore_current_file=false for file in $(find . -name "*.md"); do @@ -149,25 +150,26 @@ jobs: contents: read security-events: write steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 11 - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: java - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party- - name: Install Project - run: ./mvnw clean install -DskipTests + run: | + ./mvnw clean install -DskipTests -B -ntp -T1C - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 with: category: "/language:java" @@ -180,16 +182,34 @@ jobs: issues: write pull-requests: write steps: - - uses: actions/stale@v8 + - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-issue-stale: 30 days-before-pr-stale: -1 days-before-close: -1 stale-issue-label: "stale" - operations-per-run: 1000 + operations-per-run: 100 remove-stale-when-updated: true stale-issue-message: > There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale. - + + check-dependency-convergence: + if: github.repository == 'apache/shardingsphere' + name: Check - Dependency Convergence + needs: global-environment + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party- + - name: Run Dependency Convergence Check + run: | + sed -i '//i \ ' pom.xml + ./mvnw clean install -DskipTests -T1C -Dmaven.enforcer.fail=true diff --git a/.github/workflows/nightly-ci.yml b/.github/workflows/nightly-ci.yml index 3945b115811ba..c81c5350f3a08 100644 --- a/.github/workflows/nightly-ci.yml +++ b/.github/workflows/nightly-ci.yml @@ -41,17 +41,17 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] - java-version: [ 11, 17, 21-ea ] + java-version: [ 11, 17, 21, 22 ] steps: - name: Support Long Paths in Windows if: matrix.os == 'windows-latest' run: git config --global core.longpaths true - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: ${{ matrix.java-version }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache-${{ github.sha }} @@ -78,12 +78,12 @@ jobs: - name: Support Long Paths in Windows if: matrix.os == 'windows-latest' run: git config --global core.longpaths true - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 11 - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache-${{ github.sha }} @@ -93,9 +93,37 @@ jobs: - name: Build prod with Maven run: ./mvnw clean install -DskipTests -B -ntp -T1C - name: Setup JDK 8 for Test - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: - distribution: 'temurin' + distribution: 'zulu' java-version: 8 - name: Run Tests with JDK 8 run: ./mvnw test -B -ntp -fae -T1C + + ci-native-test: + if: github.repository == 'apache/shardingsphere' + name: NativeTest CI - GraalVM CE on ${{ matrix.os }} + needs: global-environment + runs-on: ${{ matrix.os }} + timeout-minutes: 90 + strategy: + max-parallel: 20 + fail-fast: false + matrix: + os: [ ubuntu-latest ] + steps: + - uses: actions/checkout@v4 + - uses: graalvm/setup-graalvm@v1 + with: + java-version: '21.0.2' + distribution: 'graalvm-community' + github-token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache-${{ github.sha }} + restore-keys: | + ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache- + ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party- + - name: Run nativeTest with GraalVM CE + run: ./mvnw -PnativeTestInShardingSphere -T1C -e clean test diff --git a/.github/workflows/nightly-e2e-operation.yml b/.github/workflows/nightly-e2e-operation.yml index 9f0519d4c9b8e..b5ef6d58c5a26 100644 --- a/.github/workflows/nightly-e2e-operation.yml +++ b/.github/workflows/nightly-e2e-operation.yml @@ -44,18 +44,22 @@ jobs: fail-fast: false matrix: operation: [ transaction, pipeline, showprocesslist ] - image: [ { type: "it.docker.mysql.version", version: "mysql:5.7,mysql:8.0" }, { type: "it.docker.postgresql.version", version: "postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine" }, { type: "it.docker.opengauss.version", version: "enmotech/opengauss:2.1.0,enmotech/opengauss:3.0.0" } ] + image: [ { type: "it.docker.mysql.version", version: "mysql:5.7,mysql:8.0" }, { type: "it.docker.postgresql.version", version: "postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine" }, { type: "it.docker.opengauss.version", version: "enmotech/opengauss:2.1.0,enmotech/opengauss:3.0.0" }, { type: "it.docker.mariadb.version", version: "mariadb:11" } ] exclude: + - operation: transaction + image: { type: "it.docker.mariadb.version", version: "mariadb:11" } - operation: showprocesslist image: { type: "it.docker.postgresql.version", version: "postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine" } - operation: showprocesslist image: { type: "it.docker.opengauss.version", version: "enmotech/opengauss:2.1.0,enmotech/opengauss:3.0.0" } + - operation: showprocesslist + image: { type: "it.docker.mariadb.version", version: "mariadb:11" } timeout-minutes: 40 steps: - name: Checkout Project - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Retrieve Maven Caches - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-e2e-cache-${{ github.sha }} @@ -63,7 +67,7 @@ jobs: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-e2e-cache- ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party- - name: Setup JDK 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 11 diff --git a/.github/workflows/nightly-e2e-sql.yml b/.github/workflows/nightly-e2e-sql.yml new file mode 100644 index 0000000000000..d0369a69c5974 --- /dev/null +++ b/.github/workflows/nightly-e2e-sql.yml @@ -0,0 +1,124 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name: Nightly - E2E SQL + +on: + schedule: + - cron: '0 20 */1 * *' # once a day. UTC time + workflow_dispatch: + +concurrency: + group: e2e-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dspotless.apply.skip=true + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 + +jobs: + global-environment: + name: Import Global Environment + uses: ./.github/workflows/required-reusable.yml + + build-e2e-image: + name: Build E2E Image + needs: global-environment + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 11 + - uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-e2e-cache-${{ github.sha }} + restore-keys: | + ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-e2e-cache- + ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party- + - name: Build E2E Image + run: ./mvnw -B clean install -am -pl test/e2e/sql -Pit.env.docker -DskipTests -Dspotless.apply.skip=true + - name: Save E2E Image + run: docker save -o /tmp/${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-proxy-test.tar apache/shardingsphere-proxy-test:latest + - uses: actions/upload-artifact@v4 + with: + name: e2e-image + path: /tmp/${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-proxy-test.tar + retention-days: 10 + + e2e-sql: + name: E2E - SQL + needs: [ build-e2e-image, global-environment ] + if: ${{ needs.global-environment.outputs.GLOBAL_JOB_ENABLED == 'true' }} + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + max-parallel: 20 + fail-fast: false + matrix: + adapter: [ proxy, jdbc ] + mode: [ Standalone, Cluster ] + database: [ MySQL, PostgreSQL, openGauss ] + # Fix me #25051 + #scenario: [ dbtbl_with_readwrite_splitting, dbtbl_with_readwrite_splitting_and_encrypt, sharding_and_encrypt, encrypt_and_readwrite_splitting, encrypt_shadow, readwrite_splitting_and_shadow, sharding_and_shadow, sharding_encrypt_shadow, mask_encrypt, mask_sharding, mask_encrypt_sharding ] + scenario: [ empty_rules, rdl_empty_rules, passthrough, db, tbl, encrypt, readwrite_splitting, shadow, mask, dbtbl_with_readwrite_splitting_and_encrypt, sharding_and_encrypt, encrypt_and_readwrite_splitting, encrypt_shadow, readwrite_splitting_and_shadow, sharding_and_shadow, sharding_encrypt_shadow, mask_encrypt, mask_sharding, mask_encrypt_sharding, db_tbl_sql_federation, empty_storage_units ] + additional-options: [ '' ] + include: + - adapter: proxy + database: MySQL + scenario: passthrough + additional-options: '-Dmysql-connector-java.version=8.3.0' + exclude: + - adapter: jdbc + scenario: passthrough + - adapter: jdbc + mode: Cluster + - adapter: proxy + mode: Standalone + scenario: empty_rules + - adapter: proxy + mode: Standalone + scenario: rdl_empty_rules + - adapter: proxy + mode: Standalone + scenario: passthrough + - adapter: proxy + scenario: empty_storage_units + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-e2e-cache-${{ github.sha }} + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 11 + - name: Download E2E Image + if: matrix.adapter == 'proxy' + uses: actions/download-artifact@v4 + with: + name: e2e-image + path: /tmp/ + - name: Load E2E Image + if: matrix.adapter == 'proxy' + run: docker load -i /tmp/${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-proxy-test.tar + - name: Run E2E Test + run: ./mvnw -nsu -B install -f test/e2e/sql/pom.xml -Dspotless.apply.skip=true -Dit.cluster.env.type=DOCKER -Dit.cluster.adapters=${{ matrix.adapter }} -Dit.run.modes=${{ matrix.mode }} -Dit.run.additional.cases=false -Dit.scenarios=${{ matrix.scenario }} -Dit.cluster.databases=${{ matrix.database }} ${{ matrix.additional-options }} diff --git a/.github/workflows/nightly-sql-parser.yml b/.github/workflows/nightly-sql-parser.yml index 617f4c11f2b43..b341fe894f4b1 100644 --- a/.github/workflows/nightly-sql-parser.yml +++ b/.github/workflows/nightly-sql-parser.yml @@ -43,12 +43,12 @@ jobs: matrix: database: [ mysql, postgresql ] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 11 - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache-${{ github.sha }} @@ -60,7 +60,7 @@ jobs: - name: Run SQL Parser continue-on-error: true run: ./mvnw -nsu -B install -f parser/sql/dialect/${{ matrix.database }}/pom.xml -Dsql.parser.external.it.enabled=true - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: sql-report path: /tmp/*.csv diff --git a/.github/workflows/required-check.yml b/.github/workflows/required-check.yml index 60d16a00234e9..7a3c5e33584d2 100644 --- a/.github/workflows/required-check.yml +++ b/.github/workflows/required-check.yml @@ -38,7 +38,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run CheckStyle run: ./mvnw checkstyle:check -Pcheck -T1C @@ -49,7 +49,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run Spotless run: ./mvnw spotless:check -Pcheck -T1C @@ -60,6 +60,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run Apache Rat run: ./mvnw apache-rat:check -Pcheck -T1C diff --git a/.github/workflows/required-reusable.yml b/.github/workflows/required-reusable.yml index 159952a1b9da7..bdf1ab858793e 100644 --- a/.github/workflows/required-reusable.yml +++ b/.github/workflows/required-reusable.yml @@ -31,7 +31,7 @@ jobs: init-environment: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: sparse-checkout: | .github/workflows/resources/variables/ @@ -43,6 +43,7 @@ jobs: echo ${line} >> $GITHUB_OUTPUT done echo "GLOBAL_REPOSITORY=${{ env.GLOBAL_REPOSITORY }}" + echo "DISABLE_CI=${{ env.DISABLE_CI }}" GLOBAL_CACHE_PREFIX=$(echo '${{ env.GLOBAL_REPOSITORY }}' | sed 's/\//_/g') echo "GLOBAL_CACHE_PREFIX=${GLOBAL_CACHE_PREFIX}" >> $GITHUB_OUTPUT - name: Check If Job is Executable @@ -56,13 +57,9 @@ jobs: if [ ${{ toJSON(github.repository) }} = ${{ steps.import-variables.outputs.GLOBAL_REPOSITORY }} ]; then echo "GLOBAL_IS_NIGHTLY_JOB_EXECUTABLE=true" >> $GITHUB_OUTPUT echo "GLOBAL_JOB_ENABLED=false" >> $GITHUB_OUTPUT - echo '${{ env.JSON_LABELS }}' | while read line - do - if [ ${line}="type: ${{ steps.import-variables.outputs.RUNNABLE_CI_LABEL }}" ] || [ -z "${{ steps.import-variables.outputs.RUNNABLE_CI_LABEL }}" ]; then - echo "GLOBAL_JOB_ENABLED=true" >> $GITHUB_OUTPUT - break - fi - done + if [ -z "${{ steps.import-variables.outputs.DISABLE_CI }}"] || [ "${{ steps.import-variables.outputs.DISABLE_CI }}"=="false" ] ; then + echo "GLOBAL_JOB_ENABLED=true" >> $GITHUB_OUTPUT + fi fi outputs: GLOBAL_RUNS_ON: ${{ steps.import-variables.outputs.GLOBAL_RUNS_ON }} diff --git a/.github/workflows/resources/filter/filters.yml b/.github/workflows/resources/filter/filters.yml index ebe98bddcd89d..4953976e0e4ba 100644 --- a/.github/workflows/resources/filter/filters.yml +++ b/.github/workflows/resources/filter/filters.yml @@ -22,11 +22,11 @@ pipeline: - '.github/workflows/e2e-operation.yml' - 'infra/**/src/main/**' - 'mode/**/src/main/**' - - 'features/encrypt/src/main/**' - - 'features/features/readwrite-splitting/src/main/**' - - 'features/sharding/src/main/**' + - 'features/encrypt/**/src/main/**' + - 'features/readwrite-splitting/**/src/main/**' + - 'features/sharding/**/src/main/**' - 'proxy/**/src/main/**' - - 'jdbc/core/src/main/**' + - 'jdbc/src/main/**' - '**/*-distsql*/**/src/main/**' - 'kernel/data-pipeline/**/src/main/**' - 'kernel/data-pipeline/**/pom.xml' @@ -42,7 +42,7 @@ showprocesslist: - 'infra/common/src/main/**' - 'mode/**/src/main/**' - 'proxy/**/src/main/**' - - 'jdbc/core/src/main/**' + - 'jdbc/src/main/**' - 'test/pom.xml' - 'test/e2e/fixture/**' - 'test/e2e/env/**' @@ -53,10 +53,11 @@ transaction: - 'infra/common/src/main/**' - 'mode/**/src/main/**' - 'proxy/**/src/main/**' - - 'jdbc/core/src/main/**' + - 'jdbc/src/main/**' - 'kernel/transaction/**/src/main/**' - 'kernel/transaction/**/pom.xml' - 'test/pom.xml' - 'test/e2e/fixture/**' - 'test/e2e/env/**' - 'test/e2e/operation/transaction/**' + - 'features/sharding/**/src/main/**' diff --git a/.github/workflows/resources/linkcheck/markdown-link-check.json b/.github/workflows/resources/linkcheck/markdown-link-check.json index 8fa22308e0ac7..5a3b41cfd1000 100644 --- a/.github/workflows/resources/linkcheck/markdown-link-check.json +++ b/.github/workflows/resources/linkcheck/markdown-link-check.json @@ -17,6 +17,12 @@ }, { "pattern": "^https://starchart.cc/" + }, + { + "pattern": "^https://www.apiseven.com" + }, + { + "pattern": "^https://whimsy.apache.org" } ], "replacementPatterns": [ { diff --git a/.github/workflows/resources/variables/env-variables.properties b/.github/workflows/resources/variables/env-variables.properties index 6fa4ba0075733..146a8c7920e1c 100644 --- a/.github/workflows/resources/variables/env-variables.properties +++ b/.github/workflows/resources/variables/env-variables.properties @@ -1,3 +1,3 @@ GLOBAL_REPOSITORY=apache/shardingsphere GLOBAL_RUNS_ON=ubuntu-latest -RUNNABLE_CI_LABEL= +DISABLE_CI=false diff --git a/.github/workflows/schedule-report.yml b/.github/workflows/schedule-report.yml index ea931496dc59a..63263b94c36fe 100644 --- a/.github/workflows/schedule-report.yml +++ b/.github/workflows/schedule-report.yml @@ -37,17 +37,17 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 40 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 11 - - uses: actions/cache@v3 + java-version: 17 + - uses: actions/cache@v4 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-${{ hashFiles('**/pom.xml') }} diff --git a/.gitignore b/.gitignore index 231b1113bc0d1..ffde1c123d8bd 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ release.properties # idea ignore .idea/ !/.idea/icon.png +!/.idea/vcs.xml *.ipr *.iml *.iws @@ -39,7 +40,6 @@ logs/ *.diff *.patch *.tmp -.hugo_build.lock # system ignore .DS_Store @@ -51,3 +51,8 @@ gen/ # profiler ignore .profiler/ + +# hugo ignore +public/ +.hugo_build.lock +*.html-e diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000..aa5af44ef5718 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0766778d61614..3bde6ad10d55b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,11 +2,11 @@ You can report a bug, submit a new feature enhancement recommendation, or commit ## Reporting Bug - - Before report a bug, please search from google to confirm you cannot find any hint on it. - - Look [issues List](https://github.com/apache/shardingsphere/issues) to confirm this issue is not a duplicated one. + - Before reporting a bug, please search from google to confirm that you cannot find any hint on it. + - Look at the [issues List](https://github.com/apache/shardingsphere/issues) to confirm this issue is not a duplicated one. - [Create](https://github.com/apache/shardingsphere/issues/new) a new issue. - Define a clear and descriptive title for the issue. - - If bug reported, please provide information below: + - If a bug is reported, please provide information below: - Details for reproduce bug step by step. Include SQL, configuration, expected results, actual results and tracing log. - ShardingSphere and your OS version. - Source code that reproduce the bug on GitHub, can be linked here. @@ -18,7 +18,7 @@ You can report a bug, submit a new feature enhancement recommendation, or commit - Explain why this enhancement is general feature for most developers. - List similar features which already available in other product if possible. Both open source and commercial software are available. - Assign label after issue created. Label should be bug, enhancement, discussion and so on. - - Please pay attention on the issue and provide more information during discuss. + - Please pay attention to the issue and provide more information during discuss. - Please close issue when it is resolved. If you don't close it, we will close it after 3 days。 - If this issue has new information, please reopen it again. Please note, issue can reopen which only closed by yourself. diff --git a/NOTICE b/NOTICE index 189ea35150795..2a65838de3fe5 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ Apache ShardingSphere -Copyright 2018-2023 The Apache Software Foundation +Copyright 2018-2024 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). diff --git a/README.md b/README.md index 0561966734e79..ee48d2fa23ca8 100644 --- a/README.md +++ b/README.md @@ -22,13 +22,11 @@ |:---------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| | [![Stargazers Over Time](https://starchart.cc/apache/shardingsphere.svg)](https://starchart.cc/apache/shardingsphere) | [![Contributor over time](https://contributor-graph-api.apiseven.com/contributors-svg?chart=contributorOverTime&repo=apache/shardingsphere)](https://www.apiseven.com/en/contributor-graph?chart=contributorOverTime&repo=apache/shardingsphere) | -![Contributors Map](./docs/contributor-map.svg) - ### OVERVIEW
-Apache ShardingSphere is a distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database. Our community's guiding development concept is Database Plus for creating a complete ecosystem that allows you to transform any database into a distributed database system. +Apache ShardingSphere is a distributed SQL transaction & query engine that allows for data sharding, scaling, encryption, and more - on any database. Our community's guiding development concept is Database Plus for creating a complete ecosystem that allows you to transform any database into a distributed database system. It focuses on repurposing existing databases, by placing a standardized upper layer above existing and fragmented databases, rather than creating a new database. @@ -60,13 +58,6 @@ For full documentation & more details, visit: [Docs](https://shardingsphere.apac For guides on how to get started and setup your environment, contributor & committer guides, visit: [Contribution Guidelines](https://shardingsphere.apache.org/community/en/involved/) -Good news! We'll be taking part in [Hacktoberfest 2022](https://hacktoberfest.com) 🍻🎉 Hacktoberfest is for everyone. - -Whether it's your first time, you're a seasoned PRO - it's almost time to get hacking, chase those pull/merge requests and complete your mission in supporting open source. - -You can find the issues we've prepared for this year's Hacktoberfest [here](https://github.com/apache/shardingsphere/issues?q=is%3Aopen+is%3Aissue+label%3Ahacktoberfest). - - ### Team
@@ -97,13 +88,13 @@ We deeply appreciate [community contributors](https://shardingsphere.apache.org/
-:white_check_mark: Version 5.4.0: released :tada: +:white_check_mark: Version 5.5.0: released :tada: 🔗 For the release notes, follow this link to the relevant [GitHub page](https://github.com/apache/shardingsphere/blob/master/RELEASE-NOTES.md). -:soon: Version 5.4.1 +:soon: Version 5.5.1 -We are currently working towards our 5.4.1 milestone. +We are currently working towards our 5.5.1 milestone. Keep an eye on the [milestones page](https://github.com/apache/shardingsphere/milestones) of this repo to stay up to date. [comment]: <> (##) @@ -135,7 +126,7 @@ Keep an eye on the [milestones page](https://github.com/apache/shardingsphere/mi
Apache ShardingSphere includes 2 independent products: JDBC & Proxy. -They all provide functions of data scale-out, distributed transaction and distributed governance, applicable in a variety of situations such as Java isomorphism, heterogeneous language and Cloud-Native. +They all provide functions of data scale-out, distributed transaction and distributed governance, applicable in a variety of situations such as Java-based isomorphism, heterogeneous language and Cloud-Native. ### ShardingSphere-JDBC @@ -156,7 +147,7 @@ With the client end connecting directly to the database, it provides services in [![Download](https://img.shields.io/badge/release-download-orange.svg)](https://www.apache.org/dyn/closer.lua/shardingsphere/5.3.2/apache-shardingsphere-5.3.2-shardingsphere-proxy-bin.tar.gz) [![Docker Pulls](https://img.shields.io/docker/pulls/apache/shardingsphere-proxy.svg)](https://store.docker.com/community/images/apache/shardingsphere-proxy) -A transparent database proxy, providing a database server that encapsulates database binary protocol to support heterogeneous languages. +A transparent database proxy, providing a database server that encapsulates the database binary protocol to support heterogeneous languages. Friendlier to DBAs, the MySQL and PostgreSQL version now provided can use any kind of terminal. :link: For more details, follow this [link to the official website](https://shardingsphere.apache.org/document/current/en/overview/#shardingsphere-proxy). @@ -166,9 +157,9 @@ Friendlier to DBAs, the MySQL and PostgreSQL version now provided can use any ki
ShardingSphere-JDBC adopts a decentralized architecture, applicable to high-performance light-weight OLTP applications developed with Java. -ShardingSphere-Proxy provides static entry and all languages support, suitable for OLAP application and sharding databases management and operation. +ShardingSphere-Proxy provides static entry and all languages support, suitable for an OLAP application and sharding databases management and operation. -Through the mixed use of ShardingSphere-JDBC & ShardingSphere-Proxy together with a unified sharding strategy by the same registry center, the ShardingSphere ecosystem can build an application system suitable to all kinds of scenarios. +Through the combination of ShardingSphere-JDBC & ShardingSphere-Proxy together with a unified sharding strategy by the same registry center, the ShardingSphere ecosystem can build an application system suitable to all kinds of scenarios. :link: More details can be found following this [link to the official website](https://shardingsphere.apache.org/document/current/en/overview/#hybrid-architecture). @@ -210,7 +201,7 @@ Check out [Wiki](https://github.com/apache/shardingsphere/wiki) section for deta



-   +  

Apache ShardingSphere enriches the CNCF CLOUD NATIVE Landscape.

diff --git a/README_ZH.md b/README_ZH.md index 6e3b124750943..9d76533a045bd 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -82,13 +82,13 @@ ShardingSphere 已于 2020 年 4 月 16 日成为 [Apache 软件基金会](https
-:white_check_mark: Version 5.4.0: 已发布 :tada: +:white_check_mark: Version 5.5.0: 已发布 :tada: 🔗 请访问 [发布说明](https://github.com/apache/shardingsphere/blob/master/RELEASE-NOTES.md) 获得更详细的信息. -:soon: Version 5.4.1 +:soon: Version 5.5.1 -我们目前正在开发 5.4.1 里程碑。 +我们目前正在开发 5.5.1 里程碑。 请访问[里程碑](https://github.com/apache/shardingsphere/milestones) 获取最新信息。 ## @@ -183,7 +183,7 @@ Apache ShardingSphere 是多接入端共同组成的生态圈。



-   +  

ShardingSphere 进入了CNCF 云原生全景图

diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 3a692036398a5..4158093a06987 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,70 +1,165 @@ +## Release 5.5.0 + +### API Change +1. Proxy: Remove the outdated schemaName configuration of the Proxy +2. Kernel: Remove the sqlCommentParseEnabled configuration in SQL Parser Rule to reduce code complexity +3. SQL Parser: Consider removing sqlCommentParseEnabled config in SQLParser rule +4. Federation: Add allQueryUseSQLFederation config for sql federation + +### New Feature +1. DistSQL: New syntax for query plugin (SPI) implementation +1. DistSQL: New syntax for managing SQL_TRANSLATOR rule + +### Enhancement +1. Pipeline: Improve CDC stability and performance +1. Pipeline: MemoryPipelineChannel supports configurable zero queue size for less memory consumption +1. Pipeline: Show dedicated error when mode type is not Cluster +1. Authority: Add isSuper option for user +1. Pipeline: Ignore error message in status DistSQL result on job cancelling +1. DistSQL: Use JSON format to output props in RQL +1. DistSQL: Optimize REFRESH DATABASE METADATA logic +1. DistSQL: SHOW COMPUTE NODES supports JDBC nodes +1. DistSQL: Optimize syntax of REFRESH DATABASE METADATA +1. DistSQL: Optimize the output of SHOW TABLE METADATA +1. Proxy: Add MySQL precompiled parameter verification to avoid turning on rewriteBatchedStatements=true when BenchmarkSQL connects to Proxy, causing an ArrayIndexOutOfBoundsException exception when the Proxy parameterCount exceeds 65535. +1. SQL Parser: Add EOF to throw exception when parse distsql rollback migration statement +1. SQL Parser: Support more plsql statement parse and add plsql parse assert logic +1. SQL Parser: Support parse index hint +1. SQL Parser: Support mysql intersect combine operation sql parse +1. SQL Parser: Supoort parse chinese white space for oracle +1. SQL Parser: Fix mysql TimeStampDiff function parse +1. SQL Parser: Fix sqlServer unqualified shorthand parsing +1. SQL Parser: Support sqlServer SEARCH unreserved word parsing +1. SQL Parser: Add sql server MEMBER unreserved word +1. Binder: Add ParameterMarkerSegmentBinder logic for Oracle MergeStatementBinder +1. Federation: Support mysql cross join statement for sql federation +1. Transaction: Add advice message in XATransactionCheckPrivilegeFailedException +1. Sharding: Validate duplicate sharding actual data nodes +1. Sharding: Support null condition value routing +1. Proxy: Fix mysql client multi statements option in protocol + +### Bug Fix +1. Pipeline: Fix commit/rollback migration job doesn't drop related consistency check job when check job is not completed +1. Pipeline: Fix show consistency check status stop_time display +1. Proxy: Restore original databaseName in connectionSession after unicast +1. Proxy: Fix show tables can be executed without use database +1. Proxy: Fix the incorrect current database after unicast routing +1. Proxy: Fix the problem that show tables can be executed before use database +1. Readwrite-splitting: Fix check exception when using shadow data source +1. Governance: Fix thread blocking problem when create logic database for Etcd register center +1. Governance:Fix register storage units and create feature rules failure when use Standalone mode +1. MetaData: Fix database system schema is not built when create database +1. Metadata: Fix NPE of system schema builder rule +1. SQL Parser: Fix PostgreSQL NPE when parse columnRef +1. SQL Parser: Fix npe cause by parse MySQL select window statement +1. Sharding: Fix routing error when joining tables in uppercase +1. Sharding: Fix drop sharding table exception when table name is uppercase +1. Sharding: Fix generated key with upper case column name +1. Federation: Fix Object 'DUAL' not found exception when execute select 1 from dual with sql federation +1. Transaction: Fix xa auto commit in executeQuery +1. Proxy: Fix multi statements with specified database name + +### Change Log + +1. [MILESTONE](https://github.com/apache/shardingsphere/milestone/28) + + +## Release 5.4.1 + +### New Feature +1. Proxy: Supports dbcp and c3p0 connection pools +1. Metadata: Standalone mode adapts to metadata new structure +1. Governance: Governance supports register instance level data source + +### Enhancement +1. Mode: Improve Standalone mode JDBC type impl reset data on initialization +1. Scaling: Isolate ShardingSphereDataSource Standalone repository in pipeline +1. Scaling: Disable system-schema-metadata-enabled in pipeline +1. JDBC: Move jdbc core META-INF/services/java.sql.Driver from test to main +1. Scaling: Add algorithm columns in SHOW MIGRATION CHECK ALGORITHMS DistSQL result +1. Scaling: Add type_aliaes column in SHOW MIGRATION CHECK ALGORITHMS DistSQL result +1. Encrypt: Add duplicate name check for derived columns and logical columns +1. Encrypt: Deny DDL for cipher columns in Proxy +1. Encrypt: Add the default type for derived columns to varchar(4000) + +### Bug Fix +1. Scaling: Fix get inventory position not correctly on breakpoint resuming when table names are similar +1. Scaling: Fix CDC importer not start on breakpoint resuming when first inventory task is finished +1. Single Table: Fix not switched active version when CREATE/DROP table modifies the Single rule configuration +1. JDBC: Fix JDBC memory leak with MySQL in the 5.4.0 version + +### Change Log + +1. [MILESTONE](https://github.com/apache/shardingsphere/milestone/27) + + ## Release 5.4.0 ### API Changes -Metadata: Change sharding broadcast tables to global broadcast tables -JDBC: Remove exclamation mark (!) for global rules -DistSQL: Simplify keywords ASSISTED_QUERY, LIKE_QUERY in encrypt DistSQL -DistSQL: Optimize SQL_PARSER rule syntax -Encrypt: Adjust encryption yaml API to distinguish between encrypt, like, and assisted query configurations -Encrypt: Remove plain column and queryWithCipherColumn configuration in encrypt feature -Readwrite-splitting: Refactor read/write splitting api -Proxy: Remove property proxy-instance-type configuration -Proxy: Remove property proxy-backend-executor-suitable -Proxy: Remove property proxy-mysql-default-version -Scaling: Refactor commit rollback streaming to drop streaming -Sharding: Merge ShardingCacheRule into ShardingRule (Experimental) +1. Metadata: Change sharding broadcast tables to global broadcast tables +1. JDBC: Remove exclamation mark (!) for global rules +1. DistSQL: Simplify keywords ASSISTED_QUERY, LIKE_QUERY in encrypt DistSQL +1. DistSQL: Optimize SQL_PARSER rule syntax +1. Encrypt: Adjust encryption yaml API to distinguish between encrypt, like, and assisted query configurations +1. Encrypt: Remove plain column and queryWithCipherColumn configuration in encrypt feature +1. Readwrite-splitting: Refactor read/write splitting api +1. Proxy: Remove property proxy-instance-type configuration +1. Proxy: Remove property proxy-backend-executor-suitable +1. Proxy: Remove property proxy-mysql-default-version +1. Scaling: Refactor commit rollback streaming to drop streaming +1. Sharding: Merge ShardingCacheRule into ShardingRule (Experimental) ### New Features -DistSQL: New syntax to manage SQL_FEDERATION rule -Proxy: Support Unix Domain Socket +1. DistSQL: New syntax to manage SQL_FEDERATION rule +1. Proxy: Support Unix Domain Socket ### Enhancements -Scaling: CDC supports pure incremental mode -Scaling: CDC supports exporting data by transaction -Scaling: CDC supports MySQL and PostgreSQL -Scaling: CDC supports single table -Scaling: CDC supports all openGauss data types -Scaling: CDC supports replication reconnection -Scaling: Remove DataConsistencyCalculateAlgorithmChooser -Scaling: Improve performance of integer unique key table inventory data splitting -Scaling: Adjust process configuration default value to reduce resource consumption -Scaling: Auto refresh table metadata for migration -Scaling: Compatible with openGauss existing replication slot reuse when database not existing -Scaling: Show data consistency check status result should be empty when it's not completed -Scaling: Enable concurrent CRC32 match on source and target -Scaling: Pipeline job compatible with sharding rule audit strategy -Metadata: Refactor metadata persistence structure -Metadata: Optimize the process of loading single table metadata -Metadata: Support MySQL/PostgreSQL/openGauss system tables empty query -DistSQL: Add support for transactionalReadQueryStrategy for read/write splitting rule -DistSQL: Enhanced algorithm properties check -Transaction: Add privilege check -Transaction: Remove the TransactionTypeHolder and only create the current transaction manager -Parser: Support MySQL LOAD DATA and LOAD XML statement with single table or broadcast table -Parser: Improve the parsing support of high-priority SQL statements in the test results of the MySQL test program -Parser: Oracle dialect parser now supports Chinese comma -Encrypt: Support query of encrypt column in projection subquery when use encrypt feature -Kernel: Adds table existence metadata check for INSERT, DELETE, UPDATE and SELECT statements -JDBC: Implement batch execution for ShardingSphereStatement -Proxy: Frontend supports SSL/TLS -Proxy: Support Flush message for PostgreSQL/openGauss Proxy -Proxy: Support data type bit, bool for PostgreSQL Proxy +1. Scaling: CDC supports pure incremental mode +1. Scaling: CDC supports exporting data by transaction +1. Scaling: CDC supports MySQL and PostgreSQL +1. Scaling: CDC supports single table +1. Scaling: CDC supports all openGauss data types +1. Scaling: CDC supports replication reconnection +1. Scaling: Remove DataConsistencyCalculateAlgorithmChooser +1. Scaling: Improve performance of integer unique key table inventory data splitting +1. Scaling: Adjust process configuration default value to reduce resource consumption +1. Scaling: Auto refresh table metadata for migration +1. Scaling: Compatible with openGauss existing replication slot reuse when database not existing +1. Scaling: Show data consistency check status result should be empty when it's not completed +1. Scaling: Enable concurrent CRC32 match on source and target +1. Scaling: Pipeline job compatible with sharding rule audit strategy +1. Metadata: Refactor metadata persistence structure +1. Metadata: Optimize the process of loading single table metadata +1. Metadata: Support MySQL/PostgreSQL/openGauss system tables empty query +1. DistSQL: Add support for transactionalReadQueryStrategy for read/write splitting rule +1. DistSQL: Enhanced algorithm properties check +1. Transaction: Add privilege check +1. Transaction: Remove the TransactionTypeHolder and only create the current transaction manager +1. Parser: Support MySQL LOAD DATA and LOAD XML statement with single table or broadcast table +1. Parser: Improve the parsing support of high-priority SQL statements in the test results of the MySQL test program +1. Parser: Oracle dialect parser now supports Chinese comma +1. Encrypt: Support query of encrypt column in projection subquery when use encrypt feature +1. Kernel: Adds table existence metadata check for INSERT, DELETE, UPDATE and SELECT statements +1. JDBC: Implement batch execution for ShardingSphereStatement +1. Proxy: Frontend supports SSL/TLS +1. Proxy: Support Flush message for PostgreSQL/openGauss Proxy +1. Proxy: Support data type bit, bool for PostgreSQL Proxy ### Bug Fixes -Scaling: Fix pipeline job failure status persistence and usage -Scaling: Fix CDC DELETE event Record.beforeList is null -Scaling: Fix openGauss mppdb decoding plugin single quote issue -Scaling: Fix execute engine not closed after job stopping -Scaling: Fix stop job before task starting -Metadata: Fix case sensitive issue when loading schema meta data with H2 database -Metadata: Fix "object not found" exception when config PostgreSQL/openGauss schema name as database name -DistSQL: Fix wrong result of check_table_metadata_enabled when execute SHOW DIST VARIABLE -Encrypt: Fix SQL rewrite exception when use PostgreSQL/openGauss encrypt like feature -Sharding: Support null sharding condition pass to sharding algorithm to allow user control null value route -Parser: Support BETWEEN AND expression parsing in MySQL Projection -Mask: Fix wrong mask result when config same value of from-x and to-y with KEEP_FROM_X_TO_Y -Infra: Fix ClassNotFoundException may occur when missing pgjdbc -Proxy: Fix MySQL packet out of order when client sending pipelining requests +1. Scaling: Fix pipeline job failure status persistence and usage +1. Scaling: Fix CDC DELETE event Record.beforeList is null +1. Scaling: Fix openGauss mppdb decoding plugin single quote issue +1. Scaling: Fix execute engine not closed after job stopping +1. Scaling: Fix stop job before task starting +1. Metadata: Fix case sensitive issue when loading schema meta data with H2 database +1. Metadata: Fix "object not found" exception when config PostgreSQL/openGauss schema name as database name +1. DistSQL: Fix wrong result of check_table_metadata_enabled when execute SHOW DIST VARIABLE +1. Encrypt: Fix SQL rewrite exception when use PostgreSQL/openGauss encrypt like feature +1. Sharding: Support null sharding condition pass to sharding algorithm to allow user control null value route +1. Parser: Support BETWEEN AND expression parsing in MySQL Projection +1. Mask: Fix wrong mask result when config same value of from-x and to-y with KEEP_FROM_X_TO_Y +1. Infra: Fix ClassNotFoundException may occur when missing pgjdbc +1. Proxy: Fix MySQL packet out of order when client sending pipelining requests ### Change Log @@ -163,7 +258,7 @@ Proxy: Fix MySQL packet out of order when client sending pipelining requests 1. Kernel: Fix use Consul in cluster mode start up failure 1. DB Discovery: Close heartbeat job when drop discovery rule 1. Kernel: Fix wrong decide result when execute same sharding condition subquery with SQL federation -1. Kernel: Fix priority problem of UNION, INTERSECT, EXCEPT set operation in SQL Federation for PostgreSQL and openGuass dialect +1. Kernel: Fix priority problem of UNION, INTERSECT, EXCEPT set operation in SQL Federation for PostgreSQL and openGauss dialect 1. Kernel: Fix create view index out of range exception when view contains set operator 1. Kernel: Add XA resource exceeds length check 1. Kernel: Fix transaction support for spring requires_new @@ -436,7 +531,7 @@ Proxy: Fix MySQL packet out of order when client sending pipelining requests 1. Support parsing ALTER OPERATOR in PostgreSQL 1. Add PostgreSQL Copy Statement 1. Add PostgreSQL Comment Statement -1. Support listen statement in postgreSQL +1. Support listen statement in PostgreSQL 1. Support DECLARE cursor statement 1. Add default serverConfig in helm charts 1. Assemble openGauss JDBC Driver into Proxy distribution diff --git a/agent/api/pom.xml b/agent/api/pom.xml index 18b6de84bd0be..704baf952ab3c 100644 --- a/agent/api/pom.xml +++ b/agent/api/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-agent - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-api ${project.artifactId} diff --git a/agent/api/src/main/java/org/apache/shardingsphere/agent/api/plugin/AgentPluginEnable.java b/agent/api/src/main/java/org/apache/shardingsphere/agent/api/plugin/AgentPluginEnable.java new file mode 100644 index 0000000000000..fa71cfba54659 --- /dev/null +++ b/agent/api/src/main/java/org/apache/shardingsphere/agent/api/plugin/AgentPluginEnable.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.agent.api.plugin; + +/** + * Agent plugin enable. + */ +public interface AgentPluginEnable { + + /** + * Is the plugin enabled. + * + * @return true or false + */ + boolean isPluginEnabled(); +} diff --git a/agent/core/pom.xml b/agent/core/pom.xml index 79babf7258f89..cca9547f92d6a 100644 --- a/agent/core/pom.xml +++ b/agent/core/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-agent - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-core ${project.artifactId} @@ -36,19 +36,6 @@ shardingsphere-agent-api ${project.version} - - org.apache.shardingsphere - shardingsphere-proxy-backend-core - ${project.version} - provided - - - org.apache.shardingsphere - shardingsphere-jdbc-core - ${project.version} - provided - - net.bytebuddy byte-buddy @@ -58,6 +45,27 @@ org.yaml snakeyaml + + + com.cedarsoftware + java-util + test + + + org.slf4j + slf4j-api + test + + + org.slf4j + jcl-over-slf4j + test + + + org.slf4j + jul-to-slf4j + test + diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/ShardingSphereAgent.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/ShardingSphereAgent.java index 90941a0564911..18747d695273c 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/ShardingSphereAgent.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/ShardingSphereAgent.java @@ -25,7 +25,6 @@ import org.apache.shardingsphere.agent.core.advisor.config.AdvisorConfigurationLoader; import org.apache.shardingsphere.agent.core.builder.AgentBuilderFactory; import org.apache.shardingsphere.agent.core.path.AgentPath; -import org.apache.shardingsphere.agent.core.plugin.PluginContext; import org.apache.shardingsphere.agent.core.plugin.config.PluginConfigurationLoader; import org.apache.shardingsphere.agent.core.plugin.jar.PluginJarLoader; @@ -53,10 +52,8 @@ public static void premain(final String args, final Instrumentation instrumentat File rootPath = AgentPath.getRootPath(); Map pluginConfigs = PluginConfigurationLoader.load(rootPath); Collection pluginJars = PluginJarLoader.load(rootPath); - boolean isEnhancedForProxy = isEnhancedForProxy(); - PluginContext.getInstance().setEnhancedForProxy(isEnhancedForProxy); Map advisorConfigs = AdvisorConfigurationLoader.load(pluginJars, pluginConfigs.keySet()); - AgentBuilderFactory.create(pluginConfigs, pluginJars, advisorConfigs, isEnhancedForProxy).installOn(instrumentation); + AgentBuilderFactory.create(pluginConfigs, pluginJars, advisorConfigs, isEnhancedForProxy()).installOn(instrumentation); } private static boolean isEnhancedForProxy() { diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/config/AdvisorConfigurationLoader.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/config/AdvisorConfigurationLoader.java index ffcf9992505b0..98551e16ec583 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/config/AdvisorConfigurationLoader.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/config/AdvisorConfigurationLoader.java @@ -21,8 +21,6 @@ import lombok.NoArgsConstructor; import org.apache.shardingsphere.agent.core.advisor.config.yaml.loader.YamlAdvisorsConfigurationLoader; import org.apache.shardingsphere.agent.core.advisor.config.yaml.swapper.YamlAdvisorsConfigurationSwapper; -import org.apache.shardingsphere.agent.core.log.AgentLogger; -import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory; import org.apache.shardingsphere.agent.core.plugin.classloader.AgentPluginClassLoader; import java.io.File; @@ -38,8 +36,6 @@ @NoArgsConstructor(access = AccessLevel.PRIVATE) public final class AdvisorConfigurationLoader { - private static final AgentLogger LOGGER = AgentLoggerFactory.getAgentLogger(AdvisorConfigurationLoader.class); - /** * Load advisor configurations. * @@ -52,9 +48,7 @@ public static Map load(final Collection p AgentPluginClassLoader agentPluginClassLoader = new AgentPluginClassLoader(Thread.currentThread().getContextClassLoader(), pluginJars); for (String each : pluginTypes) { InputStream advisorsResourceStream = getResourceStream(agentPluginClassLoader, each); - if (null == advisorsResourceStream) { - LOGGER.info("No configuration of advisor for type `{}`.", each); - } else { + if (null != advisorsResourceStream) { mergeConfigurations(result, YamlAdvisorsConfigurationSwapper.swap(YamlAdvisorsConfigurationLoader.load(advisorsResourceStream), each)); } } diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/AdviceExecutorFactory.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/AdviceExecutorFactory.java index c915ce3436f46..ec92fd3ad9bd3 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/AdviceExecutorFactory.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/AdviceExecutorFactory.java @@ -54,7 +54,7 @@ public AdviceExecutorFactory(final ClassLoaderContext classLoaderContext, final * @return found advice executor */ public Optional findMatchedAdviceExecutor(final InDefinedShape methodDescription) { - Map> advices = new HashMap<>(); + Map> advices = new HashMap<>(advisorConfig.getAdvisors().size(), 1F); for (MethodAdvisorConfiguration each : advisorConfig.getAdvisors()) { if (each.getPointcut().matches(methodDescription)) { advices.computeIfAbsent(each.getPluginType(), key -> new LinkedList<>()); diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/ConstructorAdviceExecutor.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/ConstructorAdviceExecutor.java index 3d04236a2d083..e27d220021bcc 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/ConstructorAdviceExecutor.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/ConstructorAdviceExecutor.java @@ -28,14 +28,14 @@ import net.bytebuddy.matcher.ElementMatchers; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; import org.apache.shardingsphere.agent.api.advice.type.ConstructorAdvice; +import org.apache.shardingsphere.agent.api.plugin.AgentPluginEnable; import org.apache.shardingsphere.agent.core.advisor.executor.AdviceExecutor; -import org.apache.shardingsphere.agent.core.log.AgentLogger; -import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory; -import org.apache.shardingsphere.agent.core.plugin.PluginContext; import java.util.Collection; import java.util.Map; import java.util.Map.Entry; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Constructor advice executor. @@ -43,7 +43,7 @@ @RequiredArgsConstructor public final class ConstructorAdviceExecutor implements AdviceExecutor { - private static final AgentLogger LOGGER = AgentLoggerFactory.getAgentLogger(ConstructorAdviceExecutor.class); + private static final Logger LOGGER = Logger.getLogger(ConstructorAdviceExecutor.class.getName()); private final Map> advices; @@ -55,23 +55,25 @@ public final class ConstructorAdviceExecutor implements AdviceExecutor { */ @RuntimeType public void advice(@This final TargetAdviceObject target, @AllArguments final Object[] args) { - boolean adviceEnabled = PluginContext.getInstance().isPluginEnabled(); - if (!adviceEnabled) { - return; - } try { for (Entry> entry : advices.entrySet()) { for (ConstructorAdvice each : entry.getValue()) { - each.onConstructor(target, args, entry.getKey()); + if (isPluginEnabled(each)) { + each.onConstructor(target, args, entry.getKey()); + } } } // CHECKSTYLE:OFF - } catch (final Throwable throwable) { + } catch (final Throwable ex) { // CHECKSTYLE:ON - LOGGER.error("Constructor advice execution error. class: {}", target.getClass().getTypeName(), throwable); + LOGGER.log(Level.SEVERE, "Constructor advice execution error. class: {0}, {1}", new String[]{target.getClass().getTypeName(), ex.getMessage()}); } } + private boolean isPluginEnabled(final ConstructorAdvice advice) { + return !(advice instanceof AgentPluginEnable) || ((AgentPluginEnable) advice).isPluginEnabled(); + } + @Override public Builder intercept(final Builder builder, final MethodDescription pointcut) { return builder.constructor(ElementMatchers.is(pointcut)).intercept(SuperMethodCall.INSTANCE.andThen(MethodDelegation.withDefaultConfiguration().to(this))); diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/InstanceMethodAdviceExecutor.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/InstanceMethodAdviceExecutor.java index 3c96d9d65911a..9fff440ddfcec 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/InstanceMethodAdviceExecutor.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/InstanceMethodAdviceExecutor.java @@ -28,18 +28,18 @@ import net.bytebuddy.implementation.bind.annotation.SuperCall; import net.bytebuddy.implementation.bind.annotation.This; import net.bytebuddy.matcher.ElementMatchers; +import org.apache.shardingsphere.agent.api.plugin.AgentPluginEnable; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; import org.apache.shardingsphere.agent.core.advisor.executor.AdviceExecutor; -import org.apache.shardingsphere.agent.core.log.AgentLogger; -import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory; -import org.apache.shardingsphere.agent.core.plugin.PluginContext; import java.lang.reflect.Method; import java.util.Collection; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.Callable; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Instance method advice executor. @@ -47,7 +47,7 @@ @RequiredArgsConstructor public final class InstanceMethodAdviceExecutor implements AdviceExecutor { - private static final AgentLogger LOGGER = AgentLoggerFactory.getAgentLogger(InstanceMethodAdviceExecutor.class); + private static final Logger LOGGER = Logger.getLogger(InstanceMethodAdviceExecutor.class.getName()); private final Map> advices; @@ -63,24 +63,17 @@ public final class InstanceMethodAdviceExecutor implements AdviceExecutor { @RuntimeType @SneakyThrows public Object advice(@This final TargetAdviceObject target, @Origin final Method method, @AllArguments final Object[] args, @SuperCall final Callable callable) { - boolean adviceEnabled = PluginContext.getInstance().isPluginEnabled(); - if (adviceEnabled) { - adviceBefore(target, method, args); - } + adviceBefore(target, method, args); Object result = null; try { result = callable.call(); // CHECKSTYLE:OFF } catch (final Throwable ex) { // CHECKSTYLE:ON - if (adviceEnabled) { - adviceThrow(target, method, args, ex); - } + adviceThrow(target, method, args, ex); throw ex; } finally { - if (adviceEnabled) { - adviceAfter(target, method, args, result); - } + adviceAfter(target, method, args, result); } return result; } @@ -89,13 +82,15 @@ private void adviceBefore(final TargetAdviceObject target, final Method method, try { for (Entry> entry : advices.entrySet()) { for (InstanceMethodAdvice each : entry.getValue()) { - each.beforeMethod(target, method, args, entry.getKey()); + if (isPluginEnabled(each)) { + each.beforeMethod(target, method, args, entry.getKey()); + } } } // CHECKSTYLE:OFF } catch (final Throwable ex) { // CHECKSTYLE:ON - LOGGER.error("Failed to execute the pre-method of method `{}` in class `{}`.", method.getName(), target.getClass(), ex); + LOGGER.log(Level.SEVERE, "Failed to execute the pre-method of method `{0}` in class `{1}`, {2}.", new String[]{method.getName(), target.getClass().getName(), ex.getMessage()}); } } @@ -103,13 +98,15 @@ private void adviceThrow(final TargetAdviceObject target, final Method method, f try { for (Entry> entry : advices.entrySet()) { for (InstanceMethodAdvice each : entry.getValue()) { - each.onThrowing(target, method, args, ex, entry.getKey()); + if (isPluginEnabled(each)) { + each.onThrowing(target, method, args, ex, entry.getKey()); + } } } // CHECKSTYLE:OFF } catch (final Throwable ignored) { // CHECKSTYLE:ON - LOGGER.error("Failed to execute the error handler of method `{}` in class `{}`.", method.getName(), target.getClass(), ex); + LOGGER.log(Level.SEVERE, "Failed to execute the error handler of method `{0}` in class `{1}`, {2}.", new String[]{method.getName(), target.getClass().getName(), ex.getMessage()}); } } @@ -117,17 +114,22 @@ private void adviceAfter(final TargetAdviceObject target, final Method method, f try { for (Entry> entry : advices.entrySet()) { for (InstanceMethodAdvice each : entry.getValue()) { - each.afterMethod(target, method, args, result, entry.getKey()); + if (isPluginEnabled(each)) { + each.afterMethod(target, method, args, result, entry.getKey()); + } } - } // CHECKSTYLE:OFF } catch (final Throwable ex) { // CHECKSTYLE:ON - LOGGER.error("Failed to execute the post-method of method `{}` in class `{}`.", method.getName(), target.getClass(), ex); + LOGGER.log(Level.SEVERE, "Failed to execute the post-method of method `{0}` in class `{1}`, {2}.", new String[]{method.getName(), target.getClass().getName(), ex.getMessage()}); } } + private boolean isPluginEnabled(final InstanceMethodAdvice advice) { + return !(advice instanceof AgentPluginEnable) || ((AgentPluginEnable) advice).isPluginEnabled(); + } + @Override public Builder intercept(final Builder builder, final MethodDescription pointcut) { return builder.method(ElementMatchers.is(pointcut)).intercept(MethodDelegation.withDefaultConfiguration().to(this)); diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/StaticMethodAdviceExecutor.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/StaticMethodAdviceExecutor.java index 82273a876149b..3e7182ed31988 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/StaticMethodAdviceExecutor.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/StaticMethodAdviceExecutor.java @@ -27,17 +27,17 @@ import net.bytebuddy.implementation.bind.annotation.RuntimeType; import net.bytebuddy.implementation.bind.annotation.SuperCall; import net.bytebuddy.matcher.ElementMatchers; +import org.apache.shardingsphere.agent.api.plugin.AgentPluginEnable; import org.apache.shardingsphere.agent.api.advice.type.StaticMethodAdvice; import org.apache.shardingsphere.agent.core.advisor.executor.AdviceExecutor; -import org.apache.shardingsphere.agent.core.log.AgentLogger; -import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory; -import org.apache.shardingsphere.agent.core.plugin.PluginContext; import java.lang.reflect.Method; import java.util.Collection; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.Callable; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Static method advice executor. @@ -45,7 +45,7 @@ @RequiredArgsConstructor public final class StaticMethodAdviceExecutor implements AdviceExecutor { - private static final AgentLogger LOGGER = AgentLoggerFactory.getAgentLogger(StaticMethodAdviceExecutor.class); + private static final Logger LOGGER = Logger.getLogger(StaticMethodAdviceExecutor.class.getName()); private final Map> advices; @@ -61,24 +61,17 @@ public final class StaticMethodAdviceExecutor implements AdviceExecutor { @RuntimeType @SneakyThrows public Object advice(@Origin final Class klass, @Origin final Method method, @AllArguments final Object[] args, @SuperCall final Callable callable) { - boolean adviceEnabled = PluginContext.getInstance().isPluginEnabled(); - if (adviceEnabled) { - adviceBefore(klass, method, args); - } + adviceBefore(klass, method, args); Object result = null; try { result = callable.call(); // CHECKSTYLE:OFF } catch (final Throwable ex) { // CHECKSTYLE:ON - if (adviceEnabled) { - adviceThrow(klass, method, args, ex); - } + adviceThrow(klass, method, args, ex); throw ex; } finally { - if (adviceEnabled) { - adviceAfter(klass, method, args, result); - } + adviceAfter(klass, method, args, result); } return result; } @@ -87,13 +80,15 @@ private void adviceBefore(final Class klass, final Method method, final Objec try { for (Entry> entry : advices.entrySet()) { for (StaticMethodAdvice each : entry.getValue()) { - each.beforeMethod(klass, method, args, entry.getKey()); + if (isPluginEnabled(each)) { + each.beforeMethod(klass, method, args, entry.getKey()); + } } } // CHECKSTYLE:OFF } catch (final Throwable ex) { // CHECKSTYLE:ON - LOGGER.error("Failed to execute the pre-method of method `{}` in class `{}`.", method.getName(), klass, ex); + LOGGER.log(Level.SEVERE, "Failed to execute the pre-method of method `{0}` in class `{1}`, {2}.", new String[]{method.getName(), klass.getClass().getName(), ex.getMessage()}); } } @@ -101,13 +96,15 @@ private void adviceThrow(final Class klass, final Method method, final Object try { for (Entry> entry : advices.entrySet()) { for (StaticMethodAdvice each : entry.getValue()) { - each.onThrowing(klass, method, args, ex, entry.getKey()); + if (isPluginEnabled(each)) { + each.onThrowing(klass, method, args, ex, entry.getKey()); + } } } // CHECKSTYLE:OFF } catch (final Throwable ignored) { // CHECKSTYLE:ON - LOGGER.error("Failed to execute the error handler of method `{}` in class `{}`.", method.getName(), klass, ex); + LOGGER.log(Level.SEVERE, "Failed to execute the error handler of method `{0}` in class `{1}`, {2}.", new String[]{method.getName(), klass.getClass().getName(), ex.getMessage()}); } } @@ -115,16 +112,22 @@ private void adviceAfter(final Class klass, final Method method, final Object try { for (Entry> entry : advices.entrySet()) { for (StaticMethodAdvice each : entry.getValue()) { - each.afterMethod(klass, method, args, result, entry.getKey()); + if (isPluginEnabled(each)) { + each.afterMethod(klass, method, args, result, entry.getKey()); + } } } // CHECKSTYLE:OFF } catch (final Throwable ex) { // CHECKSTYLE:ON - LOGGER.error("Failed to execute the post-method of method `{}` in class `{}`.", method.getName(), klass, ex); + LOGGER.log(Level.SEVERE, "Failed to execute the post-method of method `{0}` in class `{1}` {2}.", new String[]{method.getName(), klass.getClass().getName(), ex.getMessage()}); } } + private boolean isPluginEnabled(final StaticMethodAdvice advice) { + return !(advice instanceof AgentPluginEnable) || ((AgentPluginEnable) advice).isPluginEnabled(); + } + @Override public Builder intercept(final Builder builder, final MethodDescription pointcut) { return builder.method(ElementMatchers.is(pointcut)).intercept(MethodDelegation.withDefaultConfiguration().to(this)); diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentTransformer.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentTransformer.java index 04490481a104d..dc2a36d314c7d 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentTransformer.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentTransformer.java @@ -26,13 +26,10 @@ import net.bytebuddy.utility.JavaModule; import org.apache.shardingsphere.agent.api.PluginConfiguration; import org.apache.shardingsphere.agent.core.advisor.config.AdvisorConfiguration; -import org.apache.shardingsphere.agent.core.advisor.config.AdvisorConfigurationLoader; import org.apache.shardingsphere.agent.core.advisor.config.MethodAdvisorConfiguration; import org.apache.shardingsphere.agent.core.builder.interceptor.AgentBuilderInterceptChainEngine; import org.apache.shardingsphere.agent.core.builder.interceptor.impl.MethodAdvisorBuilderInterceptor; import org.apache.shardingsphere.agent.core.builder.interceptor.impl.TargetAdviceObjectBuilderInterceptor; -import org.apache.shardingsphere.agent.core.log.AgentLogger; -import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory; import org.apache.shardingsphere.agent.core.plugin.PluginLifecycleServiceManager; import org.apache.shardingsphere.agent.core.plugin.classloader.AgentPluginClassLoader; import org.apache.shardingsphere.agent.core.plugin.classloader.ClassLoaderContext; @@ -42,6 +39,8 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.jar.JarFile; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Agent transformer. @@ -49,7 +48,7 @@ @RequiredArgsConstructor public final class AgentTransformer implements Transformer { - private static final AgentLogger LOGGER = AgentLoggerFactory.getAgentLogger(AdvisorConfigurationLoader.class); + private static final Logger LOGGER = Logger.getLogger(AgentTransformer.class.getName()); private static final Map TYPE_POOL_MAP = new ConcurrentHashMap<>(); @@ -80,7 +79,7 @@ private AdvisorConfiguration filterInvalidAdviceClass(final AdvisorConfiguration result.getAdvisors().add(each); continue; } - LOGGER.error("The advice class `{}` does not exist", each.getAdviceClassName()); + LOGGER.log(Level.SEVERE, "The advice class `{0}` does not exist", new String[]{each.getAdviceClassName()}); } return result; } diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/interceptor/impl/MethodAdvisorBuilderInterceptor.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/interceptor/impl/MethodAdvisorBuilderInterceptor.java index c9f1d5b5e164c..f34969a31182b 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/interceptor/impl/MethodAdvisorBuilderInterceptor.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/interceptor/impl/MethodAdvisorBuilderInterceptor.java @@ -25,17 +25,17 @@ import org.apache.shardingsphere.agent.core.advisor.executor.AdviceExecutorFactory; import org.apache.shardingsphere.agent.core.builder.interceptor.AgentBuilderInterceptor; import org.apache.shardingsphere.agent.core.plugin.classloader.ClassLoaderContext; -import org.apache.shardingsphere.agent.core.log.AgentLogger; -import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory; import java.util.Optional; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Method advisor builder interceptor. */ public final class MethodAdvisorBuilderInterceptor implements AgentBuilderInterceptor { - private static final AgentLogger LOGGER = AgentLoggerFactory.getAgentLogger(MethodAdvisorBuilderInterceptor.class); + private static final Logger LOGGER = Logger.getLogger(MethodAdvisorBuilderInterceptor.class.getName()); private final TypeDescription typePointcut; @@ -59,7 +59,7 @@ public Builder intercept(final Builder builder) { // CHECKSTYLE:OFF } catch (final Throwable ex) { // CHECKSTYLE:ON - LOGGER.error("Failed to load advice class: {}.", typePointcut.getTypeName(), ex); + LOGGER.log(Level.SEVERE, "Failed to load advice class: {0}, {1}", new String[]{typePointcut.getTypeName(), ex.getMessage()}); } } return result; diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLogger.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLogger.java deleted file mode 100644 index 4f69ca1b3a508..0000000000000 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLogger.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.agent.core.log; - -/** - * Agent logger. - */ -public interface AgentLogger { - - /** - * Info. - * - * @param msg message - */ - void info(String msg); - - /** - * Info. - * - * @param format format - * @param arguments arguments - */ - void info(String format, Object... arguments); - - /** - * Error. - * - * @param format format - * @param arguments arguments - */ - void error(String format, Object... arguments); - - /** - * Error. - * - * @param msg message - */ - void error(String msg); -} diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLoggerFactory.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLoggerFactory.java deleted file mode 100644 index b80206195d00e..0000000000000 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/AgentLoggerFactory.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.agent.core.log; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import org.apache.shardingsphere.agent.core.log.slf4j.SLF4JAgentLogger; -import org.slf4j.LoggerFactory; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Agent logger factory. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class AgentLoggerFactory { - - private static final Map LOGGERS = new ConcurrentHashMap<>(); - - /** - * Get agent logger. - * - * @param clazz clazz - * @return agent logger - */ - public static AgentLogger getAgentLogger(final Class clazz) { - return AgentLoggerFactory.getAgentLogger(clazz.getName()); - } - - /** - * Get agent logger. - * - * @param name name - * @return agent logger - */ - public static AgentLogger getAgentLogger(final String name) { - return LOGGERS.computeIfAbsent(name, key -> new SLF4JAgentLogger(LoggerFactory.getLogger(name))); - } -} diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/slf4j/SLF4JAgentLogger.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/slf4j/SLF4JAgentLogger.java deleted file mode 100644 index 656d23ff1aeff..0000000000000 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/log/slf4j/SLF4JAgentLogger.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.agent.core.log.slf4j; - -import lombok.RequiredArgsConstructor; -import org.apache.shardingsphere.agent.core.log.AgentLogger; -import org.slf4j.Logger; - -/** - * SLF4J agent logger. - */ -@RequiredArgsConstructor -public final class SLF4JAgentLogger implements AgentLogger { - - private final Logger logger; - - @Override - public void info(final String msg) { - logger.info(msg); - } - - @Override - public void info(final String format, final Object... arguments) { - logger.info(format, arguments); - } - - @Override - public void error(final String format, final Object... arguments) { - logger.error(format, arguments); - } - - @Override - public void error(final String msg) { - logger.error(msg); - } -} diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/path/AgentPath.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/path/AgentPath.java index 6bf9a13a4c969..3bc3c7be6cbaa 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/path/AgentPath.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/path/AgentPath.java @@ -19,7 +19,7 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; -import org.apache.shardingsphere.agent.core.util.AgentPreconditions; +import org.apache.shardingsphere.agent.core.preconditions.AgentPreconditions; import java.io.File; import java.net.MalformedURLException; diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginContext.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginContext.java deleted file mode 100644 index 12ff8cc281800..0000000000000 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginContext.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.agent.core.plugin; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.apache.shardingsphere.agent.core.util.AgentReflectionUtils; -import org.apache.shardingsphere.driver.ShardingSphereDriver; -import org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache; -import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey; -import org.apache.shardingsphere.mode.manager.ContextManager; -import org.apache.shardingsphere.proxy.backend.context.ProxyContext; - -import javax.sql.DataSource; -import java.sql.Driver; -import java.sql.DriverManager; -import java.util.Enumeration; -import java.util.Map; -import java.util.Optional; - -/** - * Plugin Context. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -@Setter -public final class PluginContext { - - private static final PluginContext INSTANCE = new PluginContext(); - - private boolean enhancedForProxy; - - private ContextManager contextManager; - - /** - * Get instance of plugin context. - * - * @return instance - */ - public static PluginContext getInstance() { - return INSTANCE; - } - - /** - * Check if the plugin is enabled. - * - * @return the plugin enable value - */ - public boolean isPluginEnabled() { - if (null == contextManager) { - contextManager = getContextManager().orElse(null); - } - return null == contextManager || contextManager.getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.AGENT_PLUGINS_ENABLED); - } - - private Optional getContextManager() { - if (enhancedForProxy) { - return Optional.ofNullable(ProxyContext.getInstance().getContextManager()); - } - Optional shardingSphereDriver = getShardingSphereDriver(); - if (!shardingSphereDriver.isPresent()) { - return Optional.empty(); - } - DriverDataSourceCache dataSourceCache = AgentReflectionUtils.getFieldValue(shardingSphereDriver.get(), "dataSourceCache"); - Map dataSourceMap = AgentReflectionUtils.getFieldValue(dataSourceCache, "dataSourceMap"); - return dataSourceMap.isEmpty() ? Optional.empty() : Optional.ofNullable(AgentReflectionUtils.getFieldValue(dataSourceMap.values().iterator().next(), "contextManager")); - - } - - private Optional getShardingSphereDriver() { - Enumeration driverEnumeration = DriverManager.getDrivers(); - while (driverEnumeration.hasMoreElements()) { - Driver driver = driverEnumeration.nextElement(); - if (driver instanceof ShardingSphereDriver) { - return Optional.of((ShardingSphereDriver) driver); - } - } - return Optional.empty(); - } -} diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManager.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManager.java index cba7922376408..ea415850eb7a1 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManager.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManager.java @@ -20,8 +20,6 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.shardingsphere.agent.api.PluginConfiguration; -import org.apache.shardingsphere.agent.core.log.AgentLogger; -import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory; import org.apache.shardingsphere.agent.core.spi.AgentServiceLoader; import org.apache.shardingsphere.agent.spi.PluginLifecycleService; @@ -31,6 +29,8 @@ import java.util.Map.Entry; import java.util.concurrent.atomic.AtomicBoolean; import java.util.jar.JarFile; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Plugin lifecycle service manager. @@ -40,7 +40,7 @@ public final class PluginLifecycleServiceManager { private static final AtomicBoolean STARTED_FLAG = new AtomicBoolean(false); - private static final AgentLogger LOGGER = AgentLoggerFactory.getAgentLogger(PluginLifecycleServiceManager.class); + private static final Logger LOGGER = Logger.getLogger(PluginLifecycleServiceManager.class.getName()); /** * Initialize all plugins. @@ -52,8 +52,8 @@ public final class PluginLifecycleServiceManager { */ public static void init(final Map pluginConfigs, final Collection pluginJars, final ClassLoader pluginClassLoader, final boolean isEnhancedForProxy) { if (STARTED_FLAG.compareAndSet(false, true)) { - PluginLifecycleServiceManager.start(pluginConfigs, pluginClassLoader, isEnhancedForProxy); - Runtime.getRuntime().addShutdownHook(new Thread(() -> PluginLifecycleServiceManager.close(pluginJars))); + start(pluginConfigs, pluginClassLoader, isEnhancedForProxy); + Runtime.getRuntime().addShutdownHook(new Thread(() -> close(pluginJars))); } } @@ -72,12 +72,12 @@ private static void start(final Map pluginConfigs, private static void start(final PluginConfiguration pluginConfig, final PluginLifecycleService pluginLifecycleService, final boolean isEnhancedForProxy) { try { - LOGGER.info("Start plugin: {}", pluginLifecycleService.getType()); + LOGGER.log(Level.INFO, "Start plugin: {0}", new String[]{pluginLifecycleService.getType()}); pluginLifecycleService.start(pluginConfig, isEnhancedForProxy); // CHECKSTYLE:OFF } catch (final Throwable ex) { // CHECKSTYLE:ON - LOGGER.error("Failed to start service.", ex); + LOGGER.log(Level.SEVERE, "Failed to start service {0}.", new String[]{ex.getMessage()}); } } @@ -87,7 +87,7 @@ private static void close(final Collection pluginJars) { try { each.close(); } catch (final IOException ex) { - LOGGER.error("Failed to close jar file.", ex); + LOGGER.log(Level.SEVERE, "Failed to close jar file {0}.", new String[]{ex.getMessage()}); } }); } diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/classloader/AgentPluginClassLoader.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/classloader/AgentPluginClassLoader.java index deed99b8139e3..935a91a90d233 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/classloader/AgentPluginClassLoader.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/classloader/AgentPluginClassLoader.java @@ -103,7 +103,7 @@ private static byte[] toByteArray(final InputStream inStream) throws IOException ByteArrayOutputStream result = new ByteArrayOutputStream(); try { byte[] buffer = new byte[buffSize]; - int len = -1; + int len; while ((len = inStream.read(buffer)) != -1) { result.write(buffer, 0, len); } diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/jar/PluginJarLoader.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/jar/PluginJarLoader.java index bb61a6a27c3f2..0e4763e776973 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/jar/PluginJarLoader.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/jar/PluginJarLoader.java @@ -20,8 +20,6 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; import lombok.SneakyThrows; -import org.apache.shardingsphere.agent.core.log.AgentLogger; -import org.apache.shardingsphere.agent.core.log.AgentLoggerFactory; import java.io.File; import java.io.IOException; @@ -33,6 +31,8 @@ import java.util.Collection; import java.util.LinkedList; import java.util.jar.JarFile; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Plugin jar loader. @@ -40,11 +40,11 @@ @NoArgsConstructor(access = AccessLevel.PRIVATE) public final class PluginJarLoader { - private static final AgentLogger LOGGER = AgentLoggerFactory.getAgentLogger(PluginJarLoader.class); + private static final Logger LOGGER = Logger.getLogger(PluginJarLoader.class.getName()); /** * Load plugin jars. - * + * * @param agentRootPath agent root path * @return plugin jars * @throws IOException IO exception @@ -54,7 +54,7 @@ public static Collection load(final File agentRootPath) throws IOExcept Collection result = new LinkedList<>(); for (File each : jarFiles) { result.add(new JarFile(each, true)); - LOGGER.info("Loaded jar: {}", each.getName()); + LOGGER.log(Level.INFO, "Loaded jar: {0}", new String[]{each.getName()}); } return result; } @@ -66,8 +66,9 @@ private static Collection getJarFiles(final File file) { @Override public FileVisitResult visitFile(final Path path, final BasicFileAttributes attributes) { - if (path.toFile().isFile() && path.toFile().getName().endsWith(".jar")) { - result.add(path.toFile()); + File currentFile = path.toFile(); + if (currentFile.isFile() && currentFile.getName().endsWith(".jar")) { + result.add(currentFile); } return FileVisitResult.CONTINUE; } diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/util/AgentPreconditions.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/preconditions/AgentPreconditions.java similarity index 80% rename from agent/core/src/main/java/org/apache/shardingsphere/agent/core/util/AgentPreconditions.java rename to agent/core/src/main/java/org/apache/shardingsphere/agent/core/preconditions/AgentPreconditions.java index f6fe11baf5967..86ddcf2e96914 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/util/AgentPreconditions.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/preconditions/AgentPreconditions.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.agent.core.util; +package org.apache.shardingsphere.agent.core.preconditions; import lombok.AccessLevel; import lombok.NoArgsConstructor; @@ -39,19 +39,6 @@ public static void checkState(final boolean state, final String errorMessage) { } } - /** - * Check not null. - * - * @param reference reference - * @param errorMessage error message - * @throws NullPointerException null pointer exception - */ - public static void checkNotNull(final Object reference, final String errorMessage) { - if (null == reference) { - throw new NullPointerException(errorMessage); - } - } - /** * Check argument. * diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/spi/AgentServiceLoader.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/spi/AgentServiceLoader.java index 03eb3de6e3f32..5cc39ff7fd8c0 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/spi/AgentServiceLoader.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/spi/AgentServiceLoader.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.core.spi; import lombok.Getter; -import org.apache.shardingsphere.agent.core.util.AgentPreconditions; +import org.apache.shardingsphere.agent.core.preconditions.AgentPreconditions; import java.util.Collection; import java.util.LinkedList; @@ -39,13 +39,8 @@ public final class AgentServiceLoader { private final Collection services; private AgentServiceLoader(final Class service) { - validate(service); - this.services = load(service); - } - - private void validate(final Class service) { - AgentPreconditions.checkNotNull(service, "SPI class is null."); AgentPreconditions.checkArgument(service.isInterface(), String.format("SPI class `%s` is not interface.", service)); + services = load(service); } private Collection load(final Class service) { diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/util/AgentReflectionUtils.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/util/AgentReflectionUtils.java deleted file mode 100644 index fb073e9d2a4cc..0000000000000 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/util/AgentReflectionUtils.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.agent.core.util; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.SneakyThrows; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.Optional; - -/** - * Agent reflection utility class. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class AgentReflectionUtils { - - /** - * Get field value. - * - * @param target target - * @param fieldName field name - * @param type of field value - * @return field value - * @throws IllegalStateException illegal state exception - */ - public static T getFieldValue(final Object target, final String fieldName) { - Optional field = findField(fieldName, target.getClass()); - if (field.isPresent()) { - return getFieldValue(target, field.get()); - } - throw new IllegalStateException(String.format("Can not find field name `%s` in class %s.", fieldName, target.getClass())); - } - - @SuppressWarnings("unchecked") - @SneakyThrows(IllegalAccessException.class) - private static T getFieldValue(final Object target, final Field field) { - boolean accessible = field.isAccessible(); - if (!accessible) { - field.setAccessible(true); - } - T result = (T) field.get(target); - if (!accessible) { - field.setAccessible(false); - } - return result; - } - - private static Optional findField(final String fieldName, final Class targetClass) { - Class currentTargetClass = targetClass; - while (Object.class != currentTargetClass) { - try { - return Optional.of(currentTargetClass.getDeclaredField(fieldName)); - } catch (final NoSuchFieldException ignored) { - currentTargetClass = currentTargetClass.getSuperclass(); - } - } - return Optional.empty(); - } - - /** - * Invoke method. - * - * @param method method - * @param target target - * @param args arguments - * @param type of invoke result - * @return invoke result - */ - @SuppressWarnings("unchecked") - @SneakyThrows(ReflectiveOperationException.class) - public static T invokeMethod(final Method method, final Object target, final Object... args) { - boolean accessible = method.isAccessible(); - if (!accessible) { - method.setAccessible(true); - } - T result = (T) method.invoke(target, args); - if (!accessible) { - method.setAccessible(false); - } - return result; - } -} diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/yaml/AgentYamlConstructor.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/yaml/AgentYamlConstructor.java index dec92288623d8..be5d3e14fb65e 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/yaml/AgentYamlConstructor.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/yaml/AgentYamlConstructor.java @@ -17,7 +17,8 @@ package org.apache.shardingsphere.agent.core.yaml; -import org.apache.shardingsphere.agent.core.util.AgentPreconditions; +import org.apache.shardingsphere.agent.core.preconditions.AgentPreconditions; +import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.constructor.Constructor; /** @@ -27,8 +28,8 @@ public final class AgentYamlConstructor extends Constructor { private final Class rootClass; - public AgentYamlConstructor(final Class rootClass) { - super(rootClass); + public AgentYamlConstructor(final Class rootClass, final LoaderOptions loadingConfig) { + super(rootClass, loadingConfig); this.rootClass = rootClass; } diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/yaml/AgentYamlEngine.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/yaml/AgentYamlEngine.java index c5187528e0678..06316d057cd76 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/yaml/AgentYamlEngine.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/yaml/AgentYamlEngine.java @@ -21,6 +21,7 @@ import lombok.NoArgsConstructor; import org.apache.shardingsphere.agent.core.advisor.config.yaml.entity.YamlAdvisorsConfiguration; import org.apache.shardingsphere.agent.core.plugin.config.yaml.entity.YamlAgentConfiguration; +import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.Yaml; import java.io.InputStream; @@ -38,7 +39,7 @@ public final class AgentYamlEngine { * @return YAML agent configuration */ public static YamlAgentConfiguration unmarshalYamlAgentConfiguration(final InputStream inputStream) { - return new Yaml(new AgentYamlConstructor(YamlAgentConfiguration.class)).loadAs(inputStream, YamlAgentConfiguration.class); + return new Yaml(new AgentYamlConstructor(YamlAgentConfiguration.class, createLoaderOptions())).loadAs(inputStream, YamlAgentConfiguration.class); } /** @@ -48,6 +49,13 @@ public static YamlAgentConfiguration unmarshalYamlAgentConfiguration(final Input * @return YAML advisors configuration */ public static YamlAdvisorsConfiguration unmarshalYamlAdvisorsConfiguration(final InputStream inputStream) { - return new Yaml(new AgentYamlConstructor(YamlAdvisorsConfiguration.class)).loadAs(inputStream, YamlAdvisorsConfiguration.class); + return new Yaml(new AgentYamlConstructor(YamlAdvisorsConfiguration.class, createLoaderOptions())).loadAs(inputStream, YamlAdvisorsConfiguration.class); + } + + private static LoaderOptions createLoaderOptions() { + LoaderOptions result = new LoaderOptions(); + result.setMaxAliasesForCollections(1000); + result.setCodePointLimit(Integer.MAX_VALUE); + return result; } } diff --git a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/advisor/config/yaml/fixture/YamlAdviceFixture.java b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/advisor/config/yaml/fixture/YamlAdviceFixture.java index 292d2ed724d13..6f2fb97757d3a 100644 --- a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/advisor/config/yaml/fixture/YamlAdviceFixture.java +++ b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/advisor/config/yaml/fixture/YamlAdviceFixture.java @@ -22,35 +22,9 @@ import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; import org.apache.shardingsphere.agent.api.advice.type.StaticMethodAdvice; -import java.lang.reflect.Method; - public final class YamlAdviceFixture implements ConstructorAdvice, InstanceMethodAdvice, StaticMethodAdvice { @Override public void onConstructor(final TargetAdviceObject target, final Object[] args, final String pluginType) { } - - @Override - public void beforeMethod(final TargetAdviceObject target, final Method method, final Object[] args, final String pluginType) { - } - - @Override - public void beforeMethod(final Class clazz, final Method method, final Object[] args, final String pluginType) { - } - - @Override - public void afterMethod(final TargetAdviceObject target, final Method method, final Object[] args, final Object result, final String pluginType) { - } - - @Override - public void afterMethod(final Class clazz, final Method method, final Object[] args, final Object result, final String pluginType) { - } - - @Override - public void onThrowing(final TargetAdviceObject target, final Method method, final Object[] args, final Throwable throwable, final String pluginType) { - } - - @Override - public void onThrowing(final Class clazz, final Method method, final Object[] args, final Throwable throwable, final String pluginType) { - } } diff --git a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/PluginContextTest.java b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/PluginContextTest.java deleted file mode 100644 index cdfd7520fc2b4..0000000000000 --- a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/PluginContextTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.agent.core.plugin; - -import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey; -import org.apache.shardingsphere.mode.manager.ContextManager; -import org.apache.shardingsphere.proxy.backend.context.ProxyContext; -import org.apache.shardingsphere.test.mock.AutoMockExtension; -import org.apache.shardingsphere.test.mock.StaticMockSettings; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.RETURNS_DEEP_STUBS; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -@ExtendWith(AutoMockExtension.class) -@StaticMockSettings(ProxyContext.class) -class PluginContextTest { - - @AfterEach - void reset() { - PluginContext.getInstance().setContextManager(null); - } - - @Test - void assertPluginEnabledIsTrue() { - PluginContext.getInstance().setEnhancedForProxy(true); - ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS); - when(contextManager.getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.AGENT_PLUGINS_ENABLED)).thenReturn(true); - when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); - assertTrue(PluginContext.getInstance().isPluginEnabled()); - } - - @Test - void assertPluginEnabledIsFalse() { - PluginContext.getInstance().setEnhancedForProxy(true); - ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS); - when(contextManager.getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.AGENT_PLUGINS_ENABLED)).thenReturn(false); - when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); - assertFalse(PluginContext.getInstance().isPluginEnabled()); - } -} diff --git a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/PluginConfigurationLoaderTest.java b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/PluginConfigurationLoaderTest.java index 3e7ec100c51af..457139941deb8 100644 --- a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/PluginConfigurationLoaderTest.java +++ b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/PluginConfigurationLoaderTest.java @@ -51,7 +51,7 @@ private void assertLoggingPluginConfiguration(final PluginConfiguration actual) assertNull(actual.getPassword()); assertThat(actual.getPort(), is(8080)); assertThat(actual.getProps().size(), is(1)); - assertThat(actual.getProps().get("key"), is("value")); + assertThat(actual.getProps().getProperty("key"), is("value")); } private void assertMetricsPluginConfiguration(final PluginConfiguration actual) { @@ -59,7 +59,7 @@ private void assertMetricsPluginConfiguration(final PluginConfiguration actual) assertThat(actual.getPassword(), is("random")); assertThat(actual.getPort(), is(8081)); assertThat(actual.getProps().size(), is(1)); - assertThat(actual.getProps().get("key"), is("value")); + assertThat(actual.getProps().getProperty("key"), is("value")); } private void assertTracingPluginConfiguration(final PluginConfiguration actual) { @@ -67,6 +67,6 @@ private void assertTracingPluginConfiguration(final PluginConfiguration actual) assertThat(actual.getPassword(), is("random")); assertThat(actual.getPort(), is(8082)); assertThat(actual.getProps().size(), is(1)); - assertThat(actual.getProps().get("key"), is("value")); + assertThat(actual.getProps().getProperty("key"), is("value")); } } diff --git a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/yaml/swapper/YamlPluginsConfigurationSwapperTest.java b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/yaml/swapper/YamlPluginsConfigurationSwapperTest.java index 0117776320668..6a9bc2332bfd5 100644 --- a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/yaml/swapper/YamlPluginsConfigurationSwapperTest.java +++ b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/yaml/swapper/YamlPluginsConfigurationSwapperTest.java @@ -102,7 +102,7 @@ private void assertLogFixturePluginConfiguration(final PluginConfiguration actua assertNull(actual.getPassword()); assertThat(actual.getPort(), is(8080)); assertThat(actual.getProps().size(), is(1)); - assertThat(actual.getProps().get("key"), is("value")); + assertThat(actual.getProps().getProperty("key"), is("value")); } private void assertMetricsPluginConfiguration(final PluginConfiguration actual) { @@ -110,7 +110,7 @@ private void assertMetricsPluginConfiguration(final PluginConfiguration actual) assertThat(actual.getPassword(), is("random")); assertThat(actual.getPort(), is(8081)); assertThat(actual.getProps().size(), is(1)); - assertThat(actual.getProps().get("key"), is("value")); + assertThat(actual.getProps().getProperty("key"), is("value")); } private void assertTracingPluginConfiguration(final PluginConfiguration actual) { @@ -118,7 +118,7 @@ private void assertTracingPluginConfiguration(final PluginConfiguration actual) assertThat(actual.getPassword(), is("random")); assertThat(actual.getPort(), is(8082)); assertThat(actual.getProps().size(), is(1)); - assertThat(actual.getProps().get("key"), is("value")); + assertThat(actual.getProps().getProperty("key"), is("value")); } private Properties createProperties() { diff --git a/agent/core/src/test/java/org/apache/shardingsphere/fixture/log/LogbackConfigurationFixture.java b/agent/core/src/test/java/org/apache/shardingsphere/fixture/log/LogbackConfigurationFixture.java deleted file mode 100644 index 287d399713743..0000000000000 --- a/agent/core/src/test/java/org/apache/shardingsphere/fixture/log/LogbackConfigurationFixture.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.fixture.log; - -import ch.qos.logback.classic.BasicConfigurator; -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.Logger; -import ch.qos.logback.classic.LoggerContext; -import ch.qos.logback.classic.PatternLayout; -import ch.qos.logback.classic.spi.ILoggingEvent; -import ch.qos.logback.core.Appender; -import ch.qos.logback.core.FileAppender; -import ch.qos.logback.core.encoder.LayoutWrappingEncoder; - -import java.io.File; - -/** - * Logback configuration. - */ -public final class LogbackConfigurationFixture extends BasicConfigurator { - - public static final String DEFAULT_PATTERN = "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n"; - - public static final String SHARDINGSPHERE_LOGGER_NAME = "org.apache.shardingsphere.agent"; - - @Override - public void configure(final LoggerContext loggerContext) { - Appender appender = createFileAppender(loggerContext); - Logger rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME); - rootLogger.setLevel(Level.INFO); - rootLogger.addAppender(appender); - Logger logger = loggerContext.getLogger(SHARDINGSPHERE_LOGGER_NAME); - logger.setLevel(Level.INFO); - logger.setAdditive(false); - logger.addAppender(appender); - } - - private FileAppender createFileAppender(final LoggerContext loggerContext) { - FileAppender result = new FileAppender<>(); - result.setContext(loggerContext); - result.setName("fileAppender"); - result.setFile(getLogFile()); - LayoutWrappingEncoder encoder = createEncoder(loggerContext); - result.setEncoder(encoder); - result.start(); - return result; - } - - private String getLogFile() { - return String.join(File.separator, "target", "logs", "stdout.log"); - } - - private LayoutWrappingEncoder createEncoder(final LoggerContext loggerContext) { - LayoutWrappingEncoder result = new LayoutWrappingEncoder<>(); - result.setContext(loggerContext); - PatternLayout layout = createPatternLayout(loggerContext); - result.setLayout(layout); - return result; - } - - private PatternLayout createPatternLayout(final LoggerContext loggerContext) { - PatternLayout result = new PatternLayout(); - result.setPattern(DEFAULT_PATTERN); - result.setContext(loggerContext); - result.start(); - return result; - } -} diff --git a/agent/core/src/test/java/org/apache/shardingsphere/fixture/targeted/TargetObjectFixture.java b/agent/core/src/test/java/org/apache/shardingsphere/fixture/targeted/TargetObjectFixture.java index e707a5e2f1a03..a3e6d029fa4a9 100644 --- a/agent/core/src/test/java/org/apache/shardingsphere/fixture/targeted/TargetObjectFixture.java +++ b/agent/core/src/test/java/org/apache/shardingsphere/fixture/targeted/TargetObjectFixture.java @@ -41,7 +41,7 @@ public void call(final List queue) { * @throws UnsupportedOperationException unsupported operation exception */ public void callWhenExceptionThrown(final List queue) { - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(""); } /** @@ -60,6 +60,6 @@ public static void staticCall(final List queue) { * @throws UnsupportedOperationException unsupported operation exception */ public static void staticCallWhenExceptionThrown(final List queue) { - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(""); } } diff --git a/agent/core/src/test/java/org/apache/shardingsphere/preconditions/AgentPreconditionsTest.java b/agent/core/src/test/java/org/apache/shardingsphere/preconditions/AgentPreconditionsTest.java new file mode 100644 index 0000000000000..b1b665e6e5a5e --- /dev/null +++ b/agent/core/src/test/java/org/apache/shardingsphere/preconditions/AgentPreconditionsTest.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.preconditions; + +import org.apache.shardingsphere.agent.core.preconditions.AgentPreconditions; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertThrows; + +class AgentPreconditionsTest { + + @Test + void assertCheckStateSuccess() { + assertDoesNotThrow(() -> AgentPreconditions.checkState(true, "Can not locate agent jar file by URL /var/tmp.")); + } + + @Test + void assertCheckStateFailed() { + assertThrows(IllegalStateException.class, () -> AgentPreconditions.checkState(false, "Can not locate agent jar file by URL /var/tmp.")); + } + + @Test + void assertCheckArgumentSuccess() { + assertDoesNotThrow(() -> AgentPreconditions.checkArgument(true, "SPI class MySQL is not interface.")); + } + + @Test + void assertCheckArgumentFailed() { + assertThrows(IllegalArgumentException.class, () -> AgentPreconditions.checkArgument(false, "SPI class MySQL is not interface.")); + } +} diff --git a/agent/core/src/test/java/org/apache/shardingsphere/yaml/AgentYamlEngineTest.java b/agent/core/src/test/java/org/apache/shardingsphere/yaml/AgentYamlEngineTest.java new file mode 100644 index 0000000000000..42e911fc420b0 --- /dev/null +++ b/agent/core/src/test/java/org/apache/shardingsphere/yaml/AgentYamlEngineTest.java @@ -0,0 +1,140 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.yaml; + +import org.apache.shardingsphere.agent.api.PluginConfiguration; +import org.apache.shardingsphere.agent.core.advisor.config.yaml.entity.YamlAdvisorConfiguration; +import org.apache.shardingsphere.agent.core.advisor.config.yaml.entity.YamlAdvisorsConfiguration; +import org.apache.shardingsphere.agent.core.advisor.config.yaml.entity.YamlPointcutConfiguration; +import org.apache.shardingsphere.agent.core.advisor.config.yaml.entity.YamlPointcutParameterConfiguration; +import org.apache.shardingsphere.agent.core.advisor.config.yaml.fixture.YamlAdviceFixture; +import org.apache.shardingsphere.agent.core.advisor.config.yaml.fixture.YamlTargetObjectFixture; +import org.apache.shardingsphere.agent.core.plugin.config.yaml.entity.YamlAgentConfiguration; +import org.apache.shardingsphere.agent.core.plugin.config.yaml.swapper.YamlPluginsConfigurationSwapper; +import org.apache.shardingsphere.agent.core.yaml.AgentYamlEngine; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.Map; +import java.util.Objects; +import java.util.List; +import java.util.Collections; +import java.util.Arrays; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertNull; + +class AgentYamlEngineTest { + + @Test + void assertUnmarshalYamlAgentConfiguration() throws IOException { + try (InputStream inputStream = Files.newInputStream(new File(getResourceURL(), "/conf/agent.yaml").toPath())) { + YamlAgentConfiguration yamlAgentConfig = AgentYamlEngine.unmarshalYamlAgentConfiguration(inputStream); + Map actual = YamlPluginsConfigurationSwapper.swap(yamlAgentConfig); + assertThat(actual.size(), is(3)); + assertLogFixturePluginConfiguration(actual.get("log_fixture")); + assertMetricsPluginConfiguration(actual.get("metrics_fixture")); + assertTracingPluginConfiguration(actual.get("tracing_fixture")); + } + } + + @Test + void assertUnmarshalYamlAdvisorsConfiguration() { + InputStream inputStream = getClass().getResourceAsStream("/META-INF/conf/advisors.yaml"); + YamlAdvisorsConfiguration actual = AgentYamlEngine.unmarshalYamlAdvisorsConfiguration(inputStream); + assertYamlAdvisorConfiguration(actual.getAdvisors().iterator().next()); + } + + private String getResourceURL() throws UnsupportedEncodingException { + return URLDecoder.decode(Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource("")).getFile(), "UTF8"); + } + + private void assertLogFixturePluginConfiguration(final PluginConfiguration actual) { + assertNull(actual.getHost()); + assertNull(actual.getPassword()); + assertThat(actual.getPort(), is(8080)); + assertThat(actual.getProps().size(), is(1)); + assertThat(actual.getProps().getProperty("key"), is("value")); + } + + private void assertMetricsPluginConfiguration(final PluginConfiguration actual) { + assertThat(actual.getHost(), is("localhost")); + assertThat(actual.getPassword(), is("random")); + assertThat(actual.getPort(), is(8081)); + assertThat(actual.getProps().size(), is(1)); + assertThat(actual.getProps().getProperty("key"), is("value")); + } + + private void assertTracingPluginConfiguration(final PluginConfiguration actual) { + assertThat(actual.getHost(), is("localhost")); + assertThat(actual.getPassword(), is("random")); + assertThat(actual.getPort(), is(8082)); + assertThat(actual.getProps().size(), is(1)); + assertThat(actual.getProps().getProperty("key"), is("value")); + } + + private void assertYamlAdvisorConfiguration(final YamlAdvisorConfiguration actual) { + assertThat(actual.getTarget(), is(YamlTargetObjectFixture.class.getName())); + assertThat(actual.getAdvice(), is(YamlAdviceFixture.class.getName())); + assertThat(actual.getTarget(), is("org.apache.shardingsphere.agent.core.advisor.config.yaml.fixture.YamlTargetObjectFixture")); + assertThat(actual.getAdvice(), is("org.apache.shardingsphere.agent.core.advisor.config.yaml.fixture.YamlAdviceFixture")); + assertThat(actual.getPointcuts().size(), is(8)); + List actualYamlPointcutConfigs = new ArrayList<>(actual.getPointcuts()); + assertYamlPointcutConfiguration(actualYamlPointcutConfigs.get(0), null, "constructor", Collections.emptyList()); + assertYamlPointcutConfiguration(actualYamlPointcutConfigs.get(1), null, "constructor", Collections.singletonList(createYamlPointcutParameterConfiguration(0, "java.lang.String"))); + assertYamlPointcutConfiguration(actualYamlPointcutConfigs.get(2), "call", "method", Collections.emptyList()); + assertYamlPointcutConfiguration(actualYamlPointcutConfigs.get(3), "call", "method", Collections.singletonList(createYamlPointcutParameterConfiguration(0, "java.lang.String"))); + assertYamlPointcutConfiguration(actualYamlPointcutConfigs.get(4), "call", "method", + Arrays.asList(createYamlPointcutParameterConfiguration(0, "java.lang.String"), createYamlPointcutParameterConfiguration(1, "java.lang.String"))); + assertYamlPointcutConfiguration(actualYamlPointcutConfigs.get(5), "staticCall", "method", Collections.emptyList()); + assertYamlPointcutConfiguration(actualYamlPointcutConfigs.get(6), "staticCall", "method", Collections.singletonList(createYamlPointcutParameterConfiguration(0, "java.lang.String"))); + assertYamlPointcutConfiguration(actualYamlPointcutConfigs.get(7), "staticCall", "method", + Arrays.asList(createYamlPointcutParameterConfiguration(0, "java.lang.String"), createYamlPointcutParameterConfiguration(1, "java.lang.String"))); + } + + private void assertYamlPointcutConfiguration(final YamlPointcutConfiguration actual, + final String expectedName, final String expectedType, final List expectedParams) { + assertThat(actual.getName(), is(expectedName)); + assertThat(actual.getType(), is(expectedType)); + assertThat(actual.getParams().size(), is(expectedParams.size())); + int count = 0; + for (YamlPointcutParameterConfiguration each : actual.getParams()) { + assertYamlPointcutParameterConfiguration(each, expectedParams.get(count)); + count++; + } + } + + private void assertYamlPointcutParameterConfiguration(final YamlPointcutParameterConfiguration actual, final YamlPointcutParameterConfiguration expected) { + assertThat(actual.getIndex(), is(expected.getIndex())); + assertThat(actual.getType(), is(expected.getType())); + } + + private YamlPointcutParameterConfiguration createYamlPointcutParameterConfiguration(final int index, final String type) { + YamlPointcutParameterConfiguration result = new YamlPointcutParameterConfiguration(); + result.setIndex(index); + result.setType(type); + return result; + } +} diff --git a/agent/core/src/test/resources/META-INF/services/ch.qos.logback.classic.spi.Configurator b/agent/core/src/test/resources/META-INF/services/ch.qos.logback.classic.spi.Configurator deleted file mode 100644 index 3df18f09d07b3..0000000000000 --- a/agent/core/src/test/resources/META-INF/services/ch.qos.logback.classic.spi.Configurator +++ /dev/null @@ -1,18 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -org.apache.shardingsphere.fixture.log.LogbackConfigurationFixture diff --git a/agent/plugins/core/pom.xml b/agent/plugins/core/pom.xml index c638df4dd593f..e52387bad70fb 100644 --- a/agent/plugins/core/pom.xml +++ b/agent/plugins/core/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-agent-plugins - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-plugin-core ${project.artifactId} @@ -33,7 +33,7 @@ org.apache.shardingsphere - shardingsphere-jdbc-core + shardingsphere-jdbc ${project.version} provided diff --git a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/advice/AbstractInstanceMethodAdvice.java b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/advice/AbstractInstanceMethodAdvice.java new file mode 100644 index 0000000000000..11da9c7bad646 --- /dev/null +++ b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/advice/AbstractInstanceMethodAdvice.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.agent.plugin.core.advice; + +import org.apache.shardingsphere.agent.api.plugin.AgentPluginEnable; +import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.context.PluginContext; + +/** + * Abstract instance method advice. + */ +public abstract class AbstractInstanceMethodAdvice implements InstanceMethodAdvice, AgentPluginEnable { + + @Override + public boolean isPluginEnabled() { + return PluginContext.getInstance().isPluginEnabled(); + } +} diff --git a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/advice/AbstractStaticMethodAdvice.java b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/advice/AbstractStaticMethodAdvice.java new file mode 100644 index 0000000000000..80350378f9c17 --- /dev/null +++ b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/advice/AbstractStaticMethodAdvice.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.agent.plugin.core.advice; + +import org.apache.shardingsphere.agent.api.plugin.AgentPluginEnable; +import org.apache.shardingsphere.agent.api.advice.type.StaticMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.context.PluginContext; + +/** + * Abstract static method advice. + */ +public abstract class AbstractStaticMethodAdvice implements StaticMethodAdvice, AgentPluginEnable { + + @Override + public boolean isPluginEnabled() { + return PluginContext.getInstance().isPluginEnabled(); + } +} diff --git a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/config/validator/PluginConfigurationValidator.java b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/config/validator/PluginConfigurationValidator.java index 331bbda370f79..d360fdc2d6381 100644 --- a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/config/validator/PluginConfigurationValidator.java +++ b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/config/validator/PluginConfigurationValidator.java @@ -20,7 +20,7 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.shardingsphere.agent.api.PluginConfiguration; -import org.apache.shardingsphere.agent.plugin.core.util.PluginPreconditions; +import org.apache.shardingsphere.agent.plugin.core.preconditions.PluginPreconditions; /** * Remote plugin configuration validator. diff --git a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/context/PluginContext.java b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/context/PluginContext.java new file mode 100644 index 0000000000000..672df186be8f8 --- /dev/null +++ b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/context/PluginContext.java @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.agent.plugin.core.context; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.apache.shardingsphere.agent.plugin.core.util.AgentReflectionUtils; +import org.apache.shardingsphere.agent.plugin.core.util.ShardingSphereDriverUtils; +import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource; +import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey; +import org.apache.shardingsphere.mode.manager.ContextManager; +import org.apache.shardingsphere.proxy.backend.context.ProxyContext; + +import java.util.Map; +import java.util.Optional; + +/** + * Plugin Context. + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +@Setter +public final class PluginContext { + + private static final PluginContext INSTANCE = new PluginContext(); + + private ContextManager contextManager; + + private boolean isEnhancedForProxy; + + /** + * Get instance of plugin context. + * + * @return instance + */ + public static PluginContext getInstance() { + return INSTANCE; + } + + /** + * Check if the plugin is enabled. + * + * @return true or false + */ + public boolean isPluginEnabled() { + if (null == contextManager) { + contextManager = getContextManager().orElse(null); + } + return null == contextManager || contextManager.getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.AGENT_PLUGINS_ENABLED); + } + + /** + * Get context manager. + * + * @return context manager + */ + public Optional getContextManager() { + if (isEnhancedForProxy) { + return Optional.ofNullable(ProxyContext.getInstance().getContextManager()); + } + Optional> dataSourceMap = ShardingSphereDriverUtils.findShardingSphereDataSources(); + if (dataSourceMap.isPresent() && !dataSourceMap.get().isEmpty()) { + return Optional.ofNullable(AgentReflectionUtils.getFieldValue(dataSourceMap.get().values().iterator().next(), "contextManager")); + } + return Optional.empty(); + } +} diff --git a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/preconditions/PluginPreconditions.java b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/preconditions/PluginPreconditions.java new file mode 100644 index 0000000000000..c1e59ae24db46 --- /dev/null +++ b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/preconditions/PluginPreconditions.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.agent.plugin.core.preconditions; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + +/** + * Plugin preconditions. + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class PluginPreconditions { + + /** + * Check argument. + * + * @param condition condition + * @param errorMessage error message + * @throws IllegalArgumentException illegal argument exception + */ + public static void checkArgument(final boolean condition, final String errorMessage) { + if (!condition) { + throw new IllegalArgumentException(errorMessage); + } + } +} diff --git a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/spi/PluginServiceLoader.java b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/spi/PluginServiceLoader.java index 867d65101976a..8b10280006858 100644 --- a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/spi/PluginServiceLoader.java +++ b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/spi/PluginServiceLoader.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.agent.plugin.core.spi; -import org.apache.shardingsphere.agent.plugin.core.util.PluginPreconditions; +import org.apache.shardingsphere.agent.plugin.core.preconditions.PluginPreconditions; import java.util.Collection; import java.util.LinkedList; @@ -37,13 +37,8 @@ public final class PluginServiceLoader { private final Collection services; private PluginServiceLoader(final Class service) { - validate(service); - this.services = load(service); - } - - private void validate(final Class service) { - PluginPreconditions.checkNotNull(service, "SPI class is null."); PluginPreconditions.checkArgument(service.isInterface(), String.format("SPI class `%s` is not interface.", service)); + services = load(service); } private Collection load(final Class service) { diff --git a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtils.java b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtils.java index 27e78a72bd35d..a00bcc116dfd5 100644 --- a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtils.java +++ b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtils.java @@ -22,7 +22,6 @@ import lombok.SneakyThrows; import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.util.Optional; /** @@ -73,27 +72,4 @@ private static Optional findField(final String fieldName, final Class } return Optional.empty(); } - - /** - * Invoke method. - * - * @param method method - * @param target target - * @param args arguments - * @param type of invoke result - * @return invoke result - */ - @SuppressWarnings("unchecked") - @SneakyThrows(ReflectiveOperationException.class) - public static T invokeMethod(final Method method, final Object target, final Object... args) { - boolean accessible = method.isAccessible(); - if (!accessible) { - method.setAccessible(true); - } - T result = (T) method.invoke(target, args); - if (!accessible) { - method.setAccessible(false); - } - return result; - } } diff --git a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/PluginPreconditions.java b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/PluginPreconditions.java deleted file mode 100644 index 3b0a83cb45ab5..0000000000000 --- a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/PluginPreconditions.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.agent.plugin.core.util; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -/** - * Plugin preconditions. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class PluginPreconditions { - - /** - * Check state. - * - * @param state state - * @param errorMessage error message - * @throws IllegalStateException illegal state exception - */ - public static void checkState(final boolean state, final String errorMessage) { - if (!state) { - throw new IllegalStateException(errorMessage); - } - } - - /** - * Check not null. - * - * @param reference reference - * @param errorMessage error message - * @throws NullPointerException null pointer exception - */ - public static void checkNotNull(final Object reference, final String errorMessage) { - if (null == reference) { - throw new NullPointerException(errorMessage); - } - } - - /** - * Check argument. - * - * @param condition condition - * @param errorMessage error message - * @throws IllegalArgumentException illegal argument exception - */ - public static void checkArgument(final boolean condition, final String errorMessage) { - if (!condition) { - throw new IllegalArgumentException(errorMessage); - } - } -} diff --git a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/SQLStatementUtils.java b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/SQLStatementUtils.java index 5f943f67bbf5d..95eb857f0de09 100644 --- a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/SQLStatementUtils.java +++ b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/SQLStatementUtils.java @@ -20,11 +20,11 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.shardingsphere.agent.plugin.core.enums.SQLStatementType; -import org.apache.shardingsphere.distsql.parser.statement.DistSQLStatement; -import org.apache.shardingsphere.distsql.parser.statement.ral.RALStatement; -import org.apache.shardingsphere.distsql.parser.statement.rdl.RDLStatement; -import org.apache.shardingsphere.distsql.parser.statement.rql.RQLStatement; -import org.apache.shardingsphere.distsql.parser.statement.rul.RULStatement; +import org.apache.shardingsphere.distsql.statement.DistSQLStatement; +import org.apache.shardingsphere.distsql.statement.ral.RALStatement; +import org.apache.shardingsphere.distsql.statement.rdl.RDLStatement; +import org.apache.shardingsphere.distsql.statement.rql.RQLStatement; +import org.apache.shardingsphere.distsql.statement.rul.RULStatement; import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement; import org.apache.shardingsphere.sql.parser.sql.common.statement.dal.DALStatement; import org.apache.shardingsphere.sql.parser.sql.common.statement.dcl.DCLStatement; diff --git a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/ShardingSphereDriverUtils.java b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/ShardingSphereDriverUtils.java index 2be08e87a0117..9e7bc95b01b03 100644 --- a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/ShardingSphereDriverUtils.java +++ b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/ShardingSphereDriverUtils.java @@ -20,10 +20,16 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.shardingsphere.driver.ShardingSphereDriver; +import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource; +import org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache; +import javax.sql.DataSource; import java.sql.Driver; import java.sql.DriverManager; import java.util.Enumeration; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; import java.util.Optional; /** @@ -33,11 +39,27 @@ public final class ShardingSphereDriverUtils { /** - * Get sharding sphere driver. + * Find ShardingSphere data sources. * - * @return ShardingSphereDriver + * @return found data source */ - public static Optional getShardingSphereDriver() { + public static Optional> findShardingSphereDataSources() { + return findShardingSphereDriver().flatMap(ShardingSphereDriverUtils::findShardingSphereDataSources); + } + + private static Optional> findShardingSphereDataSources(final Driver driver) { + DriverDataSourceCache dataSourceCache = AgentReflectionUtils.getFieldValue(driver, "dataSourceCache"); + Map dataSourceMap = AgentReflectionUtils.getFieldValue(dataSourceCache, "dataSourceMap"); + Map result = new LinkedHashMap<>(); + for (Entry entry : dataSourceMap.entrySet()) { + if (entry.getValue() instanceof ShardingSphereDataSource) { + result.put(entry.getKey(), (ShardingSphereDataSource) entry.getValue()); + } + } + return Optional.of(result); + } + + private static Optional findShardingSphereDriver() { Enumeration driverEnumeration = DriverManager.getDrivers(); while (driverEnumeration.hasMoreElements()) { Driver driver = driverEnumeration.nextElement(); diff --git a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/preconditions/PluginPreconditionsTest.java b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/preconditions/PluginPreconditionsTest.java new file mode 100644 index 0000000000000..11d0534b57a27 --- /dev/null +++ b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/preconditions/PluginPreconditionsTest.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.agent.plugin.core.preconditions; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertThrows; + +class PluginPreconditionsTest { + + @Test + void assertCheckArgumentSuccess() { + assertDoesNotThrow(() -> PluginPreconditions.checkArgument(true, "Port `-3306` of MySQL Service must be a positive number.")); + } + + @Test + void assertCheckArgumentFailed() { + assertThrows(IllegalArgumentException.class, () -> PluginPreconditions.checkArgument(false, "Port `-3306` of MySQL Service must be a positive number.")); + } +} diff --git a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilsTest.java b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilsTest.java index e6bf3a63525b9..937b09740d9be 100644 --- a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilsTest.java +++ b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilsTest.java @@ -30,9 +30,4 @@ void assertGetFieldValue() { ReflectionFixture reflectionFixture = new ReflectionFixture("foo"); assertThat(AgentReflectionUtils.getFieldValue(reflectionFixture, "value"), is(reflectionFixture.getValue())); } - - @Test - void assertInvokeMethod() throws NoSuchMethodException { - assertThat(AgentReflectionUtils.invokeMethod(ReflectionFixture.class.getDeclaredMethod("call"), new ReflectionFixture("foo")), is("foo")); - } } diff --git a/agent/plugins/logging/pom.xml b/agent/plugins/logging/pom.xml index 2f5ae0c92d13c..0da7f37b7bc02 100644 --- a/agent/plugins/logging/pom.xml +++ b/agent/plugins/logging/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-agent-plugins - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-plugin-logging pom diff --git a/agent/plugins/logging/type/file/pom.xml b/agent/plugins/logging/type/file/pom.xml index 5bc16f0744b1b..7bddc55a526ff 100644 --- a/agent/plugins/logging/type/file/pom.xml +++ b/agent/plugins/logging/type/file/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-agent-logging-type - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-logging-file ${project.artifactId} diff --git a/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginLifecycleService.java b/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginLifecycleService.java index 2b1f2518187e4..297761479c7e8 100644 --- a/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginLifecycleService.java +++ b/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginLifecycleService.java @@ -18,6 +18,7 @@ package org.apache.shardingsphere.agent.plugin.logging.file; import org.apache.shardingsphere.agent.api.PluginConfiguration; +import org.apache.shardingsphere.agent.plugin.core.context.PluginContext; import org.apache.shardingsphere.agent.spi.PluginLifecycleService; /** @@ -27,6 +28,7 @@ public final class FileLoggingPluginLifecycleService implements PluginLifecycleS @Override public void start(final PluginConfiguration pluginConfig, final boolean isEnhancedForProxy) { + PluginContext.getInstance().setEnhancedForProxy(isEnhancedForProxy); } @Override diff --git a/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/advice/MetaDataContextsFactoryAdvice.java b/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/advice/MetaDataContextsFactoryAdvice.java index 9751a95c9f984..159624b5f789d 100644 --- a/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/advice/MetaDataContextsFactoryAdvice.java +++ b/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/advice/MetaDataContextsFactoryAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.logging.file.advice; import lombok.extern.slf4j.Slf4j; -import org.apache.shardingsphere.agent.api.advice.type.StaticMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractStaticMethodAdvice; import org.apache.shardingsphere.agent.plugin.core.recorder.MethodTimeRecorder; import java.lang.reflect.Method; @@ -27,7 +27,7 @@ * Meta data contexts factory advice. */ @Slf4j -public final class MetaDataContextsFactoryAdvice implements StaticMethodAdvice { +public final class MetaDataContextsFactoryAdvice extends AbstractStaticMethodAdvice { private final MethodTimeRecorder methodTimeRecorder = new MethodTimeRecorder(MetaDataContextsFactoryAdvice.class); diff --git a/agent/plugins/logging/type/pom.xml b/agent/plugins/logging/type/pom.xml index 71adaef2236f7..7fb00e9a63259 100644 --- a/agent/plugins/logging/type/pom.xml +++ b/agent/plugins/logging/type/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-agent-plugin-logging - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-logging-type pom diff --git a/agent/plugins/metrics/core/pom.xml b/agent/plugins/metrics/core/pom.xml index 05dd1208a987d..07c0d528b8048 100644 --- a/agent/plugins/metrics/core/pom.xml +++ b/agent/plugins/metrics/core/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-agent-plugin-metrics - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-metrics-core ${project.artifactId} diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdvice.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdvice.java index 343e71c209331..bb995a0d91380 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdvice.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.CounterMetricsCollector; import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType; @@ -32,7 +32,7 @@ /** * Route result count advice. */ -public final class RouteResultCountAdvice implements InstanceMethodAdvice { +public final class RouteResultCountAdvice extends AbstractInstanceMethodAdvice { private final MetricConfiguration routedResultConfig = new MetricConfiguration("routed_result_total", MetricCollectorType.COUNTER, "Total count of routed result", Arrays.asList("object", "name")); diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdvice.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdvice.java index 554c9463ecd88..464a0e8a10ef7 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdvice.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.core.util.SQLStatementUtils; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.CounterMetricsCollector; @@ -33,7 +33,7 @@ /** * SQL parse count advice. */ -public final class SQLParseCountAdvice implements InstanceMethodAdvice { +public final class SQLParseCountAdvice extends AbstractInstanceMethodAdvice { private final MetricConfiguration config = new MetricConfiguration("parsed_sql_total", MetricCollectorType.COUNTER, "Total count of parsed SQL", Collections.singletonList("type"), Collections.emptyMap()); diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdvice.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdvice.java index 885d015aa8ce2..3805a484c88c2 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdvice.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.core.util.SQLStatementUtils; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.CounterMetricsCollector; @@ -34,7 +34,7 @@ /** * SQL route count advice. */ -public final class SQLRouteCountAdvice implements InstanceMethodAdvice { +public final class SQLRouteCountAdvice extends AbstractInstanceMethodAdvice { private final MetricConfiguration config = new MetricConfiguration("routed_sql_total", MetricCollectorType.COUNTER, "Total count of routed SQL", Collections.singletonList("type"), Collections.emptyMap()); diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteCountAdvice.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteCountAdvice.java index be5f6adbbea65..3cc70c46bfd14 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteCountAdvice.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteCountAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice.jdbc; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.CounterMetricsCollector; import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType; @@ -30,7 +30,7 @@ /** * Abstract execute count advice for ShardingSphere-JDBC. */ -public abstract class AbstractExecuteCountAdvice implements InstanceMethodAdvice { +public abstract class AbstractExecuteCountAdvice extends AbstractInstanceMethodAdvice { private final MetricConfiguration config = new MetricConfiguration("jdbc_statement_execute_total", MetricCollectorType.COUNTER, "Total number of statement execute", Collections.singletonList("statement_type")); diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteErrorsCountAdvice.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteErrorsCountAdvice.java index 7cefa68af7729..3ec1523148dfa 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteErrorsCountAdvice.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteErrorsCountAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice.jdbc; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.CounterMetricsCollector; import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType; @@ -30,7 +30,7 @@ /** * Abstract execute errors count advice for ShardingSphere-JDBC. */ -public abstract class AbstractExecuteErrorsCountAdvice implements InstanceMethodAdvice { +public abstract class AbstractExecuteErrorsCountAdvice extends AbstractInstanceMethodAdvice { private final MetricConfiguration config = new MetricConfiguration("jdbc_statement_execute_errors_total", MetricCollectorType.COUNTER, "Total number of statement execute error", Collections.singletonList("statement_type")); diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteLatencyHistogramAdvice.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteLatencyHistogramAdvice.java index 8f965cdb3ce2b..06ca179d1d330 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteLatencyHistogramAdvice.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteLatencyHistogramAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice.jdbc; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.core.recorder.MethodTimeRecorder; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.HistogramMetricsCollector; @@ -33,7 +33,7 @@ /** * Abstract execute latency histogram advice for ShardingSphere-JDBC. */ -public abstract class AbstractExecuteLatencyHistogramAdvice implements InstanceMethodAdvice { +public abstract class AbstractExecuteLatencyHistogramAdvice extends AbstractInstanceMethodAdvice { private final MetricConfiguration config = new MetricConfiguration("jdbc_statement_execute_latency_millis", MetricCollectorType.HISTOGRAM, "Statement execute latency millis histogram", Collections.singletonMap("buckets", getBuckets())); diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractTransactionsCountAdvice.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractTransactionsCountAdvice.java index 55a7cf5c368f9..f74abc52a9af4 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractTransactionsCountAdvice.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractTransactionsCountAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice.jdbc; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.CounterMetricsCollector; import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType; @@ -30,7 +30,7 @@ /** * Abstract transactions count advice for ShardingSphere-JDBC. */ -public abstract class AbstractTransactionsCountAdvice implements InstanceMethodAdvice { +public abstract class AbstractTransactionsCountAdvice extends AbstractInstanceMethodAdvice { private final MetricConfiguration config = new MetricConfiguration("jdbc_transactions_total", MetricCollectorType.COUNTER, "Total transactions of ShardingSphere-JDBC", Collections.singletonList("type")); diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdvice.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdvice.java index bbde9a205423c..a7c20d09c4736 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdvice.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.CounterMetricsCollector; import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType; @@ -30,7 +30,7 @@ /** * Commit transactions count advice for ShardingSphere-Proxy. */ -public final class CommitTransactionsCountAdvice implements InstanceMethodAdvice { +public final class CommitTransactionsCountAdvice extends AbstractInstanceMethodAdvice { private final MetricConfiguration config = new MetricConfiguration("proxy_transactions_total", MetricCollectorType.COUNTER, "Total transactions of ShardingSphere-Proxy", Collections.singletonList("type"), Collections.emptyMap()); diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdvice.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdvice.java index 23ad3da638b2a..3aad6ce0b023e 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdvice.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.GaugeMetricsCollector; import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType; @@ -30,7 +30,7 @@ /** * Current connections count advice for ShardingSphere-Proxy. */ -public final class CurrentConnectionsCountAdvice implements InstanceMethodAdvice { +public final class CurrentConnectionsCountAdvice extends AbstractInstanceMethodAdvice { private final MetricConfiguration config = new MetricConfiguration("proxy_current_connections", MetricCollectorType.GAUGE, "Current connections of ShardingSphere-Proxy", Collections.emptyList(), Collections.emptyMap()); diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdvice.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdvice.java index 425103378f3df..64a21d6591918 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdvice.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.CounterMetricsCollector; import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType; @@ -30,10 +30,10 @@ /** * Execute errors count advice for ShardingSphere-Proxy. */ -public final class ExecuteErrorsCountAdvice implements InstanceMethodAdvice { +public final class ExecuteErrorsCountAdvice extends AbstractInstanceMethodAdvice { - private final MetricConfiguration config = new MetricConfiguration("proxy_execute_errors_total", - MetricCollectorType.COUNTER, "Total execute errors of ShardingSphere-Proxy", Collections.emptyList(), Collections.emptyMap()); + private final MetricConfiguration config = new MetricConfiguration( + "proxy_execute_errors_total", MetricCollectorType.COUNTER, "Total execute errors of ShardingSphere-Proxy", Collections.emptyList(), Collections.emptyMap()); @Override public void afterMethod(final TargetAdviceObject target, final Method method, final Object[] args, final Object result, final String pluginType) { diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdvice.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdvice.java index 757f604cc95bf..55697a602539c 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdvice.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.core.recorder.MethodTimeRecorder; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.HistogramMetricsCollector; @@ -34,7 +34,7 @@ /** * Execute latency histogram advance for ShardingSphere-Proxy. */ -public final class ExecuteLatencyHistogramAdvice implements InstanceMethodAdvice { +public final class ExecuteLatencyHistogramAdvice extends AbstractInstanceMethodAdvice { private final MetricConfiguration config = new MetricConfiguration("proxy_execute_latency_millis", MetricCollectorType.HISTOGRAM, "Execute latency millis histogram of ShardingSphere-Proxy", Collections.emptyList(), Collections.singletonMap("buckets", getBuckets())); diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdvice.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdvice.java index 267bc99945bab..f0fbacb520824 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdvice.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.CounterMetricsCollector; import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType; @@ -30,7 +30,7 @@ /** * Requests count advice for ShardingSphere-Proxy. */ -public final class RequestsCountAdvice implements InstanceMethodAdvice { +public final class RequestsCountAdvice extends AbstractInstanceMethodAdvice { private final MetricConfiguration config = new MetricConfiguration("proxy_requests_total", MetricCollectorType.COUNTER, "Total requests of ShardingSphere-Proxy", Collections.emptyList(), Collections.emptyMap()); diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdvice.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdvice.java index d40a8fa2ba4f3..d37d2c8c955a8 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdvice.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.CounterMetricsCollector; import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType; @@ -30,7 +30,7 @@ /** * Rollback transactions count advice for ShardingSphere-Proxy. */ -public final class RollbackTransactionsCountAdvice implements InstanceMethodAdvice { +public final class RollbackTransactionsCountAdvice extends AbstractInstanceMethodAdvice { private final MetricConfiguration config = new MetricConfiguration("proxy_transactions_total", MetricCollectorType.COUNTER, "Total transactions of ShardingSphere-Proxy", Collections.singletonList("type"), Collections.emptyMap()); diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCMetaDataInfoExporter.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCMetaDataInfoExporter.java index ed249b6955f7e..4d615de677421 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCMetaDataInfoExporter.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCMetaDataInfoExporter.java @@ -24,12 +24,9 @@ import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType; import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration; import org.apache.shardingsphere.agent.plugin.metrics.core.exporter.MetricsExporter; -import org.apache.shardingsphere.driver.ShardingSphereDriver; import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource; -import org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache; import org.apache.shardingsphere.mode.manager.ContextManager; -import javax.sql.DataSource; import java.util.Arrays; import java.util.Collections; import java.util.Map; @@ -47,16 +44,14 @@ public final class JDBCMetaDataInfoExporter implements MetricsExporter { @Override public Optional export(final String pluginType) { - Optional driver = ShardingSphereDriverUtils.getShardingSphereDriver(); - if (!driver.isPresent()) { + Optional> dataSourceMap = ShardingSphereDriverUtils.findShardingSphereDataSources(); + if (!dataSourceMap.isPresent()) { return Optional.empty(); } GaugeMetricFamilyMetricsCollector result = MetricsCollectorRegistry.get(config, pluginType); result.cleanMetrics(); - DriverDataSourceCache dataSourceCache = AgentReflectionUtils.getFieldValue(driver.get(), "dataSourceCache"); - Map dataSourceMap = AgentReflectionUtils.getFieldValue(dataSourceCache, "dataSourceMap"); - for (Entry entry : dataSourceMap.entrySet()) { - ShardingSphereDataSource dataSource = (ShardingSphereDataSource) entry.getValue(); + for (Entry entry : dataSourceMap.get().entrySet()) { + ShardingSphereDataSource dataSource = entry.getValue(); String databaseName = AgentReflectionUtils.getFieldValue(dataSource, "databaseName"); ContextManager contextManager = AgentReflectionUtils.getFieldValue(dataSource, "contextManager"); result.addMetric(Arrays.asList(databaseName, "storage_unit_count"), contextManager.getStorageUnits(databaseName).size()); diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCStateExporter.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCStateExporter.java index 16c5866d7c4ba..1ea3598257a0a 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCStateExporter.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCStateExporter.java @@ -24,12 +24,9 @@ import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType; import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration; import org.apache.shardingsphere.agent.plugin.metrics.core.exporter.MetricsExporter; -import org.apache.shardingsphere.driver.ShardingSphereDriver; import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource; -import org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache; import org.apache.shardingsphere.mode.manager.ContextManager; -import javax.sql.DataSource; import java.util.Collections; import java.util.Map; import java.util.Map.Entry; @@ -44,18 +41,16 @@ public final class JDBCStateExporter implements MetricsExporter { @Override public Optional export(final String pluginType) { - Optional driver = ShardingSphereDriverUtils.getShardingSphereDriver(); - if (!driver.isPresent()) { + Optional> dataSourceMap = ShardingSphereDriverUtils.findShardingSphereDataSources(); + if (!dataSourceMap.isPresent()) { return Optional.empty(); } GaugeMetricFamilyMetricsCollector result = MetricsCollectorRegistry.get(config, pluginType); result.cleanMetrics(); - DriverDataSourceCache dataSourceCache = AgentReflectionUtils.getFieldValue(driver.get(), "dataSourceCache"); - Map dataSourceMap = AgentReflectionUtils.getFieldValue(dataSourceCache, "dataSourceMap"); - for (Entry entry : dataSourceMap.entrySet()) { - ShardingSphereDataSource dataSource = (ShardingSphereDataSource) entry.getValue(); + for (Entry entry : dataSourceMap.get().entrySet()) { + ShardingSphereDataSource dataSource = entry.getValue(); ContextManager contextManager = AgentReflectionUtils.getFieldValue(dataSource, "contextManager"); - result.addMetric(Collections.emptyList(), contextManager.getInstanceContext().getInstance().getState().getCurrentState().ordinal()); + result.addMetric(Collections.emptyList(), contextManager.getComputeNodeInstanceContext().getInstance().getState().getCurrentState().ordinal()); } return Optional.of(result); } diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporter.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporter.java index f74bb146b9035..376827ab6cd21 100644 --- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporter.java +++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporter.java @@ -17,7 +17,6 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.exporter.impl.proxy; -import lombok.extern.slf4j.Slf4j; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry; import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.GaugeMetricFamilyMetricsCollector; import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType; @@ -32,7 +31,6 @@ /** * Proxy meta data information exporter. */ -@Slf4j public final class ProxyMetaDataInfoExporter implements MetricsExporter { private final MetricConfiguration config = new MetricConfiguration("proxy_meta_data_info", diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java index c5aace1f5b45a..ffc6d334589ef 100644 --- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java +++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java @@ -22,10 +22,10 @@ import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration; import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture; import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture; -import org.apache.shardingsphere.distsql.parser.statement.rdl.create.RegisterStorageUnitStatement; -import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowStorageUnitsStatement; -import org.apache.shardingsphere.distsql.parser.statement.rul.sql.FormatStatement; -import org.apache.shardingsphere.migration.distsql.statement.ShowMigrationListStatement; +import org.apache.shardingsphere.distsql.statement.rdl.resource.unit.type.RegisterStorageUnitStatement; +import org.apache.shardingsphere.distsql.statement.rql.resource.ShowStorageUnitsStatement; +import org.apache.shardingsphere.distsql.statement.rul.sql.FormatStatement; +import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.queryable.ShowMigrationListStatement; import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.DatabaseSegment; import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement; import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowDatabasesStatement; diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java index 78c73ad69acf1..dbd9066176530 100644 --- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java +++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java @@ -23,6 +23,7 @@ import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture; import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture; import org.apache.shardingsphere.infra.binder.context.statement.UnknownSQLStatementContext; +import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.session.connection.ConnectionContext; import org.apache.shardingsphere.infra.session.query.QueryContext; import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLDeleteStatement; @@ -52,25 +53,25 @@ void reset() { @Test void assertInsertRoute() { - QueryContext queryContext = new QueryContext(new UnknownSQLStatementContext(new MySQLInsertStatement()), "", Collections.emptyList()); + QueryContext queryContext = new QueryContext(new UnknownSQLStatementContext(new MySQLInsertStatement()), "", Collections.emptyList(), new HintValueContext()); assertRoute(queryContext, "INSERT=1"); } @Test void assertUpdateRoute() { - QueryContext queryContext = new QueryContext(new UnknownSQLStatementContext(new MySQLUpdateStatement()), "", Collections.emptyList()); + QueryContext queryContext = new QueryContext(new UnknownSQLStatementContext(new MySQLUpdateStatement()), "", Collections.emptyList(), new HintValueContext()); assertRoute(queryContext, "UPDATE=1"); } @Test void assertDeleteRoute() { - QueryContext queryContext = new QueryContext(new UnknownSQLStatementContext(new MySQLDeleteStatement()), "", Collections.emptyList()); + QueryContext queryContext = new QueryContext(new UnknownSQLStatementContext(new MySQLDeleteStatement()), "", Collections.emptyList(), new HintValueContext()); assertRoute(queryContext, "DELETE=1"); } @Test void assertSelectRoute() { - QueryContext queryContext = new QueryContext(new UnknownSQLStatementContext(new MySQLSelectStatement()), "", Collections.emptyList()); + QueryContext queryContext = new QueryContext(new UnknownSQLStatementContext(new MySQLSelectStatement()), "", Collections.emptyList(), new HintValueContext()); assertRoute(queryContext, "SELECT=1"); } diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java index 33d4d9c05a85f..df3c8fa24b543 100644 --- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java +++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java @@ -34,7 +34,7 @@ class ExecuteErrorsCountAdviceTest { - private final MetricConfiguration config = new MetricConfiguration("proxy_execute_errors_total", MetricCollectorType.COUNTER, null, Collections.emptyList(), Collections.emptyMap()); + private final MetricConfiguration config = new MetricConfiguration("proxy_execute_errors_total", MetricCollectorType.COUNTER, null, Collections.emptyList()); @AfterEach void reset() { diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporterTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporterTest.java index 36d0aab30527a..64ce8e8f02ac9 100644 --- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporterTest.java +++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporterTest.java @@ -25,11 +25,13 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; +import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.mode.metadata.MetaDataContexts; +import org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory; import org.apache.shardingsphere.proxy.backend.context.ProxyContext; import org.apache.shardingsphere.test.mock.AutoMockExtension; import org.apache.shardingsphere.test.mock.StaticMockSettings; @@ -75,11 +77,12 @@ void assertExportWithContextManager() { private ContextManager mockContextManager() { ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); + when(database.getResourceMetaData()).thenReturn(mock(ResourceMetaData.class)); when(database.getResourceMetaData().getStorageUnits()).thenReturn(Collections.singletonMap("ds_0", mock(StorageUnit.class))); when(database.getProtocolType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "FIXTURE")); ShardingSphereMetaData metaData = mock(ShardingSphereMetaData.class); when(metaData.getDatabases()).thenReturn(Collections.singletonMap("sharding_db", database)); - MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), metaData); + MetaDataContexts metaDataContexts = MetaDataContextsFactory.create(mock(MetaDataPersistService.class), metaData); ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); when(result.getMetaDataContexts()).thenReturn(metaDataContexts); return result; diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyStateExporterTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyStateExporterTest.java index 42a9b4f2aee07..0824357c6a933 100644 --- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyStateExporterTest.java +++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyStateExporterTest.java @@ -22,19 +22,12 @@ import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType; import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration; import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture; -import org.apache.shardingsphere.infra.config.mode.ModeConfiguration; -import org.apache.shardingsphere.infra.instance.ComputeNodeInstance; -import org.apache.shardingsphere.infra.instance.InstanceContext; -import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData; -import org.apache.shardingsphere.infra.instance.mode.ModeContextManager; -import org.apache.shardingsphere.infra.lock.LockContext; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.state.instance.InstanceStateContext; -import org.apache.shardingsphere.infra.util.eventbus.EventBusContext; +import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; import org.apache.shardingsphere.mode.manager.ContextManager; -import org.apache.shardingsphere.mode.manager.standalone.workerid.generator.StandaloneWorkerIdGenerator; import org.apache.shardingsphere.mode.metadata.MetaDataContexts; -import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; +import org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory; import org.apache.shardingsphere.proxy.backend.context.ProxyContext; import org.apache.shardingsphere.test.mock.AutoMockExtension; import org.apache.shardingsphere.test.mock.StaticMockSettings; @@ -80,10 +73,9 @@ void assertExportWithContextManager() { } private ContextManager mockContextManager() { - MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), new ShardingSphereMetaData()); - InstanceContext instanceContext = new InstanceContext( - new ComputeNodeInstance(mock(InstanceMetaData.class)), new StandaloneWorkerIdGenerator(), new ModeConfiguration("Standalone", null), - mock(ModeContextManager.class), mock(LockContext.class), new EventBusContext()); - return new ContextManager(metaDataContexts, instanceContext); + MetaDataContexts metaDataContexts = MetaDataContextsFactory.create(mock(MetaDataPersistService.class), new ShardingSphereMetaData()); + ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS); + when(result.getMetaDataContexts()).thenReturn(metaDataContexts); + return result; } } diff --git a/agent/plugins/metrics/core/src/test/resources/logback-test.xml b/agent/plugins/metrics/core/src/test/resources/logback-test.xml index d90fc4a715683..d17f7efbfaf30 100644 --- a/agent/plugins/metrics/core/src/test/resources/logback-test.xml +++ b/agent/plugins/metrics/core/src/test/resources/logback-test.xml @@ -17,6 +17,7 @@ --> + [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n diff --git a/agent/plugins/metrics/pom.xml b/agent/plugins/metrics/pom.xml index 85d1673fd54b0..6272d5ee9f0c5 100644 --- a/agent/plugins/metrics/pom.xml +++ b/agent/plugins/metrics/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-agent-plugins - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-plugin-metrics pom diff --git a/agent/plugins/metrics/type/pom.xml b/agent/plugins/metrics/type/pom.xml index dd055eb60c867..4ec9797f3da4b 100644 --- a/agent/plugins/metrics/type/pom.xml +++ b/agent/plugins/metrics/type/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-agent-plugin-metrics - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-metrics-type pom diff --git a/agent/plugins/metrics/type/prometheus/pom.xml b/agent/plugins/metrics/type/prometheus/pom.xml index 501d6d4ad28a4..c7a4081637a8f 100644 --- a/agent/plugins/metrics/type/prometheus/pom.xml +++ b/agent/plugins/metrics/type/prometheus/pom.xml @@ -21,15 +21,27 @@ org.apache.shardingsphere shardingsphere-agent-metrics-type - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-metrics-prometheus ${project.artifactId} - - 0.11.0 - 0.16.1 - + + + + io.prometheus + simpleclient_bom + ${prometheus-simpleclient.version} + pom + import + + + io.prometheus.jmx + collector + ${prometheus-jmx.version} + + + @@ -79,22 +91,18 @@ io.prometheus simpleclient - ${prometheus.version} io.prometheus simpleclient_hotspot - ${prometheus.version} io.prometheus simpleclient_httpserver - ${prometheus.version} io.prometheus.jmx collector - ${prometheus.jmx.version} diff --git a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleService.java b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleService.java index f5ad8f8dfb86d..b8a4630389d38 100644 --- a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleService.java +++ b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleService.java @@ -23,6 +23,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.shardingsphere.agent.api.PluginConfiguration; import org.apache.shardingsphere.agent.plugin.core.config.validator.PluginConfigurationValidator; +import org.apache.shardingsphere.agent.plugin.core.context.PluginContext; import org.apache.shardingsphere.agent.plugin.metrics.core.exporter.impl.BuildInfoExporter; import org.apache.shardingsphere.agent.plugin.metrics.core.exporter.impl.jdbc.JDBCMetaDataInfoExporter; import org.apache.shardingsphere.agent.plugin.metrics.core.exporter.impl.jdbc.JDBCStateExporter; @@ -46,6 +47,7 @@ public final class PrometheusPluginLifecycleService implements PluginLifecycleSe @Override public void start(final PluginConfiguration pluginConfig, final boolean isEnhancedForProxy) { + PluginContext.getInstance().setEnhancedForProxy(isEnhancedForProxy); PluginConfigurationValidator.validatePort(getType(), pluginConfig); startServer(pluginConfig, isEnhancedForProxy); } @@ -87,8 +89,8 @@ private InetSocketAddress getSocketAddress(final PluginConfiguration pluginConfi return isNullOrEmpty(pluginConfig.getHost()) ? new InetSocketAddress(pluginConfig.getPort()) : new InetSocketAddress(pluginConfig.getHost(), pluginConfig.getPort()); } - private boolean isNullOrEmpty(final String string) { - return null == string || string.isEmpty(); + private boolean isNullOrEmpty(final String value) { + return null == value || value.isEmpty(); } @Override diff --git a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsHistogramCollector.java b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsHistogramCollector.java index c07b7bcc9f630..b29e6b0f37bb0 100644 --- a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsHistogramCollector.java +++ b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsHistogramCollector.java @@ -60,13 +60,13 @@ private void appendProperties(final Builder builder, final Map p return; } if (EXP_TYPE_KEY.equals(buckets.get(TYPE_KEY))) { - double start = null == buckets.get(START_KEY) ? 1 : Double.parseDouble(buckets.get(START_KEY).toString()); - double factor = null == buckets.get(FACTOR_KEY) ? 1 : Double.parseDouble(buckets.get(FACTOR_KEY).toString()); + double start = null == buckets.get(START_KEY) ? 1D : Double.parseDouble(buckets.get(START_KEY).toString()); + double factor = null == buckets.get(FACTOR_KEY) ? 1D : Double.parseDouble(buckets.get(FACTOR_KEY).toString()); int count = null == buckets.get(COUNT_KEY) ? 1 : (int) buckets.get(COUNT_KEY); builder.exponentialBuckets(start, factor, count); } else if (LINEAR_TYPE_KEY.equals(buckets.get(TYPE_KEY))) { - double start = null == buckets.get(START_KEY) ? 1 : Double.parseDouble(buckets.get(START_KEY).toString()); - double width = null == buckets.get(WIDTH_KEY) ? 1 : Double.parseDouble(buckets.get(WIDTH_KEY).toString()); + double start = null == buckets.get(START_KEY) ? 1D : Double.parseDouble(buckets.get(START_KEY).toString()); + double width = null == buckets.get(WIDTH_KEY) ? 1D : Double.parseDouble(buckets.get(WIDTH_KEY).toString()); int count = null == buckets.get(COUNT_KEY) ? 1 : (int) buckets.get(COUNT_KEY); builder.linearBuckets(start, width, count); } diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java index f135775836444..be934e121087a 100644 --- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java +++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java @@ -20,16 +20,17 @@ import org.apache.shardingsphere.agent.api.PluginConfiguration; import org.apache.shardingsphere.infra.config.mode.ModeConfiguration; import org.apache.shardingsphere.infra.instance.ComputeNodeInstance; -import org.apache.shardingsphere.infra.instance.InstanceContext; +import org.apache.shardingsphere.infra.instance.ComputeNodeInstanceContext; import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData; -import org.apache.shardingsphere.infra.instance.mode.ModeContextManager; import org.apache.shardingsphere.infra.lock.LockContext; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.util.eventbus.EventBusContext; +import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.mode.manager.standalone.workerid.generator.StandaloneWorkerIdGenerator; import org.apache.shardingsphere.mode.metadata.MetaDataContexts; -import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; +import org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory; +import org.apache.shardingsphere.mode.spi.PersistRepository; import org.apache.shardingsphere.proxy.backend.context.ProxyContext; import org.apache.shardingsphere.test.mock.AutoMockExtension; import org.apache.shardingsphere.test.mock.StaticMockSettings; @@ -69,10 +70,10 @@ void assertStart() throws IOException { } private ContextManager mockContextManager() { - MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), new ShardingSphereMetaData()); - InstanceContext instanceContext = new InstanceContext( + MetaDataContexts metaDataContexts = MetaDataContextsFactory.create(mock(MetaDataPersistService.class), new ShardingSphereMetaData()); + ComputeNodeInstanceContext computeNodeInstanceContext = new ComputeNodeInstanceContext( new ComputeNodeInstance(mock(InstanceMetaData.class)), new StandaloneWorkerIdGenerator(), new ModeConfiguration("Standalone", null), - mock(ModeContextManager.class), mock(LockContext.class), new EventBusContext()); - return new ContextManager(metaDataContexts, instanceContext); + mock(LockContext.class), new EventBusContext()); + return new ContextManager(metaDataContexts, computeNodeInstanceContext, mock(PersistRepository.class)); } } diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsHistogramCollectorTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsHistogramCollectorTest.java index a90e9eb0b6af5..cdfede52e6ca1 100644 --- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsHistogramCollectorTest.java +++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsHistogramCollectorTest.java @@ -34,7 +34,7 @@ class PrometheusMetricsHistogramCollectorTest { void assertCreate() throws ReflectiveOperationException { PrometheusMetricsHistogramCollector collector = new PrometheusMetricsHistogramCollector(new MetricConfiguration("foo_histogram", MetricCollectorType.HISTOGRAM, "foo_help", Collections.emptyList(), Collections.emptyMap())); - collector.observe(1); + collector.observe(1D); Histogram histogram = (Histogram) Plugins.getMemberAccessor().get(PrometheusMetricsHistogramCollector.class.getDeclaredField("histogram"), collector); assertThat(histogram.collect().size(), is(1)); } diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusSummaryWrapperTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusSummaryWrapperTest.java index d69b78bca6da3..8bedf87c13ff5 100644 --- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusSummaryWrapperTest.java +++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusSummaryWrapperTest.java @@ -34,7 +34,7 @@ class PrometheusSummaryWrapperTest { void assertCreate() throws ReflectiveOperationException { PrometheusMetricsSummaryCollector collector = new PrometheusMetricsSummaryCollector(new MetricConfiguration("foo_summary", MetricCollectorType.SUMMARY, "foo_help", Collections.emptyList(), Collections.emptyMap())); - collector.observe(1); + collector.observe(1D); Summary summary = (Summary) Plugins.getMemberAccessor().get(PrometheusMetricsSummaryCollector.class.getDeclaredField("summary"), collector); assertThat(summary.collect().size(), is(1)); } diff --git a/agent/plugins/metrics/type/prometheus/src/test/resources/logback-test.xml b/agent/plugins/metrics/type/prometheus/src/test/resources/logback-test.xml index d9e399b0b77e8..2f7b365100763 100644 --- a/agent/plugins/metrics/type/prometheus/src/test/resources/logback-test.xml +++ b/agent/plugins/metrics/type/prometheus/src/test/resources/logback-test.xml @@ -17,6 +17,7 @@ --> + [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n diff --git a/agent/plugins/pom.xml b/agent/plugins/pom.xml index 6449bb4be73d9..5a7c83e895446 100644 --- a/agent/plugins/pom.xml +++ b/agent/plugins/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-agent - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-plugins pom @@ -47,6 +47,31 @@ byte-buddy provided + + + org.apache.shardingsphere + shardingsphere-proxy-backend-core + ${project.version} + provided + + + com.h2database + h2 + + + + + org.apache.shardingsphere + shardingsphere-jdbc + ${project.version} + provided + + + com.h2database + h2 + + + diff --git a/agent/plugins/tracing/core/pom.xml b/agent/plugins/tracing/core/pom.xml index a67e775cd3060..e8d333d2c7884 100644 --- a/agent/plugins/tracing/core/pom.xml +++ b/agent/plugins/tracing/core/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-agent-plugin-tracing - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-tracing-core ${project.artifactId} diff --git a/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingJDBCExecutorCallbackAdvice.java b/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingJDBCExecutorCallbackAdvice.java index c2c9c8005e4d9..de151c669c72d 100644 --- a/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingJDBCExecutorCallbackAdvice.java +++ b/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingJDBCExecutorCallbackAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.tracing.core.advice; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.core.util.AgentReflectionUtils; import org.apache.shardingsphere.agent.plugin.tracing.core.RootSpanContext; import org.apache.shardingsphere.infra.database.core.connector.ConnectionProperties; @@ -33,7 +33,7 @@ * * @param type of root span */ -public abstract class TracingJDBCExecutorCallbackAdvice implements InstanceMethodAdvice { +public abstract class TracingJDBCExecutorCallbackAdvice extends AbstractInstanceMethodAdvice { protected static final String OPERATION_NAME = "/ShardingSphere/executeSQL/"; diff --git a/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingRootSpanAdvice.java b/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingRootSpanAdvice.java index 6a1a234f35bec..f8702d270547a 100644 --- a/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingRootSpanAdvice.java +++ b/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingRootSpanAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.tracing.core.advice; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.tracing.core.RootSpanContext; import java.lang.reflect.Method; @@ -28,7 +28,7 @@ * * @param type of span */ -public abstract class TracingRootSpanAdvice implements InstanceMethodAdvice { +public abstract class TracingRootSpanAdvice extends AbstractInstanceMethodAdvice { protected static final String OPERATION_NAME = "/ShardingSphere/rootInvoke/"; diff --git a/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingSQLParserEngineAdvice.java b/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingSQLParserEngineAdvice.java index a6f8a02ad4e18..39ba1fe25efe8 100644 --- a/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingSQLParserEngineAdvice.java +++ b/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingSQLParserEngineAdvice.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.agent.plugin.tracing.core.advice; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; -import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice; +import org.apache.shardingsphere.agent.plugin.core.advice.AbstractInstanceMethodAdvice; import org.apache.shardingsphere.agent.plugin.tracing.core.RootSpanContext; import java.lang.reflect.Method; @@ -28,7 +28,7 @@ * * @param type of root span */ -public abstract class TracingSQLParserEngineAdvice implements InstanceMethodAdvice { +public abstract class TracingSQLParserEngineAdvice extends AbstractInstanceMethodAdvice { protected static final String OPERATION_NAME = "/ShardingSphere/parseSQL/"; diff --git a/agent/plugins/tracing/pom.xml b/agent/plugins/tracing/pom.xml index 17e8af3ee7ff8..342c8089ed167 100644 --- a/agent/plugins/tracing/pom.xml +++ b/agent/plugins/tracing/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-agent-plugins - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-plugin-tracing pom diff --git a/agent/plugins/tracing/type/opentelemetry/pom.xml b/agent/plugins/tracing/type/opentelemetry/pom.xml index d41f68072be6e..c63c0d4a59259 100644 --- a/agent/plugins/tracing/type/opentelemetry/pom.xml +++ b/agent/plugins/tracing/type/opentelemetry/pom.xml @@ -21,25 +21,40 @@ org.apache.shardingsphere shardingsphere-agent-tracing-type - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-tracing-opentelemetry ${project.artifactId} - - 1.22.0 - 1.22.0-alpha - - io.opentelemetry opentelemetry-bom - ${opentelemetry-bom.version} + ${opentelemetry.version} pom import + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin-stdlib.version} + + + org.jetbrains.kotlin + kotlin-stdlib-common + ${kotlin-stdlib.version} + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin-stdlib.version} + + + com.squareup.okhttp3 + okhttp + ${okhttp.version} + @@ -55,10 +70,22 @@ io.opentelemetry opentelemetry-exporter-jaeger + + + com.squareup.okhttp3 + okhttp + + io.opentelemetry opentelemetry-exporter-zipkin + + + com.squareup.okhttp3 + okhttp + + io.opentelemetry @@ -67,14 +94,27 @@ io.opentelemetry opentelemetry-sdk-extension-autoconfigure - ${opentelemetry-autoconfigure.version} + + com.squareup.okhttp3 + okhttp + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + + io.opentelemetry opentelemetry-sdk-testing test - org.apache.shardingsphere shardingsphere-test-util diff --git a/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginLifecycleService.java b/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginLifecycleService.java index d73bfbaa4a2db..fdeb4531e0d91 100644 --- a/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginLifecycleService.java +++ b/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginLifecycleService.java @@ -20,6 +20,7 @@ import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; import org.apache.shardingsphere.agent.api.PluginConfiguration; +import org.apache.shardingsphere.agent.plugin.core.context.PluginContext; import org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.constant.OpenTelemetryConstants; import org.apache.shardingsphere.agent.spi.PluginLifecycleService; @@ -30,6 +31,7 @@ public final class OpenTelemetryTracingPluginLifecycleService implements PluginL @Override public void start(final PluginConfiguration pluginConfig, final boolean isEnhancedForProxy) { + PluginContext.getInstance().setEnhancedForProxy(isEnhancedForProxy); pluginConfig.getProps().forEach((key, value) -> setSystemProperty(String.valueOf(key), String.valueOf(value))); OpenTelemetrySdk openTelemetrySdk = AutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk(); openTelemetrySdk.getTracer(OpenTelemetryConstants.TRACER_NAME); diff --git a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdviceTest.java b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdviceTest.java index e5712ab6317ae..82f8f8fae0c9c 100644 --- a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdviceTest.java +++ b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdviceTest.java @@ -125,7 +125,7 @@ void assertMethod() { void assertExceptionHandle() { OpenTelemetryJDBCExecutorCallbackAdvice advice = new OpenTelemetryJDBCExecutorCallbackAdvice(); advice.beforeMethod(targetObject, null, new Object[]{executionUnit, false}, "OpenTelemetry"); - advice.onThrowing(targetObject, null, new Object[]{executionUnit, false}, new IOException(), "OpenTelemetry"); + advice.onThrowing(targetObject, null, new Object[]{executionUnit, false}, new IOException(""), "OpenTelemetry"); List spanItems = testExporter.getFinishedSpanItems(); assertCommonData(spanItems); assertThat(spanItems.iterator().next().getStatus().getStatusCode(), is(StatusCode.ERROR)); diff --git a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryRootSpanAdviceTest.java b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryRootSpanAdviceTest.java index ad4c6582ed174..3ef2d8f122478 100644 --- a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryRootSpanAdviceTest.java +++ b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryRootSpanAdviceTest.java @@ -79,7 +79,7 @@ void assertMethod() { void assertExceptionHandle() { OpenTelemetryRootSpanAdvice advice = new OpenTelemetryRootSpanAdvice(); advice.beforeMethod(new TargetAdviceObjectFixture(), null, new Object[]{}, "OpenTelemetry"); - advice.onThrowing(new TargetAdviceObjectFixture(), null, new Object[]{}, new IOException(), "OpenTelemetry"); + advice.onThrowing(new TargetAdviceObjectFixture(), null, new Object[]{}, new IOException(""), "OpenTelemetry"); List spanItems = testExporter.getFinishedSpanItems(); assertCommonData(spanItems); assertThat(spanItems.iterator().next().getStatus().getStatusCode(), is(StatusCode.ERROR)); diff --git a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetrySQLParserEngineAdviceTest.java b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetrySQLParserEngineAdviceTest.java index 7a1ececc36a5c..526e014ba3c50 100644 --- a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetrySQLParserEngineAdviceTest.java +++ b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetrySQLParserEngineAdviceTest.java @@ -80,7 +80,7 @@ void assertExceptionHandle() { TargetAdviceObjectFixture adviceObjectFixture = new TargetAdviceObjectFixture(); OpenTelemetrySQLParserEngineAdvice advice = new OpenTelemetrySQLParserEngineAdvice(); advice.beforeMethod(adviceObjectFixture, null, new Object[]{SQL, true}, "OpenTelemetry"); - advice.onThrowing(adviceObjectFixture, null, new Object[]{SQL, true}, new IOException(), "OpenTelemetry"); + advice.onThrowing(adviceObjectFixture, null, new Object[]{SQL, true}, new IOException(""), "OpenTelemetry"); List spanItems = testExporter.getFinishedSpanItems(); assertCommonData(spanItems); assertThat(spanItems.iterator().next().getStatus().getStatusCode(), is(StatusCode.ERROR)); diff --git a/agent/plugins/tracing/type/pom.xml b/agent/plugins/tracing/type/pom.xml index 69b5450f6a680..6649f684fe81e 100644 --- a/agent/plugins/tracing/type/pom.xml +++ b/agent/plugins/tracing/type/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-agent-plugin-tracing - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-tracing-type pom diff --git a/agent/pom.xml b/agent/pom.xml index 47cfdac6a0eeb..9d9e37fac071b 100644 --- a/agent/pom.xml +++ b/agent/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent pom @@ -55,11 +55,6 @@ commons-lang3 test - - org.apache.commons - commons-collections4 - test - org.apache.shardingsphere diff --git a/db-protocol/core/pom.xml b/db-protocol/core/pom.xml index 6ef0df54c8972..89f7d596e7f43 100644 --- a/db-protocol/core/pom.xml +++ b/db-protocol/core/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-db-protocol - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-db-protocol-core ${project.artifactId} diff --git a/db-protocol/core/src/test/resources/logback-test.xml b/db-protocol/core/src/test/resources/logback-test.xml index d90fc4a715683..d17f7efbfaf30 100644 --- a/db-protocol/core/src/test/resources/logback-test.xml +++ b/db-protocol/core/src/test/resources/logback-test.xml @@ -17,6 +17,7 @@ --> + [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n diff --git a/db-protocol/mysql/pom.xml b/db-protocol/mysql/pom.xml index c10911f49085c..02562cf8bd13c 100644 --- a/db-protocol/mysql/pom.xml +++ b/db-protocol/mysql/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-db-protocol - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-mysql-protocol ${project.artifactId} diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/codec/MySQLPacketCodecEngine.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/codec/MySQLPacketCodecEngine.java index 9adb3d73dff38..90a2810dece5f 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/codec/MySQLPacketCodecEngine.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/codec/MySQLPacketCodecEngine.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLErrPacket; import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload; import org.apache.shardingsphere.db.protocol.packet.DatabasePacket; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnknownSQLException; +import org.apache.shardingsphere.infra.exception.generic.UnknownSQLException; import java.nio.charset.Charset; import java.util.Iterator; diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLAuthenticationMethod.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLAuthenticationMethod.java index ec98feacbbe1f..e8b42c8a9b6f0 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLAuthenticationMethod.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLAuthenticationMethod.java @@ -38,7 +38,9 @@ public enum MySQLAuthenticationMethod implements AuthenticationMethod { WINDOWS_NATIVE("authentication_windows_client"), - SHA256("sha256_password"); + SHA256("sha256_password"), + + CACHING_SHA2_PASSWORD("caching_sha2_password"); private final String methodName; } diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCapabilityFlag.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCapabilityFlag.java index 6d5eda2f71bbb..7a1c18c82a8c9 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCapabilityFlag.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCapabilityFlag.java @@ -97,7 +97,7 @@ public static int calculateHandshakeCapabilityFlagsLower() { * @return handshake capability flags upper bit */ public static int calculateHandshakeCapabilityFlagsUpper() { - return calculateCapabilityFlags(CLIENT_PLUGIN_AUTH) >> 16; + return calculateCapabilityFlags(CLIENT_MULTI_STATEMENTS, CLIENT_PLUGIN_AUTH) >> 16; } /** diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlag.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlag.java index b7a18f57b6d12..598561f5ff02d 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlag.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlag.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnknownSQLException; +import org.apache.shardingsphere.infra.exception.generic.UnknownSQLException; import java.sql.SQLException; diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValue.java index 3796c5f1c405e..5995c27a8e110 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValue.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValue.java @@ -20,7 +20,7 @@ import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef; import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.value.MySQLBinlogProtocolValue; import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import java.io.Serializable; diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDecimalBinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDecimalBinlogProtocolValue.java index 55055dd28f51e..a785390c80fce 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDecimalBinlogProtocolValue.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDecimalBinlogProtocolValue.java @@ -61,9 +61,10 @@ private static BigDecimal toDecimal(final DecimalMetaData metaData, final byte[] private static BigDecimal decodeIntegerValue(final DecimalMetaData metaData, final byte[] value) { int offset = DIG_TO_BYTES[metaData.getExtraIntegerSize()]; BigDecimal result = offset > 0 ? BigDecimal.valueOf(readFixedLengthIntBE(value, 0, offset)) : BigDecimal.ZERO; - for (; offset < metaData.getIntegerByteLength(); offset += DEC_BYTE_SIZE) { + while (offset < metaData.getIntegerByteLength()) { int i = readFixedLengthIntBE(value, offset, DEC_BYTE_SIZE); result = result.movePointRight(DIG_PER_DEC).add(BigDecimal.valueOf(i)); + offset += DEC_BYTE_SIZE; } return result; } @@ -73,8 +74,10 @@ private static BigDecimal decodeScaleValue(final DecimalMetaData metaData, final int shift = 0; int offset = metaData.getIntegerByteLength(); int scale = metaData.getScale(); - for (; shift + DIG_PER_DEC <= scale; shift += DIG_PER_DEC, offset += DEC_BYTE_SIZE) { + while (shift + DIG_PER_DEC <= scale) { result = result.add(BigDecimal.valueOf(readFixedLengthIntBE(value, offset, DEC_BYTE_SIZE)).movePointLeft(shift + DIG_PER_DEC)); + shift += DIG_PER_DEC; + offset += DEC_BYTE_SIZE; } if (shift < scale) { result = result.add(BigDecimal.valueOf(readFixedLengthIntBE(value, offset, DIG_TO_BYTES[scale - shift])).movePointLeft(scale)); diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValue.java index db2aa4e8e7c9c..6ff03873b0346 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValue.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValue.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef; import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.value.MySQLBinlogProtocolValue; import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import java.io.Serializable; diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoder.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoder.java index 77fe8014c054a..e3f8d29f8612b 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoder.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoder.java @@ -20,7 +20,7 @@ import io.netty.buffer.ByteBuf; import lombok.AccessLevel; import lombok.NoArgsConstructor; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import java.io.Serializable; import java.math.BigInteger; @@ -99,7 +99,7 @@ private static void decodeValue(final int type, final int offset, final ByteBuf private static BigInteger readUnsignedLongLE(final ByteBuf byteBuf) { long value = byteBuf.readLongLE(); - return 0 <= value ? BigInteger.valueOf(value) : MAX_BIG_INTEGER_VALUE.add(BigInteger.valueOf(1 + value)); + return 0L <= value ? BigInteger.valueOf(value) : MAX_BIG_INTEGER_VALUE.add(BigInteger.valueOf(1L + value)); } private static void decodeJsonObject(final boolean isSmall, final ByteBuf byteBuf, final StringBuilder stringBuilder) { @@ -214,12 +214,14 @@ private static String decodeString(final ByteBuf byteBuf) { private static int decodeDataLength(final ByteBuf byteBuf) { int result = 0; - for (int i = 0;; i++) { + int i = 0; + while (true) { int data = byteBuf.readUnsignedByte(); result |= (data & 0x7f) << (7 * i); if (0 == (data & 0x80)) { break; } + i++; } return result; } diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValue.java index 4dab2d308ca83..a4d712e2982a3 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValue.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValue.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef; import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.value.MySQLBinlogProtocolValue; import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import java.io.Serializable; diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValue.java index fab67f0de9475..1bd44d7dd0f83 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValue.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValue.java @@ -37,11 +37,11 @@ public final class MySQLDatetime2BinlogProtocolValue implements MySQLBinlogProto @Override public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) { long datetime = readDatetimeV2FromPayload(payload); - return 0 == datetime ? MySQLTimeValueUtils.DATETIME_OF_ZERO : readDatetime(columnDef, datetime, payload); + return 0L == datetime ? MySQLTimeValueUtils.DATETIME_OF_ZERO : readDatetime(columnDef, datetime, payload); } private long readDatetimeV2FromPayload(final MySQLPacketPayload payload) { - long result = 0; + long result = 0L; for (int i = 4; i >= 0; i--) { result |= (long) payload.readInt1() << (8 * i); } @@ -49,19 +49,19 @@ private long readDatetimeV2FromPayload(final MySQLPacketPayload payload) { } private Serializable readDatetime(final MySQLBinlogColumnDef columnDef, final long datetime, final MySQLPacketPayload payload) { - long datetimeWithoutSign = datetime & (0x8000000000L - 1); + long datetimeWithoutSign = datetime & (0x8000000000L - 1L); if (0 == datetimeWithoutSign) { return MySQLTimeValueUtils.DATETIME_OF_ZERO; } long date = datetimeWithoutSign >> 17; long yearAndMonth = date >> 5; - int year = (int) (yearAndMonth / 13); - int month = (int) (yearAndMonth % 13); - int day = (int) (date % (1 << 5)); - long time = datetimeWithoutSign % (1 << 17); + int year = (int) (yearAndMonth / 13L); + int month = (int) (yearAndMonth % 13L); + int day = (int) (date % (1L << 5L)); + long time = datetimeWithoutSign % (1L << 17L); int hour = (int) (time >> 12); - int minute = (int) ((time >> 6) % (1 << 6)); - int second = (int) (time % (1 << 6)); + int minute = (int) ((time >> 6) % (1L << 6L)); + int second = (int) (time % (1L << 6L)); MySQLFractionalSeconds fractionalSeconds = new MySQLFractionalSeconds(columnDef.getColumnMeta(), payload); return Timestamp.valueOf(LocalDateTime.of(year, month, day, hour, minute, second, fractionalSeconds.getNanos())); } diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValue.java index c4b0aa886cca8..3e9ffd76093fe 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValue.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValue.java @@ -37,15 +37,15 @@ public final class MySQLDatetimeBinlogProtocolValue implements MySQLBinlogProtoc @Override public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) { long datetime = payload.readInt8(); - return 0 == datetime ? MySQLTimeValueUtils.DATETIME_OF_ZERO : readDateTime(datetime); + return 0L == datetime ? MySQLTimeValueUtils.DATETIME_OF_ZERO : readDateTime(datetime); } private Date readDateTime(final long datetime) { - int date = (int) (datetime / 1000000); + int date = (int) (datetime / 1000000L); int year = date / 10000; int month = (date % 10000) / 100; int day = date % 100; - int time = (int) (datetime % 1000000); + int time = (int) (datetime % 1000000L); int hour = time / 10000; int minute = (time % 10000) / 100; int second = time % 100; diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java index 1bd4f1d9bbaf2..9300dc946dd18 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java @@ -20,10 +20,10 @@ import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef; import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.value.MySQLBinlogProtocolValue; import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload; +import org.apache.shardingsphere.infra.util.datetime.DateTimeFormatterFactory; import java.io.Serializable; import java.sql.Timestamp; -import java.time.format.DateTimeFormatter; /** * MySQL TIMESTAMP binlog protocol value. @@ -33,11 +33,9 @@ */ public final class MySQLTimestampBinlogProtocolValue implements MySQLBinlogProtocolValue { - private final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - @Override public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) { int seconds = payload.readInt4(); - return 0 == seconds ? MySQLTimeValueUtils.DATETIME_OF_ZERO : dateTimeFormatter.format(new Timestamp(seconds * 1000L).toLocalDateTime()); + return 0 == seconds ? MySQLTimeValueUtils.DATETIME_OF_ZERO : DateTimeFormatterFactory.getStandardFormatter().format(new Timestamp(seconds * 1000L).toLocalDateTime()); } } diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt1BinaryProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt1BinaryProtocolValue.java index a8666dea338c5..56637cb894518 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt1BinaryProtocolValue.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt1BinaryProtocolValue.java @@ -24,7 +24,6 @@ */ public final class MySQLInt1BinaryProtocolValue implements MySQLBinaryProtocolValue { - @SuppressWarnings("SimplifiableIfStatement") @Override public Object read(final MySQLPacketPayload payload, final boolean unsigned) { if (unsigned) { diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt2BinaryProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt2BinaryProtocolValue.java index f83f3d6ecd1bc..ea2068d7bce21 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt2BinaryProtocolValue.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt2BinaryProtocolValue.java @@ -24,7 +24,6 @@ */ public final class MySQLInt2BinaryProtocolValue implements MySQLBinaryProtocolValue { - @SuppressWarnings("SimplifiableIfStatement") @Override public Object read(final MySQLPacketPayload payload, final boolean unsigned) { if (unsigned) { diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt4BinaryProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt4BinaryProtocolValue.java index 5dc130c8b974d..e8a9f447a5562 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt4BinaryProtocolValue.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLInt4BinaryProtocolValue.java @@ -26,7 +26,6 @@ */ public final class MySQLInt4BinaryProtocolValue implements MySQLBinaryProtocolValue { - @SuppressWarnings("SimplifiableIfStatement") @Override public Object read(final MySQLPacketPayload payload, final boolean unsigned) { if (unsigned) { diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPreparePacket.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPreparePacket.java index 994c4e5c103db..52940e7a10654 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPreparePacket.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPreparePacket.java @@ -37,11 +37,11 @@ public final class MySQLComStmtPreparePacket extends MySQLCommandPacket implemen @Getter private final HintValueContext hintValueContext; - public MySQLComStmtPreparePacket(final MySQLPacketPayload payload, final boolean sqlCommentParseEnabled) { + public MySQLComStmtPreparePacket(final MySQLPacketPayload payload) { super(MySQLCommandPacketType.COM_STMT_PREPARE); String originSQL = payload.readStringEOF(); - hintValueContext = sqlCommentParseEnabled ? new HintValueContext() : SQLHintUtils.extractHint(originSQL).orElseGet(HintValueContext::new); - sql = sqlCommentParseEnabled ? originSQL : SQLHintUtils.removeHint(originSQL); + hintValueContext = SQLHintUtils.extractHint(originSQL); + sql = SQLHintUtils.removeHint(originSQL); } @Override diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java index fec7bed350bfb..b4eabc9b3f258 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java @@ -21,11 +21,11 @@ import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.db.protocol.mysql.packet.MySQLPacket; import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload; +import org.apache.shardingsphere.infra.util.datetime.DateTimeFormatterFactory; import java.math.BigDecimal; import java.sql.Timestamp; import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collection; @@ -40,8 +40,6 @@ public final class MySQLTextResultSetRowPacket extends MySQLPacket { private static final int NULL = 0xfb; - private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - private final Collection data; public MySQLTextResultSetRowPacket(final MySQLPacketPayload payload, final int columnCount) { @@ -72,7 +70,7 @@ private void writeDataIntoPayload(final MySQLPacketPayload payload, final Object } else if (data instanceof Boolean) { payload.writeBytesLenenc((boolean) data ? new byte[]{1} : new byte[]{0}); } else if (data instanceof LocalDateTime) { - payload.writeStringLenenc(DATE_TIME_FORMATTER.format((LocalDateTime) data)); + payload.writeStringLenenc(DateTimeFormatterFactory.getStandardFormatter().format((LocalDateTime) data)); } else { payload.writeStringLenenc(data.toString()); } diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/query/MySQLComQueryPacket.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/query/MySQLComQueryPacket.java index 65fa98eccc6f9..fce9268c753b8 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/query/MySQLComQueryPacket.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/query/MySQLComQueryPacket.java @@ -37,17 +37,17 @@ public final class MySQLComQueryPacket extends MySQLCommandPacket implements SQL @Getter private final HintValueContext hintValueContext; - public MySQLComQueryPacket(final String sql, final boolean sqlCommentParseEnabled) { + public MySQLComQueryPacket(final String sql) { super(MySQLCommandPacketType.COM_QUERY); - hintValueContext = sqlCommentParseEnabled ? new HintValueContext() : SQLHintUtils.extractHint(sql).orElseGet(HintValueContext::new); - this.sql = sqlCommentParseEnabled ? sql : SQLHintUtils.removeHint(sql); + hintValueContext = SQLHintUtils.extractHint(sql); + this.sql = SQLHintUtils.removeHint(sql); } - public MySQLComQueryPacket(final MySQLPacketPayload payload, final boolean sqlCommentParseEnabled) { + public MySQLComQueryPacket(final MySQLPacketPayload payload) { super(MySQLCommandPacketType.COM_QUERY); String originSQL = payload.readStringEOF(); - hintValueContext = sqlCommentParseEnabled ? new HintValueContext() : SQLHintUtils.extractHint(originSQL).orElseGet(HintValueContext::new); - sql = sqlCommentParseEnabled ? originSQL : SQLHintUtils.removeHint(originSQL); + hintValueContext = SQLHintUtils.extractHint(originSQL); + sql = SQLHintUtils.removeHint(originSQL); } @Override diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthMoreDataPacket.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthMoreDataPacket.java index e1f6ca39804a1..38e2b4a489774 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthMoreDataPacket.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthMoreDataPacket.java @@ -22,7 +22,7 @@ import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.db.protocol.mysql.packet.MySQLPacket; import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; /** * MySQL authentication more data packet. diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacket.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacket.java index d6d93ea376304..d7265f39ab845 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacket.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacket.java @@ -31,6 +31,7 @@ * @see AuthSwitchRequest */ @RequiredArgsConstructor +@Getter public final class MySQLAuthSwitchRequestPacket extends MySQLPacket { /** @@ -38,10 +39,8 @@ public final class MySQLAuthSwitchRequestPacket extends MySQLPacket { */ public static final int HEADER = 0xfe; - @Getter private final String authPluginName; - @Getter private final MySQLAuthenticationPluginData authPluginData; public MySQLAuthSwitchRequestPacket(final MySQLPacketPayload payload) { diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacket.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacket.java index 0dd4727333b16..07499ad04344b 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacket.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacket.java @@ -63,7 +63,7 @@ public MySQLHandshakePacket(final int connectionId, final boolean sslEnabled, fi statusFlag = MySQLStatusFlag.SERVER_STATUS_AUTOCOMMIT; capabilityFlagsUpper = MySQLCapabilityFlag.calculateHandshakeCapabilityFlagsUpper(); this.authPluginData = authPluginData; - authPluginName = MySQLAuthenticationMethod.NATIVE.getMethodName(); + authPluginName = MySQLAuthenticationMethod.CACHING_SHA2_PASSWORD.getMethodName(); } public MySQLHandshakePacket(final MySQLPacketPayload payload) { diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41Packet.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41Packet.java index 96c1f90bb4d96..7d98bc1ee36ac 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41Packet.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41Packet.java @@ -23,6 +23,7 @@ import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLAuthenticationMethod; import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLCapabilityFlag; import org.apache.shardingsphere.db.protocol.mysql.packet.MySQLPacket; +import org.apache.shardingsphere.db.protocol.mysql.packet.command.admin.MySQLComSetOptionPacket; import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload; /** @@ -49,8 +50,11 @@ public final class MySQLHandshakeResponse41Packet extends MySQLPacket { private String authPluginName; + private int multiStatementsOption; + public MySQLHandshakeResponse41Packet(final MySQLPacketPayload payload) { capabilityFlags = payload.readInt4(); + multiStatementsOption = readMultiStatementsOption(capabilityFlags); maxPacketSize = payload.readInt4(); characterSet = payload.readInt1(); payload.skipReserved(23); @@ -60,6 +64,11 @@ public MySQLHandshakeResponse41Packet(final MySQLPacketPayload payload) { authPluginName = readAuthPluginName(payload); } + private int readMultiStatementsOption(final int capabilityFlags) { + return 0 == (capabilityFlags & MySQLCapabilityFlag.CLIENT_MULTI_STATEMENTS.getValue()) ? MySQLComSetOptionPacket.MYSQL_OPTION_MULTI_STATEMENTS_OFF + : MySQLComSetOptionPacket.MYSQL_OPTION_MULTI_STATEMENTS_ON; + } + private byte[] readAuthResponse(final MySQLPacketPayload payload) { if (0 != (capabilityFlags & MySQLCapabilityFlag.CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA.getValue())) { return payload.readStringLenencByBytes(); diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/payload/MySQLPacketPayload.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/payload/MySQLPacketPayload.java index ff0354318050c..cc0145cac053a 100644 --- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/payload/MySQLPacketPayload.java +++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/payload/MySQLPacketPayload.java @@ -116,7 +116,7 @@ public void writeInt4(final int value) { * @return 6 byte fixed length integer */ public long readInt6() { - long result = 0; + long result = 0L; for (int i = 0; i < 6; i++) { result |= ((long) (0xff & byteBuf.readByte())) << (8 * i); } @@ -161,7 +161,7 @@ public long readIntLenenc() { return firstByte; } if (0xfb == firstByte) { - return 0; + return 0L; } if (0xfc == firstByte) { return readInt2(); @@ -182,12 +182,12 @@ public void writeIntLenenc(final long value) { byteBuf.writeByte((int) value); return; } - if (value < Math.pow(2, 16)) { + if (value < Math.pow(2D, 16D)) { byteBuf.writeByte(0xfc); byteBuf.writeShortLE((int) value); return; } - if (value < Math.pow(2, 24)) { + if (value < Math.pow(2D, 24D)) { byteBuf.writeByte(0xfd); byteBuf.writeMediumLE((int) value); return; @@ -203,7 +203,7 @@ public void writeIntLenenc(final long value) { * @return fixed length long */ public long readLong(final int length) { - long result = 0; + long result = 0L; for (int i = 0; i < length; i++) { result = result << 8 | readInt1(); } diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCapabilityFlagTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCapabilityFlagTest.java index e89c0e9ae44c9..ebc3cb46e2c5e 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCapabilityFlagTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLCapabilityFlagTest.java @@ -36,6 +36,6 @@ void assertCalculateHandshakeCapabilityFlagsLower() { @Test void assertCalculateHandshakeCapabilityFlagsUpper() { - assertThat(MySQLCapabilityFlag.calculateHandshakeCapabilityFlagsUpper(), is(0x0008)); + assertThat(MySQLCapabilityFlag.calculateHandshakeCapabilityFlagsUpper(), is(0x0009)); } } diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlagTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlagTest.java index 4effafb188551..de76a26c7c3a5 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlagTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlagTest.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.db.protocol.mysql.constant; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnknownSQLException; +import org.apache.shardingsphere.infra.exception.generic.UnknownSQLException; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.is; diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogRowsEventPacketTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogRowsEventPacketTest.java index 597f51618887a..8e7ff7b6ea9e1 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogRowsEventPacketTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogRowsEventPacketTest.java @@ -32,7 +32,7 @@ import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; +import java.util.Collections; import java.util.List; import static org.hamcrest.CoreMatchers.is; @@ -59,17 +59,12 @@ class MySQLBinlogRowsEventPacketTest { @BeforeEach void setUp() { - mockColumnDefs(); + columnDefs = Collections.singletonList(new MySQLBinlogColumnDef(MySQLBinaryColumnType.LONGLONG)); when(payload.readInt6()).thenReturn(1L); when(payload.readInt2()).thenReturn(2); when(payload.readIntLenenc()).thenReturn(1L); } - private void mockColumnDefs() { - columnDefs = new ArrayList<>(); - columnDefs.add(new MySQLBinlogColumnDef(MySQLBinaryColumnType.LONGLONG)); - } - @Test void assertReadWriteRowV1WithoutNullValue() throws InvocationTargetException, NoSuchMethodException, IllegalAccessException { MySQLBinlogRowsEventPacket actual = new MySQLBinlogRowsEventPacket(binlogEventHeader, payload); diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValueTest.java index 100c86cd3f2e7..0c4b55c994a21 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValueTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValueTest.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnType; import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef; import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValueTest.java index 20ae2580f0cd8..d22544d54129d 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValueTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValueTest.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef; import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.value.string.MySQLJsonValueDecoder.JsonValueTypes; import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoderTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoderTest.java index be648a1e869ae..e8ce970d2a8e0 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoderTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoderTest.java @@ -181,9 +181,9 @@ void assertDecodeSmallJsonObjectWithDouble() { void assertDecodeSmallJsonObjectWithString() { List jsonEntries = new LinkedList<>(); String value1 = ""; - String value2 = Strings.repeat("1", (int) (Math.pow(2, 7) - 1)); - String value3 = Strings.repeat("1", (int) (Math.pow(2, 7) - 1 + 1)); - String value4 = Strings.repeat("1", (int) (Math.pow(2, 14) - 1)); + String value2 = Strings.repeat("1", (int) (Math.pow(2D, 7D) - 1D)); + String value3 = Strings.repeat("1", (int) (Math.pow(2D, 7D) - 1D + 1D)); + String value4 = Strings.repeat("1", (int) (Math.pow(2D, 14D) - 1D)); jsonEntries.add(new JsonEntry(JsonValueTypes.STRING, "key1", value1)); jsonEntries.add(new JsonEntry(JsonValueTypes.STRING, "key2", value2)); jsonEntries.add(new JsonEntry(JsonValueTypes.STRING, "key3", value3)); @@ -370,10 +370,11 @@ private byte[] codecDataLength(final int length) { } // compress int index = lengthData.length - 1; - for (; index > 0; index--) { + while (index > 0) { if (0 != lengthData[index]) { break; } + index--; } for (int i = 0; i < index; i++) { lengthData[i] |= 0x80; diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValueTest.java index 7f2683c740edd..ea723824a8e7e 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValueTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValueTest.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnType; import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef; import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java index 822dea07cd373..219849627de42 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java @@ -52,7 +52,7 @@ void setUp() { @Test void assertReadWithoutFraction() { - int currentSeconds = Long.valueOf(System.currentTimeMillis() / 1000).intValue(); + int currentSeconds = Long.valueOf(System.currentTimeMillis() / 1000L).intValue(); when(byteBuf.readInt()).thenReturn(currentSeconds); assertThat(new MySQLTimestamp2BinlogProtocolValue().read(columnDef, payload), is(new Timestamp(currentSeconds * 1000L))); } @@ -61,8 +61,8 @@ void assertReadWithoutFraction() { void assertReadWithFraction() { columnDef.setColumnMeta(1); long currentTimeMillis = 1678795614082L; - int currentSeconds = Long.valueOf(currentTimeMillis / 1000).intValue(); - int currentMilliseconds = Long.valueOf(currentTimeMillis % 100).intValue(); + int currentSeconds = Long.valueOf(currentTimeMillis / 1000L).intValue(); + int currentMilliseconds = Long.valueOf(currentTimeMillis % 100L).intValue(); when(payload.readInt1()).thenReturn(currentMilliseconds); when(byteBuf.readInt()).thenReturn(currentSeconds); assertThat("currentTimeMillis:" + currentTimeMillis, new MySQLTimestamp2BinlogProtocolValue().read(columnDef, payload), is(new Timestamp(currentSeconds * 1000L + currentMilliseconds * 10L))); diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java index ceba78e9d6631..6f128c8d291ab 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java @@ -19,13 +19,13 @@ import org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.MySQLBinlogColumnDef; import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload; +import org.apache.shardingsphere.infra.util.datetime.DateTimeFormatterFactory; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import java.sql.Timestamp; -import java.time.format.DateTimeFormatter; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -45,7 +45,7 @@ void assertRead() { int currentSeconds = Long.valueOf(System.currentTimeMillis() / 1000L).intValue(); when(payload.readInt4()).thenReturn(currentSeconds); assertThat(new MySQLTimestampBinlogProtocolValue().read(columnDef, payload), - is(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(new Timestamp(currentSeconds * 1000L).toLocalDateTime()))); + is(DateTimeFormatterFactory.getStandardFormatter().format(new Timestamp(currentSeconds * 1000L).toLocalDateTime()))); } @Test diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLFieldCountPacketTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLFieldCountPacketTest.java index 9eef292f26906..28815c37aa941 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLFieldCountPacketTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLFieldCountPacketTest.java @@ -40,6 +40,6 @@ void assertWrite() { MySQLFieldCountPacket actual = new MySQLFieldCountPacket(payload); assertThat(actual.getColumnCount(), is(3)); actual.write(payload); - verify(payload).writeIntLenenc(3); + verify(payload).writeIntLenenc(3L); } } diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValueTest.java index 3375645a6a7a9..18bd36f6f4c81 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValueTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValueTest.java @@ -46,7 +46,7 @@ class MySQLTimeBinaryProtocolValueTest { @Test void assertReadWithZeroByte() throws SQLException { - assertThat(new MySQLTimeBinaryProtocolValue().read(payload, false), is(new Timestamp(0))); + assertThat(new MySQLTimeBinaryProtocolValue().read(payload, false), is(new Timestamp(0L))); } @Test diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPreparePacketTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPreparePacketTest.java index 1742166824fc3..eb74e5263bc16 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPreparePacketTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/prepare/MySQLComStmtPreparePacketTest.java @@ -37,14 +37,14 @@ class MySQLComStmtPreparePacketTest { @Test void assertNew() { when(payload.readStringEOF()).thenReturn("SELECT id FROM tbl WHERE id=?"); - MySQLComStmtPreparePacket actual = new MySQLComStmtPreparePacket(payload, false); + MySQLComStmtPreparePacket actual = new MySQLComStmtPreparePacket(payload); assertThat(actual.getSQL(), is("SELECT id FROM tbl WHERE id=?")); } @Test void assertWrite() { when(payload.readStringEOF()).thenReturn("SELECT id FROM tbl WHERE id=?"); - MySQLComStmtPreparePacket actual = new MySQLComStmtPreparePacket(payload, false); + MySQLComStmtPreparePacket actual = new MySQLComStmtPreparePacket(payload); actual.write(payload); verify(payload).writeStringEOF("SELECT id FROM tbl WHERE id=?"); } diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java index d6e3534e9f560..bbe68399b5691 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java @@ -66,7 +66,7 @@ void assertWrite() { @Test void assertTimestampWithoutNanos() { - long now = System.currentTimeMillis() / 1000 * 1000; + long now = System.currentTimeMillis() / 1000L * 1000L; Timestamp timestamp = new Timestamp(now); MySQLTextResultSetRowPacket actual = new MySQLTextResultSetRowPacket(Arrays.asList(null, "value", BigDecimal.ONE, new byte[]{}, timestamp)); actual.write(payload); diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/query/MySQLComQueryPacketTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/query/MySQLComQueryPacketTest.java index 425ddb586d69a..8b316ad0a478c 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/query/MySQLComQueryPacketTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/query/MySQLComQueryPacketTest.java @@ -38,14 +38,14 @@ class MySQLComQueryPacketTest { @Test void assertNew() { when(payload.readStringEOF()).thenReturn("SELECT id FROM tbl"); - MySQLComQueryPacket actual = new MySQLComQueryPacket(payload, false); + MySQLComQueryPacket actual = new MySQLComQueryPacket(payload); assertThat(actual.getSQL(), is("SELECT id FROM tbl")); } @Test void assertWrite() { when(payload.readStringEOF()).thenReturn("SELECT id FROM tbl"); - MySQLComQueryPacket actual = new MySQLComQueryPacket(payload, false); + MySQLComQueryPacket actual = new MySQLComQueryPacket(payload); actual.write(payload); verify(payload).writeInt1(MySQLCommandPacketType.COM_QUERY.getValue()); verify(payload).writeStringEOF("SELECT id FROM tbl"); diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacketTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacketTest.java index ff25169d263f5..f40652160485f 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacketTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacketTest.java @@ -129,7 +129,7 @@ void assertWriteWithClientPluginAuth() { verify(payload).writeInt2(MySQLCapabilityFlag.calculateHandshakeCapabilityFlagsLower()); verify(payload).writeInt1(MySQLConstants.DEFAULT_CHARSET.getId()); verify(payload).writeInt2(MySQLStatusFlag.SERVER_STATUS_AUTOCOMMIT.getValue()); - verify(payload).writeInt2(MySQLCapabilityFlag.CLIENT_PLUGIN_AUTH.getValue() >> 16); + verify(payload).writeInt2(MySQLCapabilityFlag.calculateHandshakeCapabilityFlagsUpper()); verify(payload).writeInt1(authPluginData.getAuthenticationPluginData().length + 1); verify(payload).writeReserved(10); verify(payload).writeStringNul(new String(authPluginData.getAuthenticationPluginDataPart2())); diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41PacketTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41PacketTest.java index 911071d588bf2..e0a5ad98ac2a7 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41PacketTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41PacketTest.java @@ -20,6 +20,7 @@ import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLAuthenticationMethod; import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLCapabilityFlag; import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLConstants; +import org.apache.shardingsphere.db.protocol.mysql.packet.command.admin.MySQLComSetOptionPacket; import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -55,6 +56,24 @@ void assertNewWithPayloadWithDatabase() { verify(payload).skipReserved(23); } + @Test + void assertNewWithPayloadWithClientMultiStatements() { + when(payload.readInt1()).thenReturn(MySQLConstants.DEFAULT_CHARSET.getId()); + when(payload.readInt4()).thenReturn(MySQLCapabilityFlag.CLIENT_MULTI_STATEMENTS.getValue(), 1000); + when(payload.readStringNul()).thenReturn("root", "sharding_db"); + when(payload.readStringNulByBytes()).thenReturn(new byte[]{1}); + MySQLHandshakeResponse41Packet actual = new MySQLHandshakeResponse41Packet(payload); + assertThat(actual.getMultiStatementsOption(), is(MySQLComSetOptionPacket.MYSQL_OPTION_MULTI_STATEMENTS_ON)); + assertThat(actual.getMaxPacketSize(), is(1000)); + assertThat(actual.getCharacterSet(), is(MySQLConstants.DEFAULT_CHARSET.getId())); + assertThat(actual.getUsername(), is("root")); + assertThat(actual.getAuthResponse(), is(new byte[]{1})); + assertThat(actual.getCapabilityFlags(), is(MySQLCapabilityFlag.CLIENT_MULTI_STATEMENTS.getValue())); + assertNull(actual.getDatabase()); + assertNull(actual.getAuthPluginName()); + verify(payload).skipReserved(23); + } + @Test void assertNewWithPayloadWithAuthPluginName() { when(payload.readInt1()).thenReturn(MySQLConstants.DEFAULT_CHARSET.getId()); diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/payload/MySQLPacketPayloadTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/payload/MySQLPacketPayloadTest.java index 15d5b8ca10a99..0e5064c7414af 100644 --- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/payload/MySQLPacketPayloadTest.java +++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/payload/MySQLPacketPayloadTest.java @@ -151,23 +151,23 @@ void assertWriteIntLenencWithOneByte() { @Test void assertWriteIntLenencWithTwoBytes() { - new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8).writeIntLenenc(Double.valueOf(Math.pow(2, 16)).longValue() - 1); + new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8).writeIntLenenc(Double.valueOf(Math.pow(2D, 16D)).longValue() - 1L); verify(byteBuf).writeByte(0xfc); - verify(byteBuf).writeShortLE(Double.valueOf(Math.pow(2, 16)).intValue() - 1); + verify(byteBuf).writeShortLE(Double.valueOf(Math.pow(2D, 16D)).intValue() - 1); } @Test void assertWriteIntLenencWithThreeBytes() { - new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8).writeIntLenenc(Double.valueOf(Math.pow(2, 24)).longValue() - 1); + new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8).writeIntLenenc(Double.valueOf(Math.pow(2D, 24D)).longValue() - 1L); verify(byteBuf).writeByte(0xfd); - verify(byteBuf).writeMediumLE(Double.valueOf(Math.pow(2, 24)).intValue() - 1); + verify(byteBuf).writeMediumLE(Double.valueOf(Math.pow(2D, 24D)).intValue() - 1); } @Test void assertWriteIntLenencWithFourBytes() { - new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8).writeIntLenenc(Double.valueOf(Math.pow(2, 25)).longValue() - 1); + new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8).writeIntLenenc(Double.valueOf(Math.pow(2D, 25D)).longValue() - 1L); verify(byteBuf).writeByte(0xfe); - verify(byteBuf).writeLongLE(Double.valueOf(Math.pow(2, 25)).intValue() - 1); + verify(byteBuf).writeLongLE(Double.valueOf(Math.pow(2D, 25D)).intValue() - 1L); } @Test diff --git a/db-protocol/mysql/src/test/resources/logback-test.xml b/db-protocol/mysql/src/test/resources/logback-test.xml index d90fc4a715683..d17f7efbfaf30 100644 --- a/db-protocol/mysql/src/test/resources/logback-test.xml +++ b/db-protocol/mysql/src/test/resources/logback-test.xml @@ -17,6 +17,7 @@ --> + [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n diff --git a/db-protocol/opengauss/pom.xml b/db-protocol/opengauss/pom.xml index b7378f6464997..3492eb729825e 100644 --- a/db-protocol/opengauss/pom.xml +++ b/db-protocol/opengauss/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-db-protocol - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-opengauss-protocol ${project.artifactId} diff --git a/db-protocol/opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketFactory.java b/db-protocol/opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketFactory.java index a932e40edd022..4b9acc856ae39 100644 --- a/db-protocol/opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketFactory.java +++ b/db-protocol/opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketFactory.java @@ -51,33 +51,32 @@ public final class OpenGaussCommandPacketFactory { * * @param commandPacketType command packet type for PostgreSQL/openGauss * @param payload packet payload for PostgreSQL - * @param sqlCommentParseEnabled sql comment parse enabled * @return created instance */ - public static PostgreSQLCommandPacket newInstance(final CommandPacketType commandPacketType, final PostgreSQLPacketPayload payload, final boolean sqlCommentParseEnabled) { + public static PostgreSQLCommandPacket newInstance(final CommandPacketType commandPacketType, final PostgreSQLPacketPayload payload) { if (!OpenGaussCommandPacketType.isExtendedProtocolPacketType(commandPacketType)) { payload.getByteBuf().skipBytes(1); - return getCommandPacket(commandPacketType, payload, sqlCommentParseEnabled); + return getCommandPacket(commandPacketType, payload); } List result = new ArrayList<>(); while (payload.hasCompletePacket()) { CommandPacketType type = OpenGaussCommandPacketType.valueOf(payload.readInt1()); int length = payload.getByteBuf().getInt(payload.getByteBuf().readerIndex()); PostgreSQLPacketPayload slicedPayload = new PostgreSQLPacketPayload(payload.getByteBuf().readSlice(length), payload.getCharset()); - result.add(getCommandPacket(type, slicedPayload, sqlCommentParseEnabled)); + result.add(getCommandPacket(type, slicedPayload)); } return new PostgreSQLAggregatedCommandPacket(result); } - private static PostgreSQLCommandPacket getCommandPacket(final CommandPacketType commandPacketType, final PostgreSQLPacketPayload payload, final boolean sqlCommentParseEnabled) { + private static PostgreSQLCommandPacket getCommandPacket(final CommandPacketType commandPacketType, final PostgreSQLPacketPayload payload) { if (OpenGaussCommandPacketType.BATCH_BIND_COMMAND == commandPacketType) { return new OpenGaussComBatchBindPacket(payload); } switch ((PostgreSQLCommandPacketType) commandPacketType) { case SIMPLE_QUERY: - return new PostgreSQLComQueryPacket(payload, sqlCommentParseEnabled); + return new PostgreSQLComQueryPacket(payload); case PARSE_COMMAND: - return new PostgreSQLComParsePacket(payload, sqlCommentParseEnabled); + return new PostgreSQLComParsePacket(payload); case BIND_COMMAND: return new PostgreSQLComBindPacket(payload); case DESCRIBE_COMMAND: diff --git a/db-protocol/opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacket.java b/db-protocol/opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacket.java index 291b5c559993c..63280ecd1245d 100644 --- a/db-protocol/opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacket.java +++ b/db-protocol/opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacket.java @@ -56,7 +56,7 @@ public final class OpenGaussErrorResponsePacket extends PostgreSQLIdentifierPack public static final char FIELD_TYPE_ROUTINE = 'R'; - public static final char FIELD_TYPE_ERRORCODE = 'c'; + public static final char FIELD_TYPE_ERROR_CODE = 'c'; private final Map fields; @@ -85,7 +85,7 @@ private void fillFieldsByServerErrorMessage(final ServerErrorMessage serverError fields.put(FIELD_TYPE_MESSAGE, serverErrorMessage.getMessage()); } if (null != serverErrorMessage.getERRORCODE()) { - fields.put(FIELD_TYPE_ERRORCODE, serverErrorMessage.getERRORCODE()); + fields.put(FIELD_TYPE_ERROR_CODE, serverErrorMessage.getERRORCODE()); } if (null != serverErrorMessage.getDetail()) { fields.put(FIELD_TYPE_DETAIL, serverErrorMessage.getDetail()); @@ -117,7 +117,7 @@ private void fillFieldsByServerErrorMessage(final ServerErrorMessage serverError } private void fillRequiredFieldsIfNecessary() { - fields.putIfAbsent(FIELD_TYPE_ERRORCODE, "0"); + fields.putIfAbsent(FIELD_TYPE_ERROR_CODE, "0"); } @Override diff --git a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketFactoryTest.java b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketFactoryTest.java index 9136036e7941c..c7bb811dbc4f0 100644 --- a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketFactoryTest.java +++ b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/OpenGaussCommandPacketFactoryTest.java @@ -42,11 +42,11 @@ class OpenGaussCommandPacketFactoryTest { @Test void assertNewOpenGaussComBatchBindPacket() { when(payload.getByteBuf()).thenReturn(mock(ByteBuf.class)); - assertThat(OpenGaussCommandPacketFactory.newInstance(OpenGaussCommandPacketType.BATCH_BIND_COMMAND, payload, false), instanceOf(PostgreSQLAggregatedCommandPacket.class)); + assertThat(OpenGaussCommandPacketFactory.newInstance(OpenGaussCommandPacketType.BATCH_BIND_COMMAND, payload), instanceOf(PostgreSQLAggregatedCommandPacket.class)); } @Test void assertNewPostgreSQLPacket() { - assertThat(OpenGaussCommandPacketFactory.newInstance(mock(PostgreSQLCommandPacketType.class), payload, false), instanceOf(PostgreSQLCommandPacket.class)); + assertThat(OpenGaussCommandPacketFactory.newInstance(mock(PostgreSQLCommandPacketType.class), payload), instanceOf(PostgreSQLCommandPacket.class)); } } diff --git a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacketTest.java b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacketTest.java index 1e60d972c2375..d622b9bcbf111 100644 --- a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacketTest.java +++ b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/generic/OpenGaussErrorResponsePacketTest.java @@ -41,7 +41,7 @@ void assertWritePacketFromServerErrorMessage() { verify(payload).writeStringNul("3D000"); verify(payload).writeInt1(OpenGaussErrorResponsePacket.FIELD_TYPE_MESSAGE); verify(payload).writeStringNul("database \"test\" does not exist"); - verify(payload).writeInt1(OpenGaussErrorResponsePacket.FIELD_TYPE_ERRORCODE); + verify(payload).writeInt1(OpenGaussErrorResponsePacket.FIELD_TYPE_ERROR_CODE); verify(payload).writeStringNul("-1"); verify(payload).writeInt1(OpenGaussErrorResponsePacket.FIELD_TYPE_DETAIL); verify(payload).writeStringNul("detail"); @@ -76,7 +76,7 @@ void assertWritePacketFromSeverityAndMessage() { verify(payload).writeStringNul("3D000"); verify(payload).writeInt1(OpenGaussErrorResponsePacket.FIELD_TYPE_MESSAGE); verify(payload).writeStringNul("database \"test\" does not exist"); - verify(payload).writeInt1(OpenGaussErrorResponsePacket.FIELD_TYPE_ERRORCODE); + verify(payload).writeInt1(OpenGaussErrorResponsePacket.FIELD_TYPE_ERROR_CODE); verify(payload).writeStringNul("0"); } } diff --git a/db-protocol/opengauss/src/test/resources/logback-test.xml b/db-protocol/opengauss/src/test/resources/logback-test.xml index 8913931083149..10a4fedb0e26b 100644 --- a/db-protocol/opengauss/src/test/resources/logback-test.xml +++ b/db-protocol/opengauss/src/test/resources/logback-test.xml @@ -17,6 +17,7 @@ --> + [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n diff --git a/db-protocol/pom.xml b/db-protocol/pom.xml index 88b3e0f1cac2d..eee92acd08ddb 100644 --- a/db-protocol/pom.xml +++ b/db-protocol/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-db-protocol pom diff --git a/db-protocol/postgresql/pom.xml b/db-protocol/postgresql/pom.xml index 884014bc7a503..39a45851da5b3 100644 --- a/db-protocol/postgresql/pom.xml +++ b/db-protocol/postgresql/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-db-protocol - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-postgresql-protocol ${project.artifactId} diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLValueFormat.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLValueFormat.java index 0b6b960dee90d..09dcd84e788b1 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLValueFormat.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLValueFormat.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; /** * PostgreSQL value format. diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketFactory.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketFactory.java index a57c205b44f1e..0dc45edb040b4 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketFactory.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketFactory.java @@ -46,31 +46,29 @@ public final class PostgreSQLCommandPacketFactory { * * @param commandPacketType command packet type for PostgreSQL * @param payload packet payload for PostgreSQL - * @param sqlCommentParseEnabled SQL comment parse enabled * @return created instance */ - public static PostgreSQLCommandPacket newInstance(final PostgreSQLCommandPacketType commandPacketType, final PostgreSQLPacketPayload payload, final boolean sqlCommentParseEnabled) { + public static PostgreSQLCommandPacket newInstance(final PostgreSQLCommandPacketType commandPacketType, final PostgreSQLPacketPayload payload) { if (!PostgreSQLCommandPacketType.isExtendedProtocolPacketType(commandPacketType)) { payload.getByteBuf().skipBytes(1); - return getPostgreSQLCommandPacket(commandPacketType, payload, sqlCommentParseEnabled); + return getPostgreSQLCommandPacket(commandPacketType, payload); } List result = new ArrayList<>(); while (payload.hasCompletePacket()) { PostgreSQLCommandPacketType type = PostgreSQLCommandPacketType.valueOf(payload.readInt1()); int length = payload.getByteBuf().getInt(payload.getByteBuf().readerIndex()); PostgreSQLPacketPayload slicedPayload = new PostgreSQLPacketPayload(payload.getByteBuf().readSlice(length), payload.getCharset()); - result.add(getPostgreSQLCommandPacket(type, slicedPayload, sqlCommentParseEnabled)); + result.add(getPostgreSQLCommandPacket(type, slicedPayload)); } return new PostgreSQLAggregatedCommandPacket(result); } - private static PostgreSQLCommandPacket getPostgreSQLCommandPacket(final PostgreSQLCommandPacketType commandPacketType, final PostgreSQLPacketPayload payload, - final boolean sqlCommentParseEnabled) { + private static PostgreSQLCommandPacket getPostgreSQLCommandPacket(final PostgreSQLCommandPacketType commandPacketType, final PostgreSQLPacketPayload payload) { switch (commandPacketType) { case SIMPLE_QUERY: - return new PostgreSQLComQueryPacket(payload, sqlCommentParseEnabled); + return new PostgreSQLComQueryPacket(payload); case PARSE_COMMAND: - return new PostgreSQLComParsePacket(payload, sqlCommentParseEnabled); + return new PostgreSQLComParsePacket(payload); case BIND_COMMAND: return new PostgreSQLComBindPacket(payload); case DESCRIBE_COMMAND: diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketType.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketType.java index ab694c575de29..21bf02bb79301 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketType.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketType.java @@ -55,9 +55,8 @@ public enum PostgreSQLCommandPacketType implements CommandPacketType, PostgreSQL TERMINATE('X'); - private static final Set EXTENDED_PROTOCOL_PACKET_TYPES = EnumSet.of(PostgreSQLCommandPacketType.PARSE_COMMAND, - PostgreSQLCommandPacketType.BIND_COMMAND, PostgreSQLCommandPacketType.DESCRIBE_COMMAND, PostgreSQLCommandPacketType.EXECUTE_COMMAND, - PostgreSQLCommandPacketType.SYNC_COMMAND, PostgreSQLCommandPacketType.CLOSE_COMMAND, PostgreSQLCommandPacketType.FLUSH_COMMAND); + private static final Set EXTENDED_PROTOCOL_PACKET_TYPES = EnumSet.of( + PARSE_COMMAND, BIND_COMMAND, DESCRIBE_COMMAND, EXECUTE_COMMAND, SYNC_COMMAND, CLOSE_COMMAND, FLUSH_COMMAND); private final char value; diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/admin/PostgreSQLUnsupportedCommandPacket.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/admin/PostgreSQLUnsupportedCommandPacket.java index 976c968d9574c..1cdf47193d79e 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/admin/PostgreSQLUnsupportedCommandPacket.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/admin/PostgreSQLUnsupportedCommandPacket.java @@ -27,9 +27,9 @@ * Unsupported command packet for PostgreSQL. */ @RequiredArgsConstructor +@Getter public final class PostgreSQLUnsupportedCommandPacket extends PostgreSQLCommandPacket { - @Getter private final PostgreSQLIdentifierTag identifier; @Override diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java index f3dea2e37d9db..f70ece14a8a18 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java @@ -222,6 +222,9 @@ public static PostgreSQLColumnType valueOfJDBCType(final int jdbcType, final Str if (isBool(jdbcType, columnTypeName)) { return BOOL; } + if (isUUID(jdbcType, columnTypeName)) { + return UUID; + } return valueOfJDBCType(jdbcType); } @@ -247,6 +250,17 @@ public static boolean isBool(final int jdbcType, final String columnTypeName) { return Types.BIT == jdbcType && "bool".equalsIgnoreCase(columnTypeName); } + /** + * Check if PostgreSQL is UUID type. + * + * @param jdbcType JDBC type + * @param columnTypeName column type name + * @return whether it is PostgreSQL UUID + */ + public static boolean isUUID(final int jdbcType, final String columnTypeName) { + return Types.OTHER == jdbcType && "uuid".equalsIgnoreCase(columnTypeName); + } + /** * Value of. * diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoder.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoder.java index c9c10a31c5807..c546c46c56784 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoder.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoder.java @@ -19,7 +19,7 @@ import com.google.common.base.Preconditions; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import java.nio.charset.StandardCharsets; import java.util.Arrays; diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java index e1bf538223d07..815f53faa1300 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java @@ -53,6 +53,7 @@ public final class PostgreSQLBinaryProtocolValueFactory { setBoolArrayBinaryProtocolValue(); setStringArrayBinaryProtocolValue(); setByteaBinaryProtocolValue(); + setUUIDBinaryProtocolValue(); } private static void setUnspecifiedBinaryProtocolValue() { @@ -140,6 +141,10 @@ private static void setByteaBinaryProtocolValue() { BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.BYTEA, new PostgreSQLByteaBinaryProtocolValue()); } + private static void setUUIDBinaryProtocolValue() { + BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.UUID, new PostgreSQLUUIDBinaryProtocolValue()); + } + /** * Get binary protocol value. * diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValue.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValue.java index a8876d6cb7468..9927c5adaef79 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValue.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValue.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; /** * Binary protocol value for boolean array for PostgreSQL. diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValue.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValue.java index c5443b7a4842b..76e257c670e91 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValue.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValue.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; /** * Binary protocol value for float4 array for PostgreSQL. diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValue.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValue.java index aeb6f53854111..346b028b35dbe 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValue.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValue.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; /** * Binary protocol value for float8 array for PostgreSQL. diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValue.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValue.java index 85f32fa185119..01a811f34a26f 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValue.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValue.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; /** * Binary protocol value for int2 array for PostgreSQL. diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValue.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValue.java index 10868f7218d1f..31c0bdbab3864 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValue.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValue.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; /** * Binary protocol value for int4 array for PostgreSQL. diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValue.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValue.java index 42804eaffe877..f7ee9060b431a 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValue.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValue.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; /** * Binary protocol value for int8 array for PostgreSQL. diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValue.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValue.java index 7538b88ac43e0..95794304fc525 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValue.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValue.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; /** * Binary protocol value for string array for PostgreSQL. diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValue.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValue.java new file mode 100644 index 0000000000000..1b51961e4c787 --- /dev/null +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValue.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol; + +import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; +import org.postgresql.util.ByteConverter; + +import java.util.UUID; + +/** + * Binary protocol value for UUID for PostgreSQL. + */ +public final class PostgreSQLUUIDBinaryProtocolValue implements PostgreSQLBinaryProtocolValue { + + @Override + public int getColumnLength(final Object value) { + return 16; + } + + @Override + public Object read(final PostgreSQLPacketPayload payload, final int parameterValueLength) { + byte[] result = new byte[parameterValueLength]; + payload.getByteBuf().readBytes(result); + return new UUID(ByteConverter.int8(result, 0), ByteConverter.int8(result, 8)); + } + + @Override + public void write(final PostgreSQLPacketPayload payload, final Object value) { + UUID uuid = (UUID) value; + payload.writeInt8(uuid.getMostSignificantBits()); + payload.writeInt8(uuid.getLeastSignificantBits()); + } +} diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValue.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValue.java index 4acdf258e3e3b..b08201048896c 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValue.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValue.java @@ -19,7 +19,7 @@ import org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.PostgreSQLTypeUnspecifiedSQLParameter; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; /** * Binary protocol value for unspecified for PostgreSQL. diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/text/impl/PostgreSQLTimeValueParser.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/text/impl/PostgreSQLTimeValueParser.java index 2438391b3638d..3c1f248b447d6 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/text/impl/PostgreSQLTimeValueParser.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/text/impl/PostgreSQLTimeValueParser.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol.text.impl; import org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol.text.PostgreSQLTextValueParser; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import java.time.LocalTime; import java.time.format.DateTimeFormatter; diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/util/PostgreSQLBinaryTimestampUtils.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/util/PostgreSQLBinaryTimestampUtils.java index 6293e26e06325..1022a88c5442b 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/util/PostgreSQLBinaryTimestampUtils.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/util/PostgreSQLBinaryTimestampUtils.java @@ -74,6 +74,6 @@ private static long convertJavaEpochToPgEpoch(final long seconds) { } private static long convertToJulianSeconds(final long seconds) { - return seconds - TimeUnit.DAYS.toSeconds(10); + return seconds - TimeUnit.DAYS.toSeconds(10L); } } diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/util/PostgreSQLTextBitUtils.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/util/PostgreSQLTextBitUtils.java index a7a4057c37ca5..7f6cf04ed8df2 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/util/PostgreSQLTextBitUtils.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/util/PostgreSQLTextBitUtils.java @@ -24,7 +24,7 @@ * Text bit utility class of PostgreSQL. */ @NoArgsConstructor(access = AccessLevel.PRIVATE) -public class PostgreSQLTextBitUtils { +public final class PostgreSQLTextBitUtils { /** * Get bit Text value in PostgreSQL text format. diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/util/PostgreSQLTextBoolUtils.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/util/PostgreSQLTextBoolUtils.java index c0f6ba1c8c49f..dced984dc06ee 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/util/PostgreSQLTextBoolUtils.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/util/PostgreSQLTextBoolUtils.java @@ -24,7 +24,7 @@ * Text Bool utility class of PostgreSQL. */ @NoArgsConstructor(access = AccessLevel.PRIVATE) -public class PostgreSQLTextBoolUtils { +public final class PostgreSQLTextBoolUtils { /** * Get Boolean Text value in PostgreSQL text format. diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacket.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacket.java index dbc498249be40..dc7ed37132ce3 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacket.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacket.java @@ -46,13 +46,13 @@ public final class PostgreSQLComParsePacket extends PostgreSQLCommandPacket impl private final HintValueContext hintValueContext; - public PostgreSQLComParsePacket(final PostgreSQLPacketPayload payload, final boolean sqlCommentParseEnabled) { + public PostgreSQLComParsePacket(final PostgreSQLPacketPayload payload) { this.payload = payload; payload.readInt4(); statementId = payload.readStringNul(); String originSQL = payload.readStringNul(); - hintValueContext = sqlCommentParseEnabled ? new HintValueContext() : SQLHintUtils.extractHint(originSQL).orElseGet(HintValueContext::new); - sql = sqlCommentParseEnabled ? originSQL : SQLHintUtils.removeHint(originSQL); + hintValueContext = SQLHintUtils.extractHint(originSQL); + sql = SQLHintUtils.removeHint(originSQL); } /** diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/simple/PostgreSQLComQueryPacket.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/simple/PostgreSQLComQueryPacket.java index 33cbdf2f54a99..7f361815387c0 100644 --- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/simple/PostgreSQLComQueryPacket.java +++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/simple/PostgreSQLComQueryPacket.java @@ -36,11 +36,11 @@ public final class PostgreSQLComQueryPacket extends PostgreSQLCommandPacket impl @Getter private final HintValueContext hintValueContext; - public PostgreSQLComQueryPacket(final PostgreSQLPacketPayload payload, final boolean sqlCommentParseEnabled) { + public PostgreSQLComQueryPacket(final PostgreSQLPacketPayload payload) { payload.readInt4(); String originSQL = payload.readStringNul(); - hintValueContext = sqlCommentParseEnabled ? new HintValueContext() : SQLHintUtils.extractHint(originSQL).orElseGet(HintValueContext::new); - sql = sqlCommentParseEnabled ? originSQL : SQLHintUtils.removeHint(originSQL); + hintValueContext = SQLHintUtils.extractHint(originSQL); + sql = SQLHintUtils.removeHint(originSQL); } @Override diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketFactoryTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketFactoryTest.java index 5ef40202320bd..6de25b23f9318 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketFactoryTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketFactoryTest.java @@ -41,47 +41,47 @@ class PostgreSQLCommandPacketFactoryTest { @Test void assertNewInstanceWithQueryComPacket() { when(payload.getByteBuf()).thenReturn(mock(ByteBuf.class)); - assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.SIMPLE_QUERY, payload, false), instanceOf(PostgreSQLComQueryPacket.class)); + assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.SIMPLE_QUERY, payload), instanceOf(PostgreSQLComQueryPacket.class)); } @Test void assertNewInstanceWithParseComPacket() { - assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.PARSE_COMMAND, payload, false), instanceOf(PostgreSQLAggregatedCommandPacket.class)); + assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.PARSE_COMMAND, payload), instanceOf(PostgreSQLAggregatedCommandPacket.class)); } @Test void assertNewInstanceWithBindComPacket() { - assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.BIND_COMMAND, payload, false), instanceOf(PostgreSQLAggregatedCommandPacket.class)); + assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.BIND_COMMAND, payload), instanceOf(PostgreSQLAggregatedCommandPacket.class)); } @Test void assertNewInstanceWithDescribeComPacket() { - assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.DESCRIBE_COMMAND, payload, false), instanceOf(PostgreSQLAggregatedCommandPacket.class)); + assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.DESCRIBE_COMMAND, payload), instanceOf(PostgreSQLAggregatedCommandPacket.class)); } @Test void assertNewInstanceWithExecuteComPacket() { - assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.EXECUTE_COMMAND, payload, false), instanceOf(PostgreSQLAggregatedCommandPacket.class)); + assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.EXECUTE_COMMAND, payload), instanceOf(PostgreSQLAggregatedCommandPacket.class)); } @Test void assertNewInstanceWithSyncComPacket() { - assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.SYNC_COMMAND, payload, false), instanceOf(PostgreSQLAggregatedCommandPacket.class)); + assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.SYNC_COMMAND, payload), instanceOf(PostgreSQLAggregatedCommandPacket.class)); } @Test void assertNewInstanceWithCloseComPacket() { - assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.CLOSE_COMMAND, payload, false), instanceOf(PostgreSQLAggregatedCommandPacket.class)); + assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.CLOSE_COMMAND, payload), instanceOf(PostgreSQLAggregatedCommandPacket.class)); } @Test void assertNewInstanceWithFlushComPacket() { - assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.FLUSH_COMMAND, payload, false), instanceOf(PostgreSQLAggregatedCommandPacket.class)); + assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.FLUSH_COMMAND, payload), instanceOf(PostgreSQLAggregatedCommandPacket.class)); } @Test void assertNewInstanceWithTerminationComPacket() { when(payload.getByteBuf()).thenReturn(mock(ByteBuf.class)); - assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.TERMINATE, payload, false), instanceOf(PostgreSQLComTerminationPacket.class)); + assertThat(PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketType.TERMINATE, payload), instanceOf(PostgreSQLComTerminationPacket.class)); } } diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoderTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoderTest.java index 06c086715a4d4..014d6f618a70a 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoderTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoderTest.java @@ -35,75 +35,75 @@ class PostgreSQLArrayParameterDecoderTest { @Test void assertParseInt2ArrayNormalTextMode() { - short[] result = DECODER.decodeInt2Array(INT_ARRAY_STR.getBytes(), false); - assertThat(result.length, is(2)); - assertThat(result[0], is((short) 11)); - assertThat(result[1], is((short) 12)); + short[] actual = DECODER.decodeInt2Array(INT_ARRAY_STR.getBytes(), false); + assertThat(actual.length, is(2)); + assertThat(actual[0], is((short) 11)); + assertThat(actual[1], is((short) 12)); } @Test void assertParseInt4ArrayNormalTextMode() { - int[] result = DECODER.decodeInt4Array(INT_ARRAY_STR.getBytes(), false); - assertThat(result.length, is(2)); - assertThat(result[0], is(11)); - assertThat(result[1], is(12)); + int[] actual = DECODER.decodeInt4Array(INT_ARRAY_STR.getBytes(), false); + assertThat(actual.length, is(2)); + assertThat(actual[0], is(11)); + assertThat(actual[1], is(12)); } @Test void assertParseInt8ArrayNormalTextMode() { - long[] result = DECODER.decodeInt8Array(INT_ARRAY_STR.getBytes(), false); - assertThat(result.length, is(2)); - assertThat(result[0], is(11L)); - assertThat(result[1], is(12L)); + long[] actual = DECODER.decodeInt8Array(INT_ARRAY_STR.getBytes(), false); + assertThat(actual.length, is(2)); + assertThat(actual[0], is(11L)); + assertThat(actual[1], is(12L)); } @Test void assertParseFloat4ArrayNormalTextMode() { - float[] result = DECODER.decodeFloat4Array(FLOAT_ARRAY_STR.getBytes(), false); - assertThat(result.length, is(2)); - assertThat(Float.compare(result[0], 11.1F), is(0)); - assertThat(Float.compare(result[1], 12.1F), is(0)); + float[] actual = DECODER.decodeFloat4Array(FLOAT_ARRAY_STR.getBytes(), false); + assertThat(actual.length, is(2)); + assertThat(Float.compare(actual[0], 11.1F), is(0)); + assertThat(Float.compare(actual[1], 12.1F), is(0)); } @Test void assertParseFloat8ArrayNormalTextMode() { - double[] result = DECODER.decodeFloat8Array(FLOAT_ARRAY_STR.getBytes(), false); - assertThat(result.length, is(2)); - assertThat(Double.compare(result[0], 11.1D), is(0)); - assertThat(Double.compare(result[1], 12.1D), is(0)); + double[] actual = DECODER.decodeFloat8Array(FLOAT_ARRAY_STR.getBytes(), false); + assertThat(actual.length, is(2)); + assertThat(Double.compare(actual[0], 11.1D), is(0)); + assertThat(Double.compare(actual[1], 12.1D), is(0)); } @Test void assertParseBoolArrayNormalTextMode() { - boolean[] result = DECODER.decodeBoolArray("{\"true\",\"false\"}".getBytes(), false); - assertThat(result.length, is(2)); - assertTrue(result[0]); - assertFalse(result[1]); + boolean[] actual = DECODER.decodeBoolArray("{\"true\",\"false\"}".getBytes(), false); + assertThat(actual.length, is(2)); + assertTrue(actual[0]); + assertFalse(actual[1]); } @Test void assertParseStringArrayNormalTextMode() { - String[] result = DECODER.decodeStringArray("{\"a\",\"b\"}".getBytes(), false); - assertThat(result.length, is(2)); - assertThat(result[0], is("a")); - assertThat(result[1], is("b")); + String[] actual = DECODER.decodeStringArray("{\"a\",\"b\"}".getBytes(), false); + assertThat(actual.length, is(2)); + assertThat(actual[0], is("a")); + assertThat(actual[1], is("b")); } @Test void assertParseStringArrayWithEscapeTextMode() { - String[] result = DECODER.decodeStringArray("{\"\\\"a\",\"\\\\b\",\"c\"}".getBytes(), false); - assertThat(result.length, is(3)); - assertThat(result[0], is("\"a")); - assertThat(result[1], is("\\b")); - assertThat(result[2], is("c")); + String[] actual = DECODER.decodeStringArray("{\"\\\"a\",\"\\\\b\",\"c\"}".getBytes(), false); + assertThat(actual.length, is(3)); + assertThat(actual[0], is("\"a")); + assertThat(actual[1], is("\\b")); + assertThat(actual[2], is("c")); } @Test void assertParseStringArrayWithNullTextMode() { - String[] result = DECODER.decodeStringArray("{\"a\",\"b\",NULL}".getBytes(), false); - assertThat(result.length, is(3)); - assertThat(result[0], is("a")); - assertThat(result[1], is("b")); - assertNull(result[2]); + String[] actual = DECODER.decodeStringArray("{\"a\",\"b\",NULL}".getBytes(), false); + assertThat(actual.length, is(3)); + assertThat(actual[0], is("a")); + assertThat(actual[1], is("b")); + assertNull(actual[2]); } } diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValueTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValueTest.java index 98830770f7bab..b3a723d2b85bf 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValueTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValueTest.java @@ -20,7 +20,7 @@ import io.netty.buffer.ByteBuf; import org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; @@ -49,8 +49,8 @@ void assertRead() { byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1); byteBuf.readInt(); PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf, StandardCharsets.UTF_8); - Object result = newInstance().read(payload, parameterValue.length()); - assertThat(result, is(new boolean[]{true, false})); + Object actual = newInstance().read(payload, parameterValue.length()); + assertThat(actual, is(new boolean[]{true, false})); assertThat(byteBuf.readerIndex(), is(expectedLength)); } diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValueTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValueTest.java index 2959ebb2f6e95..091afa5ebd5f0 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValueTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValueTest.java @@ -20,7 +20,7 @@ import io.netty.buffer.ByteBuf; import org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; @@ -49,8 +49,8 @@ void assertRead() { byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1); byteBuf.readInt(); PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf, StandardCharsets.UTF_8); - Object result = newInstance().read(payload, parameterValue.length()); - assertThat(result, is(new float[]{11.1F, 12.1F})); + Object actual = newInstance().read(payload, parameterValue.length()); + assertThat(actual, is(new float[]{11.1F, 12.1F})); assertThat(byteBuf.readerIndex(), is(expectedLength)); } diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValueTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValueTest.java index 00fde8bf3c3ff..f59dbc7b91ca1 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValueTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValueTest.java @@ -20,7 +20,7 @@ import io.netty.buffer.ByteBuf; import org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; @@ -49,8 +49,8 @@ void assertRead() { byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1); byteBuf.readInt(); PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf, StandardCharsets.UTF_8); - Object result = newInstance().read(payload, parameterValue.length()); - assertThat(result, is(new double[]{11.1D, 12.1D})); + Object actual = newInstance().read(payload, parameterValue.length()); + assertThat(actual, is(new double[]{11.1D, 12.1D})); assertThat(byteBuf.readerIndex(), is(expectedLength)); } diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValueTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValueTest.java index 99c8355f75578..63f545674b059 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValueTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValueTest.java @@ -20,7 +20,7 @@ import io.netty.buffer.ByteBuf; import org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; @@ -49,8 +49,8 @@ void assertRead() { byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1); byteBuf.readInt(); PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf, StandardCharsets.UTF_8); - Object result = newInstance().read(payload, parameterValue.length()); - assertThat(result, is(new short[]{11, 12})); + Object actual = newInstance().read(payload, parameterValue.length()); + assertThat(actual, is(new short[]{11, 12})); assertThat(byteBuf.readerIndex(), is(expectedLength)); } diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValueTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValueTest.java index 0dd674fb86011..9f590cece93ef 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValueTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValueTest.java @@ -20,7 +20,7 @@ import io.netty.buffer.ByteBuf; import org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; @@ -49,8 +49,8 @@ void assertRead() { byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1); byteBuf.readInt(); PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf, StandardCharsets.UTF_8); - Object result = newInstance().read(payload, parameterValue.length()); - assertThat(result, is(new int[]{11, 12})); + Object actual = newInstance().read(payload, parameterValue.length()); + assertThat(actual, is(new int[]{11, 12})); assertThat(byteBuf.readerIndex(), is(expectedLength)); } diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValueTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValueTest.java index 294424da7bfa0..699a07de4193d 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValueTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValueTest.java @@ -20,7 +20,7 @@ import io.netty.buffer.ByteBuf; import org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; @@ -49,8 +49,8 @@ void assertRead() { byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1); byteBuf.readInt(); PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf, StandardCharsets.UTF_8); - Object result = newInstance().read(payload, parameterValue.length()); - assertThat(result, is(new long[]{11, 12})); + Object actual = newInstance().read(payload, parameterValue.length()); + assertThat(actual, is(new long[]{11L, 12L})); assertThat(byteBuf.readerIndex(), is(expectedLength)); } diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValueTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValueTest.java index c212447b37314..f3dc059494e05 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValueTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValueTest.java @@ -50,8 +50,8 @@ void assertRead(final BigDecimal bigDecimal, final byte[] expected) { ByteBuf byteBuf = ByteBufTestUtils.createByteBuf(expectedLength); byteBuf.writeBytes(expected); PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf, StandardCharsets.UTF_8); - Object result = binaryProtocolValue.read(payload, expectedLength); - assertThat(result, is(bigDecimal)); + Object actual = binaryProtocolValue.read(payload, expectedLength); + assertThat(actual, is(bigDecimal)); assertThat(byteBuf.readerIndex(), is(expectedLength)); } diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValueTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValueTest.java index fc700343c2c16..5eb86e886e827 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValueTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValueTest.java @@ -20,7 +20,7 @@ import io.netty.buffer.ByteBuf; import org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; @@ -49,8 +49,8 @@ void assertRead() { byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1); byteBuf.readInt(); PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf, StandardCharsets.UTF_8); - Object result = newInstance().read(payload, parameterValue.length()); - assertThat(result, is(new String[]{"a", "b"})); + Object actual = newInstance().read(payload, parameterValue.length()); + assertThat(actual, is(new String[]{"a", "b"})); assertThat(byteBuf.readerIndex(), is(expectedLength)); } diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValueTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValueTest.java new file mode 100644 index 0000000000000..5955a26c48b3b --- /dev/null +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValueTest.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; +import org.junit.jupiter.api.Test; + +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.UUID; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +class PostgreSQLUUIDBinaryProtocolValueTest { + + @Test + void assertGetColumnLength() { + assertThat(new PostgreSQLUUIDBinaryProtocolValue().getColumnLength(UUID.fromString("00000000-000-0000-0000-000000000001")), is(16)); + } + + @Test + void assertRead() { + UUID uuid = UUID.fromString("00000000-000-0000-0000-000000000001"); + byte[] expected = new byte[16]; + ByteBuffer buffer = ByteBuffer.wrap(expected); + buffer.putLong(uuid.getMostSignificantBits()); + buffer.putLong(uuid.getLeastSignificantBits()); + ByteBuf byteBuf = Unpooled.wrappedBuffer(expected); + PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf, StandardCharsets.UTF_8); + assertThat(new PostgreSQLUUIDBinaryProtocolValue().read(payload, 16), is(uuid)); + } + + @Test + void assertWrite() { + UUID uuid = UUID.fromString("00000000-000-0000-0000-000000000001"); + byte[] expected = new byte[16]; + ByteBuffer buffer = ByteBuffer.wrap(expected); + buffer.putLong(uuid.getMostSignificantBits()); + buffer.putLong(uuid.getLeastSignificantBits()); + ByteBuf byteBuf = Unpooled.wrappedBuffer(expected); + PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf.writerIndex(0), StandardCharsets.UTF_8); + PostgreSQLUUIDBinaryProtocolValue actual = new PostgreSQLUUIDBinaryProtocolValue(); + actual.write(payload, uuid); + assertThat(actual.read(payload, 16), is(uuid)); + } +} diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValueTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValueTest.java index ffe38b7c221dd..001ec2e314eb4 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValueTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValueTest.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.db.protocol.postgresql.packet.ByteBufTestUtils; import org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.PostgreSQLTypeUnspecifiedSQLParameter; import org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; +import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException; import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; @@ -48,9 +48,9 @@ void assertRead() { byteBuf.writeCharSequence(timestampStr, StandardCharsets.ISO_8859_1); byteBuf.readInt(); PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf, StandardCharsets.UTF_8); - Object result = new PostgreSQLUnspecifiedBinaryProtocolValue().read(payload, timestampStr.length()); - assertThat(result, instanceOf(PostgreSQLTypeUnspecifiedSQLParameter.class)); - assertThat(result.toString(), is(timestampStr)); + Object actual = new PostgreSQLUnspecifiedBinaryProtocolValue().read(payload, timestampStr.length()); + assertThat(actual, instanceOf(PostgreSQLTypeUnspecifiedSQLParameter.class)); + assertThat(actual.toString(), is(timestampStr)); assertThat(byteBuf.readerIndex(), is(expectedLength)); } diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacketTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacketTest.java index 2b77586df6ea1..16f36300dee18 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacketTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacketTest.java @@ -42,7 +42,7 @@ void assertNewInstance() { when(payload.readInt2()).thenReturn(1); when(payload.readInt4()).thenReturn(0); when(payload.readStringNul()).thenReturn("sql"); - PostgreSQLComParsePacket actual = new PostgreSQLComParsePacket(payload, false); + PostgreSQLComParsePacket actual = new PostgreSQLComParsePacket(payload); actual.write(payload); assertThat(actual.getIdentifier(), is(PostgreSQLCommandPacketType.PARSE_COMMAND)); assertThat(actual.getSQL(), is("sql")); diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/simple/PostgreSQLComQueryPacketTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/simple/PostgreSQLComQueryPacketTest.java index 85e0f0ec17a32..1f15662cd9644 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/simple/PostgreSQLComQueryPacketTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/simple/PostgreSQLComQueryPacketTest.java @@ -38,7 +38,7 @@ class PostgreSQLComQueryPacketTest { @Test void assertNewInstance() { when(payload.readStringNul()).thenReturn("sql"); - PostgreSQLComQueryPacket actual = new PostgreSQLComQueryPacket(payload, false); + PostgreSQLComQueryPacket actual = new PostgreSQLComQueryPacket(payload); actual.write(payload); verify(payload).readInt4(); assertThat(actual.getSQL(), is("sql")); diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLCommandCompletePacketTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLCommandCompletePacketTest.java index ae5ee3629f113..6fa29855c7b99 100644 --- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLCommandCompletePacketTest.java +++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLCommandCompletePacketTest.java @@ -37,7 +37,7 @@ class PostgreSQLCommandCompletePacketTest { @ParameterizedTest(name = "{0}") @ArgumentsSource(TestCaseArgumentsProvider.class) void assertReadWrite(final String sqlCommand, final String expectedDelimiter) { - long rowCount = 1; + long rowCount = 1L; String expectedString = sqlCommand + expectedDelimiter + rowCount; int expectedStringLength = expectedString.length(); PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(ByteBufTestUtils.createByteBuf(expectedStringLength + 1), StandardCharsets.ISO_8859_1); diff --git a/db-protocol/postgresql/src/test/resources/logback-test.xml b/db-protocol/postgresql/src/test/resources/logback-test.xml index c50ae279f5414..1372cd9425116 100644 --- a/db-protocol/postgresql/src/test/resources/logback-test.xml +++ b/db-protocol/postgresql/src/test/resources/logback-test.xml @@ -17,6 +17,7 @@ --> + [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n diff --git a/distribution/agent/pom.xml b/distribution/agent/pom.xml index 400e72643aa77..1b68b5c08ddb5 100644 --- a/distribution/agent/pom.xml +++ b/distribution/agent/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-distribution - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-agent-distribution pom @@ -82,6 +82,21 @@ net.nicoulaj.maven.plugins checksum-maven-plugin + + maven-source-plugin + + + io.smallrye + jandex-maven-plugin + + + make-index + + jandex + + + + diff --git a/distribution/jdbc/pom.xml b/distribution/jdbc/pom.xml index 1c59bb5f7d09d..3d589c1c3705e 100644 --- a/distribution/jdbc/pom.xml +++ b/distribution/jdbc/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-distribution - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-jdbc-distribution pom @@ -30,7 +30,7 @@ org.apache.shardingsphere - shardingsphere-jdbc-core + shardingsphere-jdbc ${project.version} @@ -90,6 +90,21 @@ net.nicoulaj.maven.plugins checksum-maven-plugin + + maven-source-plugin + + + io.smallrye + jandex-maven-plugin + + + make-index + + jandex + + + + diff --git a/distribution/pom.xml b/distribution/pom.xml index 6b5e2133ba4a6..ddb8d87d82efa 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-distribution pom @@ -37,8 +37,6 @@ true - - 1.10 diff --git a/distribution/proxy-native/access-filter.json b/distribution/proxy-native/access-filter.json deleted file mode 100644 index a5c58ae341dcd..0000000000000 --- a/distribution/proxy-native/access-filter.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "rules": [ - {"includeClasses": "**"}, - {"excludeClasses": "com.atomikos.jdbc.**"}, - {"excludeClasses": "com.mchange.v2.c3p0.**"}, - {"excludeClasses": "com.mysql.jdbc.**"}, - {"excludeClasses": "com.zaxxer.hikari.**"}, - {"excludeClasses": "org.apache.commons.dbcp2.**"}, - {"excludeClasses": "org.junit.platform.launcher.**"}, - {"excludeClasses": "org.mariadb.jdbc.**"}, - {"excludeClasses": "org.apache.shardingsphere.sharding.UndefinedClass"} - ], - "regexRules": [ - {"excludeClasses": ".*Fixture*.*"}, - {"excludeClasses": ".*Mocked*.*"} - ] -} diff --git a/distribution/proxy-native/caller-filter.json b/distribution/proxy-native/caller-filter.json deleted file mode 100644 index da55d54f77156..0000000000000 --- a/distribution/proxy-native/caller-filter.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "rules": [ - {"excludeClasses": "**"}, - {"includeClasses": "org.apache.shardingsphere.**"} - ] -} diff --git a/distribution/proxy-native/pom.xml b/distribution/proxy-native/pom.xml index 7ef9c7114758d..47da6f62bf697 100644 --- a/distribution/proxy-native/pom.xml +++ b/distribution/proxy-native/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-distribution - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-proxy-native-distribution @@ -36,12 +36,11 @@ org.apache.shardingsphere shardingsphere-proxy-bootstrap ${project.version} - - - org.apache.shardingsphere - shardingsphere-cluster-mode-repository-etcd - - + + + org.apache.shardingsphere + shardingsphere-infra-reachability-metadata + ${project.version} @@ -78,24 +77,11 @@ release.native - true - true - true - true - true + 21 apache-shardingsphere-${project.version} - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - 17 - 17 - - org.graalvm.buildtools native-maven-plugin @@ -104,12 +90,8 @@ org.apache.shardingsphere.proxy.Bootstrap - --report-unsupported-elements-at-runtime - -J-Xmx7g + -H:+AddAllCharsets - - true - diff --git a/distribution/proxy-native/src/main/assembly/shardingsphere-proxy-native-binary-distribution.xml b/distribution/proxy-native/src/main/assembly/shardingsphere-proxy-native-binary-distribution.xml index f06f3bd268ced..383baaaf5d6fe 100644 --- a/distribution/proxy-native/src/main/assembly/shardingsphere-proxy-native-binary-distribution.xml +++ b/distribution/proxy-native/src/main/assembly/shardingsphere-proxy-native-binary-distribution.xml @@ -39,7 +39,7 @@ 0644 - src/main/release-docs + ../../distribution/proxy/src/main/release-docs **/* diff --git a/distribution/proxy-native/src/main/release-docs/LICENSE b/distribution/proxy-native/src/main/release-docs/LICENSE deleted file mode 100644 index f41740785cd91..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/LICENSE +++ /dev/null @@ -1,372 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -======================================================================= -Apache ShardingSphere Subcomponents: - -The Apache ShardingSphere project contains subcomponents with separate -copyright notices and license terms. Your use of the source code for these -subcomponents is subject to the terms and conditions of the following -licenses. - -======================================================================== -Apache 2.0 licenses -======================================================================== - -The following components are provided under the Apache License. See project link for details. -The text of each license is the standard Apache 2.0 license. - - accessors-smart 2.4.7: https://www.minidev.net/, Apache 2.0 - aggdesigner-algorithm 6.0: Apache 2.0 - apiguardian-api 1.1.2: https://github.com/apiguardian-team/apiguardian, Apache 2.0 - audience-annotations 0.12.0: https://github.com/apache/yetus, Apache 2.0 - avatica-core 1.23.0: https://calcite.apache.org/avatica, Apache 2.0 - avatica-metrics 1.23.0: https://calcite.apache.org/avatica, Apache 2.0 - caffeine 2.9.3: https://github.com/ben-manes/caffeine, Apache 2.0 - calcite-core 1.35.0: https://calcite.apache.org, Apache 2.0 - calcite-linq4j 1.35.0: https://calcite.apache.org, Apache 2.0 - commons-codec 1.15: https://github.com/apache/commons-codec, Apache 2.0 - commons-collections4 4.4: https://github.com/apache/commons-collections, Apache 2.0 - commons-exec 1.3: https://github.com/apache/commons-exec, Apache 2.0 - commons-io 2.11.0: https://github.com/apache/commons-io, Apache 2.0 - commons-lang 2.4: https://github.com/apache/commons-lang, Apache 2.0 - commons-lang3 3.12.0: https://github.com/apache/commons-lang, Apache 2.0 - commons-logging 1.1.3: https://github.com/apache/commons-logging, Apache 2.0 - curator-client 5.4.0: https://github.com/apache/curator, Apache 2.0 - curator-framework 5.4.0: https://github.com/apache/curator, Apache 2.0 - curator-recipes 5.4.0: https://github.com/apache/curator, Apache 2.0 - error_prone_annotations 2.11.0: https://github.com/google/error-prone, Apache 2.0 - failsafe 2.4.4: https://github.com/jhalterman/failsafe, Apache 2.0 - failureaccess 1.0.1: https://github.com/google/guava, Apache 2.0 - freemarker 2.3.31: https://freemarker.apache.org/, Apache 2.0 - groovy 4.0.10: https://groovy.apache.org/, Apache 2.0 - grpc-api 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-context 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-core 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-grpclb 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-netty 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-protobuf 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-protobuf-lite 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-stub 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - gson 2.9.1: https://github.com/google/gson, Apache 2.0 - guava 30.0-jre: https://github.com/google/guava, Apache 2.0 - HikariCP 4.0.3: https://github.com/brettwooldridge/HikariCP, Apache 2.0 - httpclient5 5.1.3: https://hc.apache.org/httpcomponents-client-5.1.x, Apache 2.0 - httpcore5-h2 5.1.3: https://hc.apache.org/httpcomponents-core-5.1.x, Apache 2.0 - httpcore5 5.1.3: https://hc.apache.org/httpcomponents-core-5.1.x, Apache 2.0 - jackson-annotations 2.14.0: http://github.com/FasterXML/jackson, Apache 2.0 - jackson-core 2.14.0: http://github.com/FasterXML/jackson, Apache 2.0 - jackson-databind 2.14.0: http://github.com/FasterXML/jackson, Apache 2.0 - jackson-dataformat-yaml 2.14.0: http://github.com/FasterXML/jackson, Apache 2.0 - jackson-datatype-jsr310 2.14.0: http://github.com/FasterXML/jackson, Apache 2.0 - jcl-over-slf4j 1.7.36: https://github.com/qos-ch/slf4j, Apache 2.0 - jetcd-api 0.7.5: https://github.com/etcd-io/jetcd, Apache 2.0 - jetcd-common 0.7.5: https://github.com/etcd-io/jetcd, Apache 2.0 - jetcd-core 0.7.5: https://github.com/etcd-io/jetcd, Apache 2.0 - jetcd-grpc 0.7.5: https://github.com/etcd-io/jetcd, Apache 2.0 - json-path 2.7.0: https://github.com/jayway/JsonPath, Apache 2.0 - json-smart 2.4.7: https://www.minidev.net/, Apache 2.0 - json-simple 1.1.1: https://code.google.com/archive/p/json-simple/, Apache 2.0 - jsr305 3.0.2: http://findbugs.sourceforge.net/, Apache 2.0 - memory 0.9.0, Apache 2.0 - netty-buffer 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-codec 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-codec-http 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-codec-http2 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-codec-socks 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-common 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-handler 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-handler-proxy 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-resolver 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-tcnative-boringssl-static 2.0.59.Final: https://github.com/netty/netty-tcnative, Apache 2.0 - netty-tcnative-boringssl-static 2.0.59.Final-linux-aarch_64: https://github.com/netty/netty-tcnative, Apache 2.0 - netty-tcnative-boringssl-static 2.0.59.Final-linux-x86_64: https://github.com/netty/netty-tcnative, Apache 2.0 - netty-tcnative-boringssl-static 2.0.59.Final-osx-aarch_64: https://github.com/netty/netty-tcnative, Apache 2.0 - netty-tcnative-boringssl-static 2.0.59.Final-osx-x86_64: https://github.com/netty/netty-tcnative, Apache 2.0 - netty-tcnative-boringssl-static 2.0.59.Final-windows-x86_64: https://github.com/netty/netty-tcnative, Apache 2.0 - netty-tcnative-classes 2.0.59.Final: https://github.com/netty/netty-tcnative, Apache 2.0 - netty-transport 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-transport-classes-epoll 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-transport-native-epoll 4.1.90.Final-linux-aarch_64: https://github.com/netty, Apache 2.0 - netty-transport-native-epoll 4.1.90.Final-linux-x86_64: https://github.com/netty, Apache 2.0 - netty-transport-native-unix-common 4.1.90.Final: https://github.com/netty, Apache 2.0 - perfmark-api 0.25.0: https://github.com/perfmark/perfmark, Apache 2.0 - proto-google-common-protos 2.9.0: https://github.com/googleapis/common-protos-java, Apache 2.0 - proj4j 1.1.5: https://github.com/locationtech/proj4j, Apache 2.0 - quartz 2.3.2: https://github.com/quartz-scheduler/quartz, Apache 2.0 - sketches-core 0.9.0, Apache 2.0 - snakeyaml 1.33: https://bitbucket.org/snakeyaml/snakeyaml, Apache 2.0 - transmittable-thread-local 2.14.2: https://github.com/alibaba/transmittable-thread-local, Apache 2.0 - uzaygezen-core 0.2: https://code.google.com/p/uzaygezen, Apache 2.0 - zookeeper 3.8.1: https://github.com/apache/zookeeper, Apache 2.0 - zookeeper-jute 3.8.1: https://github.com/apache/zookeeper, Apache 2.0 - -======================================================================== -Apache 2.0 licenses -======================================================================== - -The following components are provided under the Apache License. See project link for details. -The text of each license is also included at licenses/LICENSE-[project].txt. - - atomikos-util 6.0.0: https://www.atomikos.com, Apache 2.0 - transactions 6.0.0: https://www.atomikos.com, Apache 2.0 - transactions-api 6.0.0: https://www.atomikos.com, Apache 2.0 - transactions-jdbc 6.0.0: https://www.atomikos.com, Apache 2.0 - transactions-jta 6.0.0: https://www.atomikos.com, Apache 2.0 - -======================================================================== -BSD licenses -======================================================================== - -The following components are provided under a BSD license. See project link for details. -The text of each license is also included at licenses/LICENSE-[project].txt. - - antlr4-runtime 4.10.1: https://github.com/antlr/antlr4, BSD-3-Clause - asm 9.1: https://github.com/llbit/ow2-asm, BSD-3-Clause - commons-compiler 3.1.8: https://github.com/janino-compiler/janino, BSD-3-Clause - janino 3.1.9: https://github.com/janino-compiler/janino, BSD-3-Clause - opengauss-jdbc 3.1.0-og: https://gitee.com/opengauss/openGauss-connector-jdbc, BSD-2-Clause - postgresql 42.4.1: https://github.com/pgjdbc/pgjdbc, BSD-2-Clause - protobuf-java 3.21.12: https://github.com/protocolbuffers/protobuf/blob/master/java, BSD-3-Clause - protobuf-java-util 3.21.12: https://github.com/protocolbuffers/protobuf/blob/master/java, BSD-3-Clause - jts-io-common 1.19.0: https://github.com/locationtech/jts, EDL 1.0 - jts-core 1.19.0: https://github.com/locationtech/jts, EDL 1.0 - -======================================================================== -CDDL licenses -======================================================================== - -The following components are provided under the CDDL License. See project link for details. -The text of each license is also included at licenses/LICENSE-[project].txt. - - javax.activation-api 1.2.0: https://github.com/javaee/javax.annotation, CDDL - jta 1.1: http://jta-spec.java.net, CDDL - jaxb-api 2.3.0: http://www.oracle.com, CDDL - jaxb-core 2.3.0: http://www.oracle.com, CDDL - jaxb-impl 2.3.0 http://www.oracle.com, CDDL - -======================================================================== -EPL licenses -======================================================================== - -The following components are provided under the EPL License. See project link for details. -The text of each license is also included at licenses/LICENSE-[project].txt. - - logback-classic 1.2.11: https://github.com/qos-ch/logback, EPL 1.0 - logback-core 1.2.11: https://github.com/qos-ch/logback, EPL 1.0 - mchange-commons-java 0.2.15: https://github.com/swaldman/mchange-commons-java, EPL 1.0 - h2 2.1.214: https://github.com/h2database/h2database, EPL 1.0 - -======================================================================== -MIT licenses -======================================================================== - -The following components are provided under the MIT License. See project link for details. -The text of each license is also included at licenses/LICENSE-[project].txt. - - bcpkix-jdk15on 1.70: https://www.bouncycastle.org, MIT - bcprov-jdk15on 1.70: https://www.bouncycastle.org, MIT - bctls-jdk15on 1.70: https://www.bouncycastle.org, MIT - bcutil-jdk15on 1.70: https://www.bouncycastle.org, MIT - checker-qual 3.5.0: https://github.com/typetools/checker-framework/blob/master/checker-qual, MIT - jul-to-slf4j 1.7.36: https://www.slf4j.org, MIT - slf4j-api 1.7.36: https://www.slf4j.org, MIT diff --git a/distribution/proxy-native/src/main/release-docs/NOTICE b/distribution/proxy-native/src/main/release-docs/NOTICE deleted file mode 100644 index 4a9d35b1673f3..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/NOTICE +++ /dev/null @@ -1,389 +0,0 @@ -Apache ShardingSphere -Copyright 2018-2023 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -======================================================================== - -netty NOTICE - -======================================================================== - - The Netty Project - ================= - -Please visit the Netty web site for more information: - - * https://netty.io/ - -Copyright 2014 The Netty Project - -The Netty Project licenses this file to you under the Apache License, -version 2.0 (the "License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at: - - https://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -License for the specific language governing permissions and limitations -under the License. - -Also, please refer to each LICENSE..txt file, which is located in -the 'license' directory of the distribution file, for the license terms of the -components that this product depends on. - -------------------------------------------------------------------------------- -This product contains the extensions to Java Collections Framework which has -been derived from the works by JSR-166 EG, Doug Lea, and Jason T. Greene: - - * LICENSE: - * license/LICENSE.jsr166y.txt (Public Domain) - * HOMEPAGE: - * http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/ - * http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbosscache/experimental/jsr166/ - -This product contains a modified version of Robert Harder's Public Domain -Base64 Encoder and Decoder, which can be obtained at: - - * LICENSE: - * license/LICENSE.base64.txt (Public Domain) - * HOMEPAGE: - * http://iharder.sourceforge.net/current/java/base64/ - -This product contains a modified portion of 'Webbit', an event based -WebSocket and HTTP server, which can be obtained at: - - * LICENSE: - * license/LICENSE.webbit.txt (BSD License) - * HOMEPAGE: - * https://github.com/joewalnes/webbit - -This product contains a modified portion of 'SLF4J', a simple logging -facade for Java, which can be obtained at: - - * LICENSE: - * license/LICENSE.slf4j.txt (MIT License) - * HOMEPAGE: - * https://www.slf4j.org/ - -This product contains a modified portion of 'Apache Harmony', an open source -Java SE, which can be obtained at: - - * NOTICE: - * license/NOTICE.harmony.txt - * LICENSE: - * license/LICENSE.harmony.txt (Apache License 2.0) - * HOMEPAGE: - * https://archive.apache.org/dist/harmony/ - -This product contains a modified portion of 'jbzip2', a Java bzip2 compression -and decompression library written by Matthew J. Francis. It can be obtained at: - - * LICENSE: - * license/LICENSE.jbzip2.txt (MIT License) - * HOMEPAGE: - * https://code.google.com/p/jbzip2/ - -This product contains a modified portion of 'libdivsufsort', a C API library to construct -the suffix array and the Burrows-Wheeler transformed string for any input string of -a constant-size alphabet written by Yuta Mori. It can be obtained at: - - * LICENSE: - * license/LICENSE.libdivsufsort.txt (MIT License) - * HOMEPAGE: - * https://github.com/y-256/libdivsufsort - -This product contains a modified portion of Nitsan Wakart's 'JCTools', Java Concurrency Tools for the JVM, - which can be obtained at: - - * LICENSE: - * license/LICENSE.jctools.txt (ASL2 License) - * HOMEPAGE: - * https://github.com/JCTools/JCTools - -This product optionally depends on 'JZlib', a re-implementation of zlib in -pure Java, which can be obtained at: - - * LICENSE: - * license/LICENSE.jzlib.txt (BSD style License) - * HOMEPAGE: - * http://www.jcraft.com/jzlib/ - -This product optionally depends on 'Compress-LZF', a Java library for encoding and -decoding data in LZF format, written by Tatu Saloranta. It can be obtained at: - - * LICENSE: - * license/LICENSE.compress-lzf.txt (Apache License 2.0) - * HOMEPAGE: - * https://github.com/ning/compress - -This product optionally depends on 'lz4', a LZ4 Java compression -and decompression library written by Adrien Grand. It can be obtained at: - - * LICENSE: - * license/LICENSE.lz4.txt (Apache License 2.0) - * HOMEPAGE: - * https://github.com/jpountz/lz4-java - -This product optionally depends on 'lzma-java', a LZMA Java compression -and decompression library, which can be obtained at: - - * LICENSE: - * license/LICENSE.lzma-java.txt (Apache License 2.0) - * HOMEPAGE: - * https://github.com/jponge/lzma-java - -This product optionally depends on 'zstd-jni', a zstd-jni Java compression -and decompression library, which can be obtained at: - - * LICENSE: - * license/LICENSE.zstd-jni.txt (Apache License 2.0) - * HOMEPAGE: - * https://github.com/luben/zstd-jni - -This product contains a modified portion of 'jfastlz', a Java port of FastLZ compression -and decompression library written by William Kinney. It can be obtained at: - - * LICENSE: - * license/LICENSE.jfastlz.txt (MIT License) - * HOMEPAGE: - * https://code.google.com/p/jfastlz/ - -This product contains a modified portion of and optionally depends on 'Protocol Buffers', Google's data -interchange format, which can be obtained at: - - * LICENSE: - * license/LICENSE.protobuf.txt (New BSD License) - * HOMEPAGE: - * https://github.com/google/protobuf - -This product optionally depends on 'Bouncy Castle Crypto APIs' to generate -a temporary self-signed X.509 certificate when the JVM does not provide the -equivalent functionality. It can be obtained at: - - * LICENSE: - * license/LICENSE.bouncycastle.txt (MIT License) - * HOMEPAGE: - * https://www.bouncycastle.org/ - -This product optionally depends on 'Snappy', a compression library produced -by Google Inc, which can be obtained at: - - * LICENSE: - * license/LICENSE.snappy.txt (New BSD License) - * HOMEPAGE: - * https://github.com/google/snappy - -This product optionally depends on 'JBoss Marshalling', an alternative Java -serialization API, which can be obtained at: - - * LICENSE: - * license/LICENSE.jboss-marshalling.txt (Apache License 2.0) - * HOMEPAGE: - * https://github.com/jboss-remoting/jboss-marshalling - -This product optionally depends on 'Caliper', Google's micro- -benchmarking framework, which can be obtained at: - - * LICENSE: - * license/LICENSE.caliper.txt (Apache License 2.0) - * HOMEPAGE: - * https://github.com/google/caliper - -This product optionally depends on 'Apache Commons Logging', a logging -framework, which can be obtained at: - - * LICENSE: - * license/LICENSE.commons-logging.txt (Apache License 2.0) - * HOMEPAGE: - * https://commons.apache.org/logging/ - -This product optionally depends on 'Apache Log4J', a logging framework, which -can be obtained at: - - * LICENSE: - * license/LICENSE.log4j.txt (Apache License 2.0) - * HOMEPAGE: - * https://logging.apache.org/log4j/ - -This product optionally depends on 'Aalto XML', an ultra-high performance -non-blocking XML processor, which can be obtained at: - - * LICENSE: - * license/LICENSE.aalto-xml.txt (Apache License 2.0) - * HOMEPAGE: - * https://wiki.fasterxml.com/AaltoHome - -This product contains a modified version of 'HPACK', a Java implementation of -the HTTP/2 HPACK algorithm written by Twitter. It can be obtained at: - - * LICENSE: - * license/LICENSE.hpack.txt (Apache License 2.0) - * HOMEPAGE: - * https://github.com/twitter/hpack - -This product contains a modified version of 'HPACK', a Java implementation of -the HTTP/2 HPACK algorithm written by Cory Benfield. It can be obtained at: - - * LICENSE: - * license/LICENSE.hyper-hpack.txt (MIT License) - * HOMEPAGE: - * https://github.com/python-hyper/hpack/ - -This product contains a modified version of 'HPACK', a Java implementation of -the HTTP/2 HPACK algorithm written by Tatsuhiro Tsujikawa. It can be obtained at: - - * LICENSE: - * license/LICENSE.nghttp2-hpack.txt (MIT License) - * HOMEPAGE: - * https://github.com/nghttp2/nghttp2/ - -This product contains a modified portion of 'Apache Commons Lang', a Java library -provides utilities for the java.lang API, which can be obtained at: - - * LICENSE: - * license/LICENSE.commons-lang.txt (Apache License 2.0) - * HOMEPAGE: - * https://commons.apache.org/proper/commons-lang/ - - -This product contains the Maven wrapper scripts from 'Maven Wrapper', that provides an easy way to ensure a user has everything necessary to run the Maven build. - - * LICENSE: - * license/LICENSE.mvn-wrapper.txt (Apache License 2.0) - * HOMEPAGE: - * https://github.com/takari/maven-wrapper - -This product contains the dnsinfo.h header file, that provides a way to retrieve the system DNS configuration on MacOS. -This private header is also used by Apple's open source - mDNSResponder (https://opensource.apple.com/tarballs/mDNSResponder/). - - * LICENSE: - * license/LICENSE.dnsinfo.txt (Apple Public Source License 2.0) - * HOMEPAGE: - * https://www.opensource.apple.com/source/configd/configd-453.19/dnsinfo/dnsinfo.h - -This product optionally depends on 'Brotli4j', Brotli compression and -decompression for Java., which can be obtained at: - - * LICENSE: - * license/LICENSE.brotli4j.txt (Apache License 2.0) - * HOMEPAGE: - * https://github.com/hyperxpro/Brotli4j - -======================================================================== - -Apache groovy NOTICE - -======================================================================== - -Apache Groovy -Copyright 2003-2018 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -This product bundles icons from the famfamfam.com silk icons set -http://www.famfamfam.com/lab/icons/silk/ -Licensed under the Creative Commons Attribution Licence v2.5 -http://creativecommons.org/licenses/by/2.5/ - -======================================================================== - -Apache commons-codec NOTICE - -======================================================================== - -Apache Commons Codec -Copyright 2002-2017 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java -contains test data from http://aspell.net/test/orig/batch0.tab. -Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org) - -=============================================================================== - -The content of package org.apache.commons.codec.language.bm has been translated -from the original php source code available at http://stevemorse.org/phoneticinfo.htm -with permission from the original authors. -Original source copyright: -Copyright (c) 2008 Alexander Beider & Stephen P. Morse. - -======================================================================== - -Apache Commons Collections NOTICE - -======================================================================== - - -Apache Commons Collections -Copyright 2001-2018 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -======================================================================== - -Apache Curator NOTICE - -======================================================================== - -Apache Curator -Copyright 2013-2014 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -======================================================================== - -Apache log4j NOTICE - -======================================================================== - -Apache log4j -Copyright 2010 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -======================================================================== - -Apache ZooKeeper NOTICE - -======================================================================== - -Apache ZooKeeper -Copyright 2009-2014 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -This product includes software components originally -developed for Airlift (https://github.com/airlift/airlift), -licensed under the Apache 2.0 license. The licensing terms -for Airlift code can be found at: -https://github.com/airlift/airlift/blob/master/LICENSE - -======================================================================== - -Prometheus NOTICE - -======================================================================== - -Prometheus instrumentation library for JVM applications -Copyright 2012-2015 The Prometheus Authors - -This product includes software developed at -Boxever Ltd. (http://www.boxever.com/). - -This product includes software developed at -SoundCloud Ltd. (http://soundcloud.com/). - -This product includes software developed as part of the -Ocelli project by Netflix Inc. (https://github.com/Netflix/ocelli/). diff --git a/distribution/proxy-native/src/main/release-docs/README.txt b/distribution/proxy-native/src/main/release-docs/README.txt deleted file mode 100644 index 76f5b3fa93b48..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/README.txt +++ /dev/null @@ -1,53 +0,0 @@ -Welcome to Apache ShardingSphere -=============================================================================== - -Apache ShardingSphere is positioned as a Database Plus, and aims at building a standard layer and ecosystem above heterogeneous databases. -It focuses on how to reuse existing databases and their respective upper layer, rather than creating a new database. -The goal is to minimize or eliminate the challenges caused by underlying databases fragmentation. - -The concepts at the core of the project are Connect, Enhance and Pluggable. - -- `Connect:` Flexible adaptation of database protocol, SQL dialect and database storage. It can quickly connect applications and heterogeneous databases quickly. -- `Enhance:` Capture database access entry to provide additional features transparently, such as: redirect (sharding, readwrite-splitting and shadow), transform (data encrypt and mask), authentication (security, audit and authority), governance (circuit breaker and access limitation and analyze, QoS and observability). -- `Pluggable:` Leveraging the micro kernel and 3 layers pluggable mode, features and database ecosystem can be embedded flexibily. Developers can customize their ShardingSphere just like building with LEGO blocks. - -Apache ShardingSphere including 2 independent products: JDBC & Proxy. -They all provide functions of data scale-out, distributed transaction and distributed governance, -applicable in a variety of situations such as Java isomorphism, heterogeneous language and Cloud-Native. - -As the cornerstone of enterprises, the relational database has a huge market share. -Therefore, we prefer to focus on its incrementation instead of a total overturn. - -ShardingSphere-Proxy is a transparent database proxy, providing a database server that encapsulates database binary protocol to support heterogeneous languages. -Currently, MySQL and PostgreSQL protocols are provided. -It can use any kind of terminal that is compatible with MySQL or PostgreSQL protocol to operate data, which is more friendly to DBAs. - -- Transparent to applications, it can be used directly as MySQL/PostgreSQL; -- Compatible with MySQL-based databases, such as MariaDB, and PostgreSQL-based databases, such as openGauss; -- Applicable to any kind of client that is compatible with MySQL/PostgreSQL protocol, such as MySQL Command Client, MySQL Workbench, etc. - -The advantages of ShardingSphere-Proxy lie in supporting heterogeneous languages and providing operational entries for DBA. - -Getting Started -=============================================================================== -To help you get started, try the following links: - -Getting Started - https://shardingsphere.apache.org/document/current/en/quick-start/shardingsphere-proxy-quick-start/ - -We welcome contributions of all kinds, for details of how you can help - https://shardingsphere.apache.org/community/en/involved/ - -Find the issue tracker from here - https://github.com/apache/shardingsphere/issues - -Please help us make Apache ShardingSphere better - we appreciate any feedback you may have. - -Have fun! - ------------------ - -Licensing -=============================================================================== - -This software is licensed under the terms you may find in the file named "LICENSE" in this directory. diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-Janino.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-Janino.txt deleted file mode 100644 index af6ced3ad889f..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-Janino.txt +++ /dev/null @@ -1,34 +0,0 @@ -Janino License ---------------- - -Janino - An embedded Java[TM] compiler - -Copyright (c) 2001-2016, Arno Unkrig -Copyright (c) 2015-2016 TIBCO Software Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials - provided with the distribution. - 3. Neither the name of JANINO nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-antlr4-runtime.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-antlr4-runtime.txt deleted file mode 100644 index e4c39aa125d2a..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-antlr4-runtime.txt +++ /dev/null @@ -1,55 +0,0 @@ -ANTLR 4 License ---------------- - -[The "BSD 3-clause license"] -Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -===== - -MIT License for codepointat.js from https://git.io/codepointat -MIT License for fromcodepoint.js from https://git.io/vDW1m - -Copyright Mathias Bynens - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-asm.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-asm.txt deleted file mode 100644 index 66c8f6b7c0fa3..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-asm.txt +++ /dev/null @@ -1,30 +0,0 @@ -ASM License ---------------- - -ASM: a very small and fast Java bytecode manipulation framework -Copyright (c) 2000-2011 INRIA, France Telecom -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-atomikos.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-atomikos.txt deleted file mode 100644 index 47f772c122bc5..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-atomikos.txt +++ /dev/null @@ -1,225 +0,0 @@ -Atomikos License ---------------- - -This code X, by itself, is being distributed under the - Apache License, Version 2.0 ("AL"), - the terms of which may be found below. - - You may not use this code except in compliance with the AL. - - While the AL grants certain patent license rights, - those patent license rights only extend to the use of code X by itself. - This code X contains certain interfaces - (including com.atomikos.icatch.Participant) which, if implemented, may - infringe one or more patents held by Atomikos. - It should be appreciated that you may NOT implement such interfaces; - licensing to implement these interfaces must be obtained separately - from Atomikos. - - Unless required by applicable law or agreed to in writing, software - distributed under the AL is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - ------------------------------------------------------------------------ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-bouncy-castle.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-bouncy-castle.txt deleted file mode 100644 index d9faf7181dd15..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-bouncy-castle.txt +++ /dev/null @@ -1,15 +0,0 @@ -Bouncy Castle License ---------------- - -Please note this should be read in the same way as the MIT license. - -Please also note this licensing model is made possible through funding from donations and the sale of support contracts. - -LICENSE -Copyright (c) 2000 - 2023 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-checker-qual.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-checker-qual.txt deleted file mode 100644 index 844259c28aabb..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-checker-qual.txt +++ /dev/null @@ -1,25 +0,0 @@ -checker qual License ---------------- - -Checker Framework qualifiers -Copyright 2004-present by the Checker Framework developers - -MIT License: - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-h2.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-h2.txt deleted file mode 100644 index 72c5485af3340..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-h2.txt +++ /dev/null @@ -1,555 +0,0 @@ -H2 License ---------------- - -H2 is dual licensed and available under the MPL 2.0 (Mozilla Public License -Version 2.0) or under the EPL 1.0 (Eclipse Public License). - -------------------------------------------------------------------------------- - -Mozilla Public License, version 2.0 - -1. Definitions - - 1.1. “Contributor” - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - - 1.2. “Contributor Version” - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - - 1.3. “Contribution” - means Covered Software of a particular Contributor. - - 1.4. “Covered Software” - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, - and Modifications of such Source Code Form, in each case - including portions thereof. - - 1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the terms - of a Secondary License. - - 1.6. “Executable Form” - means any form of the work other than Source Code Form. - - 1.7. “Larger Work” - means a work that combines Covered Software with other material, - in a separate file or files, that is not Covered Software. - - 1.8. “License” - means this document. - - 1.9. “Licensable” - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, - any and all of the rights conveyed by this License. - - 1.10. “Modifications” - means any of the following: - - a. any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - - 1.11. “Patent Claims” of a Contributor - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - - 1.12. “Secondary License” - means either the GNU General Public License, Version 2.0, the - GNU Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those licenses. - - 1.13. “Source Code Form” - means the form of the work preferred for making modifications. - - 1.14. “You” (or “Your”) - means an individual or a legal entity exercising rights under this License. - For legal entities, “You” includes any entity that controls, - is controlled by, or is under common control with You. For purposes of - this definition, “control” means (a) the power, direct or indirect, - to cause the direction or management of such entity, whether by contract - or otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - -2. License Grants and Conditions - - 2.1. Grants - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, - or as part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, - offer for sale, have made, import, and otherwise transfer either - its Contributions or its Contributor Version. - - 2.2. Effective Date - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor - first distributes such Contribution. - - 2.3. Limitations on Grant Scope - The licenses granted in this Section 2 are the only rights granted - under this License. No additional rights or licenses will be implied - from the distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted - by a Contributor: - - a. for any code that a Contributor has removed from - Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its - Contributor Version); or - - c. under Patent Claims infringed by Covered Software in the - absence of its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - - 2.4. Subsequent Licenses - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License - (if permitted under the terms of Section 3.3). - - 2.5. Representation - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights - to grant the rights to its Contributions conveyed by this License. - - 2.6. Fair Use - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, - or other equivalents. - - 2.7. Conditions - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the - licenses granted in Section 2.1. - -3. Responsibilities - - 3.1. Distribution of Source Form - All distribution of Covered Software in Source Code Form, including - any Modifications that You create or to which You contribute, must be - under the terms of this License. You must inform recipients that the - Source Code Form of the Covered Software is governed by the terms - of this License, and how they can obtain a copy of this License. - You may not attempt to alter or restrict the recipients’ rights - in the Source Code Form. - - 3.2. Distribution of Executable Form - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more than - the cost of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients’ rights in the Source Code Form under this License. - - 3.3. Distribution of a Larger Work - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of - Covered Software with a work governed by one or more Secondary Licenses, - and the Covered Software is not Incompatible With Secondary Licenses, - this License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the - Covered Software under the terms of either this License or such - Secondary License(s). - - 3.4. Notices - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, - or limitations of liability) contained within the Source Code Form of - the Covered Software, except that You may alter any license notices to - the extent required to remedy known factual inaccuracies. - - 3.5. Application of Additional Terms - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of - Covered Software. However, You may do so only on Your own behalf, - and not on behalf of any Contributor. You must make it absolutely clear - that any such warranty, support, indemnity, or liability obligation is - offered by You alone, and You hereby agree to indemnify every Contributor - for any liability incurred by such Contributor as a result of warranty, - support, indemnity or liability terms You offer. You may include - additional disclaimers of warranty and limitations of liability - specific to any jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - -If it is impossible for You to comply with any of the terms of this License -with respect to some or all of the Covered Software due to statute, -judicial order, or regulation then You must: (a) comply with the terms of -this License to the maximum extent possible; and (b) describe the limitations -and the code they affect. Such description must be placed in a text file -included with all distributions of the Covered Software under this License. -Except to the extent prohibited by statute or regulation, such description -must be sufficiently detailed for a recipient of ordinary skill -to be able to understand it. - -5. Termination - - 5.1. The rights granted under this License will terminate automatically - if You fail to comply with any of its terms. However, if You become - compliant, then the rights granted under this License from a particular - Contributor are reinstated (a) provisionally, unless and until such - Contributor explicitly and finally terminates Your grants, and (b) on an - ongoing basis, if such Contributor fails to notify You of the - non-compliance by some reasonable means prior to 60 days after You have - come back into compliance. Moreover, Your grants from a particular - Contributor are reinstated on an ongoing basis if such Contributor - notifies You of the non-compliance by some reasonable means, - this is the first time You have received notice of non-compliance with - this License from such Contributor, and You become compliant prior to - 30 days after Your receipt of the notice. - - 5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted - to You by any and all Contributors for the Covered Software under - Section 2.1 of this License shall terminate. - - 5.3. In the event of termination under Sections 5.1 or 5.2 above, all - end user license agreements (excluding distributors and resellers) which - have been validly granted by You or Your distributors under this License - prior to termination shall survive termination. - -6. Disclaimer of Warranty - -Covered Software is provided under this License on an “as is” basis, without -warranty of any kind, either expressed, implied, or statutory, including, -without limitation, warranties that the Covered Software is free of defects, -merchantable, fit for a particular purpose or non-infringing. The entire risk -as to the quality and performance of the Covered Software is with You. -Should any Covered Software prove defective in any respect, You -(not any Contributor) assume the cost of any necessary servicing, repair, -or correction. This disclaimer of warranty constitutes an essential part of -this License. No use of any Covered Software is authorized under this -License except under this disclaimer. - -7. Limitation of Liability - -Under no circumstances and under no legal theory, whether tort -(including negligence), contract, or otherwise, shall any Contributor, or -anyone who distributes Covered Software as permitted above, be liable to -You for any direct, indirect, special, incidental, or consequential damages -of any character including, without limitation, damages for lost profits, -loss of goodwill, work stoppage, computer failure or malfunction, or any and -all other commercial damages or losses, even if such party shall have been -informed of the possibility of such damages. This limitation of liability -shall not apply to liability for death or personal injury resulting from -such party’s negligence to the extent applicable law prohibits such -limitation. Some jurisdictions do not allow the exclusion or limitation of -incidental or consequential damages, so this exclusion and limitation may -not apply to You. - -8. Litigation - -Any litigation relating to this License may be brought only in the courts of -a jurisdiction where the defendant maintains its principal place of business -and such litigation shall be governed by laws of that jurisdiction, without -reference to its conflict-of-law provisions. Nothing in this Section shall -prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - -This License represents the complete agreement concerning the subject matter -hereof. If any provision of this License is held to be unenforceable, -such provision shall be reformed only to the extent necessary to make it -enforceable. Any law or regulation which provides that the language of a -contract shall be construed against the drafter shall not be used to construe -this License against a Contributor. - -10. Versions of the License - - 10.1. New Versions - Mozilla Foundation is the license steward. Except as provided in - Section 10.3, no one other than the license steward has the right to - modify or publish new versions of this License. Each version will be - given a distinguishing version number. - - 10.2. Effect of New Versions - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published - by the license steward. - - 10.3. Modified Versions - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - - 10.4. Distributing Source Code Form that is - Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is - Incompatible With Secondary Licenses under the terms of this version of - the License, the notice described in Exhibit B of this - License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the terms of the - Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed - with this file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, -then You may include the notice in a location (such as a LICENSE file in a -relevant directory) where a recipient would be likely to -look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible With Secondary Licenses”, - as defined by the Mozilla Public License, v. 2.0. - -------------------------------------------------------------------------------- - -Eclipse Public License, Version 1.0 (EPL-1.0) - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC -LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM -CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - - a) in the case of the initial Contributor, the initial code and - documentation distributed under this Agreement, and - - b) in the case of each subsequent Contributor: - i) changes to the Program, and - ii) additions to the Program; - -where such changes and/or additions to the Program originate from and are -distributed by that particular Contributor. A Contribution 'originates' -from a Contributor if it was added to the Program by such Contributor itself -or anyone acting on such Contributor's behalf. Contributions do not include -additions to the Program which: (i) are separate modules of software -distributed in conjunction with the Program under their own license agreement, -and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor which are -necessarily infringed by the use or sale of its Contribution alone or -when combined with the Program. - -"Program" means the Contributions distributed in accordance with -this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, -including all Contributors. - -2. GRANT OF RIGHTS - - a) Subject to the terms of this Agreement, each Contributor hereby grants - Recipient a non-exclusive, worldwide, royalty-free copyright license to - reproduce, prepare derivative works of, publicly display, publicly - perform, distribute and sublicense the Contribution of such - Contributor, if any, and such derivative works, - in source code and object code form. - - b) Subject to the terms of this Agreement, each Contributor hereby grants - Recipient a non-exclusive, worldwide, royalty-free patent license under - Licensed Patents to make, use, sell, offer to sell, import and - otherwise transfer the Contribution of such Contributor, if any, - in source code and object code form. This patent license shall apply - to the combination of the Contribution and the Program if, at the time - the Contribution is added by the Contributor, such addition of the - Contribution causes such combination to be covered by the - Licensed Patents. The patent license shall not apply to any other - combinations which include the Contribution. - No hardware per se is licensed hereunder. - - c) Recipient understands that although each Contributor grants the - licenses to its Contributions set forth herein, no assurances are - provided by any Contributor that the Program does not infringe the - patent or other intellectual property rights of any other entity. - Each Contributor disclaims any liability to Recipient for claims - brought by any other entity based on infringement of intellectual - property rights or otherwise. As a condition to exercising the - rights and licenses granted hereunder, each Recipient hereby assumes - sole responsibility to secure any other intellectual property rights - needed, if any. For example, if a third party patent license is - required to allow Recipient to distribute the Program, it is - Recipient's responsibility to acquire that license - before distributing the Program. - - d) Each Contributor represents that to its knowledge it has sufficient - copyright rights in its Contribution, if any, to grant the copyright - license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under -its own license agreement, provided that: - - a) it complies with the terms and conditions of this Agreement; and - - b) its license agreement: - - i) effectively disclaims on behalf of all Contributors all warranties - and conditions, express and implied, including warranties or - conditions of title and non-infringement, and implied warranties or - conditions of merchantability and fitness for a particular purpose; - - ii) effectively excludes on behalf of all Contributors all liability - for damages, including direct, indirect, special, incidental and - consequential damages, such as lost profits; - - iii) states that any provisions which differ from this Agreement are - offered by that Contributor alone and not by any other party; and - - iv) states that source code for the Program is available from such - Contributor, and informs licensees how to obtain it in a reasonable - manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - - a) it must be made available under this Agreement; and - b) a copy of this Agreement must be included with each copy of the Program. - -Contributors may not remove or alter any copyright notices contained -within the Program. - -Each Contributor must identify itself as the originator of its Contribution, -if any, in a manner that reasonably allows subsequent Recipients to -identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with -respect to end users, business partners and the like. While this license is -intended to facilitate the commercial use of the Program, the Contributor who -includes the Program in a commercial product offering should do so in a manner -which does not create potential liability for other Contributors. Therefore, -if a Contributor includes the Program in a commercial product offering, -such Contributor ("Commercial Contributor") hereby agrees to defend and -indemnify every other Contributor ("Indemnified Contributor") against any -losses, damages and costs (collectively "Losses") arising from claims, -lawsuits and other legal actions brought by a third party against the -Indemnified Contributor to the extent caused by the acts or omissions of -such Commercial Contributor in connection with its distribution of the Program -in a commercial product offering. The obligations in this section do not apply -to any claims or Losses relating to any actual or alleged intellectual -property infringement. In order to qualify, an Indemnified Contributor must: -a) promptly notify the Commercial Contributor in writing of such claim, -and b) allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such -claim at its own expense. - -For example, a Contributor might include the Program in a commercial product -offering, Product X. That Contributor is then a Commercial Contributor. -If that Commercial Contributor then makes performance claims, or offers -warranties related to Product X, those performance claims and warranties -are such Commercial Contributor's responsibility alone. Under this section, -the Commercial Contributor would have to defend claims against the other -Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, -the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR -IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. -Each Recipient is solely responsible for determining the appropriateness of -using and distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to the -risks and costs of program errors, compliance with applicable laws, damage to -or loss of data, programs or equipment, and unavailability -or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY -CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION -LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE -EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of the -remainder of the terms of this Agreement, and without further action by -the parties hereto, such provision shall be reformed to the minimum extent -necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Program itself -(excluding combinations of the Program with other software or hardware) -infringes such Recipient's patent(s), then such Recipient's rights granted -under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to -comply with any of the material terms or conditions of this Agreement and -does not cure such failure in a reasonable period of time after becoming -aware of such noncompliance. If all Recipient's rights under this -Agreement terminate, Recipient agrees to cease use and distribution of the -Program as soon as reasonably practicable. However, Recipient's obligations -under this Agreement and any licenses granted by Recipient relating to the -Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and may -only be modified in the following manner. The Agreement Steward reserves -the right to publish new versions (including revisions) of this Agreement -from time to time. No one other than the Agreement Steward has the right to -modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version -of the Agreement under which it was received. In addition, after a new version -of the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly -stated in Sections 2(a) and 2(b) above, Recipient receives no rights or -licenses to the intellectual property of any Contributor under this Agreement, -whether expressly, by implication, estoppel or otherwise. All rights in the -Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the -intellectual property laws of the United States of America. No party to -this Agreement will bring a legal action under this Agreement more than one -year after the cause of action arose. Each party waives its rights to a -jury trial in any resulting litigation. diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-javax.annotation-api.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-javax.annotation-api.txt deleted file mode 100644 index b1c74f95ede8b..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-javax.annotation-api.txt +++ /dev/null @@ -1,759 +0,0 @@ -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 - -1. Definitions. - - 1.1. "Contributor" means each individual or entity that creates or - contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Software, prior Modifications used by a Contributor (if any), and - the Modifications made by that particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or (b) - Modifications, or (c) the combination of files containing Original - Software with files containing Modifications, in each case including - portions thereof. - - 1.4. "Executable" means the Covered Software in any form other than - Source Code. - - 1.5. "Initial Developer" means the individual or entity that first - makes Original Software available under this License. - - 1.6. "Larger Work" means a work which combines Covered Software or - portions thereof with code not governed by the terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable form of - any of the following: - - A. Any file that results from an addition to, deletion from or - modification of the contents of a file containing Original Software - or previous Modifications; - - B. Any new file that contains any part of the Original Software or - previous Modification; or - - C. Any new file that is contributed or otherwise made available - under the terms of this License. - - 1.10. "Original Software" means the Source Code and Executable form - of computer software code that is originally released under this - License. - - 1.11. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer software - code in which modifications are made and (b) associated - documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, - this License. For legal entities, "You" includes any entity which - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, the Initial Developer - hereby grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer, to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Software (or portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using or selling of - Original Software, to make, have made, use, practice, sell, and - offer for sale, and/or otherwise dispose of the Original Software - (or portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) are effective on - the date Initial Developer first distributes or otherwise makes the - Original Software available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: (1) for code that You delete from the Original Software, or - (2) for infringements caused by: (i) the modification of the - Original Software, or (ii) the combination of the Original Software - with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, each Contributor hereby - grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as Covered Software - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling - of Modifications made by that Contributor either alone and/or in - combination with its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, have made, and/or - otherwise dispose of: (1) Modifications made by that Contributor (or - portions thereof); and (2) the combination of Modifications made by - that Contributor with its Contributor Version (or portions of such - combination). - - (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective - on the date Contributor first distributes or otherwise makes the - Modifications available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: (1) for any code that Contributor has deleted from the - Contributor Version; (2) for infringements caused by: (i) third - party modifications of Contributor Version, or (ii) the combination - of Modifications made by that Contributor with other software - (except as part of the Contributor Version) or other devices; or (3) - under Patent Claims infringed by Covered Software in the absence of - Modifications made by that Contributor. - -3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make available - in Executable form must also be made available in Source Code form - and that Source Code form must be distributed only under the terms - of this License. You must include a copy of this License with every - copy of the Source Code form of the Covered Software You distribute - or otherwise make available. You must inform recipients of any such - Covered Software in Executable form as to how they can obtain such - Covered Software in Source Code form in a reasonable manner on or - through a medium customarily used for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You contribute are - governed by the terms of this License. You represent that You - believe Your Modifications are Your original creation(s) and/or You - have sufficient rights to grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications that - identifies You as the Contributor of the Modification. You may not - remove or alter any copyright, patent or trademark notices contained - within the Covered Software, or any notices of licensing or any - descriptive text giving attribution to any Contributor or the - Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered Software in - Source Code form that alters or restricts the applicable version of - this License or the recipients' rights hereunder. You may choose to - offer, and to charge a fee for, warranty, support, indemnity or - liability obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on behalf of - the Initial Developer or any Contributor. You must make it - absolutely clear that any such warranty, support, indemnity or - liability obligation is offered by You alone, and You hereby agree - to indemnify the Initial Developer and every Contributor for any - liability incurred by the Initial Developer or such Contributor as a - result of warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered Software under - the terms of this License or under the terms of a license of Your - choice, which may contain terms different from this License, - provided that You are in compliance with the terms of this License - and that the license for the Executable form does not attempt to - limit or alter the recipient's rights in the Source Code form from - the rights set forth in this License. If You distribute the Covered - Software in Executable form under a different license, You must make - it absolutely clear that any terms which differ from this License - are offered by You alone, not by the Initial Developer or - Contributor. You hereby agree to indemnify the Initial Developer and - every Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software with - other code not governed by the terms of this License and distribute - the Larger Work as a single product. In such a case, You must make - sure the requirements of this License are fulfilled for the Covered - Software. - -4. Versions of the License. - - 4.1. New Versions. - - Oracle is the initial license steward and may publish revised and/or - new versions of this License from time to time. Each version will be - given a distinguishing version number. Except as provided in Section - 4.3, no one other than the license steward has the right to modify - this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise make the - Covered Software available under the terms of the version of the - License under which You originally received the Covered Software. If - the Initial Developer includes a notice in the Original Software - prohibiting it from being distributed or otherwise made available - under any subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the version - of the License under which You originally received the Covered - Software. Otherwise, You may also choose to use, distribute or - otherwise make the Covered Software available under the terms of any - subsequent version of the License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a new - license for Your Original Software, You may create and use a - modified version of this License if You: (a) rename the license and - remove any references to the name of the license steward (except to - note that the license differs from this License); and (b) otherwise - make it clear that the license contains terms which differ from this - License. - -5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE - IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR - NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE - DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY - OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, - REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN - ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS - AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -6. TERMINATION. - - 6.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to - cure such breach within 30 days of becoming aware of the breach. - Provisions which, by their nature, must remain in effect beyond the - termination of this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or a - Contributor (the Initial Developer or Contributor against whom You - assert such claim is referred to as "Participant") alleging that the - Participant Software (meaning the Contributor Version where the - Participant is a Contributor or the Original Software where the - Participant is the Initial Developer) directly or indirectly - infringes any patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial Developer (if the - Initial Developer is not the Participant) and all Contributors under - Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice - from Participant terminate prospectively and automatically at the - expiration of such 60 day notice period, unless if within such 60 - day period You withdraw Your claim with respect to the Participant - Software against such Participant either unilaterally or pursuant to - a written agreement with Participant. - - 6.3. If You assert a patent infringement claim against Participant - alleging that the Participant Software directly or indirectly - infringes any patent where such claim is resolved (such as by - license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 6.4. In the event of termination under Sections 6.1 or 6.2 above, - all end user licenses that have been validly granted by You or any - distributor hereunder prior to termination (excluding licenses - granted to You by any distributor) shall survive termination. - -7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE - TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER - FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR - LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE - POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT - APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH - PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH - LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR - LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION - AND LIMITATION MAY NOT APPLY TO YOU. - -8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is defined - in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" (as that term is defined at 48 C.F.R. § - 252.227-7014(a)(1)) and "commercial computer software documentation" - as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent - with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 - (June 1995), all U.S. Government End Users acquire Covered Software - with only those rights set forth herein. This U.S. Government Rights - clause is in lieu of, and supersedes, any other FAR, DFAR, or other - clause or provision that addresses Government rights in computer - software under this License. - -9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - the law of the jurisdiction specified in a notice contained within - the Original Software (except to the extent applicable law, if any, - provides otherwise), excluding such jurisdiction's conflict-of-law - provisions. Any litigation relating to this License shall be subject - to the jurisdiction of the courts located in the jurisdiction and - venue specified in a notice contained within the Original Software, - with the losing party responsible for costs, including, without - limitation, court costs and reasonable attorneys' fees and expenses. - The application of the United Nations Convention on Contracts for - the International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall be - construed against the drafter shall not apply to this License. You - agree that You alone are responsible for compliance with the United - States export administration regulations (and the export control - laws and regulation of any other countries) when You use, distribute - or otherwise make available any Covered Software. - -10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - ------------------------------------------------------------------------- - -NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION -LICENSE (CDDL) - -The code released under the CDDL shall be governed by the laws of the -State of California (excluding conflict-of-law provisions). Any -litigation relating to this License shall be subject to the jurisdiction -of the Federal Courts of the Northern District of California and the -state courts of the State of California, with venue lying in Santa Clara -County, California. - - - - The GNU General Public License (GPL) Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor -Boston, MA 02110-1335 -USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to -share and change it. By contrast, the GNU General Public License is -intended to guarantee your freedom to share and change free software--to -make sure the software is free for all its users. This General Public -License applies to most of the Free Software Foundation's software and -to any other program whose authors commit to using it. (Some other Free -Software Foundation software is covered by the GNU Library General -Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. -Our General Public Licenses are designed to make sure that you have the -freedom to distribute copies of free software (and charge for this -service if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone -to deny you these rights or to ask you to surrender the rights. These -restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis -or for a fee, you must give the recipients all the rights that you have. -You must make sure that they, too, receive or can get the source code. -And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -Finally, any free program is threatened constantly by software patents. -We wish to avoid the danger that redistributors of a free program will -individually obtain patent licenses, in effect making the program -proprietary. To prevent this, we have made it clear that any patent must -be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and -modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a -notice placed by the copyright holder saying it may be distributed under -the terms of this General Public License. The "Program", below, refers -to any such program or work, and a "work based on the Program" means -either the Program or any derivative work under copyright law: that is -to say, a work containing the Program or a portion of it, either -verbatim or with modifications and/or translated into another language. -(Hereinafter, translation is included without limitation in the term -"modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of running -the Program is not restricted, and the output from the Program is -covered only if its contents constitute a work based on the Program -(independent of having been made by running the Program). Whether that -is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each copy an appropriate copyright notice -and disclaimer of warranty; keep intact all the notices that refer to -this License and to the absence of any warranty; and give any other -recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of -it, thus forming a work based on the Program, and copy and distribute -such modifications or work under the terms of Section 1 above, provided -that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any part - thereof, to be licensed as a whole at no charge to all third parties - under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this License. - (Exception: if the Program itself is interactive but does not - normally print such an announcement, your work based on the Program - is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, and -can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based on -the Program, the distribution of the whole must be on the terms of this -License, whose permissions for other licensees extend to the entire -whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of a -storage or distribution medium does not bring the other work under the -scope of this License. - -3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your cost - of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed - only for noncommercial distribution and only if you received the - program in object code or executable form with such an offer, in - accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source code -means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to control -compilation and installation of the executable. However, as a special -exception, the source code distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies the -executable. - -If distribution of executable or object code is made by offering access -to copy from a designated place, then offering equivalent access to copy -the source code from the same place counts as distribution of the source -code, even though third parties are not compelled to copy the source -along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt otherwise -to copy, modify, sublicense or distribute the Program is void, and will -automatically terminate your rights under this License. However, parties -who have received copies, or rights, from you under this License will -not have their licenses terminated so long as such parties remain in -full compliance. - -5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and all -its terms and conditions for copying, distributing or modifying the -Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further restrictions -on the recipients' exercise of the rights granted herein. You are not -responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot distribute -so as to satisfy simultaneously your obligations under this License and -any other pertinent obligations, then as a consequence you may not -distribute the Program at all. For example, if a patent license would -not permit royalty-free redistribution of the Program by all those who -receive copies directly or indirectly through you, then the only way you -could satisfy both it and this License would be to refrain entirely from -distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is implemented -by public license practices. Many people have made generous -contributions to the wide range of software distributed through that -system in reliance on consistent application of that system; it is up to -the author/donor to decide if he or she is willing to distribute -software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be -a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License may -add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among countries -not thus excluded. In such case, this License incorporates the -limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new -versions of the General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Program does not specify a version -number of this License, you may choose any version ever published by the -Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the -author to ask for permission. For software which is copyrighted by the -Free Software Foundation, write to the Free Software Foundation; we -sometimes make exceptions for this. Our decision will be guided by the -two goals of preserving the free status of all derivatives of our free -software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, -EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH -YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL -NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR -DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL -DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM -(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF -THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR -OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type - `show w'. This is free software, and you are welcome to redistribute - it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the commands -you use may be called something other than `show w' and `show c'; they -could even be mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (which makes passes at compilers) written by - James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications -with the library. If this is what you want to do, use the GNU Library -General Public License instead of this License. - -# - -Certain source files distributed by Oracle America, Inc. and/or its -affiliates are subject to the following clarification and special -exception to the GPLv2, based on the GNU Project exception for its -Classpath libraries, known as the GNU Classpath Exception, but only -where Oracle has expressly included in the particular source file's -header the words "Oracle designates this particular file as subject to -the "Classpath" exception as provided by Oracle in the LICENSE file -that accompanied this code." - -You should also note that Oracle includes multiple, independent -programs in this software package. Some of those programs are provided -under licenses deemed incompatible with the GPLv2 by the Free Software -Foundation and others. For example, the package includes programs -licensed under the Apache License, Version 2.0. Such programs are -licensed to you under their original licenses. - -Oracle facilitates your further distribution of this package by adding -the Classpath Exception to the necessary parts of its GPLv2 code, which -permits you to use that code in combination with other independent -modules not licensed under the GPLv2. However, note that this would -not permit you to commingle code under an incompatible license with -Oracle's GPLv2 licensed code by, for example, cutting and pasting such -code into a file also containing Oracle's GPLv2 licensed code and then -distributing the result. Additionally, if you were to remove the -Classpath Exception from any of the files to which it applies and -distribute the result, you would likely be required to license some or -all of the other code in that distribution under the GPLv2 as well, and -since the GPLv2 is incompatible with the license terms of some items -included in the distribution by Oracle, removing the Classpath -Exception could therefore effectively compromise your ability to -further distribute the package. - -Proceed with caution and we recommend that you obtain the advice of a -lawyer skilled in open source matters before removing the Classpath -Exception or making modifications to this package which may -subsequently be redistributed and/or involve the use of third party -software. - -CLASSPATH EXCEPTION -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License version 2 cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from or -based on this library. If you modify this library, you may extend this -exception to your version of the library, but you are not obligated to -do so. If you do not wish to do so, delete this exception statement -from your version. diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-jta.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-jta.txt deleted file mode 100644 index 3f930c9839d2e..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-jta.txt +++ /dev/null @@ -1,762 +0,0 @@ -jta License ---------------- - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 - -1. Definitions. - - 1.1. "Contributor" means each individual or entity that creates or - contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Software, prior Modifications used by a Contributor (if any), and - the Modifications made by that particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or (b) - Modifications, or (c) the combination of files containing Original - Software with files containing Modifications, in each case including - portions thereof. - - 1.4. "Executable" means the Covered Software in any form other than - Source Code. - - 1.5. "Initial Developer" means the individual or entity that first - makes Original Software available under this License. - - 1.6. "Larger Work" means a work which combines Covered Software or - portions thereof with code not governed by the terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable form of - any of the following: - - A. Any file that results from an addition to, deletion from or - modification of the contents of a file containing Original Software - or previous Modifications; - - B. Any new file that contains any part of the Original Software or - previous Modification; or - - C. Any new file that is contributed or otherwise made available - under the terms of this License. - - 1.10. "Original Software" means the Source Code and Executable form - of computer software code that is originally released under this - License. - - 1.11. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer software - code in which modifications are made and (b) associated - documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, - this License. For legal entities, "You" includes any entity which - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, the Initial Developer - hereby grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer, to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Software (or portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using or selling of - Original Software, to make, have made, use, practice, sell, and - offer for sale, and/or otherwise dispose of the Original Software - (or portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) are effective on - the date Initial Developer first distributes or otherwise makes the - Original Software available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: (1) for code that You delete from the Original Software, or - (2) for infringements caused by: (i) the modification of the - Original Software, or (ii) the combination of the Original Software - with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, each Contributor hereby - grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as Covered Software - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling - of Modifications made by that Contributor either alone and/or in - combination with its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, have made, and/or - otherwise dispose of: (1) Modifications made by that Contributor (or - portions thereof); and (2) the combination of Modifications made by - that Contributor with its Contributor Version (or portions of such - combination). - - (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective - on the date Contributor first distributes or otherwise makes the - Modifications available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: (1) for any code that Contributor has deleted from the - Contributor Version; (2) for infringements caused by: (i) third - party modifications of Contributor Version, or (ii) the combination - of Modifications made by that Contributor with other software - (except as part of the Contributor Version) or other devices; or (3) - under Patent Claims infringed by Covered Software in the absence of - Modifications made by that Contributor. - -3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make available - in Executable form must also be made available in Source Code form - and that Source Code form must be distributed only under the terms - of this License. You must include a copy of this License with every - copy of the Source Code form of the Covered Software You distribute - or otherwise make available. You must inform recipients of any such - Covered Software in Executable form as to how they can obtain such - Covered Software in Source Code form in a reasonable manner on or - through a medium customarily used for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You contribute are - governed by the terms of this License. You represent that You - believe Your Modifications are Your original creation(s) and/or You - have sufficient rights to grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications that - identifies You as the Contributor of the Modification. You may not - remove or alter any copyright, patent or trademark notices contained - within the Covered Software, or any notices of licensing or any - descriptive text giving attribution to any Contributor or the - Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered Software in - Source Code form that alters or restricts the applicable version of - this License or the recipients' rights hereunder. You may choose to - offer, and to charge a fee for, warranty, support, indemnity or - liability obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on behalf of - the Initial Developer or any Contributor. You must make it - absolutely clear that any such warranty, support, indemnity or - liability obligation is offered by You alone, and You hereby agree - to indemnify the Initial Developer and every Contributor for any - liability incurred by the Initial Developer or such Contributor as a - result of warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered Software under - the terms of this License or under the terms of a license of Your - choice, which may contain terms different from this License, - provided that You are in compliance with the terms of this License - and that the license for the Executable form does not attempt to - limit or alter the recipient's rights in the Source Code form from - the rights set forth in this License. If You distribute the Covered - Software in Executable form under a different license, You must make - it absolutely clear that any terms which differ from this License - are offered by You alone, not by the Initial Developer or - Contributor. You hereby agree to indemnify the Initial Developer and - every Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software with - other code not governed by the terms of this License and distribute - the Larger Work as a single product. In such a case, You must make - sure the requirements of this License are fulfilled for the Covered - Software. - -4. Versions of the License. - - 4.1. New Versions. - - Oracle is the initial license steward and may publish revised and/or - new versions of this License from time to time. Each version will be - given a distinguishing version number. Except as provided in Section - 4.3, no one other than the license steward has the right to modify - this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise make the - Covered Software available under the terms of the version of the - License under which You originally received the Covered Software. If - the Initial Developer includes a notice in the Original Software - prohibiting it from being distributed or otherwise made available - under any subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the version - of the License under which You originally received the Covered - Software. Otherwise, You may also choose to use, distribute or - otherwise make the Covered Software available under the terms of any - subsequent version of the License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a new - license for Your Original Software, You may create and use a - modified version of this License if You: (a) rename the license and - remove any references to the name of the license steward (except to - note that the license differs from this License); and (b) otherwise - make it clear that the license contains terms which differ from this - License. - -5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE - IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR - NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE - DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY - OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, - REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN - ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS - AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -6. TERMINATION. - - 6.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to - cure such breach within 30 days of becoming aware of the breach. - Provisions which, by their nature, must remain in effect beyond the - termination of this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or a - Contributor (the Initial Developer or Contributor against whom You - assert such claim is referred to as "Participant") alleging that the - Participant Software (meaning the Contributor Version where the - Participant is a Contributor or the Original Software where the - Participant is the Initial Developer) directly or indirectly - infringes any patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial Developer (if the - Initial Developer is not the Participant) and all Contributors under - Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice - from Participant terminate prospectively and automatically at the - expiration of such 60 day notice period, unless if within such 60 - day period You withdraw Your claim with respect to the Participant - Software against such Participant either unilaterally or pursuant to - a written agreement with Participant. - - 6.3. If You assert a patent infringement claim against Participant - alleging that the Participant Software directly or indirectly - infringes any patent where such claim is resolved (such as by - license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 6.4. In the event of termination under Sections 6.1 or 6.2 above, - all end user licenses that have been validly granted by You or any - distributor hereunder prior to termination (excluding licenses - granted to You by any distributor) shall survive termination. - -7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE - TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER - FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR - LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE - POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT - APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH - PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH - LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR - LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION - AND LIMITATION MAY NOT APPLY TO YOU. - -8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is defined - in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" (as that term is defined at 48 C.F.R. § - 252.227-7014(a)(1)) and "commercial computer software documentation" - as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent - with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 - (June 1995), all U.S. Government End Users acquire Covered Software - with only those rights set forth herein. This U.S. Government Rights - clause is in lieu of, and supersedes, any other FAR, DFAR, or other - clause or provision that addresses Government rights in computer - software under this License. - -9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - the law of the jurisdiction specified in a notice contained within - the Original Software (except to the extent applicable law, if any, - provides otherwise), excluding such jurisdiction's conflict-of-law - provisions. Any litigation relating to this License shall be subject - to the jurisdiction of the courts located in the jurisdiction and - venue specified in a notice contained within the Original Software, - with the losing party responsible for costs, including, without - limitation, court costs and reasonable attorneys' fees and expenses. - The application of the United Nations Convention on Contracts for - the International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall be - construed against the drafter shall not apply to this License. You - agree that You alone are responsible for compliance with the United - States export administration regulations (and the export control - laws and regulation of any other countries) when You use, distribute - or otherwise make available any Covered Software. - -10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - ------------------------------------------------------------------------- - -NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION -LICENSE (CDDL) - -The code released under the CDDL shall be governed by the laws of the -State of California (excluding conflict-of-law provisions). Any -litigation relating to this License shall be subject to the jurisdiction -of the Federal Courts of the Northern District of California and the -state courts of the State of California, with venue lying in Santa Clara -County, California. - - - - The GNU General Public License (GPL) Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor -Boston, MA 02110-1335 -USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to -share and change it. By contrast, the GNU General Public License is -intended to guarantee your freedom to share and change free software--to -make sure the software is free for all its users. This General Public -License applies to most of the Free Software Foundation's software and -to any other program whose authors commit to using it. (Some other Free -Software Foundation software is covered by the GNU Library General -Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. -Our General Public Licenses are designed to make sure that you have the -freedom to distribute copies of free software (and charge for this -service if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone -to deny you these rights or to ask you to surrender the rights. These -restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis -or for a fee, you must give the recipients all the rights that you have. -You must make sure that they, too, receive or can get the source code. -And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -Finally, any free program is threatened constantly by software patents. -We wish to avoid the danger that redistributors of a free program will -individually obtain patent licenses, in effect making the program -proprietary. To prevent this, we have made it clear that any patent must -be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and -modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a -notice placed by the copyright holder saying it may be distributed under -the terms of this General Public License. The "Program", below, refers -to any such program or work, and a "work based on the Program" means -either the Program or any derivative work under copyright law: that is -to say, a work containing the Program or a portion of it, either -verbatim or with modifications and/or translated into another language. -(Hereinafter, translation is included without limitation in the term -"modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of running -the Program is not restricted, and the output from the Program is -covered only if its contents constitute a work based on the Program -(independent of having been made by running the Program). Whether that -is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each copy an appropriate copyright notice -and disclaimer of warranty; keep intact all the notices that refer to -this License and to the absence of any warranty; and give any other -recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of -it, thus forming a work based on the Program, and copy and distribute -such modifications or work under the terms of Section 1 above, provided -that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any part - thereof, to be licensed as a whole at no charge to all third parties - under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this License. - (Exception: if the Program itself is interactive but does not - normally print such an announcement, your work based on the Program - is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, and -can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based on -the Program, the distribution of the whole must be on the terms of this -License, whose permissions for other licensees extend to the entire -whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of a -storage or distribution medium does not bring the other work under the -scope of this License. - -3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your cost - of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed - only for noncommercial distribution and only if you received the - program in object code or executable form with such an offer, in - accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source code -means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to control -compilation and installation of the executable. However, as a special -exception, the source code distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies the -executable. - -If distribution of executable or object code is made by offering access -to copy from a designated place, then offering equivalent access to copy -the source code from the same place counts as distribution of the source -code, even though third parties are not compelled to copy the source -along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt otherwise -to copy, modify, sublicense or distribute the Program is void, and will -automatically terminate your rights under this License. However, parties -who have received copies, or rights, from you under this License will -not have their licenses terminated so long as such parties remain in -full compliance. - -5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and all -its terms and conditions for copying, distributing or modifying the -Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further restrictions -on the recipients' exercise of the rights granted herein. You are not -responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot distribute -so as to satisfy simultaneously your obligations under this License and -any other pertinent obligations, then as a consequence you may not -distribute the Program at all. For example, if a patent license would -not permit royalty-free redistribution of the Program by all those who -receive copies directly or indirectly through you, then the only way you -could satisfy both it and this License would be to refrain entirely from -distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is implemented -by public license practices. Many people have made generous -contributions to the wide range of software distributed through that -system in reliance on consistent application of that system; it is up to -the author/donor to decide if he or she is willing to distribute -software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be -a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License may -add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among countries -not thus excluded. In such case, this License incorporates the -limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new -versions of the General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Program does not specify a version -number of this License, you may choose any version ever published by the -Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the -author to ask for permission. For software which is copyrighted by the -Free Software Foundation, write to the Free Software Foundation; we -sometimes make exceptions for this. Our decision will be guided by the -two goals of preserving the free status of all derivatives of our free -software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, -EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH -YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL -NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR -DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL -DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM -(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF -THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR -OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type - `show w'. This is free software, and you are welcome to redistribute - it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the commands -you use may be called something other than `show w' and `show c'; they -could even be mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (which makes passes at compilers) written by - James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications -with the library. If this is what you want to do, use the GNU Library -General Public License instead of this License. - -# - -Certain source files distributed by Oracle America, Inc. and/or its -affiliates are subject to the following clarification and special -exception to the GPLv2, based on the GNU Project exception for its -Classpath libraries, known as the GNU Classpath Exception, but only -where Oracle has expressly included in the particular source file's -header the words "Oracle designates this particular file as subject to -the "Classpath" exception as provided by Oracle in the LICENSE file -that accompanied this code." - -You should also note that Oracle includes multiple, independent -programs in this software package. Some of those programs are provided -under licenses deemed incompatible with the GPLv2 by the Free Software -Foundation and others. For example, the package includes programs -licensed under the Apache License, Version 2.0. Such programs are -licensed to you under their original licenses. - -Oracle facilitates your further distribution of this package by adding -the Classpath Exception to the necessary parts of its GPLv2 code, which -permits you to use that code in combination with other independent -modules not licensed under the GPLv2. However, note that this would -not permit you to commingle code under an incompatible license with -Oracle's GPLv2 licensed code by, for example, cutting and pasting such -code into a file also containing Oracle's GPLv2 licensed code and then -distributing the result. Additionally, if you were to remove the -Classpath Exception from any of the files to which it applies and -distribute the result, you would likely be required to license some or -all of the other code in that distribution under the GPLv2 as well, and -since the GPLv2 is incompatible with the license terms of some items -included in the distribution by Oracle, removing the Classpath -Exception could therefore effectively compromise your ability to -further distribute the package. - -Proceed with caution and we recommend that you obtain the advice of a -lawyer skilled in open source matters before removing the Classpath -Exception or making modifications to this package which may -subsequently be redistributed and/or involve the use of third party -software. - -CLASSPATH EXCEPTION -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License version 2 cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from or -based on this library. If you modify this library, you may extend this -exception to your version of the library, but you are not obligated to -do so. If you do not wish to do so, delete this exception statement -from your version. \ No newline at end of file diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-jts.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-jts.txt deleted file mode 100644 index ff1769bdde19b..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-jts.txt +++ /dev/null @@ -1,24 +0,0 @@ -JTS License ---------------- - -# JTS Topology Suite Licensing - -May 30th, 2017 - -## Project Licenses - -The Eclipse Foundation makes available all content in this project ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of either the [Eclipse Public License 2.0](https://www.eclipse.org/legal/epl-v20.html) ("EPL") or the [Eclipse Distribution License 1.0](http://www.eclipse.org/org/documents/edl-v10.php) (a BSD Style License). For purposes of the EPL, "Program" will mean the Content. - -If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party ("Redistributor") and different terms and conditions may apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise indicated below, the terms and conditions of the EPL still apply to any source code in the Content and such source code may be obtained at http://www.eclipse.org. - -## Third Party Content - -The Content includes items that have been sourced from third parties as set out below. If you did not receive this Content directly from the Eclipse Foundation, the following is provided for informational purposes only, and you should look to the Redistributor's license for terms and conditions of use. - -### GeoTools - -JTS includes some code from the GeoTools project. This code has been licensed to the JTS project under the OSGeo BSD License [2] by the GeoTools PSC [3,4]. - -[2] https://www.osgeo.org/sites/osgeo.org/files/Page/osgeo-bsd-license.txt -[3] https://github.com/geotools/geotools/wiki/JTS-ORA-Contribution -[4] https://github.com/geotools/geotools/wiki/JTS-Shapefile-Contribution diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-logback.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-logback.txt deleted file mode 100644 index 1a6915c13ce4e..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-logback.txt +++ /dev/null @@ -1,14 +0,0 @@ -Logback License ---------------- - -Logback: the reliable, generic, fast and flexible logging framework. -Copyright (C) 1999-2015, QOS.ch. All rights reserved. - -This program and the accompanying materials are dual-licensed under -either the terms of the Eclipse Public License v1.0 as published by -the Eclipse Foundation - - or (per the licensee's choosing) - -under the terms of the GNU Lesser General Public License version 2.1 -as published by the Free Software Foundation. diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-mchange-commons-java.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-mchange-commons-java.txt deleted file mode 100644 index d1f6fa3ddc37e..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-mchange-commons-java.txt +++ /dev/null @@ -1,215 +0,0 @@ -mchange-commons-java License ---------------- - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC -LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM -CONSTITUTES RECIPIENT’S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation - distributed under this Agreement, and - -b) in the case of each subsequent Contributor: - - i) changes to the Program, and - - ii) additions to the Program; - -where such changes and/or additions to the Program originate from and are -distributed by that particular Contributor. A Contribution 'originates' from -a Contributor if it was added to the Program by such Contributor itself or -anyone acting on such Contributor’s behalf. Contributions do not include -additionsto the Program which: (i) are separate modules of software distributed -in conjunction with the Program under their own license agreement, and (ii) are -not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor which are -necessarily infringed by the use or sale of its Contribution alone or when -combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, -including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free copyright license to -reproduce, prepare derivative works of, publicly display, publicly perform, -distribute and sublicense the Contribution of such Contributor, if any, and such -derivative works, in source code and object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free patent license under -Licensed Patents to make, use, sell, offer to sell, import and otherwise -transfer the Contribution of such Contributor, if any, in source code and -object code form. This patent license shall apply to the combination of the -Contribution and the Program if, at the time the Contribution is added by the -Contributor, such addition of the Contribution causes such combination to be -covered by the Licensed Patents. The patent license shall not apply to any -other combinations which include the Contribution. No hardware per se is -licensed hereunder. - -c) Recipient understands that although each Contributor grants the licenses to -its Contributions set forth herein, no assurances are provided by any -Contributor that the Program does not infringe the patent or other intellectual -property rights of any other entity. Each Contributor disclaims any liability -to Recipient for claims brought by any other entity based on infringement of -intellectual property rights or otherwise. As a condition to exercising the -rights and licenses granted hereunder, each Recipient hereby assumes sole -responsibility to secure any other intellectual property rights needed, if any. -For example, if a third party patent license is required to allow Recipient to -distribute the Program, it is Recipient’s responsibility to acquire that -license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright license -set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under -its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - - i) effectively disclaims on behalf of all Contributors all warranties and - conditions, express and implied, including warranties or conditions of - title and non-infringement, and implied warranties or conditions of - merchantability and fitness for a particular purpose; - - ii) effectively excludes on behalf of all Contributors all liability for - damages, including direct, indirect, special, incidental and - consequential damages, such as lost profits; - - iii) states that any provisions which differ from this Agreement are - offered by that Contributor alone and not by any other party; and - - iv) states that source code for the Program is available from such - Contributor, and informs licensees how to obtain it in a reasonable - manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the Program. - -Contributors may not remove or alter any copyright notices contained within -the Program. - -Each Contributor must identify itself as the originator of its Contribution, -if any, in a manner that reasonably allows subsequent Recipients to identify -the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with -respect to end users, business partners and the like. While this license is -intended to facilitate the commercial use of the Program, the Contributor who -includes the Program in a commercial product offering should do so in a manner -which does not create potential liability for other Contributors. Therefore, -if a Contributor includes the Program in a commercial product offering, such -Contributor ("Commercial Contributor") hereby agrees to defend and indemnify -every other Contributor ("Indemnified Contributor") against any losses, damages -and costs (collectively "Losses") arising from claims, lawsuits and other legal -actions brought by a third party against the Indemnified Contributor to the -extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product -offering, Product X. That Contributor is then a Commercial Contributor. If that -Commercial Contributor then makes performance claims, or offers warranties -related to Product X, those performance claims and warranties are such -Commercial Contributor’s responsibility alone. Under this section, the -Commercial Contributor would have to defend claims against the other -Contributors related to those performance claims and warranties, and if a court -requires any other Contributor to pay any damages as a result, the Commercial -Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR -IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each -Recipient is solely responsible for determining the appropriateness of using -and distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to the -risks and costs of program errors, compliance with applicable laws, damage to -or loss of data, programs or equipment, and unavailability or interruption of -operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY -CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST -PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY -WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS -GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable -law, it shall not affect the validity or enforceability of the remainder of the -terms of this Agreement, and without further action by the parties hereto, such -provision shall be reformed to the minimum extent necessary to make such -provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Program itself -(excluding combinations of the Program with other software or hardware) -infringes such Recipient’s patent(s), then such Recipient’s rights granted -under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient’s rights under this Agreement shall terminate if it fails to -comply with any of the material terms or conditions of this Agreement and does -not cure such failure in a reasonable period of time after becoming aware of -such noncompliance. If all Recipient’s rights under this Agreement terminate, -Recipient agrees to cease use and distribution of the Program as soon as -reasonably practicable. However, Recipient’s obligations under this Agreement -and any licenses granted by Recipient relating to the Program shall continue -and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in -order to avoid inconsistency the Agreement is copyrighted and may only be -modified in the following manner. The Agreement Steward reserves the right to -publish new versions (including revisions) of this Agreement from time to time. -No one other than the Agreement Steward has the right to modify this Agreement. -The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation -may assign the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) may always -be distributed subject to the version of the Agreement under which it was -received. In addition, after a new version of the Agreement is published, -Contributor may elect to distribute the Program (including its Contributions) -under the new version. Except as expressly stated in Sections 2(a) and 2(b) -above, Recipient receives no rights or licenses to the intellectual property of -any Contributor under this Agreement, whether expressly, by implication, -estoppel or otherwise. All rights in the Program not expressly granted under -this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the -intellectual property laws of the United States of America. No party to this -Agreement will bring a legal action under this Agreement more than one year -after the cause of action arose. Each party waives its rights to a jury trial -in any resulting litigation. \ No newline at end of file diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-opengauss-jdbc.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-opengauss-jdbc.txt deleted file mode 100644 index 5b45537c0727f..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-opengauss-jdbc.txt +++ /dev/null @@ -1,26 +0,0 @@ -opengauss-jdbc License ---------------- - -Copyright (c) 1997, PostgreSQL Global Development Group -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-perfmark.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-perfmark.txt deleted file mode 100644 index 619fafbbab71a..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-perfmark.txt +++ /dev/null @@ -1,43 +0,0 @@ -Perfmark License ---------------- - -Copyright 2019 Google LLC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - ------------------------------------------------------------------------ - -This product contains a modified portion of 'Catapult', an open source -Trace Event viewer for Chome, Linux, and Android applications, which can -be obtained at: - - * LICENSE: - * traceviewer/src/main/resources/io/perfmark/traceviewer/third_party/catapult/LICENSE (New BSD License) - * HOMEPAGE: - * https://github.com/catapult-project/catapult - -This product contains a modified portion of 'Polymer', a library for Web -Components, which can be obtained at: - * LICENSE: - * traceviewer/src/main/resources/io/perfmark/traceviewer/third_party/polymer/LICENSE (New BSD License) - * HOMEPAGE: - * https://github.com/Polymer/polymer - - -This product contains a modified portion of 'ASM', an open source -Java Bytecode library, which can be obtained at: - - * LICENSE: - * agent/src/main/resources/io/perfmark/agent/third_party/asm/LICENSE (BSD style License) - * HOMEPAGE: - * https://asm.ow2.io/ diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-postgresql.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-postgresql.txt deleted file mode 100644 index d1a2ff3ce1b4b..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-postgresql.txt +++ /dev/null @@ -1,26 +0,0 @@ -PostgreSQL JDBC Driver License ---------------- - -Copyright (c) 1997, PostgreSQL Global Development Group -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-protobuf-java.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-protobuf-java.txt deleted file mode 100644 index fa174d2fe429a..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-protobuf-java.txt +++ /dev/null @@ -1,4 +0,0 @@ -protobuf-java License ---------------- - -https://opensource.org/licenses/BSD-3-Clause diff --git a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-slf4j.txt b/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-slf4j.txt deleted file mode 100644 index afba44351d538..0000000000000 --- a/distribution/proxy-native/src/main/release-docs/licenses/LICENSE-slf4j.txt +++ /dev/null @@ -1,24 +0,0 @@ -SLF4J License ---------------- - -Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland) -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/distribution/proxy/Dockerfile b/distribution/proxy/Dockerfile index d0e05534f990d..604cb078f0cc1 100644 --- a/distribution/proxy/Dockerfile +++ b/distribution/proxy/Dockerfile @@ -22,7 +22,7 @@ ENV LOCAL_PATH /opt/shardingsphere-proxy ADD target/${APP_NAME}.tar.gz /opt RUN mv /opt/${APP_NAME} ${LOCAL_PATH} && mkdir -p ${LOCAL_PATH}/ext-lib -FROM eclipse-temurin:17-jdk +FROM eclipse-temurin:21-jdk MAINTAINER ShardingSphere "dev@shardingsphere.apache.org" ENV LOCAL_PATH /opt/shardingsphere-proxy diff --git a/distribution/proxy/pom.xml b/distribution/proxy/pom.xml index fca12eba7e92e..c16ebd55d0032 100644 --- a/distribution/proxy/pom.xml +++ b/distribution/proxy/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-distribution - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-proxy-distribution pom @@ -96,6 +96,21 @@ net.nicoulaj.maven.plugins checksum-maven-plugin + + maven-source-plugin + + + io.smallrye + jandex-maven-plugin + + + make-index + + jandex + + + + diff --git a/distribution/proxy/src/main/release-docs/LICENSE b/distribution/proxy/src/main/release-docs/LICENSE index f41740785cd91..70ba6b75e76da 100644 --- a/distribution/proxy/src/main/release-docs/LICENSE +++ b/distribution/proxy/src/main/release-docs/LICENSE @@ -215,7 +215,7 @@ Apache 2.0 licenses The following components are provided under the Apache License. See project link for details. The text of each license is the standard Apache 2.0 license. - accessors-smart 2.4.7: https://www.minidev.net/, Apache 2.0 + accessors-smart 2.4.9: https://www.minidev.net/, Apache 2.0 aggdesigner-algorithm 6.0: Apache 2.0 apiguardian-api 1.1.2: https://github.com/apiguardian-team/apiguardian, Apache 2.0 audience-annotations 0.12.0: https://github.com/apache/yetus, Apache 2.0 @@ -224,59 +224,70 @@ The text of each license is the standard Apache 2.0 license. caffeine 2.9.3: https://github.com/ben-manes/caffeine, Apache 2.0 calcite-core 1.35.0: https://calcite.apache.org, Apache 2.0 calcite-linq4j 1.35.0: https://calcite.apache.org, Apache 2.0 - commons-codec 1.15: https://github.com/apache/commons-codec, Apache 2.0 - commons-collections4 4.4: https://github.com/apache/commons-collections, Apache 2.0 + commons-codec 1.16.0: https://github.com/apache/commons-codec, Apache 2.0 + commons-dbcp2 2.6.0: https://commons.apache.org/proper/commons-dbcp, Apache 2.0 commons-exec 1.3: https://github.com/apache/commons-exec, Apache 2.0 commons-io 2.11.0: https://github.com/apache/commons-io, Apache 2.0 commons-lang 2.4: https://github.com/apache/commons-lang, Apache 2.0 commons-lang3 3.12.0: https://github.com/apache/commons-lang, Apache 2.0 + commons-math3 3.6.1: https://commons.apache.org/proper/commons-math, Apache 2.0 + commons-pool2 2.6.1: https://commons.apache.org/proper/commons-pool, Apache 2.0 commons-logging 1.1.3: https://github.com/apache/commons-logging, Apache 2.0 - curator-client 5.4.0: https://github.com/apache/curator, Apache 2.0 - curator-framework 5.4.0: https://github.com/apache/curator, Apache 2.0 - curator-recipes 5.4.0: https://github.com/apache/curator, Apache 2.0 - error_prone_annotations 2.11.0: https://github.com/google/error-prone, Apache 2.0 + curator-client 5.6.0: https://github.com/apache/curator, Apache 2.0 + curator-framework 5.6.0: https://github.com/apache/curator, Apache 2.0 + curator-recipes 5.6.0: https://github.com/apache/curator, Apache 2.0 + error_prone_annotations 2.22.0: https://github.com/google/error-prone, Apache 2.0 failsafe 2.4.4: https://github.com/jhalterman/failsafe, Apache 2.0 failureaccess 1.0.1: https://github.com/google/guava, Apache 2.0 freemarker 2.3.31: https://freemarker.apache.org/, Apache 2.0 - groovy 4.0.10: https://groovy.apache.org/, Apache 2.0 - grpc-api 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-context 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-core 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-grpclb 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-netty 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-protobuf 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-protobuf-lite 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-stub 1.51.0: https://github.com/grpc/grpc-java, Apache 2.0 - gson 2.9.1: https://github.com/google/gson, Apache 2.0 - guava 30.0-jre: https://github.com/google/guava, Apache 2.0 + groovy 4.0.19: https://groovy.apache.org/, Apache 2.0 + grpc-api 1.58.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-context 1.58.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-core 1.58.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-grpclb 1.58.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-netty 1.58.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-protobuf 1.58.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-protobuf-lite 1.58.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-stub 1.58.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-util 1.58.0: https://github.com/grpc/grpc-java, Apache 2.0 + gson 2.10.1: https://github.com/google/gson, Apache 2.0 + guava 32.1.2-jre: https://github.com/google/guava, Apache 2.0 HikariCP 4.0.3: https://github.com/brettwooldridge/HikariCP, Apache 2.0 httpclient5 5.1.3: https://hc.apache.org/httpcomponents-client-5.1.x, Apache 2.0 httpcore5-h2 5.1.3: https://hc.apache.org/httpcomponents-core-5.1.x, Apache 2.0 httpcore5 5.1.3: https://hc.apache.org/httpcomponents-core-5.1.x, Apache 2.0 - jackson-annotations 2.14.0: http://github.com/FasterXML/jackson, Apache 2.0 - jackson-core 2.14.0: http://github.com/FasterXML/jackson, Apache 2.0 - jackson-databind 2.14.0: http://github.com/FasterXML/jackson, Apache 2.0 - jackson-dataformat-yaml 2.14.0: http://github.com/FasterXML/jackson, Apache 2.0 - jackson-datatype-jsr310 2.14.0: http://github.com/FasterXML/jackson, Apache 2.0 + j2objc-annotations 1.3 https://github.com/google/j2objc/, Apache 2.0 + jackson-annotations 2.16.1: http://github.com/FasterXML/jackson, Apache 2.0 + jackson-core 2.16.1: http://github.com/FasterXML/jackson, Apache 2.0 + jackson-databind 2.16.1: http://github.com/FasterXML/jackson, Apache 2.0 + jackson-dataformat-xml 2.16.1: https://github.com/FasterXML/jackson-dataformat-xml, Apache 2.0 + jackson-dataformat-yaml 2.16.1: http://github.com/FasterXML/jackson, Apache 2.0 + jackson-datatype-jdk8 2.16.1: http://github.com/FasterXML/jackson-modules-java8, Apache 2.0 + jackson-datatype-jsr310 2.16.1: http://github.com/FasterXML/jackson, Apache 2.0 jcl-over-slf4j 1.7.36: https://github.com/qos-ch/slf4j, Apache 2.0 - jetcd-api 0.7.5: https://github.com/etcd-io/jetcd, Apache 2.0 - jetcd-common 0.7.5: https://github.com/etcd-io/jetcd, Apache 2.0 - jetcd-core 0.7.5: https://github.com/etcd-io/jetcd, Apache 2.0 - jetcd-grpc 0.7.5: https://github.com/etcd-io/jetcd, Apache 2.0 - json-path 2.7.0: https://github.com/jayway/JsonPath, Apache 2.0 - json-smart 2.4.7: https://www.minidev.net/, Apache 2.0 + jetcd-api 0.7.7: https://github.com/etcd-io/jetcd, Apache 2.0 + jetcd-common 0.7.7: https://github.com/etcd-io/jetcd, Apache 2.0 + jetcd-core 0.7.7: https://github.com/etcd-io/jetcd, Apache 2.0 + jetcd-grpc 0.7.7: https://github.com/etcd-io/jetcd, Apache 2.0 + json-path 2.9.0: https://github.com/jayway/JsonPath, Apache 2.0 + json-smart 2.4.10: https://www.minidev.net/, Apache 2.0 json-simple 1.1.1: https://code.google.com/archive/p/json-simple/, Apache 2.0 jsr305 3.0.2: http://findbugs.sourceforge.net/, Apache 2.0 memory 0.9.0, Apache 2.0 - netty-buffer 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-codec 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-codec-http 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-codec-http2 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-codec-socks 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-common 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-handler 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-handler-proxy 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-resolver 4.1.90.Final: https://github.com/netty, Apache 2.0 + netty-buffer 4.1.106.Final: https://github.com/netty, Apache 2.0 + netty-codec 4.1.106.Final: https://github.com/netty, Apache 2.0 + netty-codec-http 4.1.106.Final: https://github.com/netty, Apache 2.0 + netty-codec-http2 4.1.106.Final: https://github.com/netty, Apache 2.0 + netty-codec-socks 4.1.106.Final: https://github.com/netty, Apache 2.0 + netty-common 4.1.106.Final: https://github.com/netty, Apache 2.0 + netty-handler 4.1.106.Final: https://github.com/netty, Apache 2.0 + netty-handler-proxy 4.1.106.Final: https://github.com/netty, Apache 2.0 + netty-resolver 4.1.106.Final: https://github.com/netty, Apache 2.0 + netty-transport 4.1.106.Final: https://github.com/netty, Apache 2.0 + netty-transport-classes-epoll 4.1.106.Final: https://github.com/netty, Apache 2.0 + netty-transport-native-epoll 4.1.106.Final-linux-aarch_64: https://github.com/netty, Apache 2.0 + netty-transport-native-epoll 4.1.106.Final-linux-x86_64: https://github.com/netty, Apache 2.0 + netty-transport-native-unix-common 4.1.106.Final: https://github.com/netty, Apache 2.0 netty-tcnative-boringssl-static 2.0.59.Final: https://github.com/netty/netty-tcnative, Apache 2.0 netty-tcnative-boringssl-static 2.0.59.Final-linux-aarch_64: https://github.com/netty/netty-tcnative, Apache 2.0 netty-tcnative-boringssl-static 2.0.59.Final-linux-x86_64: https://github.com/netty/netty-tcnative, Apache 2.0 @@ -284,21 +295,17 @@ The text of each license is the standard Apache 2.0 license. netty-tcnative-boringssl-static 2.0.59.Final-osx-x86_64: https://github.com/netty/netty-tcnative, Apache 2.0 netty-tcnative-boringssl-static 2.0.59.Final-windows-x86_64: https://github.com/netty/netty-tcnative, Apache 2.0 netty-tcnative-classes 2.0.59.Final: https://github.com/netty/netty-tcnative, Apache 2.0 - netty-transport 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-transport-classes-epoll 4.1.90.Final: https://github.com/netty, Apache 2.0 - netty-transport-native-epoll 4.1.90.Final-linux-aarch_64: https://github.com/netty, Apache 2.0 - netty-transport-native-epoll 4.1.90.Final-linux-x86_64: https://github.com/netty, Apache 2.0 - netty-transport-native-unix-common 4.1.90.Final: https://github.com/netty, Apache 2.0 - perfmark-api 0.25.0: https://github.com/perfmark/perfmark, Apache 2.0 - proto-google-common-protos 2.9.0: https://github.com/googleapis/common-protos-java, Apache 2.0 - proj4j 1.1.5: https://github.com/locationtech/proj4j, Apache 2.0 + perfmark-api 0.26.0: https://github.com/perfmark/perfmark, Apache 2.0 + proto-google-common-protos 2.22.0: https://github.com/googleapis/common-protos-java, Apache 2.0 + proj4j 1.2.2: https://github.com/locationtech/proj4j, Apache 2.0 quartz 2.3.2: https://github.com/quartz-scheduler/quartz, Apache 2.0 sketches-core 0.9.0, Apache 2.0 - snakeyaml 1.33: https://bitbucket.org/snakeyaml/snakeyaml, Apache 2.0 + snakeyaml 2.2: https://bitbucket.org/snakeyaml/snakeyaml, Apache 2.0 transmittable-thread-local 2.14.2: https://github.com/alibaba/transmittable-thread-local, Apache 2.0 uzaygezen-core 0.2: https://code.google.com/p/uzaygezen, Apache 2.0 - zookeeper 3.8.1: https://github.com/apache/zookeeper, Apache 2.0 - zookeeper-jute 3.8.1: https://github.com/apache/zookeeper, Apache 2.0 + zookeeper 3.9.2: https://github.com/apache/zookeeper, Apache 2.0 + zookeeper-jute 3.9.2: https://github.com/apache/zookeeper, Apache 2.0 + java-util 2.4.0: https://github.com/jdereg/java-util, Apache 2.0 ======================================================================== Apache 2.0 licenses @@ -321,29 +328,16 @@ The following components are provided under a BSD license. See project link for The text of each license is also included at licenses/LICENSE-[project].txt. antlr4-runtime 4.10.1: https://github.com/antlr/antlr4, BSD-3-Clause - asm 9.1: https://github.com/llbit/ow2-asm, BSD-3-Clause - commons-compiler 3.1.8: https://github.com/janino-compiler/janino, BSD-3-Clause + asm 9.3: https://github.com/llbit/ow2-asm, BSD-3-Clause + commons-compiler 3.1.9: https://github.com/janino-compiler/janino, BSD-3-Clause janino 3.1.9: https://github.com/janino-compiler/janino, BSD-3-Clause opengauss-jdbc 3.1.0-og: https://gitee.com/opengauss/openGauss-connector-jdbc, BSD-2-Clause - postgresql 42.4.1: https://github.com/pgjdbc/pgjdbc, BSD-2-Clause + postgresql 42.7.2: https://github.com/pgjdbc/pgjdbc, BSD-2-Clause protobuf-java 3.21.12: https://github.com/protocolbuffers/protobuf/blob/master/java, BSD-3-Clause protobuf-java-util 3.21.12: https://github.com/protocolbuffers/protobuf/blob/master/java, BSD-3-Clause jts-io-common 1.19.0: https://github.com/locationtech/jts, EDL 1.0 jts-core 1.19.0: https://github.com/locationtech/jts, EDL 1.0 -======================================================================== -CDDL licenses -======================================================================== - -The following components are provided under the CDDL License. See project link for details. -The text of each license is also included at licenses/LICENSE-[project].txt. - - javax.activation-api 1.2.0: https://github.com/javaee/javax.annotation, CDDL - jta 1.1: http://jta-spec.java.net, CDDL - jaxb-api 2.3.0: http://www.oracle.com, CDDL - jaxb-core 2.3.0: http://www.oracle.com, CDDL - jaxb-impl 2.3.0 http://www.oracle.com, CDDL - ======================================================================== EPL licenses ======================================================================== @@ -351,10 +345,11 @@ EPL licenses The following components are provided under the EPL License. See project link for details. The text of each license is also included at licenses/LICENSE-[project].txt. - logback-classic 1.2.11: https://github.com/qos-ch/logback, EPL 1.0 - logback-core 1.2.11: https://github.com/qos-ch/logback, EPL 1.0 + jakarta.transaction-api 1.3.3: https://github.com/jakartaee/transactions, EPL 2.0 + logback-classic 1.2.12: https://github.com/qos-ch/logback, EPL 1.0 + logback-core 1.2.12: https://github.com/qos-ch/logback, EPL 1.0 mchange-commons-java 0.2.15: https://github.com/swaldman/mchange-commons-java, EPL 1.0 - h2 2.1.214: https://github.com/h2database/h2database, EPL 1.0 + h2 2.2.224: https://github.com/h2database/h2database, EPL 1.0 ======================================================================== MIT licenses @@ -367,6 +362,6 @@ The text of each license is also included at licenses/LICENSE-[project].txt. bcprov-jdk15on 1.70: https://www.bouncycastle.org, MIT bctls-jdk15on 1.70: https://www.bouncycastle.org, MIT bcutil-jdk15on 1.70: https://www.bouncycastle.org, MIT - checker-qual 3.5.0: https://github.com/typetools/checker-framework/blob/master/checker-qual, MIT + checker-qual 3.39.0: https://github.com/typetools/checker-framework/blob/master/checker-qual, MIT jul-to-slf4j 1.7.36: https://www.slf4j.org, MIT slf4j-api 1.7.36: https://www.slf4j.org, MIT diff --git a/distribution/proxy/src/main/release-docs/NOTICE b/distribution/proxy/src/main/release-docs/NOTICE index 4a9d35b1673f3..3ed1453ce3b72 100644 --- a/distribution/proxy/src/main/release-docs/NOTICE +++ b/distribution/proxy/src/main/release-docs/NOTICE @@ -1,5 +1,5 @@ Apache ShardingSphere -Copyright 2018-2023 The Apache Software Foundation +Copyright 2018-2024 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). diff --git a/distribution/proxy/src/main/release-docs/licenses/LICENSE-jakarta.transaction-api.txt b/distribution/proxy/src/main/release-docs/licenses/LICENSE-jakarta.transaction-api.txt new file mode 100644 index 0000000000000..1008ec263327a --- /dev/null +++ b/distribution/proxy/src/main/release-docs/licenses/LICENSE-jakarta.transaction-api.txt @@ -0,0 +1,637 @@ +# Eclipse Public License - v 2.0 + + THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE + PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION + OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + + 1. DEFINITIONS + + "Contribution" means: + + a) in the case of the initial Contributor, the initial content + Distributed under this Agreement, and + + b) in the case of each subsequent Contributor: + i) changes to the Program, and + ii) additions to the Program; + where such changes and/or additions to the Program originate from + and are Distributed by that particular Contributor. A Contribution + "originates" from a Contributor if it was added to the Program by + such Contributor itself or anyone acting on such Contributor's behalf. + Contributions do not include changes or additions to the Program that + are not Modified Works. + + "Contributor" means any person or entity that Distributes the Program. + + "Licensed Patents" mean patent claims licensable by a Contributor which + are necessarily infringed by the use or sale of its Contribution alone + or when combined with the Program. + + "Program" means the Contributions Distributed in accordance with this + Agreement. + + "Recipient" means anyone who receives the Program under this Agreement + or any Secondary License (as applicable), including Contributors. + + "Derivative Works" shall mean any work, whether in Source Code or other + form, that is based on (or derived from) the Program and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. + + "Modified Works" shall mean any work in Source Code or other form that + results from an addition to, deletion from, or modification of the + contents of the Program, including, for purposes of clarity any new file + in Source Code form that contains any contents of the Program. Modified + Works shall not include works that contain only declarations, + interfaces, types, classes, structures, or files of the Program solely + in each case in order to link to, bind by name, or subclass the Program + or Modified Works thereof. + + "Distribute" means the acts of a) distributing or b) making available + in any manner that enables the transfer of a copy. + + "Source Code" means the form of a Program preferred for making + modifications, including but not limited to software source code, + documentation source, and configuration files. + + "Secondary License" means either the GNU General Public License, + Version 2.0, or any later versions of that license, including any + exceptions or additional permissions as identified by the initial + Contributor. + + 2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free copyright + license to reproduce, prepare Derivative Works of, publicly display, + publicly perform, Distribute and sublicense the Contribution of such + Contributor, if any, and such Derivative Works. + + b) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free patent + license under Licensed Patents to make, use, sell, offer to sell, + import and otherwise transfer the Contribution of such Contributor, + if any, in Source Code or other form. This patent license shall + apply to the combination of the Contribution and the Program if, at + the time the Contribution is added by the Contributor, such addition + of the Contribution causes such combination to be covered by the + Licensed Patents. The patent license shall not apply to any other + combinations which include the Contribution. No hardware per se is + licensed hereunder. + + c) Recipient understands that although each Contributor grants the + licenses to its Contributions set forth herein, no assurances are + provided by any Contributor that the Program does not infringe the + patent or other intellectual property rights of any other entity. + Each Contributor disclaims any liability to Recipient for claims + brought by any other entity based on infringement of intellectual + property rights or otherwise. As a condition to exercising the + rights and licenses granted hereunder, each Recipient hereby + assumes sole responsibility to secure any other intellectual + property rights needed, if any. For example, if a third party + patent license is required to allow Recipient to Distribute the + Program, it is Recipient's responsibility to acquire that license + before distributing the Program. + + d) Each Contributor represents that to its knowledge it has + sufficient copyright rights in its Contribution, if any, to grant + the copyright license set forth in this Agreement. + + e) Notwithstanding the terms of any Secondary License, no + Contributor makes additional grants to any Recipient (other than + those set forth in this Agreement) as a result of such Recipient's + receipt of the Program under the terms of a Secondary License + (if permitted under the terms of Section 3). + + 3. REQUIREMENTS + + 3.1 If a Contributor Distributes the Program in any form, then: + + a) the Program must also be made available as Source Code, in + accordance with section 3.2, and the Contributor must accompany + the Program with a statement that the Source Code for the Program + is available under this Agreement, and informs Recipients how to + obtain it in a reasonable manner on or through a medium customarily + used for software exchange; and + + b) the Contributor may Distribute the Program under a license + different than this Agreement, provided that such license: + i) effectively disclaims on behalf of all other Contributors all + warranties and conditions, express and implied, including + warranties or conditions of title and non-infringement, and + implied warranties or conditions of merchantability and fitness + for a particular purpose; + + ii) effectively excludes on behalf of all other Contributors all + liability for damages, including direct, indirect, special, + incidental and consequential damages, such as lost profits; + + iii) does not attempt to limit or alter the recipients' rights + in the Source Code under section 3.2; and + + iv) requires any subsequent distribution of the Program by any + party to be under a license that satisfies the requirements + of this section 3. + + 3.2 When the Program is Distributed as Source Code: + + a) it must be made available under this Agreement, or if the + Program (i) is combined with other material in a separate file or + files made available under a Secondary License, and (ii) the initial + Contributor attached to the Source Code the notice described in + Exhibit A of this Agreement, then the Program may be made available + under the terms of such Secondary Licenses, and + + b) a copy of this Agreement must be included with each copy of + the Program. + + 3.3 Contributors may not remove or alter any copyright, patent, + trademark, attribution notices, disclaimers of warranty, or limitations + of liability ("notices") contained within the Program from any copy of + the Program which they Distribute, provided that Contributors may add + their own appropriate notices. + + 4. COMMERCIAL DISTRIBUTION + + Commercial distributors of software may accept certain responsibilities + with respect to end users, business partners and the like. While this + license is intended to facilitate the commercial use of the Program, + the Contributor who includes the Program in a commercial product + offering should do so in a manner which does not create potential + liability for other Contributors. Therefore, if a Contributor includes + the Program in a commercial product offering, such Contributor + ("Commercial Contributor") hereby agrees to defend and indemnify every + other Contributor ("Indemnified Contributor") against any losses, + damages and costs (collectively "Losses") arising from claims, lawsuits + and other legal actions brought by a third party against the Indemnified + Contributor to the extent caused by the acts or omissions of such + Commercial Contributor in connection with its distribution of the Program + in a commercial product offering. The obligations in this section do not + apply to any claims or Losses relating to any actual or alleged + intellectual property infringement. In order to qualify, an Indemnified + Contributor must: a) promptly notify the Commercial Contributor in + writing of such claim, and b) allow the Commercial Contributor to control, + and cooperate with the Commercial Contributor in, the defense and any + related settlement negotiations. The Indemnified Contributor may + participate in any such claim at its own expense. + + For example, a Contributor might include the Program in a commercial + product offering, Product X. That Contributor is then a Commercial + Contributor. If that Commercial Contributor then makes performance + claims, or offers warranties related to Product X, those performance + claims and warranties are such Commercial Contributor's responsibility + alone. Under this section, the Commercial Contributor would have to + defend claims against the other Contributors related to those performance + claims and warranties, and if a court requires any other Contributor to + pay any damages as a result, the Commercial Contributor must pay + those damages. + + 5. NO WARRANTY + + EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT + PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR + IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF + TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR + PURPOSE. Each Recipient is solely responsible for determining the + appropriateness of using and distributing the Program and assumes all + risks associated with its exercise of rights under this Agreement, + including but not limited to the risks and costs of program errors, + compliance with applicable laws, damage to or loss of data, programs + or equipment, and unavailability or interruption of operations. + + 6. DISCLAIMER OF LIABILITY + + EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT + PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS + SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST + PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE + EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGES. + + 7. GENERAL + + If any provision of this Agreement is invalid or unenforceable under + applicable law, it shall not affect the validity or enforceability of + the remainder of the terms of this Agreement, and without further + action by the parties hereto, such provision shall be reformed to the + minimum extent necessary to make such provision valid and enforceable. + + If Recipient institutes patent litigation against any entity + (including a cross-claim or counterclaim in a lawsuit) alleging that the + Program itself (excluding combinations of the Program with other software + or hardware) infringes such Recipient's patent(s), then such Recipient's + rights granted under Section 2(b) shall terminate as of the date such + litigation is filed. + + All Recipient's rights under this Agreement shall terminate if it + fails to comply with any of the material terms or conditions of this + Agreement and does not cure such failure in a reasonable period of + time after becoming aware of such noncompliance. If all Recipient's + rights under this Agreement terminate, Recipient agrees to cease use + and distribution of the Program as soon as reasonably practicable. + However, Recipient's obligations under this Agreement and any licenses + granted by Recipient relating to the Program shall continue and survive. + + Everyone is permitted to copy and distribute copies of this Agreement, + but in order to avoid inconsistency the Agreement is copyrighted and + may only be modified in the following manner. The Agreement Steward + reserves the right to publish new versions (including revisions) of + this Agreement from time to time. No one other than the Agreement + Steward has the right to modify this Agreement. The Eclipse Foundation + is the initial Agreement Steward. The Eclipse Foundation may assign the + responsibility to serve as the Agreement Steward to a suitable separate + entity. Each new version of the Agreement will be given a distinguishing + version number. The Program (including Contributions) may always be + Distributed subject to the version of the Agreement under which it was + received. In addition, after a new version of the Agreement is published, + Contributor may elect to Distribute the Program (including its + Contributions) under the new version. + + Except as expressly stated in Sections 2(a) and 2(b) above, Recipient + receives no rights or licenses to the intellectual property of any + Contributor under this Agreement, whether expressly, by implication, + estoppel or otherwise. All rights in the Program not expressly granted + under this Agreement are reserved. Nothing in this Agreement is intended + to be enforceable by any entity that is not a Contributor or Recipient. + No third-party beneficiary rights are created under this Agreement. + + Exhibit A - Form of Secondary Licenses Notice + + "This Source Code may also be made available under the following + Secondary Licenses when the conditions for such availability set forth + in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), + version(s), and exceptions or additional permissions here}." + + Simply including a copy of this Agreement, including this Exhibit A + is not sufficient to license the Source Code under Secondary Licenses. + + If it is not possible or desirable to put the notice in a particular + file, then You may include the notice in a location (such as a LICENSE + file in a relevant directory) where a recipient would be likely to + look for such a notice. + + You may add additional accurate notices of copyright ownership. + +--- + +## The GNU General Public License (GPL) Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1335 + USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your freedom to + share and change it. By contrast, the GNU General Public License is + intended to guarantee your freedom to share and change free software--to + make sure the software is free for all its users. This General Public + License applies to most of the Free Software Foundation's software and + to any other program whose authors commit to using it. (Some other Free + Software Foundation software is covered by the GNU Library General + Public License instead.) You can apply it to your programs, too. + + When we speak of free software, we are referring to freedom, not price. + Our General Public Licenses are designed to make sure that you have the + freedom to distribute copies of free software (and charge for this + service if you wish), that you receive source code or can get it if you + want it, that you can change the software or use pieces of it in new + free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid anyone + to deny you these rights or to ask you to surrender the rights. These + restrictions translate to certain responsibilities for you if you + distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether gratis + or for a fee, you must give the recipients all the rights that you have. + You must make sure that they, too, receive or can get the source code. + And you must show them these terms so they know their rights. + + We protect your rights with two steps: (1) copyright the software, and + (2) offer you this license which gives you legal permission to copy, + distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain + that everyone understands that there is no warranty for this free + software. If the software is modified by someone else and passed on, we + want its recipients to know that what they have is not the original, so + that any problems introduced by others will not reflect on the original + authors' reputations. + + Finally, any free program is threatened constantly by software patents. + We wish to avoid the danger that redistributors of a free program will + individually obtain patent licenses, in effect making the program + proprietary. To prevent this, we have made it clear that any patent must + be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and + modification follow. + + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains a + notice placed by the copyright holder saying it may be distributed under + the terms of this General Public License. The "Program", below, refers + to any such program or work, and a "work based on the Program" means + either the Program or any derivative work under copyright law: that is + to say, a work containing the Program or a portion of it, either + verbatim or with modifications and/or translated into another language. + (Hereinafter, translation is included without limitation in the term + "modification".) Each licensee is addressed as "you". + + Activities other than copying, distribution and modification are not + covered by this License; they are outside its scope. The act of running + the Program is not restricted, and the output from the Program is + covered only if its contents constitute a work based on the Program + (independent of having been made by running the Program). Whether that + is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's source + code as you receive it, in any medium, provided that you conspicuously + and appropriately publish on each copy an appropriate copyright notice + and disclaimer of warranty; keep intact all the notices that refer to + this License and to the absence of any warranty; and give any other + recipients of the Program a copy of this License along with the Program. + + You may charge a fee for the physical act of transferring a copy, and + you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion of + it, thus forming a work based on the Program, and copy and distribute + such modifications or work under the terms of Section 1 above, provided + that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any part + thereof, to be licensed as a whole at no charge to all third parties + under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this License. + (Exception: if the Program itself is interactive but does not + normally print such an announcement, your work based on the Program + is not required to print an announcement.) + + These requirements apply to the modified work as a whole. If + identifiable sections of that work are not derived from the Program, and + can be reasonably considered independent and separate works in + themselves, then this License, and its terms, do not apply to those + sections when you distribute them as separate works. But when you + distribute the same sections as part of a whole which is a work based on + the Program, the distribution of the whole must be on the terms of this + License, whose permissions for other licensees extend to the entire + whole, and thus to each and every part regardless of who wrote it. + + Thus, it is not the intent of this section to claim rights or contest + your rights to work written entirely by you; rather, the intent is to + exercise the right to control the distribution of derivative or + collective works based on the Program. + + In addition, mere aggregation of another work not based on the Program + with the Program (or with a work based on the Program) on a volume of a + storage or distribution medium does not bring the other work under the + scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, + under Section 2) in object code or executable form under the terms of + Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your cost + of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed + only for noncommercial distribution and only if you received the + program in object code or executable form with such an offer, in + accord with Subsection b above.) + + The source code for a work means the preferred form of the work for + making modifications to it. For an executable work, complete source code + means all the source code for all modules it contains, plus any + associated interface definition files, plus the scripts used to control + compilation and installation of the executable. However, as a special + exception, the source code distributed need not include anything that is + normally distributed (in either source or binary form) with the major + components (compiler, kernel, and so on) of the operating system on + which the executable runs, unless that component itself accompanies the + executable. + + If distribution of executable or object code is made by offering access + to copy from a designated place, then offering equivalent access to copy + the source code from the same place counts as distribution of the source + code, even though third parties are not compelled to copy the source + along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program + except as expressly provided under this License. Any attempt otherwise + to copy, modify, sublicense or distribute the Program is void, and will + automatically terminate your rights under this License. However, parties + who have received copies, or rights, from you under this License will + not have their licenses terminated so long as such parties remain in + full compliance. + + 5. You are not required to accept this License, since you have not + signed it. However, nothing else grants you permission to modify or + distribute the Program or its derivative works. These actions are + prohibited by law if you do not accept this License. Therefore, by + modifying or distributing the Program (or any work based on the + Program), you indicate your acceptance of this License to do so, and all + its terms and conditions for copying, distributing or modifying the + Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the + Program), the recipient automatically receives a license from the + original licensor to copy, distribute or modify the Program subject to + these terms and conditions. You may not impose any further restrictions + on the recipients' exercise of the rights granted herein. You are not + responsible for enforcing compliance by third parties to this License. + + 7. If, as a consequence of a court judgment or allegation of patent + infringement or for any other reason (not limited to patent issues), + conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not + excuse you from the conditions of this License. If you cannot distribute + so as to satisfy simultaneously your obligations under this License and + any other pertinent obligations, then as a consequence you may not + distribute the Program at all. For example, if a patent license would + not permit royalty-free redistribution of the Program by all those who + receive copies directly or indirectly through you, then the only way you + could satisfy both it and this License would be to refrain entirely from + distribution of the Program. + + If any portion of this section is held invalid or unenforceable under + any particular circumstance, the balance of the section is intended to + apply and the section as a whole is intended to apply in other + circumstances. + + It is not the purpose of this section to induce you to infringe any + patents or other property right claims or to contest validity of any + such claims; this section has the sole purpose of protecting the + integrity of the free software distribution system, which is implemented + by public license practices. Many people have made generous + contributions to the wide range of software distributed through that + system in reliance on consistent application of that system; it is up to + the author/donor to decide if he or she is willing to distribute + software through any other system and a licensee cannot impose that choice. + + This section is intended to make thoroughly clear what is believed to be + a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in + certain countries either by patents or by copyrighted interfaces, the + original copyright holder who places the Program under this License may + add an explicit geographical distribution limitation excluding those + countries, so that distribution is permitted only in or among countries + not thus excluded. In such case, this License incorporates the + limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new + versions of the General Public License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the Program + specifies a version number of this License which applies to it and "any + later version", you have the option of following the terms and + conditions either of that version or of any later version published by + the Free Software Foundation. If the Program does not specify a version + number of this License, you may choose any version ever published by the + Free Software Foundation. + + 10. If you wish to incorporate parts of the Program into other free + programs whose distribution conditions are different, write to the + author to ask for permission. For software which is copyrighted by the + Free Software Foundation, write to the Free Software Foundation; we + sometimes make exceptions for this. Our decision will be guided by the + two goals of preserving the free status of all derivatives of our free + software and of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO + WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. + EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR + OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, + EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE + ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH + YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL + NECESSARY SERVICING, REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY + AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR + DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL + DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM + (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED + INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF + THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR + OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest + possible use to the public, the best way to achieve this is to make it + free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest to + attach them to the start of each source file to most effectively convey + the exclusion of warranty; and each file should have at least the + "copyright" line and a pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + + Also add information on how to contact you by electronic and paper mail. + + If the program is interactive, make it output a short notice like this + when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type + `show w'. This is free software, and you are welcome to redistribute + it under certain conditions; type `show c' for details. + + The hypothetical commands `show w' and `show c' should show the + appropriate parts of the General Public License. Of course, the commands + you use may be called something other than `show w' and `show c'; they + could even be mouse-clicks or menu items--whatever suits your program. + + You should also get your employer (if you work as a programmer) or your + school, if any, to sign a "copyright disclaimer" for the program, if + necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + program `Gnomovision' (which makes passes at compilers) written by + James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + + This General Public License does not permit incorporating your program + into proprietary programs. If your program is a subroutine library, you + may consider it more useful to permit linking proprietary applications + with the library. If this is what you want to do, use the GNU Library + General Public License instead of this License. + +--- + +## CLASSPATH EXCEPTION + + Linking this library statically or dynamically with other modules is + making a combined work based on this library. Thus, the terms and + conditions of the GNU General Public License version 2 cover the whole + combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent + modules, and to copy and distribute the resulting executable under + terms of your choice, provided that you also meet, for each linked + independent module, the terms and conditions of the license of that + module. An independent module is a module which is not derived from or + based on this library. If you modify this library, you may extend this + exception to your version of the library, but you are not obligated to + do so. If you do not wish to do so, delete this exception statement + from your version. diff --git a/distribution/proxy/src/main/release-docs/licenses/LICENSE-javax.annotation-api.txt b/distribution/proxy/src/main/release-docs/licenses/LICENSE-javax.annotation-api.txt deleted file mode 100644 index b1c74f95ede8b..0000000000000 --- a/distribution/proxy/src/main/release-docs/licenses/LICENSE-javax.annotation-api.txt +++ /dev/null @@ -1,759 +0,0 @@ -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 - -1. Definitions. - - 1.1. "Contributor" means each individual or entity that creates or - contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Software, prior Modifications used by a Contributor (if any), and - the Modifications made by that particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or (b) - Modifications, or (c) the combination of files containing Original - Software with files containing Modifications, in each case including - portions thereof. - - 1.4. "Executable" means the Covered Software in any form other than - Source Code. - - 1.5. "Initial Developer" means the individual or entity that first - makes Original Software available under this License. - - 1.6. "Larger Work" means a work which combines Covered Software or - portions thereof with code not governed by the terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable form of - any of the following: - - A. Any file that results from an addition to, deletion from or - modification of the contents of a file containing Original Software - or previous Modifications; - - B. Any new file that contains any part of the Original Software or - previous Modification; or - - C. Any new file that is contributed or otherwise made available - under the terms of this License. - - 1.10. "Original Software" means the Source Code and Executable form - of computer software code that is originally released under this - License. - - 1.11. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer software - code in which modifications are made and (b) associated - documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, - this License. For legal entities, "You" includes any entity which - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, the Initial Developer - hereby grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer, to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Software (or portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using or selling of - Original Software, to make, have made, use, practice, sell, and - offer for sale, and/or otherwise dispose of the Original Software - (or portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) are effective on - the date Initial Developer first distributes or otherwise makes the - Original Software available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: (1) for code that You delete from the Original Software, or - (2) for infringements caused by: (i) the modification of the - Original Software, or (ii) the combination of the Original Software - with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, each Contributor hereby - grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as Covered Software - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling - of Modifications made by that Contributor either alone and/or in - combination with its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, have made, and/or - otherwise dispose of: (1) Modifications made by that Contributor (or - portions thereof); and (2) the combination of Modifications made by - that Contributor with its Contributor Version (or portions of such - combination). - - (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective - on the date Contributor first distributes or otherwise makes the - Modifications available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: (1) for any code that Contributor has deleted from the - Contributor Version; (2) for infringements caused by: (i) third - party modifications of Contributor Version, or (ii) the combination - of Modifications made by that Contributor with other software - (except as part of the Contributor Version) or other devices; or (3) - under Patent Claims infringed by Covered Software in the absence of - Modifications made by that Contributor. - -3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make available - in Executable form must also be made available in Source Code form - and that Source Code form must be distributed only under the terms - of this License. You must include a copy of this License with every - copy of the Source Code form of the Covered Software You distribute - or otherwise make available. You must inform recipients of any such - Covered Software in Executable form as to how they can obtain such - Covered Software in Source Code form in a reasonable manner on or - through a medium customarily used for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You contribute are - governed by the terms of this License. You represent that You - believe Your Modifications are Your original creation(s) and/or You - have sufficient rights to grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications that - identifies You as the Contributor of the Modification. You may not - remove or alter any copyright, patent or trademark notices contained - within the Covered Software, or any notices of licensing or any - descriptive text giving attribution to any Contributor or the - Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered Software in - Source Code form that alters or restricts the applicable version of - this License or the recipients' rights hereunder. You may choose to - offer, and to charge a fee for, warranty, support, indemnity or - liability obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on behalf of - the Initial Developer or any Contributor. You must make it - absolutely clear that any such warranty, support, indemnity or - liability obligation is offered by You alone, and You hereby agree - to indemnify the Initial Developer and every Contributor for any - liability incurred by the Initial Developer or such Contributor as a - result of warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered Software under - the terms of this License or under the terms of a license of Your - choice, which may contain terms different from this License, - provided that You are in compliance with the terms of this License - and that the license for the Executable form does not attempt to - limit or alter the recipient's rights in the Source Code form from - the rights set forth in this License. If You distribute the Covered - Software in Executable form under a different license, You must make - it absolutely clear that any terms which differ from this License - are offered by You alone, not by the Initial Developer or - Contributor. You hereby agree to indemnify the Initial Developer and - every Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software with - other code not governed by the terms of this License and distribute - the Larger Work as a single product. In such a case, You must make - sure the requirements of this License are fulfilled for the Covered - Software. - -4. Versions of the License. - - 4.1. New Versions. - - Oracle is the initial license steward and may publish revised and/or - new versions of this License from time to time. Each version will be - given a distinguishing version number. Except as provided in Section - 4.3, no one other than the license steward has the right to modify - this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise make the - Covered Software available under the terms of the version of the - License under which You originally received the Covered Software. If - the Initial Developer includes a notice in the Original Software - prohibiting it from being distributed or otherwise made available - under any subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the version - of the License under which You originally received the Covered - Software. Otherwise, You may also choose to use, distribute or - otherwise make the Covered Software available under the terms of any - subsequent version of the License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a new - license for Your Original Software, You may create and use a - modified version of this License if You: (a) rename the license and - remove any references to the name of the license steward (except to - note that the license differs from this License); and (b) otherwise - make it clear that the license contains terms which differ from this - License. - -5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE - IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR - NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE - DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY - OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, - REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN - ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS - AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -6. TERMINATION. - - 6.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to - cure such breach within 30 days of becoming aware of the breach. - Provisions which, by their nature, must remain in effect beyond the - termination of this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or a - Contributor (the Initial Developer or Contributor against whom You - assert such claim is referred to as "Participant") alleging that the - Participant Software (meaning the Contributor Version where the - Participant is a Contributor or the Original Software where the - Participant is the Initial Developer) directly or indirectly - infringes any patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial Developer (if the - Initial Developer is not the Participant) and all Contributors under - Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice - from Participant terminate prospectively and automatically at the - expiration of such 60 day notice period, unless if within such 60 - day period You withdraw Your claim with respect to the Participant - Software against such Participant either unilaterally or pursuant to - a written agreement with Participant. - - 6.3. If You assert a patent infringement claim against Participant - alleging that the Participant Software directly or indirectly - infringes any patent where such claim is resolved (such as by - license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 6.4. In the event of termination under Sections 6.1 or 6.2 above, - all end user licenses that have been validly granted by You or any - distributor hereunder prior to termination (excluding licenses - granted to You by any distributor) shall survive termination. - -7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE - TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER - FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR - LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE - POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT - APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH - PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH - LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR - LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION - AND LIMITATION MAY NOT APPLY TO YOU. - -8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is defined - in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" (as that term is defined at 48 C.F.R. § - 252.227-7014(a)(1)) and "commercial computer software documentation" - as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent - with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 - (June 1995), all U.S. Government End Users acquire Covered Software - with only those rights set forth herein. This U.S. Government Rights - clause is in lieu of, and supersedes, any other FAR, DFAR, or other - clause or provision that addresses Government rights in computer - software under this License. - -9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - the law of the jurisdiction specified in a notice contained within - the Original Software (except to the extent applicable law, if any, - provides otherwise), excluding such jurisdiction's conflict-of-law - provisions. Any litigation relating to this License shall be subject - to the jurisdiction of the courts located in the jurisdiction and - venue specified in a notice contained within the Original Software, - with the losing party responsible for costs, including, without - limitation, court costs and reasonable attorneys' fees and expenses. - The application of the United Nations Convention on Contracts for - the International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall be - construed against the drafter shall not apply to this License. You - agree that You alone are responsible for compliance with the United - States export administration regulations (and the export control - laws and regulation of any other countries) when You use, distribute - or otherwise make available any Covered Software. - -10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - ------------------------------------------------------------------------- - -NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION -LICENSE (CDDL) - -The code released under the CDDL shall be governed by the laws of the -State of California (excluding conflict-of-law provisions). Any -litigation relating to this License shall be subject to the jurisdiction -of the Federal Courts of the Northern District of California and the -state courts of the State of California, with venue lying in Santa Clara -County, California. - - - - The GNU General Public License (GPL) Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor -Boston, MA 02110-1335 -USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to -share and change it. By contrast, the GNU General Public License is -intended to guarantee your freedom to share and change free software--to -make sure the software is free for all its users. This General Public -License applies to most of the Free Software Foundation's software and -to any other program whose authors commit to using it. (Some other Free -Software Foundation software is covered by the GNU Library General -Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. -Our General Public Licenses are designed to make sure that you have the -freedom to distribute copies of free software (and charge for this -service if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone -to deny you these rights or to ask you to surrender the rights. These -restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis -or for a fee, you must give the recipients all the rights that you have. -You must make sure that they, too, receive or can get the source code. -And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -Finally, any free program is threatened constantly by software patents. -We wish to avoid the danger that redistributors of a free program will -individually obtain patent licenses, in effect making the program -proprietary. To prevent this, we have made it clear that any patent must -be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and -modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a -notice placed by the copyright holder saying it may be distributed under -the terms of this General Public License. The "Program", below, refers -to any such program or work, and a "work based on the Program" means -either the Program or any derivative work under copyright law: that is -to say, a work containing the Program or a portion of it, either -verbatim or with modifications and/or translated into another language. -(Hereinafter, translation is included without limitation in the term -"modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of running -the Program is not restricted, and the output from the Program is -covered only if its contents constitute a work based on the Program -(independent of having been made by running the Program). Whether that -is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each copy an appropriate copyright notice -and disclaimer of warranty; keep intact all the notices that refer to -this License and to the absence of any warranty; and give any other -recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of -it, thus forming a work based on the Program, and copy and distribute -such modifications or work under the terms of Section 1 above, provided -that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any part - thereof, to be licensed as a whole at no charge to all third parties - under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this License. - (Exception: if the Program itself is interactive but does not - normally print such an announcement, your work based on the Program - is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, and -can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based on -the Program, the distribution of the whole must be on the terms of this -License, whose permissions for other licensees extend to the entire -whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of a -storage or distribution medium does not bring the other work under the -scope of this License. - -3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your cost - of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed - only for noncommercial distribution and only if you received the - program in object code or executable form with such an offer, in - accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source code -means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to control -compilation and installation of the executable. However, as a special -exception, the source code distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies the -executable. - -If distribution of executable or object code is made by offering access -to copy from a designated place, then offering equivalent access to copy -the source code from the same place counts as distribution of the source -code, even though third parties are not compelled to copy the source -along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt otherwise -to copy, modify, sublicense or distribute the Program is void, and will -automatically terminate your rights under this License. However, parties -who have received copies, or rights, from you under this License will -not have their licenses terminated so long as such parties remain in -full compliance. - -5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and all -its terms and conditions for copying, distributing or modifying the -Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further restrictions -on the recipients' exercise of the rights granted herein. You are not -responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot distribute -so as to satisfy simultaneously your obligations under this License and -any other pertinent obligations, then as a consequence you may not -distribute the Program at all. For example, if a patent license would -not permit royalty-free redistribution of the Program by all those who -receive copies directly or indirectly through you, then the only way you -could satisfy both it and this License would be to refrain entirely from -distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is implemented -by public license practices. Many people have made generous -contributions to the wide range of software distributed through that -system in reliance on consistent application of that system; it is up to -the author/donor to decide if he or she is willing to distribute -software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be -a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License may -add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among countries -not thus excluded. In such case, this License incorporates the -limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new -versions of the General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Program does not specify a version -number of this License, you may choose any version ever published by the -Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the -author to ask for permission. For software which is copyrighted by the -Free Software Foundation, write to the Free Software Foundation; we -sometimes make exceptions for this. Our decision will be guided by the -two goals of preserving the free status of all derivatives of our free -software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, -EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH -YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL -NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR -DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL -DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM -(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF -THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR -OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type - `show w'. This is free software, and you are welcome to redistribute - it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the commands -you use may be called something other than `show w' and `show c'; they -could even be mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (which makes passes at compilers) written by - James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications -with the library. If this is what you want to do, use the GNU Library -General Public License instead of this License. - -# - -Certain source files distributed by Oracle America, Inc. and/or its -affiliates are subject to the following clarification and special -exception to the GPLv2, based on the GNU Project exception for its -Classpath libraries, known as the GNU Classpath Exception, but only -where Oracle has expressly included in the particular source file's -header the words "Oracle designates this particular file as subject to -the "Classpath" exception as provided by Oracle in the LICENSE file -that accompanied this code." - -You should also note that Oracle includes multiple, independent -programs in this software package. Some of those programs are provided -under licenses deemed incompatible with the GPLv2 by the Free Software -Foundation and others. For example, the package includes programs -licensed under the Apache License, Version 2.0. Such programs are -licensed to you under their original licenses. - -Oracle facilitates your further distribution of this package by adding -the Classpath Exception to the necessary parts of its GPLv2 code, which -permits you to use that code in combination with other independent -modules not licensed under the GPLv2. However, note that this would -not permit you to commingle code under an incompatible license with -Oracle's GPLv2 licensed code by, for example, cutting and pasting such -code into a file also containing Oracle's GPLv2 licensed code and then -distributing the result. Additionally, if you were to remove the -Classpath Exception from any of the files to which it applies and -distribute the result, you would likely be required to license some or -all of the other code in that distribution under the GPLv2 as well, and -since the GPLv2 is incompatible with the license terms of some items -included in the distribution by Oracle, removing the Classpath -Exception could therefore effectively compromise your ability to -further distribute the package. - -Proceed with caution and we recommend that you obtain the advice of a -lawyer skilled in open source matters before removing the Classpath -Exception or making modifications to this package which may -subsequently be redistributed and/or involve the use of third party -software. - -CLASSPATH EXCEPTION -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License version 2 cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from or -based on this library. If you modify this library, you may extend this -exception to your version of the library, but you are not obligated to -do so. If you do not wish to do so, delete this exception statement -from your version. diff --git a/distribution/proxy/src/main/release-docs/licenses/LICENSE-jta.txt b/distribution/proxy/src/main/release-docs/licenses/LICENSE-jta.txt deleted file mode 100644 index 3f930c9839d2e..0000000000000 --- a/distribution/proxy/src/main/release-docs/licenses/LICENSE-jta.txt +++ /dev/null @@ -1,762 +0,0 @@ -jta License ---------------- - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 - -1. Definitions. - - 1.1. "Contributor" means each individual or entity that creates or - contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Software, prior Modifications used by a Contributor (if any), and - the Modifications made by that particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or (b) - Modifications, or (c) the combination of files containing Original - Software with files containing Modifications, in each case including - portions thereof. - - 1.4. "Executable" means the Covered Software in any form other than - Source Code. - - 1.5. "Initial Developer" means the individual or entity that first - makes Original Software available under this License. - - 1.6. "Larger Work" means a work which combines Covered Software or - portions thereof with code not governed by the terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable form of - any of the following: - - A. Any file that results from an addition to, deletion from or - modification of the contents of a file containing Original Software - or previous Modifications; - - B. Any new file that contains any part of the Original Software or - previous Modification; or - - C. Any new file that is contributed or otherwise made available - under the terms of this License. - - 1.10. "Original Software" means the Source Code and Executable form - of computer software code that is originally released under this - License. - - 1.11. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer software - code in which modifications are made and (b) associated - documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, - this License. For legal entities, "You" includes any entity which - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, the Initial Developer - hereby grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer, to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Software (or portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using or selling of - Original Software, to make, have made, use, practice, sell, and - offer for sale, and/or otherwise dispose of the Original Software - (or portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) are effective on - the date Initial Developer first distributes or otherwise makes the - Original Software available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: (1) for code that You delete from the Original Software, or - (2) for infringements caused by: (i) the modification of the - Original Software, or (ii) the combination of the Original Software - with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, each Contributor hereby - grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as Covered Software - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling - of Modifications made by that Contributor either alone and/or in - combination with its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, have made, and/or - otherwise dispose of: (1) Modifications made by that Contributor (or - portions thereof); and (2) the combination of Modifications made by - that Contributor with its Contributor Version (or portions of such - combination). - - (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective - on the date Contributor first distributes or otherwise makes the - Modifications available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: (1) for any code that Contributor has deleted from the - Contributor Version; (2) for infringements caused by: (i) third - party modifications of Contributor Version, or (ii) the combination - of Modifications made by that Contributor with other software - (except as part of the Contributor Version) or other devices; or (3) - under Patent Claims infringed by Covered Software in the absence of - Modifications made by that Contributor. - -3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make available - in Executable form must also be made available in Source Code form - and that Source Code form must be distributed only under the terms - of this License. You must include a copy of this License with every - copy of the Source Code form of the Covered Software You distribute - or otherwise make available. You must inform recipients of any such - Covered Software in Executable form as to how they can obtain such - Covered Software in Source Code form in a reasonable manner on or - through a medium customarily used for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You contribute are - governed by the terms of this License. You represent that You - believe Your Modifications are Your original creation(s) and/or You - have sufficient rights to grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications that - identifies You as the Contributor of the Modification. You may not - remove or alter any copyright, patent or trademark notices contained - within the Covered Software, or any notices of licensing or any - descriptive text giving attribution to any Contributor or the - Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered Software in - Source Code form that alters or restricts the applicable version of - this License or the recipients' rights hereunder. You may choose to - offer, and to charge a fee for, warranty, support, indemnity or - liability obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on behalf of - the Initial Developer or any Contributor. You must make it - absolutely clear that any such warranty, support, indemnity or - liability obligation is offered by You alone, and You hereby agree - to indemnify the Initial Developer and every Contributor for any - liability incurred by the Initial Developer or such Contributor as a - result of warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered Software under - the terms of this License or under the terms of a license of Your - choice, which may contain terms different from this License, - provided that You are in compliance with the terms of this License - and that the license for the Executable form does not attempt to - limit or alter the recipient's rights in the Source Code form from - the rights set forth in this License. If You distribute the Covered - Software in Executable form under a different license, You must make - it absolutely clear that any terms which differ from this License - are offered by You alone, not by the Initial Developer or - Contributor. You hereby agree to indemnify the Initial Developer and - every Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software with - other code not governed by the terms of this License and distribute - the Larger Work as a single product. In such a case, You must make - sure the requirements of this License are fulfilled for the Covered - Software. - -4. Versions of the License. - - 4.1. New Versions. - - Oracle is the initial license steward and may publish revised and/or - new versions of this License from time to time. Each version will be - given a distinguishing version number. Except as provided in Section - 4.3, no one other than the license steward has the right to modify - this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise make the - Covered Software available under the terms of the version of the - License under which You originally received the Covered Software. If - the Initial Developer includes a notice in the Original Software - prohibiting it from being distributed or otherwise made available - under any subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the version - of the License under which You originally received the Covered - Software. Otherwise, You may also choose to use, distribute or - otherwise make the Covered Software available under the terms of any - subsequent version of the License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a new - license for Your Original Software, You may create and use a - modified version of this License if You: (a) rename the license and - remove any references to the name of the license steward (except to - note that the license differs from this License); and (b) otherwise - make it clear that the license contains terms which differ from this - License. - -5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE - IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR - NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE - DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY - OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, - REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN - ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS - AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -6. TERMINATION. - - 6.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to - cure such breach within 30 days of becoming aware of the breach. - Provisions which, by their nature, must remain in effect beyond the - termination of this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or a - Contributor (the Initial Developer or Contributor against whom You - assert such claim is referred to as "Participant") alleging that the - Participant Software (meaning the Contributor Version where the - Participant is a Contributor or the Original Software where the - Participant is the Initial Developer) directly or indirectly - infringes any patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial Developer (if the - Initial Developer is not the Participant) and all Contributors under - Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice - from Participant terminate prospectively and automatically at the - expiration of such 60 day notice period, unless if within such 60 - day period You withdraw Your claim with respect to the Participant - Software against such Participant either unilaterally or pursuant to - a written agreement with Participant. - - 6.3. If You assert a patent infringement claim against Participant - alleging that the Participant Software directly or indirectly - infringes any patent where such claim is resolved (such as by - license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 6.4. In the event of termination under Sections 6.1 or 6.2 above, - all end user licenses that have been validly granted by You or any - distributor hereunder prior to termination (excluding licenses - granted to You by any distributor) shall survive termination. - -7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE - TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER - FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR - LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE - POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT - APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH - PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH - LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR - LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION - AND LIMITATION MAY NOT APPLY TO YOU. - -8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is defined - in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" (as that term is defined at 48 C.F.R. § - 252.227-7014(a)(1)) and "commercial computer software documentation" - as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent - with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 - (June 1995), all U.S. Government End Users acquire Covered Software - with only those rights set forth herein. This U.S. Government Rights - clause is in lieu of, and supersedes, any other FAR, DFAR, or other - clause or provision that addresses Government rights in computer - software under this License. - -9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - the law of the jurisdiction specified in a notice contained within - the Original Software (except to the extent applicable law, if any, - provides otherwise), excluding such jurisdiction's conflict-of-law - provisions. Any litigation relating to this License shall be subject - to the jurisdiction of the courts located in the jurisdiction and - venue specified in a notice contained within the Original Software, - with the losing party responsible for costs, including, without - limitation, court costs and reasonable attorneys' fees and expenses. - The application of the United Nations Convention on Contracts for - the International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall be - construed against the drafter shall not apply to this License. You - agree that You alone are responsible for compliance with the United - States export administration regulations (and the export control - laws and regulation of any other countries) when You use, distribute - or otherwise make available any Covered Software. - -10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - ------------------------------------------------------------------------- - -NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION -LICENSE (CDDL) - -The code released under the CDDL shall be governed by the laws of the -State of California (excluding conflict-of-law provisions). Any -litigation relating to this License shall be subject to the jurisdiction -of the Federal Courts of the Northern District of California and the -state courts of the State of California, with venue lying in Santa Clara -County, California. - - - - The GNU General Public License (GPL) Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor -Boston, MA 02110-1335 -USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to -share and change it. By contrast, the GNU General Public License is -intended to guarantee your freedom to share and change free software--to -make sure the software is free for all its users. This General Public -License applies to most of the Free Software Foundation's software and -to any other program whose authors commit to using it. (Some other Free -Software Foundation software is covered by the GNU Library General -Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. -Our General Public Licenses are designed to make sure that you have the -freedom to distribute copies of free software (and charge for this -service if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone -to deny you these rights or to ask you to surrender the rights. These -restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis -or for a fee, you must give the recipients all the rights that you have. -You must make sure that they, too, receive or can get the source code. -And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -Finally, any free program is threatened constantly by software patents. -We wish to avoid the danger that redistributors of a free program will -individually obtain patent licenses, in effect making the program -proprietary. To prevent this, we have made it clear that any patent must -be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and -modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a -notice placed by the copyright holder saying it may be distributed under -the terms of this General Public License. The "Program", below, refers -to any such program or work, and a "work based on the Program" means -either the Program or any derivative work under copyright law: that is -to say, a work containing the Program or a portion of it, either -verbatim or with modifications and/or translated into another language. -(Hereinafter, translation is included without limitation in the term -"modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of running -the Program is not restricted, and the output from the Program is -covered only if its contents constitute a work based on the Program -(independent of having been made by running the Program). Whether that -is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each copy an appropriate copyright notice -and disclaimer of warranty; keep intact all the notices that refer to -this License and to the absence of any warranty; and give any other -recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of -it, thus forming a work based on the Program, and copy and distribute -such modifications or work under the terms of Section 1 above, provided -that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any part - thereof, to be licensed as a whole at no charge to all third parties - under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this License. - (Exception: if the Program itself is interactive but does not - normally print such an announcement, your work based on the Program - is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, and -can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based on -the Program, the distribution of the whole must be on the terms of this -License, whose permissions for other licensees extend to the entire -whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of a -storage or distribution medium does not bring the other work under the -scope of this License. - -3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your cost - of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed - only for noncommercial distribution and only if you received the - program in object code or executable form with such an offer, in - accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source code -means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to control -compilation and installation of the executable. However, as a special -exception, the source code distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies the -executable. - -If distribution of executable or object code is made by offering access -to copy from a designated place, then offering equivalent access to copy -the source code from the same place counts as distribution of the source -code, even though third parties are not compelled to copy the source -along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt otherwise -to copy, modify, sublicense or distribute the Program is void, and will -automatically terminate your rights under this License. However, parties -who have received copies, or rights, from you under this License will -not have their licenses terminated so long as such parties remain in -full compliance. - -5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and all -its terms and conditions for copying, distributing or modifying the -Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further restrictions -on the recipients' exercise of the rights granted herein. You are not -responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot distribute -so as to satisfy simultaneously your obligations under this License and -any other pertinent obligations, then as a consequence you may not -distribute the Program at all. For example, if a patent license would -not permit royalty-free redistribution of the Program by all those who -receive copies directly or indirectly through you, then the only way you -could satisfy both it and this License would be to refrain entirely from -distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is implemented -by public license practices. Many people have made generous -contributions to the wide range of software distributed through that -system in reliance on consistent application of that system; it is up to -the author/donor to decide if he or she is willing to distribute -software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be -a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License may -add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among countries -not thus excluded. In such case, this License incorporates the -limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new -versions of the General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Program does not specify a version -number of this License, you may choose any version ever published by the -Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the -author to ask for permission. For software which is copyrighted by the -Free Software Foundation, write to the Free Software Foundation; we -sometimes make exceptions for this. Our decision will be guided by the -two goals of preserving the free status of all derivatives of our free -software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, -EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH -YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL -NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR -DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL -DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM -(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF -THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR -OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type - `show w'. This is free software, and you are welcome to redistribute - it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the commands -you use may be called something other than `show w' and `show c'; they -could even be mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (which makes passes at compilers) written by - James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications -with the library. If this is what you want to do, use the GNU Library -General Public License instead of this License. - -# - -Certain source files distributed by Oracle America, Inc. and/or its -affiliates are subject to the following clarification and special -exception to the GPLv2, based on the GNU Project exception for its -Classpath libraries, known as the GNU Classpath Exception, but only -where Oracle has expressly included in the particular source file's -header the words "Oracle designates this particular file as subject to -the "Classpath" exception as provided by Oracle in the LICENSE file -that accompanied this code." - -You should also note that Oracle includes multiple, independent -programs in this software package. Some of those programs are provided -under licenses deemed incompatible with the GPLv2 by the Free Software -Foundation and others. For example, the package includes programs -licensed under the Apache License, Version 2.0. Such programs are -licensed to you under their original licenses. - -Oracle facilitates your further distribution of this package by adding -the Classpath Exception to the necessary parts of its GPLv2 code, which -permits you to use that code in combination with other independent -modules not licensed under the GPLv2. However, note that this would -not permit you to commingle code under an incompatible license with -Oracle's GPLv2 licensed code by, for example, cutting and pasting such -code into a file also containing Oracle's GPLv2 licensed code and then -distributing the result. Additionally, if you were to remove the -Classpath Exception from any of the files to which it applies and -distribute the result, you would likely be required to license some or -all of the other code in that distribution under the GPLv2 as well, and -since the GPLv2 is incompatible with the license terms of some items -included in the distribution by Oracle, removing the Classpath -Exception could therefore effectively compromise your ability to -further distribute the package. - -Proceed with caution and we recommend that you obtain the advice of a -lawyer skilled in open source matters before removing the Classpath -Exception or making modifications to this package which may -subsequently be redistributed and/or involve the use of third party -software. - -CLASSPATH EXCEPTION -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License version 2 cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from or -based on this library. If you modify this library, you may extend this -exception to your version of the library, but you are not obligated to -do so. If you do not wish to do so, delete this exception statement -from your version. \ No newline at end of file diff --git a/distribution/proxy/src/main/resources/bin/start.sh b/distribution/proxy/src/main/resources/bin/start.sh index b75111486f90d..72b64520580dc 100644 --- a/distribution/proxy/src/main/resources/bin/start.sh +++ b/distribution/proxy/src/main/resources/bin/start.sh @@ -116,7 +116,7 @@ print_usage() { echo "-a Bind addresses, can be IPv4, IPv6, hostname. In" echo " case more than one address is specified in a" echo " comma-separated list. The default value is '0.0.0.0'." - echo "-p Bind port, default is '3307', which could be changed in server.yaml" + echo "-p Bind port, default is '3307', which could be changed in global.yaml" echo "-c Path to config directory of ShardingSphere-Proxy, default is 'conf'" echo "-f Force start ShardingSphere-Proxy" echo "-g Enable agent if shardingsphere-agent deployed in 'agent' directory" diff --git a/distribution/src/pom.xml b/distribution/src/pom.xml index 1db7640fd7b03..0c7dd42e2e521 100644 --- a/distribution/src/pom.xml +++ b/distribution/src/pom.xml @@ -21,7 +21,7 @@ org.apache.shardingsphere shardingsphere-distribution - 5.4.1-SNAPSHOT + 5.5.1-SNAPSHOT shardingsphere-src-distribution pom diff --git a/docs/.gitignore b/docs/.gitignore deleted file mode 100644 index db90cd99f0292..0000000000000 --- a/docs/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -# maven ignore -target/ - -# hugo ignore -public/ - -# eclipse ignore -.settings/ -.project -.classpath - -# idea ignore -.idea/ -*.ipr -*.iml -*.iws - -# temp ignore -logs/ -*.doc -*.log -*.cache -*.diff -*.patch -*.tmp - -# system ignore -.DS_Store -Thumbs.db - -*.class -*.html-e diff --git a/docs/README.md b/docs/README.md index 862f625e20490..ad434b8542ef3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -16,12 +16,6 @@ Follow the steps below to deploy ShardingSphere website, 1. If you modify `docs/build.sh`, please test it locally. -> shardingsphere-doc support docker hugo to build the website, you can use the following command to build: -> 1. Go to the root directory of `shardingsphere-doc` -> 2. Execute docker build command `docker build .github/docker/ -t docker-hugo:latest` -> 3. Execute `build-with-docker.sh` like `build.sh` -> 4. If test it locally, go to the directory container config.toml and execute command `docker run --rm -it -p1313:1313 --volume $(pwd):/opt/input docker-hugo:latest server --bind 0.0.0.0` - ## HOW to insert a video of Bilibili or YouTube? 1. First please make sure you get the correct url of the video you want to add. diff --git a/docs/blog/content/material/2022_03_09_SQL_Parse_Format_Function_A_Technical_Deep_Dive_by_Apache_ShardingSphere.en.md b/docs/blog/content/material/2022_03_09_SQL_Parse_Format_Function_A_Technical_Deep_Dive_by_Apache_ShardingSphere.en.md index 0e56080a256ee..9bd23a0a6f61a 100644 --- a/docs/blog/content/material/2022_03_09_SQL_Parse_Format_Function_A_Technical_Deep_Dive_by_Apache_ShardingSphere.en.md +++ b/docs/blog/content/material/2022_03_09_SQL_Parse_Format_Function_A_Technical_Deep_Dive_by_Apache_ShardingSphere.en.md @@ -89,6 +89,7 @@ simpleSelect 2. We can use IDEA’s ANTLR4 plugin to easily view the syntax tree of the SQL statement. For more information of ANTLR4 , please refer to: [https://plugins.jetbrains.com/plugin/7358-antlr-v4](https://plugins.jetbrains.com/plugin/7358-antlr-v4.). + ![Image description](https://miro.medium.com/max/700/1*EiWkP_kYN3sLOH4qsPonDA.jpeg) ANTLR4 can compile the syntax file we define: it first performs lexical analysis on the SQL statement, splits it into indivisible parts, namely tokens, and divides these tokens into keywords, expressions, according to the dictionary values of different databases. @@ -117,7 +118,7 @@ public ParseContext parse(final String sql) { private ParseASTNode twoPhaseParse(final String sql) { DatabaseTypedSQLParserFacade sqlParserFacade = DatabaseTypedSQLParserFacadeRegistry.getFacade(databaseType); - SQLParser sqlParser = SQLParserFactory.newInstance(sql, sqlParserFacade.getLexerClass(), sqlParserFacade.getParserClass(), sqlCommentParseEnabled); + SQLParser sqlParser = SQLParserFactory.newInstance(sql, sqlParserFacade.getLexerClass(), sqlParserFacade.getParserClass()); try { ((Parser) sqlParser).getInterpreter().setPredictionMode(PredictionMode.SLL); return (ParseASTNode) sqlParser.parse(); @@ -157,6 +158,7 @@ At first, in terms of the above-mentioned `Visitor` method, the visitor to be us Next, let’s still take the SQL statement as an example and provide specific code to show how `Visitor` formats it. `MySQLFormatSQLVisitor` is used to visit SQL. Based on the `DEBUG` code, we can clearly see the execution path of this visit as shown in the figure below. Visitor traverses all parts of the syntax tree, and ANTLR4 generates default methods for visiting each node according to the defined grammar rules. Apache ShardingSphere leverages key methods and successfully develops complete the SQL formatting function. + ![Image description](https://miro.medium.com/max/700/1*xjjACczbInC-K4t8EX-pEw.jpeg) The following code can help us better understand how `Visitor` can format SQL. @@ -235,6 +237,7 @@ public static void main(String[] args) { ``` - Parameters Supported by Properties + ![Image description](https://miro.medium.com/max/550/1*1Ft7G0EKkayVy5vrbcsDBg.png) You can also use DistSQL in ShardingSphere-Proxy to perform operations on the SQL Parse Format function: @@ -279,6 +282,7 @@ Currently, Apache ShardingSphere’s Format function only supports [MySQL](https ## Author **Chen Chuxin** + ![Image description](https://miro.medium.com/max/634/1*smrIU5STVJsJRais0_Tghg.png) > SphereEx Middleware Engineer & Apache ShardingSphere Committer diff --git "a/docs/blog/content/material/2022_03_11_Asia\342\200\231s_E-Commerce_Giant_Dangdang_Increases_Order_Processing_Speed_by_30%_Saves_Over_Ten_Million_in_Technology_Budget_with_Apache_ShardingSphere.en.md" "b/docs/blog/content/material/2022_03_11_Asia\342\200\231s_E-Commerce_Giant_Dangdang_Increases_Order_Processing_Speed_by_30%_Saves_Over_Ten_Million_in_Technology_Budget_with_Apache_ShardingSphere.en.md" index e198916874919..861aa40dfe01a 100644 --- "a/docs/blog/content/material/2022_03_11_Asia\342\200\231s_E-Commerce_Giant_Dangdang_Increases_Order_Processing_Speed_by_30%_Saves_Over_Ten_Million_in_Technology_Budget_with_Apache_ShardingSphere.en.md" +++ "b/docs/blog/content/material/2022_03_11_Asia\342\200\231s_E-Commerce_Giant_Dangdang_Increases_Order_Processing_Speed_by_30%_Saves_Over_Ten_Million_in_Technology_Budget_with_Apache_ShardingSphere.en.md" @@ -8,7 +8,7 @@ chapter = true > - Li Yong, Head of WMS Technology, Dangdang -Ffollowing [Apache ShardingSphere 5.0.0 GA](https://medium.com/codex/apache-shardingsphere-5-0-0-new-features-middleware-to-ecosystem-evolution-e69de00bfb1b) release in November 2021, the [5.1.0 version](https://shardingsphere.medium.com/apache-shardingsphere-5-1-0-now-avaliable-4244ac470e77) was released last month. Having gone through over two years of polishing, ShardingSphere’s plugin-oriented ecosystem is beginning to take shape, and the project embarks on the evolution from a simple data sharding middleware to a mature distributed database ecosystem driven by the concept of [Database Plus](https://www.infoq.com/articles/next-evolution-of-database-sharding-architecture/). +Following [Apache ShardingSphere 5.0.0 GA](https://medium.com/codex/apache-shardingsphere-5-0-0-new-features-middleware-to-ecosystem-evolution-e69de00bfb1b) release in November 2021, the [5.1.0 version](https://shardingsphere.medium.com/apache-shardingsphere-5-1-0-now-avaliable-4244ac470e77) was released last month. Having gone through over two years of polishing, ShardingSphere’s plugin-oriented ecosystem is beginning to take shape, and the project embarks on the evolution from a simple data sharding middleware to a mature distributed database ecosystem driven by the concept of [Database Plus](https://www.infoq.com/articles/next-evolution-of-database-sharding-architecture/). Dangdang, established at the end of 1999, has become a leading e-commerce platform selling books of any kind, and by integrating new Internet technologies with the traditional book industry. Dangdang was founded during the surge in China’s Internet industry in the early 2000s. @@ -115,7 +115,7 @@ Recently, to celebrate the third anniversary of ShardingSphere entering Apache S - On November 10, 2021, Version 5.0.0 GA was released as a third-anniversity celebration with the whole Apache ShardingSphere community, and the distributed database industry. ![Apache ShardingSphere—Roadmap](https://miro.medium.com/max/1400/0*ejOCiszgebnrZ2kx) -Since Version 5.0.0, Apache ShardingSphere has embarked on its new journey: with the plugin oriented architect at its core, it evloved from a data sharding application to a comprehensive and enhanced data governance tool applicable to various complex application scenarios. Concurrently, Apache ShardingSphere also has more features, and big data solutions. +Since Version 5.0.0, Apache ShardingSphere has embarked on its new journey: With the plugin oriented architect at its core, it evloved from a data sharding application to a comprehensive and enhanced data governance tool applicable to various complex application scenarios. Concurrently, Apache ShardingSphere also has more features, and big data solutions. ## Conclusion diff --git a/docs/blog/content/material/2022_03_16_Create_a_Distributed_Database_with_High_Availability_with_Apache_ShardingSphere.en.md b/docs/blog/content/material/2022_03_16_Create_a_Distributed_Database_with_High_Availability_with_Apache_ShardingSphere.en.md index 382f92818d104..2dae7f6591b51 100644 --- a/docs/blog/content/material/2022_03_16_Create_a_Distributed_Database_with_High_Availability_with_Apache_ShardingSphere.en.md +++ b/docs/blog/content/material/2022_03_16_Create_a_Distributed_Database_with_High_Availability_with_Apache_ShardingSphere.en.md @@ -69,7 +69,7 @@ dataSources: rules: - !READWRITE_SPLITTING - dataSources: + dataSourceGroups: replication_ds: type: Dynamic props: diff --git a/docs/blog/content/material/2022_03_18_Executor_Engine_Performance_Optimization_Showcase_with_Apache_ShardingSphere_5.1.0.en.md b/docs/blog/content/material/2022_03_18_Executor_Engine_Performance_Optimization_Showcase_with_Apache_ShardingSphere_5.1.0.en.md index de907072ec90f..37b97f3f5db4b 100644 --- a/docs/blog/content/material/2022_03_18_Executor_Engine_Performance_Optimization_Showcase_with_Apache_ShardingSphere_5.1.0.en.md +++ b/docs/blog/content/material/2022_03_18_Executor_Engine_Performance_Optimization_Showcase_with_Apache_ShardingSphere_5.1.0.en.md @@ -431,7 +431,7 @@ rules: worker-id: 123 ``` -We use the JMH test program to test different CASEs: +We use the JMH test program to test different cases: ``` @State(Scope.Thread) @@ -483,10 +483,11 @@ This blog only covers the SQL Executor Engine and its optimizations. In the futu - https://shardingsphere.apache.org/document/current/en/reference/sharding/execute/ - https://github.com/apache/shardingsphere/issues/13942 - **MySQL UNION:** https://dev.mysql.com/doc/refman/8.0/en/union.html -- **PostgreSQL UNION:**https://www.postgresql.org/docs/14/sql-select.html +- **PostgreSQL UNION:** https://www.postgresql.org/docs/14/sql-select.html - **Oracle UNION:** https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/The-UNION-ALL-INTERSECT-MINUS-Operators.html - **SQL Server UNION:** https://docs.microsoft.com/en-us/sql/t-sql/language-elements/set-operators-union-transact-sql?view=sql-server-ver15 -- + + ## Author **Duan Zhengqiang** diff --git a/docs/blog/content/material/2022_03_23_Apache_ShardingSphere_Proxy_Performance_with_PostgreSQL_is_Improved_26.8%_with_Version_5.1.0.en.md b/docs/blog/content/material/2022_03_23_Apache_ShardingSphere_Proxy_Performance_with_PostgreSQL_is_Improved_26.8%_with_Version_5.1.0.en.md index 06b569bc4e07e..e168a3e7a1113 100644 --- a/docs/blog/content/material/2022_03_23_Apache_ShardingSphere_Proxy_Performance_with_PostgreSQL_is_Improved_26.8%_with_Version_5.1.0.en.md +++ b/docs/blog/content/material/2022_03_23_Apache_ShardingSphere_Proxy_Performance_with_PostgreSQL_is_Improved_26.8%_with_Version_5.1.0.en.md @@ -296,7 +296,7 @@ Moreover, ShardingSphere as an infrastructure, its performance is one of the key Apache ShardingSphere Open Source Project Links: [ShardingSphere Github](https://github.com/apache/shardingsphere) [ShardingSphere Twitter](https://twitter.com/ShardingSphere) -[ShardingSphere Slack Channel](https://apacheshardingsphere.slack.com/ssb/redirect) +[ShardingSphere Slack Channel](https://join.slack.com/t/apacheshardingsphere/shared_invite/zt-sbdde7ie-SjDqo9~I4rYcR18bq0SYTg) [Contributor Guide](https://shardingsphere.apache.org/community/cn/involved/) ### Author diff --git a/docs/blog/content/material/2022_03_29_CITIC_Industrial_Cloud_Apache_ShardingSphere_Enterprise_Applications.en.md b/docs/blog/content/material/2022_03_29_CITIC_Industrial_Cloud_Apache_ShardingSphere_Enterprise_Applications.en.md index f29a8406dcd60..e278a6aa82bef 100644 --- a/docs/blog/content/material/2022_03_29_CITIC_Industrial_Cloud_Apache_ShardingSphere_Enterprise_Applications.en.md +++ b/docs/blog/content/material/2022_03_29_CITIC_Industrial_Cloud_Apache_ShardingSphere_Enterprise_Applications.en.md @@ -64,7 +64,7 @@ If the user needs to perform a Federation query in a relational database, it can [ShardingSphere Twitter](https://twitter.com/ShardingSphere) -[ShardingSphere Slack](https://apacheshardingsphere.slack.com/ssb/redirect) +[ShardingSphere Slack](https://join.slack.com/t/apacheshardingsphere/shared_invite/zt-sbdde7ie-SjDqo9~I4rYcR18bq0SYTg) [ Contributor Guide](https://shardingsphere.apache.org/community/cn/involved/) diff --git a/docs/blog/content/material/2022_04_06_A_Holistic_Pluggable_Platform_for_Data_Sharding_ICDE_2022_Understanding_Apache_ShardingSphere.en.md b/docs/blog/content/material/2022_04_06_A_Holistic_Pluggable_Platform_for_Data_Sharding_ICDE_2022_Understanding_Apache_ShardingSphere.en.md index 5d2a35884ed23..5d07f2f5efac6 100644 --- a/docs/blog/content/material/2022_04_06_A_Holistic_Pluggable_Platform_for_Data_Sharding_ICDE_2022_Understanding_Apache_ShardingSphere.en.md +++ b/docs/blog/content/material/2022_04_06_A_Holistic_Pluggable_Platform_for_Data_Sharding_ICDE_2022_Understanding_Apache_ShardingSphere.en.md @@ -55,7 +55,7 @@ Currently, more than 170 companies are using ShardingSphere. This article is bas ## System Architecture and Data Flow As shown in Figure 2, ShardingSphere can be divided into five modules: -1. **dData source:** It enables storage by integrating various databases and currently supports data sources such as MySQL, PostgreSQL, SQL Server, Oracle, MariaDB and openGuass. +1. **dData source:** It enables storage by integrating various databases and currently supports data sources such as MySQL, PostgreSQL, SQL Server, Oracle, MariaDB and openGauss. 2. **Function:** It provides many out-of-the-box features that can be freely added, combined, or deleted as needed. 3. **Governor** is mainly used for configuration management and health monitoring. 4. **SQL engine.** With the complete data sharding SQL engine, all functions are pluggable, and any function can be implemented through a SQL statement. diff --git a/docs/blog/content/material/2022_04_13_A_Practical_Guide_to_Apache_ShardingSphere's_HINT.en.md b/docs/blog/content/material/2022_04_13_A_Practical_Guide_to_Apache_ShardingSphere's_HINT.en.md index 0f66d96da19d8..8c0ef95f2b1e0 100644 --- a/docs/blog/content/material/2022_04_13_A_Practical_Guide_to_Apache_ShardingSphere's_HINT.en.md +++ b/docs/blog/content/material/2022_04_13_A_Practical_Guide_to_Apache_ShardingSphere's_HINT.en.md @@ -276,9 +276,7 @@ Next, I’d like to showcase how to use `SQL HINT`. - **How to Use SQL HINT** `SQL HINT` is easy to use with ShardingSphere-JDBC and ShardingSphere-Proxy. -Step 1: Turn on the annotation parser and set `sqlCommentParseEnabled` to true. - -Step 2: Add SQL comments. Currently `SQL HINT` supports specifying data source routing and primary database routing. +Step 1: Add SQL comments. Currently `SQL HINT` supports specifying data source routing and primary database routing. - Data source-specified Routing: currently only supports routing to one data source. The comment format only supports `/* */` for the time being and starts with `ShardingSphere hint`: with the attribute name `dataSourceName`. diff --git a/docs/blog/content/material/2022_04_26_How_to_Use_ShardingSphere-Proxy_in_Real_Production_Scenarios_Your_Quick_Start_Guide.en.md b/docs/blog/content/material/2022_04_26_How_to_Use_ShardingSphere-Proxy_in_Real_Production_Scenarios_Your_Quick_Start_Guide.en.md index 6daeb070d09ae..d3e2d68d4f6c5 100644 --- a/docs/blog/content/material/2022_04_26_How_to_Use_ShardingSphere-Proxy_in_Real_Production_Scenarios_Your_Quick_Start_Guide.en.md +++ b/docs/blog/content/material/2022_04_26_How_to_Use_ShardingSphere-Proxy_in_Real_Production_Scenarios_Your_Quick_Start_Guide.en.md @@ -115,7 +115,6 @@ rules: #Verification Info defaultType: XA providerType: Atomikos - !SQL_PARSER - sqlCommentParseEnabled: true sqlStatementCache: initialCapacity: 2000 maximumSize: 65535 diff --git "a/docs/blog/content/material/2022_05_10_What\342\200\231s_the_Database_Plus_concept_and_what_challenges_can_it_solve.en.md" "b/docs/blog/content/material/2022_05_10_What\342\200\231s_the_Database_Plus_concept_and_what_challenges_can_it_solve.en.md" index 3176a55cc73db..206f8c0c5622f 100644 --- "a/docs/blog/content/material/2022_05_10_What\342\200\231s_the_Database_Plus_concept_and_what_challenges_can_it_solve.en.md" +++ "b/docs/blog/content/material/2022_05_10_What\342\200\231s_the_Database_Plus_concept_and_what_challenges_can_it_solve.en.md" @@ -67,7 +67,7 @@ Thanks to the implementation of the Database access protocol, Database Plus prov Moreover, Database Plus supports maximum conversion between SQL dialects. An AST (abstract syntax tree) that parses SQL can be used to regenerate SQL according to the rules of other database dialects. The SQL dialect conversion makes it possible for heterogeneous databases to access each other. This way, users can use any SQL dialect to access heterogeneous underlying databases. -**Database gateway is the best interpretation of Connect. **It is the prerequisite for Database Plus providing a solution for database fragmentation. This is done by building a common open docking layer positioned in the upper layer of the database, to pool all the access traffic of the fragmented databases. +**Database gateway is the best interpretation of Connect.** It is the prerequisite for Database Plus providing a solution for database fragmentation. This is done by building a common open docking layer positioned in the upper layer of the database, to pool all the access traffic of the fragmented databases. ### 2. Enhance: database computing enhancement engine Following decades of development, databases now boast their own query optimizer, transaction engine, storage engine, and other time-tested storage and computing capabilities and design models. With the advent of the distributed and cloud native era, original computing and storage capabilities of the database will be scattered and woven into a distributed and cloud native level of new capabilities. @@ -172,4 +172,4 @@ Among our recent achievements we’re particulary proud of, Apache ShardingSpher ## Author Zhang Liang, the founder & CEO of [SphereEx](https://www.sphere-ex.com), served as the head of the architecture and database team of many large well-known Internet enterprises. He is enthusiastic about open source and is the founder and PMC chair of Apache ShardingSphere, ElasticJob, and other well-known open source projects. -He is now a member of the [Apache Software Foundation](https://www.apache.org), a [Microsoft MVP](https://mvp.microsoft.com), [Tencent Cloud TVP](https://cloud.tencent.com/tvp), and [Huawei Cloud MVP](https://developer.huaweicloud.com/mvp) and has more than 10 years of experience in the field of architecture and database. He advocates for elegant code, and has made great achievements in distributed database technology and academic research. He has served as a producer and speaker at dozens of major domestic and international industry and technology summits, including ApacheCon, QCon, AWS summit, DTCC, SACC, and DTC. In addition, he has published the book “Future Architecture: From Service to Cloud Native” as well as the paper “Apache ShardingSphere: A Holistic and Pluggable Platform for Data Sharding” published at this year’s ICDE, a top conference in the database field. \ No newline at end of file +He is now a member of the [Apache Software Foundation](https://www.apache.org), a [Microsoft MVP](https://mvp.microsoft.com), [Tencent Cloud TVP](https://cloud.tencent.com/tvp), and [Huawei Cloud MVP](https://developer.huaweicloud.com/mvp) and has more than 10 years of experience in the field of architecture and database. He advocates for elegant code, and has made great achievements in distributed database technology and academic research. He has served as a producer and speaker at dozens of major domestic and international industry and technology summits, including ApacheCon, QCon, AWS summit, DTCC, SACC, and DTC. In addition, he has published the book “Future Architecture: From Service to Cloud Native” as well as the paper “Apache ShardingSphere: A Holistic and Pluggable Platform for Data Sharding” published at this year’s ICDE, a top conference in the database field. diff --git "a/docs/blog/content/material/2022_05_19_Apache_ShardingSphere_Enterprise_User_Case_Zhongshang_Huimin\342\200\231s_Transaction_Middle_Platform_Architecture.en.md" "b/docs/blog/content/material/2022_05_19_Apache_ShardingSphere_Enterprise_User_Case_Zhongshang_Huimin\342\200\231s_Transaction_Middle_Platform_Architecture.en.md" index 0158e1d852809..39118406724d7 100644 --- "a/docs/blog/content/material/2022_05_19_Apache_ShardingSphere_Enterprise_User_Case_Zhongshang_Huimin\342\200\231s_Transaction_Middle_Platform_Architecture.en.md" +++ "b/docs/blog/content/material/2022_05_19_Apache_ShardingSphere_Enterprise_User_Case_Zhongshang_Huimin\342\200\231s_Transaction_Middle_Platform_Architecture.en.md" @@ -124,6 +124,7 @@ We found that in the `MEMORY_STRICTLY` mode, the operation would become I/O-inte ## ShardingSphere Benefits **1. Performance improvement** + Through architecture rebuilding, it can effectively control the amount of single table data, and greatly reduce the slow SQL, down nearly 50%. **2. Save R&D resources and lower cost** @@ -143,4 +144,4 @@ In his book [Building Microservices, Sam Newman](https://samnewman.io/books/buil Software architect at Zhongshang Huimin E-Commerce platform team. -Participated in the 0–1 process of middle platform construction, mainly responsible for the R&D and building the transaction and commodity middle platform and the search platform. \ No newline at end of file +Participated in the 0–1 process of middle platform construction, mainly responsible for the R&D and building the transaction and commodity middle platform and the search platform. diff --git a/docs/blog/content/material/2022_05_24_Your_Guide_to_DistSQL_Cluster_Governance_Capability_Apache_ShardingSphere_Feature_Update.en.md b/docs/blog/content/material/2022_05_24_Your_Guide_to_DistSQL_Cluster_Governance_Capability_Apache_ShardingSphere_Feature_Update.en.md index 856a0d9606c97..3ce265dea9c9c 100644 --- a/docs/blog/content/material/2022_05_24_Your_Guide_to_DistSQL_Cluster_Governance_Capability_Apache_ShardingSphere_Feature_Update.en.md +++ b/docs/blog/content/material/2022_05_24_Your_Guide_to_DistSQL_Cluster_Governance_Capability_Apache_ShardingSphere_Feature_Update.en.md @@ -418,13 +418,13 @@ New issue Have a question about this project? Sign up for a free GitHub account github.com ## Reference -**1. ShardingSphere-Proxy Quickstart: **[https://shardingsphere.apache.org/document/5.1.0/cn/quick-start/shardingsphere-proxy-quick-start/](https://shardingsphere.apache.org/document/5.1.0/en/quick-start/shardingsphere-proxy-quick-start/) +**1. ShardingSphere-Proxy Quickstart:** [https://shardingsphere.apache.org/document/5.1.0/cn/quick-start/shardingsphere-proxy-quick-start/](https://shardingsphere.apache.org/document/5.1.0/en/quick-start/shardingsphere-proxy-quick-start/) -**2.DistSQL RDL:**https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/distsql/syntax/rdl/resource-definition/ +**2.DistSQL RDL**https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/distsql/syntax/rdl/resource-definition/ -**3.DistSQL RQL:**https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/distsql/syntax/rql/resource-query/ +**3.DistSQL RQL**https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/distsql/syntax/rql/resource-query/ -**4.DistSQL RAL:**https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/distsql/syntax/ral/ +**4.DistSQL RAL**https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/distsql/syntax/ral/ **Apache ShardingSphere Project Links:** [ShardingSphere Github](https://github.com/apache/shardingsphere/issues?page=1&q=is%3Aopen+is%3Aissue+label%3A%22project%3A+OpenForce+2022%22) diff --git "a/docs/blog/content/material/2022_06_16_Understanding_Apache_ShardingSphere's_SPI_and_why_it\342\200\231s_simpler_than_Dubbo\342\200\231s.en.md" "b/docs/blog/content/material/2022_06_16_Understanding_Apache_ShardingSphere's_SPI_and_why_it\342\200\231s_simpler_than_Dubbo\342\200\231s.en.md" index d7402de2041ab..5a21010b5f210 100644 --- "a/docs/blog/content/material/2022_06_16_Understanding_Apache_ShardingSphere's_SPI_and_why_it\342\200\231s_simpler_than_Dubbo\342\200\231s.en.md" +++ "b/docs/blog/content/material/2022_06_16_Understanding_Apache_ShardingSphere's_SPI_and_why_it\342\200\231s_simpler_than_Dubbo\342\200\231s.en.md" @@ -50,7 +50,7 @@ We can see now that Dubbo’s Java SPI is completely different from the JDK SPI. Unlike the Dubbo implementation concept, ShardingSphere extends the JDK SPI with less code. -1. The configuration is exactly the same as in the Java SPI. +The configuration is exactly the same as in the Java SPI. Let’s take the `DialectTableMetaDataLoader` interface implementation class as an example: `DialectTableMetaDataLoader.class` diff --git a/docs/blog/content/material/2022_06_28_Cloud_native_deployment_for_a_high-performance_data_gateway_new_API_driver_Apache_ShardingSphere_5.1.2_is_released.en.md b/docs/blog/content/material/2022_06_28_Cloud_native_deployment_for_a_high-performance_data_gateway_new_API_driver_Apache_ShardingSphere_5.1.2_is_released.en.md index 731767727db99..87daac6f109cf 100644 --- a/docs/blog/content/material/2022_06_28_Cloud_native_deployment_for_a_high-performance_data_gateway_new_API_driver_Apache_ShardingSphere_5.1.2_is_released.en.md +++ b/docs/blog/content/material/2022_06_28_Cloud_native_deployment_for_a_high-performance_data_gateway_new_API_driver_Apache_ShardingSphere_5.1.2_is_released.en.md @@ -19,7 +19,8 @@ In addition to the above-mentioned new features, this update also improves SQL p This post will give you an overview of the ShardingSphere 5.1.2 updates. ## New Features -**ShardingSphere-Proxy configuration using Helm** +### **ShardingSphere-Proxy configuration using Helm** + ShardingSphere-Proxy provides Docker images for deployment in containers. However, for those who need to deploy ShardingSphere-Proxy on [Kubernetes](https://kubernetes.io/), you have to go through some procedures such as database driver mounting, configuration mounting, custom algorithm mounting, etc., which make the deployment process relatively tedious and causes high operation & maintenance costs. This update brings the new ShardingSphere-Proxy Helm Chart, a new feature donated to the Apache ShardingSphere community by [SphereEx](https://www.sphere-ex.com/), a provider of enterprise-grade, cloud-native data-enhanced computing products, and solutions. This development allows Apache ShardingSphere to embrace ahead cloud-native computing. @@ -32,7 +33,8 @@ Due to the limits imposed by open source protocol, ShardingSphere-Proxy’s bina For such cases, ShardingSphere-Proxy Helm Chart can automatically obtain the MySQL JDBC driver in the Pod’s Init container, reducing your deployment operation costs. -**SQL dialect translation** +### **SQL dialect translation** + With increased database diversification, the coexistence of multiple types of databases is now the norm. The scenarios in which heterogeneous databases are accessed using one SQL dialect are becoming a trend. The existence of multiple diversified databases makes it difficult to standardize SQL dialects for accessing databases, meaning that engineers need to use different dialects for different types of databases - lacking a unified query platform. @@ -68,25 +70,29 @@ Connection conn = dataSource.getConnection(); ``` ## Optimizations of the existing capabilities -**Kernel** +### **Kernel** + In this update, ShardingSphere merged lots of PRs to improve SQL parsing support. SQL parsing optimizations take up a large proportion of the update log. ShardingSphere provided preliminary support for PostgreSQL / openGauss schema in 5.1.1. In this 5.1.2 update, the kernel, cluster mode, and auto-scaling support for PostgreSQL / openGauss schema has been improved. For example, support for schema structure has been added to metadata pairs, and schema customization is also supported in kernel and auto-scaling. -**ShardingSphere-Proxy** +### **ShardingSphere-Proxy** + As the market for servers using ARM CPUs becomes more popular, ShardingSphere-Proxy also provides images for arm64 architecture on Docker as well. When it comes to MySQL, ShardingSphere-Proxy fixed the issue where packets longer than 8 MB could not be received, and further supports receiving data larger than 16 MB in total. -**Auto-scaling** +### **Auto-scaling** + In addition to supporting PostgreSQL schema customization, auto-scaling also implements automatic table creation when migrating PostgreSQL, and fixes the problem where PostgreSQL incremental migration would report errors when encountering null fields values. In addition to these features, auto-scaling also reduces resource consumption during migration and provides support for incremental migration in openGauss 3.0. ## Release notes The full release note for ShardingSphere 5.1.2 can be found in the following sections. Note that this update adjusts a small number of APIs, so please refer to the API Adjustments section for more details. -**New Features** +### **New Features** + Kernel: alpha version of SQL dialect conversion for MySQL and PostgreSQL. Kernel: Support for PostgreSQL and openGauss custom schema. @@ -115,7 +121,8 @@ Operation mode: Governance Center supports PG/openGauss three-level structure. Operation mode: Governance Center supports Database level distributed locking. -**Optimization** +### **Optimization** + Kernel: support for PostgreSQL and openGauss copy statements. Kernel: support for PostgreSQL alter/ drop index statements. diff --git a/docs/blog/content/material/2022_07_06_ShardingSphere-JDBC_Driver_Released_A_JDBC_Driver_That_Requires_No_Code_Modifications.en.md b/docs/blog/content/material/2022_07_06_ShardingSphere-JDBC_Driver_Released_A_JDBC_Driver_That_Requires_No_Code_Modifications.en.md index 5d1b11fdbebf6..07baba52a26d2 100644 --- a/docs/blog/content/material/2022_07_06_ShardingSphere-JDBC_Driver_Released_A_JDBC_Driver_That_Requires_No_Code_Modifications.en.md +++ b/docs/blog/content/material/2022_07_06_ShardingSphere-JDBC_Driver_Released_A_JDBC_Driver_That_Requires_No_Code_Modifications.en.md @@ -38,9 +38,10 @@ DistSQL ensures security which Java and YAML are short of, and it naturally supp After the preconditions were met, ShardingSphere-JDBC version 5.1.2 took the opportunity to provide a JDBC driver that can be used only through configuration changes, without requiring engineers to modify the code. **Driver class name** + `org.apache.shardingsphere.driver.ShardingSphereDriver` -** -URL configuration description** + +**URL configuration description** - Prefix: `jdbc:shardingsphere:` - Config files: `xxx.yaml`, its format is consistent with that of `YAML` configuration. @@ -100,6 +101,7 @@ ShardingSphere-JDBC Driver officially makes ShardingSphere easier to use than ev In the coming future, the JDBC driver can be further simplified by providing the governance center address directly in the `URL`. Apache ShardingSphere has made great strides towards diversified distributed clusters. **Relevant Links:** + [GitHub issue](https://github.com/apache/shardingsphere/issues) [Contributor Guide](https://shardingsphere.apache.org/community/en/involved/) diff --git a/docs/blog/content/material/2022_07_08_ShardingSphere-Proxy_Front-End_Protocol_Troubleshooting_Guide_and_Examples.en.md b/docs/blog/content/material/2022_07_08_ShardingSphere-Proxy_Front-End_Protocol_Troubleshooting_Guide_and_Examples.en.md index 7b55984474728..64b22883059c2 100644 --- a/docs/blog/content/material/2022_07_08_ShardingSphere-Proxy_Front-End_Protocol_Troubleshooting_Guide_and_Examples.en.md +++ b/docs/blog/content/material/2022_07_08_ShardingSphere-Proxy_Front-End_Protocol_Troubleshooting_Guide_and_Examples.en.md @@ -19,8 +19,9 @@ This post will introduce you to the tools commonly used in database protocol dev The full features, installation and other details about Wireshark can be found in the official Wireshark documents. -## 1.1 Packet capture using tools like Wireshark or tcpdump -**1.1.1 Wireshark** +### 1.1 Packet capture using tools like Wireshark or tcpdump +#### **1.1.1 Wireshark** + Wireshark itself has the ability to capture packets, so if the environment connected to ShardingSphere-Proxy can run Wireshark, you can use it to capture packets directly. After initiating Wireshark , first select the correct network card. @@ -33,7 +34,7 @@ Once the NIC is selected, Wireshark starts capturing packets. Since there may be ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p11ab3e8qjqdiaa7repp.png) -**1.1.2 tcpdump** +#### **1.1.2 tcpdump** In cases where ShardingSphere-Proxy is deployed in an online environment, or when you cannot use Wireshark to capture packets, consider using tcpdump or other tools. NIC eth0 as target, filter TCP port 3307, write the result to /path/to/dump.cap. Command Example: @@ -41,7 +42,7 @@ NIC eth0 as target, filter TCP port 3307, write the result to /path/to/dump.cap. `tcpdump -i eth0 -w /path/to/dump.cap tcp port 3307` To know how to use tcpdump, you can man tcpdump. tcpdump’s packet capture result file can be opened through Wireshark. -**1.1.3 Note** +#### **1.1.3 Note** When a client connects to MySQL, SSL encryption may be automatically enabled, causing the packet capture result to not directly parse the protocol content. You can disable SSL by specifying parameters using the MySQL client command line with the following command: `mysql --ssl-mode=disable` @@ -49,7 +50,7 @@ Parameters can be added using JDBC with the following parameters: `jdbc:mysql://127.0.0.1:3306/db?useSSL=false` -## 1.2 Use Wireshark to read packet capture result +### 1.2 Use Wireshark to read packet capture result Wireshark supports reading multiple packet capture file formats, including tcpdump’s capture format. By default, Wireshark decodes port 3306 to MySQL protocol and port 5432 to PostgreSQL protocol. For cases where ShardingSphere-Proxy may use a different port, you can configure the protocol for specified port in Decode As… @@ -79,7 +80,7 @@ Example: the client executes SQL select version() with the protocol shown below: ## 2. Protocol Troubeshooting Case Study: ShardingSphere-Proxy MySQL support oversized data packages -## 2.1 Problem Description +### 2.1 Problem Description Using MySQL Connector/J 8.0.28 as a client to connect to ShardingSphere-Proxy 5.1.1, bulk insertion error prompted while executing. Problem solved after replacing driver MySQL Connector/J 5.1.38. @@ -111,10 +112,10 @@ java.lang.IllegalArgumentException: Sequence ID of MySQL command packet must be at java.base/java.lang.Thread.run(Thread.java:834) ``` -## 2.2 Troubleshooting +### 2.2 Troubleshooting The error occurred at the front end of the Proxy, which excludes the backend JDBC Driver and is related to the protocol implementation. -**2.2.1 Analysis** +#### **2.2.1 Analysis** Directly determine in the source code that if the sequence ID is not equal to 0, an error is reported. ```java @@ -133,6 +134,7 @@ public final class MySQLCommandPacketTypeLoader { } ``` **Code link:** + [https://github.com/apache/shardingsphere/blob/d928165ea4f6ecf2983b2a3a8670ff66ffe63647/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLCommandPacketTypeLoader.java#L38](https://github.com/apache/shardingsphere/blob/d928165ea4f6ecf2983b2a3a8670ff66ffe63647/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/MySQLCommandPacketTypeLoader.java#L38) In accordance with MySQL protocol documentation, consider when the sequence ID will not equal 0 [2]. @@ -140,11 +142,12 @@ In accordance with MySQL protocol documentation, consider when the sequence ID w - The server responds multiple messages to the client. - The client sends multiple consecutive messages. - …… + In this case, the message header of MySQL Packet consists of 3 bytes length + 1 byte Sequence ID [3], so the maximum length of Payload part is 16 MB — 1. Considering that the error is generated during bulk insertion, the problem might be that the data sent by the client exceeds the length limit of a single MySQL Packet and was split into multiple consecutive MySQL Packets, which the Proxy could not handle. -**2.2.2 Trying to recreate the problem** +#### **2.2.2 Trying to recreate the problem** Using a `longtext` type field. The original idea was to construct a SQL with a length of more than 16 MB, but inadvertently we found that the error was also reported when the SQL length was more than 8 MB. The code was reproduced as follows: ```java @@ -215,7 +218,7 @@ out.add(in.readRetainedSlice(SEQUENCE_LENGTH + payloadLength)); ``` The problem is clear: because ShardingSphere-Proxy didn’t aggregate packets, multiple packets are parsed separately by Proxy as multiple commands, and because the `Sequence ID` of subsequent packets is greater than 0, the Proxy’s internal assertion logic for the Sequence ID reported an error. -## 2.3 Troubleshooting and Repair +### 2.3 Troubleshooting and Repair After troubleshooting, the error was reported as: - (Direct cause) The ShardingSphere-Proxy MySQL protocol unpacket logic does not handle the length sign correctly [4]. @@ -230,7 +233,7 @@ It is first important to understand how MySQL protocol handles very long packets - When the data length is exactly equal to 16 MB — 1 or a multiple thereof, one or more packets of length 16 MB — 1 are sent followed by a packet of length 0, as shown in the following figure: ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ag3mbjanbchj012eu5c.png) -**Solution:** in order for the protocol implementation of ShardingSphere-Proxy MySQL to not care about how very long packets are handled, it is better to aggregate the packets in the data decoding logic. +**Solution:** In order for the protocol implementation of ShardingSphere-Proxy MySQL to not care about how very long packets are handled, it is better to aggregate the packets in the data decoding logic. In the ShardingSphere-Proxy front-end [Netty](https://netty.io/) decoding logic, when a data Packet of length `0xFFFFFF` is encountered, the Payload part of multiple MySQL Packets is aggregated via CompositeByteBuf. @@ -274,8 +277,10 @@ The solutions presented in this article have been released with Apache ShardingS [8] [https://github.com/apache/shardingsphere/pull/17914](https://github.com/apache/shardingsphere/pull/17914 ) + [9] [https://github.com/apache/shardingsphere/blob/2c9936497214b8a654cb56d43583f62cd7a6b76b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializer.java](https://github.com/apache/shardingsphere/blob/2c9936497214b8a654cb56d43583f62cd7a6b76b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializer.java ) + [10] [https://shardingsphere.apache.org/document/current/cn/downloads/](https://shardingsphere.apache.org/document/current/cn/downloads/) [GitHub issue](https://github.com/apache/shardingsphere/issues) diff --git a/docs/blog/content/material/2022_09_08_Apache_ShardingSphere_5.2.0_is_Released,_Bringing_New_Cloud_Native_Possibilities.en.md b/docs/blog/content/material/2022_09_08_Apache_ShardingSphere_5.2.0_is_Released,_Bringing_New_Cloud_Native_Possibilities.en.md index b435b7c867587..a63e00ab57a5b 100644 --- a/docs/blog/content/material/2022_09_08_Apache_ShardingSphere_5.2.0_is_Released,_Bringing_New_Cloud_Native_Possibilities.en.md +++ b/docs/blog/content/material/2022_09_08_Apache_ShardingSphere_5.2.0_is_Released,_Bringing_New_Cloud_Native_Possibilities.en.md @@ -302,7 +302,7 @@ Below are all the update logs of ShardingSphere 5.2.0. To deliver a better user - Kernel: Add PostgreSQL Comment Statement -- Kernel: Support listen statement in postgreSQL +- Kernel: Support listen statement in PostgreSQL - Kernel: Support DECLARE cursor statement diff --git a/docs/blog/content/material/2022_10_14_ShardingSphere_5.2.0_Audit_for_sharding_intercepts_unreasonable_requests_in_multi-shards_scenarios.en.md b/docs/blog/content/material/2022_10_14_ShardingSphere_5.2.0_Audit_for_sharding_intercepts_unreasonable_requests_in_multi-shards_scenarios.en.md index 61256b5e75640..b053c801238c2 100644 --- a/docs/blog/content/material/2022_10_14_ShardingSphere_5.2.0_Audit_for_sharding_intercepts_unreasonable_requests_in_multi-shards_scenarios.en.md +++ b/docs/blog/content/material/2022_10_14_ShardingSphere_5.2.0_Audit_for_sharding_intercepts_unreasonable_requests_in_multi-shards_scenarios.en.md @@ -201,18 +201,9 @@ mysql> /* ShardingSphere hint: disableAuditNames=sharding_key_required_auditor * 2 rows in set (0.01 sec) ``` -**Note:** `HINT` requires you to modify the `server.yaml` configuration of Proxy. In addition, if you are using MySQL terminal to connect to Proxy directly, you need to add the `-c` property — otherwise, `HINT `comments will be filtered out of the MySQL terminal and will not be parsed by Proxy on the backend. +**Note:** If you are using MySQL terminal to connect to Proxy directly, you need to add the `-c` property — otherwise, `HINT `comments will be filtered out of the MySQL terminal and will not be parsed by Proxy on the backend. ```sql -rules: - - !SQL_PARSER - sqlCommentParseEnabled: true - sqlStatementCache: - initialCapacity: 2000 - maximumSize: 65535 - parseTreeCache: - initialCapacity: 128 - maximumSize: 1024 props: proxy-hint-enabled: truemysql -uroot -proot -h127.0.0.1 -P3307 -c ``` diff --git "a/docs/blog/content/material/2022_10_25_ShardingSphere_5.2.1_is_released\342\200\212\342\200\224\342\200\212Here_are_the_highlights.en.md" "b/docs/blog/content/material/2022_10_25_ShardingSphere_5.2.1_is_released\342\200\212\342\200\224\342\200\212Here_are_the_highlights.en.md" index 247b11e99a9a2..c6791d37214dc 100644 --- "a/docs/blog/content/material/2022_10_25_ShardingSphere_5.2.1_is_released\342\200\212\342\200\224\342\200\212Here_are_the_highlights.en.md" +++ "b/docs/blog/content/material/2022_10_25_ShardingSphere_5.2.1_is_released\342\200\212\342\200\224\342\200\212Here_are_the_highlights.en.md" @@ -94,7 +94,7 @@ CLEAR SHARDING HINT; As there are problems with both methods, version 5.2.1 adds the SQL Hint mandatory sharding routing feature. This allows users to control routes flexibly through SQL annotations. There’s no need to modify the logic of the original code and the thread processing model in the Proxy access port is not affected. -Before using the SQL Hint mandatory sharding routing, users should enable configurations of parsing annotations in advance and set `sqlCommentParseEnabled` to `true`. The annotation format only supports `/* */` and content has to start with `SHARDINGSPHERE_HINT:`. +The annotation format only supports `/* */` and content has to start with `SHARDINGSPHERE_HINT:`. Optional properties include: diff --git a/docs/blog/content/material/2022_12_08_ShardingSphere_5.3.0_is_released_new_features_and_improvements.en.md b/docs/blog/content/material/2022_12_08_ShardingSphere_5.3.0_is_released_new_features_and_improvements.en.md index 2c2ac110ef5f5..e2396fd681ea5 100644 --- a/docs/blog/content/material/2022_12_08_ShardingSphere_5.3.0_is_released_new_features_and_improvements.en.md +++ b/docs/blog/content/material/2022_12_08_ShardingSphere_5.3.0_is_released_new_features_and_improvements.en.md @@ -160,7 +160,6 @@ rules: defaultType: XA providerType: Atomikos - !SQL_PARSER - sqlCommentParseEnabled: true sqlStatementCache: initialCapacity: 2000 maximumSize: 65535 @@ -183,7 +182,6 @@ authority: transaction: defaultType: XA providerType: AtomikossqlParser: - sqlCommentParseEnabled: true sqlStatementCache: initialCapacity: 2000 maximumSize: 65535 diff --git a/docs/blog/content/material/2023_03_07_ShardingSphere_5.3.x_Update_Spring_Configuration_Update_Guide.en.md b/docs/blog/content/material/2023_03_07_ShardingSphere_5.3.x_Update_Spring_Configuration_Update_Guide.en.md index dfb97327af684..2b0484a305eb1 100644 --- a/docs/blog/content/material/2023_03_07_ShardingSphere_5.3.x_Update_Spring_Configuration_Update_Guide.en.md +++ b/docs/blog/content/material/2023_03_07_ShardingSphere_5.3.x_Update_Spring_Configuration_Update_Guide.en.md @@ -298,7 +298,7 @@ The original ShardingSphere configuration in `spring-sharding.xml` has been repl xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + diff --git a/docs/blog/content/material/2023_04_11_Monitoring_SQL_Performance_with_ShardingSphere-Agent,_Prometheus_and_Grafana.en.md b/docs/blog/content/material/2023_04_11_Monitoring_SQL_Performance_with_ShardingSphere-Agent,_Prometheus_and_Grafana.en.md index 325dd13773ab2..93adbff3b1443 100644 --- a/docs/blog/content/material/2023_04_11_Monitoring_SQL_Performance_with_ShardingSphere-Agent,_Prometheus_and_Grafana.en.md +++ b/docs/blog/content/material/2023_04_11_Monitoring_SQL_Performance_with_ShardingSphere-Agent,_Prometheus_and_Grafana.en.md @@ -204,7 +204,7 @@ Many metrics can be collected and analyzed using Prometheus and Grafana. By moni # Conclusion -We welcome you to actively participate in enriching and improving the monitoring indicators of ShardingSphere-JDBC. If you have any questions or suggestions, please feel free to raise them in the [GitHub issue](https://github.com/apache/shardingsphere/issues) [6], or join our [Slack community](https://apacheshardingsphere.slack.com/ssb/redirect) [7] for discussions. +We welcome you to actively participate in enriching and improving the monitoring indicators of ShardingSphere-JDBC. If you have any questions or suggestions, please feel free to raise them in the [GitHub issue](https://github.com/apache/shardingsphere/issues) [6], or join our [Slack community](https://join.slack.com/t/apacheshardingsphere/shared_invite/zt-sbdde7ie-SjDqo9~I4rYcR18bq0SYTg) [7] for discussions. # Related Links @@ -220,4 +220,4 @@ We welcome you to actively participate in enriching and improving the monitoring [6] [GitHub issues](https://github.com/apache/shardingsphere/issues) -[7] [Slack community](https://apacheshardingsphere.slack.com/ssb/redirect) +[7] [Slack community](https://join.slack.com/t/apacheshardingsphere/shared_invite/zt-sbdde7ie-SjDqo9~I4rYcR18bq0SYTg) diff --git "a/docs/blog/content/material/2023_05_18_Enhancing_Database_Security_ShardingSphere-Proxy\342\200\231s_Authentication.en.md" "b/docs/blog/content/material/2023_05_18_Enhancing_Database_Security_ShardingSphere-Proxy\342\200\231s_Authentication.en.md" index 93bef78784deb..8e89b63dd6014 100644 --- "a/docs/blog/content/material/2023_05_18_Enhancing_Database_Security_ShardingSphere-Proxy\342\200\231s_Authentication.en.md" +++ "b/docs/blog/content/material/2023_05_18_Enhancing_Database_Security_ShardingSphere-Proxy\342\200\231s_Authentication.en.md" @@ -175,7 +175,7 @@ Connection failed. We see that it’s actually due to the authentication protocol. -The psql client requires md5 protocol authentication by default, but because Proxy requires the scram-sha-256 under the openGuass protocol, the negotiation fails and an exception is thrown. +The psql client requires md5 protocol authentication by default, but because Proxy requires the scram-sha-256 under the openGauss protocol, the negotiation fails and an exception is thrown. ## Following Steps @@ -229,7 +229,7 @@ Connection succeeded. ![img](https://shardingsphere.apache.org/blog/img/2023_05_18_Enhancing_Database_Security_ShardingSphere-Proxy’s_Authentication.en.md8.jpeg) -Now we see that `psql` has successfully connected to ShardingSphere-Proxy under the openGuass protocol. +Now we see that `psql` has successfully connected to ShardingSphere-Proxy under the openGauss protocol. ![img](https://shardingsphere.apache.org/blog/img/2023_05_18_Enhancing_Database_Security_ShardingSphere-Proxy’s_Authentication.en.md9.jpeg) diff --git a/docs/blog/content/material/CNCF.cn.md b/docs/blog/content/material/CNCF.cn.md index 98fc23e11b67f..88cdf63612bd4 100644 --- a/docs/blog/content/material/CNCF.cn.md +++ b/docs/blog/content/material/CNCF.cn.md @@ -30,4 +30,4 @@ Apache ShardingSphere 在开源领域及云原生领域会持续拓展,不断 ![](https://shardingsphere.apache.org/blog/img/CNCF3.jpg) -Apache ShardingSphere 自 2016 开源以来,不断精进、不断发展,被越来越多的企业和个人认可:Github 上收获8000+的 stars,近百家公司企业的成功案例。此外,越来越多的企业和个人也加入到Apache ShardingSphere(Incubating)的开源项目中,为它的成长和发展贡献了巨大力量。 +Apache ShardingSphere 自 2016 开源以来,不断精进、不断发展,被越来越多的企业和个人认可:Github 上收获 8000+ 的 stars,近百家公司企业的成功案例。此外,越来越多的企业和个人也加入到 Apache ShardingSphere(Incubating)的开源项目中,为它的成长和发展贡献了巨大力量。 diff --git a/docs/blog/content/material/ElasticJob.cn.md b/docs/blog/content/material/ElasticJob.cn.md index 4e34e721ac90a..39741e4b71068 100644 --- a/docs/blog/content/material/ElasticJob.cn.md +++ b/docs/blog/content/material/ElasticJob.cn.md @@ -5,13 +5,13 @@ weight = 12 chapter = true +++ -[ElasticJob](https://github.com/elasticjob)是一个分布式调度解决方案,提供分布式任务的分片,弹性伸缩,全自动发现,基于时间驱动、数据驱动、常驻任务和临时任务的多任务类型,任务聚合和动态调配资源,故障检测、自动修复,失效转移和重试,完善的运维平台和管理工具,以及对云原生的良好支持等功能特性,可以全面满足企业对于任务管理和批量作业的调度处理能力。 +[ElasticJob](https://github.com/elasticjob) 是一个分布式调度解决方案,提供分布式任务的分片,弹性伸缩,全自动发现,基于时间驱动、数据驱动、常驻任务和临时任务的多任务类型,任务聚合和动态调配资源,故障检测、自动修复,失效转移和重试,完善的运维平台和管理工具,以及对云原生的良好支持等功能特性,可以全面满足企业对于任务管理和批量作业的调度处理能力。 -ElasticJob自2014年底开源以来,经历了5年多的发展,以其功能的丰富性,文档的全面性,代码的高质量,框架的易用性,积累了大量的忠实用户和良好的业内口碑(5.8K star),一直也是分布式调度框架领域最受大家欢迎的项目之一。 +ElasticJob 自2014年底开源以来,经历了5年多的发展,以其功能的丰富性,文档的全面性,代码的高质量,框架的易用性,积累了大量的忠实用户和良好的业内口碑(5.8K star),一直也是分布式调度框架领域最受大家欢迎的项目之一。 -近两年来,由于核心开发者全力发展和维护Apache ShardingSphere项目等原因,ElasticJob放缓了发展的脚步。但是随着Apache ShardingSphere项目在分布式领域的不断拓展,以及用户对于多数据集群环境的分布式管理和数据迁移的弹性扩容等功能,需要一个强大的分布式调度组件。由此为契机,Apache ShardingSphere社区已经计划发起提议将ElasticJob作为其子项目进行长期持续的更新和维护。 +近两年来,由于核心开发者全力发展和维护 Apache ShardingSphere 项目等原因,ElasticJob 放缓了发展的脚步。但是随着 Apache ShardingSphere 项目在分布式领域的不断拓展,以及用户对于多数据集群环境的分布式管理和数据迁移的弹性扩容等功能,需要一个强大的分布式调度组件。由此为契机,Apache ShardingSphere 社区已经计划发起提议将 ElasticJob 作为其子项目进行长期持续的更新和维护。 -我们第一时间将此好消息公开,后续将带来更多关于ElasticJob的相关资讯。 +我们第一时间将此好消息公开,后续将带来更多关于 ElasticJob 的相关资讯。 > 讨论邮件: https://lists.apache.org/thread.html/rd6171e2065be6bcfbeb7aba7e5c876eeed04db585c6ab78fc03a581c%40%3Cdev.shardingsphere.apache.org%3E diff --git a/docs/blog/content/material/Jan_28_Blog_X_Kernel_Optimizations_&_Upgrade_Guide_for_Apache_ShardingSphere_5.0.0_The_Ideal_Database_Management_Ecosystem.en.md b/docs/blog/content/material/Jan_28_Blog_X_Kernel_Optimizations_&_Upgrade_Guide_for_Apache_ShardingSphere_5.0.0_The_Ideal_Database_Management_Ecosystem.en.md index a7823666af671..28e5d1b8b6332 100644 --- a/docs/blog/content/material/Jan_28_Blog_X_Kernel_Optimizations_&_Upgrade_Guide_for_Apache_ShardingSphere_5.0.0_The_Ideal_Database_Management_Ecosystem.en.md +++ b/docs/blog/content/material/Jan_28_Blog_X_Kernel_Optimizations_&_Upgrade_Guide_for_Apache_ShardingSphere_5.0.0_The_Ideal_Database_Management_Ecosystem.en.md @@ -291,7 +291,7 @@ masterSlaveRule: # 5.0.0 GA Read/Write Splitting API rules: - !READWRITE_SPLITTING - dataSources: + dataSourceGroups: pr_ds: writeDataSourceName: write_ds readDataSourceNames: @@ -564,7 +564,7 @@ rules: algorithm-expression: t_order_item_${order_id % 2} - !READWRITE_SPLITTING - dataSources: + dataSourceGroups: ms_ds_0: writeDataSourceName: ds_0 readDataSourceNames: diff --git a/docs/blog/content/material/Nov_23_1_Integrate_SCTL_into_RAL.en.md b/docs/blog/content/material/Nov_23_1_Integrate_SCTL_into_RAL.en.md index 61cddfbb097d8..8553264ea08b4 100644 --- a/docs/blog/content/material/Nov_23_1_Integrate_SCTL_into_RAL.en.md +++ b/docs/blog/content/material/Nov_23_1_Integrate_SCTL_into_RAL.en.md @@ -135,7 +135,7 @@ Output rules: - !READWRITE_SPLITTING - dataSources: + dataSourceGroups: ds_0: writeDataSourceName: write_ds_0 readDataSourceNames: diff --git a/docs/blog/content/material/Oct_12_2_A_Distributed_Database_Middleware_Ecosystem_Driven_by_Open_Source.cn.md b/docs/blog/content/material/Oct_12_2_A_Distributed_Database_Middleware_Ecosystem_Driven_by_Open_Source.cn.md index d287f263cb007..dc5876c4ecf98 100644 --- a/docs/blog/content/material/Oct_12_2_A_Distributed_Database_Middleware_Ecosystem_Driven_by_Open_Source.cn.md +++ b/docs/blog/content/material/Oct_12_2_A_Distributed_Database_Middleware_Ecosystem_Driven_by_Open_Source.cn.md @@ -44,11 +44,11 @@ Apache ShardingSphere 就是位于这一层,通过复用原有数据库的能 面对各种各样的需求以及使用场景,ShardingSphere 为不同领域的开发者提供了面向 Java 的 JDBC、面向异构的代理端以及面向上云的 Sidecar 端这三种接入形式,用户可以按具体需求来做选型,在原有集群之上来做分片、读写分离、数据迁移等相关操作。 -* **JDBC 接入:**完全以 JDBC 的方式去使用,可以理解为一款增强的 JDBC 驱动程序,完全兼容 JDBC 和各种 ORM 框架,不需额外的部署和依赖即能够实现分布式管理、水平拓展、脱敏等一系列操作; +* **JDBC 接入:** 完全以 JDBC 的方式去使用,可以理解为一款增强的 JDBC 驱动程序,完全兼容 JDBC 和各种 ORM 框架,不需额外的部署和依赖即能够实现分布式管理、水平拓展、脱敏等一系列操作; -* **Proxy 接入:**以模拟数据库服务的形式,通过 Proxy 来管理底层真实的数据库集群,基本无需对业务进行改造; +* **Proxy 接入:** 以模拟数据库服务的形式,通过 Proxy 来管理底层真实的数据库集群,基本无需对业务进行改造; -* **云上 mesh 接入:**为 ShardingSphere 提供公有云上的部署形式。在云上,目前 SphereEx 已经加入了亚马逊云科技的云创计划,后续会在中国区和海外陆续在 Marketplace 与亚马逊云科技展开深度合作,为亚马逊云科技上的用户提供更加强大的 Proxy 镜像部署能力,共同为企业应用打造更加成熟的云上环境。 +* **云上 mesh 接入:** 为 ShardingSphere 提供公有云上的部署形式。在云上,目前 SphereEx 已经加入了亚马逊云科技的云创计划,后续会在中国区和海外陆续在 Marketplace 与亚马逊云科技展开深度合作,为亚马逊云科技上的用户提供更加强大的 Proxy 镜像部署能力,共同为企业应用打造更加成熟的云上环境。 @@ -58,3 +58,12 @@ ShardingSphere 从开源至今,已经在业内产生了相当的影响力, 过去几年在开源社区上,国内用户大多是扮演程序下载和代码引用的角色,在社区建设方面却少有涉及。最近几年随着开源理念在国内的推广,开始涌现出越来越多抱有很强技术情怀的同学,正是有这些同学的加入,才能让 ShardingSphere 的社区越来越活跃。**因为对于一个好的开源项目而言,评判标准并非只是其理念超前、技术先进等,更多是在技术影响力、开源影响力、生态建设、开发者群体等多方面所积攒的深厚基础。** 这也是为什么 ShardingSphere 作为一款 Apache 顶级开源项目,依然在积极号召大家参与到开源社区中来。毕竟大家每天接触到的只是身边这群人,所做的工作也只是办公室里的这些事,每天被『局限』在这个圈子中。而通过开源,则可以让自己的工作连接到世界,让自己能够抛开书本真正投入到项目中来,打开视野,逐渐培养开放、合作的精神,重新发现自己当下所产生的价值。 + +**项目链接:** + +ShardingSphere Github: [https://github.com/apache/shardingsphere]() + +ShardingSphere Twitter: [https://twitter.com/ShardingSphere +]() + +ShardingSphere Slack Channel: [https://bit.ly/3qB2GGc]() diff --git a/docs/blog/content/material/Oct_12_3_How_Can_Students_Participate_in_Open-Source_Communities.cn.md b/docs/blog/content/material/Oct_12_3_How_Can_Students_Participate_in_Open-Source_Communities.cn.md index b4723688d95b8..3f4787e5045a1 100644 --- a/docs/blog/content/material/Oct_12_3_How_Can_Students_Participate_in_Open-Source_Communities.cn.md +++ b/docs/blog/content/material/Oct_12_3_How_Can_Students_Participate_in_Open-Source_Communities.cn.md @@ -20,7 +20,7 @@ chapter = true * 获得奖学金 -##下一个问题就是如何利用这些具有吸引力的项目加入开源中? +## 下一个问题就是如何利用这些具有吸引力的项目加入开源中? 虽然基本过程大体相同,但不同项目有不同规则,有些规则往往是明确的,即: @@ -101,4 +101,4 @@ ShardingSphere Slack Channel: [https://join.slack.com/t/apacheshardingsphere/sha [5] https://issues.apache.org/jira/browse/COMDEV-385 -[6] https://github.com/apache/shardingsphere \ No newline at end of file +[6] https://github.com/apache/shardingsphere diff --git a/docs/blog/content/material/Oct_12_4_Updates_and_FAQ_Your_1_Minute_Quick_Start_Guide_to_ShardingSphere.cn.md b/docs/blog/content/material/Oct_12_4_Updates_and_FAQ_Your_1_Minute_Quick_Start_Guide_to_ShardingSphere.cn.md index 68dea33bb9894..dff36aa68c69c 100644 --- a/docs/blog/content/material/Oct_12_4_Updates_and_FAQ_Your_1_Minute_Quick_Start_Guide_to_ShardingSphere.cn.md +++ b/docs/blog/content/material/Oct_12_4_Updates_and_FAQ_Your_1_Minute_Quick_Start_Guide_to_ShardingSphere.cn.md @@ -98,13 +98,13 @@ ShardingSphere-JDBC 示例模块,展示 ShardingSphere-JDBC 的功能特性和 展示 ShardingSphere-JDBC 在分布式治理方面的应用,包含了分库分表、读写分离、数据加密、影子库等特性与分布式治理相结合的应用场景。 -**注意:**分布式治理 example 依赖 Apache ZooKeeper,请自行部署。 +**注意:** 分布式治理 example 依赖 Apache ZooKeeper,请自行部署。 **(3)transaction-example** 展示 ShardingSphere-JDBC 支持的多种分布式事务管理方式,用户可以根据应用场景选择适合的分布式事务管理器进行使用。鉴于分布式事务的特殊性,本模块的示例都是基于分库、分表或分库+分表的场景设计的。 -**注意:**Seata 事务管理器需要自行部署。 +**注意:** Seata 事务管理器需要自行部署。 **(4)other-feature-example** @@ -291,7 +291,7 @@ https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere 此时即可通过日志中的「Logic SQL」和「Actual SQL」观察每一条 SQL 语句的路由情况,理解读写分离的运行机制。 -**注意:**如果主从数据库无法正常同步,将会发生查询异常。 +**注意:** 如果主从数据库无法正常同步,将会发生查询异常。 * **custom-sharding-algortihm-example「自定义算法场景」** diff --git a/docs/blog/content/material/Oct_12_5_E-Hualu_ShardingSphere_Hulu_Story_Data_Processing_Shortcut.cn.md b/docs/blog/content/material/Oct_12_5_E-Hualu_ShardingSphere_Hulu_Story_Data_Processing_Shortcut.cn.md index f9e5e9593c2de..e9b8bc231fde7 100644 --- a/docs/blog/content/material/Oct_12_5_E-Hualu_ShardingSphere_Hulu_Story_Data_Processing_Shortcut.cn.md +++ b/docs/blog/content/material/Oct_12_5_E-Hualu_ShardingSphere_Hulu_Story_Data_Processing_Shortcut.cn.md @@ -3,14 +3,11 @@ title = "易华录 X ShardingSphere|葫芦 App 后台数据处理的逻辑捷 weight = 21 chapter = true +++ +>“ShardingSphere 大大简化了分库分表的开发和维护工作,对于业务的快速上线起到了非常大的支撑作用,保守估计 ShardingSphere 至少为我们节省了 4 个月的研发成本。” +>——史墨轩,易华录·技术总监 -~~~ -“ShardingSphere 大大简化了分库分表的开发和维护工作,对于业务的快速上线起到了非常大的支撑作用,保守估计 ShardingSphere 至少为我们节省了 4 个月的研发成本。” -——史墨轩,易华录·技术总监 -~~~ - -今年以来,伴随着易华录旗下面向个人用户的云服务产品**【葫芦 App】**正式上线,后台架构所承受的业务压力也与日俱增。 +今年以来,伴随着易华录旗下面向个人用户的云服务产品 **【葫芦 App】** 正式上线,后台架构所承受的业务压力也与日俱增。 为此,葫芦 App 研发团队选择采用 ShardingSphere 分库分表的功能对数据进行了横向的拆分,围绕 ShardingSphere 灵活敏捷的特性,满足了葫芦 App 业务对数据层扩展性的要求,避免团队重复“造轮子”,最大程度简化了随着业务增长而带来的愈发复杂化的分库分表的开发与维护工作。 @@ -48,7 +45,7 @@ chapter = true **1.可插拔架构的『高扩展性』** -由于业务特性,葫芦 App 原本有限的存储空间被消耗得非常快,并逐渐开始影响用户在前端的响应效率。通过采用 ShardingSphere 的分片策略,葫芦研发团队在应对海量计算+存储所带来的业务问题同时,能够确保分片扩展策略的灵活性。基于此,葫芦团队可以在ShardingSphere 上快速做出相应的功能扩展,为后续架构调整提供优化方案,进一步强化突出了 ShardingSphere 分库分表的优势。 +由于业务特性,葫芦 App 原本有限的存储空间被消耗得非常快,并逐渐开始影响用户在前端的响应效率。通过采用 ShardingSphere 的分片策略,葫芦研发团队在应对海量计算+存储所带来的业务问题同时,能够确保分片扩展策略的灵活性。基于此,葫芦团队可以在 ShardingSphere 上快速做出相应的功能扩展,为后续架构调整提供优化方案,进一步强化突出了 ShardingSphere 分库分表的优势。 **2.距离业务更紧密的『贴合性』** @@ -72,3 +69,12 @@ chapter = true 北京易华录信息技术股份有限公司,成立于 2001 年,是国务院国资委直接监管的中央企业中国华录集团旗下控股的上市公司,致力于建设城市数字经济基础设施,以努力降低全社会长期保存数据的能耗和成本为使命,以成为社会可信的大数据一级开发和存储服务提供商直至演变成数据银行为愿景,构建一个数字孪生的城市,最终实现数字永生。 作为易华录内部孵化的第一款 C 端产品,葫芦 App 能够将用户生产内容的构思与素材妥善存储下来,并提供故事化的记录方式,降低用户内容制作门槛,让每个用户都能将生活的美好生动地展现出来,发现个人生活的精彩之处。为用户存储一生,点亮美好。 + +### ShardingSphere 社区链接: + +ShardingSphere Github: [https://github.com/apache/shardingsphere]() + +ShardingSphere Twitter: [https://twitter.com/ShardingSphere]() + +ShardingSphere Slack Channel: [apacheshardingsphere.slack.com]() + diff --git a/docs/blog/content/material/Oct_12_5_E_Hualu_ShardingSphere_Hulu_Story_Data_Processing_Shortcut.en.md b/docs/blog/content/material/Oct_12_5_E_Hualu_ShardingSphere_Hulu_Story_Data_Processing_Shortcut.en.md index 1438069fb9a95..edc39d3f7b09e 100644 --- a/docs/blog/content/material/Oct_12_5_E_Hualu_ShardingSphere_Hulu_Story_Data_Processing_Shortcut.en.md +++ b/docs/blog/content/material/Oct_12_5_E_Hualu_ShardingSphere_Hulu_Story_Data_Processing_Shortcut.en.md @@ -68,5 +68,7 @@ Hulu App is the first to-customer product of E-hualu. **ShardingSphere Community:** ShardingSphere Github: [https://github.com/apache/shardingsphere]() + ShardingSphere Twitter: [https://twitter.com/ShardingSphere]() + ShardingSphere Slack Channel: [apacheshardingsphere.slack.com]() diff --git a/docs/blog/content/material/Oct_12_6_AutoTable_Your_Butler-Like_Sharding_Configuration_Tool.cn.md b/docs/blog/content/material/Oct_12_6_AutoTable_Your_Butler-Like_Sharding_Configuration_Tool.cn.md index 1a44e09d62fc4..15abf7898e3c6 100644 --- a/docs/blog/content/material/Oct_12_6_AutoTable_Your_Butler-Like_Sharding_Configuration_Tool.cn.md +++ b/docs/blog/content/material/Oct_12_6_AutoTable_Your_Butler-Like_Sharding_Configuration_Tool.cn.md @@ -116,7 +116,7 @@ SHARDING_COLUMN=order_id,TYPE(NAME=hash_mod,PROPERTIES("sharding-count"=10)) DROP SHARDING TABLE RULE t_order; ~~~ -**注:**若规则修改影响到存量数据,ShardingSphere 还将提供“弹性扩缩容”的功能用作数据迁移,帮助用户方便快捷的管理分布式数据。有关“弹性扩缩容”的具体细节,请关注后续推送。 +**注:** 若规则修改影响到存量数据,ShardingSphere 还将提供“弹性扩缩容”的功能用作数据迁移,帮助用户方便快捷的管理分布式数据。有关“弹性扩缩容”的具体细节,请关注后续推送。 ### FAQ diff --git a/docs/blog/content/material/Oct_12_7_openGauss_ShardingSphere_One_of_the_Top_Distribution_Solutions.cn.md b/docs/blog/content/material/Oct_12_7_openGauss_ShardingSphere_One_of_the_Top_Distribution_Solutions.cn.md index 8fb0d6553686b..52c102b0bfcf5 100644 --- a/docs/blog/content/material/Oct_12_7_openGauss_ShardingSphere_One_of_the_Top_Distribution_Solutions.cn.md +++ b/docs/blog/content/material/Oct_12_7_openGauss_ShardingSphere_One_of_the_Top_Distribution_Solutions.cn.md @@ -23,36 +23,36 @@ openGauss 融合了众多开源组件,用以构建集数据水平扩展、分 ## 产品优势 -1.极致扩展能力,灵活扩缩容 +- 极致扩展能力,灵活扩缩容 计算与存储能力可通过水平拆分实现线性扩展,最高可达数据 6400 分片,性能随扩展准线性增长,可有效解决单表数据量膨胀问题;结合业务流量,灵活平滑进行数据节点的扩缩容,智能读写分离,实现分布式数据库的自动负载均衡。 -2.丰富企业级特性 +- 丰富企业级特性 支持分布式存储过程、触发器,分布式事务,全密态数据加密,WDR 诊断报告,提供丰富的企业级特性。 -3.一键部署,屏蔽底层依赖 +- 一键部署,屏蔽底层依赖 标准化镜像确保多环境一致性交付,容器化部署,实现物理资源池化,降低对平台的依赖性,简洁高效,实现应用秒级部署。 -4.超高可用,实现异地容灾 +- 超高可用,实现异地容灾 强有力的集群管理、运维能力,支持同城、异地、多地多中心灵活部署,基于 Paxos 协议保证数据的安全及强一致性,提供 RPO=0 的多种容灾能力。 -5.开源开放,构建全栈生态 +- 开源开放,构建全栈生态 开源 openGauss 单机及分布式解决方案,鼓励更多伙伴、开发者共同参与其中,共建数据库的繁荣生态,打造全栈开源生态链。 ## 应用场景 -1.金融系统 +- 金融系统 基于多数派共识协议 Paxos,提供分布式强一致事务能力,确保分布式环境下数据的强一致能力;多地多中心,提供 RPO=0 的能力,保障金融级可靠。 -2.政企办公 +- 政企办公 提供全密态数据加密,安全可信,支持软硬件生态,保障高可用场景,为政企办公保驾护航。 -3.智慧电网 +- 智慧电网 支持同城、异地、多地多中心灵活部署,根据业务的潮汐特点灵活扩缩容,助力智慧电网。 diff --git a/docs/blog/content/material/Oct_12_8_ShardingSphere_Google_Summer_of_Code_Students_How_Was_Your_Open_Source_Experience.cn.md b/docs/blog/content/material/Oct_12_8_ShardingSphere_Google_Summer_of_Code_Students_How_Was_Your_Open_Source_Experience.cn.md index b1e9883c8f34b..f81c49eedf390 100644 --- a/docs/blog/content/material/Oct_12_8_ShardingSphere_Google_Summer_of_Code_Students_How_Was_Your_Open_Source_Experience.cn.md +++ b/docs/blog/content/material/Oct_12_8_ShardingSphere_Google_Summer_of_Code_Students_How_Was_Your_Open_Source_Experience.cn.md @@ -8,7 +8,7 @@ chapter = true Apache ShardingSphere 社区有幸参与 Google 编程之夏(Google Summer of Code, 以下简称 GSoC),指导年轻一代参与开源程序代码设计。GSoC 是 Google 公司主办的年度开源程序设计项目,第一届从 2005 年开始,主要目的是鼓励世界各地的学生参与开放源代码的程序设计。而 Apache ShardingSphere 项目也被选中成为 GSoC 一部分,为学生带来开源软件开发的有趣体验。 -**Thanoshan** 和 **Liangda**两位学生在上一届的 GSoC 中积极与 Apache ShardingSphere 导师工作,接受指导,在 GSoC 结束后依旧在 ShardingSphere 项目中积极贡献。 +**Thanoshan** 和 **Liangda** 两位学生在上一届的 GSoC 中积极与 Apache ShardingSphere 导师工作,接受指导,在 GSoC 结束后依旧在 ShardingSphere 项目中积极贡献。 他们欣然接受了我们的采访,分享自己的 GSoC 项目申请经验,谈自己对 Apache ShardingSphere 项目和开源社区的看法,以及个人的未来计划。 <个人简介> @@ -34,85 +34,85 @@ Apache ShardingSphere 社区有幸参与 Google 编程之夏(Google Summer of **Q1:** 你们是如何喜欢上软件开发的呢? -**Thanoshan:**我的专业学位和软件开发有关,不过我个人在上大学之前就对软件开发就非常感兴趣。 +**Thanoshan:** 我的专业学位和软件开发有关,不过我个人在上大学之前就对软件开发就非常感兴趣。 -**Liangda:**应该是受到我所学专业的影响。高中时,我对商业和计算机科学都非常感兴趣,所以我选择了商业信息学专业,这个专业把这两个领域结合在一起了,上大学后,我开始了自己的编程之旅,接触到了软件开发,学习了 Java,C++,Python,还有软件设计模式等知识。 +**Liangda:** 应该是受到我所学专业的影响。高中时,我对商业和计算机科学都非常感兴趣,所以我选择了商业信息学专业,这个专业把这两个领域结合在一起了,上大学后,我开始了自己的编程之旅,接触到了软件开发,学习了 Java,C++,Python,还有软件设计模式等知识。 **Q2:** 为什么选择申请 GSoC? -**Thanoshan:**在斯里兰卡,我的很多学长学姐都已经参加过了 GSoC,他们建议我去了解一下这个项目机会,积极安利我一定要试试。然后,我搜索了很多这个项目的相关信息,去了解这个项目,并明确如何能够申请这个项目。 +**Thanoshan:** 在斯里兰卡,我的很多学长学姐都已经参加过了 GSoC,他们建议我去了解一下这个项目机会,积极安利我一定要试试。然后,我搜索了很多这个项目的相关信息,去了解这个项目,并明确如何能够申请这个项目。 -**Liangda:**我第一次知道 GSoC 是在去年夏天,我无意间在网络上找到一篇分享 GSoC 经验和申请的博文,那时我就对这个项目非常着迷。不过当时开源对我来说还是十分陌生的概念,我就望而却步,没有信心申请。之后在 2020 年的寒假,我有机会在学校的一个聊天机器人开发项目中担任助研,这个项目使用了 Rasa,Rasa 是一套开源机器学习框架。这也是我第一次深入了解开源框架,接触开源社区。这是一次非常棒的经历,所以我一下子就想到了 GSoC,我对自己说“为什么不试试 GSoC,继续去探索开源呢?”。 +**Liangda:** 我第一次知道 GSoC 是在去年夏天,我无意间在网络上找到一篇分享 GSoC 经验和申请的博文,那时我就对这个项目非常着迷。不过当时开源对我来说还是十分陌生的概念,我就望而却步,没有信心申请。之后在 2020 年的寒假,我有机会在学校的一个聊天机器人开发项目中担任助研,这个项目使用了 Rasa,Rasa 是一套开源机器学习框架。这也是我第一次深入了解开源框架,接触开源社区。这是一次非常棒的经历,所以我一下子就想到了 GSoC,我对自己说“为什么不试试 GSoC,继续去探索开源呢?”。 **Q3:** 你觉得 GSoC 有何独到之处? -**Liangda:**我认为 GSoC 很棒,因为它为学生提供了深潜开源社区的机会,去学习尖端的技术。现在 GSoC 项目有近 200 家开源社区参与,每一个社区都会提供一些项目任务,这些任务需要不同的 Stack 和技术,难度也从新手入门级别到专业难度级别,所以我觉得每个学生如果能花一些时间精力仔细研究的话,都能从中找到适合自己的项目。另一方面,GSoC 之所以特别是因为这个项目能够为开源社区带来新鲜血液。因此,GSoC 对学生和开源社区而言都是非常有益的。 +**Liangda:** 我认为 GSoC 很棒,因为它为学生提供了深潜开源社区的机会,去学习尖端的技术。现在 GSoC 项目有近 200 家开源社区参与,每一个社区都会提供一些项目任务,这些任务需要不同的 Stack 和技术,难度也从新手入门级别到专业难度级别,所以我觉得每个学生如果能花一些时间精力仔细研究的话,都能从中找到适合自己的项目。另一方面,GSoC 之所以特别是因为这个项目能够为开源社区带来新鲜血液。因此,GSoC 对学生和开源社区而言都是非常有益的。 **Q4:** 你在 GSoC 加入的是哪一个项目? -**Thanoshan:**我参加的是 ShardingSphere ANTLR 项目。我对 Java 相关开发技术真的非常感兴趣,Java 是我最喜欢的编程语言。我也对开源软件开发非常有兴趣,所以我在选择 GSoC 项目时,关注了 Java 和开源这两点。我想要向其他人请教学习,开源能够让我与他人合作。选择 ShardingSphere 的真正原因就在于它是Java开发的,这就是我参与这个项目的主要动机。 +**Thanoshan:** 我参加的是 ShardingSphere ANTLR 项目。我对 Java 相关开发技术真的非常感兴趣,Java 是我最喜欢的编程语言。我也对开源软件开发非常有兴趣,所以我在选择 GSoC 项目时,关注了 Java 和开源这两点。我想要向其他人请教学习,开源能够让我与他人合作。选择 ShardingSphere 的真正原因就在于它是Java开发的,这就是我参与这个项目的主要动机。 -**Liangda:**我在 GSoC 项目中加入了 Apache ShardingSphere Parser 引擎的任务,这个 Parser 的设计初衷就是去处理不同数据库采用不同的 SQL,比如 MySQL,PostgreSQL,Oracle 这类的。我的任务主要是关注校对数据定义语言和事务控制语言的 Oracle SQL 定义。 +**Liangda:** 我在 GSoC 项目中加入了 Apache ShardingSphere Parser 引擎的任务,这个 Parser 的设计初衷就是去处理不同数据库采用不同的 SQL,比如 MySQL,PostgreSQL,Oracle 这类的。我的任务主要是关注校对数据定义语言和事务控制语言的 Oracle SQL 定义。 **Q5:** 那你是如何开始在 ShardingSphere 项目中参与贡献的呢?有什么特别的故事吗? -**Liangda:**的确有个有趣的故事。我发现 ShardingSphere 这个项目需要学生掌握 Java,Database SQL 还有 Antlr 的知识,我感觉自己终于找到与自己知识技能完美匹配的项目了。但是当我去查看记录项目细节的 Jira 页面时,却发现 Thanoshan 从一月份就开始贡献了,那时他已经提交了很多 pull request, 进展很快。我感觉自己应该没有机会了,所以我选择放弃,继续去其他项目。但是到三月份,我打开 Apache 基金会的项目列表,出乎意料地发现 Apache ShardingSphere 又新增了一些项目任务,而且那时还没有学生认领!所以,我意识到我的机会来了,我必须抓住这个机会,于是我就开始处理一些基础的 issues。 +**Liangda:** 的确有个有趣的故事。我发现 ShardingSphere 这个项目需要学生掌握 Java,Database SQL 还有 Antlr 的知识,我感觉自己终于找到与自己知识技能完美匹配的项目了。但是当我去查看记录项目细节的 Jira 页面时,却发现 Thanoshan 从一月份就开始贡献了,那时他已经提交了很多 pull request, 进展很快。我感觉自己应该没有机会了,所以我选择放弃,继续去其他项目。但是到三月份,我打开 Apache 基金会的项目列表,出乎意料地发现 Apache ShardingSphere 又新增了一些项目任务,而且那时还没有学生认领!所以,我意识到我的机会来了,我必须抓住这个机会,于是我就开始处理一些基础的 issues。 **Q6:** 那你们怎么评价 ShardingSphere 社区的工作体验?一开始加入的时候感觉有难度吗? -**Thanoshan:**实际上,在刚开始加入 ShardingSphere 项目的时候,我还不熟悉 ANTLR,也没有用过 ANTLR,但是我的导师 Trista 写了一个帮助学生入门的 issue,写得很棒。她列出一系列需要完成的任务以及学习步骤,所以我就按照导师建议的步骤去练习,最后我学会了 ANTLR,就感觉没有那么困难了。所以我觉得这个项目一开始的难度对我来说是中等的,但是感谢我的导师提供的帮助和支持,这个项目就不那么难了。我从导师的指导中学到了很多,我的每一位导师都帮助我更好地完成任务,让我受益良多。我有三位导师,他们都非常和蔼可亲,愿意帮助我,我真的从他们身上学到很多。 +**Thanoshan:** 实际上,在刚开始加入 ShardingSphere 项目的时候,我还不熟悉 ANTLR,也没有用过 ANTLR,但是我的导师 Trista 写了一个帮助学生入门的 issue,写得很棒。她列出一系列需要完成的任务以及学习步骤,所以我就按照导师建议的步骤去练习,最后我学会了 ANTLR,就感觉没有那么困难了。所以我觉得这个项目一开始的难度对我来说是中等的,但是感谢我的导师提供的帮助和支持,这个项目就不那么难了。我从导师的指导中学到了很多,我的每一位导师都帮助我更好地完成任务,让我受益良多。我有三位导师,他们都非常和蔼可亲,愿意帮助我,我真的从他们身上学到很多。 -**Liangda:**刚开始的时候,我感觉非常难,因为我没有非常强的计算机背景,这也是我第一次参与这么大型的项目,光是初始安装就花了几个小时,而且在最初的几个 pull request 上,我也遇到挺多困难的。但是 Apache ShardingSphere 是一个非常有爱的社区,大家回答了我的每一个问题,我也得到社区成员的很多帮助。这个社区让我觉得非常温暖,这也是我决定贡献 Apache ShardingSphere 的其中一个原因。 +**Liangda:** 刚开始的时候,我感觉非常难,因为我没有非常强的计算机背景,这也是我第一次参与这么大型的项目,光是初始安装就花了几个小时,而且在最初的几个 pull request 上,我也遇到挺多困难的。但是 Apache ShardingSphere 是一个非常有爱的社区,大家回答了我的每一个问题,我也得到社区成员的很多帮助。这个社区让我觉得非常温暖,这也是我决定贡献 Apache ShardingSphere 的其中一个原因。 **Q7:** 你觉得成为 GSoC student 是一种什么体验? -**Liangda:**是非常棒的体验。GSoC 项目组织有序,时间线和日程安排清晰。从中我能够学到很多关于开源软件开发的内容,提高知识和技能。还有一点,项目结束阶段的 GSoC 学生峰会也很有趣,让我大开眼界。 +**Liangda:** 是非常棒的体验。GSoC 项目组织有序,时间线和日程安排清晰。从中我能够学到很多关于开源软件开发的内容,提高知识和技能。还有一点,项目结束阶段的 GSoC 学生峰会也很有趣,让我大开眼界。 **Q8:** 你在 ShardingSphere 项目中为了加入 GSoC 有付出额外的努力吗? -**Liangda:**我觉得自己参加的意愿非常强烈,而且我能够深入思考所面临的难题并找到问题根源。如果我无法独立解决某个 issue,我会勇敢的在 GitHub 上提问,所以我上手非常快。在对项目熟悉之后,我积极回答问题,查看其他成员的 pull request,帮助解决一些我力所能及的问题。此外,我在写项目 proposal 时,我定期会和导师联系,寻求导师的反馈。我想说的是,清楚导师的预期想法是非常重要的。 +**Liangda:** 我觉得自己参加的意愿非常强烈,而且我能够深入思考所面临的难题并找到问题根源。如果我无法独立解决某个 issue,我会勇敢的在 GitHub 上提问,所以我上手非常快。在对项目熟悉之后,我积极回答问题,查看其他成员的 pull request,帮助解决一些我力所能及的问题。此外,我在写项目 proposal 时,我定期会和导师联系,寻求导师的反馈。我想说的是,清楚导师的预期想法是非常重要的。 **Q9:** 你有什么话或是建议想对计划在 GSoC 参与 ShardingSphere 项目的同学说呢? -**Thanoshan:**我想说的是,其实导师和 ShardingSphere 社区会指定一些任务,所以如果想参与的话,应该在申请 GSoC 之前就加入社区。你们可以在项目正式开始前,就在 ShardingSphere 社区完成一些和 GSoC 主项目有关的基础项目,这绝对会帮助你在选拔过程中取得竞争优势。我想强调的就是,尽可能早地加入 ShardingSphere 社区吧。 +**Thanoshan:** 我想说的是,其实导师和 ShardingSphere 社区会指定一些任务,所以如果想参与的话,应该在申请 GSoC 之前就加入社区。你们可以在项目正式开始前,就在 ShardingSphere 社区完成一些和 GSoC 主项目有关的基础项目,这绝对会帮助你在选拔过程中取得竞争优势。我想强调的就是,尽可能早地加入 ShardingSphere 社区吧。 -**Liangda:**非常建议大家尝试一下 ShardingSphere 项目,绝对会有非常好的体验。此外,社区有些 issues 上会有“good first issue”或者“volunteer wanted”的标签,建议尽量先去尝试这些 issue。入门最简单的方式就是实操,如果你觉得毫无头绪的话,勇敢地去提问,表达自己的想法,我们都会在社区里支持你们的。 +**Liangda:** 非常建议大家尝试一下 ShardingSphere 项目,绝对会有非常好的体验。此外,社区有些 issues 上会有“good first issue”或者“volunteer wanted”的标签,建议尽量先去尝试这些 issue。入门最简单的方式就是实操,如果你觉得毫无头绪的话,勇敢地去提问,表达自己的想法,我们都会在社区里支持你们的。 **Q10:** 对 ShardingSphere 有什么建议吗? -**Thanoshan:**ShardingSphere 是一个大项目,我觉得加分项可能是它的文档。我真的很喜欢和 ShardingSphere 社区合作,我也能够在社区文档的帮助下很方便地理解一些概念。我看到已经有社区的 contributor 在提交 pull request 继续提升文档的质量。此外,我觉得 ShardingSphere 目前新增了一些安装指导,新的 contributor 就可以直接去读这些文档,明白他们应该怎么做,我觉得这一改变也很好,我也非常开心 ShardingSphere 能这么做。 +**Thanoshan:** ShardingSphere 是一个大项目,我觉得加分项可能是它的文档。我真的很喜欢和 ShardingSphere 社区合作,我也能够在社区文档的帮助下很方便地理解一些概念。我看到已经有社区的 contributor 在提交 pull request 继续提升文档的质量。此外,我觉得 ShardingSphere 目前新增了一些安装指导,新的 contributor 就可以直接去读这些文档,明白他们应该怎么做,我觉得这一改变也很好,我也非常开心 ShardingSphere 能这么做。 -**Liangda:**我觉得暑期和 ShardingShpere 社区的互动体验非常好。不过,我希望能够有机会和导师视频电话,这样会方便学生和导师的相互沟通,促进彼此的了解。 +**Liangda:** 我觉得暑期和 ShardingShpere 社区的互动体验非常好。不过,我希望能够有机会和导师视频电话,这样会方便学生和导师的相互沟通,促进彼此的了解。 **Q11:** 热爱成就精彩人生。可以请问你们对什么事情有特别热衷吗? -**Thanoshan:**我非常热衷开源。我在斯里兰卡的一家支持开源项目的公司 99X 里参与了一些开源项目,至少五个吧,我会做一些简单的贡献,比如说写 read-me 文档,写贡献者指南,去修改文档问题,或者修复一些漏洞之类的。这是我接触开源的开始,之后,我真的对开源越来越感兴趣。 +**Thanoshan:** 我非常热衷开源。我在斯里兰卡的一家支持开源项目的公司 99X 里参与了一些开源项目,至少五个吧,我会做一些简单的贡献,比如说写 read-me 文档,写贡献者指南,去修改文档问题,或者修复一些漏洞之类的。这是我接触开源的开始,之后,我真的对开源越来越感兴趣。 -**Liangda:**我非常喜欢运营社区。我是曼海姆大学的中国留学生及学者协会的主席,我们协会致力于帮助中国留学生的学习和就业,我们也会促进中德社会文化的交流。此外,在参与了 GSoC 之后,现在我也爱上了开源社区。我觉得开源社区真的很棒,因为在开源社区里面,来自世界各地的成员一起工作努力去完善一个项目,能够彼此支持。 +**Liangda:** 我非常喜欢运营社区。我是曼海姆大学的中国留学生及学者协会的主席,我们协会致力于帮助中国留学生的学习和就业,我们也会促进中德社会文化的交流。此外,在参与了 GSoC 之后,现在我也爱上了开源社区。我觉得开源社区真的很棒,因为在开源社区里面,来自世界各地的成员一起工作努力去完善一个项目,能够彼此支持。 **Q12:** 有什么关于 ShardingSphere 社区的问题想提问的吗? -**Thanoshan:**只有一个问题,能否给我一些小贴士,关于如何在 ShardingSphere 社区更积极切实地做贡献呢? +**Thanoshan:** 只有一个问题,能否给我一些小贴士,关于如何在 ShardingSphere 社区更积极切实地做贡献呢? -**主持人:**当然可以。贡献其实有很多种方式。首先,你可以帮忙处理社区的 issue。其次,你提到了的文档,帮助改进文档也是贡献的方式之一。我注意到你非常擅长写作,我读过你发布在 Medium 上的文章,如果你愿意的话,也可以帮助社区修改文档。此外,如果你的发布文章浏览量很多的,也会帮助到社区的运营。贡献真的有很多方式,有一部分是编程,当然也有和编程无关的贡献。我们社区对大家做出的任何贡献都非常感激。我不太确定,你是否有计划未来成为 Apache 基金会的committer,如果有的话,就会有一个投票的环节,投票时社区会把你在编程之外的贡献也考虑在内。 +**主持人:** 当然可以。贡献其实有很多种方式。首先,你可以帮忙处理社区的 issue。其次,你提到了的文档,帮助改进文档也是贡献的方式之一。我注意到你非常擅长写作,我读过你发布在 Medium 上的文章,如果你愿意的话,也可以帮助社区修改文档。此外,如果你的发布文章浏览量很多的,也会帮助到社区的运营。贡献真的有很多方式,有一部分是编程,当然也有和编程无关的贡献。我们社区对大家做出的任何贡献都非常感激。我不太确定,你是否有计划未来成为 Apache 基金会的committer,如果有的话,就会有一个投票的环节,投票时社区会把你在编程之外的贡献也考虑在内。 -**Thanoshan:**成为 committer 也在我的目标之中。毕业后,我绝对会尝试成为一名 committer。 +**Thanoshan:** 成为 committer 也在我的目标之中。毕业后,我绝对会尝试成为一名 committer。 -**主持人:**实际上,我最近也和 ShardingSphere PMC Chair 讨论了这个话题,他和我说,ShardingSphere 社区欢迎成员做出编程的贡献,即使你们还在学习中,只要表现出愿意贡献的想法,能够和社区共同学习成长,ShardingSphere 社区绝对是非常欢迎你们的。如果你想成为 committer 的话,你需要参与一个投票的过程,当然如果你在 ShardingSphere 项目上合作愉快的,你一定能实现你的目标的。 +**主持人:** 实际上,我最近也和 ShardingSphere PMC Chair 讨论了这个话题,他和我说,ShardingSphere 社区欢迎成员做出编程的贡献,即使你们还在学习中,只要表现出愿意贡献的想法,能够和社区共同学习成长,ShardingSphere 社区绝对是非常欢迎你们的。如果你想成为 committer 的话,你需要参与一个投票的过程,当然如果你在 ShardingSphere 项目上合作愉快的,你一定能实现你的目标的。 ### 结语 @@ -122,8 +122,8 @@ Apache ShardingSphere 社区欢迎大家的加入,无论你会不会编程, 如果你对 Apache ShardingSphere 感兴趣,欢迎点击下方链接联系我们,或查看我们的 GitHub 社区。 -**ShardingSphere Github:**https://github.com/apache/shardingsphere +**ShardingSphere Github:** https://github.com/apache/shardingsphere -**ShardingSphere Twitter:**https://twitter.com/ShardingSphere +**ShardingSphere Twitter:** https://twitter.com/ShardingSphere -**ShardingSphere Slack Channel:**apacheshardingsphere.slack.com +**ShardingSphere Slack Channel:** apacheshardingsphere.slack.com diff --git a/docs/blog/content/material/Oct_12_8_ShardingSphere_Google_Summer_of_Code_Students_How_Was_Your_Open_Source_Experience.en.md b/docs/blog/content/material/Oct_12_8_ShardingSphere_Google_Summer_of_Code_Students_How_Was_Your_Open_Source_Experience.en.md index a88f1d1184b70..c6095a84bf272 100644 --- a/docs/blog/content/material/Oct_12_8_ShardingSphere_Google_Summer_of_Code_Students_How_Was_Your_Open_Source_Experience.en.md +++ b/docs/blog/content/material/Oct_12_8_ShardingSphere_Google_Summer_of_Code_Students_How_Was_Your_Open_Source_Experience.en.md @@ -47,7 +47,7 @@ Major: Business Informatics **Thanoshan:** Here, in Sri Lanka, many of my seniors have already done the Google Summer of Code. They strongly advised me to look at this opportunity and told me that I should definitely try it. So, I researched the GSoC program, for things such as “What is about? How can I work on that?”. -**Liangda:**The first time I got to know GSoC was during last year’s summer, I was surfing on the internet, and I accidentally found out a blog sharing about some GSoC experiences and application tips. I was really fascinated by this program. But at that time, open source was completely new for me, and I was not confident enough. Then during the winter of 2020, I got the chance to work as a research assistant at the university on a chatbot project using Rasa, which is an open source conversational AI framework. That was the first time I dove so deep into an open source framework and interacted with the open source community. It was a great experience for me. And the idea came into my mind, why not take the opportunity of GSoC to get to learn more about the open source world. +**Liangda:** The first time I got to know GSoC was during last year’s summer, I was surfing on the internet, and I accidentally found out a blog sharing about some GSoC experiences and application tips. I was really fascinated by this program. But at that time, open source was completely new for me, and I was not confident enough. Then during the winter of 2020, I got the chance to work as a research assistant at the university on a chatbot project using Rasa, which is an open source conversational AI framework. That was the first time I dove so deep into an open source framework and interacted with the open source community. It was a great experience for me. And the idea came into my mind, why not take the opportunity of GSoC to get to learn more about the open source world. > **What’s so great about the program anyway?** @@ -55,7 +55,7 @@ Major: Business Informatics > **What project did you work on during GSoC?** -**Thanoshan:**ShardingSphere’s ANTLR project. I’m really interested in Java, and Java related technologies and it’s my one of the favorite languages. Also, I am very passionate about open source software development. So, I want to do something in Java and open source, to learn more from other people, something that allows me to collaborate with other people. The Java-related technology is the main motivation, which actually drove me in this project. +**Thanoshan:** ShardingSphere’s ANTLR project. I’m really interested in Java, and Java related technologies and it’s my one of the favorite languages. Also, I am very passionate about open source software development. So, I want to do something in Java and open source, to learn more from other people, something that allows me to collaborate with other people. The Java-related technology is the main motivation, which actually drove me in this project. **Liangda:** My GSoC project contributes to Apache ShardingSphere’s parser engine, which handles different database SQLs like MySQL, PostgreSQL, Oracle etc. And I was focusing on proofreading the Oracle SQL definition of DDL (Data Definition Language) and TCL (Transaction Control language). @@ -77,35 +77,35 @@ However, the Apache ShardingSphere is a nice and friendly community, my question > **How was your experience as a GSoC student?** -**Liangda:**It was a really great experience. The program is well organized with clear timeline and schedule. I was able to learn a lot about open source development and improve my skills and knowledge. The GSoC student summit at the end of the program was also really interesting and informative. +**Liangda:** It was a really great experience. The program is well organized with clear timeline and schedule. I was able to learn a lot about open source development and improve my skills and knowledge. The GSoC student summit at the end of the program was also really interesting and informative. >**What did you do differently in order to get selected for GSoC by ShardingSphere?** -**Liangda:**I think I was really motivated and I’m able to dive deep into the issues I faced to find the root cause. If I could not solve the issue by myself, I’m not afraid to ask on GitHub directly. This makes me get started quickly. +**Liangda:** I think I was really motivated and I’m able to dive deep into the issues I faced to find the root cause. If I could not solve the issue by myself, I’m not afraid to ask on GitHub directly. This makes me get started quickly. And after I got familiar with my project, I also worked proactively to answer questions, review pull requests and fix other small issues. Beside this, when I was writing my project proposal, I communicated with my mentor regularly and asked for early feedback. It is important to know mentors’ expectations. >**How was your experience as a GSoC student?** -**Liangda:**It was a really great experience. The program is well organized with clear timeline and schedule. I was able to learn a lot about open source development and improve my skills and knowledge. The GSoC student summit at the end of the program was also really interesting and informative. +**Liangda:** It was a really great experience. The program is well organized with clear timeline and schedule. I was able to learn a lot about open source development and improve my skills and knowledge. The GSoC student summit at the end of the program was also really interesting and informative. >**What did you do differently in order to get selected for GSoC by ShardingSphere?** -**Liangda: **I think I was really motivated and I’m able to dive deep into the issues I faced to find the root cause. If I could not solve the issue by myself, I’m not afraid to ask on GitHub directly. This makes me get started quickly. +**Liangda:** I think I was really motivated and I’m able to dive deep into the issues I faced to find the root cause. If I could not solve the issue by myself, I’m not afraid to ask on GitHub directly. This makes me get started quickly. And after I got familiar with my project, I also worked proactively to answer questions, review pull requests and fix other small issues. Beside this, when I was writing my project proposal, I communicated with my mentor regularly and asked for early feedback. It is important to know mentors’ expectations. > **Is there anything that you would like to say to students who are looking forward to work with ShardingSphere in GSoC? Or do you have any tips for them?** -**Thanoshan:**I would say there will be some projects that will be specified by the mentors and the ShardingSphere community. So, students will have to participate in the community even before the GSoC. +**Thanoshan:** I would say there will be some projects that will be specified by the mentors and the ShardingSphere community. So, students will have to participate in the community even before the GSoC. Students can approach the ShardingSphere community even before the program and work on some preliminary tasks related to the GSoC’s main task, which will definitely help them compete in the selection process. So, I would say that they should approach the ShardingSphere community as early as possible. -**Liangda:**Yes, I would highly recommend it and it will be a great experience for sure. There are some issues labeled as “good first issue” or “volunteer wanted”. Just go and try it as soon as possible! The easiest way to get started is learning by doing. And if you feel blocked, don’t be afraid to ask questions and express your thoughts! We are all here to support you! +**Liangda:** Yes, I would highly recommend it and it will be a great experience for sure. There are some issues labeled as “good first issue” or “volunteer wanted”. Just go and try it as soon as possible! The easiest way to get started is learning by doing. And if you feel blocked, don’t be afraid to ask questions and express your thoughts! We are all here to support you! > **Do you have any suggestions to improve ShardingSphere?** -**Thanoshan:**To improve ShardingSphere? I mean it’s a huge project. And the plus point I see here is the documentation. It’s great. So, to be honest with you, I learned a lot about SQL. I worked on the SQL parser engine part of the project, so I learned the concepts of the SQL parser engine in the ShardingSphere project. For the improvement, I currently do not see anything specific. Actually, ShardingSphere is a great one. I really love to collaborate with the ShardingSphere community. I was able to understand the concepts very easily with the help of the documentation of the ShardingSphere. I also see that there are many community contributors who submitted pull requests for the improvement of the documentation. I’m an inquisitive person so I look around in the ShardingSphere documentation and codes, support, pull request, and issues all the time. So, when I set up the project the first time, I didn’t have this setup guide. Even though I use the Intellj, the JDK, and I set up it correctly, but I didn’t have the support at that time. +**Thanoshan:** To improve ShardingSphere? I mean it’s a huge project. And the plus point I see here is the documentation. It’s great. So, to be honest with you, I learned a lot about SQL. I worked on the SQL parser engine part of the project, so I learned the concepts of the SQL parser engine in the ShardingSphere project. For the improvement, I currently do not see anything specific. Actually, ShardingSphere is a great one. I really love to collaborate with the ShardingSphere community. I was able to understand the concepts very easily with the help of the documentation of the ShardingSphere. I also see that there are many community contributors who submitted pull requests for the improvement of the documentation. I’m an inquisitive person so I look around in the ShardingSphere documentation and codes, support, pull request, and issues all the time. So, when I set up the project the first time, I didn’t have this setup guide. Even though I use the Intellj, the JDK, and I set up it correctly, but I didn’t have the support at that time. It’s nice to see that ShardingSphere currently has been adding the setup guides, so that the new contributors can easily jump to that document and read and understand what they have to do. So, it’s a great thing to have. I am happy for it. diff --git a/docs/blog/content/material/Oct_12_9_ShardingSphere_JD_Baitiao_Story_of_an_Implementation_Journey.cn.md b/docs/blog/content/material/Oct_12_9_ShardingSphere_JD_Baitiao_Story_of_an_Implementation_Journey.cn.md index 439af5d7c1d8f..7d485cec703b9 100644 --- a/docs/blog/content/material/Oct_12_9_ShardingSphere_JD_Baitiao_Story_of_an_Implementation_Journey.cn.md +++ b/docs/blog/content/material/Oct_12_9_ShardingSphere_JD_Baitiao_Story_of_an_Implementation_Journey.cn.md @@ -64,11 +64,11 @@ Solr + HBase 的方案解决了核心、非核心业务系统对关键数据库 显然京东白条数据架构将迎来一个新的阶段,解耦的驱动力可以概括如下 3 方面: -* **聚焦精力:**将基于架构的数据库拆分,交给分表组件实现,研发精力需聚焦于业务本身; +* **聚焦精力:** 将基于架构的数据库拆分,交给分表组件实现,研发精力需聚焦于业务本身; -* **简化升级:**解耦技术架构,简化业务系统升级工作的研发流程; +* **简化升级:** 解耦技术架构,简化业务系统升级工作的研发流程; -* **规划未来:**为系统提供良好的扩展能力,从容应对“618”和“11. 11”等活动。 +* **规划未来:** 为系统提供良好的扩展能力,从容应对“618”和“11. 11”等活动。 京东白条业务体量巨大,是名副其实的金融级高并发、海量数据的业务场景,因此分库分表组件应具有以下特点: @@ -87,13 +87,13 @@ Solr + HBase 的方案解决了核心、非核心业务系统对关键数据库 ShardingSphere-JDBC 的以下特点能够很好地满足白条业务场景: -* **产品成熟:**经数年打磨产品成熟度高,且社区活跃; +* **产品成熟:** 经数年打磨产品成熟度高,且社区活跃; -* **性能良好:**微内核、轻量化的设计,性能损耗极小; +* **性能良好:** 微内核、轻量化的设计,性能损耗极小; -* **改造量小:**支持原生的 MySQL 协议,研发工作量小; +* **改造量小:** 支持原生的 MySQL 协议,研发工作量小; -* **扩展灵活:**搭配使用迁移同步组件轻松实现数据扩展。 +* **扩展灵活:** 搭配使用迁移同步组件轻松实现数据扩展。 ![](https://shardingsphere.apache.org/blog/img/Blog_25_img_2_JD_ShardingSphere_JDBC_en.png) @@ -162,7 +162,6 @@ DBRep 是 ShardingSphere-Scaling 产品设计的基石,Scaling 具备的自动 搭配使用 Scaling 同步迁移组件从容面对“618”和“11.11”等大型活动,系统灵活扩容。 -- ### 写在最后 @@ -171,7 +170,6 @@ DBRep 是 ShardingSphere-Scaling 产品设计的基石,Scaling 具备的自动 互联网信用消费模式发展逐步多样化,未来 Apache ShardingSphere 将与京东展开更多业务场景的实践和探索,通过推动金融科技创新发展,进一步提升互联网金融的创新速度和效率。 -- -ShardingSphere 作为 Apache 基金会下的顶级开源项目,在 GitHub 上获得了超 14K Star 的关注,已成为行业内受欢迎的开源项目,全球有超过 170 家企业用户登记使用,覆盖金融、电子商务、云服务、旅游、物流、教育、文娱等多个领域。 +- ShardingSphere 作为 Apache 基金会下的顶级开源项目,在 GitHub 上获得了超 14K Star 的关注,已成为行业内受欢迎的开源项目,全球有超过 170 家企业用户登记使用,覆盖金融、电子商务、云服务、旅游、物流、教育、文娱等多个领域。 * 欢迎更多技术团队约稿投稿,和大家分享使用 ShardingSphere 的经验思考。如需转载请后台私信留言,对案例感兴趣的伙伴可联系社区经理(**ss_assistant_1**)回复“**加群**”进入技术交流群,我们也会不定期为社区发展做贡献的热心伙伴送上精美周边噢。 diff --git a/docs/blog/content/material/Open_source_community.cn.md b/docs/blog/content/material/Open_source_community.cn.md index 144d8e252654c..7d6ef2491f123 100644 --- a/docs/blog/content/material/Open_source_community.cn.md +++ b/docs/blog/content/material/Open_source_community.cn.md @@ -68,3 +68,7 @@ chapter = true **ShardingSphere GitHub 地址:** +**ShardingSphere Twitter 链接:** + +**ShardingSphere Slack Channel 链接:** + diff --git a/docs/blog/content/material/alpha.cn.md b/docs/blog/content/material/alpha.cn.md index bbdc855eda464..a9017701ae5dc 100644 --- a/docs/blog/content/material/alpha.cn.md +++ b/docs/blog/content/material/alpha.cn.md @@ -11,8 +11,8 @@ ElasticJob( https://github.com/apache/shardingsphere-elasticjob )是面向 ElasticJob 在技术选型时,选择站在了巨人的肩膀上而不是重复制造轮子的理念,将定时任务事实标准的 QuartZ 与 分布式协调的利器 ZooKeeper 完美结合,快速而稳定的搭建了全新概念的分布式调度框架。 -### ElasticJob调度模型 -ElasticJob 的调度模型划分为支持线程级别调度的进程内调度 ElasticJob-Lite,和进程级别调度的ElasticJob-Cloud。 +### ElasticJob 调度模型 +ElasticJob 的调度模型划分为支持线程级别调度的进程内调度 ElasticJob-Lite,和进程级别调度的 ElasticJob-Cloud。 **进程内调度** @@ -32,7 +32,7 @@ ElasticJob-Lite 本身是无中心化架构,无需独立的中心化调度节 ElasticJob-Cloud 拥有进程内调度和进程级别调度两种方式。由于 ElasticJob-Cloud 能够对作业服务器的资源进行控制,因此其作业类型可划分为常驻任务和瞬时任务。常驻任务类似于ElasticJob-Lite,是进程内调度;瞬时任务则完全不同,它充分的利用了资源分配的削峰填谷能力,是进程级的调度,每次任务的会启动全新的进程处理。 -ElasticJob-Cloud 需要通过 Mesos 对资源进行控制,并且通过部署在 Mesos Master的调度器进行任务和资源的分配。Cloud采用中心化架构,将调度中心的高可用交由 Mesos管理。 +ElasticJob-Cloud 需要通过 Mesos 对资源进行控制,并且通过部署在 Mesos Master 的调度器进行任务和资源的分配。Cloud 采用中心化架构,将调度中心的高可用交由 Mesos管理。 它的架构图如下: @@ -76,9 +76,9 @@ ElasticJob 中任务分片项的概念,使得任务可以在分布式的环境 **API 变更** -1. 将 Maven 坐标的 groupId 变更为org.apache.shardingsphere.elasticjob +1. 将 Maven 坐标的 groupId 变更为 org.apache.shardingsphere.elasticjob -2. 将包名称变更为org.apache.shardingsphere.elasticjob +2. 将包名称变更为 org.apache.shardingsphere.elasticjob 3. 将 Spring 命名空间名称变更为 http://shardingsphere.apache.org/schema/elasticjob @@ -92,7 +92,7 @@ ElasticJob 中任务分片项的概念,使得任务可以在分布式的环境 1. 调度器多元化,增加一次性任务调度器 -2. 提供ElasticJob-Lite 项目的 官方 Spring Boot Starter +2. 提供 ElasticJob-Lite 项目的 官方 Spring Boot Starter 3. 支持使用多种数据库类型存储作业历史轨迹数据 @@ -100,9 +100,9 @@ ElasticJob 中任务分片项的概念,使得任务可以在分布式的环境 5. 全新的控制台界面 -### 3.x版本设计解读 +### 3.x 版本设计解读 -通过Release Notes能够看出,ElasticJob 3.x 并非 2.x 的修补版本,而是通过革新的设计理念践行的一套新产品。 +通过 Release Notes 能够看出,ElasticJob 3.x 并非 2.x 的修补版本,而是通过革新的设计理念践行的一套新产品。 ElasticJob 3.x 最直观的变化是将原有的个位数的模块数量拆分为数十个职责清理的微模块。 @@ -110,27 +110,27 @@ ElasticJob 3.x 最直观的变化是将原有的个位数的模块数量拆分 **微内核** -ElasticJob 3.x 抽象了 API 和基础设施模块,并且将注册中心、历史执行轨迹、控制台、作业执行器、Lite和Cloud等模块全数分离。 +ElasticJob 3.x 抽象了 API 和基础设施模块,并且将注册中心、历史执行轨迹、控制台、作业执行器、Lite 和 Cloud 等模块全数分离。 内核模块高度可扩展,但不依赖于可扩展模块本身的实现。它继承了 ElasticJob 之前的能力,在继续为开发者提供分布式服务的工具包的同时,向开发者开放可自由定制化扩展的脚手架。 **可扩展** -ElasticJob 3.x在微内核的基础上定义了丰富的可扩展接口,包括作业类型、配置策略、历史执行轨迹存储端以及将要做的注册中心存储端等可扩展接口。 +ElasticJob 3.x 在微内核的基础上定义了丰富的可扩展接口,包括作业类型、配置策略、历史执行轨迹存储端以及将要做的注册中心存储端等可扩展接口。 开发者可以在不修改 ElasticJob 源码的情况下织入定制化功能,真正做到对修改关闭,对扩展开放。 **生态对接** -ElasticJob 3.x 提供了官方的Spring Boot Starter,并已经着手开发基于 Apache SkyWalking 的自动探针,使其能更加便捷的融入现有的技术体系。 +ElasticJob 3.x 提供了官方的 Spring Boot Starter,并已经着手开发基于 Apache SkyWalking 的自动探针,使其能更加便捷的融入现有的技术体系。 -另外,从Release Notes中可以解读到的是,ElasticJob 3.x 并未对 Cloud进行大幅更新,其主要改动均集中在内核以及Lite模块。 +另外,从 Release Notes中可以解读到的是,ElasticJob 3.x 并未对 Cloud 进行大幅更新,其主要改动均集中在内核以及 Lite 模块。 -对于部署复杂且逐渐不再流行的 Mesos,ElasticJob 的 3.x 将渐渐弱化对它的依赖,并计划在未来提供更加泛化资源隔离 API,使 Cloud 产品线可对接Mesos,Kubernetes 甚至无依赖的独立部署使用。 +对于部署复杂且逐渐不再流行的 Mesos,ElasticJob 的 3.x 将渐渐弱化对它的依赖,并计划在未来提供更加泛化资源隔离 API,使 Cloud 产品线可对接 Mesos,Kubernetes 甚至无依赖的独立部署使用。 ### 3.0.0-beta 功能预告 -在调整完项目和包结构之后,ElasticJob 3.0.0-beta版本将工作重点放在新功能开发和操作 API 标准化这两个方面。 +在调整完项目和包结构之后,ElasticJob 3.0.0-beta 版本将工作重点放在新功能开发和操作 API 标准化这两个方面。 **新功能预告** @@ -140,7 +140,7 @@ ElasticJob 3.x 提供了官方的Spring Boot Starter,并已经着手开发基 2. HTTP 作业类型 -支持HTTP作业类型,在Script 之外提供另外的跨语言作业类型。 +支持 HTTP 作业类型,在 Script 之外提供另外的跨语言作业类型。 **操作 API 标准化** @@ -162,7 +162,7 @@ ElasticJob 3.x 提供了官方的Spring Boot Starter,并已经着手开发基 **可插拔生态** -与 Apache ShardingSphere 一脉相承,ElasticJob 也将提供更加可插拔和模块化架构,为开发者提供基础设施。方便开发者基于 ElasticJob 二次开发,添加各种定制化功能,包括但不限于作业类型(如:大数据作业、HTTP作业等)、注册中心类型(如:Eureka等)、执行轨迹存储介质(如其他数据库类型)等。 +与 Apache ShardingSphere 一脉相承,ElasticJob 也将提供更加可插拔和模块化架构,为开发者提供基础设施。方便开发者基于 ElasticJob 二次开发,添加各种定制化功能,包括但不限于作业类型(如:大数据作业、HTTP 作业等)、注册中心类型(如:Eureka 等)、执行轨迹存储介质(如其他数据库类型)等。 ElasticJob 最终会将 Lite 和 Cloud 以更贴近的方式供开发工程师和运维工程师使用,共享其调度、执行和作业库。整体规划如下: @@ -173,7 +173,7 @@ ElasticJob 最终会将 Lite 和 Cloud 以更贴近的方式供开发工程师 ElasticJob 社区在之前的几年处于停滞状况,主要原因是作者精力有限,分身乏术。在接收到了作为 Apache ShardingSphere 弹性迁移的调度基础设施的需求之后,本就一脉相承的 ElasticJob 社区决定重启,并且作为 Apache ShardingSphere 的子项目继续发光发热。目前的 ElasticJob 已正式将项目源码迁入 Apache 的 GitHub 仓库,并且在重启的几个月来十分活跃,在GitHub 周和月度趋势排名中榜上有名。 -ElasticJob 是Apache ShardingSphere( https://github.com/apache/shardingsphere )的子项目,目标是成为独立的 Apache 顶级项目,以及为 Apache ShardingSphere 的弹性迁移提供数据调度的基石。 +ElasticJob 是 Apache ShardingSphere( https://github.com/apache/shardingsphere )的子项目,目标是成为独立的 Apache 顶级项目,以及为 Apache ShardingSphere 的弹性迁移提供数据调度的基石。 ### 作者简介 @@ -183,7 +183,7 @@ ElasticJob 是Apache ShardingSphere( https://github.com/apache/shardingsphere 目前主要精力投入在将分布式数据库中间件 Apache ShardingSphere 打造为业界一流的金融级数据解决方案之上。 -Apache ShardingSphere( https://github.com/apache/shardingsphere )是京东主导的首个 Apache 软件基金会顶级项目,也是 Apache 软件基金会首个分布式数据库中间件。 +Apache ShardingSphere ( https://github.com/apache/shardingsphere )是京东主导的首个 Apache 软件基金会顶级项目,也是 Apache 软件基金会首个分布式数据库中间件。 曾出版书籍《未来架构——从服务化到云原生》。 diff --git a/docs/blog/content/material/committer.cn.md b/docs/blog/content/material/committer.cn.md index 6d7de763b4f05..da0d71e4d5f8f 100644 --- a/docs/blog/content/material/committer.cn.md +++ b/docs/blog/content/material/committer.cn.md @@ -4,7 +4,7 @@ weight = 5 chapter = true +++ -### 什么是Apache软件基金会? +### 什么是 Apache 软件基金会? Apache 软件基金会(Apache Software Foundation),是当今最具影响力的非盈利性开源软件项目组织,正式成立于 1999 年,主要由开发者与用户的团体组成。在 Apache 软件基金会主导下,已有 350 多个顶级开源项目毕业,包括全球最著名的网络服务器软件 Apache HTTP Server。秉持着“开放、创新、社区”的精神,很多 Apache 项目已经建立起强大成功的生态圈,社区充满活力。 @@ -12,7 +12,7 @@ Apache 软件基金会(Apache Software Foundation),是当今最具影响 Apache 软件基金会如今已成为现代开源软件生态系统的基石。 -### 为什么要成为Apache committer? +### 为什么要成为 Apache committer? 说了这么多,不管大家之前对 Apache 软件基金会了解到了什么程度,都可以看出,这是一个极具影响力的组织,在业内广受认可。 @@ -31,7 +31,7 @@ Apache 软件基金会如今已成为现代开源软件生态系统的基石。 ![](https://shardingsphere.apache.org/blog/img/committer1.jpg) -### 如何成为官方认可的 committer? +### 如何成为官方认可的 committer ? 下面就是本篇文章的重点啦,需要做些什么,才会成为一名官方认可的 committer 呢? diff --git a/docs/blog/content/material/community.cn.md b/docs/blog/content/material/community.cn.md index 36905915cd9e5..853887a1a521a 100644 --- a/docs/blog/content/material/community.cn.md +++ b/docs/blog/content/material/community.cn.md @@ -5,7 +5,7 @@ chapter = true +++ -Apache ShardingSphere 社区受邀参与了11月9日在清华大学举办的《 Apache Event——走进 Apache 开源软件社区》的分享活动。在活动中 Apache ShardingSphere 社区的PPMC张亮分享了《 Apache ShardingSphere 社区的探索与拓展》这个话题,下面呈现分享的主要内容。 +Apache ShardingSphere 社区受邀参与了11月9日在清华大学举办的《 Apache Event——走进 Apache 开源软件社区》的分享活动。在活动中 Apache ShardingSphere 社区的 PPMC 张亮分享了《 Apache ShardingSphere 社区的探索与拓展》这个话题,下面呈现分享的主要内容。 ### 01 为什么要做开源 ### @@ -31,9 +31,9 @@ Apache ShardingSphere 社区受邀参与了11月9日在清华大学举办的《 ### 02 Apache 软件基金会项目简介 ### -Apache 软件基金会是一个非盈利组织。从1999年至今的20年时间里,产出了无数影响软件行业的项目。在几百个 Apache 软件基金会项目中,我们可以浏览一下几个非常著名的项目:Apache Tomcat、Apache Commons、Apache Maven、Apache Hadoop、Apache Kafka、Apache Spark、Apache Zookeeper等等。Apache 软件基金会的项目成为了开发者日常工作的基石。毫不夸张的说,如果以上项目,您一个都没听说过的话,那么可能很难拿到任何一家公司的Java后端或大数据类Offer。 +Apache 软件基金会是一个非盈利组织。从 1999 年至今的 20 年时间里,产出了无数影响软件行业的项目。在几百个 Apache 软件基金会项目中,我们可以浏览一下几个非常著名的项目:Apache Tomcat、Apache Commons、Apache Maven、Apache Hadoop、Apache Kafka、Apache Spark、Apache Zookeeper 等等。Apache 软件基金会的项目成为了开发者日常工作的基石。毫不夸张的说,如果以上项目,您一个都没听说过的话,那么可能很难拿到任何一家公司的 Java 后端或大数据类 Offer 。 -近年来,来自中国的 Apache 项目也越来越多了,截止到目前为止,已经有19个来自中国的项目进入了 Apache 软件基金会,其中有9个项目已经毕业成为顶级项目,还有10个项目正在孵化中。对于没有在西方社会工作过的人来说,参与一个国际化的开源项目的门槛有点高,因此,来自中国的 Apache 软件基金会项目对于想参与开源的国内同学是一个巨大的福音。这些项目能够提供一个有效的缓冲带,让一些初入社区且找不到门路的同学能够以熟悉的母语快速的进入国际化的开源社区。来自中国的 Apache 软件基金会项目,与来自西方的Apache软件基金会项目在流程、规范、法务等方面并无不同,唯一的区别是能在社区中找到可以说汉语的人,拉进沟通交流的举例,并进一步的了解 Apache 社区的运作模式,为以后参与其他国际化项目打好基础。 +近年来,来自中国的 Apache 项目也越来越多了,截止到目前为止,已经有 19 个来自中国的项目进入了 Apache 软件基金会,其中有 9 个项目已经毕业成为顶级项目,还有 10 个项目正在孵化中。对于没有在西方社会工作过的人来说,参与一个国际化的开源项目的门槛有点高,因此,来自中国的 Apache 软件基金会项目对于想参与开源的国内同学是一个巨大的福音。这些项目能够提供一个有效的缓冲带,让一些初入社区且找不到门路的同学能够以熟悉的母语快速的进入国际化的开源社区。来自中国的 Apache 软件基金会项目,与来自西方的 Apache 软件基金会项目在流程、规范、法务等方面并无不同,唯一的区别是能在社区中找到可以说汉语的人,拉进沟通交流的举例,并进一步的了解 Apache 社区的运作模式,为以后参与其他国际化项目打好基础。 ### 03 Apache ShardingSphere 简介 ### @@ -48,15 +48,15 @@ Apache ShardingSphere 开源将近4年了,它的外部使用相当广泛,目 \-1- 邮件列表数据变化 -这里只统计 dev@shardingsphere.apache.org 邮箱,dev邮箱是社区交流问题的主要途径。2019 年 5 月有邮件 53 封;主题20个;参与人数 14 人。而且这些数据的统计是包含了 GitBox 从 GitHub 转发的15封邮件,那么实际的邮件数量是38封。在2019年9月的统计数据则有了明显的提升,其中邮件148封;主题34个,参与人 37 人,并且我们已经将 GitBox 转发的邮件从 dev 邮件组摘除,而是转移到了notification@shardingsphere.apache.org 邮箱。 +这里只统计 dev@shardingsphere.apache.org 邮箱,dev邮箱是社区交流问题的主要途径。2019 年 5 月有邮件 53 封;个;参与人数 14 人。而且这些数据的统计是包含了 GitBox 从 GitHub 转发的 15 封邮件,那么实际的邮件数量是 38 封。在2019年9月的统计数据则有了明显的提升,其中邮件 148 封;主题 34 个,参与人 37 人,并且我们已经将 GitBox 转发的邮件从 dev 邮件组摘除,而是转移到了notification@shardingsphere.apache.org 邮箱。 \-2- GitHub 数据变化 -从项目开源之初,到 2018 年 6 月左右的时间,项目整体的提交波峰波谷数据,和我个人的提交数据是几乎吻合的。这说明,在没有进入 Apache 软件基金会之前,ShardingSphere 项目是个人色彩浓重的项目,它的成功与失败,是绑定在个人之上,项目的风险完全集中在一个或几个人身上。对比下近一个月(2019 年 10 月-2019 年 11 月)的 GitHub 数据,可以看到项目有33个人参与;合并了 100 个 pull requests;关闭了 167 个 issues;新建了 36 个 issues ;总共修改了 591 个文件;其中新增代码 12021 行;删除代码 6577 行。可以看到,Apache ShardingSphere 已经从个人项目转变为一个社区项目,由社区所掌控的项目风险更小、进展更迅速。GitHub的stars数量在近一年中增长了 4000 以上,从进入 Apache 基金会之前的 5000 +增长到了现在的 9000+。 +从项目开源之初,到 2018 年 6 月左右的时间,项目整体的提交波峰波谷数据,和我个人的提交数据是几乎吻合的。这说明,在没有进入 Apache 软件基金会之前,ShardingSphere 项目是个人色彩浓重的项目,它的成功与失败,是绑定在个人之上,项目的风险完全集中在一个或几个人身上。对比下近一个月(2019 年 10 月-2019 年 11 月)的 GitHub 数据,可以看到项目有 33 个人参与;合并了 100 个 pull requests;关闭了 167 个 issues;新建了 36 个 issues ;总共修改了 591 个文件;其中新增代码 12021 行;删除代码 6577 行。可以看到,Apache ShardingSphere 已经从个人项目转变为一个社区项目,由社区所掌控的项目风险更小、进展更迅速。GitHub 的 stars 数量在近一年中增长了 4000 以上,从进入 Apache 基金会之前的 5000+ 增长到了现在的 9000+。 \-3- 社区数据变化 -在进入 Apache 孵化器时,ShardingSphere 的项目管理委员会成员一共有11人,除了项目管理委员会成员,社区中并未有官方提交者。经过了一年的进展,目前项目管理委员会成员增加了 2 人,达到了 13 人;并且新提升了7个官方提交者。一年来,参与项目的贡献者也从 37 人增长到了 88 人。参与的人数还在不断的增长中,未来 ShardingSphere 社区会从这些贡献者中提升更多的官方提交者,也会从官方提交者中提升更多的项目管理委员会成员。 +在进入 Apache 孵化器时,ShardingSphere 的项目管理委员会成员一共有 11 人,除了项目管理委员会成员,社区中并未有官方提交者。经过了一年的进展,目前项目管理委员会成员增加了 2 人,达到了 13 人;并且新提升了 7 个官方提交者。一年来,参与项目的贡献者也从 37 人增长到了 88 人。参与的人数还在不断的增长中,未来 ShardingSphere 社区会从这些贡献者中提升更多的官方提交者,也会从官方提交者中提升更多的项目管理委员会成员。 ### 05 Apache ShardingSphere 社区的核心思路 ### @@ -64,25 +64,25 @@ Apache ShardingSphere 开源将近4年了,它的外部使用相当广泛,目 2\. 尊重和相信合作者。我们相信,主动参与开源社区的人,是因为他愿意去做,并且愿意去做好的,是有充分热情的。所以我们会尊重每一个合作者,珍惜每个合作者的贡献。同时,我们也相信每一个合作者,并授予他们最大的权限。这里需要特别说明一下,合作者和初级贡献者是不同的,合作者需要通过较为长期参与来获得其他合作者的认同。识别值得依赖的合作者,是开源社区的重要工作之一。 -3\. 自动化测试。随着项目的贡献者越来越多,代码提交也会越来越频繁,靠人力去把控最终质量则会愈加不确定。出错与否不一定取决于个人意志,ShardingSphere社区更加看重能通过自动化的方式降低出错的概率。自动化测试框架能够保证贡献者不在提心吊胆的情况下提交代码,只要自动化测试是正确的,那么代码的正确性就可以保证。自动化测试可以让参与者更加愉悦的享受代码贡献的过程。 +3\. 自动化测试。随着项目的贡献者越来越多,代码提交也会越来越频繁,靠人力去把控最终质量则会愈加不确定。出错与否不一定取决于个人意志,ShardingSphere 社区更加看重能通过自动化的方式降低出错的概率。自动化测试框架能够保证贡献者不在提心吊胆的情况下提交代码,只要自动化测试是正确的,那么代码的正确性就可以保证。自动化测试可以让参与者更加愉悦的享受代码贡献的过程。 -4\. 创建自助渠道。随着项目被越来越多的用户所使用,各种问题也会层出不穷,即有可能是项目的bug,也有可能是用户自身的问题,还有可能是文档不清晰导致。因此,创建一个可以用用户自助的渠道就尤为重要。通过文档和FAQ,让用户能够以自助的方式解决大部分问题。在出现无法解决的问题时,通过邮件、GitHub、甚至微信群都可以找到社区的核心开发者,进一步的沟通和交流问题。 +4\. 创建自助渠道。随着项目被越来越多的用户所使用,各种问题也会层出不穷,即有可能是项目的 bug,也有可能是用户自身的问题,还有可能是文档不清晰导致。因此,创建一个可以用用户自助的渠道就尤为重要。通过文档和 FAQ ,让用户能够以自助的方式解决大部分问题。在出现无法解决的问题时,通过邮件、GitHub、甚至微信群都可以找到社区的核心开发者,进一步的沟通和交流问题。 -5\. 公开和远程的工作模式。只有在邮件列表或GitHub进行公开讨论问题,才会被视为已经发生的问题。社区不会处理私下的沟通和承诺,社区希望所有的问题和决议都是公开可查的。远程协作则表示合作者没有必要在地理上集中在一起,这就意味着工作是异步的。非交互式沟通,则进一步要求信息来往要交代清楚上下文,并尽可能多的通过一次信息描述更多的问题,从而进一步的促进沟通者的思考。 +5\. 公开和远程的工作模式。只有在邮件列表或 GitHub 进行公开讨论问题,才会被视为已经发生的问题。社区不会处理私下的沟通和承诺,社区希望所有的问题和决议都是公开可查的。远程协作则表示合作者没有必要在地理上集中在一起,这就意味着工作是异步的。非交互式沟通,则进一步要求信息来往要交代清楚上下文,并尽可能多的通过一次信息描述更多的问题,从而进一步的促进沟通者的思考。 -Apache 软件基金会提供了一个社区成熟度的评估模型,从代码、著作权、发布、质量、社区、一致决议、产品独立性这7个方面对社区的成熟度进行评估。目前Apache ShardingSphere已经完成了评估,已经通过了其全部34个子项目的评估。 +Apache 软件基金会提供了一个社区成熟度的评估模型,从代码、著作权、发布、质量、社区、一致决议、产品独立性这 7 个方面对社区的成熟度进行评估。目前 Apache ShardingSphere 已经完成了评估,已经通过了其全部 34 个子项目的评估。 ### 06 提升 Apache ShardingSphere 社区的活跃度 ### -1\. 项目架构调整。Apache ShardingSphere 在技术结构层面是由数据库协议层、SQL 层、分布式事务层和存储层组成的,在功能层面则是由分片、高可用治理、数据脱敏、读写分离等很多功能组成。目前的ShardingSphere 架构正在调整为完全 SPI 化的架构,扩展任一技术或实现任一功能都不会影响其他功能。举例说明:Apache ShardingSphere 对 SQL 的支持会根据数据库的方言完全分离,改动了 MySQL 的解析部分,不会对其他数据库有任何影响。因此,ShardingSphere可以支持很多贡献者同时贡献代码而相互不冲突。 +1\. 项目架构调整。Apache ShardingSphere 在技术结构层面是由数据库协议层、SQL 层、分布式事务层和存储层组成的,在功能层面则是由分片、高可用治理、数据脱敏、读写分离等很多功能组成。目前的 ShardingSphere 架构正在调整为完全 SPI 化的架构,扩展任一技术或实现任一功能都不会影响其他功能。举例说明:Apache ShardingSphere 对 SQL 的支持会根据数据库的方言完全分离,改动了 MySQL 的解析部分,不会对其他数据库有任何影响。因此,ShardingSphere 可以支持很多贡献者同时贡献代码而相互不冲突。 -2\. 项目指南。Apache ShardingSphere 为贡献者提供了很多指南,可以让潜在的贡献者通过指南了解如何参与 Apache ShardingSphere 的社区,这些指南包括邮件订阅指南、贡献者指南、提交者指南、发布指南以及文档指南,基本涵盖了所有的参与社区的要素。社区也正在着手处理技术模块相关的贡献指南,目前的测试框架以及SQL解析指南正在进行中。 +2\. 项目指南。Apache ShardingSphere 为贡献者提供了很多指南,可以让潜在的贡献者通过指南了解如何参与 Apache ShardingSphere 的社区,这些指南包括邮件订阅指南、贡献者指南、提交者指南、发布指南以及文档指南,基本涵盖了所有的参与社区的要素。社区也正在着手处理技术模块相关的贡献指南,目前的测试框架以及 SQL 解析指南正在进行中。 -3\. 规范。规范化的代码可以使项目更加具有仪式感,当有代码开始腐坏时,是整个项目开始失控的开始。因此,代码规范也是 Apache ShardingSphere 项目的重要组成,社区提供了代码规范文档的同时,也提供了checkstyle 等代码检查工具,不符合规范的代码通不过持续集成工具的检查,也无从合并至开发主干。 +3\. 规范。规范化的代码可以使项目更加具有仪式感,当有代码开始腐坏时,是整个项目开始失控的开始。因此,代码规范也是 Apache ShardingSphere 项目的重要组成,社区提供了代码规范文档的同时,也提供了 checkstyle 等代码检查工具,不符合规范的代码通不过持续集成工具的检查,也无从合并至开发主干。 4\. 需求边界划分。Apache ShardingSphere 本身是一个活跃社区的同时,也是京东的基础数据库中间件,支撑了大量的在线应用。因此 Apache ShardingSphere 将项目拆分为公司使用的场景和社区场景。在公司使用的场景需求下,功能会尽量维持稳定、优先级更高、并且有 Deadline 作为项目提交的最终日期限制;在社区的场景下,功能会维持持续开放的心态、优先级适中、一般会采用里程碑的方式作为功能的最终日期。作为京东的 Apache ShardingSphere 的团队,我们也是社区的一部分,在参与社区的同时,会将稳定版本的 Apache ShardingSphere 赋能公司内部应用。 -5\. 多元化沟通渠道。除了邮件和 GitHub 的 issue,社区也提供了微信群进行交流。特别说明一下,邮件和 GitHub 永远是核心开发者用于处理问题的依据。微信沟通虽然方便,但不便于归档和二次查询,因此只用于进一步沟通使用,如果用户没有通过邮件或GitHub创建问题,核心开发者可能并不会通过微信直接反馈。 +5\. 多元化沟通渠道。除了邮件和 GitHub 的 issue,社区也提供了微信群进行交流。特别说明一下,邮件和 GitHub 永远是核心开发者用于处理问题的依据。微信沟通虽然方便,但不便于归档和二次查询,因此只用于进一步沟通使用,如果用户没有通过邮件或 GitHub 创建问题,核心开发者可能并不会通过微信直接反馈。 贡献社区的方式有很多,包括但不限于分享(演讲、文章)、回答问题、参与讨论、调查 issue、网站设计、文档更新、文章文档翻译、代码提交、社区运营&推广等。代码提交只是众多贡献方式的一种,热烈欢迎愿意参与社区的同学以多元化的方式贡献社区,提升自身的价值。 diff --git a/docs/blog/content/material/database.en.md b/docs/blog/content/material/database.en.md index 6aa27450b14f1..09788d270ee1b 100644 --- a/docs/blog/content/material/database.en.md +++ b/docs/blog/content/material/database.en.md @@ -46,7 +46,7 @@ Defines itself as a transparent database proxy, providing a database server that ![](https://shardingsphere.apache.org/blog/img/database2.jpg) -**Sharding-Sidecar (Planned) ** +**Sharding-Sidecar (Planned)** Defines itself as a cloud native database agent of the Kubernetes environment, in charge of all the access to the database in the form of sidecar. It provides a mesh layer interacting with the database, we call this as Database Mesh. diff --git a/docs/blog/content/material/engine.cn.md b/docs/blog/content/material/engine.cn.md index 961cf83bfba29..b2ae533d065f6 100644 --- a/docs/blog/content/material/engine.cn.md +++ b/docs/blog/content/material/engine.cn.md @@ -4,21 +4,21 @@ weight = 4 chapter = true +++ -今天「剖析Sharding-Sphere系列文章」为大家带来对Sharding-Sphere自动化执行引擎模块的相关介绍。鉴于老板比较喜欢正经的技术文章,所以妹子我尽量用正经又不失肃穆的叙述风格,为大家带来《Sharding-Sphere自动化执行引擎模块》的分享。 +今天「剖析 Sharding-Sphere 系列文章」为大家带来对 Sharding-Sphere 自动化执行引擎模块的相关介绍。鉴于老板比较喜欢正经的技术文章,所以妹子我尽量用正经又不失肃穆的叙述风格,为大家带来《Sharding-Sphere 自动化执行引擎模块》的分享。 -传说鱼的记忆只有7秒钟。前段时间刚把这个模块的代码抒写整理完,趁着我还没有失忆之前,先为大家叙述一二,愿对各位看官有所帮助。 +传说鱼的记忆只有 7 秒钟。前段时间刚把这个模块的代码抒写整理完,趁着我还没有失忆之前,先为大家叙述一二,愿对各位看官有所帮助。 -「剖析Sharding-Sphere系列文章」是由Sharding-Sphere的核心开发成员亲自操刀向大家介绍和剖析Sharding-Sphere的核心模块、所使用的前沿技术、有价值的经验总结等。这一系列的文章将带您走进Sharding-Sphere的内核世界,获得新知、激发灵感。更希望您关注我们,共同交流切磋,一同前行。 +「剖析 Sharding-Sphere 系列文章」是由 Sharding-Sphere 的核心开发成员亲自操刀向大家介绍和剖析 Sharding-Sphere 的核心模块、所使用的前沿技术、有价值的经验总结等。这一系列的文章将带您走进 Sharding-Sphere 的内核世界,获得新知、激发灵感。更希望您关注我们,共同交流切磋,一同前行。 ### 作者介绍 -潘娟,京东金融运维DBA,主要负责京东金融生产数据库运维及数据库平台、中间件开发工作。多次参与京东金融6.18、11.11大促活动的护航工作。曾负责京东金融数据库自动化平台设计与开发项目,现专注于Sharding-Sphere分布式数据库中间件开发。乐于在数据库、自动化、分布式、中间件等相关领域进行学习和探索。 +潘娟,京东金融运维DBA,主要负责京东金融生产数据库运维及数据库平台、中间件开发工作。多次参与京东金融6.18、11.11大促活动的护航工作。曾负责京东金融数据库自动化平台设计与开发项目,现专注于 Sharding-Sphere 分布式数据库中间件开发。乐于在数据库、自动化、分布式、中间件等相关领域进行学习和探索。 ### 概念介绍 Q: 什么叫"自动化执行引擎"? -A: 一条SQL的生命周期是:从客户端发起、经过Sharding-Sphere处理、再到底层数据库执行消化。而在Sharding-Sphere里过程则是:SQL解析-->SQL优化-->SQL路由-->SQL改写-->SQL执行-->结果归并。自动化执行引擎是为了处理SQL执行问题的,即将路由改写后的真实SQL如何有控制且高效地传送到底层数据库执行。那么直接通过JDBC发送SQL至数据库执行难道行不通吗?还有其他需要考虑吗?答案是:肯定有其他考虑,否则我就不用写这篇文章了。这就体现在它的"自动化"上了。所谓"自动化",其实是为了平衡数据库连接创建与结果归并模式选择问题,为了平衡资源控制与执行效率问题。 +A: 一条SQL的生命周期是:从客户端发起、经过 Sharding-Sphere 处理、再到底层数据库执行消化。而在 Sharding-Sphere 里过程则是:SQL解析-->SQL优化-->SQL路由-->SQL改写-->SQL执行-->结果归并。自动化执行引擎是为了处理SQL执行问题的,即将路由改写后的真实SQL如何有控制且高效地传送到底层数据库执行。那么直接通过JDBC发送SQL至数据库执行难道行不通吗?还有其他需要考虑吗?答案是:肯定有其他考虑,否则我就不用写这篇文章了。这就体现在它的"自动化"上了。所谓"自动化",其实是为了平衡数据库连接创建与结果归并模式选择问题,为了平衡资源控制与执行效率问题。 ### 需求场景 @@ -28,11 +28,11 @@ A: 在概念介绍部分,我们介绍了主角-自动化执行引擎。也谈 1.数据库连接创建 -作为一位混娱乐圈的DBA出身的Java coder, 多少还是会从DBA角度考虑问题。比如从资源控制的角度看,业务方访问数据库的连接数量应当有所限制,这能够有效地防止某一业务操作过多地占用资源,从而将数据库连接的资源耗尽,以致于影响其他业务的正常访问。特别是在一个数据库实例中存在较多分表的情况下,一条不包含分片键的逻辑SQL将产生落在同库不同表的大量真实SQL,如果每条真实SQL都占用一个独立的连接,那么一次查询肯定将会占用过多的资源。Sharding-Sphere作为数据库中间层,如果没有控制好数据库连接数量而导致连接暴增、数据库压力过大的话,极有可能被强行背锅。 +作为一位混娱乐圈的 DBA 出身的 Java coder, 多少还是会从 DBA 角度考虑问题。比如从资源控制的角度看,业务方访问数据库的连接数量应当有所限制,这能够有效地防止某一业务操作过多地占用资源,从而将数据库连接的资源耗尽,以致于影响其他业务的正常访问。特别是在一个数据库实例中存在较多分表的情况下,一条不包含分片键的逻辑 SQL 将产生落在同库不同表的大量真实 SQL,如果每条真实 SQL 都占用一个独立的连接,那么一次查询肯定将会占用过多的资源。Sharding-Sphere 作为数据库中间层,如果没有控制好数据库连接数量而导致连接暴增、数据库压力过大的话,极有可能被强行背锅。 2.结果归并模式选择 -但是从执行效率的角度看,为每个分片查询维持一个独立的数据库连接,可以更加有效地利用多线程来提升执行效率。为每个数据库连接开启独立的线程,可以并行化IO所产生的消耗。独立的数据库连接,能够保持查询结果集的引用以及游标位置,在需要获取相应数据时移动游标即可,避免了过早将查询结果数据加载至内存。这就涉及到了结果归并模式的选择问题。通过上一篇文章《剖析Sharding-Sphere系列——结果归并》介绍,我们知道当前有两种结果归并的模式,分别是: +但是从执行效率的角度看,为每个分片查询维持一个独立的数据库连接,可以更加有效地利用多线程来提升执行效率。为每个数据库连接开启独立的线程,可以并行化IO所产生的消耗。独立的数据库连接,能够保持查询结果集的引用以及游标位置,在需要获取相应数据时移动游标即可,避免了过早将查询结果数据加载至内存。这就涉及到了结果归并模式的选择问题。通过上一篇文章《剖析 Sharding-Sphere 系列——结果归并》介绍,我们知道当前有两种结果归并的模式,分别是: 流式归并:以结果集游标下移进行结果归并的方式,称之为流式归并,它无需将结果数据全数加载至内存,可以有效地节省内存资源,进而减少垃圾回收的频次。 @@ -40,40 +40,40 @@ A: 在概念介绍部分,我们介绍了主角-自动化执行引擎。也谈 相信只要是智商在线的朋友,一定会选择流式归并来处理结果集。可是,如果无法保证每个分片查询持有一个独立数据库连接的话,那么就需要在复用该数据库连接、获取下一张分表的查询结果集之前,将当前的查询结果集全数加载至内存。因此,即使可以采用流式归并,在此场景下也不得不退化为内存归并。 -一方面是对数据库连接资源的控制保护,一方面是采用更优的归并模式达到内存资源节省的目的,如何处理好两者之间的关系,是Sharding-Sphere执行引擎需求解决的问题。具体来说,如果一条SQL在经过Sharding-Sphere的分片后,需要操作某数据库实例下的200张表,那么,是选择创建200个连接并行执行,还是选择创建一个连接串行执行呢?效率与资源控制又应该如何抉择呢? +一方面是对数据库连接资源的控制保护,一方面是采用更优的归并模式达到内存资源节省的目的,如何处理好两者之间的关系,是 Sharding-Sphere执行引擎需求解决的问题。具体来说,如果一条 SQL 在经过 Sharding-Sphere 的分片后,需要操作某数据库实例下的 200 张表,那么,是选择创建 200 个连接并行执行,还是选择创建一个连接串行执行呢?效率与资源控制又应该如何抉择呢? ### 进化论 -针对上述的场景,Sharding-Sphere在3.0.0.M4之前提供了一种解决思路,即提出了连接模式(Connection Mode)的概念,并划分了两种模式:内存限制模式(MEMORY\_STRICTLY)和连接限制模式(CONNECTION\_STRICTLY)这两种类型。 +针对上述的场景,Sharding-Sphere 在3.0.0.M4之前提供了一种解决思路,即提出了连接模式(Connection Mode)的概念,并划分了两种模式:内存限制模式(MEMORY\_STRICTLY)和连接限制模式(CONNECTION\_STRICTLY)这两种类型。 - 内存限制模式。使用此模式的前提是数据库对其一次操作所耗费的连接数量不做限制。如果实际执行的SQL需要对某数据库实例中的200张表做操作,则对每张表创建一个新的数据库连接,并通过多线程的方式并发处理,以达成执行效率最大化。并且在SQL满足条件情况下,优先选择流式归并,以防止出现内存溢出或避免频繁垃圾回收情况。 -- 连接限制模式。使用此模式的前提是数据库严格控制对其一次操作所耗费的连接数量。如果实际执行的SQL需要对某数据库实例中的200张表做操作,那么只会创建唯一的数据库连接,并对其200张表串行处理。如果分片在不同的数据库,仍然是多线程处理不同库,但每个库的每次操作仍然只创建一个唯一的数据库连接。这样即可以防止对一次请求对数据库连接占用过多所带来的问题。该模式始终选择内存归并。 +- 连接限制模式。使用此模式的前提是数据库严格控制对其一次操作所耗费的连接数量。如果实际执行的 SQL 需要对某数据库实例中的200张表做操作,那么只会创建唯一的数据库连接,并对其 200 张表串行处理。如果分片在不同的数据库,仍然是多线程处理不同库,但每个库的每次操作仍然只创建一个唯一的数据库连接。这样即可以防止对一次请求对数据库连接占用过多所带来的问题。该模式始终选择内存归并。 -内存限制模式适用于OLAP操作,可以通过放宽对数据库连接的限制提升系统吞吐量;连接限制模式适用于OLTP操作,OLTP通常带有分片键,会路由到单一的分片,因此严格控制数据库连接,以保证在线系统数据库资源能够被更多的应用所使用,是明智的选择。 +内存限制模式适用于 OLAP 操作,可以通过放宽对数据库连接的限制提升系统吞吐量;连接限制模式适用于 OLTP 操作,OLTP 通常带有分片键,会路由到单一的分片,因此严格控制数据库连接,以保证在线系统数据库资源能够被更多的应用所使用,是明智的选择。 -而Sharding-Sphere最终使用何种模式的决定权就交由用户。Sharding-Sphere提供对连接模式的配置,让开发者依据自己业务的实际场景需求选择使用内存限制模式或连接限制模式。 +而 Sharding-Sphere 最终使用何种模式的决定权就交由用户。Sharding-Sphere 提供对连接模式的配置,让开发者依据自己业务的实际场景需求选择使用内存限制模式或连接限制模式。 -可是,将两难的选择的决定权甩锅给用户,使得用户必须要了解这两种模式的利弊,并依据业务场景需求进行选择。这显然增加了用户对Sharding-Sphere的学习和使用的成本,这并不是一种最优的解决方案。 +可是,将两难的选择的决定权甩锅给用户,使得用户必须要了解这两种模式的利弊,并依据业务场景需求进行选择。这显然增加了用户对Sharding-Sphere 的学习和使用的成本,这并不是一种最优的解决方案。 -此外,这种一分为二的处理方案,将两种模式的切换交由静态的初始化配置,缺乏灵活应性。在实际的使用场景中,面对不同SQL以及占位符参数,每次的路由结果是不同的。这就意味着某些操作可能需要使用内存归并,而某些操作则可能选择流式归并更优,它们不应该由用户在Sharding-Sphere启动之前配置好,而更应该根据SQL和占位符参数的场景,来动态的决定连接模式。 +此外,这种一分为二的处理方案,将两种模式的切换交由静态的初始化配置,缺乏灵活应性。在实际的使用场景中,面对不同 SQL 以及占位符参数,每次的路由结果是不同的。这就意味着某些操作可能需要使用内存归并,而某些操作则可能选择流式归并更优,它们不应该由用户在Sharding-Sphere 启动之前配置好,而更应该根据SQL和占位符参数的场景,来动态的决定连接模式。 -像Sharding-Sphere这样,总是站在用户角度考虑问题并且不断优化精进的七道杠青年是一定要进行相关优化调整的,于是自动化执行引擎就进化出来了。 +像 Sharding-Sphere 这样,总是站在用户角度考虑问题并且不断优化精进的七道杠青年是一定要进行相关优化调整的,于是自动化执行引擎就进化出来了。 -为了降低用户的使用成本以及连接模式动态化这两个问题,Sharding-Sphere提炼出自动化执行引擎的思路,在其内部消化了连接模式的概念。用户无需了解所谓的内存限制模式和连接限制模式是什么,而是交由执行引擎根据当前场景自动选择最优的执行方案。 +为了降低用户的使用成本以及连接模式动态化这两个问题,Sharding-Sphere 提炼出自动化执行引擎的思路,在其内部消化了连接模式的概念。用户无需了解所谓的内存限制模式和连接限制模式是什么,而是交由执行引擎根据当前场景自动选择最优的执行方案。 -同时,自动化执行引擎将连接模式的选择粒度细化至每一次SQL的操作。针对每次SQL请求,自动化执行引擎都将根据其路由结果,进行实时的演算和权衡,并自主地采用恰当的连接模式执行,以达到资源控制和效率的最优平衡。针对自动化的执行引擎,用户只需配置maxConnectionSizePerQuery即可,该参数表示一次查询时每个数据库所允许使用的最大连接数,剩余的处理逻辑将由自动化执行引擎为您负责。 +同时,自动化执行引擎将连接模式的选择粒度细化至每一次 SQL 的操作。针对每次 SQL 请求,自动化执行引擎都将根据其路由结果,进行实时的演算和权衡,并自主地采用恰当的连接模式执行,以达到资源控制和效率的最优平衡。针对自动化的执行引擎,用户只需配置maxConnectionSizePerQuery 即可,该参数表示一次查询时每个数据库所允许使用的最大连接数,剩余的处理逻辑将由自动化执行引擎为您负责。 ### 实现解析 @@ -97,17 +97,17 @@ A: 在概念介绍部分,我们介绍了主角-自动化执行引擎。也谈 a. 结果集分组 -该步骤是实现内化连接模式概念的关键。执行引擎根据maxConnectionSizePerQuery配置项,结合当前路由结果,自动选择恰当的连接模式。具体步骤如下: +该步骤是实现内化连接模式概念的关键。执行引擎根据 maxConnectionSizePerQuery 配置项,结合当前路由结果,自动选择恰当的连接模式。具体步骤如下: - 将SQL的路由结果按照数据库的名称进行分组。 -- 通过下图的公式获得每个数据库实例在maxConnectionSizePerQuery的允许范围内,每个数据库连接需要执行的SQL路由结果组,并演算出本次请求最优的连接模式。 +- 通过下图的公式获得每个数据库实例在 maxConnectionSizePerQuery 的允许范围内,每个数据库连接需要执行的SQL路由结果组,并演算出本次请求最优的连接模式。 ![](https://shardingsphere.apache.org/blog/img/engine3.jpg) -在maxConnectionSizePerQuery允许的范围内,当一个连接需要执行的请求数量大于1时,意味着当前的数据库连接无法持有相应的数据结果集,则必须采用内存归并;反之,当一个连接需要执行的请求数量等于1时,意味着当前的数据库连接可以持有相应的数据结果集,则可以采用流式归并。 +在 maxConnectionSizePerQuery 允许的范围内,当一个连接需要执行的请求数量大于1时,意味着当前的数据库连接无法持有相应的数据结果集,则必须采用内存归并;反之,当一个连接需要执行的请求数量等于1时,意味着当前的数据库连接可以持有相应的数据结果集,则可以采用流式归并。 @@ -125,11 +125,11 @@ A: 在概念介绍部分,我们介绍了主角-自动化执行引擎。也谈 -举个栗子,假设一次查询需要在某一数据库上获取2个数据库连接,用于路由至一库的2个分表查询。有可能出现查询A已获取到该数据库的1个数据库连接,并等待获取另一个数据库连接;而查询B则也已经获得了该数据库上的1个数据库连接,并同样等待另一个数据库连接的获取。如果数据库连接池的允许最大连接数是2,那么这2个查询请求将永远孤独地等待着彼此,图绘版的解释可能会更便于大家理解: +举个栗子,假设一次查询需要在某一数据库上获取 2 个数据库连接,用于路由至一库的 2 个分表查询。有可能出现查询 A 已获取到该数据库的1个数据库连接,并等待获取另一个数据库连接;而查询B则也已经获得了该数据库上的 1 个数据库连接,并同样等待另一个数据库连接的获取。如果数据库连接池的允许最大连接数是 2 ,那么这 2 个查询请求将永远孤独地等待着彼此,图绘版的解释可能会更便于大家理解: ![](https://shardingsphere.apache.org/blog/img/engine4.jpg) -为了避免死锁的出现,Sharding-Sphere在获取数据库连接时进行了同步处理。它在创建执行单元时,以原子性的方式一次性获取本次SQL请求所需的全部数据库连接,杜绝了每次查询请求获取到部分资源的可能。这种加锁做法确实可以解决死锁问题,只是,同时会带来一定程度并发性能的损失。为了展示我们不一样!有啥不一样呢? +为了避免死锁的出现,Sharding-Sphere 在获取数据库连接时进行了同步处理。它在创建执行单元时,以原子性的方式一次性获取本次 SQL 请求所需的全部数据库连接,杜绝了每次查询请求获取到部分资源的可能。这种加锁做法确实可以解决死锁问题,只是,同时会带来一定程度并发性能的损失。为了展示我们不一样!有啥不一样呢? 我们针对此问题还进行了以下两方面优化: @@ -145,15 +145,15 @@ A: 在概念介绍部分,我们介绍了主角-自动化执行引擎。也谈 -该阶段用于真正的执行SQL,它分为分组执行和归并结果集生成两个步骤。 +该阶段用于真正的执行 SQL ,它分为分组执行和归并结果集生成两个步骤。 a. 分组执行 -该步骤将准备执行阶段生成的执行单元分组下发至底层并发执行引擎,并针对执行过程中的每个关键步骤发送事件。如:执行开始事件、执行成功事件以及执行失败事件。执行引擎仅关注事件的发送,它并不关心事件的订阅者。Sharding-Sphere的其他模块,如:分布式事务、调用链路追踪等,会订阅感兴趣的事件,并进行相应的处理。 +该步骤将准备执行阶段生成的执行单元分组下发至底层并发执行引擎,并针对执行过程中的每个关键步骤发送事件。如:执行开始事件、执行成功事件以及执行失败事件。执行引擎仅关注事件的发送,它并不关心事件的订阅者。Sharding-Sphere 的其他模块,如:分布式事务、调用链路追踪等,会订阅感兴趣的事件,并进行相应的处理。 b. 归并结果集生成 -Sharding-Sphere通过在执行准备阶段的获取的连接模式,生成内存归并结果集或流式归并结果集,并将其传递至结果归并引擎,以进行下一步的工作。内存归并结果集或流式归并结果集的核心区别是:流式归并结果集会通过游标方式获取结果集的数据,而内存归并结果集则是从内存里获取数据。这也是内存归并和流式归并的数据基础。 +Sharding-Sphere 通过在执行准备阶段的获取的连接模式,生成内存归并结果集或流式归并结果集,并将其传递至结果归并引擎,以进行下一步的工作。内存归并结果集或流式归并结果集的核心区别是:流式归并结果集会通过游标方式获取结果集的数据,而内存归并结果集则是从内存里获取数据。这也是内存归并和流式归并的数据基础。 @@ -161,7 +161,7 @@ Sharding-Sphere通过在执行准备阶段的获取的连接模式,生成内 -看官一杯茶的时间,是妹子我反复修改数次的结果。妹子无法被打赏,只愿正在阅读的你能有所收获,这也是我们coding、writing的意义所在。以后还会有「剖析Sharding-Sphere系列文章」其他文章与大家见面,敬请关注~ +看官一杯茶的时间,是妹子我反复修改数次的结果。妹子无法被打赏,只愿正在阅读的你能有所收获,这也是我们 coding、writing 的意义所在。以后还会有「剖析 Sharding-Sphere 系列文章」其他文章与大家见面,敬请关注~ diff --git a/docs/blog/content/material/proxyIntroduce.cn.md b/docs/blog/content/material/proxyIntroduce.cn.md index 66d39bd93a5fd..0c582e187ff8d 100644 --- a/docs/blog/content/material/proxyIntroduce.cn.md +++ b/docs/blog/content/material/proxyIntroduce.cn.md @@ -121,7 +121,6 @@ rules: # 认证信息 defaultType: XA providerType: Atomikos - !SQL_PARSER - sqlCommentParseEnabled: true sqlStatementCache: initialCapacity: 2000 maximumSize: 65535 diff --git a/docs/blog/content/material/realization.cn.md b/docs/blog/content/material/realization.cn.md index 1fe659cb14a71..d93f4e7bd3ae4 100644 --- a/docs/blog/content/material/realization.cn.md +++ b/docs/blog/content/material/realization.cn.md @@ -12,15 +12,15 @@ chapter = true 高级Java开发工程师 -- 多年互联网开发经验,热爱开源技术,对分布式存储有浓厚的兴趣。熟悉ElasticSearch、HBase、Presto、Storm等离线和实时数据处理 +- 多年互联网开发经验,热爱开源技术,对分布式存储有浓厚的兴趣。熟悉 ElasticSearch、HBase、Presto、Storm 等离线和实时数据处理 -- 目前主要在Sharding-Sphere团队负责分布式事务的开发 +- 目前主要在 Sharding-Sphere 团队负责分布式事务的开发 ### 分布式事务的使用场景 #### ACID -一切从ACID开始说起。ACID是本地事务所具有的四大特征: +一切从 ACID 开始说起。ACID 是本地事务所具有的四大特征: * **Atomicity:原子性** @@ -41,17 +41,17 @@ chapter = true 关系型数据库的本地事务完美的提供了对ACID的原生支持。但在分布式的场景下,它却成为系统性能的桎梏。如何让数据库在分布式场景下满足ACID的特性或找寻相应的替代方案,是本文将要阐述的话题。 -#### CAP和Base理论 +#### CAP 和 Base 理论 对于互联网应用而言,随着访问量和数据量的激增,传统的单体架构模式将无法满足业务的高速发展。这时,开发者需要把单体应用拆分为多个独立的小应用,把单个数据库按照分片规则拆分为多个库和多个表。 -数据拆分后,如何在多个数据库节点间保证本地事务的ACID特性则成为一个技术难题,并且由此而衍生出了CAP和BASE经典理论。 +数据拆分后,如何在多个数据库节点间保证本地事务的ACID特性则成为一个技术难题,并且由此而衍生出了 CAP 和 BASE 经典理论。 -CAP理论指出,对于分布式的应用而言,不可能同时满足C(一致性),A(可用性),P(分区容错性),由于网络分区是分布式应用的基本要素,因此开发者需要在C和A上做出平衡。 +CAP 理论指出,对于分布式的应用而言,不可能同时满足C(一致性),A(可用性),P(分区容错性),由于网络分区是分布式应用的基本要素,因此开发者需要在C和A上做出平衡。 -由于C和A互斥性,其权衡的结果就是BASE理论。 +由于 C 和 A 互斥性,其权衡的结果就是 BASE 理论。 -对于大部分的分布式应用而言,只要数据在规定的时间内达到最终一致性即可。我们可以把符合传统的ACID叫做刚性事务,把满足BASE理论的最终一致性事务叫做柔性事务。 +对于大部分的分布式应用而言,只要数据在规定的时间内达到最终一致性即可。我们可以把符合传统的 ACID 叫做刚性事务,把满足 BASE 理论的最终一致性事务叫做柔性事务。 一味的追求强一致性,并非最佳方案。对于分布式应用来说,刚柔并济是更加合理的设计方案,即在本地服务中采用强一致事务,在跨系统调用中采用最终一致性。如何权衡系统的性能与一致性,是十分考验架构师与开发者的设计功力的。 @@ -63,42 +63,42 @@ CAP理论指出,对于分布式的应用而言,不可能同时满足C(一 #### XA -XA是X/Open CAE Specification (Distributed Transaction Processing)模型中定义的TM(Transaction Manager)与RM(Resource Manager)之间进行通信的接口。 +XA 是 X/Open CAE Specification (Distributed Transaction Processing)模型中定义的 TM(Transaction Manager)与RM(Resource Manager)之间进行通信的接口。 -Java中的javax.transaction.xa.XAResource定义了XA接口,它依赖数据库厂商对jdbc-driver的具体实现。 +Java 中的 javax.transaction.xa.XAResource 定义了 XA 接口,它依赖数据库厂商对 jdbc-driver 的具体实现。 mysql-connector-java-5.1.30的实现可参考: com.mysql.jdbc.jdbc2.optional.MysqlXAConnection。 -在XA规范中,数据库充当RM角色,应用需要充当TM的角色,即生成全局的txId,调用XAResource接口,把多个本地事务协调为全局统一的分布式事务。 +在 XA 规范中,数据库充当 RM 角色,应用需要充当 TM 的角色,即生成全局的 txId,调用 XAResource 接口,把多个本地事务协调为全局统一的分布式事务。 **一阶段提交:弱XA** ![](https://shardingsphere.apache.org/blog/img/realization2.jpg) -弱XA通过去掉XA的Prepare阶段,以达到减少资源锁定范围而提升并发性能的效果。典型的实现为在一个业务线程中,遍历所有的数据库连接,依次做commit或者rollback。弱XA同本地事务相比,性能损耗低,但在事务提交的执行过程中,若出现网络故障、数据库宕机等预期之外的异常,将会造成数据不一致,且无法进行回滚。基于弱XA的事务无需额外的实现成本,因此Sharding-Sphere默认支持。 +弱 XA 通过去掉 XA 的 Prepare 阶段,以达到减少资源锁定范围而提升并发性能的效果。典型的实现为在一个业务线程中,遍历所有的数据库连接,依次做 commit 或者 rollback。弱XA同本地事务相比,性能损耗低,但在事务提交的执行过程中,若出现网络故障、数据库宕机等预期之外的异常,将会造成数据不一致,且无法进行回滚。基于弱XA的事务无需额外的实现成本,因此 Sharding-Sphere 默认支持。 **二阶段提交:2PC** ![](https://shardingsphere.apache.org/blog/img/realization3.jpg) -二阶段提交是XA的标准实现。它将分布式事务的提交拆分为2个阶段:prepare和commit/rollback。 +二阶段提交是 XA 的标准实现。它将分布式事务的提交拆分为 2 个阶段:prepare 和 commit/rollback。 -开启XA全局事务后,所有子事务会按照本地默认的隔离级别锁定资源,并记录undo和redo日志,然后由TM发起prepare投票,询问所有的子事务是否可以进行提交:当所有子事务反馈的结果为“yes”时,TM再发起commit;若其中任何一个子事务反馈的结果为“no”,TM则发起rollback;如果在prepare阶段的反馈结果为yes,而commit的过程中出现宕机等异常时,则在节点服务重启后,可根据XA recover再次进行commit补偿,以保证数据的一致性。 +开启XA全局事务后,所有子事务会按照本地默认的隔离级别锁定资源,并记录 undo 和 redo 日志,然后由 TM 发起 prepare 投票,询问所有的子事务是否可以进行提交:当所有子事务反馈的结果为“yes”时,TM 再发起 commit;若其中任何一个子事务反馈的结果为“no”,TM 则发起 rollback;如果在 prepare 阶段的反馈结果为 yes,而 commit 的过程中出现宕机等异常时,则在节点服务重启后,可根据 XA recover 再次进行 commit 补偿,以保证数据的一致性。 -2PC模型中,在prepare阶段需要等待所有参与子事务的反馈,因此可能造成数据库资源锁定时间过长,不适合并发高以及子事务生命周长较长的业务场景。 +2PC模型中,在 prepare 阶段需要等待所有参与子事务的反馈,因此可能造成数据库资源锁定时间过长,不适合并发高以及子事务生命周长较长的业务场景。 -Sharding-Sphere支持基于XA的强一致性事务解决方案,可以通过SPI注入不同的第三方组件作为事务管理器实现XA协议,如Atomikos和Narayana。 +Sharding-Sphere 支持基于 XA 的强一致性事务解决方案,可以通过 SPI 注入不同的第三方组件作为事务管理器实现 XA 协议,如 Atomikos 和 Narayana。 #### 柔性事务 -柔性事务是对XA协议的妥协和补偿,它通过对强一致性要求的降低,已达到降低数据库资源锁定时间的效果。柔性事务的种类很多,可以通过各种不同的策略来权衡使用。 +柔性事务是对 XA 协议的妥协和补偿,它通过对强一致性要求的降低,已达到降低数据库资源锁定时间的效果。柔性事务的种类很多,可以通过各种不同的策略来权衡使用。 **一阶段提交 + 补偿 :最大努力送达(BED)** -最大努力送达,是针对于弱XA的一种补偿策略。它采用事务表记录所有的事务操作SQL,如果子事务提交成功,将会删除事务日志;如果执行失败,则会按照配置的重试次数,尝试再次提交,即最大努力的进行提交,尽量保证数据的一致性,这里可以根据不同的业务场景,平衡C和A,采用同步重试或异步重试。 +最大努力送达,是针对于弱 XA 的一种补偿策略。它采用事务表记录所有的事务操作 SQL,如果子事务提交成功,将会删除事务日志;如果执行失败,则会按照配置的重试次数,尝试再次提交,即最大努力的进行提交,尽量保证数据的一致性,这里可以根据不同的业务场景,平衡 C 和 A ,采用同步重试或异步重试。 -这种策略的优点是无锁定资源时间,性能损耗小。缺点是尝试多次提交失败后,无法回滚,它仅适用于事务最终一定能够成功的业务场景。因此BED是通过事务回滚功能上的妥协,来换取性能的提升。 +这种策略的优点是无锁定资源时间,性能损耗小。缺点是尝试多次提交失败后,无法回滚,它仅适用于事务最终一定能够成功的业务场景。因此 BED 是通过事务回滚功能上的妥协,来换取性能的提升。 ![](https://shardingsphere.apache.org/blog/img/realization4.jpg) @@ -120,26 +120,26 @@ TCC模型是把锁的粒度完全交给业务处理,它需要每个子事务 真正执行业务,不作任何业务检查; - 只使用Try阶段预留的业务资源; + 只使用 Try 阶段预留的业务资源; - Confirm操作满足幂等性; + Confirm 操作满足幂等性; * **Cancel:** 取消执行业务; - 释放Try阶段预留的业务资源; + 释放 Try 阶段预留的业务资源; - Cancel操作满足幂等性。 + Cancel 操作满足幂等性。 -这三个阶段都会按本地事务的方式执行,不同于XA的prepare,TCC无需将XA的投票期间的所有资源挂起,因此极大的提高了吞吐量。 +这三个阶段都会按本地事务的方式执行,不同于 XA 的 prepare,TCC无需将XA的投票期间的所有资源挂起,因此极大的提高了吞吐量。 -下面对TCC模式下,A账户往B账户汇款100元为例子,对业务的改造进行详细的分析: +下面对 TCC 模式下,A 账户往 B 账户汇款 100 元为例子,对业务的改造进行详细的分析: ![](https://shardingsphere.apache.org/blog/img/realization5.jpg) -汇款服务和收款服务分别需要实现,Try-Confirm-Cancel接口,并在业务初始化阶段将其注入到TCC事务管理器中。 +汇款服务和收款服务分别需要实现,Try-Confirm-Cancel 接口,并在业务初始化阶段将其注入到 TCC 事务管理器中。 汇款服务 @@ -149,9 +149,9 @@ TCC模型是把锁的粒度完全交给业务处理,它需要每个子事务 检查A账户余额是否充足; - 从A账户中扣减100元,并将状态置为“转账中”; + 从A账户中扣减 100 元,并将状态置为“转账中”; - 预留扣减资源,将从A往B账户转账100元这个事件存入消息或者日志中; + 预留扣减资源,将从A往B账户转账 100 元这个事件存入消息或者日志中; * **Confirm:** @@ -159,7 +159,7 @@ TCC模型是把锁的粒度完全交给业务处理,它需要每个子事务 * **Cancel:** - A账户增加100元; + A账户增加 100 元; 从日志或者消息中,释放扣减资源。 @@ -172,7 +172,7 @@ TCC模型是把锁的粒度完全交给业务处理,它需要每个子事务 * **Confirm**: - 读取日志或者消息,B账户增加100元; + 读取日志或者消息,B 账户增加 100 元; 从日志或者消息中,释放扣减资源; @@ -181,17 +181,17 @@ TCC模型是把锁的粒度完全交给业务处理,它需要每个子事务 不做任何操作。 -由此可以看出,TCC模型对业务的侵入强,改造的难度大。 +由此可以看出,TCC 模型对业务的侵入强,改造的难度大。 **消息驱动** ![](https://shardingsphere.apache.org/blog/img/realization6.jpg) -消息一致性方案是通过消息中间件保证上下游应用数据操作的一致性。基本思路是将本地操作和发送消息放在一个事务中,下游应用向消息系统订阅该消息,收到消息后执行相应操作。本质上是依靠消息的重试机制,达到最终一致性。消息驱动的缺点是:耦合度高,需要在业务系统中引入MQ,导致系统复杂度增加。 +消息一致性方案是通过消息中间件保证上下游应用数据操作的一致性。基本思路是将本地操作和发送消息放在一个事务中,下游应用向消息系统订阅该消息,收到消息后执行相应操作。本质上是依靠消息的重试机制,达到最终一致性。消息驱动的缺点是:耦合度高,需要在业务系统中引入 MQ,导致系统复杂度增加。 **SAGA** -Saga起源于1987年Hector & Kenneth发表的论文Sagas。 +Saga 起源于 1987 年 Hector & Kenneth 发表的论文 Sagas。 参考地址: @@ -199,9 +199,9 @@ https://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf Saga工作原理 -Saga模型把一个分布式事务拆分为多个本地事务,每个本地事务都有相应的执行模块和补偿模块( TCC中的Confirm和Cancel)。当Saga事务中任意一个本地事务出错时,可以通过调用相关的补偿方法恢复之前的事务,达到事务最终的一致性。 +Saga 模型把一个分布式事务拆分为多个本地事务,每个本地事务都有相应的执行模块和补偿模块( TCC 中的 Confirm 和 Cancel)。当 Saga 事务中任意一个本地事务出错时,可以通过调用相关的补偿方法恢复之前的事务,达到事务最终的一致性。 -当每个Saga子事务 T1, T2, …, Tn 都有对应的补偿定义 C1, C2, …, Cn-1,那么Saga系统可以保证: +当每个 Saga 子事务 T1, T2, …, Tn 都有对应的补偿定义 C1, C2, …, Cn-1,那么 Saga 系统可以保证: * 子事务序列 T1, T2, …, Tn得以完成 (最佳情况); @@ -215,9 +215,9 @@ Saga模型把一个分布式事务拆分为多个本地事务,每个本地事 * 应用层面预先冻结资源。 -Saga恢复方式 +Saga 恢复方式 -Saga支持向前和向后恢复: +Saga 支持向前和向后恢复: * 向后恢复:补偿所有已完成的事务,如果任一子事务失败; @@ -226,60 +226,60 @@ Saga支持向前和向后恢复: 显然,向前恢复没有必要提供补偿事务,如果你的业务中,子事务(最终)总会成功,或补偿事务难以定义或不可能,向前恢复更符合你的需求。理论上补偿事务永不失败,然而,在分布式世界中,服务器可能会宕机、网络可能会失败,甚至数据中心也可能会停电,这时需要提供故障恢复后回退的机制,比如人工干预。 -总的来说,TCC和MQ都是以服务为范围进行分布式事务的处理,而XA、BED、SAGA则是以数据库为范围进行分布式处理,我们更趋向于选择后者,对于业务而言侵入小,改造的成本低。 +总的来说,TCC 和 MQ 都是以服务为范围进行分布式事务的处理,而XA、BED、SAGA则是以数据库为范围进行分布式处理,我们更趋向于选择后者,对于业务而言侵入小,改造的成本低。 -### Sharding-Sphere对分布式事务的支持 +### Sharding-Sphere 对分布式事务的支持 -Sharding-Sphere是一套开源的分布式数据库中间件解决方案组成的生态圈,它由Sharding-JDBC、Sharding-Proxy和Sharding-Sidecar这3款相互独立的产品组成。它们均提供标准化的数据水平扩展、分布式事务和分布式治理等功能,可适用于如Java同构、异构语言、容器、云原生等各种多样化的应用场景。 +Sharding-Sphere 是一套开源的分布式数据库中间件解决方案组成的生态圈,它由 Sharding-JDBC、Sharding-Proxy 和 Sharding-Sidecar 这3款相互独立的产品组成。它们均提供标准化的数据水平扩展、分布式事务和分布式治理等功能,可适用于如 Java 同构、异构语言、容器、云原生等各种多样化的应用场景。 项目地址: https://github.com/sharding-sphere/sharding-sphere/ -Sharding-Sphere同时支持XA和柔性事务,它允许每次对数据库的访问,可以自由选择事务类型。分布式事务对业务操作完全透明,极大地降低了引入分布式事务的成本。 +Sharding-Sphere 同时支持 XA 和柔性事务,它允许每次对数据库的访问,可以自由选择事务类型。分布式事务对业务操作完全透明,极大地降低了引入分布式事务的成本。 #### 事务模型 ![](https://shardingsphere.apache.org/blog/img/realization7.jpg) -Sharding-Sphere事务管理器集成了XA和柔性事务模型: +Sharding-Sphere 事务管理器集成了XA和柔性事务模型: -- 对于XA事务而言,采用SPI的方式让弱XA、Atomikos、Narayana间保持互斥; +- 对于 XA 事务而言,采用 SPI 的方式让弱 XA、Atomikos、Narayana 间保持互斥; -- 对于柔性事务而言,根据每次连接中事务的类型,可以选择独立的事务管理器进行处理,每个事务管理器都会实现标准的ShardingTransaction接口,在TransactionEvent到来时,执行对应的begin、commit、rollback操作。 +- 对于柔性事务而言,根据每次连接中事务的类型,可以选择独立的事务管理器进行处理,每个事务管理器都会实现标准的 ShardingTransaction 接口,在 TransactionEvent 到来时,执行对应的 begin、commit、rollback 操作。 -下面将Sharding-Sphere内部如何用事件驱动方式,将事务从分片主流程中解耦进行详细说明: +下面将 Sharding-Sphere 内部如何用事件驱动方式,将事务从分片主流程中解耦进行详细说明: ![](https://shardingsphere.apache.org/blog/img/realization8.jpg) -从图可以看出在Sharding-core在调用执行引擎时,会根据SQL的种类产生事件进行分发。事务监听线程在收到符合要求的事件后,再调用对应的事务处理器进行处理。 +从图可以看出在 Sharding-core 在调用执行引擎时,会根据SQL的种类产生事件进行分发。事务监听线程在收到符合要求的事件后,再调用对应的事务处理器进行处理。 #### Sharding-Proxy事务实现 -Sharding-Proxy是基于netty开发的数据库中间代理层,实现了标准的MySQL协议,可以看做是一个实现了数据分片的数据库。Sharding-Proxy已经实现了基于Atomikos的XA事务,为了保证所有的子事务都处于同一个线程之中,整个Proxy的线程模型进行了如下的调整: +Sharding-Proxy 是基于 netty 开发的数据库中间代理层,实现了标准的 MySQL 协议,可以看做是一个实现了数据分片的数据库。Sharding-Proxy 已经实现了基于 Atomikos 的 XA 事务,为了保证所有的子事务都处于同一个线程之中,整个 Proxy 的线程模型进行了如下的调整: ![](https://shardingsphere.apache.org/blog/img/realization9.jpg) -当开启事务后,Proxy后端的SQL命令执行引擎将采用一通道一线程的模式,此事务线程的生命周期同通道保持一致。事务处理的具体过程与Proxy彻底解耦,即Proxy将发布事务类型的事件,然后Sharding-Sphere-TM根据传入的事务消息,选择具体的TM进行处理。 +当开启事务后,Proxy 后端的 SQL 命令执行引擎将采用一通道一线程的模式,此事务线程的生命周期同通道保持一致。事务处理的具体过程与 Proxy 彻底解耦,即 Proxy 将发布事务类型的事件,然后 Sharding-Sphere-TM 根据传入的事务消息,选择具体的 TM 进行处理。 -压测结果表明:XA事务的插入和更新的性能,基本上同跨库的个数呈线性关系,查询的性能基本不受影响,建议在并发量不大,每次事务涉及的库在10个以内时,可以使用XA。 +压测结果表明:XA 事务的插入和更新的性能,基本上同跨库的个数呈线性关系,查询的性能基本不受影响,建议在并发量不大,每次事务涉及的库在 10 个以内时,可以使用 XA。 ![](https://shardingsphere.apache.org/blog/img/realization10.jpg) -Atomikos事务管理器原理分析 +Atomikos 事务管理器原理分析 ![](https://shardingsphere.apache.org/blog/img/realization11.jpg) -Atomikos的事务管理器可以内嵌到业务进程中,当应用调用TransactionManager.begin时,将会创建本次XA事务,并且与当前线程关联。同时Atomikos也对DataSource中的connection做了二次封装,代理connection中含有本次事务相关信息的状态,并且拦截了connection的JDBC操作。 +Atomikos 的事务管理器可以内嵌到业务进程中,当应用调用 TransactionManager.begin 时,将会创建本次 XA 事务,并且与当前线程关联。同时 Atomikos 也对 DataSource 中的 connection 做了二次封装,代理 connection 中含有本次事务相关信息的状态,并且拦截了 connection 的 JDBC 操作。 -在createStatement时,调用XAResource.start进行资源注册;在close时,调用XAResource.end让XA事务处于idle可提交状态;在commit或rollback时,依次调用prepare和commit进行二阶段提交。 +在 createStatement 时,调用 XAResource.start 进行资源注册;在 close 时,调用 XAResource.end 让 XA 事务处于 idle 可提交状态;在 commit 或 rollback 时,依次调用 prepare 和 commit 进行二阶段提交。 -**Sharding-Sphere的Saga事务实现** +**Sharding-Sphere 的 Saga 事务实现** -Sharding-Sphere通过与Apache Service Comb的合作,将采用Service Comb的Saga事务引擎作为的分布式事务实现。 +Sharding-Sphere 通过与 Apache Service Comb 的合作,将采用 Service Comb 的 Saga 事务引擎作为的分布式事务实现。 -Apache Service Comb是华为开源的微服务框架,其中微服务事务处理框架分为集中式和分布式协调器。未来会在Sharding-Sphere内部集成Saga集中式协调器,支持同一线程内不同服务(本地)间的分布式事务。 +Apache Service Comb 是华为开源的微服务框架,其中微服务事务处理框架分为集中式和分布式协调器。未来会在 Sharding-Sphere 内部集成 Saga 集中式协调器,支持同一线程内不同服务(本地)间的分布式事务。 参考链接: @@ -289,31 +289,31 @@ Service Comb 集中式事务协调器 ![](https://shardingsphere.apache.org/blog/img/realization12.jpg) -集中式的协调器,包含了Saga调用请求接收、分析、执行以及结果查询的内容。任务代理模块需要预先知道Saga事务调用关系图,执行模块根据生成的调用图产生调用任务,调用相关微服务服务接口。如果服务调用执行出错,会调用服务的相关的补偿方法回滚。 +集中式的协调器,包含了 Saga 调用请求接收、分析、执行以及结果查询的内容。任务代理模块需要预先知道 Saga 事务调用关系图,执行模块根据生成的调用图产生调用任务,调用相关微服务服务接口。如果服务调用执行出错,会调用服务的相关的补偿方法回滚。 -Saga执行模块通过分析请求的JSON数据,来构建一个调用关系图。Sharding-Sphere是通过JSON描述Saga事务串行调用子事务或者并行调用子事务。关系调用图被Saga实现中的任务运行模块分解成为一个一个执行任务,执行任务由任务消费者获取并生成相关的调用 (同时支持串行和并行调用)。Saga任务会根据执行的情况向Saga Log中记录对应的Saga事务的关键事件,并可以通过事件查看器查查询执行情况。 +Saga 执行模块通过分析请求的 JSON 数据,来构建一个调用关系图。Sharding-Sphere 是通过 JSON 描述 Saga 事务串行调用子事务或者并行调用子事务。关系调用图被 Saga 实现中的任务运行模块分解成为一个一个执行任务,执行任务由任务消费者获取并生成相关的调用 (同时支持串行和并行调用)。Saga 任务会根据执行的情况向 Saga Log 中记录对应的 Saga 事务的关键事件,并可以通过事件查看器查查询执行情况。 -Sharding-Sphere内嵌Saga事务管理器 +Sharding-Sphere 内嵌 Saga 事务管理器 ![](https://shardingsphere.apache.org/blog/img/realization13.jpg) -Saga以jar包的形式提供分布式事务治理能力。 +Saga 以 jar 包的形式提供分布式事务治理能力。 -对Sharding-Sphere而言,confirm和cancel过程代表了子事务中的正常执行SQL和逆向执行SQL,(未来Sharding-Sphere将提供自动生成逆向SQL的能力)。当启用Saga柔性事务后,路由完成之后的物理数据源将开启本地自动提交事务,每次confirm和cancel都会直接提交。 +对 Sharding-Sphere 而言,confirm 和 cancel 过程代表了子事务中的正常执行 SQL 和逆向执行 SQL,(未来 Sharding-Sphere 将提供自动生成逆向SQL的能力)。当启用 Saga 柔性事务后,路由完成之后的物理数据源将开启本地自动提交事务,每次 confirm 和cancel 都会直接提交。 -在Sharding-Sphere内部,触发SQL执行引擎后,将会产生Saga事务事件,这时Sharding-Sphere事务监听器会注册本次子事务的confirm和cancel至Saga事务管理器的队列中;在业务线程触发commit和rollback后,Saga事务管理器再根据子事务执行的结果,判断进行confirm重试或者cancel流程。 +在 Sharding-Sphere 内部,触发 SQL 执行引擎后,将会产生 Saga 事务事件,这时 Sharding-Sphere 事务监听器会注册本次子事务的 confirm 和 cancel 至 Saga 事务管理器的队列中;在业务线程触发 commit 和 rollback 后,Saga 事务管理器再根据子事务执行的结果,判断进行 confirm 重试或者 cancel 流程。 ### 未来计划 -未来Sharding-Sphere将按照文中介绍的Sharding-Sphere-TM逐步完善整个事务框架: +未来 Sharding-Sphere 将按照文中介绍的 Sharding-Sphere-TM 逐步完善整个事务框架: -* 弱XA事务 (已发布) +* 弱 XA 事务 (已发布) -* 基于Atomikos的XA事务(近期发布) +* 基于 Atomikos 的XA事务(近期发布) -* 基于Narayana的XA事务(规划中) +* 基于 Narayana 的 XA 事务(规划中) -* BED柔性事务(已发布) +* BED 柔性事务(已发布) * SAGA(开发中) @@ -324,7 +324,7 @@ Saga以jar包的形式提供分布式事务治理能力。 ![](https://shardingsphere.apache.org/blog/img/realization14.jpg) -未来,我们将不断优化当前的特性,陆续推出大家关注的柔性事务、数据治理等更多新特性。如果有什么想法、意见和建议,也欢迎留言交流,更欢迎加入到Sharding-Sphere的开源项目中: +未来,我们将不断优化当前的特性,陆续推出大家关注的柔性事务、数据治理等更多新特性。如果有什么想法、意见和建议,也欢迎留言交流,更欢迎加入到 Sharding-Sphere 的开源项目中: * https://github.com/sharding-sphere/sharding-sphere/ @@ -332,45 +332,45 @@ Saga以jar包的形式提供分布式事务治理能力。 ### Q&A -**Q1**:基于XA的事物,可以应用到微服务架构中吗? +**Q1**:基于 XA 的事物,可以应用到微服务架构中吗? -**A1**:目前我们是把事务管理器内嵌到JVM进程中,对于并发量小,短事务的业务,可以用XA。 +**A1**:目前我们是把事务管理器内嵌到 JVM 进程中,对于并发量小,短事务的业务,可以用 XA。 **Q2**:对于各个事务框架开发计划的先后顺序是基本什么来确定的呢? -**A2**:基于难易程度,所以我们把TCC放到了最后。 +**A2**:基于难易程度,所以我们把 TCC 放到了最后。 -**Q3**:支持多语言吗?比如golang? +**Q3**:支持多语言吗?比如 golang? -**A3**:多语言可以用Sharding-Proxy。 +**A3**:多语言可以用 Sharding-Proxy。 -**Q4**:这次是Proxy实现分布式事务吧?我记得之前Sharding-JDBC有实现。 +**Q4**:这次是 Proxy 实现分布式事务吧?我记得之前 Sharding-JDBC 有实现。 -**A4**:这次是整个SS的事务实现,包含Sharding-JDBC和Proxy,目前SJ的实现是弱XA和BED(最大努力送达),以后会增加SAGA和TCC。 +**A4**:这次是整个 SS 的事务实现,包含 Sharding-JDBC 和 Proxy ,目前 SJ 的实现是弱 XA 和 BED(最大努力送达),以后会增加 SAGA 和 TCC。 -**Q5**:如果我只想用SS里的事务模块,可以吗? +**Q5**:如果我只想用 SS 里的事务模块,可以吗? -**A5**:SS是以事件驱动的方式进行的架构,未来事务模块只负责事务相关的处理。 +**A5**:SS 是以事件驱动的方式进行的架构,未来事务模块只负责事务相关的处理。 -**Q6**:SAGA不支持ACID中的I,咱们这边怎么考虑的呢? +**Q6**:SAGA 不支持 ACID 中的 I,咱们这边怎么考虑的呢? -**A6**:目前暂不支持隔离性,今后我们有增加I的规划,其实所有的柔性事务都不支持I,TCC增加了Try阶段,可以理解是准隔离性,使用SAGA时,可以在业务层面控制并发,防止脏读等产生。 +**A6**:目前暂不支持隔离性,今后我们有增加 I 的规划,其实所有的柔性事务都不支持 I,TCC 增加了 Try 阶段,可以理解是准隔离性,使用 SAGA 时,可以在业务层面控制并发,防止脏读等产生。 -**Q7**:那意思,现在3的版本还不能单独用事务的模块? +**Q7**:那意思,现在 3 的版本还不能单独用事务的模块? -**A7**:现在3.0版本,事务模块依赖了Sharding-JDBC模块,事务模块需要监听Sharding-JDBC和Proxy中的事件,然后进行事务操作。如果你想单独用事务模块,需要按Core中定义的事件,在你的业务里进行发布。 +**A7**:现在 3.0 版本,事务模块依赖了 Sharding-JDBC 模块,事务模块需要监听 Sharding-JDBC 和 Proxy 中的事件,然后进行事务操作。如果你想单独用事务模块,需要按 Core 中定义的事件,在你的业务里进行发布。 ### 直播回放 diff --git a/docs/blog/content/material/result.cn.md b/docs/blog/content/material/result.cn.md index 13af901a879c2..82c30ba2a29e5 100644 --- a/docs/blog/content/material/result.cn.md +++ b/docs/blog/content/material/result.cn.md @@ -8,7 +8,7 @@ chapter = true ### 讲师介绍 -张亮,原当当架构部负责人。热爱开源,目前主导两个开源项目Elastic-Job和Sharding-Sphere(Sharding-JDBC)。擅长以java为主分布式架构以及以Kubernetes和Mesos为主的云平台方向,推崇优雅代码,对如何写出具有展现力的代码有较多研究。2018年初加入京东金融,现担任数据研发负责人。目前主要精力投入在将Sharding-Sphere打造为业界一流的金融级数据解决方案之上。 +张亮,原当当架构部负责人。热爱开源,目前主导两个开源项目 Elastic-Job 和 Sharding-Sphere(Sharding-JDBC)。擅长以 java 为主分布式架构以及以 Kubernetes 和 Mesos 为主的云平台方向,推崇优雅代码,对如何写出具有展现力的代码有较多研究。2018 年初加入京东金融,现担任数据研发负责人。目前主要精力投入在将 Sharding-Sphere 打造为业界一流的金融级数据解决方案之上。 ### 简介 @@ -16,7 +16,7 @@ chapter = true -Sharding-Sphere支持的结果归并从功能上分为遍历、排序、分组和分页4种类型,它们是组合而非互斥的关系。从结构划分,可分为流式归并、内存归并和装饰者归并。流式归并和内存归并是互斥的,装饰者归并可以在流式归并和内存归并之上做进一步的处理。 +Sharding-Sphere 支持的结果归并从功能上分为遍历、排序、分组和分页 4 种类型,它们是组合而非互斥的关系。从结构划分,可分为流式归并、内存归并和装饰者归并。流式归并和内存归并是互斥的,装饰者归并可以在流式归并和内存归并之上做进一步的处理。 @@ -44,23 +44,23 @@ Sharding-Sphere支持的结果归并从功能上分为遍历、排序、分组 #### 排序归并 -由于在SQL中存在ORDER BY语句,因此每个数据结果集自身是有序的,因此只需要将数据结果集当前游标指向的数据值进行排序即可。这相当于对多个有序的数组进行排序,归并排序是最适合此场景的排序算法。 +由于在SQL中存在 ORDER BY 语句,因此每个数据结果集自身是有序的,因此只需要将数据结果集当前游标指向的数据值进行排序即可。这相当于对多个有序的数组进行排序,归并排序是最适合此场景的排序算法。 -Sharding-Sphere在对排序的查询进行归并时,将每个结果集的当前数据值进行比较(通过实现Java的Comparable接口完成),并将其放入优先级队列。每次获取下一条数据时,只需将队列顶端结果集的游标下移,并根据新游标重新进入优先级排序队列找到自己的位置即可。通过一个例子来说明Sharding-Sphere的排序归并,下图是一个通过分数进行排序的示例图。 +Sharding-Sphere 在对排序的查询进行归并时,将每个结果集的当前数据值进行比较(通过实现 Java 的 Comparable 接口完成),并将其放入优先级队列。每次获取下一条数据时,只需将队列顶端结果集的游标下移,并根据新游标重新进入优先级排序队列找到自己的位置即可。通过一个例子来说明 Sharding-Sphere 的排序归并,下图是一个通过分数进行排序的示例图。 ![](https://shardingsphere.apache.org/blog/img/result1.jpg) -示例中展示了3张表返回的数据结果集,每个数据结果集已经根据分数排序完毕,但是3个数据结果集之间是无序的。将3个数据结果集的当前游标指向的数据值进行排序,并放入优先级队列,t_score_0的第一个数据值最大,t_score_2的第一个数据值次之,t_score_1的第一个数据值最小,因此优先级队列根据t_score_0,t_score_2和t_score_1的方式排序队列。 +示例中展示了3张表返回的数据结果集,每个数据结果集已经根据分数排序完毕,但是 3 个数据结果集之间是无序的。将 3 个数据结果集的当前游标指向的数据值进行排序,并放入优先级队列,t_score_0 的第一个数据值最大,t_score_2 的第一个数据值次之,t_score_1 的第一个数据值最小,因此优先级队列根据 t_score_0,t_score_2 和 t_score_1 的方式排序队列。 -下图则展现了进行next调用的时候,排序归并是如何进行的。 +下图则展现了进行 next 调用的时候,排序归并是如何进行的。 ![](https://shardingsphere.apache.org/blog/img/result2.jpg) -通过图中我们可以看到,当进行第一次next调用时,排在队列首位的t\_score\_0将会被弹出队列,并且将当前游标指向的数据值(也就是100)返回至查询客户端,并且将游标下移一位之后,重新放入优先级队列。而优先级队列也会根据t\_score\_0的当前数据结果集指向游标的数据值(这里是90)进行排序,根据当前数值,t\_score\_0排列在队列的最后一位。之前队列中排名第二的t\_score\_2的数据结果集则自动排在了队列首位。 +通过图中我们可以看到,当进行第一次 next 调用时,排在队列首位的 t\_score\_0 将会被弹出队列,并且将当前游标指向的数据值(也就是 100)返回至查询客户端,并且将游标下移一位之后,重新放入优先级队列。而优先级队列也会根据 t\_score\_0 的当前数据结果集指向游标的数据值(这里是 90)进行排序,根据当前数值,t\_score\_0 排列在队列的最后一位。之前队列中排名第二的 t\_score\_2 的数据结果集则自动排在了队列首位。 -在进行第二次next时,只需要将目前排列在队列首位的t\_score\_2弹出队列,并且将其数据结果集游标指向的值返回至客户端,并下移游标,继续加入队列排队,以此类推。 +在进行第二次 next 时,只需要将目前排列在队列首位的 t\_score\_2 弹出队列,并且将其数据结果集游标指向的值返回至客户端,并下移游标,继续加入队列排队,以此类推。 @@ -68,19 +68,19 @@ Sharding-Sphere在对排序的查询进行归并时,将每个结果集的当 -可以看到,对于每个数据结果集中的数据有序,而多数据结果集整体无序的情况下,Sharding-Sphere无需将所有的数据都加在至内存即可排序,它使用的是流式归并的方式,每次next仅获取唯一正确的一条数据,极大的节省了内存的消耗。 +可以看到,对于每个数据结果集中的数据有序,而多数据结果集整体无序的情况下,Sharding-Sphere 无需将所有的数据都加在至内存即可排序,它使用的是流式归并的方式,每次 next 仅获取唯一正确的一条数据,极大的节省了内存的消耗。 -从另一个角度来说,Sharding-Sphere的排序归并,是在维护数据结果集的纵轴和横轴这两个维度的有序性。纵轴是指每个数据结果集本身,它是天然有序的,它通过包含ORDER BY的SQL所获取。横轴是指每个数据结果集当前游标所指向的值,它需要通过优先级队列来维护其正确顺序。每一次数据结果集当前游标的下移,都需要将该数据结果集重新放入优先级队列排序,而只有排列在队列首位的数据结果集才可能发生游标下移的操作。 +从另一个角度来说,Sharding-Sphere 的排序归并,是在维护数据结果集的纵轴和横轴这两个维度的有序性。纵轴是指每个数据结果集本身,它是天然有序的,它通过包含 ORDER BY 的 SQL 所获取。横轴是指每个数据结果集当前游标所指向的值,它需要通过优先级队列来维护其正确顺序。每一次数据结果集当前游标的下移,都需要将该数据结果集重新放入优先级队列排序,而只有排列在队列首位的数据结果集才可能发生游标下移的操作。 #### 分组归并 -分组归并的情况最为复杂,它分为流式分组归并和内存分组归并。流式分组归并要求SQL的排序项与分组项的字段以及排序类型(ASC或DESC)必须保持一致,否则只能通过内存归并才能保证其数据的正确性。 +分组归并的情况最为复杂,它分为流式分组归并和内存分组归并。流式分组归并要求SQL的排序项与分组项的字段以及排序类型(ASC 或 DESC)必须保持一致,否则只能通过内存归并才能保证其数据的正确性。 -举例说明,假设根据科目分片,表结构中包含考生的姓名(为了简单起见,不考虑重名的情况)和分数。通过SQL获取每位考生的总分,可通过如下SQL: +举例说明,假设根据科目分片,表结构中包含考生的姓名(为了简单起见,不考虑重名的情况)和分数。通过 SQL 获取每位考生的总分,可通过如下 SQL: ![](https://shardingsphere.apache.org/blog/img/result3.jpg) @@ -88,12 +88,12 @@ Sharding-Sphere在对排序的查询进行归并时,将每个结果集的当 ![](https://shardingsphere.apache.org/blog/img/result4.jpg) -进行归并时,逻辑与排序归并类似。下图展现了进行next调用的时候,流式分组归并是如何进行的。 +进行归并时,逻辑与排序归并类似。下图展现了进行 next 调用的时候,流式分组归并是如何进行的。 ![](https://shardingsphere.apache.org/blog/img/result5.jpg) -通过图中我们可以看到,当进行第一次next调用时,排在队列首位的t\_score\_java将会被弹出队列,并且将分组值同为“Jetty”的其他结果集中的数据一同弹出队列。在获取了所有的姓名为“Jetty”的同学的分数之后,进行累加操作,那么,在第一次next调用结束后,取出的结果集是“Jetty”的分数总和。于此同时,所有的数据结果集中的游标都将下移至数据值“Jetty”的下一个不同的数据值,并且根据数据结果集当前游标指向的值进行重排序。因此,包含名字顺着第二位的“John”的相关数据结果集则排在的队列的前列。 +通过图中我们可以看到,当进行第一次 next 调用时,排在队列首位的 t\_score\_java 将会被弹出队列,并且将分组值同为“Jetty”的其他结果集中的数据一同弹出队列。在获取了所有的姓名为“Jetty”的同学的分数之后,进行累加操作,那么,在第一次 next 调用结束后,取出的结果集是“Jetty”的分数总和。于此同时,所有的数据结果集中的游标都将下移至数据值“Jetty”的下一个不同的数据值,并且根据数据结果集当前游标指向的值进行重排序。因此,包含名字顺着第二位的“John”的相关数据结果集则排在的队列的前列。 @@ -101,9 +101,9 @@ Sharding-Sphere在对排序的查询进行归并时,将每个结果集的当 -1.它会一次性的将多个数据结果集中的分组项相同的数据全数取出。 +1. 它会一次性的将多个数据结果集中的分组项相同的数据全数取出。 -2.它需要根据聚合函数的类型进行聚合计算。 +2. 它需要根据聚合函数的类型进行聚合计算。 @@ -116,7 +116,7 @@ Sharding-Sphere在对排序的查询进行归并时,将每个结果集的当 -当SQL中只包含分组语句时,根据不同数据库的实现,其排序的顺序不一定与分组顺序一致。但由于排序语句的缺失,则表示此SQL并不在意排序顺序。因此,Sharding-Sphere通过SQL优化的改写,自动增加与分组项一致的排序项,使其能够从消耗内存的内存分组归并方式转化为流式分组归并方案。 +当SQL中只包含分组语句时,根据不同数据库的实现,其排序的顺序不一定与分组顺序一致。但由于排序语句的缺失,则表示此SQL并不在意排序顺序。因此,Sharding-Sphere 通过 SQL 优化的改写,自动增加与分组项一致的排序项,使其能够从消耗内存的内存分组归并方式转化为流式分组归并方案。 @@ -124,27 +124,27 @@ Sharding-Sphere在对排序的查询进行归并时,将每个结果集的当 -比较类型的聚合函数是指MAX和MIN。它们需要对每一个同组的结果集数据进行比较,并且直接返回其最大或最小值即可。 +比较类型的聚合函数是指 MAX 和 MIN。它们需要对每一个同组的结果集数据进行比较,并且直接返回其最大或最小值即可。 -累加类型的聚合函数是指SUM和COUNT。它们需要将每一个同组的结果集数据进行累加。 +累加类型的聚合函数是指 SUM 和 COUNT。它们需要将每一个同组的结果集数据进行累加。 -求平均值的聚合函数只有AVG。它必须通过SQL改写的SUM和COUNT进行计算,相关内容已在SQL改写的内容中涵盖,不再赘述。 +求平均值的聚合函数只有 AVG。它必须通过 SQL 改写的 SUM 和 COUNT 进行计算,相关内容已在SQL改写的内容中涵盖,不再赘述。 #### 分页归并 -上文所述的所有归并类型都可能进行分页。分页是追加在其他归并类型之上的装饰器,Sharding-Sphere通过装饰者模式来增加对数据结果集进行分页的能力。分页归并负责将无需获取的数据过滤掉。 +上文所述的所有归并类型都可能进行分页。分页是追加在其他归并类型之上的装饰器,Sharding-Sphere 通过装饰者模式来增加对数据结果集进行分页的能力。分页归并负责将无需获取的数据过滤掉。 -Sharding-Sphere的分页功能比较容易让使用者误解,用户通常认为分页归并会占用大量内存。在分布式的场景中,将LIMIT 10000000, 10改写为LIMIT 0, 10000010,才能保证其数据的正确性。用户非常容易产生Sharding-Sphere会将大量无意义的数据加载至内存中,造成内存溢出风险的错觉。其实,通过流式归并的原理可知,会将数据全部加载到内存中的只有内存分组归并这一种情况,而通常来说,进行OLAP的分组SQL,不会产生大量的结果数据,它更多的用于大量的计算,以及少量结果产出的场景。除了内存分组归并这种情况之外,其他情况都通过流式归并获取数据结果集,因此Sharding-Sphere会通过结果集的next方法将无需取出的数据全部跳过,并不会将其存入内存。 +Sharding-Sphere 的分页功能比较容易让使用者误解,用户通常认为分页归并会占用大量内存。在分布式的场景中,将LIMIT 10000000, 10 改写为 LIMIT 0, 10000010,才能保证其数据的正确性。用户非常容易产生 Sharding-Sphere 会将大量无意义的数据加载至内存中,造成内存溢出风险的错觉。其实,通过流式归并的原理可知,会将数据全部加载到内存中的只有内存分组归并这一种情况,而通常来说,进行 OLAP 的分组 SQL,不会产生大量的结果数据,它更多的用于大量的计算,以及少量结果产出的场景。除了内存分组归并这种情况之外,其他情况都通过流式归并获取数据结果集,因此 Sharding-Sphere 会通过结果集的 next 方法将无需取出的数据全部跳过,并不会将其存入内存。 -但同时需要注意的是,由于排序的需要,大量的数据仍然需要传输到Sharding-Sphere的内存空间。因此,采用LIMIT这种方式分页,并非最佳实践。 由于LIMIT并不能通过索引查询数据,因此如果可以保证ID的连续性,通过ID进行分页是比较好的解决方案,例如: +但同时需要注意的是,由于排序的需要,大量的数据仍然需要传输到 Sharding-Sphere 的内存空间。因此,采用 LIMIT 这种方式分页,并非最佳实践。 由于 LIMIT 并不能通过索引查询数据,因此如果可以保证ID的连续性,通过ID进行分页是比较好的解决方案,例如: ![](https://shardingsphere.apache.org/blog/img/result7.jpg) diff --git a/docs/blog/content/material/seata.cn.md b/docs/blog/content/material/seata.cn.md index 5a811e1257849..a2a3003212274 100644 --- a/docs/blog/content/material/seata.cn.md +++ b/docs/blog/content/material/seata.cn.md @@ -6,59 +6,59 @@ chapter = true ### 背景知识 -Seata是阿里集团和蚂蚁金服联合打造的分布式事务框架,目前版本包含了AT事务和TCC事务。其中AT事务的目标是在微服务架构下,提供增量的事务ACID语意,让用户像使用本地事务一样,使用分布式事务,核心理念同ShardingSphere一脉相承。 +Seata 是阿里集团和蚂蚁金服联合打造的分布式事务框架,目前版本包含了 AT 事务和 TCC 事务。其中AT事务的目标是在微服务架构下,提供增量的事务 ACID 语意,让用户像使用本地事务一样,使用分布式事务,核心理念同 ShardingSphere 一脉相承。 Github: https://github.com/seata/seata ### Seata AT模型 -Seata AT事务模型包含TM(事务管理器),RM(资源管理器),TC(事务协调器)。 +Seata AT 事务模型包含 TM (事务管理器),RM (资源管理器),TC (事务协调器)。 -其中TC是一个独立的服务需要单独部署,TM和RM以jar包的方式同业务应用部署在一起,它们同TC建立长连接,在整个事务生命周期内,保持RPC通信。 +其中TC是一个独立的服务需要单独部署,TM 和 RM 以 jar 包的方式同业务应用部署在一起,它们同 TC 建立长连接,在整个事务生命周期内,保持 RPC 通信。 -其中全局事务的发起方作为TM,全局事务的参与者作为RM ; TM负责全局事务的begin和commit/rollback,RM负责分支事务的执行和commit/rollback。 +其中全局事务的发起方作为 TM,全局事务的参与者作为 RM ; TM 负责全局事务的 begin 和 commit/rollback,RM 负责分支事务的执行和 commit/rollback。 ![](https://shardingsphere.apache.org/blog/img/seata1.jpg) -### ShardingSphere分布式事务SPI +### ShardingSphere 分布式事务 SPI -ShardingSphere提供了一套接入分布式事务的SPI,设计的目标是保证数据分片后,事务的ACID语意。分布式事务的实现目前主要包含两阶段的XA和BASE柔性事务。Seata AT事务作为BASE柔性事务的一种实现,可以无缝接入到ShardingSphere生态中。 +ShardingSphere 提供了一套接入分布式事务的 SPI ,设计的目标是保证数据分片后,事务的 ACID 语意。分布式事务的实现目前主要包含两阶段的 XA 和 BASE 柔性事务。Seata AT 事务作为 BASE 柔性事务的一种实现,可以无缝接入到 ShardingSphere 生态中。 ![](https://shardingsphere.apache.org/blog/img/seata2.jpg) -两阶段XA事务方面,我们已经整合了Atomikos,Narayana,Bitronix事务管理器,XA事务底层依赖具体的数据库厂商对XA两阶段提交协议的支持,通常XA协议通过在Prepare和Commit阶段进行2PL(2阶段锁),保证了分布式事务的ACID,通常适用于短事务及非云化环境(云化环境下一次IO操作大概需要20ms,两阶段锁会锁住资源长达40ms,因此事务的TPS会降到25/s左右,非云化环境通常一次IO只需几毫秒,因此锁热点数据的时间相对较低)\[1\]。 +两阶段XA事务方面,我们已经整合了 Atomikos,Narayana,Bitronix 事务管理器,XA 事务底层依赖具体的数据库厂商对 XA 两阶段提交协议的支持,通常 XA 协议通过在 Prepare 和 Commit 阶段进行 2PL(2阶段锁),保证了分布式事务的 ACID,通常适用于短事务及非云化环境(云化环境下一次 IO 操作大概需要 20 ms,两阶段锁会锁住资源长达 40 ms,因此事务的 TPS 会降到 25/s 左右,非云化环境通常一次 IO 只需几毫秒,因此锁热点数据的时间相对较低)\[1\]。 -BASE柔性事务方面,目前我们已经完成了对ServiceComb Saga的整合,Saga通过一阶段提交+补偿的方式提高了整体事务的性能,其中补偿的方式同Seata大致相同,即对分片后的物理SQL进行revert来生成补偿的SQL,但Saga模型在理论上不支持隔离级别,适用于对性能要求较高,对一致性要求比较低的业务。Seata AT事务在一阶段提交+补偿的基础上,通过TC的全局锁实现了RC隔离级别的支持,是介于XA和Saga之间的另一种实现。消息柔性事务方面,也欢迎大家参考我们的SPI提供整合的方案。 +BASE 柔性事务方面,目前我们已经完成了对 ServiceComb Saga 的整合,Saga 通过一阶段提交+补偿的方式提高了整体事务的性能,其中补偿的方式同 Seata 大致相同,即对分片后的物理 SQL 进行 revert 来生成补偿的 SQL,但 Saga 模型在理论上不支持隔离级别,适用于对性能要求较高,对一致性要求比较低的业务。Seata AT 事务在一阶段提交+补偿的基础上,通过 TC 的全局锁实现了RC隔离级别的支持,是介于 XA 和 Saga 之间的另一种实现。消息柔性事务方面,也欢迎大家参考我们的 SPI 提供整合的方案。 ### 整合方案 -整合Seata AT事务时,需要把TM,RM,TC的模型融入到ShardingSphere 分布式事务的SPI的生态中。在数据库资源上,Seata通过对接DataSource接口,让JDBC操作可以同TC进行RPC通信。同样,ShardingSphere也是面向DataSource接口对用户配置的物理DataSource进行了聚合,因此把物理DataSource二次包装为Seata的DataSource后,就可以把Seata AT事务融入到ShardingSphere的分片中。 +整合 Seata AT 事务时,需要把 TM,RM,TC 的模型融入到 ShardingSphere 分布式事务的 SPI 的生态中。在数据库资源上,Seata 通过对接 DataSource 接口,让 JDBC 操作可以同 TC 进行 RPC 通信。同样,ShardingSphere 也是面向 DataSource 接口对用户配置的物理 DataSource 进行了聚合,因此把物理 DataSource 二次包装为 Seata 的 DataSource 后,就可以把 Seata AT 事务融入到 ShardingSphere 的分片中。 -在Seata模型中,全局事务的上下文存放在线程变量中,通过扩展服务间的transport,可以完成线程变量的传递,分支事务通过线程变量判断是否加入到整个Seata全局事务中。而ShardingSphere的分片执行引擎通常是按多线程执行,因此整合Seata AT事务时,需要扩展主线程和子线程的事务上下文传递,这同服务间的上下文传递思路完全相同。 +在 Seata 模型中,全局事务的上下文存放在线程变量中,通过扩展服务间的 transport,可以完成线程变量的传递,分支事务通过线程变量判断是否加入到整个 Seata 全局事务中。而 ShardingSphere 的分片执行引擎通常是按多线程执行,因此整合 Seata AT 事务时,需要扩展主线程和子线程的事务上下文传递,这同服务间的上下文传递思路完全相同。 ![](https://shardingsphere.apache.org/blog/img/seata3.jpg) ### Quick Start -我们已经实现了base-seata-raw-jdbc-example,大家可以自行进行尝试。 +我们已经实现了 base-seata-raw-jdbc-example,大家可以自行进行尝试。 https://github.com/apache/incubator-shardingsphere-example/tree/dev/sharding-jdbc-example/transaction-example/transaction-base-seata-example/transaction-base-seata-raw-jdbc-example 操作手册: -1.按照seata-work-shop中的步骤,下载并启动seata server。 +1.按照 seata-work-shop 中的步骤,下载并启动 seata server。 https://github.com/seata/seata-workshop -参考 Step6 和 Step7即可 +参考 Step6 和 Step7 即可 -2.在每一个分片数据库实例中执行resources/sql/undo_log.sql脚本,创建undo_log表 +2.在每一个分片数据库实例中执行 resources/sql/undo_log.sql 脚本,创建 undo_log 表 3.Run YamlConfigurationTransactionExample.java ### 待优化项 -Seata AT事务在Revert SQL时,需要对ShardingSphere分片后的物理SQL进行二次的解析,这里我们需要设计一个SPI,避免SQL二次解析的性能损耗。 +Seata AT 事务在 Revert SQL 时,需要对 ShardingSphere 分片后的物理 SQL 进行二次的解析,这里我们需要设计一个 SPI ,避免 SQL 二次解析的性能损耗。 参考论文 diff --git a/docs/blog/content/material/solution.cn.md b/docs/blog/content/material/solution.cn.md index 6f1bf77244900..c6d821d22a4de 100644 --- a/docs/blog/content/material/solution.cn.md +++ b/docs/blog/content/material/solution.cn.md @@ -6,30 +6,30 @@ chapter = true ### 作者 -张亮,京东数科数据研发负责人,Apache ShardingSphere发起人 & PPMC +张亮,京东数科数据研发负责人,Apache ShardingSphere 发起人 & PPMC -热爱开源,目前主导开源项目ShardingSphere(原名Sharding-JDBC)和Elastic-Job。擅长以java为主分布式架构以及以Kubernetes和Mesos为主的云平台方向,推崇优雅代码,对如何写出具有展现力的代码有较多研究。 +热爱开源,目前主导开源项目 ShardingSphere (原名 Sharding-JDBC )和 Elastic-Job。擅长以 java 为主分布式架构以及以 Kubernetes 和 Mesos 为主的云平台方向,推崇优雅代码,对如何写出具有展现力的代码有较多研究。 -目前主要精力投入在将ShardingSphere打造为业界一流的金融级数据解决方案之上。ShardingSphere已经进入Apache孵化器,是京东集团首个进入Apache基金会的开源项目,也是Apache基金会首个分布式数据库中间件。 +目前主要精力投入在将 ShardingSphere 打造为业界一流的金融级数据解决方案之上。ShardingSphere 已经进入 Apache 孵化器,是京东集团首个进入 Apache 基金会的开源项目,也是 Apache 基金会首个分布式数据库中间件。 --- -姜宁,华为开源能力中心技术专家,Apache ServiceComb项目负责人。前红帽软件首席软件工程师,在企业级开源中间件开发方面有十余年经验,有丰富的Java开发和使用经验,函数式编程爱好者。从2006年开始一直从事Apache开源中间件项目的开发工作,先后参与Apache CXF,Apache Camel,以及Apache ServiceMix的开发。对微服务架构,WebServices,Enterprise Integration Pattern,SOA, OSGi 均有比较深入的研究。 +姜宁,华为开源能力中心技术专家,Apache ServiceComb 项目负责人。前红帽软件首席软件工程师,在企业级开源中间件开发方面有十余年经验,有丰富的 Java 开发和使用经验,函数式编程爱好者。从 2006 年开始一直从事 Apache 开源中间件项目的开发工作,先后参与 Apache CXF,Apache Camel,以及 Apache ServiceMix 的开发。对微服务架构,WebServices,Enterprise Integration Pattern,SOA, OSGi 均有比较深入的研究。 博客地址:https://willemjiang.github.io/ --- -冯征,红帽软件工程师。2009年加入红帽软件公司,主要从事事务管理器方面的工作,做为核心开发人员参与了 Narayana 和 BlackTie 项目,在与多个应用服务器(Wildfly, Karaf, Tomcat)和框架(Common DBCP, Spring Boot)的事务处理集成方面有过贡献。从2017年开始参与了Apache ServiceComb项目,目前是PMC成员之一。对于分布式事务处理以及微服务环境中的事务处理,有过深入的研究。 +冯征,红帽软件工程师。2009年加入红帽软件公司,主要从事事务管理器方面的工作,做为核心开发人员参与了 Narayana 和 BlackTie 项目,在与多个应用服务器(Wildfly, Karaf, Tomcat)和框架(Common DBCP, Spring Boot)的事务处理集成方面有过贡献。从2017年开始参与了 Apache ServiceComb 项目,目前是 PMC 成员之一。对于分布式事务处理以及微服务环境中的事务处理,有过深入的研究。 ### 导读 相比于数据分片方案的逐渐成熟,集性能、透明化、自动化、强一致、并能适用于各种应用场景于一体的分布式事务解决方案则显得凤毛麟角。基于两(三)阶段提交的分布式事务的性能瓶颈以及柔性事务的业务改造问题,使得分布式事务至今依然是令架构师们头疼的问题。 -Apache ShardingSphere(Incubating)不失时机的在2019年初,提供了一个刚柔并济的一体化分布式事务解决方案。如果您的应用系统正在受到这方面的困扰,不妨倒上一杯咖啡,花十分钟阅读此文,说不定会有些收获呢? +Apache ShardingSphere(Incubating)不失时机的在 2019 年初,提供了一个刚柔并济的一体化分布式事务解决方案。如果您的应用系统正在受到这方面的困扰,不妨倒上一杯咖啡,花十分钟阅读此文,说不定会有些收获呢? ### 背景 -数据库事务需要满足ACID(原子性、一致性、隔离性、持久性)4个特性。 +数据库事务需要满足 ACID(原子性、一致性、隔离性、持久性)4个特性。 - 原子性(Atomicity)指事务作为整体来执行,要么全部执行,要么全不执行。 @@ -41,7 +41,7 @@ Apache ShardingSphere(Incubating)不失时机的在2019年初,提供了一 在单一数据节点中,事务仅限于对单一数据库资源的访问控制,称之为本地事务。几乎所有的成熟的关系型数据库都提供了对本地事务的原生支持。 但是在基于微服务的分布式应用环境下,越来越多的应用场景要求对多个服务的访问及其相对应的多个数据库资源能纳入到同一个事务当中,分布式事务应运而生。 -关系型数据库虽然对本地事务提供了完美的ACID原生支持。 但在分布式的场景下,它却成为系统性能的桎梏。如何让数据库在分布式场景下满足ACID的特性或找寻相应的替代方案,是分布式事务的重点工作。 +关系型数据库虽然对本地事务提供了完美的 ACID 原生支持。 但在分布式的场景下,它却成为系统性能的桎梏。如何让数据库在分布式场景下满足 ACID 的特性或找寻相应的替代方案,是分布式事务的重点工作。 #### 本地事务 @@ -49,15 +49,15 @@ Apache ShardingSphere(Incubating)不失时机的在2019年初,提供了一 #### 两阶段提交 -XA协议最早的分布式事务模型是由X/Open国际联盟提出的X/Open Distributed Transaction Processing(DTP)模型,简称XA协议。 +XA 协议最早的分布式事务模型是由 X/Open 国际联盟提出的 X/Open Distributed Transaction Processing(DTP)模型,简称 XA 协议。 -基于XA协议实现的分布式事务对业务侵入很小。 它最大的优势就是对使用方透明,用户可以像使用本地事务一样使用基于XA协议的分布式事务。 XA协议能够严格保障事务ACID特性。 +基于 XA 协议实现的分布式事务对业务侵入很小。 它最大的优势就是对使用方透明,用户可以像使用本地事务一样使用基于 XA 协议的分布式事务。 XA 协议能够严格保障事务 ACID 特性。 -严格保障事务ACID特性是一把双刃剑。 事务执行在过程中需要将所需资源全部锁定,它更加适用于执行时间确定的短事务。 对于长事务来说,整个事务进行期间对数据的独占,将导致对热点数据依赖的业务系统并发性能衰退明显。 因此,在高并发的性能至上场景中,基于XA协议两阶段提交类型的分布式事务并不是最佳选择。 +严格保障事务 ACID 特性是一把双刃剑。 事务执行在过程中需要将所需资源全部锁定,它更加适用于执行时间确定的短事务。 对于长事务来说,整个事务进行期间对数据的独占,将导致对热点数据依赖的业务系统并发性能衰退明显。 因此,在高并发的性能至上场景中,基于XA协议两阶段提交类型的分布式事务并不是最佳选择。 #### 柔性事务 -如果将实现了ACID的事务要素的事务称为刚性事务的话,那么基于BASE事务要素的事务则称为柔性事务。 BASE是基本可用、柔性状态和最终一致性这3个要素的缩写。 +如果将实现了 ACID 的事务要素的事务称为刚性事务的话,那么基于 BASE 事务要素的事务则称为柔性事务。 BASE 是基本可用、柔性状态和最终一致性这3个要素的缩写。 - 基本可用(Basically Available)保证分布式事务参与方不一定同时在线。 @@ -65,13 +65,13 @@ XA协议最早的分布式事务模型是由X/Open国际联盟提出的X/Open Di - 最终一致性(Eventually consistent)通常是通过消息传递的方式保证系统的最终一致性。 -在ACID事务中对一致性和隔离性的要求很高,在事务执行过程中,必须将所有的资源占用。 柔性事务的理念则是通过业务逻辑将互斥锁操作从资源层面上移至业务层面。通过放宽对强一致性和隔离性的要求,只要求当整个事务最终结束的时候,数据是一致的。而在事务执行期间,任何读取操作得到的数据都有可能被改变。这种弱一致性的设计可以用来换取系统吞吐量的提升。 +在 ACID 事务中对一致性和隔离性的要求很高,在事务执行过程中,必须将所有的资源占用。 柔性事务的理念则是通过业务逻辑将互斥锁操作从资源层面上移至业务层面。通过放宽对强一致性和隔离性的要求,只要求当整个事务最终结束的时候,数据是一致的。而在事务执行期间,任何读取操作得到的数据都有可能被改变。这种弱一致性的设计可以用来换取系统吞吐量的提升。 -Saga是典型的柔性事务管理器。Sagas这个概念来源于三十多年前的一篇数据库论文[http://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf] ,一个Saga事务是一个由多个短时事务组成的长时的事务。 在分布式事务场景下,我们把一个Saga分布式事务看做是一个由多个本地事务组成的事务,每个本地事务都有一个与之对应的补偿事务。在Saga事务的执行过程中,如果某一步执行出现异常,Saga事务会被终止,同时会调用对应的补偿事务完成相关的恢复操作,这样保证Saga相关的本地事务要么都是执行成功,要么通过补偿恢复成为事务执行之前的状态。 +Saga 是典型的柔性事务管理器。Saga 这个概念来源于三十多年前的一篇数据库论文[http://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf] ,一个 Saga 事务是一个由多个短时事务组成的长时的事务。 在分布式事务场景下,我们把一个 Saga 分布式事务看做是一个由多个本地事务组成的事务,每个本地事务都有一个与之对应的补偿事务。在 Saga 事务的执行过程中,如果某一步执行出现异常,Saga 事务会被终止,同时会调用对应的补偿事务完成相关的恢复操作,这样保证 Saga 相关的本地事务要么都是执行成功,要么通过补偿恢复成为事务执行之前的状态。 -TCC(Try-Cancel/Confirm实现)是另一种柔性事务的协调实现。TCC借助两阶段提交协议提供了一种比较完美的恢复方式。在TCC方式下,cancel补偿显然是在第二阶段需要执行业务逻辑来取消第一阶段产生的后果。Try是在第一阶段执行相关的业务操作,完成相关业务资源的占用,例如预先分配票务资源,或者检查并刷新用户账户信用额度。 在取消阶段释放相关的业务资源,例如释放预先分配的票务资源或者恢复之前占用的用户信用额度。 那我们为什么还要加入确认操作呢?这需要从业务资源的使用生命周期来入手。在try过程中,我们只是占用的业务资源,相关的执行操作只是出于待定状态,只有在确认操作执行完毕之后,业务资源才能真正被确认。 +TCC( Try-Cancel/Confirm 实现)是另一种柔性事务的协调实现。TCC 借助两阶段提交协议提供了一种比较完美的恢复方式。在 TCC 方式下,cancel 补偿显然是在第二阶段需要执行业务逻辑来取消第一阶段产生的后果。Try 是在第一阶段执行相关的业务操作,完成相关业务资源的占用,例如预先分配票务资源,或者检查并刷新用户账户信用额度。 在取消阶段释放相关的业务资源,例如释放预先分配的票务资源或者恢复之前占用的用户信用额度。 那我们为什么还要加入确认操作呢?这需要从业务资源的使用生命周期来入手。在 try 过程中,我们只是占用的业务资源,相关的执行操作只是出于待定状态,只有在确认操作执行完毕之后,业务资源才能真正被确认。 -基于ACID的强一致性事务和基于BASE的最终一致性事务都不是银弹,只有在最适合的场景中才能发挥它们的最大长处。可通过下表详细对比它们之间的区别,以帮助开发者进行技术选型。 +基于 ACID 的强一致性事务和基于 BASE 的最终一致性事务都不是银弹,只有在最适合的场景中才能发挥它们的最大长处。可通过下表详细对比它们之间的区别,以帮助开发者进行技术选型。
@@ -89,27 +89,27 @@ TCC(Try-Cancel/Confirm实现)是另一种柔性事务的协调实现。TCC借 由于应用的场景不同,需要开发者能够合理的在性能与功能之间权衡各种分布式事务。 -两阶段提交与柔性事务的API和功能并不完全相同,在它们之间并不能做到自由的透明切换。在开发决策阶段,就不得不在两阶段提交的事务和柔性事务之间抉择,使得设计和开发成本被大幅增加。 +两阶段提交与柔性事务的 API 和功能并不完全相同,在它们之间并不能做到自由的透明切换。在开发决策阶段,就不得不在两阶段提交的事务和柔性事务之间抉择,使得设计和开发成本被大幅增加。 -基于XA的两阶段提交事务使用相对简单,但是无法很好的应对互联网的高并发或复杂系统的长事务场景;柔性事务则需要开发者对应用进行改造,接入成本非常高,并且需要开发者自行实现资源占用和反向补偿。 +基于 XA 的两阶段提交事务使用相对简单,但是无法很好的应对互联网的高并发或复杂系统的长事务场景;柔性事务则需要开发者对应用进行改造,接入成本非常高,并且需要开发者自行实现资源占用和反向补偿。 -### ShardingSphere的分布式事务 +### ShardingSphere 的分布式事务 -整合现有的成熟事务方案,为本地事务、两阶段提交和柔性事务提供统一的分布式事务接口,并弥补当前方案的不足,提供一站式的分布式事务解决方案是Apache ShardingSphere(Incubating)分布式事务模块的主要设计目标。该模块的名称是sharding-transaction。可以用刚柔并济、自动化和透明化这3个关键词来概括sharding-transaction模块的设计理念和功能呈现。 +整合现有的成熟事务方案,为本地事务、两阶段提交和柔性事务提供统一的分布式事务接口,并弥补当前方案的不足,提供一站式的分布式事务解决方案是 Apache ShardingSphere(Incubating)分布式事务模块的主要设计目标。该模块的名称是 sharding-transaction。可以用刚柔并济、自动化和透明化这3个关键词来概括 sharding-transaction 模块的设计理念和功能呈现。 1.刚柔并济 -同时提供基于XA的两阶段提交事务与基于Saga的柔性事务解决方案,并且能够一起配合使用。 +同时提供基于 XA 的两阶段提交事务与基于 Saga 的柔性事务解决方案,并且能够一起配合使用。 2.自动化 -XA事务和Saga事务都通过自动化的方式完成,使用方无感知。XA事务无需使用XADataSource接口以及JTA事务管理器;Saga事务也无需用户自行实现补偿接口。 +XA 事务和 Saga 事务都通过自动化的方式完成,使用方无感知。XA 事务无需使用 XADataSource 接口以及 JTA 事务管理器;Saga 事务也无需用户自行实现补偿接口。 3.透明化 -在Apache ShardingSphere(Incubating)的两个接入端——Sharding-JDBC和Sharding-Proxy中,分别提供了面向本地事务接口的封装。使用方完全可以将被ShardingSphere管理的水平分片的多个数据源当成一个数据库使用,通过本地事务API即可实现完全的分布式事务的能力。用户可以透明地在应用中任意切换事务类型。 +在 Apache ShardingSphere(Incubating)的两个接入端——Sharding-JDBC 和 Sharding-Proxy 中,分别提供了面向本地事务接口的封装。使用方完全可以将被 ShardingSphere 管理的水平分片的多个数据源当成一个数据库使用,通过本地事务API即可实现完全的分布式事务的能力。用户可以透明地在应用中任意切换事务类型。 -sharding-transaction模块由sharding-transaction-core,sharding-transaction-2pc和sharding-transaction-base这3个子模块组成。 +sharding-transaction 模块由 sharding-transaction-core,sharding-transaction-2pc 和 sharding-transaction-base 这3个子模块组成。 - sharding-transaction-core: @@ -117,15 +117,15 @@ sharding-transaction模块由sharding-transaction-core,sharding-transaction-2p - sharding-transaction-2pc: -两阶段提交事务父模块。目前只有sharding-transaction-xa模块,提供了XA协议的支持。未来会引入更多的基于两阶段提交的事务类型,如:percolator,参见: +两阶段提交事务父模块。目前只有 sharding-transaction-xa 模块,提供了 XA 协议的支持。未来会引入更多的基于两阶段提交的事务类型,如:percolator,参见: [https://storage.googleapis.com/pub-tools-public-publication-data/pdf/36726.pdf]。 - sharding-transaction-base: -柔性事务父模块。目前只有sharding-transaction-saga模块,采用Apache ServiceComb Saga Actuator提供的Saga执行器提供柔性事务支持,并在其基础之上提供了反向SQL和快照的能力,并由此实现自动逆向补偿功能。 +柔性事务父模块。目前只有 sharding-transaction-saga 模块,采用 Apache ServiceComb Saga Actuator 提供的 Saga 执行器提供柔性事务支持,并在其基础之上提供了反向 SQL 和快照的能力,并由此实现自动逆向补偿功能。 -下面将对ShardingSphere的XA和Saga事务模块的功能亮点进行说明。 +下面将对 ShardingSphere 的 XA 和 Saga 事务模块的功能亮点进行说明。 #### XA事务——三大XA事务管理器共护航 @@ -133,17 +133,17 @@ sharding-transaction模块由sharding-transaction-core,sharding-transaction-2p **1.复用成熟引擎,自动切换底层实现** -Sharding-transaction-xa模块进一步定义了面向XA事务管理器开发者的SPI,开发者仅需实现SPI定义的接口,即可自动加入至Apache ShardingSphere(Incubating)生态,作为其XA事务管理器。 +Sharding-transaction-xa 模块进一步定义了面向 XA 事务管理器开发者的 SPI,开发者仅需实现 SPI 定义的接口,即可自动加入至 Apache ShardingSphere(Incubating)生态,作为其 XA 事务管理器。 -Apache ShardingSphere(Incubating)官方目前实现了基于Atomikos和Bitronix的SPI,并且邀请了 Redhat JBoss 的XA事务引擎Narayana [https://github.com/jbosstm/narayana] 开发团队实现了JBoss的SPI。用户可以自行的在Atomikos,Bitronix和Narayana间选择自己喜欢的XA事务管理器。 +Apache ShardingSphere(Incubating)官方目前实现了基于 Atomikos 和 Bitronix 的 SPI,并且邀请了 Redhat JBoss 的 XA 事务引擎 Narayana [https://github.com/jbosstm/narayana] 开发团队实现了 JBoss 的 SPI。用户可以自行的在 Atomikos,Bitronix 和 Narayana 间选择自己喜欢的 XA 事务管理器。 -受限于Apache基金会项目License的原因,Apache ShardingSphere(Incubating)将采用Apache协议的Atomikos作为其默认实现,关于基于LGPL协议的Bitronix和基于LGPL协议的Narayana,用户可以自行引用相应jar包至项目的classpath即可。 +受限于 Apache 基金会项目 License 的原因,Apache ShardingSphere(Incubating)将采用 Apache 协议的 Atomikos 作为其默认实现,关于基于 LGPL 协议的 Bitronix 和基于 LGPL 协议的 Narayana,用户可以自行引用相应 jar包至项目的 classpath 即可。 -如果这3个XA事务管理器仍未满足用户需求,开发者则可通过扩展SPI来实现定制化的XA事务管理器。 +如果这 3 个 XA 事务管理器仍未满足用户需求,开发者则可通过扩展 SPI 来实现定制化的 XA 事务管理器。 @@ -151,18 +151,18 @@ Apache ShardingSphere(Incubating)官方目前实现了基于Atomikos和Bitro -Apache ShardingSphere(Incubating)能够自动将XADataSource作为数据库驱动的数据源接入XA事务管理器。而针对于使用DataSource作为数据库驱动的应用,用户也无需改变其编码以及配置,Apache ShardingSphere(Incubating)通过自动适配的方式,在中间件内部将其转化为支持XA协议的XADataSource和XAConnection,并将其作为XA资源注册到底层的XA事务管理器中。 +Apache ShardingSphere(Incubating)能够自动将 XADataSource 作为数据库驱动的数据源接入 XA 事务管理器。而针对于使用 DataSource 作为数据库驱动的应用,用户也无需改变其编码以及配置,Apache ShardingSphere(Incubating)通过自动适配的方式,在中间件内部将其转化为支持 XA 协议的 XADataSource 和 XAConnection,并将其作为 XA 资源注册到底层的 XA 事务管理器中。 -XA模块的架构图如下: +XA 模块的架构图如下: ![](https://shardingsphere.apache.org/blog/img/solution1.jpg) #### Saga事务—跨越柔性事务限制,实现自动补偿 -在柔性事务中,每一次对数据库的更新操作都将数据真正的提交至数据库,以达到高并发系统中最佳资源释放的效果。当数据出现问题需要回滚时,通过柔性事务管理器保持数据的最终一致性以及隔离行为。Apache ShardingSphere(Incubating)采用Apache ServiceComb Saga Actuator [https://github.com/apache/servicecomb-saga-actuator] 作为Saga事务管理器,它的主要功能如下: +在柔性事务中,每一次对数据库的更新操作都将数据真正的提交至数据库,以达到高并发系统中最佳资源释放的效果。当数据出现问题需要回滚时,通过柔性事务管理器保持数据的最终一致性以及隔离行为。Apache ShardingSphere(Incubating)采用 Apache ServiceComb Saga Actuator [https://github.com/apache/servicecomb-saga-actuator] 作为 Saga 事务管理器,它的主要功能如下: @@ -170,11 +170,11 @@ XA模块的架构图如下: -Saga定义了一个事务中的每个子事务都有一个与之对应的反向补偿操作。由Saga事务管理器根据程序执行结果生成一张有向无环图,并在需要执行回滚操作时,根据该图依次按照相反的顺序调用反向补偿操作。Saga事务管理器只用于控制何时重试,合适补偿,并不负责补偿的内容,补偿的具体操作需要由开发者自行提供。 +Saga 定义了一个事务中的每个子事务都有一个与之对应的反向补偿操作。由 Saga 事务管理器根据程序执行结果生成一张有向无环图,并在需要执行回滚操作时,根据该图依次按照相反的顺序调用反向补偿操作。Saga 事务管理器只用于控制何时重试,合适补偿,并不负责补偿的内容,补偿的具体操作需要由开发者自行提供。 -另一个柔性事务管理器TCC与Saga理念相似,均需要由使用方开发者提供补偿操作。除了补偿,TCC还提供了资源占用的能力,但也需要由使用方开发者提供资源占用操作。虽然功能上强于Saga,但TCC的使用成本较之Saga也更高。 +另一个柔性事务管理器 TCC 与 Saga 理念相似,均需要由使用方开发者提供补偿操作。除了补偿,TCC 还提供了资源占用的能力,但也需要由使用方开发者提供资源占用操作。虽然功能上强于 Saga,但 TCC 的使用成本较之 Saga 也更高。 @@ -182,41 +182,41 @@ Saga定义了一个事务中的每个子事务都有一个与之对应的反向 -Apache ShardingSphere(Incubating)采用反向SQL技术,将对数据库进行更新操作的SQL自动生成数据快照以及反向SQL,并交由Apache ServiceComb Saga Actuator执行,使用方则无需再关注如何实现补偿方法,将柔性事务管理器的应用范畴成功的定位回了事务的本源——数据库层面。 +Apache ShardingSphere(Incubating)采用反向 SQL 技术,将对数据库进行更新操作的 SQL 自动生成数据快照以及反向 SQL ,并交由 Apache ServiceComb Saga Actuator 执行,使用方则无需再关注如何实现补偿方法,将柔性事务管理器的应用范畴成功的定位回了事务的本源——数据库层面。 -对于能够处理复杂查询语句的Apache ShardingSphere(Incubating)SQL解析引擎来说,插入/更新/删除等语句解析难度则要小很多;ShardingSphere是通过拦截用户执行的SQL进行数据分片的,所有的SQL都能够被其直接管控。因此将反向SQL和补偿能力与Apache ServiceComb Saga Actuator相结合,达到了自动化柔性事务的能力,是数据分片和柔性事务结合的典范。 +对于能够处理复杂查询语句的 Apache ShardingSphere(Incubating)SQL 解析引擎来说,插入/更新/删除等语句解析难度则要小很多;ShardingSphere 是通过拦截用户执行的 SQL 进行数据分片的,所有的 SQL 都能够被其直接管控。因此将反向 SQL 和补偿能力与 Apache ServiceComb Saga Actuator 相结合,达到了自动化柔性事务的能力,是数据分片和柔性事务结合的典范。 -Saga模块的架构图如下: +Saga 模块的架构图如下: ![](https://shardingsphere.apache.org/blog/img/solution2.jpg) #### 接入端—面向原生事务接口的分布式事务 -Apache ShardingSphere(Incubating)的目标是像使用一个数据库一样使用分片后的多数据库,在事务模块,这个目标依然适用。无论被ShardingSphere所管理的数据库如何分片,面向开发者的逻辑数据库始终只有一个。因此,ShardingSphere的事务接口依然是原生的本地事务接口,即JDBC的java.sql.Connection的setAutoCommit, commit和rollback方法;以及面向数据库事务管理器的begin, commit和rollback语句。在用户调用原生本地事务接口的同时,ShardingSphere则通过sharding-transaction模块保证后端分片数据库的分布式事务。 +Apache ShardingSphere(Incubating)的目标是像使用一个数据库一样使用分片后的多数据库,在事务模块,这个目标依然适用。无论被 ShardingSphere 所管理的数据库如何分片,面向开发者的逻辑数据库始终只有一个。因此,ShardingSphere 的事务接口依然是原生的本地事务接口,即 JDBC 的 java.sql.Connection 的 setAutoCommit, commit 和 rollback 方法;以及面向数据库事务管理器的 begin, commit 和 rollback 语句。在用户调用原生本地事务接口的同时,ShardingSphere 则通过 sharding-transaction 模块保证后端分片数据库的分布式事务。 -由于原生的事务接口并不支持事务类型,因此ShardingSphere提供了3种方式供使用者切换事务类型。 +由于原生的事务接口并不支持事务类型,因此 ShardingSphere 提供了3种方式供使用者切换事务类型。 1.通过 RAL(Resource & Rule Administration Language)切换当前事务类型。以 SQL 执行的方式输入即可,适用于 Sharding-Proxy。例如:SET VARIABLE TRANSACTION_TYPE=BASE -2.通过Threadlocal切换当前事务类型,适用于Sharding-JDBC。例如:TransactionTypeHolder.set (TransactionType.XA) +2.通过 Threadlocal 切换当前事务类型,适用于 Sharding-JDBC。例如:TransactionTypeHolder.set (TransactionType.XA) -3.通过元注解,并与Spring配合使用切换当前事务类型,适用于Sharding-JDBC和Sharding-Proxy。例如:@ShardingTransactionType (TransactionType.BASE) +3.通过元注解,并与 Spring 配合使用切换当前事务类型,适用于 Sharding-JDBC和Sharding-Proxy。例如:@ShardingTransactionType (TransactionType.BASE) ### 线路规划 -分布式事务模块在github的开发分支 [https://github.com/apache/incubator-shardingsphere] 已经基本可用,将随着4.0.0.M1的版本发布,这也将是ShardingSphere进入Apache基金会孵化器之后的第一个发布版本。分布式事务是数据分片以及微服务架构的重要组成部分,也是Apache ShardingSphere(Incubating)的关注重心,发布之后仍将继续完善,线路规划如下。 +分布式事务模块在 github 的开发分支 [https://github.com/apache/incubator-shardingsphere] 已经基本可用,将随着 4.0.0.M1 的版本发布,这也将是 ShardingSphere 进入 Apache 基金会孵化器之后的第一个发布版本。分布式事务是数据分片以及微服务架构的重要组成部分,也是 Apache ShardingSphere(Incubating)的关注重心,发布之后仍将继续完善,线路规划如下。 #### 事务隔离引擎 -在SQL反向引擎稳定之后,柔性事务的重点将放在打造事务隔离之上。由于事务的隔离性并非Saga所规划的范畴,因此Apache ShardingSphere(Incubating)会在Saga之外将其完善,与SQL反向引擎一起作为整个柔性事务的组成部分。 +在 SQL 反向引擎稳定之后,柔性事务的重点将放在打造事务隔离之上。由于事务的隔离性并非 Saga 所规划的范畴,因此Apache ShardingSphere(Incubating)会在 Saga 之外将其完善,与 SQL 反向引擎一起作为整个柔性事务的组成部分。 @@ -224,22 +224,22 @@ Apache ShardingSphere(Incubating)将通过乐观锁、悲观锁、无隔离 #### 对外XA事务接口 -Apache ShardingSphere(Incubating)的两个接入端Sharding-JDBC和Sharding-Proxy在支持自身的内部事务问题之后,将提供融入与其他数据源一起作为被JTA等分布式事务管理器管理的能力。 +Apache ShardingSphere(Incubating)的两个接入端 Sharding-JDBC 和 Sharding-Proxy 在支持自身的内部事务问题之后,将提供融入与其他数据源一起作为被 JTA 等分布式事务管理器管理的能力。 -实现对外XA事务接口之后,Sharding-JDBC的DataSource将实现XADataSource接口,提供与其他数据源共同加入到一个XA事务的可能;Sharding-Proxy的数据库协议也将实现基于XA的两阶段提交协议;使其可以成为被XA所加载的资源管理器。 +实现对外 XA 事务接口之后,Sharding-JDBC 的 DataSource 将实现 XADataSource 接口,提供与其他数据源共同加入到一个 XA 事务的可能;Sharding-Proxy 的数据库协议也将实现基于 XA 的两阶段提交协议;使其可以成为被 XA 所加载的资源管理器。 -除此之外,ShardingSphere还会实现XA协议的recovery部分,即在事务处理器出现崩溃的情况时,可以有能力提供in-doubt transactions来实现事务恢复。 +除此之外,ShardingSphere 还会实现 XA 协议的 recovery 部分,即在事务处理器出现崩溃的情况时,可以有能力提供 in-doubt transactions 来实现事务恢复。 ### 总结 -Apache ShardingSphere(Incubating)提供的分布式事务能力可以通过下表总结一下,读者不妨与文章开始时的表格对比一下,看看ShardingSphere的分布式事务模块所带来的变化。 +Apache ShardingSphere(Incubating)提供的分布式事务能力可以通过下表总结一下,读者不妨与文章开始时的表格对比一下,看看 ShardingSphere 的分布式事务模块所带来的变化。 ![](https://shardingsphere.apache.org/blog/img/solution3.jpg) -在高速发展的Apache ShardingSphere(Incubating)中,分布式事务的雏形已成,我们会尽快将其打造为可用的产品,并持续为社区提供优质解决方案。对于一篇不算短的文章,阅读完此文的您,相信一定对这个领域有一定兴趣。不妨先尝试一下,是否满足您的预期?或者干脆加入我们的社区,一起打造更完善的分布式事务方案。 +在高速发展的 Apache ShardingSphere(Incubating)中,分布式事务的雏形已成,我们会尽快将其打造为可用的产品,并持续为社区提供优质解决方案。对于一篇不算短的文章,阅读完此文的您,相信一定对这个领域有一定兴趣。不妨先尝试一下,是否满足您的预期?或者干脆加入我们的社区,一起打造更完善的分布式事务方案。 diff --git a/docs/build-with-docker.sh b/docs/build-with-docker.sh deleted file mode 100644 index 0df40f155b700..0000000000000 --- a/docs/build-with-docker.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -cd `dirname $0` - -rm -rf target - -mkdir -p target/document/current -cd document -docker run --rm --volume $(pwd):/opt/input docker-hugo:latest -find ../document/public/ -name '*.html' -exec sed -i -e 's|[[:space:]]*