diff --git a/.github/workflows/upgrade_downgrade_test_backups_e2e.yml b/.github/workflows/upgrade_downgrade_test_backups_e2e.yml index b1e0697237d..16170a33c8b 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_e2e.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_e2e.yml @@ -1,4 +1,4 @@ -name: Upgrade Downgrade Testing - Backups - E2E +name: Backups - E2E - Upgrade Downgrade Testing on: push: pull_request: @@ -10,33 +10,10 @@ concurrency: permissions: read-all jobs: - get_previous_release: - if: always() - name: Get Previous Release - Backups - E2E - runs-on: gh-hosted-runners-16cores-1 - outputs: - previous_release: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }} - - steps: - - name: Check out to HEAD - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set output with latest release branch - id: output-previous-release-ref - run: | - previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) - echo $previous_release_ref - echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT - upgrade_downgrade_test_e2e: timeout-minutes: 60 - if: always() && needs.get_previous_release.result == 'success' name: Run Upgrade Downgrade Test - Backups - E2E runs-on: gh-hosted-runners-16cores-1 - needs: - - get_previous_release steps: - name: Skip CI @@ -59,6 +36,16 @@ jobs: - name: Check out commit's code if: steps.skip-workflow.outputs.skip-workflow == 'false' uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set output with latest release branch + if: steps.skip-workflow.outputs.skip-workflow == 'false' + id: output-previous-release-ref + run: | + previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) + echo $previous_release_ref + echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT - name: Check for changes in relevant files if: steps.skip-workflow.outputs.skip-workflow == 'false' @@ -117,11 +104,11 @@ jobs: sudo apt-get install -y percona-xtrabackup-24 # Checkout to the last release of Vitess - - name: Check out other version's code (${{ needs.get_previous_release.outputs.previous_release }}) + - name: Check out other version's code (${{ steps.output-previous-release-ref.outputs.previous_release_ref }}) if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' uses: actions/checkout@v3 with: - ref: ${{ needs.get_previous_release.outputs.previous_release }} + ref: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }} - name: Get dependencies for the last release if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' diff --git a/.github/workflows/upgrade_downgrade_test_backups_e2e_next_release.yml b/.github/workflows/upgrade_downgrade_test_backups_e2e_next_release.yml index 3929e22c536..41f5b40ec1d 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_e2e_next_release.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_e2e_next_release.yml @@ -1,4 +1,4 @@ -name: Upgrade Downgrade Testing - Backups - E2E - Next Release +name: Backups - E2E - Next Release - Upgrade Downgrade Testing on: push: pull_request: @@ -10,33 +10,11 @@ concurrency: permissions: read-all jobs: - get_next_release: - if: always() - name: Get Latest Release - Backups - E2E - Next Release - runs-on: gh-hosted-runners-16cores-1 - outputs: - next_release: ${{ steps.output-next-release-ref.outputs.next_release_ref }} - - steps: - - name: Check out to HEAD - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set output with latest release branch - id: output-next-release-ref - run: | - next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) - echo $next_release_ref - echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT upgrade_downgrade_test_e2e: timeout-minutes: 60 - if: always() && needs.get_next_release.result == 'success' name: Run Upgrade Downgrade Test - Backups - E2E - Next Release runs-on: gh-hosted-runners-16cores-1 - needs: - - get_next_release steps: - name: Skip CI @@ -46,6 +24,18 @@ jobs: exit 1 fi + - name: Check out commit's code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set output with latest release branch + id: output-next-release-ref + run: | + next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) + echo $next_release_ref + echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT + - name: Check if workflow needs to be skipped id: skip-workflow run: | @@ -53,16 +43,12 @@ jobs: if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then skip='true' fi - if [[ "${{needs.get_next_release.outputs.next_release}}" == "" ]]; then + if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then skip='true' fi echo Skip ${skip} echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT - - name: Check out commit's code - if: steps.skip-workflow.outputs.skip-workflow == 'false' - uses: actions/checkout@v3 - - name: Check for changes in relevant files if: steps.skip-workflow.outputs.skip-workflow == 'false' uses: frouioui/paths-filter@main @@ -120,11 +106,11 @@ jobs: sudo apt-get install -y percona-xtrabackup-24 # Checkout to the next release of Vitess - - name: Check out other version's code (${{ needs.get_next_release.outputs.next_release }}) + - name: Check out other version's code (${{ steps.output-next-release-ref.outputs.next_release_ref }}) if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' uses: actions/checkout@v3 with: - ref: ${{ needs.get_next_release.outputs.next_release }} + ref: ${{ steps.output-next-release-ref.outputs.next_release_ref }} - name: Get dependencies for the next release if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' diff --git a/.github/workflows/upgrade_downgrade_test_backups_manual.yml b/.github/workflows/upgrade_downgrade_test_backups_manual.yml index d3d97b60003..6c6ce2d9036 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_manual.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_manual.yml @@ -1,4 +1,4 @@ -name: Upgrade Downgrade Testing - Backups - Manual +name: Backups - Manual - Upgrade Downgrade Testing on: push: pull_request: @@ -10,34 +10,12 @@ concurrency: permissions: read-all jobs: - get_previous_release: - if: always() - name: Get Previous Release - Backups - Manual - runs-on: gh-hosted-runners-16cores-1 - outputs: - previous_release: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }} - - steps: - - name: Check out to HEAD - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set output with latest release branch - id: output-previous-release-ref - run: | - previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) - echo $previous_release_ref - echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT # This job usually execute in ± 20 minutes upgrade_downgrade_test_manual: timeout-minutes: 40 - if: always() && (needs.get_previous_release.result == 'success') name: Run Upgrade Downgrade Test - Backups - Manual runs-on: gh-hosted-runners-16cores-1 - needs: - - get_previous_release steps: - name: Skip CI @@ -61,6 +39,16 @@ jobs: - name: Checkout to commit's code if: steps.skip-workflow.outputs.skip-workflow == 'false' uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set output with latest release branch + id: output-previous-release-ref + if: steps.skip-workflow.outputs.skip-workflow == 'false' + run: | + previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) + echo $previous_release_ref + echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT - name: Check for changes in relevant files if: steps.skip-workflow.outputs.skip-workflow == 'false' @@ -138,11 +126,11 @@ jobs: sudo apt-get install -y percona-xtrabackup-24 # Checkout to the last release of Vitess - - name: Checkout to the other version's code (${{ needs.get_previous_release.outputs.previous_release }}) + - name: Checkout to the other version's code (${{ steps.output-previous-release-ref.outputs.previous_release_ref }}) if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' uses: actions/checkout@v3 with: - ref: ${{ needs.get_previous_release.outputs.previous_release }} + ref: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }} - name: Get dependencies for the last release if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' diff --git a/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml b/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml index cd580be954b..7348b6e516d 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml @@ -1,4 +1,4 @@ -name: Upgrade Downgrade Testing - Backups - Manual - Next Release +name: Backups - Manual - Next Release - Upgrade Downgrade Testing on: push: pull_request: @@ -10,34 +10,12 @@ concurrency: permissions: read-all jobs: - get_next_release: - if: always() - name: Get Previous Release - Backups - Manual - Next Release - runs-on: gh-hosted-runners-16cores-1 - outputs: - next_release: ${{ steps.output-next-release-ref.outputs.next_release_ref }} - - steps: - - name: Check out to HEAD - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set output with latest release branch - id: output-next-release-ref - run: | - next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) - echo $next_release_ref - echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT # This job usually execute in ± 20 minutes upgrade_downgrade_test_manual: timeout-minutes: 40 - if: always() && (needs.get_next_release.result == 'success') name: Run Upgrade Downgrade Test - Backups - Manual - Next Release runs-on: gh-hosted-runners-16cores-1 - needs: - - get_next_release steps: - name: Skip CI @@ -47,6 +25,19 @@ jobs: exit 1 fi + # Checkout to this build's commit + - name: Checkout to commit's code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set output with latest release branch + id: output-next-release-ref + run: | + next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) + echo $next_release_ref + echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT + - name: Check if workflow needs to be skipped id: skip-workflow run: | @@ -54,17 +45,12 @@ jobs: if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then skip='true' fi - if [[ "${{needs.get_next_release.outputs.next_release}}" == "" ]]; then + if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then skip='true' fi echo Skip ${skip} echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT - # Checkout to this build's commit - - name: Checkout to commit's code - if: steps.skip-workflow.outputs.skip-workflow == 'false' - uses: actions/checkout@v3 - - name: Check for changes in relevant files if: steps.skip-workflow.outputs.skip-workflow == 'false' uses: frouioui/paths-filter@main @@ -141,11 +127,11 @@ jobs: sudo apt-get install -y percona-xtrabackup-24 # Checkout to the next release of Vitess - - name: Checkout to the other version's code (${{ needs.get_next_release.outputs.next_release }}) + - name: Checkout to the other version's code (${{ steps.output-next-release-ref.outputs.next_release_ref }}) if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' uses: actions/checkout@v3 with: - ref: ${{ needs.get_next_release.outputs.next_release }} + ref: ${{ steps.output-next-release-ref.outputs.next_release_ref }} - name: Get dependencies for the next release if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' diff --git a/.github/workflows/upgrade_downgrade_test_query_serving_queries.yml b/.github/workflows/upgrade_downgrade_test_query_serving_queries.yml index 486a806796e..9f1d66ddd35 100644 --- a/.github/workflows/upgrade_downgrade_test_query_serving_queries.yml +++ b/.github/workflows/upgrade_downgrade_test_query_serving_queries.yml @@ -1,4 +1,4 @@ -name: Upgrade Downgrade Testing Query Serving (Queries) +name: Query Serving (Queries) - Upgrade Downgrade Testing on: push: pull_request: @@ -13,32 +13,10 @@ permissions: read-all # (vtgate, vttablet, etc) built on different versions. jobs: - get_previous_release: - if: always() - name: Get Previous Release - Query Serving (Queries) - runs-on: gh-hosted-runners-16cores-1 - outputs: - previous_release: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }} - - steps: - - name: Check out to HEAD - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set output with latest release branch - id: output-previous-release-ref - run: | - previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) - echo $previous_release_ref - echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT upgrade_downgrade_test: - if: always() && (needs.get_previous_release.result == 'success') name: Run Upgrade Downgrade Test - Query Serving (Queries) runs-on: gh-hosted-runners-16cores-1 - needs: - - get_previous_release steps: - name: Skip CI @@ -61,6 +39,16 @@ jobs: - name: Check out commit's code if: steps.skip-workflow.outputs.skip-workflow == 'false' uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set output with latest release branch + id: output-previous-release-ref + if: steps.skip-workflow.outputs.skip-workflow == 'false' + run: | + previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) + echo $previous_release_ref + echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT - name: Check for changes in relevant files if: steps.skip-workflow.outputs.skip-workflow == 'false' @@ -135,11 +123,11 @@ jobs: sudo apt-get install -y percona-xtrabackup-24 # Checkout to the last release of Vitess - - name: Check out other version's code (${{ needs.get_previous_release.outputs.previous_release }}) + - name: Check out other version's code (${{ steps.output-previous-release-ref.outputs.previous_release_ref }}) if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' uses: actions/checkout@v3 with: - ref: ${{ needs.get_previous_release.outputs.previous_release }} + ref: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }} - name: Get dependencies for the last release if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' diff --git a/.github/workflows/upgrade_downgrade_test_query_serving_queries_next_release.yml b/.github/workflows/upgrade_downgrade_test_query_serving_queries_next_release.yml index 3a52a551bdc..0031d2c3b15 100644 --- a/.github/workflows/upgrade_downgrade_test_query_serving_queries_next_release.yml +++ b/.github/workflows/upgrade_downgrade_test_query_serving_queries_next_release.yml @@ -1,4 +1,4 @@ -name: Upgrade Downgrade Testing Query Serving (Queries) Next Release +name: Query Serving (Queries) Next Release - Upgrade Downgrade Testing on: push: pull_request: @@ -13,32 +13,10 @@ permissions: read-all # (vtgate, vttablet, etc) built on different versions. jobs: - get_next_release: - if: always() - name: Get Latest Release - Query Serving (Queries) Next Release - runs-on: gh-hosted-runners-16cores-1 - outputs: - next_release: ${{ steps.output-next-release-ref.outputs.next_release_ref }} - - steps: - - name: Check out to HEAD - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set output with latest release branch - id: output-next-release-ref - run: | - next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) - echo $next_release_ref - echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT upgrade_downgrade_test: - if: always() && (needs.get_next_release.result == 'success') name: Run Upgrade Downgrade Test - Query Serving (Queries) Next Release runs-on: gh-hosted-runners-16cores-1 - needs: - - get_next_release steps: - name: Skip CI @@ -48,6 +26,18 @@ jobs: exit 1 fi + - name: Check out commit's code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set output with latest release branch + id: output-next-release-ref + run: | + next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) + echo $next_release_ref + echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT + - name: Check if workflow needs to be skipped id: skip-workflow run: | @@ -55,16 +45,12 @@ jobs: if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then skip='true' fi - if [[ "${{needs.get_next_release.outputs.next_release}}" == "" ]]; then + if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then skip='true' fi echo Skip ${skip} echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT - - name: Check out commit's code - if: steps.skip-workflow.outputs.skip-workflow == 'false' - uses: actions/checkout@v3 - - name: Check for changes in relevant files if: steps.skip-workflow.outputs.skip-workflow == 'false' uses: frouioui/paths-filter@main @@ -138,11 +124,11 @@ jobs: sudo apt-get install -y percona-xtrabackup-24 # Checkout to the next release of Vitess - - name: Check out other version's code (${{ needs.get_next_release.outputs.next_release }}) + - name: Check out other version's code (${{ steps.output-next-release-ref.outputs.next_release_ref }}) if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' uses: actions/checkout@v3 with: - ref: ${{ needs.get_next_release.outputs.next_release }} + ref: ${{ steps.output-next-release-ref.outputs.next_release_ref }} - name: Get dependencies for the next release if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' diff --git a/.github/workflows/upgrade_downgrade_test_query_serving_schema.yml b/.github/workflows/upgrade_downgrade_test_query_serving_schema.yml index 017f65cbaaf..2ed8affaf50 100644 --- a/.github/workflows/upgrade_downgrade_test_query_serving_schema.yml +++ b/.github/workflows/upgrade_downgrade_test_query_serving_schema.yml @@ -1,4 +1,4 @@ -name: Upgrade Downgrade Testing Query Serving (Schema) +name: Query Serving (Schema) - Upgrade Downgrade Testing on: push: pull_request: @@ -13,32 +13,10 @@ permissions: read-all # (vtgate, vttablet, etc) built on different versions. jobs: - get_previous_release: - if: always() - name: Get Previous Release - Query Serving (Schema) - runs-on: gh-hosted-runners-16cores-1 - outputs: - previous_release: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }} - - steps: - - name: Check out to HEAD - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set output with latest release branch - id: output-previous-release-ref - run: | - previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) - echo $previous_release_ref - echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT upgrade_downgrade_test: - if: always() && (needs.get_previous_release.result == 'success') name: Run Upgrade Downgrade Test - Query Serving (Schema) runs-on: gh-hosted-runners-16cores-1 - needs: - - get_previous_release steps: - name: Skip CI @@ -61,6 +39,16 @@ jobs: - name: Check out commit's code if: steps.skip-workflow.outputs.skip-workflow == 'false' uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set output with latest release branch + id: output-previous-release-ref + if: steps.skip-workflow.outputs.skip-workflow == 'false' + run: | + previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) + echo $previous_release_ref + echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT - name: Check for changes in relevant files if: steps.skip-workflow.outputs.skip-workflow == 'false' @@ -135,11 +123,11 @@ jobs: sudo apt-get install -y percona-xtrabackup-24 # Checkout to the last release of Vitess - - name: Check out other version's code (${{ needs.get_previous_release.outputs.previous_release }}) + - name: Check out other version's code (${{ steps.output-previous-release-ref.outputs.previous_release_ref }}) if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' uses: actions/checkout@v3 with: - ref: ${{ needs.get_previous_release.outputs.previous_release }} + ref: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }} - name: Get dependencies for the last release if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' diff --git a/.github/workflows/upgrade_downgrade_test_query_serving_schema_next_release.yml b/.github/workflows/upgrade_downgrade_test_query_serving_schema_next_release.yml index 952e8709da7..40a0b47e0d1 100644 --- a/.github/workflows/upgrade_downgrade_test_query_serving_schema_next_release.yml +++ b/.github/workflows/upgrade_downgrade_test_query_serving_schema_next_release.yml @@ -1,4 +1,4 @@ -name: Upgrade Downgrade Testing Query Serving (Schema) Next Release +name: Query Serving (Schema) Next Release - Upgrade Downgrade Testing on: push: pull_request: @@ -13,32 +13,10 @@ permissions: read-all # (vtgate, vttablet, etc) built on different versions. jobs: - get_next_release: - if: always() - name: Get Latest Release - Query Serving (Schema) Next Release - runs-on: gh-hosted-runners-16cores-1 - outputs: - next_release: ${{ steps.output-next-release-ref.outputs.next_release_ref }} - - steps: - - name: Check out to HEAD - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set output with latest release branch - id: output-next-release-ref - run: | - next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) - echo $next_release_ref - echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT upgrade_downgrade_test: - if: always() && (needs.get_next_release.result == 'success') name: Run Upgrade Downgrade Test - Query Serving (Schema) Next Release runs-on: gh-hosted-runners-16cores-1 - needs: - - get_next_release steps: - name: Skip CI @@ -48,6 +26,18 @@ jobs: exit 1 fi + - name: Check out commit's code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set output with latest release branch + id: output-next-release-ref + run: | + next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) + echo $next_release_ref + echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT + - name: Check if workflow needs to be skipped id: skip-workflow run: | @@ -55,16 +45,12 @@ jobs: if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then skip='true' fi - if [[ "${{needs.get_next_release.outputs.next_release}}" == "" ]]; then + if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then skip='true' fi echo Skip ${skip} echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT - - name: Check out commit's code - if: steps.skip-workflow.outputs.skip-workflow == 'false' - uses: actions/checkout@v3 - - name: Check for changes in relevant files if: steps.skip-workflow.outputs.skip-workflow == 'false' uses: frouioui/paths-filter@main @@ -138,11 +124,11 @@ jobs: sudo apt-get install -y percona-xtrabackup-24 # Checkout to the next release of Vitess - - name: Check out other version's code (${{ needs.get_next_release.outputs.next_release }}) + - name: Check out other version's code (${{ steps.output-next-release-ref.outputs.next_release_ref }}) if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' uses: actions/checkout@v3 with: - ref: ${{ needs.get_next_release.outputs.next_release }} + ref: ${{ steps.output-next-release-ref.outputs.next_release_ref }} - name: Get dependencies for the next release if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' diff --git a/.github/workflows/upgrade_downgrade_test_reparent_new_vtctl.yml b/.github/workflows/upgrade_downgrade_test_reparent_new_vtctl.yml index c305dc91795..671acf0b275 100644 --- a/.github/workflows/upgrade_downgrade_test_reparent_new_vtctl.yml +++ b/.github/workflows/upgrade_downgrade_test_reparent_new_vtctl.yml @@ -1,4 +1,4 @@ -name: Upgrade Downgrade Testing Reparent New Vtctl +name: Reparent New Vtctl - Upgrade Downgrade Testing on: push: pull_request: @@ -13,32 +13,10 @@ permissions: read-all # (vtctl, vttablet, etc) built on different versions. jobs: - get_next_release: - if: always() - name: Get Latest Release - Reparent New Vtctl - runs-on: gh-hosted-runners-16cores-1 - outputs: - next_release: ${{ steps.output-next-release-ref.outputs.next_release_ref }} - - steps: - - name: Check out to HEAD - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set output with latest release branch - id: output-next-release-ref - run: | - next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) - echo $next_release_ref - echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT upgrade_downgrade_test: - if: always() && (needs.get_next_release.result == 'success') name: Run Upgrade Downgrade Test - Reparent New Vtctl runs-on: gh-hosted-runners-16cores-1 - needs: - - get_next_release steps: - name: Skip CI @@ -48,6 +26,18 @@ jobs: exit 1 fi + - name: Check out commit's code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set output with latest release branch + id: output-next-release-ref + run: | + next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) + echo $next_release_ref + echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT + - name: Check if workflow needs to be skipped id: skip-workflow run: | @@ -55,16 +45,12 @@ jobs: if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then skip='true' fi - if [[ "${{needs.get_next_release.outputs.next_release}}" == "" ]]; then + if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then skip='true' fi echo Skip ${skip} echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT - - name: Check out commit's code - if: steps.skip-workflow.outputs.skip-workflow == 'false' - uses: actions/checkout@v3 - - name: Check for changes in relevant files if: steps.skip-workflow.outputs.skip-workflow == 'false' uses: frouioui/paths-filter@main @@ -138,11 +124,11 @@ jobs: sudo apt-get install -y percona-xtrabackup-24 # Checkout to the next release of Vitess - - name: Check out other version's code (${{ needs.get_next_release.outputs.next_release }}) + - name: Check out other version's code (${{ steps.output-next-release-ref.outputs.next_release_ref }}) if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' uses: actions/checkout@v3 with: - ref: ${{ needs.get_next_release.outputs.next_release }} + ref: ${{ steps.output-next-release-ref.outputs.next_release_ref }} - name: Get dependencies for the next release if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' diff --git a/.github/workflows/upgrade_downgrade_test_reparent_new_vttablet.yml b/.github/workflows/upgrade_downgrade_test_reparent_new_vttablet.yml index 8f88bee005c..5455c808d8f 100644 --- a/.github/workflows/upgrade_downgrade_test_reparent_new_vttablet.yml +++ b/.github/workflows/upgrade_downgrade_test_reparent_new_vttablet.yml @@ -1,4 +1,4 @@ -name: Upgrade Downgrade Testing Reparent New VTTablet +name: Reparent New VTTablet - Upgrade Downgrade Testing on: push: pull_request: @@ -13,32 +13,10 @@ permissions: read-all # (vtctl, vttablet, etc) built on different versions. jobs: - get_next_release: - if: always() - name: Get Latest Release - Reparent New VTTablet - runs-on: gh-hosted-runners-16cores-1 - outputs: - next_release: ${{ steps.output-next-release-ref.outputs.next_release_ref }} - - steps: - - name: Check out to HEAD - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set output with latest release branch - id: output-next-release-ref - run: | - next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) - echo $next_release_ref - echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT upgrade_downgrade_test: - if: always() && (needs.get_next_release.result == 'success') name: Run Upgrade Downgrade Test - Reparent New VTTablet runs-on: gh-hosted-runners-16cores-1 - needs: - - get_next_release steps: - name: Skip CI @@ -48,6 +26,18 @@ jobs: exit 1 fi + - name: Check out commit's code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set output with latest release branch + id: output-next-release-ref + run: | + next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) + echo $next_release_ref + echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT + - name: Check if workflow needs to be skipped id: skip-workflow run: | @@ -55,16 +45,12 @@ jobs: if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then skip='true' fi - if [[ "${{needs.get_next_release.outputs.next_release}}" == "" ]]; then + if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then skip='true' fi echo Skip ${skip} echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT - - name: Check out commit's code - if: steps.skip-workflow.outputs.skip-workflow == 'false' - uses: actions/checkout@v3 - - name: Check for changes in relevant files if: steps.skip-workflow.outputs.skip-workflow == 'false' uses: frouioui/paths-filter@main @@ -138,11 +124,11 @@ jobs: sudo apt-get install -y percona-xtrabackup-24 # Checkout to the next release of Vitess - - name: Check out other version's code (${{ needs.get_next_release.outputs.next_release }}) + - name: Check out other version's code (${{ steps.output-next-release-ref.outputs.next_release_ref }}) if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' uses: actions/checkout@v3 with: - ref: ${{ needs.get_next_release.outputs.next_release }} + ref: ${{ steps.output-next-release-ref.outputs.next_release_ref }} - name: Get dependencies for the next release if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' diff --git a/.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml b/.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml index c15f2776a11..44ea01cc7e7 100644 --- a/.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml +++ b/.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml @@ -1,4 +1,4 @@ -name: Upgrade Downgrade Testing Reparent Old Vtctl +name: Reparent Old Vtctl - Upgrade Downgrade Testing on: push: pull_request: @@ -13,32 +13,10 @@ permissions: read-all # (vtctl, vttablet, etc) built on different versions. jobs: - get_previous_release: - if: always() - name: Get Previous Release - Reparent Old Vtctl - runs-on: gh-hosted-runners-16cores-1 - outputs: - previous_release: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }} - - steps: - - name: Check out to HEAD - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set output with latest release branch - id: output-previous-release-ref - run: | - previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) - echo $previous_release_ref - echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT upgrade_downgrade_test: - if: always() && (needs.get_previous_release.result == 'success') name: Run Upgrade Downgrade Test - Reparent Old Vtctl runs-on: gh-hosted-runners-16cores-1 - needs: - - get_previous_release steps: - name: Skip CI @@ -61,6 +39,16 @@ jobs: - name: Check out commit's code if: steps.skip-workflow.outputs.skip-workflow == 'false' uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set output with latest release branch + id: output-previous-release-ref + if: steps.skip-workflow.outputs.skip-workflow == 'false' + run: | + previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) + echo $previous_release_ref + echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT - name: Check for changes in relevant files if: steps.skip-workflow.outputs.skip-workflow == 'false' @@ -135,11 +123,11 @@ jobs: sudo apt-get install -y percona-xtrabackup-24 # Checkout to the last release of Vitess - - name: Check out other version's code (${{ needs.get_previous_release.outputs.previous_release }}) + - name: Check out other version's code (${{ steps.output-previous-release-ref.outputs.previous_release_ref }}) if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' uses: actions/checkout@v3 with: - ref: ${{ needs.get_previous_release.outputs.previous_release }} + ref: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }} - name: Get dependencies for the last release if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' diff --git a/.github/workflows/upgrade_downgrade_test_reparent_old_vttablet.yml b/.github/workflows/upgrade_downgrade_test_reparent_old_vttablet.yml index b2a9aea7c05..21815bc29ab 100644 --- a/.github/workflows/upgrade_downgrade_test_reparent_old_vttablet.yml +++ b/.github/workflows/upgrade_downgrade_test_reparent_old_vttablet.yml @@ -1,4 +1,4 @@ -name: Upgrade Downgrade Testing Reparent Old VTTablet +name: Reparent Old VTTablet - Upgrade Downgrade Testing on: push: pull_request: @@ -13,32 +13,10 @@ permissions: read-all # (vtctl, vttablet, etc) built on different versions. jobs: - get_previous_release: - if: always() - name: Get Previous Release - Reparent Old VTTablet - runs-on: gh-hosted-runners-16cores-1 - outputs: - previous_release: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }} - - steps: - - name: Check out to HEAD - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set output with latest release branch - id: output-previous-release-ref - run: | - previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) - echo $previous_release_ref - echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT upgrade_downgrade_test: - if: always() && (needs.get_previous_release.result == 'success') name: Run Upgrade Downgrade Test - Reparent Old VTTablet runs-on: gh-hosted-runners-16cores-1 - needs: - - get_previous_release steps: - name: Skip CI @@ -61,6 +39,16 @@ jobs: - name: Check out commit's code if: steps.skip-workflow.outputs.skip-workflow == 'false' uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set output with latest release branch + id: output-previous-release-ref + if: steps.skip-workflow.outputs.skip-workflow == 'false' + run: | + previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) + echo $previous_release_ref + echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT - name: Check for changes in relevant files if: steps.skip-workflow.outputs.skip-workflow == 'false' @@ -135,11 +123,11 @@ jobs: sudo apt-get install -y percona-xtrabackup-24 # Checkout to the last release of Vitess - - name: Check out other version's code (${{ needs.get_previous_release.outputs.previous_release }}) + - name: Check out other version's code (${{ steps.output-previous-release-ref.outputs.previous_release_ref }}) if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' uses: actions/checkout@v3 with: - ref: ${{ needs.get_previous_release.outputs.previous_release }} + ref: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }} - name: Get dependencies for the last release if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' diff --git a/go/test/endtoend/vtgate/queries/aggregation/aggregation_test.go b/go/test/endtoend/vtgate/queries/aggregation/aggregation_test.go index e7a55369f8c..8e234063e10 100644 --- a/go/test/endtoend/vtgate/queries/aggregation/aggregation_test.go +++ b/go/test/endtoend/vtgate/queries/aggregation/aggregation_test.go @@ -73,7 +73,10 @@ func TestAggregateTypes(t *testing.T) { mcmp.AssertMatches("select val1 as a, count(*) from aggr_test group by a order by a", `[[VARCHAR("a") INT64(2)] [VARCHAR("b") INT64(1)] [VARCHAR("c") INT64(2)] [VARCHAR("d") INT64(1)] [VARCHAR("e") INT64(2)]]`) mcmp.AssertMatches("select val1 as a, count(*) from aggr_test group by a order by 2, a", `[[VARCHAR("b") INT64(1)] [VARCHAR("d") INT64(1)] [VARCHAR("a") INT64(2)] [VARCHAR("c") INT64(2)] [VARCHAR("e") INT64(2)]]`) mcmp.AssertMatches("select sum(val1) from aggr_test", `[[FLOAT64(0)]]`) - mcmp.AssertMatches("select avg(val1) from aggr_test", `[[FLOAT64(0)]]`) + t.Run("Average for sharded keyspaces", func(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") + mcmp.AssertMatches("select avg(val1) from aggr_test", `[[FLOAT64(0)]]`) + }) } func TestGroupBy(t *testing.T) { @@ -174,11 +177,14 @@ func TestAggrOnJoin(t *testing.T) { mcmp.AssertMatches("select a.val1 from aggr_test a join t3 t on a.val2 = t.id7 group by a.val1 having count(*) = 4", `[[VARCHAR("a")]]`) - mcmp.AssertMatches(`select avg(a1.val2), avg(a2.val2) from aggr_test a1 join aggr_test a2 on a1.val2 = a2.id join t3 t on a2.val2 = t.id7`, - "[[DECIMAL(1.5000) DECIMAL(1.0000)]]") + t.Run("Average in join for sharded", func(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") + mcmp.AssertMatches(`select avg(a1.val2), avg(a2.val2) from aggr_test a1 join aggr_test a2 on a1.val2 = a2.id join t3 t on a2.val2 = t.id7`, + "[[DECIMAL(1.5000) DECIMAL(1.0000)]]") - mcmp.AssertMatches(`select a1.val1, avg(a1.val2) from aggr_test a1 join aggr_test a2 on a1.val2 = a2.id join t3 t on a2.val2 = t.id7 group by a1.val1`, - `[[VARCHAR("a") DECIMAL(1.0000)] [VARCHAR("b") DECIMAL(1.0000)] [VARCHAR("c") DECIMAL(3.0000)]]`) + mcmp.AssertMatches(`select a1.val1, avg(a1.val2) from aggr_test a1 join aggr_test a2 on a1.val2 = a2.id join t3 t on a2.val2 = t.id7 group by a1.val1`, + `[[VARCHAR("a") DECIMAL(1.0000)] [VARCHAR("b") DECIMAL(1.0000)] [VARCHAR("c") DECIMAL(3.0000)]]`) + }) } @@ -327,21 +333,27 @@ func TestAggOnTopOfLimit(t *testing.T) { mcmp.AssertMatches("select count(*) from (select id, val1 from aggr_test where val2 is null limit 2) as x", "[[INT64(2)]]") mcmp.AssertMatches("select count(val1) from (select id, val1 from aggr_test where val2 is null limit 2) as x", "[[INT64(1)]]") mcmp.AssertMatches("select count(val2) from (select id, val2 from aggr_test where val2 is null limit 2) as x", "[[INT64(0)]]") - mcmp.AssertMatches("select avg(val2) from (select id, val2 from aggr_test where val2 is null limit 2) as x", "[[NULL]]") mcmp.AssertMatches("select val1, count(*) from (select id, val1 from aggr_test where val2 < 4 order by val1 limit 2) as x group by val1", `[[NULL INT64(1)] [VARCHAR("a") INT64(1)]]`) mcmp.AssertMatchesNoOrder("select val1, count(val2) from (select val1, val2 from aggr_test limit 8) as x group by val1", `[[NULL INT64(1)] [VARCHAR("a") INT64(2)] [VARCHAR("b") INT64(1)] [VARCHAR("c") INT64(2)]]`) - mcmp.AssertMatchesNoOrder("select val1, avg(val2) from (select val1, val2 from aggr_test limit 8) as x group by val1", `[[NULL DECIMAL(2.0000)] [VARCHAR("a") DECIMAL(3.5000)] [VARCHAR("b") DECIMAL(1.0000)] [VARCHAR("c") DECIMAL(3.5000)]]`) + t.Run("Average in sharded query", func(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") + mcmp.AssertMatches("select avg(val2) from (select id, val2 from aggr_test where val2 is null limit 2) as x", "[[NULL]]") + mcmp.AssertMatchesNoOrder("select val1, avg(val2) from (select val1, val2 from aggr_test limit 8) as x group by val1", `[[NULL DECIMAL(2.0000)] [VARCHAR("a") DECIMAL(3.5000)] [VARCHAR("b") DECIMAL(1.0000)] [VARCHAR("c") DECIMAL(3.5000)]]`) + }) // mysql returns FLOAT64(0), vitess returns DECIMAL(0) - mcmp.AssertMatches("select count(*), sum(val1), avg(val1) from (select id, val1 from aggr_test where val2 < 4 order by val1 desc limit 2) as x", "[[INT64(2) FLOAT64(0) FLOAT64(0)]]") mcmp.AssertMatches("select count(val1), sum(id) from (select id, val1 from aggr_test where val2 < 4 order by val1 desc limit 2) as x", "[[INT64(2) DECIMAL(7)]]") - mcmp.AssertMatches("select count(val1), sum(id), avg(id) from (select id, val1 from aggr_test where val2 < 4 order by val1 desc limit 2) as x", "[[INT64(2) DECIMAL(7) DECIMAL(3.5000)]]") mcmp.AssertMatches("select count(*), sum(id) from (select id, val1 from aggr_test where val2 is null limit 2) as x", "[[INT64(2) DECIMAL(14)]]") mcmp.AssertMatches("select count(val1), sum(id) from (select id, val1 from aggr_test where val2 is null limit 2) as x", "[[INT64(1) DECIMAL(14)]]") mcmp.AssertMatches("select count(val2), sum(val2) from (select id, val2 from aggr_test where val2 is null limit 2) as x", "[[INT64(0) NULL]]") mcmp.AssertMatches("select val1, count(*), sum(id) from (select id, val1 from aggr_test where val2 < 4 order by val1 limit 2) as x group by val1", `[[NULL INT64(1) DECIMAL(7)] [VARCHAR("a") INT64(1) DECIMAL(2)]]`) - mcmp.AssertMatchesNoOrder("select val1, count(val2), sum(val2), avg(val2) from (select val1, val2 from aggr_test limit 8) as x group by val1", - `[[NULL INT64(1) DECIMAL(2) DECIMAL(2.0000)] [VARCHAR("a") INT64(2) DECIMAL(7) DECIMAL(3.5000)] [VARCHAR("b") INT64(1) DECIMAL(1) DECIMAL(1.0000)] [VARCHAR("c") INT64(2) DECIMAL(7) DECIMAL(3.5000)]]`) + t.Run("Average in sharded query", func(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") + mcmp.AssertMatches("select count(*), sum(val1), avg(val1) from (select id, val1 from aggr_test where val2 < 4 order by val1 desc limit 2) as x", "[[INT64(2) FLOAT64(0) FLOAT64(0)]]") + mcmp.AssertMatches("select count(val1), sum(id), avg(id) from (select id, val1 from aggr_test where val2 < 4 order by val1 desc limit 2) as x", "[[INT64(2) DECIMAL(7) DECIMAL(3.5000)]]") + mcmp.AssertMatchesNoOrder("select val1, count(val2), sum(val2), avg(val2) from (select val1, val2 from aggr_test limit 8) as x group by val1", + `[[NULL INT64(1) DECIMAL(2) DECIMAL(2.0000)] [VARCHAR("a") INT64(2) DECIMAL(7) DECIMAL(3.5000)] [VARCHAR("b") INT64(1) DECIMAL(1) DECIMAL(1.0000)] [VARCHAR("c") INT64(2) DECIMAL(7) DECIMAL(3.5000)]]`) + }) }) } } @@ -355,10 +367,13 @@ func TestEmptyTableAggr(t *testing.T) { utils.Exec(t, mcmp.VtConn, fmt.Sprintf("set workload = %s", workload)) mcmp.AssertMatches(" select count(*) from t1 inner join t2 on (t1.t1_id = t2.id) where t1.value = 'foo'", "[[INT64(0)]]") mcmp.AssertMatches(" select count(*) from t2 inner join t1 on (t1.t1_id = t2.id) where t1.value = 'foo'", "[[INT64(0)]]") - mcmp.AssertMatches(" select count(t1.value) from t2 inner join t1 on (t1.t1_id = t2.id) where t1.value = 'foo'", "[[INT64(0)]]") - mcmp.AssertMatches(" select avg(t1.value) from t2 inner join t1 on (t1.t1_id = t2.id) where t1.value = 'foo'", "[[NULL]]") mcmp.AssertMatches(" select t1.`name`, count(*) from t2 inner join t1 on (t1.t1_id = t2.id) where t1.value = 'foo' group by t1.`name`", "[]") mcmp.AssertMatches(" select t1.`name`, count(*) from t1 inner join t2 on (t1.t1_id = t2.id) where t1.value = 'foo' group by t1.`name`", "[]") + t.Run("Average in sharded query", func(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") + mcmp.AssertMatches(" select count(t1.value) from t2 inner join t1 on (t1.t1_id = t2.id) where t1.value = 'foo'", "[[INT64(0)]]") + mcmp.AssertMatches(" select avg(t1.value) from t2 inner join t1 on (t1.t1_id = t2.id) where t1.value = 'foo'", "[[NULL]]") + }) }) } @@ -369,10 +384,13 @@ func TestEmptyTableAggr(t *testing.T) { utils.Exec(t, mcmp.VtConn, fmt.Sprintf("set workload = %s", workload)) mcmp.AssertMatches(" select count(*) from t1 inner join t2 on (t1.t1_id = t2.id) where t1.value = 'foo'", "[[INT64(0)]]") mcmp.AssertMatches(" select count(*) from t2 inner join t1 on (t1.t1_id = t2.id) where t1.value = 'foo'", "[[INT64(0)]]") - mcmp.AssertMatches(" select count(t1.value) from t2 inner join t1 on (t1.t1_id = t2.id) where t1.value = 'foo'", "[[INT64(0)]]") - mcmp.AssertMatches(" select avg(t1.value) from t2 inner join t1 on (t1.t1_id = t2.id) where t1.value = 'foo'", "[[NULL]]") mcmp.AssertMatches(" select t1.`name`, count(*) from t2 inner join t1 on (t1.t1_id = t2.id) where t1.value = 'foo' group by t1.`name`", "[]") - mcmp.AssertMatches(" select t1.`name`, count(*) from t1 inner join t2 on (t1.t1_id = t2.id) where t1.value = 'foo' group by t1.`name`", "[]") + t.Run("Average in sharded query", func(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") + mcmp.AssertMatches(" select count(t1.value) from t2 inner join t1 on (t1.t1_id = t2.id) where t1.value = 'foo'", "[[INT64(0)]]") + mcmp.AssertMatches(" select avg(t1.value) from t2 inner join t1 on (t1.t1_id = t2.id) where t1.value = 'foo'", "[[NULL]]") + mcmp.AssertMatches(" select t1.`name`, count(*) from t1 inner join t2 on (t1.t1_id = t2.id) where t1.value = 'foo' group by t1.`name`", "[]") + }) }) } @@ -414,35 +432,38 @@ func TestAggregateLeftJoin(t *testing.T) { mcmp.AssertMatches("SELECT count(*) FROM t1 LEFT JOIN t2 ON t1.t1_id = t2.id", `[[INT64(2)]]`) mcmp.AssertMatches("SELECT sum(t1.shardkey) FROM t1 LEFT JOIN t2 ON t1.t1_id = t2.id", `[[DECIMAL(1)]]`) mcmp.AssertMatches("SELECT sum(t2.shardkey) FROM t1 LEFT JOIN t2 ON t1.t1_id = t2.id", `[[DECIMAL(1)]]`) - mcmp.AssertMatches("SELECT avg(t1.shardkey) FROM t1 LEFT JOIN t2 ON t1.t1_id = t2.id", `[[DECIMAL(0.5000)]]`) - mcmp.AssertMatches("SELECT avg(t2.shardkey) FROM t1 LEFT JOIN t2 ON t1.t1_id = t2.id", `[[DECIMAL(1.0000)]]`) mcmp.AssertMatches("SELECT count(*) FROM t2 LEFT JOIN t1 ON t1.t1_id = t2.id WHERE IFNULL(t1.name, 'NOTSET') = 'r'", `[[INT64(1)]]`) - aggregations := []string{ - "count(t1.shardkey)", - "count(t2.shardkey)", - "sum(t1.shardkey)", - "sum(t2.shardkey)", - "avg(t1.shardkey)", - "avg(t2.shardkey)", - "count(*)", - } + t.Run("Average in sharded query", func(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") + mcmp.AssertMatches("SELECT avg(t1.shardkey) FROM t1 LEFT JOIN t2 ON t1.t1_id = t2.id", `[[DECIMAL(0.5000)]]`) + mcmp.AssertMatches("SELECT avg(t2.shardkey) FROM t1 LEFT JOIN t2 ON t1.t1_id = t2.id", `[[DECIMAL(1.0000)]]`) + aggregations := []string{ + "count(t1.shardkey)", + "count(t2.shardkey)", + "sum(t1.shardkey)", + "sum(t2.shardkey)", + "avg(t1.shardkey)", + "avg(t2.shardkey)", + "count(*)", + } - grouping := []string{ - "t1.t1_id", - "t1.shardKey", - "t1.value", - "t2.id", - "t2.shardKey", - } + grouping := []string{ + "t1.t1_id", + "t1.shardKey", + "t1.value", + "t2.id", + "t2.shardKey", + } - // quickly construct a big number of left join aggregation queries that have to be executed using the hash join - for _, agg := range aggregations { - for _, gb := range grouping { - query := fmt.Sprintf("SELECT %s FROM t1 LEFT JOIN (select id, shardkey from t2 limit 100) as t2 ON t1.t1_id = t2.id group by %s", agg, gb) - mcmp.Exec(query) + // quickly construct a big number of left join aggregation queries that have to be executed using the hash join + for _, agg := range aggregations { + for _, gb := range grouping { + query := fmt.Sprintf("SELECT %s FROM t1 LEFT JOIN (select id, shardkey from t2 limit 100) as t2 ON t1.t1_id = t2.id group by %s", agg, gb) + mcmp.Exec(query) + } } - } + }) } // TestScalarAggregate tests validates that only count is returned and no additional field is returned.gst @@ -470,7 +491,10 @@ func TestScalarAggregate(t *testing.T) { mcmp.Exec("insert into aggr_test(id, val1, val2) values(1,'a',1), (2,'A',1), (3,'b',1), (4,'c',3), (5,'c',4)") mcmp.AssertMatches("select count(distinct val1) from aggr_test", `[[INT64(3)]]`) - mcmp.AssertMatches("select avg(val1) from aggr_test", `[[FLOAT64(0)]]`) + t.Run("Average in sharded query", func(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") + mcmp.AssertMatches("select avg(val1) from aggr_test", `[[FLOAT64(0)]]`) + }) } func TestAggregationRandomOnAnAggregatedValue(t *testing.T) { @@ -523,11 +547,14 @@ func TestComplexAggregation(t *testing.T) { mcmp.Exec(`SELECT 1+COUNT(t1_id) FROM t1`) mcmp.Exec(`SELECT COUNT(t1_id)+1 FROM t1`) mcmp.Exec(`SELECT COUNT(t1_id)+MAX(shardkey) FROM t1`) - mcmp.Exec(`SELECT COUNT(t1_id)+MAX(shardkey)+AVG(t1_id) FROM t1`) mcmp.Exec(`SELECT shardkey, MIN(t1_id)+MAX(t1_id) FROM t1 GROUP BY shardkey`) mcmp.Exec(`SELECT shardkey + MIN(t1_id)+MAX(t1_id) FROM t1 GROUP BY shardkey`) mcmp.Exec(`SELECT name+COUNT(t1_id)+1 FROM t1 GROUP BY name`) mcmp.Exec(`SELECT COUNT(*)+shardkey+MIN(t1_id)+1+MAX(t1_id)*SUM(t1_id)+1+name FROM t1 GROUP BY shardkey, name`) + t.Run("Average in sharded query", func(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") + mcmp.Exec(`SELECT COUNT(t1_id)+MAX(shardkey)+AVG(t1_id) FROM t1`) + }) } // TestGroupConcatAggregation tests the group_concat function with vitess doing the aggregation. diff --git a/go/test/endtoend/vtgate/queries/derived/cte_test.go b/go/test/endtoend/vtgate/queries/derived/cte_test.go index 677a5dba653..61ddf5d6661 100644 --- a/go/test/endtoend/vtgate/queries/derived/cte_test.go +++ b/go/test/endtoend/vtgate/queries/derived/cte_test.go @@ -18,9 +18,12 @@ package misc import ( "testing" + + "vitess.io/vitess/go/test/endtoend/utils" ) func TestCTEWithOrderByLimit(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") mcmp, closer := start(t) defer closer() @@ -28,6 +31,7 @@ func TestCTEWithOrderByLimit(t *testing.T) { } func TestCTEAggregationOnRHS(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") mcmp, closer := start(t) defer closer() @@ -36,6 +40,7 @@ func TestCTEAggregationOnRHS(t *testing.T) { } func TestCTERemoveInnerOrderBy(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") mcmp, closer := start(t) defer closer() @@ -43,6 +48,7 @@ func TestCTERemoveInnerOrderBy(t *testing.T) { } func TestCTEWithHaving(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") mcmp, closer := start(t) defer closer() @@ -53,6 +59,7 @@ func TestCTEWithHaving(t *testing.T) { } func TestCTEColumns(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") mcmp, closer := start(t) defer closer() diff --git a/go/test/endtoend/vtgate/queries/derived/derived_test.go b/go/test/endtoend/vtgate/queries/derived/derived_test.go index 293dddb355c..80ae36633e1 100644 --- a/go/test/endtoend/vtgate/queries/derived/derived_test.go +++ b/go/test/endtoend/vtgate/queries/derived/derived_test.go @@ -92,6 +92,7 @@ func TestDerivedTableColumns(t *testing.T) { // We do this by not using the apply join we usually use, and instead use the hash join engine primitive // These tests exercise these situations func TestDerivedTablesWithLimit(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") // We need full type info before planning this, so we wait for the schema tracker require.NoError(t, utils.WaitForAuthoritative(t, keyspaceName, "user", clusterInstance.VtgateProcess.ReadVSchema)) diff --git a/go/test/endtoend/vtgate/queries/dml/insert_test.go b/go/test/endtoend/vtgate/queries/dml/insert_test.go index aa34761ee2b..80d0602b898 100644 --- a/go/test/endtoend/vtgate/queries/dml/insert_test.go +++ b/go/test/endtoend/vtgate/queries/dml/insert_test.go @@ -21,7 +21,9 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "vitess.io/vitess/go/test/endtoend/cluster" "vitess.io/vitess/go/test/endtoend/utils" ) @@ -69,10 +71,19 @@ func TestFailureInsertSelect(t *testing.T) { // primary key same mcmp.AssertContainsError("insert into s_tbl(id, num) select id, num*20 from s_tbl where id = 1", `AlreadyExists desc = Duplicate entry '1' for key`) // lookup key same (does not fail on MySQL as there is no lookup, and we have not put unique constraint on num column) - utils.AssertContainsError(t, mcmp.VtConn, "insert into s_tbl(id, num) select id*20, num from s_tbl where id = 1", `(errno 1062) (sqlstate 23000)`) - // mismatch column count - mcmp.AssertContainsError("insert into s_tbl(id, num) select 100,200,300", `column count does not match value count with the row`) - mcmp.AssertContainsError("insert into s_tbl(id, num) select 100", `column count does not match value count with the row`) + vtgateVersion, err := cluster.GetMajorVersion("vtgate") + require.NoError(t, err) + if vtgateVersion >= 19 { + utils.AssertContainsError(t, mcmp.VtConn, "insert into s_tbl(id, num) select id*20, num from s_tbl where id = 1", `(errno 1062) (sqlstate 23000)`) + // mismatch column count + mcmp.AssertContainsError("insert into s_tbl(id, num) select 100,200,300", `column count does not match value count with the row`) + mcmp.AssertContainsError("insert into s_tbl(id, num) select 100", `column count does not match value count with the row`) + } else { + utils.AssertContainsError(t, mcmp.VtConn, "insert into s_tbl(id, num) select id*20, num from s_tbl where id = 1", `lookup.Create: Code: ALREADY_EXISTS`) + // mismatch column count + mcmp.AssertContainsError("insert into s_tbl(id, num) select 100,200,300", `column count does not match value count at row 1`) + mcmp.AssertContainsError("insert into s_tbl(id, num) select 100", `column count does not match value count at row 1`) + } }) } } diff --git a/go/test/endtoend/vtgate/queries/informationschema/informationschema_test.go b/go/test/endtoend/vtgate/queries/informationschema/informationschema_test.go index 0be8a50b328..4ae5432bc81 100644 --- a/go/test/endtoend/vtgate/queries/informationschema/informationschema_test.go +++ b/go/test/endtoend/vtgate/queries/informationschema/informationschema_test.go @@ -223,6 +223,7 @@ func TestInfrSchemaAndUnionAll(t *testing.T) { } func TestTypeORMQuery(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") // This test checks that we can run queries similar to the ones that the TypeORM framework uses require.NoError(t, @@ -259,6 +260,7 @@ FROM (SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME } func TestJoinWithSingleShardQueryOnRHS(t *testing.T) { + utils.SkipIfBinaryIsBelowVersion(t, 19, "vtgate") // This test checks that we can run queries like this, where the RHS is a single shard query mcmp, closer := start(t) defer closer() diff --git a/go/test/endtoend/vtgate/queries/misc/misc_test.go b/go/test/endtoend/vtgate/queries/misc/misc_test.go index 0fdee1b88a1..465b0adf883 100644 --- a/go/test/endtoend/vtgate/queries/misc/misc_test.go +++ b/go/test/endtoend/vtgate/queries/misc/misc_test.go @@ -59,8 +59,25 @@ func TestBitVals(t *testing.T) { mcmp.AssertMatches(`select b'1001', 0x9, B'010011011010'`, `[[VARBINARY("\t") VARBINARY("\t") VARBINARY("\x04\xda")]]`) mcmp.AssertMatches(`select b'1001', 0x9, B'010011011010' from t1`, `[[VARBINARY("\t") VARBINARY("\t") VARBINARY("\x04\xda")]]`) - mcmp.AssertMatchesNoCompare(`select 1 + b'1001', 2 + 0x9, 3 + B'010011011010'`, `[[INT64(10) UINT64(11) INT64(1245)]]`, `[[INT64(10) UINT64(11) INT64(1245)]]`) - mcmp.AssertMatchesNoCompare(`select 1 + b'1001', 2 + 0x9, 3 + B'010011011010' from t1`, `[[INT64(10) UINT64(11) INT64(1245)]]`, `[[INT64(10) UINT64(11) INT64(1245)]]`) + vtgateVersion, err := cluster.GetMajorVersion("vtgate") + require.NoError(t, err) + if vtgateVersion >= 19 { + mcmp.AssertMatchesNoCompare(`select 1 + b'1001', 2 + 0x9, 3 + B'010011011010'`, `[[INT64(10) UINT64(11) INT64(1245)]]`, `[[INT64(10) UINT64(11) INT64(1245)]]`) + mcmp.AssertMatchesNoCompare(`select 1 + b'1001', 2 + 0x9, 3 + B'010011011010' from t1`, `[[INT64(10) UINT64(11) INT64(1245)]]`, `[[INT64(10) UINT64(11) INT64(1245)]]`) + } else { + mcmp.AssertMatchesNoCompare(`select 1 + b'1001', 2 + 0x9, 3 + B'010011011010'`, `[[INT64(10) UINT64(11) INT64(1245)]]`, `[[UINT64(10) UINT64(11) UINT64(1245)]]`) + mcmp.AssertMatchesNoCompare(`select 1 + b'1001', 2 + 0x9, 3 + B'010011011010' from t1`, `[[INT64(10) UINT64(11) INT64(1245)]]`, `[[UINT64(10) UINT64(11) UINT64(1245)]]`) + } +} + +// TestTimeFunctionWithPrecision tests that inserting data with NOW(1) works as intended. +func TestTimeFunctionWithPrecision(t *testing.T) { + mcmp, closer := start(t) + defer closer() + + mcmp.Exec("insert into t1(id1, id2) values (1, NOW(1))") + mcmp.Exec("insert into t1(id1, id2) values (2, NOW(2))") + mcmp.Exec("insert into t1(id1, id2) values (3, NOW())") } func TestHexVals(t *testing.T) { diff --git a/go/test/endtoend/vtgate/queries/normalize/normalize_test.go b/go/test/endtoend/vtgate/queries/normalize/normalize_test.go index b6495443a8e..735a26fc00c 100644 --- a/go/test/endtoend/vtgate/queries/normalize/normalize_test.go +++ b/go/test/endtoend/vtgate/queries/normalize/normalize_test.go @@ -28,6 +28,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "vitess.io/vitess/go/test/endtoend/cluster" "vitess.io/vitess/go/test/endtoend/utils" "vitess.io/vitess/go/mysql" @@ -40,6 +41,11 @@ func TestNormalizeAllFields(t *testing.T) { insertQuery := `insert into t1 values (1, "chars", "variable chars", x'73757265', 0x676F, 0.33, 9.99, 1, "1976-06-08", "small", "b", "{\"key\":\"value\"}", point(1,5), b'011', 0b0101)` normalizedInsertQuery := `insert into t1 values (:vtg1 /* INT64 */, :vtg2 /* VARCHAR */, :vtg3 /* VARCHAR */, :vtg4 /* HEXVAL */, :vtg5 /* HEXNUM */, :vtg6 /* DECIMAL */, :vtg7 /* DECIMAL */, :vtg8 /* INT64 */, :vtg9 /* VARCHAR */, :vtg10 /* VARCHAR */, :vtg11 /* VARCHAR */, :vtg12 /* VARCHAR */, point(:vtg13 /* INT64 */, :vtg14 /* INT64 */), :vtg15 /* BITNUM */, :vtg16 /* BITNUM */)` + vtgateVersion, err := cluster.GetMajorVersion("vtgate") + require.NoError(t, err) + if vtgateVersion < 19 { + normalizedInsertQuery = `insert into t1 values (:vtg1 /* INT64 */, :vtg2 /* VARCHAR */, :vtg3 /* VARCHAR */, :vtg4 /* HEXVAL */, :vtg5 /* HEXNUM */, :vtg6 /* DECIMAL */, :vtg7 /* DECIMAL */, :vtg8 /* INT64 */, :vtg9 /* VARCHAR */, :vtg10 /* VARCHAR */, :vtg11 /* VARCHAR */, :vtg12 /* VARCHAR */, point(:vtg13 /* INT64 */, :vtg14 /* INT64 */), :vtg15 /* HEXNUM */, :vtg16 /* HEXNUM */)` + } selectQuery := "select * from t1" utils.Exec(t, conn, insertQuery) qr := utils.Exec(t, conn, selectQuery) diff --git a/test/config.json b/test/config.json index 7aafcaf1a80..cc68301a052 100644 --- a/test/config.json +++ b/test/config.json @@ -507,7 +507,7 @@ "Manual": false, "Shard": "vtgate_queries", "RetryMax": 1, - "Tags": [] + "Tags": ["upgrade_downgrade_query_serving_queries"] }, "vtgate_queries_aggregation": { "File": "unused.go", @@ -516,7 +516,7 @@ "Manual": false, "Shard": "vtgate_queries", "RetryMax": 2, - "Tags": [] + "Tags": ["upgrade_downgrade_query_serving_queries"] }, "vtgate_queries_foundrows": { "File": "unused.go", @@ -525,7 +525,7 @@ "Manual": false, "Shard": "vtgate_queries", "RetryMax": 2, - "Tags": [] + "Tags": ["upgrade_downgrade_query_serving_queries"] }, "vtgate_queries_informationschema": { "File": "unused.go", @@ -534,7 +534,7 @@ "Manual": false, "Shard": "vtgate_queries", "RetryMax": 2, - "Tags": [] + "Tags": ["upgrade_downgrade_query_serving_queries"] }, "vtgate_queries_misc": { "File": "unused.go", @@ -543,7 +543,7 @@ "Manual": false, "Shard": "vtgate_queries", "RetryMax": 1, - "Tags": [] + "Tags": ["upgrade_downgrade_query_serving_queries"] }, "vtgate_queries_timeout": { "File": "unused.go", @@ -552,7 +552,7 @@ "Manual": false, "Shard": "vtgate_queries", "RetryMax": 1, - "Tags": [] + "Tags": ["upgrade_downgrade_query_serving_queries"] }, "vtgate_queries_normalize": { "File": "unused.go", @@ -561,7 +561,7 @@ "Manual": false, "Shard": "vtgate_queries", "RetryMax": 2, - "Tags": [] + "Tags": ["upgrade_downgrade_query_serving_queries"] }, "vtgate_queries_no_scatter": { "File": "unused.go", @@ -570,7 +570,7 @@ "Manual": false, "Shard": "vtgate_queries", "RetryMax": 1, - "Tags": [] + "Tags": ["upgrade_downgrade_query_serving_queries"] }, "vtgate_queries_orderby": { "File": "unused.go", @@ -606,7 +606,7 @@ "Manual": false, "Shard": "vtgate_queries", "RetryMax": 2, - "Tags": [] + "Tags": ["upgrade_downgrade_query_serving_queries"] }, "vtgate_queries_vexplain": { "File": "unused.go", @@ -615,7 +615,7 @@ "Manual": false, "Shard": "vtgate_queries", "RetryMax": 2, - "Tags": [] + "Tags": ["upgrade_downgrade_query_serving_queries"] }, "vtgate_queries_reference": { "File": "unused.go", @@ -624,7 +624,7 @@ "Manual": false, "Shard": "vtgate_queries", "RetryMax": 1, - "Tags": [] + "Tags": ["upgrade_downgrade_query_serving_queries"] }, "vtgate_queries_random": { "File": "unused.go", @@ -633,7 +633,7 @@ "Manual": false, "Shard": "vtgate_queries", "RetryMax": 1, - "Tags": [] + "Tags": ["upgrade_downgrade_query_serving_queries"] }, "vtgate_kill": { "File": "unused.go", @@ -642,7 +642,7 @@ "Manual": false, "Shard": "vtgate_queries", "RetryMax": 1, - "Tags": [] + "Tags": ["upgrade_downgrade_query_serving_queries"] }, "vtgate_concurrentdml": { "File": "unused.go",