diff --git a/.circleci/config.yml b/.circleci/config.yml
index f3dd5a5a8e53..a2bb1ddade4a 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -18,7 +18,7 @@ jobs:
UBUNTU_CODE_NAME="noble"
BASE_OWNER="percona"
BASE_REPO="percona-server"
- BASE_BRANCH="trunk"
+ BASE_BRANCH="9.7"
COMPILER_VERSION="19"
sudo -E apt-get -yq update >> ~/apt-get-update.log 2>&1
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 000000000000..e75fb32a8dad
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,4 @@
+# Copyright (c) 2026, Oracle and/or its affiliates.
+# Temporary default owners for every path. Replace this wildcard with
+# path-specific teams as the external committer model rolls out.
+* @seemasundara @gopshank
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 000000000000..22c468546dc0
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,35 @@
+# Copyright (c) 2026, Oracle and/or its affiliates.
+name: Bug report
+description: Report incorrect or unexpected server behavior
+labels: ["bug", "needs-triage"]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Security vulnerabilities must **not** be filed here. Report them through
+ .
+ - type: input
+ id: version
+ attributes:
+ label: MySQL version / commit
+ placeholder: "9.x trunk @ , or 8.4.x"
+ validations: { required: true }
+ - type: textarea
+ id: repro
+ attributes:
+ label: Steps to reproduce
+ description: Minimal SQL or MTR case if possible.
+ placeholder: |
+ CREATE TABLE t (...);
+ ...
+ validations: { required: true }
+ - type: textarea
+ id: expected
+ attributes:
+ label: Expected vs actual result
+ validations: { required: true }
+ - type: input
+ id: platform
+ attributes:
+ label: Platform / compiler
+ placeholder: "Ubuntu 24.04, gcc 13"
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 000000000000..e84e04ac75b7
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,15 @@
+# Copyright (c) 2026, Oracle and/or its affiliates.
+name: Feature request
+description: Propose an enhancement
+labels: ["feature-request", "needs-triage"]
+body:
+ - type: textarea
+ id: problem
+ attributes:
+ label: Problem / use case
+ validations: { required: true }
+ - type: textarea
+ id: proposal
+ attributes:
+ label: Proposed behavior
+ validations: { required: true }
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 000000000000..15304501273f
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,36 @@
+# Copyright (c) 2026, Oracle and/or its affiliates.
+
+
+### What does this change do?
+
+
+
+### Why is it needed?
+
+### How was it tested?
+
+- [ ] Added/updated MTR tests under `mysql-test/`
+- [ ] `scripts/ci/mtr.sh` passes locally
+- [ ] Ran the relevant full suite (name it): ______
+
+### Contributor checklist
+
+- [ ] I have signed the [OCA](https://oca.opensource.oracle.com) with the email on these commits
+- [ ] Code is formatted (`scripts/ci/format.sh`)
+- [ ] Commits are focused with descriptive messages
+
+### AI assistance
+
+- [ ] I did not use AI assistance for this contribution
+- [ ] I used AI assistance for this contribution
+
+If AI assistance was used, describe the tool(s) and extent of use:
+
+
+
+### Areas touched
+
+
diff --git a/.github/labeler.yml b/.github/labeler.yml
new file mode 100644
index 000000000000..10e592913d37
--- /dev/null
+++ b/.github/labeler.yml
@@ -0,0 +1,55 @@
+# Copyright (c) 2026, Oracle and/or its affiliates.
+# Area auto-labels, driven by the paths a PR touches. Keeps triage cheap and
+# routes reviews to the right owners (see CODEOWNERS).
+#
+# Format note: actions/labeler@v5 requires the `changed-files` /
+# `any-glob-to-any-file` structure below. The older flat "label: [globs]"
+# layout (v4) is NOT compatible with v5 and fails to parse.
+
+"innodb":
+ - changed-files:
+ - any-glob-to-any-file: ["storage/innobase/**"]
+
+"optimizer":
+ - changed-files:
+ - any-glob-to-any-file:
+ - "sql/join_optimizer/**"
+ - "sql/sql_optimizer*"
+ - "sql/range_optimizer/**"
+
+"replication":
+ - changed-files:
+ - any-glob-to-any-file:
+ - "sql/rpl_*"
+ - "libbinlogevents/**"
+ - "plugin/group_replication/**"
+
+"client":
+ - changed-files:
+ - any-glob-to-any-file:
+ - "client/**"
+ - "libmysql/**"
+
+"pluggable":
+ - changed-files:
+ - any-glob-to-any-file:
+ - "plugin/**"
+ - "components/**"
+
+"build":
+ - changed-files:
+ - any-glob-to-any-file:
+ - "cmake/**"
+ - "CMakeLists.txt"
+ - "scripts/ci/**"
+ - ".github/**"
+
+"tests":
+ - changed-files:
+ - any-glob-to-any-file: ["mysql-test/**"]
+
+"docs":
+ - changed-files:
+ - any-glob-to-any-file:
+ - "docs/**"
+ - "**/*.md"
diff --git a/.github/workflows/assign-codeowners.yml b/.github/workflows/assign-codeowners.yml
new file mode 100644
index 000000000000..fc3b5949fbc1
--- /dev/null
+++ b/.github/workflows/assign-codeowners.yml
@@ -0,0 +1,116 @@
+# Copyright (c) 2026, Oracle and/or its affiliates.
+name: Assign Code Owners
+
+on:
+ pull_request_target:
+ types: [opened, synchronize, reopened, ready_for_review, labeled]
+ branches: [trunk]
+
+permissions:
+ contents: read
+ issues: write
+ pull-requests: write
+
+concurrency:
+ group: assign-codeowners-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+jobs:
+ assign:
+ if: ${{ !github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'OCA Verified') }}
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Request review from code owners
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const pr = context.payload.pull_request;
+ const codeownersRef = pr.base.sha;
+ const path = '.github/CODEOWNERS';
+
+ const response = await github.rest.repos.getContent({
+ ...context.repo,
+ path,
+ ref: codeownersRef,
+ });
+ if (Array.isArray(response.data) || response.data.type !== 'file' || !response.data.content) {
+ throw new Error(`${path} at ${codeownersRef} is not a readable file`);
+ }
+
+ const codeowners = Buffer.from(response.data.content, 'base64').toString('utf8');
+ const defaultLine = codeowners
+ .split(/\r?\n/)
+ .map((line) => line.replace(/\s+#.*$/, '').trim())
+ .find((line) => line && !line.startsWith('#') && line.split(/\s+/)[0] === '*');
+ if (!defaultLine) {
+ throw new Error(`No wildcard owner rule found in ${path} at ${codeownersRef}`);
+ }
+
+ const owners = [...new Set(
+ defaultLine
+ .split(/\s+/)
+ .slice(1)
+ .filter((owner) => owner.startsWith('@'))
+ .map((owner) => owner.slice(1))
+ .filter(Boolean),
+ )];
+ if (owners.length === 0) {
+ throw new Error(`Wildcard rule in ${path} has no GitHub user owners`);
+ }
+
+ const current = await github.rest.pulls.get({
+ ...context.repo,
+ pull_number: pr.number,
+ });
+ const author = pr.user.login.toLowerCase();
+ const existing = new Set(
+ current.data.requested_reviewers.map((reviewer) => reviewer.login.toLowerCase()),
+ );
+ const eligible = owners.filter((owner) => owner.toLowerCase() !== author);
+ if (eligible.length === 0) {
+ throw new Error('No eligible code owners remain after excluding the pull request author');
+ }
+
+ const reviewers = eligible.filter((owner) => !existing.has(owner.toLowerCase()));
+ let reviewRequestSucceeded = reviewers.length === 0;
+ if (reviewers.length > 0) {
+ try {
+ await github.rest.pulls.requestReviewers({
+ ...context.repo,
+ pull_number: pr.number,
+ reviewers,
+ });
+ reviewRequestSucceeded = true;
+ } catch (error) {
+ // Forks can retain upstream owners that are not collaborators.
+ // Keep the automation informational in that case.
+ if (error.status !== 422) throw error;
+ core.warning(`Could not request reviews: ${error.message}`);
+ }
+ }
+
+ if (!reviewRequestSucceeded) {
+ core.info('Skipping the review-request label because no reviewer was assigned.');
+ return;
+ }
+
+ const label = {
+ name: 'Review Requested',
+ color: '1D76DB',
+ description: 'Review requested from code owners',
+ };
+ try {
+ await github.rest.issues.getLabel({ ...context.repo, name: label.name });
+ await github.rest.issues.updateLabel({ ...context.repo, ...label });
+ } catch (error) {
+ if (error.status !== 404) throw error;
+ await github.rest.issues.createLabel({ ...context.repo, ...label });
+ }
+ await github.rest.issues.addLabels({
+ ...context.repo,
+ issue_number: pr.number,
+ labels: [label.name],
+ });
+
+ const assigned = reviewers.length > 0 ? reviewers : eligible;
+ core.info(`Review requested from ${assigned.map((owner) => `@${owner}`).join(', ')}.`);
diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml
new file mode 100644
index 000000000000..9b15f58ccd80
--- /dev/null
+++ b/.github/workflows/builds.yml
@@ -0,0 +1,1198 @@
+# PS-11078: GitHub Actions build for percona-server 9.7 on Hetzner cax* arm64.
+# Replaces the Cirrus arm64 tasks before Cirrus shuts down 2026-06-01.
+#
+# PS-11179 (2026-05-28): AWS Graviton fallback path added. Hetzner remains the
+# primary provider; if the cax41/cax31/cax21 sweep across fsn1/hel1/nbg1 fails
+# repeatedly, pick-target switches provider to "aws" and create-runner-aws
+# provisions a c7g.4xlarge Graviton3 spot (with on-demand fallback) in
+# eu-central-1. Build steps are unchanged; only the runner provisioning path
+# branches.
+#
+# One file, three event paths (BUILD_TYPE + MTR_SUITE picked by `dispatch` job):
+# - pull_request to 9.7 -> Debug + MTR main.1st (same-repo PRs; Cirrus per-PR replacement)
+# - pull_request_target to 9.7 -> Debug + MTR main.1st (PS-11254: fork PRs by percona org members only)
+# - workflow_dispatch -> manual run OR nightly (build_type RelWithDebInfo -> binlog_nogtid)
+#
+# Nightly RelWithDebInfo + binlog_nogtid is NOT a `schedule:` trigger here:
+# GHA cron only fires from the DEFAULT branch, so a cron in this file would be
+# dead on 9.7 (a non-default branch). Instead .github/workflows/
+# builds-nightly.yml lives on the default branch and dispatches THIS file via
+# workflow_dispatch --ref on each maintained branch, so each nightly runs that
+# branch's own self-contained builds.yml (its boost version, cmake/apt deltas).
+#
+# Notes for follow-ups (per Przemek DM 2026-05-27):
+# - x86_64 nightly RelWithDebInfo can be added as a sibling job reusing the
+# `dispatch` outputs (BUILD_TYPE / MTR_SUITE / CCACHE_MAXSIZE). Intentionally
+# not wired in this PR per "we may do it, let's see how arm64 behaves first".
+#
+# Trust split: pick-target / create-runner-* / delete-runner-* hold infra
+# secrets (GHA_RUNNER_HCLOUD_TOKEN, GHA_RUNNER_PAT, AWS_ROLE_ARN via OIDC).
+# The build-arm64 job runs on the ephemeral runner (Hetzner OR EC2) and only
+# sees GITHUB_TOKEN (read-only), so PR code never reaches infra credentials.
+#
+# PS-11254: fork PRs run via pull_request_target so the provisioning jobs
+# resolve secrets in base-repo context. This is safe ONLY because the
+# secret-bearing jobs do NO checkout; build-arm64 is the sole job that checks
+# out PR code, and it holds no secrets. The `dispatch` gate limits
+# pull_request_target to fork PRs whose author is a percona org member
+# (author_association MEMBER/OWNER/COLLABORATOR). INVARIANT: never add a PR-code
+# checkout to a secret-bearing job.
+
+name: builds
+
+on:
+ workflow_dispatch:
+ inputs:
+ build_type:
+ description: 'Build type'
+ type: choice
+ options:
+ - Debug
+ - RelWithDebInfo
+ default: Debug
+ debug_keep_vm:
+ description: 'On create-runner failure: keep Hetzner VM alive so you can SSH in and grab /var/log/cloud-init-output.log + /actions-runner/_diag/* manually. SSH as root using key 107239874 (anderson@percona). Remember to delete the VM when done. (Hetzner path only; EC2 fallback always terminates.)'
+ type: boolean
+ default: false
+ force_provider:
+ description: 'Override provider selection (debug + cost benchmarking). "auto" = Hetzner with EC2 fallback (default, production behavior). "hetzner" = Hetzner only, fail if exhausted (no AWS spend). "aws" = skip Hetzner, go straight to EC2 (validate AWS path on demand without waiting for a real Hetzner outage).'
+ type: choice
+ options:
+ - auto
+ - hetzner
+ - aws
+ default: auto
+ pull_request:
+ branches: [9.7]
+ paths-ignore:
+ # Mirrors azure-pipelines.yml `paths.exclude`.
+ - 'doc/**'
+ - 'build-ps/**'
+ - 'man/**'
+ - 'mysql-test/**'
+ - 'packaging/**'
+ - 'policy/**'
+ - 'scripts/**'
+ - 'support-files/**'
+ pull_request_target:
+ # PS-11254: fork PRs get no secrets on `pull_request` (GitHub withholds
+ # them from forks), so org-member fork PRs run here in base-repo context,
+ # gated by `dispatch` below. Same-repo PRs stay on `pull_request`.
+ branches: [9.7]
+ paths-ignore:
+ - 'doc/**'
+ - 'build-ps/**'
+ - 'man/**'
+ - 'mysql-test/**'
+ - 'packaging/**'
+ - 'policy/**'
+ - 'scripts/**'
+ - 'support-files/**'
+
+concurrency:
+ # PR runs (pull_request + pull_request_target) are cancellable so superseded
+ # pushes do not waste Hetzner cycles; workflow_dispatch runs (including the
+ # nightly dispatched from the default branch) stay protected
+ # (cancel-in-progress: false) because they bill paid arm64 minutes.
+ # event_name is in the key so a fork PR's (skipped) pull_request run and its
+ # real pull_request_target run do not share a group.
+ group: build-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
+
+# Workflow-level permissions are minimal (contents: read) to limit blast
+# radius for any future jobs added here. The id-token: write grant required
+# for OIDC -> AWS STS federation lives only on the two jobs that actually
+# use it (create-runner-aws, delete-runner-aws). build-arm64 runs untrusted
+# PR code on the ephemeral runner and intentionally does not get id-token.
+permissions:
+ contents: read
+
+env:
+ PARENT_BRANCH: '9.7'
+ BUILD_PARAMS_TYPE: normal
+ COMPILER: gcc
+ COMPILER_VER: ''
+ IMAGE_NAME: ubuntu-26.04
+ UBUNTU_CODE_NAME: resolute
+ BOOST_VERSION: boost_1_87_0
+ USE_CCACHE: '1'
+ CCACHE_COMPRESS: '1'
+ CCACHE_COMPRESSLEVEL: '9'
+ CCACHE_CPP2: '1'
+ IMAGE: ubuntu-26.04
+ SSH_KEY_ID: '107239874'
+ EPHEMERAL_RUNNER_NAME: ps-arm64-${{ github.run_id }}-${{ github.run_attempt }}
+ # PS-11179: EC2 fallback knobs. eu-central-1 chosen to match the existing
+ # Jenkins eu-central-1 footprint (low latency to EU contributors, no new
+ # cross-region S3/ECR traffic for boost / ccache restore). c7g.4xlarge gives
+ # 16 vCPU + 32 GB Graviton3, which is parity with the cax41 default.
+ AWS_REGION: eu-central-1
+ AWS_INSTANCE_TYPE: c7g.4xlarge
+
+jobs:
+ # TRUSTED authorization gate (PS-11254). Root of the job graph: dispatch
+ # needs it and every other job chains off dispatch, so gating here gates the
+ # whole run.
+ # - schedule / workflow_dispatch: always
+ # - pull_request: same-repo PRs only (forks get no secrets on this event)
+ # - pull_request_target: fork PRs only, authorized when the PR author has
+ # write+ access to the repo. author_association is deliberately NOT used:
+ # its value in the event payload is CONTRIBUTOR for PRIVATE percona org
+ # members, so it would wrongly reject them. The repo-permission API call
+ # via GHA_RUNNER_PAT is reliable (empirically confirmed: members resolve
+ # to write, non-collaborators to read on this public repo). This job does
+ # no checkout and runs in base-repo context, so the trust split holds.
+ authorize:
+ runs-on: ubuntu-latest
+ permissions: {}
+ outputs:
+ ok: ${{ steps.gate.outputs.ok }}
+ steps:
+ - id: gate
+ env:
+ GH_TOKEN: ${{ secrets.GHA_RUNNER_PAT }}
+ EVENT: ${{ github.event_name }}
+ HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
+ BASE_REPO: ${{ github.repository }}
+ AUTHOR: ${{ github.event.pull_request.user.login }}
+ run: |
+ set -u
+ ok=false
+ case "$EVENT" in
+ schedule|workflow_dispatch)
+ ok=true ;;
+ pull_request)
+ [ "$HEAD_REPO" = "$BASE_REPO" ] && ok=true ;;
+ pull_request_target)
+ if [ "$HEAD_REPO" != "$BASE_REPO" ]; then
+ perm=$(curl -s -H "Authorization: Bearer $GH_TOKEN" \
+ -H "Accept: application/vnd.github+json" \
+ "https://api.github.com/repos/$BASE_REPO/collaborators/$AUTHOR/permission" \
+ | jq -r '.permission // "none"' 2>/dev/null || echo none)
+ case "$perm" in admin|maintain|write) ok=true ;; esac
+ echo "::notice::fork PR by $AUTHOR; repo permission=$perm -> authorized=$ok"
+ fi ;;
+ esac
+ echo "ok=$ok" >> "$GITHUB_OUTPUT"
+
+ # TRUSTED. Pick BUILD_TYPE + MTR suite + cache size based on event.
+ dispatch:
+ needs: authorize
+ if: needs.authorize.outputs.ok == 'true'
+ runs-on: ubuntu-latest
+ permissions: {}
+ outputs:
+ build_type: ${{ steps.pick.outputs.build_type }}
+ mtr_suite: ${{ steps.pick.outputs.mtr_suite }}
+ ccache_maxsize: ${{ steps.pick.outputs.ccache_maxsize }}
+ steps:
+ - id: pick
+ run: |
+ set -eu
+ case "${{ github.event_name }}" in
+ pull_request|pull_request_target)
+ BT=Debug; SUITE=main.1st; CACHE=4G
+ ;;
+ workflow_dispatch)
+ # Manual runs AND the nightly dispatcher (builds-nightly.yml on
+ # the default branch) land here. build_type=RelWithDebInfo ->
+ # binlog_nogtid (Cirrus nightly parity, Przemek 2026-05-18);
+ # build_type=Debug -> main.1st.
+ BT="${{ inputs.build_type }}"
+ if [ "$BT" = "Debug" ]; then
+ SUITE=main.1st; CACHE=4G
+ else
+ SUITE=binlog_nogtid; CACHE=8G
+ fi
+ ;;
+ esac
+ echo "Event ${{ github.event_name }} -> BUILD_TYPE=$BT, MTR=$SUITE, CCACHE_MAXSIZE=$CACHE" >> "$GITHUB_STEP_SUMMARY"
+ {
+ echo "build_type=$BT"
+ echo "mtr_suite=$SUITE"
+ echo "ccache_maxsize=$CACHE"
+ } >> "$GITHUB_OUTPUT"
+
+ # TRUSTED. Dynamic capacity probe with PS-11179 fallback wiring.
+ #
+ # Sweep == one full pass over the 9 (server_type, dc) combinations
+ # (cax41/cax31/cax21 × fsn1/hel1/nbg1), each combination probed via the
+ # existing POST-then-DELETE pattern (HTTP 201 == we could have created the
+ # VM, so we have capacity; delete and report the (type, dc) back to
+ # create-runner-hetzner).
+ #
+ # On a fully-saturated Hetzner arm64 fleet we retry 4 sweeps total
+ # (1 initial + 3 retries) with backoff 2/5/10 minutes between attempts.
+ # Total wait before EC2 fallback fires:
+ # 2 + 5 + 10 = 17 min.
+ # The original 9-sweep / ~3h7m curve was agreed with Przemyslaw DM
+ # 2026-05-28; PS-11254 shortened it so the AWS Graviton fallback takes
+ # over fast on a real capacity outage instead of leaving a PR without
+ # arm64 feedback for ~3h. Early retries still catch the common short dips.
+ #
+ # Implemented as a single bash loop in this single job so the workflow
+ # graph stays linear (no matrix x retries explosion in the UI).
+ #
+ # Outputs:
+ # provider "hetzner" (normal) or "aws" (all sweeps exhausted)
+ # location hetzner location (fsn1/hel1/nbg1) if provider=hetzner; "" otherwise
+ # server_type hetzner server type (cax41/cax31/cax21) if provider=hetzner; "" otherwise
+ pick-target:
+ needs: dispatch
+ runs-on: ubuntu-latest
+ permissions: {}
+ # PS-11254: 4 sweeps × backoff totals ~17m of sleeps plus 36 HTTP
+ # round-trips (~2 min worst-case) plus job overhead. 30 min leaves
+ # headroom for slow Hetzner API responses without auto-cancelling.
+ timeout-minutes: 30
+ outputs:
+ provider: ${{ steps.probe.outputs.provider }}
+ location: ${{ steps.probe.outputs.location }}
+ server_type: ${{ steps.probe.outputs.server_type }}
+ steps:
+ - id: probe
+ env:
+ HCLOUD_TOKEN: ${{ secrets.GHA_RUNNER_HCLOUD_TOKEN }}
+ FORCE_PROVIDER: ${{ github.event_name == 'workflow_dispatch' && inputs.force_provider || 'auto' }}
+ run: |
+ set -euo pipefail
+
+ # PS-11179: force_provider override (workflow_dispatch only; defaults
+ # to "auto" for pull_request / pull_request_target, and for the nightly
+ # dispatched as workflow_dispatch). Lets operators validate the
+ # EC2 path on demand without waiting for a real Hetzner outage, or
+ # pin to Hetzner-only when AWS spend must be avoided.
+ case "$FORCE_PROVIDER" in
+ aws)
+ echo "::notice::force_provider=aws -> skipping Hetzner probing, going straight to EC2 fallback"
+ echo "### Provider override: AWS (forced via workflow_dispatch input)" >> "$GITHUB_STEP_SUMMARY"
+ {
+ echo "provider=aws"
+ echo "location="
+ echo "server_type="
+ } >> "$GITHUB_OUTPUT"
+ exit 0
+ ;;
+ hetzner)
+ echo "::notice::force_provider=hetzner -> EC2 fallback disabled; will fail if Hetzner exhausted"
+ ;;
+ auto)
+ ;;
+ *)
+ echo "::error::Unrecognised force_provider value: $FORCE_PROVIDER (expected auto|hetzner|aws)"
+ exit 1
+ ;;
+ esac
+
+ # PS-11179: backoff curve in minutes between sweep attempts.
+ # Index 0 is the gap AFTER sweep 1 fails (before sweep 2), etc.
+ # PS-11254: 3 entries == 3 retries after the initial sweep == 4 sweeps
+ # total (~17m: 2+5+10), so the AWS EC2 fallback takes over fast instead
+ # of burning ~3h on a Hetzner capacity outage.
+ BACKOFF_MIN=(2 5 10)
+ MAX_SWEEPS=4
+
+ for sweep in $(seq 1 "$MAX_SWEEPS"); do
+ echo "::group::Hetzner capacity sweep $sweep/$MAX_SWEEPS"
+ for type in cax41 cax31 cax21; do
+ for dc in fsn1 hel1 nbg1; do
+ PROBE_NAME="cap-probe-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-s${sweep}-${type}-${dc}"
+ HTTP=$(curl -sS -o /tmp/resp.json -w "%{http_code}" -X POST \
+ -H "Authorization: Bearer $HCLOUD_TOKEN" -H "Content-Type: application/json" \
+ https://api.hetzner.cloud/v1/servers \
+ -d "{\"name\":\"$PROBE_NAME\",\"server_type\":\"$type\",\"image\":\"$IMAGE\",\"location\":\"$dc\",\"start_after_create\":false}")
+ if [ "$HTTP" = "201" ]; then
+ ID=$(jq -r '.server.id // empty' /tmp/resp.json)
+ [ -n "$ID" ] || { echo "::error::201 without server id"; exit 1; }
+ curl -fsS -X DELETE -H "Authorization: Bearer $HCLOUD_TOKEN" \
+ "https://api.hetzner.cloud/v1/servers/$ID" >/dev/null
+ if [ "$type" != "cax41" ]; then
+ echo "::warning::cax41 unavailable (PS-11174); falling back to $type in $dc"
+ fi
+ if [ "$sweep" -gt 1 ]; then
+ echo "::notice::Hetzner capacity recovered on sweep $sweep"
+ fi
+ echo "Hetzner target: $type in $dc (sweep $sweep/$MAX_SWEEPS)" >> "$GITHUB_STEP_SUMMARY"
+ {
+ echo "provider=hetzner"
+ echo "location=$dc"
+ echo "server_type=$type"
+ } >> "$GITHUB_OUTPUT"
+ echo "::endgroup::"
+ exit 0
+ fi
+ ERR=$(jq -r '.error.code // "?"' /tmp/resp.json 2>/dev/null || echo "?")
+ echo "::warning::sweep $sweep: $type/$dc: HTTP $HTTP ($ERR)"
+ done
+ done
+ echo "::endgroup::"
+
+ # Sleep before the next sweep unless this was the last one.
+ if [ "$sweep" -lt "$MAX_SWEEPS" ]; then
+ idx=$((sweep - 1))
+ wait_min="${BACKOFF_MIN[$idx]}"
+ echo "::notice::All 9 Hetzner combos exhausted on sweep $sweep; sleeping ${wait_min}m before sweep $((sweep + 1))"
+ sleep $((wait_min * 60))
+ fi
+ done
+
+ # PS-11179: All sweeps exhausted; switch to EC2 path (unless
+ # force_provider=hetzner explicitly disabled fallback).
+ if [ "$FORCE_PROVIDER" = "hetzner" ]; then
+ echo "::error::Hetzner CAX exhausted after $MAX_SWEEPS sweeps AND force_provider=hetzner; failing per request"
+ exit 1
+ fi
+ echo "::warning::Hetzner CAX capacity exhausted after $MAX_SWEEPS sweeps (~17m wall time); falling back to AWS EC2 c7g.4xlarge in $AWS_REGION"
+ {
+ echo "### EC2 fallback fired (PS-11179)"
+ echo ""
+ echo "Hetzner cax41/cax31/cax21 across fsn1/hel1/nbg1 had no capacity"
+ echo "across $MAX_SWEEPS sweeps spanning ~17m. Falling back to AWS"
+ echo "EC2 c7g.4xlarge (Graviton3) in eu-central-1."
+ } >> "$GITHUB_STEP_SUMMARY"
+ {
+ echo "provider=aws"
+ echo "location="
+ echo "server_type="
+ } >> "$GITHUB_OUTPUT"
+
+ # TRUSTED. Provision the ephemeral Hetzner runner. Runs only when
+ # pick-target found Hetzner capacity.
+ #
+ # Renamed from `create-runner` to `create-runner-hetzner` in PS-11179 so the
+ # AWS sibling job can live alongside it. Body otherwise unchanged.
+ create-runner-hetzner:
+ needs: [dispatch, pick-target]
+ if: needs.pick-target.outputs.provider == 'hetzner'
+ runs-on: ubuntu-latest
+ permissions: {}
+ outputs:
+ runner_label: ${{ env.EPHEMERAL_RUNNER_NAME }}
+ server_id: ${{ steps.create.outputs.server_id }}
+ server_type: ${{ needs.pick-target.outputs.server_type }}
+ steps:
+ - id: create
+ uses: olexandr-havryliak/hcloud-github-runner@bb1089d8b718a06493cb37c51dfe596e44baefc2
+ with:
+ mode: create
+ name: ${{ env.EPHEMERAL_RUNNER_NAME }}
+ hcloud_token: ${{ secrets.GHA_RUNNER_HCLOUD_TOKEN }}
+ github_token: ${{ secrets.GHA_RUNNER_PAT }}
+ image: ${{ env.IMAGE }}
+ location: ${{ needs.pick-target.outputs.location }}
+ server_type: ${{ needs.pick-target.outputs.server_type }}
+ ssh_key: ${{ env.SSH_KEY_ID }}
+ # Default budget is 60x10s = 10 min; bumped to 20 min absorbs transient
+ # apt-mirror or GitHub-release slowness during bootstrap.
+ runner_wait: '120'
+ # Retry apt with backoff for transient apt-mirror hiccups on first
+ # cloud-init (Codex diagnosis 2026-05-22).
+ pre_runner_script: |
+ set -euxo pipefail
+ export DEBIAN_FRONTEND=noninteractive
+ ok=0
+ for i in 1 2 3; do
+ if apt-get update -y && apt-get install -y --no-install-recommends curl ca-certificates jq; then
+ ok=1
+ break
+ fi
+ sleep $((i * 15))
+ done
+ [ "$ok" = 1 ]
+
+ # On create-runner failure with workflow_dispatch `debug_keep_vm` set,
+ # surface VM IP + SSH instructions in the run summary BEFORE delete-runner
+ # reaps the VM. Anderson SSHs in manually with his personal key
+ # (107239874) to grab cloud-init logs and the runner _diag dir.
+ - name: Preserve VM for manual diagnosis (on failure, debug-only)
+ if: failure() && inputs.debug_keep_vm == true
+ env:
+ HCLOUD_TOKEN: ${{ secrets.GHA_RUNNER_HCLOUD_TOKEN }}
+ SERVER_ID: ${{ steps.create.outputs.server_id }}
+ run: |
+ set -euo pipefail
+ [ -n "${SERVER_ID:-}" ] || { echo "::warning::No server_id; nothing to preserve"; exit 0; }
+ IP=$(curl -fsS -H "Authorization: Bearer $HCLOUD_TOKEN" \
+ "https://api.hetzner.cloud/v1/servers/$SERVER_ID" \
+ | jq -r '.server.public_net.ipv4.ip')
+ {
+ echo "### Debug VM kept alive for manual diagnosis"
+ echo ""
+ echo "Server ID: \`$SERVER_ID\`"
+ echo "Public IPv4: \`$IP\`"
+ echo ""
+ echo "**SSH** (key 107239874, \`anderson@percona\`):"
+ echo "\`\`\`bash"
+ echo "ssh root@$IP"
+ echo "\`\`\`"
+ echo ""
+ echo "**Files to grab:**"
+ echo "- \`/var/log/cloud-init.log\`"
+ echo "- \`/var/log/cloud-init-output.log\`"
+ echo "- \`/actions-runner/_diag/\` (if it exists)"
+ echo "- \`/actions-runner/.runner\` + \`.credentials\` (if registration partially completed)"
+ echo ""
+ echo "**Cleanup when done:**"
+ echo "\`\`\`bash"
+ echo "curl -X DELETE -H \"Authorization: Bearer \$HCLOUD_TOKEN\" \\"
+ echo " https://api.hetzner.cloud/v1/servers/$SERVER_ID"
+ echo "\`\`\`"
+ echo ""
+ echo "orphan-sweep.yml will reap this VM after 6h regardless."
+ } >> "$GITHUB_STEP_SUMMARY"
+
+ # TRUSTED. Provision the ephemeral EC2 runner (PS-11179 fallback path).
+ # Runs only when pick-target exhausted Hetzner.
+ #
+ # Provider-selection design (locked 2026-05-28):
+ # - Region: eu-central-1 (hardcoded; matches existing Jenkins footprint,
+ # low latency to EU contributors, no cross-region cache traffic).
+ # - Instance type: c7g.4xlarge (16 vCPU / 32 GB Graviton3 == cax41 parity).
+ # - Spot first across eu-central-1a/1b/1c; on InsufficientInstanceCapacity
+ # in all 3 AZs, retry on-demand across the same 3 AZs.
+ # - AMI: Canonical Ubuntu 26.04 arm64 resolved via SSM Parameter Store
+ # at runtime (no hardcoded AMI ID; auto-refreshes weekly).
+ # - Self-termination: --instance-initiated-shutdown-behavior terminate
+ # combined with userData `shutdown -h now` after runner exits;
+ # delete-runner-aws is the always-runs safety net for forced cancels.
+ # - Mandatory cluster tags (enforced by IAM tag-on-create condition and
+ # by the LambdaEC2Cleanup sweeper): iit-billing-tag + PerconaKeep.
+ #
+ # Trust split (Codex review fix 2026-05-28, P0-1 + P0-2):
+ # - NO `actions/checkout` here. PR code must not enter this trusted job,
+ # because the workflow holds AWS_ROLE_ARN + GHA_RUNNER_PAT.
+ # userData content is INLINED via heredoc below; this workflow file
+ # is the single source of truth for the runner bootstrap. Inlining
+ # avoids the "PR-controlled checkout poisons trusted bootstrap"
+ # attack class (Codex review 2026-05-28 P0-1).
+ # - NO instance profile attached. The ephemeral VM holds no AWS creds.
+ # PR code on the runner cannot reach the AWS API. The only credential
+ # on the instance is the one-shot ~1h-TTL GitHub registration token,
+ # embedded in userData for `./config.sh --token`.
+ create-runner-aws:
+ needs: [dispatch, pick-target]
+ if: needs.pick-target.outputs.provider == 'aws'
+ runs-on: ubuntu-latest
+ permissions:
+ # id-token: write for OIDC -> STS exchange in
+ # aws-actions/configure-aws-credentials.
+ # contents: read is the minimum for the runner to bootstrap; we do
+ # not checkout the repo here (see trust-split comment above).
+ contents: read
+ id-token: write
+ outputs:
+ runner_label: ${{ env.EPHEMERAL_RUNNER_NAME }}
+ instance_id: ${{ steps.run.outputs.instance_id }}
+ az: ${{ steps.run.outputs.az }}
+ market: ${{ steps.run.outputs.market }}
+ steps:
+ # OIDC -> STS. Role created in Percona/percona-cd-platform PR 1
+ # (terraform/iam/gha-percona-server-ec2-fallback.tf). Trust policy
+ # constrains audience to sts.amazonaws.com and subject to this repo +
+ # workflow ref so other repos / branches cannot assume the role.
+ # Pinned to v4.3.1 (current stable v4) by commit SHA; bumping requires
+ # re-verifying the action's source and updating this comment.
+ - name: Configure AWS credentials via OIDC
+ uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
+ with:
+ role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
+ role-session-name: gha-${{ github.run_id }}-${{ github.run_attempt }}
+ aws-region: ${{ env.AWS_REGION }}
+
+ # GitHub Actions runner registration token. One-shot, 1h TTL. Lives in
+ # the userData script so the EC2 instance can register itself with
+ # `./config.sh --token`. Generated here (not on the instance) because
+ # the EC2 instance does not hold GHA_RUNNER_PAT.
+ - name: Mint GitHub runner registration token
+ id: regtoken
+ env:
+ GH_TOKEN: ${{ secrets.GHA_RUNNER_PAT }}
+ run: |
+ set -euo pipefail
+ TOKEN=$(gh api -X POST /repos/${{ github.repository }}/actions/runners/registration-token --jq .token)
+ if [ -z "$TOKEN" ] || [ "$TOKEN" = "null" ]; then
+ echo "::error::Failed to mint runner registration token"
+ exit 1
+ fi
+ # Mark as a workflow secret so accidental log echoes are scrubbed.
+ echo "::add-mask::$TOKEN"
+ echo "token=$TOKEN" >> "$GITHUB_OUTPUT"
+
+ # Resolve the current Canonical Ubuntu 26.04 arm64 AMI from SSM at
+ # runtime. Canonical refreshes this parameter weekly with security
+ # patches; never hardcode the AMI ID in this workflow.
+ - name: Resolve Ubuntu 26.04 arm64 AMI
+ id: ami
+ run: |
+ set -euo pipefail
+ AMI=$(aws ssm get-parameter \
+ --name /aws/service/canonical/ubuntu/server/26.04/stable/current/arm64/hvm/ebs-gp3/ami-id \
+ --region "$AWS_REGION" \
+ --query Parameter.Value --output text)
+ if [ -z "$AMI" ] || [ "$AMI" = "None" ]; then
+ echo "::error::Failed to resolve Ubuntu 26.04 arm64 AMI from SSM"
+ exit 1
+ fi
+ echo "Resolved AMI: $AMI"
+ echo "ami=$AMI" >> "$GITHUB_OUTPUT"
+
+ # Build the userData payload inline (P0-1 fix). The heredoc body uses
+ # only literal shell `${VAR}` references that are expanded by the
+ # workflow runner's shell at write time, NOT by envsubst on a file
+ # that PR code could mutate. The resulting plain-bash script is what
+ # cloud-init runs on the EC2 instance.
+ #
+ # Variables exported into this step:
+ # RUNNER_TOKEN one-shot ~1h-TTL GitHub registration token
+ # EPHEMERAL_RUNNER_NAME unique runner name (=== RUNNER_LABEL)
+ # RUNNER_URL https://github.com//
+ # RUNNER_VERSION pinned actions/runner release (without leading v)
+ # RUNNER_SHA256 SHA256 of actions-runner-linux-arm64-.tar.gz
+ - name: Render userData (inline; no checkout)
+ env:
+ RUNNER_TOKEN: ${{ steps.regtoken.outputs.token }}
+ RUNNER_URL: https://github.com/${{ github.repository }}
+ # Pinned actions/runner release. Bump together with RUNNER_SHA256.
+ # GitHub deprecates runner versions (typically 4-6 months after
+ # release); a deprecated runner registers fine but is immediately
+ # rejected with "cannot receive messages" and exits. Verify the pin
+ # against https://github.com/actions/runner/releases periodically.
+ # Last bump 2026-05-28 (v2.328.0 -> v2.334.0; 2.328.0 was deprecated).
+ RUNNER_VERSION: '2.334.0'
+ # SHA256 of actions-runner-linux-arm64-2.334.0.tar.gz from the
+ # actions/runner GitHub release page (BEGIN/END SHA linux-arm64 markers).
+ RUNNER_SHA256: 'f44255bd3e80160eb25f71bc83d06ea025f6908748807a584687b3184759f7e4'
+ run: |
+ set -euo pipefail
+ mkdir -p /tmp/ec2
+ # Fail fast if any required variable is empty; we'd rather not
+ # ship a half-rendered userData to AWS.
+ : "${RUNNER_TOKEN:?registration token missing}"
+ : "${EPHEMERAL_RUNNER_NAME:?runner name missing}"
+ : "${RUNNER_URL:?runner url missing}"
+ : "${RUNNER_VERSION:?runner version pin missing}"
+ : "${RUNNER_SHA256:?runner sha256 pin missing}"
+
+ # Heredoc WITHOUT a quoted delimiter -> the workflow shell expands
+ # ${VAR} at write time. PR code never touches this content.
+ # YAML forces a multi-line block to share an indentation prefix;
+ # we strip exactly 10 leading spaces on every heredoc body line
+ # via sed before writing so cloud-init sees a script starting at
+ # column 1 (the `#!` shebang must be column 1 or cloud-init
+ # refuses to exec it).
+ sed -E 's/^ //' < /tmp/ec2/userdata.sh
+ #!/bin/bash
+ # Inlined from .github/workflows/builds.yml (create-runner-aws).
+ # This heredoc is the single source of truth for the runner
+ # bootstrap script. Do not duplicate it to a separate file
+ # (would be a PR-poisonable trusted-bootstrap path; PS-11219).
+ set -euxo pipefail
+ exec > >(tee -a /var/log/gha-runner.log) 2>&1
+
+ # Self-shutdown on any exit path. RunInstances was called with
+ # --instance-initiated-shutdown-behavior terminate, so this
+ # reaps the instance rather than just powering it off.
+ trap '/sbin/shutdown -h now' EXIT
+
+ echo "Starting userData at \$(date -u +%FT%TZ)"
+ echo "Resolved RUNNER_VERSION=${RUNNER_VERSION}"
+ echo "Resolved EPHEMERAL_RUNNER_NAME=${EPHEMERAL_RUNNER_NAME}"
+
+ export DEBIAN_FRONTEND=noninteractive
+
+ # Install runtime deps with retry-on-flake.
+ ok=0
+ for i in 1 2 3; do
+ if apt-get update -y \\
+ && apt-get install -y --no-install-recommends \\
+ curl ca-certificates jq tar libicu78 git sudo; then
+ ok=1
+ break
+ fi
+ sleep \$((i * 15))
+ done
+ [ "\$ok" = 1 ] || { echo "apt install failed after 3 attempts"; exit 1; }
+
+ # Unprivileged runner user; /home/runner matches the Hetzner
+ # action's convention and the CCACHE_DIR baked into builds.yml.
+ if ! id -u runner >/dev/null 2>&1; then
+ useradd --create-home --shell /bin/bash --home-dir /home/runner runner
+ fi
+
+ # Passwordless sudo for the runner. percona-server build steps
+ # invoke \`sudo apt-get\` extensively (Install Build Dependencies);
+ # without NOPASSWD the runner cannot install packages and the build
+ # fails immediately. The instance has no inbound network (no SSH);
+ # the runner only runs one ephemeral job; expanding sudo to NOPASSWD
+ # is bounded by the ephemeral-VM blast radius.
+ install -m 0440 -o root -g root /dev/stdin /etc/sudoers.d/90-runner <<'SUDOERS'
+ runner ALL=(ALL) NOPASSWD:ALL
+ SUDOERS
+
+ RUNNER_DIR=/home/runner/actions-runner
+ mkdir -p "\${RUNNER_DIR}"
+ chown -R runner:runner /home/runner
+
+ # Download the pinned actions/runner ARM64 tarball.
+ TARBALL="actions-runner-linux-arm64-${RUNNER_VERSION}.tar.gz"
+ TARBALL_URL="https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/\${TARBALL}"
+ cd "\${RUNNER_DIR}"
+ curl --fail --silent --show-error --location --retry 5 --retry-delay 5 \\
+ --output "\${TARBALL}" "\${TARBALL_URL}"
+
+ # FAIL HARD on checksum mismatch.
+ echo "${RUNNER_SHA256} \${TARBALL}" | sha256sum --check --status \\
+ || { echo "SHA256 mismatch for \${TARBALL}; refusing to continue"; exit 1; }
+
+ tar xzf "\${TARBALL}"
+ rm -f "\${TARBALL}"
+ chown -R runner:runner "\${RUNNER_DIR}"
+
+ # Configure + run as the unprivileged user.
+ # --ephemeral : deregister after one job
+ # --disableupdate : never self-update mid-job (we pin the version)
+ # --unattended : non-interactive
+ sudo -u runner -H bash -lc "
+ set -euxo pipefail
+ cd '\${RUNNER_DIR}'
+ ./config.sh \\
+ --url '${RUNNER_URL}' \\
+ --token '${RUNNER_TOKEN}' \\
+ --name '${EPHEMERAL_RUNNER_NAME}' \\
+ --labels '${EPHEMERAL_RUNNER_NAME}' \\
+ --runnergroup default \\
+ --work _work \\
+ --unattended \\
+ --ephemeral \\
+ --disableupdate
+ "
+ echo "Token registered, runner: ${EPHEMERAL_RUNNER_NAME}"
+
+ runner_status=0
+ sudo -u runner -H bash -lc "cd '\${RUNNER_DIR}' && ./run.sh" || runner_status=\$?
+ echo "Runner exited with status \${runner_status}"
+
+ echo "Shutting down at \$(date -u +%FT%TZ)"
+ exit 0
+ EOF
+ chmod 0644 /tmp/ec2/userdata.sh
+ # Sanity checks:
+ # (a) shebang at column 1 (cloud-init refuses otherwise),
+ # (b) all required values made it into the rendered script.
+ if [ "$(head -1 /tmp/ec2/userdata.sh)" != "#!/bin/bash" ]; then
+ echo "::error::Rendered userData does not start with #!/bin/bash at column 1"
+ head -3 /tmp/ec2/userdata.sh
+ exit 1
+ fi
+ for needle in "${EPHEMERAL_RUNNER_NAME}" "${RUNNER_URL}" "${RUNNER_VERSION}" "${RUNNER_SHA256}"; do
+ if ! grep -qF "$needle" /tmp/ec2/userdata.sh; then
+ echo "::error::Rendered userData missing expected value (sanity check failed)"
+ exit 1
+ fi
+ done
+
+ # Spot-first across 3 AZs, then on-demand across the same 3 AZs.
+ # Outputs instance_id, az, market (=spot|on-demand) so delete-runner-aws
+ # and the GHA summary can report what was launched.
+ #
+ # Tags applied on the RunInstances call (not as a follow-up
+ # CreateTags) because the cluster IAM policy attaches a
+ # condition that requires iit-billing-tag + PerconaKeep to be
+ # present in the RunInstances request itself.
+ #
+ # --client-token (P1-7): provides launch idempotency keyed on
+ # run_id + run_attempt + AZ + market, so a retried step does not
+ # double-launch the same instance.
+ #
+ # --iam-instance-profile is DELIBERATELY ABSENT (P0-2 fix). The
+ # ephemeral VM intentionally holds no AWS credentials; PR code
+ # cannot reach the AWS API from the runner.
+ - id: run
+ name: RunInstances (spot eu-central-1a/1b/1c, then on-demand)
+ env:
+ AMI_ID: ${{ steps.ami.outputs.ami }}
+ run: |
+ set -euo pipefail
+
+ TAG_SPEC="ResourceType=instance,Tags=[\
+ {Key=Name,Value=ps-arm64-${{ github.run_id }}-${{ github.run_attempt }}},\
+ {Key=iit-billing-tag,Value=percona-server-gha-fallback},\
+ {Key=PerconaKeep,Value=True},\
+ {Key=github_run_id,Value=${{ github.run_id }}},\
+ {Key=github_run_attempt,Value=${{ github.run_attempt }}},\
+ {Key=github_workflow,Value=builds},\
+ {Key=github_repository,Value=${{ github.repository }}}]"
+
+ AZS=(eu-central-1a eu-central-1b eu-central-1c)
+ INSTANCE_ID=""
+ CHOSEN_AZ=""
+ CHOSEN_MARKET=""
+
+ # Helper: try to launch in $1=az with market $2=spot|on-demand.
+ # Echoes the instance id on success, empty on InsufficientCapacity.
+ # Any other AWS error exits the job non-zero (fail fast).
+ try_launch() {
+ local az="$1" market="$2"
+ local market_opts=()
+ if [ "$market" = "spot" ]; then
+ market_opts=(--instance-market-options 'MarketType=spot')
+ fi
+ # Client-token: stable per (run_id, run_attempt, az, market) so a
+ # retried RunInstances call returns the same instance instead of
+ # launching a duplicate. AWS requires <= 64 chars; the run-id +
+ # attempt + az + market fits comfortably.
+ local client_token="ps-${{ github.run_id }}-${{ github.run_attempt }}-${az}-${market}"
+ set +e
+ # Canonical's Ubuntu 26.04 ARM64 AMI defaults the root volume to
+ # 8 GB which fills up partway through the percona-server Debug
+ # build (boost + ccache + intermediate objects). Override to
+ # 80 GB gp3, delete-on-termination so the volume dies with the
+ # ephemeral instance and the cleanup Lambdas have nothing to do.
+ OUT=$(aws ec2 run-instances \
+ --region "$AWS_REGION" \
+ --image-id "$AMI_ID" \
+ --instance-type "$AWS_INSTANCE_TYPE" \
+ --placement "AvailabilityZone=$az" \
+ --instance-initiated-shutdown-behavior terminate \
+ --user-data file:///tmp/ec2/userdata.sh \
+ --tag-specifications "$TAG_SPEC" \
+ --block-device-mappings '[{"DeviceName":"/dev/sda1","Ebs":{"VolumeSize":80,"VolumeType":"gp3","DeleteOnTermination":true}}]' \
+ --client-token "$client_token" \
+ --metadata-options 'HttpTokens=required,HttpPutResponseHopLimit=2,HttpEndpoint=enabled' \
+ "${market_opts[@]}" \
+ --query 'Instances[0].InstanceId' --output text 2>/tmp/ec2/run.err)
+ rc=$?
+ set -e
+ if [ $rc -eq 0 ] && [ -n "$OUT" ] && [ "$OUT" != "None" ]; then
+ echo "$OUT"
+ return 0
+ fi
+ ERR=$(cat /tmp/ec2/run.err)
+ # Match the two capacity-shaped errors AWS returns; everything
+ # else (auth, quota, malformed request) is fatal because retrying
+ # will not help.
+ # IMPORTANT: warnings/errors must go to STDERR (>&2), otherwise the
+ # surrounding `$(try_launch ...)` capture swallows them silently.
+ if echo "$ERR" | grep -qE 'InsufficientInstanceCapacity|SpotMaxPriceTooLow|MaxSpotInstanceCountExceeded'; then
+ echo "::warning::$market launch failed in $az: $(echo "$ERR" | head -1)" >&2
+ return 1
+ fi
+ echo "::error::Fatal RunInstances error in $az ($market): $ERR" >&2
+ return 2
+ }
+
+ # Pass 1: spot across 3 AZs.
+ for az in "${AZS[@]}"; do
+ if ID=$(try_launch "$az" spot); then
+ INSTANCE_ID="$ID"
+ CHOSEN_AZ="$az"
+ CHOSEN_MARKET="spot"
+ break
+ fi
+ rc=$?
+ [ $rc -eq 2 ] && exit 1
+ done
+
+ # Pass 2: on-demand across the same 3 AZs if spot is fully exhausted.
+ if [ -z "$INSTANCE_ID" ]; then
+ echo "::notice::All 3 AZs returned no spot capacity for $AWS_INSTANCE_TYPE; retrying on-demand"
+ for az in "${AZS[@]}"; do
+ if ID=$(try_launch "$az" on-demand); then
+ INSTANCE_ID="$ID"
+ CHOSEN_AZ="$az"
+ CHOSEN_MARKET="on-demand"
+ break
+ fi
+ rc=$?
+ [ $rc -eq 2 ] && exit 1
+ done
+ fi
+
+ if [ -z "$INSTANCE_ID" ]; then
+ echo "::error::No c7g.4xlarge capacity in eu-central-1a/1b/1c for either spot or on-demand. Giving up."
+ exit 1
+ fi
+
+ echo "Launched $INSTANCE_ID ($CHOSEN_MARKET) in $CHOSEN_AZ"
+ {
+ echo "### EC2 fallback runner launched"
+ echo ""
+ echo "- Instance: \`$INSTANCE_ID\`"
+ echo "- Type: \`$AWS_INSTANCE_TYPE\`"
+ echo "- AZ: \`$CHOSEN_AZ\`"
+ echo "- Market: \`$CHOSEN_MARKET\`"
+ echo "- AMI: \`$AMI_ID\`"
+ } >> "$GITHUB_STEP_SUMMARY"
+ {
+ echo "instance_id=$INSTANCE_ID"
+ echo "az=$CHOSEN_AZ"
+ echo "market=$CHOSEN_MARKET"
+ } >> "$GITHUB_OUTPUT"
+
+ # Wait for the runner to register itself with GitHub. Poll the
+ # repository-scoped runners list every 10s for up to 5 minutes
+ # (30 polls). cloud-init typically completes in 60-120s on c7g.4xlarge;
+ # the 5-minute budget absorbs the worst-case GitHub release CDN delay
+ # observed on Hetzner (Codex 2026-05-22).
+ - name: Wait for runner to come online
+ env:
+ GH_TOKEN: ${{ secrets.GHA_RUNNER_PAT }}
+ INSTANCE_ID: ${{ steps.run.outputs.instance_id }}
+ run: |
+ set -euo pipefail
+ # 10 min budget. Cloud-init on a fresh c7g.4xlarge spot needs
+ # apt-update + runner download + extract + configure + register;
+ # 5 min was too tight (PS-11219 PoC iteration 3 timed out at 5m15s).
+ # First-boot worst case is ~6-7 min on cold AMI/runner-release cache.
+ deadline=$(( $(date +%s) + 600 ))
+ attempt=0
+ while [ "$(date +%s)" -lt "$deadline" ]; do
+ attempt=$((attempt + 1))
+ STATUS=$(gh api -X GET /repos/${{ github.repository }}/actions/runners --paginate \
+ --jq ".runners[] | select(.name == \"$EPHEMERAL_RUNNER_NAME\") | .status" || true)
+ if [ "$STATUS" = "online" ]; then
+ echo "Runner $EPHEMERAL_RUNNER_NAME online after ${attempt} polls"
+ exit 0
+ fi
+ echo "Attempt $attempt: runner status='${STATUS:-not-registered}' (waiting 10s)"
+ sleep 10
+ done
+ # On timeout, capture EC2 console output BEFORE terminating so we
+ # have a post-mortem (no SSM available; the no-IAM-on-VM design
+ # means we can't shell in either).
+ echo "::error::Runner $EPHEMERAL_RUNNER_NAME did not come online within 10m; capturing console output and terminating $INSTANCE_ID"
+ aws ec2 get-console-output --region "$AWS_REGION" --instance-id "$INSTANCE_ID" --output text --query Output 2>&1 | tail -200 || true
+ aws ec2 terminate-instances --region "$AWS_REGION" --instance-ids "$INSTANCE_ID" >/dev/null || true
+ exit 1
+
+ # UNTRUSTED. PR code (Debug) or 9.7 HEAD (RelWithDebInfo nightly) runs here.
+ # Build shape ported from azure-pipelines.yml on 9.7 (per Przemek 2026-05-18:
+ # ".cirrus.yml is just a simplified port from Azure"). arm64-specific
+ # deviations (system-gcc selection, MTR libeatmydata, -j cap at 16) are
+ # annotated inline.
+ #
+ # PS-11179: needs lists BOTH create-runner-hetzner + create-runner-aws so
+ # the dependency wiring works regardless of which provider ran. The
+ # `runs-on` expression coalesces the two outputs with `||`; exactly one of
+ # them is populated (the other job was skipped via `if:` and has empty
+ # outputs), so the coalescing resolves to the active runner label.
+ build-arm64:
+ needs: [dispatch, pick-target, create-runner-hetzner, create-runner-aws]
+ # GHA defaults to skipping a job when ANY needed job is skipped. Since
+ # exactly ONE of create-runner-hetzner / create-runner-aws is skipped
+ # (the other ran), we explicitly require: dispatch + pick-target green,
+ # AND at least one of the two create-runner jobs succeeded.
+ if: |
+ always()
+ && needs.dispatch.result == 'success'
+ && needs.pick-target.result == 'success'
+ && (needs.create-runner-hetzner.result == 'success' || needs.create-runner-aws.result == 'success')
+ runs-on: ${{ needs.create-runner-hetzner.outputs.runner_label || needs.create-runner-aws.outputs.runner_label }}
+ permissions:
+ contents: read
+ timeout-minutes: 240
+ env:
+ BUILD_TYPE: ${{ needs.dispatch.outputs.build_type }}
+ MTR_SUITE: ${{ needs.dispatch.outputs.mtr_suite }}
+ CCACHE_MAXSIZE: ${{ needs.dispatch.outputs.ccache_maxsize }}
+ CCACHE_DIR: /home/runner/ccache
+ BOOST_DIR: /tmp/boost
+ DEBIAN_FRONTEND: noninteractive
+ steps:
+ - name: System info
+ run: |
+ set -eux
+ # PS-11179: report whichever provider actually fired.
+ echo "Provider: ${{ needs.pick-target.outputs.provider }}"
+ if [ "${{ needs.pick-target.outputs.provider }}" = "hetzner" ]; then
+ echo "Server type: ${{ needs.create-runner-hetzner.outputs.server_type }}"
+ else
+ echo "Instance: ${{ needs.create-runner-aws.outputs.instance_id }} (${{ needs.create-runner-aws.outputs.market }} in ${{ needs.create-runner-aws.outputs.az }})"
+ fi
+ echo "Build type: $BUILD_TYPE"
+ echo "MTR suite: $MTR_SUITE"
+ uname -a
+ nproc
+ free -h
+ df -h /
+
+ - name: Conditional swap (only when RAM < 16 GB)
+ run: |
+ set -eux
+ MEM_GB=$(awk '/MemTotal/ {print int($2/1024/1024)}' /proc/meminfo)
+ if [ "$MEM_GB" -lt 16 ]; then
+ sudo fallocate -l 16G /swapfile
+ sudo chmod 600 /swapfile
+ sudo mkswap /swapfile
+ sudo swapon /swapfile
+ fi
+ free -h
+
+ # Azure: `*** Install Build Dependencies`. arm64 picks system gcc (no
+ # version selector + LLVM repo plumbing needed).
+ - name: Install Build Dependencies
+ run: |
+ set -eux
+ SELECTED_CC="${COMPILER}${COMPILER_VER:+-${COMPILER_VER}}"
+ SELECTED_CXX="${COMPILER}++${COMPILER_VER:+-${COMPILER_VER}}"
+ [ "$COMPILER" = "gcc" ] && SELECTED_CXX="g++${COMPILER_VER:+-${COMPILER_VER}}"
+ echo "SELECTED_CC=$SELECTED_CC" >> "$GITHUB_ENV"
+ echo "SELECTED_CXX=$SELECTED_CXX" >> "$GITHUB_ENV"
+ PACKAGES="$SELECTED_CC"
+ [ "$COMPILER" = "gcc" ] && PACKAGES="$SELECTED_CXX"
+ sudo apt-get -yq update
+ sudo apt-get -yq --no-install-suggests --no-install-recommends install \
+ $PACKAGES make pkg-config dpkg-dev unzip lz4 git cmake cmake-curses-gui ccache bison \
+ libtirpc-dev libudev-dev libaio-dev libmecab-dev libnuma-dev \
+ libssl-dev libreadline-dev libedit-dev libpam-dev \
+ libcurl4-openssl-dev libldap2-dev libkrb5-dev libsasl2-dev \
+ libsasl2-modules-gssapi-mit \
+ libxml-simple-perl
+ # Azure: SYSTEM_LIBRARIES path (BUILD_PARAMS_TYPE != inverted).
+ sudo apt-get -yq --no-install-suggests --no-install-recommends install \
+ libicu-dev libevent-dev liblz4-dev zlib1g-dev \
+ protobuf-compiler libprotobuf-dev libprotoc-dev \
+ libzstd-dev libfido2-dev
+ # arm64-only addition: libeatmydata1 needed for MTR LD_PRELOAD
+ # (Cirrus arm64 task uses it; Azure x86 jobs do not run MTR).
+ sudo apt-get -yq --no-install-suggests --no-install-recommends install libeatmydata1
+ REAL_COMPILER_VER=$($SELECTED_CC --version | head -1 | awk '{print $4}')
+ echo "REAL_COMPILER_VER=$REAL_COMPILER_VER" >> "$GITHUB_ENV"
+
+ # Azure ccache key shape: "ccache | PARENT_BRANCH | imageName-Compiler-VER-BuildType | BUILD_PARAMS_TYPE | "
+ # run_id keeps nightly + dispatch + PR runs each save their own slot;
+ # restore-keys falls back to the most-recent matching prefix.
+ - name: ccache cache (Azure key shape; build_type-scoped)
+ uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.2.0
+ with:
+ path: /home/runner/ccache
+ key: ccache-${{ env.PARENT_BRANCH }}-${{ env.IMAGE_NAME }}-${{ env.COMPILER }}-${{ env.BUILD_TYPE }}-${{ env.BUILD_PARAMS_TYPE }}-${{ github.run_id }}
+ restore-keys: |
+ ccache-${{ env.PARENT_BRANCH }}-${{ env.IMAGE_NAME }}-${{ env.COMPILER }}-${{ env.BUILD_TYPE }}-${{ env.BUILD_PARAMS_TYPE }}-
+
+ - name: boost cache (Azure key shape)
+ uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.2.0
+ with:
+ path: /tmp/boost
+ key: ${{ env.BOOST_VERSION }}
+
+ - name: Checkout (fetchDepth 32 mirrors Azure)
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.2.2
+ with:
+ fetch-depth: 32
+ # PS-11254: on pull_request_target the default checkout ref is the
+ # base branch, so explicitly check out the fork PR head. Safe here:
+ # build-arm64 holds no secrets (see header trust-split note).
+ ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || '' }}
+
+ - name: Update git submodules
+ run: |
+ set -eux
+ git submodule sync
+ git submodule update --init --force --depth=256
+ git submodule
+
+ - name: Compiler and cmake info
+ run: |
+ set -eux
+ $SELECTED_CC -v
+ $SELECTED_CXX -v
+ ccache --version
+ mkdir -p "$CCACHE_DIR" "$BOOST_DIR"
+ ccache -p | grep -E "max_size|cache_dir"
+ ccache --zero-stats
+
+ # Azure `*** cmake ...` step, 9.7 Linux non-inverted branch.
+ - name: cmake (Azure parity, 9.7 Linux non-inverted)
+ run: |
+ set -eux
+ mkdir bin && cd bin
+ COMPILE_OPT=(
+ -DCMAKE_C_FLAGS_DEBUG=-g1
+ -DCMAKE_CXX_FLAGS_DEBUG=-g1
+ )
+ CMAKE_OPT="
+ -DCMAKE_BUILD_TYPE=$BUILD_TYPE
+ -DBUILD_CONFIG=mysql_release
+ -DWITH_PACKAGE_FLAGS=OFF
+ -DDOWNLOAD_BOOST=1
+ -DWITH_BOOST=$BOOST_DIR
+ -DCMAKE_C_COMPILER=$SELECTED_CC
+ -DCMAKE_CXX_COMPILER=$SELECTED_CXX
+ -DCMAKE_C_COMPILER_LAUNCHER=ccache
+ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
+ -DWITH_ROCKSDB=ON
+ -DWITH_COREDUMPER=ON
+ -DWITH_COMPONENT_KEYRING_VAULT=ON
+ -DWITH_PAM=ON
+ -DMYSQL_MAINTAINER_MODE=ON
+ -DWITH_MECAB=system
+ -DWITH_NUMA=ON
+ -DWITH_EDITLINE=system
+ -DWITH_SYSTEM_LIBS=ON
+ "
+ cmake .. $CMAKE_OPT "${COMPILE_OPT[@]}"
+ rm -f "$BOOST_DIR/$BOOST_VERSION.tar.gz"
+ cmake -L .
+
+ # Azure: `*** Compile` uses `make -j2` (MS-hosted has 2 cores). arm64
+ # deviation: scale to cax* cores, capped at 16 (Cirrus pattern). Literal
+ # -j2 would waste cax41's 16 cores; arm64 builds benefit linearly from
+ # parallelism (THE migration win).
+ - name: Compile (make -j, capped at 16)
+ run: |
+ set -eux
+ cd bin
+ NPROC=$(nproc --all)
+ NTHREADS=$(( NPROC > 16 ? 16 : NPROC ))
+ echo "Using $NTHREADS/$NPROC threads"
+ make -j${NTHREADS}
+ ccache --show-stats
+ df -h /
+
+ # arm64-only step (Azure x86 does not run MTR; Cirrus arm64 does).
+ # Suite picked by dispatch:
+ # - main.1st (Debug, per-PR; Cirrus arm64 PR task parity)
+ # - binlog_nogtid (RelWithDebInfo, nightly; Cirrus RelWithDebInfo parity, Przemek 2026-05-18)
+ - name: MTR (suite per build_type)
+ run: |
+ set -eux
+ cd bin
+ NPROC=$(nproc --all)
+ NTHREADS=$(( NPROC > 16 ? 16 : NPROC ))
+ LIBEATMYDATA=$(whereis libeatmydata.so | awk '{print $2}')
+ if [ "$MTR_SUITE" = "main.1st" ]; then
+ mysql-test/mysql-test-run.pl main.1st \
+ --parallel=$NTHREADS \
+ --junit-output=/tmp/MTR_results.xml \
+ --mysqld-env=LD_PRELOAD=${LIBEATMYDATA} \
+ --force --max-test-fail=0 --retry-failure=0 \
+ --debug-server
+ else
+ mysql-test/mysql-test-run.pl \
+ --suite=$MTR_SUITE \
+ --parallel=$NTHREADS \
+ --junit-output=/tmp/MTR_results.xml \
+ --mysqld-env=LD_PRELOAD=${LIBEATMYDATA} \
+ --force --max-test-fail=0 --retry-failure=0
+ fi
+
+ - name: Upload MTR results
+ if: always()
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.0
+ with:
+ name: mtr-${{ env.BUILD_TYPE }}-${{ env.MTR_SUITE }}
+ path: /tmp/MTR_results.xml
+ if-no-files-found: ignore
+
+ # Renamed from `delete-runner` to `delete-runner-hetzner` in PS-11179.
+ # Body otherwise unchanged. Only fires when the Hetzner provisioning path
+ # actually created a VM.
+ delete-runner-hetzner:
+ needs: [dispatch, pick-target, create-runner-hetzner, build-arm64]
+ # Skip delete when debug_keep_vm is set AND create-runner-hetzner failed,
+ # so the broken VM stays alive for manual SSH diagnosis. orphan-sweep
+ # reaps it after 6h regardless. Normal happy path is unaffected.
+ # Also gated on provider==hetzner so this is a no-op on EC2 fallback runs.
+ if: |
+ always()
+ && needs.pick-target.outputs.provider == 'hetzner'
+ && needs.create-runner-hetzner.outputs.server_id != ''
+ && !(inputs.debug_keep_vm == true && needs.create-runner-hetzner.result == 'failure')
+ runs-on: ubuntu-latest
+ permissions: {}
+ steps:
+ - uses: olexandr-havryliak/hcloud-github-runner@bb1089d8b718a06493cb37c51dfe596e44baefc2
+ with:
+ mode: delete
+ name: ${{ env.EPHEMERAL_RUNNER_NAME }}
+ server_id: ${{ needs.create-runner-hetzner.outputs.server_id }}
+ hcloud_token: ${{ secrets.GHA_RUNNER_HCLOUD_TOKEN }}
+ github_token: ${{ secrets.GHA_RUNNER_PAT }}
+
+ # PS-11179: Always-runs safety net for the EC2 fallback path.
+ #
+ # The instance self-terminates after the runner exits (userData does
+ # `shutdown -h now` and we pass --instance-initiated-shutdown-behavior
+ # terminate), so on the happy path TerminateInstances is idempotent /
+ # no-op. This job exists for the failure cases:
+ # - Workflow cancelled mid-build
+ # - build-arm64 timed out
+ # - userData crashed before reaching the shutdown line
+ # - registration polling failed and bailed out of create-runner-aws
+ #
+ # Also de-registers the runner from GitHub so the next run does not
+ # collide on the same EPHEMERAL_RUNNER_NAME. The runner usually self-removes
+ # via `./run.sh --ephemeral`, but if it died before --ephemeral kicked in,
+ # the orphan entry would block re-registration.
+ #
+ # Drops the create-runner-aws.outputs.instance_id != '' gate (P1-7 fix):
+ # if the job was cancelled between RunInstances and `>> $GITHUB_OUTPUT`,
+ # the output is empty but a live instance still exists. We discover by
+ # tag (github_run_id == ${{ github.run_id }}) instead, then union with
+ # the published output as a belt-and-braces measure.
+ delete-runner-aws:
+ needs: [dispatch, pick-target, create-runner-aws, build-arm64]
+ if: |
+ always()
+ && needs.pick-target.outputs.provider == 'aws'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ id-token: write
+ steps:
+ - name: Configure AWS credentials via OIDC
+ uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
+ with:
+ role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
+ role-session-name: gha-${{ github.run_id }}-${{ github.run_attempt }}-cleanup
+ aws-region: ${{ env.AWS_REGION }}
+
+ # Tag-based discovery first, then union with the published output.
+ # Covers: (a) happy path (output populated; tag query agrees),
+ # (b) cancelled mid-launch (output empty; tag query finds it),
+ # (c) double-launch from a retry that escaped client-token (both
+ # share the tag and both get terminated).
+ - name: Terminate EC2 instance (safety net)
+ env:
+ PUBLISHED_INSTANCE_ID: ${{ needs.create-runner-aws.outputs.instance_id }}
+ run: |
+ set -euo pipefail
+ IDS=$(aws ec2 describe-instances \
+ --region "$AWS_REGION" \
+ --filters \
+ "Name=tag:github_run_id,Values=${{ github.run_id }}" \
+ "Name=tag:github_run_attempt,Values=${{ github.run_attempt }}" \
+ "Name=tag:github_repository,Values=${{ github.repository }}" \
+ "Name=tag:iit-billing-tag,Values=percona-server-gha-fallback" \
+ "Name=instance-state-name,Values=pending,running,stopping,stopped" \
+ --query 'Reservations[].Instances[].InstanceId' --output text 2>/dev/null || true)
+ # Union with whatever the create job published; dedupe via sort -u.
+ ALL_IDS=$(printf '%s\n%s\n' "$IDS" "${PUBLISHED_INSTANCE_ID:-}" \
+ | tr '\t' '\n' | grep -E '^i-' | sort -u || true)
+ if [ -z "$ALL_IDS" ]; then
+ echo "No live EC2 instance found for run ${{ github.run_id }} attempt ${{ github.run_attempt }} (already terminated or never launched)"
+ exit 0
+ fi
+ echo "Terminating: $ALL_IDS"
+ # || true: instance may race to terminated between describe and
+ # terminate; either way we want this job to succeed so the
+ # workflow status is not contaminated by cleanup-only errors.
+ # shellcheck disable=SC2086
+ aws ec2 terminate-instances \
+ --region "$AWS_REGION" \
+ --instance-ids $ALL_IDS >/dev/null 2>&1 || true
+
+ - name: De-register orphaned runner (if still present)
+ env:
+ GH_TOKEN: ${{ secrets.GHA_RUNNER_PAT }}
+ run: |
+ set -euo pipefail
+ ID=$(gh api -X GET /repos/${{ github.repository }}/actions/runners --paginate \
+ --jq ".runners[] | select(.name == \"$EPHEMERAL_RUNNER_NAME\") | .id" || true)
+ if [ -n "$ID" ]; then
+ gh api -X DELETE "/repos/${{ github.repository }}/actions/runners/$ID" || true
+ echo "Removed orphan runner $EPHEMERAL_RUNNER_NAME (id=$ID)"
+ else
+ echo "Runner $EPHEMERAL_RUNNER_NAME already de-registered (ephemeral self-removal)"
+ fi
diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml
new file mode 100644
index 000000000000..7675e9dd8bf7
--- /dev/null
+++ b/.github/workflows/clang-format.yml
@@ -0,0 +1,72 @@
+# Copyright (c) 2026, Oracle and/or its affiliates.
+name: Format Check
+on:
+ pull_request_target:
+ branches: [trunk]
+ paths: ["**/*.c", "**/*.cc", "**/*.cpp", "**/*.h", "**/*.hpp"]
+
+permissions: {}
+
+concurrency:
+ group: format-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+jobs:
+ clang-format:
+ runs-on: ubuntu-24.04
+ permissions:
+ contents: read
+ steps:
+ - name: Check out PR merge commit
+ uses: actions/checkout@v4
+ with:
+ ref: refs/pull/${{ github.event.pull_request.number }}/merge
+ fetch-depth: 2
+ persist-credentials: false
+ path: source
+ - name: Verify PR merge commit
+ working-directory: source
+ env:
+ EXPECTED_BASE: ${{ github.event.pull_request.base.sha }}
+ EXPECTED_HEAD: ${{ github.event.pull_request.head.sha }}
+ run: |
+ test "$(git rev-parse HEAD^1)" = "$EXPECTED_BASE"
+ test "$(git rev-parse HEAD^2)" = "$EXPECTED_HEAD"
+ - name: Install clang-format
+ run: sudo apt-get update && sudo apt-get install -y clang-format-18
+ # Uses the repository's existing .clang-format — no style is redefined here.
+ - name: Check formatting of changed files
+ working-directory: source
+ run: |
+ changed=$(git diff --name-only HEAD^1 HEAD | grep -E '\.(c|cc|cpp|h|hpp)$' || true)
+ [ -z "$changed" ] && { echo "No C/C++ changes."; exit 0; }
+ fail=0
+ for f in $changed; do
+ [ -f "$f" ] || continue
+ if ! clang-format-18 --style=file --dry-run --Werror "$f"; then fail=1; fi
+ done
+ if [ "$fail" -ne 0 ]; then
+ echo "::error::Run scripts/ci/format.sh to fix formatting."; exit 1
+ fi
+
+ report:
+ name: Report format result
+ if: ${{ always() && !cancelled() }}
+ needs: clang-format
+ runs-on: ubuntu-24.04
+ permissions:
+ statuses: write
+ steps:
+ - name: Publish format status on the PR head
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const passed = '${{ needs.clang-format.result }}' === 'success';
+ await github.rest.repos.createCommitStatus({
+ ...context.repo,
+ sha: context.payload.pull_request.head.sha,
+ state: passed ? 'success' : 'failure',
+ context: 'Format Check',
+ description: passed ? 'Formatting check passed' : 'Formatting check failed',
+ target_url: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
+ });
diff --git a/.github/workflows/codex-pr-review.yml b/.github/workflows/codex-pr-review.yml
new file mode 100644
index 000000000000..fea6dedc52e3
--- /dev/null
+++ b/.github/workflows/codex-pr-review.yml
@@ -0,0 +1,154 @@
+# Copyright (c) 2026, Oracle and/or its affiliates.
+name: Codex PR Review
+
+on:
+ pull_request_target:
+ types: [opened, synchronize, reopened, ready_for_review]
+ branches: [trunk]
+
+permissions: {}
+
+concurrency:
+ group: codex-pr-review-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+jobs:
+ codex:
+ # This job uses an API secret, so only trusted repository actors may run it.
+ if: >-
+ github.event.pull_request.draft == false &&
+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)
+ runs-on: ubuntu-24.04
+ timeout-minutes: 20
+ permissions:
+ contents: read
+ outputs:
+ review_b64: ${{ steps.run_review.outputs.review_b64 }}
+ steps:
+ - name: Verify PR author can write
+ uses: actions/github-script@v7
+ with:
+ github-token: ${{ github.token }}
+ script: |
+ const username = context.payload.pull_request.user.login;
+ const { data } = await github.rest.repos.getCollaboratorPermissionLevel({
+ ...context.repo,
+ username,
+ });
+ if (!['admin', 'maintain', 'write'].includes(data.permission)) {
+ throw new Error(`@${username} does not have write permission`);
+ }
+
+ - name: Check out PR merge commit
+ uses: actions/checkout@v4
+ with:
+ ref: refs/pull/${{ github.event.pull_request.number }}/merge
+ fetch-depth: 2
+ persist-credentials: false
+ path: source
+
+ - name: Verify PR merge commit
+ working-directory: source
+ env:
+ EXPECTED_BASE: ${{ github.event.pull_request.base.sha }}
+ EXPECTED_HEAD: ${{ github.event.pull_request.head.sha }}
+ run: |
+ test "$(git rev-parse HEAD^1)" = "$EXPECTED_BASE"
+ test "$(git rev-parse HEAD^2)" = "$EXPECTED_HEAD"
+
+ - name: Check out trusted review client
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.event.pull_request.base.sha }}
+ fetch-depth: 1
+ persist-credentials: false
+ sparse-checkout: scripts/ci/codex_pr_review.py
+ sparse-checkout-cone-mode: false
+ path: trusted
+
+ - name: Verify trusted review client
+ env:
+ EXPECTED_BASE: ${{ github.event.pull_request.base.sha }}
+ run: test "$(git -C trusted rev-parse HEAD)" = "$EXPECTED_BASE"
+
+ - name: Review pull request
+ id: run_review
+ env:
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
+ OPENAI_REVIEW_MODEL: ${{ vars.OPENAI_REVIEW_MODEL || 'gpt-5.6-sol' }}
+ PYTHONNOUSERSITE: "1"
+ PYTHONSAFEPATH: "1"
+ run: >-
+ python3 "$GITHUB_WORKSPACE/trusted/scripts/ci/codex_pr_review.py"
+ --source "$GITHUB_WORKSPACE/source"
+
+ post_feedback:
+ runs-on: ubuntu-24.04
+ needs: codex
+ if: >-
+ needs.codex.result == 'success' &&
+ needs.codex.outputs.review_b64 != ''
+ permissions:
+ issues: write
+ pull-requests: write
+ steps:
+ - name: Post Codex feedback
+ uses: actions/github-script@v7
+ env:
+ REVIEW_B64: ${{ needs.codex.outputs.review_b64 }}
+ with:
+ github-token: ${{ github.token }}
+ script: |
+ const encoded = process.env.REVIEW_B64 || '';
+ const base64 = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
+ if (!encoded || !base64.test(encoded)) {
+ throw new Error('Review output is not canonical base64');
+ }
+ const decoded = Buffer.from(encoded, 'base64');
+ if (decoded.length === 0 || decoded.length > 48 * 1024) {
+ throw new Error('Review output is empty or too large');
+ }
+ if (decoded.toString('base64') !== encoded) {
+ throw new Error('Review output failed base64 validation');
+ }
+ const body = decoded.toString('utf8');
+ if (!Buffer.from(body, 'utf8').equals(decoded)) {
+ throw new Error('Review output is not valid UTF-8');
+ }
+ const safeBody = body.replace(/@(?=[A-Za-z0-9_-])/g, '@\u200b');
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.payload.pull_request.number,
+ body: '\n' + safeBody,
+ });
+
+ report:
+ name: Report Codex result
+ if: >-
+ always() && !cancelled() &&
+ github.event.pull_request.draft == false &&
+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)
+ needs: [codex, post_feedback]
+ runs-on: ubuntu-24.04
+ permissions:
+ statuses: write
+ steps:
+ - name: Publish Codex status on the PR head
+ uses: actions/github-script@v7
+ env:
+ REVIEW_RESULT: ${{ needs.codex.result }}
+ POST_RESULT: ${{ needs.post_feedback.result }}
+ with:
+ script: |
+ const passed =
+ process.env.REVIEW_RESULT === 'success' &&
+ process.env.POST_RESULT === 'success';
+ await github.rest.repos.createCommitStatus({
+ ...context.repo,
+ sha: context.payload.pull_request.head.sha,
+ state: passed ? 'success' : 'failure',
+ context: 'Codex PR Review',
+ description: passed ? 'Automated review posted' : 'Automated review failed',
+ target_url: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
+ });
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
new file mode 100644
index 000000000000..bc61da9a00d5
--- /dev/null
+++ b/.github/workflows/labeler.yml
@@ -0,0 +1,40 @@
+# Copyright (c) 2026, Oracle and/or its affiliates.
+name: Auto Label
+
+on:
+ pull_request_target:
+ branches: [trunk]
+
+permissions: { contents: read, pull-requests: write, issues: write }
+
+jobs:
+ label:
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Ensure labels have colors
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const labels = [
+ { name: 'innodb', color: '1D76DB', description: 'Changes touching InnoDB storage engine code' },
+ { name: 'optimizer', color: '5319E7', description: 'Changes touching optimizer code' },
+ { name: 'replication', color: '0052CC', description: 'Changes touching replication or binlog code' },
+ { name: 'client', color: '0E8A16', description: 'Changes touching client or libmysql code' },
+ { name: 'pluggable', color: 'FBCA04', description: 'Changes touching plugins or components' },
+ { name: 'build', color: 'D93F0B', description: 'Changes touching build or GitHub automation' },
+ { name: 'tests', color: 'BFDADC', description: 'Changes touching test code or test data' },
+ { name: 'docs', color: '0075CA', description: 'Changes touching documentation' },
+ ];
+
+ for (const label of labels) {
+ try {
+ await github.rest.issues.getLabel({ ...context.repo, name: label.name });
+ await github.rest.issues.updateLabel({ ...context.repo, ...label });
+ } catch (error) {
+ if (error.status !== 404) throw error;
+ await github.rest.issues.createLabel({ ...context.repo, ...label });
+ }
+ }
+
+ - uses: actions/labeler@v5
+ with: { sync-labels: true }
diff --git a/.github/workflows/mark-integrate.yml b/.github/workflows/mark-integrate.yml
new file mode 100644
index 000000000000..796f07ee36dc
--- /dev/null
+++ b/.github/workflows/mark-integrate.yml
@@ -0,0 +1,89 @@
+# Copyright (c) 2026, Oracle and/or its affiliates.
+name: Mark Integrate
+
+on:
+ # Review events load workflow YAML from the PR merge ref. Reconcile reviews
+ # once daily from the default branch so only the merged workflow runs.
+ schedule:
+ - cron: "0 6 * * *"
+
+permissions: {}
+
+concurrency:
+ group: mark-integrate-scheduled
+ cancel-in-progress: true
+
+jobs:
+ integrate:
+ runs-on: ubuntu-24.04
+ permissions:
+ issues: write
+ pull-requests: write
+ steps:
+ - name: Reconcile integrate label
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const label = {
+ name: 'integrate',
+ color: '5319E7',
+ description: 'Approved patch ready for integration',
+ };
+
+ try {
+ await github.rest.issues.getLabel({ ...context.repo, name: label.name });
+ await github.rest.issues.updateLabel({ ...context.repo, ...label });
+ } catch (error) {
+ if (error.status !== 404) throw error;
+ await github.rest.issues.createLabel({ ...context.repo, ...label });
+ }
+
+ const prs = await github.paginate(github.rest.pulls.list, {
+ ...context.repo,
+ state: 'open',
+ base: 'trunk',
+ per_page: 100,
+ });
+
+ for (const pr of prs) {
+ if (pr.base.ref !== 'trunk') continue;
+
+ const reviews = await github.paginate(github.rest.pulls.listReviews, {
+ ...context.repo,
+ pull_number: pr.number,
+ per_page: 100,
+ });
+ const meaningfulStates = new Set(['APPROVED', 'CHANGES_REQUESTED', 'DISMISSED']);
+ const latestStates = new Map();
+
+ for (const review of reviews) {
+ const login = review.user?.login;
+ if (login && meaningfulStates.has(review.state)) {
+ latestStates.set(login, review.state);
+ }
+ }
+
+ const approvers = [...latestStates.entries()]
+ .filter(([, state]) => state === 'APPROVED')
+ .map(([login]) => login);
+
+ if (approvers.length > 0) {
+ await github.rest.issues.addLabels({
+ ...context.repo,
+ issue_number: pr.number,
+ labels: [label.name],
+ });
+ core.info(`Marked PR #${pr.number} as integrate; active approvals: ${approvers.join(', ')}.`);
+ } else {
+ try {
+ await github.rest.issues.removeLabel({
+ ...context.repo,
+ issue_number: pr.number,
+ name: label.name,
+ });
+ } catch (error) {
+ if (error.status !== 404) throw error;
+ }
+ core.info(`Removed integrate from PR #${pr.number}; no active approvals remain.`);
+ }
+ }
diff --git a/.github/workflows/mtr.yml b/.github/workflows/mtr.yml
new file mode 100644
index 000000000000..f3d359e9aa21
--- /dev/null
+++ b/.github/workflows/mtr.yml
@@ -0,0 +1,130 @@
+# Copyright (c) 2026, Oracle and/or its affiliates.
+name: MTR
+on:
+ pull_request_target:
+ branches: [trunk]
+ paths-ignore: ["Docs/**", "**/*.md"]
+
+permissions: {}
+
+concurrency:
+ group: mtr-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+# Run MTR's normal default test selection on every PR.
+jobs:
+ mtr:
+ runs-on: ubuntu-latest
+ # A full default MTR selection needs substantially more time than the
+ # retired smoke check. 360 minutes is GitHub-hosted runners' job maximum.
+ timeout-minutes: 360
+ needs: []
+ permissions:
+ contents: read
+ steps:
+ - name: Check out PR merge commit
+ uses: actions/checkout@v4
+ with:
+ ref: refs/pull/${{ github.event.pull_request.number }}/merge
+ fetch-depth: 2
+ persist-credentials: false
+ path: source
+ - name: Check out trusted CI scripts
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.event.pull_request.base.sha }}
+ persist-credentials: false
+ sparse-checkout: scripts/ci
+ path: trusted
+ - name: Verify PR merge commit
+ working-directory: source
+ env:
+ EXPECTED_BASE: ${{ github.event.pull_request.base.sha }}
+ EXPECTED_HEAD: ${{ github.event.pull_request.head.sha }}
+ run: |
+ test "$(git rev-parse HEAD^1)" = "$EXPECTED_BASE"
+ test "$(git rev-parse HEAD^2)" = "$EXPECTED_HEAD"
+ - name: Install toolchain
+ working-directory: source
+ run: ../trusted/scripts/ci/bootstrap.sh
+ # A target workflow may restore trunk caches but must never save PR data.
+ - name: Restore Boost cache
+ uses: actions/cache/restore@v4
+ with:
+ path: ~/.cache/mysql-boost
+ key: boost-${{ hashFiles('source/cmake/boost.cmake') }}
+ - name: Restore ccache
+ uses: actions/cache/restore@v4
+ with:
+ path: ~/.cache/ccache
+ key: ccache-gcc-${{ github.event.pull_request.head.sha }}
+ restore-keys: ccache-gcc-
+ - name: Build
+ working-directory: source
+ run: ../trusted/scripts/ci/build.sh debug
+ - name: Run MTR
+ working-directory: source
+ run: ../trusted/scripts/ci/mtr.sh
+ - name: Publish test report
+ if: always()
+ uses: actions/upload-artifact@v4
+ with:
+ name: mtr-logs-${{ github.run_id }}
+ path: source/build/mysql-test/var/log/
+ retention-days: 5
+
+ report:
+ name: Label MTR result
+ if: ${{ always() && !cancelled() }}
+ needs: mtr
+ runs-on: ubuntu-24.04
+ permissions:
+ issues: write
+ pull-requests: write
+ statuses: write
+ steps:
+ - name: Update MTR result label
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const passed = '${{ needs.mtr.result }}' === 'success';
+ const labels = [
+ { name: 'MTR Passed', color: '0E8A16', description: 'MTR suite passed' },
+ { name: 'MTR Failed', color: 'D93F0B', description: 'MTR suite failed' },
+ ];
+
+ for (const label of labels) {
+ try {
+ await github.rest.issues.getLabel({ ...context.repo, name: label.name });
+ await github.rest.issues.updateLabel({ ...context.repo, ...label });
+ } catch (error) {
+ if (error.status !== 404) throw error;
+ await github.rest.issues.createLabel({ ...context.repo, ...label });
+ }
+ }
+
+ const selected = passed ? labels[0] : labels[1];
+ const opposite = passed ? labels[1] : labels[0];
+ try {
+ await github.rest.issues.removeLabel({
+ ...context.repo,
+ issue_number: context.payload.pull_request.number,
+ name: opposite.name,
+ });
+ } catch (error) {
+ if (error.status !== 404) throw error;
+ }
+ await github.rest.issues.addLabels({
+ ...context.repo,
+ issue_number: context.payload.pull_request.number,
+ labels: [selected.name],
+ });
+ await github.rest.repos.createCommitStatus({
+ ...context.repo,
+ sha: context.payload.pull_request.head.sha,
+ state: passed ? 'success' : 'failure',
+ context: 'MTR',
+ description: passed ? 'MySQL Test Run passed' : 'MySQL Test Run failed',
+ target_url: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
+ });
+ core.info(`Set PR #${context.payload.pull_request.number} to ${selected.name}.`);
diff --git a/.github/workflows/orphan-sweep.yml b/.github/workflows/orphan-sweep.yml
new file mode 100644
index 000000000000..76a97e4d8731
--- /dev/null
+++ b/.github/workflows/orphan-sweep.yml
@@ -0,0 +1,250 @@
+# Hourly sweeper for leaked runner VMs (Hetzner + AWS EC2) and offline
+# GHA runners. Companion to builds.yml; catches orphans from control-plane
+# crashes, cancelled workflows, and probe-step leaks.
+#
+# Runs only in percona/percona-server: forks that enable Actions would
+# otherwise inherit the hourly cron and fail every run (no secrets, and
+# the AWS OIDC trust rejects fork subjects), spamming the fork owner.
+#
+# PS-11179 (2026-05-28): EC2 sweep added for the AWS fallback path.
+
+name: orphan-sweep
+
+on:
+ schedule:
+ - cron: '23 * * * *' # hourly, off the top of hour
+ workflow_dispatch:
+ inputs:
+ dry_run:
+ description: 'Dry-run: list what would be deleted, do nothing'
+ type: boolean
+ default: false
+ max_age_hours:
+ description: 'Orphan age threshold (hours); default 6h; lower at your own risk (build-arm64 has timeout-minutes: 240)'
+ type: string
+ default: '6'
+
+# Workflow-level permissions are empty. The sweep-ec2 job opts in to
+# id-token: write for OIDC -> AWS STS. Other jobs need nothing.
+permissions: {}
+
+concurrency:
+ group: orphan-sweep
+ cancel-in-progress: false # let prior sweep finish; serialize with next
+
+jobs:
+ sweep:
+ if: github.repository == 'percona/percona-server'
+ runs-on: ubuntu-latest
+ permissions: {}
+ env:
+ HCLOUD_TOKEN: ${{ secrets.GHA_RUNNER_HCLOUD_TOKEN }}
+ GH_TOKEN: ${{ secrets.GHA_RUNNER_PAT }}
+ DRY_RUN: ${{ inputs.dry_run || 'false' }}
+ MAX_AGE_HOURS: ${{ inputs.max_age_hours || '6' }}
+ steps:
+ - name: Sweep Hetzner orphans
+ run: |
+ set -euo pipefail
+ : "${HCLOUD_TOKEN:?secret HCLOUD_TOKEN required}"
+ NOW=$(date -u +%s)
+ MAX_AGE_SECONDS=$(( MAX_AGE_HOURS * 3600 ))
+ echo "Threshold: ${MAX_AGE_HOURS}h (${MAX_AGE_SECONDS}s); dry_run=${DRY_RUN}"
+
+ # Page through all servers (max 50/page). Servers we own start with ps-arm64- or cap-probe-.
+ PAGE=1
+ : > /tmp/candidates.tsv
+ while :; do
+ RESP=$(curl -fsS -H "Authorization: Bearer $HCLOUD_TOKEN" \
+ "https://api.hetzner.cloud/v1/servers?per_page=50&page=${PAGE}")
+ echo "$RESP" \
+ | jq -r --arg now "$NOW" --arg age "$MAX_AGE_SECONDS" '
+ .servers[]
+ | select(.name | test("^(ps-arm64-|cap-probe-)"))
+ | select(($now|tonumber) - (.created | fromdateiso8601) > ($age|tonumber))
+ | [.id, .name, .created] | @tsv' \
+ >> /tmp/candidates.tsv
+ LAST=$(echo "$RESP" | jq -r '.meta.pagination.last_page // 1')
+ [ "$PAGE" -ge "$LAST" ] && break
+ PAGE=$((PAGE+1))
+ done
+
+ TOTAL=$(wc -l < /tmp/candidates.tsv)
+ DELETED=0
+ FAILED=0
+ if [ "$TOTAL" -gt 0 ]; then
+ echo "Candidates (>${MAX_AGE_HOURS}h old, matching prefix):"
+ cat /tmp/candidates.tsv
+ while IFS=$'\t' read -r id name created; do
+ if [ "$DRY_RUN" = "true" ]; then
+ echo "::notice::[dry-run] would delete $name (id=$id, created=$created)"
+ else
+ echo "::warning::Deleting orphan: $name (id=$id, created=$created)"
+ if curl -fsS -X DELETE -H "Authorization: Bearer $HCLOUD_TOKEN" \
+ "https://api.hetzner.cloud/v1/servers/$id" >/dev/null; then
+ DELETED=$((DELETED+1))
+ else
+ echo "::error::Failed to delete server $id"
+ FAILED=$((FAILED+1))
+ fi
+ fi
+ done < /tmp/candidates.tsv
+ fi
+
+ {
+ echo "### Hetzner sweep"
+ echo ""
+ echo "| metric | value |"
+ echo "|---|---|"
+ echo "| candidates | ${TOTAL} |"
+ echo "| deleted | ${DELETED} |"
+ echo "| failed | ${FAILED} |"
+ echo "| threshold | ${MAX_AGE_HOURS}h |"
+ echo "| dry_run | ${DRY_RUN} |"
+ } >> "$GITHUB_STEP_SUMMARY"
+
+ - name: Sweep offline GHA runners
+ if: env.GH_TOKEN != ''
+ run: |
+ set -euo pipefail
+ UNREGISTERED=0
+ FAILED=0
+ # offline runners with our naming prefix
+ mapfile -t LINES < <(
+ curl -fsS -H "Authorization: Bearer $GH_TOKEN" \
+ "https://api.github.com/repos/${{ github.repository }}/actions/runners?per_page=100" \
+ | jq -r '.runners[] | select(.status=="offline") | select(.name | test("^ps-arm64-")) | "\(.id)\t\(.name)"'
+ )
+ for line in "${LINES[@]}"; do
+ [ -z "$line" ] && continue
+ id="${line%%$'\t'*}"
+ name="${line#*$'\t'}"
+ if [ "$DRY_RUN" = "true" ]; then
+ echo "::notice::[dry-run] would unregister offline runner: $name (id=$id)"
+ else
+ echo "::warning::Unregistering offline runner: $name (id=$id)"
+ if curl -fsS -X DELETE -H "Authorization: Bearer $GH_TOKEN" \
+ "https://api.github.com/repos/${{ github.repository }}/actions/runners/$id" >/dev/null; then
+ UNREGISTERED=$((UNREGISTERED+1))
+ else
+ FAILED=$((FAILED+1))
+ fi
+ fi
+ done
+
+ {
+ echo ""
+ echo "### GHA offline runner sweep"
+ echo ""
+ echo "| metric | value |"
+ echo "|---|---|"
+ echo "| unregistered | ${UNREGISTERED} |"
+ echo "| failed | ${FAILED} |"
+ echo "| candidates | ${#LINES[@]} |"
+ } >> "$GITHUB_STEP_SUMMARY"
+
+ # PS-11179: EC2 orphan sweep for the AWS fallback path.
+ # Mirrors the Hetzner sweep cadence + threshold: hourly, default 6h age.
+ # OIDC -> STS via the same AWS_ROLE_ARN used by builds.yml. Region pinned
+ # to eu-central-1 (matches create-runner-aws).
+ sweep-ec2:
+ if: github.repository == 'percona/percona-server'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ id-token: write
+ env:
+ DRY_RUN: ${{ inputs.dry_run || 'false' }}
+ MAX_AGE_HOURS: ${{ inputs.max_age_hours || '6' }}
+ AWS_REGION: eu-central-1
+ steps:
+ - name: Configure AWS credentials via OIDC
+ uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
+ with:
+ role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
+ role-session-name: orphan-sweep-${{ github.run_id }}-${{ github.run_attempt }}
+ aws-region: ${{ env.AWS_REGION }}
+
+ - name: Sweep EC2 orphans
+ run: |
+ set -euo pipefail
+ NOW=$(date -u +%s)
+ MAX_AGE_SECONDS=$(( MAX_AGE_HOURS * 3600 ))
+ echo "Threshold: ${MAX_AGE_HOURS}h (${MAX_AGE_SECONDS}s); dry_run=${DRY_RUN}; region=${AWS_REGION}"
+
+ # Find every instance we own that is still alive. We tag-key on
+ # iit-billing-tag + github_repository so we never accidentally
+ # reach into another workload's instances.
+ # The --query string uses JMESPath; the backticks around `Name`
+ # are JMESPath literal syntax, not shell command substitution,
+ # so single-quoting is required (shellcheck SC2016 noise).
+ # shellcheck disable=SC2016
+ aws ec2 describe-instances \
+ --region "$AWS_REGION" \
+ --filters \
+ "Name=tag:iit-billing-tag,Values=percona-server-gha-fallback" \
+ "Name=tag:github_repository,Values=${{ github.repository }}" \
+ "Name=instance-state-name,Values=pending,running,stopping,stopped" \
+ --query 'Reservations[].Instances[].[InstanceId,LaunchTime,State.Name,Tags[?Key==`Name`]|[0].Value]' \
+ --output text > /tmp/ec2-instances.tsv || true
+
+ TOTAL=$(wc -l < /tmp/ec2-instances.tsv | tr -d ' ')
+ DELETED=0
+ FAILED=0
+ SKIPPED=0
+ : > /tmp/ec2-candidates.tsv
+ if [ "${TOTAL:-0}" -gt 0 ]; then
+ while IFS=$'\t' read -r id launch state name; do
+ [ -z "$id" ] && continue
+ # LaunchTime is RFC3339 (e.g. 2026-05-28T12:34:56.000Z); strip
+ # millis and trailing Z so `date -d` parses on Ubuntu 24.04.
+ launch_clean=$(echo "$launch" | sed -E 's/\.[0-9]+Z?$/Z/')
+ launch_epoch=$(date -u -d "$launch_clean" +%s 2>/dev/null || echo "")
+ if [ -z "$launch_epoch" ]; then
+ echo "::warning::Skipping $id; could not parse LaunchTime=$launch"
+ SKIPPED=$((SKIPPED+1))
+ continue
+ fi
+ age=$(( NOW - launch_epoch ))
+ if [ "$age" -lt "$MAX_AGE_SECONDS" ]; then
+ continue
+ fi
+ echo "$id $name $state $launch $age" >> /tmp/ec2-candidates.tsv
+ done < /tmp/ec2-instances.tsv
+ fi
+
+ CANDIDATES=$(wc -l < /tmp/ec2-candidates.tsv | tr -d ' ')
+ if [ "${CANDIDATES:-0}" -gt 0 ]; then
+ echo "Candidates (>${MAX_AGE_HOURS}h old, matching tags):"
+ cat /tmp/ec2-candidates.tsv
+ while IFS=$'\t' read -r id name state launch age; do
+ if [ "$DRY_RUN" = "true" ]; then
+ echo "::notice::[dry-run] would terminate $name ($id; state=$state; age=${age}s)"
+ else
+ echo "::warning::Terminating orphan EC2 instance: $name ($id; state=$state; age=${age}s)"
+ if aws ec2 terminate-instances \
+ --region "$AWS_REGION" \
+ --instance-ids "$id" >/dev/null 2>&1; then
+ DELETED=$((DELETED+1))
+ else
+ echo "::error::Failed to terminate $id"
+ FAILED=$((FAILED+1))
+ fi
+ fi
+ done < /tmp/ec2-candidates.tsv
+ fi
+
+ {
+ echo ""
+ echo "### EC2 sweep (${AWS_REGION})"
+ echo ""
+ echo "| metric | value |"
+ echo "|---|---|"
+ echo "| live instances | ${TOTAL} |"
+ echo "| candidates | ${CANDIDATES} |"
+ echo "| terminated | ${DELETED} |"
+ echo "| failed | ${FAILED} |"
+ echo "| skipped (parse) | ${SKIPPED} |"
+ echo "| threshold | ${MAX_AGE_HOURS}h |"
+ echo "| dry_run | ${DRY_RUN} |"
+ } >> "$GITHUB_STEP_SUMMARY"
diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml
new file mode 100644
index 000000000000..736a8321acde
--- /dev/null
+++ b/.github/workflows/pr-build.yml
@@ -0,0 +1,135 @@
+# Copyright (c) 2026, Oracle and/or its affiliates.
+name: PR Build
+on:
+ pull_request_target:
+ branches: [trunk]
+ paths-ignore: ["Docs/**", "**/*.md"]
+
+permissions: {}
+
+# Cancel superseded runs so a fast push doesn't queue behind a stale build.
+concurrency:
+ group: build-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+jobs:
+ build:
+ name: Debug build (${{ matrix.compiler }})
+ runs-on: ubuntu-latest
+ timeout-minutes: 360
+ permissions:
+ contents: read
+ strategy:
+ fail-fast: false
+ matrix:
+ compiler: [gcc, clang]
+ env:
+ CC: ${{ matrix.compiler == 'gcc' && 'gcc' || 'clang' }}
+ CXX: ${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }}
+ steps:
+ - name: Check out PR merge commit
+ uses: actions/checkout@v4
+ with:
+ ref: refs/pull/${{ github.event.pull_request.number }}/merge
+ fetch-depth: 2
+ persist-credentials: false
+ path: source
+ - name: Check out trusted CI scripts
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.event.pull_request.base.sha }}
+ persist-credentials: false
+ sparse-checkout: scripts/ci
+ path: trusted
+ - name: Verify PR merge commit
+ working-directory: source
+ env:
+ EXPECTED_BASE: ${{ github.event.pull_request.base.sha }}
+ EXPECTED_HEAD: ${{ github.event.pull_request.head.sha }}
+ run: |
+ test "$(git rev-parse HEAD^1)" = "$EXPECTED_BASE"
+ test "$(git rev-parse HEAD^2)" = "$EXPECTED_HEAD"
+ - name: Install toolchain
+ working-directory: source
+ run: ../trusted/scripts/ci/bootstrap.sh
+ # A target workflow may restore trunk caches but must never save PR data.
+ - name: Restore Boost cache
+ uses: actions/cache/restore@v4
+ with:
+ path: ~/.cache/mysql-boost
+ key: boost-${{ hashFiles('source/cmake/boost.cmake') }}
+ - name: Restore ccache
+ uses: actions/cache/restore@v4
+ with:
+ path: ~/.cache/ccache
+ key: ccache-${{ matrix.compiler }}-${{ github.event.pull_request.head.sha }}
+ restore-keys: ccache-${{ matrix.compiler }}-
+ - name: Show runner resources
+ working-directory: source
+ run: |
+ echo "CPU cores: $(nproc)"
+ free -h
+ df -h .
+ - name: Build
+ working-directory: source
+ run: ../trusted/scripts/ci/build.sh debug
+ - name: Show ccache stats
+ if: always()
+ working-directory: source
+ run: ccache --show-stats
+
+ report:
+ name: Label build result
+ if: ${{ always() && !cancelled() }}
+ needs: build
+ runs-on: ubuntu-24.04
+ permissions:
+ issues: write
+ pull-requests: write
+ statuses: write
+ steps:
+ - name: Update build result label
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const passed = '${{ needs.build.result }}' === 'success';
+ const labels = [
+ { name: 'Build Passed', color: '0E8A16', description: 'PR build passed' },
+ { name: 'Build Failed', color: 'D93F0B', description: 'PR build failed' },
+ ];
+
+ for (const label of labels) {
+ try {
+ await github.rest.issues.getLabel({ ...context.repo, name: label.name });
+ await github.rest.issues.updateLabel({ ...context.repo, ...label });
+ } catch (error) {
+ if (error.status !== 404) throw error;
+ await github.rest.issues.createLabel({ ...context.repo, ...label });
+ }
+ }
+
+ const selected = passed ? labels[0] : labels[1];
+ const opposite = passed ? labels[1] : labels[0];
+ try {
+ await github.rest.issues.removeLabel({
+ ...context.repo,
+ issue_number: context.payload.pull_request.number,
+ name: opposite.name,
+ });
+ } catch (error) {
+ if (error.status !== 404) throw error;
+ }
+ await github.rest.issues.addLabels({
+ ...context.repo,
+ issue_number: context.payload.pull_request.number,
+ labels: [selected.name],
+ });
+ await github.rest.repos.createCommitStatus({
+ ...context.repo,
+ sha: context.payload.pull_request.head.sha,
+ state: passed ? 'success' : 'failure',
+ context: 'PR Build',
+ description: passed ? 'GCC and Clang builds passed' : 'A PR build failed',
+ target_url: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
+ });
+ core.info(`Set PR #${context.payload.pull_request.number} to ${selected.name}.`);
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
new file mode 100644
index 000000000000..c331e3c28935
--- /dev/null
+++ b/.github/workflows/stale.yml
@@ -0,0 +1,23 @@
+# Copyright (c) 2026, Oracle and/or its affiliates.
+name: Triage Hygiene
+on:
+ schedule: [{ cron: "0 6 * * 1-5" }] # weekday mornings
+permissions: { issues: write, pull-requests: write }
+
+# PR-only hygiene: only PRs explicitly waiting on the author for information
+# are eligible. The matching issue label is exempted so this scheduled action
+# never marks or closes issues.
+# Eligible PRs become stale after 16 inactive days and close 14 days later
+# (30 inactive days in total).
+jobs:
+ stale:
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/stale@v9
+ with:
+ only-labels: "needs-info"
+ exempt-issue-labels: "needs-info"
+ days-before-pr-stale: 16
+ days-before-pr-close: 14
+ stale-pr-message: "Marking as stale: waiting on requested changes. Push or comment to keep it open."
+ exempt-pr-labels: "good first issue,help wanted,under-review"
diff --git a/.gitmodules b/.gitmodules
index dc657ac1b680..eccf94cbd88b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -12,3 +12,6 @@
[submodule "extra/libkmip"]
path = extra/libkmip
url = https://github.com/Percona-Lab/libkmip.git
+[submodule "extra/jwt-cpp"]
+ path = extra/jwt-cpp
+ url = https://github.com/Thalhammer/jwt-cpp
diff --git a/CMakeLists.txt b/CMakeLists.txt
index edd485a172c2..737777af6241 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -164,6 +164,8 @@ ENDIF()
# PAM build Handling
OPTION(WITH_PAM "Build with Percona PAM plugin" OFF)
+OPTION(WITH_AUTH_OPENID_CONNECT "Build with Percona OpenID Connect authentication plugin" ON)
+
# We choose to provide WITH_DEBUG as alias to standard CMAKE_BUILD_TYPE=Debug
# which turns out to be not trivial, as this involves synchronization
# between CMAKE_BUILD_TYPE and WITH_DEBUG. Besides, we have to deal with cases
diff --git a/LICENSE b/LICENSE
index 6d81a1022174..0cd4fb96d486 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
Licensing Information User Manual
-MySQL 9.7.0 Community
+MySQL 9.7.2 Community
__________________________________________________________________
Introduction
@@ -8,18 +8,18 @@ Introduction
This License Information User Manual contains Oracle's product license
and other licensing information, including licensing information for
third-party software which may be included in this distribution of
- MySQL 9.7.0 Community.
+ MySQL 9.7.2 Community.
- Last updated: February 2026
+ Last updated: June 2026
Licensing Information
- This release of MySQL 9.7.0 Community is brought to you by the MySQL
+ This release of MySQL 9.7.2 Community is brought to you by the MySQL
team at Oracle. This software is released under version 2 of the GNU
General Public License (GPLv2), as set forth below, with the following
additional permissions:
- This distribution of MySQL 9.7.0 Community is designed to work with
+ This distribution of MySQL 9.7.2 Community is designed to work with
certain software (including but not limited to OpenSSL) that is
licensed under separate terms, as designated in a particular file or
component or in the license documentation. Without limiting your rights
@@ -3527,6 +3527,168 @@ See Apache License v2.0, January 2004 in the
======================================================================
======================================================================
+OpenTelemetry C++
+
+You may be receiving a copy of the opentelemetry-cpp library with
+this MySQL product. The terms of the Oracle license do NOT apply
+to the opentelemetry-cpp library; it is licensed under the following
+license, separately from the Oracle programs you receive.
+If you do not wish to install this program, you may delete its files
+but the Oracle program might not operate properly or at all without it.
+
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+LICENSE:
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+A copy of the Apache License v2.0, January 2004 license can be found
+in the 'Standard Licenses' section.
+
+
+4th Party Dependencies
+======================
+opentelemetry-proto
+-------------------
+// Copyright 2019, OpenTelemetry Authors
+//
+// 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.
+
+Some files include
+// Copyright 2020, OpenTelemetry Authors
+(same license header)
+
+A copy of the Apache License v2.0, January 2004 license can be found
+in the 'Standard Licenses' section.
+
+================================================================================
+==
+
+protobuf
+--------
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 1996 - 2024, Daniel Stenberg, , and many
+contributors, see the THANKS file.
+
+All rights reserved.
+
+Permission to use, copy, modify, and distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright
+notice and this permission notice appear in all copies.
+
+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 OF THIRD PARTY RIGHTS. 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.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization of the copyright holder.
+
+Protobuf dependency - abseil-cpp
+--------------------------------
+=== Header in source files:
+// Copyright 2017 The Abseil Authors.
+//
+// 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
+//
+// 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.
+//
+// This header file contains C++11 versions of standard header
+// abstractions available within C++14 and C++17, and are designed to be drop-in
+// replacement for code compliant with C++14 and C++17.
+
+=== License File
+ Apache License
+ Version 2.0, January 2004
+ https://www.apache.org/licenses/
+
+A copy of the Apache License v2.0, January 2004 license can be found
+in the 'Standard Licenses' section.
+================================================================================
+==
+
+json (nlohmann)
+----
+
+MIT License
+
+Copyright (c) 2013-2022 Niels Lohmann
+
+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.
+
+================================================================================
+==
+
+curl
+----
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 1996 - 2024, Daniel Stenberg, , and many
+contributors, see the THANKS file.
+
+All rights reserved.
+
+Permission to use, copy, modify, and distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright
+notice and this permission notice appear in all copies.
+
+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 OF THIRD PARTY RIGHTS. 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.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization of the copyright holder.
+
+ ======================================================================
+ ======================================================================
+
Percona Multiple I/O Threads Patch
Copyright (c) 2008, 2009 Percona Inc
diff --git a/MYSQL_VERSION b/MYSQL_VERSION
index 21905d62e85f..1c44ad7ef4cd 100644
--- a/MYSQL_VERSION
+++ b/MYSQL_VERSION
@@ -1,5 +1,5 @@
MYSQL_VERSION_MAJOR=9
MYSQL_VERSION_MINOR=7
-MYSQL_VERSION_PATCH=1
-MYSQL_VERSION_EXTRA=-1
+MYSQL_VERSION_PATCH=2
+MYSQL_VERSION_EXTRA=-2
MYSQL_VERSION_MATURITY="LTS"
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index e3f90949c359..4bdca87ef777 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -1,28 +1,34 @@
+# Queue-time parameter. Resolved when the run is created, so it is one of the
+# few things a ${{ }} expression can see -- which is what makes it usable as the
+# full-CI gate (see the matrix below).
+#
+# GitHub Actions queues a run with:
+#
+# POST https://dev.azure.com/it0639/percona-server/_apis/pipelines//runs?api-version=7.1
+# {
+# "resources": { "repositories": { "self": { "refName": "refs/pull//merge" } } },
+# "templateParameters": { "fullCI": true }
+# }
+#
+# Omit templateParameters (or pass false) for the five default configs; pass
+# true for all 30. It also appears as a checkbox in the Run pipeline dialog.
+parameters:
+- name: fullCI
+ displayName: 'Build all configs, not just the default five'
+ type: boolean
+ default: false
+
schedules:
- cron: "0 2 * * *"
displayName: Daily 2:00 AM UTC build
branches:
include:
- - 8.4
+ - 9.7
-trigger:
- branches:
- include:
- - '*'
- exclude:
- - 8.4
- paths:
- exclude:
- - doc
- - build-ps
- - man
- - mysql-test
- - packaging
- - policy
- - scripts
- - support-files
+trigger: none
pr:
+ drafts: false
branches:
include:
- '*'
@@ -47,8 +53,8 @@ jobs:
fetchDepth: 32
- script: |
- git fetch origin 8.4
- CHANGED_FILES=$(git diff --name-only --relative --diff-filter AMR origin/8.4 -- . | tr '\n' ' ')
+ git fetch origin 9.7
+ CHANGED_FILES=$(git diff --name-only --relative --diff-filter AMR origin/9.7 -- . | tr '\n' ' ')
if [ -z "${CHANGED_FILES}" ]; then
echo --- No changed files
@@ -110,22 +116,47 @@ jobs:
CCACHE_CPP2: 1
CCACHE_MAXSIZE: 4G
OS_NAME: $(Agent.OS)
- PARENT_BRANCH: 8.4
+ PARENT_BRANCH: 9.7
BUILD_PARAMS_TYPE: normal
+ # Two tiers of coverage:
+ #
+ # default the five configs listed first -- built on every pull request.
+ # extended the remaining 25, each guarded so they are built only when the
+ # fullCI parameter is set (how GitHub Actions asks for a full run)
+ # or on the nightly schedule.
+ #
+ # The guards are compile-time insertions, so on a default run the extra legs
+ # are never generated: no agents, and no skipped entries in the run summary.
+ #
+ # The gate keys on the parameter rather than on Build.Reason because a run
+ # created through the REST API reports Build.Reason=Manual -- so testing
+ # "not a pull request" would make every GitHub-Actions-queued run build all 30.
+ # Schedule is kept so the nightly still covers everything.
+ #
+ # It cannot key on the branch, which is what an earlier attempt did. Measured
+ # on a pull request from a branch whose name contained "fullci", the
+ # compile-time values are Build.SourceBranch='refs/pull//merge',
+ # Build.SourceBranchName='merge' and System.PullRequest.SourceBranch='' -- its
+ # runtime value is the branch, but expansion happens before that is set.
+ #
+ # A runtime condition cannot substitute either:
+ # job conditions are evaluated before matrix variables are in scope, so a
+ # per-leg condition lets every leg through.
strategy:
matrix:
- macOS 14 RelWithDebInfo:
- imageName: 'macOS-14'
- Compiler: clang
- BuildType: RelWithDebInfo
-
- # skip for a pull request if branch name doesn't contain "fullci"
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
- macOS 14 Debug:
- imageName: 'macOS-14'
- Compiler: clang
- BuildType: Debug
+ # macOS 14 (disabled)
+ # macOS 14 RelWithDebInfo:
+ # imageName: 'macOS-14'
+ # Compiler: clang
+ # BuildType: RelWithDebInfo
+ #
+ # # skip for a pull request if branch name doesn't contain "fullci"
+ # ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ # macOS 14 Debug:
+ # imageName: 'macOS-14'
+ # Compiler: clang
+ # BuildType: Debug
# clang-16 and newer compilers
@@ -136,7 +167,50 @@ jobs:
CompilerVer: 22
BuildType: RelWithDebInfo
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ clang-22 Debug [Ubuntu 24.04 Noble]:
+ imageName: 'ubuntu-24.04'
+ UBUNTU_CODE_NAME: noble
+ Compiler: clang
+ CompilerVer: 22
+ BuildType: Debug
+
+ gcc-16 RelWithDebInfo [Ubuntu 24.04 Noble]:
+ imageName: 'ubuntu-24.04'
+ Compiler: gcc
+ CompilerVer: 16
+ BuildType: RelWithDebInfo
+
+ gcc-16 Debug [Ubuntu 24.04 Noble]:
+ imageName: 'ubuntu-24.04'
+ Compiler: gcc
+ CompilerVer: 16
+ BuildType: Debug
+
+ gcc-16 Debug INVERTED [Ubuntu 24.04 Noble]:
+ imageName: 'ubuntu-24.04'
+ Compiler: gcc
+ CompilerVer: 16
+ BuildType: Debug
+ BUILD_PARAMS_TYPE: inverted
+
+ # Extended coverage below: built only with fullCI, or on the nightly.
+
+ # # macOS 14
+ # ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
+ # macOS 14 RelWithDebInfo:
+ # imageName: 'macOS-14'
+ # Compiler: clang
+ # BuildType: RelWithDebInfo
+ #
+ # ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
+ # macOS 14 Debug:
+ # imageName: 'macOS-14'
+ # Compiler: clang
+ # BuildType: Debug
+
+
+ # clang-16 and newer compilers
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
clang-22 RelWithDebInfo INVERTED [Ubuntu 24.04 Noble]:
imageName: 'ubuntu-24.04'
UBUNTU_CODE_NAME: noble
@@ -145,23 +219,7 @@ jobs:
BuildType: RelWithDebInfo
BUILD_PARAMS_TYPE: inverted
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
- clang-22 Debug [Ubuntu 24.04 Noble]:
- imageName: 'ubuntu-24.04'
- UBUNTU_CODE_NAME: noble
- Compiler: clang
- CompilerVer: 22
- BuildType: Debug
-
- clang-22 Debug INVERTED [Ubuntu 24.04 Noble]:
- imageName: 'ubuntu-24.04'
- UBUNTU_CODE_NAME: noble
- Compiler: clang
- CompilerVer: 22
- BuildType: Debug
- BUILD_PARAMS_TYPE: inverted
-
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
clang-21 RelWithDebInfo [Ubuntu 24.04 Noble]:
imageName: 'ubuntu-24.04'
UBUNTU_CODE_NAME: noble
@@ -169,7 +227,7 @@ jobs:
CompilerVer: 21
BuildType: RelWithDebInfo
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
clang-21 Debug [Ubuntu 24.04 Noble]:
imageName: 'ubuntu-24.04'
UBUNTU_CODE_NAME: noble
@@ -177,7 +235,7 @@ jobs:
CompilerVer: 21
BuildType: Debug
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
clang-20 RelWithDebInfo [Ubuntu 24.04 Noble]:
imageName: 'ubuntu-24.04'
UBUNTU_CODE_NAME: noble
@@ -185,14 +243,15 @@ jobs:
CompilerVer: 20
BuildType: RelWithDebInfo
- clang-20 Debug [Ubuntu 24.04 Noble]:
- imageName: 'ubuntu-24.04'
- UBUNTU_CODE_NAME: noble
- Compiler: clang
- CompilerVer: 20
- BuildType: Debug
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
+ clang-20 Debug [Ubuntu 24.04 Noble]:
+ imageName: 'ubuntu-24.04'
+ UBUNTU_CODE_NAME: noble
+ Compiler: clang
+ CompilerVer: 20
+ BuildType: Debug
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
clang-19 RelWithDebInfo [Ubuntu 24.04 Noble]:
imageName: 'ubuntu-24.04'
UBUNTU_CODE_NAME: noble
@@ -200,7 +259,7 @@ jobs:
CompilerVer: 19
BuildType: RelWithDebInfo
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
clang-19 Debug [Ubuntu 24.04 Noble]:
imageName: 'ubuntu-24.04'
UBUNTU_CODE_NAME: noble
@@ -208,7 +267,7 @@ jobs:
CompilerVer: 19
BuildType: Debug
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
clang-18 RelWithDebInfo [Ubuntu 24.04 Noble]:
imageName: 'ubuntu-24.04'
UBUNTU_CODE_NAME: noble
@@ -216,114 +275,109 @@ jobs:
CompilerVer: 18
BuildType: RelWithDebInfo
- clang-18 Debug [Ubuntu 24.04 Noble]:
- imageName: 'ubuntu-24.04'
- UBUNTU_CODE_NAME: noble
- Compiler: clang
- CompilerVer: 18
- BuildType: Debug
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
+ clang-18 Debug [Ubuntu 24.04 Noble]:
+ imageName: 'ubuntu-24.04'
+ UBUNTU_CODE_NAME: noble
+ Compiler: clang
+ CompilerVer: 18
+ BuildType: Debug
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
clang-17 RelWithDebInfo [Ubuntu 22.04 Jammy]:
imageName: 'ubuntu-22.04'
Compiler: clang
CompilerVer: 17
BuildType: RelWithDebInfo
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
clang-17 Debug [Ubuntu 22.04 Jammy]:
imageName: 'ubuntu-22.04'
Compiler: clang
CompilerVer: 17
BuildType: Debug
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
clang-16 RelWithDebInfo [Ubuntu 22.04 Jammy]:
imageName: 'ubuntu-22.04'
Compiler: clang
CompilerVer: 16
BuildType: RelWithDebInfo
- clang-16 Debug [Ubuntu 22.04 Jammy]:
- imageName: 'ubuntu-22.04'
- Compiler: clang
- CompilerVer: 16
- BuildType: Debug
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
+ clang-16 Debug [Ubuntu 22.04 Jammy]:
+ imageName: 'ubuntu-22.04'
+ Compiler: clang
+ CompilerVer: 16
+ BuildType: Debug
# gcc-11 and newer compilers
- gcc-16 RelWithDebInfo [Ubuntu 24.04 Noble]:
- imageName: 'ubuntu-24.04'
- Compiler: gcc
- CompilerVer: 16
- BuildType: RelWithDebInfo
-
- gcc-16 Debug [Ubuntu 24.04 Noble]:
- imageName: 'ubuntu-24.04'
- Compiler: gcc
- CompilerVer: 16
- BuildType: Debug
-
- gcc-15 RelWithDebInfo [Ubuntu 24.04 Noble]:
- imageName: 'ubuntu-24.04'
- Compiler: gcc
- CompilerVer: 15
- BuildType: RelWithDebInfo
+ # (gcc-16 RelWithDebInfo and gcc-16 Debug are default configs, listed above)
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
+ gcc-15 RelWithDebInfo [Ubuntu 24.04 Noble]:
+ imageName: 'ubuntu-24.04'
+ Compiler: gcc
+ CompilerVer: 15
+ BuildType: RelWithDebInfo
- gcc-15 Debug [Ubuntu 24.04 Noble]:
- imageName: 'ubuntu-24.04'
- Compiler: gcc
- CompilerVer: 15
- BuildType: Debug
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
+ gcc-15 Debug [Ubuntu 24.04 Noble]:
+ imageName: 'ubuntu-24.04'
+ Compiler: gcc
+ CompilerVer: 15
+ BuildType: Debug
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
gcc-14 RelWithDebInfo [Ubuntu 22.04 Jammy]:
imageName: 'ubuntu-22.04'
Compiler: gcc
CompilerVer: 14
BuildType: RelWithDebInfo
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
gcc-14 Debug [Ubuntu 22.04 Jammy]:
imageName: 'ubuntu-22.04'
Compiler: gcc
CompilerVer: 14
BuildType: Debug
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
gcc-13 RelWithDebInfo [Ubuntu 22.04 Jammy]:
imageName: 'ubuntu-22.04'
Compiler: gcc
CompilerVer: 13
BuildType: RelWithDebInfo
- gcc-13 Debug [Ubuntu 22.04 Jammy]:
- imageName: 'ubuntu-22.04'
- Compiler: gcc
- CompilerVer: 13
- BuildType: Debug
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
+ gcc-13 Debug [Ubuntu 22.04 Jammy]:
+ imageName: 'ubuntu-22.04'
+ Compiler: gcc
+ CompilerVer: 13
+ BuildType: Debug
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
gcc-12 RelWithDebInfo [Ubuntu 22.04 Jammy]:
imageName: 'ubuntu-22.04'
Compiler: gcc
CompilerVer: 12
BuildType: RelWithDebInfo
- gcc-12 Debug [Ubuntu 22.04 Jammy]:
- imageName: 'ubuntu-22.04'
- Compiler: gcc
- CompilerVer: 12
- BuildType: Debug
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
+ gcc-12 Debug [Ubuntu 22.04 Jammy]:
+ imageName: 'ubuntu-22.04'
+ Compiler: gcc
+ CompilerVer: 12
+ BuildType: Debug
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
gcc-11 RelWithDebInfo [Ubuntu 22.04 Jammy]:
imageName: 'ubuntu-22.04'
Compiler: gcc
CompilerVer: 11
BuildType: RelWithDebInfo
- ${{ if or(ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'fullci')) }}:
+ ${{ if or(parameters.fullCI, eq(variables['Build.Reason'], 'Schedule')) }}:
gcc-11 Debug [Ubuntu 22.04 Jammy]:
imageName: 'ubuntu-22.04'
Compiler: gcc
diff --git a/build-ps/build-binary.sh b/build-ps/build-binary.sh
index 836dabcdd5fb..88e109ac2107 100755
--- a/build-ps/build-binary.sh
+++ b/build-ps/build-binary.sh
@@ -819,9 +819,31 @@ fi
mkdir -p "$TARGETDIR/usr/local/minimal"
cp -r "$TARGETDIR/usr/local/$PRODUCT_FULL_NAME" "$TARGETDIR/usr/local/minimal/$PRODUCT_FULL_NAME-minimal"
+ # Emitted after link so lib/private holds every bundled host library.
+ # A copy is staged in TARGETDIR/sbom, which survives the usr/ cleanup, so the caller can collect it.
+ gen_tarball_sbom() {
+ local dest=$1
+ local label=$2
+ [ "${SBOM:-0}" = "1" ] || return 0
+ sh "$SOURCEDIR/build-ps/sbom/gen-sbom.sh" \
+ --pkg "percona-xtradb-cluster" \
+ --version "${MYSQL_VERSION}-${PERCONA_SERVER_EXTENSION}" \
+ --root "$SOURCEDIR" \
+ --pins "$SOURCEDIR/build-ps/sbom/submodule-pins.txt" \
+ --artifact tarball \
+ --scan-libs "${dest}/lib/private" \
+ --dest "${dest}/sbom"
+ mkdir -p "${TARGETDIR}/sbom"
+ for _sf in "${dest}"/sbom/*; do
+ [ -f "$_sf" ] || continue
+ cp "$_sf" "${TARGETDIR}/sbom/${label}.$(basename "$_sf")"
+ done
+ }
+
# NORMAL TARBALL
cd "$TARGETDIR/usr/local/$PRODUCT_FULL_NAME"
link
+ gen_tarball_sbom "$TARGETDIR/usr/local/$PRODUCT_FULL_NAME" "$PRODUCT_FULL_NAME"
# MIN TARBALL
if [[ $CMAKE_BUILD_TYPE != "Debug" ]]; then
@@ -830,6 +852,7 @@ fi
rm -rf percona-xtradb-cluster-tests 2> /dev/null
find . -type f -exec file '{}' \; | grep ': ELF ' | cut -d':' -f1 | xargs strip --strip-unneeded
link
+ gen_tarball_sbom "$TARGETDIR/usr/local/minimal/$PRODUCT_FULL_NAME-minimal" "$PRODUCT_FULL_NAME-minimal"
fi
)
diff --git a/build-ps/debian/control b/build-ps/debian/control
index 66fd7186c8bd..43ee067ec45b 100644
--- a/build-ps/debian/control
+++ b/build-ps/debian/control
@@ -135,7 +135,7 @@ Description: Percona XtraDB Cluster - Client Plugins
Package: percona-xtradb-cluster-client-core
Architecture: any
-Depends: percona-xtradb-cluster-client-plugins,
+Depends: percona-xtradb-cluster-client-plugins (= ${binary:Version}),
${shlibs:Depends}, ${misc:Depends}
Provides: virtual-mysql-client-core
Breaks: percona-xtradb-cluster-client (<< 1:9.7.1-1)
@@ -149,8 +149,8 @@ Description: Percona XtraDB Cluster database core client binaries
Package: percona-xtradb-cluster-client
Architecture: any
Depends: percona-xtradb-cluster-common (= ${binary:Version}),
- percona-xtradb-cluster-client-core,
- percona-xtradb-cluster-client-plugins,
+ percona-xtradb-cluster-client-core (= ${binary:Version}),
+ percona-xtradb-cluster-client-plugins (= ${binary:Version}),
debianutils (>=1.6),
libdbi-perl,
${shlibs:Depends}, ${misc:Depends}
@@ -236,7 +236,7 @@ Pre-Depends: percona-xtradb-cluster-common (= ${binary:Version}),
adduser,
debconf (>= 0.2.17)
Depends: percona-xtradb-cluster-client (>= ${binary:Version}),
- percona-xtradb-cluster-server-core,
+ percona-xtradb-cluster-server-core (= ${binary:Version}),
percona-telemetry-agent,
libdbi-perl,
perl (>= 5.6),
@@ -352,14 +352,14 @@ Section: database
Architecture: any
Depends: percona-xtradb-cluster-server (>= ${binary:Version}), percona-xtradb-cluster-client (>= ${binary:Version}), ${misc:Depends}
Description: Percona XtraDB Cluster with Galera
- This is a meta-package providing PXC80 server, client.
+ This is a meta-package providing PXC 9.7 server, client.
Package: percona-xtradb-cluster-full
Section: database
Architecture: any
-Depends: percona-xtradb-cluster-server (>= ${binary:Version}), percona-xtradb-cluster-client (>= ${binary:Version}), percona-xtradb-cluster-test (>= ${binary:Version}), percona-xtradb-cluster-dbg (>= ${binary:Version}), percona-xtradb-cluster-server-debug, percona-xtradb-cluster-garbd (>= ${binary:Version}), ${misc:Depends}, percona-xtradb-cluster-garbd-debug (>= ${binary:Version})
+Depends: percona-xtradb-cluster-server (>= ${binary:Version}), percona-xtradb-cluster-client (>= ${binary:Version}), percona-xtradb-cluster-test (>= ${binary:Version}), percona-xtradb-cluster-dbg (>= ${binary:Version}), percona-xtradb-cluster-server-debug (>= ${binary:Version}), libperconaserverclient24-dev (>= ${binary:Version}), percona-xtradb-cluster-garbd (>= ${binary:Version}), percona-xtradb-cluster-garbd-debug (>= ${binary:Version}), ${misc:Depends}
Description: Percona XtraDB Cluster with Galera
- This is a meta-package providing PXC80 server, client, test and debug packages.
+ This is a meta-package providing PXC 9.7 server, client, development, test and debug packages.
Package: percona-xtradb-cluster-test
Architecture: any
diff --git a/build-ps/debian/percona-xtradb-cluster-mysql-router.install b/build-ps/debian/percona-xtradb-cluster-mysql-router.install
index 41f9a23e9186..d58df0d0c7d5 100644
--- a/build-ps/debian/percona-xtradb-cluster-mysql-router.install
+++ b/build-ps/debian/percona-xtradb-cluster-mysql-router.install
@@ -60,7 +60,6 @@ usr/lib/mysqlrouter/private/libmysqlrouter_mysqlxmessages.so.1
usr/lib/mysqlrouter/private/libmysqlrouter_routing.so.1
usr/lib/mysqlrouter/private/libmysqlrouter_routing_connections.so.1
usr/lib/mysqlrouter/private/libmysqlrouter_routing_guidelines.so.1
-usr/lib/mysqlrouter/private/libmysqlrouter_destination_status.so.1
usr/lib/mysqlrouter/private/libmysqlrouter_cluster.so.1
usr/lib/mysqlrouter/private/libmysqlrouter_mysqlxclient.so.1
usr/lib/mysqlrouter/private/libmysqlrouter_mysqlclient.so.1
diff --git a/build-ps/debian/percona-xtradb-cluster-server-core.install b/build-ps/debian/percona-xtradb-cluster-server-core.install
index 42f1c38af2c5..28135d66325a 100644
--- a/build-ps/debian/percona-xtradb-cluster-server-core.install
+++ b/build-ps/debian/percona-xtradb-cluster-server-core.install
@@ -19,6 +19,7 @@ usr/bin/perror
usr/bin/pxc_extra
usr/bin/mysql_keyring_encryption_test
usr/bin/mysql_migrate_keyring
+usr/bin/create_id_token
usr/bin/mysql-systemd
usr/sbin/mysqld
diff --git a/build-ps/percona-xtradb-cluster.spec b/build-ps/percona-xtradb-cluster.spec
index beac22b9efea..6487ba886cbc 100644
--- a/build-ps/percona-xtradb-cluster.spec
+++ b/build-ps/percona-xtradb-cluster.spec
@@ -394,8 +394,7 @@ Requires: percona-xtradb-cluster-garbd = %{version}-%{release}
%description -n percona-xtradb-cluster-full
This is a meta-package which provides the full suite of Percona XtraDB
-Cluster 56 packages including the debuginfo (except on el8, where the
-debuginfo subpackage is not required). Recommended.
+Cluster packages including the debuginfo. Recommended.
# ----------------------------------------------------------------------------
%package -n percona-xtradb-cluster-server
@@ -1674,6 +1673,7 @@ fi
%attr(755, root, root) %{_bindir}/mysqldumpslow
%attr(755, root, root) %{_bindir}/mysqltest
%attr(755, root, root) %{_bindir}/perror
+%attr(755, root, root) %{_bindir}/create_id_token
%attr(755, root, root) %{_bindir}/mysql_migrate_keyring
%attr(755, root, root) %{_bindir}/mysql_keyring_encryption_test
#%attr(755, root, root) %{_bindir}/resolve_stack_dump
diff --git a/build-ps/pxc_builder.sh b/build-ps/pxc_builder.sh
index 230c1c7444ae..f10ac4baf08b 100755
--- a/build-ps/pxc_builder.sh
+++ b/build-ps/pxc_builder.sh
@@ -138,16 +138,22 @@ get_sources(){
rm -rf wsrep-lib || true
rm -rf percona-xtradb-cluster-galera || true
git submodule deinit -f . || true
- git submodule init
- git submodule update
-
- for dir in 'wsrep-lib' 'percona-xtradb-cluster-galera'; do
- cd $dir || exit
- git submodule deinit -f . || true
- git submodule init
- git submodule update
- cd ../ || exit
+ # never block on a credential prompt; retry transient GitHub failures
+ # and stop here instead of building with an empty submodule
+ export GIT_TERMINAL_PROMPT=0
+ submodules_ok=0
+ for attempt in 1 2 3; do
+ if git submodule update --init --recursive; then
+ submodules_ok=1
+ break
+ fi
+ echo "WARNING: git submodule update failed (attempt ${attempt}/3), retrying"
+ sleep $((attempt * 10))
done
+ if [ ${submodules_ok} != 1 ]; then
+ echo "ERROR: could not fetch git submodules"
+ exit 1
+ fi
sed -i "/^env = conf.Finish()/i conf.env.Append(CPPFLAGS = ' -DGALERA_LOG_H_ENABLE_CXX')" percona-xtradb-cluster-galera/SConstruct
else
cd percona-xtradb-cluster || exit
@@ -236,6 +242,7 @@ get_sources(){
rsync -av ${WORKDIR}/percona-xtradb-cluster/wsrep-lib/ ${PXCDIR}/wsrep-lib --exclude .git
rsync -av ${WORKDIR}/percona-xtradb-cluster/extra/coredumper/ ${PXCDIR}/extra/coredumper --exclude .git
rsync -av ${WORKDIR}/percona-xtradb-cluster/extra/libkmip/ ${PXCDIR}/extra/libkmip --exclude .git
+ rsync -av ${WORKDIR}/percona-xtradb-cluster/extra/jwt-cpp/ ${PXCDIR}/extra/jwt-cpp --exclude .git
sed -i 's:ROUTER_RUNTIMEDIR:/var/run/mysqlrouter/:g' ${PXCDIR}/packaging/rpm-common/*
cd ${PXCDIR}/packaging/rpm-common || exit
@@ -1206,6 +1213,11 @@ build_tarball(){
else
bash -x ./build-ps/build-binary.sh --with-jemalloc=jemalloc/ -t $BIN_RELEASE $BUILD_ROOT
fi
+ retval=$?
+ if [ $retval != 0 ]; then
+ echo "ERROR: build-binary.sh failed with exit code $retval"
+ exit 1
+ fi
DIRNAME="tarball"
if [[ ${DEBUG} == 1 ]]; then
@@ -1215,6 +1227,12 @@ build_tarball(){
mkdir -p ${WORKDIR}/${DIRNAME}
mkdir -p ${CURDIR}/${DIRNAME}
rm -f $BUILD_NUMBER/percona-xtrabackup* || true
+ # the PXB tarballs copied into the target dir are removed above, so
+ # anything left here must come from build-binary.sh
+ if ! ls $BUILD_NUMBER/*.tar.gz >/dev/null 2>&1; then
+ echo "ERROR: no tarballs were built in $BUILD_NUMBER"
+ exit 1
+ fi
cp $BUILD_NUMBER/*.tar.gz ${WORKDIR}/../${DIRNAME}
cp $BUILD_NUMBER/*.tar.gz ${WORKDIR}/${DIRNAME}
cp $BUILD_NUMBER/*.tar.gz ${CURDIR}/${DIRNAME}
diff --git a/build-ps/sbom/check-components.sh b/build-ps/sbom/check-components.sh
new file mode 100755
index 000000000000..c31d8c8a094b
--- /dev/null
+++ b/build-ps/sbom/check-components.sh
@@ -0,0 +1,184 @@
+#!/bin/sh
+
+set -eu
+
+SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+ROOT="."
+REGISTRY="${SCRIPT_DIR}/components.txt"
+PINS=""
+
+KNOWN_UNCERTAIN=""
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --root) ROOT=${2:?}; shift 2 ;;
+ --registry) REGISTRY=${2:?}; shift 2 ;;
+ --pins) PINS=${2:?}; shift 2 ;;
+ *) echo "check-components: unknown argument: $1" >&2; exit 2 ;;
+ esac
+done
+
+[ -f "$REGISTRY" ] || { echo "check-components: registry not found: $REGISTRY" >&2; exit 2; }
+[ -d "$ROOT/extra" ] || { echo "check-components: no extra/ under root: $ROOT" >&2; exit 2; }
+[ -z "$PINS" ] || [ -f "$PINS" ] || { echo "check-components: pins file not found: $PINS" >&2; exit 2; }
+
+if [ -z "$PINS" ] && [ -f "$ROOT/build-ps/sbom/submodule-pins.txt" ]; then
+ PINS="$ROOT/build-ps/sbom/submodule-pins.txt"
+fi
+
+ERRORS=0
+UNVERIFIED=0
+err() { echo "check-components: ERROR: $*" >&2; ERRORS=$((ERRORS + 1)); }
+warn() { echo "check-components: WARNING: $*" >&2; }
+
+ROWS=$(mktemp "${TMPDIR:-/tmp}/ps-reg.XXXXXX")
+SUBS=$(mktemp "${TMPDIR:-/tmp}/ps-sub.XXXXXX")
+trap 'rm -f "$ROWS" "$SUBS"' EXIT
+
+awk -F'|' '
+ { sub(/#.*/, "") }
+ /^[[:space:]]*$/ { next }
+ {
+ for (i = 1; i <= NF; i++) gsub(/^[ \t]+|[ \t]+$/, "", $i)
+ if ($1 == "") next
+ print $1 "|" $2 "|" $4 "|" $6 "|" $7
+ }
+' "$REGISTRY" > "$ROWS"
+
+if [ -f "$ROOT/.gitmodules" ]; then
+ awk '/^[[:space:]]*path[[:space:]]*=/ {
+ sub(/^[^=]*=[[:space:]]*/, ""); gsub(/[[:space:]]+$/, ""); print
+ }' "$ROOT/.gitmodules" > "$SUBS"
+else
+ : > "$SUBS"
+fi
+
+is_submodule() {
+ while IFS= read -r _s; do
+ [ "$_s" = "$1" ] && return 0
+ done < "$SUBS"
+ return 1
+}
+
+resolve_commit() {
+ _path=$1
+ if [ -n "$PINS" ] && [ -f "$PINS" ]; then
+ _c=$(awk -F'|' -v p="$_path" '$1 == p { print $2; exit }' "$PINS")
+ if [ -n "$_c" ]; then printf '%s' "$_c"; return 0; fi
+ fi
+ if command -v git >/dev/null 2>&1 && [ -e "$ROOT/$_path/.git" ]; then
+ _c=$(git -C "$ROOT/$_path" rev-parse HEAD 2>/dev/null) || _c=""
+ if [ -n "$_c" ]; then printf '%s' "$_c"; return 0; fi
+ fi
+ return 1
+}
+
+is_sha() {
+ printf '%s' "$1" | grep -qE '^[0-9a-f]{40}$'
+}
+
+norm() { printf '%s' "$1" | tr 'A-Z' 'a-z' | tr -cd 'a-z0-9'; }
+
+while IFS='|' read -r name version ships path vsrc; do
+ [ -n "$name" ] || continue
+
+ case " $KNOWN_UNCERTAIN " in
+ *" $name "*) [ "$ships" = "uncertain" ] && warn "$name: ships=uncertain (allowlisted; resolve and set yes/no/tarball)" ;;
+ *) [ "$ships" = "uncertain" ] && err "$name: ships=uncertain and not allowlisted" ;;
+ esac
+
+ case "$ships" in
+ yes|tarball|no) ;;
+ *) err "$name: invalid ships value '$ships' (expected yes, tarball, no or uncertain)" ;;
+ esac
+
+ if [ "$ships" != "no" ] && [ -z "$version" ]; then
+ err "$name: ships=$ships with an empty version (use 'unknown' if genuinely unversioned)"
+ fi
+
+ if [ "$path" != "-" ]; then
+ if [ ! -e "$ROOT/$path" ]; then
+ if is_submodule "$path"; then
+ err "$name: $path missing - run 'git submodule update --init $path'"
+ else
+ err "$name: path does not exist: $path"
+ fi
+ continue
+ fi
+ if is_submodule "$path" && [ -z "$(ls -A "$ROOT/$path" 2>/dev/null)" ]; then
+ err "$name: $path is an empty submodule - run 'git submodule update --init $path'"
+ continue
+ fi
+ fi
+
+ [ "$version" = "unknown" ] && continue
+
+ if [ "$path" != "-" ] && is_submodule "$path" && is_sha "$version"; then
+ actual=$(resolve_commit "$path") || actual=""
+ if [ -z "$actual" ]; then
+ err "$name: version is a commit but the submodule pin could not be resolved (no pins file and no .git)"
+ elif [ "$actual" != "$version" ]; then
+ err "$name: registry version '$version' does not match submodule pin '$actual'"
+ fi
+ fi
+
+ case "$vsrc" in
+ dir)
+ if [ "$path" = "-" ]; then
+ err "$name: version-src=dir requires a path"
+ continue
+ fi
+ nv=$(norm "$version")
+ nb=$(norm "$(basename "$path")")
+ case "$nb" in
+ *"$nv"*) ;;
+ *) err "$name: version '$version' not found in path '$path'" ;;
+ esac
+ ;;
+ file:*)
+ vfile=${vsrc#file:}
+ if [ ! -f "$ROOT/$vfile" ]; then
+ err "$name: version-src file does not exist: $vfile"
+ continue
+ fi
+ if ! grep -qF -- "$version" "$ROOT/$vfile"; then
+ err "$name: version '$version' not found in $vfile"
+ fi
+ ;;
+ none)
+ UNVERIFIED=$((UNVERIFIED + 1))
+ ;;
+ *)
+ err "$name: invalid version-src '$vsrc' (expected dir, file: or none)"
+ ;;
+ esac
+done < "$ROWS"
+
+for d in "$ROOT"/extra/*/; do
+ [ -d "$d" ] || continue
+ dname=$(basename "$d")
+ if ! awk -F'|' -v d="extra/${dname}" '
+ $4 == d || index($4, d "/") == 1 { found = 1 }
+ END { exit found ? 0 : 1 }' "$ROWS"; then
+ err "extra/${dname} has no registry entry (add it, with ships=yes, tarball or no)"
+ fi
+done
+
+while IFS= read -r sub; do
+ [ -n "$sub" ] || continue
+ if ! awk -F'|' -v d="$sub" '
+ $4 == d { found = 1 }
+ END { exit found ? 0 : 1 }' "$ROWS"; then
+ err "submodule $sub has no registry entry"
+ fi
+done < "$SUBS"
+
+if [ "$UNVERIFIED" -gt 0 ]; then
+ echo "check-components: ${UNVERIFIED} component(s) have no automated version verification"
+fi
+
+if [ "$ERRORS" -gt 0 ]; then
+ echo "check-components: FAILED with ${ERRORS} error(s)" >&2
+ exit 1
+fi
+echo "check-components: registry consistent with tree"
diff --git a/build-ps/sbom/components.txt b/build-ps/sbom/components.txt
new file mode 100644
index 000000000000..c68b653bcdd0
--- /dev/null
+++ b/build-ps/sbom/components.txt
@@ -0,0 +1,70 @@
+# Third-party component registry for Percona Server for MySQL SBOM generation.
+#
+# Vendored C/C++ trees carry no package manifest, so no scanner can derive this
+# inventory. This file is authoritative. check-components.sh validates it
+# against the source tree on every build and fails on drift.
+#
+# Format (pipe-separated, surrounding space ignored, '#' starts a comment):
+#
+# name | version | license | ships | linkage | path | version-src | notes
+#
+# ships yes present in every shipped artifact
+# tarball present only in the binary tarball
+# no present in the source tree but not built or not shipped
+# uncertain needs a decision; an error unless allowlisted
+# linkage shared-lib | static | header-only | data | source
+# path tree path used for validation; '-' if not applicable
+# version-src dir version must appear in the final path component
+# file: version must appear literally in that file
+# none no automated verification is possible
+# license SPDX identifier or expression
+#
+# Components at a path listed in .gitmodules are resolved to their pinned commit
+# at build time; that commit is emitted alongside the version.
+#
+# ships=yes and ships=tarball rows are emitted, filtered by artifact
+# (package/tarball builds); --artifact source takes every row, since the
+# source tarball is the whole tree and every component is present in it
+# regardless of whether it is ever built or shipped in binary form.
+
+# --- shipped: bundled libraries installed as files ---------------------------
+protobuf | 24.4 | BSD-3-Clause | yes | shared-lib | extra/protobuf/protobuf-24.4 | dir | ships under lib/mysql/private and lib/mysqlrouter/private
+utf8_range | unknown | MIT | yes | static | extra/protobuf/protobuf-24.4/third_party/utf8_range | none | vendored inside bundled protobuf and compiled into it; no independent version marker upstream
+abseil-cpp | 20250814.1 | Apache-2.0 | yes | shared-lib | extra/abseil/abseil-cpp-20250814.1 | dir | slaved to WITH_PROTOBUF=bundled; ships libabsl_*
+icu | 77.1 | Unicode-3.0 | yes | shared-lib | extra/icu/icu-release-77-1 | dir | ships as percona-icu-data-files; no LICENSE in tree, headers cite unicode.org/copyright.html
+rocksdb | 9.3.1 | (GPL-2.0-only OR Apache-2.0) AND BSD-3-Clause | yes | shared-lib | storage/rocksdb/rocksdb | file:storage/rocksdb/MYROCKS_VERSION | submodule; ships ha_rocksdb.so in percona-server-rocksdb; MyRocks patch level 9.3.1-5; BSD-3 covers LevelDB-derived code
+
+# --- shipped: bundled libraries linked into the binaries ---------------------
+zlib | 1.3.2 | Zlib | yes | static | extra/zlib/zlib-1.3.2 | dir | -DWITH_ZLIB=bundled in all three recipes
+zstd | 1.5.7 | BSD-3-Clause | yes | static | extra/zstd/zstd-1.5.7 | dir | -DWITH_ZSTD=bundled; COPYING GPL-2.0 covers the CLI, which is not built
+lz4 | 1.10.0 | BSD-2-Clause | yes | static | extra/lz4/lz4-1.10.0 | dir | only lib/ is compiled; programs/ GPL-2.0 not built
+xxhash | 0.8.3 | BSD-2-Clause | yes | static | extra/xxhash/xxHash-0.8.3 | dir | unconditional; no LICENSE in tree, BSD-2 asserted from header
+libbacktrace | 793921876c981 | BSD-3-Clause | yes | static | extra/libbacktrace/sha793921876c981 | dir | WITH_EXT_BACKTRACE defaults ON on Linux; version is the pinned commit; no LICENSE in tree
+libedit | 20240808-3.1 | BSD-3-Clause | yes | static | extra/libedit/libedit-20240808-3.1 | dir | -DWITH_EDITLINE=bundled
+libcno | 208939f540957a35b337dacdd5c5e34d51821bd2 | MIT | yes | static | extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2 | dir | unconditional; static into the router HTTP libs; WITH_ROUTER defaults ON
+libcbor | 0.11.0 | MIT | yes | static | extra/libcbor/libcbor-0.11.0 | dir | slaved to WITH_FIDO=bundled; disabled where add_fido_plugins is 0
+libfido2 | 1.15.0 | BSD-2-Clause | yes | static | extra/libfido2/libfido2-1.15.0 | dir | bundled on DEB and tarball, and on RPM for EL8+
+libkmip | 82988b2de6a0687791a3ae549fc2bd5cbeb457ab | Apache-2.0 OR BSD-3-Clause | yes | static | extra/libkmip | none | submodule; version is the pinned commit; only component_keyring_kmip.so ships, static libs are stripped
+coredumper | 8f2623b6d34bfc4e691bdf67b4a0d37c77513ac7 | BSD-3-Clause | yes | static | extra/coredumper | none | submodule; version is the pinned commit; ships /usr/lib/libcoredumper.a
+opensslpp | 1.0.0 | GPL-2.0-only | yes | static | extra/opensslpp | file:extra/opensslpp/CMakeLists.txt | Percona-authored; WITH_ENCRYPTION_UDF=ON; no LICENSE in tree
+v8 | 12.9.202.22 | BSD-3-Clause | yes | static | - | file:cmake/v8.cmake | external prebuilt input, never in the source tree; static into component_js_lang.so
+
+# --- shipped: telemetry component, new in 9.x --------------------------------
+opentelemetry-cpp | 1.23.0 | Apache-2.0 | yes | static | extra/opentelemetry-cpp/opentelemetry-cpp-1.23.0 | dir | linked into the telemetry component
+opentelemetry-proto | 1.7.0 | Apache-2.0 | yes | static | extra/opentelemetry-proto/opentelemetry-proto-1.7.0 | dir | linked into the telemetry component
+json | 3.12.0 | MIT | yes | header-only | extra/json/json-3.12.0 | dir | nlohmann json; header-only dependency of opentelemetry-cpp
+
+# --- shipped: header-only, compiled into the binaries ------------------------
+boost | 1.87.0 | BSL-1.0 | yes | header-only | extra/boost/boost_1_87_0 | dir | always bundled, boost.cmake hardcodes the tree; trimmed subset; no LICENSE in tree
+rapidjson | 1.1.0 | MIT | yes | header-only | extra/rapidjson | none | -DWITH_RAPIDJSON=bundled; version is only in preprocessor defines, not as a literal
+unordered_dense | 4.4.0 | MIT | yes | header-only | extra/unordered_dense/unordered_dense-4.4.0 | dir | unconditional
+jwt-cpp | 3e037df3e669633a3044618e30550ea2f212e915 | MIT | yes | header-only | extra/jwt-cpp | none | submodule; version is the pinned commit; header-only dependency of auth_openid_connect / authentication_openid_connect_client
+
+# --- shipped in the binary tarball only --------------------------------------
+curl | 8.14.1 | curl | tarball | static | extra/curl/curl-8.14.1 | dir | -DWITH_CURL=bundled in build-binary.sh; RPM and DEB use the system libcurl
+tirpc | 1.3.5 | BSD-3-Clause | tarball | static | extra/tirpc/libtirpc-1.3.5 | dir | forced bundled on EL8/EL9 by the tarball custom-OpenSSL path; RPM and DEB use system libtirpc
+
+# --- not shipped -------------------------------------------------------------
+googletest | 1.17.0 | BSD-3-Clause | no | source | extra/googletest/googletest-1.17.0 | dir | compiled by the PGO-consume pass but no test artifact is packaged
+gperftools | 2.15 | BSD-3-Clause | no | source | extra/gperftools/gperftools-2.15 | dir | WITH_TCMALLOC defaults OFF and is never passed
+doxygen-awesome | 2.2.0 | MIT | no | data | extra/doxygen-awesome/2.2.0 | dir | documentation CSS only; no CMake reference
diff --git a/build-ps/sbom/gen-sbom.sh b/build-ps/sbom/gen-sbom.sh
new file mode 100755
index 000000000000..797e331c0ce7
--- /dev/null
+++ b/build-ps/sbom/gen-sbom.sh
@@ -0,0 +1,508 @@
+#!/bin/sh
+
+set -eu
+
+SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+
+PKG=""
+VER=""
+DEST=""
+ROOT="."
+REGISTRY="${SCRIPT_DIR}/components.txt"
+ARTIFACT="package"
+SCAN_LIBS=""
+PINS=""
+EXCLUDE=""
+
+usage() {
+ echo "usage: $0 --pkg NAME --version VER --dest DIR" >&2
+ echo " [--root DIR] [--registry FILE] [--pins FILE]" >&2
+ echo " [--artifact package|tarball|source] [--scan-libs DIR]" >&2
+ echo " [--exclude NAME[,NAME...]]" >&2
+ exit 2
+}
+
+die() { echo "gen-sbom: ERROR: $*" >&2; exit 1; }
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --pkg) PKG=${2:?}; shift 2 ;;
+ --version) VER=${2:?}; shift 2 ;;
+ --dest) DEST=${2:?}; shift 2 ;;
+ --root) ROOT=${2:?}; shift 2 ;;
+ --registry) REGISTRY=${2:?}; shift 2 ;;
+ --pins) PINS=${2:?}; shift 2 ;;
+ --artifact) ARTIFACT=${2:?}; shift 2 ;;
+ --scan-libs) SCAN_LIBS=${2:?}; shift 2 ;;
+ --exclude) EXCLUDE=${2:?}; shift 2 ;;
+ -h|--help) usage ;;
+ *) echo "gen-sbom: unknown argument: $1" >&2; usage ;;
+ esac
+done
+
+[ -n "$PKG" ] || usage
+[ -n "$VER" ] || usage
+[ -n "$DEST" ] || usage
+[ -f "$REGISTRY" ] || die "registry not found: $REGISTRY"
+[ -z "$PINS" ] || [ -f "$PINS" ] || die "pins file not found: $PINS"
+[ -z "$SCAN_LIBS" ] || [ -d "$SCAN_LIBS" ] || die "scan-libs directory not found: $SCAN_LIBS"
+
+if [ -z "$PINS" ] && [ -f "$ROOT/build-ps/sbom/submodule-pins.txt" ]; then
+ PINS="$ROOT/build-ps/sbom/submodule-pins.txt"
+fi
+
+case "$ARTIFACT" in
+ package|tarball|source) ;;
+ *) die "invalid --artifact '$ARTIFACT' (expected package, tarball or source)" ;;
+esac
+
+if command -v sha256sum >/dev/null 2>&1; then
+ sha256() { sha256sum | cut -d' ' -f1; }
+elif command -v shasum >/dev/null 2>&1; then
+ sha256() { shasum -a 256 | cut -d' ' -f1; }
+else
+ die "no sha256sum or shasum available"
+fi
+
+WORK=$(mktemp -d "${TMPDIR:-/tmp}/ps-sbom.XXXXXX")
+trap 'rm -rf "$WORK"' EXIT
+
+COMPONENTS="${WORK}/components"
+ROWS="${WORK}/rows"
+SUBS="${WORK}/subs"
+
+tr '\t' ' ' < "$REGISTRY" | tr -d '\000-\010\013\014\016-\037\177' > "${WORK}/registry.clean"
+
+awk -F'|' '
+ { sub(/#.*/, "") }
+ /^[[:space:]]*$/ { next }
+ {
+ for (i = 1; i <= NF; i++) gsub(/^[ \t]+|[ \t]+$/, "", $i)
+ if ($1 == "") next
+ print $1 "|" $2 "|" $3 "|" $4 "|" $5 "|" $6
+ }
+' "${WORK}/registry.clean" > "$ROWS"
+
+if [ -f "$ROOT/.gitmodules" ]; then
+ awk '/^[[:space:]]*path[[:space:]]*=/ {
+ sub(/^[^=]*=[[:space:]]*/, ""); gsub(/[[:space:]]+$/, ""); print
+ }' "$ROOT/.gitmodules" > "$SUBS"
+else
+ : > "$SUBS"
+fi
+
+resolve_commit() {
+ _path=$1
+ if [ -n "$PINS" ] && [ -f "$PINS" ]; then
+ _c=$(awk -F'|' -v p="$_path" '$1 == p { print $2; exit }' "$PINS")
+ if [ -n "$_c" ]; then printf '%s' "$_c"; return 0; fi
+ fi
+ if command -v git >/dev/null 2>&1 && [ -e "$ROOT/$_path/.git" ]; then
+ _c=$(git -C "$ROOT/$_path" rev-parse HEAD 2>/dev/null) || _c=""
+ if [ -n "$_c" ]; then printf '%s' "$_c"; return 0; fi
+ fi
+ return 1
+}
+
+is_submodule() {
+ while IFS= read -r _s; do
+ [ "$_s" = "$1" ] && return 0
+ done < "$SUBS"
+ return 1
+}
+
+row_is_sane() {
+ [ "$(printf '%s' "$1" | awk -F'|' 'END { print NF }')" = "3" ] || return 1
+ case $1 in
+ *' '*) return 1 ;;
+ esac
+ printf '%s' "$1" | awk -F'|' '{ exit ($1 == "" || $2 == "") ? 1 : 0 }'
+}
+
+resolve_owner() {
+ _p=$1
+ if command -v rpm >/dev/null 2>&1; then
+ _r=$(rpm -qf --qf '%{NAME}|%{VERSION}-%{RELEASE}|%{LICENSE}\n' "$_p" 2>/dev/null | head -1) || _r=""
+ case $_r in
+ *'|'*'|'*)
+ if row_is_sane "$_r"; then
+ _rn=$(printf '%s' "$_r" | cut -d'|' -f1)
+ _rv=$(printf '%s' "$_r" | cut -d'|' -f2)
+ _rl=$(printf '%s' "$_r" | cut -d'|' -f3)
+ # rpm's %{LICENSE} is a distro-formatted summary (e.g.
+ # "LGPLv2+ and GPLv2+"), not an SPDX license expression;
+ # declaring it as one fails strict SPDX validation. Emit
+ # NOASSERTION for the license slot and carry the raw
+ # string as a 5th field for the caller to attach as a
+ # comment/property instead.
+ printf '%s|%s|NOASSERTION|rpm|%s' "$_rn" "$_rv" "$_rl"
+ return 0
+ fi
+ ;;
+ esac
+ fi
+ if command -v dpkg-query >/dev/null 2>&1; then
+ _pk=$(dpkg -S "$_p" 2>/dev/null \
+ | grep -v '^diversion by ' \
+ | head -1 | cut -d: -f1) || _pk=""
+ if [ -z "$_pk" ]; then
+ # usrmerge systems: readlink -f canonicalizes /lib -> /usr/lib,
+ # but a package built before the merge still lists the /lib path
+ # in dpkg's database. Retry with the counterpart path.
+ case "$_p" in
+ /usr/*) _alt=${_p#/usr} ;;
+ *) _alt="/usr$_p" ;;
+ esac
+ if [ -e "$_alt" ]; then
+ _pk=$(dpkg -S "$_alt" 2>/dev/null \
+ | grep -v '^diversion by ' \
+ | head -1 | cut -d: -f1) || _pk=""
+ fi
+ fi
+ if [ -n "$_pk" ]; then
+ _v=$(dpkg-query -W -f='${Version}\n' "$_pk" 2>/dev/null | head -1) || _v=""
+ [ -n "$_v" ] || _v="unknown"
+ printf '%s|%s|NOASSERTION|deb|' "$_pk" "$_v"
+ return 0
+ fi
+ fi
+ return 1
+}
+
+HOSTMAP="${WORK}/hostmap"
+HOSTMAP_BUILT=""
+
+build_hostmap() {
+ [ -z "$HOSTMAP_BUILT" ] || return 0
+ HOSTMAP_BUILT=1
+ ldconfig -p 2>/dev/null | awk '/=>/ { print $NF }' | while IFS= read -r _p; do
+ _rp=$(readlink -f "$_p" 2>/dev/null) || continue
+ [ -f "$_rp" ] || continue
+ printf '%s|%s\n' "$(basename "$_rp")" "$_rp"
+ done | sort -u > "$HOSTMAP" || true
+}
+
+# Logical registry name -> runtime shared-object basename, for components
+# excluded via --exclude because the build links the host's copy instead of
+# the bundled tree. Default is 'lib.so'; list exceptions as they come up.
+system_lib_soname() {
+ case "$1" in
+ zlib) printf 'libz' ;;
+ *) printf 'lib%s' "$1" ;;
+ esac
+}
+
+# Resolve an excluded component to the host package that actually provides it
+# at build time, so the SBOM still names what the binary links against.
+# Prints 'name|version|license|type|declared-license' on success (the last
+# field is a non-SPDX raw string, empty unless resolved via rpm).
+resolve_system_component() {
+ _name=$1
+ build_hostmap
+ _pat="$(system_lib_soname "$_name").so"
+ _hp=$(awk -F'|' -v p="$_pat" 'index($1, p) == 1 { print $2; exit }' "$HOSTMAP" 2>/dev/null) || _hp=""
+ [ -n "$_hp" ] || return 1
+ resolve_owner "$_hp"
+}
+
+: > "$COMPONENTS"
+UNPINNED=""
+EXCLUDED_RESOLVED=""
+EXCLUDED_UNRESOLVED=""
+
+while IFS='|' read -r name version license ships linkage path; do
+ [ -n "$name" ] || continue
+
+ # A source tarball is the whole tree (minus .git/.bzr) - every
+ # registered component is physically present in it, whether or not it
+ # is ever built/shipped in binary form, so --artifact source takes
+ # everything instead of filtering by ships=.
+ if [ "$ARTIFACT" != "source" ]; then
+ case "$ships" in
+ yes) ;;
+ tarball) [ "$ARTIFACT" = "tarball" ] || continue ;;
+ *) continue ;;
+ esac
+ fi
+
+ case ",${EXCLUDE}," in
+ *",${name},"*)
+ if owner=$(resolve_system_component "$name"); then
+ oname=$(printf '%s' "$owner" | cut -d'|' -f1)
+ over=$(printf '%s' "$owner" | cut -d'|' -f2)
+ olic=$(printf '%s' "$owner" | cut -d'|' -f3)
+ otype=$(printf '%s' "$owner" | cut -d'|' -f4)
+ odlic=$(printf '%s' "$owner" | cut -d'|' -f5)
+ [ -n "$olic" ] || olic="NOASSERTION"
+ if awk -F'|' -v n="$oname" '$1 == n { f = 1 } END { exit f ? 0 : 1 }' "$COMPONENTS"; then
+ EXCLUDED_RESOLVED="${EXCLUDED_RESOLVED} ${name}(already present as ${oname})"
+ else
+ printf '%s|%s|%s|shared-lib|%s|system||%s\n' \
+ "$oname" "$over" "$olic" "$otype" "$odlic" >> "$COMPONENTS"
+ EXCLUDED_RESOLVED="${EXCLUDED_RESOLVED} ${name}->${oname}"
+ fi
+ else
+ EXCLUDED_UNRESOLVED="${EXCLUDED_UNRESOLVED} ${name}"
+ fi
+ continue
+ ;;
+ esac
+
+ [ -n "$version" ] || die "$name: ships=$ships with an empty version"
+
+ commit=""
+ if [ "$path" != "-" ] && is_submodule "$path"; then
+ commit=$(resolve_commit "$path") || commit=""
+ [ -n "$commit" ] || UNPINNED="${UNPINNED} ${name}"
+ fi
+
+ [ -n "$license" ] || license="NOASSERTION"
+
+ printf '%s|%s|%s|%s|generic|vendored|%s|\n' \
+ "$name" "$version" "$license" "$linkage" "$commit" >> "$COMPONENTS"
+done < "$ROWS"
+
+if [ -s "$COMPONENTS" ]; then :; else
+ die "no components selected for artifact '$ARTIFACT' - registry is empty or over-filtered"
+fi
+
+if [ -n "$EXCLUDED_RESOLVED" ]; then
+ echo "gen-sbom: excluded vendored component(s) resolved to the host package actually linked:${EXCLUDED_RESOLVED}"
+fi
+
+if [ -n "$EXCLUDED_UNRESOLVED" ]; then
+ echo "gen-sbom: WARNING: excluded component(s) could not be resolved to a host package and are omitted from the SBOM:${EXCLUDED_UNRESOLVED}" >&2
+ echo "gen-sbom: WARNING: is rpm/dpkg-query available, and does ldconfig list the linked library?" >&2
+fi
+
+if [ -n "$UNPINNED" ]; then
+ echo "gen-sbom: WARNING: no commit resolved for submodule component(s):${UNPINNED}" >&2
+ echo "gen-sbom: WARNING: pass --pins, or place submodule-pins.txt under /build-ps/sbom/" >&2
+fi
+
+SCANNED=0
+RESOLVED=0
+
+if [ -n "$SCAN_LIBS" ]; then
+ build_hostmap
+
+ for f in "$SCAN_LIBS"/*; do
+ [ -L "$f" ] && continue
+ [ -f "$f" ] || continue
+ SCANNED=$((SCANNED + 1))
+ b=$(basename "$f")
+ hp=$(awk -F'|' -v b="$b" '$1 == b { print $2; exit }' "$HOSTMAP" 2>/dev/null) || hp=""
+ [ -n "$hp" ] || continue
+ owner=$(resolve_owner "$hp") || continue
+ RESOLVED=$((RESOLVED + 1))
+ oname=$(printf '%s' "$owner" | cut -d'|' -f1)
+ over=$(printf '%s' "$owner" | cut -d'|' -f2)
+ olic=$(printf '%s' "$owner" | cut -d'|' -f3)
+ otype=$(printf '%s' "$owner" | cut -d'|' -f4)
+ odlic=$(printf '%s' "$owner" | cut -d'|' -f5)
+ [ -n "$olic" ] || olic="NOASSERTION"
+ if ! awk -F'|' -v n="$oname" '$1 == n { found = 1 } END { exit found ? 0 : 1 }' "$COMPONENTS"; then
+ printf '%s|%s|%s|shared-lib|%s|host||%s\n' \
+ "$oname" "$over" "$olic" "$otype" "$odlic" >> "$COMPONENTS"
+ fi
+ done
+
+ echo "gen-sbom: scanned ${SCANNED} bundled libraries, resolved ${RESOLVED} to host packages"
+ if [ "$SCANNED" -gt 0 ] && [ "$RESOLVED" -eq 0 ]; then
+ echo "gen-sbom: WARNING: no bundled library resolved to a host package;" \
+ "is ldconfig available and is the rpm or dpkg database readable?" >&2
+ fi
+fi
+
+UUID=$(printf '%s|%s|%s|%s' "$PKG" "$VER" "$ARTIFACT" "$(cat "$COMPONENTS")" | sha256 | awk '{
+ h = $0
+ printf "%s-%s-4%s-a%s-%s",
+ substr(h, 1, 8), substr(h, 9, 4), substr(h, 14, 3),
+ substr(h, 18, 3), substr(h, 21, 12)
+}')
+
+if [ -n "${SOURCE_DATE_EPOCH:-}" ]; then
+ CREATED=$(date -u -d "@${SOURCE_DATE_EPOCH}" '+%Y-%m-%dT%H:%M:%SZ' 2>/dev/null \
+ || date -u -r "${SOURCE_DATE_EPOCH}" '+%Y-%m-%dT%H:%M:%SZ' 2>/dev/null) || CREATED=""
+fi
+[ -n "${CREATED:-}" ] || CREATED=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
+
+DUPS=$(cut -d'|' -f1 "$COMPONENTS" | sort | uniq -d)
+[ -z "$DUPS" ] || die "duplicate component names would collide as SPDX identifiers: $(echo $DUPS)"
+
+mkdir -p "$DEST"
+
+AWK_LIB='
+function jesc(s, i, c, o) {
+ o = ""
+ for (i = 1; i <= length(s); i++) {
+ c = substr(s, i, 1)
+ if (c == "\\") o = o "\\\\"
+ else if (c == "\"") o = o "\\\""
+ else if (c == "\n") o = o "\\n"
+ else if (c == "\r") o = o "\\r"
+ else if (c == "\t") o = o "\\t"
+ else if (c < " ") o = o sprintf("\\u%04x", ORD[c])
+ else o = o c
+ }
+ return o
+}
+function penc(s, i, c, o) {
+ o = ""
+ for (i = 1; i <= length(s); i++) {
+ c = substr(s, i, 1)
+ if (c ~ /[A-Za-z0-9._~:-]/) o = o c
+ else o = o sprintf("%%%02X", ORD[c])
+ }
+ return o
+}
+function purl(type, name, version) {
+ return "pkg:" type "/" penc(name) "@" penc(version)
+}
+BEGIN { for (i = 0; i < 256; i++) ORD[sprintf("%c", i)] = i }
+'
+
+awk -F'|' -v pkg="$PKG" -v ver="$VER" -v uuid="$UUID" -v created="$CREATED" \
+ -v artifact="$ARTIFACT" "$AWK_LIB"'
+{
+ name[NR] = $1; vers[NR] = $2; lic[NR] = $3
+ link[NR] = $4; ptype[NR] = $5; orig[NR] = $6; commit[NR] = $7; dlic[NR] = $8
+ n = NR
+}
+END {
+ printf "{\n"
+ printf " \"spdxVersion\": \"SPDX-2.3\",\n"
+ printf " \"dataLicense\": \"CC0-1.0\",\n"
+ printf " \"SPDXID\": \"SPDXRef-DOCUMENT\",\n"
+ printf " \"name\": \"%s-%s\",\n", jesc(pkg), jesc(ver)
+ printf " \"documentNamespace\": \"https://percona.com/spdxdocs/%s-%s-%s\",\n", jesc(pkg), jesc(ver), uuid
+ printf " \"creationInfo\": {\n"
+ printf " \"created\": \"%s\",\n", created
+ printf " \"creators\": [\"Organization: Percona LLC\", \"Tool: gen-sbom.sh\"]\n"
+ printf " },\n"
+ printf " \"packages\": [\n"
+ printf " {\n"
+ printf " \"SPDXID\": \"SPDXRef-Package-root\",\n"
+ printf " \"name\": \"%s\",\n", jesc(pkg)
+ printf " \"versionInfo\": \"%s\",\n", jesc(ver)
+ printf " \"downloadLocation\": \"NOASSERTION\",\n"
+ printf " \"filesAnalyzed\": false,\n"
+ printf " \"licenseConcluded\": \"GPL-2.0-only\",\n"
+ printf " \"licenseDeclared\": \"GPL-2.0-only\",\n"
+ printf " \"copyrightText\": \"NOASSERTION\",\n"
+ printf " \"supplier\": \"Organization: Percona LLC\"\n"
+ printf " }"
+ for (i = 1; i <= n; i++) {
+ printf ",\n {\n"
+ printf " \"SPDXID\": \"SPDXRef-Component-%d\",\n", i
+ printf " \"name\": \"%s\",\n", jesc(name[i])
+ printf " \"versionInfo\": \"%s\",\n", jesc(vers[i])
+ printf " \"downloadLocation\": \"NOASSERTION\",\n"
+ printf " \"filesAnalyzed\": false,\n"
+ printf " \"licenseConcluded\": \"NOASSERTION\",\n"
+ printf " \"licenseDeclared\": \"%s\",\n", jesc(lic[i])
+ printf " \"copyrightText\": \"NOASSERTION\",\n"
+ printf " \"externalRefs\": [{\n"
+ printf " \"referenceCategory\": \"PACKAGE-MANAGER\",\n"
+ printf " \"referenceType\": \"purl\",\n"
+ printf " \"referenceLocator\": \"%s\"\n", purl(ptype[i], name[i], vers[i])
+ printf " }],\n"
+ if (commit[i] != "")
+ printf " \"sourceInfo\": \"linkage=%s origin=%s commit=%s\",\n", jesc(link[i]), jesc(orig[i]), jesc(commit[i])
+ else
+ printf " \"sourceInfo\": \"linkage=%s origin=%s\",\n", jesc(link[i]), jesc(orig[i])
+ if (dlic[i] != "")
+ printf " \"comment\": \"artifact=%s; declared-license=%s\"\n", jesc(artifact), jesc(dlic[i])
+ else
+ printf " \"comment\": \"artifact=%s\"\n", jesc(artifact)
+ printf " }"
+ }
+ printf "\n ],\n"
+ printf " \"relationships\": [\n"
+ printf " {\"spdxElementId\": \"SPDXRef-DOCUMENT\", \"relatedSpdxElement\": \"SPDXRef-Package-root\", \"relationshipType\": \"DESCRIBES\"}"
+ for (i = 1; i <= n; i++) {
+ printf ",\n {\"spdxElementId\": \"SPDXRef-Package-root\", \"relatedSpdxElement\": \"SPDXRef-Component-%d\", \"relationshipType\": \"CONTAINS\"}", i
+ }
+ printf "\n ]\n"
+ printf "}\n"
+}
+' "$COMPONENTS" > "${DEST}/${PKG}.spdx.json"
+
+awk -F'|' -v pkg="$PKG" -v ver="$VER" -v uuid="$UUID" -v created="$CREATED" \
+ -v artifact="$ARTIFACT" "$AWK_LIB"'
+{
+ name[NR] = $1; vers[NR] = $2; lic[NR] = $3
+ link[NR] = $4; ptype[NR] = $5; orig[NR] = $6; commit[NR] = $7; dlic[NR] = $8
+ n = NR
+}
+END {
+ printf "{\n"
+ printf " \"bomFormat\": \"CycloneDX\",\n"
+ printf " \"specVersion\": \"1.5\",\n"
+ printf " \"serialNumber\": \"urn:uuid:%s\",\n", uuid
+ printf " \"version\": 1,\n"
+ printf " \"metadata\": {\n"
+ printf " \"timestamp\": \"%s\",\n", created
+ printf " \"tools\": [{\"vendor\": \"Percona\", \"name\": \"gen-sbom.sh\"}],\n"
+ printf " \"component\": {\n"
+ printf " \"type\": \"application\",\n"
+ printf " \"bom-ref\": \"root\",\n"
+ printf " \"name\": \"%s\",\n", jesc(pkg)
+ printf " \"version\": \"%s\",\n", jesc(ver)
+ printf " \"supplier\": {\"name\": \"Percona LLC\"},\n"
+ printf " \"licenses\": [{\"license\": {\"id\": \"GPL-2.0-only\"}}]\n"
+ printf " }\n"
+ printf " },\n"
+ printf " \"components\": [\n"
+ for (i = 1; i <= n; i++) {
+ printf " {\n"
+ printf " \"type\": \"library\",\n"
+ printf " \"bom-ref\": \"component-%d\",\n", i
+ printf " \"name\": \"%s\",\n", jesc(name[i])
+ printf " \"version\": \"%s\",\n", jesc(vers[i])
+ printf " \"scope\": \"required\",\n"
+ printf " \"licenses\": [{\"license\": {\"name\": \"%s\"}}],\n", jesc(lic[i])
+ printf " \"purl\": \"%s\",\n", purl(ptype[i], name[i], vers[i])
+ printf " \"properties\": [\n"
+ printf " {\"name\": \"percona:linkage\", \"value\": \"%s\"},\n", jesc(link[i])
+ printf " {\"name\": \"percona:origin\", \"value\": \"%s\"},\n", jesc(orig[i])
+ if (commit[i] != "")
+ printf " {\"name\": \"percona:commit\", \"value\": \"%s\"},\n", jesc(commit[i])
+ printf " {\"name\": \"percona:artifact\", \"value\": \"%s\"}", jesc(artifact)
+ if (dlic[i] != "")
+ printf ",\n {\"name\": \"percona:declared-license\", \"value\": \"%s\"}\n", jesc(dlic[i])
+ else
+ printf "\n"
+ printf " ]\n"
+ printf " }%s\n", (i < n ? "," : "")
+ }
+ printf " ],\n"
+ printf " \"dependencies\": [\n"
+ printf " {\"ref\": \"root\", \"dependsOn\": ["
+ for (i = 1; i <= n; i++) printf "%s\"component-%d\"", (i > 1 ? ", " : ""), i
+ printf "]}\n"
+ printf " ]\n"
+ printf "}\n"
+}
+' "$COMPONENTS" > "${DEST}/${PKG}.cdx.json"
+
+{
+ echo "Percona Server for MySQL - third-party components"
+ echo "Package: ${PKG}"
+ echo "Version: ${VER}"
+ echo "Artifact: ${ARTIFACT}"
+ echo "Created: ${CREATED}"
+ echo
+ printf '%-22s %-26s %-14s %s\n' "COMPONENT" "VERSION" "ORIGIN" "LICENSE"
+ awk -F'|' '{ printf "%-22s %-26s %-14s %s\n", $1, $2, $6, $3 }' "$COMPONENTS"
+} > "${DEST}/${PKG}.sbom.txt"
+
+awk -F'|' '{ print $3 }' "$COMPONENTS" | sort -u > "${DEST}/${PKG}.licenses.txt"
+
+chmod 0755 "$DEST"
+for f in "${DEST}/${PKG}.spdx.json" "${DEST}/${PKG}.cdx.json" \
+ "${DEST}/${PKG}.sbom.txt" "${DEST}/${PKG}.licenses.txt"; do
+ chmod 0644 "$f"
+done
+
+echo "gen-sbom: wrote $(wc -l < "$COMPONENTS") components to ${DEST} (artifact=${ARTIFACT})"
diff --git a/build-ps/sbom/validate-sbom.sh b/build-ps/sbom/validate-sbom.sh
new file mode 100755
index 000000000000..6f023ece4516
--- /dev/null
+++ b/build-ps/sbom/validate-sbom.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+set -uo pipefail
+
+REQUIRED_COMPONENTS="protobuf zlib zstd lz4 icu abseil-cpp libkmip coredumper rocksdb boost"
+MIN_COMPONENTS=15
+
+ERRORS=0
+err() { echo "validate-sbom: ERROR: $*" >&2; ERRORS=$((ERRORS + 1)); }
+ok() { echo "validate-sbom: OK: $*"; }
+
+[ $# -gt 0 ] || { echo "usage: $0 ARTIFACT [ARTIFACT...]" >&2; exit 2; }
+
+TMP=$(mktemp -d "${TMPDIR:-/tmp}/ps-vsbom.XXXXXX")
+trap 'rm -rf "$TMP"' EXIT
+
+extract() {
+ local art=$1 dest=$2
+ mkdir -p "$dest"
+ case "$art" in
+ *.rpm) (cd "$dest" && rpm2cpio "$art" | cpio -idmu --quiet) ;;
+ *.deb) dpkg-deb -x "$art" "$dest" ;;
+ *.tar.gz) tar xzf "$art" -C "$dest" ;;
+ *) [ -d "$art" ] && cp -r "$art/." "$dest/" ;;
+ esac
+}
+
+check_json() {
+ local f=$1
+ if command -v python3 >/dev/null 2>&1; then
+ python3 -c "import json,sys; json.load(open(sys.argv[1]))" "$f" 2>/dev/null
+ else
+ return 0
+ fi
+}
+
+idx=0
+for art in "$@"; do
+ idx=$((idx + 1))
+ [ -e "$art" ] || { err "artifact does not exist: $art"; continue; }
+
+ name=$(basename "$art")
+ errors_before=$ERRORS
+
+ dest="${TMP}/$(printf '%03d' "$idx")_$(echo "$name" | tr -c 'A-Za-z0-9._-' '_')"
+ rm -rf "$dest"
+ extract "$art" "$dest"
+
+ spdx=$(find "$dest" -name '*.spdx.json' -type f 2>/dev/null | head -1)
+ cdx=$(find "$dest" -name '*.cdx.json' -type f 2>/dev/null | head -1)
+ txt=$(find "$dest" -name '*.sbom.txt' -type f 2>/dev/null | head -1)
+ lic=$(find "$dest" -name '*.licenses.txt' -type f 2>/dev/null | head -1)
+
+ if [ -z "$spdx" ]; then
+ err "$name: no .spdx.json found"
+ continue
+ fi
+ [ -n "$cdx" ] || err "$name: no .cdx.json found"
+ [ -n "$txt" ] || err "$name: no .sbom.txt found"
+ [ -n "$lic" ] || err "$name: no .licenses.txt found"
+
+ check_json "$spdx" || err "$name: .spdx.json is not valid JSON"
+ [ -z "$cdx" ] || check_json "$cdx" || err "$name: .cdx.json is not valid JSON"
+
+ count=$(grep -o '"SPDXID": "SPDXRef-Component-' "$spdx" 2>/dev/null | wc -l | tr -d ' ')
+ count=${count:-0}
+ if [ "$count" -lt "$MIN_COMPONENTS" ]; then
+ err "$name: only ${count} components in SPDX, expected at least ${MIN_COMPONENTS}"
+ fi
+
+ for c in $REQUIRED_COMPONENTS; do
+ if grep -q "\"name\": \"${c}\"" "$spdx"; then
+ continue
+ fi
+ # gen-sbom.sh substitutes the host package actually linked (DEB links
+ # system zlib/zstd/lz4 on some distros) for a vendored component it
+ # was told to --exclude, tagging it origin=system and naming it after
+ # the host package (e.g. zlib -> zlib1g). Accept that substitute too.
+ if grep -qi "\"name\": \"[A-Za-z0-9+_.-]*${c}[A-Za-z0-9+_.-]*\"" "$spdx" \
+ && grep -q 'origin=system' "$spdx"; then
+ continue
+ fi
+ err "$name: required component missing from SPDX: ${c}"
+ done
+
+ if [ "$ERRORS" -eq "$errors_before" ]; then
+ ok "$name: ${count} components, all required present"
+ fi
+done
+
+if [ "$ERRORS" -gt 0 ]; then
+ echo "validate-sbom: FAILED with ${ERRORS} error(s)" >&2
+ exit 1
+fi
+echo "validate-sbom: all artifacts carry a valid SBOM"
diff --git a/check_src/whitelist/ha_innodb.cc b/check_src/whitelist/ha_innodb.cc
deleted file mode 100644
index 347f58aef900..000000000000
--- a/check_src/whitelist/ha_innodb.cc
+++ /dev/null
@@ -1,16 +0,0 @@
-< #if 0
-< /* If the increment step of the auto increment column
-< decreases then it is not affecting the immediate
-< next value in the series. */
-< if (m_prebuilt->autoinc_increment > increment) {
-< current = autoinc - m_prebuilt->autoinc_increment;
-<
-< current = innobase_next_autoinc(current, 1, increment, 1, col_max_value);
-<
-< dict_table_autoinc_initialize(m_prebuilt->table, current);
-<
-< *first_value = current;
-< }
-< #endif
-<
-
diff --git a/components/audit_log_filter/audit_log_filter.cc b/components/audit_log_filter/audit_log_filter.cc
index 23b3dbe26ebe..c16aa883404d 100644
--- a/components/audit_log_filter/audit_log_filter.cc
+++ b/components/audit_log_filter/audit_log_filter.cc
@@ -76,7 +76,24 @@ SERVICE_TYPE(log_builtins_string) *log_bs = nullptr;
namespace audit_log_filter {
namespace {
-std::unique_ptr audit_log_filter;
+/*
+ Deliberately a raw pointer, and deliberately not destroyed when the server
+ goes down without unloading the component.
+
+ If the server terminates early - on an invalid --authentication-policy, say -
+ it never calls audit_log_filter_deinit(), so anything with a non-trivial
+ destructor here would be destroyed during static destruction instead.
+ Destroying AuditLogFilter that late destroys its AuditUdf member, whose
+ destructor calls AuditUdf::deinit() -> SysVars::get_comp_registry_srv(), and
+ the comp_registry_srv static that returns may already have been destroyed
+ itself: that aborts a debug build on the assertion inside
+ get_comp_registry_srv() and is undefined behaviour in a release one
+ (PS-11273).
+
+ Leaking the instance on that path is intentional - the process is on its way
+ out - so please do not turn this back into a smart pointer.
+*/
+AuditLogFilter *audit_log_filter{nullptr};
class EventsConsumer {
public:
@@ -184,7 +201,7 @@ bool is_stored_program_statement(MYSQL_THD thd) {
} // namespace
AuditLogFilter *get_audit_log_filter_instance() noexcept {
- return audit_log_filter.get();
+ return audit_log_filter;
}
/*
@@ -381,7 +398,10 @@ mysql_service_status_t audit_log_filter_init() try {
// Disarm the scope guard only after all potentially-throwing operations
// succeeded, so that SysVars cleanup still runs on exception.
comp_registry_srv = nullptr;
- audit_log_filter = std::move(local_audit_log_filter);
+ // deinit() clears the pointer, so there should be nothing here. Delete
+ // rather than overwrite, so that initializing twice cannot leak.
+ delete audit_log_filter;
+ audit_log_filter = local_audit_log_filter.release();
return 0;
} catch (const std::exception &e) {
LogComponentErr(ERROR_LEVEL, ER_AUDIT_INIT_EXCEPTION, e.what());
@@ -414,7 +434,8 @@ mysql_service_status_t audit_log_filter_deinit() try {
SysVars::deinit();
SysVars::release_comp_registry_srv();
- audit_log_filter.reset();
+ delete audit_log_filter;
+ audit_log_filter = nullptr;
return 0;
} catch (const std::exception &e) {
@@ -714,6 +735,17 @@ int AuditLogFilter::notify_event(audit_event_class_t event_class,
record);
LogComponentErr(INFORMATION_LEVEL, ER_AUDIT_BLOCKED_EVENT, ev_name.data(),
event_class);
+ /*
+ Report the abort ourselves. Without this the server falls back to
+ ER_AUDIT_API_ABORT with its generic "Aborted by Audit API ('%s';%d)"
+ text (sql_audit.cc, mysql_audit_notify()), which it only emits when the
+ handler left no error of its own. Keep that error number - it is what
+ the audit API uses for an aborted event - and only give it the wording
+ documented for an audit log filter abort. The blocked event class stays
+ available in the error log through ER_AUDIT_BLOCKED_EVENT above.
+ */
+ my_printf_error(ER_AUDIT_API_ABORT,
+ "Statement was aborted by an audit log filter.", MYF(0));
return 1;
}
diff --git a/components/audit_log_filter/audit_table/audit_log_filter.cc b/components/audit_log_filter/audit_table/audit_log_filter.cc
index bc82a34e46e3..7f36489a1d05 100644
--- a/components/audit_log_filter/audit_table/audit_log_filter.cc
+++ b/components/audit_log_filter/audit_table/audit_log_filter.cc
@@ -243,11 +243,23 @@ TableResult AuditLogFilter::load_filters(AuditRulesContainer &container,
/*skip_disabled_events=*/true)) {
container.insert({buff_filter_name_value, std::move(rule)});
} else {
+ /*
+ The parser records why it rejected the definition; report that instead
+ of a generic guess. Suggesting audit_log_filter.event_mode=FULL here
+ was always wrong: filters are parsed with skip_disabled_events=true on
+ this path, so an event class or subclass which is disabled in
+ event_mode=REDUCED is skipped with a warning rather than failing the
+ parse, and a failure therefore always means a malformed definition.
+ */
+ const std::string &parse_error = rule->get_parse_error();
+ const char *reason = parse_error.empty()
+ ? "unrecognized filter definition"
+ : parse_error.c_str();
+
LogComponentErr(ERROR_LEVEL, ER_AUDIT_TABLE_FILTER_WRONG_FORMAT,
- buff_filter_name_value, buff_filter_filter_value);
+ buff_filter_name_value, buff_filter_filter_value, reason);
error_message = std::string("Filter '") + buff_filter_name_value +
- "' has wrong format, consider using "
- "audit_log_filter.event_mode=FULL";
+ "' has wrong format: " + reason;
has_parse_error = true;
}
}
diff --git a/components/audit_log_filter/audit_udf.cc b/components/audit_log_filter/audit_udf.cc
index b7e0e51dd479..80fc9472d024 100644
--- a/components/audit_log_filter/audit_udf.cc
+++ b/components/audit_log_filter/audit_udf.cc
@@ -854,7 +854,14 @@ char *AuditUdf::audit_log_read_udf(AuditUdf *udf [[maybe_unused]],
return result;
}
- if (!json_doc.IsNull()) {
+ /*
+ Only an object has members to validate. Testing for "not null" was not
+ enough: GetObject() asserts on IsObject(), so any other JSON value -
+ an array, a number, a string, a boolean - aborted a debug server and
+ read a non-object as an object in a release one. Values which are
+ neither an object nor null are rejected as a wrong argument below.
+ */
+ if (json_doc.IsObject()) {
for (const auto &member : json_doc.GetObject()) {
const auto *member_name = member.name.GetString();
if (log_read_udf_allowed_args.count(member_name) == 0) {
@@ -877,10 +884,14 @@ char *AuditUdf::audit_log_read_udf(AuditUdf *udf [[maybe_unused]],
* Starting position for reads defined ether by "start" tag or by a
* bookmark consisting of a combination of "timestamp" and "id".
* Only one of this two ways may be used at the same time.
+ *
+ * Initializing a new read sequence (via a "start" tag or a bookmark)
+ * while one is already open is allowed: the open sequence is implicitly
+ * closed and a fresh one is started, as documented by Oracle and as
+ * upstream MySQL behaves.
*/
if ((has_timestamp_tag != has_id_tag) ||
- (has_start_tag && has_timestamp_tag) ||
- (reader_context != nullptr && (has_start_tag || has_timestamp_tag))) {
+ (has_start_tag && has_timestamp_tag)) {
my_error(ER_UDF_ERROR, MYF(0), "audit_log_read",
"Wrong argument format");
*error = 1;
@@ -918,10 +929,22 @@ char *AuditUdf::audit_log_read_udf(AuditUdf *udf [[maybe_unused]],
return result;
}
+ /*
+ * "max_array_length" may be given at the top level or, for "start"
+ * reads, nested inside the "start" object (PS-11186). A top-level value
+ * takes precedence when both are present.
+ */
+ const rapidjson::Value *max_array_length_val = nullptr;
if (json_doc.HasMember("max_array_length")) {
- if (json_doc["max_array_length"].IsUint()) {
- reader_args->max_array_length =
- json_doc["max_array_length"].GetUint();
+ max_array_length_val = &json_doc["max_array_length"];
+ } else if (has_start_tag &&
+ json_doc["start"].HasMember("max_array_length")) {
+ max_array_length_val = &json_doc["start"]["max_array_length"];
+ }
+
+ if (max_array_length_val != nullptr) {
+ if (max_array_length_val->IsUint()) {
+ reader_args->max_array_length = max_array_length_val->GetUint();
} else {
my_error(ER_UDF_ERROR, MYF(0), "audit_log_read",
"Wrong JSON argument, bad max_array_length format");
@@ -937,7 +960,13 @@ char *AuditUdf::audit_log_read_udf(AuditUdf *udf [[maybe_unused]],
return result;
}
} else if (reader_context == nullptr) {
- my_error(ER_UDF_ERROR, MYF(0), "audit_log_read", "Wrong argument format");
+ /*
+ audit_log_read() without an argument and without an open read sequence:
+ the sequence was never initialized, it has been closed, or it ended
+ because a previous read returned null. The arguments are fine, so say
+ what is actually wrong, as upstream does.
+ */
+ my_error(ER_UDF_ERROR, MYF(0), "audit_log_read", "Reader not initialized.");
*error = 1;
return result;
}
@@ -957,14 +986,24 @@ char *AuditUdf::audit_log_read_udf(AuditUdf *udf [[maybe_unused]],
bool is_new_session_request = !reader_args->timestamp.empty();
- if ((reader_context == nullptr && !is_new_session_request) ||
- (reader_context != nullptr && is_new_session_request)) {
+ if (reader_context == nullptr && !is_new_session_request) {
my_error(ER_UDF_ERROR, MYF(0), "audit_log_read", "Wrong arguments list");
*error = 1;
return result;
}
if (is_new_session_request) {
+ /*
+ * A new read sequence implicitly closes an already-open one before
+ * starting fresh from the requested position.
+ */
+ if (reader_context != nullptr) {
+ log_reader->close_reader_session(reader_context);
+ SysVars::set_log_reader_context(thd, nullptr);
+ delete reader_context;
+ reader_context = nullptr;
+ }
+
reader_context = log_reader->init_reader_session(thd, reader_args.get());
if (reader_context == nullptr) {
diff --git a/components/audit_log_filter/event_filter_function/query_digest.cc b/components/audit_log_filter/event_filter_function/query_digest.cc
index 96e26757be95..f1a4c98bf1a6 100644
--- a/components/audit_log_filter/event_filter_function/query_digest.cc
+++ b/components/audit_log_filter/event_filter_function/query_digest.cc
@@ -60,8 +60,18 @@ std::string EventFilterFunctionQueryDigest::get_query_digest() const noexcept {
CHARSET_INFO_h utf8 = charset_srv->get_utf8mb4();
+#ifdef WITH_WSREP
+ /* PXC: Cherrypicked commit from PS 26, to be removed once code is propagated
+ to PS 9.7. */
+ /*
+ * The "query_digest" THD attribute allocates a new string and stores it
+ * in the provided handle, it must not be pre-created to avoid a leak.
+ */
+ my_h_string digest = nullptr;
+#else
my_h_string digest;
string_factory_srv->create(&digest);
+#endif /* WITH_WSREP */
MYSQL_THD thd;
current_thd_srv->get(&thd);
@@ -69,8 +79,14 @@ std::string EventFilterFunctionQueryDigest::get_query_digest() const noexcept {
char buff_digest[1024];
std::string result;
+#ifdef WITH_WSREP
+ if (!thd_attrs_srv->get(thd, "query_digest",
+ reinterpret_cast(&digest)) &&
+ digest != nullptr) {
+#else
if (!thd_attrs_srv->get(thd, "query_digest",
reinterpret_cast(&digest))) {
+#endif /* WITH_WSREP */
string_converter_srv->convert_to_buffer(digest, buff_digest,
sizeof(buff_digest), utf8);
result.append(buff_digest);
diff --git a/components/keyrings/keyring_kmip/service_implementation/keyring_encryption_service_definition.cc b/components/keyrings/keyring_kmip/service_implementation/keyring_encryption_service_definition.cc
index 089d1974f91f..33947b90bf6c 100644
--- a/components/keyrings/keyring_kmip/service_implementation/keyring_encryption_service_definition.cc
+++ b/components/keyrings/keyring_kmip/service_implementation/keyring_encryption_service_definition.cc
@@ -49,6 +49,7 @@ DEFINE_BOOL_METHOD(Keyring_aes_service_impl::encrypt,
const unsigned char *data_buffer, size_t data_buffer_length,
unsigned char *out_buffer, size_t out_buffer_length,
size_t *out_length)) {
+ if (!g_keyring_operations) return true;
return aes_encrypt_template<
Keyring_kmip_backend,
keyring_common::data::Data_extension>(
@@ -63,6 +64,7 @@ DEFINE_BOOL_METHOD(Keyring_aes_service_impl::decrypt,
const unsigned char *data_buffer, size_t data_buffer_length,
unsigned char *out_buffer, size_t out_buffer_length,
size_t *out_length)) {
+ if (!g_keyring_operations) return true;
return aes_decrypt_template<
Keyring_kmip_backend,
keyring_common::data::Data_extension>(
diff --git a/components/keyrings/keyring_kmip/service_implementation/keyring_generator_service_definition.cc b/components/keyrings/keyring_kmip/service_implementation/keyring_generator_service_definition.cc
index 5a07ad18f482..7420fc3e5887 100644
--- a/components/keyrings/keyring_kmip/service_implementation/keyring_generator_service_definition.cc
+++ b/components/keyrings/keyring_kmip/service_implementation/keyring_generator_service_definition.cc
@@ -38,6 +38,7 @@ namespace service_definition {
DEFINE_BOOL_METHOD(Keyring_generator_service_impl::generate,
(const char *data_id, const char *auth_id,
const char *data_type, size_t data_size)) {
+ if (!g_keyring_operations) return true;
return generate_template(
data_id, auth_id, data_type, data_size, *g_keyring_operations,
*g_component_callbacks);
diff --git a/components/keyrings/keyring_kmip/service_implementation/keyring_keys_metadata_iterator_service_definition.cc b/components/keyrings/keyring_kmip/service_implementation/keyring_keys_metadata_iterator_service_definition.cc
index ebc19834f633..9e407310d22b 100644
--- a/components/keyrings/keyring_kmip/service_implementation/keyring_keys_metadata_iterator_service_definition.cc
+++ b/components/keyrings/keyring_kmip/service_implementation/keyring_keys_metadata_iterator_service_definition.cc
@@ -46,6 +46,7 @@ using keyring_kmip::IdExt;
namespace service_definition {
DEFINE_BOOL_METHOD(Keyring_keys_metadata_iterator_service_impl::init,
(my_h_keyring_keys_metadata_iterator * forward_iterator)) {
+ if (!g_keyring_operations) return true;
std::unique_ptr>> it;
bool retval = init_keys_metadata_iterator_template(
it, *g_keyring_operations, *g_component_callbacks);
@@ -57,6 +58,7 @@ DEFINE_BOOL_METHOD(Keyring_keys_metadata_iterator_service_impl::init,
DEFINE_BOOL_METHOD(Keyring_keys_metadata_iterator_service_impl::deinit,
(my_h_keyring_keys_metadata_iterator forward_iterator)) {
+ if (!g_keyring_operations) return true;
std::unique_ptr>> it;
it.reset(
reinterpret_cast> *>(forward_iterator));
@@ -66,6 +68,7 @@ DEFINE_BOOL_METHOD(Keyring_keys_metadata_iterator_service_impl::deinit,
DEFINE_BOOL_METHOD(Keyring_keys_metadata_iterator_service_impl::is_valid,
(my_h_keyring_keys_metadata_iterator forward_iterator)) {
+ if (!g_keyring_operations) return true;
std::unique_ptr>> it;
it.reset(
reinterpret_cast> *>(forward_iterator));
@@ -78,6 +81,7 @@ DEFINE_BOOL_METHOD(Keyring_keys_metadata_iterator_service_impl::is_valid,
DEFINE_BOOL_METHOD(Keyring_keys_metadata_iterator_service_impl::next,
(my_h_keyring_keys_metadata_iterator forward_iterator)) {
+ if (!g_keyring_operations) return true;
std::unique_ptr>> it;
it.reset(
reinterpret_cast> *>(forward_iterator));
@@ -91,6 +95,7 @@ DEFINE_BOOL_METHOD(Keyring_keys_metadata_iterator_service_impl::next,
DEFINE_BOOL_METHOD(Keyring_keys_metadata_iterator_service_impl::get_length,
(my_h_keyring_keys_metadata_iterator forward_iterator,
size_t *data_id_length, size_t *auth_id_length)) {
+ if (!g_keyring_operations) return true;
std::unique_ptr>> it;
it.reset(
reinterpret_cast> *>(forward_iterator));
@@ -106,6 +111,7 @@ DEFINE_BOOL_METHOD(Keyring_keys_metadata_iterator_service_impl::get,
(my_h_keyring_keys_metadata_iterator forward_iterator,
char *data_id, size_t data_id_length, char *auth_id,
size_t auth_id_length)) {
+ if (!g_keyring_operations) return true;
std::unique_ptr>> it;
it.reset(
reinterpret_cast> *>(forward_iterator));
diff --git a/components/keyrings/keyring_kmip/service_implementation/keyring_reader_service_definition.cc b/components/keyrings/keyring_kmip/service_implementation/keyring_reader_service_definition.cc
index e74c22f35dd4..ebdd168f1341 100644
--- a/components/keyrings/keyring_kmip/service_implementation/keyring_reader_service_definition.cc
+++ b/components/keyrings/keyring_kmip/service_implementation/keyring_reader_service_definition.cc
@@ -44,6 +44,7 @@ namespace service_definition {
DEFINE_BOOL_METHOD(Keyring_reader_service_impl::init,
(const char *data_id, const char *auth_id,
my_h_keyring_reader_object *reader_object)) {
+ if (!g_keyring_operations) return true;
std::unique_ptr>> it;
int retval = init_reader_template(
data_id, auth_id, it, *g_keyring_operations, *g_component_callbacks);
@@ -55,6 +56,7 @@ DEFINE_BOOL_METHOD(Keyring_reader_service_impl::init,
DEFINE_BOOL_METHOD(Keyring_reader_service_impl::deinit,
(my_h_keyring_reader_object reader_object)) {
+ if (!g_keyring_operations) return true;
std::unique_ptr>> it;
it.reset(reinterpret_cast> *>(reader_object));
return deinit_reader_template(it, *g_keyring_operations,
@@ -64,6 +66,7 @@ DEFINE_BOOL_METHOD(Keyring_reader_service_impl::deinit,
DEFINE_BOOL_METHOD(Keyring_reader_service_impl::fetch_length,
(my_h_keyring_reader_object reader_object, size_t *data_size,
size_t *data_type_size)) {
+ if (!g_keyring_operations) return true;
std::unique_ptr>> it;
it.reset(reinterpret_cast> *>(reader_object));
bool retval = fetch_length_template(
@@ -79,6 +82,7 @@ DEFINE_BOOL_METHOD(Keyring_reader_service_impl::fetch,
unsigned char *data_buffer, size_t data_buffer_length,
size_t *data_size, char *data_type_buffer,
size_t data_type_buffer_length, size_t *data_type_size)) {
+ if (!g_keyring_operations) return true;
std::unique_ptr>> it;
it.reset(reinterpret_cast> *>(reader_object));
bool retval = fetch_template(
diff --git a/components/keyrings/keyring_kmip/service_implementation/keyring_writer_service_definition.cc b/components/keyrings/keyring_kmip/service_implementation/keyring_writer_service_definition.cc
index 56bd409ed07b..0e2b73c985e1 100644
--- a/components/keyrings/keyring_kmip/service_implementation/keyring_writer_service_definition.cc
+++ b/components/keyrings/keyring_kmip/service_implementation/keyring_writer_service_definition.cc
@@ -39,6 +39,7 @@ DEFINE_BOOL_METHOD(Keyring_writer_service_impl::store,
(const char *data_id, const char *auth_id,
const unsigned char *data, size_t data_size,
const char *data_type)) {
+ if (!g_keyring_operations) return true;
return store_template(data_id, auth_id, data, data_size,
data_type, *g_keyring_operations,
*g_component_callbacks);
@@ -46,6 +47,7 @@ DEFINE_BOOL_METHOD(Keyring_writer_service_impl::store,
DEFINE_BOOL_METHOD(Keyring_writer_service_impl::remove,
(const char *data_id, const char *auth_id)) {
+ if (!g_keyring_operations) return true;
return remove_template(
data_id, auth_id, *g_keyring_operations, *g_component_callbacks);
}
diff --git a/components/percona_telemetry/component.cc b/components/percona_telemetry/component.cc
index af28ef17dba4..714a335a13b1 100644
--- a/components/percona_telemetry/component.cc
+++ b/components/percona_telemetry/component.cc
@@ -47,7 +47,7 @@ REQUIRES_SERVICE_PLACEHOLDER_AS(component_sys_variable_register,
REQUIRES_SERVICE_PLACEHOLDER_AS(component_sys_variable_unregister,
component_sys_variable_unregister_srv);
-std::unique_ptr percona_telemetry_component;
+PerconaTelemetryComponent *percona_telemetry_component{nullptr};
mysql_service_status_t component_init() {
auto services = std::make_unique();
@@ -64,25 +64,35 @@ mysql_service_status_t component_init() {
services->var_register_service = component_sys_variable_register_srv;
services->var_unregister_service = component_sys_variable_unregister_srv;
- percona_telemetry_component =
+ auto component =
std::make_unique(std::move(services));
- if (percona_telemetry_component->start()) {
+ if (component->start()) {
return 1;
}
+ percona_telemetry_component = component.release();
return 0;
}
mysql_service_status_t component_deinit() {
- if (percona_telemetry_component->stop()) {
+ if (percona_telemetry_component == nullptr) {
+ return 0;
+ }
+
+ std::unique_ptr component(
+ percona_telemetry_component);
+ percona_telemetry_component = nullptr;
+
+ if (component->stop()) {
return 1;
}
- percona_telemetry_component.reset();
return 0;
}
+void __attribute__((destructor)) lib_deinit() { component_deinit(); }
+
BEGIN_COMPONENT_PROVIDES(CURRENT_COMPONENT_NAME)
END_COMPONENT_PROVIDES();
diff --git a/components/percona_telemetry/data_provider.cc b/components/percona_telemetry/data_provider.cc
index c49ff4a07dc7..ff654852243c 100644
--- a/components/percona_telemetry/data_provider.cc
+++ b/components/percona_telemetry/data_provider.cc
@@ -14,11 +14,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#include
+#include
#include
#include "data_provider.h"
#include "logger.h"
+#include "telemetry_status_allowlist.h"
+#include "telemetry_sysvars_allowlist.h"
#ifdef WITH_WSREP
#include
@@ -27,6 +29,14 @@
namespace {
inline const char *b2s(bool val) { return val ? "1" : "0"; }
+/* Reject values that look like paths (defense in depth: the allow list is
+ already curated, but we double-check at collection time in case a value
+ shape changes upstream). */
+inline bool is_value_safe_for_export(const std::string &value) {
+ return std::all_of(value.begin(), value.end(),
+ [](unsigned char ch) { return ch != '/' && ch != '\\'; });
+}
+
/*
percona.telemetry user is created when server starts with telemetry
enabled. The user is deleted, when the server is started with telemetry
@@ -71,6 +81,11 @@ const char *size = "size";
// server configuration variables
const char *server_config_info = "server_config_info";
const char *thread_handling = "thread_handling";
+const char *nondefault_allowlisted_sysvars = "nondefault_allowlisted_sysvars";
+const char *variable_source = "variable_source";
+const char *variable_value = "variable_value";
+const char *server_status_info = "server_status_info";
+const char *allowlisted_global_status = "allowlisted_global_status";
#ifdef WITH_WSREP
const char *gcache_encryption_enabled = "gcache_encryption_enabled";
@@ -786,12 +801,121 @@ bool DataProvider::collect_server_config(rapidjson::Document *document) {
thread_handling, allocator);
}
+ /*
+ Non-default globals: provenance from performance_schema.variables_info,
+ restricted to allowlisted names via SQL IN (...) (see
+ telemetry_sysvars_allowlist.h) and value shape via
+ is_value_safe_for_export() above.
+ */
+ if (!kSysvarsAllowlistCsv.empty()) {
+ std::ostringstream oss;
+ oss << "SELECT vi.VARIABLE_NAME, gv.VARIABLE_VALUE, vi.VARIABLE_SOURCE "
+ "FROM performance_schema.variables_info vi "
+ "INNER JOIN performance_schema.global_variables gv "
+ "USING (VARIABLE_NAME) "
+ "WHERE vi.VARIABLE_SOURCE <> 'COMPILED' "
+ "AND vi.VARIABLE_NAME IN ("
+ << kSysvarsAllowlistCsv << ')';
+
+ QueryResult rows;
+ if (!do_query(oss.str(), &rows, nullptr, true)) {
+ rapidjson::Value sysvars_array(rapidjson::Type::kArrayType);
+ for (const Row &row : rows) {
+ if (row.size() < 3) {
+ continue;
+ }
+ const std::string &vname = row[0];
+ const std::string &vval = row[1];
+ const std::string &vsrc = row[2];
+ if (!is_value_safe_for_export(vval)) {
+ continue;
+ }
+ rapidjson::Value one_status(rapidjson::Type::kObjectType);
+ rapidjson::Value name_json;
+ name_json.SetString(vname.c_str(),
+ static_cast(vname.length()),
+ allocator);
+ one_status.AddMember(rapidjson::StringRef(JSONKey::name), name_json,
+ allocator);
+ rapidjson::Value val_json;
+ val_json.SetString(vval.c_str(),
+ static_cast(vval.length()),
+ allocator);
+ one_status.AddMember(rapidjson::StringRef(JSONKey::variable_value),
+ val_json, allocator);
+ rapidjson::Value src_json;
+ src_json.SetString(vsrc.c_str(),
+ static_cast(vsrc.length()),
+ allocator);
+ one_status.AddMember(rapidjson::StringRef(JSONKey::variable_source),
+ src_json, allocator);
+ sysvars_array.PushBack(one_status, allocator);
+ }
+
+ if (!sysvars_array.Empty()) {
+ server_config_json.AddMember(
+ rapidjson::StringRef(JSONKey::nondefault_allowlisted_sysvars),
+ sysvars_array, allocator);
+ }
+ }
+ }
+
document->AddMember(rapidjson::StringRef(JSONKey::server_config_info),
server_config_json, allocator);
return false;
}
+bool DataProvider::collect_server_status(rapidjson::Document *document) {
+ if (!kStatusAllowlistCsv.empty()) {
+ std::ostringstream oss;
+ oss << "SELECT VARIABLE_NAME, VARIABLE_VALUE FROM "
+ "performance_schema.global_status WHERE VARIABLE_NAME IN ("
+ << kStatusAllowlistCsv << ')';
+
+ QueryResult rows;
+ if (!do_query(oss.str(), &rows, nullptr, true)) {
+ rapidjson::Document::AllocatorType &allocator = document->GetAllocator();
+ rapidjson::Value status_array(rapidjson::Type::kArrayType);
+ for (const Row &row : rows) {
+ if (row.size() < 2) {
+ continue;
+ }
+ const std::string &vname = row[0];
+ const std::string &vval = row[1];
+ if (!is_value_safe_for_export(vval)) {
+ continue;
+ }
+ rapidjson::Value one_status(rapidjson::Type::kObjectType);
+ rapidjson::Value name_json;
+ name_json.SetString(vname.c_str(),
+ static_cast(vname.length()),
+ allocator);
+ one_status.AddMember(rapidjson::StringRef(JSONKey::name), name_json,
+ allocator);
+ rapidjson::Value val_json;
+ val_json.SetString(vval.c_str(),
+ static_cast(vval.length()),
+ allocator);
+ one_status.AddMember(rapidjson::StringRef(JSONKey::variable_value),
+ val_json, allocator);
+ status_array.PushBack(one_status, allocator);
+ }
+
+ if (!status_array.Empty()) {
+ rapidjson::Value server_status_json(rapidjson::Type::kObjectType);
+ server_status_json.AddMember(
+ rapidjson::StringRef(JSONKey::allowlisted_global_status),
+ status_array, allocator);
+ document->AddMember(rapidjson::StringRef(JSONKey::server_status_info),
+ server_status_json, allocator);
+ }
+ }
+ }
+
+ return false;
+}
+
bool DataProvider::collect_metrics(rapidjson::Document *document) {
/* The configuration of this instance might have changed, so we need to colect
it every time. */
@@ -819,6 +943,7 @@ bool DataProvider::collect_metrics(rapidjson::Document *document) {
res |= collect_group_replication_info(document);
res |= collect_async_replication_info(document);
res |= collect_server_config(document);
+ res |= collect_server_status(document);
#ifdef WITH_WSREP
res |= collect_galera_replication_info(document);
#endif
diff --git a/components/percona_telemetry/data_provider.h b/components/percona_telemetry/data_provider.h
index 4ae9ac2ca920..7a18860394ee 100644
--- a/components/percona_telemetry/data_provider.h
+++ b/components/percona_telemetry/data_provider.h
@@ -89,6 +89,7 @@ class DataProvider {
bool collect_group_replication_info(rapidjson::Document *document);
bool collect_async_replication_info(rapidjson::Document *document);
bool collect_server_config(rapidjson::Document *document);
+ bool collect_server_status(rapidjson::Document *document);
bool collect_db_replication_id(rapidjson::Document *document);
bool collect_metrics(rapidjson::Document *document);
diff --git a/components/percona_telemetry/telemetry_status_allowlist.h b/components/percona_telemetry/telemetry_status_allowlist.h
new file mode 100644
index 000000000000..cd7cf3d643f0
--- /dev/null
+++ b/components/percona_telemetry/telemetry_status_allowlist.h
@@ -0,0 +1,127 @@
+/* Copyright (c) 2026 Percona LLC and/or its affiliates. All rights reserved.
+
+ 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; version 2 of
+ the License.
+
+ 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 St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef TELEMETRY_STATUS_ALLOWLIST_H
+#define TELEMETRY_STATUS_ALLOWLIST_H
+
+#include
+
+/*
+ Allow list for performance_schema.global_status names collected by the
+ telemetry component. The names below are quoted, comma-joined and ready
+ to drop into SQL `IN (...)` (without surrounding parentheses). Adjacent
+ string literals concatenate at translation time, so this is one
+ contiguous read-only blob in `.rodata`; no allocation, no runtime
+ construction.
+
+ Maintenance:
+ * keep entries lexicographically sorted;
+ * every line ends with a trailing comma except the last;
+ * when adding/removing the last entry, fix up the comma on its neighbor.
+
+ Counters and numeric aggregates only; no SSL strings, paths, hostnames,
+ or InnoDB human-readable status strings. Values are still filtered
+ against `/` and `\` characters at collection time.
+*/
+inline constexpr std::string_view kStatusAllowlistCsv =
+ "'Aborted_clients',"
+ "'Aborted_connects',"
+ "'auth_openid_connect_users_authenticated',"
+ "'auth_openid_connect_users_denied',"
+ "'auth_openid_connect_users_proxied',"
+ "'auth_openid_connect_users_with_roles',"
+ "'auth_openid_connect_configured_idps',"
+ "'auth_openid_connect_configured_idps_using_jwks',"
+ "'auth_openid_connect_configured_group_role_maps',"
+ "'Acl_cache_items_count',"
+ "'Binlog_cache_disk_use',"
+ "'Binlog_cache_use',"
+ "'Binlog_stmt_cache_disk_use',"
+ "'Binlog_stmt_cache_use',"
+ "'Bytes_received',"
+ "'Bytes_sent',"
+ "'Com_delete',"
+ "'Com_insert',"
+ "'Com_select',"
+ "'Com_update',"
+ "'Connection_errors_internal',"
+ "'Connection_errors_max_connections',"
+ "'Connection_errors_peer_address',"
+ "'Connections',"
+ "'Created_tmp_disk_tables',"
+ "'Created_tmp_tables',"
+ "'Handler_commit',"
+ "'Handler_delete',"
+ "'Handler_read_first',"
+ "'Handler_read_key',"
+ "'Handler_read_next',"
+ "'Handler_read_prev',"
+ "'Handler_read_rnd',"
+ "'Handler_read_rnd_next',"
+ "'Handler_update',"
+ "'Handler_write',"
+ "'Innodb_buffer_pool_read_requests',"
+ "'Innodb_buffer_pool_reads',"
+ "'Innodb_data_read',"
+ "'Innodb_data_reads',"
+ "'Innodb_data_writes',"
+ "'Innodb_data_written',"
+ "'Innodb_dblwr_pages_written',"
+ "'Innodb_dblwr_writes',"
+ "'Innodb_log_waits',"
+ "'Innodb_log_write_requests',"
+ "'Innodb_log_writes',"
+ "'Innodb_os_log_written',"
+ "'Innodb_pages_created',"
+ "'Innodb_pages_read',"
+ "'Innodb_pages_written',"
+ "'Innodb_redo_log_read_only',"
+ "'Innodb_row_lock_time',"
+ "'Innodb_row_lock_time_avg',"
+ "'Innodb_row_lock_time_max',"
+ "'Innodb_row_lock_waits',"
+ "'Innodb_rows_deleted',"
+ "'Innodb_rows_inserted',"
+ "'Innodb_rows_read',"
+ "'Innodb_rows_updated',"
+ "'Libcoredumper_enabled',"
+ "'Max_used_connections',"
+ "'Open_files',"
+ "'Open_table_definitions',"
+ "'Open_tables',"
+ "'Prepared_stmt_count',"
+ "'Queries',"
+ "'Questions',"
+ "'Select_full_join',"
+ "'Select_full_range_join',"
+ "'Select_range',"
+ "'Select_range_check',"
+ "'Select_scan',"
+ "'Slow_queries',"
+ "'Sort_merge_passes',"
+ "'Sort_range',"
+ "'Sort_rows',"
+ "'Sort_scan',"
+ "'Table_locks_immediate',"
+ "'Table_locks_waited',"
+ "'Threadpool_idle_threads',"
+ "'Threadpool_threads',"
+ "'Threads_cached',"
+ "'Threads_connected',"
+ "'Threads_created',"
+ "'Threads_running'";
+
+#endif /* TELEMETRY_STATUS_ALLOWLIST_H */
diff --git a/components/percona_telemetry/telemetry_sysvars_allowlist.h b/components/percona_telemetry/telemetry_sysvars_allowlist.h
new file mode 100644
index 000000000000..80294a1e5413
--- /dev/null
+++ b/components/percona_telemetry/telemetry_sysvars_allowlist.h
@@ -0,0 +1,183 @@
+/* Copyright (c) 2024 Percona LLC and/or its affiliates. All rights reserved.
+
+ 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; version 2 of
+ the License.
+
+ 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 St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef TELEMETRY_SYSVARS_ALLOWLIST_H
+#define TELEMETRY_SYSVARS_ALLOWLIST_H
+
+#include
+
+/*
+ Allow list for global system variables collected by the telemetry
+ component. The names below are quoted, comma-joined and ready to drop
+ into SQL `IN (...)` (without surrounding parentheses). Adjacent string
+ literals concatenate at translation time, so this is one contiguous
+ read-only blob in `.rodata`; no allocation, no runtime construction.
+
+ Maintenance:
+ * keep entries lexicographically sorted;
+ * every line ends with a trailing comma except the last;
+ * when adding/removing the last entry, fix up the comma on its neighbor.
+
+ Policy: names whose values are usually numeric, enum, or ON/OFF only.
+ Paths, host lists, SSL file names, etc. are excluded; values are still
+ filtered against `/` and `\` characters at collection time.
+
+ Scope: common MySQL tuning, Percona-specific tuning, clone plugin, RocksDB
+ SE (when installed), semi-sync replication, binlog retention/compression.
+*/
+inline constexpr std::string_view kSysvarsAllowlistCsv =
+ "'authentication_policy',"
+ "'binlog_checksum',"
+ "'binlog_expire_logs_auto_purge',"
+ "'binlog_expire_logs_seconds',"
+ "'binlog_format',"
+ "'binlog_order_commits',"
+ "'binlog_row_image',"
+ "'binlog_space_limit',"
+ "'binlog_transaction_compression',"
+ "'binlog_transaction_compression_level_zstd',"
+ "'binlog_transaction_dependency_history_size',"
+ "'clone_autotune_concurrency',"
+ "'clone_block_ddl',"
+ "'clone_buffer_size',"
+ "'clone_compression_algorithm',"
+ "'clone_ddl_timeout',"
+ "'clone_delay_after_data_drop',"
+ "'clone_donor_timeout_after_network_failure',"
+ "'clone_enable_compression',"
+ "'clone_max_concurrency',"
+ "'clone_max_data_bandwidth',"
+ "'clone_max_network_bandwidth',"
+ "'clone_zstd_compression_level',"
+ "'disconnect_on_expired_password',"
+ "'div_precision_increment',"
+ "'enforce_gtid_consistency',"
+ "'expand_fast_index_creation',"
+ "'explicit_defaults_for_timestamp',"
+ "'general_log',"
+ "'group_replication_consistency',"
+ "'group_replication_exit_state_action',"
+ "'group_replication_flow_control_mode',"
+ "'group_replication_single_primary_mode',"
+ "'gtid_mode',"
+ "'host_cache_size',"
+ "'innodb_adaptive_flushing',"
+ "'innodb_adaptive_hash_index',"
+ "'innodb_buffer_pool_instances',"
+ "'innodb_buffer_pool_size',"
+ "'innodb_change_buffering',"
+ "'innodb_checksum_algorithm',"
+ "'innodb_ddl_threads',"
+ "'innodb_deadlock_detect',"
+ "'innodb_dedicated_server',"
+ "'innodb_doublewrite',"
+ "'innodb_file_per_table',"
+ "'innodb_fill_factor',"
+ "'innodb_flush_log_at_trx_commit',"
+ "'innodb_flush_method',"
+ "'innodb_flush_neighbors',"
+ "'innodb_ft_cache_size',"
+ "'innodb_io_capacity',"
+ "'innodb_io_capacity_max',"
+ "'innodb_log_buffer_size',"
+ "'innodb_lru_scan_depth',"
+ "'innodb_max_dirty_pages_pct',"
+ "'innodb_max_dirty_pages_pct_lwm',"
+ "'innodb_old_blocks_pct',"
+ "'innodb_old_blocks_time',"
+ "'innodb_open_files',"
+ "'innodb_page_cleaners',"
+ "'innodb_parallel_read_threads',"
+ "'innodb_purge_threads',"
+ "'innodb_read_ahead_threshold',"
+ "'innodb_read_io_threads',"
+ "'innodb_redo_log_capacity',"
+ "'innodb_spin_wait_delay',"
+ "'innodb_stats_persistent',"
+ "'innodb_strict_mode',"
+ "'innodb_sync_spin_loops',"
+ "'innodb_thread_concurrency',"
+ "'innodb_write_io_threads',"
+ "'join_buffer_size',"
+ "'lock_wait_timeout',"
+ "'log_bin',"
+ "'log_error_verbosity',"
+ "'log_replica_updates',"
+ "'long_query_time',"
+ "'max_allowed_packet',"
+ "'max_connections',"
+ "'max_heap_table_size',"
+ "'max_join_size',"
+ "'max_prepared_stmt_count',"
+ "'max_slowlog_files',"
+ "'max_slowlog_size',"
+ "'net_read_timeout',"
+ "'net_write_timeout',"
+ "'open_files_limit',"
+ "'optimizer_switch',"
+ "'performance_schema',"
+ "'read_buffer_size',"
+ "'read_only',"
+ "'read_rnd_buffer_size',"
+ "'relay_log_recovery',"
+ "'replica_compressed_protocol',"
+ "'replica_parallel_workers',"
+ "'replica_preserve_commit_order',"
+ "'replica_type_conversions',"
+ "'rocksdb_block_cache_size',"
+ "'rocksdb_block_size',"
+ "'rocksdb_bytes_per_sync',"
+ "'rocksdb_compaction_readahead_size',"
+ "'rocksdb_db_write_buffer_size',"
+ "'rocksdb_enable_bulk_load_api',"
+ "'rocksdb_flush_log_at_trx_commit',"
+ "'rocksdb_max_background_compactions',"
+ "'rocksdb_max_background_flushes',"
+ "'rocksdb_max_background_jobs',"
+ "'rocksdb_max_open_files',"
+ "'rocksdb_max_subcompactions',"
+ "'rocksdb_use_io_uring',"
+ "'rocksdb_write_policy',"
+ "'rpl_semi_sync_replica_enabled',"
+ "'rpl_semi_sync_source_enabled',"
+ "'skip_name_resolve',"
+ "'slow_query_log',"
+ "'slow_query_log_always_write_time',"
+ "'sort_buffer_size',"
+ "'sql_mode',"
+ "'sql_require_primary_key',"
+ "'super_read_only',"
+ "'sync_binlog',"
+ "'sync_source_info',"
+ "'table_definition_cache',"
+ "'table_open_cache',"
+ "'table_open_cache_instances',"
+ "'terminology_use_previous',"
+ "'thread_cache_size',"
+ "'thread_handling',"
+ "'thread_pool_high_prio_mode',"
+ "'thread_pool_high_prio_tickets',"
+ "'thread_pool_idle_timeout',"
+ "'thread_pool_max_threads',"
+ "'thread_pool_min_threads',"
+ "'thread_pool_oversubscribe',"
+ "'thread_pool_size',"
+ "'thread_pool_stall_limit',"
+ "'tmp_table_size',"
+ "'userstat',"
+ "'wait_timeout'";
+
+#endif /* TELEMETRY_SYSVARS_ALLOWLIST_H */
diff --git a/extra/jwt-cpp b/extra/jwt-cpp
new file mode 160000
index 000000000000..3e037df3e669
--- /dev/null
+++ b/extra/jwt-cpp
@@ -0,0 +1 @@
+Subproject commit 3e037df3e669633a3044618e30550ea2f212e915
diff --git a/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/common.c b/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/common.c
index 26cb53b84e20..4c0b3f127277 100644
--- a/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/common.c
+++ b/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/common.c
@@ -8,11 +8,25 @@ THREAD_LOCAL static struct cno_error_t E;
const struct cno_error_t *cno_error(void) { return &E; }
-int cno_error_set(int code, const char *fmt, ...) {
+static int cno_error_setv(int code, int detail, const char *fmt, va_list vl) {
E.code = code;
+ E.detail = detail;
+ vsnprintf(E.text, sizeof(E.text), fmt, vl);
+ return -1;
+}
+
+int cno_error_set(int code, const char *fmt, ...) {
va_list vl;
va_start(vl, fmt);
- vsnprintf(E.text, sizeof(E.text), fmt, vl);
+ cno_error_setv(code, CNO_ERROR_DETAIL_NONE, fmt, vl);
+ va_end(vl);
+ return -1;
+}
+
+int cno_error_set_detail(int code, int detail, const char *fmt, ...) {
+ va_list vl;
+ va_start(vl, fmt);
+ cno_error_setv(code, detail, fmt, vl);
va_end(vl);
return -1;
}
diff --git a/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/common.h b/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/common.h
index a85f13443838..769cf9932020 100644
--- a/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/common.h
+++ b/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/common.h
@@ -31,8 +31,17 @@ enum CNO_ERRNO {
CNO_ERRNO_DISCONNECT = 9, // connection has already been closed
};
+enum CNO_ERROR_DETAIL {
+ CNO_ERROR_DETAIL_NONE = 0,
+ CNO_ERROR_DETAIL_INVALID_CONTENT_LENGTH = 1,
+ CNO_ERROR_DETAIL_MULTIPLE_CONTENT_LENGTHS = 2,
+};
+
struct cno_error_t {
int code;
+ // Optional structured detail for callers that need to handle a specific
+ // parser error. `text` remains diagnostic.
+ int detail;
char text[256];
};
@@ -42,8 +51,12 @@ const struct cno_error_t *cno_error(void);
// Fail with a specified error code and message.
int cno_error_set(int code, const char *fmt, ...)
ATTRIBUTE((format(printf, 2, 3)));
+int cno_error_set_detail(int code, int detail, const char *fmt, ...)
+ ATTRIBUTE((format(printf, 3, 4)));
#define CNO_ERROR(n, ...) cno_error_set(CNO_ERRNO_##n, __VA_ARGS__)
+#define CNO_ERROR_WITH_DETAIL(n, d, ...) \
+ cno_error_set_detail(CNO_ERRNO_##n, CNO_ERROR_DETAIL_##d, __VA_ARGS__)
#define CNO_ERROR_UP() (-1)
struct cno_buffer_t {
diff --git a/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/core.c b/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/core.c
index 515ef05b94ff..14b476975b0e 100644
--- a/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/core.c
+++ b/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/core.c
@@ -533,7 +533,7 @@ static int cno_h2_on_end_headers(struct cno_connection_t *c,
struct cno_stream_t *s,
struct cno_frame_t *f) {
struct cno_header_t headers[CNO_MAX_HEADERS];
- struct cno_message_t m = {0, {0}, {0}, headers, CNO_MAX_HEADERS};
+ struct cno_message_t m = {0, {0}, {0}, headers, CNO_MAX_HEADERS, 0, 0};
if (cno_hpack_decode(&c->decoder, f->payload, headers, &m.headers_len))
// XXX cno_h2_goaway does not necessarily keep the old error on success...
return cno_h2_goaway(c, CNO_RST_COMPRESSION_ERROR), CNO_ERROR_UP();
@@ -1049,7 +1049,7 @@ static int cno_when_h1_head(struct cno_connection_t *c) {
}
struct cno_header_t headers[CNO_MAX_HEADERS + 2]; // + :scheme and :authority
- struct cno_message_t m = {0, {0}, {0}, headers, CNO_MAX_HEADERS};
+ struct cno_message_t m = {0, {0}, {0}, headers, CNO_MAX_HEADERS, 0, 0};
struct phr_header headers_phr[CNO_MAX_HEADERS];
int minor = 0;
@@ -1114,14 +1114,18 @@ static int cno_when_h1_head(struct cno_connection_t *c) {
upgrade = 1;
} else if (cno_buffer_eq(it->name,
CNO_BUFFER_CONST_STRING("content-length"))) {
+ m.has_content_length = 1;
if (s->reading_chunked) continue;
if (s->remaining_payload)
- return CNO_ERROR(PROTOCOL, "multiple content-lengths");
+ return CNO_ERROR_WITH_DETAIL(PROTOCOL, MULTIPLE_CONTENT_LENGTHS,
+ "multiple content-lengths");
if ((s->remaining_payload = cno_parse_uint(it->value)) == (uint64_t)-1)
- return CNO_ERROR(PROTOCOL, "invalid content-length");
+ return CNO_ERROR_WITH_DETAIL(PROTOCOL, INVALID_CONTENT_LENGTH,
+ "invalid content-length");
closeDelimited = 0;
} else if (cno_buffer_eq(it->name,
CNO_BUFFER_CONST_STRING("transfer-encoding"))) {
+ m.has_transfer_encoding = 1;
if (cno_buffer_eq(it->value, CNO_BUFFER_CONST_STRING("identity")))
continue; // (This value is probably not actually allowed.)
// Any non-identity transfer-encoding requires chunked (which should also
diff --git a/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/core.h b/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/core.h
index e9235dddfcc9..d78dd26748b8 100644
--- a/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/core.h
+++ b/extra/libcno/libcno-208939f540957a35b337dacdd5c5e34d51821bd2/cno/core.h
@@ -87,6 +87,11 @@ struct cno_message_t {
struct cno_buffer_t path;
struct cno_header_t *headers;
size_t headers_len;
+ // Parser-populated read-only flags for messages received via
+ // `on_message_head`. Not meaningful when passing a message to
+ // `cno_write_head`.
+ uint8_t has_transfer_encoding;
+ uint8_t has_content_length;
};
struct cno_tail_t {
diff --git a/extra/libfido2/libfido2-1.15.0/src/winhello.c b/extra/libfido2/libfido2-1.15.0/src/winhello.c
index 2b2a5d1b7d26..b2fc7c06170a 100644
--- a/extra/libfido2/libfido2-1.15.0/src/winhello.c
+++ b/extra/libfido2/libfido2-1.15.0/src/winhello.c
@@ -89,7 +89,8 @@ webauthn_load(void)
fido_log_debug("%s: already loaded", __func__);
return -1;
}
- if ((webauthn_handle = LoadLibrary(TEXT("webauthn.dll"))) == NULL) {
+ if ((webauthn_handle = LoadLibraryEx(TEXT("webauthn.dll"), NULL,
+ LOAD_LIBRARY_SEARCH_SYSTEM32)) == NULL) {
fido_log_debug("%s: LoadLibrary", __func__);
return -1;
}
diff --git a/include/service_wsrep.h b/include/service_wsrep.h
index 6c7b18b60a58..decccef28d2f 100644
--- a/include/service_wsrep.h
+++ b/include/service_wsrep.h
@@ -28,7 +28,16 @@ enum Wsrep_service_key_type {
};
namespace wsrep_version {
-enum wsrep_version : long { UNSPECIFIED = 0, V1 = 1, V2 = 2, V3 = 3, V4 = 4 };
+enum wsrep_version : long {
+ UNSPECIFIED = 0,
+ V1 = 1,
+ V2 = 2,
+ V3 = 3,
+ V4 = 4,
+ V5 = 5,
+ V6 = 6,
+ V7 = 7
+};
}
typedef wsrep_version::wsrep_version WsrepVersion;
diff --git a/libs/mysql/binlog/event/control_events.cpp b/libs/mysql/binlog/event/control_events.cpp
index 074ce46004e4..8d43b28c774b 100644
--- a/libs/mysql/binlog/event/control_events.cpp
+++ b/libs/mysql/binlog/event/control_events.cpp
@@ -800,13 +800,12 @@ View_change_event::~View_change_event() { certification_info.clear(); }
Heartbeat_event::Heartbeat_event(const char *buf,
const Format_description_event *fde)
- : Binary_log_event(&buf, fde) {
+ : Binary_log_event(&buf, fde), log_ident(nullptr), ident_len(0) {
BAPI_ENTER("Heartbeat_event::Heartbeat_event(const char*, ...)");
READER_TRY_INITIALIZATION;
READER_ASSERT_POSITION(fde->common_header_len);
- READER_TRY_SET(log_ident, ptr);
- if (log_ident == nullptr || header()->log_pos < BIN_LOG_HEADER_SIZE)
+ if (header()->log_pos < BIN_LOG_HEADER_SIZE)
READER_THROW("Invalid Heartbeat information");
ident_len = READER_CALL(available_to_read);
diff --git a/libs/mysql/binlog/event/rows_event.cpp b/libs/mysql/binlog/event/rows_event.cpp
index 612105ee726a..cf326894dfd5 100644
--- a/libs/mysql/binlog/event/rows_event.cpp
+++ b/libs/mysql/binlog/event/rows_event.cpp
@@ -70,11 +70,13 @@ Table_map_event::Table_map_event(const char *buf,
/* Read the variable part of the event */
READER_TRY_SET(m_dblen, net_field_length_ll);
+ if (m_dblen > NAME_LEN) READER_THROW("Invalid database name length");
ptr_dbnam = READER_TRY_CALL(ptr, m_dblen + 1);
m_dbnam = std::string(ptr_dbnam, m_dblen);
READER_TRY_SET(m_tbllen, net_field_length_ll);
+ if (m_tbllen > NAME_LEN) READER_THROW("Invalid table name length");
ptr_tblnam = READER_TRY_CALL(ptr, m_tbllen + 1);
m_tblnam = std::string(ptr_tblnam, m_tbllen);
@@ -484,7 +486,8 @@ Rows_event::Rows_event(const char *buf, const Format_description_event *fde)
}
READER_TRY_SET(m_width, net_field_length_ll);
- if (m_width == 0) READER_THROW("Invalid m_width");
+ if (m_width == 0 || m_width > Rows_event::max_fields)
+ READER_THROW("Invalid m_width");
n_bits_len = (m_width + 7) / 8;
READER_TRY_CALL(assign, &columns_before_image, n_bits_len);
diff --git a/libs/mysql/binlog/event/rows_event.h b/libs/mysql/binlog/event/rows_event.h
index be0a652138bc..34ef92cc4495 100644
--- a/libs/mysql/binlog/event/rows_event.h
+++ b/libs/mysql/binlog/event/rows_event.h
@@ -950,6 +950,9 @@ class Rows_event : public Binary_log_event {
~Rows_event() override;
protected:
+ // Maximum number of columns.
+ static constexpr const int max_fields{4096};
+
Log_event_type m_type; /** Actual event type */
/** Post header content */
diff --git a/libs/mysql/binlog/event/statement_events.cpp b/libs/mysql/binlog/event/statement_events.cpp
index 3634632dcb13..8011042c7adb 100644
--- a/libs/mysql/binlog/event/statement_events.cpp
+++ b/libs/mysql/binlog/event/statement_events.cpp
@@ -23,10 +23,33 @@
#include "mysql/binlog/event/statement_events.h"
#include // std::min() for Windows
+#include "decimal.h"
#include "mysql/binlog/event/event_reader_macros.h"
namespace mysql::binlog::event {
+namespace {
+
+constexpr int k_max_user_var_decimal_precision = 65;
+constexpr int k_max_user_var_decimal_scale = 30;
+
+} // namespace
+
+bool is_user_var_decimal_metadata_valid(const char *val, std::size_t val_len,
+ int max_precision, int max_scale) {
+ if (val_len < 2) return false;
+
+ const auto precision = static_cast(val[0]);
+ const auto scale = static_cast(val[1]);
+
+ // DECIMAL(M,D): reject precision beyond the caller limit, scale beyond
+ // the caller scale limit, or scale greater than precision.
+ if (precision > max_precision || scale > max_scale || scale > precision)
+ return false;
+
+ return decimal_bin_size(precision, scale) <= static_cast(val_len) - 2;
+}
+
/******************************************************************************
Query_event methods
******************************************************************************/
@@ -466,9 +489,10 @@ User_var_event::User_var_event(const char *buf,
READER_TRY_SET(charset_number, read);
READER_TRY_SET(val_len, read);
val = const_cast(READER_CALL(ptr, val_len));
- // val[0] is precision and val[1] is scale so precision >= scale for decimal
if (type == DECIMAL_RESULT) {
- if (val[0] < val[1])
+ if (!is_user_var_decimal_metadata_valid(val, val_len,
+ k_max_user_var_decimal_precision,
+ k_max_user_var_decimal_scale))
READER_THROW(
"Invalid User value found while deserializing User_var_event");
}
diff --git a/libs/mysql/binlog/event/statement_events.h b/libs/mysql/binlog/event/statement_events.h
index 9212ef0a7418..db50b711d6ad 100644
--- a/libs/mysql/binlog/event/statement_events.h
+++ b/libs/mysql/binlog/event/statement_events.h
@@ -34,6 +34,8 @@
#ifndef MYSQL_BINLOG_EVENT_STATEMENT_EVENTS_H
#define MYSQL_BINLOG_EVENT_STATEMENT_EVENTS_H
+#include
+
#include "mysql/binlog/event/control_events.h"
#include "mysql/udf_registration_types.h"
@@ -48,6 +50,16 @@ namespace mysql::binlog::event {
*/
const uint64_t INVALID_XID = 0xffffffffffffffffULL;
+/// Validates DECIMAL user variable metadata and payload length.
+/// @param val Encoded user variable payload, starting with precision and scale.
+/// @param val_len Length of the encoded payload in bytes.
+/// @param max_precision Maximum allowed DECIMAL precision for the caller.
+/// @param max_scale Maximum allowed DECIMAL scale for the caller.
+/// @retval true The metadata is well-formed for the given payload.
+/// @retval false The metadata is incomplete, out of range, or inconsistent.
+bool is_user_var_decimal_metadata_valid(const char *val, std::size_t val_len,
+ int max_precision, int max_scale);
+
/**
@class Query_event
diff --git a/libs/mysql/gtid/tag_plain.h b/libs/mysql/gtid/tag_plain.h
index 55e82222b93a..1716f637d116 100644
--- a/libs/mysql/gtid/tag_plain.h
+++ b/libs/mysql/gtid/tag_plain.h
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
#include "mysql/gtid/gtid_constants.h" // tag_max_length
diff --git a/man/comp_err.1 b/man/comp_err.1
index be0f520d3e11..7302f206f48b 100644
--- a/man/comp_err.1
+++ b/man/comp_err.1
@@ -2,12 +2,12 @@
.\" Title: comp_err
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "COMP_ERR" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "COMP_ERR" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/ibd2sdi.1 b/man/ibd2sdi.1
index 255c96f550a6..e158119d23f0 100644
--- a/man/ibd2sdi.1
+++ b/man/ibd2sdi.1
@@ -2,12 +2,12 @@
.\" Title: ibd2sdi
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "IBD2SDI" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "IBD2SDI" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/innochecksum.1 b/man/innochecksum.1
index 4ce1fe82176a..cca0e6233fa2 100644
--- a/man/innochecksum.1
+++ b/man/innochecksum.1
@@ -2,12 +2,12 @@
.\" Title: innochecksum
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/25/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "INNOCHECKSUM" "1" "03/25/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "INNOCHECKSUM" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/my_print_defaults.1 b/man/my_print_defaults.1
index 6c5b165d7dee..489a39b06592 100644
--- a/man/my_print_defaults.1
+++ b/man/my_print_defaults.1
@@ -2,12 +2,12 @@
.\" Title: my_print_defaults
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/25/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MY_PRINT_DEFAULTS" "1" "03/25/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MY_PRINT_DEFAULTS" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/myisam_ftdump.1 b/man/myisam_ftdump.1
index 253f072bf425..948a0a5bac08 100644
--- a/man/myisam_ftdump.1
+++ b/man/myisam_ftdump.1
@@ -2,12 +2,12 @@
.\" Title: myisam_ftdump
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/25/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYISAM_FTDUMP" "1" "03/25/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYISAM_FTDUMP" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/myisamchk.1 b/man/myisamchk.1
index 5c8b51d09c28..a6e74960366a 100644
--- a/man/myisamchk.1
+++ b/man/myisamchk.1
@@ -2,12 +2,12 @@
.\" Title: myisamchk
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/25/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYISAMCHK" "1" "03/25/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYISAMCHK" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/myisamlog.1 b/man/myisamlog.1
index f6c6bb75608d..9dc946d50961 100644
--- a/man/myisamlog.1
+++ b/man/myisamlog.1
@@ -2,12 +2,12 @@
.\" Title: myisamlog
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/25/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYISAMLOG" "1" "03/25/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYISAMLOG" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/myisampack.1 b/man/myisampack.1
index 6042c349721f..d2e66afc9d88 100644
--- a/man/myisampack.1
+++ b/man/myisampack.1
@@ -2,12 +2,12 @@
.\" Title: myisampack
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/25/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYISAMPACK" "1" "03/25/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYISAMPACK" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysql.1 b/man/mysql.1
index 115f4158d365..9a3bd48750e3 100644
--- a/man/mysql.1
+++ b/man/mysql.1
@@ -2,12 +2,12 @@
.\" Title: mysql
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQL" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQL" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysql.server.1 b/man/mysql.server.1
index 7dcc19cb19d5..ee5e2237d96b 100644
--- a/man/mysql.server.1
+++ b/man/mysql.server.1
@@ -2,12 +2,12 @@
.\" Title: mysql.server
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQL\&.SERVER" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQL\&.SERVER" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysql_config.1 b/man/mysql_config.1
index 77dfbdf91319..f6cb5d6247b9 100644
--- a/man/mysql_config.1
+++ b/man/mysql_config.1
@@ -2,12 +2,12 @@
.\" Title: mysql_config
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/25/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQL_CONFIG" "1" "03/25/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQL_CONFIG" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysql_config_editor.1 b/man/mysql_config_editor.1
index 2fcb1ea40696..99fa912f27a2 100644
--- a/man/mysql_config_editor.1
+++ b/man/mysql_config_editor.1
@@ -2,12 +2,12 @@
.\" Title: mysql_config_editor
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/25/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQL_CONFIG_EDITOR" "1" "03/25/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQL_CONFIG_EDITOR" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysql_migrate_keyring.1 b/man/mysql_migrate_keyring.1
index 3d28fb4f13bf..ff98bd4901ee 100644
--- a/man/mysql_migrate_keyring.1
+++ b/man/mysql_migrate_keyring.1
@@ -2,12 +2,12 @@
.\" Title: mysql_migrate_keyring
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/25/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQL_MIGRATE_KEYRING" "1" "03/25/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQL_MIGRATE_KEYRING" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysql_secure_installation.1 b/man/mysql_secure_installation.1
index d5c96c55adbd..2cabaf480b6a 100644
--- a/man/mysql_secure_installation.1
+++ b/man/mysql_secure_installation.1
@@ -2,12 +2,12 @@
.\" Title: mysql_secure_installation
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQL_SECURE_INSTALLATION" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQL_SECURE_INSTALLATION" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysql_tzinfo_to_sql.1 b/man/mysql_tzinfo_to_sql.1
index ea106a802941..7eb5e8e88cb8 100644
--- a/man/mysql_tzinfo_to_sql.1
+++ b/man/mysql_tzinfo_to_sql.1
@@ -2,12 +2,12 @@
.\" Title: mysql_tzinfo_to_sql
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQL_TZINFO_TO_SQL" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQL_TZINFO_TO_SQL" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysqladmin.1 b/man/mysqladmin.1
index ef374a77cbdd..c4022691ca89 100644
--- a/man/mysqladmin.1
+++ b/man/mysqladmin.1
@@ -2,12 +2,12 @@
.\" Title: mysqladmin
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLADMIN" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQLADMIN" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -336,7 +336,7 @@ statement\&. If the
\fB\-\-verbose\fR
option is given, the output is like that of
SHOW FULL PROCESSLIST\&. (See
-Section\ \&15.7.7.32, \(lqSHOW PROCESSLIST Statement\(rq\&.)
+Section\ \&15.7.7.33, \(lqSHOW PROCESSLIST Statement\(rq\&.)
.RE
.sp
.RS 4
diff --git a/man/mysqlbinlog.1 b/man/mysqlbinlog.1
index 210094731c66..4420358535d9 100644
--- a/man/mysqlbinlog.1
+++ b/man/mysqlbinlog.1
@@ -2,12 +2,12 @@
.\" Title: mysqlbinlog
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/25/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLBINLOG" "1" "03/25/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQLBINLOG" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysqlcheck.1 b/man/mysqlcheck.1
index ea3f59dfb951..b11103db9a4f 100644
--- a/man/mysqlcheck.1
+++ b/man/mysqlcheck.1
@@ -2,12 +2,12 @@
.\" Title: mysqlcheck
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLCHECK" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQLCHECK" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysqld.8 b/man/mysqld.8
index c20c46ed4980..8c61459c533f 100644
--- a/man/mysqld.8
+++ b/man/mysqld.8
@@ -2,12 +2,12 @@
.\" Title: mysqld
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLD" "8" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQLD" "8" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysqld_multi.1 b/man/mysqld_multi.1
index df18849a85d9..d8fc74162db6 100644
--- a/man/mysqld_multi.1
+++ b/man/mysqld_multi.1
@@ -2,12 +2,12 @@
.\" Title: mysqld_multi
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLD_MULTI" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQLD_MULTI" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysqld_safe.1 b/man/mysqld_safe.1
index 8c7284e7ca84..e5f6ac316b06 100644
--- a/man/mysqld_safe.1
+++ b/man/mysqld_safe.1
@@ -2,12 +2,12 @@
.\" Title: mysqld_safe
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLD_SAFE" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQLD_SAFE" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysqldump.1 b/man/mysqldump.1
index f952f0f1c3e9..876f54dcd943 100644
--- a/man/mysqldump.1
+++ b/man/mysqldump.1
@@ -2,12 +2,12 @@
.\" Title: mysqldump
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLDUMP" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQLDUMP" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -4439,7 +4439,7 @@ T}
.TE
.sp 1
This option causes generated invisible primary keys to be excluded from the output\&. For more information, see
-Section\ \&15.1.24.11, \(lqGenerated Invisible Primary Keys\(rq\&.
+Section\ \&15.1.25.11, \(lqGenerated Invisible Primary Keys\(rq\&.
.RE
.sp
.RS 4
diff --git a/man/mysqldumpslow.1 b/man/mysqldumpslow.1
index dafdd6938ba3..ced0a1dbff17 100644
--- a/man/mysqldumpslow.1
+++ b/man/mysqldumpslow.1
@@ -2,12 +2,12 @@
.\" Title: mysqldumpslow
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/25/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLDUMPSLOW" "1" "03/25/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQLDUMPSLOW" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysqlimport.1 b/man/mysqlimport.1
index fd87d9a6f807..5df58f898122 100644
--- a/man/mysqlimport.1
+++ b/man/mysqlimport.1
@@ -2,12 +2,12 @@
.\" Title: mysqlimport
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLIMPORT" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQLIMPORT" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysqlrouter.1 b/man/mysqlrouter.1
index e8cb830f79aa..c636df7cc5f7 100644
--- a/man/mysqlrouter.1
+++ b/man/mysqlrouter.1
@@ -2,12 +2,12 @@
.\" Title: mysqlrouter
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/24/2026
.\" Manual: MySQL Router
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLROUTER" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Router"
+.TH "MYSQLROUTER" "1" "06/24/2026" "MySQL 9\&.7" "MySQL Router"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysqlrouter_keyring.1 b/man/mysqlrouter_keyring.1
index 37ad319ee122..f895d7e09037 100644
--- a/man/mysqlrouter_keyring.1
+++ b/man/mysqlrouter_keyring.1
@@ -2,12 +2,12 @@
.\" Title: mysqlrouter_keyring
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/24/2026
.\" Manual: MySQL Router
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLROUTER_KEYRING" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Router"
+.TH "MYSQLROUTER_KEYRING" "1" "06/24/2026" "MySQL 9\&.7" "MySQL Router"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysqlrouter_passwd.1 b/man/mysqlrouter_passwd.1
index 1c8240832566..c9d70d405b53 100644
--- a/man/mysqlrouter_passwd.1
+++ b/man/mysqlrouter_passwd.1
@@ -2,12 +2,12 @@
.\" Title: mysqlrouter_passwd
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/24/2026
.\" Manual: MySQL Router
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLROUTER_PASSWD" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Router"
+.TH "MYSQLROUTER_PASSWD" "1" "06/24/2026" "MySQL 9\&.7" "MySQL Router"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysqlrouter_plugin_info.1 b/man/mysqlrouter_plugin_info.1
index 0c80fac25ed7..3a590793450d 100644
--- a/man/mysqlrouter_plugin_info.1
+++ b/man/mysqlrouter_plugin_info.1
@@ -2,12 +2,12 @@
.\" Title: mysqlrouter_plugin_info
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/24/2026
.\" Manual: MySQL Router
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLROUTER_PLUGIN_INFO" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Router"
+.TH "MYSQLROUTER_PLUGIN_INFO" "1" "06/24/2026" "MySQL 9\&.7" "MySQL Router"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysqlshow.1 b/man/mysqlshow.1
index c5b9f902e78b..e340ca8ca933 100644
--- a/man/mysqlshow.1
+++ b/man/mysqlshow.1
@@ -2,12 +2,12 @@
.\" Title: mysqlshow
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLSHOW" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQLSHOW" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysqlslap.1 b/man/mysqlslap.1
index de7192df7c32..8b9efcc06fec 100644
--- a/man/mysqlslap.1
+++ b/man/mysqlslap.1
@@ -2,12 +2,12 @@
.\" Title: mysqlslap
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/24/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "MYSQLSLAP" "1" "03/24/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "MYSQLSLAP" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/perror.1 b/man/perror.1
index a0dd3927535a..88ab3b23b301 100644
--- a/man/perror.1
+++ b/man/perror.1
@@ -2,12 +2,12 @@
.\" Title: perror
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 03/25/2026
+.\" Date: 06/25/2026
.\" Manual: MySQL Database System
.\" Source: MySQL 9.7
.\" Language: English
.\"
-.TH "PERROR" "1" "03/25/2026" "MySQL 9\&.7" "MySQL Database System"
+.TH "PERROR" "1" "06/25/2026" "MySQL 9\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt
index 06b9217969f3..3a9d9b343ad9 100644
--- a/mysql-test/CMakeLists.txt
+++ b/mysql-test/CMakeLists.txt
@@ -130,6 +130,7 @@ SET(MTR_TESTS_FOR_PROFILING
json
main
sysschema
+ thread_pool
x
component_connection_control
)
diff --git a/mysql-test/collections/default.daily b/mysql-test/collections/default.daily
index c18a5c888429..60f42c6ddc58 100644
--- a/mysql-test/collections/default.daily
+++ b/mysql-test/collections/default.daily
@@ -63,6 +63,10 @@ perl mysql-test-run.pl --timer --force --comment=eits-tests-innodb-engine --va
# Group Replication
perl mysql-test-run.pl --timer --force --parallel=6 --comment=group_replication --vardir=var-group_replication --suite=group_replication --big-test --testcase-timeout=60 --suite-timeout=360
+
+# Thread Pool Plugin
+perl mysql-test-run.pl --timer --big-test --force --comment=thread_pool --vardir=var-thread_pool --suite=thread_pool,thread_pool_noload,thread_pool_rpl --no-skip
+
######END OF SECTION 2 (NON-DEFAULT SUITES)######################
######## SECTION 3: EXTENDED RUNS FOR REPLICATION AND BINLOG#######
diff --git a/mysql-test/collections/default.daily-valgrind b/mysql-test/collections/default.daily-valgrind
index 3475fafdeb22..e94463fb0cb4 100644
--- a/mysql-test/collections/default.daily-valgrind
+++ b/mysql-test/collections/default.daily-valgrind
@@ -24,3 +24,7 @@ perl mysql-test-run.pl --timer --force --testcase-timeout=60 --comment=eits-t
# Group Replication
perl mysql-test-run.pl --timer --force --parallel=6 --comment=group_replication-valgrind --vardir=var-group_replication-valgrind --suite=group_replication
+
+# Thread Pool Plugin
+perl mysql-test-run.pl --valgrind --timer --force --comment=thread_pool --vardir=var-thread_pool --suite=thread_pool,thread_pool_noload,thread_pool_rpl --no-skip
+
diff --git a/mysql-test/collections/default.push b/mysql-test/collections/default.push
index 22eb29951a4c..d8ad7ad99da2 100644
--- a/mysql-test/collections/default.push
+++ b/mysql-test/collections/default.push
@@ -26,3 +26,7 @@ perl mysql-test-run.pl --exclude-platform=_el7-|_solaris11- --timer --testcase-t
perl mysql-test-run.pl --timer --force --parallel=6 --comment=group_replication --vardir=var-group_replication --suite=group_replication
perl mysql-test-run.pl --force --timer --comment=classic_hashing --vardir=var-classic_hashing --suite=classic_hashing --no-skip --big-test
+
+# Thread Pool Plugin
+perl mysql-test-run.pl --debug-server --timer --force --comment=thread_pool --vardir=var-thread_pool --suite=thread_pool,thread_pool_noload,thread_pool_rpl --no-skip
+
diff --git a/mysql-test/collections/default.release b/mysql-test/collections/default.release
index 528d9bd0824b..857cad1cf09e 100644
--- a/mysql-test/collections/default.release
+++ b/mysql-test/collections/default.release
@@ -28,3 +28,7 @@ perl mysql-test-run.pl --force --timer --comment=nist+ps --vardir=var-nist_p
# Group Replication
perl mysql-test-run.pl --timer --force --parallel=6 --comment=group_replication --vardir=var-group_replication --suite=group_replication
+
+# Thread Pool Plugin
+perl mysql-test-run.pl --timer --force --comment=thread_pool --vardir=var-thread_pool --suite=thread_pool,thread_pool_noload,thread_pool_rpl --no-skip
+
diff --git a/mysql-test/collections/default.weekly b/mysql-test/collections/default.weekly
index 515d6adda439..1b91152e976d 100644
--- a/mysql-test/collections/default.weekly
+++ b/mysql-test/collections/default.weekly
@@ -61,6 +61,10 @@ perl mysql-test-run.pl --debug-server --timer --force --big-test --comment=eit
# Group Replication
perl mysql-test-run.pl --timer --debug-server --force --parallel=6 --comment=group_replication-debug --vardir=var-gr-debug --suite=group_replication --big-test --testcase-timeout=60 --suite-timeout=360
+
+# Thread Pool Plugin
+perl mysql-test-run.pl --debug-server --big-test --timer --force --comment=thread_pool --vardir=var-thread_pool --suite=thread_pool,thread_pool_noload,thread_pool_rpl --no-skip
+
######END OF SECTION 2 (NON-DEFAULT SUITES)######################
######## SECTION 3: EXTENDED RUNS FOR REPLICATION AND BINLOG#######
diff --git a/mysql-test/collections/default.weekly-valgrind b/mysql-test/collections/default.weekly-valgrind
index 5f5a29487579..159bbd69a528 100644
--- a/mysql-test/collections/default.weekly-valgrind
+++ b/mysql-test/collections/default.weekly-valgrind
@@ -26,3 +26,7 @@ perl mysql-test-run.pl --timer --force --big-test --testcase-timeout=60 --debug-
# Group Replication
perl mysql-test-run.pl --timer --debug-server --force --parallel=6 --comment=group_replication-valgrind --vardir=var-group_replication-valgrind --suite=group_replication --big-test --testcase-timeout=60 --suite-timeout=360
+
+# Thread Pool Plugin
+perl mysql-test-run.pl --debug-server --valgrind --big-test --timer --force --comment=thread_pool --vardir=var-thread_pool --suite=thread_pool,thread_pool_noload,thread_pool_rpl --no-skip
+
diff --git a/mysql-test/collections/mysql-trunk-stage.push b/mysql-test/collections/mysql-trunk-stage.push
index 474c2ad0a448..ed6e113afc98 100644
--- a/mysql-test/collections/mysql-trunk-stage.push
+++ b/mysql-test/collections/mysql-trunk-stage.push
@@ -45,3 +45,7 @@ perl mysql-test-run.pl --debug-server --force --timer --big-test --testcase-time
# Connection Control plugin
perl mysql-test-run.pl --debug-server --force --timer --big-test --testcase-timeout=60 --comment=connection_control-big --vardir=var-connection_control-big --suite=connection_control --no-skip
+
+# Thread Pool Plugin
+perl mysql-test-run.pl --timer --big-test --force --comment=thread_pool --vardir=var-thread_pool --suite=thread_pool,thread_pool_noload,thread_pool_rpl --no-skip
+
diff --git a/mysql-test/collections/mysql-trunk-stage.push.basic b/mysql-test/collections/mysql-trunk-stage.push.basic
index 260a80c8fe48..36fc4ddabff9 100644
--- a/mysql-test/collections/mysql-trunk-stage.push.basic
+++ b/mysql-test/collections/mysql-trunk-stage.push.basic
@@ -26,3 +26,6 @@ perl mysql-test-run.pl --timer --force --comment=eits-tests-innodb-engine --va
# Group Replication
perl mysql-test-run.pl --timer --force --parallel=6 --comment=group_replication --vardir=var-group_replication --suite=group_replication
+
+# Thread Pool Plugin
+perl mysql-test-run.pl --timer --force --comment=thread_pool --vardir=var-thread_pool --suite=thread_pool,thread_pool_noload,thread_pool_rpl --no-skip
diff --git a/mysql-test/common/binlog/enforce_gtid_consistency_trx_nontrx_violation.test b/mysql-test/common/binlog/enforce_gtid_consistency_trx_nontrx_violation.test
index ec11b57d4e83..0c95d1d8112a 100644
--- a/mysql-test/common/binlog/enforce_gtid_consistency_trx_nontrx_violation.test
+++ b/mysql-test/common/binlog/enforce_gtid_consistency_trx_nontrx_violation.test
@@ -75,6 +75,7 @@ CREATE TEMPORARY TABLE tmp_myisam2 (a INT) ENGINE = MyISAM;
# Mixing of non-composable engine
--let $extra_warning_count= $mix_engine_warning_count
--source common/binlog/enforce_gtid_consistency_statement.inc
+--let $extra_warning_count= 0
--echo ---- InnoDB and temp MyISAM in one autocommit statement, binlog_format=stm ----
CREATE TRIGGER trig BEFORE INSERT ON innodb FOR EACH ROW INSERT INTO tmp_myisam1 VALUES (1);
@@ -83,12 +84,15 @@ CREATE TRIGGER trig BEFORE INSERT ON innodb FOR EACH ROW INSERT INTO tmp_myisam1
# Mixing of non-composable engine
--let $extra_warning_count= $mix_engine_warning_count
--source common/binlog/enforce_gtid_consistency_statement.inc
+--let $extra_warning_count= 0
--echo ---- InnoDB and temp MyISAM in one statement inside trx, binlog_format=stm ----
+# Mixing of non-composable engine
+--let $extra_warning_count= $mix_engine_warning_count
if (`SELECT @@GLOBAL.BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES`)
{
# Unsafe warning
- --let $extra_warning_count= 1
+ --inc $extra_warning_count
}
--disable_warnings
--let $pre_statement= BEGIN
diff --git a/mysql-test/common/rpl/rpl_auto_increment_myisam.test b/mysql-test/common/rpl/rpl_auto_increment_myisam.test
index 89e6bc89727d..c6f35297493f 100644
--- a/mysql-test/common/rpl/rpl_auto_increment_myisam.test
+++ b/mysql-test/common/rpl/rpl_auto_increment_myisam.test
@@ -4,6 +4,17 @@
-- source include/not_ndb_default.inc
-- source include/rpl/init_source_replica.inc
-- source include/have_myisam.inc
+--disable_query_log
+--connection slave
+# Bug#39580589 tracks the MyISAM/GTID visibility behavior observed here:
+# with concurrent_insert enabled, a MyISAM SELECT may observe the previous
+# table state after WAIT_FOR_EXECUTED_GTID_SET() returns. Revisit this
+# test's dependency on @@global.concurrent_insert after Bug#39580589
+# is evaluated.
+SET @old_slave_concurrent_insert= @@global.concurrent_insert;
+SET @@global.concurrent_insert= 0;
+--connection master
+--enable_query_log
eval create table t1 (a int not null auto_increment,b int, primary key (a)) engine=$engine_type2 auto_increment=3;
insert into t1 values (NULL,1),(NULL,2),(NULL,3);
@@ -213,4 +224,9 @@ DROP TABLE t2;
SET SQL_MODE='';
--source include/rpl/sync_to_replica.inc
+--disable_query_log
+--connection slave
+SET @@global.concurrent_insert= @old_slave_concurrent_insert;
+--enable_query_log
+
--source include/rpl/deinit.inc
diff --git a/mysql-test/common/rpl/rpl_charset.test b/mysql-test/common/rpl/rpl_charset.test
index 0d9ea2fd37ef..9bf2f0dbf0ea 100644
--- a/mysql-test/common/rpl/rpl_charset.test
+++ b/mysql-test/common/rpl/rpl_charset.test
@@ -2,6 +2,18 @@
# This test will fail if the server/client does not support enough charsets.
source include/rpl/init_source_replica.inc;
+--disable_query_log
+--connection slave
+# Bug#39580589 tracks the MyISAM/GTID visibility behavior observed here:
+# with concurrent_insert enabled, a MyISAM SELECT may observe the previous
+# table state after WAIT_FOR_EXECUTED_GTID_SET() returns. Revisit this
+# test's dependency on @@global.concurrent_insert after Bug#39580589
+# is evaluated.
+SET @old_slave_concurrent_insert= @@global.concurrent_insert;
+SET @@global.concurrent_insert= 0;
+--connection master
+--enable_query_log
+
set timestamp=1000000000;
create database mysqltest2 character set latin2;
@@ -143,4 +155,9 @@ update t1 set pk='test' where pk=@p;
drop table t1;
# End of 4.1 tests
+--disable_query_log
+--connection slave
+SET @@global.concurrent_insert= @old_slave_concurrent_insert;
+--enable_query_log
+
--source include/rpl/deinit.inc
diff --git a/mysql-test/common/rpl/rpl_fk_enable_triggers.test b/mysql-test/common/rpl/rpl_fk_enable_triggers.test
index 573ba0597486..7b8c5779dbc6 100644
--- a/mysql-test/common/rpl/rpl_fk_enable_triggers.test
+++ b/mysql-test/common/rpl/rpl_fk_enable_triggers.test
@@ -1,3 +1,4 @@
+-- source include/not_have_privilege_checks_user.inc
-- source include/rpl/init_source_replica.inc
CALL mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
diff --git a/mysql-test/common/rpl/rpl_foreign_key_sql_child_trig.test b/mysql-test/common/rpl/rpl_foreign_key_sql_child_trig.test
index 0e8abe9571ed..cb41533d324a 100644
--- a/mysql-test/common/rpl/rpl_foreign_key_sql_child_trig.test
+++ b/mysql-test/common/rpl/rpl_foreign_key_sql_child_trig.test
@@ -1,3 +1,4 @@
+-- source include/not_have_privilege_checks_user.inc
-- source include/rpl/init_source_replica.inc
--echo # WL#17024 Activate triggers on child table during FK cascade
diff --git a/mysql-test/common/rpl/rpl_insert_id.test b/mysql-test/common/rpl/rpl_insert_id.test
index 4cb3287b965a..90d0b3d5229a 100644
--- a/mysql-test/common/rpl/rpl_insert_id.test
+++ b/mysql-test/common/rpl/rpl_insert_id.test
@@ -26,16 +26,22 @@
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
--connection slave
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+# Bug#39580589 tracks the MyISAM/GTID visibility behavior observed here:
+# with concurrent_insert enabled, a MyISAM SELECT may observe the previous
+# table state after WAIT_FOR_EXECUTED_GTID_SET() returns. Revisit this
+# test's dependency on @@global.concurrent_insert after Bug#39580589
+# is evaluated.
+SET @old_slave_concurrent_insert= @@global.concurrent_insert;
+SET @@global.concurrent_insert= 0;
--enable_query_log
# If concurrent inserts are on, it is not guaranteed that the rows
# inserted by INSERT are immediately accessible by SELECT in another
# thread. This would cause problems near the line 'connection master1'
-# below. So we turn off concurrent inserts.
-connection master;
-SET @old_concurrent_insert= @@global.concurrent_insert;
-SET @@global.concurrent_insert= 0;
+# below. mysql-test/suite/rpl/t/rpl_insert_id.test turns off concurrent
+# inserts on the source before sourcing this file, and the replica setting
+# is handled here after replication has been initialized.
connection master;
eval create table t1(a int auto_increment, key(a)) engine=$engine_type;
@@ -554,7 +560,10 @@ select * from t2 order by id;
connection master;
drop table t1, t2;
drop procedure foo;
-SET @@global.concurrent_insert= @old_concurrent_insert;
set @@session.sql_auto_is_null=default;
+--connection slave
+--disable_query_log
+SET @@global.concurrent_insert= @old_slave_concurrent_insert;
+--enable_query_log
--source include/rpl/deinit.inc
diff --git a/mysql-test/include/attachable_trx.inc b/mysql-test/include/attachable_trx.inc
index 28e7ddc8ba7e..57b1d99eadfc 100644
--- a/mysql-test/include/attachable_trx.inc
+++ b/mysql-test/include/attachable_trx.inc
@@ -3,7 +3,7 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
-SET @debug_saved = @@global.debug;
+SET @debug_saved = @@debug;
--let $DEFAULT_SE = `SELECT @@default_storage_engine`
@@ -45,9 +45,9 @@ SELECT * FROM t1;
--echo
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
START TRANSACTION;
-SET @@global.debug = '+d,use_attachable_trx';
+SET @@debug = '+d,use_attachable_trx';
SELECT * FROM t1;
-SET @@global.debug = '-d,use_attachable_trx';
+SET @@debug = '-d,use_attachable_trx';
--disconnect con1
--echo
@@ -92,9 +92,9 @@ SELECT * FROM t1;
--echo
--echo # SELECT in the inner transaction sees the changes.
-SET @@global.debug = '+d,use_attachable_trx';
+SET @@debug = '+d,use_attachable_trx';
SELECT * FROM t1;
-SET @@global.debug = '-d,use_attachable_trx';
+SET @@debug = '-d,use_attachable_trx';
--echo
--echo # COMMIT the outer transaction.
@@ -129,9 +129,9 @@ SELECT * FROM t1;
--echo
--echo # Do anything in the inner transaction.
-SET @@global.debug = '+d,use_attachable_trx';
+SET @@debug = '+d,use_attachable_trx';
SELECT * FROM t1;
-SET @@global.debug = '-d,use_attachable_trx';
+SET @@debug = '-d,use_attachable_trx';
--echo
--echo # Just make sure the changes are still there.
@@ -158,7 +158,7 @@ COMMIT;
DROP TABLE t1;
--echo
-SET @@global.debug = @debug_saved;
+SET @@debug = @debug_saved;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/include/derived_condition_pushdown.inc b/mysql-test/include/derived_condition_pushdown.inc
index a4973cf51283..e8df32269e51 100644
--- a/mysql-test/include/derived_condition_pushdown.inc
+++ b/mysql-test/include/derived_condition_pushdown.inc
@@ -1617,3 +1617,44 @@ DEALLOCATE PREPARE ps_select_latin1_off;
DROP VIEW v1;
DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#38888307: UNION ALL + AND + WHERE IS UNKNOWN
+--echo # query results are incorrect
+--echo #
+
+CREATE TABLE t1(f1 INTEGER, f2 INTEGER, f3 INTEGER);
+INSERT INTO t1 VALUES (1, NULL, NULL), (2, 0, 0), (3, 1, 1);
+
+SELECT *
+FROM (SELECT (f1 AND f2) AS col0 FROM t1
+ UNION ALL
+ SELECT (f1 AND f2) AS col0 FROM t1
+) AS dt
+WHERE (dt.col0) IS NULL;
+
+SELECT *
+FROM (SELECT (f1 AND f2) AS col0 FROM t1
+ UNION
+ SELECT (f1 AND f2) AS col0 FROM t1
+) AS dt
+WHERE (dt.col0) IS NULL;
+
+SELECT *
+FROM (SELECT (f1 AND f2) AS col0 FROM t1
+ INTERSECT
+ SELECT (f1 AND f2) AS col0 FROM t1
+) AS dt
+WHERE (dt.col0) IS NULL;
+
+CREATE TABLE t2(f1 INTEGER, f2 INTEGER, f3 INTEGER);
+INSERT INTO t2 VALUES (2, 0, 0), (3, 1, 1);
+
+SELECT *
+FROM (SELECT (f1 AND f2) AS col0 FROM t1
+ EXCEPT
+ SELECT (f1 AND f2) AS col0 FROM t2
+) AS dt
+WHERE (dt.col0) IS NULL;
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/include/desc_index.inc b/mysql-test/include/desc_index.inc
index b739095d8733..a6dfc463996c 100644
--- a/mysql-test/include/desc_index.inc
+++ b/mysql-test/include/desc_index.inc
@@ -916,7 +916,7 @@ ALTER TABLE t1 ADD INDEX key2 (col_int_key);
ANALYZE TABLE t1;
-let $query=SELECT * FROM t1 FORCE INDEX (key1,col_int_key) WHERE pk IN (6,2)
+let $query=SELECT * FROM t1 FORCE INDEX (key1,key2) WHERE pk IN (6,2)
OR (col_int_key >= 7 AND col_int_key < 13);
eval EXPLAIN $query;
--sorted_result # The hypergraph optimizer doesn't support FORCE INDEX.
diff --git a/mysql-test/include/gr_clear_configuration.inc b/mysql-test/include/gr_clear_configuration.inc
index 0db0c14a1858..002811fca265 100644
--- a/mysql-test/include/gr_clear_configuration.inc
+++ b/mysql-test/include/gr_clear_configuration.inc
@@ -42,6 +42,7 @@ while ($_rpl_server <= $_rpl_server_max)
SET GLOBAL group_replication_force_members= "";
SET GLOBAL group_replication_bootstrap_group= OFF;
SET GLOBAL read_only= FALSE;
+ --disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT ONCE
SET GLOBAL group_replication_ip_allowlist= "AUTOMATIC";
# Result-log is enabled.
diff --git a/mysql-test/include/gr_configuration.inc b/mysql-test/include/gr_configuration.inc
index 48318922a0c0..3eff4495e60a 100644
--- a/mysql-test/include/gr_configuration.inc
+++ b/mysql-test/include/gr_configuration.inc
@@ -112,6 +112,7 @@ while ($_rpl_server)
--eval SET GLOBAL group_replication_local_address= "$_group_replication_local_address"
--eval SET GLOBAL group_replication_group_seeds= "$_group_replication_group_seeds"
--eval SET GLOBAL group_replication_bootstrap_group= $_group_replication_bootstrap_group
+ --disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT ONCE
--eval SET PERSIST group_replication_ip_allowlist= "$_group_replication_ip_allowlist"
if (!$skip_recovery_configuration)
diff --git a/mysql-test/include/have_no_telemetry_component.inc b/mysql-test/include/have_no_telemetry_component.inc
index eb3d4e3db187..2f99aa6cd426 100644
--- a/mysql-test/include/have_no_telemetry_component.inc
+++ b/mysql-test/include/have_no_telemetry_component.inc
@@ -1,7 +1,12 @@
--disable_query_log
--disable_warnings
# Make sure no telemetry component is already installed.
-let $have_component = `SELECT count(*)>=1 AS installed FROM performance_schema.global_variables WHERE variable_name like "%telemetry%" and variable_name not like "percona_telemetry%";`;
+# The percona_telemetry component and the percona_telemetry_disable server
+# variable also match "%telemetry%", but percona_telemetry only collects usage
+# data and does not conflict with the server telemetry traces/logs components,
+# so exclude it. Without this the whole family of telemetry tests always skips
+# on Percona Server.
+let $have_component = `SELECT count(*)>=1 AS installed FROM performance_schema.global_variables WHERE variable_name like "%telemetry%" AND variable_name NOT LIKE "percona_telemetry%";`;
if ($have_component)
{
skip Requires no telemetry component already installed;
diff --git a/mysql-test/include/have_thread_pool.inc b/mysql-test/include/have_thread_pool.inc
new file mode 100644
index 000000000000..b5a0b93e9acb
--- /dev/null
+++ b/mysql-test/include/have_thread_pool.inc
@@ -0,0 +1,6 @@
+if(`SELECT count(*) = 0 FROM information_schema.plugins
+ WHERE PLUGIN_LIBRARY LIKE 'thread_pool%'`)
+{
+ --skip Test requires: 'thread_pool' plugin loaded
+}
+
diff --git a/mysql-test/include/index_merge_innodb.inc b/mysql-test/include/index_merge_innodb.inc
index f28c34fac2b4..e301ea1a43b1 100644
--- a/mysql-test/include/index_merge_innodb.inc
+++ b/mysql-test/include/index_merge_innodb.inc
@@ -95,3 +95,34 @@ WHERE c1 IN
AND t1.d1 IS NULL;
DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#36584358: Wrong result with index_merge_union=off
+--echo #
+
+CREATE TABLE t1 (
+ f1 INTEGER,
+ f2 INTEGER,
+ KEY (f1 DESC,f2 DESC),
+ KEY (f2 DESC,f1)
+);
+INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,NULL),
+(NULL,NULL),(NULL,NULL),(NULL,NULL);
+ANALYZE TABLE t1;
+
+let query = SELECT f1 FROM t1 WHERE f1 OR f2;
+eval EXPLAIN FORMAT=tree $query;
+eval $query;
+
+SET @optimizer_switch_saved = @@optimizer_switch;
+SET optimizer_switch="index_merge_union=off";
+
+# It would return wrong result earlier.
+eval EXPLAIN FORMAT=tree $query;
+eval $query;
+
+SET optimizer_switch="index_merge_union=on";
+SET @@optimizer_switch = @optimizer_switch_saved;
+
+
+DROP TABLE t1;
diff --git a/mysql-test/include/is_mysql_version_maturity_lts.inc b/mysql-test/include/is_mysql_version_maturity_lts.inc
index d14e5024d3ca..e186eb260408 100644
--- a/mysql-test/include/is_mysql_version_maturity_lts.inc
+++ b/mysql-test/include/is_mysql_version_maturity_lts.inc
@@ -17,7 +17,7 @@
# --echo MYSQL_VERSION_MATURITY_LTS: $is_mysql_version_maturity_lts_out_var
--let $is_mysql_version_maturity_lts_out_var= 0
-if (`SELECT sys.version_major()>=9 AND sys.version_minor()=7`)
+if (`SELECT sys.version_major()=9 AND sys.version_minor()=7`)
{
--let $is_mysql_version_maturity_lts_out_var= 1
}
diff --git a/mysql-test/include/order_by_is_null.inc b/mysql-test/include/order_by_is_null.inc
new file mode 100644
index 000000000000..9c717bc87dd6
--- /dev/null
+++ b/mysql-test/include/order_by_is_null.inc
@@ -0,0 +1,205 @@
+--echo #
+--echo # Bug#38700622: Optimizer doesn't simplify ORDER BY when
+--echo # field IS NULL
+--echo #
+
+CREATE TABLE t1 (
+ f1 INT PRIMARY KEY AUTO_INCREMENT,
+ f2 INT NOT NULL,
+ f3 DATETIME DEFAULT NULL,
+ f4 VARCHAR(50),
+ f5 VARCHAR(20),
+ f6 TINYINT,
+ f7 VARCHAR(100),
+ KEY k1 (f2, f3, f4, f5, f6, f7)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 (f2, f3, f4, f5, f6, f7) VALUES
+(100, NULL, 'User1', 'Active', 0, 'Item A'),
+(100, NULL, 'User1', 'Active', 0, 'Item B'),
+(100, NULL, 'User1', 'Active', 0, 'Item C'),
+(100, NULL, 'User1', 'Pending', 0, 'Item D'),
+(100, '2024-01-01 10:00:00', 'User1', 'Active', 0, 'Item E'),
+(200, NULL, 'User2', 'Active', 1, 'Item F'),
+(200, NULL, 'User3', 'Pending', 0, 'Item G');
+
+ANALYZE TABLE t1;
+
+--echo #
+--echo # Test 1: Basic IS NULL with ORDER BY over f2, f3, f7.
+--echo # Should avoid sorting on f3.
+--echo #
+
+let $query =
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND f3 IS NULL
+ORDER BY f2, f3, f7;
+eval EXPLAIN FORMAT=tree $query;
+eval $query;
+
+--echo #
+--echo # Test 2: Compound index with IS NULL - No external sort.
+--echo #
+
+let $query =
+SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0 AND f7 >= 'Item B'
+ORDER BY f2, f3, f4, f5, f6, f7 ASC
+LIMIT 10;
+eval EXPLAIN FORMAT=tree $query;
+eval $query;
+
+--echo #
+--echo # Test 3: Mix of equality and IS NULL with all intermediate
+--echo # fields constant. No external sort.
+--echo #
+
+let $query =
+SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0
+ORDER BY f2, f3, f4, f5, f6, f7;
+eval EXPLAIN FORMAT=tree $query;
+eval $query;
+
+--echo #
+--echo # Test 4: IS NOT NULL should NOT be treated as constant.
+--echo # Sorting needed.
+--echo #
+
+let $query =
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f3 IS NOT NULL ORDER BY f3, f7;
+eval EXPLAIN FORMAT=tree $query;
+eval $query;
+
+--echo #
+--echo # Test 5: Record optimizer trace marker for constant
+--echo # ORDER BY fields. For hypergraph it would
+--echo # be absent.
+--echo #
+SET optimizer_trace="enabled=on";
+
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f3 IS NULL
+ORDER BY f2, f3, f7 LIMIT 2;
+
+SELECT IF(
+ LOCATE('"equals_constant_in_where": true', TRACE) > 0,
+ 'TRACE: equals_constant_in_where present',
+ 'TRACE: equals_constant_in_where absent'
+) AS trace_check
+FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+
+SET optimizer_trace="enabled=off";
+
+--echo #
+--echo # Test 6: OR with IS NULL - field should NOT be treated
+--echo # as constant. So sorting is needed.
+--echo #
+
+let $query =
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 > '2024-01-01')
+ORDER BY f3, f7;
+eval EXPLAIN FORMAT=tree $query;
+eval $query;
+
+--echo #
+--echo # Test 7: OR with multiple IS NULL - same field.
+--echo # Will be treated as constant. Sorting will be
+--echo # only on "f7".
+--echo #
+
+let $query =
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 IS NULL)
+ORDER BY f2, f3, f7;
+eval EXPLAIN FORMAT=tree $query;
+eval $query;
+
+--echo #
+--echo # Test 8: OR with <=> NULL and IS NULL on the same field.
+--echo # Tradiitonal optimizer treats f3 as constant;
+--echo # hypergraph keeps f3 in the sort (Bug#39567745).
+--echo #
+
+let $query =
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 <=> NULL OR f3 IS NULL)
+ORDER BY f2, f3, f7;
+eval EXPLAIN FORMAT=tree $query;
+eval $query;
+
+let $query =
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 <=> NULL)
+ORDER BY f2, f3, f7;
+eval EXPLAIN FORMAT=tree $query;
+eval $query;
+
+--echo #
+--echo # Test 9: Verify IS NULL works with DESC ordering
+--echo #
+
+let $query =
+SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0
+ORDER BY f2, f3, f4, f5, f6, f7 DESC;
+eval EXPLAIN FORMAT=tree $query;
+eval $query;
+
+--echo #
+--echo # Test 10: Verify NULL ordering semantics with ASC
+--echo #
+
+CREATE TABLE t2 (
+ f1 INT PRIMARY KEY AUTO_INCREMENT,
+ f2 INT,
+ f3 VARCHAR(10),
+ KEY k1 (f2, f3)
+);
+INSERT INTO t2 (f2, f3) VALUES
+ (NULL, 'null1'),
+ (NULL, 'null2'),
+ (5, 'five'),
+ (10, 'ten'),
+ (NULL, 'null3'),
+ (1, 'one');
+ANALYZE TABLE t2;
+
+SELECT f1, f2, f3 FROM t2 ORDER BY f2 ASC, f3 ASC;
+
+--echo #
+--echo # Test 11: Verify NULL ordering semantics with DESC
+--echo #
+
+SELECT f1, f2, f3 FROM t2 ORDER BY f2 DESC, f3 ASC;
+
+--echo #
+--echo # Test 12: Verify optimization works with DESC and preserves NULL ordering
+--echo #
+
+let $query=
+SELECT f1, f2, f3 FROM t2
+WHERE f2 IS NULL ORDER BY f2 DESC, f3 ASC;
+eval EXPLAIN FORMAT=tree $query;
+eval $query;
+
+--echo #
+--echo # Test 13: Mixed ASC/DESC with IS NULL constraint
+--echo #
+
+let $query=
+SELECT f1, f2, f3 FROM t2
+WHERE f2 IS NULL ORDER BY f2 ASC, f3 DESC;
+eval EXPLAIN FORMAT=tree $query;
+eval $query;
+
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/include/plugin.defs b/mysql-test/include/plugin.defs
index a5e3268c9a47..627adfded6cf 100644
--- a/mysql-test/include/plugin.defs
+++ b/mysql-test/include/plugin.defs
@@ -247,3 +247,12 @@ component_encryption_udf plugin_output_directory no ENCRYPTION_UDF_
component_masking_functions plugin_output_directory no MASKING_FUNCTIONS_COMPONENT
component_percona_udf plugin_output_directory no PERCONA_UDF_COMPONENT
component_js_lang plugin_output_directory no JS_LANG_COMPONENT
+auth_openid_connect plugin_output_directory no AUTH_OIDC auth_openid_connect
+
+# Thread Pool Plugin
+thread_pool plugin_output_directory no ONLY_THREADPOOL_PLUGIN thread_pool
+thread_pool plugin_output_directory no THREADPOOL_PLUGIN thread_pool,TP_THREAD_STATE,TP_THREAD_GROUP_STATE,TP_THREAD_GROUP_STATS
+thread_pool plugin_output_directory no TP_THREAD_GROUP_STATE_PLUGIN TP_THREAD_GROUP_STATE
+thread_pool plugin_output_directory no TP_THREAD_STATE_PLUGIN TP_THREAD_STATE
+thread_pool plugin_output_directory no TP_THREAD_TWO_PLUGIN TP_THREAD_GROUP_STATS,TP_THREAD_STATE
+
diff --git a/mysql-test/include/reopen_default_connection_as_tcpip.inc b/mysql-test/include/reopen_default_connection_as_tcpip.inc
new file mode 100644
index 000000000000..bec4cfe9ccde
--- /dev/null
+++ b/mysql-test/include/reopen_default_connection_as_tcpip.inc
@@ -0,0 +1,14 @@
+# When running on Windows the default connection will be a named pipe
+# connection. A named pipe connection is not managed by the thread pool in the
+# normal way, so it may be necessary to close it and replace it with a tcp-ip
+# connection.
+
+--source include/check_windows.inc
+
+if ($have_windows)
+{
+ disconnect default;
+ --source include/wait_until_disconnected.inc
+ connect (default, localhost, root,,);
+}
+
diff --git a/mysql-test/include/start_group_replication_command.inc b/mysql-test/include/start_group_replication_command.inc
index 077cc261c93a..b58b7f5c385c 100644
--- a/mysql-test/include/start_group_replication_command.inc
+++ b/mysql-test/include/start_group_replication_command.inc
@@ -14,6 +14,7 @@
--let $_is_windows= `SELECT convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 1`
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
if ($_is_windows)
{
--error 0, ER_GROUP_REPLICATION_CONFIGURATION
diff --git a/mysql-test/lsan.supp b/mysql-test/lsan.supp
index 101bd5a9442c..bdbb406aa4c6 100644
--- a/mysql-test/lsan.supp
+++ b/mysql-test/lsan.supp
@@ -45,6 +45,8 @@ leak:/usr/bin/python3.9
leak:/usr/bin/python3.10
leak:/usr/bin/python3.11
leak:/usr/bin/python3.12
+leak:/usr/bin/python3.13
+leak:/usr/bin/python3.14
leak:/usr/bin/dd
leak:/usr/bin/grep
leak:/usr/bin/ps
@@ -54,6 +56,12 @@ leak:/lib/*libbfd-*-system.so
leak:/usr/bin/*ld.bfd
leak:/usr/lib/*collect2
+# Ubuntu 25.10 and newer ship the Rust (uutils) reimplementation of
+# coreutils, installed under /usr/lib/cargo/bin/coreutils/ rather than
+# /usr/bin/. Every one of these binaries leaks a small allocation at
+# startup, which LSAN reports whenever a test shells out to them.
+leak:/usr/lib/cargo/bin/coreutils/*
+
# OpenLDAP bug 9081
# Fixed in 2.4.49, we build with 2.4.48
leak:ldap_initialize
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 9c524c352f98..0dad817d66d4 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -407,6 +407,7 @@ sub set_term_args {
our $exe_mysql_migrate_keyring;
our $exe_mysql_keyring_encryption_test;
our $exe_mysql_test_jwt_generator;
+our $exe_create_id_token;
our $exe_mysqladmin;
our $exe_mysqltest;
our $exe_mysql_test_event_tracking;
@@ -3065,6 +3066,7 @@ ()
$exe_mysql_keyring_encryption_test =
mtr_exe_exists("$path_client_bindir/mysql_keyring_encryption_test");
$exe_mysql_test_jwt_generator = mtr_exe_maybe_exists("$path_client_bindir/mysql_test_jwt_generator");
+ $exe_create_id_token = mtr_exe_maybe_exists("$path_client_bindir/create_id_token");
# Look for mysql_test_event_tracking binary
$exe_mysql_test_event_tracking = my_find_bin($bindir,
[ "runtime_output_directory", "bin" ],
@@ -3692,6 +3694,7 @@ sub environment_setup {
"$path_client_bindir/mysql_secure_installation";
$ENV{'OPENSSL_EXECUTABLE'} = $exe_openssl;
$ENV{'MYSQL_TEST_JWT_GENERATOR'} = $exe_mysql_test_jwt_generator;
+ $ENV{'CREATE_ID_TOKEN'} = $exe_create_id_token;
my $exe_mysqld = find_mysqld($basedir);
$ENV{'MYSQLD'} = $exe_mysqld;
diff --git a/mysql-test/r/bug38657550.result b/mysql-test/r/bug38657550.result
new file mode 100644
index 000000000000..4e54d0de3697
--- /dev/null
+++ b/mysql-test/r/bug38657550.result
@@ -0,0 +1,64 @@
+#
+# Bug#38657550 Use-after-free of TABLE::read_set in DynamicRangeIterator
+#
+CREATE TABLE t1 (
+id INT PRIMARY KEY,
+col1 INT,
+col2 INT,
+col3 INT,
+KEY index_col2(col2),
+KEY index_col3(col3),
+KEY index_c123(col1, col2, col3)
+);
+CREATE PROCEDURE insert_data_t1()
+BEGIN
+DECLARE num INT;
+SET num = 1;
+WHILE num <= 3955 DO
+INSERT INTO t1 VALUES (num, num / 150, 0, num);
+SET num = num + 1;
+END WHILE;
+END//
+CALL insert_data_t1();
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+EXPLAIN
+SELECT
+CASE 1
+WHEN EXISTS (
+SELECT 1
+FROM t1
+WHERE t1.col1 = 1
+AND t1.col2 = d.col2 - 10
+AND t1.col3 <= 100
+) THEN 2
+END
+FROM t1 d;
+id select_type table partitions type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY d NULL index NULL index_col2 5 NULL 3955 100.00 Using index
+2 DEPENDENT SUBQUERY t1 NULL ALL index_col2,index_col3,index_c123 NULL NULL NULL 3955 0.25 Range checked for each record (index map: 0xE)
+Warnings:
+Note 1276 Field or reference 'test.d.col2' of SELECT #2 was resolved in SELECT #1
+Note 1003 /* select#1 */ select (case 1 when exists(/* select#2 */ select 1 from `test`.`t1` where ((`test`.`t1`.`col1` = 1) and (`test`.`t1`.`col2` = (`test`.`d`.`col2` - 10)) and (`test`.`t1`.`col3` <= 100))) then 2 end) AS `CASE 1
+WHEN EXISTS (
+SELECT 1
+FROM t1
+WHERE t1.col1 = 1
+AND t1.col2 = d.col2 - 10
+AND t1.col3 <= 100
+) THEN 2
+END` from `test`.`t1` `d`
+SELECT
+CASE 1
+WHEN EXISTS (
+SELECT 1
+FROM t1
+WHERE t1.col1 = 1
+AND t1.col2 = d.col2 - 10
+AND t1.col3 <= 100
+) THEN 2
+END
+FROM t1 d;
+DROP TABLE t1;
+DROP PROCEDURE insert_data_t1;
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index 22af9feaa5c8..ffb4a7ca64f5 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -542,3 +542,207 @@ SELECT REVERSE(IFNULL(DENSE_RANK() OVER(),
CONVERT('abc' USING utf32))) AS c;
c
1
+#
+# Bug#39347654: IFNULL function does not handle NULL
+#
+CREATE TABLE Services
+(Id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+Name VARCHAR(150),
+DurationInMinutes INT UNSIGNED,
+BreakInMinutes INT UNSIGNED,
+Unit SMALLINT UNSIGNED,
+Volume DECIMAL(9, 3),
+HasComposition BOOL NOT NULL DEFAULT 0,
+PRIMARY KEY (Id)
+);
+INSERT INTO Services VALUES
+(2,'Name1',0,0,NULL,NULL,0), (15,'Name2',0,0,NULL,NULL,0),
+(19,'Name3',0,0,NULL,NULL,0), (27,'Name4',0,0,NULL,NULL,0),
+(126,'Name5',0,0,NULL,NULL,1), (127,'Name6',0,0,NULL,NULL,1),
+(162,'Name7',NULL,NULL,1,100.000,0);
+CREATE TABLE ServicesComposition
+(ServiceId INT UNSIGNED NOT NULL,
+CompServicePosition SMALLINT UNSIGNED NOT NULL,
+CompServiceId INT UNSIGNED NOT NULL,
+CompServiceCount DECIMAL(9, 3) NOT NULL,
+PRIMARY KEY (ServiceId, CompServiceId),
+INDEX IX_ServicesComposition_CompServiceId (CompServiceId)
+);
+INSERT INTO ServicesComposition VALUES
+(126,1,19,1.000), (126,2,27,1.000), (126,3,162,1.000), (127,1,15,1.000),
+(127,2,126,1.000);
+CREATE TABLE OrderServices
+(Id BINARY(16) NOT NULL,
+OrderId BINARY(16) NOT NULL,
+Position SMALLINT UNSIGNED NOT NULL,
+ServiceId INT UNSIGNED NOT NULL,
+INDEX IX_OrderServices_ServiceId (ServiceId),
+PRIMARY KEY (Id),
+INDEX IX_OrderServices_OrderId (OrderId, Position),
+DurationInMinutesNorm MEDIUMINT UNSIGNED NULL,
+BreakAfterInMinutesNorm MEDIUMINT UNSIGNED NULL,
+DurationInMinutes MEDIUMINT UNSIGNED NULL,
+Unit SMALLINT UNSIGNED,
+Volume DECIMAL(9, 3),
+UnitPriceWithVat DECIMAL(14, 4) NOT NULL
+);
+INSERT INTO OrderServices VALUES
+(0x019E0EAFFA6A79F984E62B28024912D2,0x019E0EB00A8779C1B2BB2382A6AB05F3,1,126,
+0, 0, 40,NULL, NULL, 5.1971),
+(0x019E0EAFFA6A7BEE9BB9998299F0ACB2,0x019E0EB00A8779C1B2BB2382A6AB05F3,0, 2,
+0, 0, 0,NULL, NULL, -5.0112),
+(0x019E0EAFFA6E76AB9A38509D7E797ECF,0x019E0EB00A8779C1B2BB2382A6AB05F3,3,162,
+NULL,NULL,NULL, 4,50.000, 0.9900),
+(0x019E0EAFFA6E7820AC9967347FDDC632,0x019E0EB00A8779C1B2BB2382A6AB05F3,4,162,
+NULL,NULL,NULL, 4,50.000, 5.1781),
+(0x019E0EAFFA6E78F1AADAC571E0001124,0x019E0EB00A8779C1B2BB2382A6AB05F3,2,126,
+0, 0, 35,NULL, NULL, 9.9900);
+CREATE TABLE OrderServiceComposition
+(OrderServiceId BINARY(16) NOT NULL,
+OrderId BINARY(16) NOT NULL,
+Position SMALLINT UNSIGNED NOT NULL,
+INDEX IX_OrderServiceComposition_OrderId (OrderId),
+ServiceId INT UNSIGNED NOT NULL,
+INDEX IX_OrderServiceComposition_ServiceId (ServiceId),
+PRIMARY KEY (OrderServiceId, ServiceId),
+DurationInMinutesNorm MEDIUMINT UNSIGNED,
+BreakAfterInMinutesNorm MEDIUMINT UNSIGNED,
+DurationInMinutes MEDIUMINT UNSIGNED,
+UnitNorm SMALLINT UNSIGNED,
+VolumeNorm DECIMAL(9, 3),
+Unit SMALLINT UNSIGNED NULL,
+Volume DECIMAL(9, 3),
+QuantityNorm DECIMAL(9, 3) NOT NULL,
+Quantity DECIMAL(9, 3) NOT NULL,
+QuantityTotal DECIMAL(9, 3) NOT NULL
+);
+INSERT INTO OrderServiceComposition VALUES
+(0x019E0EAFFA6A79F984E62B28024912D2,0x019E0EB00A8779C1B2BB2382A6AB05F3,0,19,5,
+0,5,NULL,NULL,NULL,NULL,0.000,2.000,0.000),
+(0x019E0EAFFA6A79F984E62B28024912D2,0x019E0EB00A8779C1B2BB2382A6AB05F3,0,162,
+NULL,NULL,NULL,5,50.000,5,50.000,0.000,1.500,0.000),
+(0x019E0EAFFA6E78F1AADAC571E0001124,0x019E0EB00A8779C1B2BB2382A6AB05F3,0,19,5,
+0,5,NULL,NULL,NULL,NULL,0.000,2.000,0.000),
+(0x019E0EAFFA6E78F1AADAC571E0001124,0x019E0EB00A8779C1B2BB2382A6AB05F3,0,27,0,
+0,0,NULL,NULL,NULL,NULL,0.000,1.000,0.000);
+WITH normComposition AS
+(SELECT os.Id AS OrderServiceId, sc.CompServiceId AS ServiceId,
+s.DurationInMinutes AS DurationInMinutesNorm,
+IFNULL(s.BreakInMinutes, IF(s.Unit IS NULL, 0, NULL))
+AS BreakAfterInMinutesNorm,
+s.Unit AS UnitNorm, s.Volume AS VolumeNorm,
+sc.CompServiceCount AS QuantityNorm,
+sc.CompServicePosition, s.Name AS ServiceName, s.HasComposition
+FROM OrderServices os INNER JOIN ServicesComposition sc
+ON os.ServiceId = sc.ServiceId
+INNER JOIN Services s
+ON sc.CompServiceId = s.Id
+WHERE os.OrderId = uuid_to_bin('019e0eb0-0a87-79c1-b2bb-2382a6ab05f3') AND
+os.UnitPriceWithVat >= 0 AND os.ServiceId >= 10
+),
+savedComposition AS
+(SELECT osc.OrderServiceId, osc.ServiceId, osc.DurationInMinutes, osc.Unit,
+osc.Volume, osc.Quantity, osc.QuantityTotal, osc.Position,
+s.DurationInMinutes AS DurationInMinutesNorm,
+IFNULL(s.BreakInMinutes, IF(s.Unit IS NULL, 0, NULL))
+AS BreakAfterInMinutesNorm,
+s.Unit AS UnitNorm, s.Volume AS VolumeNorm, s.Name AS ServiceName,
+s.HasComposition
+FROM OrderServiceComposition osc INNER JOIN Services s
+ON osc.ServiceId = s.Id
+WHERE osc.OrderId = uuid_to_bin('019e0eb0-0a87-79c1-b2bb-2382a6ab05f3')
+),
+fullJoin AS
+(SELECT s.OrderServiceId, s.ServiceId, s.DurationInMinutes, s.Unit, s.Volume,
+s.Quantity, s.QuantityTotal, s.DurationInMinutesNorm,
+s.BreakAfterInMinutesNorm, s.UnitNorm, s.VolumeNorm, n.QuantityNorm,
+s.Position, n.CompServicePosition, s.ServiceName, s.HasComposition
+FROM savedComposition s LEFT JOIN normComposition n
+ON s.OrderServiceId = n.OrderServiceId AND s.ServiceId = n.ServiceId
+UNION ALL
+SELECT n.OrderServiceId, n.ServiceId, s.DurationInMinutes, s.Unit, s.Volume,
+s.Quantity, s.QuantityTotal, n.DurationInMinutesNorm,
+n.BreakAfterInMinutesNorm, n.UnitNorm, n.VolumeNorm, n.QuantityNorm,
+s.Position, n.CompServicePosition, n.ServiceName, n.HasComposition
+FROM savedComposition s RIGHT JOIN normComposition n
+ON s.OrderServiceId = n.OrderServiceId AND s.ServiceId = n.ServiceId
+WHERE s.OrderServiceId IS NULL
+)
+SELECT bin_to_uuid(t.OrderServiceId),
+ROW_NUMBER() OVER
+(PARTITION BY t.OrderServiceId
+ORDER BY IFNULL(t.CompServicePosition, 999999), t.Position) AS Position,
+-- All values below must be equal
+IFNULL(t.Volume, t.VolumeNorm) AS Value_IfNull,
+COALESCE(t.Volume, t.VolumeNorm) AS Value_Coalesce,
+IF(t.Volume IS NULL, t.VolumeNorm, t.Volume) AS Value_If
+FROM fullJoin t
+WHERE t.OrderServiceId = uuid_to_bin('019e0eaf-fa6e-78f1-aada-c571e0001124');
+bin_to_uuid(t.OrderServiceId) Position Value_IfNull Value_Coalesce Value_If
+019e0eaf-fa6e-78f1-aada-c571e0001124 1 NULL NULL NULL
+019e0eaf-fa6e-78f1-aada-c571e0001124 2 NULL NULL NULL
+019e0eaf-fa6e-78f1-aada-c571e0001124 3 100.000 100.000 100.000
+DROP TABLE OrderServiceComposition, OrderServices, ServicesComposition;
+DROP TABLE Services;
+#
+# Bug#39279682: Assertion 'dt->time_type = MYSQL_TIMESTAMP_DATETIME ||
+# dt->time_type = MYSQL_TIMESTAMP_DATETIME_TZ' failed
+#
+CREATE TABLE t (a TIMESTAMP, b DATETIME, c DATE, d TIME);
+INSERT INTO t VALUES
+(CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_DATE, CURRENT_TIME);
+SELECT COUNT(*) FROM t WHERE COALESCE(a, b);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(b, a);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(a, c);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(c, a);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(a, d);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(d, a);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(b, c);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(c, b);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(b, d);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(d, b);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(c, d);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(d, c);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(a, b, c);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(a, b, d);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(a, c, d);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(b, c, d);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(a, b, c, d);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t WHERE COALESCE(d, c, b, a);
+COUNT(*)
+1
+DROP TABLE t;
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index 4d7d5cfdff37..2f635149d255 100644
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@ -398,7 +398,7 @@ create table t1 as select concat(length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) DEFAULT NULL
+ `c1` varbinary(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(char_length('a')));
@@ -408,7 +408,7 @@ create table t1 as select concat(char_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) DEFAULT NULL
+ `c1` varbinary(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(bit_length('a')));
@@ -418,7 +418,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) DEFAULT NULL
+ `c1` varbinary(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(coercibility('a')));
@@ -448,7 +448,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(3) DEFAULT NULL
+ `c1` varbinary(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(ascii(61)));
@@ -458,7 +458,7 @@ create table t1 as select concat(ascii(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(3) DEFAULT NULL
+ `c1` varbinary(4) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(ord(61)));
@@ -478,7 +478,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(3) DEFAULT NULL
+ `c1` varbinary(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select sha2('a',224), hex(sha2('a',224));
@@ -699,7 +699,7 @@ create table t1 as select concat(uncompressed_length('')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) DEFAULT NULL
+ `c1` varbinary(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
create table t1 as select concat(connection_id()) as c1;
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index 88d320aa534f..030d35da97b4 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -792,7 +792,7 @@ create table t1 as select concat(length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(char_length('a')));
@@ -802,7 +802,7 @@ create table t1 as select concat(char_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(bit_length('a')));
@@ -812,7 +812,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(coercibility('a')));
@@ -842,7 +842,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(ascii(61)));
@@ -852,7 +852,7 @@ create table t1 as select concat(ascii(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
+ `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(ord(61)));
@@ -872,7 +872,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select sha2('a',224), hex(sha2('a',224));
@@ -1093,7 +1093,7 @@ create table t1 as select concat(uncompressed_length('')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
create table t1 as select concat(connection_id()) as c1;
diff --git a/mysql-test/r/ctype_latin1_myisam.result b/mysql-test/r/ctype_latin1_myisam.result
index ad6ed7c1f259..f204184697b5 100644
--- a/mysql-test/r/ctype_latin1_myisam.result
+++ b/mysql-test/r/ctype_latin1_myisam.result
@@ -398,7 +398,7 @@ create table t1 as select concat(length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) DEFAULT NULL
+ `c1` varchar(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(char_length('a')));
@@ -408,7 +408,7 @@ create table t1 as select concat(char_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) DEFAULT NULL
+ `c1` varchar(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(bit_length('a')));
@@ -418,7 +418,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) DEFAULT NULL
+ `c1` varchar(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(coercibility('a')));
@@ -448,7 +448,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) DEFAULT NULL
+ `c1` varchar(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(ascii(61)));
@@ -458,7 +458,7 @@ create table t1 as select concat(ascii(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) DEFAULT NULL
+ `c1` varchar(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(ord(61)));
@@ -478,7 +478,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) DEFAULT NULL
+ `c1` varchar(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select sha2('a',224), hex(sha2('a',224));
@@ -699,7 +699,7 @@ create table t1 as select concat(uncompressed_length('')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) DEFAULT NULL
+ `c1` varchar(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
create table t1 as select concat(connection_id()) as c1;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index c83a855f9541..00f0d2f2607b 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -1818,7 +1818,7 @@ create table t1 as select concat(length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(char_length('a')));
@@ -1828,7 +1828,7 @@ create table t1 as select concat(char_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(bit_length('a')));
@@ -1838,7 +1838,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(coercibility('a')));
@@ -1868,7 +1868,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(ascii(61)));
@@ -1878,7 +1878,7 @@ create table t1 as select concat(ascii(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
+ `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(ord(61)));
@@ -1898,7 +1898,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select sha2('a',224), hex(sha2('a',224));
@@ -2119,7 +2119,7 @@ create table t1 as select concat(uncompressed_length('')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
create table t1 as select concat(connection_id()) as c1;
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 28add06302c4..6c95ec09bf18 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -2427,7 +2427,7 @@ Warnings:
Warning 1287 'utf8mb3' is deprecated and will be removed in a future release. Please use utf8mb4 instead
SELECT HEX(INSERT(_utf8mb3 0xD18F, 2, 1, 0x20));
HEX(INSERT(_utf8mb3 0xD18F, 2, 1, 0x20))
-D18F20
+D18F
Warnings:
Warning 1287 'utf8mb3' is deprecated and will be removed in a future release. Please use utf8mb4 instead
SELECT HEX(INSERT(_utf8mb3 0xD18FD18E, 2, 1, 0x20));
@@ -3240,7 +3240,7 @@ create table t1 as select concat(length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET utf8mb3 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(char_length('a')));
@@ -3250,7 +3250,7 @@ create table t1 as select concat(char_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET utf8mb3 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(bit_length('a')));
@@ -3260,7 +3260,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET utf8mb3 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(coercibility('a')));
@@ -3290,7 +3290,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET utf8mb3 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(ascii(61)));
@@ -3300,7 +3300,7 @@ create table t1 as select concat(ascii(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL
+ `c1` varchar(4) CHARACTER SET utf8mb3 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select hex(concat(ord(61)));
@@ -3320,7 +3320,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET utf8mb3 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET utf8mb3 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
select sha2('a',224), hex(sha2('a',224));
@@ -3541,7 +3541,7 @@ create table t1 as select concat(uncompressed_length('')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8mb3 DEFAULT NULL
+ `c1` varchar(11) CHARACTER SET utf8mb3 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
create table t1 as select concat(connection_id()) as c1;
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index d487a5c7118d..1999899ea5aa 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -697,3 +697,12 @@ STR_TO_DATE('0000-00-00','%Y-%m-%d')
NULL
Warnings:
Warning 1411 Incorrect datetime value: '0000-00-00' for function str_to_date
+#
+# Bug#39135197: failing Item_func_str_to_temporal::eval_datetime
+#
+SELECT STR_TO_DATE(IFNULL(PERIOD_ADD('*(+(', 0xa0),
+BIT_OR(OCT(18446744073709551616))), '%i%m%T%V%U');
+ERROR HY000: Incorrect arguments to period_add
+SELECT (ST_SIMPLIFY(PERIOD_DIFF(15898334837425003442, -9223372036854775807),
+10) <> CURRENT_TIMESTAMP);
+ERROR HY000: Incorrect arguments to period_diff
diff --git a/mysql-test/r/derived_condition_pushdown.result b/mysql-test/r/derived_condition_pushdown.result
index 14c7c6b2011f..c9de4763f5e1 100644
--- a/mysql-test/r/derived_condition_pushdown.result
+++ b/mysql-test/r/derived_condition_pushdown.result
@@ -2522,3 +2522,45 @@ DEALLOCATE PREPARE ps_select_latin1_on;
DEALLOCATE PREPARE ps_select_latin1_off;
DROP VIEW v1;
DROP TABLE t1, t2;
+#
+# Bug#38888307: UNION ALL + AND + WHERE IS UNKNOWN
+# query results are incorrect
+#
+CREATE TABLE t1(f1 INTEGER, f2 INTEGER, f3 INTEGER);
+INSERT INTO t1 VALUES (1, NULL, NULL), (2, 0, 0), (3, 1, 1);
+SELECT *
+FROM (SELECT (f1 AND f2) AS col0 FROM t1
+UNION ALL
+SELECT (f1 AND f2) AS col0 FROM t1
+) AS dt
+WHERE (dt.col0) IS NULL;
+col0
+NULL
+NULL
+SELECT *
+FROM (SELECT (f1 AND f2) AS col0 FROM t1
+UNION
+SELECT (f1 AND f2) AS col0 FROM t1
+) AS dt
+WHERE (dt.col0) IS NULL;
+col0
+NULL
+SELECT *
+FROM (SELECT (f1 AND f2) AS col0 FROM t1
+INTERSECT
+SELECT (f1 AND f2) AS col0 FROM t1
+) AS dt
+WHERE (dt.col0) IS NULL;
+col0
+NULL
+CREATE TABLE t2(f1 INTEGER, f2 INTEGER, f3 INTEGER);
+INSERT INTO t2 VALUES (2, 0, 0), (3, 1, 1);
+SELECT *
+FROM (SELECT (f1 AND f2) AS col0 FROM t1
+EXCEPT
+SELECT (f1 AND f2) AS col0 FROM t2
+) AS dt
+WHERE (dt.col0) IS NULL;
+col0
+NULL
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/derived_condition_pushdown_hypergraph.result b/mysql-test/r/derived_condition_pushdown_hypergraph.result
index 5059019c0ebe..9ffe84fb7047 100644
--- a/mysql-test/r/derived_condition_pushdown_hypergraph.result
+++ b/mysql-test/r/derived_condition_pushdown_hypergraph.result
@@ -1212,9 +1212,10 @@ EXPLAIN FORMAT=tree SELECT *
FROM (SELECT f1, (@rownum_r := @rownum_r + 1) AS r FROM t1) AS dt
WHERE dt.f1 = 300;
EXPLAIN
--> Index lookup on dt using (f1 = 300) (rows=0.5)
- -> Materialize (rows=5)
- -> Table scan on t1 (rows=5)
+-> Filter: (dt.f1 = 300) (rows=0.5)
+ -> Table scan on dt (rows=5)
+ -> Materialize (rows=5)
+ -> Table scan on t1 (rows=5)
Warnings:
Warning 1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
@@ -2486,4 +2487,46 @@ DEALLOCATE PREPARE ps_select_latin1_on;
DEALLOCATE PREPARE ps_select_latin1_off;
DROP VIEW v1;
DROP TABLE t1, t2;
+#
+# Bug#38888307: UNION ALL + AND + WHERE IS UNKNOWN
+# query results are incorrect
+#
+CREATE TABLE t1(f1 INTEGER, f2 INTEGER, f3 INTEGER);
+INSERT INTO t1 VALUES (1, NULL, NULL), (2, 0, 0), (3, 1, 1);
+SELECT *
+FROM (SELECT (f1 AND f2) AS col0 FROM t1
+UNION ALL
+SELECT (f1 AND f2) AS col0 FROM t1
+) AS dt
+WHERE (dt.col0) IS NULL;
+col0
+NULL
+NULL
+SELECT *
+FROM (SELECT (f1 AND f2) AS col0 FROM t1
+UNION
+SELECT (f1 AND f2) AS col0 FROM t1
+) AS dt
+WHERE (dt.col0) IS NULL;
+col0
+NULL
+SELECT *
+FROM (SELECT (f1 AND f2) AS col0 FROM t1
+INTERSECT
+SELECT (f1 AND f2) AS col0 FROM t1
+) AS dt
+WHERE (dt.col0) IS NULL;
+col0
+NULL
+CREATE TABLE t2(f1 INTEGER, f2 INTEGER, f3 INTEGER);
+INSERT INTO t2 VALUES (2, 0, 0), (3, 1, 1);
+SELECT *
+FROM (SELECT (f1 AND f2) AS col0 FROM t1
+EXCEPT
+SELECT (f1 AND f2) AS col0 FROM t2
+) AS dt
+WHERE (dt.col0) IS NULL;
+col0
+NULL
+DROP TABLE t1, t2;
SET explain_format = DEFAULT;
diff --git a/mysql-test/r/desc_index_innodb.result b/mysql-test/r/desc_index_innodb.result
index 3c1f5b203a1b..bbd07d3b9051 100644
--- a/mysql-test/r/desc_index_innodb.result
+++ b/mysql-test/r/desc_index_innodb.result
@@ -1636,13 +1636,13 @@ ALTER TABLE t1 ADD INDEX key2 (col_int_key);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
-EXPLAIN SELECT * FROM t1 FORCE INDEX (key1,col_int_key) WHERE pk IN (6,2)
+EXPLAIN SELECT * FROM t1 FORCE INDEX (key1,key2) WHERE pk IN (6,2)
OR (col_int_key >= 7 AND col_int_key < 13);
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 NULL index_merge col_int_key,key1 key1,col_int_key 4,5 NULL 2 100.00 Using sort_union(key1,col_int_key); Using where
+1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 4,5 NULL 3 100.00 Using sort_union(key1,key2); Using where
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`col_int_key` AS `col_int_key` from `test`.`t1` FORCE INDEX (`col_int_key`) FORCE INDEX (`key1`) where ((`test`.`t1`.`pk` in (6,2)) or ((`test`.`t1`.`col_int_key` >= 7) and (`test`.`t1`.`col_int_key` < 13)))
-SELECT * FROM t1 FORCE INDEX (key1,col_int_key) WHERE pk IN (6,2)
+Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`col_int_key` AS `col_int_key` from `test`.`t1` FORCE INDEX (`key2`) FORCE INDEX (`key1`) where ((`test`.`t1`.`pk` in (6,2)) or ((`test`.`t1`.`col_int_key` >= 7) and (`test`.`t1`.`col_int_key` < 13)))
+SELECT * FROM t1 FORCE INDEX (key1,key2) WHERE pk IN (6,2)
OR (col_int_key >= 7 AND col_int_key < 13);
pk col_int_key
2 1
diff --git a/mysql-test/r/func_digest.result b/mysql-test/r/func_digest.result
index e580a8a983f5..9e23b7e40ce6 100644
--- a/mysql-test/r/func_digest.result
+++ b/mysql-test/r/func_digest.result
@@ -1832,3 +1832,25 @@ SHOW variables LIKE 'character_set_client';
Variable_name Value
character_set_client latin1
SET NAMES DEFAULT;
+#
+# Bug#33073320: DIGEST USER FUNCTIONS POLLUTE CURRENT THD
+#
+SELECT statement_digest_text(
+"UPDATE `t0009` SET `c0002` = json_merge_patch("
+"conv(8955667655109960103, "
+" COUNT(aes_encrypt(0x14dc2daf, from_unixtime(1536999166))) "
+" OVER(), "
+" st_hausdorffdistance("
+" LINESTRING(POINT(17, 125), POINT(253,35)), "
+" asin(`c0002`))), "
+"CHARSET(1), ROW_COUNT()) "
+"WHERE `c0003` XOR from_unixtime(1536999166) LIMIT 10");
+statement_digest_text(
+"UPDATE `t0009` SET `c0002` = json_merge_patch("
+"conv(8955667655109960103, "
+" COUNT(aes_encrypt(0x14dc2daf, from_unixtime(1536999166))) "
+" OVER(), "
+" st_hausdorffdistance("
+" LINESTRING(POINT(17, 125), POINT(253,35)), "
+"
+UPDATE `t0009` SET `c0002` = `json_merge_patch` ( `conv` ( ? , COUNT ( `aes_encrypt` ( ? , `from_unixtime` (?) ) ) OVER ( ) , `st_hausdorffdistance` ( LINESTRING ( POINT (...) , POINT (...) ) , `asin` ( `c0002` ) ) ) , CHARSET (?) , ROW_COUNT ( ) ) WHERE `c0003` XOR `from_unixtime` (?) LIMIT ?
diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result
index 0bf092478b1b..71e47963f7b5 100644
--- a/mysql-test/r/func_if.result
+++ b/mysql-test/r/func_if.result
@@ -347,12 +347,12 @@ Warning 1292 Incorrect datetime value: '42'
# scale <= precision' failed
SELECT AVG(NULLIF(YEAR('2001-01-01'),10));
AVG(NULLIF(YEAR('2001-01-01'),10))
-2001
+2001.0000
CREATE TABLE t1(y YEAR);
INSERT INTO t1 VALUES(2001);
SELECT AVG(NULLIF(y, 10)) FROM t1;
AVG(NULLIF(y, 10))
-2001
+2001.0000
DROP TABLE t1;
#
# Bug#36151537: Assertion `m_typelib != nullptr' failed
@@ -367,3 +367,39 @@ COALESCE(CASE WHEN x THEN NULL ELSE NULL END, x)
SELECT COALESCE(COALESCE(NULL, NULL), x) FROM t EXCEPT SELECT 1;
COALESCE(COALESCE(NULL, NULL), x)
DROP TABLE t;
+#
+# Bug#37875484: cast((NULLIF) as datetime) returns incorrect result
+#
+SELECT CAST(NULLIF('1996-11-21 19:40:27', '') AS DATE) AS d;
+d
+1996-11-21
+SELECT CAST(NULLIF('1996-11-21 19:40:27', '') AS DATETIME) AS dt;
+dt
+1996-11-21 19:40:27
+SELECT CAST(NULLIF('1996-11-21 19:40:27.123456', '') AS DATETIME(6)) AS dt;
+dt
+1996-11-21 19:40:27.123456
+SELECT CAST(NULLIF(19961121194027, 0) AS DATETIME) AS dt;
+dt
+1996-11-21 19:40:27
+SELECT CAST(NULLIF(19961121194027.123456, 0) AS DATETIME(6)) AS dt;
+dt
+1996-11-21 19:40:27.123456
+SELECT CAST(NULLIF('19:40:27', '') AS TIME) AS t;
+t
+19:40:27
+SELECT CAST(NULLIF('19:40:27.123456', '') AS TIME(6)) AS t;
+t
+19:40:27.123456
+SELECT CAST(NULLIF(194027, 0) AS TIME) AS t;
+t
+19:40:27
+SELECT CAST(NULLIF(194027.123456, 0) AS TIME(6)) AS t;
+t
+19:40:27.123456
+SELECT CAST(NULLIF('1996-11-21', '1996-11-21') AS DATE) AS d;
+d
+NULL
+SELECT CAST(NULLIF(19961121, 0) AS DATE) AS d;
+d
+1996-11-21
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 42a928e87bf4..5f5d1e5fcc42 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -2109,3 +2109,17 @@ SELECT * FROM v;
c
-1
DROP VIEW v;
+#
+# Bug#39641087: POW(x, NULL) returns 1 instead of NULL (NULL exponent)
+#
+SELECT POW(2, NULL);
+POW(2, NULL)
+NULL
+SELECT POW(2, NULL) IS NULL;
+POW(2, NULL) IS NULL
+1
+SELECT 1 WHERE POW(2, NULL);
+1
+SELECT COALESCE(POW(2, NULL), -99);
+COALESCE(POW(2, NULL), -99)
+-99
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index 70db9f2bb45e..d8815537d8ef 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -315,3 +315,8 @@ invalid column 0 bravo,delta,foxtrot
invalid column 0 foxtrot
invalid column 0 alpha
DROP TABLE t1;
+#
+# Bug#39136916: INTERVAL() is failing in decimal_cmp
+#
+SELECT INTERVAL(BIT_OR(UTC_TIMESTAMP), ORD(PERIOD_ADD(-12795,-17171)));
+ERROR HY000: Incorrect arguments to period_add
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index f5a5f23b57d7..943955814d75 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -795,6 +795,15 @@ latin2_general_ci 4
select collation(replace(_latin2'abcd',_latin2'b',_latin2'B')), coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'));
collation(replace(_latin2'abcd',_latin2'b',_latin2'B')) coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'))
latin2_general_ci 4
+select collation(greatest(date'2010-01-01', date'2011-01-01'));
+collation(greatest(date'2010-01-01', date'2011-01-01'))
+binary
+select collation(least(date'2010-01-01', date'2011-01-01'));
+collation(least(date'2010-01-01', date'2011-01-01'))
+binary
+select collation(coalesce(null, date'2010-01-01', date'2011-01-01'));
+collation(coalesce(null, date'2010-01-01', date'2011-01-01'))
+binary
create table t1 charset latin1
select
bin(130),
@@ -6093,7 +6102,7 @@ ST_ASBINARY(- ROW_COUNT(), 'axis-order=srid-defined')
);
ERROR 22S01: WKB value is a geometry of unexpected type POINT in st_geomcollfromwkb.
#
-# Bug39056621: Function find_in_set returns wrong result
+# Bug#39056621: Function find_in_set returns wrong result
#
SET collation_connection = 'utf8mb4_0900_ai_ci';
SELECT FIND_IN_SET('ắ', 'a');
@@ -6103,3 +6112,161 @@ SELECT FIND_IN_SET('ắ', 'a,b,c');
FIND_IN_SET('ắ', 'a,b,c')
1
SET collation_connection = default;
+#
+# Bug#36289412: Fix offset check for insert position overflow
+#
+SET names utf8mb4;
+SELECT INSERT('A', 2, 1, 'a');
+INSERT('A', 2, 1, 'a')
+A
+SELECT INSERT('Å', 2, 1, 'a');
+INSERT('Å', 2, 1, 'a')
+Å
+SET names DEFAULT;
+#
+# Bug#39392429: AVG(ASCII()) result truncated to 99.9999 with
+# SQL_BUFFER_RESULT due to incorrect decimal precision
+#
+CREATE TABLE users (
+id INT PRIMARY KEY,
+username VARCHAR(50) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO users (id, username) VALUES
+(1, 'alice'), (2, 'bob'), (3, 'charlie'), (4, 'diana'),
+(5, 'edward'), (6, 'fiona'), (7, 'george'), (8, 'hannah'),
+(9, 'ivan'), (10, 'julia'), (11, 'kevin'), (12, 'lisa'),
+(13, 'mike'), (14, 'nancy'), (15, 'oscar');
+SELECT SQL_BUFFER_RESULT id, AVG(ASCII(username)) AS avg_val
+FROM users
+GROUP BY id;
+id avg_val
+1 97.0000
+2 98.0000
+3 99.0000
+4 100.0000
+5 101.0000
+6 102.0000
+7 103.0000
+8 104.0000
+9 105.0000
+10 106.0000
+11 107.0000
+12 108.0000
+13 109.0000
+14 110.0000
+15 111.0000
+SELECT SQL_BUFFER_RESULT id, AVG(LENGTH(username)) AS avg_val
+FROM users
+GROUP BY id;
+id avg_val
+1 5.0000
+2 3.0000
+3 7.0000
+4 5.0000
+5 6.0000
+6 5.0000
+7 6.0000
+8 6.0000
+9 4.0000
+10 5.0000
+11 5.0000
+12 4.0000
+13 4.0000
+14 5.0000
+15 5.0000
+SELECT SQL_BUFFER_RESULT id, AVG(CHAR_LENGTH(username)) AS avg_val
+FROM users
+GROUP BY id;
+id avg_val
+1 5.0000
+2 3.0000
+3 7.0000
+4 5.0000
+5 6.0000
+6 5.0000
+7 6.0000
+8 6.0000
+9 4.0000
+10 5.0000
+11 5.0000
+12 4.0000
+13 4.0000
+14 5.0000
+15 5.0000
+SELECT SQL_BUFFER_RESULT id, AVG(BIT_LENGTH(username)) AS avg_val
+FROM users
+GROUP BY id;
+id avg_val
+1 40.0000
+2 24.0000
+3 56.0000
+4 40.0000
+5 48.0000
+6 40.0000
+7 48.0000
+8 48.0000
+9 32.0000
+10 40.0000
+11 40.0000
+12 32.0000
+13 32.0000
+14 40.0000
+15 40.0000
+SELECT SQL_BUFFER_RESULT id, AVG(INSTR(username, 'i')) AS avg_val
+FROM users
+GROUP BY id;
+id avg_val
+1 3.0000
+2 0.0000
+3 6.0000
+4 2.0000
+5 0.0000
+6 2.0000
+7 0.0000
+8 0.0000
+9 1.0000
+10 4.0000
+11 4.0000
+12 2.0000
+13 2.0000
+14 0.0000
+15 0.0000
+SELECT SQL_BUFFER_RESULT id, AVG(FIELD(username, 'alice', 'ivan')) AS avg_val
+FROM users
+GROUP BY id;
+id avg_val
+1 1.0000
+2 0.0000
+3 0.0000
+4 0.0000
+5 0.0000
+6 0.0000
+7 0.0000
+8 0.0000
+9 2.0000
+10 0.0000
+11 0.0000
+12 0.0000
+13 0.0000
+14 0.0000
+15 0.0000
+SELECT SQL_BUFFER_RESULT id, AVG(FIND_IN_SET(username, 'alice,ivan')) AS avg_val
+FROM users
+GROUP BY id;
+id avg_val
+1 1.0000
+2 0.0000
+3 0.0000
+4 0.0000
+5 0.0000
+6 0.0000
+7 0.0000
+8 0.0000
+9 2.0000
+10 0.0000
+11 0.0000
+12 0.0000
+13 0.0000
+14 0.0000
+15 0.0000
+DROP TABLE users;
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index 6ee7834167e9..efcfbd6eb2ed 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -1022,3 +1022,20 @@ FROM_UNIXTIME(GREATEST(d, t, y))
1970-08-23 12:01:41.000000
SET TIMESTAMP = DEFAULT;
DROP TABLE t1;
+#
+# Bug#36065440: Unexpected result for LEAST function
+#
+CREATE TABLE t0(c0 LONGTEXT);
+INSERT INTO t0(c0) VALUES(0.1);
+CREATE TABLE t1(c0 INT ZEROFILL PRIMARY KEY);
+Warnings:
+Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column.
+INSERT IGNORE INTO t1(c0) VALUES(NULL);
+Warnings:
+Warning 1048 Column 'c0' cannot be null
+SELECT NOT (LEAST(t0.c0, t1.c0) OR t1.c0) AS c FROM t1, t0;
+c
+0
+SELECT * FROM t1, t0 WHERE NOT (LEAST(t0.c0, t1.c0) OR t1.c0);
+c0 c0
+DROP TABLE t0, t1;
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 7cfa5a38e2d8..90d4d24a95b0 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -2276,3 +2276,45 @@ ceil
SELECT SEC_TO_TIME(-00.0000004584) AS tv;
tv
00:00:00.000000
+#
+# Bug#34499767: TIMESTAMPDIFF function does not work as expected on where
+#
+CREATE TABLE t
+(id int NOT NULL,
+dt datetime,
+PRIMARY KEY (id)
+);
+INSERT INTO t(id, dt) VALUES (1, '2022-08-03 10:37:33');
+SELECT TIMESTAMPDIFF(DAY, dt, '2022-08-16 04:30:58') AS day_diff,
+TIMESTAMPDIFF(MINUTE, dt, '2022-08-16 04:30:58') AS min_diff
+FROM t
+WHERE id = 1 AND
+TIMESTAMPDIFF(DAY, dt, '2022-08-16 04:30:58') = 12 AND
+TIMESTAMPDIFF(MINUTE, dt,'2022-08-16 04:30:58') = 18353;
+day_diff min_diff
+12 18353
+DROP TABLE t;
+#
+# Bug#39649755: IN (DATE/TIME constant list) wrongly TRUE for
+# non-temporal string
+#
+SELECT 'abc' IN (DATE'2024-02-29', DATE'2026-06-25') AS d,
+'abc' IN (TIME'01:00:00', TIME'02:00:00') AS t,
+'abc' IN (TIMESTAMP'2024-02-29 01:00:00',
+TIMESTAMP'2026-06-25 02:00:00') AS dt;
+d t dt
+0 0 0
+Warnings:
+Warning 1292 Truncated incorrect date value: 'abc'
+Warning 1292 Truncated incorrect time value: 'abc'
+Warning 1292 Incorrect datetime value: 'abc' for column 'abc' at row 1
+CREATE TABLE s (id INT, v VARCHAR(20));
+INSERT INTO s VALUES (1,'abc'), (2,'2024-02-29'), (3,'xyz'),(4,'2026-06-25');
+SELECT id, v FROM s WHERE v IN (DATE'2024-02-29', DATE'2026-06-25');
+id v
+2 2024-02-29
+4 2026-06-25
+Warnings:
+Warning 1292 Truncated incorrect date value: 'abc'
+Warning 1292 Truncated incorrect date value: 'xyz'
+DROP TABLE s;
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 3c4d5f586c49..32ecde5efd8a 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -4753,4 +4753,10 @@ UPDATE t1 SET geom = DEFAULT;
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
SET sql_mode= @orig_sql_mode;
DROP TABLE t1;
+#
+# Bug#39300278: Item_func_latlongfromgeohash::val_real():
+# Assertion 'input_value != nullptr || args[0]->null_value' failed
+#
+DO ST_LONGFROMGEOHASH((@c:= ST_ASGEOJSON(POINT(28, 63), 51, 156)));
+ERROR HY000: Incorrect options value: '156' for function st_asgeojson
include/rpl/set_gtid_mode_on.inc
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index be43f6d5966c..e401cfab91da 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -5107,3 +5107,15 @@ DROP TABLE t;
SELECT 1
GROUP BY GROUPING SETS((ST_LONGFROMGEOHASH(ST_GEOHASH(POINT(79, 146), 107))));
ERROR 22003: latitude value is out of range in 'st_geohash'
+#
+# Bug#39269995: Failure with update_item_cache_if_changed()
+#
+SELECT INET_NTOA(0xebc0345def74e1f6715ab1f55f1a4a3e99f9)
+GROUP BY (@c :=JSON_REMOVE(CONCAT_WS('', '$.', 'ab'), 'BB*(e&'));
+ERROR 22032: Invalid JSON text in argument 1 to function json_remove: "Invalid value." at position 0.
+CREATE TABLE t (a INTEGER);
+SELECT (SELECT PI() FROM t)
+GROUP BY (@b:= MULTIPOINT(POINT(25698,-4724), POINT(1215,-15494))),
+ST_POINTFROMGEOHASH(ST_GEOHASH(POINT(1,2), 129), 0);
+ERROR 22003: max geohash length value is out of range in 'st_geohash'
+DROP TABLE t;
diff --git a/mysql-test/r/group_by_hypergraph.result b/mysql-test/r/group_by_hypergraph.result
index 21cfdd74a1c7..3cb708d3096c 100644
--- a/mysql-test/r/group_by_hypergraph.result
+++ b/mysql-test/r/group_by_hypergraph.result
@@ -849,4 +849,16 @@ col1
Warnings:
Warning 1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
drop table t1;
+#
+# Bug#39505077: Assertion `receiver.HasSecondaryEngineCostHook()' failed
+#
+CREATE TABLE t(a INT PRIMARY KEY);
+INSERT INTO t VALUES (1);
+SELECT 1 AS x
+FROM t USE INDEX FOR GROUP BY()
+GROUP BY ROLLUP(1);
+x
+1
+NULL
+DROP TABLE t;
drop table tb1;
diff --git a/mysql-test/r/group_skip_scan.result b/mysql-test/r/group_skip_scan.result
index 970d15e75c51..40c82cb43b8e 100644
--- a/mysql-test/r/group_skip_scan.result
+++ b/mysql-test/r/group_skip_scan.result
@@ -4324,10 +4324,8 @@ INSERT INTO t1 VALUES (NULL, 1);
INSERT INTO t1 VALUES (NULL, 2);
EXPLAIN FORMAT=TREE SELECT MIN(f2) FROM t1 WHERE f1 IS NULL GROUP BY f1;
EXPLAIN
--> Table scan on (rows=1)
- -> Temporary table with deduplication (rows=1)
- -> Filter: (t1.f1 is null) (rows=1)
- -> Covering index skip scan for grouping on t1 using f1 over (f1 = NULL) (rows=1)
+-> Filter: (t1.f1 is null) (rows=1)
+ -> Covering index skip scan for grouping on t1 using f1 over (f1 = NULL) (rows=1)
SELECT MIN(f2) FROM t1 WHERE f1 IS NULL GROUP BY f1;
MIN(f2)
diff --git a/mysql-test/r/group_skip_scan_hypergraph.result b/mysql-test/r/group_skip_scan_hypergraph.result
index 0601f315a572..3478e478cc0a 100644
--- a/mysql-test/r/group_skip_scan_hypergraph.result
+++ b/mysql-test/r/group_skip_scan_hypergraph.result
@@ -3636,8 +3636,7 @@ EXPLAIN FORMAT=TREE SELECT a, MAX(b) FROM t1 WHERE a = 1 AND b between 0 and 199
GROUP BY a;
EXPLAIN
-> Group aggregate: max(t1.b) (rows=1)
- -> Filter: (t1.b between 0 and 1999.5) (rows=2)
- -> Covering index range scan on t1 using a over (a = 1 AND 0 <= b < 2000) (rows=2)
+ -> Covering index range scan on t1 using a over (a = 1 AND 0 <= b < 2000) (rows=2)
SELECT a, MAX(b) FROM t1 WHERE a = 1 AND b between 0 and 1999.5
GROUP BY a;
diff --git a/mysql-test/r/hash_join_hypergraph.result b/mysql-test/r/hash_join_hypergraph.result
index a716c6df0d41..c7a60888cae7 100644
--- a/mysql-test/r/hash_join_hypergraph.result
+++ b/mysql-test/r/hash_join_hypergraph.result
@@ -1926,7 +1926,7 @@ SELECT * FROM t1, t2 WHERE t1.col1 = t2.col1 LIMIT 1;
SELECT COUNT_STAR > 0 FROM performance_schema.file_summary_by_event_name
WHERE event_name LIKE '%hash_join%';
COUNT_STAR > 0
-1
+0
# This should spill to disk since we have sorting.
TRUNCATE performance_schema.file_summary_by_event_name;
SELECT * FROM t1, t2 WHERE t1.col1 = t2.col1 ORDER BY t1.col1 LIMIT 1;
@@ -4897,3 +4897,105 @@ SET SESSION OPTIMIZER_TRACE="enabled=off";
DROP TABLE t1;
UNINSTALL PLUGIN mock;
SET @@session.secondary_engine_cost_threshold = @old_threshold;
+#
+# Bug#36684053: Hash join spills to disk unnecessarily with LIMIT
+#
+CREATE TABLE t1 (col1 INT, pad CHAR(50) DEFAULT 'x');
+INSERT INTO t1 (col1) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t2 SELECT * FROM t1;
+ANALYZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+test.t2 analyze status OK
+SET join_buffer_size = 128;
+SET SESSION OPTIMIZER_TRACE='enabled=on';
+# LIMIT without ORDER BY: early termination is possible, so the
+# optimizer considers both spill and no-spill hash join plans.
+SELECT * FROM t1, t2 WHERE t1.col1 = t2.col1 LIMIT 3;
+SELECT trace LIKE '%allow_spill_to_disk=false%' AS no_spill_proposed
+FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+no_spill_proposed
+1
+# No LIMIT: all rows must be produced, so only the spill plan is
+# considered (no-spill would scan the probe side multiple times).
+SELECT * FROM t1, t2 WHERE t1.col1 = t2.col1;
+SELECT trace LIKE '%allow_spill_to_disk=false%' AS no_spill_proposed
+FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+no_spill_proposed
+0
+# STRAIGHT_JOIN with LIMIT: executes as JoinType::INNER, so the
+# no-spill plan is also proposed.
+SELECT * FROM t1 STRAIGHT_JOIN t2 ON t1.col1 = t2.col1 LIMIT 3;
+SELECT trace LIKE '%allow_spill_to_disk=false%' AS no_spill_proposed
+FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+no_spill_proposed
+1
+# LEFT JOIN with LIMIT: IN_MEMORY_WITH_HASH_TABLE_REFILL writes a
+# probe-row-saving file for non-INNER joins, which the no-spill cost
+# model does not account for, so the no-spill plan is not proposed.
+SELECT * FROM t1 LEFT JOIN t2 ON t1.col1 = t2.col1 LIMIT 3;
+SELECT trace LIKE '%allow_spill_to_disk=false%' AS no_spill_proposed
+FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+no_spill_proposed
+0
+# UNION DISTINCT with outer LIMIT: each branch must produce its full
+# result before deduplication, so the outer LIMIT does not enable
+# early termination of the join and the no-spill plan is not proposed.
+(SELECT t1.col1 FROM t1 JOIN t2 ON t1.col1 = t2.col1)
+UNION DISTINCT
+(SELECT col1 FROM t2) LIMIT 3;
+SELECT trace LIKE '%allow_spill_to_disk=false%' AS no_spill_proposed
+FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+no_spill_proposed
+0
+SET SESSION OPTIMIZER_TRACE='enabled=off';
+SET join_buffer_size = DEFAULT;
+DROP TABLE t1, t2;
+CREATE TABLE t3 (col1 INT, pad CHAR(200) DEFAULT 'x');
+INSERT INTO t3 (col1)
+WITH RECURSIVE seq(n) AS (SELECT 1 UNION ALL SELECT n+1 FROM seq WHERE n<1000)
+SELECT n FROM seq;
+CREATE TABLE t4 SELECT * FROM t3;
+ANALYZE TABLE t3, t4;
+Table Op Msg_type Msg_text
+test.t3 analyze status OK
+test.t4 analyze status OK
+SET join_buffer_size = 1024;
+# The chosen no-spill plan is annotated in EXPLAIN output.
+EXPLAIN FORMAT=TREE SELECT * FROM t3, t4 WHERE t3.col1 = t4.col1 LIMIT 3;
+EXPLAIN
+-> Limit: 3 row(s) (rows=3)
+ -> Inner hash join (t3.col1 = t4.col1) (no spill to disk) (rows=100000)
+ -> Table scan on t3 (rows=1000)
+ -> Hash
+ -> Table scan on t4 (rows=1000)
+
+# Same overflow, but LIMIT close to the full result size: the no-spill
+# plan would re-scan the probe side many times to produce that many rows,
+# so the spill plan is chosen (no annotation in EXPLAIN).
+EXPLAIN FORMAT=TREE SELECT * FROM t3, t4 WHERE t3.col1 = t4.col1 LIMIT 900;
+EXPLAIN
+-> Limit: 900 row(s) (rows=900)
+ -> Inner hash join (t3.col1 = t4.col1) (rows=100000)
+ -> Table scan on t3 (rows=1000)
+ -> Hash
+ -> Table scan on t4 (rows=1000)
+
+# Moderate overflow (k of a few): a small LIMIT still favors no-spill.
+SET join_buffer_size = 65536;
+EXPLAIN FORMAT=TREE SELECT * FROM t3, t4 WHERE t3.col1 = t4.col1 LIMIT 3;
+EXPLAIN
+-> Limit: 3 row(s) (rows=3)
+ -> Inner hash join (t3.col1 = t4.col1) (no spill to disk) (rows=100000)
+ -> Table scan on t3 (rows=1000)
+ -> Hash
+ -> Table scan on t4 (rows=1000)
+
+SET join_buffer_size = 1024;
+FLUSH STATUS;
+SELECT * FROM t3, t4 WHERE t3.col1 = t4.col1 LIMIT 3;
+FLUSH STATUS;
+SELECT * FROM t3, t4 WHERE t3.col1 = t4.col1;
+include/assert.inc [LIMIT query reads less than half the rows of the full spilling join]
+SET join_buffer_size = DEFAULT;
+DROP TABLE t3, t4;
diff --git a/mysql-test/r/histograms_debug.result b/mysql-test/r/histograms_debug.result
index 7d2342332db5..ffaa9b5c3806 100644
--- a/mysql-test/r/histograms_debug.result
+++ b/mysql-test/r/histograms_debug.result
@@ -899,3 +899,14 @@ SELECT * FROM t1 AS a JOIN t1 AS b ON a.x = REVERSE(1);
x x
1 1
DROP TABLE t1;
+#
+# Bug#38940484 MDLs released incorrectly when reading histograms
+#
+CREATE TABLE t1 (i INT);
+ANALYZE TABLE t1 UPDATE HISTOGRAM ON i;
+Table Op Msg_type Msg_text
+test.t1 histogram status Histogram statistics created for column 'i'.
+FLUSH TABLES;
+SELECT * FROM t1;
+i
+DROP TABLE t1;
diff --git a/mysql-test/r/hypergraph_bugs.result b/mysql-test/r/hypergraph_bugs.result
index 97313c903244..ad0e151d0bbc 100644
--- a/mysql-test/r/hypergraph_bugs.result
+++ b/mysql-test/r/hypergraph_bugs.result
@@ -1612,28 +1612,8 @@ Table Op Msg_type Msg_text
test.t1 analyze status OK
EXPLAIN FORMAT=TREE SELECT * FROM t1 x1, t1 x2, t1 x3
WHERE x1.b=x2.a AND x2.b=x3.a AND (x1.c < 5 OR x3.c=7) LIMIT 1;
-EXPLAIN
--> Limit: 1 row(s) (rows=1)
- -> Nested loop inner join (rows=20)
- -> Nested loop inner join (rows=20)
- -> Index scan on x1 using PRIMARY (rows=20)
- -> Single-row index lookup on x2 using PRIMARY (a = x1.b) (rows=1)
- -> Filter: ((x1.c < 5) or (x3.c = 7)) (rows=1)
- -> Single-row index lookup on x3 using PRIMARY (a = x2.b) (rows=1)
-
EXPLAIN FORMAT=TREE SELECT * FROM t1 x1, t1 x2, t1 x3
WHERE x1.b=x2.d AND x2.b=x3.d AND (x1.c < 5 OR x3.c=7) ORDER BY x3.d LIMIT 1;
-EXPLAIN
--> Limit: 1 row(s) (rows=1)
- -> Filter: ((x1.c < 5) or (x3.c = 7)) (rows=80)
- -> Nested loop inner join (rows=80)
- -> Sort: x2.b (rows=40)
- -> Inner hash join (x1.b = x2.d) (rows=40)
- -> Index scan on x1 using PRIMARY (rows=20)
- -> Hash
- -> Index scan on x2 using PRIMARY (rows=20)
- -> Index lookup on x3 using k1 (d = x2.b) (rows=2)
-
EXPLAIN FORMAT=TREE SELECT * FROM t1 x1 LEFT JOIN t1 x2
ON x1.a <=> x2.a AND x1.a <=> x2.a;
EXPLAIN
@@ -1770,6 +1750,19 @@ EXPLAIN
-> Filter: (t1.x > 0) (rows=0.667)
-> Table scan on t1 (rows=2)
+DROP TABLE t1;
+#
+# Bug#39501528: Crash evaluating a ROLLUP aggregate from a constant
+# HAVING subquery during filter initialization
+#
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2), (3), (4);
+SELECT HEX(-31378)
+GROUP BY ROLLUP((SELECT /*+ BKA() */ 1))
+HAVING (SELECT 338 FROM t1 WHERE AVG(26) LIMIT 1);
+HEX(-31378)
+FFFFFFFFFFFF856E
+FFFFFFFFFFFF856E
DROP TABLE t1;
#
# Bug#36099491: Assertion secondary_engine_cost_hook != nullptr
@@ -2915,7 +2908,7 @@ DROP TABLE t1, t2;
#
CREATE TABLE A(col_int INT);
INSERT INTO A VALUES (1), (2), (3), (4), (5);
-SELECT /*+ SET_VAR(optimizer_switch='hypergraph_optimizer=on') */
+SELECT
PERCENT_RANK() OVER ( ORDER BY SEC_TO_TIME(3600) RANGE INTERVAL 7 QUARTER PRECEDING )
FROM A;
PERCENT_RANK() OVER ( ORDER BY SEC_TO_TIME(3600) RANGE INTERVAL 7 QUARTER PRECEDING )
@@ -3214,3 +3207,378 @@ NOT EXISTS (SELECT t2.f1
FROM t1 AS t3 )));
1
DROP TABLE t1;
+#
+# Bug#36448705 Wrong results for ref access with decimal-to-int truncation
+#
+# Decimal value gets truncated to integer 0 during index key construction,
+# and the optimizer incorrectly removes the post-filter predicate.
+#
+CREATE TABLE t0 (
+c2 SMALLINT UNSIGNED NOT NULL,
+UNIQUE KEY i0 (c2)
+);
+INSERT INTO t0 VALUES (0),(1);
+# With UNIQUE KEY - should return empty set
+SELECT t0.c2 FROM t0 WHERE t0.c2 = IFNULL(0.335691025520639, 0.6008055594894641);
+c2
+# Verify with explicit decimal comparison
+SELECT t0.c2 FROM t0 WHERE t0.c2 = 0.335691025520639;
+c2
+# Verify correct result with table scan (no index hint)
+SELECT t0.c2 FROM t0 IGNORE INDEX (i0) WHERE t0.c2 = IFNULL(0.335691025520639, 0.6008055594894641);
+c2
+# Non-unique key variant
+ALTER TABLE t0 DROP KEY i0, ADD KEY i0 (c2);
+SET SESSION optimizer_switch="hypergraph_optimizer=off";
+SELECT t0.c2 FROM t0 WHERE t0.c2 = IFNULL(0.335691025520639, 0.6008055594894641);
+c2
+SET SESSION optimizer_switch="hypergraph_optimizer=on";
+SELECT t0.c2 FROM t0 WHERE t0.c2 = IFNULL(0.335691025520639, 0.6008055594894641);
+c2
+DROP TABLE t0;
+#
+# Bug#36957877 Building rarely used index on derived table is inefficient
+#
+CREATE TABLE t0 (a INT PRIMARY KEY, b INT, c INT, d INT);
+INSERT INTO t0
+WITH RECURSIVE qn(n) AS
+(SELECT 0 UNION ALL SELECT n+1 FROM qn WHERE n<999)
+SELECT n, n%100, n%100, n%100 FROM qn;
+ANALYZE TABLE t0;
+Table Op Msg_type Msg_text
+test.t0 analyze status OK
+EXPLAIN FORMAT=TREE
+WITH cte1 AS (
+SELECT SUM(b) v1, c v2, d v3 FROM t0 GROUP BY c, d
+)
+SELECT * FROM cte1 WHERE v2 = 5
+UNION
+SELECT * FROM cte1 WHERE v1 = 4;
+EXPLAIN
+-> Table scan on (rows=64)
+ -> Union materialize with deduplication (rows=64)
+ -> Filter: (cte1.v2 = 5) (rows=32)
+ -> Table scan on cte1 (rows=320)
+ -> Materialize CTE cte1 if needed (rows=320)
+ -> Group aggregate: sum(t0.b) (rows=320)
+ -> Sort: t0.c, t0.d (rows=1000)
+ -> Index scan on t0 using PRIMARY (rows=1000)
+ -> Filter: (cte1.v1 = 4) (rows=32)
+ -> Table scan on cte1 (rows=320)
+ -> Materialize CTE cte1 if needed (query plan printed elsewhere) (rows=320)
+
+EXPLAIN FORMAT=TREE
+WITH cte1 AS (
+SELECT SUM(x1.b + x2.b) v1, x1.d v2
+FROM t0 x1 JOIN t0 x2 ON x1.c = x2.c
+GROUP BY x1.d
+)
+SELECT * FROM cte1 WHERE v2 = 5
+UNION
+SELECT * FROM cte1 WHERE v1 = 4;
+EXPLAIN
+-> Table scan on (rows=6.32)
+ -> Union materialize with deduplication (rows=6.32)
+ -> Filter: (cte1.v2 = 5) (rows=3.16)
+ -> Table scan on cte1 (rows=31.6)
+ -> Materialize CTE cte1 if needed (rows=31.6)
+ -> Table scan on (rows=31.6)
+ -> Aggregate using temporary table (rows=31.6)
+ -> Inner hash join (x1.c = x2.c) (rows=100000)
+ -> Index scan on x1 using PRIMARY (rows=1000)
+ -> Hash
+ -> Index scan on x2 using PRIMARY (rows=1000)
+ -> Filter: (cte1.v1 = 4) (rows=3.16)
+ -> Table scan on cte1 (rows=31.6)
+ -> Materialize CTE cte1 if needed (query plan printed elsewhere) (rows=31.6)
+
+DROP TABLE t0;
+#
+# Bug 36720017 - Hypergraph optimizer uses slow full deduplication
+# in DISTINCT + LIMIT queries
+#
+CREATE TABLE t(x INT, y INT);
+INSERT INTO t VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6,6), (7,7);
+INSERT INTO t SELECT x, y FROM t;
+INSERT INTO t SELECT x, y FROM t;
+INSERT INTO t SELECT x, y FROM t;
+ANALYZE TABLE t;
+Table Op Msg_type Msg_text
+test.t analyze status OK
+EXPLAIN ANALYZE FORMAT=TREE
+SELECT DISTINCT t1.x FROM t AS t1, t AS t2
+WHERE t1.x = t2.x LIMIT 1;
+EXPLAIN
+-> Limit: 1 row(s) (rows=1) (actual rows=1 loops=1)
+ -> Table scan on (rows=1) (actual rows=1 loops=1)
+ -> Temporary table with deduplication (rows=1) (actual rows=1 loops=1)
+ -> Limit table size: 1 unique row(s)
+ -> Inner hash join (t1.x = t2.x) (rows=314) (actual rows=1 loops=1)
+ -> Table scan on t1 (rows=56) (actual rows=1 loops=1)
+ -> Hash
+ -> Table scan on t2 (rows=56) (actual rows=56 loops=1)
+
+EXPLAIN ANALYZE FORMAT=TREE
+SELECT SQL_BIG_RESULT DISTINCT t1.x FROM t AS t1, t AS t2
+WHERE t1.x = t2.x LIMIT 1;
+EXPLAIN
+-> Limit: 1 row(s) (rows=1) (actual rows=1 loops=1)
+ -> Sort with duplicate removal: t1.x, limit input to 1 row(s) per chunk (rows=1) (actual rows=1 loops=1)
+ -> Inner hash join (t1.x = t2.x) (rows=314) (actual rows=448 loops=1)
+ -> Table scan on t1 (rows=56) (actual rows=56 loops=1)
+ -> Hash
+ -> Table scan on t2 (rows=56) (actual rows=56 loops=1)
+
+EXPLAIN ANALYZE FORMAT=TREE
+SELECT DISTINCT t1.x FROM t AS t1, t AS t2
+WHERE t1.x = t2.x LIMIT 3 OFFSET 2;
+EXPLAIN
+-> Limit/Offset: 3/2 row(s) (rows=3) (actual rows=3 loops=1)
+ -> Table scan on (rows=5) (actual rows=5 loops=1)
+ -> Temporary table with deduplication (rows=5) (actual rows=5 loops=1)
+ -> Limit table size: 5 unique row(s)
+ -> Inner hash join (t1.x = t2.x) (rows=314) (actual rows=33 loops=1)
+ -> Table scan on t1 (rows=56) (actual rows=5 loops=1)
+ -> Hash
+ -> Table scan on t2 (rows=56) (actual rows=56 loops=1)
+
+DELETE FROM t WHERE x <> 1;
+ANALYZE TABLE t;
+Table Op Msg_type Msg_text
+test.t analyze status OK
+EXPLAIN ANALYZE FORMAT=TREE
+SELECT SQL_CALC_FOUND_ROWS DISTINCT x
+FROM t AS t1
+LIMIT 5 OFFSET 15;
+EXPLAIN
+-> Limit/Offset: 5/15 row(s) (no early end due to SQL_CALC_FOUND_ROWS) (rows=0) (actual rows=0 loops=1)
+ -> Sort with duplicate removal: t1.x (rows=2.83) (actual rows=1 loops=1)
+ -> Table scan on t1 (rows=8) (actual rows=8 loops=1)
+
+Warnings:
+Warning 1287 SQL_CALC_FOUND_ROWS is deprecated and will be removed in a future release. Consider using two separate queries instead.
+SELECT FOUND_ROWS() AS total_distinct_x;
+total_distinct_x
+1
+Warnings:
+Warning 1287 FOUND_ROWS() is deprecated and will be removed in a future release. Consider using COUNT(*) instead.
+EXPLAIN ANALYZE FORMAT=TREE
+SELECT DISTINCT t1.x, t1.y
+FROM t AS t1, t AS t2
+WHERE t1.x = t2.x
+ORDER BY t1.y LIMIT 5 OFFSET 10;
+EXPLAIN
+-> Limit/Offset: 5/10 row(s) (rows=0) (actual rows=0 loops=1)
+ -> Sort with duplicate removal: t1.y, t1.x (rows=2.53) (actual rows=1 loops=1)
+ -> Inner hash join (t1.x = t2.x) (rows=6.4) (actual rows=64 loops=1)
+ -> Table scan on t1 (rows=8) (actual rows=8 loops=1)
+ -> Hash
+ -> Table scan on t2 (rows=8) (actual rows=8 loops=1)
+
+EXPLAIN ANALYZE FORMAT=TREE
+SELECT * FROM (
+SELECT DISTINCT t1.x FROM t AS t1, t AS t2
+WHERE t1.x = t2.x LIMIT 5
+) s ORDER BY s.x;
+EXPLAIN
+-> Sort: s.x (rows=2.53) (actual rows=1 loops=1)
+ -> Table scan on s (rows=2.53) (actual rows=1 loops=1)
+ -> Materialize (rows=2.53) (actual rows=1 loops=1)
+ -> Limit: 5 row(s) (rows=2.53) (actual rows=1 loops=1)
+ -> Sort with duplicate removal: t1.x, limit input to 5 row(s) per chunk (rows=2.53) (actual rows=1 loops=1)
+ -> Inner hash join (t1.x = t2.x) (rows=6.4) (actual rows=64 loops=1)
+ -> Table scan on t1 (rows=8) (actual rows=8 loops=1)
+ -> Hash
+ -> Table scan on t2 (rows=8) (actual rows=8 loops=1)
+
+DROP TABLE t;
+#
+# Bug#37152269 - REDUNDANT FILTER PATHS ON BETWEEN RANGE SCANS IN HYPERGRAPH
+#
+CREATE TABLE t1 (
+f1 int NOT NULL, f2 int NOT NULL,
+f3 int DEFAULT NULL,
+PRIMARY KEY (f1,f2), KEY f3 (f3));
+INSERT INTO t1 (f1, f2, f3) VALUES
+(1, 1, 1), (1, 2, 3), (2, 2, 3),
+(3, 2, 3), (4, 2, 3), (5, 2, 3), (6, 2, 3);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+EXPLAIN FORMAT = TREE SELECT COUNT(*) FROM t1
+WHERE f3 = 3 AND f1 BETWEEN 2 AND 4;
+EXPLAIN
+-> Aggregate: count(0) (rows=1)
+ -> Covering index range scan on t1 using f3 over (f3 = 3 AND 2 <= f1 <= 4) (rows=3)
+
+SELECT COUNT(*) FROM t1
+WHERE f3 = 3 AND f1 BETWEEN 2 AND 4;
+COUNT(*)
+3
+SET @low = 2;
+SET @high = 4;
+PREPARE stmt FROM
+'EXPLAIN FORMAT = TREE SELECT COUNT(*) FROM t1
+ WHERE f3 = 3 AND f1 BETWEEN ? AND ?';
+EXECUTE stmt USING @low, @high;
+EXPLAIN
+-> Aggregate: count(0) (rows=1)
+ -> Covering index range scan on t1 using f3 over (f3 = 3 AND 2 <= f1 <= 4) (rows=3)
+
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM
+'SELECT COUNT(*) FROM t1
+ WHERE f3 = 3 AND f1 BETWEEN ? AND ?';
+EXECUTE stmt USING @low, @high;
+COUNT(*)
+3
+DEALLOCATE PREPARE stmt;
+INSERT INTO t1 VALUES (100, 1, NULL);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+EXPLAIN FORMAT = TREE SELECT COUNT(*) FROM t1
+WHERE f1 BETWEEN 2 AND 4;
+EXPLAIN
+-> Aggregate: count(0) (rows=1)
+ -> Covering index range scan on t1 using PRIMARY over (2 <= f1 <= 4) (rows=3)
+
+SELECT COUNT(*) FROM t1
+WHERE f1 BETWEEN 2 AND 4;
+COUNT(*)
+3
+EXPLAIN FORMAT = TREE SELECT COUNT(*) FROM t1
+WHERE f1 BETWEEN 2 AND f2;
+EXPLAIN
+-> Aggregate: count(0) (rows=1)
+ -> Filter: (t1.f1 between 2 and t1.f2) (rows=0.889)
+ -> Covering index scan on t1 using PRIMARY (rows=8)
+
+SELECT COUNT(*) FROM t1
+WHERE f1 BETWEEN 2 AND f2;
+COUNT(*)
+1
+EXPLAIN FORMAT = TREE SELECT COUNT(*) FROM t1
+WHERE f1 BETWEEN 2 AND (1+3);
+EXPLAIN
+-> Aggregate: count(0) (rows=1)
+ -> Covering index range scan on t1 using PRIMARY over (2 <= f1 <= 4) (rows=3)
+
+SELECT COUNT(*) FROM t1
+WHERE f1 BETWEEN 2 AND (1+3);
+COUNT(*)
+3
+EXPLAIN FORMAT = TREE SELECT COUNT(*) FROM t1
+WHERE f1 NOT BETWEEN 100 AND f2;
+EXPLAIN
+-> Aggregate: count(0) (rows=1)
+ -> Filter: (t1.f1 not between 100 and t1.f2) (rows=7.11)
+ -> Covering index scan on t1 using PRIMARY (rows=8)
+
+SELECT COUNT(*) FROM t1
+WHERE f1 NOT BETWEEN 100 AND f2;
+COUNT(*)
+8
+INSERT INTO t1 (f1, f2, f3)
+WITH RECURSIVE seq(n) AS (
+SELECT 7 UNION ALL SELECT n + 1 FROM seq WHERE n < 1000)
+SELECT n, 1, NULL FROM seq WHERE n <> 100;
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+EXPLAIN FORMAT = TREE SELECT COUNT(*) FROM t1
+WHERE f1 NOT BETWEEN 2 AND 999;
+EXPLAIN
+-> Aggregate: count(0) (rows=1)
+ -> Covering index range scan on t1 using PRIMARY over (f1 < 2) OR (999 < f1) (rows=3)
+
+SELECT COUNT(*) FROM t1
+WHERE f1 NOT BETWEEN 2 AND 999;
+COUNT(*)
+3
+DROP TABLE t1;
+#
+# Bug#36578540 Sorting on function with side effects results in
+# more function calls
+#
+CREATE TABLE t1 (x INT);
+CREATE TABLE t2 (x INT);
+INSERT INTO t2 VALUES (1), (2), (3);
+CREATE FUNCTION f1(p INT) RETURNS INT DETERMINISTIC MODIFIES SQL DATA
+BEGIN
+INSERT INTO t1 VALUES (p);
+RETURN p + 1;
+END|
+SELECT f1(x) AS f FROM t2 ORDER BY f;
+f
+2
+3
+4
+SELECT COUNT(*) AS should_be_3 FROM t1;
+should_be_3
+3
+SELECT * FROM t1 ORDER BY x;
+x
+1
+2
+3
+DROP FUNCTION f1;
+DROP TABLE t1, t2;
+CREATE TABLE t3 (x INT);
+INSERT INTO t3 VALUES (1), (2), (3), (4), (5);
+EXPLAIN FORMAT=TREE SELECT x, RAND(42) AS r FROM t3 ORDER BY r;
+EXPLAIN
+-> Sort: r (rows=5)
+ -> Stream results (rows=5)
+ -> Table scan on t3 (rows=5)
+
+SELECT x, RAND(42) AS r FROM t3 ORDER BY r;
+x r
+2 0.15164413689788817
+4 0.3925059534539524
+5 0.6540667979550239
+1 0.6629110161800972
+3 0.7694876666827943
+DROP TABLE t3;
+CREATE TABLE t4 (x INT, y INT);
+INSERT INTO t4 VALUES (1, 0), (2, 0), (3, 0), (4, 0), (5, 0);
+UPDATE t4 SET y = 1 ORDER BY RAND();
+SELECT COUNT(*) AS should_be_5 FROM t4 WHERE y = 1;
+should_be_5
+5
+DELETE FROM t4 ORDER BY RAND() LIMIT 2;
+SELECT COUNT(*) AS should_be_3 FROM t4;
+should_be_3
+3
+DELETE FROM t4 WHERE x > 0 ORDER BY RAND();
+SELECT COUNT(*) AS should_be_0 FROM t4;
+should_be_0
+0
+DROP TABLE t4;
+CREATE TABLE t5 (a INT);
+INSERT INTO t5 VALUES (1), (2), (3), (4), (5);
+CREATE TABLE t6 (id INT PRIMARY KEY, y DOUBLE);
+INSERT INTO t6 VALUES (1, 0);
+EXPLAIN FORMAT=TREE
+DELETE FROM t6 WHERE y > (SELECT RAND() AS r FROM t5 ORDER BY r LIMIT 1);
+EXPLAIN
+-> Delete from t6 (immediate) (rows=1)
+ -> Filter: (t6.y > (select #2)) (rows=1)
+ -> Index scan on t6 using PRIMARY (rows=1)
+ -> Select #2 (subquery in condition; uncacheable)
+ -> Sort: r, limit input to 1 row(s) per chunk (rows=1)
+ -> Stream results (rows=5)
+ -> Table scan on t5 (rows=5)
+
+EXPLAIN FORMAT=TREE
+UPDATE t6 SET y = 1 WHERE y > (SELECT RAND() AS r FROM t5 ORDER BY r LIMIT 1);
+EXPLAIN
+-> Update t6 (immediate) (rows=1)
+ -> Filter: (t6.y > (select #2)) (rows=1)
+ -> Index scan on t6 using PRIMARY (rows=1)
+ -> Select #2 (subquery in condition; uncacheable)
+ -> Sort: r, limit input to 1 row(s) per chunk (rows=1)
+ -> Stream results (rows=5)
+ -> Table scan on t5 (rows=5)
+
+DROP TABLE t5, t6;
diff --git a/mysql-test/r/hypergraph_index_on_derived.result b/mysql-test/r/hypergraph_index_on_derived.result
index a56672e2bba6..3e30b2fc63c5 100644
--- a/mysql-test/r/hypergraph_index_on_derived.result
+++ b/mysql-test/r/hypergraph_index_on_derived.result
@@ -28,14 +28,15 @@ EXPLAIN
-> Index scan on y2 using PRIMARY (rows=101)
-> Select #2 (subquery in condition; dependent)
-> Aggregate: avg(cte1.v1) (rows=1)
- -> Index lookup on cte1 using (v2 = y2.d) (rows=1)
- -> Materialize CTE cte1 (rows=17)
- -> Table scan on (rows=17)
- -> Aggregate using temporary table (rows=17)
- -> Inner hash join (x1.c = x2.c) (rows=785)
- -> Index scan on x2 using PRIMARY (rows=101)
- -> Hash
- -> Index scan on x1 using PRIMARY (rows=101)
+ -> Filter: (y2.d = cte1.v2) (rows=1)
+ -> Table scan on cte1 (rows=17)
+ -> Materialize CTE cte1 (rows=17)
+ -> Table scan on (rows=17)
+ -> Aggregate using temporary table (rows=17)
+ -> Inner hash join (x1.c = x2.c) (rows=785)
+ -> Index scan on x2 using PRIMARY (rows=101)
+ -> Hash
+ -> Index scan on x1 using PRIMARY (rows=101)
Warnings:
Note 1276 Field or reference 'test.y2.d' of SELECT #2 was resolved in SELECT #1
@@ -62,8 +63,8 @@ EXPLAIN
-> Index scan on y2 using PRIMARY (rows=101)
-> Select #2 (subquery in condition; dependent)
-> Aggregate: avg(d1.v1) (rows=1)
- -> Filter: (d1.v1 > (select #4)) (rows=1)
- -> Index lookup on d1 using (v2 = y2.d) (rows=1)
+ -> Filter: ((y2.d = d1.v2) and (d1.v1 > (select #4))) (rows=1)
+ -> Table scan on d1 (rows=17)
-> Materialize CTE cte1 if needed (rows=17)
-> Table scan on (rows=17)
-> Aggregate using temporary table (rows=17)
@@ -74,7 +75,7 @@ EXPLAIN
-> Select #4 (subquery in condition; dependent)
-> Aggregate: avg(d2.v2) (rows=1)
-> Filter: (d1.v3 = d2.v1) (rows=1.7)
- -> Index lookup on d2 using (v1 = d1.v3) (rows=1.7)
+ -> Table scan on d2 (rows=17)
-> Materialize CTE cte1 if needed (query plan printed elsewhere) (rows=17)
Warnings:
@@ -90,7 +91,6 @@ line
"Keys for CTE 'cte1' considered during planning':",
" - : {'v1'}"
"Keys for CTE 'cte1' considered during planning':",
-" - : {'v1'}",
" - : {'v2'}"
EXPLAIN FORMAT=TREE WITH cte1 AS
(SELECT SUM(x1.b + x2.b) v1, x1.d v2, MAX(x1.b + x2.b) v3 FROM t1 x1, t1 x2
@@ -99,16 +99,18 @@ SELECT 1 FROM cte1 d1 where v1=2 UNION SELECT 1 FROM cte1 d2 where v2=3;
EXPLAIN
-> Table scan on (rows=3.4)
-> Union materialize with deduplication (rows=3.4)
- -> Index lookup on d1 using (v1 = 2) (rows=1.7)
- -> Materialize CTE cte1 if needed (rows=17)
- -> Table scan on (rows=17)
- -> Aggregate using temporary table (rows=17)
- -> Inner hash join (x1.c = x2.c) (rows=785)
- -> Index scan on x2 using PRIMARY (rows=101)
- -> Hash
- -> Index scan on x1 using PRIMARY (rows=101)
- -> Index lookup on d2 using (v2 = 3) (rows=1.7)
- -> Materialize CTE cte1 if needed (query plan printed elsewhere) (rows=17)
+ -> Filter: (d1.v1 = 2) (rows=1.7)
+ -> Table scan on d1 (rows=17)
+ -> Materialize CTE cte1 if needed (rows=17)
+ -> Table scan on (rows=17)
+ -> Aggregate using temporary table (rows=17)
+ -> Inner hash join (x1.c = x2.c) (rows=785)
+ -> Index scan on x2 using PRIMARY (rows=101)
+ -> Hash
+ -> Index scan on x1 using PRIMARY (rows=101)
+ -> Filter: (d2.v2 = 3) (rows=1.7)
+ -> Table scan on d2 (rows=17)
+ -> Materialize CTE cte1 if needed (query plan printed elsewhere) (rows=17)
SELECT line FROM (WITH RECURSIVE qn(n) AS
(SELECT 1 UNION ALL SELECT n+1 FROM qn WHERE n<25)
@@ -120,7 +122,6 @@ line
"Keys for CTE 'cte1' considered during planning':",
" - : {'v1'}"
"Keys for CTE 'cte1' considered during planning':",
-" - : {'v1'}",
" - : {'v2'}"
DROP TABLE t1;
CREATE TABLE t1 (a int, b int);
@@ -136,18 +137,19 @@ CREATE VIEW v1 AS SELECT MAX(a) m, b FROM t1 GROUP BY b;
EXPLAIN FORMAT=tree WITH cte1 AS (SELECT MAX(a) m, b FROM t1 GROUP BY b)
SELECT * FROM cte1 x1 NATURAL JOIN cte1 x2 NATURAL JOIN cte1 x3;
EXPLAIN
--> Nested loop inner join (rows=520e-6)
- -> Inner hash join (x2.m = x3.m), (x2.b = x3.b) (rows=0.03)
- -> Table scan on x2 (rows=1.73)
- -> Materialize CTE cte1 if needed (query plan printed elsewhere) (rows=1.73)
- -> Hash
- -> Table scan on x3 (rows=1.73)
- -> Materialize CTE cte1 if needed (query plan printed elsewhere) (rows=1.73)
- -> Covering index lookup on x1 using (m = x2.m, b = x2.b) (rows=0.0173)
+-> Inner hash join (x1.m = x2.m), (x1.b = x2.b) (rows=520e-6)
+ -> Table scan on x1 (rows=1.73)
-> Materialize CTE cte1 if needed (rows=1.73)
-> Group aggregate: max(t1.a) (rows=1.73)
-> Sort: t1.b (rows=3)
-> Table scan on t1 (rows=3)
+ -> Hash
+ -> Inner hash join (x2.m = x3.m), (x2.b = x3.b) (rows=0.03)
+ -> Table scan on x2 (rows=1.73)
+ -> Materialize CTE cte1 if needed (query plan printed elsewhere) (rows=1.73)
+ -> Hash
+ -> Table scan on x3 (rows=1.73)
+ -> Materialize CTE cte1 if needed (query plan printed elsewhere) (rows=1.73)
SELECT line FROM (WITH RECURSIVE qn(n) AS
(SELECT 1 UNION ALL SELECT n+1 FROM qn WHERE n<25)
@@ -160,24 +162,25 @@ line
" - : {'m', 'b'}"
EXPLAIN FORMAT=tree SELECT * FROM v1 x1 NATURAL JOIN v1 x2 NATURAL JOIN v1 x3;
EXPLAIN
--> Nested loop inner join (rows=520e-6)
- -> Inner hash join (x2.m = x3.m), (x2.b = x3.b) (rows=0.03)
- -> Table scan on x2 (rows=1.73)
- -> Materialize (rows=1.73)
- -> Group aggregate: max(t1.a) (rows=1.73)
- -> Sort: t1.b (rows=3)
- -> Table scan on t1 (rows=3)
- -> Hash
- -> Table scan on x3 (rows=1.73)
- -> Materialize (rows=1.73)
- -> Group aggregate: max(t1.a) (rows=1.73)
- -> Sort: t1.b (rows=3)
- -> Table scan on t1 (rows=3)
- -> Covering index lookup on x1 using (m = x2.m, b = x2.b) (rows=0.0173)
+-> Inner hash join (x1.m = x2.m), (x1.b = x2.b) (rows=520e-6)
+ -> Table scan on x1 (rows=1.73)
-> Materialize (rows=1.73)
-> Group aggregate: max(t1.a) (rows=1.73)
-> Sort: t1.b (rows=3)
-> Table scan on t1 (rows=3)
+ -> Hash
+ -> Inner hash join (x2.m = x3.m), (x2.b = x3.b) (rows=0.03)
+ -> Table scan on x2 (rows=1.73)
+ -> Materialize (rows=1.73)
+ -> Group aggregate: max(t1.a) (rows=1.73)
+ -> Sort: t1.b (rows=3)
+ -> Table scan on t1 (rows=3)
+ -> Hash
+ -> Table scan on x3 (rows=1.73)
+ -> Materialize (rows=1.73)
+ -> Group aggregate: max(t1.a) (rows=1.73)
+ -> Sort: t1.b (rows=3)
+ -> Table scan on t1 (rows=3)
SELECT line FROM (WITH RECURSIVE qn(n) AS
(SELECT 1 UNION ALL SELECT n+1 FROM qn WHERE n<25)
@@ -214,18 +217,19 @@ line
EXPLAIN FORMAT=tree WITH cte1 AS (SELECT MAX(a) m, b FROM t1 GROUP BY b)
SELECT * FROM cte1 x1, cte1 x2, cte1 x3 WHERE x1.m=x2.m AND x2.b=x3.b;
EXPLAIN
--> Nested loop inner join (rows=0.052)
- -> Inner hash join (x1.m = x2.m) (rows=0.3)
- -> Table scan on x1 (rows=1.73)
- -> Materialize CTE cte1 if needed (rows=1.73)
- -> Group aggregate: max(t1.a) (rows=1.73)
- -> Sort: t1.b (rows=3)
- -> Table scan on t1 (rows=3)
- -> Hash
- -> Table scan on x2 (rows=1.73)
- -> Materialize CTE cte1 if needed (query plan printed elsewhere) (rows=1.73)
- -> Index lookup on x3 using (b = x2.b) (rows=0.173)
+-> Inner hash join (x2.b = x3.b) (rows=0.052)
+ -> Table scan on x3 (rows=1.73)
-> Materialize CTE cte1 if needed (query plan printed elsewhere) (rows=1.73)
+ -> Hash
+ -> Inner hash join (x1.m = x2.m) (rows=0.3)
+ -> Table scan on x1 (rows=1.73)
+ -> Materialize CTE cte1 if needed (rows=1.73)
+ -> Group aggregate: max(t1.a) (rows=1.73)
+ -> Sort: t1.b (rows=3)
+ -> Table scan on t1 (rows=3)
+ -> Hash
+ -> Table scan on x2 (rows=1.73)
+ -> Materialize CTE cte1 if needed (query plan printed elsewhere) (rows=1.73)
SELECT line FROM (WITH RECURSIVE qn(n) AS
(SELECT 1 UNION ALL SELECT n+1 FROM qn WHERE n<25)
diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result
index 75039893400d..ed8cdee5d4c6 100644
--- a/mysql-test/r/index_merge_innodb.result
+++ b/mysql-test/r/index_merge_innodb.result
@@ -2378,3 +2378,42 @@ WHERE t2.c1 = 'f'
AND t1.d1 IS NULL;
c1
DROP TABLE t1, t2;
+#
+# Bug#36584358: Wrong result with index_merge_union=off
+#
+CREATE TABLE t1 (
+f1 INTEGER,
+f2 INTEGER,
+KEY (f1 DESC,f2 DESC),
+KEY (f2 DESC,f1)
+);
+INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,NULL),
+(NULL,NULL),(NULL,NULL),(NULL,NULL);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+EXPLAIN FORMAT=tree SELECT f1 FROM t1 WHERE f1 OR f2;
+EXPLAIN
+-> Filter: ((0 <> t1.f1) or (0 <> t1.f2)) (cost=0.85 rows=5.83)
+ -> Covering index scan on t1 using f1 (cost=0.85 rows=6)
+
+SELECT f1 FROM t1 WHERE f1 OR f2;
+f1
+3
+2
+1
+SET @optimizer_switch_saved = @@optimizer_switch;
+SET optimizer_switch="index_merge_union=off";
+EXPLAIN FORMAT=tree SELECT f1 FROM t1 WHERE f1 OR f2;
+EXPLAIN
+-> Filter: ((0 <> t1.f1) or (0 <> t1.f2)) (cost=0.85 rows=5.83)
+ -> Covering index scan on t1 using f1 (cost=0.85 rows=6)
+
+SELECT f1 FROM t1 WHERE f1 OR f2;
+f1
+3
+2
+1
+SET optimizer_switch="index_merge_union=on";
+SET @@optimizer_switch = @optimizer_switch_saved;
+DROP TABLE t1;
diff --git a/mysql-test/r/index_merge_innodb_hypergraph.result b/mysql-test/r/index_merge_innodb_hypergraph.result
index 596eefbcf6cf..cbee7066357a 100644
--- a/mysql-test/r/index_merge_innodb_hypergraph.result
+++ b/mysql-test/r/index_merge_innodb_hypergraph.result
@@ -2454,6 +2454,45 @@ AND t1.d1 IS NULL;
c1
DROP TABLE t1, t2;
#
+# Bug#36584358: Wrong result with index_merge_union=off
+#
+CREATE TABLE t1 (
+f1 INTEGER,
+f2 INTEGER,
+KEY (f1 DESC,f2 DESC),
+KEY (f2 DESC,f1)
+);
+INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,NULL),
+(NULL,NULL),(NULL,NULL),(NULL,NULL);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+EXPLAIN FORMAT=tree SELECT f1 FROM t1 WHERE f1 OR f2;
+EXPLAIN
+-> Filter: ((0 <> t1.f1) or (0 <> t1.f2)) (cost=0.705..4.23 rows=6)
+ -> Covering index scan on t1 using f1 (cost=0.647..3.88 rows=6)
+
+SELECT f1 FROM t1 WHERE f1 OR f2;
+f1
+3
+2
+1
+SET @optimizer_switch_saved = @@optimizer_switch;
+SET optimizer_switch="index_merge_union=off";
+EXPLAIN FORMAT=tree SELECT f1 FROM t1 WHERE f1 OR f2;
+EXPLAIN
+-> Filter: ((0 <> t1.f1) or (0 <> t1.f2)) (cost=0.705..4.23 rows=6)
+ -> Covering index scan on t1 using f1 (cost=0.647..3.88 rows=6)
+
+SELECT f1 FROM t1 WHERE f1 OR f2;
+f1
+3
+2
+1
+SET optimizer_switch="index_merge_union=on";
+SET @@optimizer_switch = @optimizer_switch_saved;
+DROP TABLE t1;
+#
# Bug#35383419: WL#14808:ASSERT: `read_rows >= 0.0' in
# Cost_model_server::tmptable_readwrite_cos
#
diff --git a/mysql-test/r/information_schema_keywords.result b/mysql-test/r/information_schema_keywords.result
index abe3425da3d0..11fc5f3eddca 100644
--- a/mysql-test/r/information_schema_keywords.result
+++ b/mysql-test/r/information_schema_keywords.result
@@ -110,7 +110,7 @@ CONVERT 1
CPU 0
CREATE 1
CROSS 1
-CUBE 0
+CUBE 1
CUME_DIST 1
CURRENT 0
CURRENT_DATE 1
@@ -196,7 +196,7 @@ EXPLAIN 1
EXPORT 0
EXTENDED 0
EXTENT_SIZE 0
-EXTERNAL 0
+EXTERNAL 1
EXTERNAL_FORMAT 0
FACTOR 0
FAILED_LOGIN_ATTEMPTS 0
@@ -479,7 +479,7 @@ PROFILE 0
PROFILES 0
PROXY 0
PURGE 1
-QUALIFY 0
+QUALIFY 1
QUARTER 0
QUERY 0
QUICK 0
@@ -674,7 +674,7 @@ SWITCHES 0
SYSTEM 1
TABLE 1
TABLES 0
-TABLESAMPLE 0
+TABLESAMPLE 1
TABLESPACE 0
TABLE_CHECKSUM 0
TABLE_NAME 0
diff --git a/mysql-test/r/innodb_pk_extension_hypergraph.result b/mysql-test/r/innodb_pk_extension_hypergraph.result
index defb4739c6b3..b6a25cb5d4aa 100644
--- a/mysql-test/r/innodb_pk_extension_hypergraph.result
+++ b/mysql-test/r/innodb_pk_extension_hypergraph.result
@@ -97,7 +97,7 @@ Handler_read_rnd_next 0
EXPLAIN SELECT count(*) FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-01-03';
EXPLAIN
-> Aggregate: count(0) (rows=1)
- -> Filter: ((t1.pk_1 between 3 and 5) and (t1.f1 = TIMESTAMP'2000-01-03 00:00:00')) (rows=6)
+ -> Filter: (t1.f1 = TIMESTAMP'2000-01-03 00:00:00') (rows=6)
-> Index range scan on t1 using PRIMARY over (3 <= pk_1 <= 5) (rows=30)
FLUSH STATUS;
@@ -115,7 +115,7 @@ Handler_read_rnd 0
Handler_read_rnd_next 0
EXPLAIN SELECT pk_1, pk_2 FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-01-03';
EXPLAIN
--> Filter: ((t1.pk_1 between 3 and 5) and (t1.f1 = TIMESTAMP'2000-01-03 00:00:00')) (rows=6)
+-> Filter: (t1.f1 = TIMESTAMP'2000-01-03 00:00:00') (rows=6)
-> Index range scan on t1 using PRIMARY over (3 <= pk_1 <= 5) (rows=30)
FLUSH STATUS;
@@ -161,7 +161,7 @@ Handler_read_rnd_next 0
EXPLAIN SELECT MIN(pk_1) FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-01-03';
EXPLAIN
-> Aggregate: min(t1.pk_1) (rows=1)
- -> Filter: ((t1.pk_1 between 3 and 5) and (t1.f1 = TIMESTAMP'2000-01-03 00:00:00')) (rows=6)
+ -> Filter: (t1.f1 = TIMESTAMP'2000-01-03 00:00:00') (rows=6)
-> Index range scan on t1 using PRIMARY over (3 <= pk_1 <= 5) (rows=30)
FLUSH STATUS;
@@ -198,7 +198,7 @@ Handler_read_rnd_next 0
EXPLAIN SELECT MAX(pk_1) FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-01-03';
EXPLAIN
-> Aggregate: max(t1.pk_1) (rows=1)
- -> Filter: ((t1.pk_1 between 3 and 5) and (t1.f1 = TIMESTAMP'2000-01-03 00:00:00')) (rows=6)
+ -> Filter: (t1.f1 = TIMESTAMP'2000-01-03 00:00:00') (rows=6)
-> Index range scan on t1 using PRIMARY over (3 <= pk_1 <= 5) (rows=30)
FLUSH STATUS;
@@ -220,8 +220,7 @@ Handler_read_rnd_next 0
EXPLAIN SELECT MIN(pk_1) FROM t1 WHERE f2 BETWEEN 13 AND 14 GROUP BY f2;
EXPLAIN
-> Group aggregate: min(t1.pk_1) (rows=45)
- -> Filter: (t1.f2 between 13 and 14) (rows=96)
- -> Covering index range scan on t1 using k2 over (13 <= f2 <= 14) (rows=96)
+ -> Covering index range scan on t1 using k2 over (13 <= f2 <= 14) (rows=96)
FLUSH STATUS;
SELECT MIN(pk_1) FROM t1 WHERE f2 BETWEEN 13 AND 14 GROUP BY f2;
@@ -319,7 +318,7 @@ EXPLAIN SELECT f1, pk_1, pk_2 FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-
ORDER BY pk_2 DESC LIMIT 5;
EXPLAIN
-> Sort: t1.pk_2 DESC, limit input to 5 row(s) per chunk (rows=5)
- -> Filter: ((t1.pk_1 between 3 and 5) and (t1.f1 = TIMESTAMP'2000-01-03 00:00:00')) (rows=6)
+ -> Filter: (t1.f1 = TIMESTAMP'2000-01-03 00:00:00') (rows=6)
-> Index range scan on t1 using PRIMARY over (3 <= pk_1 <= 5) (rows=30)
FLUSH STATUS;
@@ -575,8 +574,7 @@ Handler_read_rnd_next 0
EXPLAIN SELECT count(*) FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-01-03';
EXPLAIN
-> Aggregate: count(0) (rows=1)
- -> Filter: (t1.pk_1 between 3 and 5) (rows=6)
- -> Covering index range scan on t1 using k1 over (f1 = '2000-01-03 00:00:00' AND 3 <= pk_1 <= 5) (rows=6)
+ -> Covering index range scan on t1 using k1 over (f1 = '2000-01-03 00:00:00' AND 3 <= pk_1 <= 5) (rows=6)
FLUSH STATUS;
SELECT count(*) FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-01-03';
@@ -593,8 +591,7 @@ Handler_read_rnd 0
Handler_read_rnd_next 0
EXPLAIN SELECT pk_1, pk_2 FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-01-03';
EXPLAIN
--> Filter: (t1.pk_1 between 3 and 5) (rows=6)
- -> Covering index range scan on t1 using k1 over (f1 = '2000-01-03 00:00:00' AND 3 <= pk_1 <= 5) (rows=6)
+-> Covering index range scan on t1 using k1 over (f1 = '2000-01-03 00:00:00' AND 3 <= pk_1 <= 5) (rows=6)
FLUSH STATUS;
SELECT pk_1, pk_2 FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-01-03';
@@ -639,8 +636,7 @@ Handler_read_rnd_next 0
EXPLAIN SELECT MIN(pk_1) FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-01-03';
EXPLAIN
-> Aggregate: min(t1.pk_1) (rows=1)
- -> Filter: (t1.pk_1 between 3 and 5) (rows=6)
- -> Covering index range scan on t1 using k1 over (f1 = '2000-01-03 00:00:00' AND 3 <= pk_1 <= 5) (rows=6)
+ -> Covering index range scan on t1 using k1 over (f1 = '2000-01-03 00:00:00' AND 3 <= pk_1 <= 5) (rows=6)
FLUSH STATUS;
SELECT MIN(pk_1) FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-01-03';
@@ -676,8 +672,7 @@ Handler_read_rnd_next 0
EXPLAIN SELECT MAX(pk_1) FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-01-03';
EXPLAIN
-> Aggregate: max(t1.pk_1) (rows=1)
- -> Filter: (t1.pk_1 between 3 and 5) (rows=6)
- -> Covering index range scan on t1 using k1 over (f1 = '2000-01-03 00:00:00' AND 3 <= pk_1 <= 5) (rows=6)
+ -> Covering index range scan on t1 using k1 over (f1 = '2000-01-03 00:00:00' AND 3 <= pk_1 <= 5) (rows=6)
FLUSH STATUS;
SELECT MAX(pk_1) FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-01-03';
@@ -793,8 +788,7 @@ EXPLAIN SELECT f1, pk_1, pk_2 FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-
ORDER BY pk_2 DESC LIMIT 5;
EXPLAIN
-> Sort: t1.pk_2 DESC, limit input to 5 row(s) per chunk (rows=5)
- -> Filter: (t1.pk_1 between 3 and 5) (rows=6)
- -> Covering index range scan on t1 using k1 over (f1 = '2000-01-03 00:00:00' AND 3 <= pk_1 <= 5) (rows=6)
+ -> Covering index range scan on t1 using k1 over (f1 = '2000-01-03 00:00:00' AND 3 <= pk_1 <= 5) (rows=6)
FLUSH STATUS;
SELECT f1, pk_1, pk_2 FROM t1 WHERE pk_1 BETWEEN 3 AND 5 AND f1 = '2000-01-03'
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index d9080ad89c63..fa61269aaff7 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -4053,3 +4053,113 @@ id select_type table partitions type possible_keys key key_len ref rows filtered
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`f1` AS `f1`,`test`.`t2`.`f2` AS `f2`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t1`.`f3` AS `f3`,`test`.`t1`.`f4` AS `f4`,`test`.`t1`.`f5` AS `f5` from `test`.`t2` USE INDEX (`idx2`) left join `test`.`t1` USE INDEX (`idx1`) on(((`test`.`t1`.`f3` = 20) and (`test`.`t1`.`f2` = `test`.`t2`.`f2`) and (`test`.`t1`.`f4` > 10) and (`test`.`t1`.`f5` > 20))) where true
DROP TABLES t1,t2;
+#
+# Bug#35749693: Incorrect multiple equality optimization causes
+# performance degradation
+#
+CREATE TABLE t1(a INT, b INT, c VARCHAR(100));
+CREATE TABLE t2(a INT, b INT, c VARCHAR(100));
+INSERT INTO t1 VALUES (1,1,'x'),(-1,-1,'y'),(NULL,0,'z');
+INSERT INTO t2 VALUES (1,10,'p'),(-5,20,'q'),(2,30,'r');
+ANALYZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+test.t2 analyze status OK
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t2.a > 0;
+EXPLAIN
+-> Left hash join (t2.a = t1.a)
+ -> Table scan on t1
+ -> Hash
+ -> Filter: (t2.a > 0)
+ -> Table scan on t2
+
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t2.a > 0;
+a b c a b c
+-1 -1 y NULL NULL NULL
+1 1 x 1 10 p
+NULL 0 z NULL NULL NULL
+#
+# Same bug, bare boolean field: t2.a used directly as the predicate.
+# make_condition() wraps non-boolean predicates in Item_func_ne(0, x)
+# at parse time, so the remap above sees a FUNC_ITEM and handles it.
+#
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t2.a;
+EXPLAIN
+-> Left hash join (t2.a = t1.a)
+ -> Table scan on t1
+ -> Hash
+ -> Filter: (0 <> t2.a)
+ -> Table scan on t2
+
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t2.a;
+a b c a b c
+-1 -1 y NULL NULL NULL
+1 1 x 1 10 p
+NULL 0 z NULL NULL NULL
+#
+# Converse: user writes the predicate on the OUTER column (t1.a > 0).
+# Within the ON scope t1.a = t2.a holds, so remapping to t2.a > 0 would
+# be valid, but replace_equal_field() records the multi-equality on a
+# field only when it actually substitutes it; t1.a is already the head
+# of the equality so no substitution happens and the predicate stays as
+# an extra condition. Kept here to verify results remain correct.
+#
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t1.a > 0;
+EXPLAIN
+-> Left hash join (t2.a = t1.a), extra conditions: (t1.a > 0)
+ -> Table scan on t1
+ -> Hash
+ -> Table scan on t2
+
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t1.a > 0;
+a b c a b c
+-1 -1 y NULL NULL NULL
+1 1 x 1 10 p
+NULL 0 z NULL NULL NULL
+#
+# 3-table case: t1 LEFT JOIN (t2 JOIN t3) — predicate on t3 column
+#
+CREATE TABLE t3(a INT, b INT);
+INSERT INTO t3 VALUES (1,100),(-1,200);
+ANALYZE TABLE t3;
+Table Op Msg_type Msg_text
+test.t3 analyze status OK
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN (t2 JOIN t3 ON t2.a = t3.a)
+ON t1.a = t2.a AND t3.a > 0;
+EXPLAIN
+-> Left hash join (t3.a = t1.a), (t2.a = t1.a)
+ -> Table scan on t1
+ -> Hash
+ -> Filter: (t3.a > 0)
+ -> Inner hash join (no condition)
+ -> Table scan on t2
+ -> Hash
+ -> Table scan on t3
+
+DROP TABLE t3;
+#
+# Correctness guard: equality nested under OR in the ON clause.
+# The remapping must NOT touch a condition that already references the
+# build side; otherwise the equality (t1.b = t2.b) could be rewritten to
+# (t2.b = t2.b) via its own disjunct-level multiple equality.
+#
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN t2
+ON t1.a = t2.a AND (t1.b = t2.b OR t2.c IS NULL);
+EXPLAIN
+-> Left hash join (t2.a = t1.a), extra conditions: ((t2.b = t1.b) or (t2.c is null))
+ -> Table scan on t1
+ -> Hash
+ -> Table scan on t2
+
+SELECT * FROM t1 LEFT JOIN t2
+ON t1.a = t2.a AND (t1.b = t2.b OR t2.c IS NULL);
+a b c a b c
+-1 -1 y NULL NULL NULL
+1 1 x NULL NULL NULL
+NULL 0 z NULL NULL NULL
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/join_outer_bka.result b/mysql-test/r/join_outer_bka.result
index bd26f997d892..b406c33f3dcf 100644
--- a/mysql-test/r/join_outer_bka.result
+++ b/mysql-test/r/join_outer_bka.result
@@ -4055,4 +4055,114 @@ id select_type table partitions type possible_keys key key_len ref rows filtered
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`f1` AS `f1`,`test`.`t2`.`f2` AS `f2`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t1`.`f3` AS `f3`,`test`.`t1`.`f4` AS `f4`,`test`.`t1`.`f5` AS `f5` from `test`.`t2` USE INDEX (`idx2`) left join `test`.`t1` USE INDEX (`idx1`) on(((`test`.`t1`.`f3` = 20) and (`test`.`t1`.`f2` = `test`.`t2`.`f2`) and (`test`.`t1`.`f4` > 10) and (`test`.`t1`.`f5` > 20))) where true
DROP TABLES t1,t2;
+#
+# Bug#35749693: Incorrect multiple equality optimization causes
+# performance degradation
+#
+CREATE TABLE t1(a INT, b INT, c VARCHAR(100));
+CREATE TABLE t2(a INT, b INT, c VARCHAR(100));
+INSERT INTO t1 VALUES (1,1,'x'),(-1,-1,'y'),(NULL,0,'z');
+INSERT INTO t2 VALUES (1,10,'p'),(-5,20,'q'),(2,30,'r');
+ANALYZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+test.t2 analyze status OK
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t2.a > 0;
+EXPLAIN
+-> Left hash join (t2.a = t1.a)
+ -> Table scan on t1
+ -> Hash
+ -> Filter: (t2.a > 0)
+ -> Table scan on t2
+
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t2.a > 0;
+a b c a b c
+-1 -1 y NULL NULL NULL
+1 1 x 1 10 p
+NULL 0 z NULL NULL NULL
+#
+# Same bug, bare boolean field: t2.a used directly as the predicate.
+# make_condition() wraps non-boolean predicates in Item_func_ne(0, x)
+# at parse time, so the remap above sees a FUNC_ITEM and handles it.
+#
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t2.a;
+EXPLAIN
+-> Left hash join (t2.a = t1.a)
+ -> Table scan on t1
+ -> Hash
+ -> Filter: (0 <> t2.a)
+ -> Table scan on t2
+
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t2.a;
+a b c a b c
+-1 -1 y NULL NULL NULL
+1 1 x 1 10 p
+NULL 0 z NULL NULL NULL
+#
+# Converse: user writes the predicate on the OUTER column (t1.a > 0).
+# Within the ON scope t1.a = t2.a holds, so remapping to t2.a > 0 would
+# be valid, but replace_equal_field() records the multi-equality on a
+# field only when it actually substitutes it; t1.a is already the head
+# of the equality so no substitution happens and the predicate stays as
+# an extra condition. Kept here to verify results remain correct.
+#
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t1.a > 0;
+EXPLAIN
+-> Left hash join (t2.a = t1.a), extra conditions: (t1.a > 0)
+ -> Table scan on t1
+ -> Hash
+ -> Table scan on t2
+
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t1.a > 0;
+a b c a b c
+-1 -1 y NULL NULL NULL
+1 1 x 1 10 p
+NULL 0 z NULL NULL NULL
+#
+# 3-table case: t1 LEFT JOIN (t2 JOIN t3) — predicate on t3 column
+#
+CREATE TABLE t3(a INT, b INT);
+INSERT INTO t3 VALUES (1,100),(-1,200);
+ANALYZE TABLE t3;
+Table Op Msg_type Msg_text
+test.t3 analyze status OK
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN (t2 JOIN t3 ON t2.a = t3.a)
+ON t1.a = t2.a AND t3.a > 0;
+EXPLAIN
+-> Left hash join (t3.a = t1.a), (t2.a = t1.a)
+ -> Table scan on t1
+ -> Hash
+ -> Filter: (t3.a > 0)
+ -> Inner hash join (no condition)
+ -> Table scan on t2
+ -> Hash
+ -> Table scan on t3
+
+DROP TABLE t3;
+#
+# Correctness guard: equality nested under OR in the ON clause.
+# The remapping must NOT touch a condition that already references the
+# build side; otherwise the equality (t1.b = t2.b) could be rewritten to
+# (t2.b = t2.b) via its own disjunct-level multiple equality.
+#
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN t2
+ON t1.a = t2.a AND (t1.b = t2.b OR t2.c IS NULL);
+EXPLAIN
+-> Left hash join (t2.a = t1.a), extra conditions: ((t2.b = t1.b) or (t2.c is null))
+ -> Table scan on t1
+ -> Hash
+ -> Table scan on t2
+
+SELECT * FROM t1 LEFT JOIN t2
+ON t1.a = t2.a AND (t1.b = t2.b OR t2.c IS NULL);
+a b c a b c
+-1 -1 y NULL NULL NULL
+1 1 x NULL NULL NULL
+NULL 0 z NULL NULL NULL
+DROP TABLE t1, t2;
set optimizer_switch=default;
diff --git a/mysql-test/r/join_outer_bka_nobnl.result b/mysql-test/r/join_outer_bka_nobnl.result
index 91a9b2b463c3..19847160fd7f 100644
--- a/mysql-test/r/join_outer_bka_nobnl.result
+++ b/mysql-test/r/join_outer_bka_nobnl.result
@@ -4052,4 +4052,114 @@ id select_type table partitions type possible_keys key key_len ref rows filtered
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`f1` AS `f1`,`test`.`t2`.`f2` AS `f2`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t1`.`f3` AS `f3`,`test`.`t1`.`f4` AS `f4`,`test`.`t1`.`f5` AS `f5` from `test`.`t2` USE INDEX (`idx2`) left join `test`.`t1` USE INDEX (`idx1`) on(((`test`.`t1`.`f3` = 20) and (`test`.`t1`.`f2` = `test`.`t2`.`f2`) and (`test`.`t1`.`f4` > 10) and (`test`.`t1`.`f5` > 20))) where true
DROP TABLES t1,t2;
+#
+# Bug#35749693: Incorrect multiple equality optimization causes
+# performance degradation
+#
+CREATE TABLE t1(a INT, b INT, c VARCHAR(100));
+CREATE TABLE t2(a INT, b INT, c VARCHAR(100));
+INSERT INTO t1 VALUES (1,1,'x'),(-1,-1,'y'),(NULL,0,'z');
+INSERT INTO t2 VALUES (1,10,'p'),(-5,20,'q'),(2,30,'r');
+ANALYZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+test.t2 analyze status OK
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t2.a > 0;
+EXPLAIN
+-> Left hash join (t2.a = t1.a)
+ -> Table scan on t1
+ -> Hash
+ -> Filter: (t2.a > 0)
+ -> Table scan on t2
+
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t2.a > 0;
+a b c a b c
+-1 -1 y NULL NULL NULL
+1 1 x 1 10 p
+NULL 0 z NULL NULL NULL
+#
+# Same bug, bare boolean field: t2.a used directly as the predicate.
+# make_condition() wraps non-boolean predicates in Item_func_ne(0, x)
+# at parse time, so the remap above sees a FUNC_ITEM and handles it.
+#
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t2.a;
+EXPLAIN
+-> Left hash join (t2.a = t1.a)
+ -> Table scan on t1
+ -> Hash
+ -> Filter: (0 <> t2.a)
+ -> Table scan on t2
+
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t2.a;
+a b c a b c
+-1 -1 y NULL NULL NULL
+1 1 x 1 10 p
+NULL 0 z NULL NULL NULL
+#
+# Converse: user writes the predicate on the OUTER column (t1.a > 0).
+# Within the ON scope t1.a = t2.a holds, so remapping to t2.a > 0 would
+# be valid, but replace_equal_field() records the multi-equality on a
+# field only when it actually substitutes it; t1.a is already the head
+# of the equality so no substitution happens and the predicate stays as
+# an extra condition. Kept here to verify results remain correct.
+#
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t1.a > 0;
+EXPLAIN
+-> Left hash join (t2.a = t1.a), extra conditions: (t1.a > 0)
+ -> Table scan on t1
+ -> Hash
+ -> Table scan on t2
+
+SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a AND t1.a > 0;
+a b c a b c
+-1 -1 y NULL NULL NULL
+1 1 x 1 10 p
+NULL 0 z NULL NULL NULL
+#
+# 3-table case: t1 LEFT JOIN (t2 JOIN t3) — predicate on t3 column
+#
+CREATE TABLE t3(a INT, b INT);
+INSERT INTO t3 VALUES (1,100),(-1,200);
+ANALYZE TABLE t3;
+Table Op Msg_type Msg_text
+test.t3 analyze status OK
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN (t2 JOIN t3 ON t2.a = t3.a)
+ON t1.a = t2.a AND t3.a > 0;
+EXPLAIN
+-> Left hash join (t3.a = t1.a), (t2.a = t1.a)
+ -> Table scan on t1
+ -> Hash
+ -> Filter: (t3.a > 0)
+ -> Inner hash join (no condition)
+ -> Table scan on t2
+ -> Hash
+ -> Table scan on t3
+
+DROP TABLE t3;
+#
+# Correctness guard: equality nested under OR in the ON clause.
+# The remapping must NOT touch a condition that already references the
+# build side; otherwise the equality (t1.b = t2.b) could be rewritten to
+# (t2.b = t2.b) via its own disjunct-level multiple equality.
+#
+EXPLAIN FORMAT=TREE
+SELECT * FROM t1 LEFT JOIN t2
+ON t1.a = t2.a AND (t1.b = t2.b OR t2.c IS NULL);
+EXPLAIN
+-> Left hash join (t2.a = t1.a), extra conditions: ((t2.b = t1.b) or (t2.c is null))
+ -> Table scan on t1
+ -> Hash
+ -> Table scan on t2
+
+SELECT * FROM t1 LEFT JOIN t2
+ON t1.a = t2.a AND (t1.b = t2.b OR t2.c IS NULL);
+a b c a b c
+-1 -1 y NULL NULL NULL
+1 1 x NULL NULL NULL
+NULL 0 z NULL NULL NULL
+DROP TABLE t1, t2;
set optimizer_switch=default;
diff --git a/mysql-test/r/join_outer_bugs.result b/mysql-test/r/join_outer_bugs.result
new file mode 100644
index 000000000000..2f39cb3c8d74
--- /dev/null
+++ b/mysql-test/r/join_outer_bugs.result
@@ -0,0 +1,108 @@
+#
+# Bug 36061036 - Explain plan shows dynamic range,
+# but bug causes no chance to use for LEFT JOIN
+#
+SET @old_optimizer_switch = @@optimizer_switch;
+SET optimizer_switch = 'hypergraph_optimizer=off';
+CREATE TABLE digits (d TINYINT PRIMARY KEY);
+INSERT INTO digits VALUES
+(0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
+CREATE TABLE seq_0_to_999 AS
+SELECT ones.d + 10 * tens.d + 100 * hundreds.d AS n
+FROM digits AS ones
+CROSS JOIN digits AS tens
+CROSS JOIN digits AS hundreds;
+CREATE TABLE t2 (
+id INT NOT NULL,
+value VARCHAR(32) NOT NULL,
+PRIMARY KEY (id),
+KEY idx_value (value)
+);
+INSERT INTO t2
+SELECT n + 1, CONCAT('name', LPAD(n + 1, 5, '0'))
+FROM seq_0_to_999
+WHERE n < 923
+ORDER BY n;
+CREATE TABLE t1 (
+id INT NOT NULL,
+status CHAR(2) NOT NULL,
+name VARCHAR(32) NOT NULL,
+sequence INT NOT NULL,
+PRIMARY KEY (id),
+KEY idx_name (name)
+);
+INSERT INTO t1
+SELECT n + 1,
+CASE MOD(n, 4)
+WHEN 0 THEN 'NG'
+ WHEN 1 THEN 'FA'
+ WHEN 2 THEN 'IT'
+ ELSE 'OK'
+ END,
+CONCAT('name', LPAD(MOD(n, 923) + 1, 5, '0')),
+MOD(n * 7, 923) + 1
+FROM (
+SELECT n FROM seq_0_to_999
+UNION ALL
+SELECT n + 1000 FROM seq_0_to_999 WHERE n < 285
+) AS generated_rows
+ORDER BY n;
+INSERT INTO t1 VALUES (2000, 'NG', 'not-in-t2', 2000);
+ANALYZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+test.t2 analyze status OK
+SELECT COUNT(0)
+FROM t1
+JOIN t2
+ON t2.value = t1.name
+OR t2.id = t1.sequence
+WHERE t1.status IN ('NG', 'FA', 'IT');
+COUNT(0)
+1927
+EXPLAIN ANALYZE SELECT COUNT(0)
+FROM t1
+JOIN t2
+ON t2.value = t1.name
+OR t2.id = t1.sequence
+WHERE t1.status IN ('NG', 'FA', 'IT');
+EXPLAIN
+-> Aggregate: count(0) (rows=1)
+ -> Nested loop inner join (rows=67658)
+ -> Filter: (t1.`status` in ('NG','FA','IT')) (rows=386)
+ -> Table scan on t1 (rows=1286)
+ -> Filter: ((t2.`value` = t1.`name`) or (t2.id = t1.sequence)) (rows=175)
+ -> Index range scan on t2 (re-planned for each iteration) (rows=923)
+
+SELECT COUNT(0)
+FROM t1
+LEFT JOIN t2
+ON t2.value = t1.name
+OR t2.id = t1.sequence
+WHERE t1.status IN ('NG', 'FA', 'IT');
+COUNT(0)
+1928
+SELECT SUM(t2.id IS NULL) AS unmatched_rows
+FROM t1
+LEFT JOIN t2
+ON t2.value = t1.name
+OR t2.id = t1.sequence
+WHERE t1.status IN ('NG', 'FA', 'IT');
+unmatched_rows
+1
+EXPLAIN ANALYZE SELECT COUNT(0)
+FROM t1
+LEFT JOIN t2
+ON t2.value = t1.name
+OR t2.id = t1.sequence
+WHERE t1.status IN ('NG', 'FA', 'IT');
+EXPLAIN
+-> Aggregate: count(0) (rows=1)
+ -> Nested loop left join (rows=356093)
+ -> Filter: (t1.`status` in ('NG','FA','IT')) (rows=386)
+ -> Table scan on t1 (rows=1286)
+ -> Filter: ((t2.`value` = t1.`name`) or (t2.id = t1.sequence)) (rows=923)
+ -> Index range scan on t2 (re-planned for each iteration) (rows=923)
+
+DROP TABLE t1, t2, seq_0_to_999, digits;
+SET optimizer_switch = @old_optimizer_switch;
diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result
index 6bf1d00eb793..919cc7ccd903 100644
--- a/mysql-test/r/keywords.result
+++ b/mysql-test/r/keywords.result
@@ -288,3 +288,17 @@ SELECT * FROM t2 WHERE sets = 1;
sets data
1 test
DROP TABLE sets, t1, t2;
+#
+# Bug#36584265: Five mistakes in information_schema.keywords_reserved
+#
+CREATE TABLE manual(col1 INTEGER);
+CREATE TABLE parallel(col1 INTEGER);
+DROP TABLE manual, parallel;
+CREATE TABLE CUBE(col1 INTEGER);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CUBE(col1 INTEGER)' at line 1
+CREATE TABLE external(col1 INTEGER);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'external(col1 INTEGER)' at line 1
+CREATE TABLE QUALIFY(col1 INTEGER);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'QUALIFY(col1 INTEGER)' at line 1
+CREATE TABLE TABLESAMPLE(col1 INTEGER);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TABLESAMPLE(col1 INTEGER)' at line 1
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index 24cc34219417..1cec28b24702 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -802,3 +802,48 @@ SELECT '55,6,1,6,.8,.8\n' INTO DUMPFILE 'MYSQLTEST_VARDIR/tmp/bug35514249';
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug35514249' INTO TABLE ibstd_03 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
ERROR 01000: Row 1 doesn't contain data for all columns
DROP TABLE ibstd_03;
+#
+# Bug 38939847 - After an error occurs when importing data containing
+# NULL fields, insert can not be executed normally.
+#
+SET @old_sql_mode = @@sql_mode;
+SET sql_mode = CONCAT(
+'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,',
+'NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO');
+CREATE TABLE t2 (
+id INT NOT NULL,
+a CHAR(20) NOT NULL DEFAULT '',
+b CHAR(20) NOT NULL DEFAULT '',
+c JSON NOT NULL,
+PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug38939847' INTO TABLE t2 FIELDS TERMINATED BY 0x03 OPTIONALLY ENCLOSED BY '"' (id, a, b, c);
+ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'b' at row 1
+INSERT INTO t2 VALUES (501, 'abc', 'bb', '{"abc":2}');
+SELECT * FROM t2 ORDER BY id;
+id a b c
+501 abc bb {"abc": 2}
+DROP TABLE t2;
+#
+# Temporary NULL state must not leak between LOAD DATA rows.
+#
+SET sql_mode = '';
+CREATE TABLE t3 (
+id INT NOT NULL,
+b CHAR(20) NOT NULL DEFAULT '',
+PRIMARY KEY (id)
+);
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug38939847_rows' INTO TABLE t3 FIELDS TERMINATED BY 0x03 OPTIONALLY ENCLOSED BY '"' (id, b);
+Warnings:
+Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 1
+Warning 1261 Row 2 doesn't contain data for all columns
+SELECT @@warning_count;
+@@warning_count
+2
+SELECT id, b, b = '' AS b_is_default FROM t3 ORDER BY id;
+id b b_is_default
+1 1
+2 1
+3 ok 0
+DROP TABLE t3;
+SET sql_mode = @old_sql_mode;
diff --git a/mysql-test/r/mysql_tzinfo_to_sql_errors.result b/mysql-test/r/mysql_tzinfo_to_sql_errors.result
new file mode 100644
index 000000000000..9a29a909c7c4
--- /dev/null
+++ b/mysql-test/r/mysql_tzinfo_to_sql_errors.result
@@ -0,0 +1,15 @@
+# Bug#36624161: Contribution: mysql_tzinfo_to_sql: suppress expected warnings
+# Non-zoneinfo file (regular mode).
+File 'non_zoneinfo.txt' is not a zoneinfo file
+# Malformed zoneinfo file (regular mode).
+Failed to parse zoneinfo file 'broken_zoneinfo.tzif'
+# Short non-zoneinfo file (regular mode).
+File 'short_non_zoneinfo.bin' is not a zoneinfo file
+# Non-zoneinfo file (--leap mode).
+File 'non_zoneinfo.txt' is not a zoneinfo file
+# Malformed zoneinfo file (--leap mode).
+Failed to parse zoneinfo file 'broken_zoneinfo.tzif'
+# Directory mode: non-zoneinfo file is skipped silently.
+# Directory mode: short non-zoneinfo file is skipped silently.
+# Directory mode: malformed zoneinfo file warning.
+Warning: Failed to parse zoneinfo file 'broken_zoneinfo_dir/broken_zoneinfo.tzif'. Skipping it.
diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result
index 648d7d822c78..d761efb41248 100644
--- a/mysql-test/r/olap.result
+++ b/mysql-test/r/olap.result
@@ -2724,6 +2724,35 @@ COUNT( pk )
0
DROP TABLE t;
#
+# Bug 35722845 - Cannot find column on derived table with given
+# names and ROLLUP
+#
+CREATE TABLE t (a INT);
+INSERT INTO t VALUES (1), (2);
+SELECT s
+FROM (
+SELECT SUM(a)
+FROM t
+GROUP BY a WITH ROLLUP
+) AS dt (s)
+ORDER BY s;
+s
+1
+2
+3
+SELECT S
+FROM (
+SELECT SUM(a) AS s
+FROM t
+GROUP BY a WITH ROLLUP
+) AS dt (S)
+ORDER BY S;
+S
+1
+2
+3
+DROP TABLE t;
+#
# PS-8328: MySQL 8 Crash when using group_concat with group by with
# rollup.
#
diff --git a/mysql-test/r/opt_hints_index_merge_hypergraph.result b/mysql-test/r/opt_hints_index_merge_hypergraph.result
index c782a5d452f6..748f74aea9cd 100644
--- a/mysql-test/r/opt_hints_index_merge_hypergraph.result
+++ b/mysql-test/r/opt_hints_index_merge_hypergraph.result
@@ -39,18 +39,17 @@ EXPLAIN
EXPLAIN SELECT * FROM t1 WHERE f2 BETWEEN 5 AND 6 OR f3 = 'c' OR f4 = 'f';
EXPLAIN
--> Filter: ((t1.f2 between 5 and 6) or (t1.f3 = 'c') or (t1.f4 = 'f')) (rows=48)
- -> Sort-deduplicate by row ID (rows=48)
- -> Index range scan on t1 using f2 over (5 <= f2 <= 6) (rows=16)
- -> Index range scan on t1 using f3 over (f3 = 'c') (rows=16)
- -> Index range scan on t1 using f4 over (f4 = 'f') (rows=16)
+-> Sort-deduplicate by row ID (rows=48)
+ -> Index range scan on t1 using f2 over (5 <= f2 <= 6) (rows=16)
+ -> Index range scan on t1 using f3 over (f3 = 'c') (rows=16)
+ -> Index range scan on t1 using f4 over (f4 = 'f') (rows=16)
EXPLAIN SELECT * FROM t1 WHERE (f2 BETWEEN 5 AND 6 OR f3 = 'c') AND (f2 BETWEEN 5 AND 6 OR f4 = 'f');
EXPLAIN
--> Filter: (((t1.f2 between 5 and 6) or (t1.f3 = 'c')) and ((t1.f2 between 5 and 6) or (t1.f4 = 'f'))) (rows=3.56)
+-> Filter: ((t1.f2 between 5 and 6) or (t1.f4 = 'f')) (rows=3.56)
-> Sort-deduplicate by row ID (rows=32)
-> Index range scan on t1 using f2 over (5 <= f2 <= 6) (rows=16)
- -> Index range scan on t1 using f4 over (f4 = 'f') (rows=16)
+ -> Index range scan on t1 using f3 over (f3 = 'c') (rows=16)
EXPLAIN SELECT f1 FROM t1 WHERE f2 = 5 OR f3 = 'c' OR f4 = 'f';
EXPLAIN
@@ -446,14 +445,14 @@ EXPLAIN
SET optimizer_switch='index_merge_sort_union=off,index_merge=off';
EXPLAIN SELECT /*+ INDEX_MERGE(t1 f2, f4) */ * FROM t1 WHERE (f2 BETWEEN 5 AND 6 OR f3 = 'c') AND (f2 BETWEEN 5 AND 6 OR f4 = 'f');
EXPLAIN
--> Filter: (((t1.f2 between 5 and 6) or (t1.f3 = 'c')) and ((t1.f2 between 5 and 6) or (t1.f4 = 'f'))) (rows=3.56)
+-> Filter: ((t1.f2 between 5 and 6) or (t1.f3 = 'c')) (rows=3.56)
-> Sort-deduplicate by row ID (rows=32)
-> Index range scan on t1 using f2 over (5 <= f2 <= 6) (rows=16)
-> Index range scan on t1 using f4 over (f4 = 'f') (rows=16)
EXPLAIN SELECT /*+ INDEX_MERGE(t1 f2, f3) */ * FROM t1 WHERE (f2 BETWEEN 5 AND 6 OR f3 = 'c') AND (f2 BETWEEN 5 AND 6 OR f4 = 'f');
EXPLAIN
--> Filter: (((t1.f2 between 5 and 6) or (t1.f3 = 'c')) and ((t1.f2 between 5 and 6) or (t1.f4 = 'f'))) (rows=3.56)
+-> Filter: ((t1.f2 between 5 and 6) or (t1.f4 = 'f')) (rows=3.56)
-> Sort-deduplicate by row ID (rows=32)
-> Index range scan on t1 using f2 over (5 <= f2 <= 6) (rows=16)
-> Index range scan on t1 using f3 over (f3 = 'c') (rows=16)
@@ -468,7 +467,7 @@ Warning 3614 Invalid number of arguments for hint INDEX_MERGE(`t1` `f3`)
EXPLAIN SELECT /*+ INDEX_MERGE(t1 f2, f4) */ * FROM t1
WHERE (f2 BETWEEN 5 AND 6 OR f3 = 'c') AND (f2 BETWEEN 5 AND 6 OR f4 = 'f') AND f3 = 'n';
EXPLAIN
--> Filter: ((t1.f2 between 5 and 6) and (t1.f3 = 'n') and ((t1.f2 between 5 and 6) or (t1.f4 = 'f'))) (rows=0.00617)
+-> Filter: ((t1.f2 between 5 and 6) and (t1.f3 = 'n')) (rows=0.00617)
-> Sort-deduplicate by row ID (rows=32)
-> Index range scan on t1 using f2 over (5 <= f2 <= 6) (rows=16)
-> Index range scan on t1 using f4 over (f4 = 'f') (rows=16)
@@ -486,14 +485,14 @@ EXPLAIN
EXPLAIN SELECT /*+ NO_INDEX_MERGE(t1 f4) */ * FROM t1 WHERE (f2 BETWEEN 5 AND 6 OR f3 = 'c') AND (f2 BETWEEN 5 AND 6 OR f4 = 'f');
EXPLAIN
--> Filter: (((t1.f2 between 5 and 6) or (t1.f3 = 'c')) and ((t1.f2 between 5 and 6) or (t1.f4 = 'f'))) (rows=3.56)
+-> Filter: ((t1.f2 between 5 and 6) or (t1.f4 = 'f')) (rows=3.56)
-> Sort-deduplicate by row ID (rows=32)
-> Index range scan on t1 using f2 over (5 <= f2 <= 6) (rows=16)
-> Index range scan on t1 using f3 over (f3 = 'c') (rows=16)
EXPLAIN SELECT /*+ NO_INDEX_MERGE(t1 f3) */ * FROM t1 WHERE (f2 BETWEEN 5 AND 6 OR f3 = 'c') AND (f2 BETWEEN 5 AND 6 OR f4 = 'f');
EXPLAIN
--> Filter: (((t1.f2 between 5 and 6) or (t1.f3 = 'c')) and ((t1.f2 between 5 and 6) or (t1.f4 = 'f'))) (rows=3.56)
+-> Filter: ((t1.f2 between 5 and 6) or (t1.f3 = 'c')) (rows=3.56)
-> Sort-deduplicate by row ID (rows=32)
-> Index range scan on t1 using f2 over (5 <= f2 <= 6) (rows=16)
-> Index range scan on t1 using f4 over (f4 = 'f') (rows=16)
@@ -505,14 +504,14 @@ EXPLAIN
EXPLAIN SELECT /*+ INDEX_MERGE(t1) */ * FROM t1 WHERE (f2 BETWEEN 1 AND 200 OR f3 = 'c') AND (f2 BETWEEN 1 AND 200 OR f4 = 'f');
EXPLAIN
--> Filter: (((t1.f2 between 1 and 200) or (t1.f3 = 'c')) and ((t1.f2 between 1 and 200) or (t1.f4 = 'f'))) (rows=288)
+-> Filter: ((t1.f2 between 1 and 200) or (t1.f4 = 'f')) (rows=288)
-> Sort-deduplicate by row ID (rows=304)
-> Index range scan on t1 using f2 over (1 <= f2 <= 200) (rows=288)
- -> Index range scan on t1 using f4 over (f4 = 'f') (rows=16)
+ -> Index range scan on t1 using f3 over (f3 = 'c') (rows=16)
EXPLAIN SELECT /*+ INDEX_MERGE(t1 f2, f4) */ * FROM t1 WHERE (f2 BETWEEN 1 AND 200 OR f3 = 'c') AND (f2 BETWEEN 1 AND 200 OR f4 = 'f');
EXPLAIN
--> Filter: (((t1.f2 between 1 and 200) or (t1.f3 = 'c')) and ((t1.f2 between 1 and 200) or (t1.f4 = 'f'))) (rows=288)
+-> Filter: ((t1.f2 between 1 and 200) or (t1.f3 = 'c')) (rows=288)
-> Sort-deduplicate by row ID (rows=304)
-> Index range scan on t1 using f2 over (1 <= f2 <= 200) (rows=288)
-> Index range scan on t1 using f4 over (f4 = 'f') (rows=16)
@@ -527,7 +526,7 @@ EXPLAIN
EXPLAIN SELECT /*+ INDEX_MERGE(t1 f2, f3) */ f1 FROM t1 WHERE (f2 = 5 OR f3 = 'c' OR f4 = 'f') AND (f2 BETWEEN 1 AND 200 OR f3 = 'c');
EXPLAIN
--> Filter: (((t1.f2 between 1 and 200) or (t1.f3 = 'c')) and ((t1.f2 = 5) or (t1.f3 = 'c') or (t1.f4 = 'f'))) (rows=40)
+-> Filter: ((t1.f2 = 5) or (t1.f3 = 'c') or (t1.f4 = 'f')) (rows=40)
-> Sort-deduplicate by row ID (rows=304)
-> Index range scan on t1 using f2 over (1 <= f2 <= 200) (rows=288)
-> Index range scan on t1 using f3 over (f3 = 'c') (rows=16)
diff --git a/mysql-test/r/order_by_all.result b/mysql-test/r/order_by_all.result
index b9a0ffc681ba..fd78d826d9e8 100644
--- a/mysql-test/r/order_by_all.result
+++ b/mysql-test/r/order_by_all.result
@@ -394,7 +394,7 @@ a b c
1 NULL b
explain select * from t1 where a = 1 and b is null order by a desc, b desc;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 NULL ref a a 9 const,const 2 100.00 Using where; Using index; Using filesort
+1 SIMPLE t1 NULL ref a a 9 const,const 2 100.00 Using where; Using index
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and (`test`.`t1`.`b` is null)) order by `test`.`t1`.`a` desc,`test`.`t1`.`b` desc
select * from t1 where a = 1 and b is null order by a desc, b desc;
@@ -413,7 +413,7 @@ Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`a` = 2) and (`test`.`t1`.`b` > 0)) order by `test`.`t1`.`a` desc,`test`.`t1`.`b` desc
explain select * from t1 where a = 2 and b is null order by a desc,b desc;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 NULL ref a a 9 const,const 1 100.00 Using where; Using index; Using filesort
+1 SIMPLE t1 NULL ref a a 9 const,const 1 100.00 Using where; Using index
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`a` = 2) and (`test`.`t1`.`b` is null)) order by `test`.`t1`.`a` desc,`test`.`t1`.`b` desc
explain select * from t1 where a = 2 and (b is null or b > 0) order by a
diff --git a/mysql-test/r/order_by_icp_mrr.result b/mysql-test/r/order_by_icp_mrr.result
index 2e66f5c80b75..bba4c0408dde 100644
--- a/mysql-test/r/order_by_icp_mrr.result
+++ b/mysql-test/r/order_by_icp_mrr.result
@@ -394,7 +394,7 @@ a b c
1 NULL b
explain select * from t1 where a = 1 and b is null order by a desc, b desc;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 NULL ref a a 9 const,const 2 100.00 Using where; Using index; Using filesort
+1 SIMPLE t1 NULL ref a a 9 const,const 2 100.00 Using where; Using index
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and (`test`.`t1`.`b` is null)) order by `test`.`t1`.`a` desc,`test`.`t1`.`b` desc
select * from t1 where a = 1 and b is null order by a desc, b desc;
@@ -413,7 +413,7 @@ Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`a` = 2) and (`test`.`t1`.`b` > 0)) order by `test`.`t1`.`a` desc,`test`.`t1`.`b` desc
explain select * from t1 where a = 2 and b is null order by a desc,b desc;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 NULL ref a a 9 const,const 1 100.00 Using where; Using index; Using filesort
+1 SIMPLE t1 NULL ref a a 9 const,const 1 100.00 Using where; Using index
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`a` = 2) and (`test`.`t1`.`b` is null)) order by `test`.`t1`.`a` desc,`test`.`t1`.`b` desc
explain select * from t1 where a = 2 and (b is null or b > 0) order by a
diff --git a/mysql-test/r/order_by_is_null.result b/mysql-test/r/order_by_is_null.result
new file mode 100644
index 000000000000..6fc540903b75
--- /dev/null
+++ b/mysql-test/r/order_by_is_null.result
@@ -0,0 +1,296 @@
+#
+# Bug#38700622: Optimizer doesn't simplify ORDER BY when
+# field IS NULL
+#
+CREATE TABLE t1 (
+f1 INT PRIMARY KEY AUTO_INCREMENT,
+f2 INT NOT NULL,
+f3 DATETIME DEFAULT NULL,
+f4 VARCHAR(50),
+f5 VARCHAR(20),
+f6 TINYINT,
+f7 VARCHAR(100),
+KEY k1 (f2, f3, f4, f5, f6, f7)
+) ENGINE=InnoDB;
+INSERT INTO t1 (f2, f3, f4, f5, f6, f7) VALUES
+(100, NULL, 'User1', 'Active', 0, 'Item A'),
+(100, NULL, 'User1', 'Active', 0, 'Item B'),
+(100, NULL, 'User1', 'Active', 0, 'Item C'),
+(100, NULL, 'User1', 'Pending', 0, 'Item D'),
+(100, '2024-01-01 10:00:00', 'User1', 'Active', 0, 'Item E'),
+(200, NULL, 'User2', 'Active', 1, 'Item F'),
+(200, NULL, 'User3', 'Pending', 0, 'Item G');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+#
+# Test 1: Basic IS NULL with ORDER BY over f2, f3, f7.
+# Should avoid sorting on f3.
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND f3 IS NULL
+ORDER BY f2, f3, f7;
+EXPLAIN
+-> Sort: t1.f7 (cost=0.713 rows=4)
+ -> Filter: (t1.f3 is null) (cost=0.713 rows=4)
+ -> Covering index lookup on t1 using k1 (f2 = 100, f3 = NULL) (cost=0.713 rows=4)
+
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND f3 IS NULL
+ORDER BY f2, f3, f7;
+f1 f2 f3 f7
+1 100 NULL Item A
+2 100 NULL Item B
+3 100 NULL Item C
+4 100 NULL Item D
+#
+# Test 2: Compound index with IS NULL - No external sort.
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0 AND f7 >= 'Item B'
+ORDER BY f2, f3, f4, f5, f6, f7 ASC
+LIMIT 10;
+EXPLAIN
+-> Limit: 10 row(s) (cost=0.681 rows=2)
+ -> Filter: ((t1.f6 = 0) and (t1.f5 = 'Active') and (t1.f4 = 'User1') and (t1.f2 = 100) and (t1.f3 is null) and (t1.f7 >= 'Item B')) (cost=0.681 rows=2)
+ -> Covering index range scan on t1 using k1 over (f2 = 100 AND f3 = NULL AND f4 = 'User1' AND f5 = 'Active' AND f6 = 0 AND 'Item B' <= f7) (cost=0.681 rows=2)
+
+SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0 AND f7 >= 'Item B'
+ORDER BY f2, f3, f4, f5, f6, f7 ASC
+LIMIT 10;
+f1 f2 f3 f4 f5 f6 f7
+2 100 NULL User1 Active 0 Item B
+3 100 NULL User1 Active 0 Item C
+#
+# Test 3: Mix of equality and IS NULL with all intermediate
+# fields constant. No external sort.
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0
+ORDER BY f2, f3, f4, f5, f6, f7;
+EXPLAIN
+-> Filter: (t1.f3 is null) (cost=0.592 rows=3)
+ -> Covering index lookup on t1 using k1 (f2 = 100, f3 = NULL, f4 = 'User1', f5 = 'Active', f6 = 0) (cost=0.592 rows=3)
+
+SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0
+ORDER BY f2, f3, f4, f5, f6, f7;
+f1 f2 f3 f4 f5 f6 f7
+1 100 NULL User1 Active 0 Item A
+2 100 NULL User1 Active 0 Item B
+3 100 NULL User1 Active 0 Item C
+#
+# Test 4: IS NOT NULL should NOT be treated as constant.
+# Sorting needed.
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f7 FROM t1
+WHERE f3 IS NOT NULL ORDER BY f3, f7;
+EXPLAIN
+-> Sort: t1.f3, t1.f7 (cost=0.95 rows=7)
+ -> Filter: (t1.f3 is not null) (cost=0.95 rows=7)
+ -> Covering index scan on t1 using k1 (cost=0.95 rows=7)
+
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f3 IS NOT NULL ORDER BY f3, f7;
+f1 f2 f3 f7
+5 100 2024-01-01 10:00:00 Item E
+#
+# Test 5: Record optimizer trace marker for constant
+# ORDER BY fields. For hypergraph it would
+# be absent.
+#
+SET optimizer_trace="enabled=on";
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f3 IS NULL
+ORDER BY f2, f3, f7 LIMIT 2;
+f1 f2 f3 f7
+1 100 NULL Item A
+2 100 NULL Item B
+SELECT IF(
+LOCATE('"equals_constant_in_where": true', TRACE) > 0,
+'TRACE: equals_constant_in_where present',
+'TRACE: equals_constant_in_where absent'
+) AS trace_check
+FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+trace_check
+TRACE: equals_constant_in_where present
+SET optimizer_trace="enabled=off";
+#
+# Test 6: OR with IS NULL - field should NOT be treated
+# as constant. So sorting is needed.
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 > '2024-01-01')
+ORDER BY f3, f7;
+EXPLAIN
+-> Sort: t1.f3, t1.f7 (cost=1.34 rows=5)
+ -> Filter: ((t1.f2 = 100) and ((t1.f3 is null) or (t1.f3 > TIMESTAMP'2024-01-01 00:00:00'))) (cost=1.34 rows=5)
+ -> Covering index range scan on t1 using k1 over (f2 = 100 AND f3 = NULL) OR (f2 = 100 AND '2024-01-01 00:00:00' < f3) (cost=1.34 rows=5)
+
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 > '2024-01-01')
+ORDER BY f3, f7;
+f1 f2 f3 f7
+1 100 NULL Item A
+2 100 NULL Item B
+3 100 NULL Item C
+4 100 NULL Item D
+5 100 2024-01-01 10:00:00 Item E
+#
+# Test 7: OR with multiple IS NULL - same field.
+# Will be treated as constant. Sorting will be
+# only on "f7".
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 IS NULL)
+ORDER BY f2, f3, f7;
+EXPLAIN
+-> Sort: t1.f7 (cost=0.713 rows=4)
+ -> Filter: ((t1.f3 is null) or (t1.f3 is null)) (cost=0.713 rows=4)
+ -> Covering index lookup on t1 using k1 (f2 = 100, f3 = NULL) (cost=0.713 rows=4)
+
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 IS NULL)
+ORDER BY f2, f3, f7;
+f1 f2 f3 f7
+1 100 NULL Item A
+2 100 NULL Item B
+3 100 NULL Item C
+4 100 NULL Item D
+#
+# Test 8: OR with <=> NULL and IS NULL on the same field.
+# Tradiitonal optimizer treats f3 as constant;
+# hypergraph keeps f3 in the sort (Bug#39567745).
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 <=> NULL OR f3 IS NULL)
+ORDER BY f2, f3, f7;
+EXPLAIN
+-> Sort: t1.f7 (cost=0.713 rows=4)
+ -> Filter: ((t1.f3 <=> NULL) or (t1.f3 is null)) (cost=0.713 rows=4)
+ -> Covering index lookup on t1 using k1 (f2 = 100, f3 = NULL) (cost=0.713 rows=4)
+
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 <=> NULL OR f3 IS NULL)
+ORDER BY f2, f3, f7;
+f1 f2 f3 f7
+1 100 NULL Item A
+2 100 NULL Item B
+3 100 NULL Item C
+4 100 NULL Item D
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 <=> NULL)
+ORDER BY f2, f3, f7;
+EXPLAIN
+-> Sort: t1.f7 (cost=0.713 rows=4)
+ -> Filter: ((t1.f3 is null) or (t1.f3 <=> NULL)) (cost=0.713 rows=4)
+ -> Covering index lookup on t1 using k1 (f2 = 100, f3 = NULL) (cost=0.713 rows=4)
+
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 <=> NULL)
+ORDER BY f2, f3, f7;
+f1 f2 f3 f7
+1 100 NULL Item A
+2 100 NULL Item B
+3 100 NULL Item C
+4 100 NULL Item D
+#
+# Test 9: Verify IS NULL works with DESC ordering
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0
+ORDER BY f2, f3, f4, f5, f6, f7 DESC;
+EXPLAIN
+-> Filter: (t1.f3 is null) (cost=0.592 rows=3)
+ -> Covering index lookup on t1 using k1 (f2 = 100, f3 = NULL, f4 = 'User1', f5 = 'Active', f6 = 0) (reverse) (cost=0.592 rows=3)
+
+SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0
+ORDER BY f2, f3, f4, f5, f6, f7 DESC;
+f1 f2 f3 f4 f5 f6 f7
+3 100 NULL User1 Active 0 Item C
+2 100 NULL User1 Active 0 Item B
+1 100 NULL User1 Active 0 Item A
+#
+# Test 10: Verify NULL ordering semantics with ASC
+#
+CREATE TABLE t2 (
+f1 INT PRIMARY KEY AUTO_INCREMENT,
+f2 INT,
+f3 VARCHAR(10),
+KEY k1 (f2, f3)
+);
+INSERT INTO t2 (f2, f3) VALUES
+(NULL, 'null1'),
+(NULL, 'null2'),
+(5, 'five'),
+(10, 'ten'),
+(NULL, 'null3'),
+(1, 'one');
+ANALYZE TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status OK
+SELECT f1, f2, f3 FROM t2 ORDER BY f2 ASC, f3 ASC;
+f1 f2 f3
+1 NULL null1
+2 NULL null2
+5 NULL null3
+6 1 one
+3 5 five
+4 10 ten
+#
+# Test 11: Verify NULL ordering semantics with DESC
+#
+SELECT f1, f2, f3 FROM t2 ORDER BY f2 DESC, f3 ASC;
+f1 f2 f3
+4 10 ten
+3 5 five
+6 1 one
+1 NULL null1
+2 NULL null2
+5 NULL null3
+#
+# Test 12: Verify optimization works with DESC and preserves NULL ordering
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3 FROM t2
+WHERE f2 IS NULL ORDER BY f2 DESC, f3 ASC;
+EXPLAIN
+-> Filter: (t2.f2 is null) (cost=0.553 rows=3)
+ -> Covering index lookup on t2 using k1 (f2 = NULL) (cost=0.553 rows=3)
+
+SELECT f1, f2, f3 FROM t2
+WHERE f2 IS NULL ORDER BY f2 DESC, f3 ASC;
+f1 f2 f3
+1 NULL null1
+2 NULL null2
+5 NULL null3
+#
+# Test 13: Mixed ASC/DESC with IS NULL constraint
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3 FROM t2
+WHERE f2 IS NULL ORDER BY f2 ASC, f3 DESC;
+EXPLAIN
+-> Filter: (t2.f2 is null) (cost=0.553 rows=3)
+ -> Covering index lookup on t2 using k1 (f2 = NULL) (reverse) (cost=0.553 rows=3)
+
+SELECT f1, f2, f3 FROM t2
+WHERE f2 IS NULL ORDER BY f2 ASC, f3 DESC;
+f1 f2 f3
+5 NULL null3
+2 NULL null2
+1 NULL null1
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/r/order_by_is_null_hypergraph.result b/mysql-test/r/order_by_is_null_hypergraph.result
new file mode 100644
index 000000000000..64eadb99fbec
--- /dev/null
+++ b/mysql-test/r/order_by_is_null_hypergraph.result
@@ -0,0 +1,290 @@
+#
+# Bug#38700622: Optimizer doesn't simplify ORDER BY when
+# field IS NULL
+#
+CREATE TABLE t1 (
+f1 INT PRIMARY KEY AUTO_INCREMENT,
+f2 INT NOT NULL,
+f3 DATETIME DEFAULT NULL,
+f4 VARCHAR(50),
+f5 VARCHAR(20),
+f6 TINYINT,
+f7 VARCHAR(100),
+KEY k1 (f2, f3, f4, f5, f6, f7)
+) ENGINE=InnoDB;
+INSERT INTO t1 (f2, f3, f4, f5, f6, f7) VALUES
+(100, NULL, 'User1', 'Active', 0, 'Item A'),
+(100, NULL, 'User1', 'Active', 0, 'Item B'),
+(100, NULL, 'User1', 'Active', 0, 'Item C'),
+(100, NULL, 'User1', 'Pending', 0, 'Item D'),
+(100, '2024-01-01 10:00:00', 'User1', 'Active', 0, 'Item E'),
+(200, NULL, 'User2', 'Active', 1, 'Item F'),
+(200, NULL, 'User3', 'Pending', 0, 'Item G');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+#
+# Test 1: Basic IS NULL with ORDER BY over f2, f3, f7.
+# Should avoid sorting on f3.
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND f3 IS NULL
+ORDER BY f2, f3, f7;
+EXPLAIN
+-> Sort: t1.f7 (cost=6.48..6.48 rows=4)
+ -> Covering index lookup on t1 using k1 (f2 = 100, f3 = NULL) (cost=1.21..4.84 rows=4)
+
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND f3 IS NULL
+ORDER BY f2, f3, f7;
+f1 f2 f3 f7
+1 100 NULL Item A
+2 100 NULL Item B
+3 100 NULL Item C
+4 100 NULL Item D
+#
+# Test 2: Compound index with IS NULL - No external sort.
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0 AND f7 >= 'Item B'
+ORDER BY f2, f3, f4, f5, f6, f7 ASC
+LIMIT 10;
+EXPLAIN
+-> Limit: 10 row(s) (cost=0.957..1.91 rows=2)
+ -> Filter: (t1.f7 >= 'Item B') (cost=0.957..1.91 rows=2)
+ -> Covering index lookup on t1 using k1 (f2 = 100, f3 = NULL, f4 = 'User1', f5 = 'Active', f6 = 0) (cost=0.953..1.91 rows=2)
+
+SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0 AND f7 >= 'Item B'
+ORDER BY f2, f3, f4, f5, f6, f7 ASC
+LIMIT 10;
+f1 f2 f3 f4 f5 f6 f7
+2 100 NULL User1 Active 0 Item B
+3 100 NULL User1 Active 0 Item C
+#
+# Test 3: Mix of equality and IS NULL with all intermediate
+# fields constant. No external sort.
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0
+ORDER BY f2, f3, f4, f5, f6, f7;
+EXPLAIN
+-> Covering index lookup on t1 using k1 (f2 = 100, f3 = NULL, f4 = 'User1', f5 = 'Active', f6 = 0) (cost=0.635..1.91 rows=3)
+
+SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0
+ORDER BY f2, f3, f4, f5, f6, f7;
+f1 f2 f3 f4 f5 f6 f7
+1 100 NULL User1 Active 0 Item A
+2 100 NULL User1 Active 0 Item B
+3 100 NULL User1 Active 0 Item C
+#
+# Test 4: IS NOT NULL should NOT be treated as constant.
+# Sorting needed.
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f7 FROM t1
+WHERE f3 IS NOT NULL ORDER BY f3, f7;
+EXPLAIN
+-> Sort: t1.f3, t1.f7 (cost=17.4..17.4 rows=6.3)
+ -> Filter: (t1.f3 is not null) (cost=2.33..14.7 rows=6.3)
+ -> Index scan on t1 using PRIMARY (cost=2.04..14.3 rows=7)
+
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f3 IS NOT NULL ORDER BY f3, f7;
+f1 f2 f3 f7
+5 100 2024-01-01 10:00:00 Item E
+#
+# Test 5: Record optimizer trace marker for constant
+# ORDER BY fields. For hypergraph it would
+# be absent.
+#
+SET optimizer_trace="enabled=on";
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f3 IS NULL
+ORDER BY f2, f3, f7 LIMIT 2;
+f1 f2 f3 f7
+1 100 NULL Item A
+2 100 NULL Item B
+SELECT IF(
+LOCATE('"equals_constant_in_where": true', TRACE) > 0,
+'TRACE: equals_constant_in_where present',
+'TRACE: equals_constant_in_where absent'
+) AS trace_check
+FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+trace_check
+TRACE: equals_constant_in_where absent
+SET optimizer_trace="enabled=off";
+#
+# Test 6: OR with IS NULL - field should NOT be treated
+# as constant. So sorting is needed.
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 > '2024-01-01')
+ORDER BY f3, f7;
+EXPLAIN
+-> Sort: t1.f3, t1.f7 (cost=10.7..10.7 rows=5)
+ -> Filter: ((t1.f3 is null) or (t1.f3 > TIMESTAMP'2024-01-01 00:00:00')) (cost=1.72..8.62 rows=5)
+ -> Covering index lookup on t1 using k1 (f2 = 100) (cost=1.68..8.42 rows=5)
+
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 > '2024-01-01')
+ORDER BY f3, f7;
+f1 f2 f3 f7
+1 100 NULL Item A
+2 100 NULL Item B
+3 100 NULL Item C
+4 100 NULL Item D
+5 100 2024-01-01 10:00:00 Item E
+#
+# Test 7: OR with multiple IS NULL - same field.
+# Will be treated as constant. Sorting will be
+# only on "f7".
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 IS NULL)
+ORDER BY f2, f3, f7;
+EXPLAIN
+-> Sort: t1.f7 (cost=6.48..6.48 rows=4)
+ -> Covering index lookup on t1 using k1 (f2 = 100, f3 = NULL) (cost=1.21..4.84 rows=4)
+
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 IS NULL)
+ORDER BY f2, f3, f7;
+f1 f2 f3 f7
+1 100 NULL Item A
+2 100 NULL Item B
+3 100 NULL Item C
+4 100 NULL Item D
+#
+# Test 8: OR with <=> NULL and IS NULL on the same field.
+# Tradiitonal optimizer treats f3 as constant;
+# hypergraph keeps f3 in the sort (Bug#39567745).
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 <=> NULL OR f3 IS NULL)
+ORDER BY f2, f3, f7;
+EXPLAIN
+-> Sort: t1.f3, t1.f7 (cost=10.3..10.3 rows=4)
+ -> Filter: ((t1.f3 <=> NULL) or (t1.f3 is null)) (cost=2.16..8.62 rows=4)
+ -> Covering index lookup on t1 using k1 (f2 = 100) (cost=2.11..8.42 rows=4)
+
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 <=> NULL OR f3 IS NULL)
+ORDER BY f2, f3, f7;
+f1 f2 f3 f7
+1 100 NULL Item A
+2 100 NULL Item B
+3 100 NULL Item C
+4 100 NULL Item D
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 <=> NULL)
+ORDER BY f2, f3, f7;
+EXPLAIN
+-> Sort: t1.f3, t1.f7 (cost=10.3..10.3 rows=4)
+ -> Filter: ((t1.f3 is null) or (t1.f3 <=> NULL)) (cost=2.16..8.62 rows=4)
+ -> Covering index lookup on t1 using k1 (f2 = 100) (cost=2.11..8.42 rows=4)
+
+SELECT f1, f2, f3, f7 FROM t1
+WHERE f2 = 100 AND (f3 IS NULL OR f3 <=> NULL)
+ORDER BY f2, f3, f7;
+f1 f2 f3 f7
+1 100 NULL Item A
+2 100 NULL Item B
+3 100 NULL Item C
+4 100 NULL Item D
+#
+# Test 9: Verify IS NULL works with DESC ordering
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0
+ORDER BY f2, f3, f4, f5, f6, f7 DESC;
+EXPLAIN
+-> Covering index lookup on t1 using k1 (f2 = 100, f3 = NULL, f4 = 'User1', f5 = 'Active', f6 = 0) (reverse) (cost=0.635..1.91 rows=3)
+
+SELECT f1, f2, f3, f4, f5, f6, f7
+FROM t1
+WHERE f2 = 100 AND f3 IS NULL AND f4 = 'User1'
+ AND f5 = 'Active' AND f6 = 0
+ORDER BY f2, f3, f4, f5, f6, f7 DESC;
+f1 f2 f3 f4 f5 f6 f7
+3 100 NULL User1 Active 0 Item C
+2 100 NULL User1 Active 0 Item B
+1 100 NULL User1 Active 0 Item A
+#
+# Test 10: Verify NULL ordering semantics with ASC
+#
+CREATE TABLE t2 (
+f1 INT PRIMARY KEY AUTO_INCREMENT,
+f2 INT,
+f3 VARCHAR(10),
+KEY k1 (f2, f3)
+);
+INSERT INTO t2 (f2, f3) VALUES
+(NULL, 'null1'),
+(NULL, 'null2'),
+(5, 'five'),
+(10, 'ten'),
+(NULL, 'null3'),
+(1, 'one');
+ANALYZE TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status OK
+SELECT f1, f2, f3 FROM t2 ORDER BY f2 ASC, f3 ASC;
+f1 f2 f3
+1 NULL null1
+2 NULL null2
+5 NULL null3
+6 1 one
+3 5 five
+4 10 ten
+#
+# Test 11: Verify NULL ordering semantics with DESC
+#
+SELECT f1, f2, f3 FROM t2 ORDER BY f2 DESC, f3 ASC;
+f1 f2 f3
+4 10 ten
+3 5 five
+6 1 one
+1 NULL null1
+2 NULL null2
+5 NULL null3
+#
+# Test 12: Verify optimization works with DESC and preserves NULL ordering
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3 FROM t2
+WHERE f2 IS NULL ORDER BY f2 DESC, f3 ASC;
+EXPLAIN
+-> Covering index lookup on t2 using k1 (f2 = NULL) (cost=0.779..2.34 rows=3)
+
+SELECT f1, f2, f3 FROM t2
+WHERE f2 IS NULL ORDER BY f2 DESC, f3 ASC;
+f1 f2 f3
+1 NULL null1
+2 NULL null2
+5 NULL null3
+#
+# Test 13: Mixed ASC/DESC with IS NULL constraint
+#
+EXPLAIN FORMAT=tree SELECT f1, f2, f3 FROM t2
+WHERE f2 IS NULL ORDER BY f2 ASC, f3 DESC;
+EXPLAIN
+-> Covering index lookup on t2 using k1 (f2 = NULL) (reverse) (cost=0.779..2.34 rows=3)
+
+SELECT f1, f2, f3 FROM t2
+WHERE f2 IS NULL ORDER BY f2 ASC, f3 DESC;
+f1 f2 f3
+5 NULL null3
+2 NULL null2
+1 NULL null1
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/r/order_by_limit.result b/mysql-test/r/order_by_limit.result
index 5b5dc6b6381e..7b2be3a44e24 100644
--- a/mysql-test/r/order_by_limit.result
+++ b/mysql-test/r/order_by_limit.result
@@ -796,3 +796,84 @@ Note 1003 /* select#1 */ select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`i2` AS `i2
SET @@GLOBAL.DEBUG= '-d,prefer_ordering_index_check';
SET optimizer_switch = DEFAULT;
drop table t0, t1, t2;
+#
+# Bug#38564020: Optimizer with reverse index range scan
+# gives incorrect query result
+#
+CREATE TABLE t1(f1 INTEGER, f2 INTEGER, f3 INTEGER, PRIMARY KEY(f1), KEY key1(f2));
+INSERT INTO t1 VALUES (10,1,2), (20,1,2), (30,1,3),(40,1,4);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+EXPLAIN FORMAT=tree SELECT * FROM t1 WHERE f2 >= 1 AND f2 <= 1 ORDER BY f2 DESC, f1 DESC LIMIT 1;
+EXPLAIN
+-> Limit: 1 row(s) (cost=2.06 rows=1)
+ -> Index range scan on t1 using key1 over (f2 = 1) (reverse), with index condition: ((t1.f2 >= 1) and (t1.f2 <= 1)) (cost=2.06 rows=4)
+
+SELECT * FROM t1 WHERE f2 >= 1 AND f2 <= 1 ORDER BY f2 DESC, f1 DESC LIMIT 1;
+f1 f2 f3
+40 1 4
+EXPLAIN FORMAT=tree SELECT * FROM t1 WHERE f2 >= 1 AND f2 <= 1 ORDER BY f2 DESC, f1 DESC LIMIT 2;
+EXPLAIN
+-> Limit: 2 row(s) (cost=2.06 rows=2)
+ -> Index range scan on t1 using key1 over (f2 = 1) (reverse), with index condition: ((t1.f2 >= 1) and (t1.f2 <= 1)) (cost=2.06 rows=4)
+
+SELECT * FROM t1 WHERE f2 >= 1 AND f2 <= 1 ORDER BY f2 DESC, f1 DESC LIMIT 2;
+f1 f2 f3
+40 1 4
+30 1 3
+EXPLAIN FORMAT=tree SELECT * FROM t1 WHERE f2 >= 1 AND f2 <= 1 ORDER BY f2 DESC, f1 DESC LIMIT 4;
+EXPLAIN
+-> Limit: 4 row(s) (cost=2.06 rows=4)
+ -> Index range scan on t1 using key1 over (f2 = 1) (reverse), with index condition: ((t1.f2 >= 1) and (t1.f2 <= 1)) (cost=2.06 rows=4)
+
+SELECT * FROM t1 WHERE f2 >= 1 AND f2 <= 1 ORDER BY f2 DESC, f1 DESC LIMIT 4;
+f1 f2 f3
+40 1 4
+30 1 3
+20 1 2
+10 1 2
+DROP TABLE t1;
+#
+# Bug#38406661: Sort optimization fails as primary key info in
+# secondary index is not considered after
+# hint-enforced secondary index
+CREATE TABLE t1 (
+pk_1 INT,
+pk_2 INT,
+f1 DATETIME,
+PRIMARY KEY(pk_1, pk_2),
+KEY k1(f1)
+);
+INSERT INTO t1 VALUES
+(1,1,'2000-01-01'), (1,2,'2000-01-02'), (1,3,'2000-01-03'),
+(1,4,'2000-01-04'), (1,5,'2000-01-05'), (2,1,'2000-01-01'),
+(2,2,'2000-01-02'), (2,3,'2000-01-03'), (2,4,'2000-01-04'),
+(2,5,'2000-01-05'), (3,1,'2000-01-01'), (3,2,'2000-01-02'),
+(3,3,'2000-01-03'), (3,4,'2000-01-04'), (3,5,'2000-01-05');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+no index hint, should use covering index lookup on k1 in reverse and no Sort
+EXPLAIN FORMAT=tree SELECT f1, pk_1, pk_2 FROM t1 WHERE pk_1 = 3 AND f1 = '2000-01-03'
+ ORDER BY pk_2 DESC LIMIT 5;
+EXPLAIN
+-> Limit: 5 row(s) (rows=1)
+ -> Covering index lookup on t1 using k1 (f1 = TIMESTAMP'2000-01-03 00:00:00', pk_1 = 3) (reverse) (rows=1)
+
+SELECT f1, pk_1, pk_2 FROM t1 WHERE pk_1 = 3 AND f1 = '2000-01-03'
+ ORDER BY pk_2 DESC LIMIT 5;
+f1 pk_1 pk_2
+2000-01-03 00:00:00 3 3
+With index hint on k1, should still avoid Sort and use reverse index order
+EXPLAIN FORMAT=tree SELECT /*+ INDEX(t1 k1) */ f1, pk_1, pk_2 FROM t1
+WHERE pk_1 = 3 AND f1 = '2000-01-03' ORDER BY pk_2 DESC LIMIT 5;
+EXPLAIN
+-> Limit: 5 row(s) (rows=1)
+ -> Covering index lookup on t1 using k1 (f1 = TIMESTAMP'2000-01-03 00:00:00', pk_1 = 3) (reverse) (rows=1)
+
+SELECT /*+ INDEX(t1 k1) */ f1, pk_1, pk_2 FROM t1
+WHERE pk_1 = 3 AND f1 = '2000-01-03' ORDER BY pk_2 DESC LIMIT 5;
+f1 pk_1 pk_2
+2000-01-03 00:00:00 3 3
+DROP TABLE t1;
diff --git a/mysql-test/r/order_by_none.result b/mysql-test/r/order_by_none.result
index 220df32e7c3f..5f899ae9960b 100644
--- a/mysql-test/r/order_by_none.result
+++ b/mysql-test/r/order_by_none.result
@@ -393,7 +393,7 @@ a b c
1 NULL b
explain select * from t1 where a = 1 and b is null order by a desc, b desc;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 NULL ref a a 9 const,const 2 100.00 Using where; Using index; Using filesort
+1 SIMPLE t1 NULL ref a a 9 const,const 2 100.00 Using where; Using index
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and (`test`.`t1`.`b` is null)) order by `test`.`t1`.`a` desc,`test`.`t1`.`b` desc
select * from t1 where a = 1 and b is null order by a desc, b desc;
@@ -412,7 +412,7 @@ Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`a` = 2) and (`test`.`t1`.`b` > 0)) order by `test`.`t1`.`a` desc,`test`.`t1`.`b` desc
explain select * from t1 where a = 2 and b is null order by a desc,b desc;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 NULL ref a a 9 const,const 1 100.00 Using where; Using index; Using filesort
+1 SIMPLE t1 NULL ref a a 9 const,const 1 100.00 Using where; Using index
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`a` = 2) and (`test`.`t1`.`b` is null)) order by `test`.`t1`.`a` desc,`test`.`t1`.`b` desc
explain select * from t1 where a = 2 and (b is null or b > 0) order by a
diff --git a/mysql-test/r/skip_records_in_range.result b/mysql-test/r/skip_records_in_range.result
index 24b5899d7522..3cfd0a55e7aa 100644
--- a/mysql-test/r/skip_records_in_range.result
+++ b/mysql-test/r/skip_records_in_range.result
@@ -532,3 +532,148 @@ select * from v1;
v3
DROP VIEW v1;
DROP TABLE t1;
+#
+# Bug#37727982: FORCE INDEX does not skip records_in_range() for
+# IS NOT NULL
+#
+CREATE TABLE t1 (c1 INT, KEY (c1));
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (NULL), (NULL);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SET SESSION DEBUG="+d,crash_records_in_range";
+SELECT * FROM t1 FORCE INDEX(c1) WHERE c1 > 0;
+c1
+1
+2
+3
+4
+5
+6
+7
+8
+SELECT * FROM t1 FORCE INDEX(c1) WHERE c1 IS NOT NULL;
+c1
+1
+2
+3
+4
+5
+6
+7
+8
+SET SESSION DEBUG="-d,crash_records_in_range";
+DROP TABLE t1;
+#
+# Bug#37751691 (Bug#117791): FORCE INDEX does not skip records_in_range()
+# for 'x IS NULL'
+#
+CREATE TABLE t1 (c1 INT, UNIQUE KEY (c1));
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (NULL), (NULL);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+set debug='+d,crash_records_in_range';
+EXPLAIN SELECT * FROM t1 FORCE INDEX(c1) WHERE c1 IS NULL;
+id select_type table partitions type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 NULL ref c1 c1 5 const 1 100.00 Using where; Using index
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` FORCE INDEX (`c1`) where (`test`.`t1`.`c1` is null)
+set debug='-d,crash_records_in_range';
+DROP TABLE t1;
+# Verify that, for non-unique indexes, when index dives are skipped
+# due to eq_range_index_dive_limit, records_in_range() is also skipped
+# for an IS NULL range.
+SET @save_eq_range_index_dive_limit=@@SESSION.eq_range_index_dive_limit;
+SET SESSION eq_range_index_dive_limit=3;
+CREATE TABLE t1 (c1 INT, KEY(c1));
+INSERT INTO t1 VALUES
+(NULL), (NULL), (NULL), (NULL), (NULL),
+(NULL), (NULL), (NULL), (NULL), (NULL),
+(NULL), (NULL), (NULL), (NULL), (NULL),
+(NULL), (NULL), (NULL), (NULL), (NULL),
+(1), (2), (3);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+EXPLAIN SELECT * FROM t1 WHERE c1 IS NULL OR c1 IN (1);
+id select_type table partitions type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 NULL ref_or_null c1 c1 5 const 21 100.00 Using where; Using index
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((`test`.`t1`.`c1` is null) or (`test`.`t1`.`c1` = 1))
+EXPLAIN SELECT * FROM t1 WHERE c1 IS NULL OR c1 IN (1, 2);
+id select_type table partitions type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 NULL range c1 c1 5 NULL 22 100.00 Using where; Using index
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((`test`.`t1`.`c1` is null) or (`test`.`t1`.`c1` in (1,2)))
+set debug='+d,crash_records_in_range';
+EXPLAIN SELECT * FROM t1 WHERE c1 IS NULL OR c1 IN (1, 2, 3);
+id select_type table partitions type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 NULL range c1 c1 5 NULL 20 100.00 Using where; Using index
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((`test`.`t1`.`c1` is null) or (`test`.`t1`.`c1` in (1,2,3)))
+set debug='-d,crash_records_in_range';
+# For unique indexes, the index dive limit currently does not apply
+# if there is an IS NULL condition. (See Bug#39586297 / Bug#120729)
+ALTER TABLE t1 DROP INDEX c1, ADD UNIQUE INDEX c1u(c1);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+EXPLAIN SELECT * FROM t1 WHERE c1 IS NULL OR c1 IN (1, 2, 3, 4);
+id select_type table partitions type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 NULL index c1u c1u 5 NULL 23 100.00 Using where; Using index
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((`test`.`t1`.`c1` is null) or (`test`.`t1`.`c1` in (1,2,3,4)))
+DROP TABLE t1;
+SET SESSION eq_range_index_dive_limit=@save_eq_range_index_dive_limit;
+#
+# Verify that index statistics are checked for the right index.
+#
+SET @save_eq_range_index_dive_limit=@@SESSION.eq_range_index_dive_limit;
+SET SESSION eq_range_index_dive_limit=2;
+CREATE TABLE t1 (
+a INT,
+c1 INT,
+c2 INT,
+KEY a(a),
+KEY c1_c2(c1, c2)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0,1,1), (0,2,2), (0,3,3), (0,4,4);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
+WHERE (c1 = 1 AND c2 = 1) OR (c1 = 2 AND c2 = 2);
+id select_type table partitions type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 NULL range c1_c2 c1_c2 10 NULL 2 100.00 Using index condition
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` IGNORE INDEX (`a`) where (((`test`.`t1`.`c2` = 1) and (`test`.`t1`.`c1` = 1)) or ((`test`.`t1`.`c2` = 2) and (`test`.`t1`.`c1` = 2)))
+DROP TABLE t1;
+SET SESSION eq_range_index_dive_limit=@save_eq_range_index_dive_limit;
+#
+# Equality ranges without records_per_key must use records_in_range()
+#
+SET @save_eq_range_index_dive_limit=@@SESSION.eq_range_index_dive_limit;
+SET SESSION eq_range_index_dive_limit=1;
+CREATE TABLE t1 (
+c1 INT,
+KEY i1 USING HASH (c1)
+) ENGINE=MEMORY;
+INSERT INTO t1 VALUES
+(1),(1),(1),(1),(1),(1),(1),(1),(1),(1),
+(1),(1),(1),(1),(1),(1),(1),(1),(1),(1),
+(2),
+(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
+EXPLAIN SELECT * FROM t1 WHERE c1 IN (1, 2);
+id select_type table partitions type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 NULL range i1 i1 5 NULL 4 100.00 Using where
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (`test`.`t1`.`c1` in (1,2))
+ALTER TABLE t1 DROP INDEX i1, ADD INDEX i2 USING BTREE (c1);
+EXPLAIN SELECT * FROM t1 WHERE c1 IN (1, 2);
+id select_type table partitions type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 NULL range i2 i2 5 NULL # 100.00 Using where
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (`test`.`t1`.`c1` in (1,2))
+DROP TABLE t1;
+SET SESSION eq_range_index_dive_limit=@save_eq_range_index_dive_limit;
diff --git a/mysql-test/r/skip_scan_hypergraph.result b/mysql-test/r/skip_scan_hypergraph.result
index 04e2d867bb1d..beb3e1021785 100644
--- a/mysql-test/r/skip_scan_hypergraph.result
+++ b/mysql-test/r/skip_scan_hypergraph.result
@@ -477,7 +477,7 @@ include/diff_tables.inc [test.hint_skip_scan, test.no_skip_scan]
set optimizer_switch = 'skip_scan=on';
EXPLAIN FORMAT=TREE SELECT b, c FROM t WHERE b BETWEEN 1 AND 2 AND c > 4;
EXPLAIN
--> Filter: ((t.b between 1 and 2) and (t.c > 4)) (rows=5.92)
+-> Filter: (t.c > 4) (rows=5.92)
-> Covering index skip scan on t using b over 1 <= b <= 2 (rows=17)
FLUSH STATUS;
@@ -511,7 +511,7 @@ Handler_read_rnd_next 0
include/diff_tables.inc [test.skip_scan, test.no_skip_scan]
EXPLAIN FORMAT=TREE SELECT /*+ SKIP_SCAN(t) */ b, c FROM t WHERE b BETWEEN 1 AND 2 AND c > 4;
EXPLAIN
--> Filter: ((t.b between 1 and 2) and (t.c > 4)) (rows=5.92)
+-> Filter: (t.c > 4) (rows=5.92)
-> Covering index skip scan on t using b over 1 <= b <= 2 (rows=17)
FLUSH STATUS;
@@ -1283,7 +1283,7 @@ include/diff_tables.inc [test.hint_skip_scan, test.no_skip_scan]
set optimizer_switch = 'skip_scan=on';
EXPLAIN FORMAT=TREE SELECT b, c, d FROM t WHERE b = 2 AND c BETWEEN 3 AND 5 AND d < 3;
EXPLAIN
--> Filter: ((t.b = 2) and (t.c between 3 and 5) and (t.d < 3)) (rows=0.419)
+-> Filter: ((t.c between 3 and 5) and (t.d < 3)) (rows=0.419)
-> Covering index skip scan on t using a over b = 2 (rows=16)
FLUSH STATUS;
@@ -1317,7 +1317,7 @@ Handler_read_rnd_next 0
include/diff_tables.inc [test.skip_scan, test.no_skip_scan]
EXPLAIN FORMAT=TREE SELECT /*+ SKIP_SCAN(t) */ b, c, d FROM t WHERE b = 2 AND c BETWEEN 3 AND 5 AND d < 3;
EXPLAIN
--> Filter: ((t.b = 2) and (t.c between 3 and 5) and (t.d < 3)) (rows=0.419)
+-> Filter: ((t.c between 3 and 5) and (t.d < 3)) (rows=0.419)
-> Covering index skip scan on t using a over b = 2 (rows=16)
FLUSH STATUS;
@@ -1335,7 +1335,7 @@ include/diff_tables.inc [test.hint_skip_scan, test.no_skip_scan]
set optimizer_switch = 'skip_scan=on';
EXPLAIN FORMAT=TREE SELECT b, c, d FROM t WHERE b BETWEEN 3 AND 5 AND d < 3;
EXPLAIN
--> Filter: ((t.b between 3 and 5) and (t.d < 3)) (rows=5.92)
+-> Filter: (t.d < 3) (rows=5.92)
-> Covering index skip scan on t using a over 3 <= b <= 5 (rows=17)
FLUSH STATUS;
@@ -1369,7 +1369,7 @@ Handler_read_rnd_next 0
include/diff_tables.inc [test.skip_scan, test.no_skip_scan]
EXPLAIN FORMAT=TREE SELECT /*+ SKIP_SCAN(t) */ b, c, d FROM t WHERE b BETWEEN 3 AND 5 AND d < 3;
EXPLAIN
--> Filter: ((t.b between 3 and 5) and (t.d < 3)) (rows=5.92)
+-> Filter: (t.d < 3) (rows=5.92)
-> Covering index skip scan on t using a over 3 <= b <= 5 (rows=17)
FLUSH STATUS;
@@ -1590,8 +1590,7 @@ Handler_read_rnd_next 0
include/diff_tables.inc [test.skip_scan, test.no_skip_scan]
EXPLAIN FORMAT=TREE SELECT /*+ SKIP_SCAN(t1) */ a, b, c, d FROM t1 WHERE (a IN (1, 5) or a IS NULL) AND b in (1, 2) AND d BETWEEN 2 AND 5;
EXPLAIN
--> Filter: ((t1.d between 2 and 5) and (t1.b in (1,2)) and ((t1.a in (1,5)) or (t1.a is null))) (rows=3.78)
- -> Covering index skip scan on t1 using k1 over a IN (5, 1, NULL), b IN (1, 2), 2 <= d <= 5 (rows=34)
+-> Covering index skip scan on t1 using k1 over a IN (5, 1, NULL), b IN (1, 2), 2 <= d <= 5 (rows=3.78)
FLUSH STATUS;
SELECT /*+ SKIP_SCAN(t1) */ a, b, c, d FROM t1 WHERE (a IN (1, 5) or a IS NULL) AND b in (1, 2) AND d BETWEEN 2 AND 5;
@@ -1656,8 +1655,7 @@ Handler_read_rnd_next 0
include/diff_tables.inc [test.skip_scan, test.no_skip_scan]
EXPLAIN FORMAT=TREE SELECT /*+ SKIP_SCAN(t1) */ a, b, c, d FROM t1 WHERE (a IN (1, 5) or a IS NULL) AND b in (1, 2) AND d BETWEEN 2 AND 5;
EXPLAIN
--> Filter: ((t1.d between 2 and 5) and (t1.b in (1,2)) and ((t1.a in (1,5)) or (t1.a is null))) (rows=3.78)
- -> Covering index skip scan on t1 using k1 over a IN (NULL, 1, 5), b IN (2, 1), 5 <= d <= 2 (rows=34)
+-> Covering index skip scan on t1 using k1 over a IN (NULL, 1, 5), b IN (2, 1), 5 <= d <= 2 (rows=3.78)
FLUSH STATUS;
SELECT /*+ SKIP_SCAN(t1) */ a, b, c, d FROM t1 WHERE (a IN (1, 5) or a IS NULL) AND b in (1, 2) AND d BETWEEN 2 AND 5;
diff --git a/mysql-test/r/subquery_mat.result b/mysql-test/r/subquery_mat.result
index 00bda2d51198..19a23aecd1fd 100644
--- a/mysql-test/r/subquery_mat.result
+++ b/mysql-test/r/subquery_mat.result
@@ -1983,7 +1983,7 @@ Handler_read_last 0
Handler_read_next 1
Handler_read_prev 0
Handler_read_rnd 0
-Handler_read_rnd_next 4
+Handler_read_rnd_next 2
DROP TABLE t1,t2,t3,t4;
#
# Bug#13727407: Assert !item->const_item() || !item->not_null_tables()
diff --git a/mysql-test/r/subquery_mat_all.result b/mysql-test/r/subquery_mat_all.result
index 6b473915df40..e53b77929729 100644
--- a/mysql-test/r/subquery_mat_all.result
+++ b/mysql-test/r/subquery_mat_all.result
@@ -1985,7 +1985,7 @@ Handler_read_last 0
Handler_read_next 1
Handler_read_prev 0
Handler_read_rnd 0
-Handler_read_rnd_next 4
+Handler_read_rnd_next 2
DROP TABLE t1,t2,t3,t4;
#
# Bug#13727407: Assert !item->const_item() || !item->not_null_tables()
diff --git a/mysql-test/r/subquery_mat_none.result b/mysql-test/r/subquery_mat_none.result
index b6a266846ae6..bdb990349b2e 100644
--- a/mysql-test/r/subquery_mat_none.result
+++ b/mysql-test/r/subquery_mat_none.result
@@ -1978,7 +1978,7 @@ Handler_read_last 0
Handler_read_next 1
Handler_read_prev 0
Handler_read_rnd 0
-Handler_read_rnd_next 4
+Handler_read_rnd_next 2
DROP TABLE t1,t2,t3,t4;
#
# Bug#13727407: Assert !item->const_item() || !item->not_null_tables()
diff --git a/mysql-test/r/subquery_to_derived_hypergraph.result b/mysql-test/r/subquery_to_derived_hypergraph.result
index f4b3719e4830..271f64f3e707 100644
--- a/mysql-test/r/subquery_to_derived_hypergraph.result
+++ b/mysql-test/r/subquery_to_derived_hypergraph.result
@@ -3195,21 +3195,24 @@ LIMIT 5;
EXPLAIN
-> Limit: 5 row(s) (rows=5)
-> Group (no aggregates) (rows=500)
- -> Nested loop left join (rows=500)
- -> Nested loop left join (rows=500)
- -> Nested loop inner join (rows=500)
- -> Index scan on t1 using PRIMARY (rows=500)
- -> Covering index lookup on t2 using login (login = t1.login) (rows=1)
- -> Index lookup on derived_1_2 using (login = t2.login) (rows=1)
- -> Materialize (rows=500)
- -> Group aggregate: sum(tbl2.nump) (rows=500)
- -> Sort: tbl2.login (rows=500)
- -> Table scan on tbl2 (rows=500)
- -> Index lookup on derived_1_3 using (login = t2.login) (rows=1)
- -> Materialize (rows=500)
- -> Group aggregate: sum(tbl2.nump) (rows=500)
- -> Sort: tbl2.login (rows=500)
- -> Table scan on tbl2 (rows=500)
+ -> Nested loop inner join (rows=500)
+ -> Sort: t2.login (rows=500)
+ -> Left hash join (t2.login = derived_1_3.login) (rows=500)
+ -> Left hash join (t2.login = derived_1_2.login) (rows=500)
+ -> Covering index scan on t2 using login (rows=500)
+ -> Hash
+ -> Table scan on derived_1_2 (rows=500)
+ -> Materialize (rows=500)
+ -> Group aggregate: sum(tbl2.nump) (rows=500)
+ -> Sort: tbl2.login (rows=500)
+ -> Table scan on tbl2 (rows=500)
+ -> Hash
+ -> Table scan on derived_1_3 (rows=500)
+ -> Materialize (rows=500)
+ -> Group aggregate: sum(tbl2.nump) (rows=500)
+ -> Sort: tbl2.login (rows=500)
+ -> Table scan on tbl2 (rows=500)
+ -> Single-row index lookup on t1 using PRIMARY (login = t2.login) (rows=1)
Warnings:
Note 1276 Field or reference 'test.t1.login' of SELECT #2 was resolved in SELECT #1
diff --git a/mysql-test/r/temptable_status_vars.result b/mysql-test/r/temptable_status_vars.result
index 972a4ce4c1a4..6cfa567c981a 100644
--- a/mysql-test/r/temptable_status_vars.result
+++ b/mysql-test/r/temptable_status_vars.result
@@ -87,7 +87,7 @@ CALL print_status_variables('session');
Variable_name Value
Created_tmp_tables 1
Variable_name Value
-Created_tmp_disk_tables 0
+Created_tmp_disk_tables 1
Variable_name Value
Count_hit_tmp_table_size 0
# TempTable_count_hit_max_ram is 7 because statements to show these
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 5f7c924b8216..2312e6d170b0 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -3432,3 +3432,68 @@ c1 c2
UPDATE t1 SET c2=3 WHERE c1=1;
DROP TABLE t1;
SET sql_mode=default;
+#
+# Bug#35373634: JOIN a table with trigger report unexpected WARNINGS
+#
+CREATE TABLE s1 (
+id bigint NOT NULL AUTO_INCREMENT,
+s_id int NOT NULL,
+p_id bigint NOT NULL,
+PRIMARY KEY (id)
+);
+CREATE TABLE t1 (i int);
+INSERT INTO s1 (p_id, s_id) VALUES (1, 1), (1, 1);
+INSERT INTO t1 VALUES (1);
+# Any trigger on s1 (even one that never fires for UPDATE) is enough
+# to engage the trigger nullability code path.
+CREATE TRIGGER trg_s1 BEFORE INSERT ON s1 FOR EACH ROW
+IF 1 THEN SET @sum = @sum + 1; END IF;|
+#
+# Part 1: non-strict mode -> spurious warnings
+#
+SET sql_mode = '';
+# Statement 1: legitimately stores NULL -> 2 expected warnings
+UPDATE t1 t JOIN s1 s ON s.s_id = t.i SET p_id = IF(1=1, NULL, p_id) WHERE t.i = 1;
+Warnings:
+Warning 1048 Column 'p_id' cannot be null
+Warning 1048 Column 'p_id' cannot be null
+SHOW WARNINGS;
+Level Code Message
+Warning 1048 Column 'p_id' cannot be null
+Warning 1048 Column 'p_id' cannot be null
+# Statement 2: stores valid value 3 -> must produce NO warnings
+UPDATE t1 t JOIN s1 s ON s.s_id = t.i SET p_id = IF(1=1, 3, p_id) WHERE t.i = 1;
+SHOW WARNINGS;
+Level Code Message
+SELECT id, s_id, p_id FROM s1 ORDER BY id;
+id s_id p_id
+1 1 3
+2 1 3
+# Statement 3: stores valid value 4 -> must produce NO warnings
+UPDATE t1 t JOIN s1 s ON s.s_id = t.i SET p_id = IF(1=1, 4, p_id) WHERE t.i = 1;
+SHOW WARNINGS;
+Level Code Message
+SELECT id, s_id, p_id FROM s1 ORDER BY id;
+id s_id p_id
+1 1 4
+2 1 4
+#
+# Part 2: strict mode -> spurious errors (all subsequent updates blocked)
+#
+SET sql_mode = 'STRICT_TRANS_TABLES';
+Warnings:
+Warning 3135 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
+# Statement 4: stores NULL -> expected ERROR 1048
+UPDATE t1 t JOIN s1 s ON s.s_id = t.i SET p_id = IF(1=1, NULL, p_id) WHERE t.i = 1;
+ERROR 23000: Column 'p_id' cannot be null
+# Statement 5: stores valid value 5 -> must succeed, p_id becomes 5
+UPDATE t1 t JOIN s1 s ON s.s_id = t.i SET p_id = IF(1=1, 5, p_id) WHERE t.i = 1;
+SHOW WARNINGS;
+Level Code Message
+SELECT id, s_id, p_id FROM s1 ORDER BY id;
+id s_id p_id
+1 1 5
+2 1 5
+# Cleanup
+DROP TABLE s1, t1;
+SET sql_mode = default;
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index 96a227e3b2e7..4a2693d2c10a 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -1069,3 +1069,18 @@ SELECT c0 IN (1, - (NULL > 1.0E0)) FROM t1;
c0 IN (1, - (NULL > 1.0E0))
NULL
DROP TABLE t1;
+#
+# Bug#39444505: A negated 'IS TRUE' guard can still match a DECIMAL row
+# for which the guarded predicate is true.
+#
+CREATE TABLE t2(c0 DECIMAL(10,0) UNIQUE);
+INSERT INTO t2(c0) VALUES(0.010117779858519138), (NULL);
+Warnings:
+Note 1265 Data truncated for column 'c0' at row 1
+SELECT c0
+FROM t2
+WHERE NOT ((c0 BETWEEN c0 AND c0) IS TRUE) AND
+c0 <> IFNULL(-2022419930, c0)
+ORDER BY c0 IS NULL, c0;
+c0
+DROP TABLE t2;
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 4e3b2de9fb5d..f4e4e9ba5cba 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -700,3 +700,12 @@ ts1 ts2 f
1996-04-20 20:22:36 2000-12-31 22:01:01 2000-12-31 22:01:01
2024-04-01 13:18:49 1980-01-12 23:38:06 2024-04-01 13:18:49
DROP TABLE t1;
+#
+# Bug#39280411: Assertion 'dt->time_type = MYSQL_TIMESTAMP_DATETIME ||
+# dt->time_type = MYSQL_TIMESTAMP_DATETIME_TZ' failed
+#
+CREATE TABLE t (c3 TIMESTAMP(3));
+INSERT INTO t VALUES(NOW());
+UPDATE t SET c3 = JSON_REPLACE('{"abcca":"c"}' , '$', '2016-12-03');
+ERROR 22007: Incorrect datetime value: '2016-12-03' for column 'c3' at row 1
+DROP TABLE t;
diff --git a/mysql-test/r/type_timestamp_explicit.result b/mysql-test/r/type_timestamp_explicit.result
index bc11ef24985e..04387dd6eefe 100644
--- a/mysql-test/r/type_timestamp_explicit.result
+++ b/mysql-test/r/type_timestamp_explicit.result
@@ -698,6 +698,15 @@ ts1 ts2 f
1996-04-20 20:22:36 2000-12-31 22:01:01 2000-12-31 22:01:01
2024-04-01 13:18:49 1980-01-12 23:38:06 2024-04-01 13:18:49
DROP TABLE t1;
+#
+# Bug#39280411: Assertion 'dt->time_type = MYSQL_TIMESTAMP_DATETIME ||
+# dt->time_type = MYSQL_TIMESTAMP_DATETIME_TZ' failed
+#
+CREATE TABLE t (c3 TIMESTAMP(3));
+INSERT INTO t VALUES(NOW());
+UPDATE t SET c3 = JSON_REPLACE('{"abcca":"c"}' , '$', '2016-12-03');
+ERROR 22007: Incorrect datetime value: '2016-12-03' for column 'c3' at row 1
+DROP TABLE t;
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
#
# WL6292 - Test cases to test new behavior with
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 3689758ef2c9..2b27370def67 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -2699,26 +2699,12 @@ id td
3 2005-01-02
4 2005-01-03
5 2005-01-04
-Warnings:
-Warning 4095 Delimiter '.' in position 4 in datetime value '2005.01.02' at row 1 is deprecated. Prefer the standard '-'.
-Warning 4095 Delimiter '.' in position 4 in datetime value '2005.01.02' at row 1 is deprecated. Prefer the standard '-'.
-Warning 4095 Delimiter '.' in position 4 in datetime value '2005.01.04' at row 1 is deprecated. Prefer the standard '-'.
-Warning 4095 Delimiter '.' in position 4 in datetime value '2005.01.04' at row 1 is deprecated. Prefer the standard '-'.
-Warning 4095 Delimiter '.' in position 4 in datetime value '2005.01.02' at row 1 is deprecated. Prefer the standard '-'.
-Warning 4095 Delimiter '.' in position 4 in datetime value '2005.01.04' at row 1 is deprecated. Prefer the standard '-'.
SELECT * FROM v1 WHERE td BETWEEN CAST('2005.01.02' AS DATE) AND CAST('2005.01.04' AS DATE);
id td
2 2005-01-02
3 2005-01-02
4 2005-01-03
5 2005-01-04
-Warnings:
-Warning 4095 Delimiter '.' in position 4 in datetime value '2005.01.02' at row 1 is deprecated. Prefer the standard '-'.
-Warning 4095 Delimiter '.' in position 4 in datetime value '2005.01.02' at row 1 is deprecated. Prefer the standard '-'.
-Warning 4095 Delimiter '.' in position 4 in datetime value '2005.01.04' at row 1 is deprecated. Prefer the standard '-'.
-Warning 4095 Delimiter '.' in position 4 in datetime value '2005.01.04' at row 1 is deprecated. Prefer the standard '-'.
-Warning 4095 Delimiter '.' in position 4 in datetime value '2005.01.02' at row 1 is deprecated. Prefer the standard '-'.
-Warning 4095 Delimiter '.' in position 4 in datetime value '2005.01.04' at row 1 is deprecated. Prefer the standard '-'.
DROP VIEW v1;
DROP TABLE t1;
create table t1 (a int);
@@ -6878,3 +6864,42 @@ SELECT * FROM v1;
id c5
DROP VIEW v1;
DROP TABLE t1;
+#
+# Bug#38729126: Item_view_ref::used_tables() is wrong, leads to
+# wrong query result
+CREATE TABLE t1 (f1 INTEGER);
+INSERT INTO t1 VALUES(0),(1);
+CREATE TABLE t2 (f2 INTEGER);
+SELECT dt2.f1, coalesce(dt2.f1,1)=1
+FROM (SELECT dt1.f1 AS f1 FROM t1
+LEFT JOIN
+(SELECT PI() AS f1 FROM t2) AS dt1 ON FALSE) AS dt2;
+f1 coalesce(dt2.f1,1)=1
+NULL 1
+NULL 1
+SELECT dt2.f1
+FROM (SELECT dt1.f1 AS f1 FROM t1
+LEFT JOIN
+(SELECT PI() AS f1 FROM t2) AS dt1 ON FALSE) AS dt2
+WHERE coalesce(dt2.f1,1)=1;
+f1
+NULL
+NULL
+DROP TABLE t1,t2;
+#
+# Bug#39127431: Unexpected behavior of LEFT JOIN + empty subquery
+# with NULL comparison in WHERE clause
+#
+CREATE TABLE t1 (f1 INT, f2 DOUBLE);
+CREATE TABLE t2 (f1 INT);
+INSERT INTO t1 VALUES (1, 10.0), (2, 20.0);
+INSERT INTO t2 VALUES (1),(2);
+SELECT 15 AS c0
+FROM (SELECT t1.f2 AS c0, dt1.c0 AS c1, t1.f1 AS c3, dt1.c4 AS c4
+FROM t1
+LEFT JOIN (SELECT 57 AS c0, 3 AS c4 FROM t2 WHERE FALSE) AS dt1
+ON (TRUE)
+WHERE TRUE) AS dt2
+WHERE dt2.c3 <= dt2.c4;
+c0
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/with_non_recursive_bugs.result b/mysql-test/r/with_non_recursive_bugs.result
index 79f8c4d15950..22ccde044cde 100644
--- a/mysql-test/r/with_non_recursive_bugs.result
+++ b/mysql-test/r/with_non_recursive_bugs.result
@@ -905,7 +905,7 @@ id select_type table partitions type possible_keys key key_len ref rows filtered
1 DELETE outr2 NULL ref col_int_key col_int_key 5 test.outr1.col_int 1 100.00 NULL
1 PRIMARY NULL ref 4 test.outr1.col_int 2 100.00 NULL
3 SUBQUERY innr1 NULL ALL NULL NULL NULL NULL 10 10.00 Using where; Using temporary
-3 SUBQUERY NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Distinct; Using join buffer (hash join)
+3 SUBQUERY NULL range ,, 4 NULL 2 100.00 Range checked for each record (index map: 0x7); Distinct
2 DERIVED alias2 NULL range PRIMARY,col_varchar_key PRIMARY 4 NULL 2 100.00 Using where
2 DERIVED alias1 NULL ref col_varchar_key col_varchar_key 4 test.alias2.col_varchar_key 1 100.00 Using index
Warnings:
@@ -1227,3 +1227,55 @@ cte2 AS (SELECT COUNT(*) FROM cte1) SELECT * from cte1,cte2;
f1 COUNT(*)
x 1
DROP TABLE t1;
+#
+# Bug#39321676: WHERE equality condition fails to match existing row
+#
+CREATE TABLE parent (
+uuid CHAR(36) NOT NULL PRIMARY KEY
+) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
+CREATE TABLE child (
+uuid CHAR(36) NOT NULL PRIMARY KEY,
+id VARCHAR(255) NOT NULL,
+version INT NOT NULL,
+parent_uuid CHAR(36) NOT NULL,
+created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
+FOREIGN KEY (parent_uuid) REFERENCES parent (uuid)
+) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
+CREATE TABLE sub_child(
+uuid CHAR(36) NOT NULL PRIMARY KEY,
+child_uuid CHAR(36) NOT NULL,
+FOREIGN KEY (child_uuid) REFERENCES child (uuid)
+) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
+INSERT INTO parent VALUES
+('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');
+INSERT INTO child VALUES
+(UUID(), "A", 1, 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', CURRENT_TIMESTAMP());
+INSERT INTO sub_child
+SELECT UUID(), c.uuid
+FROM child c;
+WITH ranked_children AS
+(SELECT c.uuid AS child_uuid,
+c.parent_uuid,
+c.created_at,
+ROW_NUMBER() OVER (PARTITION BY c.id ORDER BY c.version DESC) AS rn
+FROM child AS c
+GROUP BY c.uuid
+)
+SELECT p.uuid
+FROM parent AS p JOIN ranked_children AS all_rc
+ON p.uuid = all_rc.parent_uuid AND all_rc.rn = 1
+JOIN sub_child AS all_sc
+ON all_sc.child_uuid = all_rc.child_uuid
+JOIN ranked_children AS rc
+ON rc.child_uuid = (select rc2.child_uuid
+from ranked_children AS rc2
+where p.uuid = rc2.parent_uuid and rc2.rn = 1
+order by rc2.created_at desc
+limit 1
+)
+JOIN sub_child AS sc ON sc.child_uuid = rc.child_uuid
+WHERE p.uuid = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
+GROUP BY p.uuid;
+uuid
+aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
+DROP TABLE parent, child, sub_child;
diff --git a/mysql-test/r/with_recursive_bugs.result b/mysql-test/r/with_recursive_bugs.result
index 5cad6223a453..08d316ab74de 100644
--- a/mysql-test/r/with_recursive_bugs.result
+++ b/mysql-test/r/with_recursive_bugs.result
@@ -338,3 +338,130 @@ count
1
1
DROP PROCEDURE cte_bug;
+#
+# Bug#35536775: CTE view serialization trailing comma
+#
+# When a view references a WITH clause and some CTEs are unused
+# (merged away), PT_with_clause::print must not produce a trailing
+# comma or omit separators between the remaining CTEs.
+#
+CREATE TABLE t1 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1), (2), (3);
+#
+# Case 1: Single unused CTE at the end - no trailing comma
+#
+CREATE VIEW v1 AS
+WITH cte1 AS (SELECT a FROM t1),
+cte2 AS (SELECT 1)
+SELECT * FROM cte1;
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with `cte1` as (select `t1`.`a` AS `a` from `t1`) select `cte1`.`a` AS `a` from `cte1` utf8mb4 utf8mb4_0900_ai_ci
+SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'v1';
+VIEW_DEFINITION
+with `cte1` as (select `test`.`t1`.`a` AS `a` from `test`.`t1`) select `cte1`.`a` AS `a` from `cte1`
+# The view definition must parse back without errors
+DROP VIEW v1;
+CREATE VIEW v1 AS
+WITH cte1 AS (SELECT a FROM t1),
+cte2 AS (SELECT 1)
+SELECT * FROM cte1;
+SELECT * FROM v1;
+a
+1
+2
+3
+DROP VIEW v1;
+#
+# Case 2: Unused CTE in the middle - separator between printed CTEs
+#
+CREATE VIEW v2 AS
+WITH cte1 AS (SELECT a FROM t1),
+cte2 AS (SELECT 999),
+cte3 AS (SELECT a + 10 AS b FROM t1)
+SELECT * FROM cte1, cte3;
+SHOW CREATE VIEW v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with `cte1` as (select `t1`.`a` AS `a` from `t1`), `cte3` as (select (`t1`.`a` + 10) AS `b` from `t1`) select `cte1`.`a` AS `a`,`cte3`.`b` AS `b` from (`cte1` join `cte3`) utf8mb4 utf8mb4_0900_ai_ci
+SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'v2';
+VIEW_DEFINITION
+with `cte1` as (select `test`.`t1`.`a` AS `a` from `test`.`t1`), `cte3` as (select (`test`.`t1`.`a` + 10) AS `b` from `test`.`t1`) select `cte1`.`a` AS `a`,`cte3`.`b` AS `b` from `cte1` join `cte3`
+# The view definition must parse back without errors
+SELECT * FROM v2;
+a b
+1 11
+1 12
+1 13
+2 11
+2 12
+2 13
+3 11
+3 12
+3 13
+DROP VIEW v2;
+#
+# Case 3: Multiple unused CTEs in a row
+#
+CREATE VIEW v3 AS
+WITH cte1 AS (SELECT a FROM t1),
+cte2 AS (SELECT 100),
+cte3 AS (SELECT 200),
+cte4 AS (SELECT a * 2 AS c FROM t1)
+SELECT * FROM cte1, cte4;
+SHOW CREATE VIEW v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS with `cte1` as (select `t1`.`a` AS `a` from `t1`), `cte4` as (select (`t1`.`a` * 2) AS `c` from `t1`) select `cte1`.`a` AS `a`,`cte4`.`c` AS `c` from (`cte1` join `cte4`) utf8mb4 utf8mb4_0900_ai_ci
+SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'v3';
+VIEW_DEFINITION
+with `cte1` as (select `test`.`t1`.`a` AS `a` from `test`.`t1`), `cte4` as (select (`test`.`t1`.`a` * 2) AS `c` from `test`.`t1`) select `cte1`.`a` AS `a`,`cte4`.`c` AS `c` from `cte1` join `cte4`
+SELECT * FROM v3;
+a c
+1 2
+1 4
+1 6
+2 2
+2 4
+2 6
+3 2
+3 4
+3 6
+DROP VIEW v3;
+#
+# Case 4: All CTEs unused - WITH clause should be stripped entirely
+#
+CREATE VIEW v4 AS
+WITH cte1 AS (SELECT 1),
+cte2 AS (SELECT 2)
+SELECT a FROM t1;
+SHOW CREATE VIEW v4;
+View Create View character_set_client collation_connection
+v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`a` AS `a` from `t1` utf8mb4 utf8mb4_0900_ai_ci
+SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'v4';
+VIEW_DEFINITION
+select `test`.`t1`.`a` AS `a` from `test`.`t1`
+SELECT * FROM v4;
+a
+1
+2
+3
+DROP VIEW v4;
+#
+# Case 5: First CTE unused, rest used
+#
+CREATE VIEW v5 AS
+WITH cte1 AS (SELECT 999),
+cte2 AS (SELECT a FROM t1)
+SELECT * FROM cte2;
+SHOW CREATE VIEW v5;
+View Create View character_set_client collation_connection
+v5 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v5` AS with `cte2` as (select `t1`.`a` AS `a` from `t1`) select `cte2`.`a` AS `a` from `cte2` utf8mb4 utf8mb4_0900_ai_ci
+SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'v5';
+VIEW_DEFINITION
+with `cte2` as (select `test`.`t1`.`a` AS `a` from `test`.`t1`) select `cte2`.`a` AS `a` from `cte2`
+SELECT * FROM v5;
+a
+1
+2
+3
+DROP VIEW v5;
+DROP TABLE t1;
diff --git a/mysql-test/r/with_recursive_innodb_tmp_table.result b/mysql-test/r/with_recursive_innodb_tmp_table.result
index 63ea50aaf3bd..3e92db4c60d2 100644
--- a/mysql-test/r/with_recursive_innodb_tmp_table.result
+++ b/mysql-test/r/with_recursive_innodb_tmp_table.result
@@ -360,6 +360,115 @@ Warning 1287 Setting user variables within expressions is deprecated and will be
show status like 'Created_tmp_disk_tables';
Variable_name Value
Created_tmp_disk_tables 0
-# cleanup
drop table t1;
+#
+# Bug 37308710 - const access after MEMORY to InnoDB temp-table overflow
+#
+create table t1 (
+id int primary key,
+col1 varchar(32),
+key index_col1(col1)
+);
+create table t2 (
+id int primary key,
+col1 varchar(32)
+);
+create procedure insert_bug_37308710_data()
+begin
+declare num int;
+set num = 1;
+while num < 100 do
+insert into t1 values (num, lpad(num, 32, '0'));
+insert into t2 values (num, lpad(num, 32, '0'));
+set num = num + 1;
+end while;
+end//
+call insert_bug_37308710_data();
+set @old_internal_tmp_mem_storage_engine =
+@@session.internal_tmp_mem_storage_engine;
+set session internal_tmp_mem_storage_engine = 'memory';
+set @old_tmp_table_size = @@tmp_table_size;
+set @@tmp_table_size = 102400;
+Warnings:
+Warning 48040 Tmp_table_size is set below 1MiB. The TEMPTABLE engine requires at least 1MiB table size, and will use that value instead. Please increase the limit to silence this warning.
+flush status;
+explain select count(distinct d.col1)
+from (
+select t1.col1
+from t1
+union
+select t1.col1
+from t1
+) d
+join t2 on d.col1 = t2.col1
+where t2.id = 1;
+id select_type table partitions type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 NULL
+1 PRIMARY NULL const 131 const 1 100.00 Using index
+2 DERIVED t1 NULL index NULL index_col1 131 NULL 99 100.00 Using index
+3 UNION t1 NULL index NULL index_col1 131 NULL 99 100.00 Using index
+4 UNION RESULT NULL ALL NULL NULL NULL NULL NULL NULL Using temporary
+Warnings:
+Note 1003 /* select#1 */ select count(distinct `d`.`col1`) AS `count(distinct d.col1)` from (/* select#2 */ select `test`.`t1`.`col1` AS `col1` from `test`.`t1` union /* select#3 */ select `test`.`t1`.`col1` AS `col1` from `test`.`t1`) `d` join `test`.`t2` where ((`d`.`col1` = '00000000000000000000000000000001'))
+select count(distinct d.col1)
+from (
+select t1.col1
+from t1
+union
+select t1.col1
+from t1
+) d
+join t2 on d.col1 = t2.col1
+where t2.id = 1;
+count(distinct d.col1)
+1
+show status like 'Created_tmp_disk_tables';
+Variable_name Value
+Created_tmp_disk_tables 0
+set @old_max_heap_table_size = @@max_heap_table_size;
+set @@max_heap_table_size = 16384;
+set @@tmp_table_size = 1024;
+Warnings:
+Warning 48040 Tmp_table_size is set below 1MiB. The TEMPTABLE engine requires at least 1MiB table size, and will use that value instead. Please increase the limit to silence this warning.
+flush status;
+explain select count(distinct d.col1)
+from (
+select t1.col1
+from t1
+union
+select t1.col1
+from t1
+) d
+join t2 on d.col1 = t2.col1
+where t2.id = 1;
+id select_type table partitions type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 NULL
+1 PRIMARY NULL const 131 const 1 100.00 Using index
+2 DERIVED t1 NULL index NULL index_col1 131 NULL 99 100.00 Using index
+3 UNION t1 NULL index NULL index_col1 131 NULL 99 100.00 Using index
+4 UNION RESULT NULL ALL NULL NULL NULL NULL NULL NULL Using temporary
+Warnings:
+Note 1003 /* select#1 */ select count(distinct `d`.`col1`) AS `count(distinct d.col1)` from (/* select#2 */ select `test`.`t1`.`col1` AS `col1` from `test`.`t1` union /* select#3 */ select `test`.`t1`.`col1` AS `col1` from `test`.`t1`) `d` join `test`.`t2` where ((`d`.`col1` = '00000000000000000000000000000001'))
+select count(distinct d.col1)
+from (
+select t1.col1
+from t1
+union
+select t1.col1
+from t1
+) d
+join t2 on d.col1 = t2.col1
+where t2.id = 1;
+count(distinct d.col1)
+1
+show status like 'Created_tmp_disk_tables';
+Variable_name Value
+Created_tmp_disk_tables 1
+set session internal_tmp_mem_storage_engine =
+@old_internal_tmp_mem_storage_engine;
+set @@max_heap_table_size = @old_max_heap_table_size;
+set @@tmp_table_size = @old_tmp_table_size;
+drop procedure insert_bug_37308710_data;
+drop table t1, t2;
+# cleanup
set session internal_tmp_mem_storage_engine=default;
diff --git a/mysql-test/std_data/oidc/dummy_oidc_conf.json b/mysql-test/std_data/oidc/dummy_oidc_conf.json
new file mode 100644
index 000000000000..642e79f29587
--- /dev/null
+++ b/mysql-test/std_data/oidc/dummy_oidc_conf.json
@@ -0,0 +1,55 @@
+{
+ "oidc-idp": {
+ "issuer-name": "https://idp-test.com/realms/dummy",
+ "keys": [
+ {
+ "kid": "rsa-key-1",
+ "kty": "RSA",
+ "n": "ptR4YxjdrF2RrYiY9XYH3KcXKzlS6b2foGAeHN9dViAs5yKStKAucUf81kszq6LkzkOOPX5SbToLBRv5wwOtrBLKVkqhw4i5kS0b-7jpR9g7lER3qfDVYfe0nneaJzc-1Iz6id0oVj4ay8lGmWg5JX5Z8nBs52_7rfDIBtyAsyIQ2dF2tW4e72cypvskw_TwdbsqelY5ZezzTmKx8Ra4-o9Pu5_Vxe1Hhlkx1K_tfbGH9ZUsbFy90b0Vcw5w6EKPEkM9mZTUoj8TMeHTHaiOREK4llIJ6hokXbEG8BsKJuMuYrzx98e23JkaWaWQY27LUGK5sx-lsX_n8DO2kEASRw",
+ "e": "AQAB",
+ "use": "sig",
+ "alg": "RS256"
+ },
+ {
+ "kty": "EC",
+ "kid": "ec-key-1",
+ "use": "sig",
+ "alg": "ES256",
+ "crv": "P-256",
+ "x": "bjQTXrTcw_1HKiiZm2Hqv41w7Vd44M9koyY_-VsP-SA",
+ "y": "XqAzBfS0uQQwoemIKhNw4x8FsJxChCN1qT3_IsxMda0"
+ }
+ ],
+ "audiences": [
+ "ee2811b9-10b8",
+ "https://api.example.com"
+ ],
+ "group-claim": "groups",
+ "group-role": [
+ {
+ "acc": "accounting"
+ },
+ {
+ "eng": "engineering"
+ }
+ ]
+ },
+
+ "oidc-idp2": {
+ "issuer-name": "https://idp-test2.com/realms/dummy",
+ "keys": [
+ {
+ "kid": "key-1",
+ "kty": "RSA",
+ "n": "ptR4YxjdrF2RrYiY9XYH3KcXKzlS6b2foGAeHN9dViAs5yKStKAucUf81kszq6LkzkOOPX5SbToLBRv5wwOtrBLKVkqhw4i5kS0b-7jpR9g7lER3qfDVYfe0nneaJzc-1Iz6id0oVj4ay8lGmWg5JX5Z8nBs52_7rfDIBtyAsyIQ2dF2tW4e72cypvskw_TwdbsqelY5ZezzTmKx8Ra4-o9Pu5_Vxe1Hhlkx1K_tfbGH9ZUsbFy90b0Vcw5w6EKPEkM9mZTUoj8TMeHTHaiOREK4llIJ6hokXbEG8BsKJuMuYrzx98e23JkaWaWQY27LUGK5sx-lsX_n8DO2kEASRw",
+ "e": "AQAB",
+ "use": "sig",
+ "alg": "RS256"
+ }
+ ],
+ "audiences": [
+ "ee2811b9-10b8"
+ ]
+ }
+}
+
diff --git a/mysql-test/std_data/oidc/idp_private.pem b/mysql-test/std_data/oidc/idp_private.pem
new file mode 100644
index 000000000000..e7773a8f44c9
--- /dev/null
+++ b/mysql-test/std_data/oidc/idp_private.pem
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCm1HhjGN2sXZGt
+iJj1dgfcpxcrOVLpvZ+gYB4c311WICznIpK0oC5xR/zWSzOrouTOQ449flJtOgsF
+G/nDA62sEspWSqHDiLmRLRv7uOlH2DuURHep8NVh97Sed5onNz7UjPqJ3ShWPhrL
+yUaZaDklflnycGznb/ut8MgG3ICzIhDZ0Xa1bh7vZzKm+yTD9PB1uyp6Vjll7PNO
+YrHxFrj6j0+7n9XF7UeGWTHUr+19sYf1lSxsXL3RvRVzDnDoQo8SQz2ZlNSiPxMx
+4dMdqI5EQriWUgnqGiRdsQbwGwom4y5ivPH3x7bcmRpZpZBjbstQYrmzH6Wxf+fw
+M7aQQBJHAgMBAAECggEATOmLjvQ5zmtc7Aobqp59xWZrMgw9g3FelEt71ofLuhcf
+XHf99rQadTNhB1KoQarZnZZbj1IboiuuRO6+2P9rI/eNvPavWTxBgQKw8f4v3mV8
+IkDmgjx7w6y1YpF1SjsYBlnwb3q8S/ZZ2DW1DKiWIAj+Yt0d+B0ShQCK1071Lp/5
+TGcVr+G2Opve2kVFLLWh2vXEeoQMreelk1thoACA629VsHjvFMuc8P0BXqDlTI7F
+00t+RMrkREuXhbmku29svcODa3z+eSyylXaOwaUN4ncPUogVN/XqkmtKa1/touxd
+uC3Y7U6w5xdgEMlf2s1001esrKPJF1jgSwctpK2v8QKBgQDVF1w1x9xCdU0X4QO4
+NJs+9I59jMMbrsIlZsM+K0KMUISeI9ZFI7bAozJE3KoQUEGPWZPpaFAuwsuB4qvP
+bzsEbDg+EzFQdnLOgjBH+MugF4q51ouYFe5sTJbI1pZaBovDu1pjCnBBkFx0MmbG
+BqfSvlqwId6e1YAqHd4z8KtzOwKBgQDIbGMamvspUslye8bctRTwhV0Cd8wG33p8
+4OMkcBUAUU+8/8LtDuoR2sgCX91L3ztilngsj2sXI9Jy1J23gpXm0thwV22vIJHk
+Yc0PxuZ1OEA1B6oLreFw7PD9SxlG62/L0P2WACvwi92xJlW/IDgE/CRE11IpSJrV
+FshURyEUZQKBgQCFpRwJAutKpyUN1+ssSZogduMzLOhlYUqUiInlYN5hAFLcl99Y
+B5kj4naxp6/lgWBM1sKkve6kFTnroU1eUQWztWfkzsa8Dz3b9NzxFsInCvzPpxZv
+8TlSpQpgte0gU0CvJr7+pNpY1ICXw9CfXCc/TnG0S9nCxmaWg5sL+mKdZwKBgFOj
+T5Qpusha4PAikTFHbA6XSOIfxgfUONRmMMPi9hCk3ga8IMc2ox2CVFcRVFM2PBz/
+N/U4gHMuosMC0TJkj1O9B0+SXJZpnBhXa/C6iy+9oqW+pgqrrFmot0Ssk0bSN1wx
+wbFYLv36EDC+E6hntJj389a6mHHb96kXEdCBwl81AoGBAIwt2Ani0rMl3KhS/JGq
+UhFZfneLbzeb5Oz8O/ZphJyG9sPtdXq56Z1xezMaZUWjjZRJuLMq86d4jGdpKTmX
+LOQDHYtLJxrTLGpED42zHEW/51P+q0F7EeS0ge09lvMjqoU+FCsOTqKlZH/H7DAI
+Xk/3ehQ3WrVVM7QkLw4jk8P3
+-----END PRIVATE KEY-----
diff --git a/mysql-test/std_data/oidc/idp_public.pem b/mysql-test/std_data/oidc/idp_public.pem
new file mode 100644
index 000000000000..f54628fb68b5
--- /dev/null
+++ b/mysql-test/std_data/oidc/idp_public.pem
@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAptR4YxjdrF2RrYiY9XYH
+3KcXKzlS6b2foGAeHN9dViAs5yKStKAucUf81kszq6LkzkOOPX5SbToLBRv5wwOt
+rBLKVkqhw4i5kS0b+7jpR9g7lER3qfDVYfe0nneaJzc+1Iz6id0oVj4ay8lGmWg5
+JX5Z8nBs52/7rfDIBtyAsyIQ2dF2tW4e72cypvskw/TwdbsqelY5ZezzTmKx8Ra4
++o9Pu5/Vxe1Hhlkx1K/tfbGH9ZUsbFy90b0Vcw5w6EKPEkM9mZTUoj8TMeHTHaiO
+REK4llIJ6hokXbEG8BsKJuMuYrzx98e23JkaWaWQY27LUGK5sx+lsX/n8DO2kEAS
+RwIDAQAB
+-----END PUBLIC KEY-----
diff --git a/mysql-test/suite/auth_openid_connect/inc/keycloak_oidc_conf.inc b/mysql-test/suite/auth_openid_connect/inc/keycloak_oidc_conf.inc
new file mode 100644
index 000000000000..81f007e3614e
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/inc/keycloak_oidc_conf.inc
@@ -0,0 +1,63 @@
+let $KEYCLOAK_OIDC_CONF =
+JSON://
+{
+ \"oidc-idp\": {
+ \"issuer-name\": \"https://idp-test.com/realms/dummy\",
+ \"keys\": [
+ {
+ \"kid\": \"rsa-key-1\",
+ \"kty\": \"RSA\",
+ \"n\": \"ptR4YxjdrF2RrYiY9XYH3KcXKzlS6b2foGAeHN9dViAs5yKStKAucUf81kszq6LkzkOOPX5SbToLBRv5wwOtrBLKVkqhw4i5kS0b-7jpR9g7lER3qfDVYfe0nneaJzc-1Iz6id0oVj4ay8lGmWg5JX5Z8nBs52_7rfDIBtyAsyIQ2dF2tW4e72cypvskw_TwdbsqelY5ZezzTmKx8Ra4-o9Pu5_Vxe1Hhlkx1K_tfbGH9ZUsbFy90b0Vcw5w6EKPEkM9mZTUoj8TMeHTHaiOREK4llIJ6hokXbEG8BsKJuMuYrzx98e23JkaWaWQY27LUGK5sx-lsX_n8DO2kEASRw\",
+ \"e\": \"AQAB\",
+ \"use\": \"sig\",
+ \"alg\": \"RS256\"
+ },
+ {
+ \"kty\": \"EC\",
+ \"kid\": \"ec-key-1\",
+ \"use\": \"sig\",
+ \"alg\": \"ES256\",
+ \"crv\": \"P-256\",
+ \"x\": \"bjQTXrTcw_1HKiiZm2Hqv41w7Vd44M9koyY_-VsP-SA\",
+ \"y\": \"XqAzBfS0uQQwoemIKhNw4x8FsJxChCN1qT3_IsxMda0\"
+ }
+ ],
+ \"audiences\": [
+ \"ee2811b9-10b8\",
+ \"https://api.example.com\"
+ ],
+ \"group-claim\": \"groups\",
+ \"group-role\": [
+ {
+ \"acc\": \"accounting\"
+ },
+ {
+ \"eng\": \"engineering\"
+ }
+ ]
+ },
+ \"my-keycloak\": {
+ \"issuer-name\": \"$IDP_HOST/realms/master\",
+ \"jwks-url\": \"$IDP_HOST/realms/master/protocol/openid-connect/certs\",
+ \"audiences\": [
+ \"myclient\"
+ ],
+ \"group-claim\": \"groups\",
+ \"group-role\": [
+ {
+ \"/accounting\": \"accounting\"
+ },
+ {
+ \"/marketing\": \"marketing\"
+ }
+ ]
+ },
+ \"unaccessible-idp\": {
+ \"issuer-name\": \"https://dummy-host/realms/master\",
+ \"jwks-url\": \"https://dummy-host/realms/master/protocol/openid-connect/certs\",
+ \"audiences\": [
+ \"account\"
+ ]
+ }
+};
+
diff --git a/mysql-test/suite/auth_openid_connect/inc/set_idp_vars.inc b/mysql-test/suite/auth_openid_connect/inc/set_idp_vars.inc
new file mode 100644
index 000000000000..13b02b2702a8
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/inc/set_idp_vars.inc
@@ -0,0 +1,19 @@
+if ($MTR_OIDC_IDP_HOST)
+{
+ --let $IDP_HOST = $MTR_OIDC_IDP_HOST
+}
+
+if (!$IDP_HOST)
+{
+ --let $IDP_HOST = https://keycloak.int.percona.com
+}
+
+if ($MTR_OIDC_USER_ID)
+{
+ --let $IDP_USER_ID = $MTR_USER_ID
+}
+
+if (!$IDP_USER_ID)
+{
+ --let $IDP_USER_ID = e3039939-719c-4ba7-99d9-d9efecf5caeb
+}
\ No newline at end of file
diff --git a/mysql-test/suite/auth_openid_connect/r/auth.result b/mysql-test/suite/auth_openid_connect/r/auth.result
new file mode 100644
index 000000000000..3b212bde9ecc
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/r/auth.result
@@ -0,0 +1,70 @@
+### INITIALIZE TESTS
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'auth_openid_connect_configuration not set");
+INSTALL PLUGIN auth_openid_connect SONAME 'auth_openid_connect.so';;
+CREATE USER mysql_oidc_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "oidc-idp", "user" : "oidc-user"}';
+
+### Validate system variable checks for auth_openid_connect_configuration
+
+## VALID CASES
+SET GLOBAL auth_openid_connect_configuration = 'JSON://{"oidc-idp": {"issuer-name": "https://idp-test.com/realms/dummy", "keys": [{"kid": "rsa-key-1", "kty": "RSA", "n": "ptR4YxjdrF2RrYiY9XYH3KcXKzlS6b2foGAeHN9dViAs5yKStKAucUf81kszq6LkzkOOPX5SbToLBRv5wwOtrBLKVkqhw4i5kS0b-7jpR9g7lER3qfDVYfe0nneaJzc-1Iz6id0oVj4ay8lGmWg5JX5Z8nBs52_7rfDIBtyAsyIQ2dF2tW4e72cypvskw_TwdbsqelY5ZezzTmKx8Ra4-o9Pu5_Vxe1Hhlkx1K_tfbGH9ZUsbFy90b0Vcw5w6EKPEkM9mZTUoj8TMeHTHaiOREK4llIJ6hokXbEG8BsKJuMuYrzx98e23JkaWaWQY27LUGK5sx-lsX_n8DO2kEASRw", "e": "AQAB", "use": "sig", "alg": "RS256"}], "audiences": ["ee2811b9-10b8","https://api.example.com"]}}';
+user() current_user()
+mysql_oidc_user@localhost mysql_oidc_user@%
+SET GLOBAL auth_openid_connect_configuration = 'FILE:///std_data/oidc/dummy_oidc_conf.json';
+user() current_user()
+mysql_oidc_user@localhost mysql_oidc_user@%
+
+## INVALID CASES
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'invalid sysvar prefix");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'invalid value for system variable'");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'cannot open config file:");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'extra content after correct JSON document'");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'syntax error");
+SET GLOBAL auth_openid_connect_configuration = 'INVD://';
+ERROR 42000: Variable 'auth_openid_connect_configuration' can't be set to the value of 'INVD://'
+SET GLOBAL auth_openid_connect_configuration = 'JSON://{"invalid"[}';
+ERROR 42000: Variable 'auth_openid_connect_configuration' can't be set to the value of 'JSON://{"invalid"[}'
+SET GLOBAL auth_openid_connect_configuration = 'FILE://nonexistent_path/nonexistent_file.json';
+ERROR 42000: Variable 'auth_openid_connect_configuration' can't be set to the value of 'FILE://nonexistent_path/nonexistent_file.json'
+SET GLOBAL auth_openid_connect_configuration = 'JSON://{"oidc-idp": {"issuer-name": "https://idp-test.com/realms/dummy", "keys": [{"kid": "rsa-key-1", "kty": "RSA", "n": "ptR4YxjdrF2RrYiY9XYH3KcXKzlS6b2foGAeHN9dViAs5yKStKAucUf81kszq6LkzkOOPX5SbToLBRv5wwOtrBLKVkqhw4i5kS0b-7jpR9g7lER3qfDVYfe0nneaJzc-1Iz6id0oVj4ay8lGmWg5JX5Z8nBs52_7rfDIBtyAsyIQ2dF2tW4e72cypvskw_TwdbsqelY5ZezzTmKx8Ra4-o9Pu5_Vxe1Hhlkx1K_tfbGH9ZUsbFy90b0Vcw5w6EKPEkM9mZTUoj8TMeHTHaiOREK4llIJ6hokXbEG8BsKJuMuYrzx98e23JkaWaWQY27LUGK5sx-lsX_n8DO2kEASRw", "e": "AQAB", "use": "sig", "alg": "RS256"}], "audiences": ["ee2811b9-10b8","https://api.example.com"]}} , {"oidc-idp": {"issuer-name":"name"}}';
+ERROR 42000: Variable 'auth_openid_connect_configuration' can't be set to the value of 'JSON://{"oidc-idp": {"issuer-name": "https://idp-test.com/realms/dummy", "keys": [{"kid": "rsa-key-1", "kty": "RSA", "n": "ptR4YxjdrF2RrYiY9XYH3KcXKzlS6b2foGAeHN9dViAs5yKStKAucUf81kszq6LkzkOOPX5SbToLB'
+SET GLOBAL auth_openid_connect_configuration = 'JSON://{}';
+
+### Client side validations (FR.5)
+SET GLOBAL auth_openid_connect_configuration = 'FILE:///std_data/oidc/dummy_oidc_conf.json';
+
+### CREATE USER with incorrect AS clause
+CREATE USER invalid_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "oidc-idp"}';
+DROP USER invalid_user;
+CREATE USER invalid_user IDENTIFIED WITH 'auth_openid_connect' AS '{"user" : "oidc-user"}';
+DROP USER invalid_user;
+CREATE USER invalid_user IDENTIFIED WITH 'auth_openid_connect';
+DROP USER invalid_user;
+
+### Verifying token (FR.7, FR.8, FR.9)
+CREATE USER invalid_user IDENTIFIED WITH 'auth_openid_connect' AS '{"user" : "oidc-user", "identity_provider" : "nonexistent-idp"}';
+DROP USER invalid_user;
+SET GLOBAL auth_openid_connect_configuration = 'JSON://{"oidc-idp": {"issuer-name": "https://idp-test.com/realms/dummy", "keys": [{"kid": "rsa-key-1", "kty": "RSA", "n": "ptR4YxjdrF2RrYiY9XYH3KcXKzlS6b2foGAeHN9dViAs5yKStKAucUf81kszq6LkzkOOPX5SbToLBRv5wwOtrBLKVkqhw4i5kS0b-7jpR9g7lER3qfDVYfe0nneaJzc-1Iz6id0oVj4ay8lGmWg5JX5Z8nBs52_7rfDIBtyAsyIQ2dF2tW4e72cypvskw_TwdbsqelY5ZezzTmKx8Ra4-o9Pu5_Vxe1Hhlkx1K_tfbGH9ZUsbFy90b0Vcw5w6EKPEkM9mZTUoj8TMeHTHaiOREK4llIJ6hokXbEG8BsKJuMuYrzx98e23JkaWaWQY27LUGK5sx-lsX_n8DO2kEASRw", "e": "AQAB", "use": "sig", "alg": "RS256"}], "audiences": ["ee2811b9-10b8","https://api.example.com"]}}';
+user() current_user()
+mysql_oidc_user@localhost mysql_oidc_user@%
+SET GLOBAL auth_openid_connect_configuration = 'FILE:///std_data/oidc/dummy_oidc_conf.json';
+user() current_user()
+mysql_oidc_user@localhost mysql_oidc_user@%
+SET GLOBAL auth_openid_connect_configuration = 'JSON://{"oidc-idp": {"issuer-name": "https://idp-test.com/realms/dummy", "keys": [{"kid": "rsa-key-1", "kty": "RSA", "n": "ptR4YxjdrF2RrYiY9XYH3KcXKzlS6b2foGAeHN9dViAs5yKStKAucUf81kszq6LkzkOOPX5SbToLBRv5wwOtrBLKVkqhw4i5kS0b-7jpR9g7lER3qfDVYfe0nneaJzc-1Iz6id0oVj4ay8lGmWg5JX5Z8nBs52_7rfDIBtyAsyIQ2dF2tW4e72cypvskw_TwdbsqelY5ZezzTmKx8Ra4-o9Pu5_Vxe1Hhlkx1K_tfbGH9ZUsbFy90b0Vcw5w6EKPEkM9mZTUoj8TMeHTHaiOREK4llIJ6hokXbEG8BsKJuMuYrzx98e23JkaWaWQY27LUGK5sx-lsX_n8DO2kEASRw", "e": "AQAB", "use": "sig", "alg": "RS256"}]}}';
+user() current_user()
+mysql_oidc_user@localhost mysql_oidc_user@%
+SHOW GLOBAL STATUS LIKE 'auth_openid_connect%';
+Variable_name Value
+auth_openid_connect_configured_group_role_maps 0
+auth_openid_connect_configured_idps 1
+auth_openid_connect_configured_idps_using_jwks 0
+auth_openid_connect_users_authenticated 5
+auth_openid_connect_users_denied 16
+auth_openid_connect_users_proxied 0
+auth_openid_connect_users_with_roles 0
+SELECT COUNT_ALLOC>0, SUM_NUMBER_OF_BYTES_ALLOC>0, CURRENT_NUMBER_OF_BYTES_USED>0 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/auth_openid_connect/%';
+COUNT_ALLOC>0 SUM_NUMBER_OF_BYTES_ALLOC>0 CURRENT_NUMBER_OF_BYTES_USED>0
+1 1 1
+
+### CLEANUP
+DROP USER 'mysql_oidc_user'@'%';
+UNINSTALL PLUGIN auth_openid_connect;
diff --git a/mysql-test/suite/auth_openid_connect/r/group_role.result b/mysql-test/suite/auth_openid_connect/r/group_role.result
new file mode 100644
index 000000000000..2165eedbc1c5
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/r/group_role.result
@@ -0,0 +1,27 @@
+### INITIALIZE TESTS
+INSTALL PLUGIN auth_openid_connect SONAME 'auth_openid_connect.so';;
+SET GLOBAL auth_openid_connect_configuration = 'FILE:///std_data/oidc/dummy_oidc_conf.json';
+CREATE USER mysql_oidc_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "oidc-idp", "user" : "oidc-user"}';
+CREATE ROLE accounting;
+CREATE ROLE sales;
+
+### Connect user without dynamically added role, fails to set the role
+### Connect user with dynamically added role
+# - acc from token maps to accounting role according to the config
+# - hr is unmapped
+### Connect user without dynamically added role, verify the roles were revoked
+SHOW GLOBAL STATUS LIKE 'auth_openid_connect%';
+Variable_name Value
+auth_openid_connect_configured_group_role_maps 2
+auth_openid_connect_configured_idps 2
+auth_openid_connect_configured_idps_using_jwks 0
+auth_openid_connect_users_authenticated 5
+auth_openid_connect_users_denied 0
+auth_openid_connect_users_proxied 0
+auth_openid_connect_users_with_roles 3
+
+### CLEANUP
+DROP USER mysql_oidc_user;
+DROP USER accounting;
+DROP USER sales;
+UNINSTALL PLUGIN auth_openid_connect;
diff --git a/mysql-test/suite/auth_openid_connect/r/group_role_lock_failure.result b/mysql-test/suite/auth_openid_connect/r/group_role_lock_failure.result
new file mode 100644
index 000000000000..47f85efe42da
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/r/group_role_lock_failure.result
@@ -0,0 +1,23 @@
+INSTALL PLUGIN auth_openid_connect SONAME 'auth_openid_connect.so';;
+SET GLOBAL auth_openid_connect_configuration = 'FILE:///std_data/oidc/dummy_oidc_conf.json';
+CREATE USER mysql_oidc_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "oidc-idp", "user" : "oidc-user"}';
+CREATE ROLE accounting;
+#
+# A login reporting external roles reaches the EXCLUSIVE lock; when that
+# acquisition fails the login must fail too
+#
+SET GLOBAL debug = '+d,fail_acl_external_roles_write_lock';
+ERROR 3547 (HY000): Can not lock user management caches for processing.
+SET GLOBAL debug = '';
+#
+# The server is still up and the same login works again
+#
+SELECT 1 AS server_alive;
+server_alive
+1
+#
+# CLEANUP
+#
+DROP USER mysql_oidc_user;
+DROP USER accounting;
+UNINSTALL PLUGIN auth_openid_connect;
diff --git a/mysql-test/suite/auth_openid_connect/r/idp.result b/mysql-test/suite/auth_openid_connect/r/idp.result
new file mode 100644
index 000000000000..4ffeae32a5f2
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/r/idp.result
@@ -0,0 +1,53 @@
+### INITIALIZE TESTS
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'JWKS configuration is insecure");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'IDP not found");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'JWKS: HTTP GET from https://dummy-host");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'configuration of unaccessible-idp");
+INSTALL PLUGIN auth_openid_connect SONAME 'auth_openid_connect.so';
+SET GLOBAL auth_openid_connect_configuration = 'JSON://';
+CREATE USER mysql_oidc_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "my-keycloak", "user" : ""}';;
+CREATE USER mysql_other_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "my-keycloak", "user" : "other-user-id"}';
+
+## Login tests
+user() current_user()
+mysql_oidc_user@localhost mysql_oidc_user@%
+
+## role mapping tests
+CREATE ROLE accounting;
+CREATE ROLE marketing;
+
+## Tests of update_jwks() UDF
+CREATE FUNCTION update_jwks RETURNS INTEGER SONAME 'auth_openid_connect.so';
+SELECT update_jwks();
+update_jwks()
+1
+SELECT update_jwks('my-keycloak');
+update_jwks('my-keycloak')
+1
+SELECT update_jwks('unaccessible-idp');
+update_jwks('unaccessible-idp')
+0
+SELECT update_jwks('dummy');
+update_jwks('dummy')
+NULL
+SELECT update_jwks('arg1', 'arg2');
+ERROR HY000: Can't initialize function 'update_jwks'; function requires 0 or 1 argument
+SELECT update_jwks(123);
+ERROR HY000: Can't initialize function 'update_jwks'; first argument of the function must be string
+SHOW GLOBAL STATUS LIKE 'auth_openid_connect%';
+Variable_name Value
+auth_openid_connect_configured_group_role_maps 4
+auth_openid_connect_configured_idps 3
+auth_openid_connect_configured_idps_using_jwks 2
+auth_openid_connect_users_authenticated 3
+auth_openid_connect_users_denied 1
+auth_openid_connect_users_proxied 0
+auth_openid_connect_users_with_roles 3
+
+### CLEANUP
+DROP USER mysql_oidc_user;
+DROP USER mysql_other_user;
+DROP ROLE accounting;
+DROP ROLE marketing;
+DROP FUNCTION update_jwks;
+UNINSTALL PLUGIN auth_openid_connect;
diff --git a/mysql-test/suite/auth_openid_connect/r/proxy.result b/mysql-test/suite/auth_openid_connect/r/proxy.result
new file mode 100644
index 000000000000..1d1123e7edc5
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/r/proxy.result
@@ -0,0 +1,66 @@
+### INITIALIZE TESTS
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'JWKS configuration is insecure");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'JWKS: HTTP GET from https://dummy-host");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'configuration of unaccessible-idp");
+INSTALL PLUGIN auth_openid_connect SONAME 'auth_openid_connect.so';
+SET GLOBAL auth_openid_connect_configuration = 'JSON://';
+INSTALL PLUGIN mysql_no_login SONAME 'mysql_no_login.so';
+CREATE USER '/accounting' IDENTIFIED WITH 'mysql_no_login';
+CREATE USER '/marketing' IDENTIFIED WITH 'mysql_no_login';
+
+## First group proxying
+CREATE USER ''@'' IDENTIFIED WITH 'auth_openid_connect' AS '{\"identity_provider\" : \"my-keycloak\"}';
+GRANT PROXY ON '/accounting' TO ''@'';
+GRANT PROXY ON '/marketing' TO ''@'';
+
+IDP kk_proxy_user user is member of /marketing group:
+expecting USER is mysql_oidc_user, CURRENT_USER is /marketing
+user() current_user()
+mysql_oidc_user@localhost /marketing@%
+
+IDP kkuser user is member of /accounting group:
+expecting USER is mysql_oidc_user, CURRENT_USER is /accounting
+user() current_user()
+mysql_oidc_user@localhost /accounting@%
+
+IDP kkuser-no-groups user is not member of any group:
+expecting access denied
+DROP USER ''@'';
+
+## Named group proxying
+CREATE USER accounting IDENTIFIED WITH 'auth_openid_connect' AS '{\"identity_provider\" : \"my-keycloak\", \"group"\ : \"/accounting\" }';
+GRANT PROXY ON '/accounting' TO accounting;
+CREATE USER marketing IDENTIFIED WITH 'auth_openid_connect' AS '{\"identity_provider\" : \"my-keycloak\", \"group"\ : \"/marketing\" }';
+GRANT PROXY ON '/marketing' TO marketing;
+GRANT PROXY ON '/accounting' TO accounting;
+GRANT PROXY ON '/marketing' TO marketing;
+
+IDP kk_proxy_user user is member of /marketing group:
+expecting USER is marketing, CURRENT_USER is /marketing
+user() current_user()
+marketing@localhost /marketing@%
+
+IDP kkuser user is member of /accounting group:
+expecting USER is accounting, CURRENT_USER is /accounting
+user() current_user()
+accounting@localhost /accounting@%
+
+IDP kkuser user is not member of /marketing group:
+expecting access denied
+DROP USER accounting;
+DROP USER marketing;
+SHOW GLOBAL STATUS LIKE 'auth_openid_connect%';
+Variable_name Value
+auth_openid_connect_configured_group_role_maps 4
+auth_openid_connect_configured_idps 3
+auth_openid_connect_configured_idps_using_jwks 2
+auth_openid_connect_users_authenticated 4
+auth_openid_connect_users_denied 2
+auth_openid_connect_users_proxied 4
+auth_openid_connect_users_with_roles 0
+
+### CLEANUP
+DROP USER '/accounting';
+DROP USER '/marketing';
+UNINSTALL PLUGIN auth_openid_connect;
+UNINSTALL PLUGIN mysql_no_login;
diff --git a/mysql-test/suite/auth_openid_connect/r/telemetry.result b/mysql-test/suite/auth_openid_connect/r/telemetry.result
new file mode 100644
index 000000000000..61a270e36c25
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/r/telemetry.result
@@ -0,0 +1,29 @@
+# restart
+INSTALL PLUGIN auth_openid_connect SONAME 'auth_openid_connect.so';;
+CREATE USER mysql_oidc_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "oidc-idp", "user" : "oidc-user"}';
+SET GLOBAL auth_openid_connect_configuration = 'FILE://';
+user() current_user()
+mysql_oidc_user@localhost mysql_oidc_user@%
+ "auth_openid_connect"
+ "name": "auth_openid_connect_configured_group_role_maps",
+ "variable_value": "2"
+--
+ "name": "auth_openid_connect_configured_idps",
+ "variable_value": "2"
+--
+ "name": "auth_openid_connect_configured_idps_using_jwks",
+ "variable_value": "0"
+--
+ "name": "auth_openid_connect_users_authenticated",
+ "variable_value": "1"
+--
+ "name": "auth_openid_connect_users_denied",
+ "variable_value": "0"
+--
+ "name": "auth_openid_connect_users_proxied",
+ "variable_value": "0"
+--
+ "name": "auth_openid_connect_users_with_roles",
+ "variable_value": "0"
+DROP USER 'mysql_oidc_user'@'%';
+UNINSTALL PLUGIN auth_openid_connect;
diff --git a/mysql-test/suite/auth_openid_connect/t/auth-master.opt b/mysql-test/suite/auth_openid_connect/t/auth-master.opt
new file mode 100755
index 000000000000..3c7dc63a1570
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/t/auth-master.opt
@@ -0,0 +1 @@
+$AUTH_OIDC_OPT
diff --git a/mysql-test/suite/auth_openid_connect/t/auth.test b/mysql-test/suite/auth_openid_connect/t/auth.test
new file mode 100644
index 000000000000..0351e3c6b282
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/t/auth.test
@@ -0,0 +1,210 @@
+
+###################### INIT #######################
+if ($CREATE_ID_TOKEN == "")
+{
+ --skip create_id_token tool not available, skipping test
+}
+
+--echo ### INITIALIZE TESTS
+--let $CONFIG_FILE = FILE://$MYSQL_TEST_DIR/std_data/oidc/dummy_oidc_conf.json
+--let $CONFIG_JSON = JSON://{\"oidc-idp\": {\"issuer-name\": \"https://idp-test.com/realms/dummy\", \"keys\": [{\"kid\": \"rsa-key-1\", \"kty\": \"RSA\", \"n\": \"ptR4YxjdrF2RrYiY9XYH3KcXKzlS6b2foGAeHN9dViAs5yKStKAucUf81kszq6LkzkOOPX5SbToLBRv5wwOtrBLKVkqhw4i5kS0b-7jpR9g7lER3qfDVYfe0nneaJzc-1Iz6id0oVj4ay8lGmWg5JX5Z8nBs52_7rfDIBtyAsyIQ2dF2tW4e72cypvskw_TwdbsqelY5ZezzTmKx8Ra4-o9Pu5_Vxe1Hhlkx1K_tfbGH9ZUsbFy90b0Vcw5w6EKPEkM9mZTUoj8TMeHTHaiOREK4llIJ6hokXbEG8BsKJuMuYrzx98e23JkaWaWQY27LUGK5sx-lsX_n8DO2kEASRw\", \"e\": \"AQAB\", \"use\": \"sig\", \"alg\": \"RS256\"}], \"audiences\": [\"ee2811b9-10b8\",\"https://api.example.com\"]}}
+--let $CONFIG_JSON_NO_AUD = JSON://{\"oidc-idp\": {\"issuer-name\": \"https://idp-test.com/realms/dummy\", \"keys\": [{\"kid\": \"rsa-key-1\", \"kty\": \"RSA\", \"n\": \"ptR4YxjdrF2RrYiY9XYH3KcXKzlS6b2foGAeHN9dViAs5yKStKAucUf81kszq6LkzkOOPX5SbToLBRv5wwOtrBLKVkqhw4i5kS0b-7jpR9g7lER3qfDVYfe0nneaJzc-1Iz6id0oVj4ay8lGmWg5JX5Z8nBs52_7rfDIBtyAsyIQ2dF2tW4e72cypvskw_TwdbsqelY5ZezzTmKx8Ra4-o9Pu5_Vxe1Hhlkx1K_tfbGH9ZUsbFy90b0Vcw5w6EKPEkM9mZTUoj8TMeHTHaiOREK4llIJ6hokXbEG8BsKJuMuYrzx98e23JkaWaWQY27LUGK5sx-lsX_n8DO2kEASRw\", \"e\": \"AQAB\", \"use\": \"sig\", \"alg\": \"RS256\"}]}}
+--let $TOKEN_FILE = $MYSQLTEST_VARDIR/tmp/id_token.txt
+--let $COMMON_TOKEN_ARGS = --key $MYSQL_TEST_DIR/std_data/oidc/idp_private.pem --sub oidc-user --iss https://idp-test.com/realms/dummy --aud ee2811b9-10b8 --out $TOKEN_FILE
+--let $TOKEN_ARGS_NO_AUD = --key $MYSQL_TEST_DIR/std_data/oidc/idp_private.pem --sub oidc-user --iss https://idp-test.com/realms/dummy --kid rsa-key-1 --out $TOKEN_FILE
+--let $TOKEN_ARGS_MANY_AUDS = --key $MYSQL_TEST_DIR/std_data/oidc/idp_private.pem --sub oidc-user --iss https://idp-test.com/realms/dummy --kid rsa-key-1 --aud first,ee2811b9-10b8,third --out $TOKEN_FILE
+--let $MYSQL_OIDC_USER = --authentication-openid-connect-client-id-token-file=$TOKEN_FILE --plugin-dir=$AUTH_OIDC_DIR --user=mysql_oidc_user -e "SELECT user(), current_user()"
+--let $MYSQL_INVALID_USER = --authentication-openid-connect-client-id-token-file=$TOKEN_FILE --plugin-dir=$AUTH_OIDC_DIR --user=invalid_user -e "SELECT user(), current_user()"
+
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'auth_openid_connect_configuration not set");
+--replace_regex /\.dll/.so/
+--eval INSTALL PLUGIN auth_openid_connect SONAME '$AUTH_OIDC';
+CREATE USER mysql_oidc_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "oidc-idp", "user" : "oidc-user"}';
+
+
+###################### TESTS #######################
+
+--echo
+--echo ### Validate system variable checks for auth_openid_connect_configuration
+
+--exec $CREATE_ID_TOKEN $COMMON_TOKEN_ARGS
+
+--echo
+--echo ## VALID CASES
+
+# valid JSON config (FR.1, FR.2)
+# note, that the above JSON config contains only one key, so omitting "kid" is allowed -we test this feature by the way
+--eval SET GLOBAL auth_openid_connect_configuration = '$CONFIG_JSON'
+--exec $MYSQL $MYSQL_OIDC_USER
+
+# valid FILE config (FR.1, FR.3)
+--exec $CREATE_ID_TOKEN $COMMON_TOKEN_ARGS --kid rsa-key-1
+--replace_result $CONFIG_FILE FILE:///std_data/oidc/dummy_oidc_conf.json
+--eval SET GLOBAL auth_openid_connect_configuration = '$CONFIG_FILE'
+--exec $MYSQL $MYSQL_OIDC_USER
+
+--echo
+--echo ## INVALID CASES
+
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'invalid sysvar prefix");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'invalid value for system variable'");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'cannot open config file:");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'extra content after correct JSON document'");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'syntax error");
+
+# invalid prefix, expect error
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL auth_openid_connect_configuration = 'INVD://';
+
+# invalid (non-parsable) JSON, expect error
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL auth_openid_connect_configuration = 'JSON://{"invalid"[}';
+
+# invalid (incorrect path) FILE, expect error
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL auth_openid_connect_configuration = 'FILE://nonexistent_path/nonexistent_file.json';
+
+# valid JSON + extra non-parsed element at the end
+--error ER_WRONG_VALUE_FOR_VAR
+--eval SET GLOBAL auth_openid_connect_configuration = '$CONFIG_JSON , {\"oidc-idp\": {\"issuer-name\":\"name\"}}'
+
+# valid JSON, but missing the configuration inside, expect error on connection
+SET GLOBAL auth_openid_connect_configuration = 'JSON://{}';
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER
+
+
+#####################################
+--echo
+--echo ### Client side validations (FR.5)
+--replace_result $CONFIG_FILE FILE:///std_data/oidc/dummy_oidc_conf.json
+--eval SET GLOBAL auth_openid_connect_configuration = '$CONFIG_FILE'
+
+# mising --authentication-openid-connect-client-id-token-file parameter
+--error 1
+--exec $MYSQL --plugin-dir=$AUTH_OIDC_DIR --user=mysql_oidc_user -e "SELECT user(), current_user()"
+
+# missing token file
+--remove_file $TOKEN_FILE
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER
+
+#####################################
+--echo
+--echo ### CREATE USER with incorrect AS clause
+
+# missing user name
+# expect the user is created, but cannot authenticate (FR.4.a)
+CREATE USER invalid_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "oidc-idp"}';
+--exec $CREATE_ID_TOKEN $COMMON_TOKEN_ARGS --kid rsa-key-1
+--error 1
+--exec $MYSQL $MYSQL_INVALID_USER
+DROP USER invalid_user;
+
+# missing IDP
+# expect the user is created, but cannot authenticate (FR.4.a)
+CREATE USER invalid_user IDENTIFIED WITH 'auth_openid_connect' AS '{"user" : "oidc-user"}';
+--exec $CREATE_ID_TOKEN $COMMON_TOKEN_ARGS --kid rsa-key-1
+--error 1
+--exec $MYSQL $MYSQL_INVALID_USER
+DROP USER invalid_user;
+
+# missing whole clause
+# expect the user is created, but cannot authenticate (FR.4.a)
+CREATE USER invalid_user IDENTIFIED WITH 'auth_openid_connect';
+--exec $CREATE_ID_TOKEN $COMMON_TOKEN_ARGS --kid rsa-key-1
+--error 1
+--exec $MYSQL $MYSQL_INVALID_USER
+DROP USER invalid_user;
+
+
+#####################################
+--echo
+--echo ### Verifying token (FR.7, FR.8, FR.9)
+
+# invalid content of token file -failure (FR.8.b)
+--remove_file $TOKEN_FILE
+write_file $TOKEN_FILE;
+some dummy content
+EOF
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER
+
+# token expired: TTL < 0 -failure (FR.8.c)
+--exec $CREATE_ID_TOKEN $COMMON_TOKEN_ARGS --kid rsa-key-1 --ttl -10
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER
+
+# sub doesn't match -failure (FR.8.d)
+--exec $CREATE_ID_TOKEN --key $MYSQL_TEST_DIR/std_data/oidc/idp_private.pem --sub oidc-user-invalid --iss https://idp-test.com/realms/dummy --aud ee2811b9-10b8 --kid rsa-key-1 --out $TOKEN_FILE
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER
+
+# iss doesn't match -failure (FR.8.e)
+--exec $CREATE_ID_TOKEN --key $MYSQL_TEST_DIR/std_data/oidc/idp_private.pem --sub oidc-user --iss https://invalid.com/realms/dummy --aud ee2811b9-10b8 --kid rsa-key-1 --out $TOKEN_FILE
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER
+
+# missing IDP configuration -failure (FR.8.f)
+CREATE USER invalid_user IDENTIFIED WITH 'auth_openid_connect' AS '{"user" : "oidc-user", "identity_provider" : "nonexistent-idp"}';
+--exec $CREATE_ID_TOKEN $COMMON_TOKEN_ARGS --kid rsa-key-1
+--error 1
+--exec $MYSQL $MYSQL_INVALID_USER
+DROP USER invalid_user;
+
+# non-existing kid claim, multiple key in IDP -failure (FR.8.g)
+--exec $CREATE_ID_TOKEN --key $MYSQL_TEST_DIR/std_data/oidc/idp_private.pem --sub oidc-user --iss https://idp-test.com/realms/dummy --aud ee2811b9-10b8 --kid nonexistent --out $TOKEN_FILE
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER
+
+# no kid claim, multiple key in IDP -failure (FR.8.h)
+--exec $CREATE_ID_TOKEN $COMMON_TOKEN_ARGS
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER
+
+# no kid claim, single key in IDP -success (FR.8.h, FR.9)
+--eval SET GLOBAL auth_openid_connect_configuration = '$CONFIG_JSON'
+--exec $CREATE_ID_TOKEN $COMMON_TOKEN_ARGS
+--exec $MYSQL $MYSQL_OIDC_USER
+
+# single key in IDP, alg not match -failure (FR.8.i)
+--exec $CREATE_ID_TOKEN --key $MYSQL_TEST_DIR/std_data/oidc/idp_private.pem --sub oidc-user --iss https://idp-test.com/realms/dummy --aud ee2811b9-10b8 --alg HS256 --out $TOKEN_FILE
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER
+
+# multiple keys in IDP, alg not match -failure (FR.8.i)
+--replace_result $CONFIG_FILE FILE:///std_data/oidc/dummy_oidc_conf.json
+--eval SET GLOBAL auth_openid_connect_configuration = '$CONFIG_FILE'
+--exec $CREATE_ID_TOKEN --key $MYSQL_TEST_DIR/std_data/oidc/idp_private.pem --sub oidc-user --iss https://idp-test.com/realms/dummy --aud ee2811b9-10b8 --alg HS512 --out $TOKEN_FILE
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER
+
+# aud doesn't match -failure (FR.8.j)
+--exec $CREATE_ID_TOKEN --key $MYSQL_TEST_DIR/std_data/oidc/idp_private.pem --sub oidc-user --iss https://idp-test.com/realms/dummy --aud invalid-aud --kid rsa-key-1 --out $TOKEN_FILE
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER
+
+# aud is missing -failure (FR.8.j)
+--exec $CREATE_ID_TOKEN $TOKEN_ARGS_NO_AUD
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER
+
+# many auds -success
+--exec $CREATE_ID_TOKEN $TOKEN_ARGS_MANY_AUDS
+--exec $MYSQL $MYSQL_OIDC_USER
+
+# aud is missing, but audiences were not configured -success
+--eval SET GLOBAL auth_openid_connect_configuration = '$CONFIG_JSON_NO_AUD'
+--exec $CREATE_ID_TOKEN $TOKEN_ARGS_NO_AUD
+--exec $MYSQL $MYSQL_OIDC_USER
+
+SHOW GLOBAL STATUS LIKE 'auth_openid_connect%';
+
+# ensure memory instrumentation works
+SELECT COUNT_ALLOC>0, SUM_NUMBER_OF_BYTES_ALLOC>0, CURRENT_NUMBER_OF_BYTES_USED>0 FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/auth_openid_connect/%';
+###################### CLEANUP #######################
+--echo
+--echo ### CLEANUP
+DROP USER 'mysql_oidc_user'@'%';
+UNINSTALL PLUGIN auth_openid_connect;
+--remove_file $TOKEN_FILE
diff --git a/mysql-test/suite/auth_openid_connect/t/group_role-master.opt b/mysql-test/suite/auth_openid_connect/t/group_role-master.opt
new file mode 100755
index 000000000000..3c7dc63a1570
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/t/group_role-master.opt
@@ -0,0 +1 @@
+$AUTH_OIDC_OPT
diff --git a/mysql-test/suite/auth_openid_connect/t/group_role.test b/mysql-test/suite/auth_openid_connect/t/group_role.test
new file mode 100644
index 000000000000..e1bca50a15a7
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/t/group_role.test
@@ -0,0 +1,58 @@
+
+###################### INIT #######################
+if ($CREATE_ID_TOKEN == "")
+{
+ --skip create_id_token tool not available, skipping test
+}
+
+--echo ### INITIALIZE TESTS
+--let $CONFIG_FILE = FILE://$MYSQL_TEST_DIR/std_data/oidc/dummy_oidc_conf.json
+--let $TOKEN_FILE = $MYSQLTEST_VARDIR/tmp/id_token.txt
+--let $COMMON_TOKEN_ARGS = --key $MYSQL_TEST_DIR/std_data/oidc/idp_private.pem --sub oidc-user --iss https://idp-test.com/realms/dummy --aud ee2811b9-10b8 --out $TOKEN_FILE --kid rsa-key-1
+--let $MYSQL_OIDC_USER = --authentication-openid-connect-client-id-token-file=$TOKEN_FILE --plugin-dir=$AUTH_OIDC_DIR --user=mysql_oidc_user
+
+--replace_regex /\.dll/.so/
+--eval INSTALL PLUGIN auth_openid_connect SONAME '$AUTH_OIDC';
+
+--replace_result $CONFIG_FILE FILE:///std_data/oidc/dummy_oidc_conf.json
+--eval SET GLOBAL auth_openid_connect_configuration = '$CONFIG_FILE'
+CREATE USER mysql_oidc_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "oidc-idp", "user" : "oidc-user"}';
+CREATE ROLE accounting;
+CREATE ROLE sales;
+
+###################### TESTS #######################
+
+--echo
+--echo ### Connect user without dynamically added role, fails to set the role
+--exec $CREATE_ID_TOKEN $COMMON_TOKEN_ARGS
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER -e "SET ROLE accounting"
+
+--echo ### Connect user with dynamically added role
+--echo # - acc from token maps to accounting role according to the config
+--echo # - hr is unmapped
+--exec $CREATE_ID_TOKEN $COMMON_TOKEN_ARGS --groups "[\"acc\", \"hr\"]"
+# success
+--exec $MYSQL $MYSQL_OIDC_USER -e "SET ROLE accounting"
+# failure
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER -e "SET ROLE hr"
+# failure
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER -e "SET ROLE sales"
+
+--echo ### Connect user without dynamically added role, verify the roles were revoked
+--exec $CREATE_ID_TOKEN $COMMON_TOKEN_ARGS
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER -e "SET ROLE accounting"
+
+SHOW GLOBAL STATUS LIKE 'auth_openid_connect%';
+
+###################### CLEANUP #######################
+--echo
+--echo ### CLEANUP
+DROP USER mysql_oidc_user;
+DROP USER accounting;
+DROP USER sales;
+UNINSTALL PLUGIN auth_openid_connect;
+--remove_file $TOKEN_FILE
diff --git a/mysql-test/suite/auth_openid_connect/t/group_role_lock_failure-master.opt b/mysql-test/suite/auth_openid_connect/t/group_role_lock_failure-master.opt
new file mode 100755
index 000000000000..3c7dc63a1570
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/t/group_role_lock_failure-master.opt
@@ -0,0 +1 @@
+$AUTH_OIDC_OPT
diff --git a/mysql-test/suite/auth_openid_connect/t/group_role_lock_failure.test b/mysql-test/suite/auth_openid_connect/t/group_role_lock_failure.test
new file mode 100644
index 000000000000..30081004e0db
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/t/group_role_lock_failure.test
@@ -0,0 +1,62 @@
+# PS-11593: when the EXCLUSIVE ACL cache lock cannot be acquired while applying
+# external roles, the login must FAIL and not reach my_ok().
+#
+# Only a login whose authentication plugin reports external roles should reach
+# the exclusive lock in apply_external_roles(); an ordinary password login
+# returns earlier, under the shared probe. This test uses the OIDC plugin to
+# reach that path.
+#
+# Before the fix apply_external_roles() returned void and discarded the result
+# of lock(), so ER_CANNOT_LOCK_USER_MANAGEMENT_CACHES was left in the
+# diagnostics area and acl_authenticate() carried on to my_ok(), aborting a
+# debug server on Diagnostics_area::assert_not_set.
+
+--source include/have_debug.inc
+
+if ($CREATE_ID_TOKEN == "")
+{
+ --skip create_id_token tool not available, skipping test
+}
+
+--let $CONFIG_FILE = FILE://$MYSQL_TEST_DIR/std_data/oidc/dummy_oidc_conf.json
+--let $TOKEN_FILE = $MYSQLTEST_VARDIR/tmp/id_token_ps11593.txt
+--let $COMMON_TOKEN_ARGS = --key $MYSQL_TEST_DIR/std_data/oidc/idp_private.pem --sub oidc-user --iss https://idp-test.com/realms/dummy --aud ee2811b9-10b8 --out $TOKEN_FILE --kid rsa-key-1
+--let $MYSQL_OIDC_USER = --authentication-openid-connect-client-id-token-file=$TOKEN_FILE --plugin-dir=$AUTH_OIDC_DIR --user=mysql_oidc_user
+
+--replace_regex /\.dll/.so/
+--eval INSTALL PLUGIN auth_openid_connect SONAME '$AUTH_OIDC';
+--replace_result $CONFIG_FILE FILE:///std_data/oidc/dummy_oidc_conf.json
+--eval SET GLOBAL auth_openid_connect_configuration = '$CONFIG_FILE'
+
+CREATE USER mysql_oidc_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "oidc-idp", "user" : "oidc-user"}';
+CREATE ROLE accounting;
+
+--let $old_debug = `SELECT @@GLOBAL.debug`
+
+--echo #
+--echo # A login reporting external roles reaches the EXCLUSIVE lock; when that
+--echo # acquisition fails the login must fail too
+--echo #
+--exec $CREATE_ID_TOKEN $COMMON_TOKEN_ARGS --groups "[\"acc\"]"
+SET GLOBAL debug = '+d,fail_acl_external_roles_write_lock';
+
+--replace_regex /^mysql: \[Warning\].*\n//
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER -e "SELECT 1" 2>&1
+
+--eval SET GLOBAL debug = '$old_debug'
+
+--echo #
+--echo # The server is still up and the same login works again
+--echo #
+--exec $MYSQL $MYSQL_OIDC_USER -e "SET ROLE accounting"
+
+SELECT 1 AS server_alive;
+
+--echo #
+--echo # CLEANUP
+--echo #
+DROP USER mysql_oidc_user;
+DROP USER accounting;
+UNINSTALL PLUGIN auth_openid_connect;
+--remove_file $TOKEN_FILE
diff --git a/mysql-test/suite/auth_openid_connect/t/idp-master.opt b/mysql-test/suite/auth_openid_connect/t/idp-master.opt
new file mode 100755
index 000000000000..3c7dc63a1570
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/t/idp-master.opt
@@ -0,0 +1 @@
+$AUTH_OIDC_OPT
diff --git a/mysql-test/suite/auth_openid_connect/t/idp.test b/mysql-test/suite/auth_openid_connect/t/idp.test
new file mode 100644
index 000000000000..9427dc10e023
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/t/idp.test
@@ -0,0 +1,105 @@
+
+###################### INIT #######################
+--source suite/auth_openid_connect/inc/set_idp_vars.inc
+--source suite/auth_openid_connect/inc/keycloak_oidc_conf.inc
+--echo ### INITIALIZE TESTS
+--let $IDP_URL = https://keycloak.int.percona.com/realms/master/protocol/openid-connect
+
+### Check if IdP is available
+--exec sh -c "curl -fsS $IDP_URL/certs >/dev/null 2>&1 && echo ok > $MYSQLTEST_VARDIR/tmp/idp_flag || true";
+if (`SELECT IF(LOAD_FILE('$MYSQLTEST_VARDIR/tmp/idp_flag') IS NULL, 1, 0)`)
+{
+ --skip IdP not available, skipping test
+}
+--remove_file $MYSQLTEST_VARDIR/tmp/idp_flag
+
+--let $TOKEN_FILE = $MYSQLTEST_VARDIR/tmp/id_token.txt
+--let $MYSQL_OIDC_USER = --authentication-openid-connect-client-id-token-file=$TOKEN_FILE --plugin-dir=$AUTH_OIDC_DIR --user=mysql_oidc_user
+--let $MYSQL_OTHER_USER = --authentication-openid-connect-client-id-token-file=$TOKEN_FILE --plugin-dir=$AUTH_OIDC_DIR --user=mysql_other_user
+
+let $OBTAIN_ID_TOKEN = curl --fail -sS -X POST "$IDP_URL/token"
+ -H "Content-Type: application/x-www-form-urlencoded"
+ -d "grant_type=password"
+ -d "client_id=myclient"
+ -d "username=kkuser"
+ --data-urlencode "password=alamakota1"
+ -d "scope=openid"
+| jq -er '.id_token';
+
+## suppress errors and warnings caused by tests
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'JWKS configuration is insecure");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'IDP not found");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'JWKS: HTTP GET from https://dummy-host");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'configuration of unaccessible-idp");
+
+--replace_regex /\.dll/.so/
+--eval INSTALL PLUGIN auth_openid_connect SONAME '$AUTH_OIDC'
+--replace_result $KEYCLOAK_OIDC_CONF JSON://
+--eval SET GLOBAL auth_openid_connect_configuration = '$KEYCLOAK_OIDC_CONF'
+--replace_result $IDP_USER_ID
+--eval CREATE USER mysql_oidc_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "my-keycloak", "user" : "$IDP_USER_ID"}';
+CREATE USER mysql_other_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "my-keycloak", "user" : "other-user-id"}';
+
+###################### TESTS #######################
+--echo
+--echo ## Login tests
+
+exec $OBTAIN_ID_TOKEN > $TOKEN_FILE;
+
+## login successful
+--exec $MYSQL $MYSQL_OIDC_USER -e "SELECT user(), current_user()"
+
+# cannot authenticate as someone else
+--error 1
+--exec $MYSQL $MYSQL_OTHER_USER -e "SELECT user(), current_user()"
+
+--echo
+--echo ## role mapping tests
+CREATE ROLE accounting;
+CREATE ROLE marketing;
+## success
+--exec $MYSQL $MYSQL_OIDC_USER -e "SET ROLE accounting"
+
+## failure, the user is not member of group mapped to the role
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER -e "SET ROLE marketing"
+
+--echo
+--echo ## Tests of update_jwks() UDF
+
+--replace_regex /\.dll/.so/
+--eval CREATE FUNCTION update_jwks RETURNS INTEGER SONAME '$AUTH_OIDC'
+
+## no argument, update all, return 1 as there is 1 accessible IDP
+SELECT update_jwks();
+
+## one argument -configured and accessible IDP, return 1
+SELECT update_jwks('my-keycloak');
+
+## one argument -configured but accessible IDP, return 0
+SELECT update_jwks('unaccessible-idp');
+
+## one argument -non configured IDP, return NULL
+SELECT update_jwks('dummy');
+
+## two arguments not allowed, expect error
+--error ER_CANT_INITIALIZE_UDF
+SELECT update_jwks('arg1', 'arg2');
+
+## invalid type of argument, expect error
+--error ER_CANT_INITIALIZE_UDF
+SELECT update_jwks(123);
+
+SHOW GLOBAL STATUS LIKE 'auth_openid_connect%';
+
+###################### CLEANUP #######################
+--echo
+--echo ### CLEANUP
+DROP USER mysql_oidc_user;
+DROP USER mysql_other_user;
+DROP ROLE accounting;
+DROP ROLE marketing;
+--remove_file $TOKEN_FILE
+DROP FUNCTION update_jwks;
+UNINSTALL PLUGIN auth_openid_connect;
+
diff --git a/mysql-test/suite/auth_openid_connect/t/proxy-master.opt b/mysql-test/suite/auth_openid_connect/t/proxy-master.opt
new file mode 100755
index 000000000000..3c7dc63a1570
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/t/proxy-master.opt
@@ -0,0 +1 @@
+$AUTH_OIDC_OPT
diff --git a/mysql-test/suite/auth_openid_connect/t/proxy.test b/mysql-test/suite/auth_openid_connect/t/proxy.test
new file mode 100644
index 000000000000..eda1b1698f16
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/t/proxy.test
@@ -0,0 +1,148 @@
+
+###################### INIT #######################
+--source include/have_mysql_no_login_plugin.inc
+--source suite/auth_openid_connect/inc/set_idp_vars.inc
+--source suite/auth_openid_connect/inc/keycloak_oidc_conf.inc
+--echo ### INITIALIZE TESTS
+--let $IDP_URL = $IDP_HOST/realms/master/protocol/openid-connect
+
+### Check if IdP is available
+--exec sh -c "curl -fsS $IDP_URL/certs >/dev/null 2>&1 && echo ok > $MYSQLTEST_VARDIR/tmp/idp_flag || true";
+if (`SELECT IF(LOAD_FILE('$MYSQLTEST_VARDIR/tmp/idp_flag') IS NULL, 1, 0)`)
+{
+ --skip IdP not available, skipping test
+}
+--remove_file $MYSQLTEST_VARDIR/tmp/idp_flag
+
+--let $TOKEN_FILE = $MYSQLTEST_VARDIR/tmp/id_token.txt
+--let $MYSQL_OIDC_USER = --authentication-openid-connect-client-id-token-file=$TOKEN_FILE --plugin-dir=$AUTH_OIDC_DIR --user=mysql_oidc_user
+--let $MYSQL_MARKETING_USER = --authentication-openid-connect-client-id-token-file=$TOKEN_FILE --plugin-dir=$AUTH_OIDC_DIR --user=marketing
+--let $MYSQL_ACCOUNTING_USER = --authentication-openid-connect-client-id-token-file=$TOKEN_FILE --plugin-dir=$AUTH_OIDC_DIR --user=accounting
+
+let $OBTAIN_ID_TOKEN_1 = curl --fail -sS -X POST "$IDP_URL/token"
+ -H "Content-Type: application/x-www-form-urlencoded"
+ -d "grant_type=password"
+ -d "client_id=myclient"
+ -d "username=kk_proxy_user"
+ --data-urlencode "password=kotmaale"
+ -d "scope=openid"
+| jq -er '.id_token';
+
+let $OBTAIN_ID_TOKEN_2 = curl --fail -sS -X POST "$IDP_URL/token"
+ -H "Content-Type: application/x-www-form-urlencoded"
+ -d "grant_type=password"
+ -d "client_id=myclient"
+ -d "username=kkuser"
+ --data-urlencode "password=alamakota1"
+ -d "scope=openid"
+| jq -er '.id_token';
+
+let $OBTAIN_ID_TOKEN_3 = curl --fail -sS -X POST "$IDP_URL/token"
+ -H "Content-Type: application/x-www-form-urlencoded"
+ -d "grant_type=password"
+ -d "client_id=myclient"
+ -d "username=kk_no_group_user"
+ --data-urlencode "password=QWSdm0qtuDctHMHvZXq235xApO5EiSr"
+ -d "scope=openid"
+| jq -er '.id_token';
+
+## suppress errors and warnings caused by tests
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'JWKS configuration is insecure");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'JWKS: HTTP GET from https://dummy-host");
+CALL mtr.add_suppression("Plugin auth_openid_connect reported: 'configuration of unaccessible-idp");
+
+--replace_regex /\.dll/.so/
+--eval INSTALL PLUGIN auth_openid_connect SONAME '$AUTH_OIDC'
+--replace_result $KEYCLOAK_OIDC_CONF JSON://
+--eval SET GLOBAL auth_openid_connect_configuration = '$KEYCLOAK_OIDC_CONF'
+
+--replace_regex /\.dll/.so/
+eval INSTALL PLUGIN mysql_no_login SONAME '$MYSQL_NO_LOGIN';
+
+### Create proxied accounts
+CREATE USER '/accounting' IDENTIFIED WITH 'mysql_no_login';
+CREATE USER '/marketing' IDENTIFIED WITH 'mysql_no_login';
+
+###################### TESTS #######################
+--echo
+--echo ## First group proxying
+## The user is authenticated using anonymous account,
+## the proxied account is selected automatically based on the first group name
+
+CREATE USER ''@'' IDENTIFIED WITH 'auth_openid_connect' AS '{\"identity_provider\" : \"my-keycloak\"}';
+GRANT PROXY ON '/accounting' TO ''@'';
+GRANT PROXY ON '/marketing' TO ''@'';
+
+exec $OBTAIN_ID_TOKEN_1 > $TOKEN_FILE;
+
+--echo
+--echo IDP kk_proxy_user user is member of /marketing group:
+--echo expecting USER is mysql_oidc_user, CURRENT_USER is /marketing
+--exec $MYSQL $MYSQL_OIDC_USER -e "SELECT user(), current_user()"
+
+exec $OBTAIN_ID_TOKEN_2 > $TOKEN_FILE;
+
+--echo
+--echo IDP kkuser user is member of /accounting group:
+--echo expecting USER is mysql_oidc_user, CURRENT_USER is /accounting
+--exec $MYSQL $MYSQL_OIDC_USER -e "SELECT user(), current_user()"
+
+exec $OBTAIN_ID_TOKEN_3 > $TOKEN_FILE;
+
+--echo
+--echo IDP kkuser-no-groups user is not member of any group:
+--echo expecting access denied
+--error 1
+--exec $MYSQL $MYSQL_OIDC_USER -e "SELECT user(), current_user()"
+
+DROP USER ''@'';
+
+--echo
+--echo ## Named group proxying
+## The user is authenticated using shared account connected to a group,
+## the proxied account is selected automatically based on the group name
+
+CREATE USER accounting IDENTIFIED WITH 'auth_openid_connect' AS '{\"identity_provider\" : \"my-keycloak\", \"group"\ : \"/accounting\" }';
+GRANT PROXY ON '/accounting' TO accounting;
+
+CREATE USER marketing IDENTIFIED WITH 'auth_openid_connect' AS '{\"identity_provider\" : \"my-keycloak\", \"group"\ : \"/marketing\" }';
+GRANT PROXY ON '/marketing' TO marketing;
+
+GRANT PROXY ON '/accounting' TO accounting;
+GRANT PROXY ON '/marketing' TO marketing;
+
+exec $OBTAIN_ID_TOKEN_1 > $TOKEN_FILE;
+
+--echo
+--echo IDP kk_proxy_user user is member of /marketing group:
+--echo expecting USER is marketing, CURRENT_USER is /marketing
+--exec $MYSQL $MYSQL_MARKETING_USER -e "SELECT user(), current_user()"
+
+exec $OBTAIN_ID_TOKEN_2 > $TOKEN_FILE;
+
+--echo
+--echo IDP kkuser user is member of /accounting group:
+--echo expecting USER is accounting, CURRENT_USER is /accounting
+--exec $MYSQL $MYSQL_ACCOUNTING_USER -e "SELECT user(), current_user()"
+
+--echo
+--echo IDP kkuser user is not member of /marketing group:
+--echo expecting access denied
+--error 1
+--exec $MYSQL $MYSQL_MARKETING_USER -e "SELECT user(), current_user()"
+
+DROP USER accounting;
+DROP USER marketing;
+
+SHOW GLOBAL STATUS LIKE 'auth_openid_connect%';
+
+###################### CLEANUP #######################
+--echo
+--echo ### CLEANUP
+DROP USER '/accounting';
+DROP USER '/marketing';
+
+--remove_file $TOKEN_FILE
+UNINSTALL PLUGIN auth_openid_connect;
+UNINSTALL PLUGIN mysql_no_login;
+
diff --git a/mysql-test/suite/auth_openid_connect/t/telemetry-master.opt b/mysql-test/suite/auth_openid_connect/t/telemetry-master.opt
new file mode 100755
index 000000000000..3c7dc63a1570
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/t/telemetry-master.opt
@@ -0,0 +1 @@
+$AUTH_OIDC_OPT
diff --git a/mysql-test/suite/auth_openid_connect/t/telemetry.test b/mysql-test/suite/auth_openid_connect/t/telemetry.test
new file mode 100644
index 000000000000..790c8d6b43fa
--- /dev/null
+++ b/mysql-test/suite/auth_openid_connect/t/telemetry.test
@@ -0,0 +1,40 @@
+###################### INIT #######################
+--source include/big_test.inc
+--source include/have_percona_telemetry.inc
+if ($CREATE_ID_TOKEN == "")
+{
+ --skip create_id_token tool not available, skipping test
+}
+--let $CONFIG_FILE = FILE://$MYSQL_TEST_DIR/std_data/oidc/dummy_oidc_conf.json
+--let $TOKEN_FILE = $MYSQLTEST_VARDIR/tmp/id_token.txt
+--let $TELEMETRY_DIR = $MYSQLTEST_VARDIR/tmp/telemetry
+--let $GRACE_INTERVAL = 20
+--let $SLEEP_TIME = 21
+
+--mkdir $TELEMETRY_DIR
+
+###################### TESTS #######################
+# restart the server with custom telemetry file path
+--let $restart_parameters = "restart:--percona_telemetry.grace_interval=$GRACE_INTERVAL --percona_telemetry.telemetry_root_dir=$TELEMETRY_DIR"
+--let $do_not_echo_parameters = 1
+--source include/restart_mysqld.inc
+
+--replace_regex /\.dll/.so/
+--eval INSTALL PLUGIN auth_openid_connect SONAME '$AUTH_OIDC';
+CREATE USER mysql_oidc_user IDENTIFIED WITH 'auth_openid_connect' AS '{"identity_provider" : "oidc-idp", "user" : "oidc-user"}';
+
+--exec $CREATE_ID_TOKEN --key $MYSQL_TEST_DIR/std_data/oidc/idp_private.pem --sub oidc-user --iss https://idp-test.com/realms/dummy --aud ee2811b9-10b8 --out $TOKEN_FILE --kid rsa-key-1
+--replace_result $CONFIG_FILE FILE://
+--eval SET GLOBAL auth_openid_connect_configuration = '$CONFIG_FILE'
+--exec $MYSQL --authentication-openid-connect-client-id-token-file=$TOKEN_FILE --plugin-dir=$AUTH_OIDC_DIR --user=mysql_oidc_user -e "SELECT user(), current_user()"
+
+--sleep $SLEEP_TIME
+
+--exec grep -rh '"auth_openid_connect"' $TELEMETRY_DIR
+--exec grep -A 1 -rh '"name": "auth_openid_connect_' $TELEMETRY_DIR
+
+###################### CLEANUP #######################
+DROP USER 'mysql_oidc_user'@'%';
+UNINSTALL PLUGIN auth_openid_connect;
+--remove_file $TOKEN_FILE
+--force-rmdir $TELEMETRY_DIR
diff --git a/mysql-test/suite/binlog/r/binlog_enforce_gtid_consistency_trx_nontrx_violation.result b/mysql-test/suite/binlog/r/binlog_enforce_gtid_consistency_trx_nontrx_violation.result
index ee4c7e7e533f..d60209cc2c4c 100644
--- a/mysql-test/suite/binlog/r/binlog_enforce_gtid_consistency_trx_nontrx_violation.result
+++ b/mysql-test/suite/binlog/r/binlog_enforce_gtid_consistency_trx_nontrx_violation.result
@@ -1,4 +1,3 @@
-include/rpl/set_gtid_mode_off.inc
include/rpl/begin_replace_gtid_combination.inc [gtid_mode=off/on -> binlog_direct_non_transactional_updates=0/1]
include/rpl/init.inc [topology=none]
SET @old_sql_notes= @@GLOBAL.SQL_NOTES;
diff --git a/mysql-test/suite/binlog/r/binlog_grant_alter_user.result b/mysql-test/suite/binlog/r/binlog_grant_alter_user.result
index 62ed1b5c50a0..a296e22a0bed 100644
--- a/mysql-test/suite/binlog/r/binlog_grant_alter_user.result
+++ b/mysql-test/suite/binlog/r/binlog_grant_alter_user.result
@@ -1455,7 +1455,7 @@ slave-bin.000001 # Query # # use `test`; ALTER USER 'user1'@'localhost' IDENTIFI
slave-bin.000001 # Query # # use `test`; ALTER USER 'user2'@'localhost' IDENTIFIED WITH 'caching_sha2_password' AS ''
slave-bin.000001 # Query # # use `test`; CREATE USER 'user4'@'localhost' IDENTIFIED WITH 'caching_sha2_password'
slave-bin.000001 # Query # # use `test`; ALTER USER 'user4'@'localhost' PASSWORD EXPIRE
-slave-bin.000001 # Query # # use `test`; ALTER USER 'user4'@'localhost' IDENTIFIED WITH 'caching_sha2_password'
+slave-bin.000001 # Query # # use `test`; ALTER USER 'user4'@'localhost' IDENTIFIED WITH 'caching_sha2_password' AS ''
slave-bin.000001 # Query # # use `test`; CREATE USER 'user3'@'localhost' IDENTIFIED WITH 'caching_sha2_password' AS ''
slave-bin.000001 # Query # # use `test`; CREATE USER 'user5'@'localhost' IDENTIFIED WITH 'caching_sha2_password' AS ''
slave-bin.000001 # Query # # use `test`; ALTER USER 'user3'@'localhost' IDENTIFIED WITH 'caching_sha2_password' AS ''
diff --git a/mysql-test/suite/binlog/t/binlog_enforce_gtid_consistency_trx_nontrx_violation.test b/mysql-test/suite/binlog/t/binlog_enforce_gtid_consistency_trx_nontrx_violation.test
index e3e3edf2feea..58f618e446c4 100644
--- a/mysql-test/suite/binlog/t/binlog_enforce_gtid_consistency_trx_nontrx_violation.test
+++ b/mysql-test/suite/binlog/t/binlog_enforce_gtid_consistency_trx_nontrx_violation.test
@@ -1,8 +1,5 @@
--source include/no_valgrind_without_big.inc
-# This test doesn't support GTID
---source include/rpl/set_gtid_mode_off.inc
-
--let $variable= binlog_direct_non_transactional_updates
--source include/rpl/begin_replace_gtid_combination.inc
@@ -11,6 +8,3 @@
--let $variable= binlog_direct_non_transactional_updates
--source include/rpl/end_replace_gtid_combination.inc
-
-# Restore the default for gtid_mode which is ON
---source include/rpl/set_gtid_mode_on.inc
diff --git a/mysql-test/suite/binlog_gtid/r/binlog_check_gtid_persistor_compatibility.result b/mysql-test/suite/binlog_gtid/r/binlog_check_gtid_persistor_compatibility.result
index 768f9d61fe11..243b24037e30 100644
--- a/mysql-test/suite/binlog_gtid/r/binlog_check_gtid_persistor_compatibility.result
+++ b/mysql-test/suite/binlog_gtid/r/binlog_check_gtid_persistor_compatibility.result
@@ -1,13 +1,14 @@
-# 1. Set debug points which save GTID in version 1 and cause
-# a crash before GTID is persisted in table.
+# 1. Set debug points which save GTID in version 1 and disable
+# clone GTID flushing during setup.
-# Adding debug point 'crash_before_gtid_table_persistor_save' to @@GLOBAL.debug
+# Adding debug point 'gtid_persist_flush_disable' to @@GLOBAL.debug
# Adding debug point 'gtid_persistor_use_gtid_version_one' to @@GLOBAL.debug
-# 2. Execute queries, restart server after crash
+# 2. Execute setup query, set crash debug point, restart server after crash
CREATE TABLE t (a INT);
+# Adding debug point 'crash_before_gtid_table_persistor_save' to @@SESSION.debug
FLUSH LOGS;
ERROR HY000: Lost connection to MySQL server during query
diff --git a/mysql-test/suite/binlog_gtid/t/binlog_check_gtid_persistor_compatibility.test b/mysql-test/suite/binlog_gtid/t/binlog_check_gtid_persistor_compatibility.test
index 52f51f97add2..651296940a6d 100644
--- a/mysql-test/suite/binlog_gtid/t/binlog_check_gtid_persistor_compatibility.test
+++ b/mysql-test/suite/binlog_gtid/t/binlog_check_gtid_persistor_compatibility.test
@@ -7,9 +7,9 @@
# ==== IMPLEMENTATION ====
#
# Steps:
-# 1. Set debug points which save GTID in version 1 and cause
-# a crash before GTID is persisted in table.
-# 2. Execute queries, restart server after crash
+# 1. Set debug points which save GTID in version 1 and disable
+# clone GTID flushing during setup.
+# 2. Execute setup query, set crash debug point, restart server after crash
# 3. Verify that GTIDs were persisted correctly
#
# ==== REQUIREMENTS ====
@@ -26,21 +26,27 @@
--source include/have_debug.inc
--echo
---echo # 1. Set debug points which save GTID in version 1 and cause
---echo # a crash before GTID is persisted in table.
+--echo # 1. Set debug points which save GTID in version 1 and disable
+--echo # clone GTID flushing during setup.
--echo
---let $debug_point = crash_before_gtid_table_persistor_save
+# Prevent the clone GTID background thread from flushing the GTID before
+# the crash point is armed for the FLUSH LOGS statement.
+--let $debug_point = gtid_persist_flush_disable
--source include/add_debug_point.inc
--let $debug_point = gtid_persistor_use_gtid_version_one
--source include/add_debug_point.inc
--echo
---echo # 2. Execute queries, restart server after crash
+--echo # 2. Execute setup query, set crash debug point, restart server after crash
--echo
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
CREATE TABLE t (a INT);
+--let $debug_point = crash_before_gtid_table_persistor_save
+--let $debug_type = SESSION
+--source include/add_debug_point.inc
+--let $debug_type =
--error 2013
FLUSH LOGS;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/clone/r/remote_error_invalid_data_file_index.result b/mysql-test/suite/clone/r/remote_error_invalid_data_file_index.result
new file mode 100644
index 000000000000..dcae0296a9e4
--- /dev/null
+++ b/mysql-test/suite/clone/r/remote_error_invalid_data_file_index.result
@@ -0,0 +1,17 @@
+INSTALL PLUGIN clone SONAME 'CLONE_PLUGIN';
+SET GLOBAL clone_autotune_concurrency = OFF;
+SET GLOBAL clone_max_concurrency = 8;
+SET GLOBAL clone_valid_donor_list = 'HOST:PORT';
+SET GLOBAL DEBUG = '+d,clone_send_invalid_data_file_index';
+CLONE INSTANCE FROM USER@HOST:PORT IDENTIFIED BY '' DATA DIRECTORY = 'CLONE_DATADIR';
+ERROR HY000: Clone received unexpected response from Donor : Wrong Clone RPC: Invalid Data File Index.
+SELECT STATE, ERROR_NO > 0 AS error_set,
+LOCATE('Invalid Data File Index', ERROR_MESSAGE) > 0
+AS has_invalid_index
+FROM performance_schema.clone_status;
+STATE error_set has_invalid_index
+Failed 1 1
+SET GLOBAL DEBUG = '-d,clone_send_invalid_data_file_index';
+SET GLOBAL clone_max_concurrency = DEFAULT;
+SET GLOBAL clone_autotune_concurrency = DEFAULT;
+UNINSTALL PLUGIN clone;
diff --git a/mysql-test/suite/clone/t/remote_error_invalid_data_file_index.test b/mysql-test/suite/clone/t/remote_error_invalid_data_file_index.test
new file mode 100644
index 000000000000..d5fa7b095ef2
--- /dev/null
+++ b/mysql-test/suite/clone/t/remote_error_invalid_data_file_index.test
@@ -0,0 +1,36 @@
+# Test remote clone error for an invalid data file index descriptor
+--source include/have_debug.inc
+--source include/have_innodb_max_16k.inc
+
+--let $CLONE_DATADIR = $MYSQL_TMP_DIR/data_new
+--let $HOST = 127.0.0.1
+--let $PORT =`select @@port`
+--let $USER = root
+
+--replace_result $CLONE_PLUGIN CLONE_PLUGIN
+--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
+
+SET GLOBAL clone_autotune_concurrency = OFF;
+SET GLOBAL clone_max_concurrency = 8;
+
+--replace_result $HOST HOST $PORT PORT
+--eval SET GLOBAL clone_valid_donor_list = '$HOST:$PORT'
+
+SET GLOBAL DEBUG = '+d,clone_send_invalid_data_file_index';
+
+--replace_result $CLONE_DATADIR CLONE_DATADIR $HOST HOST $PORT PORT $USER USER
+--error ER_CLONE_PROTOCOL
+--eval CLONE INSTANCE FROM $USER@$HOST:$PORT IDENTIFIED BY '' DATA DIRECTORY = '$CLONE_DATADIR'
+
+SELECT STATE, ERROR_NO > 0 AS error_set,
+ LOCATE('Invalid Data File Index', ERROR_MESSAGE) > 0
+ AS has_invalid_index
+FROM performance_schema.clone_status;
+
+SET GLOBAL DEBUG = '-d,clone_send_invalid_data_file_index';
+SET GLOBAL clone_max_concurrency = DEFAULT;
+SET GLOBAL clone_autotune_concurrency = DEFAULT;
+
+UNINSTALL PLUGIN clone;
+
+--force-rmdir $CLONE_DATADIR
diff --git a/mysql-test/suite/component_audit_log_filter/r/abort_during_startup.result b/mysql-test/suite/component_audit_log_filter/r/abort_during_startup.result
new file mode 100644
index 000000000000..1ed68c2011e6
--- /dev/null
+++ b/mysql-test/suite/component_audit_log_filter/r/abort_during_startup.result
@@ -0,0 +1,11 @@
+CALL mtr.add_suppression("Option --authentication-policy is set to an invalid value");
+CALL mtr.add_suppression("Aborting");
+### Shutdown
+### Start with invalid option
+# restart_abort: --authentication-policy=mysql_native_password --loose-mysql_native_password=OFF
+### Waiting for the error message to occur
+include/wait_for_pattern_in_file.inc [authentication-policy is set to an invalid value]
+### Start again
+# restart:
+### Check that the server only refused to start, and did not crash
+include/assert_grep.inc [Server rejected the configuration without crashing]
diff --git a/mysql-test/suite/component_audit_log_filter/r/filter_definition_abort_event.result b/mysql-test/suite/component_audit_log_filter/r/filter_definition_abort_event.result
index 8408b9b273ed..9fd381255561 100644
--- a/mysql-test/suite/component_audit_log_filter/r/filter_definition_abort_event.result
+++ b/mysql-test/suite/component_audit_log_filter/r/filter_definition_abort_event.result
@@ -37,17 +37,17 @@ SELECT audit_log_filter_set_user('%', 'table_readonly');
audit_log_filter_set_user('%', 'table_readonly')
OK
INSERT INTO t1 VALUES (2);
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_INSERT';1).
+ERROR HY000: Statement was aborted by an audit log filter.
INSERT INTO t2 VALUES (2);
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_INSERT';1).
+ERROR HY000: Statement was aborted by an audit log filter.
UPDATE t1 SET c1 = 3 WHERE c1 = 2;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_UPDATE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
UPDATE t2 SET c2 = 3 WHERE c2 = 2;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_UPDATE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
DELETE FROM t1 WHERE c1 = 1;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_DELETE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
DELETE FROM t2 WHERE c2 = 1;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_DELETE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT * FROM t1;
c1
1
@@ -90,16 +90,16 @@ SELECT audit_log_filter_set_user('%', 'no_t1_access');
audit_log_filter_set_user('%', 'no_t1_access')
OK
INSERT INTO t1 VALUES (2);
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_INSERT';1).
+ERROR HY000: Statement was aborted by an audit log filter.
INSERT INTO t2 VALUES (2);
UPDATE t1 SET c1 = 3 WHERE c1 = 2;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_UPDATE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
UPDATE t2 SET c2 = 3 WHERE c2 = 2;
DELETE FROM t1 WHERE c1 = 1;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_DELETE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
DELETE FROM t2 WHERE c2 = 1;
SELECT * FROM t1;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_READ';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT * FROM t2;
c2
3
@@ -132,7 +132,7 @@ SELECT audit_log_filter_set_user('%', 'abort_message');
audit_log_filter_set_user('%', 'abort_message')
OK
SELECT audit_api_message_emit_udf('component_text', 'producer_text', 'message_text', 'key', 'value') AS 'Message';
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_MESSAGE_USER';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_remove_user('%');
audit_log_filter_remove_user('%')
OK
diff --git a/mysql-test/suite/component_audit_log_filter/r/udf_audit_log_filter_flush_wrong_format.result b/mysql-test/suite/component_audit_log_filter/r/udf_audit_log_filter_flush_wrong_format.result
new file mode 100644
index 000000000000..0a6c3da3946d
--- /dev/null
+++ b/mysql-test/suite/component_audit_log_filter/r/udf_audit_log_filter_flush_wrong_format.result
@@ -0,0 +1,51 @@
+call mtr.add_suppression("Component audit_log_filter reported: 'Wrong JSON filter '.*' format");
+call mtr.add_suppression("Component audit_log_filter reported: 'audit_log_filter name: .*, filter: .* has wrong format");
+call mtr.add_suppression("Component audit_log_filter reported: 'Wrong argument: incorrect rule definition");
+SELECT audit_log_filter_set_filter('filter_1', '{"filter": {"class": {"name": "general"}}}');
+audit_log_filter_set_filter('filter_1', '{"filter": {"class": {"name": "general"}}}')
+OK
+#
+# A condition with too few operands. The reported reason must be the
+# one from the parser, not a suggestion to change the event mode.
+#
+UPDATE mysql.audit_log_filter SET filter = '{"filter": {"class": {"name": "general", "event": {"name": "status", "log": {"or": [{"field": {"name": "general_command.str", "value": "Execute"}}]}}}}}' WHERE name = 'filter_1';
+SELECT audit_log_filter_flush();
+audit_log_filter_flush()
+ERROR: Filter 'filter_1' has wrong format: there should be at least two fields provided for 'or' condition
+#
+# A different defect must give a different reason.
+#
+UPDATE mysql.audit_log_filter SET filter = '{"filter": {"class": {"name": "no_such_class"}}}' WHERE name = 'filter_1';
+SELECT audit_log_filter_flush();
+audit_log_filter_flush()
+ERROR: Filter 'filter_1' has wrong format: unknown event class name 'no_such_class'
+#
+# Valid JSON - the column type enforces that much - but not a filter.
+#
+UPDATE mysql.audit_log_filter SET filter = '{"not_a_filter": 1}' WHERE name = 'filter_1';
+SELECT audit_log_filter_flush();
+audit_log_filter_flush()
+ERROR: Filter 'filter_1' has wrong format: missing or invalid 'filter' object
+#
+# The same definitions are rejected with the same reason by
+# audit_log_filter_set_filter(), which never had this problem.
+#
+SELECT audit_log_filter_set_filter('filter_2', '{"filter": {"class": {"name": "general", "event": {"name": "status", "log": {"or": [{"field": {"name": "general_command.str", "value": "Execute"}}]}}}}}');
+audit_log_filter_set_filter('filter_2', '{"filter": {"class": {"name": "general", "event": {"name": "status", "log": {"or": [{"field": {"name": "general_command.str", "value": "Execute"}}]}}}}}')
+ERROR: Incorrect rule definition: there should be at least two fields provided for 'or' condition
+SELECT audit_log_filter_set_filter('filter_2', '{"filter": {"class": {"name": "no_such_class"}}}');
+audit_log_filter_set_filter('filter_2', '{"filter": {"class": {"name": "no_such_class"}}}')
+ERROR: Incorrect rule definition: unknown event class name 'no_such_class'
+#
+# A well formed filter still loads.
+#
+UPDATE mysql.audit_log_filter SET filter = '{"filter": {"class": {"name": "general"}}}' WHERE name = 'filter_1';
+SELECT audit_log_filter_flush();
+audit_log_filter_flush()
+OK
+#
+# Cleanup
+#
+SELECT audit_log_filter_remove_filter('filter_1');
+audit_log_filter_remove_filter('filter_1')
+OK
diff --git a/mysql-test/suite/component_audit_log_filter/r/udf_audit_log_read_max_array_length_in_start.result b/mysql-test/suite/component_audit_log_filter/r/udf_audit_log_read_max_array_length_in_start.result
new file mode 100644
index 000000000000..cbb3c6557099
--- /dev/null
+++ b/mysql-test/suite/component_audit_log_filter/r/udf_audit_log_read_max_array_length_in_start.result
@@ -0,0 +1,80 @@
+#
+# PS-11186: max_array_length does not work in FULL/REDUCED mode audit logs
+# https://perconadev.atlassian.net/browse/PS-11186
+#
+# PS is running with JSON audit log format in FULL event mode.
+#
+# audit_log_read() must honour the "max_array_length" limit both when it
+# is placed at the top level next to "start":
+#
+# audit_log_read('{"start": {"timestamp": "..."}, "max_array_length": 1}')
+#
+# and when it is nested INSIDE the "start" object, as in the bug report:
+#
+# audit_log_read('{"start": {"timestamp": "...", "max_array_length": 1}}')
+#
+# Previously the nested form silently ignored the limit and returned ALL
+# matching events. The bug was in the UDF argument parsing and does not
+# depend on the event_mode (REDUCED mode is affected too).
+#
+SET GLOBAL audit_log_filter.event_mode=FULL;
+#
+# Set up a filter that logs table access events and generate five
+# events with deterministic timestamps (10:01:00 .. 10:05:00).
+CREATE TABLE t1 (c1 INT);
+SELECT audit_log_filter_set_filter('log_inserts', '{"filter": { "class": {"name": "table_access", "event": {"name": "insert", "log": true} } } }');
+audit_log_filter_set_filter('log_inserts', '{"filter": { "class": {"name": "table_access", "event": {"name": "insert", "log": true} } } }')
+OK
+SELECT audit_log_filter_set_user('%', 'log_inserts');
+audit_log_filter_set_user('%', 'log_inserts')
+OK
+SET GLOBAL DEBUG='+d,audit_log_filter_debug_timestamp';
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+#
+# Rotate so that all five events are flushed to a closed log file.
+SELECT audit_log_rotate();
+audit_log_rotate()
+
+#
+# max_array_length at the TOP level limits the result to a single event.
+SELECT audit_log_read('{"start": {"timestamp": "2022-08-09 10:00:00"}, "max_array_length": 1}');
+audit_log_read('{"start": {"timestamp": "2022-08-09 10:00:00"}, "max_array_length": 1}')
+[
+{"timestamp": "2022-08-09 10:01:00", "id": 0, "class": "table_access", "event": "insert", "connection_id": , "account": {"user": "root", "host": "localhost"}, "login": {"user": "root", "os": "", "ip": "", "proxy": ""}, "table_access_data": {"db": "test", "table": "t1", "query": "INSERT INTO t1 VALUES (1)", "sql_command": "insert"}}
+]
+
+SELECT audit_log_read('null');
+audit_log_read('null')
+OK
+#
+# max_array_length nested INSIDE "start" (the bug report's form) now also
+# limits the result to a single event.
+SELECT audit_log_read('{"start": {"timestamp": "2022-08-09 10:00:00", "max_array_length": 1}}');
+audit_log_read('{"start": {"timestamp": "2022-08-09 10:00:00", "max_array_length": 1}}')
+[
+{"timestamp": "2022-08-09 10:01:00", "id": 0, "class": "table_access", "event": "insert", "connection_id": , "account": {"user": "root", "host": "localhost"}, "login": {"user": "root", "os": "", "ip": "", "proxy": ""}, "table_access_data": {"db": "test", "table": "t1", "query": "INSERT INTO t1 VALUES (1)", "sql_command": "insert"}}
+]
+
+SELECT audit_log_read('null');
+audit_log_read('null')
+OK
+#
+# A top-level max_array_length takes precedence over a nested one.
+SELECT audit_log_read('{"start": {"timestamp": "2022-08-09 10:00:00", "max_array_length": 5}, "max_array_length": 2}');
+audit_log_read('{"start": {"timestamp": "2022-08-09 10:00:00", "max_array_length": 5}, "max_array_length": 2}')
+[
+{"timestamp": "2022-08-09 10:01:00", "id": 0, "class": "table_access", "event": "insert", "connection_id": , "account": {"user": "root", "host": "localhost"}, "login": {"user": "root", "os": "", "ip": "", "proxy": ""}, "table_access_data": {"db": "test", "table": "t1", "query": "INSERT INTO t1 VALUES (1)", "sql_command": "insert"}},
+{"timestamp": "2022-08-09 10:02:00", "id": 1, "class": "table_access", "event": "insert", "connection_id": , "account": {"user": "root", "host": "localhost"}, "login": {"user": "root", "os": "", "ip": "", "proxy": ""}, "table_access_data": {"db": "test", "table": "t1", "query": "INSERT INTO t1 VALUES (2)", "sql_command": "insert"}}
+]
+
+SELECT audit_log_read('null');
+audit_log_read('null')
+OK
+#
+# Cleanup
+DROP TABLE t1;
+SET GLOBAL DEBUG='-d,audit_log_filter_debug_timestamp';
diff --git a/mysql-test/suite/component_audit_log_filter/r/udf_audit_log_read_not_initialized.result b/mysql-test/suite/component_audit_log_filter/r/udf_audit_log_read_not_initialized.result
new file mode 100644
index 000000000000..80dbadb161af
--- /dev/null
+++ b/mysql-test/suite/component_audit_log_filter/r/udf_audit_log_read_not_initialized.result
@@ -0,0 +1,25 @@
+#
+# No read sequence has ever been initialized in this session.
+#
+SELECT audit_log_read();
+ERROR HY000: audit_log_read UDF failed; Reader not initialized.
+#
+# Still not initialized after a bookmark read is prepared but the
+# sequence is closed again.
+#
+SELECT audit_log_read(audit_log_read_bookmark());
+SELECT audit_log_read('null');
+audit_log_read('null')
+OK
+SELECT audit_log_read();
+ERROR HY000: audit_log_read UDF failed; Reader not initialized.
+#
+# Genuinely wrong arguments keep reporting the argument as the problem.
+#
+SELECT audit_log_read('{"timestamp": "2026-01-01 00:00:00"}');
+ERROR HY000: audit_log_read UDF failed; Wrong argument format
+SELECT audit_log_read('[]');
+ERROR HY000: audit_log_read UDF failed; Wrong argument format
+#
+# Cleanup
+#
diff --git a/mysql-test/suite/component_audit_log_filter/r/udf_audit_log_read_reopen_sequence.result b/mysql-test/suite/component_audit_log_filter/r/udf_audit_log_read_reopen_sequence.result
new file mode 100644
index 000000000000..e98a266aff87
--- /dev/null
+++ b/mysql-test/suite/component_audit_log_filter/r/udf_audit_log_read_reopen_sequence.result
@@ -0,0 +1,55 @@
+#
+# PS-11182: Audit log read sequence needs to be closed before a new
+# read sequence is initialized
+# https://perconadev.atlassian.net/browse/PS-11182
+#
+# PS is running with JSON audit log format in REDUCED event mode.
+#
+# When a read sequence is already open (for example, started with a
+# "start" timestamp), initializing a NEW read sequence with a bookmark
+# ("timestamp" + "id") must implicitly close the open sequence and start
+# a fresh one, exactly as documented by Oracle:
+#
+# "It is unnecessary to close reading explicitly. Reading is closed
+# implicitly when the session ends or a new read sequence is
+# initialized by calling audit_log_read() with an argument that
+# indicates the position at which to begin."
+#
+#
+# Set up a filter that logs table access events so that the audit log
+# contains readable events.
+CREATE TABLE t1 (c1 INT);
+SELECT audit_log_filter_set_filter('log_inserts', '{"filter": { "class": {"name": "table_access", "event": {"name": "insert", "log": true} } } }');
+audit_log_filter_set_filter('log_inserts', '{"filter": { "class": {"name": "table_access", "event": {"name": "insert", "log": true} } } }')
+OK
+SELECT audit_log_filter_set_user('%', 'log_inserts');
+audit_log_filter_set_user('%', 'log_inserts')
+OK
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+#
+# Rotate to flush the events to a closed log file, then capture a valid
+# bookmark (timestamp + id) for the events written so far.
+SET @bookmark := audit_log_read_bookmark();
+#
+# Step 1: open a read sequence using a "start" timestamp, reading only a
+# single event (max_array_length = 1) so that the read sequence
+# stays OPEN (it is not read to the end, so it is not implicitly
+# closed on session end).
+SELECT audit_log_read('{"start": {"timestamp": "2022-08-09 10:10:00"}, "max_array_length": 1}');
+#
+# Step 2: without explicitly closing, initialize a NEW read sequence
+# using the bookmark. This implicitly closes the sequence opened
+# in step 1 and succeeds (as it does in upstream MySQL).
+SELECT audit_log_read(@bookmark) AS reopen_with_bookmark;
+#
+# Close the read sequence explicitly.
+SELECT audit_log_read('null');
+audit_log_read('null')
+OK
+#
+# Cleanup
+DROP TABLE t1;
diff --git a/mysql-test/suite/component_audit_log_filter/t/abort_during_startup.test b/mysql-test/suite/component_audit_log_filter/t/abort_during_startup.test
new file mode 100644
index 000000000000..354275fc955e
--- /dev/null
+++ b/mysql-test/suite/component_audit_log_filter/t/abort_during_startup.test
@@ -0,0 +1,64 @@
+####################################################################
+# PS-11273: the component must not crash when the server aborts.
+#
+# When the server terminates early - here by way of an invalid
+# --authentication-policy - it never calls the component's deinit
+# function, so whatever the component left behind at namespace scope is
+# torn down during static destruction instead. Destroying AuditLogFilter
+# that late destroys its AuditUdf member, and
+# AuditUdf::deinit() -> SysVars::get_comp_registry_srv() then touches a
+# static that may already be gone. The server died a second time on top
+# of the configuration error:
+#
+# mysqld got signal 6
+# #11 audit_log_filter::SysVars::get_comp_registry_srv()
+# #12 audit_log_filter::AuditUdf::deinit()
+# #13 audit_log_filter::AuditUdf::~AuditUdf()
+# #15 std::unique_ptr::~unique_ptr()
+#
+# The abort is an assert(), hence the debug build requirement below; a
+# release build takes the same path but reads the destroyed object
+# instead of stopping.
+#
+# So the test starts the server with a configuration it has to reject,
+# and checks that the only thing wrong with that startup is the
+# configuration error itself.
+####################################################################
+
+--source include/have_component_audit_log.inc
+--source include/have_debug.inc
+--source ../inc/audit_tables_init.inc
+--source ../inc/audit_comp_install.inc
+
+CALL mtr.add_suppression("Option --authentication-policy is set to an invalid value");
+CALL mtr.add_suppression("Aborting");
+
+--echo ### Shutdown
+--source include/shutdown_mysqld.inc
+
+--echo ### Start with invalid option
+--let $restart_parameters=--authentication-policy=mysql_native_password --loose-mysql_native_password=OFF
+--source include/start_mysqld_expecting_crash.inc
+
+--echo ### Waiting for the error message to occur
+--let $grep_pattern=authentication-policy is set to an invalid value
+--let $grep_file=$MYSQLTEST_VARDIR/log/mysqld.1.err
+--source include/wait_for_pattern_in_file.inc
+
+--echo ### Start again
+--let $restart_parameters=restart:
+--source include/start_mysqld.inc
+
+--echo ### Check that the server only refused to start, and did not crash
+# Checked after the restart because assert_grep.inc needs a server to run on.
+# The aborted process is long gone by then, so its error log is complete;
+# without the fix this finds the signal 6 raised while the component was
+# being torn down at exit.
+--let $assert_text=Server rejected the configuration without crashing
+--let $assert_file=$MYSQLTEST_VARDIR/log/mysqld.1.err
+--let $assert_select=mysqld got signal
+--let $assert_count=0
+--source include/assert_grep.inc
+
+--source ../inc/audit_comp_uninstall.inc
+--source ../inc/audit_tables_cleanup.inc
diff --git a/mysql-test/suite/component_audit_log_filter/t/sys_var_audit_log_filter_disable.test b/mysql-test/suite/component_audit_log_filter/t/sys_var_audit_log_filter_disable.test
index 02dc5d0a80e9..022681dab92c 100644
--- a/mysql-test/suite/component_audit_log_filter/t/sys_var_audit_log_filter_disable.test
+++ b/mysql-test/suite/component_audit_log_filter/t/sys_var_audit_log_filter_disable.test
@@ -43,6 +43,7 @@ call mtr.add_suppression("Audit Log Filter is disabled. Enable it with audit_log
CREATE USER 'user1'@'%' IDENTIFIED BY '111';
GRANT SYSTEM_VARIABLES_ADMIN ON *.* to 'user1'@'%';
+--source include/count_sessions.inc
connect(conn1, localhost, user1, 111, test);
--connection conn1
@@ -59,6 +60,12 @@ SELECT @@global.audit_log_filter.disable;
--disconnect conn1
--connection default
+# Wait for the disconnected session to be gone: while it is alive it still
+# holds cached references to the component's event_tracking_* service
+# implementations, which makes UNINSTALL COMPONENT fail with
+# ER_COMPONENTS_UNLOAD_CANT_UNREGISTER_SERVICE.
+--source include/wait_until_count_sessions.inc
+
--echo #
--echo # Cleanup
--source ../inc/audit_comp_uninstall.inc
diff --git a/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_filter_flush_wrong_format.test b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_filter_flush_wrong_format.test
new file mode 100644
index 000000000000..3392334153c1
--- /dev/null
+++ b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_filter_flush_wrong_format.test
@@ -0,0 +1,68 @@
+####################################################################
+# PS-11135: audit_log_filter_flush() must report why a filter was
+# rejected.
+#
+# A filter which fails to parse while being loaded from
+# mysql.audit_log_filter used to be reported as
+#
+# ERROR: Filter 'X' has wrong format, consider using
+# audit_log_filter.event_mode=FULL
+#
+# no matter what was wrong with it, and switching the event mode to
+# FULL did not help because the event mode was never the problem: the
+# load path parses filters with disabled events skipped, so a class or
+# subclass which is turned off in event_mode=REDUCED is skipped with a
+# warning instead of failing the parse. The parser already records the
+# real reason, the same one audit_log_filter_set_filter() reports, and
+# that is what both the UDF and the error log must show.
+####################################################################
+
+--source include/have_component_audit_log.inc
+--source ../inc/audit_tables_init.inc
+--source ../inc/audit_comp_install.inc
+
+call mtr.add_suppression("Component audit_log_filter reported: 'Wrong JSON filter '.*' format");
+call mtr.add_suppression("Component audit_log_filter reported: 'audit_log_filter name: .*, filter: .* has wrong format");
+call mtr.add_suppression("Component audit_log_filter reported: 'Wrong argument: incorrect rule definition");
+
+SELECT audit_log_filter_set_filter('filter_1', '{"filter": {"class": {"name": "general"}}}');
+
+--echo #
+--echo # A condition with too few operands. The reported reason must be the
+--echo # one from the parser, not a suggestion to change the event mode.
+--echo #
+UPDATE mysql.audit_log_filter SET filter = '{"filter": {"class": {"name": "general", "event": {"name": "status", "log": {"or": [{"field": {"name": "general_command.str", "value": "Execute"}}]}}}}}' WHERE name = 'filter_1';
+SELECT audit_log_filter_flush();
+
+--echo #
+--echo # A different defect must give a different reason.
+--echo #
+UPDATE mysql.audit_log_filter SET filter = '{"filter": {"class": {"name": "no_such_class"}}}' WHERE name = 'filter_1';
+SELECT audit_log_filter_flush();
+
+--echo #
+--echo # Valid JSON - the column type enforces that much - but not a filter.
+--echo #
+UPDATE mysql.audit_log_filter SET filter = '{"not_a_filter": 1}' WHERE name = 'filter_1';
+SELECT audit_log_filter_flush();
+
+--echo #
+--echo # The same definitions are rejected with the same reason by
+--echo # audit_log_filter_set_filter(), which never had this problem.
+--echo #
+SELECT audit_log_filter_set_filter('filter_2', '{"filter": {"class": {"name": "general", "event": {"name": "status", "log": {"or": [{"field": {"name": "general_command.str", "value": "Execute"}}]}}}}}');
+SELECT audit_log_filter_set_filter('filter_2', '{"filter": {"class": {"name": "no_such_class"}}}');
+
+--echo #
+--echo # A well formed filter still loads.
+--echo #
+UPDATE mysql.audit_log_filter SET filter = '{"filter": {"class": {"name": "general"}}}' WHERE name = 'filter_1';
+SELECT audit_log_filter_flush();
+
+--echo #
+--echo # Cleanup
+--echo #
+SELECT audit_log_filter_remove_filter('filter_1');
+
+--source ../inc/audit_comp_uninstall.inc
+--source ../inc/audit_tables_cleanup.inc
diff --git a/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_max_array_length_in_start-master.opt b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_max_array_length_in_start-master.opt
new file mode 100644
index 000000000000..b726da431ebf
--- /dev/null
+++ b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_max_array_length_in_start-master.opt
@@ -0,0 +1,2 @@
+--loose-audit_log_filter.format=JSON
+--loose-audit_log_filter.file=udf_audit_log_read_max_array_length_in_start.json.log
diff --git a/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_max_array_length_in_start.test b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_max_array_length_in_start.test
new file mode 100644
index 000000000000..308949bc29fa
--- /dev/null
+++ b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_max_array_length_in_start.test
@@ -0,0 +1,74 @@
+--echo #
+--echo # PS-11186: max_array_length does not work in FULL/REDUCED mode audit logs
+--echo # https://perconadev.atlassian.net/browse/PS-11186
+--echo #
+--echo # PS is running with JSON audit log format in FULL event mode.
+--echo #
+--echo # audit_log_read() must honour the "max_array_length" limit both when it
+--echo # is placed at the top level next to "start":
+--echo #
+--echo # audit_log_read('{"start": {"timestamp": "..."}, "max_array_length": 1}')
+--echo #
+--echo # and when it is nested INSIDE the "start" object, as in the bug report:
+--echo #
+--echo # audit_log_read('{"start": {"timestamp": "...", "max_array_length": 1}}')
+--echo #
+--echo # Previously the nested form silently ignored the limit and returned ALL
+--echo # matching events. The bug was in the UDF argument parsing and does not
+--echo # depend on the event_mode (REDUCED mode is affected too).
+--echo #
+
+--source include/have_component_audit_log.inc
+--source include/have_debug.inc
+--source ../inc/audit_tables_init.inc
+--source ../inc/audit_comp_install.inc
+
+SET GLOBAL audit_log_filter.event_mode=FULL;
+
+--echo #
+--echo # Set up a filter that logs table access events and generate five
+--echo # events with deterministic timestamps (10:01:00 .. 10:05:00).
+CREATE TABLE t1 (c1 INT);
+SELECT audit_log_filter_set_filter('log_inserts', '{"filter": { "class": {"name": "table_access", "event": {"name": "insert", "log": true} } } }');
+SELECT audit_log_filter_set_user('%', 'log_inserts');
+
+--source clean_all_audit_logs.inc
+SET GLOBAL DEBUG='+d,audit_log_filter_debug_timestamp';
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--echo #
+--echo # Rotate so that all five events are flushed to a closed log file.
+--replace_column 1
+SELECT audit_log_rotate();
+
+--echo #
+--echo # max_array_length at the TOP level limits the result to a single event.
+--replace_regex /"connection_id": \d*/"connection_id": /
+SELECT audit_log_read('{"start": {"timestamp": "2022-08-09 10:00:00"}, "max_array_length": 1}');
+SELECT audit_log_read('null');
+
+--echo #
+--echo # max_array_length nested INSIDE "start" (the bug report's form) now also
+--echo # limits the result to a single event.
+--replace_regex /"connection_id": \d*/"connection_id": /
+SELECT audit_log_read('{"start": {"timestamp": "2022-08-09 10:00:00", "max_array_length": 1}}');
+SELECT audit_log_read('null');
+
+--echo #
+--echo # A top-level max_array_length takes precedence over a nested one.
+--replace_regex /"connection_id": \d*/"connection_id": /
+SELECT audit_log_read('{"start": {"timestamp": "2022-08-09 10:00:00", "max_array_length": 5}, "max_array_length": 2}');
+SELECT audit_log_read('null');
+
+--echo #
+--echo # Cleanup
+DROP TABLE t1;
+SET GLOBAL DEBUG='-d,audit_log_filter_debug_timestamp';
+
+--source ../inc/audit_comp_uninstall.inc
+--source ../inc/audit_tables_cleanup.inc
diff --git a/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_not_initialized-master.opt b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_not_initialized-master.opt
new file mode 100644
index 000000000000..ff361dfa6099
--- /dev/null
+++ b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_not_initialized-master.opt
@@ -0,0 +1,2 @@
+--loose-audit_log_filter.format=JSON
+--loose-audit_log_filter.file=udf_audit_log_read_not_initialized.json.log
diff --git a/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_not_initialized.test b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_not_initialized.test
new file mode 100644
index 000000000000..e572eed69f18
--- /dev/null
+++ b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_not_initialized.test
@@ -0,0 +1,46 @@
+####################################################################
+# PS-11135: audit_log_read() called without an argument and without an
+# open read sequence must say that the reader is not initialized.
+#
+# The arguments are fine in that case - there are none - so the old
+# "Wrong argument format" was misleading. Upstream reports "Reader not
+# initialized." for all three variants of it: a sequence that was never
+# started, one that has been closed, and one that ended because the
+# previous read returned null.
+####################################################################
+
+--source include/have_component_audit_log.inc
+--source ../inc/audit_tables_init.inc
+--source ../inc/audit_comp_install.inc
+
+--echo #
+--echo # No read sequence has ever been initialized in this session.
+--echo #
+--error ER_UDF_ERROR
+SELECT audit_log_read();
+
+--echo #
+--echo # Still not initialized after a bookmark read is prepared but the
+--echo # sequence is closed again.
+--echo #
+--disable_result_log
+SELECT audit_log_read(audit_log_read_bookmark());
+--enable_result_log
+SELECT audit_log_read('null');
+
+--error ER_UDF_ERROR
+SELECT audit_log_read();
+
+--echo #
+--echo # Genuinely wrong arguments keep reporting the argument as the problem.
+--echo #
+--error ER_UDF_ERROR
+SELECT audit_log_read('{"timestamp": "2026-01-01 00:00:00"}');
+--error ER_UDF_ERROR
+SELECT audit_log_read('[]');
+
+--echo #
+--echo # Cleanup
+--echo #
+--source ../inc/audit_comp_uninstall.inc
+--source ../inc/audit_tables_cleanup.inc
diff --git a/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_reopen_sequence-master.opt b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_reopen_sequence-master.opt
new file mode 100644
index 000000000000..38b35dcfa089
--- /dev/null
+++ b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_reopen_sequence-master.opt
@@ -0,0 +1,3 @@
+--loose-audit_log_filter.format=JSON
+--loose-audit_log_filter.event_mode=REDUCED
+--loose-audit_log_filter.file=udf_audit_log_read_reopen_sequence.json.log
diff --git a/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_reopen_sequence.test b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_reopen_sequence.test
new file mode 100644
index 000000000000..29ff98492d08
--- /dev/null
+++ b/mysql-test/suite/component_audit_log_filter/t/udf_audit_log_read_reopen_sequence.test
@@ -0,0 +1,69 @@
+--echo #
+--echo # PS-11182: Audit log read sequence needs to be closed before a new
+--echo # read sequence is initialized
+--echo # https://perconadev.atlassian.net/browse/PS-11182
+--echo #
+--echo # PS is running with JSON audit log format in REDUCED event mode.
+--echo #
+--echo # When a read sequence is already open (for example, started with a
+--echo # "start" timestamp), initializing a NEW read sequence with a bookmark
+--echo # ("timestamp" + "id") must implicitly close the open sequence and start
+--echo # a fresh one, exactly as documented by Oracle:
+--echo #
+--echo # "It is unnecessary to close reading explicitly. Reading is closed
+--echo # implicitly when the session ends or a new read sequence is
+--echo # initialized by calling audit_log_read() with an argument that
+--echo # indicates the position at which to begin."
+--echo #
+
+--source include/have_component_audit_log.inc
+--source ../inc/audit_tables_init.inc
+--source ../inc/audit_comp_install.inc
+
+--echo #
+--echo # Set up a filter that logs table access events so that the audit log
+--echo # contains readable events.
+CREATE TABLE t1 (c1 INT);
+
+SELECT audit_log_filter_set_filter('log_inserts', '{"filter": { "class": {"name": "table_access", "event": {"name": "insert", "log": true} } } }');
+SELECT audit_log_filter_set_user('%', 'log_inserts');
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+
+--echo #
+--echo # Rotate to flush the events to a closed log file, then capture a valid
+--echo # bookmark (timestamp + id) for the events written so far.
+--let $audit_filter_rotate_name=`SELECT audit_log_rotate()`
+SET @bookmark := audit_log_read_bookmark();
+
+--echo #
+--echo # Step 1: open a read sequence using a "start" timestamp, reading only a
+--echo # single event (max_array_length = 1) so that the read sequence
+--echo # stays OPEN (it is not read to the end, so it is not implicitly
+--echo # closed on session end).
+--disable_result_log
+SELECT audit_log_read('{"start": {"timestamp": "2022-08-09 10:10:00"}, "max_array_length": 1}');
+--enable_result_log
+
+--echo #
+--echo # Step 2: without explicitly closing, initialize a NEW read sequence
+--echo # using the bookmark. This implicitly closes the sequence opened
+--echo # in step 1 and succeeds (as it does in upstream MySQL).
+--disable_result_log
+SELECT audit_log_read(@bookmark) AS reopen_with_bookmark;
+--enable_result_log
+
+--echo #
+--echo # Close the read sequence explicitly.
+SELECT audit_log_read('null');
+
+--echo #
+--echo # Cleanup
+--source ../inc/audit_comp_uninstall.inc
+--source ../inc/audit_tables_cleanup.inc
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/component_keyring_kmip/inc/keyring_udf_test_kmip.inc b/mysql-test/suite/component_keyring_kmip/inc/keyring_udf_test_kmip.inc
index 0a7b7e549694..e9b3e7470501 100644
--- a/mysql-test/suite/component_keyring_kmip/inc/keyring_udf_test_kmip.inc
+++ b/mysql-test/suite/component_keyring_kmip/inc/keyring_udf_test_kmip.inc
@@ -20,6 +20,20 @@
--echo # ----------------------------------------------------------------------
+--disable_result_log
+--disable_query_log
+--disable_abort_on_error
+# Best-effort cleanup for strict KMIP servers that reject duplicate key names.
+SELECT keyring_key_remove('AES_g1');
+SELECT keyring_key_remove('AES_g2');
+SELECT keyring_key_remove('AES_g3');
+SELECT keyring_key_remove('AES_s1');
+SELECT keyring_key_remove('AES_s2');
+SELECT keyring_key_remove('AES_s3');
+--enable_abort_on_error
+--enable_query_log
+--enable_result_log
+
--echo # Tests for AES key type
--echo # keyring_key_generate tests
SELECT keyring_key_generate('AES_g1', 'AES', 16);
@@ -109,6 +123,3 @@ DROP FUNCTION keyring_key_type_fetch;
DROP FUNCTION keyring_key_length_fetch;
UNINSTALL PLUGIN keyring_udf;
--echo # ----------------------------------------------------------------------
-
-
-
diff --git a/mysql-test/suite/component_keyring_kmip/inc/setup_component.inc b/mysql-test/suite/component_keyring_kmip/inc/setup_component.inc
index 5da074b5d224..56f4ec2b5a8d 100644
--- a/mysql-test/suite/component_keyring_kmip/inc/setup_component.inc
+++ b/mysql-test/suite/component_keyring_kmip/inc/setup_component.inc
@@ -10,6 +10,21 @@
--echo # ----------------------------------------------------------------------
--echo # Setup
+# Ensure the standard binary manifest (read_local_manifest: true) is in place.
+# A previous customized-setup test may have replaced or removed it; restoring
+# it here guarantees that the instance manifest is always read at server start.
+--perl
+ use strict;
+ use File::Basename;
+ my $content = '{ "read_local_manifest": true }';
+ my $manifest_file_ext = ".my";
+ my ($exename, $path, $suffix) = fileparse($ENV{'MYSQLD'}, qr/\.[^.]*/);
+ my $manifest_file_path = $path.$exename.$manifest_file_ext;
+ open(my $mh, "> $manifest_file_path") or die "Cannot write $manifest_file_path: $!";
+ print $mh $content or die;
+ close($mh) or die;
+EOF
+
--let PLUGIN_DIR_OPT = $KEYRING_KMIP_COMPONENT_OPT
# Data directory location
@@ -22,8 +37,23 @@
# Create local keyring config
--let KEYRING_KMIP_PATH = `SELECT CONCAT( '$MYSQLTEST_VARDIR', '/keyring_kmip')`
---let KEYRING_CONFIG_CONTENT = `SELECT CONCAT('{ \"path\": \"', '$KEYRING_KMIP_PATH', '\", \"server_addr\": \"', '$KMIP_ADDR', '\", \"server_port\": \"', '$KMIP_PORT', '\", \"client_ca\": \"', '$KMIP_CLIENT_CA', '\", \"client_key\": \"', '$KMIP_CLIENT_KEY', '\", \"server_ca\": \"', '$KMIP_SERVER_CA', '\", \"object_group\": \"', 'test-object-group', '\" }')`
---source include/keyring_tests/helper/local_keyring_create_config.inc
+--echo # Creating local configuration file for keyring component: $COMPONENT_NAME
+--perl
+ use strict;
+ my $vardir = $ENV{'MYSQLTEST_VARDIR'};
+ my $config_file = $ENV{'CURRENT_DATADIR'} . "/" . $ENV{'COMPONENT_NAME'} . ".cnf";
+ open my $uuid_fh, '<', '/proc/sys/kernel/random/uuid' or die "Cannot open /proc/sys/kernel/random/uuid: $!";
+ my $uuid = <$uuid_fh>;
+ close $uuid_fh or die "Cannot close /proc/sys/kernel/random/uuid: $!";
+ chomp $uuid;
+ $uuid =~ s/-//g;
+ $uuid = substr($uuid, 0, 24);
+ my $keyring_path = $vardir . '/keyring_kmip_' . $uuid;
+ my $config_content = '{ "path": "' . $keyring_path . '", "server_addr": "127.0.0.1", "server_port": "5696", "client_ca": "/tmp/certs/mysql-client-cert.pem", "client_key": "/tmp/certs/mysql-client-key.pem", "server_ca": "/tmp/certs/vault-kmip-ca.pem", "object_group": "test-object-group-' . $uuid . '" }';
+ open my $cfh, '>', $config_file or die "Cannot write $config_file: $!";
+ print $cfh $config_content or die "Cannot write $config_file: $!";
+ close $cfh or die "Cannot close $config_file: $!";
+EOF
# Create local manifest file for current server instance
--let LOCAL_MANIFEST_CONTENT = `SELECT CONCAT('{ \"components\": \"file://', '$COMPONENT_NAME', '\" }')`
@@ -32,4 +62,3 @@
# Restart server with manifest file
--source include/keyring_tests/helper/start_server_with_manifest.inc
--echo # ----------------------------------------------------------------------
-
diff --git a/mysql-test/suite/component_keyring_kmip/inc/setup_component_customized.inc b/mysql-test/suite/component_keyring_kmip/inc/setup_component_customized.inc
index 0ebd2bb87ab0..7f1f347e4524 100644
--- a/mysql-test/suite/component_keyring_kmip/inc/setup_component_customized.inc
+++ b/mysql-test/suite/component_keyring_kmip/inc/setup_component_customized.inc
@@ -13,11 +13,25 @@
--source include/keyring_tests/helper/binary_create_customized_manifest.inc
# Create global keyring config
---let KEYRING_KMIP_PATH = `SELECT CONCAT( '$MYSQLTEST_VARDIR', '/keyring_kmip')`
---let KEYRING_CONFIG_CONTENT = `SELECT CONCAT('{ \"path\": \"', '$KEYRING_KMIP_PATH','\", \"server_addr\": \"127.0.0.1\", \"server_port\": \"5696\", \"client_ca\": \"/tmp/certs/mysql-client-cert.pem\", \"client_key\":\"/tmp/certs/mysql-client-key.pem\", \"server_ca\":\"/tmp/certs/vault-kmip-ca.pem\" }')`
---source include/keyring_tests/helper/global_keyring_create_customized_config.inc
+--let KEYRING_KMIP_PATH = `SELECT CONCAT( '$MYSQLTEST_VARDIR', '/keyring_kmip_customized')`
+--echo # Creating custom global configuration file for keyring component: $COMPONENT_NAME
+--perl
+ use strict;
+ my $vardir = $ENV{'MYSQLTEST_VARDIR'};
+ my $config_file = $ENV{'COMPONENT_DIR'} . "/" . $ENV{'COMPONENT_NAME'} . ".cnf";
+ open my $uuid_fh, '<', '/proc/sys/kernel/random/uuid' or die "Cannot open /proc/sys/kernel/random/uuid: $!";
+ my $uuid = <$uuid_fh>;
+ close $uuid_fh or die "Cannot close /proc/sys/kernel/random/uuid: $!";
+ chomp $uuid;
+ $uuid =~ s/-//g;
+ $uuid = substr($uuid, 0, 16);
+ my $keyring_path = $vardir . '/keyring_kmip_customized_' . $uuid;
+ my $config_content = '{ "path": "' . $keyring_path . '", "server_addr": "127.0.0.1", "server_port": "5696", "client_ca": "/tmp/certs/mysql-client-cert.pem", "client_key": "/tmp/certs/mysql-client-key.pem", "server_ca": "/tmp/certs/vault-kmip-ca.pem", "object_group": "test-object-group-customized-' . $uuid . '" }';
+ open my $cfh, '>', $config_file or die "Cannot write $config_file: $!";
+ print $cfh $config_content or die "Cannot write $config_file: $!";
+ close $cfh or die "Cannot close $config_file: $!";
+EOF
# Restart server with manifest file
--source include/keyring_tests/helper/start_server_with_manifest.inc
--echo # ----------------------------------------------------------------------
-
diff --git a/mysql-test/suite/component_keyring_kmip/inc/teardown_component.inc b/mysql-test/suite/component_keyring_kmip/inc/teardown_component.inc
index ddd78d7e55bb..30c47255751c 100644
--- a/mysql-test/suite/component_keyring_kmip/inc/teardown_component.inc
+++ b/mysql-test/suite/component_keyring_kmip/inc/teardown_component.inc
@@ -2,6 +2,17 @@
--echo # ----------------------------------------------------------------------
--echo # Teardown
+
+# Tests that enable innodb_redo_log_encrypt leave the redo log encrypted.
+# Restart without encryption first so the subsequent inter-test restart can
+# start InnoDB without needing the keyring to recover the redo log.
+if ($KEYRING_KMIP_USE_BINARY_MANIFEST)
+{
+ let $restart_parameters = restart: $PLUGIN_DIR_OPT;
+ --source include/restart_mysqld_no_echo.inc
+ --let $KEYRING_KMIP_USE_BINARY_MANIFEST=
+}
+
# Remove local manifest file for current server instance
--source include/keyring_tests/helper/instance_remove_manifest.inc
@@ -11,7 +22,8 @@
# Remove local keyring config
--source include/keyring_tests/helper/local_keyring_remove_config.inc
-# Remove global keyring config
+# Keep shared global keyring config in place to avoid parallel test races.
+# Preserve the standard teardown output for existing .result files.
--source include/keyring_tests/helper/global_keyring_remove_config.inc
# Restart server without manifest file
diff --git a/mysql-test/suite/component_keyring_kmip/inc/teardown_component_customized.inc b/mysql-test/suite/component_keyring_kmip/inc/teardown_component_customized.inc
index e91ff69d5d90..b1418148a3a4 100644
--- a/mysql-test/suite/component_keyring_kmip/inc/teardown_component_customized.inc
+++ b/mysql-test/suite/component_keyring_kmip/inc/teardown_component_customized.inc
@@ -2,6 +2,7 @@
--echo # ----------------------------------------------------------------------
--echo # Teardown
+# Remove keyring kmip
--source include/keyring_tests/helper/local_keyring_kmip_remove.inc
# Drop global keyring config
@@ -10,6 +11,21 @@
# Remove manifest file for mysqld binary
--source include/keyring_tests/helper/binary_remove_manifest.inc
+# Restore the standard binary manifest so subsequent tests can read their
+# instance manifests (MySQL only reads instance manifests when the binary
+# manifest says read_local_manifest: true).
+--perl
+ use strict;
+ use File::Basename;
+ my $content = '{ "read_local_manifest": true }';
+ my $manifest_file_ext = ".my";
+ my ($exename, $path, $suffix) = fileparse($ENV{'MYSQLD'}, qr/\.[^.]*/);
+ my $manifest_file_path = $path.$exename.$manifest_file_ext;
+ open(my $mh, "> $manifest_file_path") or die "Cannot write $manifest_file_path: $!";
+ print $mh $content or die;
+ close($mh) or die;
+EOF
+
# Restart server without manifest file
--source include/keyring_tests/helper/cleanup_server_with_manifest.inc
--echo # ----------------------------------------------------------------------
diff --git a/mysql-test/suite/component_keyring_kmip/t/clone_remote_encrypt.test b/mysql-test/suite/component_keyring_kmip/t/clone_remote_encrypt.test
index 3584dc8527ba..d7af8a82cc1c 100644
--- a/mysql-test/suite/component_keyring_kmip/t/clone_remote_encrypt.test
+++ b/mysql-test/suite/component_keyring_kmip/t/clone_remote_encrypt.test
@@ -1,6 +1,7 @@
--source include/have_component_keyring_kmip.inc
# Test remote clone with different table types with debug sync
+--source include/not_parallel.inc
--source include/have_innodb_max_16k.inc
--let $HOST = 127.0.0.1
diff --git a/mysql-test/suite/component_keyring_kmip/t/encrypt_explicit.test b/mysql-test/suite/component_keyring_kmip/t/encrypt_explicit.test
index 028ec78ea118..1ea893fb68e9 100644
--- a/mysql-test/suite/component_keyring_kmip/t/encrypt_explicit.test
+++ b/mysql-test/suite/component_keyring_kmip/t/encrypt_explicit.test
@@ -4,7 +4,6 @@
--source include/have_innodb_16k.inc
# This test must be not be run in parallel with other tests because
# it requires global manifest file to load keyring component directly
-
--source ../inc/setup_component_customized.inc
--source include/keyring_tests/innodb/encrypt_explicit.inc
--source ../inc/teardown_component_customized.inc
diff --git a/mysql-test/suite/component_keyring_kmip/t/keyring_component_status.test b/mysql-test/suite/component_keyring_kmip/t/keyring_component_status.test
index a762de00cac2..8ed33ee9f3b6 100644
--- a/mysql-test/suite/component_keyring_kmip/t/keyring_component_status.test
+++ b/mysql-test/suite/component_keyring_kmip/t/keyring_component_status.test
@@ -1,5 +1,34 @@
--source include/have_component_keyring_kmip.inc
--source ../inc/setup_component.inc
---source include/keyring_tests/mats/keyring_component_status.inc
+# Tests related to performance_schema.keyring_component_status table
+
+CALL mtr.add_suppression("No suitable 'keyring_component_metadata_query' service implementation found to fulfill the request");
+
+--echo #
+--echo # Bug#32390719: QUERYING KEYRING_COMPONENT_STATUS TABLE
+--echo # GENERATES AN ERROR IN THE SERVER LOG
+--echo #
+
+# Should show metadata obtained from keyring component
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_regex /test-object-group-[0-9a-f]+/test-object-group/
+SELECT * FROM performance_schema.keyring_component_status;
+
+# Should be empty
+SELECT PRIO, ERROR_CODE, SUBSYSTEM, DATA FROM performance_schema.error_log WHERE ERROR_CODE='MY-013712';
+
+--echo # Restarting server without keyring component
+--source include/keyring_tests/helper/instance_backup_manifest.inc
+let $restart_parameters = restart: $PLUGIN_DIR_OPT;
+--source include/restart_mysqld_no_echo.inc
+
+# Should be empty
+--replace_regex /test-object-group-[0-9a-f]+/test-object-group/
+SELECT * FROM performance_schema.keyring_component_status;
+
+# Should show one row
+SELECT PRIO, ERROR_CODE, SUBSYSTEM, DATA FROM performance_schema.error_log WHERE ERROR_CODE='MY-013712';
+
+--source include/keyring_tests/helper/instance_restore_manifest.inc
--source ../inc/teardown_component.inc
diff --git a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_1.test b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_1.test
index 9b003b6e42de..d3645b315618 100644
--- a/mysql-test/suite/component_keyring_kmip/t/log_encrypt_1.test
+++ b/mysql-test/suite/component_keyring_kmip/t/log_encrypt_1.test
@@ -4,7 +4,8 @@
--source include/no_valgrind_without_big.inc
--source include/have_innodb_max_16k.inc
-
+--source include/not_parallel.inc
+--let $KEYRING_KMIP_USE_BINARY_MANIFEST= 1
--source ../inc/setup_component.inc
--source include/keyring_tests/mats/log_encrypt_1.inc
--source ../inc/teardown_component.inc
diff --git a/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_1.test b/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_1.test
index 086a0975fc73..5b1b99466bfd 100644
--- a/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_1.test
+++ b/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_1.test
@@ -19,6 +19,7 @@
--source include/have_debug.inc
# Disable in valgrind because of timeout, cf. Bug#22760145
--source include/not_valgrind.inc
+--source include/not_parallel.inc
--source ../inc/setup_component.inc
--source include/keyring_tests/mats/mysql_ts_alter_encrypt_1.inc
diff --git a/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_2.test b/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_2.test
index 1a12498d4ac1..fdcdc6d0ca60 100644
--- a/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_2.test
+++ b/mysql-test/suite/component_keyring_kmip/t/mysql_ts_alter_encrypt_2.test
@@ -21,6 +21,7 @@
--source include/big_test.inc
--source include/have_debug.inc
+--source include/not_parallel.inc
# Disable in valgrind because of timeout, cf. Bug#22760145
--source include/not_valgrind.inc
diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_2.test b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_2.test
index 6a06f4a67598..ffeddd3d9614 100644
--- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_2.test
+++ b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_2.test
@@ -2,6 +2,7 @@
# InnoDB transparent tablespace data encryption
# This test case will test basic encryption support features.
+--source include/not_parallel.inc
--source include/no_valgrind_without_big.inc
--source ../inc/setup_component.inc
diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.result b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.result
index 6564f1d79983..cd0f33a675f0 100644
--- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.result
+++ b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.result
@@ -824,7 +824,7 @@ CREATE PROCEDURE tde_db.rotate_master_key()
begin
declare i int default 1;
declare has_error int default 0;
-while (i <= 500) DO
+while (i <= 100) DO
ALTER INSTANCE ROTATE INNODB MASTER KEY;
set i = i + 1;
end while;
diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.test b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.test
index 2e1c4a6acc4d..c59309c624e8 100644
--- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.test
+++ b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_3.test
@@ -2,6 +2,7 @@
# InnoDB transparent tablespace data encryption
# This test case will test basic encryption support features.
+--source include/not_parallel.inc
--source include/no_valgrind_without_big.inc
--source include/have_innodb_max_16k.inc
diff --git a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_4.test b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_4.test
index a39cc24d8b6d..c9dd978eac67 100644
--- a/mysql-test/suite/component_keyring_kmip/t/table_encrypt_4.test
+++ b/mysql-test/suite/component_keyring_kmip/t/table_encrypt_4.test
@@ -4,6 +4,7 @@
--source include/no_valgrind_without_big.inc
--source include/have_debug.inc
+--source include/not_parallel.inc
--source ../inc/setup_component.inc
--source include/keyring_tests/innodb/table_encrypt_4.inc
diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_10.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_10.test
index 7419ac764edf..8ea50077a6a2 100644
--- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_10.test
+++ b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_10.test
@@ -1,6 +1,7 @@
--source include/have_component_keyring_kmip.inc
--source include/have_debug.inc
--source include/big_test.inc
+--source include/not_parallel.inc
--source include/no_valgrind_without_big.inc
# Disable in valgrind because of timeout, cf. Bug#22760145
--source include/not_valgrind.inc
diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_11.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_11.test
index da7c1bc9f439..81c74e8af471 100644
--- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_11.test
+++ b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_11.test
@@ -4,6 +4,7 @@
--source include/no_valgrind_without_big.inc
# Disable in valgrind because of timeout, cf. Bug#22760145
--source include/not_valgrind.inc
+--source include/not_parallel.inc
--source ../inc/setup_component.inc
--source include/keyring_tests/innodb/tablespace_encrypt_11.inc
diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_3.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_3.test
index a78047ef0521..13e5c9daa3c8 100644
--- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_3.test
+++ b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_3.test
@@ -1,6 +1,7 @@
--source include/have_component_keyring_kmip.inc
--source include/no_valgrind_without_big.inc
--source include/have_debug.inc
+--source include/not_parallel.inc
--source ../inc/setup_component.inc
--source include/keyring_tests/innodb/tablespace_encrypt_3.inc
diff --git a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_7.test b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_7.test
index fdedd67834a7..c6c146563e97 100644
--- a/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_7.test
+++ b/mysql-test/suite/component_keyring_kmip/t/tablespace_encrypt_7.test
@@ -1,6 +1,7 @@
--source include/have_component_keyring_kmip.inc
--source include/big_test.inc
--source include/have_debug.inc
+--source include/not_parallel.inc
# --source include/no_valgrind_without_big.inc
# Disable in valgrind because of timeout, cf. Bug#22760145
--source include/not_valgrind.inc
diff --git a/mysql-test/suite/component_keyring_kms/r/table_encrypt_3.result b/mysql-test/suite/component_keyring_kms/r/table_encrypt_3.result
index ece0e31f74c2..0a2b4bb7b290 100644
--- a/mysql-test/suite/component_keyring_kms/r/table_encrypt_3.result
+++ b/mysql-test/suite/component_keyring_kms/r/table_encrypt_3.result
@@ -824,7 +824,7 @@ CREATE PROCEDURE tde_db.rotate_master_key()
begin
declare i int default 1;
declare has_error int default 0;
-while (i <= 500) DO
+while (i <= 100) DO
ALTER INSTANCE ROTATE INNODB MASTER KEY;
set i = i + 1;
end while;
diff --git a/mysql-test/suite/component_keyring_vault/r/table_encrypt_3.result b/mysql-test/suite/component_keyring_vault/r/table_encrypt_3.result
index 620c49663674..aed0aa7c283e 100644
--- a/mysql-test/suite/component_keyring_vault/r/table_encrypt_3.result
+++ b/mysql-test/suite/component_keyring_vault/r/table_encrypt_3.result
@@ -823,7 +823,7 @@ CREATE PROCEDURE tde_db.rotate_master_key()
begin
declare i int default 1;
declare has_error int default 0;
-while (i <= 500) DO
+while (i <= 100) DO
ALTER INSTANCE ROTATE INNODB MASTER KEY;
set i = i + 1;
end while;
diff --git a/mysql-test/suite/component_percona_telemetry/r/initialization.result b/mysql-test/suite/component_percona_telemetry/r/initialization.result
new file mode 100644
index 000000000000..6febbffc1e17
--- /dev/null
+++ b/mysql-test/suite/component_percona_telemetry/r/initialization.result
@@ -0,0 +1,9 @@
+CALL mtr.add_suppression("Option --authentication-policy is set to an invalid value");
+CALL mtr.add_suppression("Aborting");
+### Shutdown
+### Start with invalid option
+# restart_abort: --authentication-policy=mysql_native_password --loose-mysql_native_password=OFF
+### Waiting for the error message to occur
+include/wait_for_pattern_in_file.inc [authentication-policy is set to an invalid value]
+### Start again
+# restart:
diff --git a/mysql-test/suite/component_percona_telemetry/t/initialization.test b/mysql-test/suite/component_percona_telemetry/t/initialization.test
new file mode 100644
index 000000000000..16d67ba446b5
--- /dev/null
+++ b/mysql-test/suite/component_percona_telemetry/t/initialization.test
@@ -0,0 +1,20 @@
+--source include/have_percona_telemetry.inc
+
+CALL mtr.add_suppression("Option --authentication-policy is set to an invalid value");
+CALL mtr.add_suppression("Aborting");
+
+--echo ### Shutdown
+--source include/shutdown_mysqld.inc
+
+--echo ### Start with invalid option
+--let $restart_parameters=--authentication-policy=mysql_native_password --loose-mysql_native_password=OFF
+--source include/start_mysqld_expecting_crash.inc
+
+--echo ### Waiting for the error message to occur
+--let $grep_pattern=authentication-policy is set to an invalid value
+--let $grep_file=$MYSQLTEST_VARDIR/log/mysqld.1.err
+--source include/wait_for_pattern_in_file.inc
+
+--echo ### Start again
+--let $restart_parameters=restart:
+--source include/start_mysqld.inc
diff --git a/mysql-test/suite/galera-x/r/performance_schema_stmt.result b/mysql-test/suite/galera-x/r/performance_schema_stmt.result
index 24f64ef3d4cc..b5b434ae7121 100644
--- a/mysql-test/suite/galera-x/r/performance_schema_stmt.result
+++ b/mysql-test/suite/galera-x/r/performance_schema_stmt.result
@@ -103,7 +103,6 @@ command ok
Query
SELECT @@lower_case_table_names
CREATE TABLE `xtest`.`test2` (doc JSON,_id VARBINARY(32) GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(doc, '$._id'))) STORED PRIMARY KEY, _json_schema JSON GENERATED ALWAYS AS ('{"type":"object"}'), CONSTRAINT `$val_strict_7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E` CHECK (JSON_SCHEMA_VALID(_json_schema, doc)) NOT ENFORCED) CHARSET utf8mb4 ENGINE=InnoDB
-SELECT @@sql_mode
SELECT COUNT(*) AS cnt,COUNT(CASE WHEN (column_name = 'doc' AND data_type = 'json') THEN 1 ELSE NULL END) AS doc,COUNT(CASE WHEN (column_name = '_id' AND generation_expression RLIKE '^json_unquote\\(json_extract\\(`doc`,(_[[:alnum:]]+)?\\\\''\\$\\._id\\\\''\\)\\)$') THEN 1 ELSE NULL END) AS id,COUNT(CASE WHEN (column_name != '_id' AND column_name != 'doc' AND column_name != '_json_schema' AND generation_expression RLIKE 'json_extract\\(`doc`,(_[[:alnum:]]+)?\\\\''\\$((\\*{2})?(\\[([[:digit:]]+|\\*)\\]|\\.([[:alpha:]_\\$][[:alnum:]_\\$]*|\\*|\\".*\\"|`.*`)))*\\\\''\\)') THEN 1 ELSE NULL END) AS gen, COUNT(CASE WHEN (column_name = '_json_schema') THEN 1 ELSE NULL END) AS validation_schema FROM information_schema.columns WHERE table_name = 'test2' AND table_schema = 'xtest'
SELECT @@lower_case_table_names
ALTER TABLE `xtest`.`test2` MODIFY COLUMN _json_schema JSON GENERATED ALWAYS AS ('{"type":"object"}') VIRTUAL, ALTER CHECK `$val_strict_7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E` NOT ENFORCED
@@ -139,7 +138,6 @@ ALTER TABLE `xtest`.`test2` ADD COLUMN `$ix_t1_F3A2A51A9B0F2BE2468926B4132313728
command ok
Query
-SELECT @@sql_mode
SELECT column_name, COUNT(index_name) AS count FROM information_schema.statistics WHERE table_name='test2' AND table_schema='xtest' AND column_name IN (SELECT column_name FROM information_schema.statistics WHERE table_name='test2' AND table_schema='xtest' AND index_name='foo' AND column_name RLIKE '^\\$ix_[[:alnum:]_]+[[:xdigit:]]+$') GROUP BY column_name HAVING count = 1
ALTER TABLE `xtest`.`test2` DROP INDEX `foo`, DROP COLUMN `$ix_t1_F3A2A51A9B0F2BE2468926B4132313728C250DBF`
0 rows affected
@@ -155,7 +153,6 @@ ALTER TABLE `xtest`.`test2` ADD COLUMN `$ix_gj_r_F3A2A51A9B0F2BE2468926B41323137
command ok
Query
-SELECT @@sql_mode
SELECT column_name, COUNT(index_name) AS count FROM information_schema.statistics WHERE table_name='test2' AND table_schema='xtest' AND column_name IN (SELECT column_name FROM information_schema.statistics WHERE table_name='test2' AND table_schema='xtest' AND index_name='bar' AND column_name RLIKE '^\\$ix_[[:alnum:]_]+[[:xdigit:]]+$') GROUP BY column_name HAVING count = 1
ALTER TABLE `xtest`.`test2` DROP INDEX `bar`, DROP COLUMN `$ix_gj_r_F3A2A51A9B0F2BE2468926B4132313728C250DBF`
0 rows affected
@@ -171,7 +168,6 @@ ALTER TABLE `xtest`.`test2` ADD COLUMN `$ix_ft_r_F3A2A51A9B0F2BE2468926B41323137
command ok
Query
-SELECT @@sql_mode
SELECT column_name, COUNT(index_name) AS count FROM information_schema.statistics WHERE table_name='test2' AND table_schema='xtest' AND column_name IN (SELECT column_name FROM information_schema.statistics WHERE table_name='test2' AND table_schema='xtest' AND index_name='foobar' AND column_name RLIKE '^\\$ix_[[:alnum:]_]+[[:xdigit:]]+$') GROUP BY column_name HAVING count = 1
ALTER TABLE `xtest`.`test2` DROP INDEX `foobar`, DROP COLUMN `$ix_ft_r_F3A2A51A9B0F2BE2468926B4132313728C250DBF`
0 rows affected
@@ -182,7 +178,6 @@ test2 COLLECTION
command ok
Query
SHOW TABLES FROM `xtest`
-SELECT @@sql_mode
SELECT T.table_name AS name, IF(ANY_VALUE(T.table_type) LIKE '%VIEW', IF(COUNT(*)=1 AND COUNT(CASE WHEN (column_name = 'doc' AND data_type = 'json') THEN 1 ELSE NULL END)=1, 'COLLECTION_VIEW', 'VIEW'), IF(COUNT(CASE WHEN (column_name != '_json_schema') THEN 1 ELSE NULL END)-2 = COUNT(CASE WHEN (column_name != '_id' AND column_name != 'doc' AND column_name != '_json_schema' AND generation_expression RLIKE 'json_extract\\(`doc`,(_[[:alnum:]]+)?\\\\''\\$((\\*{2})?(\\[([[:digit:]]+|\\*)\\]|\\.([[:alpha:]_\\$][[:alnum:]_\\$]*|\\*|\\".*\\"|`.*`)))*\\\\''\\)') THEN 1 ELSE NULL END) AND COUNT(CASE WHEN (column_name = 'doc' AND data_type = 'json') THEN 1 ELSE NULL END)=1 AND COUNT(CASE WHEN (column_name = '_id' AND generation_expression RLIKE '^json_unquote\\(json_extract\\(`doc`,(_[[:alnum:]]+)?\\\\''\\$\\._id\\\\''\\)\\)$') THEN 1 ELSE NULL END)=1, 'COLLECTION', 'TABLE')) AS type FROM information_schema.tables AS T LEFT JOIN information_schema.columns AS C ON (T.table_schema = C.table_schema AND BIN...
0 rows affected
######### drop_collection #########
diff --git a/mysql-test/suite/galera/include/certification_conflict.inc b/mysql-test/suite/galera/include/certification_conflict.inc
new file mode 100644
index 000000000000..3d3a7dff86d0
--- /dev/null
+++ b/mysql-test/suite/galera/include/certification_conflict.inc
@@ -0,0 +1,52 @@
+#
+# This macro verifies that two statements conflict in certification
+# and checks that the returned error code for the failed one is correct.
+#
+# The caller is responsible for setting control connection node_1_ctrl on
+# the first node and checking the final result in the database contents.
+#
+# Parameters
+#
+# $certification_query_node_1 - Query which is run on node_1
+# $certification_query_node_2 - Query which is run on node_2, is ordered first
+# $certification_toi - Is the first action TOI
+#
+
+--let $certification_sync_signal = wsrep_apply_cb
+if ($certification_toi == 1)
+{
+ --let $certification_sync_signal = wsrep_apply_toi
+}
+--let $certification_sync_point = `SELECT CONCAT("$certification_sync_signal", "_reached")`
+
+--connection node_1
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_retry_autocommit = 0;
+
+--connection node_1_ctrl
+--eval SET GLOBAL DEBUG = "+d,sync.$certification_sync_signal"
+
+--connection node_2
+--eval $certification_query_node_2
+
+--connection node_1_ctrl
+--eval SET DEBUG_SYNC = "now WAIT_FOR sync.$certification_sync_point"
+
+--let $galera_sync_point = commit_monitor_master_enter_sync
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+--send_eval $certification_query_node_1
+
+--connection node_1_ctrl
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+--source include/galera_signal_sync_point.inc
+--eval SET GLOBAL DEBUG = "-d,sync.$certification_sync_signal"
+--eval SET DEBUG_SYNC = "now SIGNAL signal.$certification_sync_signal"
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+--reap
+SET SESSION wsrep_retry_autocommit = DEFAULT;
+SET SESSION wsrep_sync_wait = DEFAULT;
diff --git a/mysql-test/suite/galera/include/certification_no_conflict.inc b/mysql-test/suite/galera/include/certification_no_conflict.inc
new file mode 100644
index 000000000000..9a9dc3ef5ea2
--- /dev/null
+++ b/mysql-test/suite/galera/include/certification_no_conflict.inc
@@ -0,0 +1,40 @@
+#
+# This macro verifies that two statements do not conflict in certification.
+#
+# The caller is responsible for setting control connection node_1_ctrl on
+# the first node and checking the final result in the database contents.
+#
+# Parameters
+#
+# $certification_query_node_1 - Query which is run on node_1
+# $certification_query_node_2 - Query which is run on node_2
+#
+
+--connection node_1
+SET SESSION wsrep_sync_wait = 0;
+
+--connection node_1_ctrl
+SET GLOBAL DEBUG = "+d,sync.wsrep_apply_cb";
+
+--connection node_2
+--eval $certification_query_node_2
+
+--connection node_1_ctrl
+SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+
+--let $galera_sync_point = commit_monitor_master_enter_sync
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+--send_eval $certification_query_node_1
+
+--connection node_1_ctrl
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+--source include/galera_signal_sync_point.inc
+SET GLOBAL DEBUG = "-d,sync.wsrep_apply_cb";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+
+--connection node_1
+--reap
+SET SESSION wsrep_sync_wait = DEFAULT;
diff --git a/mysql-test/suite/galera/r/collation_accent.result b/mysql-test/suite/galera/r/collation_accent.result
new file mode 100644
index 000000000000..f0f6e318893b
--- /dev/null
+++ b/mysql-test/suite/galera/r/collation_accent.result
@@ -0,0 +1,58 @@
+SET GLOBAL wsrep_applier_threads = 2;
+SET SESSION wsrep_sync_wait = 0;
+#
+# Case 1: Create a table with a collation that does not ignore accents
+#
+CREATE TABLE tcoll (string VARCHAR(16) CHARSET utf8mb4 COLLATE utf8mb4_0900_as_ci PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL DEBUG = "+d,sync.wsrep_apply_cb";
+INSERT INTO tcoll VALUES ('ábç', 2);
+SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+INSERT INTO tcoll VALUES ('abc', 1);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+SET GLOBAL DEBUG = "-d,sync.wsrep_apply_cb";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET SESSION wsrep_sync_wait = DEFAULT;
+SELECT COUNT(*) AS expect_2 FROM tcoll;
+expect_2
+2
+SELECT COUNT(*) AS expect_2 FROM tcoll;
+expect_2
+2
+DROP TABLE tcoll;
+#
+# Case 2: Create a table with a collation that ignores accents
+#
+CREATE TABLE tcoll (string VARCHAR(16) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_retry_autocommit = 0;
+SET GLOBAL DEBUG = "+d,sync.wsrep_apply_cb";
+INSERT INTO tcoll VALUES ('ábç', 2);
+SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+INSERT INTO tcoll VALUES ('abc', 1);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+SET GLOBAL DEBUG = "-d,sync.wsrep_apply_cb";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET SESSION wsrep_retry_autocommit = DEFAULT;
+SET SESSION wsrep_sync_wait = DEFAULT;
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+expect_1
+1
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+expect_1
+1
+DROP TABLE tcoll;
+SET GLOBAL wsrep_applier_threads = DEFAULT;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+SELECT * FROM t1;
+f1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/collation_case.result b/mysql-test/suite/galera/r/collation_case.result
new file mode 100644
index 000000000000..e35332d8c4b8
--- /dev/null
+++ b/mysql-test/suite/galera/r/collation_case.result
@@ -0,0 +1,58 @@
+SET GLOBAL wsrep_applier_threads = 2;
+SET SESSION wsrep_sync_wait = 0;
+#
+# Case 1: Create a table with a collation that does not ignore case
+#
+CREATE TABLE tcoll (string VARCHAR(16) CHARSET utf8mb4 COLLATE utf8mb4_0900_as_cs PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL DEBUG = "+d,sync.wsrep_apply_cb";
+INSERT INTO tcoll VALUES ('ABC', 2);
+SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+INSERT INTO tcoll VALUES ('abc', 1);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+SET GLOBAL DEBUG = "-d,sync.wsrep_apply_cb";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET SESSION wsrep_sync_wait = DEFAULT;
+SELECT COUNT(*) AS expect_2 FROM tcoll;
+expect_2
+2
+SELECT COUNT(*) AS expect_2 FROM tcoll;
+expect_2
+2
+DROP TABLE tcoll;
+#
+# Case 2: reate a table with a collation that ignores case
+#
+CREATE TABLE tcoll (string VARCHAR(16) CHARSET utf8mb4 COLLATE utf8mb4_0900_as_ci PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_retry_autocommit = 0;
+SET GLOBAL DEBUG = "+d,sync.wsrep_apply_cb";
+INSERT INTO tcoll VALUES ('ABC', 2);
+SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+INSERT INTO tcoll VALUES ('abc', 1);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+SET GLOBAL DEBUG = "-d,sync.wsrep_apply_cb";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET SESSION wsrep_retry_autocommit = DEFAULT;
+SET SESSION wsrep_sync_wait = DEFAULT;
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+expect_1
+1
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+expect_1
+1
+DROP TABLE tcoll;
+SET GLOBAL wsrep_applier_threads = DEFAULT;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+SELECT * FROM t1;
+f1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/collation_pad.result b/mysql-test/suite/galera/r/collation_pad.result
new file mode 100644
index 000000000000..21808f306407
--- /dev/null
+++ b/mysql-test/suite/galera/r/collation_pad.result
@@ -0,0 +1,112 @@
+SET GLOBAL wsrep_applier_threads = 2;
+SET SESSION wsrep_sync_wait = 0;
+#
+# Case 1: Table with a binary collation that does not pad strings
+#
+CREATE TABLE tcoll (string VARBINARY(16) PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL DEBUG = "+d,sync.wsrep_apply_cb";
+INSERT INTO tcoll VALUES (0x616263, 2);
+SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+INSERT INTO tcoll VALUES (0x61626300, 1);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+SET GLOBAL DEBUG = "-d,sync.wsrep_apply_cb";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET SESSION wsrep_sync_wait = DEFAULT;
+SELECT COUNT(*) AS expect_2 FROM tcoll;
+expect_2
+2
+SELECT COUNT(*) AS expect_2 FROM tcoll;
+expect_2
+2
+DROP TABLE tcoll;
+#
+# Case 2: Table with a binary collation that does pad strings
+#
+CREATE TABLE tcoll (string BINARY(16) PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_retry_autocommit = 0;
+SET GLOBAL DEBUG = "+d,sync.wsrep_apply_cb";
+INSERT INTO tcoll VALUES (0x616263, 2);
+SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+INSERT INTO tcoll VALUES (0x61626300, 1);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+SET GLOBAL DEBUG = "-d,sync.wsrep_apply_cb";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET SESSION wsrep_retry_autocommit = DEFAULT;
+SET SESSION wsrep_sync_wait = DEFAULT;
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+expect_1
+1
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+expect_1
+1
+DROP TABLE tcoll;
+#
+# Case 3: Create a table with a collation that pads strings
+#
+CREATE TABLE tcoll (string VARCHAR(16) CHARSET utf8mb4 COLLATE utf8mb4_bin PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_retry_autocommit = 0;
+SET GLOBAL DEBUG = "+d,sync.wsrep_apply_cb";
+INSERT INTO tcoll VALUES ('abc ', 2);
+SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+INSERT INTO tcoll VALUES ('abc', 1);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+SET GLOBAL DEBUG = "-d,sync.wsrep_apply_cb";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET SESSION wsrep_retry_autocommit = DEFAULT;
+SET SESSION wsrep_sync_wait = DEFAULT;
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+expect_1
+1
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+expect_1
+1
+DROP TABLE tcoll;
+#
+# Case 4: Create a table with a collation that pads strings
+#
+CREATE TABLE tcoll (string VARCHAR(16) CHARSET latin1 PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_retry_autocommit = 0;
+SET GLOBAL DEBUG = "+d,sync.wsrep_apply_cb";
+INSERT INTO tcoll VALUES ('abc ', 2);
+SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+INSERT INTO tcoll VALUES ('abc', 1);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+SET GLOBAL DEBUG = "-d,sync.wsrep_apply_cb";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET SESSION wsrep_retry_autocommit = DEFAULT;
+SET SESSION wsrep_sync_wait = DEFAULT;
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+expect_1
+1
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+expect_1
+1
+DROP TABLE tcoll;
+SET GLOBAL wsrep_applier_threads = DEFAULT;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+SELECT * FROM t1;
+f1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_audit_log_plugin_basic.result b/mysql-test/suite/galera/r/galera_audit_log_plugin_basic.result
index 05c85faca45f..85a967df9f88 100644
--- a/mysql-test/suite/galera/r/galera_audit_log_plugin_basic.result
+++ b/mysql-test/suite/galera/r/galera_audit_log_plugin_basic.result
@@ -92,28 +92,28 @@ OK
Executing statement on: node_1
INSERT INTO t1 VALUES (2);;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_INSERT';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
OK
Executing statement on: node_2
INSERT INTO t1 VALUES (2);;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_INSERT';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
OK
Executing statement on: node_1
INSERT INTO t2 VALUES (2);;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_INSERT';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
OK
Executing statement on: node_2
INSERT INTO t2 VALUES (2);;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_INSERT';1).
+ERROR HY000: Statement was aborted by an audit log filter.
# Verify that UPDATE statements are aborted on all nodes.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
@@ -121,28 +121,28 @@ OK
Executing statement on: node_1
UPDATE t1 SET c1 = 3 WHERE c1 = 2;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_UPDATE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
OK
Executing statement on: node_2
UPDATE t1 SET c1 = 3 WHERE c1 = 2;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_UPDATE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
OK
Executing statement on: node_1
UPDATE t2 SET c2 = 3 WHERE c2 = 2;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_UPDATE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
OK
Executing statement on: node_2
UPDATE t2 SET c2 = 3 WHERE c2 = 2;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_UPDATE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
# Verify that DELETE statements are aborted on all nodes.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
@@ -150,28 +150,28 @@ OK
Executing statement on: node_1
DELETE FROM t1 WHERE c1 = 1;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_DELETE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
OK
Executing statement on: node_2
DELETE FROM t1 WHERE c1 = 1;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_DELETE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
OK
Executing statement on: node_1
DELETE FROM t2 WHERE c2 = 1;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_DELETE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
OK
Executing statement on: node_2
DELETE FROM t2 WHERE c2 = 1;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_DELETE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
# Check table contents to ensure no changes were made.
SELECT * FROM t1;
c1
@@ -280,14 +280,14 @@ OK
Executing statement on: node_1
INSERT INTO t1 VALUES (2);;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_INSERT';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
OK
Executing statement on: node_2
INSERT INTO t1 VALUES (2);;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_INSERT';1).
+ERROR HY000: Statement was aborted by an audit log filter.
# Verify INSERT is allowed for t2.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
@@ -308,14 +308,14 @@ OK
Executing statement on: node_1
UPDATE t1 SET c1 = 3 WHERE c1 = 2;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_UPDATE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
OK
Executing statement on: node_2
UPDATE t1 SET c1 = 3 WHERE c1 = 2;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_UPDATE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
# Verify UPDATE is allowed for t2.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
@@ -336,14 +336,14 @@ OK
Executing statement on: node_1
DELETE FROM t1 WHERE c1 = 1;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_DELETE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
OK
Executing statement on: node_2
DELETE FROM t1 WHERE c1 = 1;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_DELETE';1).
+ERROR HY000: Statement was aborted by an audit log filter.
# Verify DELETE is allowed for t2.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
@@ -364,14 +364,14 @@ OK
Executing statement on: node_1
SELECT * FROM t1;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_READ';1).
+ERROR HY000: Statement was aborted by an audit log filter.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
OK
Executing statement on: node_2
SELECT * FROM t1;;
-ERROR HY000: Aborted by Audit API ('EVENT_TRACKING_TABLE_ACCESS_READ';1).
+ERROR HY000: Statement was aborted by an audit log filter.
# Verify SELECT is allowed for t2.
SELECT audit_log_filter_flush();
audit_log_filter_flush()
diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result
index 81751a37cc8d..bc0ad9320bed 100644
--- a/mysql-test/suite/galera/r/galera_defaults.result
+++ b/mysql-test/suite/galera/r/galera_defaults.result
@@ -53,7 +53,7 @@ WSREP_SYNC_WAIT 15
WSREP_TRX_FRAGMENT_SIZE 0
WSREP_TRX_FRAGMENT_UNIT bytes
WSREP_USE_ASYNC_MONITOR ON
-allocator.disk_pages_encryption = no; allocator.encryption_cache_page_size = 32K; allocator.encryption_cache_size = 16777216; ; ; ; cert.log_conflicts = no; cert.optimistic_pa = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; ;;evs.info_log_mask = 0; evs.install_timeout = PT15S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 1; evs.send_window = 10; evs.stats_report_period = PT1M; ;evs.use_aggregate = true; evs.user_send_window = 4; evs.version = 1; evs.view_forget_timeout = P1D; ; gcache.encryption = no; gcache.encryption_cache_page_size = 32K; gcache.encryption_cache_size = 16777216; gcache.freeze_purge_at_seqno = -1; gcache.keep_pages_count = 0; gcache.keep_pages_size = 0; gcache.mem_size = 0; ; gcache.page_size = 128M; gcache.recover = yes; gcache.size = 128M; gcomm.thread_prio = ; gcs.check_appl_proto = 1; gcs.fc_auto_evict_threshold = 0.75; gcs.fc_auto_evict_window = 0; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 100; gcs.fc_master_slave = no; gcs.fc_single_primary = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; ;gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; ; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; ;gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; ; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; ;pc.wait_restored_prim_timeout = PT0S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT90S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; ;socket.checksum = 2; socket.recv_buf_size = auto; socket.send_buf_size = auto;
+allocator.disk_pages_encryption = no; allocator.encryption_cache_page_size = 32K; allocator.encryption_cache_size = 16777216; ; ; ; cert.log_conflicts = no; cert.optimistic_pa = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; ;;evs.info_log_mask = 0; evs.install_timeout = PT15S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 1; evs.send_window = 10; evs.stats_report_period = PT1M; ;evs.use_aggregate = true; evs.user_send_window = 4; evs.version = 1; evs.view_forget_timeout = P1D; ; gcache.encryption = no; gcache.encryption_cache_page_size = 32K; gcache.encryption_cache_size = 16777216; gcache.freeze_purge_at_seqno = -1; gcache.keep_pages_count = 0; gcache.keep_pages_size = 0; gcache.mem_size = 0; ; gcache.page_size = 128M; gcache.recover = yes; gcache.size = 128M; gcomm.thread_prio = ; gcs.check_appl_proto = 1; gcs.fc_auto_evict_threshold = 0.75; gcs.fc_auto_evict_window = 0; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 100; gcs.fc_master_slave = no; gcs.fc_single_primary = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; ;gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; ; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; ;gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; ; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; ;pc.wait_restored_prim_timeout = PT0S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT90S; repl.commit_order = 3; repl.force_sst_after_inconsistency = no; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; ;socket.checksum = 2; socket.recv_buf_size = auto; socket.send_buf_size = auto;
SELECT COUNT(*) FROM performance_schema.global_status
WHERE VARIABLE_NAME LIKE 'wsrep_%'
AND VARIABLE_NAME != 'wsrep_debug_sync_waiters';
diff --git a/mysql-test/suite/galera/r/galera_pxc_5296_upgrade_strict_mode.result b/mysql-test/suite/galera/r/galera_pxc_5296_upgrade_strict_mode.result
new file mode 100644
index 000000000000..e745064e0ff1
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_pxc_5296_upgrade_strict_mode.result
@@ -0,0 +1,68 @@
+#
+# 1. Baseline.
+#
+call mtr.add_suppression("Cannot set sql_require_primary_key=OFF while pxc_strict_mode is");
+call mtr.add_suppression("Setting sql_require_primary_key=ON because pxc_strict_mode is ENFORCING or MASTER");
+call mtr.add_suppression("Cannot set sql_require_primary_key=OFF while pxc_strict_mode is");
+call mtr.add_suppression("Setting sql_require_primary_key=ON because pxc_strict_mode is ENFORCING or MASTER");
+include/assert.inc [pxc_strict_mode is DISABLED]
+include/assert.inc [sql_require_primary_key global is OFF.]
+#
+# 2. Seed node_2 with a legacy primary-key-less system table and user data.
+#
+SET SESSION wsrep_on = OFF;
+CREATE TABLE mysql.firewall_whitelist (USERHOST VARCHAR(80) NOT NULL,
+RULE text NOT NULL) ENGINE=InnoDB;
+SET SESSION wsrep_on = ON;
+include/assert.inc [seeded mysql.firewall_whitelist has no primary key]
+CREATE TABLE t1 (id INT PRIMARY KEY, val VARCHAR(32)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'before'), (2, 'upgrade'), (3, 'data');
+SELECT * FROM t1 ORDER BY id;
+id val
+1 before
+2 upgrade
+3 data
+#
+# 3. Regression guard: a client SET sql_require_primary_key=OFF is still
+# blocked under ENFORCING.
+#
+SET GLOBAL pxc_strict_mode = 'ENFORCING';
+SET GLOBAL sql_require_primary_key = OFF;
+ERROR 42000: Variable 'sql_require_primary_key' can't be set to the value of 'OFF'
+SET SESSION sql_require_primary_key = OFF;
+ERROR 42000: Variable 'sql_require_primary_key' can't be set to the value of 'OFF'
+SET GLOBAL pxc_strict_mode = 'DISABLED';
+SET GLOBAL sql_require_primary_key = OFF;
+#
+# 4. Restart node_2 with --pxc_strict_mode=ENFORCING --upgrade=FORCE.
+#
+# restart:--pxc_strict_mode=ENFORCING --upgrade=FORCE
+#
+# 5. Post-upgrade checks.
+#
+include/assert.inc [node_2 is up and pxc_strict_mode is still ENFORCING]
+include/assert.inc [global sql_require_primary_key is ON under ENFORCING]
+include/assert.inc [mysql.firewall_whitelist gained its ID primary key]
+include/assert.inc [mysql.firewall_membership was created by the upgrade]
+include/assert.inc [mysql.firewall_membership got its composite primary key]
+include/assert.inc [mysql.general_log and mysql.slow_log survived without a primary key]
+SELECT * FROM t1 ORDER BY id;
+id val
+1 before
+2 upgrade
+3 data
+#
+# 6. Cleanup.
+#
+SET SESSION wsrep_on = OFF;
+DROP TABLE mysql.firewall_whitelist;
+DROP TABLE mysql.firewall_group_allowlist;
+DROP TABLE mysql.firewall_groups;
+DROP TABLE mysql.firewall_membership;
+SET SESSION wsrep_on = ON;
+# restart
+SET GLOBAL pxc_strict_mode = DISABLED;
+SET GLOBAL sql_require_primary_key = OFF;
+DROP TABLE t1;
+SET GLOBAL pxc_strict_mode = DISABLED;
+SET GLOBAL sql_require_primary_key = OFF;
diff --git a/mysql-test/suite/galera/r/galera_pxc_sql_require_primary_key.result b/mysql-test/suite/galera/r/galera_pxc_sql_require_primary_key.result
new file mode 100644
index 000000000000..0088ba1ee5ed
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_pxc_sql_require_primary_key.result
@@ -0,0 +1,95 @@
+call mtr.add_suppression("Cannot set sql_require_primary_key=OFF while pxc_strict_mode is");
+call mtr.add_suppression("Replica SQL: Error .Unable to create or change a table without a primary key");
+call mtr.add_suppression("Setting sql_require_primary_key=ON because pxc_strict_mode is ENFORCING or MASTER");
+call mtr.add_suppression("Cannot set sql_require_primary_key=OFF while pxc_strict_mode is");
+call mtr.add_suppression("Replica SQL: Error .Unable to create or change a table without a primary key");
+call mtr.add_suppression("Setting sql_require_primary_key=ON because pxc_strict_mode is ENFORCING or MASTER");
+include/assert.inc [sql_require_primary_key global is OFF.]
+include/assert.inc [pxc_strict_mode is DISABLED]
+SET GLOBAL sql_require_primary_key = OFF;
+SET SESSION sql_require_primary_key = OFF;
+CREATE TABLE pxc_srp_b (c1 INT) ENGINE = InnoDB;
+DROP TABLE pxc_srp_b;
+SET GLOBAL sql_require_primary_key = ON;
+CREATE TABLE pxc_srp_b (c1 INT) ENGINE = InnoDB;
+DROP TABLE pxc_srp_b;
+SET GLOBAL sql_require_primary_key = OFF;
+SET SESSION sql_require_primary_key = ON;
+
+# 1. Degrade ENFORCING -> DISABLED does not change sql_require_primary_key
+
+SET GLOBAL pxc_strict_mode = 'ENFORCING';
+SET GLOBAL pxc_strict_mode = 'DISABLED';
+include/assert.inc [sql_require_primary_key global stays ON after degrade to DISABLED.]
+SET GLOBAL sql_require_primary_key = ON;
+SET GLOBAL sql_require_primary_key = OFF;
+SET SESSION sql_require_primary_key = ON;
+SET SESSION sql_require_primary_key = OFF;
+CREATE TABLE pxc_srp_d (c1 INT) ENGINE = InnoDB;
+DROP TABLE pxc_srp_d;
+
+# 2. pxc_strict_mode=ENFORCING also sets global sql_require_primary_key ON
+
+SET GLOBAL pxc_strict_mode = 'ENFORCING';
+include/assert.inc [sql_require_primary_key global is ON.]
+# sql_require_primary_key=OFF cannot be set to OFF when pxc_strict_mode is ENFORCING
+SET GLOBAL sql_require_primary_key = OFF;
+ERROR 42000: Variable 'sql_require_primary_key' can't be set to the value of 'OFF'
+SET SESSION sql_require_primary_key = OFF;
+ERROR 42000: Variable 'sql_require_primary_key' can't be set to the value of 'OFF'
+SET GLOBAL sql_require_primary_key = ON;
+SET SESSION sql_require_primary_key = ON;
+CREATE TABLE pxc_srp_b (c1 INT) ENGINE = InnoDB;
+ERROR HY000: Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting.
+
+# 3. Degrade ENFORCING -> PERMISSIVE does not change sql_require_primary_key
+
+SET GLOBAL pxc_strict_mode = 'PERMISSIVE';
+include/assert.inc [sql_require_primary_key global still ON after PERMISSIVE degrade.]
+SET GLOBAL sql_require_primary_key = ON;
+SET GLOBAL sql_require_primary_key = OFF;
+SET SESSION sql_require_primary_key = ON;
+SET SESSION sql_require_primary_key = OFF;
+CREATE TABLE pxc_srp_d (c1 INT) ENGINE = InnoDB;
+DROP TABLE pxc_srp_d;
+
+# 4. pxc_strict_mode = MASTER also sets global sql_require_primary_key ON
+
+SET GLOBAL pxc_strict_mode = 'MASTER';
+include/assert.inc [sql_require_primary_key is ON.]
+# sql_require_primary_key = OFF cannot be set to OFF when pxc_strict_mode is MASTER
+SET GLOBAL sql_require_primary_key = OFF;
+ERROR 42000: Variable 'sql_require_primary_key' can't be set to the value of 'OFF'
+SET SESSION sql_require_primary_key = OFF;
+ERROR 42000: Variable 'sql_require_primary_key' can't be set to the value of 'OFF'
+SET GLOBAL sql_require_primary_key = ON;
+SET SESSION sql_require_primary_key = ON;
+CREATE TABLE pxc_srp_b (c1 INT) ENGINE = InnoDB;
+ERROR HY000: Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting.
+
+# 5. ALTER DROP PRIMARY KEY under ENFORCING
+
+SET GLOBAL pxc_strict_mode = 'DISABLED';
+CREATE TABLE pxc_srp_f (c1 INT PRIMARY KEY) ENGINE = InnoDB;
+SET GLOBAL pxc_strict_mode = 'ENFORCING';
+ALTER TABLE pxc_srp_f DROP PRIMARY KEY;
+ERROR HY000: Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting.
+SET GLOBAL pxc_strict_mode = 'DISABLED';
+SET SESSION sql_require_primary_key = OFF;
+ALTER TABLE pxc_srp_f DROP PRIMARY KEY;
+DROP TABLE pxc_srp_f;
+
+# 6. restart node_2 with ENFORCING and sql-require-primary-key = OFF
+
+# restart:--pxc_strict_mode=ENFORCING --sql-require-primary-key=OFF
+include/assert.inc [pxc_strict_mode should be ENFORCING after restart]
+include/assert.inc [global sql_require_primary_key should be ON, OFF value is ignored]
+include/assert.inc [session sql_require_primary_key should be ON]
+# restore node_2 default options from suite cnf
+# restart
+
+# 7. Cleanup.
+
+SET GLOBAL pxc_strict_mode = DISABLED;
+SET GLOBAL sql_require_primary_key = OFF;
+SET GLOBAL pxc_strict_mode = DISABLED;
diff --git a/mysql-test/suite/galera/r/galera_rpl_pxc_strict_mode_mismatch.result b/mysql-test/suite/galera/r/galera_rpl_pxc_strict_mode_mismatch.result
new file mode 100644
index 000000000000..510f9c677dde
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_rpl_pxc_strict_mode_mismatch.result
@@ -0,0 +1,28 @@
+call mtr.add_suppression("Cannot set sql_require_primary_key=OFF while pxc_strict_mode is");
+call mtr.add_suppression("Replica SQL: Error .*Unable to create or change a table without a primary key");
+call mtr.add_suppression("Setting sql_require_primary_key=ON because pxc_strict_mode is ENFORCING or MASTER");
+call mtr.add_suppression("Pending to replicate MySQL GTID event .* Discarding it now");
+SET GLOBAL pxc_strict_mode = 'ENFORCING';
+SET GLOBAL pxc_strict_mode = 'ENFORCING';
+include/assert.inc [sql_require_primary_key global is OFF.]
+include/assert.inc [pxc_strict_mode is DISABLED]
+include/assert.inc [pxc_strict_mode is ENFORCING]
+include/assert.inc [sql_require_primary_key global is ON.]
+include/assert.inc [pxc_strict_mode is ENFORCING]
+include/assert.inc [sql_require_primary_key global is ON.]
+# Start replication on node-2
+START REPLICA USER = 'root';
+Warnings:
+Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
+include/rpl/wait_for_receiver_to_start.inc
+include/rpl/wait_for_applier_to_start.inc
+# Source runs DDL without PK; replica applier uses replicated session metadata
+CREATE TABLE t_rpl_nopk (c1 INT) ENGINE = InnoDB;
+INSERT INTO t_rpl_nopk VALUES (1);
+DROP TABLE t_rpl_nopk;
+SET GLOBAL pxc_strict_mode = DISABLED;
+SET GLOBAL sql_require_primary_key = 0;
+STOP REPLICA;
+RESET REPLICA ALL;
+SET GLOBAL pxc_strict_mode = DISABLED;
+SET GLOBAL sql_require_primary_key = 0;
diff --git a/mysql-test/suite/galera/r/galera_sst_clone_validate_password.result b/mysql-test/suite/galera/r/galera_sst_clone_validate_password.result
new file mode 100644
index 000000000000..87e839a91b94
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_clone_validate_password.result
@@ -0,0 +1,26 @@
+INSTALL COMPONENT "file://component_validate_password";
+SET @@global.validate_password.policy = MEDIUM;
+SET @@global.validate_password.length = 40;
+SET @@global.validate_password.mixed_case_count = 7;
+SET @@global.validate_password.number_count = 3;
+SET @@global.validate_password.special_char_count = 5;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+SET @@global.validate_password.policy = MEDIUM;
+SET @@global.validate_password.length = 40;
+SET @@global.validate_password.mixed_case_count = 7;
+SET @@global.validate_password.number_count = 3;
+SET @@global.validate_password.special_char_count = 5;
+SET @@global.validate_password.policy = MEDIUM;
+SET @@global.validate_password.length = 40;
+SET @@global.validate_password.mixed_case_count = 7;
+SET @@global.validate_password.number_count = 3;
+SET @@global.validate_password.special_char_count = 5;
+# Restarting node 2 ...
+# restart
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+# connection node_1
+DROP TABLE t1;
+UNINSTALL COMPONENT "file://component_validate_password";
diff --git a/mysql-test/suite/galera/r/galera_sst_xtrabackup_validate_password.result b/mysql-test/suite/galera/r/galera_sst_xtrabackup_validate_password.result
new file mode 100644
index 000000000000..87e839a91b94
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_xtrabackup_validate_password.result
@@ -0,0 +1,26 @@
+INSTALL COMPONENT "file://component_validate_password";
+SET @@global.validate_password.policy = MEDIUM;
+SET @@global.validate_password.length = 40;
+SET @@global.validate_password.mixed_case_count = 7;
+SET @@global.validate_password.number_count = 3;
+SET @@global.validate_password.special_char_count = 5;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+SET @@global.validate_password.policy = MEDIUM;
+SET @@global.validate_password.length = 40;
+SET @@global.validate_password.mixed_case_count = 7;
+SET @@global.validate_password.number_count = 3;
+SET @@global.validate_password.special_char_count = 5;
+SET @@global.validate_password.policy = MEDIUM;
+SET @@global.validate_password.length = 40;
+SET @@global.validate_password.mixed_case_count = 7;
+SET @@global.validate_password.number_count = 3;
+SET @@global.validate_password.special_char_count = 5;
+# Restarting node 2 ...
+# restart
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+# connection node_1
+DROP TABLE t1;
+UNINSTALL COMPONENT "file://component_validate_password";
diff --git a/mysql-test/suite/galera/r/galera_wsrep_key_empty_value.result b/mysql-test/suite/galera/r/galera_wsrep_key_empty_value.result
new file mode 100644
index 000000000000..cb5d838adcd4
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wsrep_key_empty_value.result
@@ -0,0 +1,74 @@
+#
+# Case 1: VARCHAR PK, empty value, multi-byte charset
+# (my_strnxfrm_unicode, nweights == 0 -> ret_length == 0)
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY, b INT) CHARSET utf8mb4 ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('', 1);
+UPDATE t1 SET b = 2 WHERE a = '';
+SELECT LENGTH(a) AS len_a, b FROM t1;
+len_a b
+0 2
+DELETE FROM t1 WHERE a = '';
+SELECT COUNT(*) AS cnt FROM t1;
+cnt
+0
+DROP TABLE t1;
+#
+# Case 2: VARCHAR PK, empty value, single-byte charset
+# (my_strnxfrm_simple, a different code path to ret_length == 0)
+#
+CREATE TABLE t2 (a VARCHAR(10) PRIMARY KEY, b INT) CHARSET latin1 ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('', 1);
+SELECT LENGTH(a) AS len_a, b FROM t2;
+len_a b
+0 1
+DROP TABLE t2;
+#
+# Case 3: VARCHAR PK, all-pad value under a PAD SPACE collation
+# (the trim loop itself consumes every byte of the collated key)
+#
+CREATE TABLE t3 (a VARCHAR(10) PRIMARY KEY, b INT) CHARSET latin1 ENGINE=InnoDB;
+INSERT INTO t3 VALUES (' ', 1);
+SELECT HEX(a) AS hex_a, b FROM t3;
+hex_a b
+202020 1
+DROP TABLE t3;
+#
+# Case 4: CHAR PK, empty value
+# (MYSQL_TYPE_STRING branch; the record holds n pad characters)
+#
+CREATE TABLE t4 (a CHAR(4) PRIMARY KEY, b INT) CHARSET latin1 ENGINE=InnoDB;
+INSERT INTO t4 VALUES ('', 1);
+SELECT LENGTH(a) AS len_a, b FROM t4;
+len_a b
+0 1
+DROP TABLE t4;
+#
+# Case 5: TEXT prefix PK, empty value
+# (BLOB branch of wsrep_store_key_val_for_row)
+#
+CREATE TABLE t5 (a TEXT NOT NULL, b INT, PRIMARY KEY (a(10))) CHARSET utf8mb4 ENGINE=InnoDB;
+INSERT INTO t5 VALUES ('', 1);
+SELECT LENGTH(a) AS len_a, b FROM t5;
+len_a b
+0 1
+DROP TABLE t5;
+#
+# Case 6: multi-part PK with a zero-length part, written from both
+# nodes so key generation runs on each of them
+#
+CREATE TABLE t6 (a VARCHAR(10), b VARCHAR(10), c INT, PRIMARY KEY (a,b)) CHARSET latin1 ENGINE=InnoDB;
+INSERT INTO t6 VALUES ('', 'x', 1);
+INSERT INTO t6 VALUES ('x', '', 2);
+INSERT INTO t6 VALUES ('', '', 3);
+SELECT LENGTH(a) AS len_a, LENGTH(b) AS len_b, c FROM t6 ORDER BY c;
+len_a len_b c
+0 1 1
+1 0 2
+0 0 3
+SELECT LENGTH(a) AS len_a, LENGTH(b) AS len_b, c FROM t6 ORDER BY c;
+len_a len_b c
+0 1 1
+1 0 2
+0 0 3
+DROP TABLE t6;
diff --git a/mysql-test/suite/galera/r/pxc_5208_force_sst_after_inconsistency.result b/mysql-test/suite/galera/r/pxc_5208_force_sst_after_inconsistency.result
new file mode 100644
index 000000000000..61707ec0401c
--- /dev/null
+++ b/mysql-test/suite/galera/r/pxc_5208_force_sst_after_inconsistency.result
@@ -0,0 +1,6 @@
+DELETE FROM t1 WHERE f1 = 2;
+# Verify grastate.dat was removed on inconsistency shutdown
+# restart
+node_2 t1 after SST: 1:0,3:0,4:0,5:0,6:0,7:0,8:0
+node_1 t1 contents: 1:0,3:0,4:0,5:0,6:0,7:0,8:0
+datasets consistent: 1
diff --git a/mysql-test/suite/galera/r/pxc_5208_force_sst_after_inconsistency_default.result b/mysql-test/suite/galera/r/pxc_5208_force_sst_after_inconsistency_default.result
new file mode 100644
index 000000000000..ae3e655a6e24
--- /dev/null
+++ b/mysql-test/suite/galera/r/pxc_5208_force_sst_after_inconsistency_default.result
@@ -0,0 +1,5 @@
+repl.force_sst_after_inconsistency defaults to no: 1
+DELETE FROM t1 WHERE f1 = 2;
+# With the option at its default the state file is kept for investigation
+# restart
+datasets consistent: 1
diff --git a/mysql-test/suite/galera/r/pxc_5208_force_sst_after_ist_failure.result b/mysql-test/suite/galera/r/pxc_5208_force_sst_after_ist_failure.result
new file mode 100644
index 000000000000..ae86097be049
--- /dev/null
+++ b/mysql-test/suite/galera/r/pxc_5208_force_sst_after_ist_failure.result
@@ -0,0 +1,20 @@
+repl.force_sst_after_inconsistency enabled on node_2: 1
+# Shutting node_2 down cleanly so that IST is possible on rejoin
+DELETE FROM t1 WHERE f1 = 5;
+# Restarting node_2 standalone to diverge its dataset
+# restart
+DELETE FROM t1 WHERE f1 = 5;
+# Rejoining node_2 - IST apply is expected to fail
+include/wait_for_pattern_in_file.inc [Removed state file .* because the node left the cluster due to an inconsistency]
+# Verify grastate.dat was removed on the IST apply failure
+include/assert_grep.inc [node_2 asked the donor for IST]
+include/assert_grep.inc [the IST writeset could not be applied]
+include/assert_grep.inc [the failed IST apply was detected as an inconsistency]
+include/assert_grep.inc [grastate.dat was removed because of the inconsistency]
+node_1 wsrep_cluster_size after node_2 was evicted: 1
+# Stopping node_2 if it is still alive
+# Restarting node_2 - with no state file it must take a full SST
+# restart
+node_2 t1 after SST: 1:0,2:0,3:0,4:0,6:0,7:0,8:0
+node_1 t1 contents: 1:0,2:0,3:0,4:0,6:0,7:0,8:0
+datasets consistent: 1
diff --git a/mysql-test/suite/galera/r/pxc_5208_force_sst_after_ist_receiver_failure.result b/mysql-test/suite/galera/r/pxc_5208_force_sst_after_ist_receiver_failure.result
new file mode 100644
index 000000000000..12787653b24c
--- /dev/null
+++ b/mysql-test/suite/galera/r/pxc_5208_force_sst_after_ist_receiver_failure.result
@@ -0,0 +1,16 @@
+# Populate nodes with data
+# Shut down node_2
+# Wait for node_2 to be down
+# Execute some transactions on node_1 for node_2 to rejoin with IST
+# node_2 still has its state file at this point
+# Setup node_1 to server minimal IST range
+SET GLOBAL wsrep_provider_options = 'dbug=d,serve_mimimal_ist';
+# Start node_2 in background. Force wrong IST starting seqno and wait after detection of malformed IST.
+# Wait for node_2 to join the cluster
+# Execute some transactions on node_1 while node_2 is blocked in IST. This will cause node_2 receive queue to grow up
+include/wait_for_pattern_in_file.inc [Receiving IST failed, node restart required]
+include/assert_grep.inc [Ensure that Joiner aborted after receiving wrong IST]
+# Verify grastate.dat was removed before the abort
+# Start node_2 without forcing malformed IST
+# restart
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/pxc_create_trigger_binlog_super.result b/mysql-test/suite/galera/r/pxc_create_trigger_binlog_super.result
new file mode 100644
index 000000000000..9688ce975c9a
--- /dev/null
+++ b/mysql-test/suite/galera/r/pxc_create_trigger_binlog_super.result
@@ -0,0 +1,83 @@
+
+# 1. Setup users.
+
+SET @old_trust = @@GLOBAL.log_bin_trust_function_creators;
+Warnings:
+Warning 1287 '@@log_bin_trust_function_creators' is deprecated and will be removed in a future release.
+SET GLOBAL log_bin_trust_function_creators = 0;
+CREATE DATABASE probe;
+CREATE USER 'any_def'@'%' IDENTIFIED BY '';
+GRANT ALL PRIVILEGES ON probe.* TO 'any_def'@'%';
+GRANT SET_ANY_DEFINER ON *.* TO 'any_def'@'%';
+CREATE USER 'plain'@'%' IDENTIFIED BY '';
+GRANT ALL PRIVILEGES ON probe.* TO 'plain'@'%';
+CREATE USER 'sup'@'%' IDENTIFIED BY '';
+GRANT ALL PRIVILEGES ON probe.* TO 'sup'@'%';
+GRANT SUPER ON *.* TO 'sup'@'%';
+Warnings:
+Warning 1287 The SUPER privilege identifier is deprecated
+CREATE USER 'other'@'%' IDENTIFIED BY '';
+CREATE TABLE t (id BIGINT NOT NULL PRIMARY KEY);
+
+# 2. log_bin_trust_function_creators = 0
+
+# 2a. SET_ANY_DEFINER only
+CREATE TRIGGER t_any_definer_no_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+ERROR HY000: You do not have the SUPER privilege (you *might* want to use the less safe log_bin_trust_function_creators variable)
+CREATE DEFINER = 'other'@'%' TRIGGER t_any_definer_definer_no_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+ERROR HY000: You do not have the SUPER privilege (you *might* want to use the less safe log_bin_trust_function_creators variable)
+# 2b. Plain user (no SUPER, no SET_ANY_DEFINER)
+CREATE TRIGGER t_plain_no_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+ERROR HY000: You do not have the SUPER privilege (you *might* want to use the less safe log_bin_trust_function_creators variable)
+CREATE DEFINER = 'other'@'%' TRIGGER t_plain_definer_no_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+ERROR HY000: You do not have the SUPER privilege (you *might* want to use the less safe log_bin_trust_function_creators variable)
+# 2c. SUPER only
+CREATE TRIGGER t_super_no_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+CREATE DEFINER = 'other'@'%' TRIGGER t_super_definer_no_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+include/assert.inc ['Trigger t_any_definer_no_trust not created on node_1 (SET_ANY_DEFINER, trust = 0)']
+include/assert.inc ['Trigger t_any_definer_definer_no_trust not created on node_1 (SET_ANY_DEFINER, DEFINER, trust = 0)']
+include/assert.inc ['Trigger t_plain_no_trust not created on node_1 (PLAIN, trust = 0)']
+include/assert.inc ['Trigger t_plain_definer_no_trust not created on node_1 (PLAIN, DEFINER, trust = 0)']
+include/assert.inc ['Trigger t_super_no_trust created on node_1 (SUPER, trust = 0)']
+include/assert.inc ['Trigger t_super_definer_no_trust created on node_1 (SUPER, DEFINER, trust = 0)']
+'Trigger t_sup t_super_no_trust to node_2 (SUPER, trust = 0)'
+'Trigger t_super_definer_no_trust replicated to node_2 (SUPER, DEFINER, trust = 0)'
+include/assert.inc ['Trigger t_any_definer_no_trust not created on node_2 (SET_ANY_DEFINER, trust = 0)']
+include/assert.inc ['Trigger t_any_definer_definer_no_trust not created on node_2 (SET_ANY_DEFINER, DEFINER, trust = 0)']
+include/assert.inc ['Trigger t_plain_no_trust not created on node_2 (PLAIN, trust = 0)']
+include/assert.inc ['Trigger t_plain_definer_no_trust not created on node_2 (PLAIN, DEFINER, trust = 0)']
+
+# 3. log_bin_trust_function_creators = 1
+
+SET GLOBAL log_bin_trust_function_creators = 1;
+# 3a. SET_ANY_DEFINER only
+CREATE TRIGGER t_any_definer_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+CREATE DEFINER = 'other'@'%' TRIGGER t_any_definer_definer_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+# 3b. Plain user (no SUPER, no SET_ANY_DEFINER)
+CREATE TRIGGER t_plain_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+CREATE DEFINER = 'other'@'%' TRIGGER t_plain_definer_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+ERROR 42000: Access denied; you need (at least one of) the SUPER or SET_ANY_DEFINER privilege(s) for this operation
+# 3c. SUPER only
+CREATE TRIGGER t_super_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+CREATE DEFINER = 'other'@'%' TRIGGER t_super_definer_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+include/assert.inc ['Trigger t_any_definer_trust created on node_1 (SET_ANY_DEFINER, trust = 1)']
+include/assert.inc ['Trigger t_any_definer_definer_trust created on node_1 (SET_ANY_DEFINER, DEFINER, trust = 1)']
+include/assert.inc ['Trigger t_plain_trust created on node_1 (PLAIN, trust = 1)']
+include/assert.inc ['Trigger t_plain_definer_trust not created on node_1 (PLAIN, DEFINER, trust = 1)']
+include/assert.inc ['Trigger t_super_trust created on node_1 (SUPER, trust = 1)']
+include/assert.inc ['Trigger t_super_definer_trust created on node_1 (SUPER, DEFINER, trust = 1)']
+'Trigger t_any_definer_trust replicated to node_2 (SET_ANY_DEFINER, trust = 1)'
+'Trigger t_any_definer_definer_trust replicated to node_2 (SET_ANY_DEFINER, DEFINER, trust = 1)'
+'Trigger t_super_trust replicated to node_2 (SUPER, trust = 1)'
+'Trigger t_super_definer_trust replicated to node_2 (SUPER, DEFINER, trust = 1)'
+'Trigger t_plain_trust replicated to node_2 (PLAIN, trust = 1)'
+include/assert.inc ['Trigger t_plain_definer_trust not replicated on node_2 (PLAIN, DEFINER, trust = 1)']
+
+# 4. Cleanup.
+
+DROP DATABASE probe;
+DROP USER 'any_def'@'%';
+DROP USER 'plain'@'%';
+DROP USER 'sup'@'%';
+DROP USER 'other'@'%';
+SET GLOBAL log_bin_trust_function_creators = @old_trust;
diff --git a/mysql-test/suite/galera/r/pxc_create_trigger_nonexistent_definer.result b/mysql-test/suite/galera/r/pxc_create_trigger_nonexistent_definer.result
new file mode 100644
index 000000000000..40d28bf7ea3f
--- /dev/null
+++ b/mysql-test/suite/galera/r/pxc_create_trigger_nonexistent_definer.result
@@ -0,0 +1,80 @@
+
+# 1. Setup users.
+
+SET @old_trust = @@GLOBAL.log_bin_trust_function_creators;
+Warnings:
+Warning 1287 '@@log_bin_trust_function_creators' is deprecated and will be removed in a future release.
+SET GLOBAL log_bin_trust_function_creators = 1;
+CREATE DATABASE probe;
+CREATE USER 'any_def'@'%' IDENTIFIED BY '';
+GRANT ALL PRIVILEGES ON probe.* TO 'any_def'@'%';
+GRANT SET_ANY_DEFINER ON *.* TO 'any_def'@'%';
+CREATE USER 'nonexist_ok'@'%' IDENTIFIED BY '';
+GRANT ALL PRIVILEGES ON probe.* TO 'nonexist_ok'@'%';
+GRANT SET_ANY_DEFINER, ALLOW_NONEXISTENT_DEFINER ON *.* TO 'nonexist_ok'@'%';
+CREATE USER 'sup'@'%' IDENTIFIED BY '';
+GRANT ALL PRIVILEGES ON probe.* TO 'sup'@'%';
+GRANT SUPER ON *.* TO 'sup'@'%';
+Warnings:
+Warning 1287 The SUPER privilege identifier is deprecated
+CREATE TABLE t (id INT PRIMARY KEY);
+
+# 2. SET_ANY_DEFINER user, nonexistent DEFINER -> rejected pre-TOI, no eviction.
+
+CREATE DEFINER='ghost1'@'localhost' TRIGGER tg_ghost1 AFTER INSERT ON t FOR EACH ROW SET @n = NEW.id;
+ERROR 42000: Access denied; you need (at least one of) the SUPER or ALLOW_NONEXISTENT_DEFINER privilege(s) for this operation
+include/assert.inc ['node_1 still in a 2-node cluster after the rejected orphan-definer CREATE TRIGGER (no eviction)']
+include/assert.inc ['node_1 is still Synced (not Inconsistent)']
+include/assert.inc ['No inconsistency seen in node_1']
+include/assert.inc ['Trigger tg_ghost1 not created on node_1']
+include/assert.inc ['node_2 still in a 2-node cluster (no eviction)']
+include/assert.inc ['No inconsistency seen in node_2']
+include/assert.inc ['Trigger tg_ghost1 not created on node_2']
+
+# 2b. SET_ANY_DEFINER , EXISTING different DEFINER -> allowed, replicates.
+
+CREATE DEFINER='sup'@'%' TRIGGER tg_existing AFTER UPDATE ON t FOR EACH ROW SET @u = NEW.id;
+include/assert.inc ['Trigger tg_existing (existing DEFINER) created on node_1 by SET_ANY_DEFINER user']
+'Trigger tg_existing replicated to node_2'
+
+# 3. ALLOW_NONEXISTENT_DEFINER user, nonexistent DEFINER -> allowed, replicates.
+
+CREATE DEFINER='ghost2'@'localhost' TRIGGER tg_ghost2 AFTER INSERT ON t FOR EACH ROW SET @n = NEW.id;
+Warnings:
+Note 1449 The user specified as a definer ('ghost2'@'localhost') does not exist
+include/assert.inc ['Trigger tg_ghost2 created on node_1 (ALLOW_NONEXISTENT_DEFINER)']
+'Trigger tg_ghost2 replicated to node_2'
+
+# 4. SUPER user, nonexistent DEFINER -> allowed, replicates.
+
+CREATE DEFINER='ghost3'@'localhost' TRIGGER tg_ghost3 AFTER INSERT ON t FOR EACH ROW SET @n = NEW.id;
+Warnings:
+Note 1449 The user specified as a definer ('ghost3'@'localhost') does not exist
+include/assert.inc ['Trigger tg_ghost3 created on node_1 (SUPER)']
+'Trigger tg_ghost3 replicated to node_2'
+
+# 4b. trust = 0, nonexistent DEFINER: which gate reports, and both enforced.
+
+SET GLOBAL log_bin_trust_function_creators = 0;
+CREATE DEFINER='ghost4'@'localhost' TRIGGER tg_ghost4 AFTER INSERT ON t FOR EACH ROW SET @n = NEW.id;
+ERROR HY000: You do not have the SUPER privilege (you *might* want to use the less safe log_bin_trust_function_creators variable)
+include/assert.inc ['Trigger tg_ghost4 not created on node_1 (trust = 0)']
+include/assert.inc ['node_1 still in a 2-node cluster after the rejected trust = 0 CREATE TRIGGER (no eviction)']
+include/assert.inc ['Trigger tg_ghost4 not created on node_2 (trust = 0)']
+CREATE DEFINER='ghost5'@'localhost' TRIGGER tg_ghost5 AFTER INSERT ON t FOR EACH ROW SET @n = NEW.id;
+Warnings:
+Note 1449 The user specified as a definer ('ghost5'@'localhost') does not exist
+include/assert.inc ['Trigger tg_ghost5 created on node_1 (SUPER, trust = 0)']
+'Trigger tg_ghost5 replicated to node_2 (SUPER, trust = 0)'
+CREATE DEFINER='ghost6'@'localhost' TRIGGER tg_ghost6 AFTER INSERT ON t FOR EACH ROW SET @n = NEW.id;
+ERROR HY000: You do not have the SUPER privilege (you *might* want to use the less safe log_bin_trust_function_creators variable)
+include/assert.inc ['Trigger tg_ghost6 not created on node_1 (ALLOW_NONEXISTENT_DEFINER, no SUPER, trust = 0)']
+include/assert.inc ['Trigger tg_ghost6 not created on node_2 (ALLOW_NONEXISTENT_DEFINER, no SUPER, trust = 0)']
+
+# 5. Cleanup.
+
+DROP DATABASE probe;
+DROP USER 'any_def'@'%';
+DROP USER 'nonexist_ok'@'%';
+DROP USER 'sup'@'%';
+SET GLOBAL log_bin_trust_function_creators = @old_trust;
diff --git a/mysql-test/suite/galera/r/pxc_fk_inconsistency_voting.result b/mysql-test/suite/galera/r/pxc_fk_inconsistency_voting.result
index a3ee3b032e57..1aa583133157 100644
--- a/mysql-test/suite/galera/r/pxc_fk_inconsistency_voting.result
+++ b/mysql-test/suite/galera/r/pxc_fk_inconsistency_voting.result
@@ -3,7 +3,7 @@ CREATE TABLE child (j INT PRIMARY KEY) ENGINE = InnoDB;
INSERT INTO child VALUES (10);
ALTER TABLE child ADD CONSTRAINT idx17 FOREIGN KEY (j) REFERENCES parent(i);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`temp_table`, CONSTRAINT `idx17` FOREIGN KEY (`j`) REFERENCES `parent` (`i`))
-include/assert_grep.inc [Verify that the intermediate temporary table name has been replaced with temp_table]
+include/assert_grep.inc [Verify that both nodes vote on the same error code]
SET SESSION wsrep_on=OFF;
ALTER TABLE child ADD CONSTRAINT idx17 FOREIGN KEY (j) REFERENCES parent(i), ALGORITHM=COPY;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`#sql-XXXXX
diff --git a/mysql-test/suite/galera/r/pxc_inconsistency_voting.result b/mysql-test/suite/galera/r/pxc_inconsistency_voting.result
index 5d5564590e08..46fdfce828f4 100644
--- a/mysql-test/suite/galera/r/pxc_inconsistency_voting.result
+++ b/mysql-test/suite/galera/r/pxc_inconsistency_voting.result
@@ -2,8 +2,9 @@ CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT PRIMARY KEY, c2 INTEGER);
SET lc_messages = 'fr_FR';
ALTER TABLE t1 MODIFY c2 BIGINT UNSIGNED NOT NULL AUTO_INCREMENT ;
ERROR 42000: Un seul champ automatique est permis et il doit être indexé
-include/assert_grep.inc [Verify that node1 logs the message in the language set above]
-include/assert_grep.inc [Verify that node2 logs the message in the default language]
+include/assert_grep.inc [Verify that both nodes vote on the same error code]
+include/assert_grep.inc [Verify vote buffer carries no French message text]
+include/assert_grep.inc [Verify vote buffer carries no English message text]
ALTER TABLE t1 MODIFY c2 BIGINT UNSIGNED NOT NULL;
INSERT INTO t1 (c2) VALUES (123123), (234234);
SELECT * FROM t1;
diff --git a/mysql-test/suite/galera/r/pxc_install_gr.result b/mysql-test/suite/galera/r/pxc_install_gr.result
index cc276dbe9d80..25c7ebb540d9 100644
--- a/mysql-test/suite/galera/r/pxc_install_gr.result
+++ b/mysql-test/suite/galera/r/pxc_install_gr.result
@@ -9,5 +9,7 @@ INSTALL PLUGIN group_replication SONAME 'group_replication.so';
ERROR HY000: Group replication cannot be used with Percona XtraDB Cluster in strict mode.
CREATE TABLE t1(id INT PRIMARY KEY AUTO_INCREMENT);
SET GLOBAL pxc_strict_mode = 0;
+SET GLOBAL sql_require_primary_key = OFF;
SET GLOBAL pxc_strict_mode = 0;
+SET GLOBAL sql_require_primary_key = OFF;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/collation_accent.test b/mysql-test/suite/galera/t/collation_accent.test
new file mode 100644
index 000000000000..9c0d5c8a27a7
--- /dev/null
+++ b/mysql-test/suite/galera/t/collation_accent.test
@@ -0,0 +1,64 @@
+#
+# This test checks the correct operation with respect to padding and non-padding
+# string key collations
+#
+
+--source include/galera_cluster.inc
+--source include/have_debug_sync.inc
+--source suite/galera/include/galera_have_debug_sync.inc
+
+# We need two applier threads to avoid blocking on Galera internal
+# events
+--connection node_1
+SET GLOBAL wsrep_applier_threads = 2;
+
+# Session on node 1 for controlling sync points
+--connect node_1_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET SESSION wsrep_sync_wait = 0;
+
+--echo #
+--echo # Case 1: Create a table with a collation that does not ignore accents
+--echo #
+--connection node_1
+CREATE TABLE tcoll (string VARCHAR(16) CHARSET utf8mb4 COLLATE utf8mb4_0900_as_ci PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+
+--let $certification_query_node_1 = INSERT INTO tcoll VALUES ('abc', 1)
+--let $certification_query_node_2 = INSERT INTO tcoll VALUES ('ábç', 2)
+--source suite/galera/include/certification_no_conflict.inc
+
+--connection node_1
+SELECT COUNT(*) AS expect_2 FROM tcoll;
+
+--connection node_2
+SELECT COUNT(*) AS expect_2 FROM tcoll;
+
+--connection node_1
+DROP TABLE tcoll;
+
+--echo #
+--echo # Case 2: Create a table with a collation that ignores accents
+--echo #
+--connection node_1
+CREATE TABLE tcoll (string VARCHAR(16) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+
+--let $certification_query_node_1 = INSERT INTO tcoll VALUES ('abc', 1)
+--let $certification_query_node_2 = INSERT INTO tcoll VALUES ('ábç', 2)
+--source suite/galera/include/certification_conflict.inc
+
+--connection node_1
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+
+--connection node_2
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+
+--connection node_1
+DROP TABLE tcoll;
+
+# Reset number of applier threads back to default and execute a
+# query to make the extra applier to exit before leaving the test.
+SET GLOBAL wsrep_applier_threads = DEFAULT;
+--connection node_2
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+--connection node_1
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/collation_case.test b/mysql-test/suite/galera/t/collation_case.test
new file mode 100644
index 000000000000..4e7df29ef17e
--- /dev/null
+++ b/mysql-test/suite/galera/t/collation_case.test
@@ -0,0 +1,68 @@
+#
+# This test checks the correct operation with respect to padding and non-padding
+# string key collations
+#
+
+--source include/galera_cluster.inc
+--source include/have_debug_sync.inc
+--source suite/galera/include/galera_have_debug_sync.inc
+
+# We need two applier threads to avoid blocking on Galera internal
+# events
+--connection node_1
+SET GLOBAL wsrep_applier_threads = 2;
+
+# Session on node 1 for controlling sync points
+--connect node_1_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET SESSION wsrep_sync_wait = 0;
+
+
+--echo #
+--echo # Case 1: Create a table with a collation that does not ignore case
+--echo #
+
+--connection node_1
+CREATE TABLE tcoll (string VARCHAR(16) CHARSET utf8mb4 COLLATE utf8mb4_0900_as_cs PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+
+--let $certification_query_node_1 = INSERT INTO tcoll VALUES ('abc', 1)
+--let $certification_query_node_2 = INSERT INTO tcoll VALUES ('ABC', 2)
+--source suite/galera/include/certification_no_conflict.inc
+
+--connection node_1
+SELECT COUNT(*) AS expect_2 FROM tcoll;
+
+--connection node_2
+SELECT COUNT(*) AS expect_2 FROM tcoll;
+
+--connection node_1
+DROP TABLE tcoll;
+
+--echo #
+--echo # Case 2: reate a table with a collation that ignores case
+--echo #
+
+--connection node_1
+CREATE TABLE tcoll (string VARCHAR(16) CHARSET utf8mb4 COLLATE utf8mb4_0900_as_ci PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+--let $expect_rows = 1
+
+--let $certification_query_node_1 = INSERT INTO tcoll VALUES ('abc', 1)
+--let $certification_query_node_2 = INSERT INTO tcoll VALUES ('ABC', 2)
+--source suite/galera/include/certification_conflict.inc
+
+--connection node_1
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+
+--connection node_2
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+
+--connection node_1
+DROP TABLE tcoll;
+
+# Reset number of applier threads back to default and execute a
+# query to make the extra applier to exit before leaving the test.
+SET GLOBAL wsrep_applier_threads = DEFAULT;
+--connection node_2
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+--connection node_1
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/collation_pad.test b/mysql-test/suite/galera/t/collation_pad.test
new file mode 100644
index 000000000000..98280ea5cf9c
--- /dev/null
+++ b/mysql-test/suite/galera/t/collation_pad.test
@@ -0,0 +1,105 @@
+#
+# This test checks the correct operation with respect to padding and non-padding
+# string key collations.
+#
+
+--source include/galera_cluster.inc
+--source include/have_debug_sync.inc
+--source suite/galera/include/galera_have_debug_sync.inc
+
+# We need two applier threads to avoid blocking on Galera internal
+# events
+--connection node_1
+SET GLOBAL wsrep_applier_threads = 2;
+
+# Session on node 1 for controlling sync points
+--connect node_1_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET SESSION wsrep_sync_wait = 0;
+
+--echo #
+--echo # Case 1: Table with a binary collation that does not pad strings
+--echo #
+--connection node_1
+CREATE TABLE tcoll (string VARBINARY(16) PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+
+--let $certification_query_node_1 = INSERT INTO tcoll VALUES (0x61626300, 1)
+--let $certification_query_node_2 = INSERT INTO tcoll VALUES (0x616263, 2)
+--source suite/galera/include/certification_no_conflict.inc
+
+--connection node_1
+SELECT COUNT(*) AS expect_2 FROM tcoll;
+
+--connection node_2
+SELECT COUNT(*) AS expect_2 FROM tcoll;
+
+--connection node_1
+DROP TABLE tcoll;
+
+--echo #
+--echo # Case 2: Table with a binary collation that does pad strings
+--echo #
+
+--connection node_1
+CREATE TABLE tcoll (string BINARY(16) PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+
+--let $certification_query_node_1 = INSERT INTO tcoll VALUES (0x61626300, 1)
+--let $certification_query_node_2 = INSERT INTO tcoll VALUES (0x616263, 2)
+--source suite/galera/include/certification_conflict.inc
+
+--connection node_1
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+
+--connection node_2
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+
+--connection node_1
+DROP TABLE tcoll;
+
+--echo #
+--echo # Case 3: Create a table with a collation that pads strings
+--echo #
+
+--connection node_1
+CREATE TABLE tcoll (string VARCHAR(16) CHARSET utf8mb4 COLLATE utf8mb4_bin PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+
+--let $certification_query_node_1 = INSERT INTO tcoll VALUES ('abc', 1)
+--let $certification_query_node_2 = INSERT INTO tcoll VALUES ('abc ', 2)
+--source suite/galera/include/certification_conflict.inc
+
+--connection node_1
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+
+--connection node_2
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+
+--connection node_1
+DROP TABLE tcoll;
+
+--echo #
+--echo # Case 4: Create a table with a collation that pads strings
+--echo #
+
+--connection node_1
+CREATE TABLE tcoll (string VARCHAR(16) CHARSET latin1 PRIMARY KEY, node INTEGER) ENGINE=InnoDB;
+
+--let $certification_query_node_1 = INSERT INTO tcoll VALUES ('abc', 1)
+--let $certification_query_node_2 = INSERT INTO tcoll VALUES ('abc ', 2)
+--source suite/galera/include/certification_conflict.inc
+
+--connection node_1
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+
+--connection node_2
+SELECT COUNT(*) AS expect_1 FROM tcoll;
+
+--connection node_1
+DROP TABLE tcoll;
+
+# Reset number of applier threads back to default and execute a
+# query to make the extra applier to exit before leaving the test.
+SET GLOBAL wsrep_applier_threads = DEFAULT;
+--connection node_2
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+--connection node_1
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_pxc_5296_upgrade_strict_mode.test b/mysql-test/suite/galera/t/galera_pxc_5296_upgrade_strict_mode.test
new file mode 100644
index 000000000000..093d4d18eb7d
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_pxc_5296_upgrade_strict_mode.test
@@ -0,0 +1,197 @@
+################################################################################
+# PXC-5296: A PXC server upgrade must succeed when pxc_strict_mode is ENFORCING.
+#
+# pxc_strict_mode=ENFORCING/MASTER forces sql_require_primary_key=ON (PXC-5106)
+# and rejects any attempt to set it back to OFF. The server upgrade thread runs
+# the compiled-in upgrade script (mysql_system_tables_fix.sql), which
+# a) temporarily sets sql_require_primary_key=OFF to rebuild the CSV log
+# tables, which have no primary key (upstream bug#92988), and
+# b) rebuilds the legacy firewall tables, which also have no primary key,
+# *without* turning the policy off first.
+# Both were rejected, so the upgrade aborted with "Failed to upgrade server"
+# and the node could not start. Since ENFORCING forces the policy ON at
+# startup, this hit every upgrade of a node running in a strict mode.
+#
+# 1. Baseline.
+# 2. Seed node_2 with a legacy primary-key-less system table (the pre-8.0.22
+# mysql.firewall_whitelist) and with user data that must survive.
+# 3. Regression guard: a normal client SET sql_require_primary_key=OFF is still
+# blocked under ENFORCING.
+# 4. Restart node_2 with --pxc_strict_mode=ENFORCING --upgrade=FORCE.
+# 5. Post-upgrade checks: node rejoined, still ENFORCING, the primary-key-less
+# system tables were rebuilt, log tables intact, user data intact.
+# 6. Cleanup.
+################################################################################
+
+--source include/galera_cluster.inc
+# Reference mysql_upgrade.test, due to the upgrade/restart this takes time.
+--source include/big_test.inc
+--source include/not_valgrind.inc
+
+--echo #
+--echo # 1. Baseline.
+--echo #
+
+--connection node_1
+call mtr.add_suppression("Cannot set sql_require_primary_key=OFF while pxc_strict_mode is");
+call mtr.add_suppression("Setting sql_require_primary_key=ON because pxc_strict_mode is ENFORCING or MASTER");
+--let $pxc_saved_1 = `SELECT @@global.pxc_strict_mode`
+
+--connection node_2
+# mtr.test_suppressions has no primary key, so these INSERTs must happen before
+# node_2 is switched to ENFORCING.
+call mtr.add_suppression("Cannot set sql_require_primary_key=OFF while pxc_strict_mode is");
+call mtr.add_suppression("Setting sql_require_primary_key=ON because pxc_strict_mode is ENFORCING or MASTER");
+--let $pxc_saved_2 = `SELECT @@global.pxc_strict_mode`
+
+--let $assert_text = pxc_strict_mode is DISABLED
+--let $assert_cond = "$pxc_saved_2" = "DISABLED"
+--source include/assert.inc
+
+--let $assert_text = sql_require_primary_key global is OFF.
+--let $assert_cond = [ SELECT @@global.sql_require_primary_key = 0 ]
+--source include/assert.inc
+
+--echo #
+--echo # 2. Seed node_2 with a legacy primary-key-less system table and user data.
+--echo #
+
+--connection node_2
+# mysql.firewall_whitelist as shipped before 8.0.22: no primary key. The
+# upgrade script runs "ALTER TABLE mysql.firewall_whitelist ENGINE=InnoDB" and
+# then adds the ID primary key. The ALTER is rejected while
+# sql_require_primary_key is ON, which is what aborted the upgrade.
+#
+# wsrep_on=OFF keeps the legacy table local to the node being upgraded, which
+# is how it would look in a real datadir, and keeps node_1 untouched.
+SET SESSION wsrep_on = OFF;
+CREATE TABLE mysql.firewall_whitelist (USERHOST VARCHAR(80) NOT NULL,
+ RULE text NOT NULL) ENGINE=InnoDB;
+SET SESSION wsrep_on = ON;
+
+--let $assert_text = seeded mysql.firewall_whitelist has no primary key
+--let $assert_cond = [ SELECT COUNT(*) = 0 FROM information_schema.table_constraints WHERE table_schema = "mysql" AND table_name = "firewall_whitelist" AND constraint_type = "PRIMARY KEY" ]
+--source include/assert.inc
+
+--connection node_1
+# Has a primary key, so it is valid under the sql_require_primary_key=ON that
+# pxc_strict_mode=ENFORCING implies.
+CREATE TABLE t1 (id INT PRIMARY KEY, val VARCHAR(32)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'before'), (2, 'upgrade'), (3, 'data');
+SELECT * FROM t1 ORDER BY id;
+
+--echo #
+--echo # 3. Regression guard: a client SET sql_require_primary_key=OFF is still
+--echo # blocked under ENFORCING.
+--echo #
+
+# The fix must not weaken the user-facing guard. Only the server's own upgrade
+# thread is exempt; a normal session is not.
+--connection node_1
+SET GLOBAL pxc_strict_mode = 'ENFORCING';
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL sql_require_primary_key = OFF;
+--error ER_WRONG_VALUE_FOR_VAR
+SET SESSION sql_require_primary_key = OFF;
+
+# Put node_1 back to the baseline; only node_2 is upgraded below. Degrading
+# pxc_strict_mode does not clear the global sql_require_primary_key that
+# ENFORCING turned ON, so reset it explicitly.
+SET GLOBAL pxc_strict_mode = 'DISABLED';
+SET GLOBAL sql_require_primary_key = OFF;
+
+--echo #
+--echo # 4. Restart node_2 with --pxc_strict_mode=ENFORCING --upgrade=FORCE.
+--echo #
+
+--connection node_2
+--source include/mysql_upgrade_preparation.inc
+
+# Before the fix this restart aborted during "Server upgrade from ... started"
+# with "Cannot set sql_require_primary_key=OFF while pxc_strict_mode is
+# ENFORCING" followed by "Failed to upgrade server", and the node never came
+# back. Reference mysql_upgrade.test: the upgrade takes a while.
+--let $restart_parameters = restart:--pxc_strict_mode=ENFORCING --upgrade=FORCE
+--let $wait_counter = 10000
+--source include/restart_mysqld.inc
+
+--source include/mysql_upgrade_cleanup.inc
+
+--echo #
+--echo # 5. Post-upgrade checks.
+--echo #
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+# Wait until node_2 is fully synced before reading replicated data below.
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+--source include/wait_condition.inc
+
+--let $pxc_mode_upg = `SELECT @@global.pxc_strict_mode`
+--let $assert_text = node_2 is up and pxc_strict_mode is still ENFORCING
+--let $assert_cond = "$pxc_mode_upg" = "ENFORCING"
+--source include/assert.inc
+
+--let $assert_text = global sql_require_primary_key is ON under ENFORCING
+--let $assert_cond = [ SELECT @@global.sql_require_primary_key = 1 ]
+--source include/assert.inc
+
+# The upgrade script actually ran to completion over the primary-key-less
+# tables: firewall_whitelist gained its ID primary key, and the group-profile
+# tables were created -- including mysql.firewall_membership, which the script
+# creates without a primary key.
+--let $assert_text = mysql.firewall_whitelist gained its ID primary key
+--let $assert_cond = [ SELECT COUNT(*) = 1 FROM information_schema.table_constraints WHERE table_schema = "mysql" AND table_name = "firewall_whitelist" AND constraint_type = "PRIMARY KEY" ]
+--source include/assert.inc
+
+# The script creates firewall_membership without a primary key first and adds
+# the composite key later on, so both statements had to get through.
+--let $assert_text = mysql.firewall_membership was created by the upgrade
+--let $assert_cond = [ SELECT COUNT(*) = 1 FROM information_schema.tables WHERE table_schema = "mysql" AND table_name = "firewall_membership" ]
+--source include/assert.inc
+
+--let $assert_text = mysql.firewall_membership got its composite primary key
+--let $assert_cond = [ SELECT COUNT(*) = 1 FROM information_schema.table_constraints WHERE table_schema = "mysql" AND table_name = "firewall_membership" AND constraint_type = "PRIMARY KEY" ]
+--source include/assert.inc
+
+# The CSV log tables are the ones the script wraps in
+# sql_require_primary_key=OFF. They must still be there, and still without a
+# primary key.
+--let $assert_text = mysql.general_log and mysql.slow_log survived without a primary key
+--let $assert_cond = [ SELECT COUNT(*) = 2 FROM information_schema.tables t WHERE t.table_schema = "mysql" AND t.table_name IN ("general_log", "slow_log") AND NOT EXISTS (SELECT 1 FROM information_schema.table_constraints c WHERE c.table_schema = t.table_schema AND c.table_name = t.table_name AND c.constraint_type = "PRIMARY KEY") ]
+--source include/assert.inc
+
+# t1 was created on node_1; it must be present on the upgraded node_2, proving
+# the upgraded node is a working cluster member and the data survived.
+SELECT * FROM t1 ORDER BY id;
+
+--echo #
+--echo # 6. Cleanup.
+--echo #
+
+--connection node_2
+# Drop the node-local firewall tables while still under ENFORCING; DROP is not
+# affected by sql_require_primary_key.
+SET SESSION wsrep_on = OFF;
+DROP TABLE mysql.firewall_whitelist;
+DROP TABLE mysql.firewall_group_allowlist;
+DROP TABLE mysql.firewall_groups;
+DROP TABLE mysql.firewall_membership;
+SET SESSION wsrep_on = ON;
+
+# Restore node_2 to its suite defaults.
+--let $restart_parameters = restart
+--source include/restart_mysqld.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--eval SET GLOBAL pxc_strict_mode = $pxc_saved_2
+SET GLOBAL sql_require_primary_key = OFF;
+
+--connection node_1
+DROP TABLE t1;
+--eval SET GLOBAL pxc_strict_mode = $pxc_saved_1
+SET GLOBAL sql_require_primary_key = OFF;
diff --git a/mysql-test/suite/galera/t/galera_pxc_sql_require_primary_key.test b/mysql-test/suite/galera/t/galera_pxc_sql_require_primary_key.test
new file mode 100644
index 000000000000..d5426c9cfa1f
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_pxc_sql_require_primary_key.test
@@ -0,0 +1,213 @@
+# This test proves that setting pxc_strict_mode to ENFORCING or MASTER
+# sets @@global sql_require_primary_key ON and test few related scenarios.
+# Session values are not updated by pxc_strict_mode.
+#
+# 1. Degrade ENFORCING -> DISABLED does not change sql_require_primary_key
+# 2. pxc_strict_mode=ENFORCING also sets global sql_require_primary_key ON
+# 3. Degrade ENFORCING -> PERMISSIVE does not change sql_require_primary_key
+# 4. pxc_strict_mode=MASTER also sets global sql_require_primary_key ON
+# sql_require_primary_key=OFF cannot be set to OFF when pxc_strict_mode is MASTER
+# 5. ALTER DROP PRIMARY KEY under ENFORCING
+# 6. restart node_2 with ENFORCING and sql-require-primary-key=OFF
+# 7. Cleanup.
+
+--source include/galera_cluster.inc
+# Due to restart, lets make this test big-test.
+--source include/big_test.inc
+#--source include/force_restart.inc
+
+--connection node_1
+call mtr.add_suppression("Cannot set sql_require_primary_key=OFF while pxc_strict_mode is");
+call mtr.add_suppression("Replica SQL: Error .Unable to create or change a table without a primary key");
+call mtr.add_suppression("Setting sql_require_primary_key=ON because pxc_strict_mode is ENFORCING or MASTER");
+--let $pxc_saved_1 = `SELECT @@global.pxc_strict_mode`
+
+--connection node_2
+call mtr.add_suppression("Cannot set sql_require_primary_key=OFF while pxc_strict_mode is");
+call mtr.add_suppression("Replica SQL: Error .Unable to create or change a table without a primary key");
+call mtr.add_suppression("Setting sql_require_primary_key=ON because pxc_strict_mode is ENFORCING or MASTER");
+--let $pxc_saved_2 = `SELECT @@global.pxc_strict_mode`
+
+--let $assert_text = sql_require_primary_key global is OFF.
+--let $assert_cond = [ SELECT @@global.sql_require_primary_key = 0 ]
+--source include/assert.inc
+
+--let $pxc_strict_baseline = `SELECT @@global.pxc_strict_mode`
+--let $assert_text = pxc_strict_mode is DISABLED
+--let $assert_cond = "$pxc_strict_baseline" = "DISABLED"
+--source include/assert.inc
+
+## sql_require_primary_key behavior ##
+# Below command prove that even if GLOBAL sql_require_primary_key is set to ON
+# session variable value is not changed, allowing DDL without primary key to
+# run successfully.
+SET GLOBAL sql_require_primary_key = OFF;
+SET SESSION sql_require_primary_key = OFF;
+CREATE TABLE pxc_srp_b (c1 INT) ENGINE = InnoDB;
+DROP TABLE pxc_srp_b;
+
+# Though sql_require_primary_key is ON sesson values are not changed allowing
+# DDL without primary key to run successfully.
+SET GLOBAL sql_require_primary_key = ON;
+CREATE TABLE pxc_srp_b (c1 INT) ENGINE = InnoDB;
+DROP TABLE pxc_srp_b;
+SET GLOBAL sql_require_primary_key = OFF;
+SET SESSION sql_require_primary_key = ON;
+
+## NOTE-1: Upgrade pxc_strict_mode into ENFORCING/MASTER forces @@global
+## sql_require_primary_key = ON existing @@sessions are not changed.
+## Refer above testing that confirms behavior is in synch with
+## sql_require_primary_key
+## NOTE-2: Degrading strict mode does not clear global sql_require_primary_key.
+
+--echo
+--echo # 1. Degrade ENFORCING -> DISABLED does not change sql_require_primary_key
+--echo
+
+--connection node_1
+SET GLOBAL pxc_strict_mode = 'ENFORCING';
+SET GLOBAL pxc_strict_mode = 'DISABLED';
+
+--let $assert_text = sql_require_primary_key global stays ON after degrade to DISABLED.
+--let $assert_cond = [ SELECT @@global.sql_require_primary_key = 1 ]
+--source include/assert.inc
+
+# sql_require_primary_key can be set to ON and OFF when pxc_strict_mode = DISABLED/PERMISSIVE
+# since pxc_strict_mode is not strict but customer may need the flag.
+SET GLOBAL sql_require_primary_key = ON;
+SET GLOBAL sql_require_primary_key = OFF;
+SET SESSION sql_require_primary_key = ON;
+SET SESSION sql_require_primary_key = OFF;
+
+CREATE TABLE pxc_srp_d (c1 INT) ENGINE = InnoDB;
+DROP TABLE pxc_srp_d;
+
+--echo
+--echo # 2. pxc_strict_mode=ENFORCING also sets global sql_require_primary_key ON
+--echo
+
+SET GLOBAL pxc_strict_mode = 'ENFORCING';
+
+--let $assert_text = sql_require_primary_key global is ON.
+--let $assert_cond = [ SELECT @@global.sql_require_primary_key = 1 ]
+--source include/assert.inc
+
+--echo # sql_require_primary_key=OFF cannot be set to OFF when pxc_strict_mode is ENFORCING
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL sql_require_primary_key = OFF;
+--error ER_WRONG_VALUE_FOR_VAR
+SET SESSION sql_require_primary_key = OFF;
+
+SET GLOBAL sql_require_primary_key = ON;
+SET SESSION sql_require_primary_key = ON;
+
+# NOTE: Old session can still execute below statements.
+--error ER_TABLE_WITHOUT_PK
+CREATE TABLE pxc_srp_b (c1 INT) ENGINE = InnoDB;
+
+--echo
+--echo # 3. Degrade ENFORCING -> PERMISSIVE does not change sql_require_primary_key
+--echo
+
+SET GLOBAL pxc_strict_mode = 'PERMISSIVE';
+
+--let $assert_text = sql_require_primary_key global still ON after PERMISSIVE degrade.
+--let $assert_cond = [ SELECT @@global.sql_require_primary_key = 1 ]
+--source include/assert.inc
+
+# sql_require_primary_key can be set to ON and OFF when pxc_strict_mode = DISABLED/PERMISSIVE
+# since pxc_strict_mode is not strict but customer may need the flag.
+SET GLOBAL sql_require_primary_key = ON;
+SET GLOBAL sql_require_primary_key = OFF;
+SET SESSION sql_require_primary_key = ON;
+SET SESSION sql_require_primary_key = OFF;
+
+CREATE TABLE pxc_srp_d (c1 INT) ENGINE = InnoDB;
+DROP TABLE pxc_srp_d;
+
+--echo
+--echo # 4. pxc_strict_mode = MASTER also sets global sql_require_primary_key ON
+--echo
+
+SET GLOBAL pxc_strict_mode = 'MASTER';
+
+--let $assert_text = sql_require_primary_key is ON.
+--let $assert_cond = [ SELECT @@global.sql_require_primary_key = 1 ]
+--source include/assert.inc
+
+--echo # sql_require_primary_key = OFF cannot be set to OFF when pxc_strict_mode is MASTER
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL sql_require_primary_key = OFF;
+--error ER_WRONG_VALUE_FOR_VAR
+SET SESSION sql_require_primary_key = OFF;
+
+SET GLOBAL sql_require_primary_key = ON;
+SET SESSION sql_require_primary_key = ON;
+
+# NOTE: Old sessions can still execute below statements.
+--error ER_TABLE_WITHOUT_PK
+CREATE TABLE pxc_srp_b (c1 INT) ENGINE = InnoDB;
+
+--echo
+--echo # 5. ALTER DROP PRIMARY KEY under ENFORCING
+--echo
+
+SET GLOBAL pxc_strict_mode = 'DISABLED';
+
+CREATE TABLE pxc_srp_f (c1 INT PRIMARY KEY) ENGINE = InnoDB;
+
+SET GLOBAL pxc_strict_mode = 'ENFORCING';
+
+--error ER_TABLE_WITHOUT_PK
+ALTER TABLE pxc_srp_f DROP PRIMARY KEY;
+
+SET GLOBAL pxc_strict_mode = 'DISABLED';
+SET SESSION sql_require_primary_key = OFF;
+
+ALTER TABLE pxc_srp_f DROP PRIMARY KEY;
+DROP TABLE pxc_srp_f;
+
+--echo
+--echo # 6. restart node_2 with ENFORCING and sql-require-primary-key = OFF
+--echo
+
+--connection node_2
+--let $restart_parameters = restart:--pxc_strict_mode=ENFORCING --sql-require-primary-key=OFF
+--source include/restart_mysqld.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_2
+--let $pxc_mode_boot = `SELECT @@global.pxc_strict_mode`
+--let $assert_text = pxc_strict_mode should be ENFORCING after restart
+--let $assert_cond = "$pxc_mode_boot" = "ENFORCING"
+--source include/assert.inc
+
+--let $assert_text = global sql_require_primary_key should be ON, OFF value is ignored
+--let $assert_cond = [ SELECT @@global.sql_require_primary_key = 1 ]
+--source include/assert.inc
+
+--let $assert_text = session sql_require_primary_key should be ON
+--let $assert_cond = [ SELECT @@session.sql_require_primary_key = 1 ]
+--source include/assert.inc
+
+--echo # restore node_2 default options from suite cnf
+--let $restart_parameters = restart
+--source include/restart_mysqld.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--echo
+--echo # 7. Cleanup.
+--echo
+
+--connection node_1
+--eval SET GLOBAL pxc_strict_mode = $pxc_saved_1
+SET GLOBAL sql_require_primary_key = OFF;
+
+--connection node_2
+--eval SET GLOBAL pxc_strict_mode = $pxc_saved_2
diff --git a/mysql-test/suite/galera/t/galera_rpl_pxc_strict_mode_mismatch.cnf b/mysql-test/suite/galera/t/galera_rpl_pxc_strict_mode_mismatch.cnf
new file mode 100644
index 000000000000..0f48727564f2
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_rpl_pxc_strict_mode_mismatch.cnf
@@ -0,0 +1,5 @@
+!include ../galera_2nodes_as_slave.cnf
+
+[mysqld.2]
+
+[mysqld.3]
diff --git a/mysql-test/suite/galera/t/galera_rpl_pxc_strict_mode_mismatch.test b/mysql-test/suite/galera/t/galera_rpl_pxc_strict_mode_mismatch.test
new file mode 100644
index 000000000000..cb07bd76ba7f
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_rpl_pxc_strict_mode_mismatch.test
@@ -0,0 +1,134 @@
+# This tests make sure transactions received from remote node of galera or from
+# asynch source are applied successfully in both galera and replica even if
+# pxc_strict_mode is ENFORCING.
+#
+# Setup Summary
+# ------------------------------------
+# Node-1 is the async replication 'source' not part of cluster.
+# The test turns 'sql_require_primary_key=OFF' so it can run CREATE TABLE
+# without a PK,
+#
+# Node-2 is the 'Galera member'. It is async-replica of node-1.
+# The test turns 'pxc_strict_mode=ENFORCING' before START REPLICA.
+# sql_require_primary_key is ON.
+# DDLs without primary key received from node-1 are executed successfully.
+#
+# Node-3 is the 'Galera member'. It is not async-replica.
+# The test turns 'pxc_strict_mode=ENFORCING' so sql_require_primary_key is ON.
+# Node-3 will receive DDL from node-2 and apply successfully.
+#
+# Testcase: On node-1 execute CREATE TABLE without a primary key and INSERT;
+# expect the table and row on node-2 (replica applier) and on node-3 (Galera).
+# Then DROP on node-1 and expect removal on the cluster; stop replication and
+# restore node-2 globals.
+#
+# Why node-2/node-3 boot with pxc_strict_mode=DISABLED (.cnf)
+# -----------------------------------------------------------
+# MTR runs include/check-testcase.test before each run; it does SET SESSION
+# sql_require_primary_key=0, which errors if pxc_strict_mode is ENFORCING. The test
+# then switches node-2 to ENFORCING before START REPLICA (strict replica after modes
+# are set, as intended). mysqld.2 also uses replica_parallel_workers=0 so upstream
+# DDL does not stall under parallel apply with Galera.
+
+--source include/have_log_bin.inc
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--source include/galera_cluster_master_slave.inc
+
+--connection node_2
+call mtr.add_suppression("Cannot set sql_require_primary_key=OFF while pxc_strict_mode is");
+call mtr.add_suppression("Replica SQL: Error .*Unable to create or change a table without a primary key");
+call mtr.add_suppression("Setting sql_require_primary_key=ON because pxc_strict_mode is ENFORCING or MASTER");
+call mtr.add_suppression("Pending to replicate MySQL GTID event .* Discarding it now");
+
+--let $pxc_saved_2 = `SELECT @@global.pxc_strict_mode`
+--let $pk_saved_2 = `SELECT @@global.sql_require_primary_key`
+
+SET GLOBAL pxc_strict_mode = 'ENFORCING';
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
+--connection node_3
+--let $pxc_saved_3 = `SELECT @@global.pxc_strict_mode`
+--let $pk_saved_3 = `SELECT @@global.sql_require_primary_key`
+
+SET GLOBAL pxc_strict_mode = 'ENFORCING';
+
+--connection node_1
+--let $assert_text = sql_require_primary_key global is OFF.
+--let $assert_cond = [ SELECT @@global.sql_require_primary_key = 0 ]
+--source include/assert.inc
+
+--let $pxc_strict_baseline = `SELECT @@global.pxc_strict_mode`
+--let $assert_text = pxc_strict_mode is DISABLED
+--let $assert_cond = "$pxc_strict_baseline" = "DISABLED"
+--source include/assert.inc
+
+--connection node_2
+--let $pxc_boot = `SELECT @@global.pxc_strict_mode`
+--let $assert_text = pxc_strict_mode is ENFORCING
+--let $assert_cond = "$pxc_boot" = "ENFORCING"
+--source include/assert.inc
+
+--let $assert_text = sql_require_primary_key global is ON.
+--let $assert_cond = [ SELECT @@global.sql_require_primary_key = 1 ]
+--source include/assert.inc
+
+--connection node_3
+--let $pxc_boot = `SELECT @@global.pxc_strict_mode`
+--let $assert_text = pxc_strict_mode is ENFORCING
+--let $assert_cond = "$pxc_boot" = "ENFORCING"
+--source include/assert.inc
+
+--let $assert_text = sql_require_primary_key global is ON.
+--let $assert_cond = [ SELECT @@global.sql_require_primary_key = 1 ]
+--source include/assert.inc
+
+--echo # Start replication on node-2
+--connection node_2
+--disable_query_log
+--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST = '127.0.0.1', SOURCE_PORT = $NODE_MYPORT_1
+--enable_query_log
+START REPLICA USER = 'root';
+
+--source include/rpl/wait_for_receiver_to_start.inc
+--source include/rpl/wait_for_applier_to_start.inc
+
+--echo # Source runs DDL without PK; replica applier uses replicated session metadata
+--connection node_1
+CREATE TABLE t_rpl_nopk (c1 INT) ENGINE = InnoDB;
+INSERT INTO t_rpl_nopk VALUES (1);
+
+## NODE-2 is replica
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 't_rpl_nopk'
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t_rpl_nopk
+--source include/wait_condition.inc
+
+## NODE-3 is Galera
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 't_rpl_nopk'
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t_rpl_nopk
+--source include/wait_condition.inc
+
+--connection node_1
+DROP TABLE t_rpl_nopk;
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 0 FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 't_rpl_nopk'
+--source include/wait_condition.inc
+--eval SET GLOBAL pxc_strict_mode = $pxc_saved_3
+--eval SET GLOBAL sql_require_primary_key = $pk_saved_3
+--disconnect node_3
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 0 FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 't_rpl_nopk'
+--source include/wait_condition.inc
+
+STOP REPLICA;
+RESET REPLICA ALL;
+
+--eval SET GLOBAL pxc_strict_mode = $pxc_saved_2
+--eval SET GLOBAL sql_require_primary_key = $pk_saved_2
diff --git a/mysql-test/suite/galera/t/galera_sst_clone_validate_password-master.opt b/mysql-test/suite/galera/t/galera_sst_clone_validate_password-master.opt
new file mode 100644
index 000000000000..7938fb41d496
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_clone_validate_password-master.opt
@@ -0,0 +1 @@
+$VALIDATE_PASSWORD_COMPONENT_OPT
diff --git a/mysql-test/suite/galera/t/galera_sst_clone_validate_password-slave.opt b/mysql-test/suite/galera/t/galera_sst_clone_validate_password-slave.opt
new file mode 100644
index 000000000000..7938fb41d496
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_clone_validate_password-slave.opt
@@ -0,0 +1 @@
+$VALIDATE_PASSWORD_COMPONENT_OPT
diff --git a/mysql-test/suite/galera/t/galera_sst_clone_validate_password.cnf b/mysql-test/suite/galera/t/galera_sst_clone_validate_password.cnf
new file mode 100644
index 000000000000..4c59ae65ecbb
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_clone_validate_password.cnf
@@ -0,0 +1,16 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=clone
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true;@ENV.WSREP_PROVIDER_TIMEOUTS'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true;@ENV.WSREP_PROVIDER_TIMEOUTS'
+
+[sst]
+# Default clone SST password is 36 chars (32 random hex + Aa1.). The suffix
+# below adds uppercase, digits, and special chars for validate_password:
+# mixed_case_count=7, number_count=3, special_char_count=5, length=40.
+sst-password-suffix=AAAAAAA..//-2344
diff --git a/mysql-test/suite/galera/t/galera_sst_clone_validate_password.test b/mysql-test/suite/galera/t/galera_sst_clone_validate_password.test
new file mode 100644
index 000000000000..3721384185fd
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_clone_validate_password.test
@@ -0,0 +1,8 @@
+#
+# Clone SST with validate_password component active on the donor.
+# The joiner configures [sst] sst-password-suffix so the generated clone
+# password satisfies strict length, mixed-case, digit, and special-char
+# policies on the donor.
+#
+
+--source galera_sst_validate_password.inc
diff --git a/mysql-test/suite/galera/t/galera_sst_validate_password.inc b/mysql-test/suite/galera/t/galera_sst_validate_password.inc
new file mode 100644
index 000000000000..386e11e12de9
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_validate_password.inc
@@ -0,0 +1,63 @@
+# Shared scenario: strict validate_password policy, two-node cluster,
+# force SST on node 2, verify replication succeeds.
+#
+# SST method and method-specific [sst] options come from the test .cnf file.
+
+--source include/have_validate_password_component.inc
+
+--disable_query_log
+CALL mtr.add_suppression("Effective value of validate_password.length is changed.");
+--enable_query_log
+
+INSTALL COMPONENT "file://component_validate_password";
+SET @@global.validate_password.policy = MEDIUM;
+SET @@global.validate_password.length = 40;
+SET @@global.validate_password.mixed_case_count = 7;
+SET @@global.validate_password.number_count = 3;
+SET @@global.validate_password.special_char_count = 5;
+
+--source include/galera_cluster.inc
+--source include/force_restart.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+
+--connection node_1
+SET @@global.validate_password.policy = MEDIUM;
+SET @@global.validate_password.length = 40;
+SET @@global.validate_password.mixed_case_count = 7;
+SET @@global.validate_password.number_count = 3;
+SET @@global.validate_password.special_char_count = 5;
+
+--connection node_2
+SET @@global.validate_password.policy = MEDIUM;
+SET @@global.validate_password.length = 40;
+SET @@global.validate_password.mixed_case_count = 7;
+SET @@global.validate_password.number_count = 3;
+SET @@global.validate_password.special_char_count = 5;
+
+# Remove the grastate.dat file to force an SST
+--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+--echo # Restarting node 2 ...
+--source include/shutdown_mysqld.inc
+--source include/start_mysqld.inc
+
+--source include/wait_until_connected_again.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--connection node_2
+SELECT COUNT(*) FROM t1;
+
+# Test cleanup
+--connection node_1
+--echo # connection node_1
+DROP TABLE t1;
+UNINSTALL COMPONENT "file://component_validate_password";
+
+--disable_query_log
+--connection node_1
+CALL mtr.add_suppression("Failed to remove page file");
+--connection node_2
+CALL mtr.add_suppression("Failed to remove page file");
+--enable_query_log
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup_validate_password-master.opt b/mysql-test/suite/galera/t/galera_sst_xtrabackup_validate_password-master.opt
new file mode 100644
index 000000000000..7938fb41d496
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup_validate_password-master.opt
@@ -0,0 +1 @@
+$VALIDATE_PASSWORD_COMPONENT_OPT
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup_validate_password-slave.opt b/mysql-test/suite/galera/t/galera_sst_xtrabackup_validate_password-slave.opt
new file mode 100644
index 000000000000..7938fb41d496
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup_validate_password-slave.opt
@@ -0,0 +1 @@
+$VALIDATE_PASSWORD_COMPONENT_OPT
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup_validate_password.cnf b/mysql-test/suite/galera/t/galera_sst_xtrabackup_validate_password.cnf
new file mode 100644
index 000000000000..a13b51ddbac4
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup_validate_password.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=xtrabackup-v2
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true;@ENV.WSREP_PROVIDER_TIMEOUTS'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true;@ENV.WSREP_PROVIDER_TIMEOUTS'
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup_validate_password.test b/mysql-test/suite/galera/t/galera_sst_xtrabackup_validate_password.test
new file mode 100644
index 000000000000..49020f0765cc
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup_validate_password.test
@@ -0,0 +1,9 @@
+#
+# Xtrabackup SST with validate_password on a strict policy.
+# Post-processing recreates mysql.pxc.sst.user with a password that would not
+# satisfy the policy (aA!9 + 32 random alnum in wsrep_sst_common.sh).
+# SST and post-processing succeed anyway: CREATE USER runs from init-file
+# before validate_password is active in the temporary post-processing mysqld.
+#
+
+--source galera_sst_validate_password.inc
diff --git a/mysql-test/suite/galera/t/galera_wan.test b/mysql-test/suite/galera/t/galera_wan.test
index 373895665697..62608ecb8ec3 100644
--- a/mysql-test/suite/galera/t/galera_wan.test
+++ b/mysql-test/suite/galera/t/galera_wan.test
@@ -6,6 +6,13 @@
# status variables are provided. So we only check that simple replication works.
#
+# Allocates 4 mysqld nodes plus an xtrabackup SST pipeline; running multiple
+# copies of this test concurrently with other galera tests over-subscribes the
+# host and causes EVS to declare peers inactive mid-SST (manifesting as
+# "SST preparation failed" / "State transfer ... failed: Operation canceled").
+# Serialise the test to keep it deterministic under high --parallel runs.
+--source include/not_parallel.inc
+
--source include/galera_cluster.inc
SELECT VARIABLE_VALUE = 4 FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size';
diff --git a/mysql-test/suite/galera/t/galera_wsrep_key_empty_value.test b/mysql-test/suite/galera/t/galera_wsrep_key_empty_value.test
new file mode 100644
index 000000000000..c5860f85195a
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wsrep_key_empty_value.test
@@ -0,0 +1,116 @@
+#
+# Regression test for a stack-buffer-overflow (1-byte underflow READ)
+# in wsrep_innobase_mysql_sort() when a Galera-replicated write generates a
+# key value that collates to zero length. The peek preceding the pad-trim
+# loop in the WsrepVersion::V5 branch used to read str[ret_length - 1]
+# without checking ret_length > 0; strnxfrm returns 0 for an empty non-binary
+# input, so the read was one byte before the caller's stack buffer and
+# tripped ASan.
+#
+# The fix guards the peek with `ret_length > 0`; the existing for-loop was
+# already bounded correctly. This test exercises the six shapes that reach
+# the three wsrep_innobase_mysql_sort() call sites in
+# wsrep_store_key_val_for_row() with an empty key value. Under a plain
+# build every case is a semantic round-trip; under an ASan build the pre-fix
+# tree crashes before the DROP.
+#
+
+--source include/galera_cluster.inc
+
+--echo #
+--echo # Case 1: VARCHAR PK, empty value, multi-byte charset
+--echo # (my_strnxfrm_unicode, nweights == 0 -> ret_length == 0)
+--echo #
+--connection node_1
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY, b INT) CHARSET utf8mb4 ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('', 1);
+UPDATE t1 SET b = 2 WHERE a = '';
+
+--connection node_2
+SELECT LENGTH(a) AS len_a, b FROM t1;
+
+--connection node_1
+DELETE FROM t1 WHERE a = '';
+
+--connection node_2
+SELECT COUNT(*) AS cnt FROM t1;
+
+--connection node_1
+DROP TABLE t1;
+
+--echo #
+--echo # Case 2: VARCHAR PK, empty value, single-byte charset
+--echo # (my_strnxfrm_simple, a different code path to ret_length == 0)
+--echo #
+--connection node_1
+CREATE TABLE t2 (a VARCHAR(10) PRIMARY KEY, b INT) CHARSET latin1 ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('', 1);
+
+--connection node_2
+SELECT LENGTH(a) AS len_a, b FROM t2;
+
+--connection node_1
+DROP TABLE t2;
+
+--echo #
+--echo # Case 3: VARCHAR PK, all-pad value under a PAD SPACE collation
+--echo # (the trim loop itself consumes every byte of the collated key)
+--echo #
+--connection node_1
+CREATE TABLE t3 (a VARCHAR(10) PRIMARY KEY, b INT) CHARSET latin1 ENGINE=InnoDB;
+INSERT INTO t3 VALUES (' ', 1);
+
+--connection node_2
+SELECT HEX(a) AS hex_a, b FROM t3;
+
+--connection node_1
+DROP TABLE t3;
+
+--echo #
+--echo # Case 4: CHAR PK, empty value
+--echo # (MYSQL_TYPE_STRING branch; the record holds n pad characters)
+--echo #
+--connection node_1
+CREATE TABLE t4 (a CHAR(4) PRIMARY KEY, b INT) CHARSET latin1 ENGINE=InnoDB;
+INSERT INTO t4 VALUES ('', 1);
+
+--connection node_2
+SELECT LENGTH(a) AS len_a, b FROM t4;
+
+--connection node_1
+DROP TABLE t4;
+
+--echo #
+--echo # Case 5: TEXT prefix PK, empty value
+--echo # (BLOB branch of wsrep_store_key_val_for_row)
+--echo #
+--connection node_1
+CREATE TABLE t5 (a TEXT NOT NULL, b INT, PRIMARY KEY (a(10))) CHARSET utf8mb4 ENGINE=InnoDB;
+INSERT INTO t5 VALUES ('', 1);
+
+--connection node_2
+SELECT LENGTH(a) AS len_a, b FROM t5;
+
+--connection node_1
+DROP TABLE t5;
+
+--echo #
+--echo # Case 6: multi-part PK with a zero-length part, written from both
+--echo # nodes so key generation runs on each of them
+--echo #
+--connection node_1
+CREATE TABLE t6 (a VARCHAR(10), b VARCHAR(10), c INT, PRIMARY KEY (a,b)) CHARSET latin1 ENGINE=InnoDB;
+INSERT INTO t6 VALUES ('', 'x', 1);
+INSERT INTO t6 VALUES ('x', '', 2);
+
+--connection node_2
+INSERT INTO t6 VALUES ('', '', 3);
+
+--connection node_1
+SELECT LENGTH(a) AS len_a, LENGTH(b) AS len_b, c FROM t6 ORDER BY c;
+
+--connection node_2
+SELECT LENGTH(a) AS len_a, LENGTH(b) AS len_b, c FROM t6 ORDER BY c;
+
+--connection node_1
+DROP TABLE t6;
diff --git a/mysql-test/suite/galera/t/pxc_5208_force_sst_after_inconsistency.test b/mysql-test/suite/galera/t/pxc_5208_force_sst_after_inconsistency.test
new file mode 100644
index 000000000000..32c84469f321
--- /dev/null
+++ b/mysql-test/suite/galera/t/pxc_5208_force_sst_after_inconsistency.test
@@ -0,0 +1,113 @@
+#
+# PXC-5208: Force SST after a node is restarted following an inconsistency.
+#
+# When a node is voted out of the cluster because of a data inconsistency it
+# marks its state as corrupt. That alone does not force a full SST on the next
+# start: mysqld_safe's --wsrep-recover recovers a usable position straight out
+# of InnoDB, the cluster then offers IST, and the inconsistent dataset survives.
+#
+# With repl.force_sst_after_inconsistency=YES the node also removes
+# grastate.dat, so the next start finds no usable position and can only rejoin
+# through a full SST, which is what repairs the dataset.
+#
+# The option is OFF by default; this test enables it explicitly on node_2.
+# galera.pxc_5208_force_sst_after_inconsistency_default covers the default.
+#
+
+--source include/galera_cluster.inc
+
+--connection node_1
+--disable_query_log
+# pc.weight=2 lets node_1 maintain quorum alone after node_2 leaves (2-node cluster).
+SET GLOBAL wsrep_provider_options = 'pc.weight=2';
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT);
+INSERT INTO t1 VALUES (1, 0),(2, 0),(3, 0),(4, 0),(5, 0),(6, 0),(7, 0),(8, 0);
+--enable_query_log
+
+--connection node_2
+--disable_query_log
+SET GLOBAL wsrep_provider_options = 'repl.force_sst_after_inconsistency=YES';
+--enable_query_log
+
+--file_exists $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
+#
+# Provoke inconsistency: delete row f1=2 locally on node_2 (not replicated),
+# then delete it on node_1 (replicated). When the replicated DELETE arrives
+# at node_2 and can't find the row, the apply error triggers inconsistency
+# voting and node_2 is evicted.
+#
+# Wait for the INSERT to be applied on node_2 first, otherwise the local DELETE
+# below can race ahead of it and remove nothing.
+#
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1
+--source include/wait_condition.inc
+
+--disable_query_log
+SET wsrep_on = OFF;
+DELETE FROM t1 WHERE f1 = 2;
+SET wsrep_on = ON;
+--enable_query_log
+
+--connection node_1
+DELETE FROM t1 WHERE f1 = 2;
+
+# node_2 detects the apply failure, gets voted inconsistent and aborts.
+# Wait on node_1 for cluster_size=1 (node_2 left).
+--let $wait_timeout = 60
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+#
+# Shut node_2 down. It left due to an inconsistency with the option enabled,
+# so grastate.dat must already be gone.
+#
+--connection node_2
+--disable_query_log
+# node_2 is no longer in a primary component, so it refuses ordinary reads.
+# wsrep_on=OFF lets this session query performance_schema to confirm the
+# eviction actually happened before we shut the node down.
+SET SESSION wsrep_on = OFF;
+
+--let $wait_condition = SELECT COUNT(*) >= 1 FROM performance_schema.error_log WHERE data LIKE '%Inconsistency detected:%'
+--source include/wait_condition.inc
+--enable_query_log
+
+--source include/shutdown_mysqld.inc
+
+--echo # Verify grastate.dat was removed on inconsistency shutdown
+--error 1
+--file_exists $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
+#
+# Restart node_2. With no grastate.dat it can only rejoin via SST, which
+# overwrites the inconsistent dataset and makes it consistent again.
+#
+--source include/start_mysqld.inc
+--source include/galera_wait_ready.inc
+
+# Verify the dataset is consistent with node_1 after SST.
+--connection node_1
+--let $node_1_data = `SELECT GROUP_CONCAT(f1, ':', f2 ORDER BY f1) FROM t1`
+--connection node_2
+--let $node_2_data = `SELECT GROUP_CONCAT(f1, ':', f2 ORDER BY f1) FROM t1`
+--echo node_2 t1 after SST: $node_2_data
+--echo node_1 t1 contents: $node_1_data
+
+if ($node_1_data != $node_2_data) {
+ --die node_2 dataset is not consistent with node_1 after SST
+}
+--echo datasets consistent: 1
+
+# Cleanup
+--disable_query_log
+--connection node_1
+SET GLOBAL wsrep_provider_options = 'pc.weight=1';
+DROP TABLE t1;
+--connection node_2
+CALL mtr.add_suppression("Could not execute Delete_rows event on table test.t1.*Error_code: 1032");
+CALL mtr.add_suppression("Delete_rows apply failed:");
+CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus on");
+CALL mtr.add_suppression("Failed to apply write set: ");
+--enable_query_log
diff --git a/mysql-test/suite/galera/t/pxc_5208_force_sst_after_inconsistency_default.test b/mysql-test/suite/galera/t/pxc_5208_force_sst_after_inconsistency_default.test
new file mode 100644
index 000000000000..c4c2351b9009
--- /dev/null
+++ b/mysql-test/suite/galera/t/pxc_5208_force_sst_after_inconsistency_default.test
@@ -0,0 +1,94 @@
+#
+# PXC-5208: repl.force_sst_after_inconsistency defaults to NO.
+#
+# The default must preserve the historical behaviour: a node evicted for an
+# inconsistency keeps its grastate.dat so the state can be investigated, and
+# the operator decides whether to remove it.
+#
+# galera.pxc_5208_force_sst_after_inconsistency covers the opt-in behaviour.
+#
+
+--source include/galera_cluster.inc
+
+--connection node_2
+--let $force_sst_default = `SELECT @@wsrep_provider_options LIKE '%repl.force_sst_after_inconsistency = no%'`
+--echo repl.force_sst_after_inconsistency defaults to no: $force_sst_default
+
+if ($force_sst_default != 1) {
+ --die repl.force_sst_after_inconsistency must default to no
+}
+
+--connection node_1
+--disable_query_log
+# pc.weight=2 lets node_1 maintain quorum alone after node_2 leaves (2-node cluster).
+SET GLOBAL wsrep_provider_options = 'pc.weight=2';
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT);
+INSERT INTO t1 VALUES (1, 0),(2, 0),(3, 0),(4, 0),(5, 0),(6, 0),(7, 0),(8, 0);
+--enable_query_log
+
+--file_exists $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
+#
+# Same inconsistency as the opt-in test, but with the option left at its
+# default. Wait for the INSERT to reach node_2 before deleting locally.
+#
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1
+--source include/wait_condition.inc
+
+--disable_query_log
+SET wsrep_on = OFF;
+DELETE FROM t1 WHERE f1 = 2;
+SET wsrep_on = ON;
+--enable_query_log
+
+--connection node_1
+DELETE FROM t1 WHERE f1 = 2;
+
+--let $wait_timeout = 60
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--connection node_2
+--disable_query_log
+# node_2 is no longer in a primary component, so it refuses ordinary reads.
+SET SESSION wsrep_on = OFF;
+
+--let $wait_condition = SELECT COUNT(*) >= 1 FROM performance_schema.error_log WHERE data LIKE '%Inconsistency detected:%'
+--source include/wait_condition.inc
+--enable_query_log
+
+--source include/shutdown_mysqld.inc
+
+--echo # With the option at its default the state file is kept for investigation
+--file_exists $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
+#
+# Emulate the documented manual workaround so node_2 can rejoin through SST
+# and the cluster is healthy again for cleanup.
+#
+--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+--source include/start_mysqld.inc
+--source include/galera_wait_ready.inc
+
+--connection node_1
+--let $node_1_data = `SELECT GROUP_CONCAT(f1, ':', f2 ORDER BY f1) FROM t1`
+--connection node_2
+--let $node_2_data = `SELECT GROUP_CONCAT(f1, ':', f2 ORDER BY f1) FROM t1`
+
+if ($node_1_data != $node_2_data) {
+ --die node_2 dataset is not consistent with node_1 after SST
+}
+--echo datasets consistent: 1
+
+# Cleanup
+--disable_query_log
+--connection node_1
+SET GLOBAL wsrep_provider_options = 'pc.weight=1';
+DROP TABLE t1;
+--connection node_2
+CALL mtr.add_suppression("Could not execute Delete_rows event on table test.t1.*Error_code: 1032");
+CALL mtr.add_suppression("Delete_rows apply failed:");
+CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus on");
+CALL mtr.add_suppression("Failed to apply write set: ");
+--enable_query_log
diff --git a/mysql-test/suite/galera/t/pxc_5208_force_sst_after_ist_failure.cnf b/mysql-test/suite/galera/t/pxc_5208_force_sst_after_ist_failure.cnf
new file mode 100644
index 000000000000..d01287412a23
--- /dev/null
+++ b/mysql-test/suite/galera/t/pxc_5208_force_sst_after_ist_failure.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.2]
+#
+# repl.force_sst_after_inconsistency has to be set at startup here, not with
+# SET GLOBAL. This test restarts node_2, and the provider re-reads its options
+# from the configuration when it is initialised, so a runtime value would be
+# lost across exactly the restart whose behaviour we want to observe.
+#
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;@ENV.WSREP_PROVIDER_TIMEOUTS;repl.force_sst_after_inconsistency=YES'
diff --git a/mysql-test/suite/galera/t/pxc_5208_force_sst_after_ist_failure.test b/mysql-test/suite/galera/t/pxc_5208_force_sst_after_ist_failure.test
new file mode 100644
index 000000000000..68fb392e78f8
--- /dev/null
+++ b/mysql-test/suite/galera/t/pxc_5208_force_sst_after_ist_failure.test
@@ -0,0 +1,204 @@
+#
+# PXC-5208: the IST apply-failure path also drops grastate.dat.
+#
+# A writeset can also fail to apply while the node is catching up through IST.
+# That path reports "Inconsistency detected: Failed on preordered"
+# and closes replication on the spot: the node drops out of the cluster
+#
+# repl.force_sst_after_inconsistency=YES is set for node_2 in the .cnf rather
+# than with SET GLOBAL, because this test restarts node_2 and the provider
+# re-reads its options on initialisation.
+#
+# How the failure is provoked:
+# 1. node_2 leaves cleanly, so its recorded position stays valid and IST is
+# possible when it comes back.
+# 2. node_1 deletes a row while node_2 is away -> that writeset is what
+# node_2 will fetch through IST.
+# 3. node_2 is restarted standalone (wsrep-provider=none) and the same row is
+# deleted locally. This diverges the dataset without touching grastate.dat.
+# 4. node_2 rejoins, IST replays the DELETE, the row is already gone and the
+# apply fails. grastate.dat must be gone by then.
+#
+
+# Due to server restarts this test has been made big-test
+--source include/big_test.inc
+--source include/galera_cluster.inc
+
+--connection node_2
+--let $force_sst = `SELECT @@wsrep_provider_options LIKE '%repl.force_sst_after_inconsistency = yes%'`
+--echo repl.force_sst_after_inconsistency enabled on node_2: $force_sst
+
+if ($force_sst != 1) {
+ --die repl.force_sst_after_inconsistency must be enabled at startup for this test
+}
+
+--connection node_1
+--disable_query_log
+# pc.weight=2 lets node_1 hold quorum alone while node_2 is away.
+SET GLOBAL wsrep_provider_options = 'pc.weight=2';
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT);
+INSERT INTO t1 VALUES (1, 0),(2, 0),(3, 0),(4, 0),(5, 0),(6, 0),(7, 0),(8, 0);
+--enable_query_log
+
+--file_exists $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1
+--source include/wait_condition.inc
+
+#
+# 1. node_2 leaves cleanly, keeping a valid position in grastate.dat.
+#
+--echo # Shutting node_2 down cleanly so that IST is possible on rejoin
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+--let $wait_timeout = 60
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+#
+# 2. The writeset node_2 will replay through IST.
+#
+
+DELETE FROM t1 WHERE f1 = 5;
+
+#
+# 3. Diverge node_2 offline. wsrep-provider=none keeps Galera out of the
+# picture entirely, so grastate.dat is left untouched and still holds a
+# valid position.
+#
+--connection node_2
+--echo # Restarting node_2 standalone to diverge its dataset
+--let $start_mysqld_params = --wsrep-provider=none
+--let $do_not_echo_parameters = 1
+--source include/start_mysqld.inc
+
+DELETE FROM t1 WHERE f1 = 5;
+
+--source include/shutdown_mysqld.inc
+
+#
+# 4. Rejoin with Galera enabled again. IST replays the DELETE, cannot find the
+# row, and the apply fails. Both $start_mysqld_params and
+# $restart_parameters have to be cleared: start_mysqld.inc latches the
+# latter and would otherwise reuse --wsrep-provider=none.
+#
+--let $start_mysqld_params =
+--let $restart_parameters =
+--let $do_not_echo_parameters = 0
+
+--echo # Rejoining node_2 - IST apply is expected to fail
+--exec echo "restart" > $_expect_file_name
+
+#
+# Synchronise on node_2 leaving the group, watched from node_1.
+#
+--connection node_1
+
+--let $grep_file = $MYSQLTEST_VARDIR/log/mysqld.2.err
+--let $grep_pattern = Removed state file .* because the node left the cluster due to an inconsistency
+--let $wait_timeout = 120
+--source include/wait_for_pattern_in_file.inc
+
+--echo # Verify grastate.dat was removed on the IST apply failure
+--error 1
+--file_exists $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
+#
+# Assert node 2 removed due to IST and removed state file logged.
+--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err
+
+--let $assert_text = node_2 asked the donor for IST
+--let $assert_select = Receiving IST: .* writesets, seqnos
+--let $assert_count_condition = >= 1
+--source include/assert_grep.inc
+
+--let $assert_text = the IST writeset could not be applied
+--let $assert_select = Could not execute Delete_rows event on table test.t1
+--let $assert_count_condition = >= 1
+--source include/assert_grep.inc
+
+--let $assert_text = the failed IST apply was detected as an inconsistency
+--let $assert_select = Inconsistency detected: Failed on preordered
+--let $assert_count_condition = >= 1
+--source include/assert_grep.inc
+
+--let $assert_text = grastate.dat was removed because of the inconsistency
+--let $assert_select = Removed state file .* because the node left the cluster due to an inconsistency
+--let $assert_count_condition = >= 1
+--source include/assert_grep.inc
+
+--let $cluster_size = `SELECT VARIABLE_VALUE FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size'`
+--echo node_1 wsrep_cluster_size after node_2 was evicted: $cluster_size
+
+#
+# Here we cannot execute any client command since IST failed.
+# We can still execute shutdown but we are killing server instead.
+#
+--echo # Stopping node_2 if it is still alive
+--exec echo "wait" > $_expect_file_name
+--perl
+ my $log = "$ENV{'MYSQLTEST_VARDIR'}/log/mysqld.2.err";
+ open(my $fh, '<', $log) or die "cannot read $log: $!\n";
+ local $/; my $c = <$fh>; close($fh);
+ my @pids = ($c =~ /starting as process (\d+)/g);
+ die "could not determine node_2 pid from $log\n" unless @pids;
+ my $pid = $pids[-1];
+ # node_2 may already have gone, in which case its pid can have been reused
+ # by another process on the machine - an MTR worker, or node_1. Never rely
+ # on kill(0): confirm through /proc that the pid is still this node_2
+ # mysqld before sending anything to it.
+ my $is_node_2 = sub {
+ my $cf = "/proc/$pid/cmdline";
+ return 0 unless -r $cf;
+ open(my $h, '<', $cf) or return 0;
+ local $/; my $cl = <$h>; close($h);
+ return 0 unless defined $cl;
+ $cl =~ s/\0/ /g;
+ return ($cl =~ /mysqld/ && $cl =~ /defaults-group-suffix=\.2(?!\d)/) ? 1 : 0;
+ };
+ if ($is_node_2->()) {
+ kill('TERM', $pid);
+ for (my $i = 0; $i < 30 && $is_node_2->(); $i++) { sleep 1; }
+ kill('KILL', $pid) if $is_node_2->();
+ for (my $i = 0; $i < 30 && $is_node_2->(); $i++) { sleep 1; }
+ die "node_2 (pid $pid) would not stop\n" if $is_node_2->();
+ }
+EOF
+
+--connection node_2
+--echo # Restarting node_2 - with no state file it must take a full SST
+--source include/start_mysqld.inc
+--source include/galera_wait_ready.inc
+
+--connection node_1
+--let $node_1_data = `SELECT GROUP_CONCAT(f1, ':', f2 ORDER BY f1) FROM t1`
+--connection node_2
+--let $node_2_data = `SELECT GROUP_CONCAT(f1, ':', f2 ORDER BY f1) FROM t1`
+--echo node_2 t1 after SST: $node_2_data
+--echo node_1 t1 contents: $node_1_data
+
+if ($node_1_data != $node_2_data) {
+ --die node_2 dataset is not consistent with node_1 after SST
+}
+--echo datasets consistent: 1
+
+# Cleanup.
+--disable_query_log
+--connection node_1
+SET GLOBAL wsrep_provider_options = 'pc.weight=1';
+DROP TABLE t1;
+# node_1 was the IST donor and node_2 was killed while it was still attached.
+CALL mtr.add_suppression("Peer .* for IST AsyncSender seems to be disconnected");
+--connection node_2
+CALL mtr.add_suppression("Could not execute Delete_rows event on table test.t1.*Error_code: 1032");
+CALL mtr.add_suppression("Delete_rows apply failed:");
+CALL mtr.add_suppression("Failed to apply write set: ");
+CALL mtr.add_suppression("Failed to apply app buffer");
+CALL mtr.add_suppression("Inconsistency detected: Failed on preordered");
+CALL mtr.add_suppression("Aborting");
+# The evicted instance cannot rejoin - that is the point of the test. The
+# instance that comes back after the kill does sync with the group.
+CALL mtr.add_suppression("Failed to JOIN the cluster after SST");
+--enable_query_log
diff --git a/mysql-test/suite/galera/t/pxc_5208_force_sst_after_ist_receiver_failure.test b/mysql-test/suite/galera/t/pxc_5208_force_sst_after_ist_receiver_failure.test
new file mode 100644
index 000000000000..d5b9b57f1298
--- /dev/null
+++ b/mysql-test/suite/galera/t/pxc_5208_force_sst_after_ist_receiver_failure.test
@@ -0,0 +1,128 @@
+#
+# PXC-5208: IST failures that end in abort().
+#
+# galera.pxc_5208_force_sst_after_ist_failure covers an IST writeset that fails
+# to APPLY. That is handled inside process_IST_writeset(), which marks the state
+# corrupt - removing grastate.dat when repl.force_sst_after_inconsistency is on -
+# and lets the node close replication down gracefully.
+#
+# This test covers the other IST failure class: the IST receiver rejects the
+# stream itself. Here the stream starts at the wrong seqno, thrown from
+# ist.cpp. That exception does not come from writeset application, so it never
+# passes through process_IST_writeset() and lands straight in recv_IST()'s
+# catch, which does:
+#
+# log_fatal << "Receiving IST failed, node restart required: " ...
+# abort();
+#
+# abort() runs no destructors, so whatever happened to grastate.dat before that
+# point is final.
+#
+# The malformed IST is provoked exactly as galera.pxc_malformed_ist does; this
+# test is deliberately kept a minimal delta from it, adding only
+# repl.force_sst_after_inconsistency=YES and the grastate.dat assertions.
+#
+# Refer test: pxc_malformed_ist.test
+#
+
+--source include/big_test.inc
+# Abort is raised, so lets avoid valgrind and ASAN
+--source include/not_valgrind.inc
+--source include/have_debug_sync.inc
+--source suite/galera/include/galera_have_debug_sync.inc
+--source include/galera_cluster.inc
+
+--let $pidfile= $MYSQLTEST_VARDIR/tmp/pxc5208_node2.pid
+--let $ofile= $MYSQLTEST_VARDIR/tmp/pxc5208_node2.err
+--let $grastate= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
+--echo # Populate nodes with data
+--disable_query_log
+CREATE TABLE t1 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES (0);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+--enable_query_log
+
+--echo # Shut down node_2
+--connection node_2
+--source include/shutdown_mysqld.inc
+
+--echo # Wait for node_2 to be down
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--echo # Execute some transactions on node_1 for node_2 to rejoin with IST
+--disable_query_log
+insert into t1 values (5);
+insert into t1 values (6);
+insert into t1 values (7);
+insert into t1 values (8);
+insert into t1 values (9);
+insert into t1 values (10);
+insert into t1 values (11);
+insert into t1 values (12);
+--enable_query_log
+
+--echo # node_2 still has its state file at this point
+--file_exists $grastate
+
+--echo # Setup node_1 to server minimal IST range
+--let $galera_sync_point = serve_mimimal_ist
+--source include/galera_set_sync_point.inc
+
+#
+# repl.force_sst_after_inconsistency=YES is the only addition to the command
+# line compared with galera.pxc_malformed_ist. node_2 is about to abort on a
+# broken IST; the question this test answers is whether it drops grastate.dat
+# on the way down.
+#
+--echo # Start node_2 in background. Force wrong IST starting seqno and wait after detection of malformed IST.
+--connection node_2
+--let $command = $MYSQLD
+--let $command_opt = --defaults-group-suffix=.2 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep_provider_options='base_port=$NODE_GALERAPORT_2;pc.wait_restored_prim_timeout=PT10S;repl.force_sst_after_inconsistency=YES;dbug=d,sst_received_decrease_state_seqno,ist_receiver_wait_afterreceived_wrong_starting_seqno' --log-error=$ofile
+--let $pid_file = $pidfile
+--source include/start_proc_in_background.inc
+
+--echo # Wait for node_2 to join the cluster
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--echo # Execute some transactions on node_1 while node_2 is blocked in IST. This will cause node_2 receive queue to grow up
+--let $count=100
+--disable_query_log
+while($count)
+{
+ --eval INSERT INTO t1 VALUES($count+100);
+ --dec $count
+}
+--enable_query_log
+
+--let $grep_file = $ofile
+--let $grep_pattern = Receiving IST failed, node restart required
+--let $wait_timeout = 120
+--source include/wait_for_pattern_in_file.inc
+
+--let $assert_select = Receiving IST failed, node restart required: IST receiver reported failure: 'IST started with wrong seqno
+--let $assert_text = Ensure that Joiner aborted after receiving wrong IST
+--let $assert_count = 1
+--let $assert_file = $ofile
+--source include/assert_grep.inc
+
+--echo # Verify grastate.dat was removed before the abort
+--error 1
+--file_exists $grastate
+
+--echo # Start node_2 without forcing malformed IST
+--connection node_2
+--source include/start_mysqld.inc
+--source include/wait_until_connected_again.inc
+
+--connection node_1
+DROP TABLE t1;
+--remove_file $pidfile
+--remove_file $ofile
diff --git a/mysql-test/suite/galera/t/pxc_block_write_while_in_rolling_upgrade.test b/mysql-test/suite/galera/t/pxc_block_write_while_in_rolling_upgrade.test
index feedfeaaca87..e4bff1eb170a 100644
--- a/mysql-test/suite/galera/t/pxc_block_write_while_in_rolling_upgrade.test
+++ b/mysql-test/suite/galera/t/pxc_block_write_while_in_rolling_upgrade.test
@@ -11,6 +11,7 @@ CALL mtr.add_suppression("Percona-XtraDB-Cluster doesn't recommend use of multip
CALL mtr.add_suppression("pxc_maint_mode cannot be changed while using of multiple major versions");
CALL mtr.add_suppression("Percona-XtraDB-Cluster prohibits use of multiple major versions while accepting write workload with pxc_strict_mode = ENFORCING");
SET @global_saved_strict_tmp = @@global.pxc_strict_mode;
+# Below statement also sets @@global.sql_require_primary_key = ON;
SET GLOBAL pxc_strict_mode = ENFORCING;
CREATE TABLE tb1 (ID INT PRIMARY KEY);
INSERT INTO tb1 VALUES (1),(2),(3);
@@ -76,5 +77,6 @@ SET SESSION wsrep_sync_wait = 0;
--source include/wait_condition.inc
SET SESSION wsrep_sync_wait = DEFAULT;
DROP TABLE tb1;
+SET GLOBAL sql_require_primary_key = OFF;
--enable_query_log
diff --git a/mysql-test/suite/galera/t/pxc_create_trigger_binlog_super.test b/mysql-test/suite/galera/t/pxc_create_trigger_binlog_super.test
new file mode 100644
index 000000000000..00cd63f839b6
--- /dev/null
+++ b/mysql-test/suite/galera/t/pxc_create_trigger_binlog_super.test
@@ -0,0 +1,243 @@
+################################################################################
+# PXC-5291: User without SUPER can create trigger even without
+# log_bin_trust_function_creators enabled.
+#
+# Test:
+# 0. Two servers: node_1 and node_2.
+# 1. Setup users.
+# 2. log_bin_trust_function_creators = 0
+# 2a. SET_ANY_DEFINER only
+# 2b. Plain user (no SUPER, no SET_ANY_DEFINER)
+# 2c. SUPER only
+# 3. log_bin_trust_function_creators = 1
+# 3a. SET_ANY_DEFINER only
+# 3b. Plain user (no SUPER, no SET_ANY_DEFINER)
+# 3c. SUPER only
+# 4. Cleanup.
+################################################################################
+
+--source include/galera_cluster.inc
+--source include/count_sessions.inc
+
+--echo
+--echo # 1. Setup users.
+--echo
+
+--connection node_1
+SET @old_trust = @@GLOBAL.log_bin_trust_function_creators;
+--disable_warnings
+SET GLOBAL log_bin_trust_function_creators = 0;
+--enable_warnings
+
+CREATE DATABASE probe;
+
+# User with SET_ANY_DEFINER(YES), SUPER(NO)
+CREATE USER 'any_def'@'%' IDENTIFIED BY '';
+GRANT ALL PRIVILEGES ON probe.* TO 'any_def'@'%';
+GRANT SET_ANY_DEFINER ON *.* TO 'any_def'@'%';
+
+# User with SET_ANY_DEFINER(NO), SUPER(NO)
+CREATE USER 'plain'@'%' IDENTIFIED BY '';
+GRANT ALL PRIVILEGES ON probe.* TO 'plain'@'%';
+
+# User with SET_ANY_DEFINER(NO), SUPER(YES)
+CREATE USER 'sup'@'%' IDENTIFIED BY '';
+GRANT ALL PRIVILEGES ON probe.* TO 'sup'@'%';
+GRANT SUPER ON *.* TO 'sup'@'%';
+
+# Helper user used as a DEFINER.
+CREATE USER 'other'@'%' IDENTIFIED BY '';
+
+--connect (any_def_con,localhost,any_def,,probe,$NODE_MYPORT_1)
+CREATE TABLE t (id BIGINT NOT NULL PRIMARY KEY);
+
+################################################################################
+--echo
+--echo # 2. log_bin_trust_function_creators = 0
+--echo
+
+--echo # 2a. SET_ANY_DEFINER only
+--connection any_def_con
+
+--error ER_BINLOG_CREATE_ROUTINE_NEED_SUPER
+CREATE TRIGGER t_any_definer_no_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+--error ER_BINLOG_CREATE_ROUTINE_NEED_SUPER
+CREATE DEFINER = 'other'@'%' TRIGGER t_any_definer_definer_no_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+
+--echo # 2b. Plain user (no SUPER, no SET_ANY_DEFINER)
+--connect (plain_con,localhost,plain,,probe,$NODE_MYPORT_1)
+
+--error ER_BINLOG_CREATE_ROUTINE_NEED_SUPER
+CREATE TRIGGER t_plain_no_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+
+# Both gates would reject this: the binlog gate (no SUPER, trust = 0) and the
+# DEFINER check (no SET_ANY_DEFINER). The binlog gate reports, because the
+# DEFINER pre-check runs later, just before TOI -- which is the order PS uses.
+--error ER_BINLOG_CREATE_ROUTINE_NEED_SUPER
+CREATE DEFINER = 'other'@'%' TRIGGER t_plain_definer_no_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+
+--echo # 2c. SUPER only
+--connect (sup_con,localhost,sup,,probe,$NODE_MYPORT_1)
+
+CREATE TRIGGER t_super_no_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+CREATE DEFINER = 'other'@'%' TRIGGER t_super_definer_no_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+
+################################################################################
+##### Asserts
+################################################################################
+
+# Rejected triggers exist on no node; the SUPER-created trigger replicates.
+--connection node_1
+--let $assert_text = 'Trigger t_any_definer_no_trust not created on node_1 (SET_ANY_DEFINER, trust = 0)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_any_definer_no_trust", c, 1] = 0
+--source include/assert.inc
+
+--let $assert_text = 'Trigger t_any_definer_definer_no_trust not created on node_1 (SET_ANY_DEFINER, DEFINER, trust = 0)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_any_definer_definer_no_trust", c, 1] = 0
+--source include/assert.inc
+
+--let $assert_text = 'Trigger t_plain_no_trust not created on node_1 (PLAIN, trust = 0)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_plain_no_trust", c, 1] = 0
+--source include/assert.inc
+
+--let $assert_text = 'Trigger t_plain_definer_no_trust not created on node_1 (PLAIN, DEFINER, trust = 0)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_plain_definer_no_trust", c, 1] = 0
+--source include/assert.inc
+
+--let $assert_text = 'Trigger t_super_no_trust created on node_1 (SUPER, trust = 0)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_super_no_trust", c, 1] = 1
+--source include/assert.inc
+
+--let $assert_text = 'Trigger t_super_definer_no_trust created on node_1 (SUPER, DEFINER, trust = 0)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_super_definer_no_trust", c, 1] = 1
+--source include/assert.inc
+
+--connection node_2
+--echo 'Trigger t_sup t_super_no_trust to node_2 (SUPER, trust = 0)'
+--let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_super_no_trust"
+--source include/wait_condition.inc
+
+--echo 'Trigger t_super_definer_no_trust replicated to node_2 (SUPER, DEFINER, trust = 0)'
+--let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_super_definer_no_trust"
+--source include/wait_condition.inc
+
+--let $assert_text = 'Trigger t_any_definer_no_trust not created on node_2 (SET_ANY_DEFINER, trust = 0)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_any_definer_no_trust", c, 1] = 0
+--source include/assert.inc
+
+--let $assert_text = 'Trigger t_any_definer_definer_no_trust not created on node_2 (SET_ANY_DEFINER, DEFINER, trust = 0)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_any_definer_definer_no_trust", c, 1] = 0
+--source include/assert.inc
+
+--let $assert_text = 'Trigger t_plain_no_trust not created on node_2 (PLAIN, trust = 0)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_plain_no_trust", c, 1] = 0
+--source include/assert.inc
+
+--let $assert_text = 'Trigger t_plain_definer_no_trust not created on node_2 (PLAIN, DEFINER, trust = 0)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_plain_definer_no_trust", c, 1] = 0
+--source include/assert.inc
+
+################################################################################
+--echo
+--echo # 3. log_bin_trust_function_creators = 1
+--echo
+
+--connection node_1
+--disable_warnings
+SET GLOBAL log_bin_trust_function_creators = 1;
+--enable_warnings
+
+--echo # 3a. SET_ANY_DEFINER only
+--connection any_def_con
+
+CREATE TRIGGER t_any_definer_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+CREATE DEFINER = 'other'@'%' TRIGGER t_any_definer_definer_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+
+--echo # 3b. Plain user (no SUPER, no SET_ANY_DEFINER)
+--connection plain_con
+
+# This passes(even in PS) since definer is not there and log_bin_trust_function_creators is set.
+CREATE TRIGGER t_plain_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+CREATE DEFINER = 'other'@'%' TRIGGER t_plain_definer_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+
+--echo # 3c. SUPER only
+--connection sup_con
+
+CREATE TRIGGER t_super_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+CREATE DEFINER = 'other'@'%' TRIGGER t_super_definer_trust AFTER DELETE ON t FOR EACH ROW SET @x = OLD.id;
+
+################################################################################
+##### Asserts
+################################################################################
+# Rejected triggers exist on no node; the SUPER-created trigger replicates.
+--connection node_1
+--let $assert_text = 'Trigger t_any_definer_trust created on node_1 (SET_ANY_DEFINER, trust = 1)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_any_definer_trust", c, 1] = 1
+--source include/assert.inc
+
+--let $assert_text = 'Trigger t_any_definer_definer_trust created on node_1 (SET_ANY_DEFINER, DEFINER, trust = 1)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_any_definer_definer_trust", c, 1] = 1
+--source include/assert.inc
+
+--let $assert_text = 'Trigger t_plain_trust created on node_1 (PLAIN, trust = 1)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_plain_trust", c, 1] = 1
+--source include/assert.inc
+
+--let $assert_text = 'Trigger t_plain_definer_trust not created on node_1 (PLAIN, DEFINER, trust = 1)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_plain_definer_trust", c, 1] = 0
+--source include/assert.inc
+
+--let $assert_text = 'Trigger t_super_trust created on node_1 (SUPER, trust = 1)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_super_trust", c, 1] = 1
+--source include/assert.inc
+
+--let $assert_text = 'Trigger t_super_definer_trust created on node_1 (SUPER, DEFINER, trust = 1)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_super_definer_trust", c, 1] = 1
+--source include/assert.inc
+
+--connection node_2
+--echo 'Trigger t_any_definer_trust replicated to node_2 (SET_ANY_DEFINER, trust = 1)'
+--let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_any_definer_trust"
+--source include/wait_condition.inc
+
+--echo 'Trigger t_any_definer_definer_trust replicated to node_2 (SET_ANY_DEFINER, DEFINER, trust = 1)'
+--let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_any_definer_definer_trust"
+--source include/wait_condition.inc
+
+--echo 'Trigger t_super_trust replicated to node_2 (SUPER, trust = 1)'
+--let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_super_trust"
+--source include/wait_condition.inc
+
+--echo 'Trigger t_super_definer_trust replicated to node_2 (SUPER, DEFINER, trust = 1)'
+--let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_super_definer_trust"
+--source include/wait_condition.inc
+
+--echo 'Trigger t_plain_trust replicated to node_2 (PLAIN, trust = 1)'
+--let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_plain_trust"
+--source include/wait_condition.inc
+
+--let $assert_text = 'Trigger t_plain_definer_trust not replicated on node_2 (PLAIN, DEFINER, trust = 1)'
+--let $assert_cond = [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "t_plain_definer_trust", c, 1] = 0
+--source include/assert.inc
+
+################################################################################
+--echo
+--echo # 4. Cleanup.
+--echo
+
+--disconnect plain_con
+--disconnect sup_con
+--disconnect any_def_con
+
+--connection node_1
+DROP DATABASE probe;
+DROP USER 'any_def'@'%';
+DROP USER 'plain'@'%';
+DROP USER 'sup'@'%';
+DROP USER 'other'@'%';
+--disable_warnings
+SET GLOBAL log_bin_trust_function_creators = @old_trust;
+--enable_warnings
+
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/galera/t/pxc_create_trigger_nonexistent_definer.test b/mysql-test/suite/galera/t/pxc_create_trigger_nonexistent_definer.test
new file mode 100644
index 000000000000..59aacf9db24c
--- /dev/null
+++ b/mysql-test/suite/galera/t/pxc_create_trigger_nonexistent_definer.test
@@ -0,0 +1,238 @@
+################################################################################
+# PXC-5292: CREATE TRIGGER with a nonexistent DEFINER by a user without
+# SUPER / ALLOW_NONEXISTENT_DEFINER must be rejected on the origin
+# node BEFORE the statement is replicated (before TOI), so the node
+# is NOT evicted from the cluster.
+#
+# This guards against the inconsistency via the orphan-definer path
+# (WL#15874 stage 2). Without the fix, the origin accepts the statement and
+# replicates it. Statement is later rejected in check_valid_definer()
+# during creation (post-TOI) while the appliers create it successfully -> the
+# origin is declared inconsistent by consensus and leaves the cluster.
+#
+# Test:
+# 1. Setup users.
+# 2. SET_ANY_DEFINER user, nonexistent DEFINER -> rejected pre-TOI, no eviction.
+# 2b. SET_ANY_DEFINER , EXISTING different DEFINER -> allowed, replicates.
+# 3. ALLOW_NONEXISTENT_DEFINER user, nonexistent DEFINER -> allowed, replicates.
+# 4. SUPER user, nonexistent DEFINER -> allowed, replicates.
+# 4b. trust = 0, nonexistent DEFINER: which gate reports, and both enforced.
+# The binlog gate runs first; the DEFINER pre-check runs just before TOI,
+# matching the order PS uses.
+# - SET_ANY_DEFINER only -> rejected by the binlog gate (no SUPER).
+# - SUPER -> satisfies both gates, allowed, replicates.
+# - ALLOW_NONEXISTENT_DEFINER without SUPER -> rejected by the binlog gate.
+# 5. Cleanup.
+################################################################################
+
+--source include/galera_cluster.inc
+--source include/count_sessions.inc
+
+--echo
+--echo # 1. Setup users.
+--echo
+
+--connection node_1
+SET @old_trust = @@GLOBAL.log_bin_trust_function_creators;
+--disable_warnings
+SET GLOBAL log_bin_trust_function_creators = 1;
+--enable_warnings
+
+CREATE DATABASE probe;
+
+# SET_ANY_DEFINER, but NOT SUPER and NOT ALLOW_NONEXISTENT_DEFINER.
+CREATE USER 'any_def'@'%' IDENTIFIED BY '';
+GRANT ALL PRIVILEGES ON probe.* TO 'any_def'@'%';
+GRANT SET_ANY_DEFINER ON *.* TO 'any_def'@'%';
+
+# SET_ANY_DEFINER + ALLOW_NONEXISTENT_DEFINER (allowed to create orphan definer).
+CREATE USER 'nonexist_ok'@'%' IDENTIFIED BY '';
+GRANT ALL PRIVILEGES ON probe.* TO 'nonexist_ok'@'%';
+GRANT SET_ANY_DEFINER, ALLOW_NONEXISTENT_DEFINER ON *.* TO 'nonexist_ok'@'%';
+
+# SUPER.
+CREATE USER 'sup'@'%' IDENTIFIED BY '';
+GRANT ALL PRIVILEGES ON probe.* TO 'sup'@'%';
+GRANT SUPER ON *.* TO 'sup'@'%';
+
+--connect (any_def_con,localhost,any_def,,probe,$NODE_MYPORT_1)
+CREATE TABLE t (id INT PRIMARY KEY);
+
+--echo
+--echo # 2. SET_ANY_DEFINER user, nonexistent DEFINER -> rejected pre-TOI, no eviction.
+--echo
+
+# The 'ghost1' definer does not exist, logged in as 'user with SET_ANY_DEFINER'
+--connection any_def_con
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+CREATE DEFINER='ghost1'@'localhost' TRIGGER tg_ghost1 AFTER INSERT ON t FOR EACH ROW SET @n = NEW.id;
+
+# --- Eviction guard: node_1 must still be a healthy member of the 2-node cluster ---
+--connection node_1
+--let $assert_text= 'node_1 still in a 2-node cluster after the rejected orphan-definer CREATE TRIGGER (no eviction)'
+--let $assert_cond= [SELECT VARIABLE_VALUE = 2 AS c FROM performance_schema.global_status WHERE VARIABLE_NAME = "wsrep_cluster_size", c, 1] = 1
+--source include/assert.inc
+
+--let $assert_text= 'node_1 is still Synced (not Inconsistent)'
+--let $assert_cond= [SELECT VARIABLE_VALUE = "Synced" AS c FROM performance_schema.global_status WHERE VARIABLE_NAME = "wsrep_local_state_comment", c, 1] = 1
+--source include/assert.inc
+
+--let $assert_text= 'No inconsistency seen in node_1'
+--let $assert_cond = [SELECT COUNT(*) FROM performance_schema.error_log WHERE DATA LIKE "%Inconsistency detected%"] = 0
+--source include/assert.inc
+
+# Rejected before replication: trigger exists on no node.
+--let $assert_text= 'Trigger tg_ghost1 not created on node_1'
+--let $assert_cond= [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_ghost1", c, 1] = 0
+--source include/assert.inc
+
+--connection node_2
+--let $assert_text= 'node_2 still in a 2-node cluster (no eviction)'
+--let $assert_cond= [SELECT VARIABLE_VALUE = 2 AS c FROM performance_schema.global_status WHERE VARIABLE_NAME = "wsrep_cluster_size", c, 1] = 1
+--source include/assert.inc
+
+--let $assert_text= 'No inconsistency seen in node_2'
+--let $assert_cond = [SELECT COUNT(*) FROM performance_schema.error_log WHERE DATA LIKE "%Inconsistency detected%"] = 0
+--source include/assert.inc
+
+--let $assert_text= 'Trigger tg_ghost1 not created on node_2'
+--let $assert_cond= [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_ghost1", c, 1] = 0
+--source include/assert.inc
+
+--echo
+--echo # 2b. SET_ANY_DEFINER , EXISTING different DEFINER -> allowed, replicates.
+--echo
+
+# The 'sup' DEFINER is existing, logged in as 'user with SET_ANY_DEFINER'
+--connection any_def_con
+CREATE DEFINER='sup'@'%' TRIGGER tg_existing AFTER UPDATE ON t FOR EACH ROW SET @u = NEW.id;
+
+--connection node_1
+--let $assert_text= 'Trigger tg_existing (existing DEFINER) created on node_1 by SET_ANY_DEFINER user'
+--let $assert_cond= [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_existing", c, 1] = 1
+--source include/assert.inc
+
+--connection node_2
+--echo 'Trigger tg_existing replicated to node_2'
+--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_existing"
+--source include/wait_condition.inc
+
+--echo
+--echo # 3. ALLOW_NONEXISTENT_DEFINER user, nonexistent DEFINER -> allowed, replicates.
+--echo
+
+# The 'ghost2' DEFINER is not existing, logged in as 'user with ALLOW_NONEXISTENT_DEFINER'
+--connect (nonexist_ok_con,localhost,nonexist_ok,,probe,$NODE_MYPORT_1)
+CREATE DEFINER='ghost2'@'localhost' TRIGGER tg_ghost2 AFTER INSERT ON t FOR EACH ROW SET @n = NEW.id;
+
+--connection node_1
+--let $assert_text= 'Trigger tg_ghost2 created on node_1 (ALLOW_NONEXISTENT_DEFINER)'
+--let $assert_cond= [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_ghost2", c, 1] = 1
+--source include/assert.inc
+
+--connection node_2
+--echo 'Trigger tg_ghost2 replicated to node_2'
+--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_ghost2"
+--source include/wait_condition.inc
+
+--echo
+--echo # 4. SUPER user, nonexistent DEFINER -> allowed, replicates.
+--echo
+
+# The 'ghost3' DEFINER is not existing, logged in as 'super user'
+--connect (sup_con,localhost,sup,,probe,$NODE_MYPORT_1)
+CREATE DEFINER='ghost3'@'localhost' TRIGGER tg_ghost3 AFTER INSERT ON t FOR EACH ROW SET @n = NEW.id;
+
+--connection node_1
+--let $assert_text= 'Trigger tg_ghost3 created on node_1 (SUPER)'
+--let $assert_cond= [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_ghost3", c, 1] = 1
+--source include/assert.inc
+
+--connection node_2
+--echo 'Trigger tg_ghost3 replicated to node_2'
+--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_ghost3"
+--source include/wait_condition.inc
+
+--echo
+--echo # 4b. trust = 0, nonexistent DEFINER: which gate reports, and both enforced.
+--echo
+
+# Cases above runs with log_bin_trust_function_creators = 1.
+--connection node_1
+--disable_warnings
+SET GLOBAL log_bin_trust_function_creators = 0;
+--enable_warnings
+
+# The 'ghost4' definer does not exist, logged in as 'user with SET_ANY_DEFINER'.
+# Both gates would reject: the binlog gate (no SUPER, trust = 0) and the
+# orphan-DEFINER check. The binlog gate reports, because the DEFINER pre-check
+# runs later, just before TOI -- which is the order PS uses.
+--connection any_def_con
+--error ER_BINLOG_CREATE_ROUTINE_NEED_SUPER
+CREATE DEFINER='ghost4'@'localhost' TRIGGER tg_ghost4 AFTER INSERT ON t FOR EACH ROW SET @n = NEW.id;
+
+# Rejected before replication: trigger exists on no node.
+--connection node_1
+--let $assert_text= 'Trigger tg_ghost4 not created on node_1 (trust = 0)'
+--let $assert_cond= [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_ghost4", c, 1] = 0
+--source include/assert.inc
+
+--let $assert_text= 'node_1 still in a 2-node cluster after the rejected trust = 0 CREATE TRIGGER (no eviction)'
+--let $assert_cond= [SELECT VARIABLE_VALUE = 2 AS c FROM performance_schema.global_status WHERE VARIABLE_NAME = "wsrep_cluster_size", c, 1] = 1
+--source include/assert.inc
+
+--connection node_2
+--let $assert_text= 'Trigger tg_ghost4 not created on node_2 (trust = 0)'
+--let $assert_cond= [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_ghost4", c, 1] = 0
+--source include/assert.inc
+
+# --- SUPER: satisfies the DEFINER check
+--connection sup_con
+CREATE DEFINER='ghost5'@'localhost' TRIGGER tg_ghost5 AFTER INSERT ON t FOR EACH ROW SET @n = NEW.id;
+
+--connection node_1
+--let $assert_text= 'Trigger tg_ghost5 created on node_1 (SUPER, trust = 0)'
+--let $assert_cond= [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_ghost5", c, 1] = 1
+--source include/assert.inc
+
+--connection node_2
+--echo 'Trigger tg_ghost5 replicated to node_2 (SUPER, trust = 0)'
+--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_ghost5"
+--source include/wait_condition.inc
+
+# --- ALLOW_NONEXISTENT_DEFINER without SUPER: clears the DEFINER check, ---
+# then the binlog gate rejects, because only SUPER (or trust = 1) satisfies it.
+# This pins that the binlog gate is still reached and enforced AFTER the
+# DEFINER check passes -- the complement of the SET_ANY_DEFINER case above.
+--connection nonexist_ok_con
+--error ER_BINLOG_CREATE_ROUTINE_NEED_SUPER
+CREATE DEFINER='ghost6'@'localhost' TRIGGER tg_ghost6 AFTER INSERT ON t FOR EACH ROW SET @n = NEW.id;
+
+--connection node_1
+--let $assert_text= 'Trigger tg_ghost6 not created on node_1 (ALLOW_NONEXISTENT_DEFINER, no SUPER, trust = 0)'
+--let $assert_cond= [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_ghost6", c, 1] = 0
+--source include/assert.inc
+
+--connection node_2
+--let $assert_text= 'Trigger tg_ghost6 not created on node_2 (ALLOW_NONEXISTENT_DEFINER, no SUPER, trust = 0)'
+--let $assert_cond= [SELECT COUNT(*) AS c FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = "probe" AND TRIGGER_NAME = "tg_ghost6", c, 1] = 0
+--source include/assert.inc
+
+--echo
+--echo # 5. Cleanup.
+--echo
+
+--disconnect sup_con
+--disconnect nonexist_ok_con
+--disconnect any_def_con
+
+--connection node_1
+DROP DATABASE probe;
+DROP USER 'any_def'@'%';
+DROP USER 'nonexist_ok'@'%';
+DROP USER 'sup'@'%';
+--disable_warnings
+SET GLOBAL log_bin_trust_function_creators = @old_trust;
+--enable_warnings
+
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/galera/t/pxc_fk_inconsistency_voting.test b/mysql-test/suite/galera/t/pxc_fk_inconsistency_voting.test
index 96dc758a31ff..1bf1e0857829 100644
--- a/mysql-test/suite/galera/t/pxc_fk_inconsistency_voting.test
+++ b/mysql-test/suite/galera/t/pxc_fk_inconsistency_voting.test
@@ -11,10 +11,14 @@ INSERT INTO child VALUES (10);
--error ER_NO_REFERENCED_ROW_2
ALTER TABLE child ADD CONSTRAINT idx17 FOREIGN KEY (j) REFERENCES parent(i);
-# Assert that the message has 'temp_table'. Note that count is 2 because it
-# prints messages from both the nodes.
---let $assert_text= Verify that the intermediate temporary table name has been replaced with temp_table
---let $assert_select= a foreign key constraint fails \(`temp_table`, CONSTRAINT `idx17`
+# At wsrep application protocol >= 7 the TOI vote buffer contains only
+# " Error_code: NNNN;" (no locale-dependent message text), so voting is
+# deterministic across nodes regardless of the intermediate temp-table
+# name. Assert that both nodes' vote-initiation lines land on the same
+# error code (ER_NO_REFERENCED_ROW_2 = 1452). Count is 2 because
+# node_1 logs its own vote and node_2's vote.
+--let $assert_text= Verify that both nodes vote on the same error code
+--let $assert_select= initiates vote on .*: Error_code: 1452;
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_count=2
--source include/assert_grep.inc
diff --git a/mysql-test/suite/galera/t/pxc_inconsistency_voting.test b/mysql-test/suite/galera/t/pxc_inconsistency_voting.test
index b42785b347d4..b88a45a85162 100644
--- a/mysql-test/suite/galera/t/pxc_inconsistency_voting.test
+++ b/mysql-test/suite/galera/t/pxc_inconsistency_voting.test
@@ -1,6 +1,10 @@
#
-# This test ensures that server performs recomputation of votes based only on
-# the error codes instead of full error messages.
+# This test ensures that TOI voting is deterministic across nodes even
+# when lc_messages differs. At wsrep application protocol >= 7 the TOI
+# vote buffer contains only " Error_code: NNNN;" (no locale-dependent
+# message text), so nodes running with different lc_messages still vote
+# on identical byte sequences without needing the recompute-by-error-code
+# fallback in PXC's Galera library.
#
--source include/galera_cluster.inc
@@ -12,19 +16,28 @@ SET lc_messages = 'fr_FR';
--error ER_WRONG_AUTO_KEY
ALTER TABLE t1 MODIFY c2 BIGINT UNSIGNED NOT NULL AUTO_INCREMENT ;
-# Assert that node1 logs the message in the language set above.
---let $assert_text= Verify that node1 logs the message in the language set above
---let $assert_select= Member .* initiates vote on .* Un seul champ automatique est permis et il doit être indexé
+# Both nodes must initiate the vote with the same error code
+# (ER_WRONG_AUTO_KEY = 1075). Count is 2: node_1's own vote and
+# node_2's vote, both logged on node_1.
+--let $assert_text= Verify that both nodes vote on the same error code
+--let $assert_select= initiates vote on .*: Error_code: 1075;
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
---let $assert_count=1
+--let $assert_count=2
--source include/assert_grep.inc
-# Assert that node2 logs the message in the default language.
---let $assert_text= Verify that node2 logs the message in the default language
---let $assert_select= Member .* initiates vote on .* Incorrect table definition; there can be only one auto column and it must be defined as a key
+# The vote buffer must not carry the locale-dependent message text on
+# either side — this is what makes voting deterministic across
+# lc_messages settings.
+--let $assert_text= Verify vote buffer carries no French message text
+--let $assert_select= initiates vote on .* Un seul champ automatique
+--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
+--let $assert_count=0
+--source include/assert_grep.inc
+--let $assert_text= Verify vote buffer carries no English message text
+--let $assert_select= initiates vote on .* Incorrect table definition
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
---let $assert_count=1
+--let $assert_count=0
--source include/assert_grep.inc
# Verify that cluster remains operational even when the above query failed with different error messages.
diff --git a/mysql-test/suite/galera/t/pxc_install_gr.test b/mysql-test/suite/galera/t/pxc_install_gr.test
index 09093e068b01..5109d79b7f57 100644
--- a/mysql-test/suite/galera/t/pxc_install_gr.test
+++ b/mysql-test/suite/galera/t/pxc_install_gr.test
@@ -42,7 +42,9 @@ INSTALL PLUGIN group_replication SONAME 'group_replication.so';
CREATE TABLE t1(id INT PRIMARY KEY AUTO_INCREMENT);
SET GLOBAL pxc_strict_mode = 0;
+SET GLOBAL sql_require_primary_key = OFF;
--connection node_2
SET GLOBAL pxc_strict_mode = 0;
+SET GLOBAL sql_require_primary_key = OFF;
--connection node_1
DROP TABLE t1;
diff --git a/mysql-test/suite/group_replication/include/gr_clone_integration_basics_with_ssl.inc b/mysql-test/suite/group_replication/include/gr_clone_integration_basics_with_ssl.inc
index efd59b8a339d..01b66ad000ce 100644
--- a/mysql-test/suite/group_replication/include/gr_clone_integration_basics_with_ssl.inc
+++ b/mysql-test/suite/group_replication/include/gr_clone_integration_basics_with_ssl.inc
@@ -100,6 +100,7 @@ SET SESSION sql_log_bin=1;
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
--eval SET PERSIST group_replication_ssl_mode= "$_group_replication_ssl_mode"
@@ -133,6 +134,7 @@ CHANGE REPLICATION SOURCE TO SOURCE_USER="rec_ssl_user" FOR CHANNEL "group_repli
--let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold`
SET GLOBAL group_replication_clone_threshold= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/r/gr_acf_receiver_network_partition.result b/mysql-test/suite/group_replication/r/gr_acf_receiver_network_partition.result
index 3e1983500eb6..be03437b2174 100644
--- a/mysql-test/suite/group_replication/r/gr_acf_receiver_network_partition.result
+++ b/mysql-test/suite/group_replication/r/gr_acf_receiver_network_partition.result
@@ -96,7 +96,17 @@ include/assert.inc ['There is one row in performance_schema.replication_asynchro
include/assert.inc ['The version of replication_asynchronous_connection_failover_managed must be 1']
############################################################
-# 10. Clean up.
+# 10. Disable failover channels auto-start before cleanup.
+[connection server1]
+SELECT group_replication_disable_member_action("mysql_start_failover_channels_if_primary", "AFTER_PRIMARY_ELECTION");
+group_replication_disable_member_action("mysql_start_failover_channels_if_primary", "AFTER_PRIMARY_ELECTION")
+OK
+include/assert.inc [The action mysql_start_failover_channels_if_primary must be disabled]
+[connection server2]
+include/assert.inc [The action mysql_start_failover_channels_if_primary must be disabled on server2]
+
+############################################################
+# 11. Clean up.
[connection server1]
include/stop_group_replication.inc
include/rpl/reset_replica.inc
diff --git a/mysql-test/suite/group_replication/r/gr_communication_configuration.result b/mysql-test/suite/group_replication/r/gr_communication_configuration.result
index c06cc0c848b2..66f807e707f4 100644
--- a/mysql-test/suite/group_replication/r/gr_communication_configuration.result
+++ b/mysql-test/suite/group_replication/r/gr_communication_configuration.result
@@ -38,8 +38,12 @@ SET @group_seeds= @@GLOBAL.group_replication_group_seeds;
SET @local_address= @@GLOBAL.group_replication_local_address;
SET @group_seeds= @@GLOBAL.group_replication_group_seeds;
SET PERSIST group_replication_ip_allowlist= "GROUP_LOCAL_IP_ALLOWLIST";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
[connection server1]
SET PERSIST group_replication_ip_allowlist= "GROUP_LOCAL_IP_ALLOWLIST";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
[connection server2]
#######################################################
# 1. Try setting bootstrap_group variable with invalid
diff --git a/mysql-test/suite/group_replication/r/gr_communication_stack_deprecation.result b/mysql-test/suite/group_replication/r/gr_communication_stack_deprecation.result
new file mode 100644
index 000000000000..4e3faf87c791
--- /dev/null
+++ b/mysql-test/suite/group_replication/r/gr_communication_stack_deprecation.result
@@ -0,0 +1,43 @@
+include/group_replication.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
+[connection server1]
+
+############################################################
+# 1. Set group_replication_communication_stack to MYSQL.
+# No deprecation warning is thrown on the client session.
+[connection server1]
+include/save_sysvars.inc [ "GLOBAL.group_replication_communication_stack" ]
+SET @@GLOBAL.group_replication_communication_stack= "MYSQL";
+
+############################################################
+# 2. Set group_replication_communication_stack to XCOM.
+# A deprecation warning is thrown on the client session.
+[connection server1]
+SET @@GLOBAL.group_replication_communication_stack= "XCOM";
+Warnings:
+Warning 1287 'group_replication_communication_stack=XCOM' is deprecated and will be removed in a future release. Please use group_replication_communication_stack=MYSQL instead
+
+############################################################
+# 3. Start Group Replication from client session.
+# A deprecation warning is thrown on the client session because
+# group_replication_communication_stack is XCOM.
+[connection server1]
+include/start_and_bootstrap_group_replication.inc
+
+############################################################
+# 4. Start Group Replication on server start.
+# A deprecation warning is logged on the error log because
+# group_replication_communication_stack is XCOM.
+[connection server1]
+# restart:--group_replication_group_name=GROUP_REPLICATION_GROUP_NAME --group_replication_local_address=GROUP_REPLICATION_LOCAL_ADDRESS --group_replication_group_seeds=GROUP_REPLICATION_GROUP_SEEDS --group_replication_bootstrap_group=1 --group_replication_start_on_boot=1 --group_replication_communication_stack=XCOM
+include/rpl/reconnect.inc
+include/gr_wait_for_member_state.inc
+
+############################################################
+# 5. Cleanup.
+[connection server1]
+include/stop_group_replication.inc
+include/restore_sysvars.inc
+include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/r/gr_communication_stack_option.result b/mysql-test/suite/group_replication/r/gr_communication_stack_option.result
new file mode 100644
index 000000000000..2ad4617b9206
--- /dev/null
+++ b/mysql-test/suite/group_replication/r/gr_communication_stack_option.result
@@ -0,0 +1,17 @@
+SET @group_replication_communication_stack_saved= @@GLOBAL.group_replication_communication_stack;
+SET @@GLOBAL.group_replication_communication_stack= 1;
+include/assert.inc [Numeric value 1 sets group_replication_communication_stack to MySQL]
+SET @@GLOBAL.group_replication_communication_stack= 0;
+Warnings:
+Warning 1287 'group_replication_communication_stack=XCOM' is deprecated and will be removed in a future release. Please use group_replication_communication_stack=MYSQL instead
+include/assert.inc [Numeric value 0 sets group_replication_communication_stack to XCom]
+SET @@GLOBAL.group_replication_communication_stack= NULL;
+ERROR 42000: Variable 'group_replication_communication_stack' can't be set to the value of 'NULL'
+include/assert.inc [group_replication_communication_stack value must remain XCom]
+SET @@GLOBAL.group_replication_communication_stack= "OLA";
+ERROR 42000: Variable 'group_replication_communication_stack' can't be set to the value of 'OLA'
+include/assert.inc [group_replication_communication_stack value must remain XCom]
+SET @@GLOBAL.group_replication_communication_stack= 10;
+ERROR 42000: Variable 'group_replication_communication_stack' can't be set to the value of '10'
+include/assert.inc [group_replication_communication_stack value must remain XCom]
+SET @@GLOBAL.group_replication_communication_stack= @group_replication_communication_stack_saved;
diff --git a/mysql-test/suite/group_replication/r/gr_concurrent_ticket_pop_with_channel.result b/mysql-test/suite/group_replication/r/gr_concurrent_ticket_pop_with_channel.result
index e181017ba0c5..4a082f6a7844 100644
--- a/mysql-test/suite/group_replication/r/gr_concurrent_ticket_pop_with_channel.result
+++ b/mysql-test/suite/group_replication/r/gr_concurrent_ticket_pop_with_channel.result
@@ -13,8 +13,6 @@ Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
SET @@GLOBAL.DEBUG= '+d,group_replication_version_with_vcle';
include/start_and_bootstrap_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_AUTO_POSITION=1, SOURCE_PORT=SERVER_3_PORT FOR CHANNEL 'ch1';
Warnings:
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
@@ -47,8 +45,6 @@ Warning 1681 'group_replication_view_change_uuid' is deprecated and will be remo
SET GLOBAL group_replication_group_name= "GROUP_REPLICATION_GROUP_NAME";
SET @@GLOBAL.DEBUG= '+d,group_replication_version_with_vcle';
START GROUP_REPLICATION;
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
[connection server1]
include/assert.inc ['There is a worker whose stage reports it is waiting on a ticket']
#
@@ -68,8 +64,6 @@ Warning 1681 'group_replication_view_change_uuid' is deprecated and will be remo
SET GLOBAL group_replication_group_name= "GROUP_REPLICATION_GROUP_NAME";
SET @@GLOBAL.DEBUG= '+d,group_replication_version_with_vcle';
START GROUP_REPLICATION;
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
[connection server1]
#
# 6. Unblock the stuck ticket
diff --git a/mysql-test/suite/group_replication/r/gr_failed_server_mysql_connection.result b/mysql-test/suite/group_replication/r/gr_failed_server_mysql_connection.result
index 1d2c1b679d19..7fb758eda066 100644
--- a/mysql-test/suite/group_replication/r/gr_failed_server_mysql_connection.result
+++ b/mysql-test/suite/group_replication/r/gr_failed_server_mysql_connection.result
@@ -57,6 +57,8 @@ START GROUP_REPLICATION;;
#
#######
[connection server2]
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
#
# 7. Clean-up
#
diff --git a/mysql-test/suite/group_replication/r/gr_gcs_debug_trace_auto_rotation.result b/mysql-test/suite/group_replication/r/gr_gcs_debug_trace_auto_rotation.result
new file mode 100644
index 000000000000..d334985d3859
--- /dev/null
+++ b/mysql-test/suite/group_replication/r/gr_gcs_debug_trace_auto_rotation.result
@@ -0,0 +1,34 @@
+include/group_replication.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
+[connection server1]
+
+# 1. Set communication_debug_max_file_size and start GR.
+# Trace file with timestamp are created.
+SET GLOBAL group_replication_communication_debug_max_file_size = 200;
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_ALL";
+include/start_and_bootstrap_group_replication.inc
+Initial trace file is timestamped, as expected
+No plain GCS_DEBUG_TRACE created, as expected
+
+# 2. Size-based rotation: old file stays, new timestamped file created.
+Size-based rotation created a new timestamped file, as expected
+Original file still exists after rotation (no archiving), as expected
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_NONE";
+
+# 3. Restart Group Replication -- a new timestamped file is created on start.
+Recorded file count before restart
+include/stop_group_replication.inc
+include/start_and_bootstrap_group_replication.inc
+New timestamped file created on GR restart, as expected
+
+# 4. Group Replication is ONLINE.
+include/assert.inc [Member is ONLINE after automatic rotation]
+
+# 5. Cleanup.
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_NONE";
+SET GLOBAL group_replication_communication_debug_max_file_size = 0;
+include/stop_group_replication.inc
+Cleanup complete
+include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/r/gr_gcs_debug_trace_reopen.result b/mysql-test/suite/group_replication/r/gr_gcs_debug_trace_reopen.result
new file mode 100644
index 000000000000..ff747493fc4b
--- /dev/null
+++ b/mysql-test/suite/group_replication/r/gr_gcs_debug_trace_reopen.result
@@ -0,0 +1,23 @@
+include/group_replication.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
+[connection server1]
+
+# 1. Start Group Replication.
+include/start_and_bootstrap_group_replication.inc
+
+# 2. Enable GCS_DEBUG_ALL tracing.
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_ALL";
+
+# 3. Remove GCS_DEBUG_TRACE.
+
+# 4. Wait for stat auto-detection -- GCS_DEBUG_TRACE must reappear
+
+# 5. Group Replication is ONLINE.
+include/assert.inc [Member is ONLINE after stale-fd detection and reopen]
+
+# 6. cleanup
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_NONE";
+include/stop_group_replication.inc
+include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/r/gr_gcs_debug_trace_timestamps.result b/mysql-test/suite/group_replication/r/gr_gcs_debug_trace_timestamps.result
new file mode 100644
index 000000000000..70f779f02a4d
--- /dev/null
+++ b/mysql-test/suite/group_replication/r/gr_gcs_debug_trace_timestamps.result
@@ -0,0 +1,28 @@
+include/group_replication.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
+[connection server1]
+
+# Step 1: Start Group Replication — GCS_DEBUG_TRACE must be created.
+include/start_and_bootstrap_group_replication.inc
+
+# Step 2: Enable GCS_DEBUG_BASIC tracing
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_BASIC";
+include/assert.inc [Debug option is GCS_DEBUG_BASIC]
+
+# Step 3: verify ISO 8601 UTC timestamps(microsecond) in GCS_DEBUG_TRACE
+include/wait_for_pattern_in_file.inc [\[\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z\] \[MYSQL_GCS_DEBUG\] \[GCS\]]
+
+# Step 4: disable then re-enable tracing; timestamps must persist
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_NONE";
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_ALL";
+include/assert_grep.inc [Timestamps persist after tracing re-enable]
+
+# Step 5: Verify Group Replication is still ONLINE.
+include/assert.inc [Member is ONLINE after timestamp test]
+
+# Step 6: Cleanup.
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_NONE";
+include/stop_group_replication.inc
+include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/r/gr_ip_allowlist_deprecation.result b/mysql-test/suite/group_replication/r/gr_ip_allowlist_deprecation.result
new file mode 100644
index 000000000000..68e29056f04c
--- /dev/null
+++ b/mysql-test/suite/group_replication/r/gr_ip_allowlist_deprecation.result
@@ -0,0 +1,47 @@
+include/group_replication.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
+[connection server1]
+
+############################################################
+# 1. Set group_replication_ip_allowlist.
+# A deprecation warning is thrown on the client session.
+[connection server1]
+include/save_sysvars.inc [ "GLOBAL.group_replication_ip_allowlist" ]
+SET @@GLOBAL.group_replication_ip_allowlist= "AUTOMATIC";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
+
+############################################################
+# 2. Set group_replication_ip_allowlist to some custom value.
+# A deprecation warning is thrown on the client session.
+[connection server1]
+SET @@GLOBAL.group_replication_ip_allowlist= "127.0.0.1/32";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
+
+############################################################
+# 3. Start Group Replication from client session.
+# A deprecation warning is thrown on the client session because
+# group_replication_ip_allowlist is not the default one.
+[connection server1]
+include/start_and_bootstrap_group_replication.inc
+
+############################################################
+# 4. Start Group Replication on server start.
+# A deprecation warning is logged on the error log because
+# group_replication_ip_allowlist is not the default one.
+[connection server1]
+# restart:--group_replication_group_name=GROUP_REPLICATION_GROUP_NAME --group_replication_local_address=GROUP_REPLICATION_LOCAL_ADDRESS --group_replication_group_seeds=GROUP_REPLICATION_GROUP_SEEDS --group_replication_bootstrap_group=1 --group_replication_start_on_boot=1 --group_replication_ip_allowlist=127.0.0.1/32
+include/rpl/reconnect.inc
+include/gr_wait_for_member_state.inc
+
+############################################################
+# 5. Cleanup.
+[connection server1]
+include/stop_group_replication.inc
+include/restore_sysvars.inc
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
+include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/r/gr_ip_allowlist_options.result b/mysql-test/suite/group_replication/r/gr_ip_allowlist_options.result
index a209d168dc1b..9c7fe8208d26 100644
--- a/mysql-test/suite/group_replication/r/gr_ip_allowlist_options.result
+++ b/mysql-test/suite/group_replication/r/gr_ip_allowlist_options.result
@@ -8,47 +8,69 @@ SET GLOBAL group_replication_group_name="00000000-1111-2222-3333-444444444444";
SET GLOBAL group_replication_ip_allowlist=NULL;
ERROR 42000: Variable 'group_replication_ip_allowlist' can't be set to the value of 'NULL'
SET GLOBAL group_replication_ip_allowlist="192.256.1.20";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
START GROUP_REPLICATION;
ERROR HY000: The START GROUP_REPLICATION command failed as there was an error when initializing the group communication layer.
SET GLOBAL group_replication_ip_allowlist="300.168.1.20";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
START GROUP_REPLICATION;
ERROR HY000: The START GROUP_REPLICATION command failed as there was an error when initializing the group communication layer.
SET GLOBAL group_replication_ip_allowlist="192.168.1.0/33";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
START GROUP_REPLICATION;
ERROR HY000: The START GROUP_REPLICATION command failed as there was an error when initializing the group communication layer.
SET GLOBAL group_replication_ip_allowlist="192.168.266.0/24";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
START GROUP_REPLICATION;
ERROR HY000: The START GROUP_REPLICATION command failed as there was an error when initializing the group communication layer.
SET GLOBAL group_replication_ip_allowlist="8.9.10.0/20,192.168.1.1,192.168.2.0/44";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
START GROUP_REPLICATION;
ERROR HY000: The START GROUP_REPLICATION command failed as there was an error when initializing the group communication layer.
SET GLOBAL group_replication_ip_allowlist="8.9.10.0/20,192.168.1.1,AUTOMATIC";
ERROR HY000: The group_replication_ip_allowlist is invalid. Make sure that when specifying "AUTOMATIC" the list contains no other values.
SET GLOBAL group_replication_ip_allowlist="192.168.1.1";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
include/assert.inc [Assert value changed to 192.168.1.1]
include/stop_group_replication.inc
include/assert_grep.inc [ip_allowlist was successfully logged to the error log]
SET GLOBAL group_replication_ip_allowlist="192.168.1.0/24";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
include/assert.inc [Assert value changed to 192.168.1.0/24]
include/stop_group_replication.inc
include/assert_grep.inc [ip_allowlist was successfully logged to the error log]
SET GLOBAL group_replication_ip_allowlist="8.9.10.0/20";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
include/assert.inc [Assert value changed to 8.9.10.0/20]
include/stop_group_replication.inc
include/assert_grep.inc [ip_allowlist was successfully logged to the error log]
SET GLOBAL group_replication_ip_allowlist="fe80::f6dd:5a39:661b:b00b/64,8.9.10.0/20,192.168.1.1,192.168.2.0/24";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
include/assert.inc [Assert value changed to fe80::f6dd:5a39:661b:b00b/64,8.9.10.0/20,192.168.1.1,192.168.2.0/24]
include/stop_group_replication.inc
include/assert_grep.inc [ip_allowlist was successfully logged to the error log]
SET GLOBAL group_replication_ip_allowlist="CORRECT_HOSTNAME";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
include/assert.inc [Assert value with hostname is not empty]
include/stop_group_replication.inc
SET GLOBAL group_replication_ip_allowlist="";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
include/assert.inc [Assert value changed to ""]
include/stop_group_replication.inc
@@ -56,9 +78,13 @@ include/assert_grep.inc [ip_allowlist was successfully logged to the error log]
SET GLOBAL group_replication_ip_allowlist=DEFAULT;
ERROR 42000: Variable 'group_replication_ip_allowlist' can't be set to the value of 'DEFAULT'
SET GLOBAL group_replication_ip_allowlist=AUTOMATIC;
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
include/assert.inc [Assert value changed to "AUTOMATIC"]
SET GLOBAL group_replication_ip_allowlist="192.168.1.1";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
include/assert.inc [Assert value changed to "192.168.1.1"]
SET GLOBAL group_replication_ip_allowlist="192.256.1.20";
ERROR HY000: The group_replication_ip_allowlist is invalid. Make sure that when specifying "AUTOMATIC" the list contains no other values.
@@ -66,6 +92,8 @@ include/assert.inc [Assert value has not changed to "192.256.1.20"]
include/stop_group_replication.inc
[connection server1]
SET GLOBAL group_replication_ip_allowlist="";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
[connection server2]
include/start_group_replication.inc
@@ -79,9 +107,13 @@ include/rpl/sync.inc
[connection server1]
include/stop_group_replication.inc
SET GLOBAL group_replication_ip_allowlist= AUTOMATIC;
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
include/start_group_replication.inc
[connection server2]
include/stop_group_replication.inc
SET GLOBAL group_replication_ip_allowlist= AUTOMATIC;
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
include/start_group_replication.inc
include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/r/gr_persist_only_variables.result b/mysql-test/suite/group_replication/r/gr_persist_only_variables.result
index e164382f9978..440002b7ffe7 100644
--- a/mysql-test/suite/group_replication/r/gr_persist_only_variables.result
+++ b/mysql-test/suite/group_replication/r/gr_persist_only_variables.result
@@ -29,6 +29,7 @@ SET PERSIST_ONLY group_replication_bootstrap_group = @@GLOBAL.group_replication_
SET PERSIST_ONLY group_replication_certification_loop_chunk_size = @@GLOBAL.group_replication_certification_loop_chunk_size;
SET PERSIST_ONLY group_replication_certification_loop_sleep_time = @@GLOBAL.group_replication_certification_loop_sleep_time;
SET PERSIST_ONLY group_replication_clone_threshold = @@GLOBAL.group_replication_clone_threshold;
+SET PERSIST_ONLY group_replication_communication_debug_max_file_size = @@GLOBAL.group_replication_communication_debug_max_file_size;
SET PERSIST_ONLY group_replication_communication_debug_options = @@GLOBAL.group_replication_communication_debug_options;
SET PERSIST_ONLY group_replication_communication_max_message_size = @@GLOBAL.group_replication_communication_max_message_size;
SET PERSIST_ONLY group_replication_communication_stack = @@GLOBAL.group_replication_communication_stack;
@@ -86,7 +87,7 @@ SET PERSIST_ONLY group_replication_view_change_uuid = @@GLOBAL.group_replication
SET PERSIST_ONLY group_replication_xcom_ssl_accept_retries = @@GLOBAL.group_replication_xcom_ssl_accept_retries;
SET PERSIST_ONLY group_replication_xcom_ssl_socket_timeout = @@GLOBAL.group_replication_xcom_ssl_socket_timeout;
-include/assert.inc ['Expect 64 persisted variables.']
+include/assert.inc ['Expect 65 persisted variables.']
############################################################
# 2. Restart server, it must bootstrap the group and preserve
@@ -95,9 +96,9 @@ include/assert.inc ['Expect 64 persisted variables.']
include/rpl/reconnect.inc
include/gr_wait_for_member_state.inc
-include/assert.inc ['Expect 64 persisted variables in persisted_variables table.']
-include/assert.inc ['Expect 63 variables which last value was set through SET PERSIST.']
-include/assert.inc ['Expect 63 persisted variables with matching persisted and global values.']
+include/assert.inc ['Expect 65 persisted variables in persisted_variables table.']
+include/assert.inc ['Expect 64 variables which last value was set through SET PERSIST.']
+include/assert.inc ['Expect 64 persisted variables with matching persisted and global values.']
############################################################
# 3. Test RESET PERSIST IF EXISTS.
@@ -110,6 +111,7 @@ RESET PERSIST IF EXISTS group_replication_bootstrap_group;
RESET PERSIST IF EXISTS group_replication_certification_loop_chunk_size;
RESET PERSIST IF EXISTS group_replication_certification_loop_sleep_time;
RESET PERSIST IF EXISTS group_replication_clone_threshold;
+RESET PERSIST IF EXISTS group_replication_communication_debug_max_file_size;
RESET PERSIST IF EXISTS group_replication_communication_debug_options;
RESET PERSIST IF EXISTS group_replication_communication_max_message_size;
RESET PERSIST IF EXISTS group_replication_communication_stack;
diff --git a/mysql-test/suite/group_replication/r/gr_persist_variables.result b/mysql-test/suite/group_replication/r/gr_persist_variables.result
index 56d096d823c1..82d3f3e223c9 100644
--- a/mysql-test/suite/group_replication/r/gr_persist_variables.result
+++ b/mysql-test/suite/group_replication/r/gr_persist_variables.result
@@ -29,6 +29,7 @@ SET PERSIST group_replication_bootstrap_group = @@GLOBAL.group_replication_boots
SET PERSIST group_replication_certification_loop_chunk_size = @@GLOBAL.group_replication_certification_loop_chunk_size;
SET PERSIST group_replication_certification_loop_sleep_time = @@GLOBAL.group_replication_certification_loop_sleep_time;
SET PERSIST group_replication_clone_threshold = @@GLOBAL.group_replication_clone_threshold;
+SET PERSIST group_replication_communication_debug_max_file_size = @@GLOBAL.group_replication_communication_debug_max_file_size;
SET PERSIST group_replication_communication_debug_options = @@GLOBAL.group_replication_communication_debug_options;
SET PERSIST group_replication_communication_max_message_size = @@GLOBAL.group_replication_communication_max_message_size;
SET PERSIST group_replication_communication_stack = @@GLOBAL.group_replication_communication_stack;
@@ -83,12 +84,10 @@ SET PERSIST group_replication_tls_source = @@GLOBAL.group_replication_tls_source
SET PERSIST group_replication_transaction_size_limit = @@GLOBAL.group_replication_transaction_size_limit;
SET PERSIST group_replication_unreachable_majority_timeout = @@GLOBAL.group_replication_unreachable_majority_timeout;
SET PERSIST group_replication_view_change_uuid = @@GLOBAL.group_replication_view_change_uuid;
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
SET PERSIST group_replication_xcom_ssl_accept_retries = @@GLOBAL.group_replication_xcom_ssl_accept_retries;
SET PERSIST group_replication_xcom_ssl_socket_timeout = @@GLOBAL.group_replication_xcom_ssl_socket_timeout;
-include/assert.inc ['Expect 64 persisted variables.']
+include/assert.inc ['Expect 65 persisted variables.']
############################################################
# 2. Restart server, it must bootstrap the group and preserve
@@ -97,9 +96,9 @@ include/assert.inc ['Expect 64 persisted variables.']
include/rpl/reconnect.inc
include/gr_wait_for_member_state.inc
-include/assert.inc ['Expect 64 persisted variables in persisted_variables table.']
-include/assert.inc ['Expect 63 variables which last value was set through SET PERSIST.']
-include/assert.inc ['Expect 63 variables which last value was set through SET PERSIST is equal to its global value.']
+include/assert.inc ['Expect 65 persisted variables in persisted_variables table.']
+include/assert.inc ['Expect 64 variables which last value was set through SET PERSIST.']
+include/assert.inc ['Expect 64 variables which last value was set through SET PERSIST is equal to its global value.']
############################################################
# 3. Test RESET PERSIST.
@@ -112,6 +111,7 @@ RESET PERSIST group_replication_bootstrap_group;
RESET PERSIST group_replication_certification_loop_chunk_size;
RESET PERSIST group_replication_certification_loop_sleep_time;
RESET PERSIST group_replication_clone_threshold;
+RESET PERSIST group_replication_communication_debug_max_file_size;
RESET PERSIST group_replication_communication_debug_options;
RESET PERSIST group_replication_communication_max_message_size;
RESET PERSIST group_replication_communication_stack;
diff --git a/mysql-test/suite/group_replication/r/gr_set_option_during_stop.result b/mysql-test/suite/group_replication/r/gr_set_option_during_stop.result
index 61d1470a1754..0dce33026aca 100644
--- a/mysql-test/suite/group_replication/r/gr_set_option_during_stop.result
+++ b/mysql-test/suite/group_replication/r/gr_set_option_during_stop.result
@@ -29,6 +29,7 @@ INSERT INTO gr_options_that_cannot_be_change (name)
SELECT VARIABLE_NAME FROM performance_schema.global_variables
WHERE VARIABLE_NAME LIKE 'group_replication_%'
AND VARIABLE_NAME != 'group_replication_bootstrap_group'
+ AND VARIABLE_NAME != 'group_replication_communication_debug_max_file_size'
AND VARIABLE_NAME != 'group_replication_communication_stack'
AND VARIABLE_NAME != 'group_replication_consistency'
AND VARIABLE_NAME != 'group_replication_exit_state_action'
@@ -182,6 +183,8 @@ SET @value= @@GLOBAL.group_replication_certification_loop_chunk_size;
SET @@GLOBAL.group_replication_certification_loop_chunk_size= @value;
SET @value= @@GLOBAL.group_replication_certification_loop_sleep_time;
SET @@GLOBAL.group_replication_certification_loop_sleep_time= @value;
+SET @value= @@GLOBAL.group_replication_communication_debug_max_file_size;
+SET @@GLOBAL.group_replication_communication_debug_max_file_size= @value;
SET @value= @@GLOBAL.group_replication_communication_stack;
SET @@GLOBAL.group_replication_communication_stack= @value;
SET @value= @@GLOBAL.group_replication_consistency;
diff --git a/mysql-test/suite/group_replication/r/gr_set_variable_in_read_only.result b/mysql-test/suite/group_replication/r/gr_set_variable_in_read_only.result
index d42517897728..8bac43d4e41a 100644
--- a/mysql-test/suite/group_replication/r/gr_set_variable_in_read_only.result
+++ b/mysql-test/suite/group_replication/r/gr_set_variable_in_read_only.result
@@ -26,10 +26,14 @@ Warnings:
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release.
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
# 6. Cleanup.
Warnings:
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release.
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
[connection server2]
SET @@GLOBAL.binlog_checksum= @binlog_checksum_save;
include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/r/gr_show_global_and_session_variables.result b/mysql-test/suite/group_replication/r/gr_show_global_and_session_variables.result
index c2e586885e77..965a81ea5bca 100644
--- a/mysql-test/suite/group_replication/r/gr_show_global_and_session_variables.result
+++ b/mysql-test/suite/group_replication/r/gr_show_global_and_session_variables.result
@@ -7,8 +7,8 @@ Note #### Storing MySQL user name or password information in the connection meta
include/start_and_bootstrap_group_replication.inc
include/stop_group_replication.inc
-# Test#1: Basic check that there are 65 GR variables.
-include/assert.inc [There are 65 GR variables at present.]
+# Test#1: Basic check that there are 66 GR variables.
+include/assert.inc [There are 66 GR variables at present.]
# Test#2: Verify group replication related variables at GLOBAL scope.
SET @@SESSION.group_replication_auto_increment_increment= 7;
@@ -100,6 +100,8 @@ ERROR HY000: Variable 'group_replication_preemptive_garbage_collection' is a GLO
SET @@SESSION.group_replication_preemptive_garbage_collection_rows_threshold= 100000;
ERROR HY000: Variable 'group_replication_preemptive_garbage_collection_rows_threshold' is a GLOBAL variable and should be set with SET GLOBAL
Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
+Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
# Test#3: Verify group replication related variables at SESSION scope.
@@ -108,8 +110,6 @@ SET @@SESSION.group_replication_consistency= DEFAULT;
# Test#4: Verify GLOBAL and SESSION variables
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
SET GLOBAL group_replication_recovery_ssl_crl= 'crl-client-revoked.crl';
SET GLOBAL group_replication_recovery_tls_ciphersuites= "";
include/assert.inc [Verify GLOBAL value of group_replication_auto_increment_increment]
@@ -293,5 +293,7 @@ include/assert.inc [Verify SESSION value of group_replication_preemptive_garbage
# Clean up
include/stop_group_replication.inc
Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
+Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/r/gr_variables_default_values.result b/mysql-test/suite/group_replication/r/gr_variables_default_values.result
index 10cddaff13ac..a3b67f9fbd2d 100644
--- a/mysql-test/suite/group_replication/r/gr_variables_default_values.result
+++ b/mysql-test/suite/group_replication/r/gr_variables_default_values.result
@@ -5,6 +5,8 @@ Note #### Storing MySQL user name or password information in the connection meta
[connection server1]
[connection server1]
SET @@GLOBAL.group_replication_ip_allowlist= "AUTOMATIC";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
SET @@GLOBAL.group_replication_auto_increment_increment= default;
ERROR 42000: Variable 'group_replication_auto_increment_increment' can't be set to the value of 'DEFAULT'
@@ -28,9 +30,9 @@ include/stop_group_replication.inc
#
# Test Unit#1
# Set global/session group replication variables to default.
-# Curently there are 65 group replication variables.
+# Curently there are 66 group replication variables.
#
-include/assert.inc [There are 65 GR variables at present.]
+include/assert.inc [There are 66 GR variables at present.]
SET @@GLOBAL.group_replication_auto_increment_increment= default;
ERROR 42000: Variable 'group_replication_auto_increment_increment' can't be set to the value of 'DEFAULT'
SET @@GLOBAL.group_replication_compression_threshold= default;
@@ -116,6 +118,7 @@ include/assert.inc [Default group_replication_ssl_mode is REQUIRED]
include/assert.inc [Default group_replication_start_on_boot is ON/1]
include/assert.inc [Default group_replication_transaction_size_limit is 150000000]
include/assert.inc [Default group_replication_communication_debug_options is "GCS_DEBUG_NONE"]
+include/assert.inc [Default group_replication_communication_debug_max_file_size is 0]
include/assert.inc [Default group_replication_unreachable_majority_timeout is 0]
include/assert.inc [Default group_replication_member_weight is 50]
include/assert.inc [Default group_replication_recovery_public_key_path is ""(EMPTY)]
@@ -143,5 +146,7 @@ include/assert.inc [Default group_replication_xcom_ssl_accept_retries is 10]
# Clean up
#
Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
+Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/r/gr_variables_mysqladmin.result b/mysql-test/suite/group_replication/r/gr_variables_mysqladmin.result
index bfaeceb29193..10412adbd1ab 100644
--- a/mysql-test/suite/group_replication/r/gr_variables_mysqladmin.result
+++ b/mysql-test/suite/group_replication/r/gr_variables_mysqladmin.result
@@ -4,6 +4,8 @@ Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
[connection server1]
SET @@GLOBAL.group_replication_ip_allowlist= "AUTOMATIC";
+Warnings:
+Warning 1681 'group_replication_ip_allowlist' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
=====mysqladmin -u root -P MASTER_MYPORT --protocol=TCP check all the GR variable outputs=====
diff --git a/mysql-test/suite/group_replication/r/gr_variables_privileges.result b/mysql-test/suite/group_replication/r/gr_variables_privileges.result
index f91558223632..dc434e1b6de9 100644
--- a/mysql-test/suite/group_replication/r/gr_variables_privileges.result
+++ b/mysql-test/suite/group_replication/r/gr_variables_privileges.result
@@ -41,6 +41,8 @@ SET GLOBAL group_replication_certification_loop_sleep_time = @@GLOBAL.group_repl
ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation
SET GLOBAL group_replication_clone_threshold = @@GLOBAL.group_replication_clone_threshold;
ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation
+SET GLOBAL group_replication_communication_debug_max_file_size = @@GLOBAL.group_replication_communication_debug_max_file_size;
+ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation
SET GLOBAL group_replication_communication_debug_options = @@GLOBAL.group_replication_communication_debug_options;
ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation
SET GLOBAL group_replication_communication_max_message_size = @@GLOBAL.group_replication_communication_max_message_size;
@@ -177,6 +179,7 @@ SET GLOBAL group_replication_bootstrap_group = @@GLOBAL.group_replication_bootst
SET GLOBAL group_replication_certification_loop_chunk_size = @@GLOBAL.group_replication_certification_loop_chunk_size;
SET GLOBAL group_replication_certification_loop_sleep_time = @@GLOBAL.group_replication_certification_loop_sleep_time;
SET GLOBAL group_replication_clone_threshold = @@GLOBAL.group_replication_clone_threshold;
+SET GLOBAL group_replication_communication_debug_max_file_size = @@GLOBAL.group_replication_communication_debug_max_file_size;
SET GLOBAL group_replication_communication_debug_options = @@GLOBAL.group_replication_communication_debug_options;
SET GLOBAL group_replication_communication_max_message_size = @@GLOBAL.group_replication_communication_max_message_size;
SET GLOBAL group_replication_communication_stack = @@GLOBAL.group_replication_communication_stack;
@@ -233,8 +236,6 @@ SET GLOBAL group_replication_tls_source = @@GLOBAL.group_replication_tls_source;
SET GLOBAL group_replication_transaction_size_limit = @@GLOBAL.group_replication_transaction_size_limit;
SET GLOBAL group_replication_unreachable_majority_timeout = @@GLOBAL.group_replication_unreachable_majority_timeout;
SET GLOBAL group_replication_view_change_uuid = @@GLOBAL.group_replication_view_change_uuid;
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
SET GLOBAL group_replication_xcom_ssl_accept_retries = @@GLOBAL.group_replication_xcom_ssl_accept_retries;
SET GLOBAL group_replication_xcom_ssl_socket_timeout = @@GLOBAL.group_replication_xcom_ssl_socket_timeout;
diff --git a/mysql-test/suite/group_replication/r/gr_view_change_uuid.result b/mysql-test/suite/group_replication/r/gr_view_change_uuid.result
index 0010c8288bbb..a3eea6b1ca7b 100644
--- a/mysql-test/suite/group_replication/r/gr_view_change_uuid.result
+++ b/mysql-test/suite/group_replication/r/gr_view_change_uuid.result
@@ -25,8 +25,6 @@ Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
SET @@GLOBAL.DEBUG= '+d,group_replication_version_with_vcle';
include/start_and_bootstrap_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/assert.inc [GTID_EXECUTED must have one transaction of view change]
include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -44,8 +42,6 @@ Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
SET @@GLOBAL.DEBUG= '+d,group_replication_version_with_vcle';
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/assert.inc [GTID_EXECUTED must have two transactions of view changes]
include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -80,8 +76,6 @@ Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
SET @@GLOBAL.DEBUG= '+d,group_replication_version_with_vcle';
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/assert.inc [GTID_EXECUTED must have three transactions of view changes]
include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -169,8 +163,6 @@ server-binary-log.000001 # Query # # COMMIT
# 9. Start server 2 and assert it has 4 transactions
[connection server2]
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/assert.inc [GTID_EXECUTED must have four transactions of view changes]
include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -212,8 +204,6 @@ server-binary-log.000001 # Query # # COMMIT
# 11. Start server 3 and assert it has 5 transactions
[connection server3]
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/assert.inc [GTID_EXECUTED must have five transactions of view changes]
include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
diff --git a/mysql-test/suite/group_replication/r/gr_view_change_uuid_deprecation.result b/mysql-test/suite/group_replication/r/gr_view_change_uuid_deprecation.result
index 0ebc6a2a4bc9..d8ae856e5ef6 100644
--- a/mysql-test/suite/group_replication/r/gr_view_change_uuid_deprecation.result
+++ b/mysql-test/suite/group_replication/r/gr_view_change_uuid_deprecation.result
@@ -27,8 +27,6 @@ Warning 1681 'group_replication_view_change_uuid' is deprecated and will be remo
# group_replication_view_change_uuid is not the default one.
[connection server1]
include/start_and_bootstrap_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
############################################################
# 4. Start Group Replication on server start.
diff --git a/mysql-test/suite/group_replication/r/gr_view_change_uuid_equal_all_members.result b/mysql-test/suite/group_replication/r/gr_view_change_uuid_equal_all_members.result
index 1ed625cbf514..b554f1860017 100644
--- a/mysql-test/suite/group_replication/r/gr_view_change_uuid_equal_all_members.result
+++ b/mysql-test/suite/group_replication/r/gr_view_change_uuid_equal_all_members.result
@@ -15,8 +15,6 @@ Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
SET @@GLOBAL.DEBUG= '+d,group_replication_version_with_vcle';
include/start_and_bootstrap_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
############################################################
# 3. To change view_change_uuid group replication shall be
@@ -48,8 +46,6 @@ SET GLOBAL group_replication_view_change_uuid = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaa
Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
############################################################
# 6. Confirm both server have same GTID.EXECUTED from all
diff --git a/mysql-test/suite/group_replication/r/gr_view_change_uuid_equal_all_members_no_vcle.result b/mysql-test/suite/group_replication/r/gr_view_change_uuid_equal_all_members_no_vcle.result
index 318a33179737..ffeb44bccb52 100644
--- a/mysql-test/suite/group_replication/r/gr_view_change_uuid_equal_all_members_no_vcle.result
+++ b/mysql-test/suite/group_replication/r/gr_view_change_uuid_equal_all_members_no_vcle.result
@@ -14,8 +14,6 @@ SET GLOBAL group_replication_view_change_uuid = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaa
Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
############################################################
# 3. To change view_change_uuid group replication shall be
@@ -33,8 +31,6 @@ Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
SET GLOBAL group_replication_group_name = "GROUP_REPLICATION_GROUP_NAME";
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/stop_group_replication.inc
############################################################
@@ -44,8 +40,6 @@ SET GLOBAL group_replication_view_change_uuid = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaa
Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
############################################################
# 6. Confirm both server have same GTID.EXECUTED the views
diff --git a/mysql-test/suite/group_replication/r/gr_view_change_uuid_no_vcle.result b/mysql-test/suite/group_replication/r/gr_view_change_uuid_no_vcle.result
index 25f7564d53d6..b6bfe16ff217 100644
--- a/mysql-test/suite/group_replication/r/gr_view_change_uuid_no_vcle.result
+++ b/mysql-test/suite/group_replication/r/gr_view_change_uuid_no_vcle.result
@@ -24,8 +24,6 @@ SET GLOBAL group_replication_view_change_uuid = "c0dec0de-c0de-c0de-c0de-c0dec0d
Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/assert.inc [GTID_EXECUTED must have one transaction of view change]
include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -39,8 +37,6 @@ SET GLOBAL group_replication_view_change_uuid = "c0dec0de-c0de-c0de-c0de-c0dec0d
Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/assert.inc [GTID_EXECUTED must have two transactions of view changes]
include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -62,8 +58,6 @@ SET GLOBAL group_replication_view_change_uuid = "c0dec0de-c0de-c0de-c0de-c0dec0d
Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/assert.inc [GTID_EXECUTED must have three transactions of view changes]
include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -106,8 +100,6 @@ server-binary-log.000001 # Previous_gtids # #
# 9. Start server 2 and assert it has 0 transactions
[connection server2]
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/assert.inc [GTID_EXECUTED must have four transactions of view changes]
include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@@ -125,8 +117,6 @@ server-binary-log.000001 # Previous_gtids # #
# 11. Start server 3 and assert it has 0 transactions
[connection server3]
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/assert.inc [GTID_EXECUTED must have five transactions of view changes]
include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
diff --git a/mysql-test/suite/group_replication/r/gr_view_change_uuid_recompute_intervals.result b/mysql-test/suite/group_replication/r/gr_view_change_uuid_recompute_intervals.result
index 1db8cc8b3c8d..f768f53b8dab 100644
--- a/mysql-test/suite/group_replication/r/gr_view_change_uuid_recompute_intervals.result
+++ b/mysql-test/suite/group_replication/r/gr_view_change_uuid_recompute_intervals.result
@@ -13,8 +13,6 @@ Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
SET @@GLOBAL.DEBUG= '+d,group_replication_version_with_vcle';
include/start_and_bootstrap_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
[connection server2]
SET @group_replication_view_change_uuid_save= @@GLOBAL.group_replication_view_change_uuid;
SET GLOBAL group_replication_view_change_uuid = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa";
@@ -22,8 +20,6 @@ Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
SET @@GLOBAL.DEBUG= '+d,group_replication_version_with_vcle';
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
############################################################
# 2. Create a table on server 1 that will add one
@@ -46,8 +42,6 @@ include/stop_group_replication.inc
include/assert.inc [GTID_EXECUTED must contain GTID_EXECUTED 2 transactions]
include/assert.inc [GTID_EXECUTED must contain GTID_EXECUTED 2 view changes]
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
############################################################
# 5. Insert data into table on server 2 that will add one
@@ -75,8 +69,6 @@ SET GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:4';;
INSERT INTO t1 VALUES (2);
[connection server2]
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
############################################################
# 8. Assert the intervals were not used, the new view
diff --git a/mysql-test/suite/group_replication/r/gr_view_change_uuid_recompute_intervals_no_vcle.result b/mysql-test/suite/group_replication/r/gr_view_change_uuid_recompute_intervals_no_vcle.result
index 95d0251e113f..905ea51be00b 100644
--- a/mysql-test/suite/group_replication/r/gr_view_change_uuid_recompute_intervals_no_vcle.result
+++ b/mysql-test/suite/group_replication/r/gr_view_change_uuid_recompute_intervals_no_vcle.result
@@ -12,16 +12,12 @@ SET GLOBAL group_replication_view_change_uuid = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaa
Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
[connection server2]
SET @group_replication_view_change_uuid_save= @@GLOBAL.group_replication_view_change_uuid;
SET GLOBAL group_replication_view_change_uuid = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa";
Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
############################################################
# 2. Create a table on server 1 that will add one
@@ -44,8 +40,6 @@ include/stop_group_replication.inc
include/assert.inc [GTID_EXECUTED must contain GTID_EXECUTED 2 transactions]
include/assert.inc [GTID_EXECUTED must contain GTID_EXECUTED 0 view changes]
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
############################################################
# 5. Insert data into table on server 2 that will add one
@@ -73,8 +67,6 @@ SET GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:4';;
INSERT INTO t1 VALUES (2);
[connection server2]
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
############################################################
# 8. Assert the intervals were not used, the new view
diff --git a/mysql-test/suite/group_replication/r/gr_view_change_uuid_skip_encode.result b/mysql-test/suite/group_replication/r/gr_view_change_uuid_skip_encode.result
index 9b587f3cc7fc..9b05cc30a3a7 100644
--- a/mysql-test/suite/group_replication/r/gr_view_change_uuid_skip_encode.result
+++ b/mysql-test/suite/group_replication/r/gr_view_change_uuid_skip_encode.result
@@ -23,8 +23,6 @@ SET @@GLOBAL.group_replication_view_change_uuid = 'c0dec0de-c0de-c0de-c0de-c0dec
Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/stop_group_replication.inc
############################################################
diff --git a/mysql-test/suite/group_replication/r/gr_view_change_uuid_validation_with_anonymous_server.result b/mysql-test/suite/group_replication/r/gr_view_change_uuid_validation_with_anonymous_server.result
index 8a80d4060251..26d41c17975d 100644
--- a/mysql-test/suite/group_replication/r/gr_view_change_uuid_validation_with_anonymous_server.result
+++ b/mysql-test/suite/group_replication/r/gr_view_change_uuid_validation_with_anonymous_server.result
@@ -12,15 +12,11 @@ SET GLOBAL group_replication_view_change_uuid = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaa
Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/start_and_bootstrap_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
[connection server2]
SET GLOBAL group_replication_view_change_uuid = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa";
Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
############################################################
# 2. Disable GTIDs on server 3
@@ -81,8 +77,6 @@ SET GLOBAL group_replication_view_change_uuid= "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa
Warnings:
Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/start_group_replication.inc
-Warnings:
-Warning 1681 'group_replication_view_change_uuid' is deprecated and will be removed in a future release.
include/rpl/start_replica.inc
###################################################################
diff --git a/mysql-test/suite/group_replication/t/gr_acf_receiver_clone_on_rejoin.test b/mysql-test/suite/group_replication/t/gr_acf_receiver_clone_on_rejoin.test
index 0e48786b9e86..6367cbcd8c9d 100644
--- a/mysql-test/suite/group_replication/t/gr_acf_receiver_clone_on_rejoin.test
+++ b/mysql-test/suite/group_replication/t/gr_acf_receiver_clone_on_rejoin.test
@@ -195,6 +195,7 @@ SET PERSIST local_infile= ON;
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_enforce_update_everywhere_checks=FALSE;
@@ -217,6 +218,7 @@ SET GLOBAL group_replication_clone_threshold= 1;
--replace_result $local_address_server1 LOCAL_ADDRESS_SERVER1 $local_address_server2 LOCAL_ADDRESS_SERVER2 $local_address_server3 LOCAL_ADDRESS_SERVER3
--eval SET GLOBAL GROUP_REPLICATION_GROUP_SEEDS= "$local_address_server1, $local_address_server2, $local_address_server3"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_acf_receiver_network_partition.test b/mysql-test/suite/group_replication/t/gr_acf_receiver_network_partition.test
index 99a2ce906225..b45b84089707 100644
--- a/mysql-test/suite/group_replication/t/gr_acf_receiver_network_partition.test
+++ b/mysql-test/suite/group_replication/t/gr_acf_receiver_network_partition.test
@@ -22,7 +22,8 @@
# 7. Resume server2.
# 8. server1 will update group B membership.
# 9. server2 will also update group B membership.
-# 10. Clean up.
+# 10. Disable failover channels auto-start before cleanup.
+# 11. Clean up.
###############################################################################
--source include/linux.inc
--source include/big_test.inc
@@ -289,7 +290,32 @@ SET SESSION sql_log_bin= 1;
--echo
--echo ############################################################
---echo # 10. Clean up.
+--echo # 10. Disable failover channels auto-start before cleanup.
+--let $rpl_connection_name= server1
+--source include/connection.inc
+
+--let $member_actions_version= `SELECT version FROM performance_schema.replication_group_configuration_version WHERE name='replication_group_member_actions'`
+SELECT group_replication_disable_member_action("mysql_start_failover_channels_if_primary", "AFTER_PRIMARY_ELECTION");
+--inc $member_actions_version
+
+--let $assert_text= The action mysql_start_failover_channels_if_primary must be disabled
+--let $assert_cond= [SELECT enabled FROM performance_schema.replication_group_member_actions WHERE name=\'mysql_start_failover_channels_if_primary\' AND event=\'AFTER_PRIMARY_ELECTION\', enabled, 1] = 0
+--source include/assert.inc
+
+--let $rpl_connection_name= server2
+--source include/connection.inc
+
+--let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.replication_group_configuration_version WHERE name="replication_group_member_actions" AND version=$member_actions_version;
+--source include/wait_condition.inc
+
+--let $assert_text= The action mysql_start_failover_channels_if_primary must be disabled on server2
+--let $assert_cond= [SELECT enabled FROM performance_schema.replication_group_member_actions WHERE name=\'mysql_start_failover_channels_if_primary\' AND event=\'AFTER_PRIMARY_ELECTION\', enabled, 1] = 0
+--source include/assert.inc
+
+
+--echo
+--echo ############################################################
+--echo # 11. Clean up.
--let $rpl_connection_name= server1
--source include/connection.inc
--source include/stop_group_replication.inc
diff --git a/mysql-test/suite/group_replication/t/gr_acf_start_failover_channels_error_on_bootstrap.test b/mysql-test/suite/group_replication/t/gr_acf_start_failover_channels_error_on_bootstrap.test
index b52a9cae7270..08ea8ff0d531 100644
--- a/mysql-test/suite/group_replication/t/gr_acf_start_failover_channels_error_on_bootstrap.test
+++ b/mysql-test/suite/group_replication/t/gr_acf_start_failover_channels_error_on_bootstrap.test
@@ -67,6 +67,7 @@ SET @@GLOBAL.DEBUG='+d,force_error_on_start_failover_channels';
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--source include/gr_set_bootstrap_group.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--let $group_replication_member_state = ERROR
diff --git a/mysql-test/suite/group_replication/t/gr_add_node_with_ill_configurated_stack.test b/mysql-test/suite/group_replication/t/gr_add_node_with_ill_configurated_stack.test
index 8b54cc3bfa17..e0760572550f 100644
--- a/mysql-test/suite/group_replication/t/gr_add_node_with_ill_configurated_stack.test
+++ b/mysql-test/suite/group_replication/t/gr_add_node_with_ill_configurated_stack.test
@@ -56,6 +56,7 @@ SET SESSION sql_log_bin= 1;
--replace_result $server_3_mysql_address GROUP_REPLICATION_SERVER_3_ADDRESS
--eval SET GLOBAL group_replication_local_address= "$server_3_mysql_address"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
SET GLOBAL group_replication_communication_stack= MySQL;
@@ -65,12 +66,14 @@ SET GLOBAL group_replication_communication_stack= MySQL;
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
--echo # 6. Restore server 3 original address
--replace_result $server_3_local_address GROUP_REPLICATION_SERVER_3_LOCAL_ADDRESS
--eval SET GLOBAL group_replication_local_address= "$server_3_local_address"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET GLOBAL group_replication_communication_stack= "$server_3_comm_stack"
--echo # 7. Server 3 must successfully join the group
diff --git a/mysql-test/suite/group_replication/t/gr_add_node_with_same_local_address.test b/mysql-test/suite/group_replication/t/gr_add_node_with_same_local_address.test
index ed7bf79ec3c1..9ff7e4246f24 100644
--- a/mysql-test/suite/group_replication/t/gr_add_node_with_same_local_address.test
+++ b/mysql-test/suite/group_replication/t/gr_add_node_with_same_local_address.test
@@ -54,6 +54,7 @@ SET @local_address_save= @@GLOBAL.group_replication_local_address;
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_applier_channel_reset.test b/mysql-test/suite/group_replication/t/gr_applier_channel_reset.test
index d6915f040956..d7ecc30e7bde 100644
--- a/mysql-test/suite/group_replication/t/gr_applier_channel_reset.test
+++ b/mysql-test/suite/group_replication/t/gr_applier_channel_reset.test
@@ -61,6 +61,7 @@ RESET BINARY LOGS AND GTIDS;
# C. The applier fails and its initialization processes catches the error.
# During the start, it is known that the applier failed so the START
# GROUP_REPLICATION fails with: ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error 0, ER_GROUP_REPLICATION_CONFIGURATION, ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_applier_early_failure.test b/mysql-test/suite/group_replication/t/gr_applier_early_failure.test
index c45e0da6a587..92521c9236f6 100644
--- a/mysql-test/suite/group_replication/t/gr_applier_early_failure.test
+++ b/mysql-test/suite/group_replication/t/gr_applier_early_failure.test
@@ -78,6 +78,7 @@ INSERT INTO t1 VALUES (1);
--source include/stop_group_replication.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error 0, ER_GROUP_REPLICATION_CONFIGURATION, ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_applier_initialization.test b/mysql-test/suite/group_replication/t/gr_applier_initialization.test
index df709545ad94..3b9dbea00830 100644
--- a/mysql-test/suite/group_replication/t/gr_applier_initialization.test
+++ b/mysql-test/suite/group_replication/t/gr_applier_initialization.test
@@ -42,6 +42,7 @@ SET GLOBAL debug= 'd,double_unique_handler';
# This start command will error out due to the double occurrence
# of a singleton handler (applier initialization error).
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
START GROUP_REPLICATION;
@@ -64,6 +65,7 @@ SET @@GLOBAL.DEBUG= 'd,applier_thd_timeout';
STOP GROUP_REPLICATION;
#The start command will fail as the applier is still running
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_auto_increment_start_stop_parallel.test b/mysql-test/suite/group_replication/t/gr_auto_increment_start_stop_parallel.test
index 3d3ab000d2d9..f97824cfe5a0 100644
--- a/mysql-test/suite/group_replication/t/gr_auto_increment_start_stop_parallel.test
+++ b/mysql-test/suite/group_replication/t/gr_auto_increment_start_stop_parallel.test
@@ -97,6 +97,7 @@ while ($transactions <= $max_transactions)
while ($i <= $rpl_num_server)
{
--connection server$i
+ --disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
# verify that there should not be any error
--error 0
--reap
diff --git a/mysql-test/suite/group_replication/t/gr_autorejoin_with_clone_while_recovery_locked.test b/mysql-test/suite/group_replication/t/gr_autorejoin_with_clone_while_recovery_locked.test
index 92214fdb2303..3a87822f69e3 100644
--- a/mysql-test/suite/group_replication/t/gr_autorejoin_with_clone_while_recovery_locked.test
+++ b/mysql-test/suite/group_replication/t/gr_autorejoin_with_clone_while_recovery_locked.test
@@ -102,6 +102,7 @@ SET sql_log_bin=1;
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
--enable_query_log
diff --git a/mysql-test/suite/group_replication/t/gr_certifier_garbage_collection_with_clone.test b/mysql-test/suite/group_replication/t/gr_certifier_garbage_collection_with_clone.test
index d4b02c7c56ec..2f22f4f4ac96 100644
--- a/mysql-test/suite/group_replication/t/gr_certifier_garbage_collection_with_clone.test
+++ b/mysql-test/suite/group_replication/t/gr_certifier_garbage_collection_with_clone.test
@@ -84,6 +84,7 @@ INSERT INTO t1 VALUES (0);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address2"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds2"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
--let $_group_replication_start_on_boot_save = `SELECT @@GLOBAL.group_replication_start_on_boot;`
@@ -105,6 +106,7 @@ SET GLOBAL clone_autotune_concurrency = OFF;
SET GLOBAL clone_max_concurrency = 1;
SET @@GLOBAL.DEBUG='+d,gr_clone_wait';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
SET DEBUG_SYNC = 'now WAIT_FOR gr_clone_paused';
diff --git a/mysql-test/suite/group_replication/t/gr_clone_applier_reset.test b/mysql-test/suite/group_replication/t/gr_clone_applier_reset.test
index 84904a5a1bde..837d6c30ba43 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_applier_reset.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_applier_reset.test
@@ -74,6 +74,7 @@ INSERT INTO t1 VALUES (2);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
@@ -90,6 +91,7 @@ SET GLOBAL group_replication_clone_threshold= 1;
--echo # Joiner must fail to join the group.
--echo
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_clone_applier_stop.test b/mysql-test/suite/group_replication/t/gr_clone_applier_stop.test
index a15660859229..818aa01c4568 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_applier_stop.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_applier_stop.test
@@ -68,6 +68,7 @@ INSERT INTO t1 values (2);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
--enable_query_log
@@ -131,6 +132,7 @@ SET DEBUG_SYNC= 'RESET';
SET @@GLOBAL.DEBUG='+d,gr_clone_wait';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
SET DEBUG_SYNC = 'now WAIT_FOR gr_clone_paused';
@@ -211,6 +213,7 @@ SET @@GLOBAL.DEBUG='+d,dump_thread_before_read_event';
SET @@GLOBAL.DEBUG='+d,gr_run_clone_query_fail_once';
SET GLOBAL group_replication_clone_threshold= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
SET DEBUG_SYNC = 'now WAIT_FOR signal.run_clone_query_waiting';
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_basics.test b/mysql-test/suite/group_replication/t/gr_clone_integration_basics.test
index a8082feef145..7eca2f0f5649 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_basics.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_basics.test
@@ -71,6 +71,7 @@ INSERT INTO t1 VALUES (2);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -97,6 +98,7 @@ SET GTID_NEXT= "AUTOMATIC";
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$errand_transaction_uuid:1";
--source include/assert.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -121,6 +123,7 @@ RESET BINARY LOGS AND GTIDS;
SET GLOBAL group_replication_clone_threshold= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_clone_on_rejoin.test b/mysql-test/suite/group_replication/t/gr_clone_integration_clone_on_rejoin.test
index 8fc5dcbb02b7..c0d7147ac284 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_clone_on_rejoin.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_clone_on_rejoin.test
@@ -90,6 +90,7 @@ SET PERSIST local_infile= ON;
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -107,6 +108,7 @@ SET PERSIST group_replication_start_on_boot= ON;
--let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold`
SET GLOBAL group_replication_clone_threshold= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_clone_on_server_start.test b/mysql-test/suite/group_replication/t/gr_clone_integration_clone_on_server_start.test
index 7bdb409ede41..3c3ec715814b 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_clone_on_server_start.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_clone_on_server_start.test
@@ -77,6 +77,7 @@ RESET REPLICA ALL;
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_clone_operations_on_runnning_member.test b/mysql-test/suite/group_replication/t/gr_clone_integration_clone_operations_on_runnning_member.test
index c6c856072a07..4d15cca99428 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_clone_operations_on_runnning_member.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_clone_operations_on_runnning_member.test
@@ -73,6 +73,7 @@ INSERT INTO t1 VALUES (1);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_concurrent_shutdown.test b/mysql-test/suite/group_replication/t/gr_clone_integration_concurrent_shutdown.test
index 2e976aec3e96..a54e1322cde1 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_concurrent_shutdown.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_concurrent_shutdown.test
@@ -77,6 +77,7 @@ SET @@GLOBAL.DEBUG='+d,gr_clone_wait';
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
SET DEBUG_SYNC = 'now WAIT_FOR gr_clone_paused';
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_ddl_error.test b/mysql-test/suite/group_replication/t/gr_clone_integration_ddl_error.test
index 15e1fc53229c..fafd3eb4bf49 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_ddl_error.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_ddl_error.test
@@ -69,6 +69,7 @@ INSERT INTO t1 VALUES (2);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
--let $_group_replication_start_on_boot_save= `SELECT @@GLOBAL.group_replication_start_on_boot`
@@ -93,6 +94,7 @@ SET GLOBAL clone_ddl_timeout = 0;
SET @@GLOBAL.DEBUG='+d,gr_clone_wait';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
SET DEBUG_SYNC = 'now WAIT_FOR gr_clone_paused';
@@ -137,6 +139,7 @@ SET DEBUG_SYNC = 'now SIGNAL gr_clone_continue';
--source include/stop_group_replication.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_different_recovery_user.test b/mysql-test/suite/group_replication/t/gr_clone_integration_different_recovery_user.test
index 22bdd977c6c5..46fe7d6a7903 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_different_recovery_user.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_different_recovery_user.test
@@ -89,6 +89,7 @@ SET PERSIST group_replication_recovery_retry_count= 1;
SET GLOBAL group_replication_clone_threshold= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_exit_state_action_on_clone_error.test b/mysql-test/suite/group_replication/t/gr_clone_integration_exit_state_action_on_clone_error.test
index 75cb1ca40944..de6025e4c7a1 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_exit_state_action_on_clone_error.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_exit_state_action_on_clone_error.test
@@ -95,6 +95,7 @@ SET @@GLOBAL.group_replication_exit_state_action = ABORT_SERVER;
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_kill_donor_during_clone.test b/mysql-test/suite/group_replication/t/gr_clone_integration_kill_donor_during_clone.test
index f3b0c2c6ae56..2ec33af58f58 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_kill_donor_during_clone.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_kill_donor_during_clone.test
@@ -89,6 +89,7 @@ INSERT INTO t1 VALUES (2);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address2"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds2"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -109,6 +110,7 @@ SET GLOBAL clone_autotune_concurrency = OFF;
SET GLOBAL clone_max_concurrency = 1;
SET @@GLOBAL.DEBUG='+d,gr_clone_wait';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
SET DEBUG_SYNC = 'now WAIT_FOR gr_clone_paused';
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_no_managed_restart.test b/mysql-test/suite/group_replication/t/gr_clone_integration_no_managed_restart.test
index 804485e7d049..e13f1abb967d 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_no_managed_restart.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_no_managed_restart.test
@@ -79,6 +79,7 @@ SET PERSIST group_replication_start_on_boot= ON;
--let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold`
SET GLOBAL group_replication_clone_threshold= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_no_privileges.test b/mysql-test/suite/group_replication/t/gr_clone_integration_no_privileges.test
index bb1a44b17b9c..7cb647187f7d 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_no_privileges.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_no_privileges.test
@@ -87,6 +87,7 @@ SET SESSION sql_log_bin= 1;
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
--enable_query_log
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_purged_donor.test b/mysql-test/suite/group_replication/t/gr_clone_integration_purged_donor.test
index b8c87d78dbd8..6263e46bfb04 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_purged_donor.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_purged_donor.test
@@ -85,6 +85,7 @@ FLUSH BINARY LOGS;
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
--enable_query_log
@@ -95,6 +96,7 @@ FLUSH BINARY LOGS;
--echo # from binary logs is not possible.
--echo # As a test variation, do not start on boot after cloning
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_recovery_priv_user_preservation.test b/mysql-test/suite/group_replication/t/gr_clone_integration_recovery_priv_user_preservation.test
index 3e2e1b46b0a9..71ad6b646110 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_recovery_priv_user_preservation.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_recovery_priv_user_preservation.test
@@ -80,6 +80,7 @@ INSERT INTO db1.t1 VALUES (1);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -96,6 +97,7 @@ SET PERSIST group_replication_start_on_boot= ON;
--let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold`
SET GLOBAL group_replication_clone_threshold= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_start_gr_during_user_clone.test b/mysql-test/suite/group_replication/t/gr_clone_integration_start_gr_during_user_clone.test
index b451e702f356..9cd2c92f031c 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_start_gr_during_user_clone.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_start_gr_during_user_clone.test
@@ -68,6 +68,7 @@ INSERT INTO t1 VALUES (2);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
--enable_query_log
@@ -98,6 +99,7 @@ SET DEBUG_SYNC = 'now WAIT_FOR clone_paused';
--echo ############################################################
--echo # 5. Verify that GR cannot be started while clone is ongoing.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMAND_FAILURE
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_stop_donor_during_clone.test b/mysql-test/suite/group_replication/t/gr_clone_integration_stop_donor_during_clone.test
index 118509c8229d..e5cb08c556dd 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_stop_donor_during_clone.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_stop_donor_during_clone.test
@@ -76,6 +76,7 @@ INSERT INTO t1 VALUES (2);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -96,6 +97,7 @@ SET GLOBAL clone_autotune_concurrency = OFF;
SET GLOBAL clone_max_concurrency = 1;
SET @@GLOBAL.DEBUG='+d,gr_clone_wait';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
SET DEBUG_SYNC = 'now WAIT_FOR gr_clone_paused';
@@ -147,6 +149,7 @@ SET @@GLOBAL.DEBUG = '-d,gr_clone_wait';
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_stop_donor_during_clone_failover.test b/mysql-test/suite/group_replication/t/gr_clone_integration_stop_donor_during_clone_failover.test
index 815ad04a5028..766d89e42019 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_stop_donor_during_clone_failover.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_stop_donor_during_clone_failover.test
@@ -101,6 +101,7 @@ INSERT INTO t1 VALUES (2);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address2"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds2"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -121,6 +122,7 @@ SET GLOBAL clone_autotune_concurrency = OFF;
SET GLOBAL clone_max_concurrency = 1;
SET @@GLOBAL.DEBUG='+d,gr_clone_wait';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
SET DEBUG_SYNC = 'now WAIT_FOR gr_clone_paused';
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_stop_joiner_during_clone.test b/mysql-test/suite/group_replication/t/gr_clone_integration_stop_joiner_during_clone.test
index eb9522806b60..c170a19ec93b 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_stop_joiner_during_clone.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_stop_joiner_during_clone.test
@@ -82,6 +82,7 @@ INSERT INTO t1 VALUES (2);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -102,6 +103,7 @@ SET GLOBAL clone_autotune_concurrency = OFF;
SET GLOBAL clone_max_concurrency = 1;
SET @@GLOBAL.DEBUG='+d,gr_clone_wait';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
SET DEBUG_SYNC = 'now WAIT_FOR gr_clone_paused';
@@ -139,6 +141,7 @@ SET DEBUG_SYNC = 'now WAIT_FOR gr_clone_paused';
SET DEBUG_SYNC = 'RESET';
SET @@GLOBAL.DEBUG = '-d,gr_clone_wait';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_clone_integration_stop_primary_member.test b/mysql-test/suite/group_replication/t/gr_clone_integration_stop_primary_member.test
index e416ca43cfe0..d410a51527fa 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_integration_stop_primary_member.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_integration_stop_primary_member.test
@@ -94,6 +94,7 @@ SET PERSIST group_replication_single_primary_mode= ON;
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address2"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds2"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -112,6 +113,7 @@ SET GLOBAL group_replication_clone_threshold= 1;
SET @@GLOBAL.DEBUG='+d,gr_clone_process_before_execution';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
SET DEBUG_SYNC = 'now WAIT_FOR signal.gr_clone_thd_paused';
diff --git a/mysql-test/suite/group_replication/t/gr_clone_multi_version_single_valid_donor.test b/mysql-test/suite/group_replication/t/gr_clone_multi_version_single_valid_donor.test
index 599d8975ea50..52cd95e52b7e 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_multi_version_single_valid_donor.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_multi_version_single_valid_donor.test
@@ -121,6 +121,7 @@ SET @@GLOBAL.DEBUG='+d,group_replication_compatibility_higher_patch_version';
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address2"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds2"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
diff --git a/mysql-test/suite/group_replication/t/gr_clone_with_consistency_after.test b/mysql-test/suite/group_replication/t/gr_clone_with_consistency_after.test
index 9de1032eb5f7..08d664ae9640 100644
--- a/mysql-test/suite/group_replication/t/gr_clone_with_consistency_after.test
+++ b/mysql-test/suite/group_replication/t/gr_clone_with_consistency_after.test
@@ -75,6 +75,7 @@ SET PERSIST group_replication_consistency= AFTER;
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -96,6 +97,7 @@ SET GLOBAL group_replication_clone_threshold= 1;
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_consistency]" = "AFTER"
--source include/assert.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_command_line_recovery_ssl_validation.test b/mysql-test/suite/group_replication/t/gr_command_line_recovery_ssl_validation.test
index b75cf20ce1a8..a40b900056aa 100644
--- a/mysql-test/suite/group_replication/t/gr_command_line_recovery_ssl_validation.test
+++ b/mysql-test/suite/group_replication/t/gr_command_line_recovery_ssl_validation.test
@@ -23,6 +23,7 @@ SET SESSION sql_log_bin= 1;
# Starting the group. This should fail as the group_replication_recovery_user
# is set to a invalid value in the configuration file.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_communication_configuration.test b/mysql-test/suite/group_replication/t/gr_communication_configuration.test
index cdcc5c73be95..d47071497592 100644
--- a/mysql-test/suite/group_replication/t/gr_communication_configuration.test
+++ b/mysql-test/suite/group_replication/t/gr_communication_configuration.test
@@ -120,6 +120,7 @@ SET GLOBAL group_replication_bootstrap_group= 1.2;
--echo # communication engine parameter, start must fail.
--let $rpl_connection_name= server1
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
START GROUP_REPLICATION;
@@ -135,6 +136,7 @@ START GROUP_REPLICATION;
SET GLOBAL group_replication_bootstrap_group= 1;
SET GLOBAL group_replication_local_address= "";
SET GLOBAL group_replication_group_seeds= "";
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
START GROUP_REPLICATION;
@@ -150,6 +152,7 @@ START GROUP_REPLICATION;
SET GLOBAL group_replication_bootstrap_group= 0;
SET GLOBAL group_replication_local_address= "ola";
SET GLOBAL group_replication_group_seeds= "";
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
START GROUP_REPLICATION;
@@ -165,6 +168,7 @@ START GROUP_REPLICATION;
SET GLOBAL group_replication_bootstrap_group= 0;
SET GLOBAL group_replication_local_address= @local_address;
SET GLOBAL group_replication_group_seeds= "";
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_JOIN_ERROR
START GROUP_REPLICATION;
@@ -181,6 +185,7 @@ START GROUP_REPLICATION;
SET GLOBAL group_replication_bootstrap_group= 1;
SET GLOBAL group_replication_local_address= "";
SET GLOBAL group_replication_group_seeds= @group_seeds;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
START GROUP_REPLICATION;
@@ -215,6 +220,7 @@ CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_PASSWORD='' FOR CHANNEL
SET GLOBAL group_replication_bootstrap_group= 0;
SET GLOBAL group_replication_local_address= @local_address;
SET GLOBAL group_replication_group_seeds= "ola";
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
START GROUP_REPLICATION;
@@ -233,6 +239,7 @@ SET GLOBAL group_replication_local_address= @local_address;
--disable_query_log
--eval SET GLOBAL group_replication_group_seeds= "$invalid"
--enable_query_log
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
START GROUP_REPLICATION;
@@ -249,6 +256,7 @@ START GROUP_REPLICATION;
SET GLOBAL group_replication_bootstrap_group= 0;
SET GLOBAL group_replication_local_address= NULL;
SET GLOBAL group_replication_group_seeds= NULL;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_communication_stack_deprecation.test b/mysql-test/suite/group_replication/t/gr_communication_stack_deprecation.test
new file mode 100644
index 000000000000..48ffa35ced8c
--- /dev/null
+++ b/mysql-test/suite/group_replication/t/gr_communication_stack_deprecation.test
@@ -0,0 +1,108 @@
+################################################################################
+# This test verifies that a deprecation warning is thrown/logged when
+# group_replication_communication_stack variable is used.
+#
+# Test:
+# 0. The test requires one server: server1.
+# 1. Set group_replication_communication_stack to MYSQL.
+# No deprecation warning is thrown on the client session.
+# 2. Set group_replication_communication_stack to XCOM.
+# A deprecation warning is thrown on the client session.
+# 3. Start Group Replication from client session.
+# A deprecation warning is thrown on the client session because
+# group_replication_communication_stack is XCOM.
+# 4. Start Group Replication on server start.
+# A deprecation warning is logged on the error log because
+# group_replication_communication_stack is XCOM.
+# 5. Cleanup.
+################################################################################
+--source include/big_test.inc
+--source include/have_group_replication_xcom_communication_stack.inc
+--source include/have_group_replication_plugin.inc
+--let $rpl_skip_group_replication_start= 1
+--source include/group_replication.inc
+
+
+--echo
+--echo ############################################################
+--echo # 1. Set group_replication_communication_stack to MYSQL.
+--echo # No deprecation warning is thrown on the client session.
+
+
+--let $rpl_connection_name= server1
+--source include/connection.inc
+
+--let $sysvars_to_save = [ "GLOBAL.group_replication_communication_stack" ]
+--source include/save_sysvars.inc
+
+SET @@GLOBAL.group_replication_communication_stack= "MYSQL";
+
+
+--echo
+--echo ############################################################
+--echo # 2. Set group_replication_communication_stack to XCOM.
+--echo # A deprecation warning is thrown on the client session.
+
+--let $rpl_connection_name= server1
+--source include/connection.inc
+
+SET @@GLOBAL.group_replication_communication_stack= "XCOM";
+
+--echo
+--echo ############################################################
+--echo # 3. Start Group Replication from client session.
+--echo # A deprecation warning is thrown on the client session because
+--echo # group_replication_communication_stack is XCOM.
+
+--let $rpl_connection_name= server1
+--source include/connection.inc
+
+--let $warning_count= query_get_value(SELECT COUNT(*) AS COUNT FROM performance_schema.error_log WHERE error_code='MY-011068' AND data LIKE '%The syntax \'group_replication_communication_stack=XCOM\' is deprecated and will be removed in a future release.%', COUNT, 1)
+
+--source include/start_and_bootstrap_group_replication.inc
+
+--let $wait_condition= SELECT COUNT(*)=$warning_count FROM performance_schema.error_log WHERE error_code='MY-011068' AND data LIKE '%The syntax \'group_replication_communication_stack=XCOM\' is deprecated and will be removed in a future release.%'
+--source include/wait_condition.inc
+
+
+--echo
+--echo ############################################################
+--echo # 4. Start Group Replication on server start.
+--echo # A deprecation warning is logged on the error log because
+--echo # group_replication_communication_stack is XCOM.
+
+--let $rpl_connection_name= server1
+--source include/connection.inc
+
+--let $warning_count= query_get_value(SELECT COUNT(*) AS COUNT FROM performance_schema.error_log WHERE error_code='MY-011068' AND data LIKE '%The syntax \'group_replication_communication_stack=XCOM\' is deprecated and will be removed in a future release.%', COUNT, 1)
+
+--let $allow_rpl_inited=1
+--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
+--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
+--let $restart_parameters=restart:--group_replication_group_name=$group_replication_group_name --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_bootstrap_group=1 --group_replication_start_on_boot=1 --group_replication_communication_stack=XCOM
+--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
+--source include/restart_mysqld.inc
+
+--let $rpl_server_number= 1
+--source include/rpl/reconnect.inc
+--let $group_replication_member_state= ONLINE
+--source include/gr_wait_for_member_state.inc
+
+--inc $warning_count
+--let $wait_condition= SELECT COUNT(*)=$warning_count FROM performance_schema.error_log WHERE error_code='MY-011068' AND data LIKE '%The syntax \'group_replication_communication_stack=XCOM\' is deprecated and will be removed in a future release.%'
+--source include/wait_condition.inc
+
+
+--echo
+--echo ############################################################
+--echo # 5. Cleanup.
+
+--let $rpl_connection_name= server1
+--source include/connection.inc
+
+--source include/stop_group_replication.inc
+--disable_warnings
+--source include/restore_sysvars.inc
+--enable_warnings
+
+--source include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/t/gr_communication_stack_option.test b/mysql-test/suite/group_replication/t/gr_communication_stack_option.test
new file mode 100644
index 000000000000..2ef5d9eda419
--- /dev/null
+++ b/mysql-test/suite/group_replication/t/gr_communication_stack_option.test
@@ -0,0 +1,47 @@
+################################################################################
+# This test verifies that group_replication_communication_stack accepts numeric
+# enum values.
+#
+# Test:
+# 0. The test requires one server.
+# 1. Set group_replication_communication_stack to 1 and assert it is MySQL.
+# 2. Set group_replication_communication_stack to 0 and assert it is XCom.
+# 3. Set group_replication_communication_stack to NULL, it must fail.
+# 4. Set group_replication_communication_stack to invalid value, it must fail.
+# 5. Cleanup.
+################################################################################
+
+--source include/have_group_replication_plugin_base.inc
+
+SET @group_replication_communication_stack_saved= @@GLOBAL.group_replication_communication_stack;
+
+SET @@GLOBAL.group_replication_communication_stack= 1;
+--let $assert_text= Numeric value 1 sets group_replication_communication_stack to MySQL
+--let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_stack]" = "MySQL"
+--source include/assert.inc
+
+SET @@GLOBAL.group_replication_communication_stack= 0;
+--let $assert_text= Numeric value 0 sets group_replication_communication_stack to XCom
+--let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_stack]" = "XCom"
+--source include/assert.inc
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@GLOBAL.group_replication_communication_stack= NULL;
+--let $assert_text= group_replication_communication_stack value must remain XCom
+--let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_stack]" = "XCom"
+--source include/assert.inc
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@GLOBAL.group_replication_communication_stack= "OLA";
+--let $assert_text= group_replication_communication_stack value must remain XCom
+--let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_stack]" = "XCom"
+--source include/assert.inc
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@GLOBAL.group_replication_communication_stack= 10;
+--let $assert_text= group_replication_communication_stack value must remain XCom
+--let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_stack]" = "XCom"
+--source include/assert.inc
+
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
+SET @@GLOBAL.group_replication_communication_stack= @group_replication_communication_stack_saved;
diff --git a/mysql-test/suite/group_replication/t/gr_compatibility_rules.test b/mysql-test/suite/group_replication/t/gr_compatibility_rules.test
index 7edd12aba52e..0b70257b8af2 100644
--- a/mysql-test/suite/group_replication/t/gr_compatibility_rules.test
+++ b/mysql-test/suite/group_replication/t/gr_compatibility_rules.test
@@ -50,6 +50,7 @@ SET @@GLOBAL.DEBUG= '+d,group_replication_compatibility_higher_patch_version';
SET GLOBAL group_replication_group_name= "6db14550-03bb-11e5-b939-0800200c9a66";
# The start will fail as the node is declared incompatible with the group
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_compatibility_rules_lts_spm.test b/mysql-test/suite/group_replication/t/gr_compatibility_rules_lts_spm.test
index cb9a496c83af..80bcffd5deb8 100644
--- a/mysql-test/suite/group_replication/t/gr_compatibility_rules_lts_spm.test
+++ b/mysql-test/suite/group_replication/t/gr_compatibility_rules_lts_spm.test
@@ -230,6 +230,7 @@ SET SESSION sql_log_bin= 0;
call mtr.add_suppression("Member version is incompatible with the group.");
SET SESSION sql_log_bin= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_concurrent_start_uninstall.test b/mysql-test/suite/group_replication/t/gr_concurrent_start_uninstall.test
index de8a5b41104d..0a300dfa15e3 100644
--- a/mysql-test/suite/group_replication/t/gr_concurrent_start_uninstall.test
+++ b/mysql-test/suite/group_replication/t/gr_concurrent_start_uninstall.test
@@ -60,6 +60,7 @@ SET DEBUG_SYNC= 'now SIGNAL signal.start_continue';
--let $rpl_connection_name= server1
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--reap
--echo
diff --git a/mysql-test/suite/group_replication/t/gr_concurrent_uninstall_start.test b/mysql-test/suite/group_replication/t/gr_concurrent_uninstall_start.test
index 089781b9c9dc..5c956b2ec708 100644
--- a/mysql-test/suite/group_replication/t/gr_concurrent_uninstall_start.test
+++ b/mysql-test/suite/group_replication/t/gr_concurrent_uninstall_start.test
@@ -38,6 +38,7 @@ SET SESSION sql_log_bin= 1;
--echo #
--echo # START GROUP_REPLICATION in parallel,
--echo #
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION, ER_GROUP_REPLICATION_RUNNING
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_crash_recovery_server.test b/mysql-test/suite/group_replication/t/gr_crash_recovery_server.test
index cc3b0fbb7844..2918dbf12755 100644
--- a/mysql-test/suite/group_replication/t/gr_crash_recovery_server.test
+++ b/mysql-test/suite/group_replication/t/gr_crash_recovery_server.test
@@ -161,6 +161,7 @@ LOCK TABLES t1 READ;
--let $rpl_connection_name= server_3
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
start group_replication;
--let $group_replication_member_state= RECOVERING
diff --git a/mysql-test/suite/group_replication/t/gr_crash_server_id.test b/mysql-test/suite/group_replication/t/gr_crash_server_id.test
index dc7f9cd23377..f13dd553cbdd 100644
--- a/mysql-test/suite/group_replication/t/gr_crash_server_id.test
+++ b/mysql-test/suite/group_replication/t/gr_crash_server_id.test
@@ -26,6 +26,7 @@ call mtr.add_suppression("It was not possible to identify the group replication
SET SESSION sql_log_bin=1;
SET GLOBAL server_id=0;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_BAD_REPLICA, ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_cross_version_member_join.test b/mysql-test/suite/group_replication/t/gr_cross_version_member_join.test
index 95da5d2450ea..791f4fa4d902 100644
--- a/mysql-test/suite/group_replication/t/gr_cross_version_member_join.test
+++ b/mysql-test/suite/group_replication/t/gr_cross_version_member_join.test
@@ -56,6 +56,7 @@ SET @@GLOBAL.DEBUG= 'd,group_replication_compatibility_lower_major_version';
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -68,6 +69,7 @@ START GROUP_REPLICATION;
SET @@GLOBAL.DEBUG= 'd,group_replication_compatibility_lower_minor_version';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_default_table_encryption.test b/mysql-test/suite/group_replication/t/gr_default_table_encryption.test
index 047adf3ad4b9..b36785061ac4 100644
--- a/mysql-test/suite/group_replication/t/gr_default_table_encryption.test
+++ b/mysql-test/suite/group_replication/t/gr_default_table_encryption.test
@@ -54,6 +54,7 @@ SET SESSION sql_log_bin = 1;
SET @table_encryption_default= @@GLOBAL.default_table_encryption;
SET @@GLOBAL.default_table_encryption = OFF;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_default_table_encryption_skip_encode.test b/mysql-test/suite/group_replication/t/gr_default_table_encryption_skip_encode.test
index 315e2b745df3..0e3661a22b43 100644
--- a/mysql-test/suite/group_replication/t/gr_default_table_encryption_skip_encode.test
+++ b/mysql-test/suite/group_replication/t/gr_default_table_encryption_skip_encode.test
@@ -50,6 +50,7 @@ SET SESSION sql_log_bin = 1;
SET @table_encryption_default= @@GLOBAL.default_table_encryption;
SET @@GLOBAL.default_table_encryption = ON;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_executed_sets_compatibility.test b/mysql-test/suite/group_replication/t/gr_executed_sets_compatibility.test
index abb084b0c05c..8f3b10916c74 100644
--- a/mysql-test/suite/group_replication/t/gr_executed_sets_compatibility.test
+++ b/mysql-test/suite/group_replication/t/gr_executed_sets_compatibility.test
@@ -83,6 +83,7 @@ SET GTID_NEXT= "AUTOMATIC";
--source include/assert.inc
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -126,6 +127,7 @@ RESET BINARY LOGS AND GTIDS;
--source include/assert.inc
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_exit_state_action_on_start_gr_cmd.test b/mysql-test/suite/group_replication/t/gr_exit_state_action_on_start_gr_cmd.test
index 92b7b98ed48c..a126ba327209 100644
--- a/mysql-test/suite/group_replication/t/gr_exit_state_action_on_start_gr_cmd.test
+++ b/mysql-test/suite/group_replication/t/gr_exit_state_action_on_start_gr_cmd.test
@@ -70,6 +70,7 @@ SET @exit_state_action_saved = @@GLOBAL.group_replication_exit_state_action;
--enable_query_log
# We expect a config error since this server's version is different from the
# group
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -115,6 +116,7 @@ SET @@GLOBAL.group_replication_exit_state_action = ABORT_SERVER;
# We must restart GR to trigger another join
# We expect a config error since this server's version is different from the
# group
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_exit_state_action_on_start_gr_cmd_offline_mode.test b/mysql-test/suite/group_replication/t/gr_exit_state_action_on_start_gr_cmd_offline_mode.test
index 5c7a727104db..0a2aa3b722ef 100644
--- a/mysql-test/suite/group_replication/t/gr_exit_state_action_on_start_gr_cmd_offline_mode.test
+++ b/mysql-test/suite/group_replication/t/gr_exit_state_action_on_start_gr_cmd_offline_mode.test
@@ -62,6 +62,7 @@ SET @super_read_only_saved = @@GLOBAL.super_read_only;
--enable_query_log
# We expect a config error since this server's version is different from the
# group
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_failed_second_node_boot_without_majority_loss.test b/mysql-test/suite/group_replication/t/gr_failed_second_node_boot_without_majority_loss.test
index 4533d683af67..5ef407da184b 100644
--- a/mysql-test/suite/group_replication/t/gr_failed_second_node_boot_without_majority_loss.test
+++ b/mysql-test/suite/group_replication/t/gr_failed_second_node_boot_without_majority_loss.test
@@ -110,6 +110,7 @@ CHANGE REPLICATION SOURCE TO SOURCE_USER='user_m2' , SOURCE_PASSWORD='password'
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_failed_server_mysql_connection.test b/mysql-test/suite/group_replication/t/gr_failed_server_mysql_connection.test
index 728d08b38d5d..f41cee432409 100644
--- a/mysql-test/suite/group_replication/t/gr_failed_server_mysql_connection.test
+++ b/mysql-test/suite/group_replication/t/gr_failed_server_mysql_connection.test
@@ -68,6 +68,7 @@ call mtr.add_suppression("Error connecting to all peers. Member join failed. Loc
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_filter_crash.test b/mysql-test/suite/group_replication/t/gr_filter_crash.test
index 032fa66a01a4..58112dbe5355 100644
--- a/mysql-test/suite/group_replication/t/gr_filter_crash.test
+++ b/mysql-test/suite/group_replication/t/gr_filter_crash.test
@@ -47,6 +47,7 @@ SET @@GLOBAL.DEBUG='+d,dump_thread_before_read_event';
--let rpl_connection_name= server_2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--echo # Wait until donor is confirmed
diff --git a/mysql-test/suite/group_replication/t/gr_flow_control_options.test b/mysql-test/suite/group_replication/t/gr_flow_control_options.test
index b40dc82f9a3d..ba6daa17673b 100644
--- a/mysql-test/suite/group_replication/t/gr_flow_control_options.test
+++ b/mysql-test/suite/group_replication/t/gr_flow_control_options.test
@@ -488,6 +488,7 @@ set session sql_log_bin=1;
--replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--source include/restart_mysqld.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -496,6 +497,7 @@ START GROUP_REPLICATION;
--replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--source include/restart_mysqld.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -504,6 +506,7 @@ START GROUP_REPLICATION;
--replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--source include/restart_mysqld.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_force_peer_addresses_option.test b/mysql-test/suite/group_replication/t/gr_force_peer_addresses_option.test
index 045e69993eb9..f44d5f6abf48 100644
--- a/mysql-test/suite/group_replication/t/gr_force_peer_addresses_option.test
+++ b/mysql-test/suite/group_replication/t/gr_force_peer_addresses_option.test
@@ -185,6 +185,7 @@ SET DEBUG_SYNC= 'RESET';
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_force_members]" = "127.0.0.1:10000"
--source include/assert.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_gcs_debug_trace_auto_rotation.test b/mysql-test/suite/group_replication/t/gr_gcs_debug_trace_auto_rotation.test
new file mode 100644
index 000000000000..5b7226831906
--- /dev/null
+++ b/mysql-test/suite/group_replication/t/gr_gcs_debug_trace_auto_rotation.test
@@ -0,0 +1,168 @@
+################################################################################
+#
+# This test confirms AUTOMATIC rotation of the GCS_DEBUG_TRACE file.
+#
+# When group_replication_communication_debug_max_file_size > 0:
+# - Every file (including the first) gets a timestamp in its name:
+# GCS_DEBUG_TRACE.YYYYMMDDTHHMMSS (UTC)
+# - Rotation creates a new timestamped file; the old file is left in place
+# (no archiving/renaming -- same model as binary logs).
+# - Each START GROUP_REPLICATION also opens a fresh timestamped file.
+#
+# Test steps:
+# 1. Set communication_debug_max_file_size and start GR.
+# Trace file with timestamp are created.
+# 2. Size-based rotation: old file stays, new timestamped file appears.
+# 3. Restart Group Replication: another new timestamped file is created.
+# 4. Group Replication is ONLINE.
+# 5. Cleanup.
+################################################################################
+
+--source include/have_group_replication_plugin.inc
+--let $rpl_skip_group_replication_start= 1
+--source include/group_replication.inc
+
+--connection server1
+
+--echo
+--echo # 1. Set communication_debug_max_file_size and start GR.
+--echo # Trace file with timestamp are created.
+
+--error 0,1
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
+SET GLOBAL group_replication_communication_debug_max_file_size = 200;
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_ALL";
+--source include/start_and_bootstrap_group_replication.inc
+
+# Confirm file with timestamp was created.
+perl;
+ use strict;
+ use File::Glob ':glob';
+ my $dir = "$ENV{MYSQLTEST_VARDIR}/mysqld.1/data";
+ my $deadline = time() + 30;
+ my @files;
+ while (time() < $deadline) {
+ @files = bsd_glob("$dir/GCS_DEBUG_TRACE.[0-9]*");
+ last if @files;
+ select(undef, undef, undef, 0.5);
+ }
+ die "ERROR: no timestamped GCS_DEBUG_TRACE.* file appeared within 30s\n"
+ unless @files;
+ print "Initial trace file is timestamped, as expected\n";
+
+ die "ERROR: plain GCS_DEBUG_TRACE must not be created when max_file_size > 0\n"
+ if -f "$dir/GCS_DEBUG_TRACE";
+ print "No plain GCS_DEBUG_TRACE created, as expected\n";
+
+ # Save first file path for step 2
+ my $out = "$ENV{MYSQLTEST_VARDIR}/tmp/gcs_first_file.txt";
+ open(my $fh, '>', $out) or die "Cannot write $out: $!\n";
+ print $fh $files[0] . "\n";
+ close $fh;
+EOF
+
+--echo
+--echo # 2. Size-based rotation: old file stays, new timestamped file created.
+
+# Confirm some new trace file was created due to rotation.
+perl;
+ use strict;
+ use File::Glob ':glob';
+ my $dir = "$ENV{MYSQLTEST_VARDIR}/mysqld.1/data";
+
+ # Retrieve first file saved in step 1
+ my $in = "$ENV{MYSQLTEST_VARDIR}/tmp/gcs_first_file.txt";
+ open(my $fh, '<', $in) or die "Cannot open $in: $!\n";
+ my $first_file = <$fh>;
+ chomp $first_file;
+ close $fh;
+
+ # Wait for a second timestamped file (rotation at 200-byte threshold)
+ my $deadline = time() + 30;
+ my @files;
+ while (time() < $deadline) {
+ @files = bsd_glob("$dir/GCS_DEBUG_TRACE.[0-9]*");
+ last if scalar(@files) >= 2;
+ select(undef, undef, undef, 0.5);
+ }
+ die "ERROR: size-based rotation did not produce a second file within 30s\n"
+ unless scalar(@files) >= 2;
+ print "Size-based rotation created a new timestamped file, as expected\n";
+
+ # Old file must still be present -- no archiving or renaming
+ die "ERROR: original file '$first_file' was removed after rotation " .
+ "(archiving must not happen)\n"
+ unless -f $first_file;
+ print "Original file still exists after rotation (no archiving), as expected\n";
+EOF
+
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_NONE";
+
+--echo
+--echo # 3. Restart Group Replication -- a new timestamped file is created on start.
+
+# Not number of files before restart
+perl;
+ use strict;
+ use File::Glob ':glob';
+ my $dir = "$ENV{MYSQLTEST_VARDIR}/mysqld.1/data";
+ my @files = bsd_glob("$dir/GCS_DEBUG_TRACE.[0-9]*");
+ my $out = "$ENV{MYSQLTEST_VARDIR}/tmp/gcs_count_before_restart.txt";
+ open(my $fh, '>', $out) or die "Cannot write $out: $!\n";
+ print $fh scalar(@files) . "\n";
+ close $fh;
+ print "Recorded file count before restart\n";
+EOF
+
+--source include/stop_group_replication.inc
+--source include/start_and_bootstrap_group_replication.inc
+
+# Confirm more GCS_DEBUG_TRACE.* file exists post restart
+perl;
+ use strict;
+ use File::Glob ':glob';
+ my $in = "$ENV{MYSQLTEST_VARDIR}/tmp/gcs_count_before_restart.txt";
+ open(my $fh, '<', $in) or die "Cannot open $in: $!\n";
+ my $before = int(<$fh>);
+ close $fh;
+
+ my $dir = "$ENV{MYSQLTEST_VARDIR}/mysqld.1/data";
+ my $deadline = time() + 30;
+ my @files;
+ while (time() < $deadline) {
+ @files = bsd_glob("$dir/GCS_DEBUG_TRACE.[0-9]*");
+ last if scalar(@files) > $before;
+ select(undef, undef, undef, 0.5);
+ }
+ die "ERROR: expected a new timestamped file on GR restart " .
+ "(before=$before, after=" . scalar(@files) . ")\n"
+ unless scalar(@files) > $before;
+ print "New timestamped file created on GR restart, as expected\n";
+EOF
+
+--echo
+--echo # 4. Group Replication is ONLINE.
+
+--let $assert_text= Member is ONLINE after automatic rotation
+--let $assert_cond= COUNT(*) = 1 FROM performance_schema.replication_group_members WHERE MEMBER_STATE = "ONLINE"
+--source include/assert.inc
+
+--echo
+--echo # 5. Cleanup.
+
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_NONE";
+SET GLOBAL group_replication_communication_debug_max_file_size = 0;
+--source include/stop_group_replication.inc
+perl;
+ use strict;
+ use File::Glob ':glob';
+ my $dir = "$ENV{MYSQLTEST_VARDIR}/mysqld.1/data";
+ for my $f (bsd_glob("$dir/GCS_DEBUG_TRACE*")) {
+ unlink $f or warn "Could not remove $f: $!\n";
+ }
+ unlink "$ENV{MYSQLTEST_VARDIR}/tmp/gcs_first_file.txt";
+ unlink "$ENV{MYSQLTEST_VARDIR}/tmp/gcs_count_before_restart.txt";
+ print "Cleanup complete\n";
+EOF
+
+--source include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/t/gr_gcs_debug_trace_reopen.test b/mysql-test/suite/group_replication/t/gr_gcs_debug_trace_reopen.test
new file mode 100644
index 000000000000..3a97b606c999
--- /dev/null
+++ b/mysql-test/suite/group_replication/t/gr_gcs_debug_trace_reopen.test
@@ -0,0 +1,63 @@
+################################################################################
+#
+# This test case proves that when GCS_DEBUG_TRACE is moved or deleted while the
+# fd is open, subsequent writes go to the newly created file.
+#
+# Test steps:
+# 1. Start Group Replication.
+# 2. Enable GCS_DEBUG_ALL tracing.
+# 3. Remove GCS_DEBUG_TRACE.
+# 4. Wait for stat auto-detection -- GCS_DEBUG_TRACE must reappear
+# 5. Group Replication is ONLINE.
+# 6. Cleanup.
+################################################################################
+
+--source include/have_group_replication_plugin.inc
+--let $rpl_skip_group_replication_start= 1
+--source include/group_replication.inc
+
+--connection server1
+
+--echo
+--echo # 1. Start Group Replication.
+
+--error 0,1
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
+
+--source include/start_and_bootstrap_group_replication.inc
+
+--echo
+--echo # 2. Enable GCS_DEBUG_ALL tracing.
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_ALL";
+--let $wait_condition = SELECT LENGTH(LOAD_FILE(CONCAT(@@datadir, 'GCS_DEBUG_TRACE'))) > 0
+--source include/wait_condition.inc
+
+--echo
+--echo # 3. Remove GCS_DEBUG_TRACE.
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
+
+--echo
+--echo # 4. Wait for stat auto-detection -- GCS_DEBUG_TRACE must reappear
+
+# Wait for GCS_DEBUG_TRACE re-creation and logs to be written.
+--let $wait_condition = SELECT LENGTH(LOAD_FILE(CONCAT(@@datadir, 'GCS_DEBUG_TRACE'))) > 0
+--source include/wait_condition.inc
+
+--file_exists $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
+
+--echo
+--echo # 5. Group Replication is ONLINE.
+
+--let $assert_text= Member is ONLINE after stale-fd detection and reopen
+--let $assert_cond= COUNT(*) = 1 FROM performance_schema.replication_group_members WHERE MEMBER_STATE = "ONLINE"
+--source include/assert.inc
+
+--echo
+--echo # 6. cleanup
+
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_NONE";
+--source include/stop_group_replication.inc
+
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
+
+--source include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/t/gr_gcs_debug_trace_timestamps.test b/mysql-test/suite/group_replication/t/gr_gcs_debug_trace_timestamps.test
new file mode 100644
index 000000000000..e1d40ef7eb41
--- /dev/null
+++ b/mysql-test/suite/group_replication/t/gr_gcs_debug_trace_timestamps.test
@@ -0,0 +1,95 @@
+################################################################################
+# PS-11216: Timestamps needed in the GCS_DEBUG_TRACE file
+#
+# This test case verify that every log written to GCS_DEBUG_TRACE carries a
+# ISO 8601 UTC timestamp with microsecond precision, leading the line:
+# [YYYY-MM-DDTHH:MM:SS.uuuuuuZ] [MYSQL_GCS_DEBUG] [GCS]
+#
+# Test steps:
+# 1. Start Group Replication — GCS_DEBUG_TRACE must be created.
+# 2. Enable tracing; let the consumer write a few lines.
+# 3. Verify ISO 8601 UTC timestamps with microsecond precision.
+# 4. Disable then re-enable; verify timestamps continue in new entries.
+# 5. Verify Group Replication is still ONLINE.
+# 6. Cleanup.
+################################################################################
+
+--source include/have_group_replication_plugin.inc
+--let $rpl_skip_group_replication_start = 1
+--source include/group_replication.inc
+
+##############################################################################
+# Step 1: Start Group Replication — GCS_DEBUG_TRACE is created.
+##############################################################################
+
+--echo
+--echo # Step 1: Start Group Replication — GCS_DEBUG_TRACE must be created.
+--source include/start_and_bootstrap_group_replication.inc
+--file_exists $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
+
+##############################################################################
+# Step 2: Enable tracing; let the consumer write a few lines.
+##############################################################################
+--echo
+--echo # Step 2: Enable GCS_DEBUG_BASIC tracing
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_BASIC";
+
+--let $assert_text = Debug option is GCS_DEBUG_BASIC
+--let $assert_cond = "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_BASIC"
+--source include/assert.inc
+
+##############################################################################
+# Step 3: Verify ISO 8601 UTC timestamps with microsecond precision.
+##############################################################################
+--echo
+--echo # Step 3: verify ISO 8601 UTC timestamps(microsecond) in GCS_DEBUG_TRACE
+
+# Wait until at least one timestamped line appears in the trace file.
+--let $grep_pattern = \[\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z\] \[MYSQL_GCS_DEBUG\] \[GCS\]
+--let $grep_file = $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
+--source include/wait_for_pattern_in_file.inc
+
+##############################################################################
+# Step 4: Disable then re-enable; verify timestamps continue in new entries.
+##############################################################################
+--echo
+--echo # Step 4: disable then re-enable tracing; timestamps must persist
+
+# Record file size before the cycle so we can prove new entries were appended.
+--let $size_before = `SELECT LENGTH(LOAD_FILE(CONCAT(@@datadir, 'GCS_DEBUG_TRACE')))`
+
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_NONE";
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_ALL";
+
+# Wait until the file grows beyond the size recorded before the cycle.
+--let $wait_condition = SELECT LENGTH(LOAD_FILE(CONCAT(@@datadir, 'GCS_DEBUG_TRACE'))) > $size_before
+--source include/wait_condition.inc
+
+--let $assert_text = Timestamps persist after tracing re-enable
+--let $assert_file = $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
+--let $assert_select = \[\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z\] \[MYSQL_GCS_DEBUG\] \[GCS\]
+--let $assert_count_condition = >= 1
+--source include/assert_grep.inc
+
+##############################################################################
+# Step 5: Verify Group Replication is still ONLINE.
+##############################################################################
+--echo
+--echo # Step 5: Verify Group Replication is still ONLINE.
+
+--let $assert_text = Member is ONLINE after timestamp test
+--let $assert_cond = COUNT(*) = 1 FROM performance_schema.replication_group_members WHERE MEMBER_STATE = "ONLINE"
+--source include/assert.inc
+
+##############################################################################
+# Step 6: Cleanup.
+##############################################################################
+--echo
+--echo # Step 6: Cleanup.
+
+SET GLOBAL group_replication_communication_debug_options = "GCS_DEBUG_NONE";
+--source include/stop_group_replication.inc
+
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
+
+--source include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/t/gr_group_gtid_initialize_error.test b/mysql-test/suite/group_replication/t/gr_group_gtid_initialize_error.test
index c204444cdc9d..9463921edf1c 100644
--- a/mysql-test/suite/group_replication/t/gr_group_gtid_initialize_error.test
+++ b/mysql-test/suite/group_replication/t/gr_group_gtid_initialize_error.test
@@ -32,6 +32,7 @@ SET @debug_save= @@GLOBAL.DEBUG;
SET @@GLOBAL.DEBUG= '+d,gr_server_gtid_executed_extraction_error';
# The start GR will error out here due to the error injection.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_group_operations_name_logging.test b/mysql-test/suite/group_replication/t/gr_group_operations_name_logging.test
index 369813a4672d..e5d5d6fa42bf 100644
--- a/mysql-test/suite/group_replication/t/gr_group_operations_name_logging.test
+++ b/mysql-test/suite/group_replication/t/gr_group_operations_name_logging.test
@@ -80,6 +80,7 @@ set session sql_log_bin=1;
# Configure the member to use single-primary mode as server 1 is already configured
SET GLOBAL group_replication_enforce_update_everywhere_checks= FALSE;
SET GLOBAL group_replication_single_primary_mode= TRUE;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error 0, ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_gtid_assignment_block_size.test b/mysql-test/suite/group_replication/t/gr_gtid_assignment_block_size.test
index 974695f65a82..0f466fb9c867 100644
--- a/mysql-test/suite/group_replication/t/gr_gtid_assignment_block_size.test
+++ b/mysql-test/suite/group_replication/t/gr_gtid_assignment_block_size.test
@@ -111,6 +111,7 @@ SET GLOBAL group_replication_gtid_assignment_block_size= 1000;
--enable_query_log
SET GLOBAL group_replication_gtid_assignment_block_size= 2;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_incorrect_group_name_join.test b/mysql-test/suite/group_replication/t/gr_incorrect_group_name_join.test
index da5c1aa83b47..452bb9d0438f 100644
--- a/mysql-test/suite/group_replication/t/gr_incorrect_group_name_join.test
+++ b/mysql-test/suite/group_replication/t/gr_incorrect_group_name_join.test
@@ -35,6 +35,7 @@ call mtr.add_suppression("Error connecting to all peers. Member join failed. Loc
SET SESSION sql_log_bin= 1;
SET GLOBAL group_replication_group_name= "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb";
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_inject_join_error.test b/mysql-test/suite/group_replication/t/gr_inject_join_error.test
index 5c3ef443c897..8aeca3dc47f0 100644
--- a/mysql-test/suite/group_replication/t/gr_inject_join_error.test
+++ b/mysql-test/suite/group_replication/t/gr_inject_join_error.test
@@ -25,6 +25,7 @@ SET @@GLOBAL.DEBUG='+d,group_replication_inject_gcs_join_error';
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--enable_query_log
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_ip_allowlist_deprecation.test b/mysql-test/suite/group_replication/t/gr_ip_allowlist_deprecation.test
new file mode 100644
index 000000000000..58aaf640cd82
--- /dev/null
+++ b/mysql-test/suite/group_replication/t/gr_ip_allowlist_deprecation.test
@@ -0,0 +1,104 @@
+################################################################################
+# This test verifies that a deprecation warning is thrown/logged when
+# group_replication_ip_allowlist variable is used.
+#
+# Test:
+# 0. The test requires one server: server1.
+# 1. Set group_replication_ip_allowlist.
+# A deprecation warning is thrown on the client session.
+# 2. Set group_replication_ip_allowlist to some custom value.
+# A deprecation warning is thrown on the client session.
+# 3. Start Group Replication from client session.
+# A deprecation warning is thrown on the client session because
+# group_replication_ip_allowlist is not the default one.
+# 4. Start Group Replication on server start.
+# A deprecation warning is logged on the error log because
+# group_replication_ip_allowlist is not the default one.
+# 5. Cleanup.
+################################################################################
+--source include/big_test.inc
+--source include/have_group_replication_plugin.inc
+--let $rpl_skip_group_replication_start= 1
+--source include/group_replication.inc
+
+
+--echo
+--echo ############################################################
+--echo # 1. Set group_replication_ip_allowlist.
+--echo # A deprecation warning is thrown on the client session.
+
+
+--let $rpl_connection_name= server1
+--source include/connection.inc
+
+--let $sysvars_to_save = [ "GLOBAL.group_replication_ip_allowlist" ]
+--source include/save_sysvars.inc
+
+SET @@GLOBAL.group_replication_ip_allowlist= "AUTOMATIC";
+
+
+--echo
+--echo ############################################################
+--echo # 2. Set group_replication_ip_allowlist to some custom value.
+--echo # A deprecation warning is thrown on the client session.
+
+--let $rpl_connection_name= server1
+--source include/connection.inc
+
+SET @@GLOBAL.group_replication_ip_allowlist= "127.0.0.1/32";
+
+--echo
+--echo ############################################################
+--echo # 3. Start Group Replication from client session.
+--echo # A deprecation warning is thrown on the client session because
+--echo # group_replication_ip_allowlist is not the default one.
+
+--let $rpl_connection_name= server1
+--source include/connection.inc
+
+--let $warning_count= query_get_value(SELECT COUNT(*) AS COUNT FROM performance_schema.error_log WHERE error_code='MY-011069' AND data LIKE '%The syntax \'group_replication_ip_allowlist\' is deprecated and will be removed in a future release.%', COUNT, 1)
+
+--source include/start_and_bootstrap_group_replication.inc
+
+--let $wait_condition= SELECT COUNT(*)=$warning_count FROM performance_schema.error_log WHERE error_code='MY-011069' AND data LIKE '%The syntax \'group_replication_ip_allowlist\' is deprecated and will be removed in a future release.%'
+--source include/wait_condition.inc
+
+
+--echo
+--echo ############################################################
+--echo # 4. Start Group Replication on server start.
+--echo # A deprecation warning is logged on the error log because
+--echo # group_replication_ip_allowlist is not the default one.
+
+--let $rpl_connection_name= server1
+--source include/connection.inc
+
+--let $warning_count= query_get_value(SELECT COUNT(*) AS COUNT FROM performance_schema.error_log WHERE error_code='MY-011069' AND data LIKE '%The syntax \'group_replication_ip_allowlist\' is deprecated and will be removed in a future release.%', COUNT, 1)
+
+--let $allow_rpl_inited=1
+--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
+--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
+--let $restart_parameters=restart:--group_replication_group_name=$group_replication_group_name --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_bootstrap_group=1 --group_replication_start_on_boot=1 --group_replication_ip_allowlist="127.0.0.1/32"
+--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
+--source include/restart_mysqld.inc
+
+--let $rpl_server_number= 1
+--source include/rpl/reconnect.inc
+--let $group_replication_member_state= ONLINE
+--source include/gr_wait_for_member_state.inc
+
+--inc $warning_count
+--let $wait_condition= SELECT COUNT(*)=$warning_count FROM performance_schema.error_log WHERE error_code='MY-011069' AND data LIKE '%The syntax \'group_replication_ip_allowlist\' is deprecated and will be removed in a future release.%'
+--source include/wait_condition.inc
+
+--echo
+--echo ############################################################
+--echo # 5. Cleanup.
+
+--let $rpl_connection_name= server1
+--source include/connection.inc
+
+--source include/stop_group_replication.inc
+--source include/restore_sysvars.inc
+
+--source include/group_replication_end.inc
diff --git a/mysql-test/suite/group_replication/t/gr_ip_allowlist_options.test b/mysql-test/suite/group_replication/t/gr_ip_allowlist_options.test
index 354f748ceaef..2c00227af310 100644
--- a/mysql-test/suite/group_replication/t/gr_ip_allowlist_options.test
+++ b/mysql-test/suite/group_replication/t/gr_ip_allowlist_options.test
@@ -68,22 +68,27 @@
#START GROUP_REPLICATION;
--eval SET GLOBAL group_replication_ip_allowlist="$incorrect_ip1"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
START GROUP_REPLICATION;
--eval SET GLOBAL group_replication_ip_allowlist="$incorrect_ip2"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
START GROUP_REPLICATION;
--eval SET GLOBAL group_replication_ip_allowlist="$incorrect_subnetmask1"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
START GROUP_REPLICATION;
--eval SET GLOBAL group_replication_ip_allowlist="$incorrect_subnetmask2"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
START GROUP_REPLICATION;
--eval SET GLOBAL group_replication_ip_allowlist="$incorrect_list1"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_join_with_suspect_member.test b/mysql-test/suite/group_replication/t/gr_join_with_suspect_member.test
index f5ad46d72b6d..d79bbb0391c1 100644
--- a/mysql-test/suite/group_replication/t/gr_join_with_suspect_member.test
+++ b/mysql-test/suite/group_replication/t/gr_join_with_suspect_member.test
@@ -151,6 +151,7 @@ let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--replace_result $server1_local_address SERVER1_LOCAL_ADDRESS
--eval SET GLOBAL group_replication_group_seeds= "$server1_local_address"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_kill_restart.test b/mysql-test/suite/group_replication/t/gr_kill_restart.test
index 5f127ea5321a..b03fc21e2cd7 100644
--- a/mysql-test/suite/group_replication/t/gr_kill_restart.test
+++ b/mysql-test/suite/group_replication/t/gr_kill_restart.test
@@ -43,6 +43,7 @@ while ($loop < 4)
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= @@GLOBAL.group_replication_local_address
--eval SET PERSIST group_replication_group_seeds= @@GLOBAL.group_replication_group_seeds
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= @@GLOBAL.group_replication_communication_stack
--enable_query_log
--inc $loop
diff --git a/mysql-test/suite/group_replication/t/gr_lock_tables_unblock.test b/mysql-test/suite/group_replication/t/gr_lock_tables_unblock.test
index d014bec50587..a4494eeeb6e0 100644
--- a/mysql-test/suite/group_replication/t/gr_lock_tables_unblock.test
+++ b/mysql-test/suite/group_replication/t/gr_lock_tables_unblock.test
@@ -54,6 +54,7 @@ LOCK TABLE t1 WRITE;
UNLOCK TABLES;
--connection server1
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--reap
--let $group_replication_member_state= ONLINE
diff --git a/mysql-test/suite/group_replication/t/gr_lower_case_table_names_different.test b/mysql-test/suite/group_replication/t/gr_lower_case_table_names_different.test
index 444f2663231b..d53666f8e599 100644
--- a/mysql-test/suite/group_replication/t/gr_lower_case_table_names_different.test
+++ b/mysql-test/suite/group_replication/t/gr_lower_case_table_names_different.test
@@ -87,6 +87,7 @@ SET DEBUG_SYNC= "now SIGNAL signal.continue_leave_process";
--echo ## does not match.
--echo
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_lower_version_member.test b/mysql-test/suite/group_replication/t/gr_lower_version_member.test
index 8a302e84e3fc..059598f9df59 100644
--- a/mysql-test/suite/group_replication/t/gr_lower_version_member.test
+++ b/mysql-test/suite/group_replication/t/gr_lower_version_member.test
@@ -51,6 +51,7 @@ SET session sql_log_bin=1;
SET GLOBAL group_replication_group_name= "6f6932e0-03d9-11e5-b939-0800200c9a66";
# The start will fail as the node is declared incompatible with the group
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_max_group_size.test b/mysql-test/suite/group_replication/t/gr_max_group_size.test
index 15f801ce86d6..144edc6388dd 100644
--- a/mysql-test/suite/group_replication/t/gr_max_group_size.test
+++ b/mysql-test/suite/group_replication/t/gr_max_group_size.test
@@ -38,6 +38,7 @@ SET SESSION sql_log_bin= 1;
SET @debug_save= @@GLOBAL.DEBUG;
SET @@GLOBAL.DEBUG='+d,group_replication_set_number_of_members_on_view_changed_to_10';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_MAX_GROUP_SIZE
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_member_actions_error_handling.test b/mysql-test/suite/group_replication/t/gr_member_actions_error_handling.test
index c038886a6595..2bd2eaa9d83b 100644
--- a/mysql-test/suite/group_replication/t/gr_member_actions_error_handling.test
+++ b/mysql-test/suite/group_replication/t/gr_member_actions_error_handling.test
@@ -60,6 +60,7 @@ SET @@GLOBAL.DEBUG='+d,group_replication_force_error_on_mysql_disable_super_read
SET @@GLOBAL.DEBUG='+d,group_replication_force_action_error_handling_critical';
SET GLOBAL group_replication_bootstrap_group= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
SET GLOBAL group_replication_bootstrap_group= 0;
diff --git a/mysql-test/suite/group_replication/t/gr_member_actions_error_on_read_on_member_join.test b/mysql-test/suite/group_replication/t/gr_member_actions_error_on_read_on_member_join.test
index 00cbccdef911..22a51aeb896e 100644
--- a/mysql-test/suite/group_replication/t/gr_member_actions_error_on_read_on_member_join.test
+++ b/mysql-test/suite/group_replication/t/gr_member_actions_error_on_read_on_member_join.test
@@ -65,6 +65,7 @@ SET @@GLOBAL.DEBUG='+d,force_error_on_configuration_table_close';
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_member_actions_error_on_update_on_member_join.test b/mysql-test/suite/group_replication/t/gr_member_actions_error_on_update_on_member_join.test
index 2f5efdb88bd6..4e730a6664dd 100644
--- a/mysql-test/suite/group_replication/t/gr_member_actions_error_on_update_on_member_join.test
+++ b/mysql-test/suite/group_replication/t/gr_member_actions_error_on_update_on_member_join.test
@@ -51,6 +51,7 @@ SET @@GLOBAL.DEBUG='+d,force_error_on_configuration_table_close';
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_member_actions_error_on_update_on_member_join_lower_version_group.test b/mysql-test/suite/group_replication/t/gr_member_actions_error_on_update_on_member_join_lower_version_group.test
index 5b98a1cc855a..fd6f38b69ee8 100644
--- a/mysql-test/suite/group_replication/t/gr_member_actions_error_on_update_on_member_join_lower_version_group.test
+++ b/mysql-test/suite/group_replication/t/gr_member_actions_error_on_update_on_member_join_lower_version_group.test
@@ -76,6 +76,7 @@ SET @@GLOBAL.DEBUG='+d,force_error_on_configuration_table_close';
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_multiple_starts_after_clone.test b/mysql-test/suite/group_replication/t/gr_multiple_starts_after_clone.test
index e9765c4754b6..1126d185752c 100644
--- a/mysql-test/suite/group_replication/t/gr_multiple_starts_after_clone.test
+++ b/mysql-test/suite/group_replication/t/gr_multiple_starts_after_clone.test
@@ -62,6 +62,7 @@ INSERT INTO t1 VALUES (1);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
--enable_query_log
@@ -76,6 +77,7 @@ SET PERSIST group_replication_start_on_boot= ON;
--let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold`
SET GLOBAL group_replication_clone_threshold= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_multiple_version_members.test b/mysql-test/suite/group_replication/t/gr_multiple_version_members.test
index 8991be0b8c76..0e1711dd2c51 100644
--- a/mysql-test/suite/group_replication/t/gr_multiple_version_members.test
+++ b/mysql-test/suite/group_replication/t/gr_multiple_version_members.test
@@ -107,6 +107,7 @@ call mtr.add_suppression("Member version is read compatible with the group.");
SET session sql_log_bin=1;
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -172,6 +173,7 @@ SET session sql_log_bin=1;
SET @@GLOBAL.DEBUG= @debug_save_s1;
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_mysql_thread_queued_task_psi_memory.test b/mysql-test/suite/group_replication/t/gr_mysql_thread_queued_task_psi_memory.test
index ead9b049953f..94aa156de8f1 100644
--- a/mysql-test/suite/group_replication/t/gr_mysql_thread_queued_task_psi_memory.test
+++ b/mysql-test/suite/group_replication/t/gr_mysql_thread_queued_task_psi_memory.test
@@ -61,6 +61,7 @@ SET DEBUG_SYNC= "now SIGNAL signal.group_replication_mysql_thread_dispatcher_bef
--let $rpl_connection_name= server_1
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--reap
diff --git a/mysql-test/suite/group_replication/t/gr_no_user_start_failure.test b/mysql-test/suite/group_replication/t/gr_no_user_start_failure.test
index 8a382ff1298e..1ff151cd5732 100644
--- a/mysql-test/suite/group_replication/t/gr_no_user_start_failure.test
+++ b/mysql-test/suite/group_replication/t/gr_no_user_start_failure.test
@@ -36,6 +36,7 @@ DROP USER "mysql.session"@"localhost";
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_parallel_start_stop.test b/mysql-test/suite/group_replication/t/gr_parallel_start_stop.test
index 5bfc6d2f2e47..04dddcada8fc 100644
--- a/mysql-test/suite/group_replication/t/gr_parallel_start_stop.test
+++ b/mysql-test/suite/group_replication/t/gr_parallel_start_stop.test
@@ -46,6 +46,7 @@ SET @@GLOBAL.DEBUG='+d,group_replication_wait_on_start';
SET DEBUG_SYNC='now wait_for signal.start_waiting';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMAND_FAILURE
START GROUP_REPLICATION;
@@ -55,6 +56,7 @@ SET DEBUG_SYNC='now signal signal.start_continue';
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--reap
--let $group_replication_member_state = ONLINE
@@ -72,6 +74,7 @@ SET @@GLOBAL.DEBUG='+d,group_replication_hold_stop_before_leave_the_group';
SET DEBUG_SYNC='now wait_for signal.stopping_before_leave_the_group';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_COMMAND_FAILURE
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_parallel_start_uninstall.test b/mysql-test/suite/group_replication/t/gr_parallel_start_uninstall.test
index 48e7bf2bad44..78ad0eb0e2a4 100644
--- a/mysql-test/suite/group_replication/t/gr_parallel_start_uninstall.test
+++ b/mysql-test/suite/group_replication/t/gr_parallel_start_uninstall.test
@@ -77,6 +77,7 @@ SET DEBUG_SYNC='now signal signal.resume_stop_before_leave_the_group';
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--reap
--let $rpl_connection_name= server_2_1
@@ -116,6 +117,7 @@ SET GLOBAL group_replication_recovery_retry_count= 2;
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--let $group_replication_member_state = ERROR
@@ -145,6 +147,7 @@ SET @@GLOBAL.DEBUG='+d,group_replication_hold_stop_before_leave_the_group';
--source include/connection.inc
--disable_result_log
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error 0, ER_GROUP_REPLICATION_CONFIGURATION, ER_GROUP_REPLICATION_COMMAND_FAILURE
START GROUP_REPLICATION USER='root' , PASSWORD='';
--enable_result_log
diff --git a/mysql-test/suite/group_replication/t/gr_persist_variables.test b/mysql-test/suite/group_replication/t/gr_persist_variables.test
index ab38435fbec6..5de97d1295c1 100644
--- a/mysql-test/suite/group_replication/t/gr_persist_variables.test
+++ b/mysql-test/suite/group_replication/t/gr_persist_variables.test
@@ -49,6 +49,7 @@ INSERT INTO grvars (varname, varvalue)
while ( $varid <= $countvars )
{
--let $varnames= `SELECT varname FROM grvars WHERE id=$varid`
+ --disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST $varnames = @@GLOBAL.$varnames
--inc $varid
}
diff --git a/mysql-test/suite/group_replication/t/gr_preemptive_garbage_collection_different_value.test b/mysql-test/suite/group_replication/t/gr_preemptive_garbage_collection_different_value.test
index f8feb69a6996..5b479bb4715d 100644
--- a/mysql-test/suite/group_replication/t/gr_preemptive_garbage_collection_different_value.test
+++ b/mysql-test/suite/group_replication/t/gr_preemptive_garbage_collection_different_value.test
@@ -47,6 +47,7 @@ SET SESSION sql_log_bin = 1;
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_protocol_stack_tables_and_migration.test b/mysql-test/suite/group_replication/t/gr_protocol_stack_tables_and_migration.test
index 423948f81bd6..34ac37999b2c 100644
--- a/mysql-test/suite/group_replication/t/gr_protocol_stack_tables_and_migration.test
+++ b/mysql-test/suite/group_replication/t/gr_protocol_stack_tables_and_migration.test
@@ -83,6 +83,7 @@ while ($_rpl_server)
--echo # accordingly
--echo # 5. Start and bootstrap the group with server 1
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
SET GLOBAL group_replication_communication_stack= MySQL;
--let $server_address_1= localhost:$SERVER_MYPORT_1
--disable_query_log
@@ -95,6 +96,7 @@ SET GLOBAL group_replication_communication_stack= MySQL;
--echo # accordingly
--echo # 7. Start server 2.
--connection server2
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
SET GLOBAL group_replication_communication_stack= MySQL;
--let $server_address_2= localhost:$SERVER_MYPORT_2
--disable_query_log
@@ -129,6 +131,7 @@ while ($_rpl_server)
--echo # group_replication_communication_stack
--echo # 10. Stop server 1
--connection server1
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
SET GLOBAL group_replication_communication_stack= XCOM;
--let $server_uuid= `SELECT @@server_uuid`
@@ -147,6 +150,7 @@ SET GLOBAL group_replication_communication_stack= XCOM;
--echo # group_replication_communication_stack
--echo # 12. Stop server 2
--connection server2
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
SET GLOBAL group_replication_communication_stack= XCOM;
--let $server_uuid= `SELECT @@server_uuid`
@@ -162,6 +166,7 @@ SET GLOBAL group_replication_communication_stack= XCOM;
--echo # 13. Bootstrap the group with server 1.
--connection server1
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
SET GLOBAL group_replication_communication_stack= XCOM;
--let $server_address_1= localhost:$SERVER_GR_PORT_1
--disable_query_log
@@ -172,6 +177,7 @@ SET GLOBAL group_replication_communication_stack= XCOM;
--echo # 14. Join Server 2.
--connection server2
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
SET GLOBAL group_replication_communication_stack= XCOM;
--let $server_address_2= localhost:$SERVER_GR_PORT_2
--disable_query_log
@@ -184,6 +190,7 @@ SET GLOBAL group_replication_communication_stack= XCOM;
--connection server2
--disable_query_log
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET GLOBAL group_replication_communication_stack= "$communication_stack_save_2"
--eval SET GLOBAL group_replication_local_address= "$local_addr_save_2"
--eval SET GLOBAL group_replication_group_seeds= "$seeds_save_2"
@@ -191,6 +198,7 @@ SET GLOBAL group_replication_communication_stack= XCOM;
--connection server1
--disable_query_log
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET GLOBAL group_replication_communication_stack= "$communication_stack_save_1"
--eval SET GLOBAL group_replication_local_address= "$local_addr_save_1"
--eval SET GLOBAL group_replication_group_seeds= "$seeds_save_1"
diff --git a/mysql-test/suite/group_replication/t/gr_reach_max_connections_during_start.test b/mysql-test/suite/group_replication/t/gr_reach_max_connections_during_start.test
index b8846a25fd09..6544288e48b0 100644
--- a/mysql-test/suite/group_replication/t/gr_reach_max_connections_during_start.test
+++ b/mysql-test/suite/group_replication/t/gr_reach_max_connections_during_start.test
@@ -31,6 +31,7 @@ SET SESSION sql_log_bin= 1;
SET @debug_saved= @@GLOBAL.DEBUG;
SET @@GLOBAL.DEBUG= '+d,simulate_reach_max_connections';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_received_sets_compatibility_member_rejected.test b/mysql-test/suite/group_replication/t/gr_received_sets_compatibility_member_rejected.test
index 0ae1ab567b16..24aae1cb1e2f 100644
--- a/mysql-test/suite/group_replication/t/gr_received_sets_compatibility_member_rejected.test
+++ b/mysql-test/suite/group_replication/t/gr_received_sets_compatibility_member_rejected.test
@@ -178,6 +178,7 @@ LOCK TABLE t1 READ;
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--send
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--let $rpl_connection_name= server_2
diff --git a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_invalid_conf.test b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_invalid_conf.test
index 3f2357c6dfec..104b3738577e 100644
--- a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_invalid_conf.test
+++ b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_invalid_conf.test
@@ -90,6 +90,7 @@ SET PERSIST_ONLY group_replication_advertise_recovery_endpoints = "127.0.0.1:360
--echo
--echo # 7. START GROUP_REPLICATION , it will fail due invalid format.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_DA_GRP_RPL_RECOVERY_ENDPOINT_FORMAT
START GROUP_REPLICATION;
@@ -109,6 +110,7 @@ SET PERSIST_ONLY group_replication_advertise_recovery_endpoints = "128.0.0.1:360
--let $rpl_server_number= 1
--source include/rpl/reconnect.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_DA_GRP_RPL_RECOVERY_ENDPOINT_INVALID
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_invalid_donor.test b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_invalid_donor.test
index 7bbfc1512603..8a0bc6265c94 100644
--- a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_invalid_donor.test
+++ b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_invalid_donor.test
@@ -76,6 +76,7 @@ SET GLOBAL group_replication_recovery_retry_count= 1;
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -131,6 +132,7 @@ SET @@GLOBAL.DEBUG= @debug_save;
--echo # 12. Clean debug point to allow to recovery be successful
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_ipv6_ipv4.test b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_ipv6_ipv4.test
index fd6ead4b195b..4c2616b175a8 100644
--- a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_ipv6_ipv4.test
+++ b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_ipv6_ipv4.test
@@ -76,6 +76,7 @@ INSERT INTO t1 VALUES (2);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -96,6 +97,7 @@ SET GLOBAL group_replication_clone_threshold= 1;
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_iterate_list_clone.test b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_iterate_list_clone.test
index a51031c84c26..7c1c55704242 100644
--- a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_iterate_list_clone.test
+++ b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_iterate_list_clone.test
@@ -76,6 +76,7 @@ INSERT INTO t1 VALUES (2);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -94,6 +95,7 @@ SET GLOBAL group_replication_clone_threshold= 1;
--echo # 6. On a empty server2 start group replication
--echo # Wait for it to restart and come back
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_multiple_valid.test b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_multiple_valid.test
index 3f0ceb0b12a1..e882e5bd9f08 100644
--- a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_multiple_valid.test
+++ b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_multiple_valid.test
@@ -77,6 +77,7 @@ INSERT INTO t1 VALUES (2);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -95,6 +96,7 @@ SET GLOBAL group_replication_clone_threshold= 1;
--echo # 7. On a empty server2 start group replication
--echo # Wait for it to restart and come back
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_no_fallback.test b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_no_fallback.test
index 901086b04410..94f766d056cc 100644
--- a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_no_fallback.test
+++ b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_no_fallback.test
@@ -89,6 +89,7 @@ SET GLOBAL group_replication_recovery_retry_count= 2;
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -146,6 +147,7 @@ SET @@GLOBAL.group_replication_advertise_recovery_endpoints = "DEFAULT";
--source include/stop_group_replication.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_retry_clone.test b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_retry_clone.test
index c81b111ebc03..ccbbff47b006 100644
--- a/mysql-test/suite/group_replication/t/gr_recovery_endpoints_retry_clone.test
+++ b/mysql-test/suite/group_replication/t/gr_recovery_endpoints_retry_clone.test
@@ -78,6 +78,7 @@ INSERT INTO t1 VALUES (2);
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= ON;
@@ -126,6 +127,7 @@ SET DEBUG_SYNC = "now SIGNAL signal.run_clone_query_continue";
--let $rpl_connection_name= server3
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--reap
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/group_replication/t/gr_recovery_errors_report.test b/mysql-test/suite/group_replication/t/gr_recovery_errors_report.test
index 34011e204e26..9e03d81b50aa 100644
--- a/mysql-test/suite/group_replication/t/gr_recovery_errors_report.test
+++ b/mysql-test/suite/group_replication/t/gr_recovery_errors_report.test
@@ -50,6 +50,7 @@ SET GLOBAL group_replication_recovery_reconnect_interval= 3600;
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--echo # Wait until the error is reported on performance_schema.replication_applier_status_by_worker table
diff --git a/mysql-test/suite/group_replication/t/gr_rejoining_offline_member.test b/mysql-test/suite/group_replication/t/gr_rejoining_offline_member.test
index e9725bc958c6..e7ff083d686d 100644
--- a/mysql-test/suite/group_replication/t/gr_rejoining_offline_member.test
+++ b/mysql-test/suite/group_replication/t/gr_rejoining_offline_member.test
@@ -69,6 +69,7 @@ call gr_rejoining_offline_member_proc(100);
--let $rpl_connection_name= server1
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--reap
--let $group_replication_member_state= ONLINE
diff --git a/mysql-test/suite/group_replication/t/gr_roles.test b/mysql-test/suite/group_replication/t/gr_roles.test
index a5ef0eb7e75f..2958ca21f7b1 100644
--- a/mysql-test/suite/group_replication/t/gr_roles.test
+++ b/mysql-test/suite/group_replication/t/gr_roles.test
@@ -56,6 +56,7 @@ connect(alpha_con, localhost, alpha, alpha);
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
SET GLOBAL group_replication_bootstrap_group= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
START GROUP_REPLICATION;
@@ -82,6 +83,7 @@ SELECT CURRENT_ROLE();
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
SET GLOBAL group_replication_bootstrap_group= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
START GROUP_REPLICATION;
@@ -94,6 +96,7 @@ GRANT GROUP_REPLICATION_ADMIN ON *.* TO 'gr_user';
--echo [connection alpha]
connect(alpha_con, localhost, alpha, alpha,*NO-ONE*);
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
SET GLOBAL group_replication_bootstrap_group= 0;
diff --git a/mysql-test/suite/group_replication/t/gr_server_id_0.test b/mysql-test/suite/group_replication/t/gr_server_id_0.test
index 4f2326673775..a1683ff5fe20 100644
--- a/mysql-test/suite/group_replication/t/gr_server_id_0.test
+++ b/mysql-test/suite/group_replication/t/gr_server_id_0.test
@@ -59,6 +59,7 @@ SET SESSION sql_log_bin= 1;
--echo
--echo ############################################################
--echo # 2. Both start and install plugin must fail.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -75,9 +76,11 @@ START GROUP_REPLICATION;
--eval SET GLOBAL server_id= $_server_id
--source include/install_group_replication_plugin.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_server_uuid_matches_group_name.test b/mysql-test/suite/group_replication/t/gr_server_uuid_matches_group_name.test
index 630f4ea4205d..bf8999d02bd8 100644
--- a/mysql-test/suite/group_replication/t/gr_server_uuid_matches_group_name.test
+++ b/mysql-test/suite/group_replication/t/gr_server_uuid_matches_group_name.test
@@ -73,6 +73,7 @@ SET @debug_group_replication_start_on_boot= @@GLOBAL.group_replication_start_on_
## 1.1. START GROUP_REPLICATION should fail on server1.
## Since server_uuid matches group_name GR should not start.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -117,6 +118,7 @@ START GROUP_REPLICATION;
## 2.3. START GROUP_REPLICATION should fail on server2.
## Since server_uuid matches group_name GR should not start.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_server_uuid_matches_other_server_uuid.test b/mysql-test/suite/group_replication/t/gr_server_uuid_matches_other_server_uuid.test
index 49f223156a0f..df6d8d442e0e 100644
--- a/mysql-test/suite/group_replication/t/gr_server_uuid_matches_other_server_uuid.test
+++ b/mysql-test/suite/group_replication/t/gr_server_uuid_matches_other_server_uuid.test
@@ -53,6 +53,7 @@ SET @@GLOBAL.DEBUG= '+d,group_replication_force_member_uuid';
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_set_debug_options.test b/mysql-test/suite/group_replication/t/gr_set_debug_options.test
index 06c67fca0684..123656dae020 100644
--- a/mysql-test/suite/group_replication/t/gr_set_debug_options.test
+++ b/mysql-test/suite/group_replication/t/gr_set_debug_options.test
@@ -189,6 +189,7 @@ call mtr.add_suppression("\\[ERROR\\] \\[[^]]*\\] \\[[^]]*\\] Plugin group_repli
SET SESSION sql_log_bin=1;
SET GLOBAL group_replication_group_name= "89ab83b0-9f17-11e3-a5e2-0800200c9a66";
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_set_gtid_mode.test b/mysql-test/suite/group_replication/t/gr_set_gtid_mode.test
index 64d130202640..db104e12324f 100644
--- a/mysql-test/suite/group_replication/t/gr_set_gtid_mode.test
+++ b/mysql-test/suite/group_replication/t/gr_set_gtid_mode.test
@@ -82,6 +82,7 @@ SET @@GLOBAL.GTID_MODE= ON_PERMISSIVE;
--let $assert_cond= "[SELECT @@GLOBAL.GTID_MODE]" = "ON_PERMISSIVE"
--source include/assert.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -91,6 +92,7 @@ SET @@GLOBAL.GTID_MODE= OFF_PERMISSIVE;
--let $assert_cond= "[SELECT @@GLOBAL.GTID_MODE]" = "OFF_PERMISSIVE"
--source include/assert.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -99,6 +101,7 @@ SET @@GLOBAL.GTID_MODE= OFF;
--let $assert_cond= "[SELECT @@GLOBAL.GTID_MODE]" = "OFF"
--source include/assert.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_set_gtid_mode_on_start.test b/mysql-test/suite/group_replication/t/gr_set_gtid_mode_on_start.test
index 8a49d480221a..1c0f07c62d4d 100644
--- a/mysql-test/suite/group_replication/t/gr_set_gtid_mode_on_start.test
+++ b/mysql-test/suite/group_replication/t/gr_set_gtid_mode_on_start.test
@@ -52,6 +52,7 @@ SET DEBUG_SYNC= 'now SIGNAL signal.start_continue';
--let $rpl_connection_name= server1
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--reap
--let $group_replication_member_state= ONLINE
diff --git a/mysql-test/suite/group_replication/t/gr_set_option_during_stop.test b/mysql-test/suite/group_replication/t/gr_set_option_during_stop.test
index af177c86f619..a338a40630af 100644
--- a/mysql-test/suite/group_replication/t/gr_set_option_during_stop.test
+++ b/mysql-test/suite/group_replication/t/gr_set_option_during_stop.test
@@ -62,6 +62,7 @@ INSERT INTO gr_options_that_cannot_be_change (name)
SELECT VARIABLE_NAME FROM performance_schema.global_variables
WHERE VARIABLE_NAME LIKE 'group_replication_%'
AND VARIABLE_NAME != 'group_replication_bootstrap_group'
+ AND VARIABLE_NAME != 'group_replication_communication_debug_max_file_size'
AND VARIABLE_NAME != 'group_replication_communication_stack'
AND VARIABLE_NAME != 'group_replication_consistency'
AND VARIABLE_NAME != 'group_replication_exit_state_action'
@@ -114,7 +115,9 @@ while ( $option_id <= $gr_options_that_can_be_change_count )
{
--let $option_name= `SELECT name FROM gr_options_that_can_be_change WHERE id=$option_id`
--eval SET @value= @@GLOBAL.$option_name
+ --disable_warnings
--eval SET @@GLOBAL.$option_name= @value
+ --enable_warnings
--inc $option_id
}
diff --git a/mysql-test/suite/group_replication/t/gr_show_global_and_session_variables.test b/mysql-test/suite/group_replication/t/gr_show_global_and_session_variables.test
index 350924a6393a..d920eced791c 100644
--- a/mysql-test/suite/group_replication/t/gr_show_global_and_session_variables.test
+++ b/mysql-test/suite/group_replication/t/gr_show_global_and_session_variables.test
@@ -30,7 +30,7 @@
--source include/start_and_bootstrap_group_replication.inc
--source include/stop_group_replication.inc
---let $gr_var_count= 65
+--let $gr_var_count= 66
--echo
--echo # Test#1: Basic check that there are $gr_var_count GR variables.
diff --git a/mysql-test/suite/group_replication/t/gr_show_status_on_start.test b/mysql-test/suite/group_replication/t/gr_show_status_on_start.test
index 652c3fdcefd2..fb8a20d27143 100644
--- a/mysql-test/suite/group_replication/t/gr_show_status_on_start.test
+++ b/mysql-test/suite/group_replication/t/gr_show_status_on_start.test
@@ -61,6 +61,7 @@ SET DEBUG_SYNC= 'now SIGNAL signal.resume_group_replication_wait_on_before_gcs_j
--let $rpl_connection_name= server_1
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--reap
--let $group_replication_member_state= ONLINE
diff --git a/mysql-test/suite/group_replication/t/gr_single_primary_async_before_gr_secondary.test b/mysql-test/suite/group_replication/t/gr_single_primary_async_before_gr_secondary.test
index 3d85ec56c11a..922636ca9a10 100644
--- a/mysql-test/suite/group_replication/t/gr_single_primary_async_before_gr_secondary.test
+++ b/mysql-test/suite/group_replication/t/gr_single_primary_async_before_gr_secondary.test
@@ -79,6 +79,7 @@ if (!$group_replication_found_primary_out_var)
--source include/rpl/start_replica.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -91,6 +92,7 @@ START GROUP_REPLICATION;
--source include/rpl/start_receiver.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -103,6 +105,7 @@ START GROUP_REPLICATION;
--source include/rpl/start_applier.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_single_primary_mixed_configuration.test b/mysql-test/suite/group_replication/t/gr_single_primary_mixed_configuration.test
index b1d6a6be30f3..96d675cdd725 100644
--- a/mysql-test/suite/group_replication/t/gr_single_primary_mixed_configuration.test
+++ b/mysql-test/suite/group_replication/t/gr_single_primary_mixed_configuration.test
@@ -42,6 +42,7 @@ SET GLOBAL group_replication_single_primary_mode= 0;
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -51,6 +52,7 @@ START GROUP_REPLICATION;
--source include/connection.inc
SET GLOBAL group_replication_enforce_update_everywhere_checks= 1;
SET GLOBAL group_replication_single_primary_mode= 0;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -69,6 +71,7 @@ SET GLOBAL group_replication_enforce_update_everywhere_checks= 1;
--source include/connection.inc
SET GLOBAL group_replication_enforce_update_everywhere_checks= 0;
SET GLOBAL group_replication_single_primary_mode= 0;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -76,6 +79,7 @@ START GROUP_REPLICATION;
--echo ## TRY TO START SERVER 2 (INVALID CONFIGURATION 4 - SINGLE MASTER + NO ENFORCED CHECK)
SET GLOBAL group_replication_enforce_update_everywhere_checks= 0;
SET GLOBAL group_replication_single_primary_mode= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -101,6 +105,7 @@ SET GLOBAL group_replication_enforce_update_everywhere_checks= 0;
--source include/connection.inc
SET GLOBAL group_replication_enforce_update_everywhere_checks= 0;
SET GLOBAL group_replication_single_primary_mode= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -110,6 +115,7 @@ START GROUP_REPLICATION;
--source include/connection.inc
SET GLOBAL group_replication_single_primary_mode= 0;
SET GLOBAL group_replication_enforce_update_everywhere_checks= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_single_primary_var_checks.test b/mysql-test/suite/group_replication/t/gr_single_primary_var_checks.test
index afe50aafc759..910cca818477 100644
--- a/mysql-test/suite/group_replication/t/gr_single_primary_var_checks.test
+++ b/mysql-test/suite/group_replication/t/gr_single_primary_var_checks.test
@@ -28,6 +28,7 @@
SET SESSION sql_log_bin= 0;
call mtr.add_suppression("It is not allowed to run single primary mode with 'group_replication_enforce_update_everywhere_checks' enabled.");
SET SESSION sql_log_bin= 1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_singlewriter_option.test b/mysql-test/suite/group_replication/t/gr_singlewriter_option.test
index 84283857f8a6..2bfd4c4b95ea 100644
--- a/mysql-test/suite/group_replication/t/gr_singlewriter_option.test
+++ b/mysql-test/suite/group_replication/t/gr_singlewriter_option.test
@@ -257,6 +257,7 @@ SET GLOBAL group_replication_paxos_single_leader = 1;
--echo # 9) Try to add the third member
--echo ####
--echo
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_singlewriter_paxos_single_writer_and_communication_protocol_version.test b/mysql-test/suite/group_replication/t/gr_singlewriter_paxos_single_writer_and_communication_protocol_version.test
index 4dc8909d1e89..9f7250bc8f44 100644
--- a/mysql-test/suite/group_replication/t/gr_singlewriter_paxos_single_writer_and_communication_protocol_version.test
+++ b/mysql-test/suite/group_replication/t/gr_singlewriter_paxos_single_writer_and_communication_protocol_version.test
@@ -80,6 +80,7 @@ SET SESSION sql_log_bin = 1;
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -125,6 +126,7 @@ let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_skip_wait_for_view_modification.test b/mysql-test/suite/group_replication/t/gr_skip_wait_for_view_modification.test
index 98a65b512de4..0ef34eab440c 100644
--- a/mysql-test/suite/group_replication/t/gr_skip_wait_for_view_modification.test
+++ b/mysql-test/suite/group_replication/t/gr_skip_wait_for_view_modification.test
@@ -38,6 +38,7 @@ call mtr.add_suppression("The member has failed to gracefully leave the group*.*
SET SESSION sql_log_bin= 1;
SET @@GLOBAL.DEBUG='+d,group_replication_force_view_modification_timeout';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_sql_service_command_data_psi_memory.test b/mysql-test/suite/group_replication/t/gr_sql_service_command_data_psi_memory.test
index 4a0bf14e07cf..80b1641f4703 100644
--- a/mysql-test/suite/group_replication/t/gr_sql_service_command_data_psi_memory.test
+++ b/mysql-test/suite/group_replication/t/gr_sql_service_command_data_psi_memory.test
@@ -60,6 +60,7 @@ SET DEBUG_SYNC= "now SIGNAL signal.group_replication_session_plugin_handler_befo
--let $rpl_connection_name= server_1
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--reap
diff --git a/mysql-test/suite/group_replication/t/gr_sql_service_failure.test b/mysql-test/suite/group_replication/t/gr_sql_service_failure.test
index d6b69bdf63af..6efd8446ddf7 100644
--- a/mysql-test/suite/group_replication/t/gr_sql_service_failure.test
+++ b/mysql-test/suite/group_replication/t/gr_sql_service_failure.test
@@ -28,6 +28,7 @@ SET GLOBAL group_replication_bootstrap_group=ON;
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--enable_query_log
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
--source include/gr_clear_bootstrap_group.inc
diff --git a/mysql-test/suite/group_replication/t/gr_ssl_mode.test b/mysql-test/suite/group_replication/t/gr_ssl_mode.test
index e4e0a6f8db51..7a8c533e91a9 100644
--- a/mysql-test/suite/group_replication/t/gr_ssl_mode.test
+++ b/mysql-test/suite/group_replication/t/gr_ssl_mode.test
@@ -51,6 +51,7 @@ SET GLOBAL group_replication_ssl_mode= REQUIRED;
SET @group_replication_ssl_mode_save= @@GLOBAL.group_replication_ssl_mode;
SET GLOBAL group_replication_ssl_mode= DISABLED;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_ssl_mode_tls_source_incompatible_certificates.test b/mysql-test/suite/group_replication/t/gr_ssl_mode_tls_source_incompatible_certificates.test
index 271bcabc2d99..40232a98bad5 100644
--- a/mysql-test/suite/group_replication/t/gr_ssl_mode_tls_source_incompatible_certificates.test
+++ b/mysql-test/suite/group_replication/t/gr_ssl_mode_tls_source_incompatible_certificates.test
@@ -54,6 +54,7 @@ SET @group_replication_ssl_mode_save= @@GLOBAL.group_replication_ssl_mode;
SET GLOBAL group_replication_ssl_mode= VERIFY_CA;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_ssl_mode_tls_source_mysql_admin.test b/mysql-test/suite/group_replication/t/gr_ssl_mode_tls_source_mysql_admin.test
index 96f4f04c91ce..eb7012e4b9be 100644
--- a/mysql-test/suite/group_replication/t/gr_ssl_mode_tls_source_mysql_admin.test
+++ b/mysql-test/suite/group_replication/t/gr_ssl_mode_tls_source_mysql_admin.test
@@ -52,6 +52,7 @@ SET GLOBAL group_replication_ssl_mode= REQUIRED;
SET @group_replication_ssl_mode_save= @@GLOBAL.group_replication_ssl_mode;
SET GLOBAL group_replication_ssl_mode= DISABLED;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_ssl_socket_timeout.test b/mysql-test/suite/group_replication/t/gr_ssl_socket_timeout.test
index 437264886759..26af5d233f35 100644
--- a/mysql-test/suite/group_replication/t/gr_ssl_socket_timeout.test
+++ b/mysql-test/suite/group_replication/t/gr_ssl_socket_timeout.test
@@ -90,6 +90,7 @@ SET GLOBAL group_replication_communication_debug_options= "XCOM_DEBUG_BASIC";
--source include/start_proc_in_background.inc
--connection server2
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--connection server1
diff --git a/mysql-test/suite/group_replication/t/gr_start_fail_restore_read_mode.test b/mysql-test/suite/group_replication/t/gr_start_fail_restore_read_mode.test
index 2b30a708d6d0..6f62f0289f88 100644
--- a/mysql-test/suite/group_replication/t/gr_start_fail_restore_read_mode.test
+++ b/mysql-test/suite/group_replication/t/gr_start_fail_restore_read_mode.test
@@ -45,6 +45,7 @@ SET SESSION sql_log_bin=1;
SET GLOBAL super_read_only = 1;
SET GLOBAL server_id=0;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_BAD_REPLICA, ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
START GROUP_REPLICATION;
@@ -62,6 +63,7 @@ START GROUP_REPLICATION;
SET GLOBAL read_only = 1;
SET GLOBAL server_id=0;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_BAD_REPLICA, ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
START GROUP_REPLICATION;
@@ -86,6 +88,7 @@ START GROUP_REPLICATION;
SET GLOBAL read_only = 0;
SET GLOBAL server_id=0;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_BAD_REPLICA, ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_start_gr_credential_options_clone.test b/mysql-test/suite/group_replication/t/gr_start_gr_credential_options_clone.test
index 6070e95402ef..3afdc19fc883 100644
--- a/mysql-test/suite/group_replication/t/gr_start_gr_credential_options_clone.test
+++ b/mysql-test/suite/group_replication/t/gr_start_gr_credential_options_clone.test
@@ -75,6 +75,7 @@ RESET REPLICA ALL FOR CHANNEL 'group_replication_recovery';
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
SET PERSIST group_replication_start_on_boot= OFF;
@@ -88,6 +89,7 @@ SET GLOBAL group_replication_clone_threshold= 1;
--echo
--echo # 5. Start GR by passing credentials in command.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--eval START GROUP_REPLICATION USER='$recovery_user' , PASSWORD='$recovery_password';
--source include/wait_until_disconnected.inc
@@ -108,6 +110,7 @@ SET GLOBAL group_replication_clone_threshold= 1;
--let $diff_tables=server1:test.t1 ,server2:test.t1
--source include/diff_tables.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--eval START GROUP_REPLICATION USER='$recovery_user' , PASSWORD='$recovery_password';
--let $group_replication_member_state = ONLINE
diff --git a/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials.test b/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials.test
index 83374092e5be..5db2ecdba582 100644
--- a/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials.test
+++ b/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials.test
@@ -79,6 +79,7 @@ INSERT INTO t1 VALUES (2);
--source include/connection.inc
RESET REPLICA ALL FOR CHANNEL 'group_replication_recovery';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--let $group_replication_member_state = ERROR
--source include/gr_wait_for_member_state.inc
@@ -96,6 +97,7 @@ INSERT INTO t1 VALUES (3);
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='root';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -109,6 +111,7 @@ INSERT INTO t1 VALUES (4);
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--let $group_replication_member_state = ERROR
--source include/gr_wait_for_member_state.inc
@@ -125,6 +128,7 @@ INSERT INTO t1 VALUES (5);
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_p',PASSWORD='wrong';
--let $group_replication_member_state = ERROR
--source include/gr_wait_for_member_state.inc
@@ -138,6 +142,7 @@ INSERT INTO t1 VALUES (6);
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_p';
--let $group_replication_member_state = ERROR
--source include/gr_wait_for_member_state.inc
@@ -151,6 +156,7 @@ INSERT INTO t1 VALUES (7);
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_wp' , PASSWORD='password';
--let $group_replication_member_state = ERROR
--source include/gr_wait_for_member_state.inc
@@ -167,6 +173,7 @@ INSERT INTO t1 VALUES (8);
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_p' , PASSWORD='password';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -180,6 +187,7 @@ INSERT INTO t1 VALUES (9);
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_p' , PASSWORD='password' , DEFAULT_AUTH='wrong_auth';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -193,6 +201,7 @@ INSERT INTO t1 VALUES (10);
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_p' , PASSWORD='password' , DEFAULT_AUTH= 'auth_test_plugin';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -206,6 +215,7 @@ INSERT INTO t1 VALUES (11);
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION PASSWORD='password' , USER='regular_user_p', DEFAULT_AUTH='auth_test_plugin';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -219,6 +229,7 @@ INSERT INTO t1 VALUES (12);
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_p' , DEFAULT_AUTH= '' , PASSWORD='password';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -232,6 +243,7 @@ INSERT INTO t1 VALUES (13);
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_wp';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -245,6 +257,7 @@ INSERT INTO t1 VALUES (14);
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_wp' , PASSWORD='';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
diff --git a/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_2.test b/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_2.test
index 75b3b815e5c6..6a937605d0f5 100644
--- a/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_2.test
+++ b/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_2.test
@@ -96,6 +96,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER= 'plug_user_p' , PASSWORD= 'proxy_user_p';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -120,6 +121,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER= 'plug_user_wp' , PASSWORD= 'proxy_user_wp';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -144,6 +146,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER= 'plug_user_p' , PASSWORD= 'proxy_user_p' , DEFAULT_AUTH= 'auth_test_plugin';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -168,6 +171,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER= 'plug_user_wp' , PASSWORD= 'proxy_user_wp' , DEFAULT_AUTH= 'auth_test_plugin';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -192,6 +196,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER= 'plug_user_wp' , PASSWORD= 'proxy_user_wp' , DEFAULT_AUTH= 'auth_test_plugin';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -222,6 +227,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER= 'plug_user_p' , PASSWORD= 'proxy_user_p';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -245,6 +251,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER= 'plug_user_p' , PASSWORD= 'proxy_user_p' , DEFAULT_AUTH= 'auth_test_plugin';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -268,6 +275,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER= 'plug_user_wp' , PASSWORD= 'proxy_user_wp' , DEFAULT_AUTH= 'auth_test_plugin';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -298,6 +306,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='plug_user_p',PASSWORD='WRONG';
--let $group_replication_member_state = ERROR
--source include/gr_wait_for_member_state.inc
@@ -322,6 +331,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='plug_user_wp';
--let $group_replication_member_state = ERROR
--source include/gr_wait_for_member_state.inc
@@ -346,6 +356,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_USER_MANDATORY_MSG
START GROUP_REPLICATION PASSWORD='wrong';
--let $assert_text= Password is not logged.
@@ -368,6 +379,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--eval START GROUP_REPLICATION USER='plug_user_p' , PASSWORD='proxy_user_p' , DEFAULT_AUTH='wrong_auth';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
diff --git a/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_3.test b/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_3.test
index 4f4586e23fd0..6ea4fe630498 100644
--- a/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_3.test
+++ b/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_3.test
@@ -96,6 +96,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_USER_EMPTY_MSG
START GROUP_REPLICATION USER='';
--let $assert_text= Command is not logged.
@@ -114,6 +115,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_PARSE_ERROR
START GROUP_REPLICATION USER;
--let $assert_text= Command is not logged.
@@ -136,6 +138,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_PASSWORD_LENGTH
START GROUP_REPLICATION USER='regular_user_p' , PASSWORD='012345678901234567890123456789abc';
--let $assert_text= Command is not logged.
@@ -162,6 +165,7 @@ SET @@GLOBAL.DEBUG='+d,dump_thread_before_read_event';
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_p' , PASSWORD='012345678901234567890123456789ab';
--let $wait_condition=SELECT SERVICE_STATE="ON" FROM performance_schema.replication_connection_status WHERE CHANNEL_NAME='group_replication_recovery'
@@ -216,6 +220,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_USER_MANDATORY_MSG
START GROUP_REPLICATION PASSWORD='wrong';
--let $assert_text= Password is not logged.
@@ -237,6 +242,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_USER_EMPTY_MSG
START GROUP_REPLICATION USER='',PASSWORD='wrong';
--let $assert_text= Command is not logged.
@@ -263,6 +269,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION DEFAULT_AUTH='auth_test_plugin';
--let $group_replication_member_state = ERROR
--source include/gr_wait_for_member_state.inc
@@ -297,6 +304,7 @@ SET GLOBAL super_read_only= FALSE;
SET SQL_LOG_BIN=0;
TRUNCATE mysql.general_log;
SET SQL_LOG_BIN=1;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION DEFAULT_AUTH='auth_test_plugin';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
@@ -320,6 +328,7 @@ INSERT INTO t1 VALUES (9);
--source include/connection.inc
# Below command proves value of DEFAULT_AUTH matters.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION DEFAULT_AUTH='wrong';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
diff --git a/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_mysql_connections.test b/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_mysql_connections.test
index fff9e01d541e..5cce6fb268f6 100644
--- a/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_mysql_connections.test
+++ b/mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_mysql_connections.test
@@ -80,6 +80,7 @@ SET GLOBAL group_replication_recovery_retry_count= 2;
RESET REPLICA ALL FOR CHANNEL 'group_replication_recovery';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -87,54 +88,65 @@ START GROUP_REPLICATION;
--echo # 5. Pass USER as root and test START GR, member should come ONLINE.
--echo # START GR without parameter fails, credentials are removed on STOP.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='root';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
--source include/stop_group_replication.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
--echo
--echo # 6. Test wrong credentials do not connect with master.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION USER='regular_user_p',PASSWORD='wrong';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION USER='regular_user_p';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION USER='regular_user_wp' , PASSWORD='password';
--echo
--echo # 7. Test right credentials in START GR connect with master.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_p' , PASSWORD='password';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
--source include/stop_group_replication.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_p' , PASSWORD='password' , DEFAULT_AUTH= 'auth_test_plugin';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
--source include/stop_group_replication.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION PASSWORD='password' , USER='regular_user_p', DEFAULT_AUTH='auth_test_plugin';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
--source include/stop_group_replication.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_p' , DEFAULT_AUTH= '' , PASSWORD='password';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
--source include/stop_group_replication.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_wp';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
--source include/stop_group_replication.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_wp' , PASSWORD='';
--let $group_replication_member_state = ONLINE
--source include/gr_wait_for_member_state.inc
diff --git a/mysql-test/suite/group_replication/t/gr_start_group_without_boot_node.test b/mysql-test/suite/group_replication/t/gr_start_group_without_boot_node.test
index 9df5b6045f00..5626a3ef61a1 100644
--- a/mysql-test/suite/group_replication/t/gr_start_group_without_boot_node.test
+++ b/mysql-test/suite/group_replication/t/gr_start_group_without_boot_node.test
@@ -51,6 +51,7 @@ SET SESSION sql_log_bin= 1;
--echo ############################################################
--echo # 3. Start the node and expect it to fail
--echo ############################################################
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_start_replication_auto.test b/mysql-test/suite/group_replication/t/gr_start_replication_auto.test
index 2fe5e14784ee..b117b5f38f80 100644
--- a/mysql-test/suite/group_replication/t/gr_start_replication_auto.test
+++ b/mysql-test/suite/group_replication/t/gr_start_replication_auto.test
@@ -30,6 +30,7 @@ SELECT @@group_replication_group_name;
SELECT @@group_replication_group_name;
SELECT @@group_replication_start_on_boot;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_RUNNING
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_start_stop_applier_thd_crash.test b/mysql-test/suite/group_replication/t/gr_start_stop_applier_thd_crash.test
index c2769c434394..029b6be5fb6d 100644
--- a/mysql-test/suite/group_replication/t/gr_start_stop_applier_thd_crash.test
+++ b/mysql-test/suite/group_replication/t/gr_start_stop_applier_thd_crash.test
@@ -106,6 +106,7 @@ SET @@GLOBAL.DEBUG= @debug_save;
# set group_replication_group_name command is failing as the previous start
# process may still be running so can't use
# start_and_bootstrap_group_replication.inc.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--let $group_replication_member_state= ONLINE
diff --git a/mysql-test/suite/group_replication/t/gr_start_stop_behaviour.test b/mysql-test/suite/group_replication/t/gr_start_stop_behaviour.test
index f112c547c256..11e7d9851f79 100644
--- a/mysql-test/suite/group_replication/t/gr_start_stop_behaviour.test
+++ b/mysql-test/suite/group_replication/t/gr_start_stop_behaviour.test
@@ -182,6 +182,7 @@ SET GTID_NEXT= AUTOMATIC;
BEGIN;
INSERT INTO t1 VALUES (4);
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_LOCK_OR_ACTIVE_TRANSACTION
START GROUP_REPLICATION;
@@ -267,6 +268,7 @@ RESET BINARY LOGS AND GTIDS;
SET GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-bbbbbbbbbbbb:1';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_CANT_EXECUTE_COMMAND_WITH_ASSIGNED_GTID_NEXT
START GROUP_REPLICATION;
@@ -359,6 +361,7 @@ LOCK table t1 WRITE;
# should be blocked (this command will try to convert the server
# into read_only mode and it will hang there until MDL lock acquired
# is released)
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_LOCK_OR_ACTIVE_TRANSACTION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_start_stop_no_autocommit.test b/mysql-test/suite/group_replication/t/gr_start_stop_no_autocommit.test
index af7b357413cb..d5b84811c38a 100644
--- a/mysql-test/suite/group_replication/t/gr_start_stop_no_autocommit.test
+++ b/mysql-test/suite/group_replication/t/gr_start_stop_no_autocommit.test
@@ -50,6 +50,7 @@ SET @@GLOBAL.super_read_only= 1;
SET @saved_autocommit = @@SESSION.autocommit;
SET @@SESSION.autocommit = 0;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
COMMIT;
diff --git a/mysql-test/suite/group_replication/t/gr_start_stop_stress.test b/mysql-test/suite/group_replication/t/gr_start_stop_stress.test
index fe0cb6a20ff8..a87b62d79716 100644
--- a/mysql-test/suite/group_replication/t/gr_start_stop_stress.test
+++ b/mysql-test/suite/group_replication/t/gr_start_stop_stress.test
@@ -63,6 +63,7 @@ INSERT INTO t1 VALUES (3);
--let $number_of_reps= 5
while($number_of_reps > 0) {
+ --disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
start group_replication;
stop group_replication;
diff --git a/mysql-test/suite/group_replication/t/gr_start_timeout_set_super_read_only.test b/mysql-test/suite/group_replication/t/gr_start_timeout_set_super_read_only.test
index 02a101401b79..e90b2f4c630a 100644
--- a/mysql-test/suite/group_replication/t/gr_start_timeout_set_super_read_only.test
+++ b/mysql-test/suite/group_replication/t/gr_start_timeout_set_super_read_only.test
@@ -49,6 +49,7 @@ LOCK TABLE t1 WRITE;
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_startup_verifications.test b/mysql-test/suite/group_replication/t/gr_startup_verifications.test
index f27d40f2f5ad..f1e2f6e856d2 100644
--- a/mysql-test/suite/group_replication/t/gr_startup_verifications.test
+++ b/mysql-test/suite/group_replication/t/gr_startup_verifications.test
@@ -30,6 +30,7 @@
SET GLOBAL binlog_format= STATEMENT;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -44,6 +45,7 @@ SET @replica_preserve_commit_order= @@GLOBAL.REPLICA_PRESERVE_COMMIT_ORDER;
SET GLOBAL REPLICA_PARALLEL_WORKERS= 4;
SET @@GLOBAL.REPLICA_PRESERVE_COMMIT_ORDER= OFF;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_startup_verifications_not_binlog.test b/mysql-test/suite/group_replication/t/gr_startup_verifications_not_binlog.test
index 59ed51e2fe4e..b99adec50d6d 100644
--- a/mysql-test/suite/group_replication/t/gr_startup_verifications_not_binlog.test
+++ b/mysql-test/suite/group_replication/t/gr_startup_verifications_not_binlog.test
@@ -35,6 +35,7 @@ if (!`select count(*) from information_schema.plugins where PLUGIN_NAME like 'gr
--echo # Test if binlog disabled will fail.
--echo #
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_startup_verifications_not_gtid.test b/mysql-test/suite/group_replication/t/gr_startup_verifications_not_gtid.test
index af9fc75c0bb0..caf07eebf059 100644
--- a/mysql-test/suite/group_replication/t/gr_startup_verifications_not_gtid.test
+++ b/mysql-test/suite/group_replication/t/gr_startup_verifications_not_gtid.test
@@ -37,6 +37,7 @@ if (!`select count(*) from information_schema.plugins where PLUGIN_NAME like 'gr
--echo # Test if gtid_mode with the wrong value will fail.
--echo #
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_startup_verifications_not_log_replica_updates.test b/mysql-test/suite/group_replication/t/gr_startup_verifications_not_log_replica_updates.test
index c734bf731efc..8f376c05f445 100644
--- a/mysql-test/suite/group_replication/t/gr_startup_verifications_not_log_replica_updates.test
+++ b/mysql-test/suite/group_replication/t/gr_startup_verifications_not_log_replica_updates.test
@@ -30,6 +30,7 @@ SET SESSION sql_log_bin= 1;
--echo # Test if LOG_REPLICA_UPDATES with the wrong value will fail.
--echo #
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_stop_while_recovery_locked.test b/mysql-test/suite/group_replication/t/gr_stop_while_recovery_locked.test
index 2ca7a5c2511c..4bc43e6508ef 100644
--- a/mysql-test/suite/group_replication/t/gr_stop_while_recovery_locked.test
+++ b/mysql-test/suite/group_replication/t/gr_stop_while_recovery_locked.test
@@ -69,6 +69,7 @@ FLUSH TABLES WITH READ LOCK;
--echo # 4. Starting server2 will fail, recovery module fail to stop, as it is
--echo # blocked
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GRP_RPL_RECOVERY_CHANNEL_STILL_RUNNING
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_to_binlogless_slave.test b/mysql-test/suite/group_replication/t/gr_to_binlogless_slave.test
index 67cbc4a71cef..05c2444020f5 100644
--- a/mysql-test/suite/group_replication/t/gr_to_binlogless_slave.test
+++ b/mysql-test/suite/group_replication/t/gr_to_binlogless_slave.test
@@ -101,6 +101,7 @@ set sql_log_bin=1;
# This operation will fail as binlog is disabled in server4
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_transaction_compatibility_basics.test b/mysql-test/suite/group_replication/t/gr_transaction_compatibility_basics.test
index 446f3aa20d03..934287ceef6e 100644
--- a/mysql-test/suite/group_replication/t/gr_transaction_compatibility_basics.test
+++ b/mysql-test/suite/group_replication/t/gr_transaction_compatibility_basics.test
@@ -62,6 +62,7 @@ SET GTID_NEXT= "AUTOMATIC";
--source include/assert.inc
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_user.test b/mysql-test/suite/group_replication/t/gr_user.test
index 9ef324e1667e..a2677ff8cd83 100644
--- a/mysql-test/suite/group_replication/t/gr_user.test
+++ b/mysql-test/suite/group_replication/t/gr_user.test
@@ -56,6 +56,7 @@ let $date_to_restore=`SELECT password_last_changed from mysql.user where user='m
let $date_to_restore_priv=`SELECT timestamp from mysql.tables_priv where user='mysql.session'`;
DROP USER "mysql.session"@"localhost";
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_variables_default_values.test b/mysql-test/suite/group_replication/t/gr_variables_default_values.test
index 8aa60fec644a..3cf9b32157ba 100644
--- a/mysql-test/suite/group_replication/t/gr_variables_default_values.test
+++ b/mysql-test/suite/group_replication/t/gr_variables_default_values.test
@@ -95,7 +95,7 @@ SET @@GLOBAL.group_replication_preemptive_garbage_collection = default;
--let $saved_gr_xcom_ssl_accept_retries = `SELECT @@GLOBAL.group_replication_xcom_ssl_accept_retries;`
# Total number of GR variables.
---let $total_gr_vars= 65
+--let $total_gr_vars= 66
--echo #
--echo # Test Unit#1
@@ -162,6 +162,7 @@ SET @@GLOBAL.group_replication_recovery_tls_version= default;
SET @@GLOBAL.group_replication_recovery_tls_ciphersuites= default;
SET @@GLOBAL.group_replication_advertise_recovery_endpoints = default;
SET @@GLOBAL.group_replication_view_change_uuid= default;
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
SET @@GLOBAL.group_replication_communication_stack = default;
SET @@GLOBAL.group_replication_paxos_single_leader = default;
SET @@GLOBAL.group_replication_preemptive_garbage_collection_rows_threshold = default;
@@ -296,6 +297,11 @@ SET @@SESSION.group_replication_consistency= default;
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_NONE"
--source include/assert.inc
+# group_replication_communication_debug_max_file_size
+--let $assert_text= Default group_replication_communication_debug_max_file_size is 0
+--let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_max_file_size]" = 0
+--source include/assert.inc
+
# group_replication_unreachable_majority_timeout
--let $assert_text= Default group_replication_unreachable_majority_timeout is 0
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_unreachable_majority_timeout]" = 0
@@ -463,6 +469,7 @@ SET @@SESSION.group_replication_consistency= default;
--eval SET @@GLOBAL.group_replication_recovery_tls_ciphersuites= "$saved_gr_recovery_tls_ciphersuites"
--eval SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "$saved_gr_advertise_recovery_endpoints"
--eval SET @@GLOBAL.group_replication_view_change_uuid= "$saved_gr_view_change_uuid"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--eval SET @@GLOBAL.group_replication_communication_stack= "$saved_gr_communication_stack"
--eval SET @@GLOBAL.group_replication_paxos_single_leader= $saved_gr_paxos_single_leader
--eval SET @@GLOBAL.group_replication_preemptive_garbage_collection= $saved_group_replication_preemptive_garbage_collection
diff --git a/mysql-test/suite/group_replication/t/gr_variables_privileges.test b/mysql-test/suite/group_replication/t/gr_variables_privileges.test
index 54d86a8936e6..7406998e4636 100644
--- a/mysql-test/suite/group_replication/t/gr_variables_privileges.test
+++ b/mysql-test/suite/group_replication/t/gr_variables_privileges.test
@@ -88,6 +88,7 @@ GRANT SYSTEM_VARIABLES_ADMIN, SESSION_VARIABLES_ADMIN ON *.* TO 'no_priv_user'@l
while ( $var_id <= $count_vars )
{
--let $var_names= `SELECT var_name FROM gr_vars WHERE id=$var_id`
+ --disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
if ($var_names == "group_replication_consistency")
{
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
diff --git a/mysql-test/suite/group_replication/t/gr_view_change_uuid_check_configuration.test b/mysql-test/suite/group_replication/t/gr_view_change_uuid_check_configuration.test
index 3b27f58bf2ec..3d271dfed052 100644
--- a/mysql-test/suite/group_replication/t/gr_view_change_uuid_check_configuration.test
+++ b/mysql-test/suite/group_replication/t/gr_view_change_uuid_check_configuration.test
@@ -60,6 +60,7 @@ SET PERSIST_ONLY group_replication_view_change_uuid = "";
--source include/assert_grep.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -103,6 +104,7 @@ SET GLOBAL group_replication_view_change_uuid = "";
--let $assert_text= group_replication_group_name shall be different from group_replication_view_change_uuid
--source include/assert_grep.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
@@ -150,6 +152,7 @@ START GROUP_REPLICATION;
--source include/assert_grep.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_view_change_uuid_equal_all_members.test b/mysql-test/suite/group_replication/t/gr_view_change_uuid_equal_all_members.test
index 9007ef443cff..677bf4dcd027 100644
--- a/mysql-test/suite/group_replication/t/gr_view_change_uuid_equal_all_members.test
+++ b/mysql-test/suite/group_replication/t/gr_view_change_uuid_equal_all_members.test
@@ -71,6 +71,7 @@ SET @group_replication_view_change_uuid_save= @@GLOBAL.group_replication_view_ch
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name = "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_view_change_uuid_validation_with_anonymous_server.test b/mysql-test/suite/group_replication/t/gr_view_change_uuid_validation_with_anonymous_server.test
index b0a17199a684..009252a49d88 100644
--- a/mysql-test/suite/group_replication/t/gr_view_change_uuid_validation_with_anonymous_server.test
+++ b/mysql-test/suite/group_replication/t/gr_view_change_uuid_validation_with_anonymous_server.test
@@ -151,6 +151,7 @@
--source include/assert_grep.inc
# Verify that START fails for group_replication
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/gr_with_credential_and_channel.test b/mysql-test/suite/group_replication/t/gr_with_credential_and_channel.test
index 456c369284b1..ab36e6fabe6b 100644
--- a/mysql-test/suite/group_replication/t/gr_with_credential_and_channel.test
+++ b/mysql-test/suite/group_replication/t/gr_with_credential_and_channel.test
@@ -61,6 +61,7 @@ INSERT INTO t1 VALUES (1);
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'invalid', SOURCE_PASSWORD='wrong' FOR CHANNEL 'group_replication_recovery';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='regular_user_p', PASSWORD='password';
--let $group_replication_member_state = ONLINE
@@ -80,6 +81,7 @@ INSERT INTO t1 VALUES (2);
--let $rpl_connection_name= server2
--source include/connection.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--let $group_replication_member_state = ERROR
@@ -100,6 +102,7 @@ INSERT INTO t1 VALUES (3);
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'regular_user_p', SOURCE_PASSWORD='password' FOR CHANNEL 'group_replication_recovery';
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION USER='user_wrong' , PASSWORD='password_wrong';
--let $group_replication_member_state = ERROR
diff --git a/mysql-test/suite/group_replication/t/gr_without_perfschema.test b/mysql-test/suite/group_replication/t/gr_without_perfschema.test
index fe6188920d99..8015c09988ea 100644
--- a/mysql-test/suite/group_replication/t/gr_without_perfschema.test
+++ b/mysql-test/suite/group_replication/t/gr_without_perfschema.test
@@ -38,6 +38,7 @@ INSERT INTO t1 VALUES (1);
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--source include/gr_set_bootstrap_group.inc
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--source include/gr_clear_bootstrap_group.inc
@@ -49,6 +50,7 @@ START GROUP_REPLICATION;
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
START GROUP_REPLICATION;
--echo Wait until server2 recovered table t1
diff --git a/mysql-test/suite/group_replication/t/gr_write_set_extraction_algorithm.test b/mysql-test/suite/group_replication/t/gr_write_set_extraction_algorithm.test
index 22a1f67c2971..9f2e8feea0bd 100644
--- a/mysql-test/suite/group_replication/t/gr_write_set_extraction_algorithm.test
+++ b/mysql-test/suite/group_replication/t/gr_write_set_extraction_algorithm.test
@@ -27,6 +27,7 @@ SET @@GLOBAL.DEBUG= '+d,group_replication_write_set_extraction_algorithm_murmur3
--enable_query_log
# server2 will use XXHASH64 write set extraction algorithm.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/group_replication/t/group_replication.test b/mysql-test/suite/group_replication/t/group_replication.test
index 9742fc10e910..c1c1373f844e 100644
--- a/mysql-test/suite/group_replication/t/group_replication.test
+++ b/mysql-test/suite/group_replication/t/group_replication.test
@@ -54,12 +54,14 @@ SET GLOBAL group_replication_group_name= "8a94f357-aab4-11df-86ab-invalid";
# After the server restart the group name is again set to NULL which will
# cause an error due to wrong configuration.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
--source include/start_group_replication.inc
# This start command will error out since the group is already running.
+--disable_warnings ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,ER_WARN_DEPRECATED_SYNTAX ONCE
--error ER_GROUP_REPLICATION_RUNNING
START GROUP_REPLICATION;
diff --git a/mysql-test/suite/innodb/include/dblwr_encrypt_rowcomp.inc b/mysql-test/suite/innodb/include/dblwr_encrypt_rowcomp.inc
index f681c13cc8f6..53ae00b4d669 100644
--- a/mysql-test/suite/innodb/include/dblwr_encrypt_rowcomp.inc
+++ b/mysql-test/suite/innodb/include/dblwr_encrypt_rowcomp.inc
@@ -53,6 +53,8 @@ let PAGE_NO=`select @page_no`;
let FILE_NAME=`select @space_file_name`;
let PAGE_SIZE=`select @space_page_size`;
+SET GLOBAL innodb_log_flush_now = ON;
+
--source include/kill_mysqld.inc
--echo # Corrupt the root page of table t1 in the user tablespace.
diff --git a/mysql-test/suite/innodb/include/flush_dirty_pages_and_stop_flushing.inc b/mysql-test/suite/innodb/include/flush_dirty_pages_and_stop_flushing.inc
index 5f5cf92506dd..c2157c40830d 100644
--- a/mysql-test/suite/innodb/include/flush_dirty_pages_and_stop_flushing.inc
+++ b/mysql-test/suite/innodb/include/flush_dirty_pages_and_stop_flushing.inc
@@ -16,5 +16,6 @@ SET GLOBAL innodb_log_checkpoint_now = ON;
# Disable page cleaner threads, because we are going to fill
# redo log and we want to collect a group of dirty pages for
-# which the redo log records protect changes.
+# which the redo log records protect changes. This also pauses the
+# per-instance LRU manager threads, which reuse this same debug flag.
SET GLOBAL innodb_page_cleaner_disabled_debug = ON;
\ No newline at end of file
diff --git a/mysql-test/suite/innodb/r/ahi_persist_during_buf_pool_resize.result b/mysql-test/suite/innodb/r/ahi_persist_during_buf_pool_resize.result
new file mode 100644
index 000000000000..b11022b7f000
--- /dev/null
+++ b/mysql-test/suite/innodb/r/ahi_persist_during_buf_pool_resize.result
@@ -0,0 +1,16 @@
+RESET PERSIST IF EXISTS innodb_adaptive_hash_index;
+# Reproduce the transient OFF state during buffer pool resize
+SET GLOBAL debug = '+d,ib_buf_pool_resize_after_disable_ahi';
+SET GLOBAL innodb_adaptive_hash_index = ON;
+SET GLOBAL innodb_buffer_pool_size = @new_innodb_buffer_pool_size;
+# Verify resize has already disabled AHI
+include/assert_grep.inc [mysqld.err shows AHI was disabled by buffer pool resize]
+# Persist the user-requested value while resize still keeps AHI disabled
+SET PERSIST innodb_adaptive_hash_index = ON;
+# Verify the fixed persisted result
+include/assert_grep.inc [mysqld-auto.cnf persists innodb_adaptive_hash_index=ON]
+SET GLOBAL debug = '-d,ib_buf_pool_resize_after_disable_ahi';
+SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index;
+SET GLOBAL innodb_buffer_pool_size = @old_innodb_buffer_pool_size;
+RESET PERSIST IF EXISTS innodb_adaptive_hash_index;
+SET GLOBAL debug = @old_debug;
diff --git a/mysql-test/suite/innodb/r/attachable_trx.result b/mysql-test/suite/innodb/r/attachable_trx.result
index 17d41daa468b..564bc070a182 100644
--- a/mysql-test/suite/innodb/r/attachable_trx.result
+++ b/mysql-test/suite/innodb/r/attachable_trx.result
@@ -1,4 +1,4 @@
-SET @debug_saved = @@global.debug;
+SET @debug_saved = @@debug;
START TRANSACTION;
@@ -29,13 +29,13 @@ a b
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
START TRANSACTION;
-SET @@global.debug = '+d,use_attachable_trx';
+SET @@debug = '+d,use_attachable_trx';
SELECT * FROM t1;
a b
1 aaa
2 bbb
3 ccc
-SET @@global.debug = '-d,use_attachable_trx';
+SET @@debug = '-d,use_attachable_trx';
# [default connection]
@@ -69,13 +69,13 @@ a b
3 ccc
# SELECT in the inner transaction sees the changes.
-SET @@global.debug = '+d,use_attachable_trx';
+SET @@debug = '+d,use_attachable_trx';
SELECT * FROM t1;
a b
1 aaa
2 zzz
3 ccc
-SET @@global.debug = '-d,use_attachable_trx';
+SET @@debug = '-d,use_attachable_trx';
# COMMIT the outer transaction.
COMMIT;
@@ -111,13 +111,13 @@ a b
3 ccc
# Do anything in the inner transaction.
-SET @@global.debug = '+d,use_attachable_trx';
+SET @@debug = '+d,use_attachable_trx';
SELECT * FROM t1;
a b
1 aaa
2 zzz
3 ccc
-SET @@global.debug = '-d,use_attachable_trx';
+SET @@debug = '-d,use_attachable_trx';
# Just make sure the changes are still there.
SELECT * FROM t1;
@@ -142,4 +142,4 @@ COMMIT;
# Cleanup.
DROP TABLE t1;
-SET @@global.debug = @debug_saved;
+SET @@debug = @debug_saved;
diff --git a/mysql-test/suite/innodb/r/buffer_pool_lazy_latch_init.result b/mysql-test/suite/innodb/r/buffer_pool_lazy_latch_init.result
new file mode 100644
index 000000000000..cfeac1e2af5b
--- /dev/null
+++ b/mysql-test/suite/innodb/r/buffer_pool_lazy_latch_init.result
@@ -0,0 +1,51 @@
+SELECT @@global.innodb_buffer_pool_lazy_latch_init;
+@@global.innodb_buffer_pool_lazy_latch_init
+1
+# Scan I_S.INNODB_BUFFER_PAGE while the pool is mostly unused.
+# Without the lazy-init guard this enters an unconstructed mutex.
+SELECT COUNT(*) > 0 AS ok FROM information_schema.innodb_buffer_page
+WHERE page_state = 'NOT_USED' AND page_type = 'UNKNOWN';
+ok
+1
+# Fault index/data pages into the pool.
+CREATE TABLE t1 (id INT PRIMARY KEY, val INT) ENGINE=InnoDB;
+# Some INDEX pages are now cached.
+SELECT COUNT(*) > 0 AS ok FROM information_schema.innodb_buffer_page
+WHERE page_type = 'INDEX';
+ok
+1
+# Create compressed pages, evict their uncompressed frames, then scan
+# I_S.INNODB_BUFFER_PAGE_LRU for standalone compressed descriptors.
+CREATE TABLE t_zip (
+id INT PRIMARY KEY,
+val BLOB,
+KEY(val(10))
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+SELECT COUNT(*) FROM t_zip;
+COUNT(*)
+100
+SELECT COUNT(*) > 0 AS ok FROM information_schema.innodb_buffer_page_lru;
+ok
+1
+# Expand the buffer pool (new lazy chunks), then re-scan.
+SET GLOBAL innodb_buffer_pool_size = 25165824;
+SELECT COUNT(*) > 0 AS ok FROM information_schema.innodb_buffer_page;
+ok
+1
+# Shrink the buffer pool (chunks freed), then re-scan.
+SET GLOBAL innodb_buffer_pool_size = 8388608;
+SELECT COUNT(*) > 0 AS ok FROM information_schema.innodb_buffer_page;
+ok
+1
+# Restart: the pool comes back up in lazy mode (opt reapplied).
+# restart
+SELECT @@global.innodb_buffer_pool_lazy_latch_init;
+@@global.innodb_buffer_pool_lazy_latch_init
+1
+SELECT COUNT(*) > 0 AS ok FROM information_schema.innodb_buffer_page;
+ok
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2000
+DROP TABLE t1, t_zip;
diff --git a/mysql-test/suite/innodb/r/builder_error_case.result b/mysql-test/suite/innodb/r/builder_error_case.result
index 2378ff614b9b..f20c135593f8 100644
--- a/mysql-test/suite/innodb/r/builder_error_case.result
+++ b/mysql-test/suite/innodb/r/builder_error_case.result
@@ -24,16 +24,6 @@ test.t1 optimize status Operation failed
Warnings:
Error 1062 Duplicate entry '' for key '*UNKNOWN*'
SET DEBUG="-d,builder_bulk_add_row_trigger_error_1";
-# Builder::bulk_add_row returns DB_INVALID_NULL
-SET DEBUG="+d,builder_bulk_add_row_trigger_error_2";
-OPTIMIZE TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
-test.t1 optimize error Invalid use of NULL value
-test.t1 optimize status Operation failed
-Warnings:
-Error 1138 Invalid use of NULL value
-SET DEBUG="-d,builder_bulk_add_row_trigger_error_2";
# Builder::bulk_add_row returns DB_IO_ERROR
SET DEBUG="+d,builder_bulk_add_row_trigger_error_3";
OPTIMIZE TABLE t1;
diff --git a/mysql-test/suite/innodb/r/dblwr_encrypt_rowcomp.result b/mysql-test/suite/innodb/r/dblwr_encrypt_rowcomp.result
index 6fecf87d8713..006def8398b7 100644
--- a/mysql-test/suite/innodb/r/dblwr_encrypt_rowcomp.result
+++ b/mysql-test/suite/innodb/r/dblwr_encrypt_rowcomp.result
@@ -47,6 +47,7 @@ SELECT @@session.innodb_interpreter_output INTO @space_file_name;
SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size test/t1';
SELECT @@session.innodb_interpreter_output INTO @space_page_size;
SET SESSION innodb_interpreter = 'destroy';
+SET GLOBAL innodb_log_flush_now = ON;
# Kill the server
# Corrupt the root page of table t1 in the user tablespace.
SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages';
@@ -108,6 +109,7 @@ SELECT @@session.innodb_interpreter_output INTO @space_file_name;
SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size test/t1';
SELECT @@session.innodb_interpreter_output INTO @space_page_size;
SET SESSION innodb_interpreter = 'destroy';
+SET GLOBAL innodb_log_flush_now = ON;
# Kill the server
# Corrupt the root page of table t1 in the user tablespace.
SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages';
@@ -169,6 +171,7 @@ SELECT @@session.innodb_interpreter_output INTO @space_file_name;
SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size test/t1';
SELECT @@session.innodb_interpreter_output INTO @space_page_size;
SET SESSION innodb_interpreter = 'destroy';
+SET GLOBAL innodb_log_flush_now = ON;
# Kill the server
# Corrupt the root page of table t1 in the user tablespace.
SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages';
@@ -230,6 +233,7 @@ SELECT @@session.innodb_interpreter_output INTO @space_file_name;
SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size test/t1';
SELECT @@session.innodb_interpreter_output INTO @space_page_size;
SET SESSION innodb_interpreter = 'destroy';
+SET GLOBAL innodb_log_flush_now = ON;
# Kill the server
# Corrupt the root page of table t1 in the user tablespace.
SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages';
diff --git a/mysql-test/suite/innodb/r/dblwr_lz4_encrypt.result b/mysql-test/suite/innodb/r/dblwr_lz4_encrypt.result
index 23dad78aba74..f66409d492aa 100644
--- a/mysql-test/suite/innodb/r/dblwr_lz4_encrypt.result
+++ b/mysql-test/suite/innodb/r/dblwr_lz4_encrypt.result
@@ -47,6 +47,7 @@ SET @cmd = CONCAT('make_page_dirty ', @space_id, ' 0');
SET SESSION innodb_interpreter = @cmd;
SET SESSION innodb_interpreter = 'corrupt_ondisk_page0 test/t1';
SET SESSION innodb_interpreter = 'destroy';
+SET GLOBAL innodb_log_flush_now = ON;
# Kill and restart: PLUGIN_DIR_OPT
SET SESSION innodb_interpreter = 'init';
SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages';
diff --git a/mysql-test/suite/innodb/r/dblwr_lz4_encrypt_recv.result b/mysql-test/suite/innodb/r/dblwr_lz4_encrypt_recv.result
index 829fdcfc2ca7..28150caad677 100644
--- a/mysql-test/suite/innodb/r/dblwr_lz4_encrypt_recv.result
+++ b/mysql-test/suite/innodb/r/dblwr_lz4_encrypt_recv.result
@@ -11,6 +11,8 @@
# Check if the DBLWR recovery works correctly for a page
# that is compressed and encrypted.
create table t1 (f1 int primary key, f2 blob) COMPRESSION='lz4' ENCRYPTION='Y';
+SET GLOBAL innodb_master_thread_disabled_debug=1;
+SET GLOBAL innodb_checkpoint_disabled = 1;
START TRANSACTION;
INSERT INTO t1 VALUES(1, repeat('#',12));
INSERT INTO t1 VALUES(2, repeat('+',12));
diff --git a/mysql-test/suite/innodb/r/dblwr_recover_zeroes.result b/mysql-test/suite/innodb/r/dblwr_recover_zeroes.result
index 494182f6530c..673553406654 100644
--- a/mysql-test/suite/innodb/r/dblwr_recover_zeroes.result
+++ b/mysql-test/suite/innodb/r/dblwr_recover_zeroes.result
@@ -47,6 +47,7 @@ SELECT @@session.innodb_interpreter_output INTO @space_file_name;
SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size test/t1';
SELECT @@session.innodb_interpreter_output INTO @space_page_size;
SET SESSION innodb_interpreter = 'destroy';
+SET GLOBAL innodb_log_flush_now = ON;
# Kill the server
# Corrupt the root page of table t1 in the user tablespace.
# restart: PLUGIN_DIR_OPT
diff --git a/mysql-test/suite/innodb/r/dblwr_zlib_encrypt.result b/mysql-test/suite/innodb/r/dblwr_zlib_encrypt.result
index 1a596dcbbf24..11075d19b388 100644
--- a/mysql-test/suite/innodb/r/dblwr_zlib_encrypt.result
+++ b/mysql-test/suite/innodb/r/dblwr_zlib_encrypt.result
@@ -39,6 +39,7 @@ SET @cmd = CONCAT('make_page_dirty ', @space_id, ' 0');
SET SESSION innodb_interpreter = @cmd;
SET SESSION innodb_interpreter = 'corrupt_ondisk_page0 test/t1';
SET SESSION innodb_interpreter = 'destroy';
+SET GLOBAL innodb_log_flush_now = ON;
# Kill and restart: PLUGIN_DIR_OPT
SET SESSION innodb_interpreter = 'init';
SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages';
diff --git a/mysql-test/suite/innodb/r/dblwr_zlib_encrypt_recv.result b/mysql-test/suite/innodb/r/dblwr_zlib_encrypt_recv.result
index a61b6dc1996b..20fbc91a3cbb 100644
--- a/mysql-test/suite/innodb/r/dblwr_zlib_encrypt_recv.result
+++ b/mysql-test/suite/innodb/r/dblwr_zlib_encrypt_recv.result
@@ -11,6 +11,8 @@
# Check if the DBLWR recovery works correctly for a page
# that is compressed and encrypted.
create table t1 (f1 int primary key, f2 blob) COMPRESSION='zlib' ENCRYPTION='Y';
+SET GLOBAL innodb_master_thread_disabled_debug=1;
+SET GLOBAL innodb_checkpoint_disabled = 1;
START TRANSACTION;
INSERT INTO t1 VALUES(1, repeat('#',12));
INSERT INTO t1 VALUES(2, repeat('+',12));
diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result
index c56d243f2d93..8f6d0ec9a03a 100644
--- a/mysql-test/suite/innodb/r/innodb.result
+++ b/mysql-test/suite/innodb/r/innodb.result
@@ -1863,7 +1863,7 @@ variable_value
{checked_valid}
SELECT sum(variable_value) - @innodb_rows_deleted_orig FROM performance_schema.global_status WHERE LOWER(variable_name) like 'innodb%_rows_deleted';
sum(variable_value) - @innodb_rows_deleted_orig
-1846
+1844
SELECT sum(variable_value) - @innodb_rows_inserted_orig FROM performance_schema.global_status WHERE LOWER(variable_name) like 'innodb%_rows_inserted';
sum(variable_value) - @innodb_rows_inserted_orig
2733
diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result
index 98415ff51038..96a119c79541 100644
--- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result
+++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result
@@ -28,7 +28,7 @@ select @@global.innodb_adaptive_hash_index;
set global innodb_adaptive_hash_index = ON;
select @@global.innodb_adaptive_hash_index;
@@global.innodb_adaptive_hash_index
-0
+1
set global innodb_adaptive_hash_index = OFF;
select @@global.innodb_adaptive_hash_index;
@@global.innodb_adaptive_hash_index
diff --git a/mysql-test/suite/innodb/r/innodb_bug115136.result b/mysql-test/suite/innodb/r/innodb_bug115136.result
new file mode 100644
index 000000000000..c44d7f02f08b
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug115136.result
@@ -0,0 +1,36 @@
+set @ori_parallel_read_threads = @@innodb_parallel_read_threads;
+set @ori_ddl_threads = @@innodb_ddl_threads;
+set @ori_ddl_buffer_size = @@innodb_ddl_buffer_size;
+create table a(a int, b int, primary key(a));
+set innodb_parallel_read_threads = 16;
+set innodb_ddl_threads = 16;
+CREATE PROCEDURE insert_into_tables(IN num INTEGER)
+BEGIN
+declare x INT;
+set x = 1;
+while x < num do
+INSERT INTO `a` (`a`, `b`) VALUES (x, x);
+set x = x + 1;
+end while;
+end$$
+call insert_into_tables(10000);
+set innodb_ddl_buffer_size = 65536;
+alter table a add column `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, ADD KEY (`id`);
+select max(a), max(b), max(id) from a;
+max(a) max(b) max(id)
+9999 9999 9999
+select b from a where b not in (select id from a);
+b
+set innodb_ddl_buffer_size = 104857600;
+alter table a drop column id, drop index id;
+alter table a add column `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, ADD KEY (`id`);
+select max(a), max(b), max(id) from a;
+max(a) max(b) max(id)
+9999 9999 9999
+select b from a where b not in (select id from a);
+b
+drop table a;
+drop PROCEDURE insert_into_tables;
+set innodb_parallel_read_threads = @ori_parallel_read_threads;
+set innodb_ddl_threads = @ori_ddl_threads;
+set innodb_ddl_buffer_size = @ori_ddl_buffer_size;
diff --git a/mysql-test/suite/innodb/r/innodb_information_schema_buffer.result b/mysql-test/suite/innodb/r/innodb_information_schema_buffer.result
index 7f1ab8de6809..2716655da796 100644
--- a/mysql-test/suite/innodb/r/innodb_information_schema_buffer.result
+++ b/mysql-test/suite/innodb/r/innodb_information_schema_buffer.result
@@ -67,10 +67,10 @@ SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME like "%infoschema_buffer_test%";
TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE PAGE_STATE PAGE_TYPE
-SELECT space, is_stale FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
-WHERE space = {space_id} GROUP BY space, is_stale;;
-space is_stale
-{space_id} YES
+SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
+WHERE space = {space_id} AND is_stale = 'NO';
+count(*)
+0
# Emptying InnoDB buffer pool: begin
# Buffer pool size: 25165824 bytes
# Creating and dropping a table with size: 50331648 bytes
diff --git a/mysql-test/suite/innodb/r/innodb_lru_threads_kill_recovery.result b/mysql-test/suite/innodb/r/innodb_lru_threads_kill_recovery.result
new file mode 100644
index 000000000000..23a90998a4c3
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_lru_threads_kill_recovery.result
@@ -0,0 +1,23 @@
+#
+# PS-11445: with --innodb-lru-threads=ON, the LRU manager threads
+# are created before buf_pool_invalidate() runs on every startup, so
+# they are alive throughout crash recovery (including the
+# buf_pool_invalidate_instance() pause/resume of run_lru). Restart
+# after a crash with a non-trivial amount of redo to apply exercises
+# that path; a normal restart afterward exercises the page-cleaner
+# coordinator waiting for the LRU managers to stop on shutdown.
+#
+# restart:--innodb-lru-threads=ON --innodb-buffer-pool-size=8M --innodb-buffer-pool-instances=2 --innodb-lru-scan-depth=100
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(512)) ENGINE=InnoDB;
+# Kill and restart:--innodb-lru-threads=ON --innodb-buffer-pool-size=8M --innodb-buffer-pool-instances=2 --innodb-lru-scan-depth=100
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+20000
+# Clean shutdown must not hang: the page-cleaner coordinator has to
+# observe every LRU manager thread stop.
+# restart:--innodb-lru-threads=ON --innodb-buffer-pool-size=8M --innodb-buffer-pool-instances=2 --innodb-lru-scan-depth=100
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+20000
+DROP TABLE t1;
+# restart
diff --git a/mysql-test/suite/innodb/r/monitor.result b/mysql-test/suite/innodb/r/monitor.result
index 79e7114989f6..3650df0ca786 100644
--- a/mysql-test/suite/innodb/r/monitor.result
+++ b/mysql-test/suite/innodb/r/monitor.result
@@ -107,6 +107,8 @@ buffer_LRU_search_scanned_per_call disabled
buffer_LRU_unzip_search_scanned disabled
buffer_LRU_unzip_search_num_scan disabled
buffer_LRU_unzip_search_scanned_per_call disabled
+buffer_LRU_single_page_flush_count disabled
+buffer_LRU_flush_await_count disabled
buffer_page_read_index_leaf disabled
buffer_page_read_index_non_leaf disabled
buffer_page_read_index_ibuf_leaf disabled
diff --git a/mysql-test/suite/innodb/r/multi_value_basic.result b/mysql-test/suite/innodb/r/multi_value_basic.result
index b4bb61b03f24..43dbb722c0dc 100644
--- a/mysql-test/suite/innodb/r/multi_value_basic.result
+++ b/mysql-test/suite/innodb/r/multi_value_basic.result
@@ -1161,7 +1161,7 @@ id doc_id doc
5 2 {"val": [4, 5]}
EXPLAIN SELECT * FROM t FORCE INDEX (mv_doc_id) WHERE doc_id is NOT NULL;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t NULL range mv_doc_id mv_doc_id 5 NULL 15 100.00 Using where
+1 SIMPLE t NULL range mv_doc_id mv_doc_id 5 NULL 1 100.00 Using where
Warnings:
Note 1003 /* select#1 */ select `test`.`t`.`id` AS `id`,`test`.`t`.`doc_id` AS `doc_id`,`test`.`t`.`doc` AS `doc` from `test`.`t` FORCE INDEX (`mv_doc_id`) where (`test`.`t`.`doc_id` is not null)
SELECT * FROM t FORCE INDEX (mv_doc_id) WHERE doc_id is NOT NULL;
diff --git a/mysql-test/suite/innodb/r/page_tracking_corruption.result b/mysql-test/suite/innodb/r/page_tracking_corruption.result
new file mode 100644
index 000000000000..0d9d69e30c10
--- /dev/null
+++ b/mysql-test/suite/innodb/r/page_tracking_corruption.result
@@ -0,0 +1,40 @@
+#
+# Enable page tracking
+#
+INSTALL COMPONENT 'file://component_mysqlbackup';
+SELECT mysqlbackup_page_track_set(1);
+mysqlbackup_page_track_set(1)
+#
+#
+# Generate data to create page tracking archive files
+#
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
+UPDATE t1 SET b = REPEAT('y', 1000);
+#
+# Verify page tracking works before corruption
+#
+SELECT mysqlbackup_page_track_get_changed_page_count(mysqlbackup_page_track_get_start_lsn(), mysqlbackup_page_track_get_start_lsn() + 1);
+mysqlbackup_page_track_get_changed_page_count(mysqlbackup_page_track_get_start_lsn(), mysqlbackup_page_track_get_start_lsn() + 1)
+#
+#
+# Shutdown the server
+#
+#
+# Corrupt page tracking archive files
+#
+Page tracking archive files corrupted successfully.
+#
+# Restart the server — should succeed despite corrupted archive files
+#
+# restart
+#
+# Verify page tracking query does not crash after corruption
+#
+SELECT mysqlbackup_page_track_get_changed_page_count(mysqlbackup_page_track_get_start_lsn(), mysqlbackup_page_track_get_start_lsn() + 1);
+mysqlbackup_page_track_get_changed_page_count(mysqlbackup_page_track_get_start_lsn(), mysqlbackup_page_track_get_start_lsn() + 1)
+#
+#
+# Cleanup
+#
+DROP TABLE t1;
+UNINSTALL COMPONENT 'file://component_mysqlbackup';
diff --git a/mysql-test/suite/innodb/t/ahi_persist_during_buf_pool_resize.test b/mysql-test/suite/innodb/t/ahi_persist_during_buf_pool_resize.test
new file mode 100644
index 000000000000..c5bd518d7e2e
--- /dev/null
+++ b/mysql-test/suite/innodb/t/ahi_persist_during_buf_pool_resize.test
@@ -0,0 +1,64 @@
+#
+# BUG#39157211: InnoDB: SET PERSIST innodb_adaptive_hash_index = "ON" stores "OFF" value in the mysqld-auto.cnf file
+#
+
+--source include/have_debug.inc
+
+# Setup
+--let $MYSQL_DATA_DIR = `SELECT @@datadir`
+
+--disable_query_log
+SET @old_debug = @@global.debug;
+SET @old_innodb_adaptive_hash_index = @@global.innodb_adaptive_hash_index;
+SET @old_innodb_buffer_pool_size = @@global.innodb_buffer_pool_size;
+SET @new_innodb_buffer_pool_size = 2 * @old_innodb_buffer_pool_size;
+--enable_query_log
+
+--disable_warnings
+RESET PERSIST IF EXISTS innodb_adaptive_hash_index;
+--enable_warnings
+
+--echo # Reproduce the transient OFF state during buffer pool resize
+SET GLOBAL debug = '+d,ib_buf_pool_resize_after_disable_ahi';
+SET GLOBAL innodb_adaptive_hash_index = ON;
+SET GLOBAL innodb_buffer_pool_size = @new_innodb_buffer_pool_size;
+
+--let $wait_timeout = 60
+--let $wait_condition = SELECT variable_value = 2 FROM performance_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status_code'
+--source include/wait_condition.inc
+
+--echo # Verify resize has already disabled AHI
+--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err
+--let $assert_match = disabled adaptive hash index
+--let $assert_select = disabled adaptive hash index
+--let $assert_text = mysqld.err shows AHI was disabled by buffer pool resize
+--source include/assert_grep.inc
+
+--echo # Persist the user-requested value while resize still keeps AHI disabled
+SET PERSIST innodb_adaptive_hash_index = ON;
+
+--echo # Verify the fixed persisted result
+--let $assert_file = $MYSQL_DATA_DIR/mysqld-auto.cnf
+--let $assert_match = "innodb_adaptive_hash_index": \{"Value": "ON"
+--let $assert_select = "mysql_dynamic_variables": \{"innodb_adaptive_hash_index"
+--let $assert_text = mysqld-auto.cnf persists innodb_adaptive_hash_index=ON
+--source include/assert_grep.inc
+
+# Cleanup
+SET GLOBAL debug = '-d,ib_buf_pool_resize_after_disable_ahi';
+
+--let $wait_timeout = 60
+--let $wait_condition = SELECT SUBSTR(variable_value, 1, 9) = 'Completed' FROM performance_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'
+--source include/wait_condition.inc
+
+SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index;
+SET GLOBAL innodb_buffer_pool_size = @old_innodb_buffer_pool_size;
+
+--let $wait_timeout = 60
+--let $wait_condition = SELECT SUBSTR(variable_value, 1, 9) = 'Completed' FROM performance_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'
+--source include/wait_condition.inc
+
+RESET PERSIST IF EXISTS innodb_adaptive_hash_index;
+SET GLOBAL debug = @old_debug;
+
+--remove_file $MYSQL_DATA_DIR/mysqld-auto.cnf
diff --git a/mysql-test/suite/innodb/t/buffer_pool_lazy_latch_init-master.opt b/mysql-test/suite/innodb/t/buffer_pool_lazy_latch_init-master.opt
new file mode 100644
index 000000000000..e65ee78b8bc1
--- /dev/null
+++ b/mysql-test/suite/innodb/t/buffer_pool_lazy_latch_init-master.opt
@@ -0,0 +1 @@
+--innodb-buffer-pool-lazy-latch-init=ON --innodb-buffer-pool-size=16M --innodb-buffer-pool-chunk-size=2M
diff --git a/mysql-test/suite/innodb/t/buffer_pool_lazy_latch_init.test b/mysql-test/suite/innodb/t/buffer_pool_lazy_latch_init.test
new file mode 100644
index 000000000000..330a5ca9d2a8
--- /dev/null
+++ b/mysql-test/suite/innodb/t/buffer_pool_lazy_latch_init.test
@@ -0,0 +1,97 @@
+#
+# PS-10595: exercise innodb_buffer_pool_lazy_latch_init=ON end to end.
+#
+# With lazy latch init, a never-used buffer block has no constructed latches.
+# This test drives the paths that touch every chunk block regardless of state:
+# - INFORMATION_SCHEMA.INNODB_BUFFER_PAGE scans all blocks (including unused
+# ones) - it must report unused blocks as free without entering their
+# (unconstructed) mutex,
+# - online buffer pool resize creates fresh lazy chunks and later frees them,
+# - a restart brings the pool back up in lazy mode.
+# On a debug build this also activates all the block->latches_initialized
+# assertions added by this feature.
+#
+
+--source include/have_innodb_max_16k.inc
+
+# The feature is opt-in and read only; confirm the server started with it ON.
+SELECT @@global.innodb_buffer_pool_lazy_latch_init;
+
+let $wait_timeout = 180;
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at '
+ FROM performance_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status';
+
+--echo # Scan I_S.INNODB_BUFFER_PAGE while the pool is mostly unused.
+--echo # Without the lazy-init guard this enters an unconstructed mutex.
+SELECT COUNT(*) > 0 AS ok FROM information_schema.innodb_buffer_page
+ WHERE page_state = 'NOT_USED' AND page_type = 'UNKNOWN';
+
+--echo # Fault index/data pages into the pool.
+CREATE TABLE t1 (id INT PRIMARY KEY, val INT) ENGINE=InnoDB;
+--disable_query_log
+BEGIN;
+let $i = 2000;
+while ($i) {
+ eval INSERT INTO t1 VALUES ($i, $i);
+ dec $i;
+}
+COMMIT;
+--enable_query_log
+
+--echo # Some INDEX pages are now cached.
+SELECT COUNT(*) > 0 AS ok FROM information_schema.innodb_buffer_page
+ WHERE page_type = 'INDEX';
+
+--echo # Create compressed pages, evict their uncompressed frames, then scan
+--echo # I_S.INNODB_BUFFER_PAGE_LRU for standalone compressed descriptors.
+CREATE TABLE t_zip (
+ id INT PRIMARY KEY,
+ val BLOB,
+ KEY(val(10))
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+--disable_query_log
+BEGIN;
+let $i = 100;
+while ($i) {
+ eval INSERT INTO t_zip VALUES ($i, REPEAT('a', 2000));
+ dec $i;
+}
+COMMIT;
+--enable_query_log
+SELECT COUNT(*) FROM t_zip;
+
+let $have_debug = `SELECT VERSION() LIKE '%debug%'`;
+if ($have_debug) {
+ --disable_query_log
+ SET GLOBAL innodb_buffer_pool_evict = 'uncompressed';
+ --enable_query_log
+
+ let $compressed_only_pages = `SELECT COUNT(*)
+ FROM information_schema.innodb_buffer_page_lru
+ WHERE table_name LIKE '%t_zip%' AND compressed = 'YES'`;
+ if (!$compressed_only_pages) {
+ --die Expected standalone compressed descriptors for t_zip
+ }
+}
+
+SELECT COUNT(*) > 0 AS ok FROM information_schema.innodb_buffer_page_lru;
+
+--echo # Expand the buffer pool (new lazy chunks), then re-scan.
+SET GLOBAL innodb_buffer_pool_size = 25165824;
+--source include/wait_condition.inc
+SELECT COUNT(*) > 0 AS ok FROM information_schema.innodb_buffer_page;
+
+--echo # Shrink the buffer pool (chunks freed), then re-scan.
+SET GLOBAL innodb_buffer_pool_size = 8388608;
+--source include/wait_condition.inc
+SELECT COUNT(*) > 0 AS ok FROM information_schema.innodb_buffer_page;
+
+--echo # Restart: the pool comes back up in lazy mode (opt reapplied).
+--source include/restart_mysqld.inc
+SELECT @@global.innodb_buffer_pool_lazy_latch_init;
+SELECT COUNT(*) > 0 AS ok FROM information_schema.innodb_buffer_page;
+SELECT COUNT(*) FROM t1;
+
+DROP TABLE t1, t_zip;
diff --git a/mysql-test/suite/innodb/t/builder_error_case.test b/mysql-test/suite/innodb/t/builder_error_case.test
index 635e47df8a80..e44b08c25d2b 100644
--- a/mysql-test/suite/innodb/t/builder_error_case.test
+++ b/mysql-test/suite/innodb/t/builder_error_case.test
@@ -51,11 +51,6 @@ SET DEBUG="+d,builder_bulk_add_row_trigger_error_1";
OPTIMIZE TABLE t1;
SET DEBUG="-d,builder_bulk_add_row_trigger_error_1";
---echo # Builder::bulk_add_row returns DB_INVALID_NULL
-SET DEBUG="+d,builder_bulk_add_row_trigger_error_2";
-OPTIMIZE TABLE t1;
-SET DEBUG="-d,builder_bulk_add_row_trigger_error_2";
-
--echo # Builder::bulk_add_row returns DB_IO_ERROR
SET DEBUG="+d,builder_bulk_add_row_trigger_error_3";
OPTIMIZE TABLE t1;
diff --git a/mysql-test/suite/innodb/t/dblwr_lz4_encrypt.test b/mysql-test/suite/innodb/t/dblwr_lz4_encrypt.test
index 4af6260765d1..bbb51d6e0831 100644
--- a/mysql-test/suite/innodb/t/dblwr_lz4_encrypt.test
+++ b/mysql-test/suite/innodb/t/dblwr_lz4_encrypt.test
@@ -65,6 +65,8 @@ SET SESSION innodb_interpreter = @cmd;
SET SESSION innodb_interpreter = 'corrupt_ondisk_page0 test/t1';
SET SESSION innodb_interpreter = 'destroy';
+SET GLOBAL innodb_log_flush_now = ON;
+
--replace_result $PLUGIN_DIR_OPT PLUGIN_DIR_OPT
--source include/kill_and_restart_mysqld.inc
diff --git a/mysql-test/suite/innodb/t/dblwr_lz4_encrypt_recv.test b/mysql-test/suite/innodb/t/dblwr_lz4_encrypt_recv.test
index 1c7a8189529e..d8fbc0645f34 100644
--- a/mysql-test/suite/innodb/t/dblwr_lz4_encrypt_recv.test
+++ b/mysql-test/suite/innodb/t/dblwr_lz4_encrypt_recv.test
@@ -13,6 +13,9 @@
create table t1 (f1 int primary key, f2 blob) COMPRESSION='lz4' ENCRYPTION='Y';
+SET GLOBAL innodb_master_thread_disabled_debug=1;
+SET GLOBAL innodb_checkpoint_disabled = 1;
+
START TRANSACTION;
INSERT INTO t1 VALUES(1, repeat('#',12));
INSERT INTO t1 VALUES(2, repeat('+',12));
diff --git a/mysql-test/suite/innodb/t/dblwr_recover_zeroes.test b/mysql-test/suite/innodb/t/dblwr_recover_zeroes.test
index 5d0dbcbbe421..750a23b85566 100644
--- a/mysql-test/suite/innodb/t/dblwr_recover_zeroes.test
+++ b/mysql-test/suite/innodb/t/dblwr_recover_zeroes.test
@@ -65,6 +65,8 @@ let PAGE_NO=`select @page_no`;
let FILE_NAME=`select @space_file_name`;
let PAGE_SIZE=`select @space_page_size`;
+SET GLOBAL innodb_log_flush_now = ON;
+
--source include/kill_mysqld.inc
--echo # Corrupt the root page of table t1 in the user tablespace.
diff --git a/mysql-test/suite/innodb/t/dblwr_zlib_encrypt.test b/mysql-test/suite/innodb/t/dblwr_zlib_encrypt.test
index 1cba51e5fb4f..261d8a0e194d 100644
--- a/mysql-test/suite/innodb/t/dblwr_zlib_encrypt.test
+++ b/mysql-test/suite/innodb/t/dblwr_zlib_encrypt.test
@@ -57,6 +57,8 @@ SET SESSION innodb_interpreter = @cmd;
SET SESSION innodb_interpreter = 'corrupt_ondisk_page0 test/t1';
SET SESSION innodb_interpreter = 'destroy';
+SET GLOBAL innodb_log_flush_now = ON;
+
--replace_result $PLUGIN_DIR_OPT PLUGIN_DIR_OPT
--source include/kill_and_restart_mysqld.inc
diff --git a/mysql-test/suite/innodb/t/dblwr_zlib_encrypt_recv.test b/mysql-test/suite/innodb/t/dblwr_zlib_encrypt_recv.test
index 6d6555022edf..85ddd931e6d4 100644
--- a/mysql-test/suite/innodb/t/dblwr_zlib_encrypt_recv.test
+++ b/mysql-test/suite/innodb/t/dblwr_zlib_encrypt_recv.test
@@ -13,6 +13,9 @@
create table t1 (f1 int primary key, f2 blob) COMPRESSION='zlib' ENCRYPTION='Y';
+SET GLOBAL innodb_master_thread_disabled_debug=1;
+SET GLOBAL innodb_checkpoint_disabled = 1;
+
START TRANSACTION;
INSERT INTO t1 VALUES(1, repeat('#',12));
INSERT INTO t1 VALUES(2, repeat('+',12));
diff --git a/mysql-test/suite/innodb/t/innodb_bug115136.test b/mysql-test/suite/innodb/t/innodb_bug115136.test
new file mode 100644
index 000000000000..1ac2af1c6590
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug115136.test
@@ -0,0 +1,48 @@
+set @ori_parallel_read_threads = @@innodb_parallel_read_threads;
+set @ori_ddl_threads = @@innodb_ddl_threads;
+set @ori_ddl_buffer_size = @@innodb_ddl_buffer_size;
+
+create table a(a int, b int, primary key(a));
+set innodb_parallel_read_threads = 16;
+set innodb_ddl_threads = 16;
+
+delimiter $$;
+CREATE PROCEDURE insert_into_tables(IN num INTEGER)
+ BEGIN
+ declare x INT;
+ set x = 1;
+ while x < num do
+ INSERT INTO `a` (`a`, `b`) VALUES (x, x);
+ set x = x + 1;
+ end while;
+end$$
+delimiter ;$$
+
+call insert_into_tables(10000);
+
+# Mofidy ddl buffer size
+set innodb_ddl_buffer_size = 65536;
+
+alter table a add column `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, ADD KEY (`id`);
+
+# Max(id) should be same with max(a) and max(b)
+select max(a), max(b), max(id) from a;
+select b from a where b not in (select id from a);
+
+
+# Mofidy ddl buffer size
+set innodb_ddl_buffer_size = 104857600;
+
+alter table a drop column id, drop index id;
+
+alter table a add column `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, ADD KEY (`id`);
+
+# Max(id) should be same with max(a) and max(b)
+select max(a), max(b), max(id) from a;
+select b from a where b not in (select id from a);
+
+drop table a;
+drop PROCEDURE insert_into_tables;
+set innodb_parallel_read_threads = @ori_parallel_read_threads;
+set innodb_ddl_threads = @ori_ddl_threads;
+set innodb_ddl_buffer_size = @ori_ddl_buffer_size;
diff --git a/mysql-test/suite/innodb/t/innodb_information_schema_buffer.test b/mysql-test/suite/innodb/t/innodb_information_schema_buffer.test
index 51a7d179725e..4301729b8cc6 100644
--- a/mysql-test/suite/innodb/t/innodb_information_schema_buffer.test
+++ b/mysql-test/suite/innodb/t/innodb_information_schema_buffer.test
@@ -62,13 +62,14 @@ SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME like "%infoschema_buffer_test%";
-# There should be only stale pages.
+# There should be no non-stale pages.
+let $query_no_non_stale = SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
+ WHERE space = $space_id AND is_stale = 'NO';
--replace_result $space_id {space_id}
---eval $query;
+--eval $query_no_non_stale
--source suite/innodb/include/evict_everything_from_buffer_pool.inc
-
# There should no space pages now, neither stale nor not.
--replace_result $space_id {space_id}
--eval $query;
@@ -91,4 +92,3 @@ SELECT count(*)
DROP TABLE infoschema_child;
DROP TABLE infoschema_parent;
-
diff --git a/mysql-test/suite/innodb/t/innodb_lru_threads_kill_recovery.test b/mysql-test/suite/innodb/t/innodb_lru_threads_kill_recovery.test
new file mode 100644
index 000000000000..b2e0a586f7b0
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_lru_threads_kill_recovery.test
@@ -0,0 +1,48 @@
+--source include/no_valgrind_without_big.inc
+
+--echo #
+--echo # PS-11445: with --innodb-lru-threads=ON, the LRU manager threads
+--echo # are created before buf_pool_invalidate() runs on every startup, so
+--echo # they are alive throughout crash recovery (including the
+--echo # buf_pool_invalidate_instance() pause/resume of run_lru). Restart
+--echo # after a crash with a non-trivial amount of redo to apply exercises
+--echo # that path; a normal restart afterward exercises the page-cleaner
+--echo # coordinator waiting for the LRU managers to stop on shutdown.
+--echo #
+
+--let $restart_parameters=restart:--innodb-lru-threads=ON --innodb-buffer-pool-size=8M --innodb-buffer-pool-instances=2 --innodb-lru-scan-depth=100
+--source include/restart_mysqld.inc
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(512)) ENGINE=InnoDB;
+
+--disable_query_log
+DELIMITER |;
+CREATE PROCEDURE fill_t1()
+BEGIN
+ DECLARE i INT DEFAULT 0;
+ WHILE i < 20000 DO
+ INSERT INTO t1 VALUES (i, REPEAT('x', 512));
+ SET i = i + 1;
+ END WHILE;
+END|
+DELIMITER ;|
+CALL fill_t1();
+DROP PROCEDURE fill_t1;
+--enable_query_log
+
+--let $wait_counter= 3000
+--source include/kill_and_restart_mysqld.inc
+
+SELECT COUNT(*) FROM t1;
+
+--echo # Clean shutdown must not hang: the page-cleaner coordinator has to
+--echo # observe every LRU manager thread stop.
+--let $restart_parameters=restart:--innodb-lru-threads=ON --innodb-buffer-pool-size=8M --innodb-buffer-pool-instances=2 --innodb-lru-scan-depth=100
+--source include/restart_mysqld.inc
+
+SELECT COUNT(*) FROM t1;
+
+DROP TABLE t1;
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
diff --git a/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test b/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test
index 0a84997f0334..6a110f42c119 100644
--- a/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test
+++ b/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test
@@ -58,4 +58,5 @@ SET autocommit=1;
--disable_query_log
call mtr.add_suppression("Unable to delete statistics for table test.innodb_stats_drop_locked: Lock wait timeout. They can be deleted later using DELETE FROM mysql.innodb_index_stats WHERE database_name");
+call mtr.add_suppression("Cannot save table statistics for table `mysql`\\.");
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/page_tracking_corruption.test b/mysql-test/suite/innodb/t/page_tracking_corruption.test
new file mode 100644
index 000000000000..e9fca4251d00
--- /dev/null
+++ b/mysql-test/suite/innodb/t/page_tracking_corruption.test
@@ -0,0 +1,120 @@
+# Test that the server starts despite corrupted page tracking archive files.
+#
+# When ib_page_* files in #ib_archive are corrupted (e.g. truncated),
+# the server should detect the problem, log a warning, and continue
+# starting up rather than crashing.
+#
+--source include/not_valgrind.inc
+
+--disable_query_log
+call mtr.add_suppression("Page Archiver's doublewrite buffer initialisation failed");
+call mtr.add_suppression("Page archiver system's recovery failed");
+call mtr.add_suppression("Page archiver: ");
+call mtr.add_suppression("Operating system error number .* in a file operation");
+call mtr.add_suppression("Error number .* means");
+call mtr.add_suppression("'rmdir' returned OS error");
+call mtr.add_suppression("bytes should have been read. Only .* bytes read");
+call mtr.add_suppression("Retry attempts for reading partial data failed");
+--enable_query_log
+
+let MYSQLD_DATADIR = `SELECT @@datadir`;
+
+--echo #
+--echo # Enable page tracking
+--echo #
+INSTALL COMPONENT 'file://component_mysqlbackup';
+--replace_column 1 #
+SELECT mysqlbackup_page_track_set(1);
+
+--echo #
+--echo # Generate data to create page tracking archive files
+--echo #
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
+
+--disable_query_log
+--let $i = 100
+while ($i)
+{
+ INSERT INTO t1 (b) VALUES (REPEAT('x', 1000));
+ --dec $i
+}
+--enable_query_log
+
+UPDATE t1 SET b = REPEAT('y', 1000);
+
+--echo #
+--echo # Verify page tracking works before corruption
+--echo #
+--replace_column 1 #
+SELECT mysqlbackup_page_track_get_changed_page_count(mysqlbackup_page_track_get_start_lsn(), mysqlbackup_page_track_get_start_lsn() + 1);
+
+--echo #
+--echo # Shutdown the server
+--echo #
+--source include/shutdown_mysqld.inc
+
+--echo #
+--echo # Corrupt page tracking archive files
+--echo #
+
+perl;
+use File::Find;
+use strict;
+use warnings;
+
+my $datadir = $ENV{'MYSQLD_DATADIR'};
+chomp $datadir if defined $datadir;
+die "MYSQLD_DATADIR not set\n" unless defined $datadir && length $datadir;
+
+$datadir .= '/' unless $datadir =~ m{/$};
+my $archive_dir = "${datadir}#ib_archive";
+
+die "Archive directory $archive_dir not found.\n" unless -d $archive_dir;
+
+my $corrupted = 0;
+
+find(sub {
+ # Truncate the doublewrite buffer so it cannot restore corrupted blocks.
+ if (/^dblwr_\d+$/ && -f $File::Find::name) {
+ truncate($File::Find::name, 0) or die "Cannot truncate $File::Find::name: $!\n";
+ }
+
+ return unless /^ib_page_\d+$/;
+ my $path = $File::Find::name;
+ my $size = -s $path;
+ return unless defined $size && $size > 16384;
+
+ # Truncate just past the first block (the reset block). This preserves
+ # the valid reset entries that reference data blocks further in the file,
+ # but removes those data blocks. During recovery, fetch_reset_lsn() will
+ # try to read a referenced data block past the end of the file and hit
+ # the assertion (debug) or fatal read error (release).
+ # The size must be > ARCH_PAGE_BLK_SIZE (16384) so that
+ # cleanup_if_required() does not delete the file.
+ truncate($path, 16385) or die "Cannot truncate $path: $!\n";
+
+ $corrupted++;
+}, $archive_dir);
+
+die "No ib_page_* files found under $archive_dir.\n" if $corrupted == 0;
+
+print "Page tracking archive files corrupted successfully.\n";
+EOF
+
+--echo #
+--echo # Restart the server — should succeed despite corrupted archive files
+--echo #
+--source include/start_mysqld.inc
+
+--echo #
+--echo # Verify page tracking query does not crash after corruption
+--echo #
+--replace_column 1 #
+SELECT mysqlbackup_page_track_get_changed_page_count(mysqlbackup_page_track_get_start_lsn(), mysqlbackup_page_track_get_start_lsn() + 1);
+
+--echo #
+--echo # Cleanup
+--echo #
+DROP TABLE t1;
+UNINSTALL COMPONENT 'file://component_mysqlbackup';
+--force-rmdir $MYSQLD_DATADIR/#ib_archive
diff --git a/mysql-test/suite/innodb_gis/r/big_records.result b/mysql-test/suite/innodb_gis/r/big_records.result
new file mode 100644
index 000000000000..050ed835f3ab
--- /dev/null
+++ b/mysql-test/suite/innodb_gis/r/big_records.result
@@ -0,0 +1,61 @@
+CREATE TABLE t1 (
+a VARCHAR(255) NOT NULL,
+b VARCHAR(255) NOT NULL,
+c VARCHAR(255) NOT NULL,
+d VARCHAR(175) NOT NULL,
+g GEOMETRY NOT NULL SRID 4326,
+PRIMARY KEY (a, b, c, d),
+SPATIAL KEY idx_g (g)
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=latin1;
+INSERT INTO t1 (a,b,c,d,g)
+VALUES ('a', 'b', 'c', 'd', ST_GeomFromText('POINT(0 0)', 4326));
+INSERT INTO t1 (a,b,c,d,g) VALUES (
+REPEAT('a',255),
+REPEAT('b',255),
+REPEAT('c',255),
+REPEAT('d',175),
+ST_GeomFromText('POINT(1 1)', 4326)
+);
+CREATE TABLE nums(id INT PRIMARY KEY);
+INSERT INTO nums VALUES (1);
+INSERT INTO nums SELECT id + (SELECT MAX(id) FROM nums) FROM nums;
+INSERT INTO nums SELECT id + (SELECT MAX(id) FROM nums) FROM nums;
+INSERT INTO nums SELECT id + (SELECT MAX(id) FROM nums) FROM nums;
+INSERT INTO nums SELECT id + (SELECT MAX(id) FROM nums) FROM nums;
+INSERT INTO nums SELECT id + (SELECT MAX(id) FROM nums) FROM nums;
+INSERT INTO nums SELECT id + (SELECT MAX(id) FROM nums) FROM nums;
+INSERT INTO nums SELECT id + (SELECT MAX(id) FROM nums) FROM nums;
+INSERT INTO nums SELECT id + (SELECT MAX(id) FROM nums) FROM nums;
+INSERT INTO nums SELECT id + (SELECT MAX(id) FROM nums) FROM nums;
+INSERT INTO nums SELECT id + (SELECT MAX(id) FROM nums) FROM nums;
+INSERT INTO t1 (a,b,c,d,g)
+SELECT REPEAT(id,50), REPEAT('b',255), REPEAT('c',255), 'd2', ST_GeomFromText(
+CONCAT('POINT(', MOD(id,90), ' -122.4194)'),
+4326
+) FROM nums;
+DROP TABLE nums;
+# Before DELETE:
+SELECT a,b,c,d,ST_AsText(g) FROM t1 WHERE g=ST_GeomFromText('POINT(40 -122.4194)', 4326);
+a b c d ST_AsText(g)
+130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130130 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc d2 POINT(40 -122.4194)
+220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc d2 POINT(40 -122.4194)
+310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310310 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc d2 POINT(40 -122.4194)
+400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400400 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc d2 POINT(40 -122.4194)
+4040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc d2 POINT(40 -122.4194)
+490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490490 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc d2 POINT(40 -122.4194)
+580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580580 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc d2 POINT(40 -122.4194)
+670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670670 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc d2 POINT(40 -122.4194)
+760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760760 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc d2 POINT(40 -122.4194)
+850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850850 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc d2 POINT(40 -122.4194)
+940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940940 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc d2 POINT(40 -122.4194)
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1026
+DELETE FROM t1 WHERE g=ST_GeomFromText('POINT(40 -122.4194)', 4326);
+# After DELETE
+SELECT a,b,c,d,ST_AsText(g) FROM t1 WHERE g=ST_GeomFromText('POINT(40 -122.4194)', 4326);
+a b c d ST_AsText(g)
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1015
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_gis/t/big_records.test b/mysql-test/suite/innodb_gis/t/big_records.test
new file mode 100644
index 000000000000..5ed6dcd6120d
--- /dev/null
+++ b/mysql-test/suite/innodb_gis/t/big_records.test
@@ -0,0 +1,56 @@
+# Bug#39433811 Can't create some of tables with SPATIAL KEY because of ER_TOO_BIG_ROWSIZE
+--source include/have_innodb_16k.inc
+
+CREATE TABLE t1 (
+ a VARCHAR(255) NOT NULL,
+ b VARCHAR(255) NOT NULL,
+ c VARCHAR(255) NOT NULL,
+ d VARCHAR(175) NOT NULL,
+ g GEOMETRY NOT NULL SRID 4326,
+ PRIMARY KEY (a, b, c, d),
+ SPATIAL KEY idx_g (g)
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=latin1;
+
+# This one is a simple case where the row is very short
+INSERT INTO t1 (a,b,c,d,g)
+ VALUES ('a', 'b', 'c', 'd', ST_GeomFromText('POINT(0 0)', 4326));
+
+# This one is a more difficult case where the row is very long,
+# in particular its Primary Key columns have longest possible values.
+INSERT INTO t1 (a,b,c,d,g) VALUES (
+ REPEAT('a',255),
+ REPEAT('b',255),
+ REPEAT('c',255),
+ REPEAT('d',175),
+ ST_GeomFromText('POINT(1 1)', 4326)
+);
+
+# Now lets see what happens if the R-tree has some internal nodes
+CREATE TABLE nums(id INT PRIMARY KEY);
+INSERT INTO nums VALUES (1);
+
+--let $i=0
+while($i<10){
+ INSERT INTO nums SELECT id + (SELECT MAX(id) FROM nums) FROM nums;
+ --inc $i
+}
+
+INSERT INTO t1 (a,b,c,d,g)
+ SELECT REPEAT(id,50), REPEAT('b',255), REPEAT('c',255), 'd2', ST_GeomFromText(
+ CONCAT('POINT(', MOD(id,90), ' -122.4194)'),
+ 4326
+ ) FROM nums;
+
+DROP TABLE nums;
+
+--echo # Before DELETE:
+SELECT a,b,c,d,ST_AsText(g) FROM t1 WHERE g=ST_GeomFromText('POINT(40 -122.4194)', 4326);
+SELECT COUNT(*) FROM t1;
+
+# Now test navigation
+DELETE FROM t1 WHERE g=ST_GeomFromText('POINT(40 -122.4194)', 4326);
+--echo # After DELETE
+SELECT a,b,c,d,ST_AsText(g) FROM t1 WHERE g=ST_GeomFromText('POINT(40 -122.4194)', 4326);
+SELECT COUNT(*) FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_zip/r/lru_mutex_narrow_stress_debug.result b/mysql-test/suite/innodb_zip/r/lru_mutex_narrow_stress_debug.result
new file mode 100644
index 000000000000..81f2172016b8
--- /dev/null
+++ b/mysql-test/suite/innodb_zip/r/lru_mutex_narrow_stress_debug.result
@@ -0,0 +1,16 @@
+SET GLOBAL DEBUG="+d,buf_lru_free_page_delay_zip_reinsert,buf_page_init_for_read_delay_lru_add";
+CREATE TABLE t1 (
+id INT PRIMARY KEY,
+c LONGBLOB
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
+CALL scan_t1(6);
+CALL scan_t1(6);
+CALL update_t1(12);
+SELECT COUNT(*), MIN(LENGTH(c)) > 0 FROM t1;
+COUNT(*) MIN(LENGTH(c)) > 0
+2000 1
+SET GLOBAL DEBUG="-d,buf_lru_free_page_delay_zip_reinsert,buf_page_init_for_read_delay_lru_add";
+DROP PROCEDURE populate_t1;
+DROP PROCEDURE scan_t1;
+DROP PROCEDURE update_t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_zip/t/lru_mutex_narrow_stress_debug-master.opt b/mysql-test/suite/innodb_zip/t/lru_mutex_narrow_stress_debug-master.opt
new file mode 100644
index 000000000000..451844199700
--- /dev/null
+++ b/mysql-test/suite/innodb_zip/t/lru_mutex_narrow_stress_debug-master.opt
@@ -0,0 +1,3 @@
+--innodb-buffer-pool-size=24M
+--innodb-buffer-pool-chunk-size=2M
+--innodb-buffer-pool-instances=1
diff --git a/mysql-test/suite/innodb_zip/t/lru_mutex_narrow_stress_debug.test b/mysql-test/suite/innodb_zip/t/lru_mutex_narrow_stress_debug.test
new file mode 100644
index 000000000000..8e120feb2013
--- /dev/null
+++ b/mysql-test/suite/innodb_zip/t/lru_mutex_narrow_stress_debug.test
@@ -0,0 +1,109 @@
+# PS-11141: buf_page_init_for_read() inserts into the page hash without
+# holding the LRU list mutex. This test stresses the two windows that the
+# narrowed latching opens, with debug sync points widening them:
+#
+# 1) buf_lru_free_page_delay_zip_reinsert widens the window between the
+# page hash delete and the re-insert of the compressed-only descriptor
+# in the keep-zip path of buf_LRU_free_page(). The hash cell X-latch is
+# held across that window, so a concurrent read of the page being
+# unzip-evicted must block on the cell latch instead of inserting a
+# second descriptor for the same page id (which would fail
+# ut_a(!buf_page_hash_get_low(buf_pool, b->id)) at the re-insert).
+#
+# 2) buf_page_init_for_read_delay_lru_add widens the window in which a
+# page is hash-visible but not yet linked into the LRU list. Threads
+# finding such a page via the page hash (buf_page_get_zip() ->
+# buf_block_try_discard_uncompressed() -> buf_LRU_free_page(),
+# buf_buddy_relocate(), buf_page_make_young_if_needed()) must back off
+# from it because it is io-fixed for read; buf_page_can_relocate()
+# accepts it (io-fixed, not in the LRU list) without asserting.
+#
+# The workload keeps a compressed table with externally stored BLOBs
+# (read through buf_page_get_zip()) larger than the buffer pool, so that
+# unzip-LRU eviction, keep-zip frees, physical re-reads and buddy
+# alloc/free churn all run concurrently.
+
+--source include/have_debug.inc
+--source include/have_innodb_16k.inc
+--source include/big_test.inc
+
+SET GLOBAL DEBUG="+d,buf_lru_free_page_delay_zip_reinsert,buf_page_init_for_read_delay_lru_add";
+
+CREATE TABLE t1 (
+ id INT PRIMARY KEY,
+ c LONGBLOB
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
+
+--disable_query_log
+DELIMITER |;
+CREATE PROCEDURE populate_t1()
+BEGIN
+ DECLARE i INT DEFAULT 1;
+ WHILE i <= 2000 DO
+ INSERT INTO t1 VALUES (i, REPEAT(CONCAT('row', i, '-'), 2048));
+ IF i % 200 = 0 THEN
+ COMMIT;
+ END IF;
+ SET i = i + 1;
+ END WHILE;
+ COMMIT;
+END|
+CREATE PROCEDURE scan_t1(IN iterations INT)
+BEGIN
+ DECLARE i INT DEFAULT 1;
+ DECLARE dummy BIGINT;
+ WHILE i <= iterations DO
+ SELECT SUM(LENGTH(c)) INTO dummy FROM t1;
+ SET i = i + 1;
+ END WHILE;
+END|
+CREATE PROCEDURE update_t1(IN iterations INT)
+BEGIN
+ DECLARE i INT DEFAULT 1;
+ WHILE i <= iterations DO
+ UPDATE t1 SET c = REPEAT(CONCAT('mod', i, '-'), 2048)
+ WHERE id % 500 = i % 500;
+ COMMIT;
+ SET i = i + 1;
+ END WHILE;
+END|
+DELIMITER ;|
+SET autocommit = 0;
+CALL populate_t1();
+SET autocommit = 1;
+--enable_query_log
+
+# Two connections scanning the BLOB column (physical re-reads +
+# buf_page_get_zip() -> buf_block_try_discard_uncompressed()), one
+# connection updating (creates dirty compressed pages, so the keep-zip
+# eviction path sees both ZIP_PAGE and ZIP_DIRTY re-inserts).
+--connect(con_scan1, localhost, root,,)
+--send CALL scan_t1(6)
+
+--connect(con_scan2, localhost, root,,)
+--send CALL scan_t1(6)
+
+--connect(con_upd, localhost, root,,)
+--send CALL update_t1(12)
+
+--connection con_scan1
+--reap
+--disconnect con_scan1
+
+--connection con_scan2
+--reap
+--disconnect con_scan2
+
+--connection con_upd
+--reap
+--disconnect con_upd
+
+--connection default
+SELECT COUNT(*), MIN(LENGTH(c)) > 0 FROM t1;
+
+SET GLOBAL DEBUG="-d,buf_lru_free_page_delay_zip_reinsert,buf_page_init_for_read_delay_lru_add";
+
+DROP PROCEDURE populate_t1;
+DROP PROCEDURE scan_t1;
+DROP PROCEDURE update_t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/jdv/r/jdv_update.result b/mysql-test/suite/jdv/r/jdv_update.result
index 119837775d96..72dfd9d8d7ed 100644
--- a/mysql-test/suite/jdv/r/jdv_update.result
+++ b/mysql-test/suite/jdv/r/jdv_update.result
@@ -1578,3 +1578,250 @@ data
DROP TABLE p_t2;
DROP TABLE p_t1;
DROP VIEW p_dv1;
+#
+# Bug#39566804: FK constraints may be violated when update deletes from
+# nested child base table.
+#
+CREATE TABLE course (
+id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+name VARCHAR(75) NOT NULL,
+address VARCHAR(75) NOT NULL,
+address2 VARCHAR(75) DEFAULT NULL,
+city VARCHAR(50) NOT NULL,
+state VARCHAR(2) NOT NULL,
+zip VARCHAR(10) NOT NULL,
+phone VARCHAR(14) NOT NULL,
+abbrev VARCHAR(6) DEFAULT NULL,
+PRIMARY KEY (id)
+);
+CREATE TABLE hole_group (
+id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+name VARCHAR(75) NOT NULL,
+sort_order INT NOT NULL DEFAULT '0',
+slope DECIMAL(10,2) NOT NULL DEFAULT '113.00',
+rating DECIMAL(10,2) NOT NULL DEFAULT '72.00',
+course_id INT UNSIGNED DEFAULT NULL,
+PRIMARY KEY (id),
+KEY holegroup_course_id_index (course_id),
+KEY holegroup_sort_order_index (sort_order),
+CONSTRAINT holegroup_course_id_fk FOREIGN KEY (course_id) REFERENCES course (id)
+);
+CREATE TABLE hole (
+id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+number INT NOT NULL DEFAULT '0',
+handicap INT NOT NULL DEFAULT '0',
+par INT NOT NULL DEFAULT '0',
+hole_group_id INT UNSIGNED DEFAULT NULL,
+PRIMARY KEY (id),
+KEY hole_hole_group_id_index (hole_group_id),
+KEY hole_number_index (number),
+CONSTRAINT hole_holegroup_id_fk FOREIGN KEY (hole_group_id) REFERENCES hole_group (id)
+);
+CREATE
+ALGORITHM=UNDEFINED SQL SECURITY INVOKER
+JSON RELATIONAL DUALITY VIEW course_dv AS
+SELECT JSON_DUALITY_OBJECT(
+WITH (INSERT,UPDATE,DELETE)
+'_id': course.id,
+'name': course.name,
+'address': course.address,
+'address2': course.address2,
+'city': course.city,
+'state': course.state,
+'zip': course.zip,
+'phone': course.phone,
+'abbrev': course.abbrev,
+'holeGroups':(
+SELECT JSON_ARRAYAGG(
+JSON_DUALITY_OBJECT(
+WITH (INSERT,UPDATE,DELETE)
+'id': hole_group.id,
+'name': hole_group.name,
+'sort_order': hole_group.sort_order,
+'slope': hole_group.slope,
+'rating': hole_group.rating,
+'course_id': hole_group.course_id,
+'holes':(
+SELECT JSON_ARRAYAGG(
+JSON_DUALITY_OBJECT(
+WITH (INSERT,UPDATE,DELETE)
+'id': hole.id,
+'number': hole.number,
+'handicap': hole.handicap,
+'par': hole.par,
+'hole_group_id': hole.hole_group_id))
+FROM hole WHERE (hole.hole_group_id = hole_group.id))))
+FROM hole_group WHERE (hole_group.course_id = course.id))) AS Name_exp_1
+FROM course;
+INSERT INTO course_dv
+VALUES (
+'{
+ "name": "Rock Harbor Golf Course - Boulder Course",
+ "address": "365 Rock Harbor Drive",
+ "address2": null,
+ "city": "Winchester",
+ "state": "VA",
+ "zip": "22602",
+ "phone": "(540) 722-7111",
+ "abbrev": "RHB",
+ "holeGroups": [
+ {
+ "name": "Front Nine",
+ "sort_order": 1,
+ "slope": 136.00,
+ "rating": 35.15,
+ "holes": [
+ { "number": 1, "handicap": 15, "par": 4 },
+ { "number": 2, "handicap": 5, "par": 3 },
+ { "number": 3, "handicap": 7, "par": 4 },
+ { "number": 4, "handicap": 17, "par": 5 },
+ { "number": 5, "handicap": 13, "par": 3 },
+ { "number": 6, "handicap": 1, "par": 5 },
+ { "number": 7, "handicap": 9, "par": 4 },
+ { "number": 8, "handicap": 3, "par": 3 },
+ { "number": 9, "handicap": 11, "par": 5 }
+ ]
+ },
+ {
+ "name": "Back Nine",
+ "sort_order": 2,
+ "slope": 136.00,
+ "rating": 35.15,
+ "holes": [
+ { "number": 10, "handicap": 4, "par": 5 },
+ { "number": 11, "handicap": 18, "par": 3 },
+ { "number": 12, "handicap": 16, "par": 4 },
+ { "number": 13, "handicap": 14, "par": 3 },
+ { "number": 14, "handicap": 8, "par": 4 },
+ { "number": 15, "handicap": 2, "par": 4 },
+ { "number": 16, "handicap": 6, "par": 5 },
+ { "number": 17, "handicap": 12, "par": 3 },
+ { "number": 18, "handicap": 10, "par": 5 }
+ ]
+ }
+ ]
+ }'
+);
+SELECT * FROM course_dv;
+data
+{"_id": 1, "zip": "22602", "city": "Winchester", "name": "Rock Harbor Golf Course - Boulder Course", "phone": "(540) 722-7111", "state": "VA", "abbrev": "RHB", "address": "365 Rock Harbor Drive", "address2": null, "_metadata": {"etag": "b262d99e8bb2a75ede3248c9ddae58a6"}, "holeGroups": [{"id": 1, "name": "Front Nine", "holes": [{"id": 10, "par": 5, "number": 9, "handicap": 11, "hole_group_id": 1}, {"id": 11, "par": 3, "number": 8, "handicap": 3, "hole_group_id": 1}, {"id": 12, "par": 4, "number": 7, "handicap": 9, "hole_group_id": 1}, {"id": 13, "par": 5, "number": 6, "handicap": 1, "hole_group_id": 1}, {"id": 14, "par": 3, "number": 5, "handicap": 13, "hole_group_id": 1}, {"id": 15, "par": 5, "number": 4, "handicap": 17, "hole_group_id": 1}, {"id": 16, "par": 4, "number": 3, "handicap": 7, "hole_group_id": 1}, {"id": 17, "par": 3, "number": 2, "handicap": 5, "hole_group_id": 1}, {"id": 18, "par": 4, "number": 1, "handicap": 15, "hole_group_id": 1}], "slope": 136.00, "rating": 35.15, "course_id": 1, "sort_order": 1}, {"id": 2, "name": "Back Nine", "holes": [{"id": 1, "par": 5, "number": 18, "handicap": 10, "hole_group_id": 2}, {"id": 2, "par": 3, "number": 17, "handicap": 12, "hole_group_id": 2}, {"id": 3, "par": 5, "number": 16, "handicap": 6, "hole_group_id": 2}, {"id": 4, "par": 4, "number": 15, "handicap": 2, "hole_group_id": 2}, {"id": 5, "par": 4, "number": 14, "handicap": 8, "hole_group_id": 2}, {"id": 6, "par": 3, "number": 13, "handicap": 14, "hole_group_id": 2}, {"id": 7, "par": 4, "number": 12, "handicap": 16, "hole_group_id": 2}, {"id": 8, "par": 3, "number": 11, "handicap": 18, "hole_group_id": 2}, {"id": 9, "par": 5, "number": 10, "handicap": 4, "hole_group_id": 2}], "slope": 136.00, "rating": 35.15, "course_id": 1, "sort_order": 2}]}
+SELECT * FROM course;
+id name address address2 city state zip phone abbrev
+1 Rock Harbor Golf Course - Boulder Course 365 Rock Harbor Drive NULL Winchester VA 22602 (540) 722-7111 RHB
+SELECT * FROM hole_group;
+id name sort_order slope rating course_id
+1 Front Nine 1 136.00 35.15 1
+2 Back Nine 2 136.00 35.15 1
+SELECT * FROM hole;
+id number handicap par hole_group_id
+1 18 10 5 2
+2 17 12 3 2
+3 16 6 5 2
+4 15 2 4 2
+5 14 8 4 2
+6 13 14 3 2
+7 12 16 4 2
+8 11 18 3 2
+9 10 4 5 2
+10 9 11 5 1
+11 8 3 3 1
+12 7 9 4 1
+13 6 1 5 1
+14 5 13 3 1
+15 4 17 5 1
+16 3 7 4 1
+17 2 5 3 1
+18 1 15 4 1
+# Note that only the base table course is actually being updated here.
+# None of the hole_groups or holes in the new value actually exists,
+# so all existing rows in hole_group and hole will be deleted and
+# the hole_groups and holes from the new value will be inserted.
+UPDATE course_dv
+SET data = '{
+ "_id": 1,
+ "name": "Rock Harbor Golf Course - Boulder Course",
+ "address": "365 Rock Harbor Drive",
+ "address2": null,
+ "city": "Winchester",
+ "state": "VA",
+ "zip": "22602",
+ "phone": "(540) 722-7111",
+ "abbrev": "RHB",
+ "holeGroups": [
+ {
+ "id": 13,
+ "name": "First Nine",
+ "sort_order": 1,
+ "slope": 136.00,
+ "rating": 35.15,
+ "course_id": 1,
+ "holes": [
+ { "id": 109, "number": 1, "handicap": 15, "par": 4, "hole_group_id": 13 },
+ { "id": 110, "number": 2, "handicap": 5, "par": 3, "hole_group_id": 13 },
+ { "id": 111, "number": 3, "handicap": 7, "par": 4, "hole_group_id": 13 },
+ { "id": 112, "number": 4, "handicap": 17, "par": 5, "hole_group_id": 13 },
+ { "id": 113, "number": 5, "handicap": 13, "par": 3, "hole_group_id": 13 },
+ { "id": 114, "number": 6, "handicap": 1, "par": 5, "hole_group_id": 13 },
+ { "id": 115, "number": 7, "handicap": 9, "par": 4, "hole_group_id": 13 },
+ { "id": 116, "number": 8, "handicap": 3, "par": 3, "hole_group_id": 13 },
+ { "id": 117, "number": 9, "handicap": 11, "par": 5, "hole_group_id": 13 }
+ ]
+ },
+ {
+ "id": 14,
+ "name": "Second Nine",
+ "sort_order": 2,
+ "slope": 136.00,
+ "rating": 35.15,
+ "course_id": 1,
+ "holes": [
+ { "id": 118, "number": 10, "handicap": 4, "par": 5, "hole_group_id": 14 },
+ { "id": 119, "number": 11, "handicap": 18, "par": 3, "hole_group_id": 14 },
+ { "id": 120, "number": 12, "handicap": 16, "par": 4, "hole_group_id": 14 },
+ { "id": 121, "number": 13, "handicap": 14, "par": 3, "hole_group_id": 14 },
+ { "id": 122, "number": 14, "handicap": 8, "par": 4, "hole_group_id": 14 },
+ { "id": 123, "number": 15, "handicap": 2, "par": 4, "hole_group_id": 14 },
+ { "id": 124, "number": 16, "handicap": 6, "par": 5, "hole_group_id": 14 },
+ { "id": 125, "number": 17, "handicap": 12, "par": 3, "hole_group_id": 14 },
+ { "id": 126, "number": 18, "handicap": 10, "par": 4, "hole_group_id": 14 }
+ ]
+ }
+ ]
+}'
+WHERE JSON_VALUE(data, '$._id') = 1;
+Warnings:
+Warning 6493 ETAG missing for updated value
+SELECT * FROM course_dv;
+data
+{"_id": 1, "zip": "22602", "city": "Winchester", "name": "Rock Harbor Golf Course - Boulder Course", "phone": "(540) 722-7111", "state": "VA", "abbrev": "RHB", "address": "365 Rock Harbor Drive", "address2": null, "_metadata": {"etag": "25859f6a50b86104588e882f3f74c714"}, "holeGroups": [{"id": 13, "name": "First Nine", "holes": [{"id": 109, "par": 4, "number": 1, "handicap": 15, "hole_group_id": 13}, {"id": 110, "par": 3, "number": 2, "handicap": 5, "hole_group_id": 13}, {"id": 111, "par": 4, "number": 3, "handicap": 7, "hole_group_id": 13}, {"id": 112, "par": 5, "number": 4, "handicap": 17, "hole_group_id": 13}, {"id": 113, "par": 3, "number": 5, "handicap": 13, "hole_group_id": 13}, {"id": 114, "par": 5, "number": 6, "handicap": 1, "hole_group_id": 13}, {"id": 115, "par": 4, "number": 7, "handicap": 9, "hole_group_id": 13}, {"id": 116, "par": 3, "number": 8, "handicap": 3, "hole_group_id": 13}, {"id": 117, "par": 5, "number": 9, "handicap": 11, "hole_group_id": 13}], "slope": 136.00, "rating": 35.15, "course_id": 1, "sort_order": 1}, {"id": 14, "name": "Second Nine", "holes": [{"id": 118, "par": 5, "number": 10, "handicap": 4, "hole_group_id": 14}, {"id": 119, "par": 3, "number": 11, "handicap": 18, "hole_group_id": 14}, {"id": 120, "par": 4, "number": 12, "handicap": 16, "hole_group_id": 14}, {"id": 121, "par": 3, "number": 13, "handicap": 14, "hole_group_id": 14}, {"id": 122, "par": 4, "number": 14, "handicap": 8, "hole_group_id": 14}, {"id": 123, "par": 4, "number": 15, "handicap": 2, "hole_group_id": 14}, {"id": 124, "par": 5, "number": 16, "handicap": 6, "hole_group_id": 14}, {"id": 125, "par": 3, "number": 17, "handicap": 12, "hole_group_id": 14}, {"id": 126, "par": 4, "number": 18, "handicap": 10, "hole_group_id": 14}], "slope": 136.00, "rating": 35.15, "course_id": 1, "sort_order": 2}]}
+SELECT * FROM course;
+id name address address2 city state zip phone abbrev
+1 Rock Harbor Golf Course - Boulder Course 365 Rock Harbor Drive NULL Winchester VA 22602 (540) 722-7111 RHB
+SELECT * FROM hole_group;
+id name sort_order slope rating course_id
+13 First Nine 1 136.00 35.15 1
+14 Second Nine 2 136.00 35.15 1
+SELECT * FROM hole;
+id number handicap par hole_group_id
+109 1 15 4 13
+110 2 5 3 13
+111 3 7 4 13
+112 4 17 5 13
+113 5 13 3 13
+114 6 1 5 13
+115 7 9 4 13
+116 8 3 3 13
+117 9 11 5 13
+118 10 4 5 14
+119 11 18 3 14
+120 12 16 4 14
+121 13 14 3 14
+122 14 8 4 14
+123 15 2 4 14
+124 16 6 5 14
+125 17 12 3 14
+126 18 10 4 14
+DROP VIEW course_dv;
+DROP TABLE hole;
+DROP TABLE hole_group;
+DROP TABLE course;
diff --git a/mysql-test/suite/jdv/t/jdv_update.test b/mysql-test/suite/jdv/t/jdv_update.test
index abd700f84100..48300edf993d 100644
--- a/mysql-test/suite/jdv/t/jdv_update.test
+++ b/mysql-test/suite/jdv/t/jdv_update.test
@@ -1744,3 +1744,208 @@ DROP TABLE p_t2;
DROP TABLE p_t1;
DROP VIEW p_dv1;
+
+
+--echo #
+--echo # Bug#39566804: FK constraints may be violated when update deletes from
+--echo # nested child base table.
+--echo #
+
+CREATE TABLE course (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+ name VARCHAR(75) NOT NULL,
+ address VARCHAR(75) NOT NULL,
+ address2 VARCHAR(75) DEFAULT NULL,
+ city VARCHAR(50) NOT NULL,
+ state VARCHAR(2) NOT NULL,
+ zip VARCHAR(10) NOT NULL,
+ phone VARCHAR(14) NOT NULL,
+ abbrev VARCHAR(6) DEFAULT NULL,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE hole_group (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+ name VARCHAR(75) NOT NULL,
+ sort_order INT NOT NULL DEFAULT '0',
+ slope DECIMAL(10,2) NOT NULL DEFAULT '113.00',
+ rating DECIMAL(10,2) NOT NULL DEFAULT '72.00',
+ course_id INT UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (id),
+ KEY holegroup_course_id_index (course_id),
+ KEY holegroup_sort_order_index (sort_order),
+ CONSTRAINT holegroup_course_id_fk FOREIGN KEY (course_id) REFERENCES course (id)
+);
+
+CREATE TABLE hole (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+ number INT NOT NULL DEFAULT '0',
+ handicap INT NOT NULL DEFAULT '0',
+ par INT NOT NULL DEFAULT '0',
+ hole_group_id INT UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (id),
+ KEY hole_hole_group_id_index (hole_group_id),
+ KEY hole_number_index (number),
+ CONSTRAINT hole_holegroup_id_fk FOREIGN KEY (hole_group_id) REFERENCES hole_group (id)
+);
+
+CREATE
+ALGORITHM=UNDEFINED SQL SECURITY INVOKER
+JSON RELATIONAL DUALITY VIEW course_dv AS
+SELECT JSON_DUALITY_OBJECT(
+ WITH (INSERT,UPDATE,DELETE)
+ '_id': course.id,
+ 'name': course.name,
+ 'address': course.address,
+ 'address2': course.address2,
+ 'city': course.city,
+ 'state': course.state,
+ 'zip': course.zip,
+ 'phone': course.phone,
+ 'abbrev': course.abbrev,
+ 'holeGroups':(
+ SELECT JSON_ARRAYAGG(
+ JSON_DUALITY_OBJECT(
+ WITH (INSERT,UPDATE,DELETE)
+ 'id': hole_group.id,
+ 'name': hole_group.name,
+ 'sort_order': hole_group.sort_order,
+ 'slope': hole_group.slope,
+ 'rating': hole_group.rating,
+ 'course_id': hole_group.course_id,
+ 'holes':(
+ SELECT JSON_ARRAYAGG(
+ JSON_DUALITY_OBJECT(
+ WITH (INSERT,UPDATE,DELETE)
+ 'id': hole.id,
+ 'number': hole.number,
+ 'handicap': hole.handicap,
+ 'par': hole.par,
+ 'hole_group_id': hole.hole_group_id))
+ FROM hole WHERE (hole.hole_group_id = hole_group.id))))
+ FROM hole_group WHERE (hole_group.course_id = course.id))) AS Name_exp_1
+FROM course;
+
+
+INSERT INTO course_dv
+VALUES (
+ '{
+ "name": "Rock Harbor Golf Course - Boulder Course",
+ "address": "365 Rock Harbor Drive",
+ "address2": null,
+ "city": "Winchester",
+ "state": "VA",
+ "zip": "22602",
+ "phone": "(540) 722-7111",
+ "abbrev": "RHB",
+ "holeGroups": [
+ {
+ "name": "Front Nine",
+ "sort_order": 1,
+ "slope": 136.00,
+ "rating": 35.15,
+ "holes": [
+ { "number": 1, "handicap": 15, "par": 4 },
+ { "number": 2, "handicap": 5, "par": 3 },
+ { "number": 3, "handicap": 7, "par": 4 },
+ { "number": 4, "handicap": 17, "par": 5 },
+ { "number": 5, "handicap": 13, "par": 3 },
+ { "number": 6, "handicap": 1, "par": 5 },
+ { "number": 7, "handicap": 9, "par": 4 },
+ { "number": 8, "handicap": 3, "par": 3 },
+ { "number": 9, "handicap": 11, "par": 5 }
+ ]
+ },
+ {
+ "name": "Back Nine",
+ "sort_order": 2,
+ "slope": 136.00,
+ "rating": 35.15,
+ "holes": [
+ { "number": 10, "handicap": 4, "par": 5 },
+ { "number": 11, "handicap": 18, "par": 3 },
+ { "number": 12, "handicap": 16, "par": 4 },
+ { "number": 13, "handicap": 14, "par": 3 },
+ { "number": 14, "handicap": 8, "par": 4 },
+ { "number": 15, "handicap": 2, "par": 4 },
+ { "number": 16, "handicap": 6, "par": 5 },
+ { "number": 17, "handicap": 12, "par": 3 },
+ { "number": 18, "handicap": 10, "par": 5 }
+ ]
+ }
+ ]
+ }'
+);
+
+SELECT * FROM course_dv;
+SELECT * FROM course;
+SELECT * FROM hole_group;
+SELECT * FROM hole;
+
+--echo # Note that only the base table course is actually being updated here.
+--echo # None of the hole_groups or holes in the new value actually exists,
+--echo # so all existing rows in hole_group and hole will be deleted and
+--echo # the hole_groups and holes from the new value will be inserted.
+UPDATE course_dv
+SET data = '{
+ "_id": 1,
+ "name": "Rock Harbor Golf Course - Boulder Course",
+ "address": "365 Rock Harbor Drive",
+ "address2": null,
+ "city": "Winchester",
+ "state": "VA",
+ "zip": "22602",
+ "phone": "(540) 722-7111",
+ "abbrev": "RHB",
+ "holeGroups": [
+ {
+ "id": 13,
+ "name": "First Nine",
+ "sort_order": 1,
+ "slope": 136.00,
+ "rating": 35.15,
+ "course_id": 1,
+ "holes": [
+ { "id": 109, "number": 1, "handicap": 15, "par": 4, "hole_group_id": 13 },
+ { "id": 110, "number": 2, "handicap": 5, "par": 3, "hole_group_id": 13 },
+ { "id": 111, "number": 3, "handicap": 7, "par": 4, "hole_group_id": 13 },
+ { "id": 112, "number": 4, "handicap": 17, "par": 5, "hole_group_id": 13 },
+ { "id": 113, "number": 5, "handicap": 13, "par": 3, "hole_group_id": 13 },
+ { "id": 114, "number": 6, "handicap": 1, "par": 5, "hole_group_id": 13 },
+ { "id": 115, "number": 7, "handicap": 9, "par": 4, "hole_group_id": 13 },
+ { "id": 116, "number": 8, "handicap": 3, "par": 3, "hole_group_id": 13 },
+ { "id": 117, "number": 9, "handicap": 11, "par": 5, "hole_group_id": 13 }
+ ]
+ },
+ {
+ "id": 14,
+ "name": "Second Nine",
+ "sort_order": 2,
+ "slope": 136.00,
+ "rating": 35.15,
+ "course_id": 1,
+ "holes": [
+ { "id": 118, "number": 10, "handicap": 4, "par": 5, "hole_group_id": 14 },
+ { "id": 119, "number": 11, "handicap": 18, "par": 3, "hole_group_id": 14 },
+ { "id": 120, "number": 12, "handicap": 16, "par": 4, "hole_group_id": 14 },
+ { "id": 121, "number": 13, "handicap": 14, "par": 3, "hole_group_id": 14 },
+ { "id": 122, "number": 14, "handicap": 8, "par": 4, "hole_group_id": 14 },
+ { "id": 123, "number": 15, "handicap": 2, "par": 4, "hole_group_id": 14 },
+ { "id": 124, "number": 16, "handicap": 6, "par": 5, "hole_group_id": 14 },
+ { "id": 125, "number": 17, "handicap": 12, "par": 3, "hole_group_id": 14 },
+ { "id": 126, "number": 18, "handicap": 10, "par": 4, "hole_group_id": 14 }
+ ]
+ }
+ ]
+}'
+WHERE JSON_VALUE(data, '$._id') = 1;
+
+SELECT * FROM course_dv;
+SELECT * FROM course;
+SELECT * FROM hole_group;
+SELECT * FROM hole;
+
+DROP VIEW course_dv;
+DROP TABLE hole;
+DROP TABLE hole_group;
+DROP TABLE course;
diff --git a/mysql-test/suite/json/r/json_no_table.result b/mysql-test/suite/json/r/json_no_table.result
index 217adb311886..8aab3b2f5f30 100644
--- a/mysql-test/suite/json/r/json_no_table.result
+++ b/mysql-test/suite/json/r/json_no_table.result
@@ -4315,3 +4315,17 @@ JSON_REMOVE('{}','{"a":1}')
)
);
ERROR 42000: Invalid JSON path expression. The error is around character position 1.
+#
+# Bug#39649893: JSON_VALUE RETURNING DATETIME DEFAULT returns garbage
+#
+SELECT CAST(JSON_VALUE('"x"', '$' RETURNING DATETIME
+DEFAULT '2023-07-19 08:09:10' ON ERROR) AS DATE) AS d;
+d
+2023-07-19
+SELECT CAST(JSON_VALUE('{}', '$.x' RETURNING DATETIME
+DEFAULT '2023-07-19 08:09:10' ON EMPTY) AS DATE) AS d;
+d
+2023-07-19
+SELECT CAST(TIMESTAMP'2023-07-19 08:09:10' AS DATE) AS d;
+d
+2023-07-19
diff --git a/mysql-test/suite/json/r/json_value.result b/mysql-test/suite/json/r/json_value.result
index 0f2bace8eae0..fb6863bec764 100644
--- a/mysql-test/suite/json/r/json_value.result
+++ b/mysql-test/suite/json/r/json_value.result
@@ -101,50 +101,40 @@ def col2 253 256 16 Y 0 31 255
def col3 253 256 18 Y 0 31 255
col1 col2 col3
utf8mb4_0900_bin utf8mb4_0900_bin utf8mb4_0900_ai_ci
-SELECT JSON_VALUE('{"data": "2019-01-01"}', '$.data' RETURNING DATE);
+SELECT JSON_VALUE('{"data": "2019-01-01"}', '$.data' RETURNING DATE) AS d;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def JSON_VALUE('{"data": "2019-01-01"}', '$.data' RETURNING DATE) 10 40 10 Y 0 0 255
-JSON_VALUE('{"data": "2019-01-01"}', '$.data' RETURNING DATE)
+def d 10 10 10 Y 128 0 63
+d
2019-01-01
SELECT JSON_VALUE(JSON_OBJECT('data', CAST( DATE'2019-01-01' AS JSON)),
-'$.data' RETURNING DATE);
+'$.data' RETURNING DATE) AS d;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def JSON_VALUE(JSON_OBJECT('data', CAST( DATE'2019-01-01' AS JSON)),
-'$.data' RETURNING DATE) 10 40 10 Y 0 0 255
-JSON_VALUE(JSON_OBJECT('data', CAST( DATE'2019-01-01' AS JSON)),
-'$.data' RETURNING DATE)
+def d 10 10 10 Y 128 0 63
+d
2019-01-01
-SELECT JSON_VALUE('{"data": "11:11:11"}', '$.data' RETURNING TIME);
+SELECT JSON_VALUE('{"data": "11:11:11"}', '$.data' RETURNING TIME) AS t;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def JSON_VALUE('{"data": "11:11:11"}', '$.data' RETURNING TIME) 11 40 8 Y 0 0 255
-JSON_VALUE('{"data": "11:11:11"}', '$.data' RETURNING TIME)
+def t 11 10 8 Y 128 0 63
+t
11:11:11
SELECT JSON_VALUE(JSON_OBJECT('data', CAST( TIME'11:11:11' AS JSON)),
-'$.data' RETURNING TIME);
+'$.data' RETURNING TIME) AS t;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def JSON_VALUE(JSON_OBJECT('data', CAST( TIME'11:11:11' AS JSON)),
-'$.data' RETURNING TIME) 11 40 8 Y 0 0 255
-JSON_VALUE(JSON_OBJECT('data', CAST( TIME'11:11:11' AS JSON)),
-'$.data' RETURNING TIME)
+def t 11 10 8 Y 128 0 63
+t
11:11:11
SELECT JSON_VALUE('{"data": "2019-01-01 11:11:11"}',
-'$.data' RETURNING DATETIME);
+'$.data' RETURNING DATETIME) AS dt;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def JSON_VALUE('{"data": "2019-01-01 11:11:11"}',
-'$.data' RETURNING DATETIME) 12 76 19 Y 0 0 255
-JSON_VALUE('{"data": "2019-01-01 11:11:11"}',
-'$.data' RETURNING DATETIME)
+def dt 12 19 19 Y 128 0 63
+dt
2019-01-01 11:11:11
SELECT JSON_VALUE(
JSON_OBJECT('data', CAST(TIMESTAMP'2019-01-01 11:11:11' AS JSON)),
-'$.data' RETURNING DATETIME);
+'$.data' RETURNING DATETIME) AS dt;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def JSON_VALUE(
-JSON_OBJECT('data', CAST(TIMESTAMP'2019-01-01 11:11:11' AS JSON)),
-'$.data' RETURNING DATETIME) 12 76 19 Y 0 0 255
-JSON_VALUE(
-JSON_OBJECT('data', CAST(TIMESTAMP'2019-01-01 11:11:11' AS JSON)),
-'$.data' RETURNING DATETIME)
+def dt 12 19 19 Y 128 0 63
+dt
2019-01-01 11:11:11
SELECT JSON_VALUE('{"data": 123.45}', '$.data' RETURNING CHAR(10));
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
diff --git a/mysql-test/suite/json/t/json_no_table.test b/mysql-test/suite/json/t/json_no_table.test
index 74f90b94c9b1..8f9149314337 100644
--- a/mysql-test/suite/json/t/json_no_table.test
+++ b/mysql-test/suite/json/t/json_no_table.test
@@ -3001,3 +3001,15 @@ DO COALESCE(JSON_SEARCH(JSON_ARRAY('{}', '$[0]', '{}'), 'all',
JSON_REMOVE('{}','{"a":1}')
)
);
+
+--echo #
+--echo # Bug#39649893: JSON_VALUE RETURNING DATETIME DEFAULT returns garbage
+--echo #
+
+SELECT CAST(JSON_VALUE('"x"', '$' RETURNING DATETIME
+ DEFAULT '2023-07-19 08:09:10' ON ERROR) AS DATE) AS d;
+
+SELECT CAST(JSON_VALUE('{}', '$.x' RETURNING DATETIME
+ DEFAULT '2023-07-19 08:09:10' ON EMPTY) AS DATE) AS d;
+
+SELECT CAST(TIMESTAMP'2023-07-19 08:09:10' AS DATE) AS d;
diff --git a/mysql-test/suite/json/t/json_value.test b/mysql-test/suite/json/t/json_value.test
index d14b65006482..5b27c9931d99 100644
--- a/mysql-test/suite/json/t/json_value.test
+++ b/mysql-test/suite/json/t/json_value.test
@@ -43,22 +43,22 @@ SELECT COLLATION(JSON_VALUE('{"x": "y"}', '$.x')) AS col1,
COLLATION(JSON_VALUE('{"x": "y"}',
'$.x' RETURNING CHAR(10) CHARSET utf8mb4)) AS col3;
-SELECT JSON_VALUE('{"data": "2019-01-01"}', '$.data' RETURNING DATE);
+SELECT JSON_VALUE('{"data": "2019-01-01"}', '$.data' RETURNING DATE) AS d;
SELECT JSON_VALUE(JSON_OBJECT('data', CAST( DATE'2019-01-01' AS JSON)),
- '$.data' RETURNING DATE);
+ '$.data' RETURNING DATE) AS d;
# PS protocol gives different metadata for the "Max length" column for
# TIME and DATETIME.
--disable_ps_protocol
-SELECT JSON_VALUE('{"data": "11:11:11"}', '$.data' RETURNING TIME);
+SELECT JSON_VALUE('{"data": "11:11:11"}', '$.data' RETURNING TIME) AS t;
SELECT JSON_VALUE(JSON_OBJECT('data', CAST( TIME'11:11:11' AS JSON)),
- '$.data' RETURNING TIME);
+ '$.data' RETURNING TIME) AS t;
SELECT JSON_VALUE('{"data": "2019-01-01 11:11:11"}',
- '$.data' RETURNING DATETIME);
+ '$.data' RETURNING DATETIME) AS dt;
SELECT JSON_VALUE(
JSON_OBJECT('data', CAST(TIMESTAMP'2019-01-01 11:11:11' AS JSON)),
- '$.data' RETURNING DATETIME);
+ '$.data' RETURNING DATETIME) AS dt;
--enable_ps_protocol
SELECT JSON_VALUE('{"data": 123.45}', '$.data' RETURNING CHAR(10));
diff --git a/mysql-test/suite/ndb/r/ndb_addnode.result b/mysql-test/suite/ndb/r/ndb_addnode.result
index f0d7f0fc9090..010cba2eb003 100644
--- a/mysql-test/suite/ndb/r/ndb_addnode.result
+++ b/mysql-test/suite/ndb/r/ndb_addnode.result
@@ -489,6 +489,7 @@ id=231 (not connected, accepting connect from localhost)
id=232 (not connected, accepting connect from localhost)
id=233 (not connected, accepting connect from localhost)
id=255 (not connected, accepting connect from localhost)
+include/assert_grep.inc [Checking for node group in ndbd log file]
ALTER TABLESPACE ts_1 DROP DATAFILE 'data_1.dat';
DROP TABLESPACE ts_1;
DROP LOGFILE GROUP lg_1 ENGINE NDB;
diff --git a/mysql-test/suite/ndb/r/ndb_blob.result b/mysql-test/suite/ndb/r/ndb_blob.result
index fcfcb9bf8f74..4d555e782e7a 100644
--- a/mysql-test/suite/ndb/r/ndb_blob.result
+++ b/mysql-test/suite/ndb/r/ndb_blob.result
@@ -757,6 +757,37 @@ round_trips
3
set autocommit=0;
drop table t1;
+set autocommit=1;
+create table t1 (a int primary key, b text) engine=ndb;
+create table t2 like t1;
+create table t3 like t1;
+insert into t1 values (1, repeat('Blah', 1000));
+insert into t2 select * from t1;
+insert into t3 select * from t1;
+select t1.a, length(t1.b), length(t2.b), length(t3.b) from t1 inner join t2 on t1.a = t2.a inner join t3 on t1.a = t3.a where t1.a=1;
+a length(t1.b) length(t2.b) length(t3.b)
+1 4000 4000 4000
+select @start_count:=variable_value from performance_schema.global_status where variable_name="ndb_api_wait_exec_complete_count";
+3 way join
+select t1.a, length(t1.b), length(t2.b), length(t3.b) from t1 inner join t2 on t1.a = t2.a inner join t3 on t1.a = t3.a where t1.a=1;
+select @end_count:=variable_value from performance_schema.global_status where variable_name="ndb_api_wait_exec_complete_count";
+Total round trips with parts
+select @end_count-@start_count as round_trips;
+round_trips
+7
+update t1 set b=left(b,100);
+update t2 set b=left(b,100);
+update t3 set b=left(b,100);
+select @start_count:=variable_value from performance_schema.global_status where variable_name="ndb_api_wait_exec_complete_count";
+3 way join
+select t1.a, length(t1.b), length(t2.b), length(t3.b) from t1 inner join t2 on t1.a = t2.a inner join t3 on t1.a = t3.a where t1.a=1;
+select @end_count:=variable_value from performance_schema.global_status where variable_name="ndb_api_wait_exec_complete_count";
+Total round trips without parts
+select @end_count-@start_count as round_trips;
+round_trips
+4
+drop table t1, t2, t3;
+set autocommit=0;
5.6 tests
create table `t1` (`a` int,`b` blob,primary key (`a`))
engine=ndbcluster
diff --git a/mysql-test/suite/ndb/r/ndb_datanode_errorlog.result b/mysql-test/suite/ndb/r/ndb_datanode_errorlog.result
new file mode 100644
index 000000000000..95ba6532d252
--- /dev/null
+++ b/mysql-test/suite/ndb/r/ndb_datanode_errorlog.result
@@ -0,0 +1,377 @@
+Test robustness of data node error log generation code
+Clean up before starting
+--------------------------------------------------
+Test behaviour of problems with next crash id file
+--------------------------------------------------
+Create a normal set of files to start with id 1
+Generate an error-insert crash
+Sending dump signal with data:
+0x00000a2a 0x00000001
+
+
+Wait for the node to stop
+Node 1: NOT_STARTED
+Database node 1 is being started.
+
+Wait for the node to start
+Node 1: STARTED
+Node 2: STARTED
+Show next crash id file content
+1
+ndb_1_error.log
+ndb_1_trace.log.1
+ndb_1_trace.log.1_t1
+ndb_1_trace.log.1_t10
+ndb_1_trace.log.1_t2
+ndb_1_trace.log.1_t3
+ndb_1_trace.log.1_t4
+ndb_1_trace.log.1_t5
+ndb_1_trace.log.1_t6
+ndb_1_trace.log.1_t7
+ndb_1_trace.log.1_t8
+ndb_1_trace.log.1_t9
+ndb_1_trace.log.next
+
+-------------------
+Test : Unwriteable next file
+Show file content
+1
+ndb_1_trace.log.next
+
+Generate an error-insert crash
+Sending dump signal with data:
+0x00000a2a 0x00000001
+
+
+Wait for the node to stop
+Node 1: NOT_STARTED
+Database node 1 is being started.
+
+Wait for the node to start
+Node 1: STARTED
+Node 2: STARTED
+Show file content
+Expect next file unchanged, error + trace files 1 written
+1
+ndb_1_error.log
+ndb_1_trace.log.1
+ndb_1_trace.log.1_t1
+ndb_1_trace.log.1_t10
+ndb_1_trace.log.1_t2
+ndb_1_trace.log.1_t3
+ndb_1_trace.log.1_t4
+ndb_1_trace.log.1_t5
+ndb_1_trace.log.1_t6
+ndb_1_trace.log.1_t7
+ndb_1_trace.log.1_t8
+ndb_1_trace.log.1_t9
+ndb_1_trace.log.next
+-------------------
+Test : Unreadable next file
+
+ndb_1_trace.log.next
+
+Generate an error-insert crash
+Sending dump signal with data:
+0x00000a2a 0x00000001
+
+
+Wait for the node to stop
+Node 1: NOT_STARTED
+Database node 1 is being started.
+
+Wait for the node to start
+Node 1: STARTED
+Node 2: STARTED
+Show file content
+Expect next file unchanged, error and trace files 1 written
+1
+ndb_1_error.log
+ndb_1_trace.log.1
+ndb_1_trace.log.1_t1
+ndb_1_trace.log.1_t10
+ndb_1_trace.log.1_t2
+ndb_1_trace.log.1_t3
+ndb_1_trace.log.1_t4
+ndb_1_trace.log.1_t5
+ndb_1_trace.log.1_t6
+ndb_1_trace.log.1_t7
+ndb_1_trace.log.1_t8
+ndb_1_trace.log.1_t9
+ndb_1_trace.log.next
+-------------------
+Test : Zero length next file
+Show content
+
+ndb_1_trace.log.next
+Generate an error-insert crash
+Sending dump signal with data:
+0x00000a2a 0x00000001
+
+
+Wait for the node to stop
+Node 1: NOT_STARTED
+Database node 1 is being started.
+
+Wait for the node to start
+Node 1: STARTED
+Node 2: STARTED
+Show file content
+Expect next file defaults to 2, error + trace files 2 written
+2
+ndb_1_error.log
+ndb_1_trace.log.2
+ndb_1_trace.log.2_t1
+ndb_1_trace.log.2_t10
+ndb_1_trace.log.2_t2
+ndb_1_trace.log.2_t3
+ndb_1_trace.log.2_t4
+ndb_1_trace.log.2_t5
+ndb_1_trace.log.2_t6
+ndb_1_trace.log.2_t7
+ndb_1_trace.log.2_t8
+ndb_1_trace.log.2_t9
+ndb_1_trace.log.next
+-------------------
+Test : Junk in next file
+Show junk content
+ILLEGIBLE JUNK
+
+ndb_1_trace.log.next
+Generate an error-insert crash
+Sending dump signal with data:
+0x00000a2a 0x00000001
+
+
+Wait for the node to stop
+Node 1: NOT_STARTED
+Database node 1 is being started.
+
+Wait for the node to start
+Node 1: STARTED
+Node 2: STARTED
+Show file content
+Expect next file defaults to 2, error + trace files 2 written
+2
+ndb_1_error.log
+ndb_1_trace.log.2
+ndb_1_trace.log.2_t1
+ndb_1_trace.log.2_t10
+ndb_1_trace.log.2_t2
+ndb_1_trace.log.2_t3
+ndb_1_trace.log.2_t4
+ndb_1_trace.log.2_t5
+ndb_1_trace.log.2_t6
+ndb_1_trace.log.2_t7
+ndb_1_trace.log.2_t8
+ndb_1_trace.log.2_t9
+ndb_1_trace.log.next
+Cleanup
+----------------------------------------------
+Test behaviour of problems with error log file
+----------------------------------------------
+Generate an error-insert crash
+Sending dump signal with data:
+0x00000a2a 0x00000001
+
+
+Wait for the node to stop
+Node 1: NOT_STARTED
+Database node 1 is being started.
+
+Wait for the node to start
+Node 1: STARTED
+Node 2: STARTED
+
+ndb_1_error.log
+ndb_1_trace.log.1
+ndb_1_trace.log.1_t1
+ndb_1_trace.log.1_t10
+ndb_1_trace.log.1_t2
+ndb_1_trace.log.1_t3
+ndb_1_trace.log.1_t4
+ndb_1_trace.log.1_t5
+ndb_1_trace.log.1_t6
+ndb_1_trace.log.1_t7
+ndb_1_trace.log.1_t8
+ndb_1_trace.log.1_t9
+ndb_1_trace.log.next
+
+-------------------
+Test : Unwriteable error log
+ndb_1_error.log
+ndb_1_trace.log.next
+Generate an error-insert crash
+Sending dump signal with data:
+0x00000a2a 0x00000001
+
+
+Wait for the node to stop
+Node 1: NOT_STARTED
+Database node 1 is being started.
+
+Wait for the node to start
+Node 1: STARTED
+Node 2: STARTED
+Expect trace files 2 written
+
+ndb_1_error.log
+ndb_1_trace.log.2
+ndb_1_trace.log.2_t1
+ndb_1_trace.log.2_t10
+ndb_1_trace.log.2_t2
+ndb_1_trace.log.2_t3
+ndb_1_trace.log.2_t4
+ndb_1_trace.log.2_t5
+ndb_1_trace.log.2_t6
+ndb_1_trace.log.2_t7
+ndb_1_trace.log.2_t8
+ndb_1_trace.log.2_t9
+ndb_1_trace.log.next
+
+-------------------
+Test : Unreadable error log
+ndb_1_error.log
+ndb_1_trace.log.next
+Generate an error-insert crash
+Sending dump signal with data:
+0x00000a2a 0x00000001
+
+
+Wait for the node to stop
+Node 1: NOT_STARTED
+Database node 1 is being started.
+
+Wait for the node to start
+Node 1: STARTED
+Node 2: STARTED
+Expect trace files 3 written
+
+ndb_1_error.log
+ndb_1_trace.log.3
+ndb_1_trace.log.3_t1
+ndb_1_trace.log.3_t10
+ndb_1_trace.log.3_t2
+ndb_1_trace.log.3_t3
+ndb_1_trace.log.3_t4
+ndb_1_trace.log.3_t5
+ndb_1_trace.log.3_t6
+ndb_1_trace.log.3_t7
+ndb_1_trace.log.3_t8
+ndb_1_trace.log.3_t9
+ndb_1_trace.log.next
+
+-------------------
+Test : Zero length error log file
+ndb_1_error.log
+ndb_1_trace.log.next
+Show content
+Generate an error-insert crash
+Sending dump signal with data:
+0x00000a2a 0x00000001
+
+
+Wait for the node to stop
+Node 1: NOT_STARTED
+Database node 1 is being started.
+
+Wait for the node to start
+Node 1: STARTED
+Node 2: STARTED
+Show content
+Expect error log written, error log copy empty, trace files 1 written
+include/assert_grep.inc [Check that error log is written]
+
+ndb_1_error.log
+ndb_1_error.log.bak
+ndb_1_trace.log.1
+ndb_1_trace.log.1_t1
+ndb_1_trace.log.1_t10
+ndb_1_trace.log.1_t2
+ndb_1_trace.log.1_t3
+ndb_1_trace.log.1_t4
+ndb_1_trace.log.1_t5
+ndb_1_trace.log.1_t6
+ndb_1_trace.log.1_t7
+ndb_1_trace.log.1_t8
+ndb_1_trace.log.1_t9
+ndb_1_trace.log.next
+-------------------
+Test : Junk in error log file
+ndb_1_error.log
+ndb_1_trace.log.next
+Show junk content
+ILLEGIBLE JUNK
+Generate an error-insert crash
+Sending dump signal with data:
+0x00000a2a 0x00000001
+
+
+Wait for the node to stop
+Node 1: NOT_STARTED
+Database node 1 is being started.
+
+Wait for the node to start
+Node 1: STARTED
+Node 2: STARTED
+Show file content
+Expect error log written, error log copy has hunk, trace files 2 written
+include/assert_grep.inc [Check that error log is written]
+ILLEGIBLE JUNK
+
+ndb_1_error.log
+ndb_1_error.log.bak
+ndb_1_trace.log.2
+ndb_1_trace.log.2_t1
+ndb_1_trace.log.2_t10
+ndb_1_trace.log.2_t2
+ndb_1_trace.log.2_t3
+ndb_1_trace.log.2_t4
+ndb_1_trace.log.2_t5
+ndb_1_trace.log.2_t6
+ndb_1_trace.log.2_t7
+ndb_1_trace.log.2_t8
+ndb_1_trace.log.2_t9
+ndb_1_trace.log.next
+-----------------------------------------------
+Test behaviour of problems with trace log files
+-----------------------------------------------
+Clean up before starting
+Expect next crash will write trace logs 1
+Create some files with those names already
+that cannot be overwritten due to permissions
+Test that files that can be written are
+written.
+Show state before
+ndb_1_trace.log.1
+ndb_1_trace.log.1_t3
+Generate an error-insert crash
+Sending dump signal with data:
+0x00000a2a 0x00000001
+
+
+Wait for the node to stop
+Node 1: NOT_STARTED
+Database node 1 is being started.
+
+Wait for the node to start
+Node 1: STARTED
+Node 2: STARTED
+Show state after
+Expect error log and trace files 1 written
+Bad trace files still contain JUNK
+ndb_1_error.log
+ndb_1_trace.log.1
+ndb_1_trace.log.1_t1
+ndb_1_trace.log.1_t10
+ndb_1_trace.log.1_t2
+ndb_1_trace.log.1_t3
+ndb_1_trace.log.1_t4
+ndb_1_trace.log.1_t5
+ndb_1_trace.log.1_t6
+ndb_1_trace.log.1_t7
+ndb_1_trace.log.1_t8
+ndb_1_trace.log.1_t9
+ndb_1_trace.log.next
+JUNK
+JUNK
diff --git a/mysql-test/suite/ndb/r/ndb_scan_start_restart.result b/mysql-test/suite/ndb/r/ndb_scan_start_restart.result
new file mode 100644
index 000000000000..146f9203a1ae
--- /dev/null
+++ b/mysql-test/suite/ndb/r/ndb_scan_start_restart.result
@@ -0,0 +1,4 @@
+Running command
+Result of command: 0
+DROP DATABASE TEST_DB;
+Test program success!
diff --git a/mysql-test/suite/ndb/t/ndb_addnode.test b/mysql-test/suite/ndb/t/ndb_addnode.test
index 24bf5590363f..bd5f341c8bd1 100644
--- a/mysql-test/suite/ndb/t/ndb_addnode.test
+++ b/mysql-test/suite/ndb/t/ndb_addnode.test
@@ -206,6 +206,14 @@ drop table t1,t2,t3,t4,t5,t6,t10;
## Nodegroup with "new" nodes still exists after dropping it as shown:
--source ndb_mgm_show_table.inc
+# Verify nodegroup messages in a data node log file
+--let $assert_text= Checking for node group in ndbd log file
+--let $assert_select= Now in node group
+--let $assert_only_after= Now in node group 1 due to CREATE NODEGROUP.
+--let $assert_match= Now in node group 65536 due to DROP NODEGROUP.
+--let $assert_file= $MYSQLTEST_VARDIR/mysql_cluster.1/ndbd.4/ndbd.log
+--source include/assert_grep.inc
+
# Cleanup
ALTER TABLESPACE ts_1 DROP DATAFILE 'data_1.dat';
DROP TABLESPACE ts_1;
diff --git a/mysql-test/suite/ndb/t/ndb_blob.test b/mysql-test/suite/ndb/t/ndb_blob.test
index 447fd96a3b73..c93612f2a07f 100644
--- a/mysql-test/suite/ndb/t/ndb_blob.test
+++ b/mysql-test/suite/ndb/t/ndb_blob.test
@@ -706,6 +706,56 @@ set autocommit=0;
drop table t1;
+# Test autocommit + join + blobs roundtrips
+
+set autocommit=1;
+create table t1 (a int primary key, b text) engine=ndb;
+create table t2 like t1;
+create table t3 like t1;
+
+insert into t1 values (1, repeat('Blah', 1000));
+insert into t2 select * from t1;
+insert into t3 select * from t1;
+
+# Warmup
+select t1.a, length(t1.b), length(t2.b), length(t3.b) from t1 inner join t2 on t1.a = t2.a inner join t3 on t1.a = t3.a where t1.a=1;
+
+# Timing
+--disable_result_log
+select @start_count:=variable_value from performance_schema.global_status where variable_name="ndb_api_wait_exec_complete_count";
+
+--echo 3 way join
+select t1.a, length(t1.b), length(t2.b), length(t3.b) from t1 inner join t2 on t1.a = t2.a inner join t3 on t1.a = t3.a where t1.a=1;
+
+select @end_count:=variable_value from performance_schema.global_status where variable_name="ndb_api_wait_exec_complete_count";
+
+--enable_result_log
+
+--echo Total round trips with parts
+select @end_count-@start_count as round_trips;
+
+update t1 set b=left(b,100);
+update t2 set b=left(b,100);
+update t3 set b=left(b,100);
+
+# Timing
+--disable_result_log
+select @start_count:=variable_value from performance_schema.global_status where variable_name="ndb_api_wait_exec_complete_count";
+
+--echo 3 way join
+select t1.a, length(t1.b), length(t2.b), length(t3.b) from t1 inner join t2 on t1.a = t2.a inner join t3 on t1.a = t3.a where t1.a=1;
+
+select @end_count:=variable_value from performance_schema.global_status where variable_name="ndb_api_wait_exec_complete_count";
+
+--enable_result_log
+
+--echo Total round trips without parts
+select @end_count-@start_count as round_trips;
+
+drop table t1, t2, t3;
+
+set autocommit=0;
+
--echo 5.6 tests
# Bug#16749788
diff --git a/mysql-test/suite/ndb/t/ndb_datanode_errorlog.cnf b/mysql-test/suite/ndb/t/ndb_datanode_errorlog.cnf
new file mode 100644
index 000000000000..46877543a1dd
--- /dev/null
+++ b/mysql-test/suite/ndb/t/ndb_datanode_errorlog.cnf
@@ -0,0 +1,4 @@
+!include suite/ndb/my.cnf
+
+[cluster_config]
+MaxNoOfSavedMessages= 3
diff --git a/mysql-test/suite/ndb/t/ndb_datanode_errorlog.test b/mysql-test/suite/ndb/t/ndb_datanode_errorlog.test
new file mode 100644
index 000000000000..607281ab49db
--- /dev/null
+++ b/mysql-test/suite/ndb/t/ndb_datanode_errorlog.test
@@ -0,0 +1,407 @@
+--source include/have_ndb.inc
+--source have_ndb_error_insert.inc
+
+--echo Test robustness of data node error log generation code
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+let $DN1_DATADIR=$MYSQLD_DATADIR/../../ndbd.1;
+let $DN1_NEXT=$DN1_DATADIR/ndb_1_trace.log.next;
+let $DN1_ERRORLOG=$DN1_DATADIR/ndb_1_error.log;
+let $DN1_TRACEBASE=$DN1_DATADIR/ndb_1_trace.log;
+let $DN1_ERRORLOG_COPY=$DN1_ERRORLOG.bak;
+
+--echo Clean up before starting
+--remove_files_wildcard $DN1_DATADIR ndb_1_error*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace*
+
+--echo --------------------------------------------------
+--echo Test behaviour of problems with next crash id file
+--echo --------------------------------------------------
+
+--echo Create a normal set of files to start with id 1
+--echo Generate an error-insert crash
+--exec $NDB_MGM -e "1 DUMP 2602 1"
+--exec $NDB_MGM --execute "1 ERROR 9999"
+
+--echo Wait for the node to stop
+--exec $NDB_WAITER --not-started -w1
+--exec $NDB_MGM -e "1 START"
+--echo Wait for the node to start
+--exec $NDB_WAITER
+
+--echo Show next crash id file content
+--cat_file $DN1_NEXT
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+--echo
+
+
+--echo -------------------
+--echo Test : Unwriteable next file
+# r
+--chmod 0400 $DN1_NEXT
+
+# Remove files except next file
+--remove_files_wildcard $DN1_DATADIR ndb_1_error*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.1*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.2*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.3*
+
+--echo Show file content
+--cat_file $DN1_NEXT
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+--echo
+
+--echo Generate an error-insert crash
+--exec $NDB_MGM -e "1 DUMP 2602 1"
+--exec $NDB_MGM --execute "1 ERROR 9999"
+
+--echo Wait for the node to stop
+--exec $NDB_WAITER --not-started -w1
+--exec $NDB_MGM -e "1 START"
+--echo Wait for the node to start
+--exec $NDB_WAITER
+
+--echo Show file content
+--echo Expect next file unchanged, error + trace files 1 written
+--chmod 0600 $DN1_NEXT
+--cat_file $DN1_NEXT
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+
+--echo -------------------
+--echo Test : Unreadable next file
+--chmod 0000 $DN1_NEXT
+
+# Remove files except next file
+--remove_files_wildcard $DN1_DATADIR ndb_1_error*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.1*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.2*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.3*
+
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+--echo
+
+--echo Generate an error-insert crash
+--exec $NDB_MGM -e "1 DUMP 2602 1"
+--exec $NDB_MGM --execute "1 ERROR 9999"
+
+--echo Wait for the node to stop
+--exec $NDB_WAITER --not-started -w1
+--exec $NDB_MGM -e "1 START"
+--echo Wait for the node to start
+--exec $NDB_WAITER
+
+--echo Show file content
+--echo Expect next file unchanged, error and trace files 1 written
+--chmod 0600 $DN1_NEXT
+--cat_file $DN1_NEXT
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+
+
+--echo -------------------
+--echo Test : Zero length next file
+--remove_file $DN1_NEXT
+--write_file $DN1_NEXT
+EOF
+
+# Remove files except next file
+--remove_files_wildcard $DN1_DATADIR ndb_1_error*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.1*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.2*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.3*
+
+--echo Show content
+--cat_file $DN1_NEXT
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+--echo Generate an error-insert crash
+--exec $NDB_MGM -e "1 DUMP 2602 1"
+--exec $NDB_MGM --execute "1 ERROR 9999"
+
+--echo Wait for the node to stop
+--exec $NDB_WAITER --not-started -w1
+--exec $NDB_MGM -e "1 START"
+--echo Wait for the node to start
+--exec $NDB_WAITER
+
+--echo Show file content
+--echo Expect next file defaults to 2, error + trace files 2 written
+--cat_file $DN1_NEXT
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+
+--echo -------------------
+--echo Test : Junk in next file
+--remove_file $DN1_NEXT
+--write_file $DN1_NEXT
+ILLEGIBLE JUNK
+EOF
+
+# Remove files except next file
+--remove_files_wildcard $DN1_DATADIR ndb_1_error*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.1*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.2*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.3*
+
+--echo Show junk content
+--cat_file $DN1_NEXT
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+--echo Generate an error-insert crash
+--exec $NDB_MGM -e "1 DUMP 2602 1"
+--exec $NDB_MGM --execute "1 ERROR 9999"
+
+--echo Wait for the node to stop
+--exec $NDB_WAITER --not-started -w1
+--exec $NDB_MGM -e "1 START"
+--echo Wait for the node to start
+--exec $NDB_WAITER
+
+--echo Show file content
+--echo Expect next file defaults to 2, error + trace files 2 written
+--cat_file $DN1_NEXT
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+
+
+--echo Cleanup
+--remove_files_wildcard $DN1_DATADIR ndb_1_error*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace*
+
+--echo ----------------------------------------------
+--echo Test behaviour of problems with error log file
+--echo ----------------------------------------------
+
+--echo Generate an error-insert crash
+--exec $NDB_MGM -e "1 DUMP 2602 1"
+--exec $NDB_MGM --execute "1 ERROR 9999"
+
+--echo Wait for the node to stop
+--exec $NDB_WAITER --not-started -w1
+--exec $NDB_MGM -e "1 START"
+--echo Wait for the node to start
+--exec $NDB_WAITER
+
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+--echo
+
+
+--echo -------------------
+--echo Test : Unwriteable error log
+# r
+--chmod 0400 $DN1_ERRORLOG
+
+# Remove trace files
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.1*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.2*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.3*
+
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+--echo Generate an error-insert crash
+--exec $NDB_MGM -e "1 DUMP 2602 1"
+--exec $NDB_MGM --execute "1 ERROR 9999"
+
+--echo Wait for the node to stop
+--exec $NDB_WAITER --not-started -w1
+--exec $NDB_MGM -e "1 START"
+--echo Wait for the node to start
+--exec $NDB_WAITER
+
+--chmod 0600 $DN1_ERRORLOG
+
+--echo Expect trace files 2 written
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+--echo
+
+--echo -------------------
+--echo Test : Unreadable error log
+--chmod 0000 $DN1_ERRORLOG
+
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.1*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.2*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.3*
+
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+--echo Generate an error-insert crash
+--exec $NDB_MGM -e "1 DUMP 2602 1"
+--exec $NDB_MGM --execute "1 ERROR 9999"
+
+--echo Wait for the node to stop
+--exec $NDB_WAITER --not-started -w1
+--exec $NDB_MGM -e "1 START"
+--echo Wait for the node to start
+--exec $NDB_WAITER
+
+--chmod 0600 $DN1_ERRORLOG
+
+--echo Expect trace files 3 written
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+--echo
+
+--echo -------------------
+--echo Test : Zero length error log file
+--remove_file $DN1_ERRORLOG
+--write_file $DN1_ERRORLOG
+EOF
+
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.1*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.2*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.3*
+
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+--echo Show content
+--cat_file $DN1_ERRORLOG
+
+--echo Generate an error-insert crash
+--exec $NDB_MGM -e "1 DUMP 2602 1"
+--exec $NDB_MGM --execute "1 ERROR 9999"
+
+--echo Wait for the node to stop
+--exec $NDB_WAITER --not-started -w1
+--exec $NDB_MGM -e "1 START"
+--echo Wait for the node to start
+--exec $NDB_WAITER
+
+--echo Show content
+--echo Expect error log written, error log copy empty, trace files 1 written
+--let $assert_text=Check that error log is written
+--let $assert_file=$DN1_ERRORLOG
+--let $assert_select=Current byte-offset of
+--let $assert_count=1
+--source include/assert_grep.inc
+--cat_file $DN1_ERRORLOG_COPY
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+--remove_file $DN1_ERRORLOG_COPY
+
+--echo -------------------
+--echo Test : Junk in error log file
+--remove_file $DN1_ERRORLOG
+--write_file $DN1_ERRORLOG
+ILLEGIBLE JUNK
+EOF
+
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.1*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.2*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace.log.3*
+
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+--echo Show junk content
+--cat_file $DN1_ERRORLOG
+
+--echo Generate an error-insert crash
+--exec $NDB_MGM -e "1 DUMP 2602 1"
+--exec $NDB_MGM --execute "1 ERROR 9999"
+
+--echo Wait for the node to stop
+--exec $NDB_WAITER --not-started -w1
+--exec $NDB_MGM -e "1 START"
+--echo Wait for the node to start
+--exec $NDB_WAITER
+
+--echo Show file content
+--echo Expect error log written, error log copy has hunk, trace files 2 written
+--let $assert_text=Check that error log is written
+--let $assert_file=$DN1_ERRORLOG
+--let $assert_select=Current byte-offset of
+--let $assert_count=1
+--source include/assert_grep.inc
+--cat_file $DN1_ERRORLOG_COPY
+--echo
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+--remove_file $DN1_ERRORLOG_COPY
+
+
+--echo -----------------------------------------------
+--echo Test behaviour of problems with trace log files
+--echo -----------------------------------------------
+
+--echo Clean up before starting
+--remove_files_wildcard $DN1_DATADIR ndb_1_error*
+--remove_files_wildcard $DN1_DATADIR ndb_1_trace*
+
+--echo Expect next crash will write trace logs 1
+--echo Create some files with those names already
+--echo that cannot be overwritten due to permissions
+--echo Test that files that can be written are
+--echo written.
+
+
+let $BADTRACE1=$DN1_TRACEBASE.1;
+let $BADTRACE2=$DN1_TRACEBASE.1_t3;
+
+--write_file $BADTRACE1
+JUNK
+EOF
+# r
+--chmod 0400 $BADTRACE1
+
+--write_file $BADTRACE2
+JUNK
+EOF
+--chmod 0400 $BADTRACE2
+
+--echo Show state before
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+--echo Generate an error-insert crash
+--exec $NDB_MGM -e "1 DUMP 2602 1"
+--exec $NDB_MGM --execute "1 ERROR 9999"
+
+--echo Wait for the node to stop
+--exec $NDB_WAITER --not-started -w1
+--exec $NDB_MGM -e "1 START"
+--echo Wait for the node to start
+--exec $NDB_WAITER
+
+--echo Show state after
+--echo Expect error log and trace files 1 written
+--echo Bad trace files still contain JUNK
+
+--list_files $DN1_DATADIR ndb_1_error*
+--list_files $DN1_DATADIR ndb_1_trace*
+
+--cat_file $BADTRACE1
+--cat_file $BADTRACE2
+
+--chmod 0600 $BADTRACE1
+--chmod 0600 $BADTRACE2
+
diff --git a/mysql-test/suite/ndb/t/ndb_local_logevents.cnf b/mysql-test/suite/ndb/t/ndb_local_logevents.cnf
index 96bbecdf8208..29eb98426163 100644
--- a/mysql-test/suite/ndb/t/ndb_local_logevents.cnf
+++ b/mysql-test/suite/ndb/t/ndb_local_logevents.cnf
@@ -1,4 +1,4 @@
!include ../my.cnf
[cluster_config.1]
-HeartbeatIntervalDbDb=10
+HeartbeatIntervalDbDb=100
StopOnError=0
diff --git a/mysql-test/suite/ndb/t/ndb_scan_start_restart.cnf b/mysql-test/suite/ndb/t/ndb_scan_start_restart.cnf
new file mode 100644
index 000000000000..8596ef61bf63
--- /dev/null
+++ b/mysql-test/suite/ndb/t/ndb_scan_start_restart.cnf
@@ -0,0 +1,11 @@
+!include ../my.cnf
+
+# 8 data nodes to surface bug
+
+[cluster_config.1]
+NoOfReplicas= 2
+ndbd=,,,,,,,
+ndb_mgmd=
+mysqld=,
+ndbapi=,,,,,,,,,,,
+
diff --git a/mysql-test/suite/ndb/t/ndb_scan_start_restart.test b/mysql-test/suite/ndb/t/ndb_scan_start_restart.test
new file mode 100644
index 000000000000..8d7067efdbc3
--- /dev/null
+++ b/mysql-test/suite/ndb/t/ndb_scan_start_restart.test
@@ -0,0 +1,7 @@
+--source include/have_ndb.inc
+
+let NDBAPITEST_NAME=testScan;
+let NDBAPITEST_ARGS=-nScanStartRestart T1;
+let NDBAPITEST_CLEANUP_QUERY=DROP DATABASE TEST_DB;
+
+--source suite/ndb/include/run_ndbapitest.inc
diff --git a/mysql-test/suite/ndb_binlog/r/ndb_binlog_multi_conn_fail.result b/mysql-test/suite/ndb_binlog/r/ndb_binlog_multi_conn_fail.result
new file mode 100644
index 000000000000..5df1345245ee
--- /dev/null
+++ b/mysql-test/suite/ndb_binlog/r/ndb_binlog_multi_conn_fail.result
@@ -0,0 +1,586 @@
+call mtr.add_suppression("cluster disconnect An incident event has been written");
+Determine which nodeid each connection uses
+create table t1 (a int) engine=ndb;
+Test 1 : Show main connection activity unaffected
+by failures of secondary connections
+Bounce non-main connections
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce non-main connections
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce non-main connections
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce non-main connections
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce non-main connections
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce non-main connections
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce non-main connections
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce non-main connections
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce non-main connections
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce non-main connections
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Test 2 : Show secondary conn2
+unaffected by failure of secondary
+conn3
+Connection 2 (nodeid 32)
+Bounce other connection (3 / 63)
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (3 / 63)
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (3 / 63)
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (3 / 63)
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (3 / 63)
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (3 / 63)
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (3 / 63)
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (3 / 63)
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (3 / 63)
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (3 / 63)
+Sending dump signal with data:
+0x00000384 0x0000003f
+Sending dump signal with data:
+0x00000384 0x0000003f
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Test 3 : Show secondary conn3
+unaffected by failure of secondary
+conn2
+Connection 3 (nodeid 63)
+Bounce other connection (2 / 32)
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (2 / 32)
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (2 / 32)
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (2 / 32)
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (2 / 32)
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (2 / 32)
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (2 / 32)
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (2 / 32)
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (2 / 32)
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Bounce other connection (2 / 32)
+Sending dump signal with data:
+0x00000384 0x00000020
+Sending dump signal with data:
+0x00000384 0x00000020
+
+Show query successful
+select * from t1 LIMIT 1;
+a
+1
+Show dml successful
+insert into t1 values (1);
+Show DDL successful
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Test 4 : Show main connection
+failure affects all connections
+but not in a permanent way
+Main : Main
+Bounce main connection (1 / 49)
+Sending dump signal with data:
+0x00000384 0x00000031
+Sending dump signal with data:
+0x00000384 0x00000031
+
+Show query fails
+select * from t1 LIMIT 1;
+Got one of the listed errors
+Show dml fails
+insert into t1 values (1);
+Got one of the listed errors
+Show DDL fails
+create table test.t2 (a int primary key) engine=ndb;
+Got one of the listed errors
+Main : 2
+Bounce main connection (1 / 49)
+Sending dump signal with data:
+0x00000384 0x00000031
+Sending dump signal with data:
+0x00000384 0x00000031
+
+Query will fail during BI reinit
+select * from t1 LIMIT 1;
+Got one of the listed errors
+DML will fail during BI reinit
+insert into t1 values (1);
+Got one of the listed errors
+Show DDL fails
+create table test.t2 (a int primary key) engine=ndb;
+Got one of the listed errors
+Main : 3
+Bounce main connection (1 / 49)
+Sending dump signal with data:
+0x00000384 0x00000031
+Sending dump signal with data:
+0x00000384 0x00000031
+
+Query will fail during BI reinit
+select * from t1 LIMIT 1;
+Got one of the listed errors
+DML will fail during BI reinit
+insert into t1 values (1);
+Got one of the listed errors
+Show DDL fails
+create table test.t2 (a int primary key) engine=ndb;
+Got one of the listed errors
+Show all working again
+Main
+select * from t1 LIMIT 1;
+a
+1
+insert into t1 values (1);
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Conn 2
+select * from t1 LIMIT 1;
+a
+1
+insert into t1 values (1);
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+Conn 3
+select * from t1 LIMIT 1;
+a
+1
+insert into t1 values (1);
+create table test.t2 (a int primary key) engine=ndb;
+drop table test.t2;
+drop table t1;
diff --git a/mysql-test/suite/ndb_binlog/t/ndb_binlog_multi_conn_fail.test b/mysql-test/suite/ndb_binlog/t/ndb_binlog_multi_conn_fail.test
new file mode 100644
index 000000000000..f800b7613dce
--- /dev/null
+++ b/mysql-test/suite/ndb_binlog/t/ndb_binlog_multi_conn_fail.test
@@ -0,0 +1,256 @@
+--source include/have_ndb.inc
+
+#
+# Test ha_ndbcluster behaviour with
+# intermittent connection loss +
+# DDL
+#
+
+call mtr.add_suppression("cluster disconnect An incident event has been written");
+
+# In this test suite :
+# Server1 uses main API connection
+# id 49, secondary 32, 63
+# Server 2 uses main API connection
+# id 16, secondary 48, 127
+
+connect (server1a,127.0.0.1,root,,test,$MASTER_MYPORT,);
+connect (server1b,127.0.0.1,root,,test,$MASTER_MYPORT,);
+connect (server1c,127.0.0.1,root,,test,$MASTER_MYPORT,);
+
+--echo Determine which nodeid each connection uses
+
+create table t1 (a int) engine=ndb;
+
+--connection server1a
+--let $server_nodeid=query_get_value("select variable_value as v from performance_schema.session_status where variable_name='Ndb_cluster_node_id'", v, 1)
+# --eval select "server1a is $server_nodeid"
+
+if ($server_nodeid == 49)
+{
+ --let $main_conn=server1a
+}
+if ($server_nodeid == 32)
+{
+ --let $conn2=server1a
+}
+if ($server_nodeid == 63)
+{
+ --let $conn3=server1a
+}
+
+--connection server1b
+--let $server_nodeid=query_get_value("select variable_value as v from performance_schema.session_status where variable_name='Ndb_cluster_node_id'", v, 1)
+# --eval select "server1b is $server_nodeid"
+
+if ($server_nodeid == 49)
+{
+ --let $main_conn=server1b
+}
+if ($server_nodeid == 32)
+{
+ --let $conn2=server1b
+}
+if ($server_nodeid == 63)
+{
+ --let $conn3=server1b
+}
+
+--connection server1c
+--let $server_nodeid=query_get_value("select variable_value as v from performance_schema.session_status where variable_name='Ndb_cluster_node_id'", v, 1)
+# --eval select "server1c is $server_nodeid"
+
+if ($server_nodeid == 49)
+{
+ --let $main_conn=server1c
+}
+if ($server_nodeid == 32)
+{
+ --let $conn2=server1c
+}
+if ($server_nodeid == 63)
+{
+ --let $conn3=server1c
+}
+
+#--echo Main conn is $main_conn
+#--echo Second conn is $conn2
+#--echo Third conn is $conn3
+
+--echo Test 1 : Show main connection activity unaffected
+--echo by failures of secondary connections
+--connection $main_conn
+
+--let $iter=10
+while($iter)
+{
+ --echo Bounce non-main connections
+ --exec $NDB_MGM -e"ALL DUMP 900 32"
+ --exec $NDB_MGM -e"ALL DUMP 900 63"
+
+ --echo Show query successful
+ select * from t1 LIMIT 1;
+
+ --echo Show dml successful
+ insert into t1 values (1);
+
+ --echo Show DDL successful
+ create table test.t2 (a int primary key) engine=ndb;
+ drop table test.t2;
+
+ --sleep 0.5
+ --dec $iter
+}
+
+--echo Test 2 : Show secondary conn2
+--echo unaffected by failure of secondary
+--echo conn3
+
+--echo Connection 2 (nodeid 32)
+--connection $conn2
+--source include/ndb_not_readonly.inc
+
+--let $iter=10
+while($iter)
+{
+ --echo Bounce other connection (3 / 63)
+ --exec $NDB_MGM -e"ALL DUMP 900 63"
+
+ --echo Show query successful
+ select * from t1 LIMIT 1;
+
+ --echo Show dml successful
+ insert into t1 values (1);
+
+ --echo Show DDL successful
+ create table test.t2 (a int primary key) engine=ndb;
+ drop table test.t2;
+
+ --sleep 0.5
+ --dec $iter
+}
+
+--echo Test 3 : Show secondary conn3
+--echo unaffected by failure of secondary
+--echo conn2
+
+--echo Connection 3 (nodeid 63)
+--connection $conn3
+--source include/ndb_not_readonly.inc
+
+--let $iter=10
+while($iter)
+{
+ --echo Bounce other connection (2 / 32)
+ --exec $NDB_MGM -e"ALL DUMP 900 32"
+
+ --echo Show query successful
+ select * from t1 LIMIT 1;
+
+ --echo Show dml successful
+ insert into t1 values (1);
+
+ --echo Show DDL successful
+ create table test.t2 (a int primary key) engine=ndb;
+ drop table test.t2;
+
+ --sleep 0.5
+ --dec $iter
+}
+
+
+--echo Test 4 : Show main connection
+--echo failure affects all connections
+--echo but not in a permanent way
+
+--connection $main_conn
+--echo Main : Main
+
+--echo Bounce main connection (1 / 49)
+--exec $NDB_MGM -e"ALL DUMP 900 49"
+
+--echo Show query fails
+--let $query=select * from t1 LIMIT 1;
+--source include/wait_for_query_to_fail.inc
+--error 1296,1297
+select * from t1 LIMIT 1;
+
+--echo Show dml fails
+--error 1296,1297
+insert into t1 values (1);
+
+--echo Show DDL fails
+--error 1296,1297
+create table test.t2 (a int primary key) engine=ndb;
+
+--source include/ndb_not_readonly.inc
+
+--connection $conn2
+--echo Main : 2
+
+--echo Bounce main connection (1 / 49)
+--exec $NDB_MGM -e"ALL DUMP 900 49"
+
+--echo Query will fail during BI reinit
+--let $query=select * from t1 LIMIT 1;
+--source include/wait_for_query_to_fail.inc
+--error 1296,1297
+select * from t1 LIMIT 1;
+
+--echo DML will fail during BI reinit
+--error 1296,1297
+insert into t1 values (1);
+
+--echo Show DDL fails
+--error 1296,1297
+create table test.t2 (a int primary key) engine=ndb;
+
+--connection $main_conn
+--source include/ndb_not_readonly.inc
+
+--connection $conn3
+--echo Main : 3
+
+--echo Bounce main connection (1 / 49)
+--exec $NDB_MGM -e"ALL DUMP 900 49"
+
+--echo Query will fail during BI reinit
+--let $query=select * from t1 LIMIT 1;
+--source include/wait_for_query_to_fail.inc
+--error 1296,1297
+select * from t1 LIMIT 1;
+
+--echo DML will fail during BI reinit
+--error 1296,1297
+insert into t1 values (1);
+
+--echo Show DDL fails
+--error 1296,1297
+create table test.t2 (a int primary key) engine=ndb;
+
+--connection $main_conn
+--source include/ndb_not_readonly.inc
+
+--echo Show all working again
+--echo Main
+--connection $main_conn
+ select * from t1 LIMIT 1;
+ insert into t1 values (1);
+ create table test.t2 (a int primary key) engine=ndb;
+ drop table test.t2;
+
+--echo Conn 2
+--connection $conn2
+ select * from t1 LIMIT 1;
+ insert into t1 values (1);
+ create table test.t2 (a int primary key) engine=ndb;
+ drop table test.t2;
+
+--echo Conn 3
+--connection $conn3
+ select * from t1 LIMIT 1;
+ insert into t1 values (1);
+ create table test.t2 (a int primary key) engine=ndb;
+ drop table test.t2;
+
+drop table t1;
diff --git a/mysql-test/suite/ndb_tls/tls_required.result b/mysql-test/suite/ndb_tls/tls_required.result
index e334e711aa39..b606188abc3c 100644
--- a/mysql-test/suite/ndb_tls/tls_required.result
+++ b/mysql-test/suite/ndb_tls/tls_required.result
@@ -22,6 +22,9 @@ node_id remote_node_id encrypted
2 49 1
2 63 1
2 127 1
+SELECT COUNT(*) FROM ndbinfo.ndb$certificates;
+COUNT(*)
+16
Use test;
CREATE TABLE t (i int primary key not null, j int) engine = ndb;
INSERT INTO t VALUES(1, 1);
diff --git a/mysql-test/suite/ndb_tls/tls_required.test b/mysql-test/suite/ndb_tls/tls_required.test
index 44a4a90b98f5..72980807f1f8 100644
--- a/mysql-test/suite/ndb_tls/tls_required.test
+++ b/mysql-test/suite/ndb_tls/tls_required.test
@@ -32,6 +32,9 @@
SELECT node_id, remote_node_id, encrypted from ndbinfo.transporters
WHERE status = 'CONNECTED' ORDER BY node_id, remote_node_id;
+# Check cardinality of ndb$certificates. Expect 16 rows.
+SELECT COUNT(*) FROM ndbinfo.ndb$certificates;
+
# Manage some data
Use test;
CREATE TABLE t (i int primary key not null, j int) engine = ndb;
diff --git a/mysql-test/suite/opt_trace/r/opt_hints_index_merge.result b/mysql-test/suite/opt_trace/r/opt_hints_index_merge.result
index f303bd080cde..c902f816d147 100644
--- a/mysql-test/suite/opt_trace/r/opt_hints_index_merge.result
+++ b/mysql-test/suite/opt_trace/r/opt_hints_index_merge.result
@@ -208,9 +208,8 @@ EXPLAIN SELECT /*+ INDEX_MERGE(t1 f2, f3) */ f1 FROM t1 WHERE f2 = 5 OR f3 = 'c'
"cause": "cost"
}
] /* indexes_to_merge */,
- "cost_of_reading_ranges": 2.92872,
"chosen": false,
- "cause": "cost"
+ "cause": "not all disjuncts are candidates for index merge"
}
] /* analyzing_index_merge_union */
} /* range_analysis */
diff --git a/mysql-test/suite/opt_trace/r/range_no_prot.result b/mysql-test/suite/opt_trace/r/range_no_prot.result
index e0384f18745c..eb1e0d746da9 100644
--- a/mysql-test/suite/opt_trace/r/range_no_prot.result
+++ b/mysql-test/suite/opt_trace/r/range_no_prot.result
@@ -3339,9 +3339,8 @@ EXPLAIN SELECT * FROM t1 WHERE (key1 > 1 OR key2 > 2) {
"cause": "cost"
}
] /* indexes_to_merge */,
- "cost_of_reading_ranges": 0,
"chosen": false,
- "cause": "cost"
+ "cause": "not all disjuncts are candidates for index merge"
}
] /* analyzing_index_merge_union */
} /* range_analysis */
diff --git a/mysql-test/suite/opt_trace/r/range_ps_prot.result b/mysql-test/suite/opt_trace/r/range_ps_prot.result
index f15ff380479e..5ed0de82b25c 100644
--- a/mysql-test/suite/opt_trace/r/range_ps_prot.result
+++ b/mysql-test/suite/opt_trace/r/range_ps_prot.result
@@ -3339,9 +3339,8 @@ EXPLAIN SELECT * FROM t1 WHERE (key1 > 1 OR key2 > 2) {
"cause": "cost"
}
] /* indexes_to_merge */,
- "cost_of_reading_ranges": 0,
"chosen": false,
- "cause": "cost"
+ "cause": "not all disjuncts are candidates for index merge"
}
] /* analyzing_index_merge_union */
} /* range_analysis */
diff --git a/mysql-test/suite/percona/include/distance.inc b/mysql-test/suite/percona/include/distance.inc
new file mode 100644
index 000000000000..b53a544e2b7f
--- /dev/null
+++ b/mysql-test/suite/percona/include/distance.inc
@@ -0,0 +1,253 @@
+--echo #
+--echo # Test coverage for vector DISTANCE() function.
+--echo #
+
+--echo #
+--echo # 0) Prepare playground.
+--echo #
+CREATE TABLE t1 (id INT PRIMARY KEY, v1 VECTOR(1), v2 VECTOR(2));
+INSERT INTO t1 VALUES (0, TO_VECTOR('[0]'), TO_VECTOR('[0, 0]')),
+ (1, TO_VECTOR('[1]'), TO_VECTOR('[1, 0]')),
+ (2, TO_VECTOR('[1]'), TO_VECTOR('[0, 1]')),
+ (3, TO_VECTOR('[2]'), TO_VECTOR('[1, 1]')),
+ (4, TO_VECTOR('[2]'), TO_VECTOR('[2, 0]')),
+ (98, TO_VECTOR('[1]'), TO_VECTOR('[2]')),
+ (99, NULL, NULL);
+CREATE TABLE t_metric_name (id INT PRIMARY KEY, name VARCHAR(10));
+INSERT INTO t_metric_name VALUES (1, "EUCLIDEAN"), (99, NULL);
+
+--echo #
+--echo # 1) Test how different number and types of arguments are handled.
+--echo #
+--echo # 1.1) Arity.
+--echo #
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT DISTANCE();
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT DISTANCE(TO_VECTOR("[1]"));
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"));
+eval SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), "$metric");
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), TO_VECTOR("[3]"), "EUCLIDEAN");
+
+--echo #
+--echo # 1.2) Argument types.
+--echo #
+--echo # Only vectors or binary strings are allowed for first the two arguments.
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE("[1]", TO_VECTOR("[2]"), "$metric");
+eval SELECT DISTANCE(X'0000803F', TO_VECTOR("[2]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[2]"), "$metric");
+eval SELECT DISTANCE(v1, TO_VECTOR("[2]"), "$metric") FROM t1 WHERE id = 0;
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE(id, TO_VECTOR("[2]"), "$metric") FROM t1 WHERE id = 0;
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE(TO_VECTOR("[1]"), "[2]", "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[2]"), X'0000803F', "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[3]"), v1, "$metric") FROM t1 WHERE id = 1;
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE(TO_VECTOR("[0]"), id, "$metric") FROM t1 WHERE id = 1;
+
+--echo # The third argument must be a string literal with value from the
+--echo # fixed list of metric names.
+--error ER_WRONG_ARGUMENTS
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[-1, 0]"), 1);
+--error ER_WRONG_ARGUMENTS
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 0]"), CONCAT("EUCLI","DEAN"));
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2, 0]"), "euclidean");
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[3, 0]"), "EuClIdEaN");
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[4, 0]"), X'4555434C494445414E');
+--echo # Metric strings with embedded NUL must be rejected regardless of prefix match.
+--error ER_WRONG_ARGUMENTS
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), X'4555434C494445414E00');
+--error ER_WRONG_ARGUMENTS
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), X'4555434C494445414E004A554E4B');
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 0]"), "NOSUCHMETRIC");
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[6, 0]"), name) FROM t_metric_name WHERE id = 1;
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[7, 0]"), NULL);
+
+--echo #
+--echo # 1.3) NULL arguments and nullability in metadata for result.
+--echo #
+eval SELECT DISTANCE(NULL, TO_VECTOR("[1, 0]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[1, 1]"), NULL, "$metric");
+eval SELECT DISTANCE(v2, TO_VECTOR("[1, 0]"), "$metric") FROM t1 WHERE id = 99;
+eval SELECT DISTANCE(TO_VECTOR("[1, 1]"), v2, "$metric") FROM t1 WHERE id = 99;
+--echo # The third argument doesn't allow NULL values in any form.
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), NULL);
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), name) FROM t_metric_name WHERE id = 99;
+--echo # The result metadata should indicate that it is nullable.
+eval CREATE TABLE tt SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "$metric") AS d;
+SHOW CREATE TABLE tt;
+DROP TABLE tt;
+
+--echo #
+--echo # 2) Test vector arguments length mismatch.
+--echo #
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[1, 0]"), "$metric");
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE(v2, TO_VECTOR("[1]"), "$metric") FROM t1 WHERE id = 1;
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE(v1, v2, "$metric") FROM t1 WHERE id = 1;
+--echo #
+--echo # Note that length check happens at runtime. This is well visible
+--echo # when we have value stored in a vector field which is shorter than
+--echo # maximum length specified at the field creation time.
+eval SELECT DISTANCE(v1, v2, "$metric") FROM t1 WHERE id = 98;
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), v2, "$metric") FROM t1 WHERE id = 98;
+--echo # Binary-string BLOB arguments exceeding max_dimensions (16383) are rejected.
+--echo # A BLOB column is used so the argument passes the resolve-time binary-charset
+--echo # type check; the max_dimensions guard fires at runtime in val_real().
+CREATE TABLE t_oversized (v MEDIUMBLOB);
+INSERT INTO t_oversized VALUES (REPEAT(X'00000000', 16384));
+--error ER_WRONG_ARGUMENTS
+eval SELECT DISTANCE(v, v, "$metric") FROM t_oversized;
+DROP TABLE t_oversized;
+
+--echo #
+--echo # 3) Some basic tests for different (from syntax PoV) variants of
+--echo # arguments.
+--echo #
+eval SELECT DISTANCE(X'0000803F0000803F', X'0000000000000040', "$metric");
+eval SELECT DISTANCE(X'0000803F0000803F', TO_VECTOR("[2, 0]"), "$metric");
+eval SELECT DISTANCE(X'0000803F0000803F', v2, "$metric") FROM t1 WHERE id = 4;
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), X'000000000000803F', "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), v2, "$metric") FROM t1 WHERE id = 1;
+eval SELECT DISTANCE(a.v2, b.v2, "$metric") FROM t1 AS a, t1 AS b WHERE a.id = 0 AND b.id = 4;
+eval SELECT DISTANCE(v2, X'0000000000000040', "$metric") FROM t1 WHERE id = 0;
+eval SELECT DISTANCE(v2, TO_VECTOR("[0, 2]"), "$metric") FROM t1 WHERE id = 0;
+--echo # Non-trivial (artificial) combinations
+eval SELECT DISTANCE(TO_VECTOR(CONCAT("[0", ", ", "1]")), CONCAT(X'00000000', X'00000040'), "$metric");
+--echo # The below case demonstrates that arguments to DISTANCE might not be
+--echo # well-aligned in memory.
+eval SELECT DISTANCE(SUBSTR(X'010000000000000040', 2), RIGHT(X'40000000000000803F', 8), "$metric");
+--echo # 9-byte blobs; SUBSTR from pos 2 → 8 bytes at offset 1 (misaligned for float).
+--echo # Length must stay a multiple of 4; SUBSTR(..., 4) on 9 bytes yields 6 → ER_TO_VECTOR_CONVERSION.
+eval SELECT DISTANCE(SUBSTR(X'000100000000000040', 2), SUBSTR(X'00040000000000803F', 2), "$metric");
+
+--echo #
+--echo # 4) Basic test for different vector values.
+--echo #
+--echo # Identical / collinear vectors.
+eval SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 1]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[1, 0]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2.5, 2.5]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[1, 2, 3, 4, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "$metric");
+--echo # Orthogonal vectors.
+eval SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[0, 1, 0]"), TO_VECTOR("[-1, 0, -1]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[1, 0, 3, 0, 5]"), TO_VECTOR("[0, 2, 0, 4, 0]"), "$metric");
+--echo # Anti-parallel vectors.
+eval SELECT DISTANCE(TO_VECTOR("[-1, -1]"), TO_VECTOR("[2, 2]"), "$metric");
+if ($metric != DOT)
+{
+ if ($metric != MANHATTAN)
+ {
+ if ($metric != COSINE)
+ {
+ --error ER_DATA_OUT_OF_RANGE
+ }
+ }
+}
+eval SELECT DISTANCE(TO_VECTOR("[-2e38, 1]"), TO_VECTOR("[2e38, -1]"), "$metric");
+--echo # Distance from origin.
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[3, 4]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 12]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[0, 0, 0, 0]"), TO_VECTOR("[1, 1, 1, 1]"), "$metric");
+--echo # Mixed-sign and larger vectors.
+eval SELECT DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[1, 7, 3, 16, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "$metric");
+--echo # Zero vector (behavior differs per metric).
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2, 2]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[0, 0]"), "$metric");
+eval SELECT DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[0]"), "$metric");
+--echo # Large values near float32 max.
+eval SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2e38, 0]"), "$metric");
+--echo # Same value in a 16-dim vector: exercises the wide-tier SIMD overflow
+--echo # fallback (dims >= 16 dispatches to the wide kernel; squaring 2e38 in
+--echo # float32 overflows to +Inf, but the isfinite check falls back to scalar).
+eval SELECT DISTANCE(TO_VECTOR("[2e38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+ TO_VECTOR("[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+ "$metric");
+--echo # Symmetry: DISTANCE(a, b) = DISTANCE(b, a).
+eval SELECT DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "$metric") =
+ DISTANCE(TO_VECTOR("[4, 5, 6]"), TO_VECTOR("[1, 2, 3]"), "$metric");
+--echo # Special IEEE 754 float32 values: NaN, +Infinity, -Infinity.
+--echo # NaN/Inf input elements raise ER_DATA_OUT_OF_RANGE for all metrics (POW/EXP convention).
+--error ER_DATA_OUT_OF_RANGE
+eval SELECT DISTANCE(X'0000C07F', X'00000000', "$metric");
+--error ER_DATA_OUT_OF_RANGE
+eval SELECT DISTANCE(X'0000807F', X'00000000', "$metric");
+--error ER_DATA_OUT_OF_RANGE
+eval SELECT DISTANCE(X'000080FF', X'00000000', "$metric");
+--echo # Wide-tier SIMD path coverage (dims >= 16 dispatches to the wide kernel).
+--echo # Integer-valued diffs keep float32 partial sums exact, so results are
+--echo # identical across Scalar / SSE4.2 / NEON / AVX2 / AVX-512 / SVE2.
+--echo # 16-dim: fills one AVX-512 register / two AVX2 / four SSE4.2 -- no scalar tail.
+eval SELECT DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+ TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+ "$metric");
+--echo # 20-dim: SSE4.2 5x4 (no tail); AVX2 2x8 + 4-elem scalar tail;
+--echo # AVX-512 1x16 + 4-elem scalar tail.
+eval SELECT DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+ TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+ "$metric");
+
+--echo #
+--echo # prepared statements
+--echo #
+eval PREPARE s1 FROM 'SELECT DISTANCE(v1, TO_VECTOR("[2]"), "$metric") FROM t1 WHERE id = 4';
+EXECUTE s1;
+EXECUTE s1;
+DEALLOCATE PREPARE s1;
+
+--error ER_WRONG_ARGUMENTS
+PREPARE stmt FROM 'SELECT DISTANCE(v1, TO_VECTOR("[2]"), "?") FROM t1 WHERE id = 4';
+
+eval PREPARE stmt FROM 'SELECT DISTANCE(v1, TO_VECTOR(?), "$metric") FROM t1 WHERE id = 4';
+SET @met="[2]";
+EXECUTE stmt USING @met;
+DEALLOCATE PREPARE stmt;
+
+--disable_warnings
+--echo #
+--echo # 5) Distance in query contexts.
+--echo #
+--echo # ORDER BY distance: nearest-neighbour pattern.
+eval SELECT id FROM t1 WHERE id IN (0,1,2,3,4)
+ ORDER BY DISTANCE(v2, TO_VECTOR('[1, 0]'), "$metric"), id;
+--echo # ORDER BY distance DESC: farthest-neighbour pattern.
+eval SELECT id FROM t1 WHERE id IN (0,1,2,3,4)
+ ORDER BY DISTANCE(v2, TO_VECTOR('[1, 0]'), "$metric") DESC, id;
+--echo # WHERE: range query filtering by distance.
+eval SELECT id FROM t1
+ WHERE id IN (0,1,2,3,4) AND DISTANCE(v2, TO_VECTOR('[1, 0]'), "$metric") < 1.5
+ ORDER BY id;
+--echo # Derived table with distance.
+eval SELECT id FROM
+ (SELECT id, DISTANCE(v2, TO_VECTOR('[1, 0]'), "$metric") AS d
+ FROM t1 WHERE id IN (0,1,2,3,4)) AS sq
+ WHERE d IS NOT NULL ORDER BY d, id;
+--enable_warnings
+
+if ($metric == COSINE)
+{
+--echo # Zero-vector cosine in DML: must insert NULL without aborting under strict sql_mode.
+CREATE TABLE tt_cosine_dml (d DOUBLE);
+INSERT INTO tt_cosine_dml SELECT DISTANCE(TO_VECTOR('[0]'), TO_VECTOR('[0]'), 'COSINE');
+SELECT d FROM tt_cosine_dml;
+DROP TABLE tt_cosine_dml;
+}
+
+DROP TABLE t_metric_name;
+DROP TABLE t1;
diff --git a/mysql-test/suite/percona/r/acl_external_roles_lock_failure.result b/mysql-test/suite/percona/r/acl_external_roles_lock_failure.result
new file mode 100644
index 000000000000..1df2db866cee
--- /dev/null
+++ b/mysql-test/suite/percona/r/acl_external_roles_lock_failure.result
@@ -0,0 +1,16 @@
+CREATE USER ps11593@localhost IDENTIFIED BY 'pw';
+#
+# A failed SHARED probe must fail the login, not let it through
+#
+SET GLOBAL debug = '+d,fail_acl_external_roles_read_lock';
+ERROR 3547 (HY000): Can not lock user management caches for processing.
+SET GLOBAL debug = '';
+#
+# The server is still up and ordinary logins work again
+#
+1
+1
+SELECT 1 AS server_alive;
+server_alive
+1
+DROP USER ps11593@localhost;
diff --git a/mysql-test/suite/percona/r/acl_external_roles_lock_mode.result b/mysql-test/suite/percona/r/acl_external_roles_lock_mode.result
new file mode 100644
index 000000000000..92fccd760c26
--- /dev/null
+++ b/mysql-test/suite/percona/r/acl_external_roles_lock_mode.result
@@ -0,0 +1,9 @@
+CREATE USER ps11593@localhost IDENTIFIED BY 'pw';
+SET GLOBAL debug = '+d,acl_external_roles_log_lock_mode';
+#
+# An ordinary login - caching_sha2_password reports no external roles
+#
+SET GLOBAL debug = '';
+include/assert_grep.inc [the probe took a SHARED ACL cache lock]
+include/assert_grep.inc [the probe never took the EXCLUSIVE ACL cache lock]
+DROP USER ps11593@localhost;
diff --git a/mysql-test/suite/percona/r/bug_ps11143_threadpool_auth_shutdown.result b/mysql-test/suite/percona/r/bug_ps11143_threadpool_auth_shutdown.result
new file mode 100644
index 000000000000..4331e438c1c0
--- /dev/null
+++ b/mysql-test/suite/percona/r/bug_ps11143_threadpool_auth_shutdown.result
@@ -0,0 +1,11 @@
+#
+# Verify auth callback drains before plugin deinit with threadpool
+#
+# restart:--thread-handling=pool-of-threads --thread-pool-size=2 --thread-pool-max-threads=4
+CREATE USER tp_user@127.0.0.1 IDENTIFIED WITH caching_sha2_password BY 'tp_pwd';
+SET GLOBAL debug = "+d,auth_plugin_before_callback_sync";
+1
+1
+SET DEBUG_SYNC='now WAIT_FOR auth_plugin_before_callback_entered TIMEOUT 30';
+# restart
+DROP USER IF EXISTS tp_user@127.0.0.1;
diff --git a/mysql-test/suite/percona/r/distance_cosine.result b/mysql-test/suite/percona/r/distance_cosine.result
new file mode 100644
index 000000000000..b4b1cb14c5a3
--- /dev/null
+++ b/mysql-test/suite/percona/r/distance_cosine.result
@@ -0,0 +1,363 @@
+#
+# Test coverage for vector DISTANCE() function.
+#
+#
+# 0) Prepare playground.
+#
+CREATE TABLE t1 (id INT PRIMARY KEY, v1 VECTOR(1), v2 VECTOR(2));
+INSERT INTO t1 VALUES (0, TO_VECTOR('[0]'), TO_VECTOR('[0, 0]')),
+(1, TO_VECTOR('[1]'), TO_VECTOR('[1, 0]')),
+(2, TO_VECTOR('[1]'), TO_VECTOR('[0, 1]')),
+(3, TO_VECTOR('[2]'), TO_VECTOR('[1, 1]')),
+(4, TO_VECTOR('[2]'), TO_VECTOR('[2, 0]')),
+(98, TO_VECTOR('[1]'), TO_VECTOR('[2]')),
+(99, NULL, NULL);
+CREATE TABLE t_metric_name (id INT PRIMARY KEY, name VARCHAR(10));
+INSERT INTO t_metric_name VALUES (1, "EUCLIDEAN"), (99, NULL);
+#
+# 1) Test how different number and types of arguments are handled.
+#
+# 1.1) Arity.
+#
+SELECT DISTANCE();
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"));
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"));
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), "COSINE");
+DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), "COSINE")
+0
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), TO_VECTOR("[3]"), "EUCLIDEAN");
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+#
+# 1.2) Argument types.
+#
+# Only vectors or binary strings are allowed for first the two arguments.
+SELECT DISTANCE("[1]", TO_VECTOR("[2]"), "COSINE");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(X'0000803F', TO_VECTOR("[2]"), "COSINE");
+DISTANCE(X'0000803F', TO_VECTOR("[2]"), "COSINE")
+0
+SELECT DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[2]"), "COSINE");
+DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[2]"), "COSINE")
+NULL
+SELECT DISTANCE(v1, TO_VECTOR("[2]"), "COSINE") FROM t1 WHERE id = 0;
+DISTANCE(v1, TO_VECTOR("[2]"), "COSINE")
+NULL
+SELECT DISTANCE(id, TO_VECTOR("[2]"), "COSINE") FROM t1 WHERE id = 0;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1]"), "[2]", "COSINE");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[2]"), X'0000803F', "COSINE");
+DISTANCE(TO_VECTOR("[2]"), X'0000803F', "COSINE")
+0
+SELECT DISTANCE(TO_VECTOR("[3]"), v1, "COSINE") FROM t1 WHERE id = 1;
+DISTANCE(TO_VECTOR("[3]"), v1, "COSINE")
+0
+SELECT DISTANCE(TO_VECTOR("[0]"), id, "COSINE") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+# The third argument must be a string literal with value from the
+# fixed list of metric names.
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[-1, 0]"), 1);
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 0]"), CONCAT("EUCLI","DEAN"));
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2, 0]"), "euclidean");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2, 0]"), "euclidean")
+1.4142135623730951
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[3, 0]"), "EuClIdEaN");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[3, 0]"), "EuClIdEaN")
+2.23606797749979
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[4, 0]"), X'4555434C494445414E');
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[4, 0]"), X'4555434C494445414E')
+3.1622776601683795
+# Metric strings with embedded NUL must be rejected regardless of prefix match.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), X'4555434C494445414E00');
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), X'4555434C494445414E004A554E4B');
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 0]"), "NOSUCHMETRIC");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[6, 0]"), name) FROM t_metric_name WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[7, 0]"), NULL);
+ERROR HY000: Incorrect arguments to distance
+#
+# 1.3) NULL arguments and nullability in metadata for result.
+#
+SELECT DISTANCE(NULL, TO_VECTOR("[1, 0]"), "COSINE");
+DISTANCE(NULL, TO_VECTOR("[1, 0]"), "COSINE")
+NULL
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), NULL, "COSINE");
+DISTANCE(TO_VECTOR("[1, 1]"), NULL, "COSINE")
+NULL
+SELECT DISTANCE(v2, TO_VECTOR("[1, 0]"), "COSINE") FROM t1 WHERE id = 99;
+DISTANCE(v2, TO_VECTOR("[1, 0]"), "COSINE")
+NULL
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), v2, "COSINE") FROM t1 WHERE id = 99;
+DISTANCE(TO_VECTOR("[1, 1]"), v2, "COSINE")
+NULL
+# The third argument doesn't allow NULL values in any form.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), NULL);
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), name) FROM t_metric_name WHERE id = 99;
+ERROR HY000: Incorrect arguments to distance
+# The result metadata should indicate that it is nullable.
+CREATE TABLE tt SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "COSINE") AS d;
+SHOW CREATE TABLE tt;
+Table Create Table
+tt CREATE TABLE `tt` (
+ `d` double DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
+DROP TABLE tt;
+#
+# 2) Test vector arguments length mismatch.
+#
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[1, 0]"), "COSINE");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(v2, TO_VECTOR("[1]"), "COSINE") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(v1, v2, "COSINE") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+#
+# Note that length check happens at runtime. This is well visible
+# when we have value stored in a vector field which is shorter than
+# maximum length specified at the field creation time.
+SELECT DISTANCE(v1, v2, "COSINE") FROM t1 WHERE id = 98;
+DISTANCE(v1, v2, "COSINE")
+0
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), v2, "COSINE") FROM t1 WHERE id = 98;
+ERROR HY000: Incorrect arguments to distance
+# Binary-string BLOB arguments exceeding max_dimensions (16383) are rejected.
+# A BLOB column is used so the argument passes the resolve-time binary-charset
+# type check; the max_dimensions guard fires at runtime in val_real().
+CREATE TABLE t_oversized (v MEDIUMBLOB);
+INSERT INTO t_oversized VALUES (REPEAT(X'00000000', 16384));
+SELECT DISTANCE(v, v, "COSINE") FROM t_oversized;
+ERROR HY000: Incorrect arguments to distance
+DROP TABLE t_oversized;
+#
+# 3) Some basic tests for different (from syntax PoV) variants of
+# arguments.
+#
+SELECT DISTANCE(X'0000803F0000803F', X'0000000000000040', "COSINE");
+DISTANCE(X'0000803F0000803F', X'0000000000000040', "COSINE")
+0.29289321881345254
+SELECT DISTANCE(X'0000803F0000803F', TO_VECTOR("[2, 0]"), "COSINE");
+DISTANCE(X'0000803F0000803F', TO_VECTOR("[2, 0]"), "COSINE")
+0.29289321881345254
+SELECT DISTANCE(X'0000803F0000803F', v2, "COSINE") FROM t1 WHERE id = 4;
+DISTANCE(X'0000803F0000803F', v2, "COSINE")
+0.29289321881345254
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "COSINE");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "COSINE")
+NULL
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), X'000000000000803F', "COSINE");
+DISTANCE(TO_VECTOR("[0, 0]"), X'000000000000803F', "COSINE")
+NULL
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), v2, "COSINE") FROM t1 WHERE id = 1;
+DISTANCE(TO_VECTOR("[0, 0]"), v2, "COSINE")
+NULL
+SELECT DISTANCE(a.v2, b.v2, "COSINE") FROM t1 AS a, t1 AS b WHERE a.id = 0 AND b.id = 4;
+DISTANCE(a.v2, b.v2, "COSINE")
+NULL
+SELECT DISTANCE(v2, X'0000000000000040', "COSINE") FROM t1 WHERE id = 0;
+DISTANCE(v2, X'0000000000000040', "COSINE")
+NULL
+SELECT DISTANCE(v2, TO_VECTOR("[0, 2]"), "COSINE") FROM t1 WHERE id = 0;
+DISTANCE(v2, TO_VECTOR("[0, 2]"), "COSINE")
+NULL
+# Non-trivial (artificial) combinations
+SELECT DISTANCE(TO_VECTOR(CONCAT("[0", ", ", "1]")), CONCAT(X'00000000', X'00000040'), "COSINE");
+DISTANCE(TO_VECTOR(CONCAT("[0", ", ", "1]")), CONCAT(X'00000000', X'00000040'), "COSINE")
+0
+# The below case demonstrates that arguments to DISTANCE might not be
+# well-aligned in memory.
+SELECT DISTANCE(SUBSTR(X'010000000000000040', 2), RIGHT(X'40000000000000803F', 8), "COSINE");
+DISTANCE(SUBSTR(X'010000000000000040', 2), RIGHT(X'40000000000000803F', 8), "COSINE")
+0
+# 9-byte blobs; SUBSTR from pos 2 → 8 bytes at offset 1 (misaligned for float).
+# Length must stay a multiple of 4; SUBSTR(..., 4) on 9 bytes yields 6 → ER_TO_VECTOR_CONVERSION.
+SELECT DISTANCE(SUBSTR(X'000100000000000040', 2), SUBSTR(X'00040000000000803F', 2), "COSINE");
+DISTANCE(SUBSTR(X'000100000000000040', 2), SUBSTR(X'00040000000000803F', 2), "COSINE")
+0
+#
+# 4) Basic test for different vector values.
+#
+# Identical / collinear vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 1]"), "COSINE");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 1]"), "COSINE")
+0
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[1, 0]"), "COSINE");
+DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[1, 0]"), "COSINE")
+0
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2.5, 2.5]"), "COSINE");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2.5, 2.5]"), "COSINE")
+0
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3, 4, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "COSINE");
+DISTANCE(TO_VECTOR("[1, 2, 3, 4, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "COSINE")
+0
+# Orthogonal vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "COSINE");
+DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "COSINE")
+1
+SELECT DISTANCE(TO_VECTOR("[0, 1, 0]"), TO_VECTOR("[-1, 0, -1]"), "COSINE");
+DISTANCE(TO_VECTOR("[0, 1, 0]"), TO_VECTOR("[-1, 0, -1]"), "COSINE")
+1
+SELECT DISTANCE(TO_VECTOR("[1, 0, 3, 0, 5]"), TO_VECTOR("[0, 2, 0, 4, 0]"), "COSINE");
+DISTANCE(TO_VECTOR("[1, 0, 3, 0, 5]"), TO_VECTOR("[0, 2, 0, 4, 0]"), "COSINE")
+1
+# Anti-parallel vectors.
+SELECT DISTANCE(TO_VECTOR("[-1, -1]"), TO_VECTOR("[2, 2]"), "COSINE");
+DISTANCE(TO_VECTOR("[-1, -1]"), TO_VECTOR("[2, 2]"), "COSINE")
+2
+SELECT DISTANCE(TO_VECTOR("[-2e38, 1]"), TO_VECTOR("[2e38, -1]"), "COSINE");
+DISTANCE(TO_VECTOR("[-2e38, 1]"), TO_VECTOR("[2e38, -1]"), "COSINE")
+2
+# Distance from origin.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "COSINE");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "COSINE")
+NULL
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[3, 4]"), "COSINE");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[3, 4]"), "COSINE")
+NULL
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 12]"), "COSINE");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 12]"), "COSINE")
+NULL
+SELECT DISTANCE(TO_VECTOR("[0, 0, 0, 0]"), TO_VECTOR("[1, 1, 1, 1]"), "COSINE");
+DISTANCE(TO_VECTOR("[0, 0, 0, 0]"), TO_VECTOR("[1, 1, 1, 1]"), "COSINE")
+NULL
+# Mixed-sign and larger vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "COSINE");
+DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "COSINE")
+0.025368153802923787
+SELECT DISTANCE(TO_VECTOR("[1, 7, 3, 16, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "COSINE");
+DISTANCE(TO_VECTOR("[1, 7, 3, 16, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "COSINE")
+0.17366216073634244
+# Zero vector (behavior differs per metric).
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2, 2]"), "COSINE");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2, 2]"), "COSINE")
+NULL
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[0, 0]"), "COSINE");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[0, 0]"), "COSINE")
+NULL
+SELECT DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[0]"), "COSINE");
+DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[0]"), "COSINE")
+NULL
+# Large values near float32 max.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2e38, 0]"), "COSINE");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2e38, 0]"), "COSINE")
+NULL
+# Same value in a 16-dim vector: exercises the wide-tier SIMD overflow
+# fallback (dims >= 16 dispatches to the wide kernel; squaring 2e38 in
+# float32 overflows to +Inf, but the isfinite check falls back to scalar).
+SELECT DISTANCE(TO_VECTOR("[2e38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+TO_VECTOR("[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+"COSINE");
+DISTANCE(TO_VECTOR("[2e38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+TO_VECTOR("[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+"COSINE")
+NULL
+# Symmetry: DISTANCE(a, b) = DISTANCE(b, a).
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "COSINE") =
+DISTANCE(TO_VECTOR("[4, 5, 6]"), TO_VECTOR("[1, 2, 3]"), "COSINE");
+DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "COSINE") =
+DISTANCE(TO_VECTOR("[4, 5, 6]"), TO_VECTOR("[1, 2, 3]"), "COSINE")
+1
+# Special IEEE 754 float32 values: NaN, +Infinity, -Infinity.
+# NaN/Inf input elements raise ER_DATA_OUT_OF_RANGE for all metrics (POW/EXP convention).
+SELECT DISTANCE(X'0000C07F', X'00000000', "COSINE");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x0000c07f,0x00000000,'COSINE')'
+SELECT DISTANCE(X'0000807F', X'00000000', "COSINE");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x0000807f,0x00000000,'COSINE')'
+SELECT DISTANCE(X'000080FF', X'00000000', "COSINE");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x000080ff,0x00000000,'COSINE')'
+# Wide-tier SIMD path coverage (dims >= 16 dispatches to the wide kernel).
+# Integer-valued diffs keep float32 partial sums exact, so results are
+# identical across Scalar / SSE4.2 / NEON / AVX2 / AVX-512 / SVE2.
+# 16-dim: fills one AVX-512 register / two AVX2 / four SSE4.2 -- no scalar tail.
+SELECT DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"COSINE");
+DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"COSINE")
+1
+# 20-dim: SSE4.2 5x4 (no tail); AVX2 2x8 + 4-elem scalar tail;
+# AVX-512 1x16 + 4-elem scalar tail.
+SELECT DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"COSINE");
+DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"COSINE")
+1
+#
+# prepared statements
+#
+PREPARE s1 FROM 'SELECT DISTANCE(v1, TO_VECTOR("[2]"), "COSINE") FROM t1 WHERE id = 4';
+EXECUTE s1;
+DISTANCE(v1, TO_VECTOR("[2]"), "COSINE")
+0
+EXECUTE s1;
+DISTANCE(v1, TO_VECTOR("[2]"), "COSINE")
+0
+DEALLOCATE PREPARE s1;
+PREPARE stmt FROM 'SELECT DISTANCE(v1, TO_VECTOR("[2]"), "?") FROM t1 WHERE id = 4';
+ERROR HY000: Incorrect arguments to distance
+PREPARE stmt FROM 'SELECT DISTANCE(v1, TO_VECTOR(?), "COSINE") FROM t1 WHERE id = 4';
+SET @met="[2]";
+EXECUTE stmt USING @met;
+DISTANCE(v1, TO_VECTOR(?), "COSINE")
+0
+DEALLOCATE PREPARE stmt;
+#
+# 5) Distance in query contexts.
+#
+# ORDER BY distance: nearest-neighbour pattern.
+SELECT id FROM t1 WHERE id IN (0,1,2,3,4)
+ORDER BY DISTANCE(v2, TO_VECTOR('[1, 0]'), "COSINE"), id;
+id
+0
+1
+4
+3
+2
+# ORDER BY distance DESC: farthest-neighbour pattern.
+SELECT id FROM t1 WHERE id IN (0,1,2,3,4)
+ORDER BY DISTANCE(v2, TO_VECTOR('[1, 0]'), "COSINE") DESC, id;
+id
+2
+3
+1
+4
+0
+# WHERE: range query filtering by distance.
+SELECT id FROM t1
+WHERE id IN (0,1,2,3,4) AND DISTANCE(v2, TO_VECTOR('[1, 0]'), "COSINE") < 1.5
+ORDER BY id;
+id
+1
+2
+3
+4
+# Derived table with distance.
+SELECT id FROM
+(SELECT id, DISTANCE(v2, TO_VECTOR('[1, 0]'), "COSINE") AS d
+FROM t1 WHERE id IN (0,1,2,3,4)) AS sq
+WHERE d IS NOT NULL ORDER BY d, id;
+id
+1
+4
+3
+2
+# Zero-vector cosine in DML: must insert NULL without aborting under strict sql_mode.
+CREATE TABLE tt_cosine_dml (d DOUBLE);
+INSERT INTO tt_cosine_dml SELECT DISTANCE(TO_VECTOR('[0]'), TO_VECTOR('[0]'), 'COSINE');
+SELECT d FROM tt_cosine_dml;
+d
+NULL
+DROP TABLE tt_cosine_dml;
+DROP TABLE t_metric_name;
+DROP TABLE t1;
diff --git a/mysql-test/suite/percona/r/distance_dot.result b/mysql-test/suite/percona/r/distance_dot.result
new file mode 100644
index 000000000000..2c6f71adee23
--- /dev/null
+++ b/mysql-test/suite/percona/r/distance_dot.result
@@ -0,0 +1,358 @@
+#
+# Test coverage for vector DISTANCE() function.
+#
+#
+# 0) Prepare playground.
+#
+CREATE TABLE t1 (id INT PRIMARY KEY, v1 VECTOR(1), v2 VECTOR(2));
+INSERT INTO t1 VALUES (0, TO_VECTOR('[0]'), TO_VECTOR('[0, 0]')),
+(1, TO_VECTOR('[1]'), TO_VECTOR('[1, 0]')),
+(2, TO_VECTOR('[1]'), TO_VECTOR('[0, 1]')),
+(3, TO_VECTOR('[2]'), TO_VECTOR('[1, 1]')),
+(4, TO_VECTOR('[2]'), TO_VECTOR('[2, 0]')),
+(98, TO_VECTOR('[1]'), TO_VECTOR('[2]')),
+(99, NULL, NULL);
+CREATE TABLE t_metric_name (id INT PRIMARY KEY, name VARCHAR(10));
+INSERT INTO t_metric_name VALUES (1, "EUCLIDEAN"), (99, NULL);
+#
+# 1) Test how different number and types of arguments are handled.
+#
+# 1.1) Arity.
+#
+SELECT DISTANCE();
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"));
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"));
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), "DOT");
+DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), "DOT")
+-2
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), TO_VECTOR("[3]"), "EUCLIDEAN");
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+#
+# 1.2) Argument types.
+#
+# Only vectors or binary strings are allowed for first the two arguments.
+SELECT DISTANCE("[1]", TO_VECTOR("[2]"), "DOT");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(X'0000803F', TO_VECTOR("[2]"), "DOT");
+DISTANCE(X'0000803F', TO_VECTOR("[2]"), "DOT")
+-2
+SELECT DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[2]"), "DOT");
+DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[2]"), "DOT")
+-0
+SELECT DISTANCE(v1, TO_VECTOR("[2]"), "DOT") FROM t1 WHERE id = 0;
+DISTANCE(v1, TO_VECTOR("[2]"), "DOT")
+-0
+SELECT DISTANCE(id, TO_VECTOR("[2]"), "DOT") FROM t1 WHERE id = 0;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1]"), "[2]", "DOT");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[2]"), X'0000803F', "DOT");
+DISTANCE(TO_VECTOR("[2]"), X'0000803F', "DOT")
+-2
+SELECT DISTANCE(TO_VECTOR("[3]"), v1, "DOT") FROM t1 WHERE id = 1;
+DISTANCE(TO_VECTOR("[3]"), v1, "DOT")
+-3
+SELECT DISTANCE(TO_VECTOR("[0]"), id, "DOT") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+# The third argument must be a string literal with value from the
+# fixed list of metric names.
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[-1, 0]"), 1);
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 0]"), CONCAT("EUCLI","DEAN"));
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2, 0]"), "euclidean");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2, 0]"), "euclidean")
+1.4142135623730951
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[3, 0]"), "EuClIdEaN");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[3, 0]"), "EuClIdEaN")
+2.23606797749979
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[4, 0]"), X'4555434C494445414E');
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[4, 0]"), X'4555434C494445414E')
+3.1622776601683795
+# Metric strings with embedded NUL must be rejected regardless of prefix match.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), X'4555434C494445414E00');
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), X'4555434C494445414E004A554E4B');
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 0]"), "NOSUCHMETRIC");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[6, 0]"), name) FROM t_metric_name WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[7, 0]"), NULL);
+ERROR HY000: Incorrect arguments to distance
+#
+# 1.3) NULL arguments and nullability in metadata for result.
+#
+SELECT DISTANCE(NULL, TO_VECTOR("[1, 0]"), "DOT");
+DISTANCE(NULL, TO_VECTOR("[1, 0]"), "DOT")
+NULL
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), NULL, "DOT");
+DISTANCE(TO_VECTOR("[1, 1]"), NULL, "DOT")
+NULL
+SELECT DISTANCE(v2, TO_VECTOR("[1, 0]"), "DOT") FROM t1 WHERE id = 99;
+DISTANCE(v2, TO_VECTOR("[1, 0]"), "DOT")
+NULL
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), v2, "DOT") FROM t1 WHERE id = 99;
+DISTANCE(TO_VECTOR("[1, 1]"), v2, "DOT")
+NULL
+# The third argument doesn't allow NULL values in any form.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), NULL);
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), name) FROM t_metric_name WHERE id = 99;
+ERROR HY000: Incorrect arguments to distance
+# The result metadata should indicate that it is nullable.
+CREATE TABLE tt SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "DOT") AS d;
+SHOW CREATE TABLE tt;
+Table Create Table
+tt CREATE TABLE `tt` (
+ `d` double DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
+DROP TABLE tt;
+#
+# 2) Test vector arguments length mismatch.
+#
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[1, 0]"), "DOT");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(v2, TO_VECTOR("[1]"), "DOT") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(v1, v2, "DOT") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+#
+# Note that length check happens at runtime. This is well visible
+# when we have value stored in a vector field which is shorter than
+# maximum length specified at the field creation time.
+SELECT DISTANCE(v1, v2, "DOT") FROM t1 WHERE id = 98;
+DISTANCE(v1, v2, "DOT")
+-2
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), v2, "DOT") FROM t1 WHERE id = 98;
+ERROR HY000: Incorrect arguments to distance
+# Binary-string BLOB arguments exceeding max_dimensions (16383) are rejected.
+# A BLOB column is used so the argument passes the resolve-time binary-charset
+# type check; the max_dimensions guard fires at runtime in val_real().
+CREATE TABLE t_oversized (v MEDIUMBLOB);
+INSERT INTO t_oversized VALUES (REPEAT(X'00000000', 16384));
+SELECT DISTANCE(v, v, "DOT") FROM t_oversized;
+ERROR HY000: Incorrect arguments to distance
+DROP TABLE t_oversized;
+#
+# 3) Some basic tests for different (from syntax PoV) variants of
+# arguments.
+#
+SELECT DISTANCE(X'0000803F0000803F', X'0000000000000040', "DOT");
+DISTANCE(X'0000803F0000803F', X'0000000000000040', "DOT")
+-2
+SELECT DISTANCE(X'0000803F0000803F', TO_VECTOR("[2, 0]"), "DOT");
+DISTANCE(X'0000803F0000803F', TO_VECTOR("[2, 0]"), "DOT")
+-2
+SELECT DISTANCE(X'0000803F0000803F', v2, "DOT") FROM t1 WHERE id = 4;
+DISTANCE(X'0000803F0000803F', v2, "DOT")
+-2
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "DOT");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "DOT")
+-0
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), X'000000000000803F', "DOT");
+DISTANCE(TO_VECTOR("[0, 0]"), X'000000000000803F', "DOT")
+-0
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), v2, "DOT") FROM t1 WHERE id = 1;
+DISTANCE(TO_VECTOR("[0, 0]"), v2, "DOT")
+-0
+SELECT DISTANCE(a.v2, b.v2, "DOT") FROM t1 AS a, t1 AS b WHERE a.id = 0 AND b.id = 4;
+DISTANCE(a.v2, b.v2, "DOT")
+-0
+SELECT DISTANCE(v2, X'0000000000000040', "DOT") FROM t1 WHERE id = 0;
+DISTANCE(v2, X'0000000000000040', "DOT")
+-0
+SELECT DISTANCE(v2, TO_VECTOR("[0, 2]"), "DOT") FROM t1 WHERE id = 0;
+DISTANCE(v2, TO_VECTOR("[0, 2]"), "DOT")
+-0
+# Non-trivial (artificial) combinations
+SELECT DISTANCE(TO_VECTOR(CONCAT("[0", ", ", "1]")), CONCAT(X'00000000', X'00000040'), "DOT");
+DISTANCE(TO_VECTOR(CONCAT("[0", ", ", "1]")), CONCAT(X'00000000', X'00000040'), "DOT")
+-2
+# The below case demonstrates that arguments to DISTANCE might not be
+# well-aligned in memory.
+SELECT DISTANCE(SUBSTR(X'010000000000000040', 2), RIGHT(X'40000000000000803F', 8), "DOT");
+DISTANCE(SUBSTR(X'010000000000000040', 2), RIGHT(X'40000000000000803F', 8), "DOT")
+-2
+# 9-byte blobs; SUBSTR from pos 2 → 8 bytes at offset 1 (misaligned for float).
+# Length must stay a multiple of 4; SUBSTR(..., 4) on 9 bytes yields 6 → ER_TO_VECTOR_CONVERSION.
+SELECT DISTANCE(SUBSTR(X'000100000000000040', 2), SUBSTR(X'00040000000000803F', 2), "DOT");
+DISTANCE(SUBSTR(X'000100000000000040', 2), SUBSTR(X'00040000000000803F', 2), "DOT")
+-2
+#
+# 4) Basic test for different vector values.
+#
+# Identical / collinear vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 1]"), "DOT");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 1]"), "DOT")
+-2
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[1, 0]"), "DOT");
+DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[1, 0]"), "DOT")
+-1
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2.5, 2.5]"), "DOT");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2.5, 2.5]"), "DOT")
+-5
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3, 4, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "DOT");
+DISTANCE(TO_VECTOR("[1, 2, 3, 4, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "DOT")
+-55
+# Orthogonal vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "DOT");
+DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "DOT")
+-0
+SELECT DISTANCE(TO_VECTOR("[0, 1, 0]"), TO_VECTOR("[-1, 0, -1]"), "DOT");
+DISTANCE(TO_VECTOR("[0, 1, 0]"), TO_VECTOR("[-1, 0, -1]"), "DOT")
+-0
+SELECT DISTANCE(TO_VECTOR("[1, 0, 3, 0, 5]"), TO_VECTOR("[0, 2, 0, 4, 0]"), "DOT");
+DISTANCE(TO_VECTOR("[1, 0, 3, 0, 5]"), TO_VECTOR("[0, 2, 0, 4, 0]"), "DOT")
+-0
+# Anti-parallel vectors.
+SELECT DISTANCE(TO_VECTOR("[-1, -1]"), TO_VECTOR("[2, 2]"), "DOT");
+DISTANCE(TO_VECTOR("[-1, -1]"), TO_VECTOR("[2, 2]"), "DOT")
+4
+SELECT DISTANCE(TO_VECTOR("[-2e38, 1]"), TO_VECTOR("[2e38, -1]"), "DOT");
+DISTANCE(TO_VECTOR("[-2e38, 1]"), TO_VECTOR("[2e38, -1]"), "DOT")
+3.999999744228558e76
+# Distance from origin.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "DOT");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "DOT")
+-0
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[3, 4]"), "DOT");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[3, 4]"), "DOT")
+-0
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 12]"), "DOT");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 12]"), "DOT")
+-0
+SELECT DISTANCE(TO_VECTOR("[0, 0, 0, 0]"), TO_VECTOR("[1, 1, 1, 1]"), "DOT");
+DISTANCE(TO_VECTOR("[0, 0, 0, 0]"), TO_VECTOR("[1, 1, 1, 1]"), "DOT")
+-0
+# Mixed-sign and larger vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "DOT");
+DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "DOT")
+-32
+SELECT DISTANCE(TO_VECTOR("[1, 7, 3, 16, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "DOT");
+DISTANCE(TO_VECTOR("[1, 7, 3, 16, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "DOT")
+-113
+# Zero vector (behavior differs per metric).
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2, 2]"), "DOT");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2, 2]"), "DOT")
+-0
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[0, 0]"), "DOT");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[0, 0]"), "DOT")
+-0
+SELECT DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[0]"), "DOT");
+DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[0]"), "DOT")
+-0
+# Large values near float32 max.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2e38, 0]"), "DOT");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2e38, 0]"), "DOT")
+-0
+# Same value in a 16-dim vector: exercises the wide-tier SIMD overflow
+# fallback (dims >= 16 dispatches to the wide kernel; squaring 2e38 in
+# float32 overflows to +Inf, but the isfinite check falls back to scalar).
+SELECT DISTANCE(TO_VECTOR("[2e38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+TO_VECTOR("[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+"DOT");
+DISTANCE(TO_VECTOR("[2e38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+TO_VECTOR("[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+"DOT")
+-0
+# Symmetry: DISTANCE(a, b) = DISTANCE(b, a).
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "DOT") =
+DISTANCE(TO_VECTOR("[4, 5, 6]"), TO_VECTOR("[1, 2, 3]"), "DOT");
+DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "DOT") =
+DISTANCE(TO_VECTOR("[4, 5, 6]"), TO_VECTOR("[1, 2, 3]"), "DOT")
+1
+# Special IEEE 754 float32 values: NaN, +Infinity, -Infinity.
+# NaN/Inf input elements raise ER_DATA_OUT_OF_RANGE for all metrics (POW/EXP convention).
+SELECT DISTANCE(X'0000C07F', X'00000000', "DOT");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x0000c07f,0x00000000,'DOT')'
+SELECT DISTANCE(X'0000807F', X'00000000', "DOT");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x0000807f,0x00000000,'DOT')'
+SELECT DISTANCE(X'000080FF', X'00000000', "DOT");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x000080ff,0x00000000,'DOT')'
+# Wide-tier SIMD path coverage (dims >= 16 dispatches to the wide kernel).
+# Integer-valued diffs keep float32 partial sums exact, so results are
+# identical across Scalar / SSE4.2 / NEON / AVX2 / AVX-512 / SVE2.
+# 16-dim: fills one AVX-512 register / two AVX2 / four SSE4.2 -- no scalar tail.
+SELECT DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"DOT");
+DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"DOT")
+-0
+# 20-dim: SSE4.2 5x4 (no tail); AVX2 2x8 + 4-elem scalar tail;
+# AVX-512 1x16 + 4-elem scalar tail.
+SELECT DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"DOT");
+DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"DOT")
+-0
+#
+# prepared statements
+#
+PREPARE s1 FROM 'SELECT DISTANCE(v1, TO_VECTOR("[2]"), "DOT") FROM t1 WHERE id = 4';
+EXECUTE s1;
+DISTANCE(v1, TO_VECTOR("[2]"), "DOT")
+-4
+EXECUTE s1;
+DISTANCE(v1, TO_VECTOR("[2]"), "DOT")
+-4
+DEALLOCATE PREPARE s1;
+PREPARE stmt FROM 'SELECT DISTANCE(v1, TO_VECTOR("[2]"), "?") FROM t1 WHERE id = 4';
+ERROR HY000: Incorrect arguments to distance
+PREPARE stmt FROM 'SELECT DISTANCE(v1, TO_VECTOR(?), "DOT") FROM t1 WHERE id = 4';
+SET @met="[2]";
+EXECUTE stmt USING @met;
+DISTANCE(v1, TO_VECTOR(?), "DOT")
+-4
+DEALLOCATE PREPARE stmt;
+#
+# 5) Distance in query contexts.
+#
+# ORDER BY distance: nearest-neighbour pattern.
+SELECT id FROM t1 WHERE id IN (0,1,2,3,4)
+ORDER BY DISTANCE(v2, TO_VECTOR('[1, 0]'), "DOT"), id;
+id
+4
+1
+3
+0
+2
+# ORDER BY distance DESC: farthest-neighbour pattern.
+SELECT id FROM t1 WHERE id IN (0,1,2,3,4)
+ORDER BY DISTANCE(v2, TO_VECTOR('[1, 0]'), "DOT") DESC, id;
+id
+0
+2
+1
+3
+4
+# WHERE: range query filtering by distance.
+SELECT id FROM t1
+WHERE id IN (0,1,2,3,4) AND DISTANCE(v2, TO_VECTOR('[1, 0]'), "DOT") < 1.5
+ORDER BY id;
+id
+0
+1
+2
+3
+4
+# Derived table with distance.
+SELECT id FROM
+(SELECT id, DISTANCE(v2, TO_VECTOR('[1, 0]'), "DOT") AS d
+FROM t1 WHERE id IN (0,1,2,3,4)) AS sq
+WHERE d IS NOT NULL ORDER BY d, id;
+id
+4
+1
+3
+0
+2
+DROP TABLE t_metric_name;
+DROP TABLE t1;
diff --git a/mysql-test/suite/percona/r/distance_euclidean.result b/mysql-test/suite/percona/r/distance_euclidean.result
new file mode 100644
index 000000000000..9a0c2ae85448
--- /dev/null
+++ b/mysql-test/suite/percona/r/distance_euclidean.result
@@ -0,0 +1,357 @@
+#
+# Test coverage for vector DISTANCE() function.
+#
+#
+# 0) Prepare playground.
+#
+CREATE TABLE t1 (id INT PRIMARY KEY, v1 VECTOR(1), v2 VECTOR(2));
+INSERT INTO t1 VALUES (0, TO_VECTOR('[0]'), TO_VECTOR('[0, 0]')),
+(1, TO_VECTOR('[1]'), TO_VECTOR('[1, 0]')),
+(2, TO_VECTOR('[1]'), TO_VECTOR('[0, 1]')),
+(3, TO_VECTOR('[2]'), TO_VECTOR('[1, 1]')),
+(4, TO_VECTOR('[2]'), TO_VECTOR('[2, 0]')),
+(98, TO_VECTOR('[1]'), TO_VECTOR('[2]')),
+(99, NULL, NULL);
+CREATE TABLE t_metric_name (id INT PRIMARY KEY, name VARCHAR(10));
+INSERT INTO t_metric_name VALUES (1, "EUCLIDEAN"), (99, NULL);
+#
+# 1) Test how different number and types of arguments are handled.
+#
+# 1.1) Arity.
+#
+SELECT DISTANCE();
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"));
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"));
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), "EUCLIDEAN")
+1
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), TO_VECTOR("[3]"), "EUCLIDEAN");
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+#
+# 1.2) Argument types.
+#
+# Only vectors or binary strings are allowed for first the two arguments.
+SELECT DISTANCE("[1]", TO_VECTOR("[2]"), "EUCLIDEAN");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(X'0000803F', TO_VECTOR("[2]"), "EUCLIDEAN");
+DISTANCE(X'0000803F', TO_VECTOR("[2]"), "EUCLIDEAN")
+1
+SELECT DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[2]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[2]"), "EUCLIDEAN")
+2
+SELECT DISTANCE(v1, TO_VECTOR("[2]"), "EUCLIDEAN") FROM t1 WHERE id = 0;
+DISTANCE(v1, TO_VECTOR("[2]"), "EUCLIDEAN")
+2
+SELECT DISTANCE(id, TO_VECTOR("[2]"), "EUCLIDEAN") FROM t1 WHERE id = 0;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1]"), "[2]", "EUCLIDEAN");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[2]"), X'0000803F', "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[2]"), X'0000803F', "EUCLIDEAN")
+1
+SELECT DISTANCE(TO_VECTOR("[3]"), v1, "EUCLIDEAN") FROM t1 WHERE id = 1;
+DISTANCE(TO_VECTOR("[3]"), v1, "EUCLIDEAN")
+2
+SELECT DISTANCE(TO_VECTOR("[0]"), id, "EUCLIDEAN") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+# The third argument must be a string literal with value from the
+# fixed list of metric names.
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[-1, 0]"), 1);
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 0]"), CONCAT("EUCLI","DEAN"));
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2, 0]"), "euclidean");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2, 0]"), "euclidean")
+1.4142135623730951
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[3, 0]"), "EuClIdEaN");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[3, 0]"), "EuClIdEaN")
+2.23606797749979
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[4, 0]"), X'4555434C494445414E');
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[4, 0]"), X'4555434C494445414E')
+3.1622776601683795
+# Metric strings with embedded NUL must be rejected regardless of prefix match.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), X'4555434C494445414E00');
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), X'4555434C494445414E004A554E4B');
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 0]"), "NOSUCHMETRIC");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[6, 0]"), name) FROM t_metric_name WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[7, 0]"), NULL);
+ERROR HY000: Incorrect arguments to distance
+#
+# 1.3) NULL arguments and nullability in metadata for result.
+#
+SELECT DISTANCE(NULL, TO_VECTOR("[1, 0]"), "EUCLIDEAN");
+DISTANCE(NULL, TO_VECTOR("[1, 0]"), "EUCLIDEAN")
+NULL
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), NULL, "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[1, 1]"), NULL, "EUCLIDEAN")
+NULL
+SELECT DISTANCE(v2, TO_VECTOR("[1, 0]"), "EUCLIDEAN") FROM t1 WHERE id = 99;
+DISTANCE(v2, TO_VECTOR("[1, 0]"), "EUCLIDEAN")
+NULL
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), v2, "EUCLIDEAN") FROM t1 WHERE id = 99;
+DISTANCE(TO_VECTOR("[1, 1]"), v2, "EUCLIDEAN")
+NULL
+# The third argument doesn't allow NULL values in any form.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), NULL);
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), name) FROM t_metric_name WHERE id = 99;
+ERROR HY000: Incorrect arguments to distance
+# The result metadata should indicate that it is nullable.
+CREATE TABLE tt SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "EUCLIDEAN") AS d;
+SHOW CREATE TABLE tt;
+Table Create Table
+tt CREATE TABLE `tt` (
+ `d` double DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
+DROP TABLE tt;
+#
+# 2) Test vector arguments length mismatch.
+#
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(v2, TO_VECTOR("[1]"), "EUCLIDEAN") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(v1, v2, "EUCLIDEAN") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+#
+# Note that length check happens at runtime. This is well visible
+# when we have value stored in a vector field which is shorter than
+# maximum length specified at the field creation time.
+SELECT DISTANCE(v1, v2, "EUCLIDEAN") FROM t1 WHERE id = 98;
+DISTANCE(v1, v2, "EUCLIDEAN")
+1
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), v2, "EUCLIDEAN") FROM t1 WHERE id = 98;
+ERROR HY000: Incorrect arguments to distance
+# Binary-string BLOB arguments exceeding max_dimensions (16383) are rejected.
+# A BLOB column is used so the argument passes the resolve-time binary-charset
+# type check; the max_dimensions guard fires at runtime in val_real().
+CREATE TABLE t_oversized (v MEDIUMBLOB);
+INSERT INTO t_oversized VALUES (REPEAT(X'00000000', 16384));
+SELECT DISTANCE(v, v, "EUCLIDEAN") FROM t_oversized;
+ERROR HY000: Incorrect arguments to distance
+DROP TABLE t_oversized;
+#
+# 3) Some basic tests for different (from syntax PoV) variants of
+# arguments.
+#
+SELECT DISTANCE(X'0000803F0000803F', X'0000000000000040', "EUCLIDEAN");
+DISTANCE(X'0000803F0000803F', X'0000000000000040', "EUCLIDEAN")
+1.4142135623730951
+SELECT DISTANCE(X'0000803F0000803F', TO_VECTOR("[2, 0]"), "EUCLIDEAN");
+DISTANCE(X'0000803F0000803F', TO_VECTOR("[2, 0]"), "EUCLIDEAN")
+1.4142135623730951
+SELECT DISTANCE(X'0000803F0000803F', v2, "EUCLIDEAN") FROM t1 WHERE id = 4;
+DISTANCE(X'0000803F0000803F', v2, "EUCLIDEAN")
+1.4142135623730951
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN")
+1
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), X'000000000000803F', "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[0, 0]"), X'000000000000803F', "EUCLIDEAN")
+1
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), v2, "EUCLIDEAN") FROM t1 WHERE id = 1;
+DISTANCE(TO_VECTOR("[0, 0]"), v2, "EUCLIDEAN")
+1
+SELECT DISTANCE(a.v2, b.v2, "EUCLIDEAN") FROM t1 AS a, t1 AS b WHERE a.id = 0 AND b.id = 4;
+DISTANCE(a.v2, b.v2, "EUCLIDEAN")
+2
+SELECT DISTANCE(v2, X'0000000000000040', "EUCLIDEAN") FROM t1 WHERE id = 0;
+DISTANCE(v2, X'0000000000000040', "EUCLIDEAN")
+2
+SELECT DISTANCE(v2, TO_VECTOR("[0, 2]"), "EUCLIDEAN") FROM t1 WHERE id = 0;
+DISTANCE(v2, TO_VECTOR("[0, 2]"), "EUCLIDEAN")
+2
+# Non-trivial (artificial) combinations
+SELECT DISTANCE(TO_VECTOR(CONCAT("[0", ", ", "1]")), CONCAT(X'00000000', X'00000040'), "EUCLIDEAN");
+DISTANCE(TO_VECTOR(CONCAT("[0", ", ", "1]")), CONCAT(X'00000000', X'00000040'), "EUCLIDEAN")
+1
+# The below case demonstrates that arguments to DISTANCE might not be
+# well-aligned in memory.
+SELECT DISTANCE(SUBSTR(X'010000000000000040', 2), RIGHT(X'40000000000000803F', 8), "EUCLIDEAN");
+DISTANCE(SUBSTR(X'010000000000000040', 2), RIGHT(X'40000000000000803F', 8), "EUCLIDEAN")
+1
+# 9-byte blobs; SUBSTR from pos 2 → 8 bytes at offset 1 (misaligned for float).
+# Length must stay a multiple of 4; SUBSTR(..., 4) on 9 bytes yields 6 → ER_TO_VECTOR_CONVERSION.
+SELECT DISTANCE(SUBSTR(X'000100000000000040', 2), SUBSTR(X'00040000000000803F', 2), "EUCLIDEAN");
+DISTANCE(SUBSTR(X'000100000000000040', 2), SUBSTR(X'00040000000000803F', 2), "EUCLIDEAN")
+1
+#
+# 4) Basic test for different vector values.
+#
+# Identical / collinear vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 1]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 1]"), "EUCLIDEAN")
+0
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN")
+0
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2.5, 2.5]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2.5, 2.5]"), "EUCLIDEAN")
+2.1213203435596424
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3, 4, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[1, 2, 3, 4, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "EUCLIDEAN")
+0
+# Orthogonal vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "EUCLIDEAN")
+1.4142135623730951
+SELECT DISTANCE(TO_VECTOR("[0, 1, 0]"), TO_VECTOR("[-1, 0, -1]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[0, 1, 0]"), TO_VECTOR("[-1, 0, -1]"), "EUCLIDEAN")
+1.7320508075688772
+SELECT DISTANCE(TO_VECTOR("[1, 0, 3, 0, 5]"), TO_VECTOR("[0, 2, 0, 4, 0]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[1, 0, 3, 0, 5]"), TO_VECTOR("[0, 2, 0, 4, 0]"), "EUCLIDEAN")
+7.416198487095663
+# Anti-parallel vectors.
+SELECT DISTANCE(TO_VECTOR("[-1, -1]"), TO_VECTOR("[2, 2]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[-1, -1]"), TO_VECTOR("[2, 2]"), "EUCLIDEAN")
+4.242640687119285
+SELECT DISTANCE(TO_VECTOR("[-2e38, 1]"), TO_VECTOR("[2e38, -1]"), "EUCLIDEAN");
+ERROR 22003: DOUBLE value is out of range in 'distance(to_vector('[-2e38, 1]'),to_vector('[2e38, -1]'),'EUCLIDEAN')'
+# Distance from origin.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN")
+1
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[3, 4]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[3, 4]"), "EUCLIDEAN")
+5
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 12]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 12]"), "EUCLIDEAN")
+13
+SELECT DISTANCE(TO_VECTOR("[0, 0, 0, 0]"), TO_VECTOR("[1, 1, 1, 1]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[0, 0, 0, 0]"), TO_VECTOR("[1, 1, 1, 1]"), "EUCLIDEAN")
+2
+# Mixed-sign and larger vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "EUCLIDEAN")
+5.196152422706632
+SELECT DISTANCE(TO_VECTOR("[1, 7, 3, 16, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[1, 7, 3, 16, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "EUCLIDEAN")
+13
+# Zero vector (behavior differs per metric).
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2, 2]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2, 2]"), "EUCLIDEAN")
+2.8284271247461903
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[0, 0]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[0, 0]"), "EUCLIDEAN")
+0
+SELECT DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[0]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[0]"), "EUCLIDEAN")
+0
+# Large values near float32 max.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2e38, 0]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2e38, 0]"), "EUCLIDEAN")
+1.9999999360571385e38
+# Same value in a 16-dim vector: exercises the wide-tier SIMD overflow
+# fallback (dims >= 16 dispatches to the wide kernel; squaring 2e38 in
+# float32 overflows to +Inf, but the isfinite check falls back to scalar).
+SELECT DISTANCE(TO_VECTOR("[2e38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+TO_VECTOR("[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+"EUCLIDEAN");
+DISTANCE(TO_VECTOR("[2e38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+TO_VECTOR("[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+"EUCLIDEAN")
+1.9999999360571385e38
+# Symmetry: DISTANCE(a, b) = DISTANCE(b, a).
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "EUCLIDEAN") =
+DISTANCE(TO_VECTOR("[4, 5, 6]"), TO_VECTOR("[1, 2, 3]"), "EUCLIDEAN");
+DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "EUCLIDEAN") =
+DISTANCE(TO_VECTOR("[4, 5, 6]"), TO_VECTOR("[1, 2, 3]"), "EUCLIDEAN")
+1
+# Special IEEE 754 float32 values: NaN, +Infinity, -Infinity.
+# NaN/Inf input elements raise ER_DATA_OUT_OF_RANGE for all metrics (POW/EXP convention).
+SELECT DISTANCE(X'0000C07F', X'00000000', "EUCLIDEAN");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x0000c07f,0x00000000,'EUCLIDEAN')'
+SELECT DISTANCE(X'0000807F', X'00000000', "EUCLIDEAN");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x0000807f,0x00000000,'EUCLIDEAN')'
+SELECT DISTANCE(X'000080FF', X'00000000', "EUCLIDEAN");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x000080ff,0x00000000,'EUCLIDEAN')'
+# Wide-tier SIMD path coverage (dims >= 16 dispatches to the wide kernel).
+# Integer-valued diffs keep float32 partial sums exact, so results are
+# identical across Scalar / SSE4.2 / NEON / AVX2 / AVX-512 / SVE2.
+# 16-dim: fills one AVX-512 register / two AVX2 / four SSE4.2 -- no scalar tail.
+SELECT DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"EUCLIDEAN");
+DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"EUCLIDEAN")
+4
+# 20-dim: SSE4.2 5x4 (no tail); AVX2 2x8 + 4-elem scalar tail;
+# AVX-512 1x16 + 4-elem scalar tail.
+SELECT DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"EUCLIDEAN");
+DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"EUCLIDEAN")
+4.47213595499958
+#
+# prepared statements
+#
+PREPARE s1 FROM 'SELECT DISTANCE(v1, TO_VECTOR("[2]"), "EUCLIDEAN") FROM t1 WHERE id = 4';
+EXECUTE s1;
+DISTANCE(v1, TO_VECTOR("[2]"), "EUCLIDEAN")
+0
+EXECUTE s1;
+DISTANCE(v1, TO_VECTOR("[2]"), "EUCLIDEAN")
+0
+DEALLOCATE PREPARE s1;
+PREPARE stmt FROM 'SELECT DISTANCE(v1, TO_VECTOR("[2]"), "?") FROM t1 WHERE id = 4';
+ERROR HY000: Incorrect arguments to distance
+PREPARE stmt FROM 'SELECT DISTANCE(v1, TO_VECTOR(?), "EUCLIDEAN") FROM t1 WHERE id = 4';
+SET @met="[2]";
+EXECUTE stmt USING @met;
+DISTANCE(v1, TO_VECTOR(?), "EUCLIDEAN")
+0
+DEALLOCATE PREPARE stmt;
+#
+# 5) Distance in query contexts.
+#
+# ORDER BY distance: nearest-neighbour pattern.
+SELECT id FROM t1 WHERE id IN (0,1,2,3,4)
+ORDER BY DISTANCE(v2, TO_VECTOR('[1, 0]'), "EUCLIDEAN"), id;
+id
+1
+0
+3
+4
+2
+# ORDER BY distance DESC: farthest-neighbour pattern.
+SELECT id FROM t1 WHERE id IN (0,1,2,3,4)
+ORDER BY DISTANCE(v2, TO_VECTOR('[1, 0]'), "EUCLIDEAN") DESC, id;
+id
+2
+0
+3
+4
+1
+# WHERE: range query filtering by distance.
+SELECT id FROM t1
+WHERE id IN (0,1,2,3,4) AND DISTANCE(v2, TO_VECTOR('[1, 0]'), "EUCLIDEAN") < 1.5
+ORDER BY id;
+id
+0
+1
+2
+3
+4
+# Derived table with distance.
+SELECT id FROM
+(SELECT id, DISTANCE(v2, TO_VECTOR('[1, 0]'), "EUCLIDEAN") AS d
+FROM t1 WHERE id IN (0,1,2,3,4)) AS sq
+WHERE d IS NOT NULL ORDER BY d, id;
+id
+1
+0
+3
+4
+2
+DROP TABLE t_metric_name;
+DROP TABLE t1;
diff --git a/mysql-test/suite/percona/r/distance_euclidean_squared.result b/mysql-test/suite/percona/r/distance_euclidean_squared.result
new file mode 100644
index 000000000000..c94eb1775e4f
--- /dev/null
+++ b/mysql-test/suite/percona/r/distance_euclidean_squared.result
@@ -0,0 +1,356 @@
+#
+# Test coverage for vector DISTANCE() function.
+#
+#
+# 0) Prepare playground.
+#
+CREATE TABLE t1 (id INT PRIMARY KEY, v1 VECTOR(1), v2 VECTOR(2));
+INSERT INTO t1 VALUES (0, TO_VECTOR('[0]'), TO_VECTOR('[0, 0]')),
+(1, TO_VECTOR('[1]'), TO_VECTOR('[1, 0]')),
+(2, TO_VECTOR('[1]'), TO_VECTOR('[0, 1]')),
+(3, TO_VECTOR('[2]'), TO_VECTOR('[1, 1]')),
+(4, TO_VECTOR('[2]'), TO_VECTOR('[2, 0]')),
+(98, TO_VECTOR('[1]'), TO_VECTOR('[2]')),
+(99, NULL, NULL);
+CREATE TABLE t_metric_name (id INT PRIMARY KEY, name VARCHAR(10));
+INSERT INTO t_metric_name VALUES (1, "EUCLIDEAN"), (99, NULL);
+#
+# 1) Test how different number and types of arguments are handled.
+#
+# 1.1) Arity.
+#
+SELECT DISTANCE();
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"));
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"));
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), "EUCLIDEAN_SQUARED")
+1
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), TO_VECTOR("[3]"), "EUCLIDEAN");
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+#
+# 1.2) Argument types.
+#
+# Only vectors or binary strings are allowed for first the two arguments.
+SELECT DISTANCE("[1]", TO_VECTOR("[2]"), "EUCLIDEAN_SQUARED");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(X'0000803F', TO_VECTOR("[2]"), "EUCLIDEAN_SQUARED");
+DISTANCE(X'0000803F', TO_VECTOR("[2]"), "EUCLIDEAN_SQUARED")
+1
+SELECT DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[2]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[2]"), "EUCLIDEAN_SQUARED")
+4
+SELECT DISTANCE(v1, TO_VECTOR("[2]"), "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 0;
+DISTANCE(v1, TO_VECTOR("[2]"), "EUCLIDEAN_SQUARED")
+4
+SELECT DISTANCE(id, TO_VECTOR("[2]"), "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 0;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1]"), "[2]", "EUCLIDEAN_SQUARED");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[2]"), X'0000803F', "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[2]"), X'0000803F', "EUCLIDEAN_SQUARED")
+1
+SELECT DISTANCE(TO_VECTOR("[3]"), v1, "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 1;
+DISTANCE(TO_VECTOR("[3]"), v1, "EUCLIDEAN_SQUARED")
+4
+SELECT DISTANCE(TO_VECTOR("[0]"), id, "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+# The third argument must be a string literal with value from the
+# fixed list of metric names.
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[-1, 0]"), 1);
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 0]"), CONCAT("EUCLI","DEAN"));
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2, 0]"), "euclidean");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2, 0]"), "euclidean")
+1.4142135623730951
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[3, 0]"), "EuClIdEaN");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[3, 0]"), "EuClIdEaN")
+2.23606797749979
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[4, 0]"), X'4555434C494445414E');
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[4, 0]"), X'4555434C494445414E')
+3.1622776601683795
+# Metric strings with embedded NUL must be rejected regardless of prefix match.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), X'4555434C494445414E00');
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), X'4555434C494445414E004A554E4B');
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 0]"), "NOSUCHMETRIC");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[6, 0]"), name) FROM t_metric_name WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[7, 0]"), NULL);
+ERROR HY000: Incorrect arguments to distance
+#
+# 1.3) NULL arguments and nullability in metadata for result.
+#
+SELECT DISTANCE(NULL, TO_VECTOR("[1, 0]"), "EUCLIDEAN_SQUARED");
+DISTANCE(NULL, TO_VECTOR("[1, 0]"), "EUCLIDEAN_SQUARED")
+NULL
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), NULL, "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[1, 1]"), NULL, "EUCLIDEAN_SQUARED")
+NULL
+SELECT DISTANCE(v2, TO_VECTOR("[1, 0]"), "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 99;
+DISTANCE(v2, TO_VECTOR("[1, 0]"), "EUCLIDEAN_SQUARED")
+NULL
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), v2, "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 99;
+DISTANCE(TO_VECTOR("[1, 1]"), v2, "EUCLIDEAN_SQUARED")
+NULL
+# The third argument doesn't allow NULL values in any form.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), NULL);
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), name) FROM t_metric_name WHERE id = 99;
+ERROR HY000: Incorrect arguments to distance
+# The result metadata should indicate that it is nullable.
+CREATE TABLE tt SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "EUCLIDEAN_SQUARED") AS d;
+SHOW CREATE TABLE tt;
+Table Create Table
+tt CREATE TABLE `tt` (
+ `d` double DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
+DROP TABLE tt;
+#
+# 2) Test vector arguments length mismatch.
+#
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN_SQUARED");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(v2, TO_VECTOR("[1]"), "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(v1, v2, "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+#
+# Note that length check happens at runtime. This is well visible
+# when we have value stored in a vector field which is shorter than
+# maximum length specified at the field creation time.
+SELECT DISTANCE(v1, v2, "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 98;
+DISTANCE(v1, v2, "EUCLIDEAN_SQUARED")
+1
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), v2, "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 98;
+ERROR HY000: Incorrect arguments to distance
+# Binary-string BLOB arguments exceeding max_dimensions (16383) are rejected.
+# A BLOB column is used so the argument passes the resolve-time binary-charset
+# type check; the max_dimensions guard fires at runtime in val_real().
+CREATE TABLE t_oversized (v MEDIUMBLOB);
+INSERT INTO t_oversized VALUES (REPEAT(X'00000000', 16384));
+SELECT DISTANCE(v, v, "EUCLIDEAN_SQUARED") FROM t_oversized;
+ERROR HY000: Incorrect arguments to distance
+DROP TABLE t_oversized;
+#
+# 3) Some basic tests for different (from syntax PoV) variants of
+# arguments.
+#
+SELECT DISTANCE(X'0000803F0000803F', X'0000000000000040', "EUCLIDEAN_SQUARED");
+DISTANCE(X'0000803F0000803F', X'0000000000000040', "EUCLIDEAN_SQUARED")
+2
+SELECT DISTANCE(X'0000803F0000803F', TO_VECTOR("[2, 0]"), "EUCLIDEAN_SQUARED");
+DISTANCE(X'0000803F0000803F', TO_VECTOR("[2, 0]"), "EUCLIDEAN_SQUARED")
+2
+SELECT DISTANCE(X'0000803F0000803F', v2, "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 4;
+DISTANCE(X'0000803F0000803F', v2, "EUCLIDEAN_SQUARED")
+2
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN_SQUARED")
+1
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), X'000000000000803F', "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[0, 0]"), X'000000000000803F', "EUCLIDEAN_SQUARED")
+1
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), v2, "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 1;
+DISTANCE(TO_VECTOR("[0, 0]"), v2, "EUCLIDEAN_SQUARED")
+1
+SELECT DISTANCE(a.v2, b.v2, "EUCLIDEAN_SQUARED") FROM t1 AS a, t1 AS b WHERE a.id = 0 AND b.id = 4;
+DISTANCE(a.v2, b.v2, "EUCLIDEAN_SQUARED")
+4
+SELECT DISTANCE(v2, X'0000000000000040', "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 0;
+DISTANCE(v2, X'0000000000000040', "EUCLIDEAN_SQUARED")
+4
+SELECT DISTANCE(v2, TO_VECTOR("[0, 2]"), "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 0;
+DISTANCE(v2, TO_VECTOR("[0, 2]"), "EUCLIDEAN_SQUARED")
+4
+# Non-trivial (artificial) combinations
+SELECT DISTANCE(TO_VECTOR(CONCAT("[0", ", ", "1]")), CONCAT(X'00000000', X'00000040'), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR(CONCAT("[0", ", ", "1]")), CONCAT(X'00000000', X'00000040'), "EUCLIDEAN_SQUARED")
+1
+# The below case demonstrates that arguments to DISTANCE might not be
+# well-aligned in memory.
+SELECT DISTANCE(SUBSTR(X'010000000000000040', 2), RIGHT(X'40000000000000803F', 8), "EUCLIDEAN_SQUARED");
+DISTANCE(SUBSTR(X'010000000000000040', 2), RIGHT(X'40000000000000803F', 8), "EUCLIDEAN_SQUARED")
+1
+# 9-byte blobs; SUBSTR from pos 2 → 8 bytes at offset 1 (misaligned for float).
+# Length must stay a multiple of 4; SUBSTR(..., 4) on 9 bytes yields 6 → ER_TO_VECTOR_CONVERSION.
+SELECT DISTANCE(SUBSTR(X'000100000000000040', 2), SUBSTR(X'00040000000000803F', 2), "EUCLIDEAN_SQUARED");
+DISTANCE(SUBSTR(X'000100000000000040', 2), SUBSTR(X'00040000000000803F', 2), "EUCLIDEAN_SQUARED")
+1
+#
+# 4) Basic test for different vector values.
+#
+# Identical / collinear vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 1]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 1]"), "EUCLIDEAN_SQUARED")
+0
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN_SQUARED")
+0
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2.5, 2.5]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2.5, 2.5]"), "EUCLIDEAN_SQUARED")
+4.5
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3, 4, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[1, 2, 3, 4, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "EUCLIDEAN_SQUARED")
+0
+# Orthogonal vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "EUCLIDEAN_SQUARED")
+2
+SELECT DISTANCE(TO_VECTOR("[0, 1, 0]"), TO_VECTOR("[-1, 0, -1]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[0, 1, 0]"), TO_VECTOR("[-1, 0, -1]"), "EUCLIDEAN_SQUARED")
+3
+SELECT DISTANCE(TO_VECTOR("[1, 0, 3, 0, 5]"), TO_VECTOR("[0, 2, 0, 4, 0]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[1, 0, 3, 0, 5]"), TO_VECTOR("[0, 2, 0, 4, 0]"), "EUCLIDEAN_SQUARED")
+55
+# Anti-parallel vectors.
+SELECT DISTANCE(TO_VECTOR("[-1, -1]"), TO_VECTOR("[2, 2]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[-1, -1]"), TO_VECTOR("[2, 2]"), "EUCLIDEAN_SQUARED")
+18
+SELECT DISTANCE(TO_VECTOR("[-2e38, 1]"), TO_VECTOR("[2e38, -1]"), "EUCLIDEAN_SQUARED");
+ERROR 22003: DOUBLE value is out of range in 'distance(to_vector('[-2e38, 1]'),to_vector('[2e38, -1]'),'EUCLIDEAN_SQUARED')'
+# Distance from origin.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "EUCLIDEAN_SQUARED")
+1
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[3, 4]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[3, 4]"), "EUCLIDEAN_SQUARED")
+25
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 12]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 12]"), "EUCLIDEAN_SQUARED")
+169
+SELECT DISTANCE(TO_VECTOR("[0, 0, 0, 0]"), TO_VECTOR("[1, 1, 1, 1]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[0, 0, 0, 0]"), TO_VECTOR("[1, 1, 1, 1]"), "EUCLIDEAN_SQUARED")
+4
+# Mixed-sign and larger vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "EUCLIDEAN_SQUARED")
+27
+SELECT DISTANCE(TO_VECTOR("[1, 7, 3, 16, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[1, 7, 3, 16, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "EUCLIDEAN_SQUARED")
+169
+# Zero vector (behavior differs per metric).
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2, 2]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2, 2]"), "EUCLIDEAN_SQUARED")
+8
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[0, 0]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[0, 0]"), "EUCLIDEAN_SQUARED")
+0
+SELECT DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[0]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[0]"), "EUCLIDEAN_SQUARED")
+0
+# Large values near float32 max.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2e38, 0]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2e38, 0]"), "EUCLIDEAN_SQUARED")
+3.999999744228558e76
+# Same value in a 16-dim vector: exercises the wide-tier SIMD overflow
+# fallback (dims >= 16 dispatches to the wide kernel; squaring 2e38 in
+# float32 overflows to +Inf, but the isfinite check falls back to scalar).
+SELECT DISTANCE(TO_VECTOR("[2e38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+TO_VECTOR("[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+"EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[2e38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+TO_VECTOR("[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+"EUCLIDEAN_SQUARED")
+3.999999744228558e76
+# Symmetry: DISTANCE(a, b) = DISTANCE(b, a).
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "EUCLIDEAN_SQUARED") =
+DISTANCE(TO_VECTOR("[4, 5, 6]"), TO_VECTOR("[1, 2, 3]"), "EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "EUCLIDEAN_SQUARED") =
+DISTANCE(TO_VECTOR("[4, 5, 6]"), TO_VECTOR("[1, 2, 3]"), "EUCLIDEAN_SQUARED")
+1
+# Special IEEE 754 float32 values: NaN, +Infinity, -Infinity.
+# NaN/Inf input elements raise ER_DATA_OUT_OF_RANGE for all metrics (POW/EXP convention).
+SELECT DISTANCE(X'0000C07F', X'00000000', "EUCLIDEAN_SQUARED");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x0000c07f,0x00000000,'EUCLIDEAN_SQUARED')'
+SELECT DISTANCE(X'0000807F', X'00000000', "EUCLIDEAN_SQUARED");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x0000807f,0x00000000,'EUCLIDEAN_SQUARED')'
+SELECT DISTANCE(X'000080FF', X'00000000', "EUCLIDEAN_SQUARED");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x000080ff,0x00000000,'EUCLIDEAN_SQUARED')'
+# Wide-tier SIMD path coverage (dims >= 16 dispatches to the wide kernel).
+# Integer-valued diffs keep float32 partial sums exact, so results are
+# identical across Scalar / SSE4.2 / NEON / AVX2 / AVX-512 / SVE2.
+# 16-dim: fills one AVX-512 register / two AVX2 / four SSE4.2 -- no scalar tail.
+SELECT DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"EUCLIDEAN_SQUARED")
+16
+# 20-dim: SSE4.2 5x4 (no tail); AVX2 2x8 + 4-elem scalar tail;
+# AVX-512 1x16 + 4-elem scalar tail.
+SELECT DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"EUCLIDEAN_SQUARED");
+DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"EUCLIDEAN_SQUARED")
+20
+#
+# prepared statements
+#
+PREPARE s1 FROM 'SELECT DISTANCE(v1, TO_VECTOR("[2]"), "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 4';
+EXECUTE s1;
+DISTANCE(v1, TO_VECTOR("[2]"), "EUCLIDEAN_SQUARED")
+0
+EXECUTE s1;
+DISTANCE(v1, TO_VECTOR("[2]"), "EUCLIDEAN_SQUARED")
+0
+DEALLOCATE PREPARE s1;
+PREPARE stmt FROM 'SELECT DISTANCE(v1, TO_VECTOR("[2]"), "?") FROM t1 WHERE id = 4';
+ERROR HY000: Incorrect arguments to distance
+PREPARE stmt FROM 'SELECT DISTANCE(v1, TO_VECTOR(?), "EUCLIDEAN_SQUARED") FROM t1 WHERE id = 4';
+SET @met="[2]";
+EXECUTE stmt USING @met;
+DISTANCE(v1, TO_VECTOR(?), "EUCLIDEAN_SQUARED")
+0
+DEALLOCATE PREPARE stmt;
+#
+# 5) Distance in query contexts.
+#
+# ORDER BY distance: nearest-neighbour pattern.
+SELECT id FROM t1 WHERE id IN (0,1,2,3,4)
+ORDER BY DISTANCE(v2, TO_VECTOR('[1, 0]'), "EUCLIDEAN_SQUARED"), id;
+id
+1
+0
+3
+4
+2
+# ORDER BY distance DESC: farthest-neighbour pattern.
+SELECT id FROM t1 WHERE id IN (0,1,2,3,4)
+ORDER BY DISTANCE(v2, TO_VECTOR('[1, 0]'), "EUCLIDEAN_SQUARED") DESC, id;
+id
+2
+0
+3
+4
+1
+# WHERE: range query filtering by distance.
+SELECT id FROM t1
+WHERE id IN (0,1,2,3,4) AND DISTANCE(v2, TO_VECTOR('[1, 0]'), "EUCLIDEAN_SQUARED") < 1.5
+ORDER BY id;
+id
+0
+1
+3
+4
+# Derived table with distance.
+SELECT id FROM
+(SELECT id, DISTANCE(v2, TO_VECTOR('[1, 0]'), "EUCLIDEAN_SQUARED") AS d
+FROM t1 WHERE id IN (0,1,2,3,4)) AS sq
+WHERE d IS NOT NULL ORDER BY d, id;
+id
+1
+0
+3
+4
+2
+DROP TABLE t_metric_name;
+DROP TABLE t1;
diff --git a/mysql-test/suite/percona/r/distance_manhattan.result b/mysql-test/suite/percona/r/distance_manhattan.result
new file mode 100644
index 000000000000..e2e14d1bd124
--- /dev/null
+++ b/mysql-test/suite/percona/r/distance_manhattan.result
@@ -0,0 +1,357 @@
+#
+# Test coverage for vector DISTANCE() function.
+#
+#
+# 0) Prepare playground.
+#
+CREATE TABLE t1 (id INT PRIMARY KEY, v1 VECTOR(1), v2 VECTOR(2));
+INSERT INTO t1 VALUES (0, TO_VECTOR('[0]'), TO_VECTOR('[0, 0]')),
+(1, TO_VECTOR('[1]'), TO_VECTOR('[1, 0]')),
+(2, TO_VECTOR('[1]'), TO_VECTOR('[0, 1]')),
+(3, TO_VECTOR('[2]'), TO_VECTOR('[1, 1]')),
+(4, TO_VECTOR('[2]'), TO_VECTOR('[2, 0]')),
+(98, TO_VECTOR('[1]'), TO_VECTOR('[2]')),
+(99, NULL, NULL);
+CREATE TABLE t_metric_name (id INT PRIMARY KEY, name VARCHAR(10));
+INSERT INTO t_metric_name VALUES (1, "EUCLIDEAN"), (99, NULL);
+#
+# 1) Test how different number and types of arguments are handled.
+#
+# 1.1) Arity.
+#
+SELECT DISTANCE();
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"));
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"));
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), "MANHATTAN")
+1
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[2]"), TO_VECTOR("[3]"), "EUCLIDEAN");
+ERROR 42000: Incorrect parameter count in the call to native function 'DISTANCE'
+#
+# 1.2) Argument types.
+#
+# Only vectors or binary strings are allowed for first the two arguments.
+SELECT DISTANCE("[1]", TO_VECTOR("[2]"), "MANHATTAN");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(X'0000803F', TO_VECTOR("[2]"), "MANHATTAN");
+DISTANCE(X'0000803F', TO_VECTOR("[2]"), "MANHATTAN")
+1
+SELECT DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[2]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[2]"), "MANHATTAN")
+2
+SELECT DISTANCE(v1, TO_VECTOR("[2]"), "MANHATTAN") FROM t1 WHERE id = 0;
+DISTANCE(v1, TO_VECTOR("[2]"), "MANHATTAN")
+2
+SELECT DISTANCE(id, TO_VECTOR("[2]"), "MANHATTAN") FROM t1 WHERE id = 0;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1]"), "[2]", "MANHATTAN");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[2]"), X'0000803F', "MANHATTAN");
+DISTANCE(TO_VECTOR("[2]"), X'0000803F', "MANHATTAN")
+1
+SELECT DISTANCE(TO_VECTOR("[3]"), v1, "MANHATTAN") FROM t1 WHERE id = 1;
+DISTANCE(TO_VECTOR("[3]"), v1, "MANHATTAN")
+2
+SELECT DISTANCE(TO_VECTOR("[0]"), id, "MANHATTAN") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+# The third argument must be a string literal with value from the
+# fixed list of metric names.
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[-1, 0]"), 1);
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 0]"), CONCAT("EUCLI","DEAN"));
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2, 0]"), "euclidean");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2, 0]"), "euclidean")
+1.4142135623730951
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[3, 0]"), "EuClIdEaN");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[3, 0]"), "EuClIdEaN")
+2.23606797749979
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[4, 0]"), X'4555434C494445414E');
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[4, 0]"), X'4555434C494445414E')
+3.1622776601683795
+# Metric strings with embedded NUL must be rejected regardless of prefix match.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), X'4555434C494445414E00');
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), X'4555434C494445414E004A554E4B');
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 0]"), "NOSUCHMETRIC");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[6, 0]"), name) FROM t_metric_name WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[7, 0]"), NULL);
+ERROR HY000: Incorrect arguments to distance
+#
+# 1.3) NULL arguments and nullability in metadata for result.
+#
+SELECT DISTANCE(NULL, TO_VECTOR("[1, 0]"), "MANHATTAN");
+DISTANCE(NULL, TO_VECTOR("[1, 0]"), "MANHATTAN")
+NULL
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), NULL, "MANHATTAN");
+DISTANCE(TO_VECTOR("[1, 1]"), NULL, "MANHATTAN")
+NULL
+SELECT DISTANCE(v2, TO_VECTOR("[1, 0]"), "MANHATTAN") FROM t1 WHERE id = 99;
+DISTANCE(v2, TO_VECTOR("[1, 0]"), "MANHATTAN")
+NULL
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), v2, "MANHATTAN") FROM t1 WHERE id = 99;
+DISTANCE(TO_VECTOR("[1, 1]"), v2, "MANHATTAN")
+NULL
+# The third argument doesn't allow NULL values in any form.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), NULL);
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), name) FROM t_metric_name WHERE id = 99;
+ERROR HY000: Incorrect arguments to distance
+# The result metadata should indicate that it is nullable.
+CREATE TABLE tt SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "MANHATTAN") AS d;
+SHOW CREATE TABLE tt;
+Table Create Table
+tt CREATE TABLE `tt` (
+ `d` double DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
+DROP TABLE tt;
+#
+# 2) Test vector arguments length mismatch.
+#
+SELECT DISTANCE(TO_VECTOR("[1]"), TO_VECTOR("[1, 0]"), "MANHATTAN");
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(v2, TO_VECTOR("[1]"), "MANHATTAN") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+SELECT DISTANCE(v1, v2, "MANHATTAN") FROM t1 WHERE id = 1;
+ERROR HY000: Incorrect arguments to distance
+#
+# Note that length check happens at runtime. This is well visible
+# when we have value stored in a vector field which is shorter than
+# maximum length specified at the field creation time.
+SELECT DISTANCE(v1, v2, "MANHATTAN") FROM t1 WHERE id = 98;
+DISTANCE(v1, v2, "MANHATTAN")
+1
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), v2, "MANHATTAN") FROM t1 WHERE id = 98;
+ERROR HY000: Incorrect arguments to distance
+# Binary-string BLOB arguments exceeding max_dimensions (16383) are rejected.
+# A BLOB column is used so the argument passes the resolve-time binary-charset
+# type check; the max_dimensions guard fires at runtime in val_real().
+CREATE TABLE t_oversized (v MEDIUMBLOB);
+INSERT INTO t_oversized VALUES (REPEAT(X'00000000', 16384));
+SELECT DISTANCE(v, v, "MANHATTAN") FROM t_oversized;
+ERROR HY000: Incorrect arguments to distance
+DROP TABLE t_oversized;
+#
+# 3) Some basic tests for different (from syntax PoV) variants of
+# arguments.
+#
+SELECT DISTANCE(X'0000803F0000803F', X'0000000000000040', "MANHATTAN");
+DISTANCE(X'0000803F0000803F', X'0000000000000040', "MANHATTAN")
+2
+SELECT DISTANCE(X'0000803F0000803F', TO_VECTOR("[2, 0]"), "MANHATTAN");
+DISTANCE(X'0000803F0000803F', TO_VECTOR("[2, 0]"), "MANHATTAN")
+2
+SELECT DISTANCE(X'0000803F0000803F', v2, "MANHATTAN") FROM t1 WHERE id = 4;
+DISTANCE(X'0000803F0000803F', v2, "MANHATTAN")
+2
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "MANHATTAN")
+1
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), X'000000000000803F', "MANHATTAN");
+DISTANCE(TO_VECTOR("[0, 0]"), X'000000000000803F', "MANHATTAN")
+1
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), v2, "MANHATTAN") FROM t1 WHERE id = 1;
+DISTANCE(TO_VECTOR("[0, 0]"), v2, "MANHATTAN")
+1
+SELECT DISTANCE(a.v2, b.v2, "MANHATTAN") FROM t1 AS a, t1 AS b WHERE a.id = 0 AND b.id = 4;
+DISTANCE(a.v2, b.v2, "MANHATTAN")
+2
+SELECT DISTANCE(v2, X'0000000000000040', "MANHATTAN") FROM t1 WHERE id = 0;
+DISTANCE(v2, X'0000000000000040', "MANHATTAN")
+2
+SELECT DISTANCE(v2, TO_VECTOR("[0, 2]"), "MANHATTAN") FROM t1 WHERE id = 0;
+DISTANCE(v2, TO_VECTOR("[0, 2]"), "MANHATTAN")
+2
+# Non-trivial (artificial) combinations
+SELECT DISTANCE(TO_VECTOR(CONCAT("[0", ", ", "1]")), CONCAT(X'00000000', X'00000040'), "MANHATTAN");
+DISTANCE(TO_VECTOR(CONCAT("[0", ", ", "1]")), CONCAT(X'00000000', X'00000040'), "MANHATTAN")
+1
+# The below case demonstrates that arguments to DISTANCE might not be
+# well-aligned in memory.
+SELECT DISTANCE(SUBSTR(X'010000000000000040', 2), RIGHT(X'40000000000000803F', 8), "MANHATTAN");
+DISTANCE(SUBSTR(X'010000000000000040', 2), RIGHT(X'40000000000000803F', 8), "MANHATTAN")
+1
+# 9-byte blobs; SUBSTR from pos 2 → 8 bytes at offset 1 (misaligned for float).
+# Length must stay a multiple of 4; SUBSTR(..., 4) on 9 bytes yields 6 → ER_TO_VECTOR_CONVERSION.
+SELECT DISTANCE(SUBSTR(X'000100000000000040', 2), SUBSTR(X'00040000000000803F', 2), "MANHATTAN");
+DISTANCE(SUBSTR(X'000100000000000040', 2), SUBSTR(X'00040000000000803F', 2), "MANHATTAN")
+1
+#
+# 4) Basic test for different vector values.
+#
+# Identical / collinear vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 1]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[1, 1]"), "MANHATTAN")
+0
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[1, 0]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[1, 0]"), "MANHATTAN")
+0
+SELECT DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2.5, 2.5]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[1, 1]"), TO_VECTOR("[2.5, 2.5]"), "MANHATTAN")
+3
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3, 4, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[1, 2, 3, 4, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "MANHATTAN")
+0
+# Orthogonal vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[1, 0]"), TO_VECTOR("[0, 1]"), "MANHATTAN")
+2
+SELECT DISTANCE(TO_VECTOR("[0, 1, 0]"), TO_VECTOR("[-1, 0, -1]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[0, 1, 0]"), TO_VECTOR("[-1, 0, -1]"), "MANHATTAN")
+3
+SELECT DISTANCE(TO_VECTOR("[1, 0, 3, 0, 5]"), TO_VECTOR("[0, 2, 0, 4, 0]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[1, 0, 3, 0, 5]"), TO_VECTOR("[0, 2, 0, 4, 0]"), "MANHATTAN")
+15
+# Anti-parallel vectors.
+SELECT DISTANCE(TO_VECTOR("[-1, -1]"), TO_VECTOR("[2, 2]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[-1, -1]"), TO_VECTOR("[2, 2]"), "MANHATTAN")
+6
+SELECT DISTANCE(TO_VECTOR("[-2e38, 1]"), TO_VECTOR("[2e38, -1]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[-2e38, 1]"), TO_VECTOR("[2e38, -1]"), "MANHATTAN")
+3.999999872114277e38
+# Distance from origin.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[1, 0]"), "MANHATTAN")
+1
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[3, 4]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[3, 4]"), "MANHATTAN")
+7
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 12]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[5, 12]"), "MANHATTAN")
+17
+SELECT DISTANCE(TO_VECTOR("[0, 0, 0, 0]"), TO_VECTOR("[1, 1, 1, 1]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[0, 0, 0, 0]"), TO_VECTOR("[1, 1, 1, 1]"), "MANHATTAN")
+4
+# Mixed-sign and larger vectors.
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "MANHATTAN")
+9
+SELECT DISTANCE(TO_VECTOR("[1, 7, 3, 16, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[1, 7, 3, 16, 5]"), TO_VECTOR("[1, 2, 3, 4, 5]"), "MANHATTAN")
+17
+# Zero vector (behavior differs per metric).
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2, 2]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2, 2]"), "MANHATTAN")
+4
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[0, 0]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[0, 0]"), "MANHATTAN")
+0
+SELECT DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[0]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[0]"), TO_VECTOR("[0]"), "MANHATTAN")
+0
+# Large values near float32 max.
+SELECT DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2e38, 0]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[0, 0]"), TO_VECTOR("[2e38, 0]"), "MANHATTAN")
+1.9999999360571385e38
+# Same value in a 16-dim vector: exercises the wide-tier SIMD overflow
+# fallback (dims >= 16 dispatches to the wide kernel; squaring 2e38 in
+# float32 overflows to +Inf, but the isfinite check falls back to scalar).
+SELECT DISTANCE(TO_VECTOR("[2e38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+TO_VECTOR("[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+"MANHATTAN");
+DISTANCE(TO_VECTOR("[2e38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+TO_VECTOR("[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"),
+"MANHATTAN")
+1.9999999360571385e38
+# Symmetry: DISTANCE(a, b) = DISTANCE(b, a).
+SELECT DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "MANHATTAN") =
+DISTANCE(TO_VECTOR("[4, 5, 6]"), TO_VECTOR("[1, 2, 3]"), "MANHATTAN");
+DISTANCE(TO_VECTOR("[1, 2, 3]"), TO_VECTOR("[4, 5, 6]"), "MANHATTAN") =
+DISTANCE(TO_VECTOR("[4, 5, 6]"), TO_VECTOR("[1, 2, 3]"), "MANHATTAN")
+1
+# Special IEEE 754 float32 values: NaN, +Infinity, -Infinity.
+# NaN/Inf input elements raise ER_DATA_OUT_OF_RANGE for all metrics (POW/EXP convention).
+SELECT DISTANCE(X'0000C07F', X'00000000', "MANHATTAN");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x0000c07f,0x00000000,'MANHATTAN')'
+SELECT DISTANCE(X'0000807F', X'00000000', "MANHATTAN");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x0000807f,0x00000000,'MANHATTAN')'
+SELECT DISTANCE(X'000080FF', X'00000000', "MANHATTAN");
+ERROR 22003: DOUBLE value is out of range in 'distance(0x000080ff,0x00000000,'MANHATTAN')'
+# Wide-tier SIMD path coverage (dims >= 16 dispatches to the wide kernel).
+# Integer-valued diffs keep float32 partial sums exact, so results are
+# identical across Scalar / SSE4.2 / NEON / AVX2 / AVX-512 / SVE2.
+# 16-dim: fills one AVX-512 register / two AVX2 / four SSE4.2 -- no scalar tail.
+SELECT DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"MANHATTAN");
+DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"MANHATTAN")
+16
+# 20-dim: SSE4.2 5x4 (no tail); AVX2 2x8 + 4-elem scalar tail;
+# AVX-512 1x16 + 4-elem scalar tail.
+SELECT DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"MANHATTAN");
+DISTANCE(TO_VECTOR("[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]"),
+TO_VECTOR("[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]"),
+"MANHATTAN")
+20
+#
+# prepared statements
+#
+PREPARE s1 FROM 'SELECT DISTANCE(v1, TO_VECTOR("[2]"), "MANHATTAN") FROM t1 WHERE id = 4';
+EXECUTE s1;
+DISTANCE(v1, TO_VECTOR("[2]"), "MANHATTAN")
+0
+EXECUTE s1;
+DISTANCE(v1, TO_VECTOR("[2]"), "MANHATTAN")
+0
+DEALLOCATE PREPARE s1;
+PREPARE stmt FROM 'SELECT DISTANCE(v1, TO_VECTOR("[2]"), "?") FROM t1 WHERE id = 4';
+ERROR HY000: Incorrect arguments to distance
+PREPARE stmt FROM 'SELECT DISTANCE(v1, TO_VECTOR(?), "MANHATTAN") FROM t1 WHERE id = 4';
+SET @met="[2]";
+EXECUTE stmt USING @met;
+DISTANCE(v1, TO_VECTOR(?), "MANHATTAN")
+0
+DEALLOCATE PREPARE stmt;
+#
+# 5) Distance in query contexts.
+#
+# ORDER BY distance: nearest-neighbour pattern.
+SELECT id FROM t1 WHERE id IN (0,1,2,3,4)
+ORDER BY DISTANCE(v2, TO_VECTOR('[1, 0]'), "MANHATTAN"), id;
+id
+1
+0
+3
+4
+2
+# ORDER BY distance DESC: farthest-neighbour pattern.
+SELECT id FROM t1 WHERE id IN (0,1,2,3,4)
+ORDER BY DISTANCE(v2, TO_VECTOR('[1, 0]'), "MANHATTAN") DESC, id;
+id
+2
+0
+3
+4
+1
+# WHERE: range query filtering by distance.
+SELECT id FROM t1
+WHERE id IN (0,1,2,3,4) AND DISTANCE(v2, TO_VECTOR('[1, 0]'), "MANHATTAN") < 1.5
+ORDER BY id;
+id
+0
+1
+3
+4
+# Derived table with distance.
+SELECT id FROM
+(SELECT id, DISTANCE(v2, TO_VECTOR('[1, 0]'), "MANHATTAN") AS d
+FROM t1 WHERE id IN (0,1,2,3,4)) AS sq
+WHERE d IS NOT NULL ORDER BY d, id;
+id
+1
+0
+3
+4
+2
+DROP TABLE t_metric_name;
+DROP TABLE t1;
diff --git a/mysql-test/suite/percona/r/encrypt_tmp_files_debug.result b/mysql-test/suite/percona/r/encrypt_tmp_files_debug.result
index 90b592c62f58..2ca4b70e5641 100644
--- a/mysql-test/suite/percona/r/encrypt_tmp_files_debug.result
+++ b/mysql-test/suite/percona/r/encrypt_tmp_files_debug.result
@@ -28,6 +28,7 @@ CREATE TABLE t2 AS SELECT sql_big_result * FROM t1 ORDER BY dummy;
SET DEBUG_SYNC = 'now WAIT_FOR after_find_all_keys_reached';
LOAD DATA LOCAL INFILE '' INTO TABLE id_table;
TRUNCATE TABLE id_table;
+include/assert.inc [filesort() temporary file descriptor must be found]
include/assert_grep.inc [filesort() temporary file must not contain unencrypted key]
SET DEBUG_SYNC = 'now SIGNAL after_find_all_keys_signaled';
SET debug = "-d,enforce_legacy_temp_files";
@@ -65,6 +66,7 @@ CREATE TABLE t2 AS SELECT sql_big_result * FROM t1 ORDER BY dummy;
SET DEBUG_SYNC = 'now WAIT_FOR after_find_all_keys_reached';
LOAD DATA LOCAL INFILE '' INTO TABLE id_table;
TRUNCATE TABLE id_table;
+include/assert.inc [filesort() temporary file descriptor must be found]
include/assert_grep.inc [filesort() temporary file must contain unencrypted key]
SET DEBUG_SYNC = 'now SIGNAL after_find_all_keys_signaled';
SET debug = "-d,enforce_legacy_temp_files";
diff --git a/mysql-test/suite/percona/r/ps11209.result b/mysql-test/suite/percona/r/ps11209.result
new file mode 100644
index 000000000000..39ad39b8e4c3
--- /dev/null
+++ b/mysql-test/suite/percona/r/ps11209.result
@@ -0,0 +1,35 @@
+# PS-11209: CTE clone handler mismatch when TempTable falls back to InnoDB
+# Bug#112704: CTE query got internal table doesn't exist error with small tmp_table_size
+SET @@internal_tmp_mem_storage_engine = 'TempTable';
+# Case 1: Non-recursive CTE — handler mismatch fix + status counter check
+FLUSH STATUS;
+SET DEBUG='+d,temptable_create_return_full';
+WITH v AS (VALUES ROW(1), ROW(2)) SELECT * FROM v AS v1 JOIN v AS v2 ORDER BY v1.column_0, v2.column_0;
+column_0 column_0
+1 1
+1 2
+2 1
+2 2
+SHOW STATUS LIKE 'Created_tmp_disk_tables';
+Variable_name Value
+Created_tmp_disk_tables 1
+# Case 2: Recursive CTE — recursive ref clone also uses the shortcut path
+FLUSH STATUS;
+WITH RECURSIVE r AS (
+SELECT 1 AS n
+UNION ALL
+SELECT n + 1 FROM r WHERE n < 5
+)
+SELECT * FROM r ORDER BY n;
+n
+1
+2
+3
+4
+5
+SET DEBUG='-d,temptable_create_return_full';
+SHOW STATUS LIKE 'Created_tmp_disk_tables';
+Variable_name Value
+Created_tmp_disk_tables 1
+FLUSH STATUS;
+SET @@internal_tmp_mem_storage_engine = DEFAULT;
diff --git a/mysql-test/suite/percona/t/acl_external_roles_lock_failure.test b/mysql-test/suite/percona/t/acl_external_roles_lock_failure.test
new file mode 100644
index 000000000000..73f4cce22bb0
--- /dev/null
+++ b/mysql-test/suite/percona/t/acl_external_roles_lock_failure.test
@@ -0,0 +1,30 @@
+# PS-11593: when the ACL cache lock cannot be acquired during authentication,
+# the login must FAIL with ER_CANNOT_LOCK_USER_MANAGEMENT_CACHES.
+
+--source include/have_debug.inc
+--source include/not_valgrind.inc
+
+CREATE USER ps11593@localhost IDENTIFIED BY 'pw';
+
+--let $old_debug = `SELECT @@GLOBAL.debug`
+
+--echo #
+--echo # A failed SHARED probe must fail the login, not let it through
+--echo #
+SET GLOBAL debug = '+d,fail_acl_external_roles_read_lock';
+
+# strip the client's password-on-command-line warning, keep the server error
+--replace_regex /^mysql: \[Warning\].*\n//
+--error 1
+--exec $MYSQL -ups11593 -ppw -e "SELECT 1" 2>&1
+
+--eval SET GLOBAL debug = '$old_debug'
+
+--echo #
+--echo # The server is still up and ordinary logins work again
+--echo #
+--exec $MYSQL -ups11593 -ppw -e "SELECT 1"
+
+SELECT 1 AS server_alive;
+
+DROP USER ps11593@localhost;
diff --git a/mysql-test/suite/percona/t/acl_external_roles_lock_mode.test b/mysql-test/suite/percona/t/acl_external_roles_lock_mode.test
new file mode 100644
index 000000000000..34cc168d8752
--- /dev/null
+++ b/mysql-test/suite/percona/t/acl_external_roles_lock_mode.test
@@ -0,0 +1,40 @@
+# PS-11593: an ordinary login must take the ACL cache lock in SHARED mode.
+#
+# apply_external_roles() has to look in g_external_roles to decide whether any
+# external role must be granted or revoked. For a login whose authentication
+# plugin reports no roles - every password login - the answer is always "none",
+# so that lookup must happen under a SHARED lock. Taking the EXCLUSIVE lock
+# serializes every login and re-introduces the freeze PS-7143 fixed.
+#
+# The debug point reports the mode actually held at that point, read back from
+# the thread's own MDL context, so this test fails if the probe is ever changed
+# to acquire the exclusive lock.
+
+--source include/have_debug.inc
+--source include/not_valgrind.inc
+
+CREATE USER ps11593@localhost IDENTIFIED BY 'pw';
+
+--let $old_debug = `SELECT @@GLOBAL.debug`
+SET GLOBAL debug = '+d,acl_external_roles_log_lock_mode';
+
+--echo #
+--echo # An ordinary login - caching_sha2_password reports no external roles
+--echo #
+--exec $MYSQL -ups11593 -ppw -e "SELECT 1" > /dev/null 2>&1
+
+--eval SET GLOBAL debug = '$old_debug'
+
+--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err
+
+--let $assert_text = the probe took a SHARED ACL cache lock
+--let $assert_select = PS-11593 external roles probe lock mode: SHARED
+--let $assert_count = 1
+--source include/assert_grep.inc
+
+--let $assert_text = the probe never took the EXCLUSIVE ACL cache lock
+--let $assert_select = PS-11593 external roles probe lock mode: EXCLUSIVE
+--let $assert_count = 0
+--source include/assert_grep.inc
+
+DROP USER ps11593@localhost;
diff --git a/mysql-test/suite/percona/t/bug_ps11143_threadpool_auth_shutdown.test b/mysql-test/suite/percona/t/bug_ps11143_threadpool_auth_shutdown.test
new file mode 100644
index 000000000000..1e78fd1f41c4
--- /dev/null
+++ b/mysql-test/suite/percona/t/bug_ps11143_threadpool_auth_shutdown.test
@@ -0,0 +1,45 @@
+--source include/not_windows.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+--echo #
+--echo # Verify auth callback drains before plugin deinit with threadpool
+--echo #
+
+--let $restart_parameters=restart:--thread-handling=pool-of-threads --thread-pool-size=2 --thread-pool-max-threads=4
+--source include/restart_mysqld.inc
+--source include/have_pool_of_threads.inc
+
+CREATE USER tp_user@127.0.0.1 IDENTIFIED WITH caching_sha2_password BY 'tp_pwd';
+
+SET GLOBAL debug = "+d,auth_plugin_before_callback_sync";
+
+--let $mysqld_pid_file=`SELECT @@GLOBAL.pid_file`
+
+--let $output_file= $MYSQLTEST_VARDIR/tmp/bug_ps11143_mysql_output
+--let $pid_file= $MYSQLTEST_VARDIR/tmp/bug_ps11143_mysql_pid
+--let $sql_file= $MYSQLTEST_VARDIR/tmp/bug_ps11143_query.sql
+--write_file $sql_file
+SELECT 1;
+EOF
+--let $command= $MYSQL
+--let $command_opt= --protocol=tcp --host=127.0.0.1 --port=$MASTER_MYPORT --user=tp_user --password=tp_pwd < $sql_file
+--let $redirect_stderr= 1
+--source include/start_proc_in_background.inc
+
+SET DEBUG_SYNC='now WAIT_FOR auth_plugin_before_callback_entered TIMEOUT 30';
+
+--source include/expect_crash.inc
+exec kill -TERM `cat $mysqld_pid_file`;
+
+--source include/wait_until_disconnected.inc
+--source include/wait_proc_to_finish.inc
+
+--let $restart_parameters=
+--source include/start_mysqld.inc
+
+DROP USER IF EXISTS tp_user@127.0.0.1;
+
+--remove_file $pid_file
+--remove_file $output_file
+--remove_file $sql_file
diff --git a/mysql-test/suite/percona/t/distance_cosine.test b/mysql-test/suite/percona/t/distance_cosine.test
new file mode 100644
index 000000000000..3875a94aacfe
--- /dev/null
+++ b/mysql-test/suite/percona/t/distance_cosine.test
@@ -0,0 +1,2 @@
+let $metric = COSINE;
+--source ../include/distance.inc
diff --git a/mysql-test/suite/percona/t/distance_dot.test b/mysql-test/suite/percona/t/distance_dot.test
new file mode 100644
index 000000000000..bf77176908f5
--- /dev/null
+++ b/mysql-test/suite/percona/t/distance_dot.test
@@ -0,0 +1,2 @@
+let $metric = DOT;
+--source ../include/distance.inc
diff --git a/mysql-test/suite/percona/t/distance_euclidean.test b/mysql-test/suite/percona/t/distance_euclidean.test
new file mode 100644
index 000000000000..ecb97385dcb8
--- /dev/null
+++ b/mysql-test/suite/percona/t/distance_euclidean.test
@@ -0,0 +1,2 @@
+let $metric = EUCLIDEAN;
+--source ../include/distance.inc
diff --git a/mysql-test/suite/percona/t/distance_euclidean_squared.test b/mysql-test/suite/percona/t/distance_euclidean_squared.test
new file mode 100644
index 000000000000..a5b0f6552c1e
--- /dev/null
+++ b/mysql-test/suite/percona/t/distance_euclidean_squared.test
@@ -0,0 +1,2 @@
+let $metric = EUCLIDEAN_SQUARED;
+--source ../include/distance.inc
diff --git a/mysql-test/suite/percona/t/distance_manhattan.test b/mysql-test/suite/percona/t/distance_manhattan.test
new file mode 100644
index 000000000000..76edbf2a6b43
--- /dev/null
+++ b/mysql-test/suite/percona/t/distance_manhattan.test
@@ -0,0 +1,2 @@
+let $metric = MANHATTAN;
+--source ../include/distance.inc
diff --git a/mysql-test/suite/percona/t/encrypt_tmp_files_debug.test b/mysql-test/suite/percona/t/encrypt_tmp_files_debug.test
index f174bde56c3a..5aa0e9d68658 100644
--- a/mysql-test/suite/percona/t/encrypt_tmp_files_debug.test
+++ b/mysql-test/suite/percona/t/encrypt_tmp_files_debug.test
@@ -101,7 +101,14 @@ while($encryption_mode < 2)
# * "-o" means omit owner;
# * "-g" means omit group;
# * "--time-style='+'" means omit timestamp.
- --let $awk_filter = {print \$4}
+ # The file descriptor number is the field right before '->'. It must not be
+ # addressed by a fixed column index: 'ls' emits an extra timestamp column
+ # whenever "--time-style='+'" is not honoured, and awk would then pick the
+ # month name, which 'LOAD DATA' silently converts to 0. Grepping
+ # /proc//fd/0 (the server's stdin) yields no match at all, which passes
+ # the $encryption_mode == 0 assertion vacuously and fails the
+ # $encryption_mode == 1 one with a misleading message.
+ --let $awk_filter = {for(i=1;i<=NF;i++) if(\$i == "->") print \$(i-1)}
--let $fd_no_include_file = $MYSQL_TMP_DIR/fd_no_include_file.inc
--exec ls -og --time-style='+' /proc/$pid_no/fd | grep -E $tmp_dir/MY | awk '$awk_filter' > $fd_no_include_file
--replace_result $fd_no_include_file
@@ -110,6 +117,12 @@ while($encryption_mode < 2)
--let $tmp_fd_no = `SELECT id FROM id_table`
TRUNCATE TABLE id_table;
+ # Making sure that a real temporary file descriptor has been found, so that
+ # a broken lookup is not silently reported as an encryption failure.
+ --let $assert_text = filesort() temporary file descriptor must be found
+ --let $assert_cond = "$tmp_fd_no" NOT IN ("", "0", "1", "2")
+ --source include/assert.inc
+
# Asserting that 'filesort()' temp file contains / not contains one of the
# 'value' column hashes from 't1' table. '42' was randomly chosen.
# 'UPPER()' is needed as in the temp file keys are stored in upper case.
diff --git a/mysql-test/suite/percona/t/ps11209.test b/mysql-test/suite/percona/t/ps11209.test
new file mode 100644
index 000000000000..0deea58fe92d
--- /dev/null
+++ b/mysql-test/suite/percona/t/ps11209.test
@@ -0,0 +1,25 @@
+--source include/have_debug.inc
+
+--echo # PS-11209: CTE clone handler mismatch when TempTable falls back to InnoDB
+--echo # Bug#112704: CTE query got internal table doesn't exist error with small tmp_table_size
+
+SET @@internal_tmp_mem_storage_engine = 'TempTable';
+--echo # Case 1: Non-recursive CTE — handler mismatch fix + status counter check
+FLUSH STATUS;
+SET DEBUG='+d,temptable_create_return_full';
+WITH v AS (VALUES ROW(1), ROW(2)) SELECT * FROM v AS v1 JOIN v AS v2 ORDER BY v1.column_0, v2.column_0;
+SHOW STATUS LIKE 'Created_tmp_disk_tables';
+
+--echo # Case 2: Recursive CTE — recursive ref clone also uses the shortcut path
+FLUSH STATUS;
+WITH RECURSIVE r AS (
+ SELECT 1 AS n
+ UNION ALL
+ SELECT n + 1 FROM r WHERE n < 5
+)
+SELECT * FROM r ORDER BY n;
+SET DEBUG='-d,temptable_create_return_full';
+SHOW STATUS LIKE 'Created_tmp_disk_tables';
+FLUSH STATUS;
+
+SET @@internal_tmp_mem_storage_engine = DEFAULT;
diff --git a/mysql-test/suite/percona_innodb/r/parallel_ddl_debug_sync_race.result b/mysql-test/suite/percona_innodb/r/parallel_ddl_debug_sync_race.result
new file mode 100644
index 000000000000..a2b4a351eba2
--- /dev/null
+++ b/mysql-test/suite/percona_innodb/r/parallel_ddl_debug_sync_race.result
@@ -0,0 +1,119 @@
+#
+# Part 1: several builders of one ALTER meet in one sync point.
+#
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1,1,1,1);
+SET SESSION innodb_ddl_threads = 4;
+SET DEBUG_SYNC = 'RESET';
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl_parked WAIT_FOR ddl_resume';
+ALTER TABLE t1 ADD INDEX i1(b), ADD INDEX i2(c), ADD INDEX i3(d), ADD INDEX i4(e), ALGORITHM=INPLACE, LOCK=NONE;
+SET DEBUG_SYNC = 'now WAIT_FOR ddl_parked';
+SET DEBUG_SYNC = 'now SIGNAL ddl_resume';
+ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
+SET DEBUG_SYNC = 'RESET';
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl_parked WAIT_FOR ddl_resume';
+ALTER TABLE t1 ADD INDEX i1(b), ADD INDEX i2(c), ADD INDEX i3(d), ADD INDEX i4(e), ALGORITHM=INPLACE, LOCK=NONE;
+SET DEBUG_SYNC = 'now WAIT_FOR ddl_parked';
+SET DEBUG_SYNC = 'now SIGNAL ddl_resume';
+ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
+SET DEBUG_SYNC = 'RESET';
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl_parked WAIT_FOR ddl_resume';
+ALTER TABLE t1 ADD INDEX i1(b), ADD INDEX i2(c), ADD INDEX i3(d), ADD INDEX i4(e), ALGORITHM=INPLACE, LOCK=NONE;
+SET DEBUG_SYNC = 'now WAIT_FOR ddl_parked';
+SET DEBUG_SYNC = 'now SIGNAL ddl_resume';
+ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
+SET DEBUG_SYNC = 'RESET';
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl_parked WAIT_FOR ddl_resume';
+ALTER TABLE t1 ADD INDEX i1(b), ADD INDEX i2(c), ADD INDEX i3(d), ADD INDEX i4(e), ALGORITHM=INPLACE, LOCK=NONE;
+SET DEBUG_SYNC = 'now WAIT_FOR ddl_parked';
+SET DEBUG_SYNC = 'now SIGNAL ddl_resume';
+ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
+SET DEBUG_SYNC = 'RESET';
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl_parked WAIT_FOR ddl_resume';
+ALTER TABLE t1 ADD INDEX i1(b), ADD INDEX i2(c), ADD INDEX i3(d), ADD INDEX i4(e), ALGORITHM=INPLACE, LOCK=NONE;
+SET DEBUG_SYNC = 'now WAIT_FOR ddl_parked';
+SET DEBUG_SYNC = 'now SIGNAL ddl_resume';
+ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
+SET DEBUG_SYNC = 'RESET';
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl_parked WAIT_FOR ddl_resume';
+ALTER TABLE t1 ADD INDEX i1(b), ADD INDEX i2(c), ADD INDEX i3(d), ADD INDEX i4(e), ALGORITHM=INPLACE, LOCK=NONE;
+SET DEBUG_SYNC = 'now WAIT_FOR ddl_parked';
+SET DEBUG_SYNC = 'now SIGNAL ddl_resume';
+ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
+SET DEBUG_SYNC = 'RESET';
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl_parked WAIT_FOR ddl_resume';
+ALTER TABLE t1 ADD INDEX i1(b), ADD INDEX i2(c), ADD INDEX i3(d), ADD INDEX i4(e), ALGORITHM=INPLACE, LOCK=NONE;
+SET DEBUG_SYNC = 'now WAIT_FOR ddl_parked';
+SET DEBUG_SYNC = 'now SIGNAL ddl_resume';
+ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
+SET DEBUG_SYNC = 'RESET';
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl_parked WAIT_FOR ddl_resume';
+ALTER TABLE t1 ADD INDEX i1(b), ADD INDEX i2(c), ADD INDEX i3(d), ADD INDEX i4(e), ALGORITHM=INPLACE, LOCK=NONE;
+SET DEBUG_SYNC = 'now WAIT_FOR ddl_parked';
+SET DEBUG_SYNC = 'now SIGNAL ddl_resume';
+ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
+SET DEBUG_SYNC = 'RESET';
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl_parked WAIT_FOR ddl_resume';
+ALTER TABLE t1 ADD INDEX i1(b), ADD INDEX i2(c), ADD INDEX i3(d), ADD INDEX i4(e), ALGORITHM=INPLACE, LOCK=NONE;
+SET DEBUG_SYNC = 'now WAIT_FOR ddl_parked';
+SET DEBUG_SYNC = 'now SIGNAL ddl_resume';
+ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
+SET DEBUG_SYNC = 'RESET';
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl_parked WAIT_FOR ddl_resume';
+ALTER TABLE t1 ADD INDEX i1(b), ADD INDEX i2(c), ADD INDEX i3(d), ADD INDEX i4(e), ALGORITHM=INPLACE, LOCK=NONE;
+SET DEBUG_SYNC = 'now WAIT_FOR ddl_parked';
+SET DEBUG_SYNC = 'now SIGNAL ddl_resume';
+ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
+SET DEBUG_SYNC = 'RESET';
+# The table survived the concurrent builders.
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1024
+#
+# Part 2: the serialization must not span connections.
+#
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t2 SELECT a, b FROM t1;
+SET SESSION innodb_ddl_threads = 4;
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl1_parked WAIT_FOR ddl1_resume';
+ALTER TABLE t1 ADD INDEX i1(b), ALGORITHM=INPLACE, LOCK=NONE;
+SET DEBUG_SYNC = 'now WAIT_FOR ddl1_parked';
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl2_parked WAIT_FOR ddl2_resume';
+ALTER TABLE t2 ADD INDEX j1(b), ALGORITHM=INPLACE, LOCK=NONE;
+# ddl1 is parked inside row_log_apply_before. ddl2 has to be able to
+# reach the very same sync point; this times out if the two statements
+# are serialized against each other instead of per THD.
+SET DEBUG_SYNC = 'now WAIT_FOR ddl2_parked';
+SET DEBUG_SYNC = 'now SIGNAL ddl1_resume';
+SET DEBUG_SYNC = 'now SIGNAL ddl2_resume';
+# Both statements completed.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int NOT NULL,
+ `b` int DEFAULT NULL,
+ `c` int DEFAULT NULL,
+ `d` int DEFAULT NULL,
+ `e` int DEFAULT NULL,
+ PRIMARY KEY (`a`),
+ KEY `i1` (`b`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int NOT NULL,
+ `b` int DEFAULT NULL,
+ PRIMARY KEY (`a`),
+ KEY `j1` (`b`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1024
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+1024
+#
+# Cleanup
+#
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/percona_innodb/t/parallel_ddl_debug_sync_race.test b/mysql-test/suite/percona_innodb/t/parallel_ddl_debug_sync_race.test
new file mode 100644
index 000000000000..0f74ea001b73
--- /dev/null
+++ b/mysql-test/suite/percona_innodb/t/parallel_ddl_debug_sync_race.test
@@ -0,0 +1,143 @@
+####################################################################
+# PS-11344: debug_sync race between the parallel DDL threads.
+#
+# The tasks that drive ddl::Builder are taken off a shared queue by
+# whichever DDL thread is free (ddl::Loader::Task_queue::mt_execute()),
+# so an ALTER that builds several indexes runs their
+# setup_sort()/btree_build()/finalize() concurrently - and every one of
+# those threads executes the builder's sync points on the *same* THD,
+# the connection's, since that is what ddl::Context::thd() returns.
+#
+# debug_sync() is not thread safe; it assumes a sync point is only ever
+# hit by the thread owning the THD. It tests action->activation_count
+# and only then calls debug_sync_execute(), which asserts the same
+# condition before decrementing it. A lone thread can therefore never
+# trip that assert, but two threads can: both pass the test, then the
+# first consumes the last activation while the second is still on its
+# way in, and the debug build dies with
+#
+# sql/debug_sync.cc:1769: Assertion `action->activation_count' failed
+#
+# Part 1 makes several builders of one statement meet in the same sync
+# point. Note that this part is a stress rather than a deterministic
+# reproducer: the surviving window is the few instructions between the
+# test and the decrement, so an unfixed server does not crash on every
+# run. What it does do on every run is create the concurrency the crash
+# needs.
+#
+# Part 2 is deterministic, and pins down the *shape* of the fix rather
+# than the crash: the serialization has to be per THD. While one
+# connection is parked inside the sync point, another connection's DDL
+# must still be able to reach it. Serializing all statements against
+# each other deadlocks that, which is exactly how a first attempt at
+# this fix broke innodb.innodb-index-online-purge.
+####################################################################
+
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+--echo #
+--echo # Part 1: several builders of one ALTER meet in one sync point.
+--echo #
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1,1,1,1,1);
+--disable_query_log
+--let $rows = 10
+while ($rows)
+{
+ INSERT INTO t1 SELECT a + (SELECT MAX(a) FROM t1), b, c, d, e FROM t1;
+ --dec $rows
+}
+--enable_query_log
+
+--connect (ddl1, localhost, root,,)
+# More than one DDL thread is what puts several builders in flight at
+# once; be explicit rather than relying on the default.
+SET SESSION innodb_ddl_threads = 4;
+
+--connection default
+
+--let $round = 10
+while ($round)
+{
+ --connection default
+ SET DEBUG_SYNC = 'RESET';
+
+ --connection ddl1
+ SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl_parked WAIT_FOR ddl_resume';
+ --send ALTER TABLE t1 ADD INDEX i1(b), ADD INDEX i2(c), ADD INDEX i3(d), ADD INDEX i4(e), ALGORITHM=INPLACE, LOCK=NONE
+
+ --connection default
+ # One builder parks here; the other three reach the same sync point
+ # while it does, which is the concurrency being tested.
+ SET DEBUG_SYNC = 'now WAIT_FOR ddl_parked';
+ SET DEBUG_SYNC = 'now SIGNAL ddl_resume';
+
+ --connection ddl1
+ --reap
+ ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
+
+ --dec $round
+}
+
+--connection default
+SET DEBUG_SYNC = 'RESET';
+
+--echo # The table survived the concurrent builders.
+SELECT COUNT(*) FROM t1;
+
+--echo #
+--echo # Part 2: the serialization must not span connections.
+--echo #
+
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t2 SELECT a, b FROM t1;
+
+--connect (ddl2, localhost, root,,)
+SET SESSION innodb_ddl_threads = 4;
+
+--connection ddl1
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl1_parked WAIT_FOR ddl1_resume';
+--send ALTER TABLE t1 ADD INDEX i1(b), ALGORITHM=INPLACE, LOCK=NONE
+
+--connection default
+SET DEBUG_SYNC = 'now WAIT_FOR ddl1_parked';
+
+--connection ddl2
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL ddl2_parked WAIT_FOR ddl2_resume';
+--send ALTER TABLE t2 ADD INDEX j1(b), ALGORITHM=INPLACE, LOCK=NONE
+
+--connection default
+--echo # ddl1 is parked inside row_log_apply_before. ddl2 has to be able to
+--echo # reach the very same sync point; this times out if the two statements
+--echo # are serialized against each other instead of per THD.
+SET DEBUG_SYNC = 'now WAIT_FOR ddl2_parked';
+
+SET DEBUG_SYNC = 'now SIGNAL ddl1_resume';
+SET DEBUG_SYNC = 'now SIGNAL ddl2_resume';
+
+--connection ddl1
+--reap
+
+--connection ddl2
+--reap
+
+--connection default
+--echo # Both statements completed.
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t2;
+
+--echo #
+--echo # Cleanup
+--echo #
+
+--disconnect ddl1
+--disconnect ddl2
+
+--connection default
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/perfschema/r/dml_setup_threads.result b/mysql-test/suite/perfschema/r/dml_setup_threads.result
index 5aacf4abdbda..ab5d612be6f7 100644
--- a/mysql-test/suite/perfschema/r/dml_setup_threads.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_threads.result
@@ -1,9 +1,10 @@
select * from performance_schema.setup_threads;
select * from performance_schema.setup_threads
where name not like '%galera%'
- order by name limit 13;
+ order by name limit 14;
NAME ENABLED HISTORY PROPERTIES VOLATILITY DOCUMENTATION
thread/innodb/buf_dump_thread YES YES singleton 0 NULL
+thread/innodb/buf_lru_manager_thread YES YES 0 NULL
thread/innodb/buf_pool_create_thread YES YES singleton 0 NULL
thread/innodb/buf_resize_thread YES YES singleton 0 NULL
thread/innodb/bulk_alloc_thread YES YES singleton 0 NULL
diff --git a/mysql-test/suite/perfschema/r/error_log.result b/mysql-test/suite/perfschema/r/error_log.result
index cb0576aaea41..c893014bdd0e 100644
--- a/mysql-test/suite/perfschema/r/error_log.result
+++ b/mysql-test/suite/perfschema/r/error_log.result
@@ -94,7 +94,7 @@ AND error_code NOT IN("MY-010097", "MY-015641",
"MY-013884", "MY-013908", "MY-013930", "MY-014013",
"MY-000068", "MY-014066", "MY-014067", "MY-014068",
"MY-013932", "MY-010101", "MY-010099", "MY-011070",
-"MY-011872", "MY-011874", "MY-015140")
+"MY-011872", "MY-011874", "MY-015140", "MY-048400")
ORDER BY logged, error_code;
prio error_code subsystem
System MY-015015 Server
diff --git a/mysql-test/suite/perfschema/r/idx_compare_mutex_instances.result b/mysql-test/suite/perfschema/r/idx_compare_mutex_instances.result
index 7828d87255d6..b8e474d61b5a 100644
--- a/mysql-test/suite/perfschema/r/idx_compare_mutex_instances.result
+++ b/mysql-test/suite/perfschema/r/idx_compare_mutex_instances.result
@@ -197,7 +197,6 @@ OK: Result set: Empty Expected: Empty
OK: Extra rows: 0 Missing rows: 0
UNLOCK TABLES;
-UNLOCK TABLES;
===== CLEAN UP =====
## Default connection
diff --git a/mysql-test/suite/perfschema/t/dml_setup_threads.test b/mysql-test/suite/perfschema/t/dml_setup_threads.test
index e2863ad5526f..a105b9025e10 100644
--- a/mysql-test/suite/perfschema/t/dml_setup_threads.test
+++ b/mysql-test/suite/perfschema/t/dml_setup_threads.test
@@ -13,7 +13,7 @@ select * from performance_schema.setup_threads;
select * from performance_schema.setup_threads
where name not like '%galera%'
- order by name limit 13;
+ order by name limit 14;
# PXC specific threads
select * from performance_schema.setup_threads
diff --git a/mysql-test/suite/perfschema/t/error_log.test b/mysql-test/suite/perfschema/t/error_log.test
index 1072a005b9cc..793cc33d25b5 100644
--- a/mysql-test/suite/perfschema/t/error_log.test
+++ b/mysql-test/suite/perfschema/t/error_log.test
@@ -144,6 +144,7 @@ SELECT prio,error_code,subsystem,data
# Percona-added:
# MY-010097: ER_SEC_FILE_PRIV_EMPTY, emitted for --secure-log-path
# MY-015641: ER_SERVER_WARN_CONTAINER_IGNORED, depends on whether server runs in a container
+# MY-048400: ER_VECTOR_DISTANCE_SIMD_DISPATCH, emits to inform about the SIMD/scalar used to calculate vector_distance
SELECT prio,error_code,subsystem
FROM performance_schema.error_log
WHERE logged>=@startup
@@ -159,7 +160,7 @@ SELECT prio,error_code,subsystem
"MY-013884", "MY-013908", "MY-013930", "MY-014013",
"MY-000068", "MY-014066", "MY-014067", "MY-014068",
"MY-013932", "MY-010101", "MY-010099", "MY-011070",
- "MY-011872", "MY-011874", "MY-015140")
+ "MY-011872", "MY-011874", "MY-015140", "MY-048400")
ORDER BY logged, error_code;
--echo
diff --git a/mysql-test/suite/perfschema/t/idx_compare_mutex_instances.test b/mysql-test/suite/perfschema/t/idx_compare_mutex_instances.test
index 45cf05b45f91..e890f8ce53b0 100644
--- a/mysql-test/suite/perfschema/t/idx_compare_mutex_instances.test
+++ b/mysql-test/suite/perfschema/t/idx_compare_mutex_instances.test
@@ -27,12 +27,28 @@ LOCK TABLE t1 READ;
--connection con2
# User1 has a READ LOCK
-# User2 waiting for WRITE LOCK
---send LOCK TABLE t1 write;
+# User2 waiting for an EXCLUSIVE MDL lock.
+#
+# The blocking statement must request MDL_EXCLUSIVE, not the
+# MDL_SHARED_NO_READ_WRITE of "LOCK TABLE t1 write". The waiting thread
+# is reported as the owner of its MDL_wait::LOCK_wait_status mutex, and
+# that flag is sticky: a mutex held across a condition wait is never
+# unlocked as far as the Performance Schema is concerned, while
+# "UPDATE performance_schema.threads SET instrumented = 'NO'" below makes
+# it one-way, since an unlock always clears the owner but a re-lock never
+# restores it for an uninstrumented thread. Only MDL_EXCLUSIVE requests
+# enable notification of conflicting locks (MDL_object_lock, see
+# object_lock_needs_notification() in sql/mdl.cc), which makes the waiting
+# thread leave and re-enter the wait once a second, so the owner is
+# cleared within a second of instrumentation being disabled. With
+# MDL_SHARED_NO_READ_WRITE the wait is entered once and never left, and
+# whether the owner is still reported by the LOCKED_BY_THREAD_ID test
+# below depends on unrelated background MDL activity on t1.
+--send TRUNCATE TABLE t1;
--connection default
-# Wait for the LOCK TABLE t1 write to block
+# Wait for the TRUNCATE TABLE t1 to block
let $wait_condition=
select count(*) = 1 from performance_schema.events_waits_current
where event_name = 'wait/lock/metadata/sql/mdl'
@@ -42,6 +58,15 @@ let $wait_condition=
--connection default
+# The waiting thread releases and re-acquires LOCK_wait_status once a
+# second, so make sure the mutex is seen locked before it is sampled.
+let $wait_condition=
+ select count(*) >= 1 from performance_schema.mutex_instances
+ where name = 'wait/synch/mutex/sql/MDL_wait::LOCK_wait_status'
+ and locked_by_thread_id is not null
+ and locked_by_thread_id != @innodb_stats_thread_id;
+--source include/wait_condition.inc
+
eval SELECT object_instance_begin, locked_by_thread_id
INTO @object_instance_begin, @target_id
FROM performance_schema.mutex_instances
@@ -73,14 +98,13 @@ let $key_group = 14;
--connection con1
# User1 releases a READ LOCK
-# User2 granted a WRITE LOCK
+# User2 granted the EXCLUSIVE lock
UNLOCK TABLES;
--connection con2
-# Complete LOCK TABLE t1 write
+# Complete TRUNCATE TABLE t1
--reap
-UNLOCK TABLES;
--connection default
diff --git a/mysql-test/suite/rocksdb/r/attachable_trx.result b/mysql-test/suite/rocksdb/r/attachable_trx.result
index cd1f016dbe46..59fa4ad87e5d 100644
--- a/mysql-test/suite/rocksdb/r/attachable_trx.result
+++ b/mysql-test/suite/rocksdb/r/attachable_trx.result
@@ -1,5 +1,5 @@
set @@default_storage_engine=rocksdb;
-SET @debug_saved = @@global.debug;
+SET @debug_saved = @@debug;
START TRANSACTION;
@@ -39,13 +39,13 @@ a b
3 ccc
# SELECT in the inner transaction sees the changes.
-SET @@global.debug = '+d,use_attachable_trx';
+SET @@debug = '+d,use_attachable_trx';
SELECT * FROM t1;
a b
1 aaa
2 zzz
3 ccc
-SET @@global.debug = '-d,use_attachable_trx';
+SET @@debug = '-d,use_attachable_trx';
# COMMIT the outer transaction.
COMMIT;
@@ -60,4 +60,4 @@ COMMIT;
# Cleanup.
DROP TABLE t1;
-SET @@global.debug = @debug_saved;
+SET @@debug = @debug_saved;
diff --git a/mysql-test/suite/rocksdb_rpl/r/rpl_rocksdb_row_crash_safe.result b/mysql-test/suite/rocksdb_rpl/r/rpl_rocksdb_row_crash_safe.result
index 722164b43948..140e85dc055a 100644
--- a/mysql-test/suite/rocksdb_rpl/r/rpl_rocksdb_row_crash_safe.result
+++ b/mysql-test/suite/rocksdb_rpl/r/rpl_rocksdb_row_crash_safe.result
@@ -211,7 +211,7 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -219,7 +219,7 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
@@ -241,8 +241,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
@@ -251,8 +251,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
@@ -276,10 +276,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -288,10 +288,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
@@ -313,14 +313,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
@@ -329,14 +329,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
@@ -369,11 +369,11 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T T-trig C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -381,11 +381,11 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T T-trig C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -420,13 +420,13 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T T-func C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -434,13 +434,13 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T T-func C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -473,15 +473,15 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T T-proc C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -489,15 +489,15 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T T-proc C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -531,10 +531,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig T C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -543,10 +543,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -582,12 +582,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T-func T C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -596,12 +596,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T-func T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -635,14 +635,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc T C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -651,14 +651,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -679,7 +679,7 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -687,7 +687,7 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
@@ -709,8 +709,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
@@ -719,8 +719,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
@@ -744,10 +744,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -756,10 +756,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
@@ -781,14 +781,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
@@ -797,14 +797,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
@@ -837,11 +837,11 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T T-trig C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -849,11 +849,11 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T T-trig C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -888,13 +888,13 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T T-func C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -902,13 +902,13 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T T-func C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -941,15 +941,15 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T T-proc C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -957,15 +957,15 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T T-proc C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -999,10 +999,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig T C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1011,10 +1011,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1050,12 +1050,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T-func T C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1064,12 +1064,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T-func T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1103,14 +1103,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc T C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1119,14 +1119,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1147,7 +1147,7 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1155,7 +1155,7 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1177,8 +1177,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1187,8 +1187,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1212,10 +1212,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1224,10 +1224,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1249,14 +1249,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1265,14 +1265,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1305,11 +1305,11 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T T-trig C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1317,11 +1317,11 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T T-trig C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1356,13 +1356,13 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T T-func C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1370,13 +1370,13 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T T-func C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1409,15 +1409,15 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T T-proc C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1425,15 +1425,15 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T T-proc C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1467,10 +1467,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig T C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1479,10 +1479,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1518,12 +1518,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T-func T C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1532,12 +1532,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T-func T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1571,14 +1571,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc T C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1587,14 +1587,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1615,7 +1615,7 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1623,7 +1623,7 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1645,8 +1645,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1655,8 +1655,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1680,10 +1680,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1692,10 +1692,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1717,14 +1717,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1733,14 +1733,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1773,11 +1773,11 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T T-trig C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1785,11 +1785,11 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T T-trig C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1824,13 +1824,13 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T T-func C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1838,13 +1838,13 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T T-func C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1877,15 +1877,15 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T T-proc C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1893,15 +1893,15 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T T-proc C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1935,10 +1935,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig T C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1947,10 +1947,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1986,12 +1986,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T-func T C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -2000,12 +2000,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T-func T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -2039,14 +2039,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc T C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -2055,14 +2055,14 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -2086,7 +2086,7 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -2094,7 +2094,7 @@ include/rpl/deprecated/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
@@ -2116,8 +2116,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_5)
master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b-
@@ -2126,8 +2126,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_5)
master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e-
@@ -2151,10 +2151,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_5)
master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -2163,10 +2163,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_5)
master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: USE_SQL_FOREIGN_KEY_F
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F USE_SQL_FOREIGN_KEY_F
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
diff --git a/mysql-test/suite/rpl/r/rpl_alter_user_empty_auth.result b/mysql-test/suite/rpl/r/rpl_alter_user_empty_auth.result
new file mode 100644
index 000000000000..a0f0bbd78ae8
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_alter_user_empty_auth.result
@@ -0,0 +1,52 @@
+include/rpl/init_source_replica.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
+[connection master]
+#
+# Bug#38478657: ALTER USER with empty authentication data should not
+# expire passwords on replicas.
+#
+CREATE USER 'rpl_empty_auth_by'@'%'
+ IDENTIFIED WITH 'caching_sha2_password' BY '';
+CREATE USER 'rpl_empty_auth_with'@'%'
+ IDENTIFIED WITH 'caching_sha2_password' BY '';
+CREATE USER 'rpl_empty_auth_as'@'%'
+ IDENTIFIED WITH 'caching_sha2_password' BY '';
+include/rpl/sync_to_replica.inc
+ALTER USER 'rpl_empty_auth_by'@'%'
+ IDENTIFIED WITH caching_sha2_password BY '';
+ALTER USER 'rpl_empty_auth_with'@'%'
+ IDENTIFIED WITH caching_sha2_password;
+ALTER USER 'rpl_empty_auth_as'@'%'
+ IDENTIFIED WITH caching_sha2_password AS '';
+include/rpl/sync_to_replica.inc
+SET @sql_log_bin_saved = @@sql_log_bin;
+SET sql_log_bin = 0;
+CREATE TABLE test.rpl_empty_auth_master
+SELECT user, host, plugin, authentication_string, password_expired
+FROM mysql.user
+WHERE user LIKE 'rpl_empty_auth_%'
+ORDER BY user;
+SET sql_log_bin = @sql_log_bin_saved;
+SET @sql_log_bin_saved = @@sql_log_bin;
+SET sql_log_bin = 0;
+CREATE TABLE test.rpl_empty_auth_slave
+SELECT user, host, plugin, authentication_string, password_expired
+FROM mysql.user
+WHERE user LIKE 'rpl_empty_auth_%'
+ORDER BY user;
+SET sql_log_bin = @sql_log_bin_saved;
+include/diff_tables.inc [master:test.rpl_empty_auth_master, slave:test.rpl_empty_auth_slave]
+DROP USER 'rpl_empty_auth_by'@'%', 'rpl_empty_auth_with'@'%',
+'rpl_empty_auth_as'@'%';
+SET @sql_log_bin_saved = @@sql_log_bin;
+SET sql_log_bin = 0;
+DROP TABLE test.rpl_empty_auth_master;
+SET sql_log_bin = @sql_log_bin_saved;
+include/rpl/sync_to_replica.inc
+SET @sql_log_bin_saved = @@sql_log_bin;
+SET sql_log_bin = 0;
+DROP TABLE test.rpl_empty_auth_slave;
+SET sql_log_bin = @sql_log_bin_saved;
+include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl/r/rpl_applier_blocked_by_backup.result b/mysql-test/suite/rpl/r/rpl_applier_blocked_by_backup.result
index 44f8ef3a8d1f..b2724861f1ad 100644
--- a/mysql-test/suite/rpl/r/rpl_applier_blocked_by_backup.result
+++ b/mysql-test/suite/rpl/r/rpl_applier_blocked_by_backup.result
@@ -3,6 +3,9 @@ Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
[connection master]
+[connection master]
+CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=InnoDB;
+include/rpl/sync_to_replica.inc
#
# Lock replica for backup
#
@@ -14,6 +17,7 @@ LOCK INSTANCE FOR BACKUP;
#
[connection master]
FLUSH BINARY LOGS;
+INSERT INTO t1 VALUES (1);
#
# Check that relay logs have not been purged on replica
#
@@ -34,6 +38,7 @@ UNLOCK INSTANCE;
#
[connection master]
FLUSH BINARY LOGS;
+INSERT INTO t1 VALUES (2);
#
# Check relay logs have been purged on replica
#
@@ -46,4 +51,6 @@ call mtr.add_suppression("Could not purge binary logs since another session is e
# Cleanup
#
[connection master]
+DROP TABLE t1;
+include/rpl/sync_to_replica.inc
include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl/r/rpl_applier_metrics_basic.result b/mysql-test/suite/rpl/r/rpl_applier_metrics_basic.result
index 4492a81a1826..a4918b3dcfa0 100644
--- a/mysql-test/suite/rpl/r/rpl_applier_metrics_basic.result
+++ b/mysql-test/suite/rpl/r/rpl_applier_metrics_basic.result
@@ -46,7 +46,7 @@ include/assert_eventually.inc [Eventually, coordinator increases WAITS_FOR_WORK_
include/assert_eventually.inc [Eventually, coordinator increaess WAITS_FOR_WORK_FROM_SOURCE_SUM_TIME]
include/assert.inc [WAITS_FOR_AVAILABLE_WORKER_COUNT should remain 0 (because there are more workers than transactions)]
include/assert.inc [WAITS_FOR_AVAILABLE_WORKER_SUM_TIME should remain 0 (because there are more workers than transactions)]
-include/assert.inc [There were no "real" waits on dependencies, so WAITS_COMMIT_SCHEDULE_DEPENDENCY_COUNT is 1]
+include/assert.inc [WAITS_COMMIT_SCHEDULE_DEPENDENCY_COUNT is incremented]
# Nothing to assert for WAITS_COMMIT_SCHEDULE_DEPENDENCY_SUM_TIME: there was a wait, so it is likely nonzero, but there is no guarantee
include/assert.inc [There are no waits for memory on worker queues]
include/assert.inc [There are no waits on full queues]
diff --git a/mysql-test/suite/rpl/r/rpl_change_master_to_priv_checks_user_errors.result b/mysql-test/suite/rpl/r/rpl_change_master_to_priv_checks_user_errors.result
index bd1772177b34..81f6795be399 100644
--- a/mysql-test/suite/rpl/r/rpl_change_master_to_priv_checks_user_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_change_master_to_priv_checks_user_errors.result
@@ -20,7 +20,7 @@ GRANT SESSION_VARIABLES_ADMIN, REPLICATION_APPLIER ON *.* TO 'u1'@'localhost';
# TC2. `Query_log_event` should fail if `PRIVILEGE_CHECKS_USER` user
# doesn't have CREATE privilege on the active database.
# -------------------------------------------------------------------
-CALL mtr.add_suppression(".CREATE command denied to user.");
+CALL mtr.add_suppression("Access denied for user.*to database.*");
RESET REPLICA ALL;
CHANGE REPLICATION SOURCE TO REQUIRE_ROW_FORMAT = 1 FOR CHANNEL '';
CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_PORT=MY_SOURCE_PORT, SOURCE_HOST='127.0.0.1', PRIVILEGE_CHECKS_USER='u1'@'localhost', SOURCE_LOG_POS=MY_SOURCE_LOG_POS;
@@ -29,9 +29,11 @@ Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
Note 1760 Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
START REPLICA;
[connection master]
+CREATE DATABASE db1;
+USE db1;
CREATE TABLE t1 (c1 INT);
[connection slave]
-include/rpl/wait_for_applier_error.inc [errno=1142]
+include/rpl/wait_for_applier_error.inc [errno=1044]
include/rpl/stop_replica.inc
GRANT CREATE ON *.* TO 'u1'@'localhost';
include/rpl/start_replica.inc
@@ -83,6 +85,7 @@ CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER='u1'@'localhost', SOURCE_LOG_
START REPLICA;
[connection master]
DROP TABLE t1;
+DROP DATABASE db1;
include/rpl/sync_to_replica.inc
include/rpl/stop_replica.inc
CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER=NULL, REQUIRE_ROW_FORMAT=0 FOR CHANNEL '';
diff --git a/mysql-test/suite/rpl/r/rpl_explicit_defaults_timestamp_generated_not_null.result b/mysql-test/suite/rpl/r/rpl_explicit_defaults_timestamp_generated_not_null.result
new file mode 100644
index 000000000000..2f4884133a0b
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_explicit_defaults_timestamp_generated_not_null.result
@@ -0,0 +1,42 @@
+include/rpl/init_source_replica.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
+[connection master]
+
+[connection master]
+SET @@SESSION.explicit_defaults_for_timestamp = OFF;
+Warnings:
+Warning 1287 'explicit_defaults_for_timestamp' is deprecated and will be removed in a future release.
+CREATE TABLE `t` (
+`id_col` int NOT NULL AUTO_INCREMENT,
+`datetime_col` datetime(6) DEFAULT NULL,
+`timestamp_col2` timestamp(6) GENERATED ALWAYS AS (`datetime_col`) STORED NOT NULL, PRIMARY KEY (`id_col`)
+);
+insert ignore into t(datetime_col) values(NULL);
+Warnings:
+Warning 1048 Column 'timestamp_col2' cannot be null
+
+SELECT * FROM t;
+id_col 1
+datetime_col NULL
+timestamp_col2 0000-00-00 00:00:00.000000
+include/rpl/sync_to_replica.inc
+
+SELECT * FROM t;
+id_col 1
+datetime_col NULL
+timestamp_col2 0000-00-00 00:00:00.000000
+include/rpl/stop_replica.inc
+DROP TABLE t;
+RESET BINARY LOGS AND GTIDS;
+
+SELECT * FROM t;
+id_col 1
+datetime_col NULL
+timestamp_col2 0000-00-00 00:00:00.000000
+include/rpl/start_replica.inc
+[connection master]
+DROP TABLE t;
+include/rpl/sync_to_replica.inc
+include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl/r/rpl_inconsistent_logical_timestamp_replica_parallel_workers.result b/mysql-test/suite/rpl/r/rpl_inconsistent_logical_timestamp_replica_parallel_workers.result
index eebbadf13035..839ea4b61756 100644
--- a/mysql-test/suite/rpl/r/rpl_inconsistent_logical_timestamp_replica_parallel_workers.result
+++ b/mysql-test/suite/rpl/r/rpl_inconsistent_logical_timestamp_replica_parallel_workers.result
@@ -75,6 +75,5 @@ include/assert_grep.inc [Warning Found - Transaction's sequence number is incons
# 11. Cleanup
#
[connection master]
-include/rpl/set_gtid_mode.inc [0 on servers 1,2]
DROP TABLE t1, t2;
include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl/r/rpl_insert_id.result b/mysql-test/suite/rpl/r/rpl_insert_id.result
index ad6b3a685009..03c7259a1066 100644
--- a/mysql-test/suite/rpl/r/rpl_insert_id.result
+++ b/mysql-test/suite/rpl/r/rpl_insert_id.result
@@ -13,8 +13,6 @@ Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
[connection master]
-SET @old_concurrent_insert= @@global.concurrent_insert;
-SET @@global.concurrent_insert= 0;
create table t1(a int auto_increment, key(a)) engine=myisam;
create table t2(b int auto_increment, c int, key(b)) engine=myisam;
insert into t1 values (1),(2),(3);
@@ -561,7 +559,6 @@ id last_id
1 3
drop table t1, t2;
drop procedure foo;
-SET @@global.concurrent_insert= @old_concurrent_insert;
set @@session.sql_auto_is_null=default;
include/rpl/deinit.inc
SET @@GLOBAL.concurrent_insert = SAVED_CONCURRENT_INSERT;
diff --git a/mysql-test/suite/rpl/r/rpl_priv_checks_user_db_specific_access.result b/mysql-test/suite/rpl/r/rpl_priv_checks_user_db_specific_access.result
new file mode 100644
index 000000000000..f482c92e58e9
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_priv_checks_user_db_specific_access.result
@@ -0,0 +1,86 @@
+#
+# 1. Set up the initial source-replica configuration.
+include/rpl/init_source_replica.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
+[connection master]
+#
+# 2. Set `PRIVILEGE_CHECKS_USER` to a user without `CREATE` and `DROP`
+# privileges and start replica.
+[connection slave]
+CALL mtr.add_suppression("Access denied for user.*to database.*");
+CALL mtr.add_suppression(".*The replica coordinator and worker threads are stopped.*");
+CREATE USER 'u1'@'localhost';
+GRANT SESSION_VARIABLES_ADMIN, REPLICATION_APPLIER ON *.* TO 'u1'@'localhost';
+RESET REPLICA ALL;
+CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_PORT=MY_MASTER_PORT, SOURCE_HOST='127.0.0.1', PRIVILEGE_CHECKS_USER='u1'@'localhost', REQUIRE_ROW_FORMAT = 1, SOURCE_LOG_POS=MY_MASTER_LOG_POS;
+Warnings:
+Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note 1760 Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
+START REPLICA;
+#
+# 3. Execute CREATE and DROP operations (e.g., database and table) on
+# db1 on the source.
+[connection master]
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE t1 (c1 INT);
+DROP TABLE t1;
+DROP DATABASE db1;
+#
+# 4. Wait for the replica to encounter an "access denied" error.
+[connection slave]
+include/rpl/wait_for_applier_error.inc [errno=1044]
+include/rpl/stop_replica.inc
+#
+# 5. Grant database-specific `CREATE` and `DROP` privileges to the
+# specified user, resume replication, and verify that it succeeds.
+GRANT CREATE, DROP ON db1.* TO 'u1'@'localhost';
+include/rpl/start_replica.inc
+[connection master]
+include/rpl/sync_to_replica.inc
+#
+# 6. Execute CREATE and DROP operations (e.g., database and table) on
+# db2 on the source.
+[connection master]
+CREATE DATABASE db2;
+USE db2;
+CREATE TABLE t1 (c1 INT);
+DROP TABLE t1;
+DROP DATABASE db2;
+#
+# 7. Wait for the replica to encounter an "access denied" error.
+[connection slave]
+include/rpl/wait_for_applier_error.inc [errno=1044]
+include/rpl/stop_replica.inc
+#
+# 8. Create a role with CREATE and DROP privileges on db2, grant it to
+# the specified user, set it as the default role, start replication
+# and verify the changes replicate successfully to the replica.
+CREATE ROLE role1;
+GRANT role1 TO 'u1'@'localhost';
+SET DEFAULT ROLE role1 TO 'u1'@'localhost';
+GRANT CREATE, DROP ON db2.* TO role1;
+include/rpl/start_replica.inc
+[connection master]
+include/rpl/sync_to_replica.inc
+#
+# 9. On the source, perform a CREATE operation on a different database.
+[connection master]
+CREATE DATABASE db3;
+#
+# 10. Wait for the replica to encounter an "access denied" error.
+[connection slave]
+include/rpl/wait_for_applier_error.inc [errno=1044]
+#
+# 11. Clean up
+[connection master]
+DROP DATABASE db3;
+[connection slave]
+DROP ROLE role1;
+DROP USER 'u1'@'localhost';
+include/rpl/stop_replica.inc
+CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER=NULL, REQUIRE_ROW_FORMAT=0 FOR CHANNEL '';
+START REPLICA;
+include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl/r/rpl_seconds_behind_master.result b/mysql-test/suite/rpl/r/rpl_seconds_behind_master.result
index 5267652e1cb1..4ac5da40e2e0 100644
--- a/mysql-test/suite/rpl/r/rpl_seconds_behind_master.result
+++ b/mysql-test/suite/rpl/r/rpl_seconds_behind_master.result
@@ -24,6 +24,17 @@ include/rpl/reset.inc
# Adding debug point 'dec_event_time_by_1_hour' to @@GLOBAL.debug
CREATE TABLE t1 (a INT);
include/rpl/sync_to_replica.inc
+# Adding debug point 'mta_checkpoint' to @@GLOBAL.debug
+SET DEBUG_SYNC="RESET";
+SET DEBUG_SYNC="now WAIT_FOR mta_checkpoint_start";
+SET DEBUG_SYNC="now WAIT_FOR mta_checkpoint_end";
+# Removing debug point 'mta_checkpoint' from @@GLOBAL.debug
+# Adding debug point 'mta_checkpoint' to @@GLOBAL.debug
+SET DEBUG_SYNC="RESET";
+SET DEBUG_SYNC="now WAIT_FOR mta_checkpoint_start";
+SET DEBUG_SYNC="now WAIT_FOR mta_checkpoint_end";
+# Removing debug point 'mta_checkpoint' from @@GLOBAL.debug
+include/assert.inc [Seconds_Behind_Source must be 0]
include/rpl/wait_for_replica_status.inc [Seconds_Behind_Source]
LOCK TABLE t1 WRITE;
INSERT INTO t1 VALUES (3);
diff --git a/mysql-test/suite/rpl/r/rpl_source_retry_count_zero_reconnect_limit.result b/mysql-test/suite/rpl/r/rpl_source_retry_count_zero_reconnect_limit.result
new file mode 100644
index 000000000000..654eb8edb642
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_source_retry_count_zero_reconnect_limit.result
@@ -0,0 +1,17 @@
+include/rpl/init_source_replica.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
+[connection master]
+[connection slave]
+CHANGE REPLICATION SOURCE TO SOURCE_CONNECT_RETRY= 1, SOURCE_RETRY_COUNT= 0;
+# Adding debug point 'simulate_reconnect_after_failed_binlog_dump_twice' to @@GLOBAL.debug
+include/rpl/start_replica.inc
+[connection master]
+CREATE TABLE t_retry_zero (id INT PRIMARY KEY);
+INSERT INTO t_retry_zero VALUES (1);
+include/rpl/sync_to_replica.inc
+# Removing debug point 'simulate_reconnect_after_failed_binlog_dump_twice' from @@GLOBAL.debug
+[connection master]
+DROP TABLE t_retry_zero;
+include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl/t/rpl_alter_user_empty_auth.test b/mysql-test/suite/rpl/t/rpl_alter_user_empty_auth.test
new file mode 100644
index 000000000000..cb012c0662e2
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_alter_user_empty_auth.test
@@ -0,0 +1,70 @@
+#
+# Verify that ALTER USER with empty authentication data replicates without
+# changing the account state.
+#
+
+--source include/not_have_privilege_checks_user.inc
+--source include/rpl/init_source_replica.inc
+
+--connection master
+--echo #
+--echo # Bug#38478657: ALTER USER with empty authentication data should not
+--echo # expire passwords on replicas.
+--echo #
+CREATE USER 'rpl_empty_auth_by'@'%'
+ IDENTIFIED WITH 'caching_sha2_password' BY '';
+CREATE USER 'rpl_empty_auth_with'@'%'
+ IDENTIFIED WITH 'caching_sha2_password' BY '';
+CREATE USER 'rpl_empty_auth_as'@'%'
+ IDENTIFIED WITH 'caching_sha2_password' BY '';
+--source include/rpl/sync_to_replica.inc
+
+--connection master
+ALTER USER 'rpl_empty_auth_by'@'%'
+ IDENTIFIED WITH caching_sha2_password BY '';
+ALTER USER 'rpl_empty_auth_with'@'%'
+ IDENTIFIED WITH caching_sha2_password;
+ALTER USER 'rpl_empty_auth_as'@'%'
+ IDENTIFIED WITH caching_sha2_password AS '';
+--source include/rpl/sync_to_replica.inc
+
+--connection master
+SET @sql_log_bin_saved = @@sql_log_bin;
+SET sql_log_bin = 0;
+CREATE TABLE test.rpl_empty_auth_master
+SELECT user, host, plugin, authentication_string, password_expired
+FROM mysql.user
+WHERE user LIKE 'rpl_empty_auth_%'
+ORDER BY user;
+SET sql_log_bin = @sql_log_bin_saved;
+
+--connection slave
+SET @sql_log_bin_saved = @@sql_log_bin;
+SET sql_log_bin = 0;
+CREATE TABLE test.rpl_empty_auth_slave
+SELECT user, host, plugin, authentication_string, password_expired
+FROM mysql.user
+WHERE user LIKE 'rpl_empty_auth_%'
+ORDER BY user;
+SET sql_log_bin = @sql_log_bin_saved;
+
+--let $diff_tables=master:test.rpl_empty_auth_master, slave:test.rpl_empty_auth_slave
+--source include/diff_tables.inc
+
+--connection master
+DROP USER 'rpl_empty_auth_by'@'%', 'rpl_empty_auth_with'@'%',
+ 'rpl_empty_auth_as'@'%';
+SET @sql_log_bin_saved = @@sql_log_bin;
+SET sql_log_bin = 0;
+DROP TABLE test.rpl_empty_auth_master;
+SET sql_log_bin = @sql_log_bin_saved;
+--source include/rpl/sync_to_replica.inc
+
+--connection slave
+SET @sql_log_bin_saved = @@sql_log_bin;
+SET sql_log_bin = 0;
+DROP TABLE test.rpl_empty_auth_slave;
+SET sql_log_bin = @sql_log_bin_saved;
+
+--connection master
+--source include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl/t/rpl_applier_blocked_by_backup.test b/mysql-test/suite/rpl/t/rpl_applier_blocked_by_backup.test
index fc0c27748f99..81a32a602294 100644
--- a/mysql-test/suite/rpl/t/rpl_applier_blocked_by_backup.test
+++ b/mysql-test/suite/rpl/t/rpl_applier_blocked_by_backup.test
@@ -19,6 +19,9 @@
--source include/have_debug_sync.inc
--source include/have_binlog_format_row.inc
--source include/rpl/init_source_replica.inc
+--source include/rpl/connection_source.inc
+CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=InnoDB;
+--source include/rpl/sync_to_replica.inc
--echo #
--echo # Lock replica for backup
@@ -36,6 +39,10 @@ LOCK INSTANCE FOR BACKUP;
--source include/rpl/connection_source.inc
FLUSH BINARY LOGS;
+# Rotate does not carry a GTID. Insert a row so GTID-based sync waits for
+# a post-rotate event, which guarantees that the applier has switched logs.
+INSERT INTO t1 VALUES (1);
+
--echo #
--echo # Check that relay logs have not been purged on replica
--echo #
@@ -64,6 +71,8 @@ UNLOCK INSTANCE;
--source include/rpl/connection_source.inc
FLUSH BINARY LOGS;
+INSERT INTO t1 VALUES (2);
+
--echo #
--echo # Check relay logs have been purged on replica
--echo #
@@ -83,5 +92,6 @@ call mtr.add_suppression("Could not purge binary logs since another session is e
--echo #
--source include/rpl/connection_source.inc
+DROP TABLE t1;
+--source include/rpl/sync_to_replica.inc
--source include/rpl/deinit.inc
-
diff --git a/mysql-test/suite/rpl/t/rpl_applier_metrics_basic.test b/mysql-test/suite/rpl/t/rpl_applier_metrics_basic.test
index f2feba5f0a19..e6cd0ee342f9 100644
--- a/mysql-test/suite/rpl/t/rpl_applier_metrics_basic.test
+++ b/mysql-test/suite/rpl/t/rpl_applier_metrics_basic.test
@@ -162,12 +162,13 @@ INSERT INTO t1 (a) VALUES(1);
--let $assert_cond = [SELECT WAITS_FOR_AVAILABLE_WORKER_SUM_TIME $from_ch] = 0
--source include/assert.inc
-# The first transaction in a channel always causes a dependency check.
-# The second transaction, in this case, executes on source only after the first
-# one completes on replica, so it will not check dependencies. Hence we expect
-# the counter to be exactly 1.
---let $assert_text = There were no "real" waits on dependencies, so WAITS_COMMIT_SCHEDULE_DEPENDENCY_COUNT is 1
---let $assert_cond = [SELECT WAITS_COMMIT_SCHEDULE_DEPENDENCY_COUNT $from_ch] = 1
+# The first transaction in a channel always causes a dependency check. Depending
+# on coordinator and worker timing, the second transaction may observe another
+# dependency scheduling wait even though this test does not intentionally block
+# on one. Exact dependency-wait accounting is covered by
+# rpl_applier_metrics_waits.
+--let $assert_text = WAITS_COMMIT_SCHEDULE_DEPENDENCY_COUNT is incremented
+--let $assert_cond = [SELECT WAITS_COMMIT_SCHEDULE_DEPENDENCY_COUNT $from_ch] >= 1
--source include/assert.inc
--echo # Nothing to assert for WAITS_COMMIT_SCHEDULE_DEPENDENCY_SUM_TIME: there was a wait, so it is likely nonzero, but there is no guarantee
diff --git a/mysql-test/suite/rpl/t/rpl_change_master_to_priv_checks_user_errors.test b/mysql-test/suite/rpl/t/rpl_change_master_to_priv_checks_user_errors.test
index 6a5481297bda..80e3ebf83e4b 100644
--- a/mysql-test/suite/rpl/t/rpl_change_master_to_priv_checks_user_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_change_master_to_priv_checks_user_errors.test
@@ -97,7 +97,7 @@ GRANT SESSION_VARIABLES_ADMIN, REPLICATION_APPLIER ON *.* TO 'u1'@'localhost';
#
# 1) Set `PRIVILEGE_CHECKS_USER` to a user without `CREATE` privileges.
#
-CALL mtr.add_suppression(".CREATE command denied to user.");
+CALL mtr.add_suppression("Access denied for user.*to database.*");
RESET REPLICA ALL;
@@ -113,13 +113,15 @@ START REPLICA;
# 2) Create a table on the master.
#
--source include/rpl/connection_source.inc
+CREATE DATABASE db1;
+USE db1;
CREATE TABLE t1 (c1 INT);
#
# 3) Wait for slave to error out.
#
--source include/rpl/connection_replica.inc
---let $slave_sql_errno = convert_error(ER_TABLEACCESS_DENIED_ERROR)
+--let $slave_sql_errno = convert_error(ER_DBACCESS_DENIED_ERROR)
--source include/rpl/wait_for_applier_error.inc
--source include/rpl/stop_replica.inc
@@ -195,7 +197,7 @@ CALL mtr.add_suppression(".*Access denied. you need .at least one of. the GRANT
if (`SELECT @@GLOBAL.GTID_MODE = "ON"`)
{
--disable_query_log
- --eval SET GTID_NEXT= '$master_uuid:2'
+ --eval SET GTID_NEXT= '$master_uuid:3'
BEGIN;
COMMIT;
SET GTID_NEXT= 'AUTOMATIC';
@@ -226,6 +228,7 @@ GRANT DROP ON *.* TO 'u1'@'localhost';
START REPLICA;
--source include/rpl/connection_source.inc
DROP TABLE t1;
+DROP DATABASE db1;
--source include/rpl/sync_to_replica.inc
--source include/rpl/stop_replica.inc
CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER=NULL, REQUIRE_ROW_FORMAT=0 FOR CHANNEL '';
diff --git a/mysql-test/suite/rpl/t/rpl_delete_no_where.test b/mysql-test/suite/rpl/t/rpl_delete_no_where.test
index db7ea2eaed50..3d8c91a6803f 100644
--- a/mysql-test/suite/rpl/t/rpl_delete_no_where.test
+++ b/mysql-test/suite/rpl/t/rpl_delete_no_where.test
@@ -6,6 +6,25 @@
-- source include/force_myisam_default.inc
-- source include/have_myisam.inc
-- source include/rpl/init_source_replica.inc
+
+--disable_query_log
+--connection slave
+# Bug#39580589 tracks the MyISAM/GTID visibility behavior observed here:
+# with concurrent_insert enabled, a MyISAM SELECT may observe the previous
+# table state after WAIT_FOR_EXECUTED_GTID_SET() returns. Revisit this
+# test's dependency on @@global.concurrent_insert after Bug#39580589
+# is evaluated.
+SET @old_slave_concurrent_insert= @@global.concurrent_insert;
+SET @@global.concurrent_insert= 0;
+--connection master
+--enable_query_log
+
let $engine_type=myisam;
-- source common/rpl/rpl_delete_no_where.test
+
+--disable_query_log
+--connection slave
+SET @@global.concurrent_insert= @old_slave_concurrent_insert;
+--enable_query_log
+
--source include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl/t/rpl_explicit_defaults_timestamp_generated_not_null.test b/mysql-test/suite/rpl/t/rpl_explicit_defaults_timestamp_generated_not_null.test
new file mode 100644
index 000000000000..79a6a332dfd5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_explicit_defaults_timestamp_generated_not_null.test
@@ -0,0 +1,73 @@
+#
+# ==== PURPOSE ====
+#
+# This test checks that row-based replication does not fail when
+# explicit_defaults_for_timestamp is OFF and a generated TIMESTAMP NOT NULL
+# column is derived from a NULL source value.
+#
+# ==== IMPLEMENTATION ====
+#
+# To reproduce and verify the issue, this test inserts a NULL value that is
+# accepted on source with INSERT IGNORE, validates the same row is applied
+# on replica without replication stop, and replays the source binlog through
+# mysqlbinlog to verify the BINLOG applier path too.
+#
+# Test steps:
+#
+# 1. Configure source/replica and set explicit_defaults_for_timestamp=OFF.
+# 2. Create a table with a stored generated TIMESTAMP NOT NULL column.
+# 3. Execute INSERT IGNORE with NULL input for the base datetime column.
+# 4. Verify source and replica both contain the row after replication.
+# 5. Stop replica apply on the second server and replay the source binlog
+# through mysqlbinlog into the same server.
+# 6. Verify mysqlbinlog replay stores the same row successfully.
+#
+# Test pass conditions:
+#
+# - Source row is inserted with expected coerced generated timestamp value.
+# - Replica applies row event and returns the same row without SQL thread
+# failure.
+# - mysqlbinlog replay restores the same row without ER_BAD_NULL_ERROR.
+#
+# ==== REFERENCES ====
+#
+# BUG#120128: When explicit_defaults_for_timestamp is off, inserting a null
+# value causes replication exceptions.
+#
+--source include/have_binlog_format_row.inc
+--source include/rpl/init_source_replica.inc
+
+--echo
+--source include/rpl/connection_source.inc
+SET @@SESSION.explicit_defaults_for_timestamp = OFF;
+CREATE TABLE `t` (
+ `id_col` int NOT NULL AUTO_INCREMENT,
+ `datetime_col` datetime(6) DEFAULT NULL,
+ `timestamp_col2` timestamp(6) GENERATED ALWAYS AS (`datetime_col`) STORED NOT NULL, PRIMARY KEY (`id_col`)
+);
+
+insert ignore into t(datetime_col) values(NULL);
+--let $source_binlog_file= query_get_value(SHOW BINARY LOG STATUS, File, 1)
+
+--echo
+--query_vertical SELECT * FROM t
+
+--source include/rpl/sync_to_replica.inc
+--echo
+--query_vertical SELECT * FROM t
+
+--source include/rpl/stop_replica.inc
+DROP TABLE t;
+RESET BINARY LOGS AND GTIDS;
+
+--let $replica_connection_args= --user=root --host=127.0.0.1 --port=$SLAVE_MYPORT
+--exec $MYSQL_BINLOG $server_1_datadir/$source_binlog_file | $MYSQL $replica_connection_args test
+
+--echo
+--query_vertical SELECT * FROM t
+
+--source include/rpl/start_replica.inc
+--source include/rpl/connection_source.inc
+DROP TABLE t;
+--source include/rpl/sync_to_replica.inc
+--source include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl/t/rpl_inconsistent_logical_timestamp_replica_parallel_workers.test b/mysql-test/suite/rpl/t/rpl_inconsistent_logical_timestamp_replica_parallel_workers.test
index c84eff1e8a21..41d33c55827d 100644
--- a/mysql-test/suite/rpl/t/rpl_inconsistent_logical_timestamp_replica_parallel_workers.test
+++ b/mysql-test/suite/rpl/t/rpl_inconsistent_logical_timestamp_replica_parallel_workers.test
@@ -29,6 +29,8 @@
--source include/have_debug.inc
--source include/have_binlog_format_row.inc
--source include/have_gtid_mode_off.inc
+--source include/skip_config_rpl_gtid_only.inc
+--let $use_gtids= 0
# This test needs at least 2 applier workers
--let $option_name = replica_parallel_workers
@@ -45,7 +47,9 @@
if($gtid_mode_on == 1){
--let $rpl_gtid_mode= OFF
--let $rpl_set_enforce_gtid_consistency= 0
+ --let $include_silent= 1
--source include/rpl/set_gtid_mode.inc
+ --let $include_silent= 0
}
--source include/rpl/connection_replica.inc
@@ -186,11 +190,13 @@ UNLOCK TABLES;
--source include/rpl/connection_source.inc
#Setting GTID_MODE to original state
+--let $include_silent= 1
if ($gtid_mode_on == 0) {
--let $rpl_gtid_mode = 0
--let $rpl_set_enforce_gtid_consistency = 0
}
--source include/rpl/set_gtid_mode.inc
+--let $include_silent= 0
DROP TABLE t1, t2;
--source include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test b/mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test
index 15052981394a..5ffe246e7f74 100644
--- a/mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test
+++ b/mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test
@@ -18,6 +18,7 @@
--source include/not_group_replication_plugin.inc
-- source include/not_windows.inc
-- source include/not_lowercase1.inc
+--source include/not_rpl_gtid_only.inc
-- source include/rpl/init_source_replica.inc
SET SQL_LOG_BIN=0;
diff --git a/mysql-test/suite/rpl/t/rpl_priv_checks_user_db_specific_access.test b/mysql-test/suite/rpl/t/rpl_priv_checks_user_db_specific_access.test
new file mode 100644
index 000000000000..a7bf70aaa3e2
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_priv_checks_user_db_specific_access.test
@@ -0,0 +1,137 @@
+##############################################################################
+# ==== Purpose ====
+# This script tests database-specific CREATE and DROP access handling
+# with respect to the `PRIVILEGE_CHECKS_USER` option of
+# `CHANGE REPLICATION SOURCE TO.. `.
+#
+# ==== Requirements ====
+# Replication must succeed for the respective CREATE or DROP operations
+# when the user specified in the `PRIVILEGE_CHECKS_USER` option of
+# `CHANGEASTER REPLICATION SOURCE TO ...` has database-specific privileges to
+# perform those operations.
+#
+# ==== Implementation ====
+# 1. Set up the initial source-replica configuration.
+# 2. Set `PRIVILEGE_CHECKS_USER` to a user without `CREATE` and `DROP`
+# privileges and start replica.
+# 3. Execute CREATE and DROP operations (e.g., database and table) on
+# db1 on the source.
+# 4. Wait for the replica to encounter an "access denied" error.
+# 5. Grant database-specific `CREATE` and `DROP` privileges to the specified
+# user, resume replication, and verify that it succeeds.
+# 6. Execute CREATE and DROP operations (e.g., database and table) on db2 on
+# the source.
+# 7. Wait for the replica to encounter an "access denied" error.
+# 8. Create a role with CREATE and DROP privileges on db2, grant it to the
+# specified user, set it as the default role, start replication and verify
+# the changes replicate successfully to the replica.
+# 9. On the source, perform a CREATE operation on a different database.
+# 10. Wait for the replica to encounter an "access denied" error.
+# 11. Clean up.
+#
+# ==== References ====
+# Bug#37587555:PRIVILEGE CHECK FAILS FOR CREATE, DROP WHEN IT IS GRANTED
+# TO A SPECIFIC DATABASE
+##############################################################################
+
+--source include/have_binlog_format_row.inc
+
+--echo #
+--echo # 1. Set up the initial source-replica configuration.
+--let $rpl_skip_start_slave = 1
+--source include/rpl/init_source_replica.inc
+
+--let $source_log_pos = query_get_value(SHOW BINARY LOG STATUS, Position, 1)
+
+--echo #
+--echo # 2. Set `PRIVILEGE_CHECKS_USER` to a user without `CREATE` and `DROP`
+--echo # privileges and start replica.
+--source include/rpl/connection_replica.inc
+CALL mtr.add_suppression("Access denied for user.*to database.*");
+CALL mtr.add_suppression(".*The replica coordinator and worker threads are stopped.*");
+
+CREATE USER 'u1'@'localhost';
+GRANT SESSION_VARIABLES_ADMIN, REPLICATION_APPLIER ON *.* TO 'u1'@'localhost';
+
+RESET REPLICA ALL;
+--replace_result $MASTER_MYPORT MY_MASTER_PORT $source_log_pos MY_MASTER_LOG_POS
+--eval CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_PORT=$MASTER_MYPORT, SOURCE_HOST='127.0.0.1', PRIVILEGE_CHECKS_USER='u1'@'localhost', REQUIRE_ROW_FORMAT = 1, SOURCE_LOG_POS=$source_log_pos
+START REPLICA;
+
+--echo #
+--echo # 3. Execute CREATE and DROP operations (e.g., database and table) on
+--echo # db1 on the source.
+--source include/rpl/connection_source.inc
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE t1 (c1 INT);
+DROP TABLE t1;
+DROP DATABASE db1;
+
+--echo #
+--echo # 4. Wait for the replica to encounter an "access denied" error.
+--source include/rpl/connection_replica.inc
+--let $slave_sql_errno = convert_error(ER_DBACCESS_DENIED_ERROR)
+--source include/rpl/wait_for_applier_error.inc
+--source include/rpl/stop_replica.inc
+
+--echo #
+--echo # 5. Grant database-specific `CREATE` and `DROP` privileges to the
+--echo # specified user, resume replication, and verify that it succeeds.
+GRANT CREATE, DROP ON db1.* TO 'u1'@'localhost';
+--source include/rpl/start_replica.inc
+--source include/rpl/connection_source.inc
+--source include/rpl/sync_to_replica.inc
+
+--echo #
+--echo # 6. Execute CREATE and DROP operations (e.g., database and table) on
+--echo # db2 on the source.
+--source include/rpl/connection_source.inc
+CREATE DATABASE db2;
+USE db2;
+CREATE TABLE t1 (c1 INT);
+DROP TABLE t1;
+DROP DATABASE db2;
+
+--echo #
+--echo # 7. Wait for the replica to encounter an "access denied" error.
+--source include/rpl/connection_replica.inc
+--let $slave_sql_errno = convert_error(ER_DBACCESS_DENIED_ERROR)
+--source include/rpl/wait_for_applier_error.inc
+--source include/rpl/stop_replica.inc
+
+--echo #
+--echo # 8. Create a role with CREATE and DROP privileges on db2, grant it to
+--echo # the specified user, set it as the default role, start replication
+--echo # and verify the changes replicate successfully to the replica.
+CREATE ROLE role1;
+GRANT role1 TO 'u1'@'localhost';
+SET DEFAULT ROLE role1 TO 'u1'@'localhost';
+GRANT CREATE, DROP ON db2.* TO role1;
+--source include/rpl/start_replica.inc
+
+--source include/rpl/connection_source.inc
+--source include/rpl/sync_to_replica.inc
+
+--echo #
+--echo # 9. On the source, perform a CREATE operation on a different database.
+--source include/rpl/connection_source.inc
+CREATE DATABASE db3;
+
+--echo #
+--echo # 10. Wait for the replica to encounter an "access denied" error.
+--source include/rpl/connection_replica.inc
+--let $slave_sql_errno = convert_error(ER_DBACCESS_DENIED_ERROR)
+--source include/rpl/wait_for_applier_error.inc
+
+--echo #
+--echo # 11. Clean up
+--source include/rpl/connection_source.inc
+DROP DATABASE db3;
+--source include/rpl/connection_replica.inc
+DROP ROLE role1;
+DROP USER 'u1'@'localhost';
+--source include/rpl/stop_replica.inc
+CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER=NULL, REQUIRE_ROW_FORMAT=0 FOR CHANNEL '';
+START REPLICA;
+--source include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl/t/rpl_ps_worker_retry_transaction_mts.test b/mysql-test/suite/rpl/t/rpl_ps_worker_retry_transaction_mts.test
index 39c85b1e0194..a1f359d58716 100644
--- a/mysql-test/suite/rpl/t/rpl_ps_worker_retry_transaction_mts.test
+++ b/mysql-test/suite/rpl/t/rpl_ps_worker_retry_transaction_mts.test
@@ -15,4 +15,6 @@
#
# WL#9131 Add RETRIES field to replication_applier_status_by_worker P_S table
+--source include/not_rpl_gtid_only.inc
+
--source common/rpl/ps_table_worker_retry.inc
diff --git a/mysql-test/suite/rpl/t/rpl_read_size.test b/mysql-test/suite/rpl/t/rpl_read_size.test
index 17dcf5367964..53274ba4da2f 100644
--- a/mysql-test/suite/rpl/t/rpl_read_size.test
+++ b/mysql-test/suite/rpl/t/rpl_read_size.test
@@ -36,9 +36,17 @@ while ($case < 2)
# Avoid reading relay log file while receiving events
--source include/rpl/stop_applier.inc
+ # Reset PFS rows left by previous tests or previous cases in this test.
+ --disable_query_log
+ TRUNCATE TABLE performance_schema.file_summary_by_instance;
+ --enable_query_log
+
+ # Measure the file this replica is currently reading.
+ --let $relay_log_file= query_get_value(SHOW REPLICA STATUS, Relay_Log_File, 1)
+
# Move to the next relay log. This will ensure that the count_read
# variable will only contains the read done by belows INSERT query.
- --let $count_read_start= query_get_value(SELECT count_read FROM performance_schema.file_summary_by_instance WHERE event_name='wait/io/file/sql/relaylog' ORDER BY file_name, count_read, 2)
+ --let $count_read_start= query_get_value(SELECT count_read FROM performance_schema.file_summary_by_instance WHERE event_name='wait/io/file/sql/relaylog' AND file_name LIKE '%$relay_log_file', count_read, 1)
--source include/rpl/connection_source.inc
--let $counter= 0
@@ -60,7 +68,7 @@ while ($case < 2)
--let $ignore_gtids_on_sync=1
--source include/rpl/sync_with_recieved.inc
- --let $count_read_end= query_get_value(SELECT count_read FROM performance_schema.file_summary_by_instance WHERE event_name='wait/io/file/sql/relaylog' ORDER BY file_name, count_read, 2)
+ --let $count_read_end= query_get_value(SELECT count_read FROM performance_schema.file_summary_by_instance WHERE event_name='wait/io/file/sql/relaylog' AND file_name LIKE '%$relay_log_file', count_read, 1)
--let $rpl_read_size_value= `SELECT @@GLOBAL.rpl_read_size`
--let $relay_log_pos= query_get_value(SHOW REPLICA STATUS, Relay_Log_Pos, 1)
diff --git a/mysql-test/suite/rpl/t/rpl_relay_log_space_limit.test b/mysql-test/suite/rpl/t/rpl_relay_log_space_limit.test
index a35b592f7a56..f47557f2c60f 100644
--- a/mysql-test/suite/rpl/t/rpl_relay_log_space_limit.test
+++ b/mysql-test/suite/rpl/t/rpl_relay_log_space_limit.test
@@ -68,6 +68,10 @@
--source include/have_binlog_format_row.inc
+# This test case requires a deterministic relay log size.
+# Therefore, cannot run with compression on.
+--source include/not_binlog_transaction_compression_on.inc
+
--let $rpl_skip_start_slave=1
--source include/rpl/init_source_replica.inc
diff --git a/mysql-test/suite/rpl/t/rpl_seconds_behind_master.test b/mysql-test/suite/rpl/t/rpl_seconds_behind_master.test
index d0afbd17b05b..68728ee0cccf 100644
--- a/mysql-test/suite/rpl/t/rpl_seconds_behind_master.test
+++ b/mysql-test/suite/rpl/t/rpl_seconds_behind_master.test
@@ -151,6 +151,19 @@ let $field= State;
let $condition= = 'Replica has read all relay log; waiting for more updates';
-- source include/wait_show_condition.inc
+# In MTA, Seconds_Behind_Source is updated by the checkpoint routine after
+# workers have applied their queued events.
+--source include/rpl/wait_for_mta_checkpoint.inc
+
+# In MTA, Seconds_Behind_Source is updated by the checkpoint routine after
+# workers have applied their queued events.
+--source include/rpl/wait_for_mta_checkpoint.inc
+
+-- let $sbm= query_get_value("SHOW REPLICA STATUS", Seconds_Behind_Source, 1)
+let $assert_text= Seconds_Behind_Source must be 0;
+let $assert_cond= $sbm = 0;
+source include/assert.inc;
+
--let $slave_param= Seconds_Behind_Source
--let $slave_param_value= 0
--source include/rpl/wait_for_replica_status.inc
diff --git a/mysql-test/suite/rpl/t/rpl_source_retry_count_zero_reconnect_limit.test b/mysql-test/suite/rpl/t/rpl_source_retry_count_zero_reconnect_limit.test
new file mode 100644
index 000000000000..ef01cdd51d0d
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_source_retry_count_zero_reconnect_limit.test
@@ -0,0 +1,63 @@
+# ==== PURPOSE ====
+#
+# This test verifies that SOURCE_RETRY_COUNT=0 allows unlimited reconnect
+# attempts.
+#
+# ==== IMPLEMENTATION ====
+#
+# The test starts a receiver with SOURCE_RETRY_COUNT=0 and injects two failed
+# binlog dump reconnect attempts before allowing the next retry to succeed.
+#
+# A value of 0 is documented as infinite retry count, so transient reconnect
+# failures in this path should not stop replication.
+#
+# Test steps:
+#
+# 1. Configure SOURCE_CONNECT_RETRY=1 and SOURCE_RETRY_COUNT=0.
+# 2. Inject two failed binlog dump reconnects.
+# 3. Start replication.
+# 4. Write an event on source.
+# 5. Wait for the replica to synchronize.
+#
+# Test pass conditions:
+#
+# - Replication does not stop after two reconnect attempts.
+# - The receiver catches up with source events.
+#
+# ==== REFERENCES ====
+#
+# BUG#39086875: Lost connection while registering replica on source stops
+# receiver thread
+
+--source include/have_binlog_format_row.inc
+--source include/have_debug.inc
+
+--let $rpl_skip_start_slave= 1
+--source include/rpl/init_source_replica.inc
+
+--source include/rpl/connection_replica.inc
+
+--disable_query_log
+call mtr.add_suppression(".*Failed on request_dump\\(\\) for channel.*");
+call mtr.add_suppression(".*Source command COM_BINLOG_DUMP failed*");
+--enable_query_log
+
+CHANGE REPLICATION SOURCE TO SOURCE_CONNECT_RETRY= 1, SOURCE_RETRY_COUNT= 0;
+
+--let $debug_point= simulate_reconnect_after_failed_binlog_dump_twice
+--source include/add_debug_point.inc
+
+--source include/rpl/start_replica.inc
+
+--source include/rpl/connection_source.inc
+CREATE TABLE t_retry_zero (id INT PRIMARY KEY);
+INSERT INTO t_retry_zero VALUES (1);
+--source include/rpl/sync_to_replica.inc
+
+# Cleanup
+--let $debug_point= simulate_reconnect_after_failed_binlog_dump_twice
+--source include/remove_debug_point.inc
+--source include/rpl/connection_source.inc
+DROP TABLE t_retry_zero;
+
+--source include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl_gtid/r/rpl_apply_binlog_with_same_server_id.result b/mysql-test/suite/rpl_gtid/r/rpl_apply_binlog_with_same_server_id.result
index 3696a7cb0c42..e9217cec825a 100644
--- a/mysql-test/suite/rpl_gtid/r/rpl_apply_binlog_with_same_server_id.result
+++ b/mysql-test/suite/rpl_gtid/r/rpl_apply_binlog_with_same_server_id.result
@@ -3,10 +3,6 @@ call mtr.add_suppression("using --replicate-same-server-id in conjunction with -
# restart: --replicate-same-server-id=1 --server_id=1 --relay-log=replicate-relay-bin
SET GLOBAL RELAY_LOG_PURGE=OFF;
CHANGE REPLICATION SOURCE TO RELAY_LOG_FILE='replicate-relay-bin.000001', RELAY_LOG_POS=1, SOURCE_HOST='dummy';
-START REPLICA SQL_THREAD;
-SET GLOBAL RELAY_LOG_PURGE=ON;
-STOP REPLICA SQL_THREAD;
-CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root';
-Warnings:
-Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
-Note 1760 Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
+include/rpl/start_applier.inc
+include/rpl/stop_applier.inc
+include/rpl/reset_replica.inc
diff --git a/mysql-test/suite/rpl_gtid/r/rpl_mta_commit_order_gtid_update_nobinlog.result b/mysql-test/suite/rpl_gtid/r/rpl_mta_commit_order_gtid_update_nobinlog.result
new file mode 100644
index 000000000000..6526828f55f2
--- /dev/null
+++ b/mysql-test/suite/rpl_gtid/r/rpl_mta_commit_order_gtid_update_nobinlog.result
@@ -0,0 +1,62 @@
+include/rpl/init.inc [topology=1->2->1]
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
+[connection server_1]
+CALL mtr.add_suppression(".*Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*");
+[connection server_2]
+CALL mtr.add_suppression(".*Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*");
+# Configure thread cache for the concurrent workload.
+[connection server_1]
+SET GLOBAL thread_cache_size=32;
+[connection server_2]
+SET GLOBAL thread_cache_size=32;
+# Create generic write targets and a statement-format checksum table.
+[connection server_1]
+CREATE TABLE source_writes (
+id INT AUTO_INCREMENT PRIMARY KEY,
+pad VARCHAR(64)
+) ENGINE=InnoDB;
+CREATE TABLE replica_writes (
+id INT AUTO_INCREMENT PRIMARY KEY,
+pad VARCHAR(64)
+) ENGINE=InnoDB;
+CREATE DATABASE checksum_test;
+CREATE TABLE checksum_test.table_checksums (
+table_name VARCHAR(64) NOT NULL,
+chunk INT NOT NULL,
+row_count INT,
+row_crc VARCHAR(40),
+updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ON UPDATE CURRENT_TIMESTAMP,
+PRIMARY KEY (table_name, chunk)
+) ENGINE=InnoDB;
+include/rpl/sync.inc
+# Run bounded local writes and GTID/checksum readers.
+# Wait for mysqlslap client sessions to finish.
+[connection server_1]
+[connection server_2]
+[connection server_1]
+[connection server_2]
+include/rpl/sync.inc
+[connection server_1]
+[connection server_2]
+# Stop replication before local cleanup.
+include/rpl/stop_all_replicas.inc
+# Clean local test objects without replicating cleanup DDL.
+[connection server_1]
+include/rpl/disable_binlog.inc
+DROP TABLE source_writes;
+DROP TABLE replica_writes;
+DROP DATABASE checksum_test;
+include/rpl/restore_binlog.inc
+[connection server_2]
+include/rpl/disable_binlog.inc
+DROP TABLE source_writes;
+DROP TABLE replica_writes;
+DROP DATABASE checksum_test;
+include/rpl/restore_binlog.inc
+include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl_gtid/t/rpl_apply_binlog_with_same_server_id.test b/mysql-test/suite/rpl_gtid/t/rpl_apply_binlog_with_same_server_id.test
index 883d679c8285..331d67e23a96 100644
--- a/mysql-test/suite/rpl_gtid/t/rpl_apply_binlog_with_same_server_id.test
+++ b/mysql-test/suite/rpl_gtid/t/rpl_apply_binlog_with_same_server_id.test
@@ -6,7 +6,7 @@
#
# ==== Implementation ====
#
-# 1) Supress a warning.
+# 1) Suppress a warning.
# 2) Initialize source datadir path.
# 3) Stop the server.
# 4) Rename the already executed and saved binary logs
@@ -27,7 +27,7 @@
# Clean any existing old relay log files that can cause conflicts
--source include/rpl/reset_replica.inc
-# 1) Supress a warning.
+# 1) Suppress a warning.
call mtr.add_suppression("using --replicate-same-server-id in conjunction with --log-replica-updates would lead to infinite loops in this server.");
# 2) Initialize source data dir path.
@@ -46,9 +46,10 @@ call mtr.add_suppression("using --replicate-same-server-id in conjunction with -
--source include/start_mysqld.inc
# 6) Start replica in parallel mode.
+--let $relay_log_purge_orig= `select @@relay_log_purge`
SET GLOBAL RELAY_LOG_PURGE=OFF;
CHANGE REPLICATION SOURCE TO RELAY_LOG_FILE='replicate-relay-bin.000001', RELAY_LOG_POS=1, SOURCE_HOST='dummy';
-START REPLICA SQL_THREAD;
+--source include/rpl/start_applier.inc
# 7) Wait for replica to finish.
--let $show_statement= SHOW PROCESSLIST
@@ -57,6 +58,9 @@ START REPLICA SQL_THREAD;
--source include/wait_show_condition.inc
# 8) Cleanup.
-SET GLOBAL RELAY_LOG_PURGE=ON;
-STOP REPLICA SQL_THREAD;
-CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root';
+--disable_query_log
+--eval SET GLOBAL relay_log_purge = $relay_log_purge_orig
+--enable_query_log
+--source include/rpl/stop_applier.inc
+--let $rpl_reset_slave_all= 1
+--source include/rpl/reset_replica.inc
diff --git a/mysql-test/suite/rpl_gtid/t/rpl_mta_commit_order_gtid_update_nobinlog-master.opt b/mysql-test/suite/rpl_gtid/t/rpl_mta_commit_order_gtid_update_nobinlog-master.opt
new file mode 100644
index 000000000000..168bad7b6ab8
--- /dev/null
+++ b/mysql-test/suite/rpl_gtid/t/rpl_mta_commit_order_gtid_update_nobinlog-master.opt
@@ -0,0 +1 @@
+--skip-log-replica-updates
diff --git a/mysql-test/suite/rpl_gtid/t/rpl_mta_commit_order_gtid_update_nobinlog-slave.opt b/mysql-test/suite/rpl_gtid/t/rpl_mta_commit_order_gtid_update_nobinlog-slave.opt
new file mode 100644
index 000000000000..168bad7b6ab8
--- /dev/null
+++ b/mysql-test/suite/rpl_gtid/t/rpl_mta_commit_order_gtid_update_nobinlog-slave.opt
@@ -0,0 +1 @@
+--skip-log-replica-updates
diff --git a/mysql-test/suite/rpl_gtid/t/rpl_mta_commit_order_gtid_update_nobinlog.test b/mysql-test/suite/rpl_gtid/t/rpl_mta_commit_order_gtid_update_nobinlog.test
new file mode 100644
index 000000000000..dbdc8c77a346
--- /dev/null
+++ b/mysql-test/suite/rpl_gtid/t/rpl_mta_commit_order_gtid_update_nobinlog.test
@@ -0,0 +1,167 @@
+#
+# ==== PURPOSE ====
+#
+# This test checks a writable replica that applies transactions with
+# log_replica_updates disabled while user sessions commit local transactions on
+# the same server. The applied transactions use the commit-order path, while
+# the local transactions use binlog group commit. These two paths must not race
+# while updating GTID state.
+#
+# ==== IMPLEMENTATION ====
+#
+# This scenario requires applier workers with preserved commit order, disabled
+# log_replica_updates, local read-write user sessions on the same server,
+# statement-format checksum writes, and concurrent GTID reads. The test uses
+# circular GTID replication only to make each server receive replicated
+# transactions and also run local user transactions. The important concurrency
+# is between COMMIT_ORDER_FLUSH_STAGE and BINLOG_FLUSH_STAGE.
+#
+# Test steps:
+#
+# 1. Start two GTID-enabled servers in circular replication with
+# log_replica_updates disabled.
+# 2. Increase the thread cache used by the concurrent client workload.
+# 3. Create generic write and checksum tables.
+# 4. Run bounded mysqlslap clients that do local writes on both servers.
+# 5. Run statement-format checksum writes and GTID reads concurrently.
+# 6. Wait for the workload and replication to drain.
+# 7. Stop replication and clean local test objects without logging cleanup DDL.
+#
+# Test pass conditions:
+#
+# - The workload completes without a server error or hang.
+# - Both appliers synchronize after the concurrent workload and deinitialize
+# without applier errors.
+#
+# ==== REFERENCES ====
+#
+# BUG#39259437: Commit-order GTID state update race
+#
+
+--source include/not_valgrind.inc
+--source include/have_binlog_format_row.inc
+--source include/not_rpl_gtid_only.inc
+
+--let $rpl_topology= 1->2->1
+--source include/rpl/init.inc
+
+--let $rpl_connection_name= server_1
+--source include/connection.inc
+CALL mtr.add_suppression(".*Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*");
+--let $rpl_connection_name= server_2
+--source include/connection.inc
+CALL mtr.add_suppression(".*Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*");
+
+--echo # Configure thread cache for the concurrent workload.
+--let $rpl_connection_name= server_1
+--source include/connection.inc
+--disable_query_log
+--let $server_1_thread_cache_size= `SELECT @@GLOBAL.thread_cache_size`
+--enable_query_log
+SET GLOBAL thread_cache_size=32;
+
+--let $rpl_connection_name= server_2
+--source include/connection.inc
+--disable_query_log
+--let $server_2_thread_cache_size= `SELECT @@GLOBAL.thread_cache_size`
+--enable_query_log
+SET GLOBAL thread_cache_size=32;
+
+--echo # Create generic write targets and a statement-format checksum table.
+--let $rpl_connection_name= server_1
+--source include/connection.inc
+CREATE TABLE source_writes (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ pad VARCHAR(64)
+) ENGINE=InnoDB;
+CREATE TABLE replica_writes (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ pad VARCHAR(64)
+) ENGINE=InnoDB;
+CREATE DATABASE checksum_test;
+CREATE TABLE checksum_test.table_checksums (
+ table_name VARCHAR(64) NOT NULL,
+ chunk INT NOT NULL,
+ row_count INT,
+ row_crc VARCHAR(40),
+ updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (table_name, chunk)
+) ENGINE=InnoDB;
+--source include/rpl/sync.inc
+
+--echo # Run bounded local writes and GTID/checksum readers.
+--let $iterations= 100
+
+--exec_in_background $MYSQL_SLAP --user=root --host=127.0.0.1 --port=$SERVER_MYPORT_1 --number-of-queries=1 --iterations=$iterations --query="INSERT INTO source_writes(pad) VALUES (REPEAT('a', 32))" --create-schema=test --concurrency=4 --silent 2>&1
+
+--exec_in_background $MYSQL_SLAP --user=root --host=127.0.0.1 --port=$SERVER_MYPORT_2 --number-of-queries=1 --iterations=$iterations --query="INSERT INTO replica_writes(pad) VALUES (REPEAT('b', 32))" --create-schema=test --concurrency=4 --silent 2>&1
+
+--exec_in_background $MYSQL_SLAP --user=root --host=127.0.0.1 --port=$SERVER_MYPORT_1 --number-of-queries=1 --iterations=$iterations --delimiter=";" --query="SET SESSION binlog_format=STATEMENT; REPLACE INTO checksum_test.table_checksums(table_name,chunk,row_count,row_crc) SELECT 'source_writes',MOD(CONNECTION_ID(),16),COUNT(*),COALESCE(LOWER(CONV(BIT_XOR(CAST(CRC32(CONCAT_WS('#',id,pad)) AS UNSIGNED)),10,16)),'0') FROM test.source_writes WHERE id <= 128" --create-schema=test --concurrency=2 --silent 2>&1
+
+--exec_in_background $MYSQL_SLAP --user=root --host=127.0.0.1 --port=$SERVER_MYPORT_2 --number-of-queries=1 --iterations=$iterations --delimiter=";" --query="SET SESSION binlog_format=STATEMENT; REPLACE INTO checksum_test.table_checksums(table_name,chunk,row_count,row_crc) SELECT 'replica_writes',MOD(CONNECTION_ID(),16),COUNT(*),COALESCE(LOWER(CONV(BIT_XOR(CAST(CRC32(CONCAT_WS('#',id,pad)) AS UNSIGNED)),10,16)),'0') FROM test.replica_writes WHERE id <= 128" --create-schema=test --concurrency=2 --silent 2>&1
+
+--exec_in_background $MYSQL_SLAP --user=root --host=127.0.0.1 --port=$SERVER_MYPORT_2 --number-of-queries=1 --iterations=$iterations --query="SELECT @@GLOBAL.gtid_executed" --create-schema=test --concurrency=4 --silent 2>&1
+
+--echo # Wait for mysqlslap client sessions to finish.
+--let $rpl_connection_name= server_1
+--source include/connection.inc
+--let $wait_condition= SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND DB = 'test' AND ID <> CONNECTION_ID() AND COMMAND NOT IN ('Sleep', 'Daemon', 'Killed')
+--let $wait_timeout= 300
+--source include/wait_condition.inc
+
+--let $rpl_connection_name= server_2
+--source include/connection.inc
+--let $wait_condition= SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND DB = 'test' AND ID <> CONNECTION_ID() AND COMMAND NOT IN ('Sleep', 'Daemon', 'Killed')
+--let $wait_timeout= 300
+--source include/wait_condition.inc
+
+--let $rpl_connection_name= server_1
+--source include/connection.inc
+--let $wait_condition= SELECT COUNT(*) = 400 FROM source_writes
+--let $wait_timeout= 300
+--source include/wait_condition.inc
+
+--let $rpl_connection_name= server_2
+--source include/connection.inc
+--let $wait_condition= SELECT COUNT(*) = 400 FROM replica_writes
+--let $wait_timeout= 300
+--source include/wait_condition.inc
+
+--source include/rpl/sync.inc
+
+--let $rpl_connection_name= server_1
+--source include/connection.inc
+--disable_query_log
+--eval SET GLOBAL thread_cache_size=$server_1_thread_cache_size
+--enable_query_log
+
+--let $rpl_connection_name= server_2
+--source include/connection.inc
+--disable_query_log
+--eval SET GLOBAL thread_cache_size=$server_2_thread_cache_size
+--enable_query_log
+
+--echo # Stop replication before local cleanup.
+--source include/rpl/stop_all_replicas.inc
+
+--echo # Clean local test objects without replicating cleanup DDL.
+--let $rpl_connection_name= server_1
+--source include/connection.inc
+--source include/rpl/disable_binlog.inc
+DROP TABLE source_writes;
+DROP TABLE replica_writes;
+DROP DATABASE checksum_test;
+--source include/rpl/restore_binlog.inc
+
+--let $rpl_connection_name= server_2
+--source include/connection.inc
+--source include/rpl/disable_binlog.inc
+DROP TABLE source_writes;
+DROP TABLE replica_writes;
+DROP DATABASE checksum_test;
+--source include/rpl/restore_binlog.inc
+
+--let $rpl_skip_sync= 1
+--let $rpl_skip_stop_slave= 1
+--source include/rpl/deinit.inc
diff --git a/mysql-test/suite/rpl_gtid/t/rpl_verify_delay_time.test b/mysql-test/suite/rpl_gtid/t/rpl_verify_delay_time.test
index 87463812a801..84d5d64958da 100644
--- a/mysql-test/suite/rpl_gtid/t/rpl_verify_delay_time.test
+++ b/mysql-test/suite/rpl_gtid/t/rpl_verify_delay_time.test
@@ -4,11 +4,11 @@
# immediate_commit_timestamp and not with respect to when it started.
#
# ==== Implementation ====
-# In a master->slave topology it verifies that the delay of transaction
-# on slave is relative to the commit event time on master and not relative
+# In a source->replica topology it verifies that the delay of transaction
+# on replica is relative to the commit event time on source and not relative
# to the begining of the transaction by sleeping for a time equal to $delay
# before the commit event. It uses the timestamps of events in the mysqld
-# log of master and slave.
+# log of source and replica.
#
# ==== References ====
#
@@ -68,28 +68,38 @@ perl;
open(FILE, "$outfile2") or die("Unable to open $outfile2: $!\n");
- my $next_stmt_slave;
- my $insert_event_slave;
+ my $next_stmt_replica;
+ my $insert_event_replica;
+ my $found_test_table = 0;
- #obtain the timestamp of BEGIN event by using regex. note that the
- #the timestamps of BEGIN and INSERT events are almost same.
+ # Obtain the timestamp of the replicated BEGIN event by using regex.
+ # Ignore setup traffic that may have been logged before the test
+ # transaction.
- while (my $next_stmt_slave = )
+ while (my $next_stmt_replica = )
{
- chomp $next_stmt_slave;
- $insert_event_slave= $next_stmt_slave;
- if ($next_stmt_slave =~ /BEGIN/)
+ chomp $next_stmt_replica;
+ if ($next_stmt_replica =~ /BEGIN/)
{
+ next unless $found_test_table;
+ $insert_event_replica= $next_stmt_replica;
last;
}
+ if ($next_stmt_replica =~ /\QCREATE TABLE t1 (a varchar(50))\E/)
+ {
+ $found_test_table = 1;
+ }
}
- $insert_event_slave =~ s/.*([0-9][0-9]:[0-9][0-9]:[0-9][0-9]).*/\1/;
+ die("Unable to find the replicated test transaction in $outfile2\n")
+ unless defined $insert_event_replica;
+
+ $insert_event_replica =~ s/.*([0-9][0-9]:[0-9][0-9]:[0-9][0-9]).*/\1/;
my $dir = $ENV{'MYSQLTEST_VARDIR'};
open (OUTPUT, ">$dir/tmp/tar.inc") ;
print OUTPUT "--let \$insert_timestamp = $insert_event\n";
- print OUTPUT "--let \$insert_timestamp2 = $insert_event_slave\n";
+ print OUTPUT "--let \$insert_timestamp2 = $insert_event_replica\n";
close (OUTPUT);
EOF
@@ -108,16 +118,16 @@ EOF
--let $ICT_UTC= `SELECT CONVERT_TZ('$immediate_commit_timestamp','SYSTEM','+00:00')`
--let $ICT_sec= `SELECT TIME_TO_SEC('$ICT_UTC')`
---let $insert_slave_sec= `SELECT TIME_TO_SEC('$insert_timestamp2')`
---let $insert_master_sec= `SELECT TIME_TO_SEC('$insert_timestamp')`
+--let $insert_replica_sec= `SELECT TIME_TO_SEC('$insert_timestamp2')`
+--let $insert_source_sec= `SELECT TIME_TO_SEC('$insert_timestamp')`
# verify that the delay is relative to the ICT and not relative to BEGIN or INSERT event.
--let $assert_text= Assert that the delay is relative to the immediate_commit_timestamp..
---let $assert_cond= $insert_slave_sec >= $ICT_sec + $delay
+--let $assert_cond= $insert_replica_sec >= $ICT_sec + $delay
--source include/assert.inc
--let $assert_text= Assert that the delay is not relative to the insert event timestamp or begining of transaction..
---let $assert_cond= $insert_slave_sec >= $insert_master_sec + 2 * $delay
+--let $assert_cond= $insert_replica_sec >= $insert_source_sec + 2 * $delay
--source include/assert.inc
# Cleanup
diff --git a/mysql-test/suite/rpl_nogtid/r/rpl_apply_binlog_with_gtid_when_gtid_mode_off.result b/mysql-test/suite/rpl_nogtid/r/rpl_apply_binlog_with_gtid_when_gtid_mode_off.result
index 24288df4849f..16ee60bd4679 100644
--- a/mysql-test/suite/rpl_nogtid/r/rpl_apply_binlog_with_gtid_when_gtid_mode_off.result
+++ b/mysql-test/suite/rpl_nogtid/r/rpl_apply_binlog_with_gtid_when_gtid_mode_off.result
@@ -25,7 +25,7 @@ call mtr.add_suppression("Replica worker thread has failed to apply an event");
call mtr.add_suppression("The replica coordinator and worker threads are stopped");
call mtr.add_suppression("Client requested source to start replication from position > file size");
include/rpl/wait_for_applier_error.inc [errno=1781]
-include/rpl/wait_for_receiver_error.inc [errno=13114]
+include/rpl/stop_replica.inc
RESET BINARY LOGS AND GTIDS;
RESET REPLICA;
include/rpl/start_replica.inc
diff --git a/mysql-test/suite/rpl_nogtid/t/rpl_apply_binlog_with_gtid_when_gtid_mode_off.test b/mysql-test/suite/rpl_nogtid/t/rpl_apply_binlog_with_gtid_when_gtid_mode_off.test
index dc0f762c7478..2413a998e274 100644
--- a/mysql-test/suite/rpl_nogtid/t/rpl_apply_binlog_with_gtid_when_gtid_mode_off.test
+++ b/mysql-test/suite/rpl_nogtid/t/rpl_apply_binlog_with_gtid_when_gtid_mode_off.test
@@ -55,18 +55,26 @@ call mtr.add_suppression("Client requested source to start replication from posi
--let $slave_sql_errno= convert_error(ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF)
--source include/rpl/wait_for_applier_error.inc
+# Cleanup
# Reset replica.
-#
-# But wait for IO thread to stop due to error first.
-# We copy binlog generated by a different server, thus position of the IO
-# thread is wrong with respect to the current source.
-# Therefore, we wait for: ER_SERVER_SOURCE_FATAL_ERROR_READING_BINLOG
---let $slave_io_errno= convert_error(ER_SERVER_SOURCE_FATAL_ERROR_READING_BINLOG)
---source include/rpl/wait_for_receiver_error.inc
+# On slower machines, when the SQL thread is killed due to error
+# ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF, it may happen that the IO
+# thread is also killed while it is still reading events from the binlog.
+# Moreover, we copy binlog generated by a different server, thus position
+# of the IO thread may be wrong with respect to the current source.
+# The IO thread may still be running/connecting after the applier stops.
+# Therefore, we use unconditional STOP REPLICA and enable the following errors:
+# CR_SERVER_LOST
+# ER_SERVER_SOURCE_FATAL_ERROR_READING_BINLOG
+--let $_server_source_fatal_error_reading_binlog= convert_error(ER_SERVER_SOURCE_FATAL_ERROR_READING_BINLOG)
+--let $slave_io_errno= 2013,$_server_source_fatal_error_reading_binlog
+--let $rpl_allow_error= 1
+--disable_warnings
+--source include/rpl/stop_replica.inc
+--enable_warnings
RESET BINARY LOGS AND GTIDS;
RESET REPLICA;
--source include/rpl/start_replica.inc
-# Cleanup
--source include/rpl/connection_source.inc
--source include/rpl/deinit.inc
diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_lazy_latch_init_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_lazy_latch_init_basic.result
new file mode 100644
index 000000000000..1fdc0ac6efa9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_lazy_latch_init_basic.result
@@ -0,0 +1,9 @@
+SELECT @@global.innodb_buffer_pool_lazy_latch_init;
+@@global.innodb_buffer_pool_lazy_latch_init
+0
+SET @@global.innodb_buffer_pool_lazy_latch_init = ON;
+ERROR HY000: Variable 'innodb_buffer_pool_lazy_latch_init' is a read only variable
+SET @@global.innodb_buffer_pool_lazy_latch_init = OFF;
+ERROR HY000: Variable 'innodb_buffer_pool_lazy_latch_init' is a read only variable
+SELECT @@session.innodb_buffer_pool_lazy_latch_init;
+ERROR HY000: Variable 'innodb_buffer_pool_lazy_latch_init' is a GLOBAL variable
diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_populate_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_populate_basic.result
new file mode 100644
index 000000000000..e24616fd701f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_populate_basic.result
@@ -0,0 +1,62 @@
+SET @start_global_value = @@global.innodb_buffer_pool_populate;
+SELECT @start_global_value;
+@start_global_value
+1
+Valid values are 'ON' and 'OFF'
+select @@global.innodb_buffer_pool_populate in (0, 1);
+@@global.innodb_buffer_pool_populate in (0, 1)
+1
+select @@global.innodb_buffer_pool_populate;
+@@global.innodb_buffer_pool_populate
+1
+select @@session.innodb_buffer_pool_populate;
+ERROR HY000: Variable 'innodb_buffer_pool_populate' is a GLOBAL variable
+show global variables like 'innodb_buffer_pool_populate';
+Variable_name Value
+innodb_buffer_pool_populate ON
+show session variables like 'innodb_buffer_pool_populate';
+Variable_name Value
+innodb_buffer_pool_populate ON
+select * from performance_schema.global_variables where variable_name='innodb_buffer_pool_populate';
+VARIABLE_NAME VARIABLE_VALUE
+innodb_buffer_pool_populate ON
+select * from performance_schema.session_variables where variable_name='innodb_buffer_pool_populate';
+VARIABLE_NAME VARIABLE_VALUE
+innodb_buffer_pool_populate ON
+set global innodb_buffer_pool_populate='ON';
+select @@global.innodb_buffer_pool_populate;
+@@global.innodb_buffer_pool_populate
+1
+set @@global.innodb_buffer_pool_populate=0;
+select @@global.innodb_buffer_pool_populate;
+@@global.innodb_buffer_pool_populate
+0
+set global innodb_buffer_pool_populate=1;
+select @@global.innodb_buffer_pool_populate;
+@@global.innodb_buffer_pool_populate
+1
+set @@global.innodb_buffer_pool_populate='OFF';
+select @@global.innodb_buffer_pool_populate;
+@@global.innodb_buffer_pool_populate
+0
+set session innodb_buffer_pool_populate='OFF';
+ERROR HY000: Variable 'innodb_buffer_pool_populate' is a GLOBAL variable and should be set with SET GLOBAL
+set @@session.innodb_buffer_pool_populate='ON';
+ERROR HY000: Variable 'innodb_buffer_pool_populate' is a GLOBAL variable and should be set with SET GLOBAL
+set global innodb_buffer_pool_populate=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_buffer_pool_populate'
+set global innodb_buffer_pool_populate=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_buffer_pool_populate'
+set global innodb_buffer_pool_populate=2;
+ERROR 42000: Variable 'innodb_buffer_pool_populate' can't be set to the value of '2'
+set global innodb_buffer_pool_populate=-3;
+ERROR 42000: Variable 'innodb_buffer_pool_populate' can't be set to the value of '-3'
+select @@global.innodb_buffer_pool_populate;
+@@global.innodb_buffer_pool_populate
+0
+set global innodb_buffer_pool_populate='AUTO';
+ERROR 42000: Variable 'innodb_buffer_pool_populate' can't be set to the value of 'AUTO'
+SET @@global.innodb_buffer_pool_populate = @start_global_value;
+SELECT @@global.innodb_buffer_pool_populate;
+@@global.innodb_buffer_pool_populate
+1
diff --git a/mysql-test/suite/sys_vars/r/innodb_lru_threads_basic.result b/mysql-test/suite/sys_vars/r/innodb_lru_threads_basic.result
new file mode 100644
index 000000000000..f2a17f69b789
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_lru_threads_basic.result
@@ -0,0 +1,27 @@
+#
+# Basic test for innodb_lru_threads (read-only)
+#
+SELECT @@GLOBAL.innodb_lru_threads;
+@@GLOBAL.innodb_lru_threads
+0
+SET GLOBAL innodb_lru_threads = OFF;
+ERROR HY000: Variable 'innodb_lru_threads' is a read only variable
+SET GLOBAL innodb_lru_threads = ON;
+ERROR HY000: Variable 'innodb_lru_threads' is a read only variable
+SELECT @@GLOBAL.innodb_lru_threads;
+@@GLOBAL.innodb_lru_threads
+0
+#
+# Startup with innodb_lru_threads=ON
+#
+# restart:--innodb-lru-threads=ON
+SELECT @@GLOBAL.innodb_lru_threads;
+@@GLOBAL.innodb_lru_threads
+1
+#
+# Startup with innodb_lru_threads=OFF
+#
+# restart
+SELECT @@GLOBAL.innodb_lru_threads;
+@@GLOBAL.innodb_lru_threads
+0
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
index adbb506eb3a8..77b303242dfa 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
@@ -107,6 +107,8 @@ buffer_LRU_search_scanned_per_call disabled
buffer_LRU_unzip_search_scanned disabled
buffer_LRU_unzip_search_num_scan disabled
buffer_LRU_unzip_search_scanned_per_call disabled
+buffer_LRU_single_page_flush_count disabled
+buffer_LRU_flush_await_count disabled
buffer_page_read_index_leaf disabled
buffer_page_read_index_non_leaf disabled
buffer_page_read_index_ibuf_leaf disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
index adbb506eb3a8..77b303242dfa 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
@@ -107,6 +107,8 @@ buffer_LRU_search_scanned_per_call disabled
buffer_LRU_unzip_search_scanned disabled
buffer_LRU_unzip_search_num_scan disabled
buffer_LRU_unzip_search_scanned_per_call disabled
+buffer_LRU_single_page_flush_count disabled
+buffer_LRU_flush_await_count disabled
buffer_page_read_index_leaf disabled
buffer_page_read_index_non_leaf disabled
buffer_page_read_index_ibuf_leaf disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
index adbb506eb3a8..77b303242dfa 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
@@ -107,6 +107,8 @@ buffer_LRU_search_scanned_per_call disabled
buffer_LRU_unzip_search_scanned disabled
buffer_LRU_unzip_search_num_scan disabled
buffer_LRU_unzip_search_scanned_per_call disabled
+buffer_LRU_single_page_flush_count disabled
+buffer_LRU_flush_await_count disabled
buffer_page_read_index_leaf disabled
buffer_page_read_index_non_leaf disabled
buffer_page_read_index_ibuf_leaf disabled
diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
index 88eeaaf46dca..eda84d8e40a1 100644
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
@@ -107,6 +107,8 @@ buffer_LRU_search_scanned_per_call disabled
buffer_LRU_unzip_search_scanned disabled
buffer_LRU_unzip_search_num_scan disabled
buffer_LRU_unzip_search_scanned_per_call disabled
+buffer_LRU_single_page_flush_count disabled
+buffer_LRU_flush_await_count disabled
buffer_page_read_index_leaf disabled
buffer_page_read_index_non_leaf disabled
buffer_page_read_index_ibuf_leaf disabled
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_lazy_latch_init_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_lazy_latch_init_basic.test
new file mode 100644
index 000000000000..b35298cb28e8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_lazy_latch_init_basic.test
@@ -0,0 +1,18 @@
+#
+# Basic test for innodb_buffer_pool_lazy_latch_init
+#
+# It is a read-only, global-only boolean that defaults to OFF.
+#
+
+# Check the default value.
+SELECT @@global.innodb_buffer_pool_lazy_latch_init;
+
+# It is read only: it cannot be changed at runtime.
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.innodb_buffer_pool_lazy_latch_init = ON;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.innodb_buffer_pool_lazy_latch_init = OFF;
+
+# It has only a global scope.
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.innodb_buffer_pool_lazy_latch_init;
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_populate_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_populate_basic.test
new file mode 100644
index 000000000000..96e742ebf0dc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_populate_basic.test
@@ -0,0 +1,60 @@
+#
+# Basic test for innodb_buffer_pool_populate
+#
+# It is a dynamic, global-only boolean that defaults to OFF.
+#
+
+SET @start_global_value = @@global.innodb_buffer_pool_populate;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_buffer_pool_populate in (0, 1);
+select @@global.innodb_buffer_pool_populate;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_buffer_pool_populate;
+show global variables like 'innodb_buffer_pool_populate';
+show session variables like 'innodb_buffer_pool_populate';
+--disable_warnings
+select * from performance_schema.global_variables where variable_name='innodb_buffer_pool_populate';
+select * from performance_schema.session_variables where variable_name='innodb_buffer_pool_populate';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_buffer_pool_populate='ON';
+select @@global.innodb_buffer_pool_populate;
+set @@global.innodb_buffer_pool_populate=0;
+select @@global.innodb_buffer_pool_populate;
+set global innodb_buffer_pool_populate=1;
+select @@global.innodb_buffer_pool_populate;
+set @@global.innodb_buffer_pool_populate='OFF';
+select @@global.innodb_buffer_pool_populate;
+--error ER_GLOBAL_VARIABLE
+set session innodb_buffer_pool_populate='OFF';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_buffer_pool_populate='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_buffer_pool_populate=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_buffer_pool_populate=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_buffer_pool_populate=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_buffer_pool_populate=-3;
+select @@global.innodb_buffer_pool_populate;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_buffer_pool_populate='AUTO';
+
+#
+# Cleanup
+#
+SET @@global.innodb_buffer_pool_populate = @start_global_value;
+SELECT @@global.innodb_buffer_pool_populate;
diff --git a/mysql-test/suite/sys_vars/t/innodb_lru_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_lru_threads_basic.test
new file mode 100644
index 000000000000..c2de5a7f5c48
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_lru_threads_basic.test
@@ -0,0 +1,29 @@
+--echo #
+--echo # Basic test for innodb_lru_threads (read-only)
+--echo #
+
+SELECT @@GLOBAL.innodb_lru_threads;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL innodb_lru_threads = OFF;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL innodb_lru_threads = ON;
+
+SELECT @@GLOBAL.innodb_lru_threads;
+
+--echo #
+--echo # Startup with innodb_lru_threads=ON
+--echo #
+
+--let $restart_parameters=restart:--innodb-lru-threads=ON
+--source include/restart_mysqld.inc
+SELECT @@GLOBAL.innodb_lru_threads;
+
+--echo #
+--echo # Startup with innodb_lru_threads=OFF
+--echo #
+
+--let $restart_parameters=restart
+--source include/restart_mysqld.inc
+SELECT @@GLOBAL.innodb_lru_threads;
diff --git a/mysql-test/suite/thread_pool/inc/admcon.inc b/mysql-test/suite/thread_pool/inc/admcon.inc
new file mode 100644
index 000000000000..0e1425b3c675
--- /dev/null
+++ b/mysql-test/suite/thread_pool/inc/admcon.inc
@@ -0,0 +1,10 @@
+# Temporarily GRANT TP_CONNECTION_ADMIN to root@localhost and
+# create the connection admcon which will end up in the admin
+# group. This is useful in order to be able to execute queries,
+# e.g. against performance_schema without affecting the state
+# of the normal thread groups.
+
+GRANT TP_CONNECTION_ADMIN ON *.* TO root@localhost;
+connect admcon,localhost,root,,,,,;
+connection default;
+REVOKE TP_CONNECTION_ADMIN ON *.* FROM root@localhost;
diff --git a/mysql-test/suite/thread_pool/inc/check_connect_kill.inc b/mysql-test/suite/thread_pool/inc/check_connect_kill.inc
new file mode 100644
index 000000000000..0acdc9ae4fee
--- /dev/null
+++ b/mysql-test/suite/thread_pool/inc/check_connect_kill.inc
@@ -0,0 +1,656 @@
+# Routine for checking
+# - connect, run some statement, disconnect
+# - kill connection, kill query of some connection
+# when either parallel connections or the affected connection itself (kill experiments)
+# are in some interesting state (high load, waiting for lock, inactive, user sleep etc.)
+# Therefore this test is a complement to the existing tests for kill, connect, disconnect
+# within the main testsuite.
+#
+# The variable $connections_to_add must be set before calling this routine.
+# Recommended values:
+# - @@global.thread_pool_size in case thread pooling functionality is loaded and
+# thread_pool_size > 1, @@global.thread_pool_size = 5 is recommended
+# - something like 5 in case thread pooling functionality is not available
+#
+# IMHO the weakest point within this routine is the statement $high_load.
+# It must have a runtime of clear more than ~30 seconds.
+#
+
+--echo # Check and generate prerequisites used in various tests.
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+# Attention: This is no test for the some storage engine.
+# MEMORY is used because it is a fast engine.
+CREATE TABLE t1 (connection_name VARCHAR(20), id BIGINT, PRIMARY KEY(connection_name))
+ENGINE = MEMORY;
+CREATE TABLE t2 (col1 BIGINT) ENGINE = MEMORY;
+INSERT INTO t2 VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(11);
+let $select_sleep= SELECT SLEEP(30);
+# The execution of the next statement must require >= ~30 seconds even on a box without
+# parallel load.
+# The WHERE condition should ensure that the optimizer has no chance to make the statement fast
+# and it should cause some work by the server.
+# ~ 47s, 8 table join with 43046721 rows result, 10 rows per table, tmpfs, one core 100%
+# ~ 110s, 8 table join with 100000000 rows result, 11 rows per table, tmpfs, one core 100%
+# There is no dramatic increase in performance when placing vardir on tmpfs instead of disc
+# based filesystem and the space consumption in vardir is rather low (> 100 MB).
+#
+let $high_load=
+SELECT COUNT(*)
+FROM t2 C1, t2 C2, t2 C3, t2 C4, t2 C5 , t2 C6 , t2 C7 , t2 C8
+WHERE C1.col1 <> 1 AND C2.col1 <> 2 AND C3.col1 <> 3 AND C4.col1 <> 4 AND C5.col1 <> 5
+ AND C6.col1 <> 6 AND C7.col1 <> 7 AND C8.col1 <> 8 ;
+
+
+# 1. Ensure that KILL works
+# 1.1 KILL of connection by other connection
+--echo #--------------------------------------
+--echo # 1.1.1 KILL other inactive connection.
+--echo #--------------------------------------
+let $connection= con_to_kill1;
+--echo # Establish connection $connection
+--connect ($connection, localhost, root,,)
+let $id_list= `SELECT CONNECTION_ID()`;
+
+--echo # Switch to connection default
+--connection default
+--echo # Poll till the just started session is visible within the processlist
+--echo # and command is "sleep".
+let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist
+WHERE id = $id_list AND command = 'sleep' AND info IS NULL;
+--source include/wait_condition.inc
+if(!$success)
+{
+ --echo # ERROR The just started session with id = $id_list did not reach the state with
+ --echo # command = 'sleep' AND info IS NULL
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --sleep 30
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --echo # abort
+ exit;
+}
+#
+--replace_result $id_list
+eval KILL $id_list;
+#
+--echo # Poll till the just killed session is no more visible within the processlist.
+--source ../inc/wait_until_disappeared.inc
+
+
+let $statement= $select_sleep;
+--echo #--------------------------------------------------
+--echo # 1.1.2 KILL other active connection which executes
+--echo # $statement
+--echo # and just does the "sleep" from the SELECT.
+--echo #--------------------------------------------------
+let $connection= con_to_kill2;
+--echo # Establish connection $connection
+--connect ($connection, localhost, root,,)
+let $id_list= `SELECT CONNECTION_ID()`;
+--echo # Send statement to the server, don't wait for results
+--send
+eval $statement;
+--echo # Switch to connection default
+--connection default
+--echo # Poll till the just started session and its SELECT is visible within the processlist
+--echo # and the state contains the string 'sleep'.
+let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist
+WHERE id = $id_list AND state LIKE '%sleep%' AND info = '$statement';
+--source include/wait_condition.inc
+if(!$success)
+{
+ --echo # ERROR The just started session with id = $id_list did not reach the state with
+ --echo # state LIKE '%sleep%' AND info = '$statement'
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --sleep 30
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --echo # abort
+ exit;
+}
+#
+--replace_result $id_list
+eval KILL $id_list;
+#
+--echo # Poll till the just killed session is no more visible within the processlist.
+--source ../inc/wait_until_disappeared.inc
+
+
+LOCK TABLE t1 WRITE;
+let $statement= SELECT * FROM t1;
+--echo #--------------------------------------------------
+--echo # 1.1.3 KILL other active connection which executes
+--echo # $statement
+--echo # and just waits for getting a lock.
+--echo #--------------------------------------------------
+let $connection= con_to_kill3;
+--echo # Establish connection $connection
+--connect ($connection, localhost, root,,)
+let $id_list= `SELECT CONNECTION_ID()`;
+--echo # Send statement to the server, don't wait for results
+--send
+eval $statement;
+--echo # Switch to connection default
+--connection default
+--echo # Poll till the just started session and its SELECT is visible within the processlist
+--echo # and the state contains the string 'lock'.
+let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist
+WHERE id = $id_list AND state LIKE '%lock%' AND info = "$statement";
+--source include/wait_condition.inc
+if(!$success)
+{
+ --echo # ERROR The just started session with id = $id_list did not reach the state with
+ --echo # state LIKE '%lock%' AND info = "$statement"
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --sleep 30
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --echo # abort
+ exit;
+}
+#
+--replace_result $id_list
+eval KILL $id_list;
+#
+--echo # Poll till the just killed session is no more visible within the processlist.
+--source ../inc/wait_until_disappeared.inc
+UNLOCK TABLES;
+
+
+let $statement= $high_load;
+--echo #--------------------------------------------------------------
+--echo # 1.1.4 KILL other active connection which executes a huge join
+--echo # and just causes a high load.
+--echo #--------------------------------------------------------------
+let $connection= con_to_kill4;
+--echo # Establish connection $connection
+--connect ($connection, localhost, root,,)
+let $id_list= `SELECT CONNECTION_ID()`;
+--echo # Send statement to the server, don't wait for results
+--send
+eval $statement;
+--echo # Switch to connection default
+--connection default
+--echo # Poll till the just started session and its SELECT is visible within the processlist
+--echo # and time > 0.
+let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist
+WHERE id = $id_list AND time > 0 AND info = "$statement";
+--source include/wait_condition.inc
+if(!$success)
+{
+ --echo # ERROR The just started session with id = $id_list did not reach the state with
+ --echo # time > 0 AND info = "$statement"
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --sleep 30
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --echo # abort
+ exit;
+}
+#
+--replace_result $id_list
+eval KILL $id_list;
+#
+--echo # Poll till the just killed session is no more visible within the processlist.
+--source ../inc/wait_until_disappeared.inc
+
+
+--echo #--------------------------------
+--echo # 1.2 KILL own active connection.
+--echo #--------------------------------
+let $connection= con_to_kill5;
+--echo # Establish connection $connection
+--connect ($connection, localhost, root,,)
+let $id_list= `SELECT CONNECTION_ID()`;
+#
+--error ER_QUERY_INTERRUPTED
+KILL CONNECTION_ID();
+#
+--echo # Switch to connection default
+--connection default
+--echo # Poll till the just killed session is no more visible within the processlist.
+--source ../inc/wait_until_disappeared.inc
+
+
+# 2. Ensure that KILL QUERY works.
+let $statement= $select_sleep;
+--echo #------------------------------------------------------------
+--echo # 2.1 KILL ongoing query of another connection which executes
+--echo # $statement
+--echo # and just does the "sleep" from the SELECT.
+--echo #------------------------------------------------------------
+let $connection= con_to_kill6;
+--echo # Establish connection $connection
+--connect ($connection, localhost, root,,)
+let $id_list= `SELECT CONNECTION_ID()`;
+--echo # Send statement to the server, reap result later
+--send
+eval $statement;
+--echo # Switch to connection default
+--connection default
+--echo # Poll till execution of '$statement' has started
+let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist
+WHERE id = $id_list AND state LIKE '%sleep%' AND info = "$statement";
+--source include/wait_condition.inc
+if(!$success)
+{
+ --echo # ERROR The just started session with id = $id_list did not reach the state with
+ --echo # state LIKE '%sleep%' AND info = "$statement"
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --sleep 30
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --echo # abort
+ exit;
+}
+#
+--replace_result $id_list
+eval KILL QUERY $id_list;
+#
+--echo # Switch to connection $connection
+--connection $connection
+# The session should exist and be not damaged.
+# -> Reap should report that the query was interrupted.
+--echo # Reap result
+# I am unsure if it is correct that the server response is not ER_QUERY_INTERRUPTED
+# --error ER_QUERY_INTERRUPTED
+--reap
+--echo # Switch to connection default
+--connection default
+
+LOCK TABLE t1 WRITE;
+let $statement= SELECT * FROM t1;
+--echo #------------------------------------------------------------
+--echo # 2.2 KILL ongoing query of another connection which executes
+--echo # $statement
+--echo # and just waits for getting a lock.
+--echo #------------------------------------------------------------
+--echo # Switch to connection $connection
+--connection $connection
+let $id_list= `SELECT CONNECTION_ID()`;
+--echo # Send statement to the server, reap result later
+--send
+eval $statement;
+--echo # Switch to connection default
+--connection default
+--echo # Poll till execution of '$statement' has started
+--echo # and state contains the string 'lock'
+let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist
+WHERE id = $id_list AND state LIKE '%lock%' AND info = "$statement";
+--source include/wait_condition.inc
+if(!$success)
+{
+ --echo # ERROR The session with id = $id_list did not reach the state with
+ --echo # state LIKE '%lock%' AND info = "$statement"
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --sleep 30
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --echo # abort
+ exit;
+}
+#
+--replace_result $id_list
+eval KILL QUERY $id_list;
+#
+--echo # Switch to connection $connection
+--connection $connection
+# The session should exist and be not damaged.
+# -> Reap should report that the query was interrupted.
+--echo # Reap result
+--error ER_QUERY_INTERRUPTED
+--reap
+--connection default
+UNLOCK TABLES;
+
+let $statement= $high_load;
+--echo #------------------------------------------------------------
+--echo # 2.3 KILL ongoing query of another connection which executes
+--echo # a huge join and just causes a high load.
+--echo #------------------------------------------------------------
+--echo # Switch to connection $connection
+--connection $connection
+let $id_list= `SELECT CONNECTION_ID()`;
+--echo # Send statement to the server, reap result later
+--send
+eval $statement;
+--echo # Switch to connection default
+--connection default
+--echo # Poll till the execution of '$statement' has started
+--echo # and time > 0.
+let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist
+WHERE id = $id_list AND time > 0 AND info = "$statement";
+--source include/wait_condition.inc
+if(!$success)
+{
+ --echo # ERROR The session with id = $id_list did not reach the state with
+ --echo # time > 0 AND info = "$statement"
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --sleep 30
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --echo # abort
+ exit;
+}
+#
+--replace_result $id_list
+eval KILL QUERY $id_list;
+#
+--echo # Switch to connection $connection
+--connection $connection
+# The session should exist and be not damaged.
+# -> Reap should report that the query was interrupted.
+--echo # Reap result
+--error ER_QUERY_INTERRUPTED
+--reap
+
+--echo #-------------------------------------
+--echo # 2.4 KILL own query (pathologic case)
+--echo #-------------------------------------
+--echo # Switch to connection $connection
+--connection $connection
+#
+--error ER_QUERY_INTERRUPTED
+KILL QUERY CONNECTION_ID();
+#
+--echo # Switch to connection default
+--connection default
+--echo # Poll till it becomes visible that the connection $connection is
+--echo # inactive.
+let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist
+WHERE id = $id_list AND command = 'sleep' AND info IS NULL;
+--source include/wait_condition.inc
+if(!$success)
+{
+ --echo # ERROR The session with id = $id_list did not reach the state with
+ --echo # command = 'sleep' AND info IS NULL
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --sleep 30
+ eval SELECT * FROM information_schema.processlist WHERE id = $id_list;
+ --echo # abort
+ exit;
+}
+
+
+--echo #---------------------------------
+--echo # 3. Disconnect current connection
+--echo #---------------------------------
+--echo # Switch to connection $connection
+--connection $connection
+#
+--echo # Disconnect connection $connection
+--disconnect $connection
+#
+--connection default
+--echo # Poll till the connection $connection disappeared from the processlist.
+--source ../inc/wait_until_disappeared.inc
+
+
+--echo #--------------------------------------------------------------
+--echo # 4. Thread pool group related tests
+--echo # In case these tests are applied to a server without thread
+--echo # pooling than the comments are partially no more valid.
+--echo #--------------------------------------------------------------
+# Ensure that some connection A (we have one per thread group) executing some statement and just
+# being in the state
+# - "user sleep"
+# - wait for some lock
+# - cause a high load
+# does not prevent that
+# 1. some new connection "con_extra" to the thread group containing A could be established, run
+# some statement and disconnect
+# 2. some existing connection C being in whatever thread group could kill the query executed by all
+# connections A in every thread group
+--echo # Establish connections_to_add (= thread_pool_size if possible) additional connections
+--echo # so that every thread group contains one of these additional connections.
+let $run= $connections_to_add;
+--disable_query_log
+while($run)
+{
+ --connect (con$run, localhost, root,,)
+ eval INSERT INTO t1 SET connection_name = 'con$run', id = CONNECTION_ID();
+ dec $run;
+}
+--connection default
+--enable_query_log
+--echo # Switch to connection default
+--connection default
+--replace_result $connections_to_add
+eval SELECT COUNT(*) = $connections_to_add AS "Expect 1" FROM t1;
+
+
+let $statement= $select_sleep;
+--echo #-------------------------------------------------------------------------
+--echo # 4.1 Have within every thread group a connection A executing
+--echo # $statement
+--echo # and just doing the "sleep" from the SELECT.
+--echo # Show that
+--echo # - con_extra: connect, run some statement, disconnect
+--echo # - default: run SELECT ... and KILL QUERY
+--echo # works.
+--echo #-------------------------------------------------------------------------
+let $run= $connections_to_add;
+--disable_query_log
+while($run)
+{
+ --connection con$run
+ --send
+ eval $statement;
+ dec $run;
+}
+--enable_query_log
+--echo # Switch to connection default
+--connection default
+--echo # Poll till connections_to_add connections are busy with their statement.
+let $wait_condition= SELECT COUNT(*) = $connections_to_add FROM information_schema.processlist
+ WHERE state LIKE '%sleep%' AND info = '$statement';
+--source include/wait_condition.inc
+if(!$success)
+{
+ --echo # ERROR The $connections_to_add sessions did not reach the state with
+ --echo # state LIKE '%sleep%' AND info = '$statement'
+ SELECT * FROM information_schema.processlist;
+ --sleep 30
+ SELECT * FROM information_schema.processlist;
+ --echo # abort
+ exit;
+}
+
+let $connection= con_extra;
+--echo # Establish connection $connection
+--connect ($connection, localhost, root,,)
+let $id_list= `SELECT CONNECTION_ID()`;
+--replace_result $connections_to_add
+eval SET @connections_to_add = $connections_to_add;
+eval SELECT COUNT(*) = @connections_to_add AS "Expect 1" FROM information_schema.processlist
+WHERE info = '$statement';
+--echo # Switch to connection default
+--connection default
+--echo # Disconnect the additional session $connection
+--disconnect $connection
+--echo # Poll till the connection $connection disappeared from the processlist.
+--source ../inc/wait_until_disappeared.inc
+
+--echo # KILL the queries of all additional sessions (printing is suppressed).
+let $run= $connections_to_add;
+--disable_query_log
+while($run)
+{
+ eval SELECT id INTO @target_id FROM t1 WHERE connection_name = 'con$run';
+ KILL QUERY @target_id;
+ dec $run;
+}
+--enable_query_log
+--echo # Let all additional sessions reap their results (printing is suppressed).
+--disable_result_log
+let $run= $connections_to_add;
+while($run)
+{
+ --connection con$run
+ --reap
+ dec $run;
+}
+--enable_result_log
+--echo # Switch to connection default
+--connection default
+
+
+LOCK TABLE t1 WRITE;
+let $statement= SELECT * FROM t1;
+--echo #-------------------------------------------------------------------------
+--echo # 4.2 Have within every thread group a connection A executing
+--echo # $statement
+--echo # and just waiting for a lock.
+--echo # Show that
+--echo # - con_extra: connect, run some statement, disconnect
+--echo # - default: run SELECT ... and KILL QUERY
+--echo # works.
+--echo #-------------------------------------------------------------------------
+let $run= $connections_to_add;
+--disable_query_log
+while($run)
+{
+ --connection con$run
+ --send
+ eval $statement;
+ dec $run;
+}
+--enable_query_log
+--echo # Switch to connection default
+--connection default
+--echo # Poll till connections_to_add connections are busy with their statement.
+let $wait_condition= SELECT COUNT(*) = $connections_to_add FROM information_schema.processlist
+ WHERE state LIKE '%lock%' AND info = '$statement';
+--source include/wait_condition.inc
+if(!$success)
+{
+ --echo # ERROR The $connections_to_add sessions did not reach the state with
+ --echo # state LIKE '%lock%' AND info = '$statement'
+ SELECT * FROM information_schema.processlist;
+ --sleep 30
+ SELECT * FROM information_schema.processlist;
+ --echo # abort
+ exit;
+}
+
+let $connection= con_extra;
+--echo # Establish connection $connection
+--connect ($connection, localhost, root,,)
+let $id_list= `SELECT CONNECTION_ID()`;
+--replace_result $connections_to_add
+eval SET @connections_to_add = $connections_to_add;
+eval SELECT COUNT(*) = @connections_to_add AS "Expect 1" FROM information_schema.processlist
+WHERE info = '$statement';
+--echo # Switch to connection default
+--connection default
+--echo # Disconnect the additional session $connection
+--disconnect $connection
+--echo # Poll till the connection $connection disappeared from the processlist.
+--source ../inc/wait_until_disappeared.inc
+
+--echo # KILL the queries of all additional sessions (printing is suppressed).
+let $run= $connections_to_add;
+--disable_query_log
+while($run)
+{
+ eval SELECT id INTO @target_id FROM t1 WHERE connection_name = 'con$run';
+ KILL QUERY @target_id;
+ dec $run;
+}
+--enable_query_log
+
+--echo # Let all additional sessions reap their results (printing is suppressed).
+--disable_result_log
+let $run= $connections_to_add;
+while($run)
+{
+ --connection con$run
+ --error ER_QUERY_INTERRUPTED
+ --reap
+ dec $run;
+}
+--enable_result_log
+--echo # Switch to connection default
+--connection default
+UNLOCK TABLES;
+
+
+let $statement= $high_load;
+--echo #-------------------------------------------------------------------------
+--echo # 4.3 Have within every thread group a connection A executing a huge join
+--echo # and just causing high load.
+--echo # Show that
+--echo # - con_extra: connect, run some statement, disconnect
+--echo # works.
+--echo #-------------------------------------------------------------------------
+let $run= $connections_to_add;
+--disable_query_log
+while($run)
+{
+ --connection con$run
+ --send
+ eval $statement;
+ dec $run;
+}
+--enable_query_log
+--echo # Switch to connection default
+--connection default
+--echo # Poll till connections_to_add connections are busy with their statement.
+let $wait_condition= SELECT COUNT(*) = $connections_to_add FROM information_schema.processlist
+ WHERE time > 0 AND info = '$statement';
+--source include/wait_condition.inc
+if(!$success)
+{
+ --echo # ERROR The $connections_to_add sessions did not reach the state with
+ --echo # time > 0 AND info = '$statement'
+ SELECT * FROM information_schema.processlist;
+ --sleep 30
+ SELECT * FROM information_schema.processlist;
+ --echo # abort
+}
+
+let $connection= con_extra;
+--echo # Establish connection $connection
+--connect ($connection, localhost, root,,)
+--replace_result $connections_to_add
+eval SET @connections_to_add = $connections_to_add;
+eval SELECT COUNT(*) = @connections_to_add AS "Expect 1" FROM information_schema.processlist
+WHERE info = '$statement';
+let $id_list= `SELECT CONNECTION_ID()`;
+--echo # Switch to connection default
+--connection default
+--echo # Disconnect the additional session $connection
+--disconnect $connection
+--echo # Poll till the connection $connection disappeared from the processlist.
+--source ../inc/wait_until_disappeared.inc
+--enable_query_log
+
+
+--echo #--------------------------------------------------------------------------------------
+--echo # 4.4 Reveal that some session having another session causing high load within the same
+--echo # thread group is able to KILL this other session.
+--echo #--------------------------------------------------------------------------------------
+--echo # KILL the queries of all additional sessions (printing is suppressed).
+let $run= $connections_to_add;
+--disable_query_log
+while($run)
+{
+ eval SELECT id INTO @target_id FROM t1 WHERE connection_name = 'con$run';
+ KILL @target_id;
+ dec $run;
+}
+--enable_query_log
+--echo # Poll till there is no connection running which has an id occurring in t1
+let $wait_condition= SELECT COUNT(*) = 0 FROM information_schema.processlist
+ WHERE id IN (SELECT id FROM t1);
+--source include/wait_condition.inc
+if(!$success)
+{
+ --echo # ERROR Not all sessions disappeared from processlist
+ SELECT * FROM information_schema.processlist WHERE id IN (SELECT id FROM t1);
+ --sleep 30
+ SELECT * FROM information_schema.processlist WHERE id IN (SELECT id FROM t1);
+ --echo # abort
+ exit;
+}
+
+# Cleanup
+DROP TABLE t1;
+DROP TABLE t2;
+
diff --git a/mysql-test/suite/thread_pool/inc/coverage.inc b/mysql-test/suite/thread_pool/inc/coverage.inc
new file mode 100644
index 000000000000..fff166154317
--- /dev/null
+++ b/mysql-test/suite/thread_pool/inc/coverage.inc
@@ -0,0 +1,23 @@
+# Experiments with thread_pool_func4 and this include file revealed that these
+# three selects have a good impact on the code coverage in thread_pool.cc
+# (10 extra lines covered).
+#
+# The main property of thread_pool_func4 is:
+# Have a lot activity of concurrent sessions which have a strong impact
+# on the content of thread_pool related information_schema tables.
+#
+# Therefore this include file gets sourced in all thread_pool tests which
+# run with concurrent sessions.
+# The printing of the result sets must be suppressed because the content
+# depends on preceding tests, current load on testing box etc.
+#
+--echo # Printing of result sets is disabled.
+--disable_result_log
+SELECT * FROM information_schema.TP_THREAD_GROUP_STATS;
+SELECT * FROM information_schema.TP_THREAD_GROUP_STATE;
+SELECT * FROM information_schema.TP_THREAD_STATE;
+SELECT * FROM performance_schema.tp_thread_group_stats;
+SELECT * FROM performance_schema.tp_thread_group_state;
+SELECT * FROM performance_schema.tp_thread_state;
+--enable_result_log
+
diff --git a/mysql-test/suite/thread_pool/inc/func2.inc b/mysql-test/suite/thread_pool/inc/func2.inc
new file mode 100644
index 000000000000..9182ed4f4065
--- /dev/null
+++ b/mysql-test/suite/thread_pool/inc/func2.inc
@@ -0,0 +1,62 @@
+# Routine to be sourced by
+# plugin/thread_pool/tests/mtr/t/thread_pool_func2a.test
+# plugin/thread_pool/tests/mtr/t/thread_pool_func2b.test
+#
+# Purpose:
+# Check how different values of "pool of threads" variables show up within the
+# content of performance_schema.tp_thread_group_state
+#
+# thread_pool_func2a and thread_pool_func2b differ only within
+# - the values of "pool of threads" variables assigned at server startup
+# --> plugin/thread_pool/tests/mtr/t/thread_pool_func2?-master.opt
+# - the files with expected results
+# --> plugin/thread_pool/tests/mtr/r/thread_pool_func2?.result
+# where the current values of "pool of threads" variables are printed
+#
+# Note:
+# - These tests are not intended to show how the content of
+# performance_schema.tp_thread_group_state changes depending on activity
+# within the server.
+# - Please take care that all values of the variables differ between both
+# tests.
+#
+# Author:
+# 2010-12-17 mleich develop tests for WL#5136 New Thread pool design
+#
+
+SET @admin_thread_groups = 1;
+
+--echo # 0. Print the current setting of "pool of threads" variables which
+--echo # were assigned at server startup.
+SELECT @@global.thread_pool_size, @@global.thread_pool_algorithm,
+ @@global.thread_pool_prio_kickup_timer, @@global.thread_pool_stall_limit;
+
+--echo # 1. We must have thread_pool_size different thread group id's within the table.
+SELECT COUNT(DISTINCT TP_GROUP_ID) = @@global.thread_pool_size + @admin_thread_groups AS "Expect 1"
+FROM performance_schema.tp_thread_group_state;
+
+--echo # 2. All thread pool groups have the same values for the columns
+--echo # STALL_LIMIT, PRIO_KICKUP_TIMER, ALGORITHM
+SELECT COUNT(DISTINCT STALL_LIMIT) = 1
+ AND COUNT(DISTINCT PRIO_KICKUP_TIMER) = 1
+ AND COUNT(DISTINCT ALGORITHM) = 1
+AS "Expect 1"
+FROM performance_schema.tp_thread_group_state;
+
+--echo # 3. Check the current values of the columns STALL_LIMIT, PRIO_KICKUP_TIMER, ALGORITHM
+--echo # against the content of the "pool of threads" variables
+# STALL_LIMIT is the plugin's internal representation, in 10ms units
+# (PERCONA_THREADPOOL_COMPAT mode: @@GLOBAL.thread_pool_stall_limit is the
+# server-owned (Percona) sysvar, in milliseconds; converting it with the
+# same clamp(ceil(ms/10), 4, 600) formula the plugin itself uses --
+# see percona_stall_limit_to_plugin_units() in
+# plugin/thread_pool/src/thread_pool.h -- must match STALL_LIMIT).
+SELECT STALL_LIMIT = LEAST(GREATEST(CEIL(@@GLOBAL.thread_pool_stall_limit / 10), 4), 600)
+ AND PRIO_KICKUP_TIMER = @@GLOBAL.thread_pool_prio_kickup_timer
+ AND ALGORITHM = CASE @@GLOBAL.thread_pool_algorithm
+ WHEN 0 THEN 'Low Concurrency'
+ WHEN 1 THEN 'High Concurrency'
+ ELSE 'Not expected algorithm' END
+ AS "Expect 1"
+FROM performance_schema.tp_thread_group_state LIMIT 1;
+
diff --git a/mysql-test/suite/thread_pool/inc/func4.inc b/mysql-test/suite/thread_pool/inc/func4.inc
new file mode 100644
index 000000000000..ab904208a59b
--- /dev/null
+++ b/mysql-test/suite/thread_pool/inc/func4.inc
@@ -0,0 +1,476 @@
+### 0. $worker_count must be so big that we can distinct the
+# thread pool groups
+if($worker_count < 3)
+{
+ --enable_query_log
+ --enable_result_log
+ --echo # ERROR: worker_count = $worker_count but must be >= 3
+ --echo # abort
+ exit;
+}
+
+### 1. Actualize mysqltest.book_keeping
+--disable_query_log
+--disable_result_log
+if($DEBUG)
+{
+ --enable_query_log
+ --enable_result_log
+}
+TRUNCATE mysqltest.book_keeping;
+TRUNCATE mysqltest.start_statistics;
+let $num= $worker_count;
+while($num)
+{
+ eval INSERT INTO mysqltest.book_keeping
+ SET worker_id = $num,
+ session_id = NULL,
+ worker_type = NULL,
+ counter = NULL,
+ mysql_errno = NULL;
+ dec $num;
+}
+
+eval UPDATE mysqltest.book_keeping SET
+ worker_type = 'first',
+ high_priority_connection = @first_high_priority_connection,
+ task_size = @first_size, task_transaction = @first_transaction,
+ task_prepared = @first_prepared
+WHERE $first;
+eval UPDATE mysqltest.book_keeping SET
+ worker_type = 'second',
+ high_priority_connection = @second_high_priority_connection,
+ task_size = @second_size, task_transaction = @second_transaction,
+ task_prepared = @second_prepared
+WHERE NOT $first;
+if($DEBUG)
+{
+ SELECT * FROM mysqltest.book_keeping ORDER BY worker_id;
+ SELECT * FROM information_schema.processlist WHERE DB = 'mysqltest' ORDER BY ID;
+}
+# Check consistency of mysqltest.book_keeping
+if(`SELECT COUNT(*) <> 0 FROM mysqltest.book_keeping
+ WHERE session_id IS NOT NULL
+ OR counter IS NOT NULL
+ OR mysql_errno IS NOT NULL`)
+{
+ --enable_query_log
+ --enable_result_log
+ --echo # ERROR: Content of mysqltest.book_keeping is inconsistent
+ SELECT * FROM mysqltest.book_keeping
+ WHERE session_id IS NOT NULL
+ OR counter IS NOT NULL
+ OR mysql_errno IS NOT NULL
+ ORDER BY worker_id;
+ --echo # abort
+ exit;
+}
+if(`SELECT COUNT(*) = 0 FROM mysqltest.book_keeping`)
+{
+ --echo # ERROR: mysqltest.book_keeping must be not empty
+ SELECT * FROM mysqltest.book_keeping;
+ --echo # abort
+ exit;
+}
+
+
+--connection locker
+LOCK TABLES mysqltest.to_lock WRITE;
+--connection default
+
+### 2. Start the worker sessions
+let $worker_script= $MYSQL_TEST_DIR/suite/thread_pool/inc/worker.test;
+let $current_id= `SELECT MIN(worker_id) FROM mysqltest.book_keeping
+ WHERE session_id IS NULL`;
+let $its_windows= `SELECT CONVERT(@@version_compile_os USING latin1) IN ("Win32","Win64","Windows") = 1`;
+let $num= `SELECT COUNT(worker_id) FROM mysqltest.book_keeping`;
+while($num)
+{
+ let $worker_stdout= $MYSQLTEST_VARDIR/tmp/$current_id.out;
+ let $worker_stderr= $MYSQLTEST_VARDIR/tmp/$current_id.err;
+
+ if (!$its_windows)
+ {
+ --exec $MYSQL_TEST --test-file=$worker_script > $worker_stdout 2>$worker_stderr &
+ }
+ if ($its_windows)
+ {
+ # When calling "--exec ... &" in Windows the parent seems to wait for the child to exit.
+ # Therefore we have to go with a different solution for this OS.
+ let MYSQLTEST_WORKER_SCRIPT = $worker_script;
+ let MYSQLTEST_WORKER_STDOUT = $worker_stdout;
+ let MYSQLTEST_WORKER_STDERR = $worker_stderr;
+ let MYSQLTEST_BIN = $MYSQL_TEST;
+ --perl
+ my $worker_script = $ENV{'MYSQLTEST_WORKER_SCRIPT'};
+ my $worker_stdout = $ENV{'MYSQLTEST_WORKER_STDOUT'};
+ my $worker_stderr = $ENV{'MYSQLTEST_WORKER_STDERR'};
+ my $mysqltest_bin = $ENV{'MYSQLTEST_BIN'};
+ $SIG{CHLD} = 'IGNORE';
+ my $pid = fork();
+ if (not defined $pid)
+ {
+ die "forking of a new mysqltest client failed";
+ }
+ # Perl manual
+ # Process | sees in $pid
+ # ---------------------------------
+ # parent | process id of the child
+ # child | 0
+ #
+ # On Linux we would let the child ($pid ==0) do the exec whereas the parent would not wait
+ # till the child disappears. This doesn't work on WIN where the parent would wait.
+ # Here we let the parent run the exec whereas the child can go forward without waiting.
+ if (defined $pid && $pid != 0 )
+ {
+ open(STDOUT,">", "$worker_stdout") || die "Can't redirect stdout to '$worker_stdout'";
+ open(STDERR,">", "$worker_stderr") || die "Can't redirect stderr to '$worker_stderr'";
+ # 1 -> Force a flush on every write or print.
+ $| = 1;
+ my @mysqltest_with_args = split(' ', $mysqltest_bin);
+ push @mysqltest_with_args, "-x";
+ push @mysqltest_with_args, "$worker_script";
+ exec(@mysqltest_with_args);
+ # exec will not return therefore the next line shouldn't be reached.
+ print STDERR "exec of (@mysqltest_with_args) failed with: $! though it shouldn't return at all\n";
+ print STDERR "(see $worker_stderr and $worker_stdout)\n";
+ exit;
+ }
+ EOF
+ }
+
+ # Wait till the worker session shows up in mysqltest.book_keeping
+ let $wait_timeout= 10;
+ let $wait_condition=
+ SELECT COUNT(*) = 1 FROM mysqltest.book_keeping
+ WHERE worker_id = $current_id AND session_id IS NOT NULL;
+ --source include/wait_condition.inc
+ if(!$success)
+ {
+ --enable_query_log
+ --enable_result_log
+ --echo # ERROR: Worker session did not show up like expected
+ --echo # session_id must be no more NULL
+ eval SELECT * FROM mysqltest.book_keeping
+ WHERE worker_id = $current_id;
+ SELECT * FROM information_schema.processlist
+ WHERE DB = 'mysqltest'
+ ORDER BY ID;
+ --echo # Sorry have to abort
+ exit;
+ }
+ # We have two thread_groups and all workers must be within the same.
+ # The next connection will be send into the other thread_group.
+ # Make some connect + disconnect.
+ --connect (dummy, localhost, root,,)
+ --disconnect dummy
+ --connection default
+ let $current_id= `SELECT MIN(worker_id) FROM mysqltest.book_keeping
+ WHERE session_id IS NULL`;
+ # empty -> SELECT gave NULL -> we have started all required worker threads
+ # In case we would go with this value into the while loop again than we
+ # would be in trouble. But $num will be decremented and become 0.
+
+ dec $num;
+}
+--disable_query_log
+--disable_result_log
+if($DEBUG)
+{
+ --enable_query_log
+ --enable_result_log
+ SELECT * FROM information_schema.processlist WHERE DB = 'mysqltest' ORDER BY ID;
+ SELECT * FROM mysqltest.book_keeping ORDER BY worker_id;
+}
+
+# Wait till all worker sessions are waiting for the MDL lock on mysqltest.to_lock.
+# If the workers reach this point than we can be sure that they have set their
+# high_priority_connection value.
+let $wait_condition=
+SELECT COUNT(*) = $worker_count FROM information_schema.processlist
+WHERE STATE = 'Waiting for table metadata lock'
+ AND DB = 'mysqltest';
+--source include/wait_condition.inc
+if(!$success)
+{
+ --enable_query_log
+ --enable_result_log
+ --echo # ERROR: Not all worker sessions are waiting for the MDL lock
+ SELECT * FROM information_schema.processlist
+ WHERE DB = 'mysqltest'
+ ORDER BY ID;
+ SELECT * FROM mysqltest.book_keeping
+ ORDER BY worker_id;
+ --echo # Sorry have to abort
+ exit;
+}
+
+--disable_query_log
+--disable_result_log
+if($DEBUG)
+{
+ --enable_query_log
+ --enable_result_log
+ SELECT * FROM information_schema.processlist WHERE DB = 'mysqltest' ORDER BY ID;
+ SELECT * FROM mysqltest.book_keeping ORDER BY worker_id;
+}
+
+# Preserve the current counters from performance_schema.tp_thread_group_stats
+eval INSERT INTO mysqltest.start_statistics (WHAT,$statistics_column_list)
+SELECT 'before',$statistics_column_list
+FROM performance_schema.tp_thread_group_stats
+WHERE CONNECTIONS_STARTED - CONNECTIONS_CLOSED = $worker_count;
+
+--disable_query_log
+--disable_result_log
+if($DEBUG)
+{
+ --enable_query_log
+ --enable_result_log
+ SELECT * FROM mysqltest.start_statistics;
+}
+
+### 3. Start the race.
+--connection locker
+UNLOCK TABLES;
+
+--connection default
+let $num= $run_time;
+while($num)
+{
+ --sleep 1
+ dec $num;
+}
+--disable_query_log
+--disable_result_log
+if($DEBUG)
+{
+ --enable_query_log
+ --enable_result_log
+ SELECT * FROM information_schema.processlist WHERE DB = 'mysqltest' ORDER BY ID;
+}
+
+### 4. Stop the race.
+--connection locker
+LOCK TABLES mysqltest.to_lock WRITE;
+
+--connection default
+# Wait till all worker sessions are waiting for the MDL lock on mysqltest.to_lock.
+let $wait_timeout= 20;
+let $wait_condition=
+SELECT COUNT(*) = $worker_count FROM information_schema.processlist
+WHERE STATE = 'Waiting for table metadata lock'
+ AND DB = 'mysqltest';
+--source include/wait_condition.inc
+if(!$success)
+{
+ --enable_query_log
+ --enable_result_log
+ --echo # ERROR: Not all worker sessions are again waiting for the MDL lock
+ SELECT * FROM information_schema.processlist
+ WHERE DB = 'mysqltest'
+ ORDER BY ID;
+ --echo # Sorry have to abort
+ exit;
+}
+# include/wait_condition.inc above switched protocolling on
+--disable_query_log
+--disable_result_log
+if($DEBUG)
+{
+ --enable_query_log
+ --enable_result_log
+ SELECT * FROM information_schema.processlist WHERE DB = 'mysqltest' ORDER BY ID;
+}
+
+
+# Preserve the current counters from performance_schema.tp_thread_group_stats
+eval INSERT INTO mysqltest.start_statistics (WHAT,$statistics_column_list)
+SELECT 'after',$statistics_column_list
+FROM performance_schema.tp_thread_group_stats
+WHERE CONNECTIONS_STARTED - CONNECTIONS_CLOSED = $worker_count;
+--disable_query_log
+--disable_result_log
+if($DEBUG)
+{
+ --enable_query_log
+ --enable_result_log
+ SELECT * FROM mysqltest.start_statistics;
+}
+
+
+### 5. Signal the worker sessions to terminate
+# 5.1 Kill the current queries of the worker sessions
+--disable_query_log
+--disable_result_log
+if($DEBUG)
+{
+ --enable_query_log
+ --enable_result_log
+}
+
+SELECT * FROM information_schema.processlist WHERE DB = 'mysqltest' ORDER BY ID;
+SELECT MIN(worker_id) INTO @kill_worker_id FROM mysqltest.book_keeping;
+let $num= $worker_count;
+while($num)
+{
+ SELECT session_id into @kill_id FROM mysqltest.book_keeping
+ WHERE worker_id = @kill_worker_id;
+ KILL QUERY @kill_id;
+ SET @kill_worker_id = @kill_worker_id + 1;
+ dec $num;
+}
+
+--disable_query_log
+--disable_result_log
+if($DEBUG)
+{
+ --enable_query_log
+ --enable_result_log
+ SELECT * FROM information_schema.processlist WHERE DB = 'mysqltest' ORDER BY ID;
+ SELECT * FROM mysqltest.book_keeping ORDER BY worker_id;
+}
+
+# 5.2 Wait till all worker sessions have disappeared from information_schema.processlist
+let $wait_condition=
+SELECT COUNT(*) = 0 FROM information_schema.processlist
+WHERE DB = 'mysqltest';
+--source include/wait_condition.inc
+if(!$success)
+{
+ --enable_query_log
+ --enable_result_log
+ --echo # ERROR: Not all worker sessions disappeared from information_schema.processlist
+ SELECT * FROM information_schema.processlist
+ WHERE DB = 'mysqltest';
+ --echo # Sorry have to abort
+ exit;
+}
+--disable_query_log
+--disable_result_log
+if($DEBUG)
+{
+ --enable_query_log
+ --enable_result_log
+ SELECT * FROM information_schema.processlist WHERE DB = 'mysqltest' ORDER BY ID;
+}
+
+--connection locker
+UNLOCK TABLES;
+
+--connection default
+
+--disable_query_log
+--disable_result_log
+if($DEBUG)
+{
+ --enable_query_log
+ --enable_result_log
+ SELECT * FROM mysqltest.book_keeping ORDER BY worker_id;
+}
+
+### 6. Some checks
+#--------------------
+# 6.1 Check that all worker sessions had a proper end
+if(`SELECT COUNT(*) > 0 FROM mysqltest.book_keeping
+ WHERE counter IS NULL
+ OR mysql_errno <> $ER_QUERY_INTERRUPTED OR mysql_errno IS NULL`)
+{
+ --enable_query_log
+ --enable_result_log
+ --echo # ERROR in Check 1:
+ --echo # All worker sessions must have updated their records (counter,mysql_errno) and
+ --echo # mysql_errno must be all time $ER_QUERY_INTERRUPTED (ER_QUERY_INTERRUPTED)
+ eval SELECT * FROM mysqltest.book_keeping
+ WHERE counter IS NULL
+ OR mysql_errno <> $ER_QUERY_INTERRUPTED OR mysql_errno IS NULL
+ ORDER BY worker_id;
+ --echo # abort
+ exit;
+}
+# 6.2 Check that the priorization system worked sufficient fair
+if(`SELECT MIN(counter)/AVG(counter) < 0.5 OR MAX(counter)/AVG(counter) > 2
+ FROM mysqltest.book_keeping
+ GROUP BY high_priority_connection,task_size,task_transaction,task_prepared
+ HAVING COUNT(*) > 1 AND AVG(counter) >= 10`)
+{
+ --enable_query_log
+ --enable_result_log
+ --echo # ERROR in Check 2:
+ --echo # The priorization system should treat all sessions belonging to the same
+ --echo # thread_pool group and having the same properties (value of task_* and
+ --echo # high_priority_connection) sufficient fair.
+ --echo # This means IMHO the throughput (mysqltest.book_keeping.counter) of any
+ --echo # of such sessions must be between 0.5 AVG(counter) and 2 AVG(counter)
+ --echo # except the throughput is already a very small number (AVG(counter) < 10).
+ --echo # That this criterion might become invalid in case of sessions fighting
+ --echo # for getting the same exclusive locks.
+ SELECT MIN(counter), AVG(counter) * 0.5, MAX(counter), AVG(counter) * 2
+ FROM mysqltest.book_keeping
+ GROUP BY high_priority_connection,task_size,task_transaction,task_prepared
+ HAVING COUNT(*) > 1 AND AVG(counter) >= 10;
+ SELECT *
+ FROM mysqltest.book_keeping;
+ --echo # abort
+ exit;
+}
+
+if(!$DEBUG)
+{
+ let $num= $worker_count;
+ while($num)
+ {
+ let $worker_stdout= $MYSQLTEST_VARDIR/tmp/$num.out;
+ let $worker_stderr= $MYSQLTEST_VARDIR/tmp/$num.err;
+ --error 0,1
+ remove_file $worker_stdout 10;
+ --error 0,1
+ remove_file $worker_stderr 10;
+ dec $num;
+ }
+}
+
+#-------------------------------------------
+
+SELECT AVG(tab1.counter),AVG(tab2.counter) INTO @first_counter,@second_counter
+FROM mysqltest.book_keeping tab1, mysqltest.book_keeping tab2
+WHERE tab1.worker_type = 'first' AND tab2.worker_type = 'second';
+#
+eval INSERT INTO mysqltest.statistics (prio_kickup_timer, first_counter, second_counter, $statistics_column_list)
+SELECT @@GLOBAL.thread_pool_prio_kickup_timer, @first_counter, @second_counter,
+tab2.QUERIES_EXECUTED - tab1.QUERIES_EXECUTED, tab2.QUERIES_QUEUED - tab1.QUERIES_QUEUED,
+tab2.PRIO_KICKUPS - tab1.PRIO_KICKUPS, tab2.STALLED_QUERIES_EXECUTED - tab1.STALLED_QUERIES_EXECUTED,
+tab2.BECOME_CONSUMER_THREAD - tab1.BECOME_CONSUMER_THREAD,tab2.BECOME_RESERVE_THREAD - tab1.BECOME_RESERVE_THREAD,
+tab2.BECOME_WAITING_THREAD - tab1.BECOME_WAITING_THREAD, tab2.WAKE_THREAD_STALL_CHECKER - tab1.WAKE_THREAD_STALL_CHECKER,
+tab2.SLEEP_WAITS - tab1.SLEEP_WAITS, tab2.DISK_IO_WAITS - tab1.DISK_IO_WAITS,
+tab2.ROW_LOCK_WAITS - tab1.ROW_LOCK_WAITS, tab2.GLOBAL_LOCK_WAITS - tab1.GLOBAL_LOCK_WAITS,
+tab2.META_DATA_LOCK_WAITS - tab1.META_DATA_LOCK_WAITS, tab2.TABLE_LOCK_WAITS - tab1.TABLE_LOCK_WAITS,
+tab2.USER_LOCK_WAITS - tab1.USER_LOCK_WAITS, tab2.BINLOG_WAITS - tab1.BINLOG_WAITS,
+tab2.GROUP_COMMIT_WAITS - tab1.GROUP_COMMIT_WAITS, tab2.FSYNC_WAITS - tab1.FSYNC_WAITS
+FROM mysqltest.start_statistics tab1, mysqltest.start_statistics tab2
+WHERE tab1.WHAT = 'before' AND tab2.WHAT = 'after';
+
+--disable_query_log
+--disable_result_log
+if($DEBUG)
+{
+ --enable_query_log
+ --enable_result_log
+ SELECT
+ 'MY_SETTINGS',@@GLOBAL.thread_pool_prio_kickup_timer,
+ @first_high_priority_connection, @first_size, @first_transaction, @first_prepared,
+ @second_high_priority_connection, @second_size, @second_transaction, @second_prepared;
+ SELECT 'MY_RESULTS', @@GLOBAL.thread_pool_prio_kickup_timer, @first_counter, @second_counter,
+ tab2.QUERIES_EXECUTED - tab1.QUERIES_EXECUTED, tab2.QUERIES_QUEUED - tab1.QUERIES_QUEUED,
+ tab2.PRIO_KICKUPS - tab1.PRIO_KICKUPS, tab2.STALLED_QUERIES_EXECUTED - tab1.STALLED_QUERIES_EXECUTED,
+ tab2.BECOME_CONSUMER_THREAD - tab1.BECOME_CONSUMER_THREAD,tab2.BECOME_RESERVE_THREAD - tab1.BECOME_RESERVE_THREAD,
+ tab2.BECOME_WAITING_THREAD - tab1.BECOME_WAITING_THREAD, tab2.WAKE_THREAD_STALL_CHECKER - tab1.WAKE_THREAD_STALL_CHECKER,
+ tab2.SLEEP_WAITS - tab1.SLEEP_WAITS, tab2.DISK_IO_WAITS - tab1.DISK_IO_WAITS,
+ tab2.ROW_LOCK_WAITS - tab1.ROW_LOCK_WAITS, tab2.GLOBAL_LOCK_WAITS - tab1.GLOBAL_LOCK_WAITS,
+ tab2.META_DATA_LOCK_WAITS - tab1.META_DATA_LOCK_WAITS, tab2.TABLE_LOCK_WAITS - tab1.TABLE_LOCK_WAITS,
+ tab2.USER_LOCK_WAITS - tab1.USER_LOCK_WAITS, tab2.BINLOG_WAITS - tab1.BINLOG_WAITS,
+ tab2.GROUP_COMMIT_WAITS - tab1.GROUP_COMMIT_WAITS, tab2.FSYNC_WAITS - tab1.FSYNC_WAITS
+ FROM mysqltest.start_statistics tab1, mysqltest.start_statistics tab2
+ WHERE tab1.WHAT = 'before' AND tab2.WHAT = 'after';
+}
+
diff --git a/mysql-test/suite/thread_pool/inc/i_s_debug.inc b/mysql-test/suite/thread_pool/inc/i_s_debug.inc
new file mode 100644
index 000000000000..f999a752bc33
--- /dev/null
+++ b/mysql-test/suite/thread_pool/inc/i_s_debug.inc
@@ -0,0 +1,17 @@
+# Auxiliary routine for debugging
+#
+# The content of all "pool of threads" related tables within the information_schema
+# is printed in case of $DEBUG= 1.
+
+if($DEBUG)
+{
+ SELECT * FROM information_schema.processlist;
+ SELECT * FROM information_schema.TP_THREAD_GROUP_STATS;
+ SELECT * FROM information_schema.TP_THREAD_GROUP_STATE;
+ SELECT TP_GROUP_ID,TP_THREAD_NUMBER,PROCESS_COUNT,WAIT_TYPE
+ FROM information_schema.TP_THREAD_STATE;
+ SELECT * FROM performance_schema.tp_thread_group_stats;
+ SELECT * FROM performance_schema.tp_thread_group_state;
+ SELECT TP_GROUP_ID,TP_THREAD_NUMBER,PROCESS_COUNT,WAIT_TYPE
+ FROM performance_schema.tp_thread_state;
+}
diff --git a/mysql-test/suite/thread_pool/inc/kill_coverage.inc b/mysql-test/suite/thread_pool/inc/kill_coverage.inc
new file mode 100644
index 000000000000..d5d22d665e29
--- /dev/null
+++ b/mysql-test/suite/thread_pool/inc/kill_coverage.inc
@@ -0,0 +1,65 @@
+# Kill some query of the worker session though there is no already running query.
+
+# Reset DEBUG_SYNC facility.
+SET DEBUG_SYNC= 'RESET';
+
+--echo Bug#29969769 - KILL QUERY KILLS THE NEXT QUERY
+# Sending KILL QUERY before statement begins execution shall not interrupt it.
+connect (con1, localhost, root,,);
+--let $ID= `SELECT connection_id()`
+SET DEBUG_SYNC='before_command_dispatch SIGNAL kill_query WAIT_FOR continue';
+--send SELECT 1;
+
+connection default;
+SET DEBUG_SYNC='now WAIT_FOR kill_query';
+--replace_result $ID ID
+--eval KILL QUERY $ID
+SET DEBUG_SYNC='now SIGNAL continue';
+
+connection con1;
+#Without fix, SELECT fails with ER_QUERY_INTERRUPTED error.
+--reap
+
+connection default;
+SET DEBUG_SYNC='RESET';
+disconnect con1;
+
+# The KILL QUERY shall terminate the statement that is currently executing on the connection.
+
+--connection worker
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL sync_start WAIT_FOR continue';
+send SELECT * FROM t1;
+
+--connection default
+--disable_query_log
+SET DEBUG_SYNC='now WAIT_FOR sync_start';
+--replace_result $worker_id
+eval KILL QUERY $worker_id;
+SET DEBUG_SYNC='now SIGNAL continue';
+
+--enable_query_log
+
+--connection worker
+--error ER_QUERY_INTERRUPTED
+--reap
+send SELECT * FROM t1;
+
+--connection default
+--disable_query_log
+--replace_result $worker_id
+--error 0
+eval KILL $worker_id;
+--replace_result $worker_id
+--error 0,ER_NO_SUCH_THREAD
+eval KILL $worker_id;
+
+# Reset DEBUG_SYNC facility after use.
+SET DEBUG_SYNC= "RESET";
+
+--enable_query_log
+# Wait till the worker session has disappeared.
+# let $wait_timeout= 10;
+let $wait_condition= SELECT COUNT(*) = 0 FROM information_schema.processlist
+WHERE ID = $worker_id;
+--source include/wait_condition.inc
+
diff --git a/mysql-test/suite/thread_pool/inc/thread_pool_err.inc b/mysql-test/suite/thread_pool/inc/thread_pool_err.inc
new file mode 100644
index 000000000000..c5933833cc83
--- /dev/null
+++ b/mysql-test/suite/thread_pool/inc/thread_pool_err.inc
@@ -0,0 +1,120 @@
+# internal/mysql-test/suite/thread_pol/inc/thread_pool_err.inc
+#
+# Purpose:
+# There are several tests in the pattern
+# thread_pool__wrong which check the
+# content of mysqld.1.err for specific messages when the test was
+# started with invalid values.
+#
+# Some tests expect the same messages. In order to avoid code
+# duplication we store the expected messages here and depend on the
+# ./inc/wrong_value.inc to validate that appropriate messages have been
+# logged in the error log.
+
+# We get the following error when thread poool fails to load.
+--let TP_INIT_ERROR_PATTERN= Plugin 'thread_pool' init function returned error
+
+#---------- thread_pool_algorithm ----------
+# Snip of mysqld.1.err
+# [Warning] [MY-000082] [Server] option 'thread-pool-algorithm': value -1 adjusted to 0.
+# [Warning] [MY-000081] [Server] option 'thread-pool-algorithm': unsigned value 2 adjusted to 1.
+
+--let $tp_algo_min_warn= option 'thread-pool-algorithm':.*value .* adjusted to 0
+--let $tp_algo_max_warn= option 'thread-pool-algorithm':.*value .* adjusted to 1
+
+#---------- thread_pool_longrun_trx_limit ----------
+# Snip of mysqld.1.err
+# [Warning] [MY-000082] [Server] option 'thread-pool-longrun-trx-limit': value -1 adjusted to 10.
+# [Warning] [MY-000081] [Server] option 'thread-pool-longrun-trx-limit': unsigned value 86400001 adjusted to 86400000.
+
+--let $tp_lrtl_min_warn= option 'thread-pool-longrun-trx-limit':.*value .* adjusted to 10
+--let $tp_lrtl_max_warn= option 'thread-pool-longrun-trx-limit':.*value .* adjusted to 86400000
+
+#---------- thread_pool_dedicated_listeners ----------
+# Snip of mysqld.1.err
+# [Warning] [MY-000076] [Server] option 'thread-pool-dedicated-listeners': boolean value '-1' was not recognized. Set to OFF.
+# [Warning] [MY-000076] [Server] option 'thread-pool-dedicated-listeners': boolean value '2' was not recognized. Set to OFF.
+
+--let $tp_dl_min_warn= option 'thread-pool-dedicated-listeners': boolean value .* was not recognized. Set to OFF
+--let $tp_dl_max_warn= option 'thread-pool-dedicated-listeners': boolean value .* was not recognized. Set to OFF
+
+#---------- thread_pool_max_active_query_threads ----------
+# Snip of mysqld.1.err
+# [Warning] [MY-000082] [Server] option 'thread-pool-max-active-query-threads': value -1 adjusted to 0.
+# [Warning] [MY-000081] [Server] option 'thread-pool-max-active-query-threads': unsigned value 513 adjusted to 512.
+
+--let $tp_maqt_min_warn= option 'thread-pool-max-active-query-threads':.*value .* adjusted to 0
+--let $tp_maqt_max_warn= option 'thread-pool-max-active-query-threads':.*value .* adjusted to 512
+
+#---------- thread_pool_max_transactions_limit ----------
+# Snip of mysqld.1.err
+# [Warning] [MY-000082] [Server] option 'thread-pool-max-transactions-limit': value -1 adjusted to 0.
+# [Warning] [MY-000081] [Server] option 'thread-pool-max-transactions-limit': unsigned value 1100000 adjusted to 1000000.
+
+--let $tp_mtl_min_warn= option 'thread-pool-max-transactions-limit':.*value .* adjusted to 0
+--let $tp_mtl_max_warn= option 'thread-pool-max-transactions-limit':.*value .* adjusted to 1000000
+
+#---------- thread_pool_max_unused_threads ----------
+# Snip of mysqld.1.err
+# [Warning] [MY-000082] [Server] option 'thread-pool-max-unused-threads': value -1 adjusted to 0.
+# [Warning] [MY-000081] [Server] option 'thread-pool-max-unused-threads': unsigned value 40970 adjusted to 4096.
+
+--let $tp_mut_min_warn= option 'thread-pool-max-unused-threads':.*value .* adjusted to 0
+--let $tp_mut_max_warn= option 'thread-pool-max-unused-threads':.*value .* adjusted to 4096
+
+#---------- thread_pool_priority_kickup_timer ----------
+# Snip of mysqld.1.err
+# [Warning] [MY-000082] [Server] option 'thread-pool-prio-kickup-timer': value -12 adjusted to 0.
+# [Warning] [MY-000081] [Server] option 'thread-pool-prio-kickup-timer': unsigned value 4294967296 adjusted to 4294967295.
+
+--let $tp_pkt_min_warn= option 'thread-pool-prio-kickup-timer':.*value .* adjusted to 0
+--let $tp_pkt_max_warn= option 'thread-pool-prio-kickup-timer':.*value .* adjusted to 4294967295
+
+#---------- thread_pool_query_threads_per_group ----------
+# Snip of mysqld.1.err
+# [Warning] [MY-000082] [Server] option 'thread-pool-query-threads-per-group': value -1 adjusted to 1.
+# [Warning] [MY-000081] [Server] option 'thread-pool-query-threads-per-group': unsigned value 4097 adjusted to 4096.
+
+--let $tp_qtpg_min_warn= option 'thread-pool-query-threads-per-group':.*value .* adjusted to 1
+--let $tp_qtpg_max_warn= option 'thread-pool-query-threads-per-group':.*value .* adjusted to 4096
+
+#---------- thread_pool_size ----------
+# Snip of mysqld.1.err
+# [Warning] [MY-000082] [Server] option 'thread-pool-size': value -1 adjusted to 1.
+# [Warning] [MY-000081] [Server] option 'thread-pool-size': unsigned value 513 adjusted to 512.
+# Note: No tests are currently using $tp_size_max_warn as it can consume more resources.
+#
+# In PERCONA_THREADPOOL_COMPAT mode this option is parsed against the
+# server-owned (Percona) thread_pool_size sysvar (VALID_RANGE(1,
+# MAX_THREAD_GROUPS=1024)), not the Oracle plugin's own (VALID_RANGE(1,
+# 512)); the min bound is unchanged, but the max bound is now 1024. Core
+# Sys_var startup-adjustment warnings also print the variable name with
+# underscores ('thread_pool_size'), unlike plugin vars, which print it
+# with dashes ('thread-pool-size') as above.
+
+--let $tp_size_min_warn= option 'thread_pool_size':.*value .* adjusted to 1
+--let $tp_size_max_warn= option 'thread_pool_size':.*value .* adjusted to 1024
+
+#---------- thread_pool_stall_limit ----------
+# Snip of mysqld.1.err
+# [Warning] [MY-000082] [Server] option 'thread-pool-stall-limit': value 3 adjusted to 10.
+# [Warning] [MY-000081] [Server] option 'thread-pool-stall-limit': unsigned value 4294967296 adjusted to 4294967295.
+#
+# In PERCONA_THREADPOOL_COMPAT mode this option is parsed against the
+# server-owned (Percona) thread_pool_stall_limit sysvar (milliseconds,
+# VALID_RANGE(10, UINT_MAX)), not the Oracle plugin's own (centiseconds,
+# VALID_RANGE(4, 600)); there is no longer a practically-reachable "too
+# large" value, so the max case below only exercises unsigned overflow.
+# Like thread_pool_size above, the core Sys_var prints the variable name
+# with underscores, not dashes.
+
+--let $tp_sl_min_warn= option 'thread_pool_stall_limit':.*value .* adjusted to 10
+--let $tp_sl_max_warn= option 'thread_pool_stall_limit':.*value .* adjusted to 4294967295
+
+#---------- thread_pool_size_transaction_delay value ----------
+# Snip of mysqld.1.err
+# [Warning] [MY-000082] [Server] option 'thread-pool-transaction-delay': value -1 adjusted to 0.
+# [Warning] [MY-000081] [Server] option 'thread-pool-transaction-delay': unsigned value 300001 adjusted to 300000.
+
+--let $tp_trx_delay_min_warn= option 'thread-pool-transaction-delay':.*value .* adjusted to 0
+--let $tp_trx_delay_max_warn= option 'thread-pool-transaction-delay':.*value .* adjusted to 300000
diff --git a/mysql-test/suite/thread_pool/inc/wait_until_disappeared.inc b/mysql-test/suite/thread_pool/inc/wait_until_disappeared.inc
new file mode 100644
index 000000000000..6c8c11089822
--- /dev/null
+++ b/mysql-test/suite/thread_pool/inc/wait_until_disappeared.inc
@@ -0,0 +1,43 @@
+# Auxiliary script
+#
+# Purpose: Wait till all connections with id in ($id_list)
+# disappeared from information_schema.processlist
+# or abort if $wait_timeout seconds have passed.
+#
+# $id_list has to be set before calling the current script.
+#
+# Typical use case:
+# --connection con1
+# let $id_list= `SELECT CONNECTION_ID();
+# ...
+# --connection con2
+# let $id= `SELECT CONNECTION_ID();
+# let $id_list= $id_list , $id;
+# ...
+# --connection default
+# --replace_result $id
+# eval KILL $id;
+# ...
+# --disconnect con2
+# --source ../inc/wait_until_disappeared.inc
+#
+# Note: Using this routine to ensure that disconnects are finished is
+# significant more straight forward and reliable than using the common sequence
+# --connection con1
+# --disconnect con1
+# --source include/wait_until_disconnected.inc
+#
+
+let $wait_condition= SELECT COUNT(*) = 0 FROM information_schema.processlist
+WHERE id IN ($id_list);
+--source include/wait_condition.inc
+if(!$success)
+{
+ --echo # ERROR The sessions with id IN ($id_list) did not disappear from processlist
+ eval SELECT * FROM information_schema.processlist WHERE id IN ($id_list);
+ --sleep 30
+ eval SELECT * FROM information_schema.processlist WHERE id IN ($id_list);
+ --echo # abort
+ exit;
+}
+
diff --git a/mysql-test/suite/thread_pool/inc/worker.test b/mysql-test/suite/thread_pool/inc/worker.test
new file mode 100644
index 000000000000..905c8afbf25e
--- /dev/null
+++ b/mysql-test/suite/thread_pool/inc/worker.test
@@ -0,0 +1,140 @@
+# Usage of this routine:
+#-----------------------
+# 1. The caller scripts establishes a WRITE LOCK on mysqltest.to_lock
+# 2. The caller scripts starts mysqltest interpreting this script into the background.
+# 3. The execution of this script stops at the SELECT within the loop because
+# it needs a lock on mysqltest.to_lock.
+# 4. The caller waits till at least our current session
+# - is visible within information_schema processlist at all
+# - seems to wait for the MDL lock
+# 5. The caller scripts executes UNLOCK TABLES.
+# 6. Sooner or later our current session becomes active and it
+# runs loops.
+# 7. After some time the caller scripts establishes a WRITE LOCK on mysqltest.to_lock
+# 8. Our session stops at the SELECT within the loop because
+# it needs a lock on mysqltest.to_lock.
+# 9. The caller script kills the current query (waiting for the MDL lock).
+# 10. Our session gets ER_QUERY_INTERRUPTED for the SELECT and leaves the loop.
+# 11. Our session writes it's runtime conditions (system variables) and the
+# loop execution counter @aux into mysqltest.book_keeping
+#
+#
+
+--disable_query_log
+--disable_result_log
+if($DEBUG)
+{
+ --enable_query_log
+ --enable_result_log
+}
+
+
+# Set mysqltest as default database. This allows to identify worker sessions like
+# current one within the processlist.
+USE mysqltest;
+
+# Ensure that all worker sessions start with the same deterministic value for autocommit.
+# This value will be changed later.
+SET SESSION autocommit = 1;
+
+# Set @@SESSION.lock_wait_timeout to a rather small value in order to reduce the risk
+# that we end up with long life processes in case something goes wrong.
+SET @@SESSION.lock_wait_timeout = 30;
+
+# Show that I am here.
+SELECT MIN(worker_id) INTO @worker_id FROM mysqltest.book_keeping WHERE session_id IS NULL;
+UPDATE mysqltest.book_keeping SET session_id = CONNECTION_ID() WHERE worker_id = @worker_id;
+
+# Determine the required value for high_priority_connection and set it.
+let $high_priority_connection= `SELECT high_priority_connection FROM mysqltest.book_keeping
+ WHERE worker_id = @worker_id`;
+eval SET @@session.thread_pool_high_priority_connection = $high_priority_connection;
+
+# Determine the required task settings
+let $task_size= `SELECT task_size FROM mysqltest.book_keeping WHERE worker_id = @worker_id`;
+let $task_transaction= `SELECT task_transaction FROM mysqltest.book_keeping WHERE worker_id = @worker_id`;
+let $task_prepared= `SELECT task_prepared FROM mysqltest.book_keeping WHERE worker_id = @worker_id`;
+--echo # Task: Size: $task_size - Use of transaction: $task_transaction - Use of prepared statement: $task_prepared
+
+# Initialize the counter variable
+SET @aux = 0;
+
+let $statement= WRONG TASK SIZE VALUE;
+if($task_size == 'small')
+{
+ # My notebook: 10 workers -> 200 rounds per 1 second and one worker
+ let $statement= SELECT COUNT(*), @aux + 1 INTO @throw_away, @aux
+ FROM mysqltest.to_lock C1
+ WHERE C1.col1 <> 1 ;
+}
+if($task_size == 'medium')
+{
+ # My notebook: 10 workers -> 60 rounds per 1 second and one worker
+ let $statement= SELECT COUNT(*), @aux + 1 INTO @throw_away, @aux
+ FROM mysqltest.to_lock C1, mysqltest.to_lock C2, mysqltest.to_lock C3
+ WHERE C1.col1 <> 1 AND C2.col1 <> 2 AND C3.col1 <> 3;
+}
+if($task_size == 'big')
+{
+ let $statement= SELECT COUNT(*), @aux + 1 INTO @throw_away, @aux
+ FROM mysqltest.to_lock C1, mysqltest.to_lock C2, mysqltest.to_lock C3, mysqltest.to_lock C4
+ WHERE C1.col1 <> 1 AND C2.col1 <> 2 AND C3.col1 <> 3 AND C4.col1 <> 4;
+}
+if($task_size == 'huge')
+{
+ let $statement= SELECT COUNT(*), @aux + 1 INTO @throw_away, @aux
+ FROM mysqltest.to_lock C1, mysqltest.to_lock C2, mysqltest.to_lock C3, mysqltest.to_lock C4, mysqltest.to_lock C5
+ WHERE C1.col1 <> 1 AND C2.col1 <> 2 AND C3.col1 <> 3 AND C4.col1 <> 4 AND C5.col1 <> 5;
+}
+
+if($task_transaction)
+{
+ SET SESSION autocommit = 0;
+}
+
+if($task_prepared)
+{
+ eval PREPARE stmt FROM '$statement';
+ let $statement= EXECUTE stmt;
+}
+
+let $cnt= 1;
+let $my_errno= 0;
+while(!$my_errno)
+{
+ --error 0, ER_LOCK_WAIT_TIMEOUT, ER_QUERY_INTERRUPTED
+ eval $statement;
+ let $my_errno= $mysql_errno;
+
+ # Without this COMMIT our session with transaction will hold a share lock
+ # on mysqltest.to_lock. Than the connection locker will fail to stop the race.
+ # (It gets ERROR 1205 on LOCK TABLES mysqltest.to_lock WRITE and all workers
+ # run endless. Of course this COMMIT is a slight overhead compared to the
+ # loops which do not have an open transaction.
+ if($cnt == 10)
+ {
+ COMMIT;
+ let $cnt= 0;
+ }
+ --inc $cnt
+}
+
+SET @@session.thread_pool_high_priority_connection = 0;
+
+if($task_prepared)
+{
+ DEALLOCATE PREPARE stmt;
+}
+
+if($task_transaction)
+{
+ SET SESSION autocommit = 1;
+}
+
+# Update the entry with my results
+eval
+UPDATE mysqltest.book_keeping
+SET counter = @aux,
+ mysql_errno = $my_errno
+WHERE worker_id = @worker_id;
+
diff --git a/mysql-test/suite/thread_pool/inc/wrong_value.inc b/mysql-test/suite/thread_pool/inc/wrong_value.inc
new file mode 100644
index 000000000000..bc677acd25d1
--- /dev/null
+++ b/mysql-test/suite/thread_pool/inc/wrong_value.inc
@@ -0,0 +1,42 @@
+--disable_query_log
+--eval CALL mtr.add_suppression("$error_pattern")
+--enable_query_log
+
+# Code inspired by some solution found in binlog_stm_unsafe_warning.test.
+let $log_error_= `SELECT @@GLOBAL.log_error`;
+if($log_error_ == "stderr")
+{
+ # MySQL Server on windows is started with --console and thus
+ # does not know the location of its .err log, use default location
+ let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
+}
+
+--echo # Check for expected content in mysqld.1.err
+
+# Setup log file for assert_grep.inc
+--let $assert_file= $log_error_
+
+if ($tp_init_failure_expected)
+{
+ --eval CALL mtr.add_suppression("$TP_INIT_ERROR_PATTERN")
+
+ --let $assert_text= "$TP_INIT_ERROR_PATTERN found"
+ --let $assert_select= $TP_INIT_ERROR_PATTERN
+ --let $assert_count= 1
+ --source include/assert_grep.inc
+
+ # Assert that the thread pool is not loaded if init failed.
+ --error ER_UNKNOWN_SYSTEM_VARIABLE
+ SELECT @@global.thread_pool_size;
+}
+
+if (!$tp_init_failure_expected)
+{
+ # Assert that the thread pool is loaded despite the wrong values.
+ --assert (`SELECT @@global.thread_pool_size <> 0`)
+}
+
+--let $assert_text= $error_pattern found
+--let $assert_select= $error_pattern
+--let $assert_count= 1
+--source include/assert_grep.inc
diff --git a/mysql-test/suite/thread_pool/r/telemetry_traces_server.result b/mysql-test/suite/thread_pool/r/telemetry_traces_server.result
new file mode 100644
index 000000000000..ce8468b9dc44
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/telemetry_traces_server.result
@@ -0,0 +1,611 @@
+#########
+# SETUP #
+#########
+SET @mem_limit_orig= @@GLOBAL.connection_memory_limit;
+INSTALL COMPONENT 'file://component_query_attributes';
+INSTALL COMPONENT 'file://component_test_server_telemetry_traces';
+CREATE USER internal@localhost IDENTIFIED BY 'internal';
+CREATE USER api@localhost IDENTIFIED BY 'api';
+CREATE USER normal@localhost IDENTIFIED BY 'normal';
+SHOW VARIABLES LIKE 'test_server_telemetry_traces.%';
+Variable_name Value
+test_server_telemetry_traces.application_context_keys
+test_server_telemetry_traces.callsite_context_keys
+test_server_telemetry_traces.trace_key trace
+##############
+# Operations #
+##############
+# check initial telemetry session refcount (should be 1)
+SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions";
+variable_value
+1
+# no query attributes attached, should not be traced
+SELECT 1;
+1
+1
+# "trace" query attribute missing, should not be traced
+SELECT 2;
+2
+2
+# "trace" query attribute present but off, should not be traced
+SELECT 3;
+3
+3
+# "trace" query attribute present and on, should be traced
+SELECT 4;
+4
+4
+# "internal" user requests are never traced
+SELECT 5;
+5
+5
+# check telemetry session refcount with new session (should be 2)
+SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions";
+variable_value
+2
+# check telemetry session refcount with new session closed (should be 1)
+SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions";
+variable_value
+1
+# "api" user requests are traced (in force mode)
+SELECT 6;
+6
+6
+# check telemetry session refcount with 'api' session created (should be 2)
+SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions";
+variable_value
+2
+# check telemetry session refcount with 'api' session destroyed (should be 1)
+SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions";
+variable_value
+1
+# requests by users other than "api"/"root" are not forced
+SELECT 7;
+7
+7
+# check telemetry session refcount with 'normal' session created (should be 2)
+SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions";
+variable_value
+2
+# check telemetry session refcount with 'normal' session destroyed (should be 1)
+SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions";
+variable_value
+1
+# modify tracing activation key name
+SET GLOBAL test_server_telemetry_traces.trace_key='activate';
+# - do not trace statement using old key
+SELECT 8;
+8
+8
+# - do trace statement using new key
+SELECT 9;
+9
+9
+# define application and call-site contexts
+SET GLOBAL test_server_telemetry_traces.application_context_keys='client_id;root_id;parent_id;id';
+SET GLOBAL test_server_telemetry_traces.callsite_context_keys=';source_file;source_line;;';
+# trace statement with rich context data
+SELECT 10;
+10
+10
+# trace nested query
+SELECT 11, (SELECT COUNT(*) FROM DUAL);
+11 (SELECT COUNT(*) FROM DUAL)
+11 1
+# trace substatements
+CREATE PROCEDURE proc1()
+BEGIN
+SELECT "proc1 stmt#1";
+SELECT "proc1 stmt#2";
+END|
+CREATE PROCEDURE proc2()
+BEGIN
+CALL proc1();
+CALL proc1();
+END|
+CALL proc2();
+proc1 stmt#1
+proc1 stmt#1
+proc1 stmt#2
+proc1 stmt#2
+proc1 stmt#1
+proc1 stmt#1
+proc1 stmt#2
+proc1 stmt#2
+SELECT 12;
+12
+12
+# no trace if root statement without query attributes
+CALL proc2();
+proc1 stmt#1
+proc1 stmt#1
+proc1 stmt#2
+proc1 stmt#2
+proc1 stmt#1
+proc1 stmt#1
+proc1 stmt#2
+proc1 stmt#2
+# trace substatements using function
+CREATE FUNCTION SayHi( name VARCHAR(20) )
+RETURNS VARCHAR(30)
+DETERMINISTIC
+BEGIN
+DECLARE greeting VARCHAR(20);
+SET greeting = CONCAT('Hi ', name);
+RETURN greeting;
+END|
+SELECT SayHi('Marc');
+SayHi('Marc')
+Hi Marc
+# prepared statement without qa, should not be traced
+PREPARE stmt1 FROM 'SELECT SQRT(?) AS square_root';
+SET @a = 4;
+EXECUTE stmt1 USING @a;
+square_root
+2
+DEALLOCATE PREPARE stmt1;
+# statements within transaction, should be traced
+CREATE TABLE t1 (s1 INT) ENGINE=InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1),(2);
+ROLLBACK;
+# cursor handling statements without qa, should not be traced
+INSERT INTO t1 VALUES (1),(2);
+CREATE PROCEDURE curdemo()
+BEGIN
+DECLARE done INT DEFAULT FALSE;
+DECLARE a INT;
+DECLARE t1_cursor CURSOR FOR SELECT s1 FROM t1;
+DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+OPEN t1_cursor;
+read_loop: LOOP
+FETCH t1_cursor INTO a;
+IF done THEN
+LEAVE read_loop;
+END IF;
+END LOOP;
+CLOSE t1_cursor;
+END|
+CALL curdemo();
+# statement within trigger without qa, should not be traced
+CREATE TRIGGER valcheck BEFORE INSERT ON t1 FOR EACH ROW IF NEW.s1 < 0 THEN SET NEW.s1 = 0; END IF; |
+INSERT INTO t1 VALUES (1),(-2);
+DROP TRIGGER valcheck;
+# statement within view without qa, should not be traced
+CREATE DEFINER=root@localhost VIEW big_nums AS SELECT s1 FROM t1 WHERE s1 > 1;
+SELECT count(*) FROM big_nums;
+count(*)
+1
+# statement within event without qa, should not be traced
+CREATE EVENT new_item ON SCHEDULE AT CURRENT_TIMESTAMP DO INSERT INTO t1 VALUES(100);
+# statement with runtime error without qa, should not be traced
+SELECT wrong FROM t1;
+ERROR 42S22: Unknown column 'wrong' in 'field list'
+# statement with syntax error with qa, should be traced
+SEEELECT s1 FROM t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SEEELECT s1 FROM t1' at line 1
+# EXPLAIN statement without qa, should not be traced
+EXPLAIN SELECT s1 FROM t1;
+# utility statement without qa, should not be traced
+DESCRIBE t1;
+Field Type Null Key Default Extra
+s1 int YES NULL
+DROP TABLE t1;
+# SHOW PROCESSLIST statement without qa, should not be traced
+SHOW PROCESSLIST;
+# substatement of SET type without qa, should not be traced
+CREATE PROCEDURE SetMemLimit( amount INT )
+BEGIN
+SET @@GLOBAL.connection_memory_limit=amount;
+END|
+CALL SetMemLimit(33333333);
+# statement run through mysql_command_query service, should not be traced
+INSTALL COMPONENT "file://component_test_mysql_command_services";
+SELECT test_mysql_command_services_udf("SELECT 1+1");
+test_mysql_command_services_udf("SELECT 1+1")
+2
+UNINSTALL COMPONENT "file://component_test_mysql_command_services";
+# statement using Memory engine, should be traced
+CREATE TABLE t2 (s1 INT) ENGINE=MEMORY;
+INSERT INTO t2 VALUES (1),(2);
+DROP TABLE t2;
+# statements working with sensitive data which should be obfuscated
+CREATE PROCEDURE obfuscate_this_2(a DECIMAL(2,2))
+SET PASSWORD FOR internal='CmdrShepard';|
+# statements in non-default character set should be logged correctly by telemetry
+SET CHARACTER SET cp1250_latin2;
+SELECT '£¥ª¯';
+£¥ª¯
+£¥ª¯
+SET CHARACTER SET default;
+# COM_QUIT command should be processed by telemetry (appear in the log)
+# check telemetry session refcount with 'api' session created (should be 2)
+SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions";
+variable_value
+2
+# check telemetry session refcount with 'api' session destroyed (should be 1)
+SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions";
+variable_value
+1
+# COM_INIT_DB command should be processed by telemetry (appear in the log)
+USE mysql;
+USE test;
+# COM_PING command should be processed by telemetry (appear in the log)
+# COM_RESET_CONNECTION command should be processed by telemetry (appear in the log)
+SET @@GLOBAL.connection_memory_limit= @mem_limit_orig;
+###########
+# CLEANUP #
+###########
+DROP PROCEDURE proc2;
+DROP PROCEDURE proc1;
+DROP FUNCTION SayHi;
+DROP PROCEDURE SetMemLimit;
+DROP PROCEDURE curdemo;
+DROP VIEW big_nums;
+DROP PROCEDURE obfuscate_this_2;
+DROP USER internal@localhost;
+DROP USER api@localhost;
+DROP USER normal@localhost;
+# check telemetry session refcount before unloading component (should be 1)
+SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions";
+variable_value
+1
+UNINSTALL COMPONENT 'file://component_test_server_telemetry_traces';
+UNINSTALL COMPONENT 'file://component_query_attributes';
+# check telemetry session refcount after unloading component (status variable should not exist)
+SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions";
+variable_value
+Component logs:
+test_server_telemetry_traces_component_init init:
+ - UDFs registered.
+ - System variables registered.
+ - Status variables registered.
+ - Telemetry per-session data slot registered.
+ - Telemetry session callbacks registered.
+ - Telemetry statement callbacks registered.
+End of init
+ tm_session_create: telemetry session started, increase refcount by user=root to 1
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE USER 'internal'@'localhost' IDENTIFIED BY ')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE USER 'api'@'localhost' IDENTIFIED BY ')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE USER 'normal'@'localhost' IDENTIFIED BY ')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SHOW VARIABLES LIKE 'test_server_telemetry_traces.%'')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions"')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SELECT 1')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"a": "b"}]
+ query_attr_read: failed to find query attribute 'trace'
+ > tm_stmt_notify_qa: skip tracing, no attribute 'trace' (depth=1, with_qa=1, user=root, query='SELECT 2')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"trace": "off"}]
+ > tm_stmt_notify_qa: skip tracing, attribute 'trace'='off' (depth=1, with_qa=1, user=root, query='SELECT 3')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"trace": "on"}]
+> tm_stmt_notify_qa: proceed further (depth=1, with_qa=1, user=root, query='SELECT 4', app[], call[])
+> tm_stmt_end: trace statement (depth=1, user=root, query='', query1='SELECT 4', digest='SELECT ?', app[], call[])
+ tm_session_connect: client session started (user=internal)
+ tm_session_create: telemetry session started, increase refcount by user=internal to 2
+> tm_stmt_start: skip tracing from user 'internal'
+> tm_stmt_start: skip tracing from user 'internal'
+> tm_stmt_start: skip tracing from user 'internal'
+ tm_session_destroy: telemetry session ended, decrease refcount to 1
+ tm_session_disconnect: client session ended (user=internal)
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions"')
+ tm_session_connect: client session started (user=api)
+ tm_session_create: telemetry session started, increase refcount by user=api to 2
+> tm_stmt_start: proceed further (depth=1, user=api, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"trace": "on"}]
+> tm_stmt_notify_qa: proceed further (depth=1, with_qa=1, user=api, query='SELECT 6', app[], call[])
+> tm_stmt_end: trace statement (depth=1, user=api, query='', query1='SELECT 6', digest='SELECT ?', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=api, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=api, query='SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions"')
+> tm_stmt_start: proceed further (depth=1, user=api, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=api, query='')
+ tm_session_destroy: telemetry session ended, decrease refcount to 1
+ tm_session_disconnect: client session ended (user=api)
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions"')
+ tm_session_connect: client session started (user=normal)
+ tm_session_create: telemetry session started, increase refcount by user=normal to 2
+> tm_stmt_start: proceed further (depth=1, user=normal, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"trace": "on"}]
+> tm_stmt_notify_qa: proceed further (depth=1, with_qa=1, user=normal, query='SELECT 7', app[], call[])
+> tm_stmt_end: trace statement (depth=1, user=normal, query='', query1='SELECT 7', digest='SELECT ?', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=normal, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=normal, query='SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions"')
+> tm_stmt_start: proceed further (depth=1, user=normal, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=normal, query='')
+ tm_session_destroy: telemetry session ended, decrease refcount to 1
+ tm_session_disconnect: client session ended (user=normal)
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions"')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SET GLOBAL test_server_telemetry_traces.trace_key='activate'')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"trace": "on"}]
+ query_attr_read: failed to find query attribute 'activate'
+ > tm_stmt_notify_qa: skip tracing, no attribute 'activate' (depth=1, with_qa=1, user=root, query='SELECT 8')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"activate": "on"}]
+> tm_stmt_notify_qa: proceed further (depth=1, with_qa=1, user=root, query='SELECT 9', app[], call[])
+> tm_stmt_end: trace statement (depth=1, user=root, query='', query1='SELECT 9', digest='SELECT ?', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SET GLOBAL test_server_telemetry_traces.application_context_keys='client_id;root_id;parent_id;id'')
+> sysvar 'application_context_keys' updated to 'client_id;root_id;parent_id;id'
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SET GLOBAL test_server_telemetry_traces.callsite_context_keys=';source_file;source_line;;'')
+> sysvar 'callsite_context_keys' updated to ';source_file;source_line;;'
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"activate": "on", "client_id": "10", "root_id": "1", "parent_id": "2", "id": "99", "external_id": "123", "source_file": "main.cc", "source_line": "998", "source_dir": "dummy"}]
+> tm_stmt_notify_qa: proceed further (depth=1, with_qa=1, user=root, query='SELECT 10', app[{"client_id": "10", "root_id": "1", "parent_id": "2", "id": "99"}], call[{"source_file": "main.cc", "source_line": "998"}])
+> tm_stmt_end: trace statement (depth=1, user=root, query='', query1='SELECT 10', digest='SELECT ?', app[{"client_id": "10", "root_id": "1", "parent_id": "2", "id": "99"}], call[{"source_file": "main.cc", "source_line": "998"}])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"activate": "on"}]
+> tm_stmt_notify_qa: proceed further (depth=1, with_qa=1, user=root, query='SELECT 11, (SELECT COUNT(*) FROM DUAL)', app[], call[])
+> tm_stmt_end: trace statement (depth=1, user=root, query='', query1='SELECT 11, (SELECT COUNT(*) FROM DUAL)', digest='SELECT ? , ( SELECT COUNT ( * ) FROM DUAL )', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE PROCEDURE proc1()
+BEGIN
+SELECT "proc1 stmt#1";
+SELECT "proc1 stmt#2";
+END')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE PROCEDURE proc2()
+BEGIN
+CALL proc1();
+CALL proc1();
+END')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"activate": "on"}]
+> tm_stmt_notify_qa: proceed further (depth=1, with_qa=1, user=root, query='CALL proc2()', app[], call[])
+> tm_stmt_start: proceed further (depth=2, user=root, host=localhost, db=test, query='CALL proc2()')
+> tm_stmt_start: proceed further (depth=3, user=root, host=localhost, db=test, query='CALL proc1()')
+> tm_stmt_end: trace statement (depth=3, user=root, query='CALL proc1()', query1='SELECT "proc1 stmt#1"', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=3, user=root, host=localhost, db=test, query='CALL proc1()')
+> tm_stmt_end: trace statement (depth=3, user=root, query='CALL proc1()', query1='SELECT "proc1 stmt#2"', digest='(null)', app[], call[])
+> tm_stmt_end: trace statement (depth=2, user=root, query='CALL proc2()', query1='CALL proc1()', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=2, user=root, host=localhost, db=test, query='CALL proc2()')
+> tm_stmt_start: proceed further (depth=3, user=root, host=localhost, db=test, query='CALL proc1()')
+> tm_stmt_end: trace statement (depth=3, user=root, query='CALL proc1()', query1='SELECT "proc1 stmt#1"', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=3, user=root, host=localhost, db=test, query='CALL proc1()')
+> tm_stmt_end: trace statement (depth=3, user=root, query='CALL proc1()', query1='SELECT "proc1 stmt#2"', digest='(null)', app[], call[])
+> tm_stmt_end: trace statement (depth=2, user=root, query='CALL proc2()', query1='CALL proc1()', digest='(null)', app[], call[])
+> tm_stmt_end: trace statement (depth=1, user=root, query='', query1='CALL proc2()', digest='CALL `proc2` ( )', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SELECT 12')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CALL proc2()')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL proc2()')
+> tm_stmt_start: discard substatement (user=root, host=localhost, db=test, query='CALL proc1()'), its root statement will be filtered out
+> tm_stmt_start: discard substatement (user=root, host=localhost, db=test, query='CALL proc1()'), its root statement will be filtered out
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL proc2()', query1='CALL proc1()', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL proc2()')
+> tm_stmt_start: discard substatement (user=root, host=localhost, db=test, query='CALL proc1()'), its root statement will be filtered out
+> tm_stmt_start: discard substatement (user=root, host=localhost, db=test, query='CALL proc1()'), its root statement will be filtered out
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL proc2()', query1='CALL proc1()', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE FUNCTION SayHi( name VARCHAR(20) )
+RETURNS VARCHAR(30)
+DETERMINISTIC
+BEGIN
+DECLARE greeting VARCHAR(20);
+SET greeting = CONCAT('Hi ', name);
+RETURN greeting;
+END')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"activate": "on"}]
+> tm_stmt_notify_qa: proceed further (depth=1, with_qa=1, user=root, query='SELECT SayHi('Marc')', app[], call[])
+> tm_stmt_start: proceed further (depth=2, user=root, host=localhost, db=test, query='SELECT SayHi('Marc')')
+> tm_stmt_end: trace statement (depth=2, user=root, query='SELECT SayHi('Marc')', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=2, user=root, host=localhost, db=test, query='SELECT SayHi('Marc')')
+> tm_stmt_end: trace statement (depth=2, user=root, query='SELECT SayHi('Marc')', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=2, user=root, host=localhost, db=test, query='SELECT SayHi('Marc')')
+> tm_stmt_end: trace statement (depth=2, user=root, query='SELECT SayHi('Marc')', query1='', digest='(null)', app[], call[])
+> tm_stmt_end: trace statement (depth=1, user=root, query='', query1='SELECT SayHi('Marc')', digest='SELECT `SayHi` (?)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='PREPARE stmt1 FROM ...')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SET @a = 4')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='EXECUTE stmt1 USING @a')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DEALLOCATE PREPARE stmt1')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE TABLE t1 (s1 INT) ENGINE=InnoDB')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='START TRANSACTION')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"activate": "on"}]
+> tm_stmt_notify_qa: proceed further (depth=1, with_qa=1, user=root, query='INSERT INTO t1 VALUES (1),(2)', app[], call[])
+> tm_stmt_end: trace statement (depth=1, user=root, query='', query1='INSERT INTO t1 VALUES (1),(2)', digest='INSERT INTO `t1` VALUES (?) /* , ... */', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='ROLLBACK')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='INSERT INTO t1 VALUES (1),(2)')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE PROCEDURE curdemo()
+BEGIN
+DECLARE done INT DEFAULT FALSE;
+DECLARE a INT;
+DECLARE t1_cursor CURSOR FOR SELECT s1 FROM t1;
+DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+OPEN t1_cursor;
+read_loop: LOOP
+FETCH t1_cursor INTO a;
+IF done THEN
+LEAVE read_loop;
+END IF;
+END LOOP;
+CLOSE t1_cursor;
+END')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CALL curdemo()')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL curdemo()')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL curdemo()', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE TRIGGER valcheck BEFORE INSERT ON t1 FOR EACH ROW IF NEW.s1 < 0 THEN SET NEW.s1 = 0; END IF')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='INSERT INTO t1 VALUES (1),(-2)')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='INSERT INTO t1 VALUES (1),(-2)')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='INSERT INTO t1 VALUES (1),(-2)', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='INSERT INTO t1 VALUES (1),(-2)')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='INSERT INTO t1 VALUES (1),(-2)', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='INSERT INTO t1 VALUES (1),(-2)')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='INSERT INTO t1 VALUES (1),(-2)', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='INSERT INTO t1 VALUES (1),(-2)')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='INSERT INTO t1 VALUES (1),(-2)', query1='', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DROP TRIGGER valcheck')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE DEFINER=root@localhost VIEW big_nums AS SELECT s1 FROM t1 WHERE s1 > 1')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SELECT count(*) FROM big_nums')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE EVENT new_item ON SCHEDULE AT CURRENT_TIMESTAMP DO INSERT INTO t1 VALUES(100)')
+ tm_session_create: telemetry session started, increase refcount by user=event_scheduler to 2
+> tm_stmt_start: proceed further (depth=1, user=event_scheduler, host=localhost, db=, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=event_scheduler, query='')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CREATE PROCEDURE `new_item`() SQL SECURITY INVOKER INSERT INTO t1 VALUES(100)')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CREATE PROCEDURE `new_item`() SQL SECURITY INVOKER INSERT INTO t1 VALUES(100)', query1='INSERT INTO t1 VALUES(100)', digest='(null)', app[], call[])
+ tm_session_destroy: telemetry session ended, decrease refcount to 1
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SELECT wrong FROM t1')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"activate": "on"}]
+> tm_stmt_notify_qa: proceed further (depth=1, with_qa=1, user=root, query='SEEELECT s1 FROM t1', app[], call[])
+> tm_stmt_end: trace statement (depth=1, user=root, query='', query1='SEEELECT s1 FROM t1', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='EXPLAIN SELECT s1 FROM t1')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DESCRIBE t1')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DROP TABLE t1')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SHOW PROCESSLIST')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE PROCEDURE SetMemLimit( amount INT )
+BEGIN
+SET @@GLOBAL.connection_memory_limit=amount;
+END')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CALL SetMemLimit(33333333)')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='CALL SetMemLimit(33333333)')
+> tm_stmt_end: discard substatement, root discarded (depth=1, user=root, query='CALL SetMemLimit(33333333)', query1='SET @@GLOBAL.connection_memory_limit=amount', digest='(null)', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='INSTALL COMPONENT "file://component_test_mysql_command_services"')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SELECT test_mysql_command_services_udf("SELECT 1+1")')
+> tm_stmt_start: proceed further (depth=1, user=mysql.session, host=localhost, db=, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=mysql.session, query='SELECT 1+1')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='UNINSTALL COMPONENT "file://component_test_mysql_command_services"')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE TABLE t2 (s1 INT) ENGINE=MEMORY')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+> tm_stmt_notify_qa: all query attributes [{"activate": "on"}]
+> tm_stmt_notify_qa: proceed further (depth=1, with_qa=1, user=root, query='INSERT INTO t2 VALUES (1),(2)', app[], call[])
+> tm_stmt_end: trace statement (depth=1, user=root, query='', query1='INSERT INTO t2 VALUES (1),(2)', digest='INSERT INTO `t2` VALUES (?) /* , ... */', app[], call[])
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DROP TABLE t2')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='CREATE PROCEDURE obfuscate_this_2(a DECIMAL(2,2))
+SET PASSWORD FOR internal='CmdrShepard'')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SET CHARACTER SET cp1250_latin2')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SELECT '£¥ª¯'')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SET CHARACTER SET default')
+ tm_session_connect: client session started (user=api)
+ tm_session_create: telemetry session started, increase refcount by user=api to 2
+> tm_stmt_start: proceed further (depth=1, user=api, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=api, query='SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions"')
+> tm_stmt_start: proceed further (depth=1, user=api, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=api, query='')
+ tm_session_destroy: telemetry session ended, decrease refcount to 1
+ tm_session_disconnect: client session ended (user=api)
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions"')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='USE mysql')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=mysql, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='USE test')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SET @@GLOBAL.connection_memory_limit= @mem_limit_orig')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DROP PROCEDURE proc2')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DROP PROCEDURE proc1')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DROP FUNCTION SayHi')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DROP PROCEDURE SetMemLimit')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DROP PROCEDURE curdemo')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DROP VIEW big_nums')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DROP PROCEDURE obfuscate_this_2')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DROP USER internal@localhost')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DROP USER api@localhost')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='DROP USER normal@localhost')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SELECT variable_value FROM performance_schema.global_status WHERE variable_name="test_server_telemetry_traces.live_sessions"')
+> tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=test, query='')
+ > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='UNINSTALL COMPONENT 'file://component_test_server_telemetry_traces'')
+test_server_telemetry_traces_component_deinit:
+ - Telemetry statement callbacks unregistered.
+ tm_session_destroy: telemetry session ended, decrease refcount to 0
+ - Current session aborted.
+ - Done waiting for telemetry sessions to finish (refcount = 0).
+ - Telemetry session callbacks unregistered.
+ - Telemetry per-session data slot unregistered.
+ - Status variables unregistered.
+ - System variables unregistered.
+ - UDFs unregistered.
+End of deinit
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_admin_interface.result b/mysql-test/suite/thread_pool/r/thread_pool_admin_interface.result
new file mode 100644
index 000000000000..e7bf9c7ff917
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_admin_interface.result
@@ -0,0 +1,195 @@
+#
+# WL#12138 -- Add Admin Port
+#
+# Create the user u1
+CREATE USER u1;
+# Grant the user u1 the privilege SERVICE_CONNECTION_ADMIN
+GRANT SERVICE_CONNECTION_ADMIN ON *.* TO u1;
+# Create the user u2
+CREATE USER u2;
+# Create the user u3
+CREATE USER u3;
+# Grant the user u3 the privilege SERVICE_CONNECTION_ADMIN
+GRANT SUPER ON *.* TO u3;
+Warnings:
+Warning 1287 The SUPER privilege identifier is deprecated
+# Stop DB server which was created by MTR default
+# Test case 1
+# Check that specially treated value :: is not allowed as part of
+# option admin-address.
+Pattern "Invalid value for command line option admin-address: '::'" found
+# Test case 2
+# Check that specially treated value * is not allowed as part of
+# option admin-address.
+Pattern "Invalid value for command line option admin-address: '*'" found
+# Test case 3
+# Check that specially treated value 0.0.0.0 is not allowed as part of
+# option admin-address.
+Pattern "Invalid value for command line option admin-address: '0.0.0.0'" found
+# Test case 4
+# Check that non-existent host name specified as a value of the option admin-address results in error on server starting up.
+# option admin-address.
+Pattern "Can't start server: cannot resolve hostname" found
+# Starting up server with --admin-address=127.0.0.1 --max-connections=2
+# restart: --admin-address=127.0.0.1 --admin-port=ADMIN_PORT --max-connections=2
+# Test case 5
+# Check that ordinary connection using tcp protocol can be established
+connect ordinary_tcp_con,localhost,root,,,,,TCP;
+SELECT CURRENT_USER();
+CURRENT_USER()
+root@localhost
+disconnect ordinary_tcp_con;
+# Check error when starting a server having admin port which is busy
+Pattern "Can't start server: Bind on TCP/IP port: (Address .*in use|Only one usage of each socket address .* normally permitted)" found
+# Test case 6
+# Check that ordinary connection using default connection method can be established
+connect ordinary_con,localhost,root,,,,,;
+SELECT CURRENT_USER();
+CURRENT_USER()
+root@localhost
+disconnect ordinary_con;
+# Test case 7
+# Check that admin connection using tcp protocol can be established
+connect admin_tcp_con,127.0.0.1,root,,,$MASTER_ADMINPORT,,TCP;
+SELECT CURRENT_USER();
+CURRENT_USER()
+root@localhost
+# Check that a system message about the admin interface is written
+# to the error log
+Pattern "\[System\] \[MY\-[0-9]+\] \[Server\] Admin interface ready for connections, address: \'127.0.0.1\' port: ADMIN_PORT" found
+disconnect admin_tcp_con;
+# Test case 8
+# Check that the user u1 can establish connection to admin interface since
+# this user has the privilege SERVICE_CONNECTION_ADMIN
+connect admin_tcp_con_u1,127.0.0.1,u1,,,$MASTER_ADMINPORT,,TCP;
+SELECT CURRENT_USER();
+CURRENT_USER()
+u1@%
+disconnect admin_tcp_con_u1;
+# Test case 9
+# Check that the user u2 can't establish connection to admin interface since
+# this user doesn't have the privilege SERVICE_CONNECTION_ADMIN
+connection default;
+connect(127.0.0.1,u2,,test,ADMIN_PORT,SOURCE_SOCKET);
+connect admin_tcp_con_u2,127.0.0.1,u2,,,$MASTER_ADMINPORT,,TCP;
+ERROR 42000: Access denied; you need (at least one of) the SERVICE_CONNECTION_ADMIN privilege(s) for this operation
+# Check that the user u3 can't establish connection to admin interface since
+# this user doesn't have the privilege SERVICE_CONNECTION_ADMIN
+connect(127.0.0.1,u3,,test,ADMIN_PORT,SOURCE_SOCKET);
+connect admin_tcp_con_u3,127.0.0.1,u3,,,$MASTER_ADMINPORT,,TCP;
+ERROR 42000: Access denied; you need (at least one of) the SERVICE_CONNECTION_ADMIN privilege(s) for this operation
+connection default;
+# Wait until the failed connections are gone.
+# Test case 10
+# Check that the parameter max_connections does affect to an ordinary
+# connection and doesn't affect to a connection made to admin interface
+connect ordinary_con_1,localhost,u1,,,,,;
+# Show how many active connections exist after the connection
+# ordinary_con_1 established
+SHOW STATUS LIKE 'Threads_connected';
+Variable_name Value
+Threads_connected 2
+# Since server was started with the option --max-connections=2 and
+# there are already two active connections (the first one is for
+# the default connection and the second one is for the connection
+# ordinary_con_1) an attempt to connect to the server results in
+# error ER_CON_COUNT_ERROR
+connect(localhost,u2,,test,SOURCE_PORT,SOURCE_SOCKET);
+connect ordinary_con_2,localhost,u2,,,,,;
+ERROR 08004: Too many connections
+# Check that attempt to establish the third connection to admin interface
+# doesn't result in error
+connect admin_con_3,localhost,u1,,,$MASTER_ADMINPORT,,TCP;
+# Check that total number of concurrent connection made to admin interface
+# is not limited by the value max-connections + 1
+connect admin_con_4,localhost,u1,,,$MASTER_ADMINPORT,,TCP;
+connection ordinary_con_1;
+disconnect ordinary_con_1;
+connection admin_con_3;
+disconnect admin_con_3;
+connection admin_con_4;
+disconnect admin_con_4;
+connection default;
+# Test case 11
+# Check that a dedicated thread for handling connection requests
+# on admin interface is not running in case a server started without
+# the option --create-admin-listener-thread=true
+SELECT name, type FROM performance_schema.threads WHERE name = 'thread/sql/admin_interface';
+name type
+# Stop DB server
+# Starting up server with --admin-address=127.0.0.1,
+# handle connections on admin interface by a dedicated thread
+# restart: --admin-address=127.0.0.1 --admin-port=ADMIN_PORT --create-admin-listener-thread=true
+# Test case 12
+# Check that a dedicated thread for handling connection requests on
+# admin interface is running in case a server started with the option
+# --create-admin-listener-thread=true
+SELECT name, type FROM performance_schema.threads WHERE name = 'thread/sql/admin_interface';
+name type
+thread/sql/admin_interface BACKGROUND
+# Test case 13
+# Check that admin connection using tcp protocol can be established
+# when a server is started with option --create-admin-listener-thread=true
+connect admin_tcp_con,127.0.0.1,root,,,$MASTER_ADMINPORT,,TCP;
+SELECT CURRENT_USER();
+CURRENT_USER()
+root@localhost
+disconnect admin_tcp_con;
+# Test case 14
+# Check that admin interface is turned off
+# in case a server started with the --skip-networking option
+connection default;
+# Stop DB server
+# Starting up server with --admin-address=127.0.0.1 --skip-networking
+# restart: --admin-address=127.0.0.1 --admin-port=ADMIN_PORT --skip-networking
+connect(127.0.0.1,root,,test,ADMIN_PORT,SOURCE_SOCKET);
+connect admin_tcp_con,127.0.0.1,root,,,$MASTER_ADMINPORT,,TCP;
+# Test case 15
+# Check that admin interface is turned off in case a server started
+# with the --skip-grant-tables option. If the server is started with
+# the --skip-grant-tables option to disable authentication checks,
+# the server enables --skip-networking automatically to prevent remote
+# connections. Therefore, listening on admin interface must be disabled too.
+connection default;
+# Stop DB server
+# Starting up server with --admin-address=127.0.0.1 --skip-grant-tables
+# restart: --admin-address=127.0.0.1 --admin-port=ADMIN_PORT --skip-grant-tables
+connect(127.0.0.1,root,,test,ADMIN_PORT,SOURCE_SOCKET);
+connect admin_tcp_con,127.0.0.1,root,,,$MASTER_ADMINPORT,,TCP;
+connection default;
+# Stop DB server
+# Test case 16
+# Check that admin interface is not setup when the option
+# --admin-port is specified without --admin-address
+# restart: --admin-port=ADMIN_PORT
+connect ordinary_tcp_con,localhost,root,,,,,TCP;
+SELECT CURRENT_USER();
+CURRENT_USER()
+root@localhost
+SELECT @@admin_address, @@admin_port;
+@@admin_address @@admin_port
+NULL ADMIN_PORT
+disconnect ordinary_tcp_con;
+connect(127.0.0.1,root,,test,ADMIN_PORT,SOURCE_SOCKET);
+connect admin_tcp_con,127.0.0.1,root,,,$MASTER_ADMINPORT,,TCP;
+# Test case 17
+# Check that we can connect to the server if admin
+# interface is set up on loopback IPV6 address
+connection default;
+# restart: --skip-name-resolve --admin-address=::1 --admin-port=ADMIN_PORT
+connect admin_tcp_con_ipv6,::1,u1,,,$MASTER_ADMINPORT,,TCP;
+SELECT @@admin_address, @@admin_port;
+@@admin_address @@admin_port
+::1 ADMIN_PORT
+disconnect admin_tcp_con_ipv6;
+connection default;
+# Stop DB server
+#
+# Starting mysqld in the regular mode...
+#
+connection default;
+# restart
+# Cleaning up
+DROP USER u1;
+DROP USER u2;
+DROP USER u3;
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_admin_interface_ipv4_mapped.result b/mysql-test/suite/thread_pool/r/thread_pool_admin_interface_ipv4_mapped.result
new file mode 100644
index 000000000000..6eac2f2cef01
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_admin_interface_ipv4_mapped.result
@@ -0,0 +1,9 @@
+# restart: --skip-name-resolve --admin-address=::ffff:127.0.0.1 --admin_port=ADMIN_PORT
+# Checking ::ffff:127.0.0.1 ...
+mysqld is alive
+# Checking 127.0.0.1 ...
+mysqld is alive
+#
+# Starting mysqld in the regular mode...
+#
+# restart
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_algorithm_basic.result b/mysql-test/suite/thread_pool/r/thread_pool_algorithm_basic.result
new file mode 100644
index 000000000000..112a821a9c27
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_algorithm_basic.result
@@ -0,0 +1,43 @@
+SET @default_val = 1;
+SET @some_val = 0;
+SELECT @some_val <> @default_val AS "Expect 1";
+Expect 1
+1
+CREATE USER low_priv@localhost;
+GRANT USAGE ON test.* TO low_priv@localhost;
+SET @default_val = ;
+#---------------------BS_STVARS_101_01----------------------#
+SELECT @@GLOBAL.thread_pool_algorithm = @default_val AS "Expect 1";
+Expect 1
+1
+SELECT @@SESSION.thread_pool_algorithm = @default_val AS "Expect 1";
+ERROR HY000: Variable 'thread_pool_algorithm' is a GLOBAL variable
+SELECT @@GLOBAL.thread_pool_algorithm = @default_val AS "Expect 1";
+Expect 1
+1
+DROP USER low_priv@localhost;
+#---------------------BS_STVARS_101_02----------------------#
+SET @@GLOBAL.thread_pool_algorithm = @some_val;
+ERROR HY000: Variable 'thread_pool_algorithm' is a read only variable
+SELECT @@GLOBAL.thread_pool_algorithm = @default_val AS "Expect 1";
+Expect 1
+1
+#---------------------BS_STVARS_101_03----------------------#
+SELECT @@GLOBAL.thread_pool_algorithm = VARIABLE_VALUE AS "Expect 1"
+FROM performance_schema.global_variables
+WHERE VARIABLE_NAME = 'thread_pool_algorithm';
+Expect 1
+1
+SELECT @@GLOBAL.thread_pool_algorithm = VARIABLE_VALUE AS "Expect 1"
+FROM performance_schema.session_variables
+WHERE VARIABLE_NAME = 'thread_pool_algorithm';
+Expect 1
+1
+#---------------------BS_STVARS_101_04----------------------#
+SELECT @@thread_pool_algorithm = @@GLOBAL.thread_pool_algorithm AS "Expect 1";
+Expect 1
+1
+#---------------------BS_STVARS_101_05----------------------#
+SELECT thread_pool_algorithm = @@GLOBAL.thread_pool_algorithm;
+ERROR 42S22: Unknown column 'thread_pool_algorithm' in 'field list'
+# Expected error ER_BAD_FIELD_ERROR
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_algorithm_wrong_max.result b/mysql-test/suite/thread_pool/r/thread_pool_algorithm_wrong_max.result
new file mode 100644
index 000000000000..d7c714f0a894
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_algorithm_wrong_max.result
@@ -0,0 +1,8 @@
+# Check for expected content in mysqld.1.err
+include/assert_grep.inc [option 'thread-pool-algorithm':.*value .* adjusted to 1 found]
+SET SESSION thread_pool_algorithm = 2;
+ERROR HY000: Variable 'thread_pool_algorithm' is a read only variable
+SET GLOBAL thread_pool_algorithm = 2;
+ERROR HY000: Variable 'thread_pool_algorithm' is a read only variable
+SET GLOBAL thread_pool_algorithm = 0;
+ERROR HY000: Variable 'thread_pool_algorithm' is a read only variable
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_algorithm_wrong_min.result b/mysql-test/suite/thread_pool/r/thread_pool_algorithm_wrong_min.result
new file mode 100644
index 000000000000..4e17816e951e
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_algorithm_wrong_min.result
@@ -0,0 +1,8 @@
+# Check for expected content in mysqld.1.err
+include/assert_grep.inc [option 'thread-pool-algorithm':.*value .* adjusted to 0 found]
+SET SESSION thread_pool_algorithm = -1;
+ERROR HY000: Variable 'thread_pool_algorithm' is a read only variable
+SET GLOBAL thread_pool_algorithm = -1;
+ERROR HY000: Variable 'thread_pool_algorithm' is a read only variable
+SET GLOBAL thread_pool_algorithm = 0;
+ERROR HY000: Variable 'thread_pool_algorithm' is a read only variable
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_auth_fail_max_connect_threads.result b/mysql-test/suite/thread_pool/r/thread_pool_auth_fail_max_connect_threads.result
new file mode 100644
index 000000000000..dd18c7e59b38
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_auth_fail_max_connect_threads.result
@@ -0,0 +1,8 @@
+CREATE USER tp_user1@localhost IDENTIFIED BY 'pass1';
+GRANT SELECT ON *.* TO tp_user1@localhost;
+# Adding debug point 'simulate_max_connect_threads_per_group' to @@GLOBAL.debug
+# Adding debug point 'sleep_before_handling_connection' to @@GLOBAL.debug
+# Removing debug point 'simulate_max_connect_threads_per_group' from @@GLOBAL.debug
+# Removing debug point 'sleep_before_handling_connection' from @@GLOBAL.debug
+# restart
+DROP USER tp_user1@localhost;
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_basic.result b/mysql-test/suite/thread_pool/r/thread_pool_basic.result
new file mode 100644
index 000000000000..63d9fa9970b0
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_basic.result
@@ -0,0 +1,7 @@
+SELECT PLUGIN_NAME, PLUGIN_TYPE, PLUGIN_STATUS
+FROM INFORMATION_SCHEMA.PLUGINS
+WHERE PLUGIN_NAME = 'THREAD_POOL';
+PLUGIN_NAME PLUGIN_TYPE PLUGIN_STATUS
+thread_pool DAEMON ACTIVE
+UNINSTALL PLUGIN thread_pool;
+ERROR HY000: Plugin 'thread_pool' is marked as not dynamically uninstallable. You have to stop the server to uninstall it.
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_connect.result b/mysql-test/suite/thread_pool/r/thread_pool_connect.result
new file mode 100644
index 000000000000..0b5661ad0806
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_connect.result
@@ -0,0 +1,405 @@
+set global log_error_verbosity= 1;
+drop table if exists t1,t2;
+show tables where Tables_in_mysql != 'ndb_binlog_index';
+Tables_in_mysql
+columns_priv
+component
+db
+default_roles
+engine_cost
+func
+general_log
+global_grants
+gtid_executed
+help_category
+help_keyword
+help_relation
+help_topic
+innodb_index_stats
+innodb_table_stats
+password_history
+plugin
+procs_priv
+proxies_priv
+replication_asynchronous_connection_failover
+replication_asynchronous_connection_failover_managed
+replication_group_configuration_version
+replication_group_member_actions
+role_edges
+server_cost
+servers
+slave_master_info
+slave_relay_log_info
+slave_worker_info
+slow_log
+tables_priv
+time_zone
+time_zone_leap_second
+time_zone_name
+time_zone_transition
+time_zone_transition_type
+user
+show tables;
+Tables_in_test
+connect(localhost,root,z,test2,SOURCE_PORT,SOURCE_SOCKET);
+ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
+connect(localhost,root,z,test,SOURCE_PORT,SOURCE_SOCKET);
+ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
+create user test@localhost identified by "gambling";
+grant ALL on *.* to test@localhost;
+create user test@127.0.0.1 identified by "gambling";
+grant ALL on *.* to test@127.0.0.1;
+show tables where Tables_in_mysql != 'ndb_binlog_index';
+Tables_in_mysql
+columns_priv
+component
+db
+default_roles
+engine_cost
+func
+general_log
+global_grants
+gtid_executed
+help_category
+help_keyword
+help_relation
+help_topic
+innodb_index_stats
+innodb_table_stats
+password_history
+plugin
+procs_priv
+proxies_priv
+replication_asynchronous_connection_failover
+replication_asynchronous_connection_failover_managed
+replication_group_configuration_version
+replication_group_member_actions
+role_edges
+server_cost
+servers
+slave_master_info
+slave_relay_log_info
+slave_worker_info
+slow_log
+tables_priv
+time_zone
+time_zone_leap_second
+time_zone_name
+time_zone_transition
+time_zone_transition_type
+user
+show tables;
+Tables_in_test
+connect(localhost,test,,test2,SOURCE_PORT,SOURCE_SOCKET);
+ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
+connect(localhost,test,,"",SOURCE_PORT,SOURCE_SOCKET);
+ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
+connect(localhost,test,zorro,test2,SOURCE_PORT,SOURCE_SOCKET);
+ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
+connect(localhost,test,zorro,test,SOURCE_PORT,SOURCE_SOCKET);
+ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
+connect(localhost,test,,test2,SOURCE_PORT,SOURCE_SOCKET);
+ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
+connect(localhost,test,,test,SOURCE_PORT,SOURCE_SOCKET);
+ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
+drop user test@localhost;
+drop user test@127.0.0.1;
+create table t1 (id integer not null auto_increment primary key);
+create temporary table t2(id integer not null auto_increment primary key);
+set @id := 1;
+delete from t1 where id like @id;
+drop table t1;
+# ------------------------------------------------------------------
+# -- End of 4.1 tests
+# ------------------------------------------------------------------
+
+# -- Bug#33507: Event scheduler creates more threads than max_connections
+# -- which results in user lockout.
+
+CREATE USER mysqltest_u1@localhost;
+
+SET GLOBAL max_connections = 3;
+SELECT COUNT(*) = 1 FROM information_schema.processlist
+WHERE user = 'event_scheduler' AND command = 'Daemon';
+COUNT(*) = 1
+1
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+
+# -- Disconnecting default connection...
+
+# -- Check that we allow exactly three user connections, no matter how
+# -- many threads are running.
+
+# -- Connecting (1)...
+# -- Establishing connection 'con_1' (user: mysqltest_u1)...
+# -- Connection 'con_1' has been established.
+
+# -- Connecting (2)...
+# -- Establishing connection 'con_2' (user: mysqltest_u1)...
+# -- Connection 'con_2' has been established.
+
+# -- Connecting (3)...
+# -- Establishing connection 'con_3' (user: mysqltest_u1)...
+# -- Connection 'con_3' has been established.
+
+# -- Connecting (4) [should fail]...
+# -- Establishing connection 'con_4' (user: mysqltest_u1)...
+# -- Error: can not establish connection 'con_4'.
+
+# -- Check that we allow one extra SUPER-user connection.
+
+# -- Connecting super (1)...
+# -- Establishing connection 'con_super_1' (user: root)...
+# -- Connection 'con_super_1' has been established.
+
+# -- Connecting super (2) [should fail]...
+# -- Establishing connection 'con_super_2' (user: root)...
+# -- Error: can not establish connection 'con_super_2'.
+
+# -- Ensure that we have Event Scheduler thread, 3 ordinary user
+# -- connections and one extra super-user connection.
+SELECT user FROM information_schema.processlist ORDER BY id;
+user
+event_scheduler
+mysqltest_u1
+mysqltest_u1
+mysqltest_u1
+root
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+
+# -- Resetting variables...
+SET GLOBAL max_connections = 151;
+
+# -- That's it. Closing connections...
+
+# -- Restoring default connection...
+
+# -- Waiting for connections to close...
+
+DROP USER mysqltest_u1@localhost;
+
+# -- End of Bug#33507.
+
+# -- Bug#35074: max_used_connections is not correct.
+
+FLUSH STATUS;
+
+SHOW STATUS LIKE 'max_used_connections';
+Variable_name Value
+Max_used_connections 1
+# -- Waiting for Event Scheduler to start...
+
+# -- Opening a new connection to check max_used_connections...
+
+# -- Check that max_used_connections hasn't changed.
+SHOW STATUS LIKE 'max_used_connections';
+Variable_name Value
+Max_used_connections 2
+SELECT COUNT(*) = 1 FROM information_schema.processlist
+WHERE user = 'event_scheduler' AND command = 'Daemon';
+COUNT(*) = 1
+1
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+
+# -- Closing new connection...
+
+# -- End of Bug#35074.
+
+# ------------------------------------------------------------------
+# -- End of 5.1 tests
+# ------------------------------------------------------------------
+#
+# WL#2392: Change Password at next login
+#
+CREATE USER must_change@localhost IDENTIFIED BY 'aha';
+SELECT password_expired FROM mysql.user
+WHERE user='must_change' and host = 'localhost';
+password_expired
+N
+SELECT USER();
+USER()
+must_change@localhost
+CREATE TABLE t1 (A INT);
+CREATE PROCEDURE TEST_t1(new_a INT) INSERT INTO t1 VALUES (new_a);
+CREATE FUNCTION last_t1() RETURNS INT RETURN (SELECT MAX(A) FROM t1);
+# Initialize the table
+CALL test_t1(1);
+UPDATE mysql.user SET password_expired='Y'
+ WHERE user='must_change' and host = 'localhost';
+# without FLUSH the field has no effect
+# must not throw an error
+SELECT USER();
+USER()
+must_change@localhost
+# must not throw an error
+SELECT last_t1();
+last_t1()
+1
+# must not throw an error
+CALL test_t1(last_t1() + 1);
+FLUSH PRIVILEGES;
+Warnings:
+Warning 1681 'FLUSH PRIVILEGES' is deprecated and will be removed in a future release.
+# existing connections continue as before even after flush
+# must not throw an error
+SELECT USER();
+USER()
+must_change@localhost
+# must not throw an error
+SELECT last_t1();
+last_t1()
+2
+# must not throw an error
+CALL test_t1(last_t1() + 1);
+# new connections are blocked until a password reset
+SELECT USER();
+ERROR HY000: You must reset your password using ALTER USER statement before executing this statement.
+SELECT last_t1();
+ERROR HY000: You must reset your password using ALTER USER statement before executing this statement.
+CALL test_t1(last_t1() + 1);
+ERROR HY000: You must reset your password using ALTER USER statement before executing this statement.
+# setting a password unlocks it
+ALTER USER must_change@localhost IDENTIFIED BY 'aha2';
+# must not throw an error
+SELECT USER();
+USER()
+must_change@localhost
+# must not throw an error
+SELECT last_t1();
+last_t1()
+3
+# must not throw an error
+CALL test_t1(last_t1() + 1);
+# check if SET PASSWORD resets the column
+SELECT password_expired FROM mysql.user
+WHERE user='must_change' and host = 'localhost';
+password_expired
+N
+UPDATE mysql.user SET password_expired='Y'
+ WHERE user='must_change' and host = 'localhost';
+FLUSH PRIVILEGES;
+Warnings:
+Warning 1681 'FLUSH PRIVILEGES' is deprecated and will be removed in a future release.
+SELECT USER();
+ERROR HY000: You must reset your password using ALTER USER statement before executing this statement.
+SELECT last_t1();
+ERROR HY000: You must reset your password using ALTER USER statement before executing this statement.
+CALL test_t1(last_t1() + 1);
+ERROR HY000: You must reset your password using ALTER USER statement before executing this statement.
+# setting a password with a user name is ok if it exactly matches the
+# authenticated user.
+ALTER USER must_change@localhost IDENTIFIED BY 'aha3';
+SELECT USER();
+USER()
+must_change@localhost
+SELECT last_t1();
+last_t1()
+4
+CALL test_t1(last_t1() + 1);
+# setting a password for the current user works
+ALTER USER must_change@localhost IDENTIFIED BY 'aha3';
+SELECT USER();
+USER()
+must_change@localhost
+SELECT last_t1();
+last_t1()
+5
+CALL test_t1(last_t1() + 1);
+# testing the ALTER USER command
+# try a single user
+ALTER USER must_change@localhost PASSWORD EXPIRE;
+SELECT password_expired FROM mysql.user
+WHERE user='must_change' and host = 'localhost';
+password_expired
+Y
+SELECT USER();
+ERROR HY000: You must reset your password using ALTER USER statement before executing this statement.
+ALTER USER must_change@localhost IDENTIFIED BY 'aha4';
+# try a valid+invalid user combo
+ALTER USER
+invalid_user@localhost,
+must_change@localhost PASSWORD EXPIRE;
+ERROR HY000: Operation ALTER USER failed for 'invalid_user'@'localhost' (User account does not exist)
+SELECT password_expired FROM mysql.user
+WHERE user='must_change' and host = 'localhost';
+password_expired
+N
+SELECT USER();
+USER()
+must_change@localhost
+ALTER USER must_change@localhost PASSWORD EXPIRE;
+SELECT password_expired FROM mysql.user
+WHERE user='must_change' and host = 'localhost';
+password_expired
+Y
+SELECT USER();
+ERROR HY000: You must reset your password using ALTER USER statement before executing this statement.
+ALTER USER must_change@localhost IDENTIFIED BY 'aha5';
+SELECT USER();
+USER()
+must_change@localhost
+# Password change must be persistent when reconnecting
+SELECT USER();
+USER()
+must_change@localhost
+# cleanup
+DROP PROCEDURE test_t1;
+DROP FUNCTION last_t1;
+DROP TABLE t1;
+DROP USER must_change@localhost;
+#
+# WL#6587: Protocol support for password expiration
+#
+CREATE USER wl6587@localhost IDENTIFIED BY 'wl6587';
+ALTER USER wl6587@localhost PASSWORD EXPIRE;
+# non-interactive mysql should fail
+mysql: [Warning] Using a password on the command line interface can be insecure.
+Please use --connect-expired-password option or invoke mysql in interactive mode.
+# mysqladmin non-password should fail
+mysqladmin: [Warning] Using a password on the command line interface can be insecure.
+mysqladmin: connect to server at 'localhost' failed
+error: 'Your password has expired. To log in you must change it using a client that supports expired passwords.'
+# mysqladmin password should work
+mysqladmin: [Warning] Using a password on the command line interface can be insecure.
+DROP USER wl6587@localhost;
+# ------------------------------------------------------------------
+# -- End of 5.6 tests
+# ------------------------------------------------------------------
+#
+# BUG#27539838: NOT ALL ABORTED CONNECTS ARE REPORTED TO ERROR.LOG
+# PROPERLY
+#
+# restart: --log-error=LOG_ERR --log-error-verbosity=3
+SHOW STATUS LIKE 'Aborted_connects';
+Variable_name Value
+Aborted_connects 0
+
+# Case 1: Connection attempt by an invalid user
+connect(localhost,newuser,,test,SOURCE_PORT,SOURCE_SOCKET);
+ERROR 28000: Access denied for user 'newuser'@'localhost' (using password: NO)
+Pattern "Access denied for user 'newuser'@'localhost' \(using password: NO\)" found
+
+# Case 2: Connection attempt by a valid user with incorrect password
+connect(localhost,root,1234,test,SOURCE_PORT,SOURCE_SOCKET);
+ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
+Pattern "Access denied for user 'root'@'localhost' \(using password: YES\)" found
+CREATE DATABASE test1;
+CREATE USER 'new1'@'localhost';
+
+# Case 3: Connection attempt by a valid user with no privileges to access a database
+connect(localhost,new1,,test1,SOURCE_PORT,SOURCE_SOCKET);
+ERROR 42000: Access denied for user 'new1'@'localhost' to database 'test1'
+Pattern "Access denied for user 'new1'@'localhost' to database 'test1'" found
+
+# Case 4: SSL connection attempt without necessary certificates
+Pattern "Got an error reading communication packets" found
+SHOW STATUS LIKE 'Aborted_connects';
+Variable_name Value
+Aborted_connects 4
+DROP USER 'new1'@'localhost';
+DROP DATABASE test1;
+set global log_error_verbosity= STARTVAL;
+# restart:
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_connection_abort_stats.result b/mysql-test/suite/thread_pool/r/thread_pool_connection_abort_stats.result
new file mode 100644
index 000000000000..826a02d57ef6
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_connection_abort_stats.result
@@ -0,0 +1,20 @@
+#
+#
+# BUG 14081240 - THREAD POOL BASED CONNECTIONS CAUSE
+# CAUSE ABORTED_CLIENTS TO BE INCREMENTED.
+#
+#
+connect con1, localhost, root,,;
+connect con2, localhost, root,,;
+connect con3, localhost, root,,;
+connection default;
+disconnect con1;
+disconnect con2;
+# Abort con3 via KILL.
+SET @connection_id= ID;
+KILL @connection_id;
+# Wait for connection to be killed before getting Aborted_clients.
+# Aborted_clients value must be 1.
+SHOW GLOBAL STATUS LIKE "Aborted_clients";
+Variable_name Value
+Aborted_clients 1
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_connection_handler.result b/mysql-test/suite/thread_pool/r/thread_pool_connection_handler.result
new file mode 100644
index 000000000000..522ee86e8a30
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_connection_handler.result
@@ -0,0 +1,58 @@
+# Need to start with just one connection. Otherwise the check against
+# max_connections = 3 will fail earlier than expected. With thread pool
+# connections are established asynchronously by a connection handler
+# thread so it may take a while for the connection_count variable to
+# be decremented when connection creation fails.
+SHOW GLOBAL STATUS LIKE 'Threads_connected';
+Variable_name Value
+Threads_connected 1
+SET @old_debug= @@GLOBAL.debug;
+SET @orig_max_connections= @@global.max_connections;
+connect con1, localhost, root,,mysql;
+SELECT 1;
+1
+1
+connect con2, localhost, root,,mysql;
+SELECT 1;
+1
+1
+connect con3, localhost, root,,mysql;
+SELECT 1;
+1
+1
+disconnect con3;
+connection con2;
+disconnect con2;
+connection con1;
+disconnect con1;
+connection default;
+call mtr.add_suppression("Too many connections");
+set global max_connections= 3;
+connect con1, localhost, root,,mysql;
+connect con2, localhost, root,,mysql;
+connect con3, localhost, root,,mysql;
+connect(localhost,root,,mysql,MYSQL_PORT,MYSQL_SOCK);
+connect con4, localhost, root,,mysql;
+ERROR HY000: Too many connections
+connection con3;
+disconnect con3;
+connection con2;
+disconnect con2;
+connection con1;
+disconnect con1;
+connection default;
+SET GLOBAL debug= '+d,simulate_resource_failure';
+SHOW VARIABLES like 'DEBUG';
+Variable_name Value
+debug d,simulate_resource_failure
+call mtr.add_suppression("Failed to allocate thd");
+call mtr.add_suppression("Out of memory");
+connect(localhost,root,,mysql,MYSQL_PORT,MYSQL_SOCK);
+connect con1, localhost, root,,mysql;
+ERROR HY000: Lost connection to MySQL server at 'reading initial communication packet', system error: NUM
+connection default;
+SHOW GLOBAL STATUS LIKE 'Threads_connected';
+Variable_name Value
+Threads_connected 1
+SET GLOBAL debug= @old_debug;
+SET GLOBAL max_connections= @orig_max_connections;
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_connection_report.result b/mysql-test/suite/thread_pool/r/thread_pool_connection_report.result
new file mode 100644
index 000000000000..9bd360accaec
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_connection_report.result
@@ -0,0 +1,123 @@
+# Setting this means a single connection report
+# will be emitted whenever thread_pool_connection_report_interval
+# is set (to a legal value).
+SET GLOBAL DEBUG = "+d,tp_force_connection_report";
+# The illegal value 1 in -master.opt is ignored replaced with 0 (OFF)
+SELECT @@GLOBAL.thread_pool_connection_report_interval;
+@@GLOBAL.thread_pool_connection_report_interval
+120
+SET GLOBAL thread_pool_connection_report_interval = 59;
+ERROR 42000: Variable 'thread_pool_connection_report_interval' can't be set to the value of '59'
+SELECT NOW(6) INTO @now_var;
+SET GLOBAL thread_pool_connection_report_interval = 65;
+# This will trigger a connection report, but the result depends on the current state of the server
+# so we don't show the results here.
+SET GLOBAL thread_pool_connection_report_interval = 601;
+ERROR 42000: Variable 'thread_pool_connection_report_interval' can't be set to the value of '601'
+# Turning logging off is allowed
+SELECT NOW(6) INTO @now_var;
+SET GLOBAL thread_pool_connection_report_interval = 0;
+# Expect 1 active usr connection here
+SELECT SUBSTRING(DATA, 105) FROM performance_schema.error_log
+WHERE error_code = 'MY-015509' AND logged > @now_var;
+SUBSTRING(DATA, 105)
+Init: 0, 0, 0, 0, 0. Usr: 1(+0), 1, 0, 0, 0, 0. Adm: 0(+0), 0, 0, 0, 0, 0.
+# Result 1
+CREATE USER u1;
+# Grant the user u1 the privilege SERVICE_CONNECTION_ADMIN
+# so that u1 is able to connect on the admin interface.
+GRANT SERVICE_CONNECTION_ADMIN ON *.* TO u1;
+# Grant the TP-provided dynamic privilege TP_CONNECTION_ADMIN to root
+# so that new connection from root end up in the admin thread group.
+GRANT TP_CONNECTION_ADMIN ON *.* TO root@localhost;
+# New connection with root should end up in admin thread group.
+SELECT CURRENT_USER();
+CURRENT_USER()
+root@localhost
+# Check that the user u1 can establish connection to admin interface since
+# this user has the privilege SERVICE_CONNECTION_ADMIN
+SELECT CURRENT_USER();
+CURRENT_USER()
+u1@%
+# Verify that failed connections are not counted in connection report.
+ERROR 28000: Access denied for user 'dummy'@'localhost' (using password: NO)
+ERROR 28000: Access denied for user 'dummy'@'localhost' (using password: NO)
+ERROR 28000: Access denied for user 'dummy'@'localhost' (using password: NO)
+ERROR 28000: Access denied for user 'dummy'@'localhost' (using password: NO)
+CREATE TABLE t1(i INT);
+# Force connection report
+SELECT NOW(6) INTO @now_var;
+SET GLOBAL thread_pool_connection_report_interval = 0;
+# Expect usr connection active and two new admin connections, both active
+SELECT SUBSTRING(DATA, 105) FROM performance_schema.error_log
+WHERE error_code = 'MY-015509' AND logged > @now_var;
+SUBSTRING(DATA, 105)
+Init: 6, 0, 0, 4, 2. Usr: 1(+0), 1, 0, 0, 0, 0. Adm: 2(+2), 2, 2, 0, 2, 0.
+# Result 2
+CREATE TABLE t2(i INT);
+INSERT INTO t2 VALUES (0), (1), (2);
+# Force connection report
+SELECT NOW(6) INTO @now_var;
+SET GLOBAL thread_pool_connection_report_interval = 0;
+# Expect 1 active usr connection and two admin connections, one of which is active
+SELECT SUBSTRING(DATA, 105) FROM performance_schema.error_log
+WHERE error_code = 'MY-015509' AND logged > @now_var;
+SUBSTRING(DATA, 105)
+Init: 0, 0, 0, 0, 0. Usr: 1(+0), 1, 0, 0, 0, 0. Adm: 2(+0), 1, 0, 0, 0, 0.
+# Result 3
+SELECT * FROM t1;
+i
+# Wait until only the default connection is listed as active
+SELECT * FROM performance_schema.tp_connections WHERE ACTIVE_FLAG = 1 AND
+(SELECT COUNT(*) > 1 FROM performance_schema.tp_connections WHERE ACTIVE_FLAG = 1);
+CONNECTION_ID TP_GROUP_ID TP_PROCESSING_THREAD_NUMBER THREAD_ID STATE ACTIVE_FLAG KILLED_STATE CLEANUP_STATE TIME_OF_LAST_EVENT_COMPLETION TIME_OF_EXPIRY TIME_OF_ADD TIME_OF_POP TIME_OF_ARM CONNECT_HANDLER_INDEX TYPE DIRECT_QUERY_EVENTS QUEUED_QUERY_EVENTS TIME_OF_EVENT_ARRIVAL MANAGEMENT_TIME
+# Force connection report which we do not report, to allow active counts
+# to stablilize
+SELECT NOW(6) INTO @now_var;
+SET GLOBAL thread_pool_connection_report_interval = 0;
+# Force stable connection report
+SELECT NOW(6) INTO @now_var;
+SET GLOBAL thread_pool_connection_report_interval = 0;
+# Expect 1 active usr connection and two admin connections, none of
+# which are active
+SELECT SUBSTRING(DATA, 105) FROM performance_schema.error_log
+WHERE error_code = 'MY-015509' AND logged > @now_var;
+SUBSTRING(DATA, 105)
+Init: 0, 0, 0, 0, 0. Usr: 1(+0), 1, 0, 0, 0, 0. Adm: 2(+0), 0, 0, 0, 0, 0.
+# Result 4
+# Force connection report
+SELECT NOW(6) INTO @now_var;
+SET GLOBAL thread_pool_connection_report_interval = 0;
+# Expect 1 active usr connection and two closed admin connections
+SELECT SUBSTRING(DATA, 105) FROM performance_schema.error_log
+WHERE error_code = 'MY-015509' AND logged > @now_var;
+SUBSTRING(DATA, 105)
+Init: 0, 0, 0, 0, 0. Usr: 1(+0), 1, 0, 0, 0, 0. Adm: 0(-2), 0, 0, 2, 0, 2.
+# Result 5
+# Connect u1 to the admin port successfully
+# Connect u1 to the user port successfully
+# Connect u1 to the admin port with bad pwd
+# Connect u1 to the user port with bad pwd
+SET GLOBAL DEBUG = "+d,sleep_before_auth";
+# Connect u1 to the admin port, sleep in authentication
+# Connect u1 to the user port, sleep in authentication
+SET GLOBAL DEBUG = "-d,sleep_before_auth";
+SET GLOBAL DEBUG = "+d,sleep_before_handling_connection_nolock";
+# Connect u1 to the admin port, sleep before draining queue
+# Connect u1 to the user port, sleep before draining queue
+SET GLOBAL DEBUG = "-d,sleep_before_handling_connection_nolock";
+# Force connection report
+SELECT NOW(6) INTO @now_var;
+SET GLOBAL thread_pool_connection_report_interval = 0;
+# This should leave us: Init: 8, 2, 2, 2, 2.
+SELECT SUBSTRING(DATA, 105, 20) FROM performance_schema.error_log
+WHERE error_code = 'MY-015509' AND logged > @now_var;
+SUBSTRING(DATA, 105, 20)
+Init: 8, 2, 2, 2, 2.
+DROP TABLE t2;
+DROP TABLE t1;
+DROP USER u1;
+REVOKE TP_CONNECTION_ADMIN ON *.* FROM root@localhost;
+SET GLOBAL DEBUG = "-d,tp_force_connection_report";
+# Set back to what test started with
+SET GLOBAL thread_pool_connection_report_interval = 120;
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_dedicated_listeners_mtl_mismatch.result b/mysql-test/suite/thread_pool/r/thread_pool_dedicated_listeners_mtl_mismatch.result
new file mode 100644
index 000000000000..ea0ece60e5c3
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_dedicated_listeners_mtl_mismatch.result
@@ -0,0 +1,4 @@
+# Check for expected content in mysqld.1.err
+include/assert_grep.inc [The thread_pool_dedicated_listeners option can only be set to ON if thread_pool_max_transaction_limit > 0 found]
+# Restart mysqld server with valid options.
+# restart:ONLY_THREADPOOL_PLUGIN_LOAD --plugin_load=thread_pool=thread_pool. --thread_pool_dedicated_listeners=ON --thread_pool_max_transactions_limit=16
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_dedicated_listeners_wrong_max.result b/mysql-test/suite/thread_pool/r/thread_pool_dedicated_listeners_wrong_max.result
new file mode 100644
index 000000000000..dfd90b106da0
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_dedicated_listeners_wrong_max.result
@@ -0,0 +1,8 @@
+# Check for expected content in mysqld.1.err
+include/assert_grep.inc [option 'thread-pool-dedicated-listeners': boolean value .* was not recognized. Set to OFF found]
+SET SESSION thread_pool_dedicated_listeners = 0;
+ERROR HY000: Variable 'thread_pool_dedicated_listeners' is a read only variable
+SET GLOBAL thread_pool_algorithm = 1;
+ERROR HY000: Variable 'thread_pool_algorithm' is a read only variable
+SET GLOBAL thread_pool_algorithm = 2;
+ERROR HY000: Variable 'thread_pool_algorithm' is a read only variable
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_dedicated_listeners_wrong_min.result b/mysql-test/suite/thread_pool/r/thread_pool_dedicated_listeners_wrong_min.result
new file mode 100644
index 000000000000..5420495de652
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_dedicated_listeners_wrong_min.result
@@ -0,0 +1,8 @@
+# Check for expected content in mysqld.1.err
+include/assert_grep.inc [option 'thread-pool-dedicated-listeners': boolean value .* was not recognized. Set to OFF found]
+SET SESSION thread_pool_dedicated_listeners = -1;
+ERROR HY000: Variable 'thread_pool_dedicated_listeners' is a read only variable
+SET GLOBAL thread_pool_algorithm = 0;
+ERROR HY000: Variable 'thread_pool_algorithm' is a read only variable
+SET GLOBAL thread_pool_algorithm = 1;
+ERROR HY000: Variable 'thread_pool_algorithm' is a read only variable
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_defaults.result b/mysql-test/suite/thread_pool/r/thread_pool_defaults.result
new file mode 100644
index 000000000000..2142e948baed
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_defaults.result
@@ -0,0 +1,16 @@
+#
+# Restart mysqld server with --thread-pool-size=1
+#
+# restart:ONLY_THREADPOOL_PLUGIN_LOAD --plugin_load=thread_pool=thread_pool. --thread-pool-size=1
+#
+# Restart mysqld server with --thread-pool-size=8
+#
+# restart:ONLY_THREADPOOL_PLUGIN_LOAD --plugin_load=thread_pool=thread_pool. --thread-pool-size=8
+#
+# Restart mysqld server with --thread-pool-size=32
+#
+# restart:ONLY_THREADPOOL_PLUGIN_LOAD --plugin_load=thread_pool=thread_pool. --thread-pool-size=32
+#
+# Restart mysqld server with --thread-pool-size=128
+#
+# restart:ONLY_THREADPOOL_PLUGIN_LOAD --plugin_load=thread_pool=thread_pool. --thread-pool-size=128
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_disconnect_sigalrm.result b/mysql-test/suite/thread_pool/r/thread_pool_disconnect_sigalrm.result
new file mode 100644
index 000000000000..6a62a02dc531
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_disconnect_sigalrm.result
@@ -0,0 +1,16 @@
+CREATE TABLE t1(i INT);
+# Force the connection thread to terminate after processing this
+# connection. This makes the original thread id in Vio::thread_id
+# invalid.
+SET GLOBAL DEBUG="+d,terminate_connect_thread";
+BEGIN WORK;
+INSERT INTO t1 VALUES (0),(1),(2);
+SELECT TP_GROUP_ID, CONNECT_THREAD_COUNT FROM
+performance_schema.tp_thread_group_state WHERE TP_GROUP_ID = 0;
+TP_GROUP_ID CONNECT_THREAD_COUNT
+0 0
+SET GLOBAL DEBUG="-d,terminate_connect_thread";
+# Kill connection
+KILL ;
+# Cleanup
+DROP TABLE t1;
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_dual_threadpool_guard.result b/mysql-test/suite/thread_pool/r/thread_pool_dual_threadpool_guard.result
new file mode 100644
index 000000000000..4440e34f5430
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_dual_threadpool_guard.result
@@ -0,0 +1,9 @@
+CALL mtr.add_suppression(
+"Configuration error: --thread-handling=pool-of-threads cannot be used with thread_pool plugin");
+CALL mtr.add_suppression("Plugin 'thread_pool' init function returned error.");
+### Start with both thread pools enabled
+# restart:--thread-handling=pool-of-threads
+### Waiting for the expected error message
+include/wait_for_pattern_in_file.inc [Configuration error: --thread-handling=pool-of-threads cannot be used with thread_pool plugin]
+### Start again
+# restart:
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_error_log_throttling.result b/mysql-test/suite/thread_pool/r/thread_pool_error_log_throttling.result
new file mode 100644
index 000000000000..73771b38e069
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_error_log_throttling.result
@@ -0,0 +1,45 @@
+# Make sure it's more than one minute since the previous throttled warning, in case the test is repeated.
+SELECT SLEEP(60 - IFNULL(TIMESTAMPDIFF(SECOND, MAX(logged), NOW()), 60))
+FROM performance_schema.error_log WHERE ERROR_CODE = 'MY-015510';
+SLEEP(60 - IFNULL(TIMESTAMPDIFF(SECOND, MAX(logged), NOW()), 60))
+0
+# New connection should cause errors to be emitted because a THD will not be allocated.
+SELECT NOW(6) INTO @now_var;
+SET GLOBAL DEBUG = "+d, simulate_resource_failure, emit_throttled_msg";
+connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
+ERROR HY000: Lost connection to MySQL server at 'reading initial communication packet', system error: NUM
+# Verify errors emitted once.
+include/assert.inc [Throttled error codes should be emitted only once]
+# More than nine additional new connections should cause throttling.
+connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
+ERROR HY000: Lost connection to MySQL server at 'reading initial communication packet', system error: NUM
+connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
+ERROR HY000: Lost connection to MySQL server at 'reading initial communication packet', system error: NUM
+connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
+ERROR HY000: Lost connection to MySQL server at 'reading initial communication packet', system error: NUM
+connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
+ERROR HY000: Lost connection to MySQL server at 'reading initial communication packet', system error: NUM
+connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
+ERROR HY000: Lost connection to MySQL server at 'reading initial communication packet', system error: NUM
+connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
+ERROR HY000: Lost connection to MySQL server at 'reading initial communication packet', system error: NUM
+connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
+ERROR HY000: Lost connection to MySQL server at 'reading initial communication packet', system error: NUM
+connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
+ERROR HY000: Lost connection to MySQL server at 'reading initial communication packet', system error: NUM
+connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
+ERROR HY000: Lost connection to MySQL server at 'reading initial communication packet', system error: NUM
+# Verify errors now emitted ten times.
+include/assert.inc [Throttled error codes should be emitted ten times]
+# A new connection should have the errors throttled.
+connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
+ERROR HY000: Lost connection to MySQL server at 'reading initial communication packet', system error: NUM
+# Verify errors still emitted only ten times.
+include/assert.inc [Throttled error codes should still be emitted only ten times]
+# Wait until throttling interval passed.
+# A new connection should cause errors to be emitted again.
+connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
+ERROR HY000: Lost connection to MySQL server at 'reading initial communication packet', system error: NUM
+# Verify errors are now emitted 11 times.
+include/assert.inc [Throttled error codes should now be emitted eleven times]
+SET GLOBAL DEBUG = "-d, simulate_resource_failure, emit_throttled_msg";
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_func1.result b/mysql-test/suite/thread_pool/r/thread_pool_func1.result
new file mode 100644
index 000000000000..14b0c126a4e7
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_func1.result
@@ -0,0 +1,3 @@
+# Reveal that Sorting of new connections into the thread groups is done round robin.
+# Any preceding disconnect of a session has to have no impact on this.
+# Success
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_func2a.result b/mysql-test/suite/thread_pool/r/thread_pool_func2a.result
new file mode 100644
index 000000000000..dd96dd066b89
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_func2a.result
@@ -0,0 +1,33 @@
+SET @admin_thread_groups = 1;
+# 0. Print the current setting of "pool of threads" variables which
+# were assigned at server startup.
+SELECT @@global.thread_pool_size, @@global.thread_pool_algorithm,
+@@global.thread_pool_prio_kickup_timer, @@global.thread_pool_stall_limit;
+@@global.thread_pool_size @@global.thread_pool_algorithm @@global.thread_pool_prio_kickup_timer @@global.thread_pool_stall_limit
+2 0 300 100
+# 1. We must have thread_pool_size different thread group id's within the table.
+SELECT COUNT(DISTINCT TP_GROUP_ID) = @@global.thread_pool_size + @admin_thread_groups AS "Expect 1"
+FROM performance_schema.tp_thread_group_state;
+Expect 1
+1
+# 2. All thread pool groups have the same values for the columns
+# STALL_LIMIT, PRIO_KICKUP_TIMER, ALGORITHM
+SELECT COUNT(DISTINCT STALL_LIMIT) = 1
+AND COUNT(DISTINCT PRIO_KICKUP_TIMER) = 1
+AND COUNT(DISTINCT ALGORITHM) = 1
+AS "Expect 1"
+FROM performance_schema.tp_thread_group_state;
+Expect 1
+1
+# 3. Check the current values of the columns STALL_LIMIT, PRIO_KICKUP_TIMER, ALGORITHM
+# against the content of the "pool of threads" variables
+SELECT STALL_LIMIT = LEAST(GREATEST(CEIL(@@GLOBAL.thread_pool_stall_limit / 10), 4), 600)
+AND PRIO_KICKUP_TIMER = @@GLOBAL.thread_pool_prio_kickup_timer
+AND ALGORITHM = CASE @@GLOBAL.thread_pool_algorithm
+WHEN 0 THEN 'Low Concurrency'
+ WHEN 1 THEN 'High Concurrency'
+ ELSE 'Not expected algorithm' END
+AS "Expect 1"
+FROM performance_schema.tp_thread_group_state LIMIT 1;
+Expect 1
+1
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_func2b.result b/mysql-test/suite/thread_pool/r/thread_pool_func2b.result
new file mode 100644
index 000000000000..7d4eaf900136
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_func2b.result
@@ -0,0 +1,33 @@
+SET @admin_thread_groups = 1;
+# 0. Print the current setting of "pool of threads" variables which
+# were assigned at server startup.
+SELECT @@global.thread_pool_size, @@global.thread_pool_algorithm,
+@@global.thread_pool_prio_kickup_timer, @@global.thread_pool_stall_limit;
+@@global.thread_pool_size @@global.thread_pool_algorithm @@global.thread_pool_prio_kickup_timer @@global.thread_pool_stall_limit
+3 1 600 200
+# 1. We must have thread_pool_size different thread group id's within the table.
+SELECT COUNT(DISTINCT TP_GROUP_ID) = @@global.thread_pool_size + @admin_thread_groups AS "Expect 1"
+FROM performance_schema.tp_thread_group_state;
+Expect 1
+1
+# 2. All thread pool groups have the same values for the columns
+# STALL_LIMIT, PRIO_KICKUP_TIMER, ALGORITHM
+SELECT COUNT(DISTINCT STALL_LIMIT) = 1
+AND COUNT(DISTINCT PRIO_KICKUP_TIMER) = 1
+AND COUNT(DISTINCT ALGORITHM) = 1
+AS "Expect 1"
+FROM performance_schema.tp_thread_group_state;
+Expect 1
+1
+# 3. Check the current values of the columns STALL_LIMIT, PRIO_KICKUP_TIMER, ALGORITHM
+# against the content of the "pool of threads" variables
+SELECT STALL_LIMIT = LEAST(GREATEST(CEIL(@@GLOBAL.thread_pool_stall_limit / 10), 4), 600)
+AND PRIO_KICKUP_TIMER = @@GLOBAL.thread_pool_prio_kickup_timer
+AND ALGORITHM = CASE @@GLOBAL.thread_pool_algorithm
+WHEN 0 THEN 'Low Concurrency'
+ WHEN 1 THEN 'High Concurrency'
+ ELSE 'Not expected algorithm' END
+AS "Expect 1"
+FROM performance_schema.tp_thread_group_state LIMIT 1;
+Expect 1
+1
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_func3b.result b/mysql-test/suite/thread_pool/r/thread_pool_func3b.result
new file mode 100644
index 000000000000..46b8c5cb8168
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_func3b.result
@@ -0,0 +1,230 @@
+CALL mtr.add_suppression("thread_pool_query_threads_per_group.1. is not recommended when used with HIGH_CONCURRENCY_ALGORITHM");
+# Check and generate prerequisites used in various tests.
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (connection_name VARCHAR(20), id BIGINT, PRIMARY KEY(connection_name))
+ENGINE = MEMORY;
+CREATE TABLE t2 (col1 BIGINT) ENGINE = MEMORY;
+INSERT INTO t2 VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(11);
+#--------------------------------------
+# 1.1.1 KILL other inactive connection.
+#--------------------------------------
+# Establish connection con_to_kill1
+# Switch to connection default
+# Poll till the just started session is visible within the processlist
+# and command is "sleep".
+KILL ;
+# Poll till the just killed session is no more visible within the processlist.
+#--------------------------------------------------
+# 1.1.2 KILL other active connection which executes
+# SELECT SLEEP(30)
+# and just does the "sleep" from the SELECT.
+#--------------------------------------------------
+# Establish connection con_to_kill2
+# Send statement to the server, don't wait for results
+SELECT SLEEP(30);
+# Switch to connection default
+# Poll till the just started session and its SELECT is visible within the processlist
+# and the state contains the string 'sleep'.
+KILL ;
+# Poll till the just killed session is no more visible within the processlist.
+LOCK TABLE t1 WRITE;
+#--------------------------------------------------
+# 1.1.3 KILL other active connection which executes
+# SELECT * FROM t1
+# and just waits for getting a lock.
+#--------------------------------------------------
+# Establish connection con_to_kill3
+# Send statement to the server, don't wait for results
+SELECT * FROM t1;
+# Switch to connection default
+# Poll till the just started session and its SELECT is visible within the processlist
+# and the state contains the string 'lock'.
+KILL ;
+# Poll till the just killed session is no more visible within the processlist.
+UNLOCK TABLES;
+#--------------------------------------------------------------
+# 1.1.4 KILL other active connection which executes a huge join
+# and just causes a high load.
+#--------------------------------------------------------------
+# Establish connection con_to_kill4
+# Send statement to the server, don't wait for results
+SELECT COUNT(*)
+FROM t2 C1, t2 C2, t2 C3, t2 C4, t2 C5 , t2 C6 , t2 C7 , t2 C8
+WHERE C1.col1 <> 1 AND C2.col1 <> 2 AND C3.col1 <> 3 AND C4.col1 <> 4 AND C5.col1 <> 5
+AND C6.col1 <> 6 AND C7.col1 <> 7 AND C8.col1 <> 8 ;
+# Switch to connection default
+# Poll till the just started session and its SELECT is visible within the processlist
+# and time > 0.
+KILL ;
+# Poll till the just killed session is no more visible within the processlist.
+#--------------------------------
+# 1.2 KILL own active connection.
+#--------------------------------
+# Establish connection con_to_kill5
+KILL CONNECTION_ID();
+ERROR 70100: Query execution was interrupted
+# Switch to connection default
+# Poll till the just killed session is no more visible within the processlist.
+#------------------------------------------------------------
+# 2.1 KILL ongoing query of another connection which executes
+# SELECT SLEEP(30)
+# and just does the "sleep" from the SELECT.
+#------------------------------------------------------------
+# Establish connection con_to_kill6
+# Send statement to the server, reap result later
+SELECT SLEEP(30);
+# Switch to connection default
+# Poll till execution of 'SELECT SLEEP(30)' has started
+KILL QUERY ;
+# Switch to connection con_to_kill6
+# Reap result
+SLEEP(30)
+1
+# Switch to connection default
+LOCK TABLE t1 WRITE;
+#------------------------------------------------------------
+# 2.2 KILL ongoing query of another connection which executes
+# SELECT * FROM t1
+# and just waits for getting a lock.
+#------------------------------------------------------------
+# Switch to connection con_to_kill6
+# Send statement to the server, reap result later
+SELECT * FROM t1;
+# Switch to connection default
+# Poll till execution of 'SELECT * FROM t1' has started
+# and state contains the string 'lock'
+KILL QUERY ;
+# Switch to connection con_to_kill6
+# Reap result
+ERROR 70100: Query execution was interrupted
+UNLOCK TABLES;
+#------------------------------------------------------------
+# 2.3 KILL ongoing query of another connection which executes
+# a huge join and just causes a high load.
+#------------------------------------------------------------
+# Switch to connection con_to_kill6
+# Send statement to the server, reap result later
+SELECT COUNT(*)
+FROM t2 C1, t2 C2, t2 C3, t2 C4, t2 C5 , t2 C6 , t2 C7 , t2 C8
+WHERE C1.col1 <> 1 AND C2.col1 <> 2 AND C3.col1 <> 3 AND C4.col1 <> 4 AND C5.col1 <> 5
+AND C6.col1 <> 6 AND C7.col1 <> 7 AND C8.col1 <> 8 ;
+# Switch to connection default
+# Poll till the execution of 'SELECT COUNT(*)
+FROM t2 C1, t2 C2, t2 C3, t2 C4, t2 C5 , t2 C6 , t2 C7 , t2 C8
+WHERE C1.col1 <> 1 AND C2.col1 <> 2 AND C3.col1 <> 3 AND C4.col1 <> 4 AND C5.col1 <> 5
+AND C6.col1 <> 6 AND C7.col1 <> 7 AND C8.col1 <> 8 ' has started
+# and time > 0.
+KILL QUERY ;
+# Switch to connection con_to_kill6
+# Reap result
+ERROR 70100: Query execution was interrupted
+#-------------------------------------
+# 2.4 KILL own query (pathologic case)
+#-------------------------------------
+# Switch to connection con_to_kill6
+KILL QUERY CONNECTION_ID();
+ERROR 70100: Query execution was interrupted
+# Switch to connection default
+# Poll till it becomes visible that the connection con_to_kill6 is
+# inactive.
+#---------------------------------
+# 3. Disconnect current connection
+#---------------------------------
+# Switch to connection con_to_kill6
+# Disconnect connection con_to_kill6
+# Poll till the connection con_to_kill6 disappeared from the processlist.
+#--------------------------------------------------------------
+# 4. Thread pool group related tests
+# In case these tests are applied to a server without thread
+# pooling than the comments are partially no more valid.
+#--------------------------------------------------------------
+# Establish connections_to_add (= thread_pool_size if possible) additional connections
+# so that every thread group contains one of these additional connections.
+# Switch to connection default
+SELECT COUNT(*) = AS "Expect 1" FROM t1;
+Expect 1
+1
+#-------------------------------------------------------------------------
+# 4.1 Have within every thread group a connection A executing
+# SELECT SLEEP(30)
+# and just doing the "sleep" from the SELECT.
+# Show that
+# - con_extra: connect, run some statement, disconnect
+# - default: run SELECT ... and KILL QUERY
+# works.
+#-------------------------------------------------------------------------
+# Switch to connection default
+# Poll till connections_to_add connections are busy with their statement.
+# Establish connection con_extra
+SET @connections_to_add = ;
+SELECT COUNT(*) = @connections_to_add AS "Expect 1" FROM information_schema.processlist
+WHERE info = 'SELECT SLEEP(30)';
+Expect 1
+1
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# Switch to connection default
+# Disconnect the additional session con_extra
+# Poll till the connection con_extra disappeared from the processlist.
+# KILL the queries of all additional sessions (printing is suppressed).
+# Let all additional sessions reap their results (printing is suppressed).
+# Switch to connection default
+LOCK TABLE t1 WRITE;
+#-------------------------------------------------------------------------
+# 4.2 Have within every thread group a connection A executing
+# SELECT * FROM t1
+# and just waiting for a lock.
+# Show that
+# - con_extra: connect, run some statement, disconnect
+# - default: run SELECT ... and KILL QUERY
+# works.
+#-------------------------------------------------------------------------
+# Switch to connection default
+# Poll till connections_to_add connections are busy with their statement.
+# Establish connection con_extra
+SET @connections_to_add = ;
+SELECT COUNT(*) = @connections_to_add AS "Expect 1" FROM information_schema.processlist
+WHERE info = 'SELECT * FROM t1';
+Expect 1
+1
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# Switch to connection default
+# Disconnect the additional session con_extra
+# Poll till the connection con_extra disappeared from the processlist.
+# KILL the queries of all additional sessions (printing is suppressed).
+# Let all additional sessions reap their results (printing is suppressed).
+# Switch to connection default
+UNLOCK TABLES;
+#-------------------------------------------------------------------------
+# 4.3 Have within every thread group a connection A executing a huge join
+# and just causing high load.
+# Show that
+# - con_extra: connect, run some statement, disconnect
+# works.
+#-------------------------------------------------------------------------
+# Switch to connection default
+# Poll till connections_to_add connections are busy with their statement.
+# Establish connection con_extra
+SET @connections_to_add = ;
+SELECT COUNT(*) = @connections_to_add AS "Expect 1" FROM information_schema.processlist
+WHERE info = 'SELECT COUNT(*)
+FROM t2 C1, t2 C2, t2 C3, t2 C4, t2 C5 , t2 C6 , t2 C7 , t2 C8
+WHERE C1.col1 <> 1 AND C2.col1 <> 2 AND C3.col1 <> 3 AND C4.col1 <> 4 AND C5.col1 <> 5
+AND C6.col1 <> 6 AND C7.col1 <> 7 AND C8.col1 <> 8 ';
+Expect 1
+1
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# Switch to connection default
+# Disconnect the additional session con_extra
+# Poll till the connection con_extra disappeared from the processlist.
+#--------------------------------------------------------------------------------------
+# 4.4 Reveal that some session having another session causing high load within the same
+# thread group is able to KILL this other session.
+#--------------------------------------------------------------------------------------
+# KILL the queries of all additional sessions (printing is suppressed).
+# Poll till there is no connection running which has an id occurring in t1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_func3c.result b/mysql-test/suite/thread_pool/r/thread_pool_func3c.result
new file mode 100644
index 000000000000..46b8c5cb8168
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_func3c.result
@@ -0,0 +1,230 @@
+CALL mtr.add_suppression("thread_pool_query_threads_per_group.1. is not recommended when used with HIGH_CONCURRENCY_ALGORITHM");
+# Check and generate prerequisites used in various tests.
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (connection_name VARCHAR(20), id BIGINT, PRIMARY KEY(connection_name))
+ENGINE = MEMORY;
+CREATE TABLE t2 (col1 BIGINT) ENGINE = MEMORY;
+INSERT INTO t2 VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(11);
+#--------------------------------------
+# 1.1.1 KILL other inactive connection.
+#--------------------------------------
+# Establish connection con_to_kill1
+# Switch to connection default
+# Poll till the just started session is visible within the processlist
+# and command is "sleep".
+KILL ;
+# Poll till the just killed session is no more visible within the processlist.
+#--------------------------------------------------
+# 1.1.2 KILL other active connection which executes
+# SELECT SLEEP(30)
+# and just does the "sleep" from the SELECT.
+#--------------------------------------------------
+# Establish connection con_to_kill2
+# Send statement to the server, don't wait for results
+SELECT SLEEP(30);
+# Switch to connection default
+# Poll till the just started session and its SELECT is visible within the processlist
+# and the state contains the string 'sleep'.
+KILL ;
+# Poll till the just killed session is no more visible within the processlist.
+LOCK TABLE t1 WRITE;
+#--------------------------------------------------
+# 1.1.3 KILL other active connection which executes
+# SELECT * FROM t1
+# and just waits for getting a lock.
+#--------------------------------------------------
+# Establish connection con_to_kill3
+# Send statement to the server, don't wait for results
+SELECT * FROM t1;
+# Switch to connection default
+# Poll till the just started session and its SELECT is visible within the processlist
+# and the state contains the string 'lock'.
+KILL ;
+# Poll till the just killed session is no more visible within the processlist.
+UNLOCK TABLES;
+#--------------------------------------------------------------
+# 1.1.4 KILL other active connection which executes a huge join
+# and just causes a high load.
+#--------------------------------------------------------------
+# Establish connection con_to_kill4
+# Send statement to the server, don't wait for results
+SELECT COUNT(*)
+FROM t2 C1, t2 C2, t2 C3, t2 C4, t2 C5 , t2 C6 , t2 C7 , t2 C8
+WHERE C1.col1 <> 1 AND C2.col1 <> 2 AND C3.col1 <> 3 AND C4.col1 <> 4 AND C5.col1 <> 5
+AND C6.col1 <> 6 AND C7.col1 <> 7 AND C8.col1 <> 8 ;
+# Switch to connection default
+# Poll till the just started session and its SELECT is visible within the processlist
+# and time > 0.
+KILL ;
+# Poll till the just killed session is no more visible within the processlist.
+#--------------------------------
+# 1.2 KILL own active connection.
+#--------------------------------
+# Establish connection con_to_kill5
+KILL CONNECTION_ID();
+ERROR 70100: Query execution was interrupted
+# Switch to connection default
+# Poll till the just killed session is no more visible within the processlist.
+#------------------------------------------------------------
+# 2.1 KILL ongoing query of another connection which executes
+# SELECT SLEEP(30)
+# and just does the "sleep" from the SELECT.
+#------------------------------------------------------------
+# Establish connection con_to_kill6
+# Send statement to the server, reap result later
+SELECT SLEEP(30);
+# Switch to connection default
+# Poll till execution of 'SELECT SLEEP(30)' has started
+KILL QUERY ;
+# Switch to connection con_to_kill6
+# Reap result
+SLEEP(30)
+1
+# Switch to connection default
+LOCK TABLE t1 WRITE;
+#------------------------------------------------------------
+# 2.2 KILL ongoing query of another connection which executes
+# SELECT * FROM t1
+# and just waits for getting a lock.
+#------------------------------------------------------------
+# Switch to connection con_to_kill6
+# Send statement to the server, reap result later
+SELECT * FROM t1;
+# Switch to connection default
+# Poll till execution of 'SELECT * FROM t1' has started
+# and state contains the string 'lock'
+KILL QUERY ;
+# Switch to connection con_to_kill6
+# Reap result
+ERROR 70100: Query execution was interrupted
+UNLOCK TABLES;
+#------------------------------------------------------------
+# 2.3 KILL ongoing query of another connection which executes
+# a huge join and just causes a high load.
+#------------------------------------------------------------
+# Switch to connection con_to_kill6
+# Send statement to the server, reap result later
+SELECT COUNT(*)
+FROM t2 C1, t2 C2, t2 C3, t2 C4, t2 C5 , t2 C6 , t2 C7 , t2 C8
+WHERE C1.col1 <> 1 AND C2.col1 <> 2 AND C3.col1 <> 3 AND C4.col1 <> 4 AND C5.col1 <> 5
+AND C6.col1 <> 6 AND C7.col1 <> 7 AND C8.col1 <> 8 ;
+# Switch to connection default
+# Poll till the execution of 'SELECT COUNT(*)
+FROM t2 C1, t2 C2, t2 C3, t2 C4, t2 C5 , t2 C6 , t2 C7 , t2 C8
+WHERE C1.col1 <> 1 AND C2.col1 <> 2 AND C3.col1 <> 3 AND C4.col1 <> 4 AND C5.col1 <> 5
+AND C6.col1 <> 6 AND C7.col1 <> 7 AND C8.col1 <> 8 ' has started
+# and time > 0.
+KILL QUERY ;
+# Switch to connection con_to_kill6
+# Reap result
+ERROR 70100: Query execution was interrupted
+#-------------------------------------
+# 2.4 KILL own query (pathologic case)
+#-------------------------------------
+# Switch to connection con_to_kill6
+KILL QUERY CONNECTION_ID();
+ERROR 70100: Query execution was interrupted
+# Switch to connection default
+# Poll till it becomes visible that the connection con_to_kill6 is
+# inactive.
+#---------------------------------
+# 3. Disconnect current connection
+#---------------------------------
+# Switch to connection con_to_kill6
+# Disconnect connection con_to_kill6
+# Poll till the connection con_to_kill6 disappeared from the processlist.
+#--------------------------------------------------------------
+# 4. Thread pool group related tests
+# In case these tests are applied to a server without thread
+# pooling than the comments are partially no more valid.
+#--------------------------------------------------------------
+# Establish connections_to_add (= thread_pool_size if possible) additional connections
+# so that every thread group contains one of these additional connections.
+# Switch to connection default
+SELECT COUNT(*) = AS "Expect 1" FROM t1;
+Expect 1
+1
+#-------------------------------------------------------------------------
+# 4.1 Have within every thread group a connection A executing
+# SELECT SLEEP(30)
+# and just doing the "sleep" from the SELECT.
+# Show that
+# - con_extra: connect, run some statement, disconnect
+# - default: run SELECT ... and KILL QUERY
+# works.
+#-------------------------------------------------------------------------
+# Switch to connection default
+# Poll till connections_to_add connections are busy with their statement.
+# Establish connection con_extra
+SET @connections_to_add = ;
+SELECT COUNT(*) = @connections_to_add AS "Expect 1" FROM information_schema.processlist
+WHERE info = 'SELECT SLEEP(30)';
+Expect 1
+1
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# Switch to connection default
+# Disconnect the additional session con_extra
+# Poll till the connection con_extra disappeared from the processlist.
+# KILL the queries of all additional sessions (printing is suppressed).
+# Let all additional sessions reap their results (printing is suppressed).
+# Switch to connection default
+LOCK TABLE t1 WRITE;
+#-------------------------------------------------------------------------
+# 4.2 Have within every thread group a connection A executing
+# SELECT * FROM t1
+# and just waiting for a lock.
+# Show that
+# - con_extra: connect, run some statement, disconnect
+# - default: run SELECT ... and KILL QUERY
+# works.
+#-------------------------------------------------------------------------
+# Switch to connection default
+# Poll till connections_to_add connections are busy with their statement.
+# Establish connection con_extra
+SET @connections_to_add = ;
+SELECT COUNT(*) = @connections_to_add AS "Expect 1" FROM information_schema.processlist
+WHERE info = 'SELECT * FROM t1';
+Expect 1
+1
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# Switch to connection default
+# Disconnect the additional session con_extra
+# Poll till the connection con_extra disappeared from the processlist.
+# KILL the queries of all additional sessions (printing is suppressed).
+# Let all additional sessions reap their results (printing is suppressed).
+# Switch to connection default
+UNLOCK TABLES;
+#-------------------------------------------------------------------------
+# 4.3 Have within every thread group a connection A executing a huge join
+# and just causing high load.
+# Show that
+# - con_extra: connect, run some statement, disconnect
+# works.
+#-------------------------------------------------------------------------
+# Switch to connection default
+# Poll till connections_to_add connections are busy with their statement.
+# Establish connection con_extra
+SET @connections_to_add = ;
+SELECT COUNT(*) = @connections_to_add AS "Expect 1" FROM information_schema.processlist
+WHERE info = 'SELECT COUNT(*)
+FROM t2 C1, t2 C2, t2 C3, t2 C4, t2 C5 , t2 C6 , t2 C7 , t2 C8
+WHERE C1.col1 <> 1 AND C2.col1 <> 2 AND C3.col1 <> 3 AND C4.col1 <> 4 AND C5.col1 <> 5
+AND C6.col1 <> 6 AND C7.col1 <> 7 AND C8.col1 <> 8 ';
+Expect 1
+1
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# Switch to connection default
+# Disconnect the additional session con_extra
+# Poll till the connection con_extra disappeared from the processlist.
+#--------------------------------------------------------------------------------------
+# 4.4 Reveal that some session having another session causing high load within the same
+# thread group is able to KILL this other session.
+#--------------------------------------------------------------------------------------
+# KILL the queries of all additional sessions (printing is suppressed).
+# Poll till there is no connection running which has an id occurring in t1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_func4.result b/mysql-test/suite/thread_pool/r/thread_pool_func4.result
new file mode 100644
index 000000000000..c0ce217044ef
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_func4.result
@@ -0,0 +1,118 @@
+DROP DATABASE IF EXISTS mysqltest;
+CREATE DATABASE mysqltest;
+CREATE TABLE mysqltest.to_lock (col1 BIGINT) ENGINE = InnoDB;
+INSERT INTO mysqltest.to_lock
+VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(11);
+CREATE TABLE mysqltest.book_keeping (
+worker_id INTEGER,
+session_id INTEGER,
+worker_type ENUM('first','second') DEFAULT NULL,
+task_size ENUM('small','medium','big') DEFAULT 'small',
+task_transaction BOOLEAN DEFAULT 0,
+task_prepared BOOLEAN DEFAULT 0,
+high_priority_connection BOOLEAN DEFAULT 0,
+counter BIGINT,
+mysql_errno INTEGER,
+PRIMARY KEY(worker_id))
+ENGINE = MEMORY;
+CREATE TABLE mysqltest.start_statistics (
+WHAT ENUM('before','after') NOT NULL,
+QUERIES_EXECUTED BIGINT(20) UNSIGNED,
+QUERIES_QUEUED BIGINT(20) UNSIGNED,
+PRIO_KICKUPS BIGINT(20) UNSIGNED,
+STALLED_QUERIES_EXECUTED BIGINT(20) UNSIGNED,
+BECOME_CONSUMER_THREAD BIGINT(20) UNSIGNED,
+BECOME_RESERVE_THREAD BIGINT(20) UNSIGNED,
+BECOME_WAITING_THREAD BIGINT(20) UNSIGNED,
+WAKE_THREAD_STALL_CHECKER BIGINT(20) UNSIGNED,
+SLEEP_WAITS BIGINT(20) UNSIGNED,
+DISK_IO_WAITS BIGINT(20) UNSIGNED,
+ROW_LOCK_WAITS BIGINT(20) UNSIGNED,
+GLOBAL_LOCK_WAITS BIGINT(20) UNSIGNED,
+META_DATA_LOCK_WAITS BIGINT(20) UNSIGNED,
+TABLE_LOCK_WAITS BIGINT(20) UNSIGNED,
+USER_LOCK_WAITS BIGINT(20) UNSIGNED,
+BINLOG_WAITS BIGINT(20) UNSIGNED,
+GROUP_COMMIT_WAITS BIGINT(20) UNSIGNED,
+FSYNC_WAITS BIGINT(20) UNSIGNED,
+PRIMARY KEY(WHAT))
+ENGINE = MEMORY;
+Warnings:
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+Warning 1681 Integer display width is deprecated and will be removed in a future release.
+CREATE TABLE mysqltest.statistics
+LIKE mysqltest.start_statistics;
+ALTER TABLE mysqltest.statistics
+DROP COLUMN WHAT,
+ADD COLUMN prio_kickup_timer BIGINT,
+ADD COLUMN first_counter BIGINT,
+ADD COLUMN second_counter BIGINT;
+SET @@SESSION.lock_wait_timeout = 10;
+LOCK TABLES mysqltest.to_lock WRITE;
+INSERT INTO mysqltest.to_lock VALUES(1);
+KILL QUERY ;
+ERROR 70100: Query execution was interrupted
+UNLOCK TABLES;
+SET @first_high_priority_connection = 1, @second_high_priority_connection = 0;
+SET @first_size = 'small', @second_size = 'small';
+SET @first_transaction = 0, @second_transaction = 0;
+SET @first_prepared = 0, @second_prepared = 0;
+SELECT COUNT(*),worker_type,high_priority_connection,task_size,task_transaction,task_prepared
+FROM mysqltest.book_keeping
+GROUP BY worker_type;
+COUNT(*) worker_type high_priority_connection task_size task_transaction task_prepared
+5 first 1 small 0 0
+5 second 0 small 0 0
+SELECT AVG(first_counter), AVG(second_counter),
+AVG(PRIO_KICKUPS), AVG(BECOME_WAITING_THREAD)
+INTO @first_counter_0, @second_counter_0,
+@PRIO_KICKUPS_0, @BECOME_WAITING_THREAD_0
+FROM mysqltest.statistics
+WHERE prio_kickup_timer = 0
+GROUP BY prio_kickup_timer;
+SELECT AVG(first_counter), AVG(second_counter),
+AVG(PRIO_KICKUPS), AVG(BECOME_WAITING_THREAD)
+INTO @first_counter_1, @second_counter_1,
+@PRIO_KICKUPS_1, @BECOME_WAITING_THREAD_1
+FROM mysqltest.statistics
+WHERE prio_kickup_timer = 1
+GROUP BY prio_kickup_timer;
+SELECT AVG(first_counter), AVG(second_counter),
+AVG(PRIO_KICKUPS), AVG(BECOME_WAITING_THREAD)
+INTO @first_counter_512, @second_counter_512,
+@PRIO_KICKUPS_512, @BECOME_WAITING_THREAD_512
+FROM mysqltest.statistics
+WHERE prio_kickup_timer = 512
+GROUP BY prio_kickup_timer;
+SELECT AVG(first_counter), AVG(second_counter),
+AVG(PRIO_KICKUPS), AVG(BECOME_WAITING_THREAD)
+INTO @first_counter_4096, @second_counter_4096,
+@PRIO_KICKUPS_4096, @BECOME_WAITING_THREAD_4096
+FROM mysqltest.statistics
+WHERE prio_kickup_timer = 4096
+GROUP BY prio_kickup_timer;
+# Printing of result sets is disabled.
+SELECT * FROM information_schema.TP_THREAD_GROUP_STATS;
+SELECT * FROM information_schema.TP_THREAD_GROUP_STATE;
+SELECT * FROM information_schema.TP_THREAD_STATE;
+SELECT * FROM performance_schema.tp_thread_group_stats;
+SELECT * FROM performance_schema.tp_thread_group_state;
+SELECT * FROM performance_schema.tp_thread_state;
+DROP DATABASE mysqltest;
+SET @@GLOBAL.THREAD_POOL_PRIO_KICKUP_TIMER = ;
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_func5.result b/mysql-test/suite/thread_pool/r/thread_pool_func5.result
new file mode 100644
index 000000000000..bd51419ed79e
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_func5.result
@@ -0,0 +1,37 @@
+SELECT CONNECTIONS_STARTED INTO @connection_started_0
+FROM performance_schema.tp_thread_group_stats WHERE TP_GROUP_ID = 0;
+SELECT SLEEP(3);
+SELECT SLEEP(3);
+SLEEP(3)
+0
+SLEEP(3)
+0
+SET @TP_GROUP_ID = ;
+SELECT RESERVE_THREADS = 0 AS "Expect 1" FROM performance_schema.tp_thread_group_state
+WHERE TP_GROUP_ID = @TP_GROUP_ID;
+Expect 1
+1
+SELECT THREAD_COUNT = 3 AND CONSUMER_THREADS = 2 AND RESERVE_THREADS = 0 AND CONNECT_THREAD_COUNT = 1 AS "Expect 1"
+FROM performance_schema.tp_thread_group_state
+WHERE TP_GROUP_ID = @TP_GROUP_ID;
+Expect 1
+0
+SELECT SLEEP(3);
+SELECT SLEEP(3);
+SELECT SLEEP(3);
+SLEEP(3)
+0
+SLEEP(3)
+0
+SLEEP(3)
+0
+SELECT RESERVE_THREADS = 0 AS "Expect 1" FROM performance_schema.tp_thread_group_state
+WHERE TP_GROUP_ID = @TP_GROUP_ID;
+Expect 1
+1
+SELECT THREAD_COUNT = 3 AND CONSUMER_THREADS = 2 AND RESERVE_THREADS = 0 AND CONNECT_THREAD_COUNT = 1 AS "Expect 1"
+FROM performance_schema.tp_thread_group_state
+WHERE TP_GROUP_ID = @TP_GROUP_ID;
+Expect 1
+0
+CALL mtr.add_suppression("thread_pool_query_threads_per_group.1. is not recommended when used with HIGH_CONCURRENCY_ALGORITHM");
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_func6.result b/mysql-test/suite/thread_pool/r/thread_pool_func6.result
new file mode 100644
index 000000000000..7884a07de514
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_func6.result
@@ -0,0 +1,111 @@
+CREATE USER mysqltest_u1@localhost;
+GRANT USAGE ON test.* TO mysqltest_u1@localhost;
+SET GLOBAL max_connections = 3;
+call mtr.add_suppression("Too many connections");
+# -----------------------------------------------------------------------
+# Should have success
+SELECT CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+FROM information_schema.processlist;
+CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+1
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# -- Establishing connection 'con1' (user: mysqltest_u1)...
+# -- Connection 'con1' has been established.
+# -----------------------------------------------------------------------
+# Should have success
+SELECT CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+FROM information_schema.processlist;
+CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+0
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# -- Establishing connection 'con2' (user: mysqltest_u1)...
+# -- Connection 'con2' has been established.
+# -----------------------------------------------------------------------
+# No success for attempt to exceed max_connections with non root user
+SELECT CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+FROM information_schema.processlist;
+CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+-1
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# -- Establishing connection 'con_too_much' (user: mysqltest_u1)...
+# -- Error: can not establish connection 'con_too_much'.
+SET GLOBAL max_connections = 4;
+# -----------------------------------------------------------------------
+# Should have success
+SELECT CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+FROM information_schema.processlist;
+CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+0
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# -- Establishing connection 'con3' (user: mysqltest_u1)...
+# -- Connection 'con3' has been established.
+# -----------------------------------------------------------------------
+# No success for attempt to exceed max_connections with non root user
+SELECT CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+FROM information_schema.processlist;
+CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+-1
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# -- Establishing connection 'con_too_much' (user: mysqltest_u1)...
+# -- Error: can not establish connection 'con_too_much'.
+# -----------------------------------------------------------------------
+# Success for attempt to exceed max_connections with root by 1
+SELECT CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+FROM information_schema.processlist;
+CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+-1
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# -- Establishing connection 'con4' (user: root)...
+# -- Connection 'con4' has been established.
+# -----------------------------------------------------------------------
+# No success for attempt to exceed max_connections with root by 2
+# Should not have success
+SELECT CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+FROM information_schema.processlist;
+CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+-2
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# -- Establishing connection 'con_too_much' (user: root)...
+# -- Error: can not establish connection 'con_too_much'.
+# -----------------------------------------------------------------------
+# Cut down the max_connections and show that the existing connections
+# stay operable.
+SET GLOBAL max_connections = 1;
+SELECT CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+FROM information_schema.processlist;
+CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+-5
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+SELECT 'Here is con4' AS my_col;
+my_col
+Here is con4
+SELECT 'Here is con3' AS my_col;
+my_col
+Here is con3
+SELECT 'Here is con2' AS my_col;
+my_col
+Here is con2
+SELECT 'Here is con1' AS my_col;
+my_col
+Here is con1
+# -----------------------------------------------------------------------
+# No success for attempt, lowered max_connections limit gets honoured
+SELECT CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+FROM information_schema.processlist;
+CAST(@@global.max_connections AS SIGNED INTEGER) - COUNT(*)
+-5
+Warnings:
+Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
+# -- Establishing connection 'con_too_much' (user: root)...
+# -- Error: can not establish connection 'con_too_much'.
+# -----------------------------------------------------------------------
+SET GLOBAL max_connections = ;
+DROP USER mysqltest_u1@localhost;
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_high_priority_connection_sys_var.result b/mysql-test/suite/thread_pool/r/thread_pool_high_priority_connection_sys_var.result
new file mode 100644
index 000000000000..5a5decf96164
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_high_priority_connection_sys_var.result
@@ -0,0 +1,11 @@
+#
+#
+# Bug 16310373 - THREAD_POOL_HIGH_PRIORITY_CONNECTION IS NOT
+# RECOGNIZED A CONFIGURATION OPTION
+#
+#
+SELECT @@GLOBAL.thread_pool_high_priority_connection;
+@@GLOBAL.thread_pool_high_priority_connection
+1
+1 Expected
+# End of test
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_hpc_basic.result b/mysql-test/suite/thread_pool/r/thread_pool_hpc_basic.result
new file mode 100644
index 000000000000..7aac03dc2290
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_hpc_basic.result
@@ -0,0 +1,162 @@
+SET @default_val = 0;
+SET @min_val = 0;
+SET @max_val = 1;
+SET @some_val = 1;
+SELECT @min_val < @some_val AND @some_val < @max_val
+AND @some_val <> @default_val AS "Expect 1";
+Expect 1
+0
+CREATE USER low_priv@localhost;
+GRANT USAGE ON test.* TO low_priv@localhost;
+SET @default_val = ;
+SET @some_val = ;
+#---------------------BS_DYNVARS_102_01----------------------#
+SELECT @@GLOBAL.thread_pool_high_priority_connection = @default_val AS "Expect 1";
+Expect 1
+1
+SELECT @@SESSION.thread_pool_high_priority_connection = @default_val AS "Expect 1";
+Expect 1
+1
+SELECT @@thread_pool_high_priority_connection = @default_val AS "Expect 1";
+Expect 1
+1
+SELECT @@GLOBAL.thread_pool_high_priority_connection = @default_val AS "Expect 1";
+Expect 1
+1
+SELECT @@SESSION.thread_pool_high_priority_connection = @default_val AS "Expect 1";
+Expect 1
+1
+SELECT @@thread_pool_high_priority_connection = @default_val AS "Expect 1";
+Expect 1
+1
+#---------------------BS_DYNVARS_102_02----------------------#
+SET @initial_val = @@GLOBAL.thread_pool_high_priority_connection;
+SET @@GLOBAL.thread_pool_high_priority_connection = @some_val;
+SELECT @@GLOBAL.thread_pool_high_priority_connection = @some_val AS "Expect 1";
+Expect 1
+1
+SELECT @@SESSION.thread_pool_high_priority_connection = @default_val AS "Expect 1";
+Expect 1
+1
+SELECT @@GLOBAL.thread_pool_high_priority_connection = @some_val AS "Expect 1";
+Expect 1
+1
+SELECT @@SESSION.thread_pool_high_priority_connection = @default_val AS "Expect 1";
+Expect 1
+1
+SET @@GLOBAL.thread_pool_high_priority_connection = @default_val;
+SET @@SESSION.thread_pool_high_priority_connection = @some_val;
+SELECT @@GLOBAL.thread_pool_high_priority_connection = @default_val AS "Expect 1";
+Expect 1
+1
+SELECT @@SESSION.thread_pool_high_priority_connection = @some_val AS "Expect 1";
+Expect 1
+1
+SELECT @@SESSION.thread_pool_high_priority_connection = @default_val AS "Expect 1";
+Expect 1
+1
+SET @@thread_pool_high_priority_connection = @default_val;
+SELECT @@SESSION.thread_pool_high_priority_connection = @default_val AS "Expect 1";
+Expect 1
+1
+SET @@GLOBAL.thread_pool_high_priority_connection = @some_val;
+ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation
+SELECT @@GLOBAL.thread_pool_high_priority_connection = @default_val AS "Expect 1";
+Expect 1
+1
+SET @@SESSION.thread_pool_high_priority_connection = @some_val;
+SELECT @@SESSION.thread_pool_high_priority_connection = @some_val AS "Expect 1";
+Expect 1
+1
+SET @@GLOBAL.thread_pool_high_priority_connection = @some_val;
+SELECT @@GLOBAL.thread_pool_high_priority_connection = @@SESSION.thread_pool_high_priority_connection
+AS "Expect 1";
+Expect 1
+1
+DROP USER low_priv@localhost;
+#---------------------BS_DYNVARS_102_03----------------------#
+SET @@thread_pool_high_priority_connection = @min_val;
+SELECT @@thread_pool_high_priority_connection = @min_val AS "Expect 1";
+Expect 1
+1
+SET @@thread_pool_high_priority_connection = @max_val;
+SELECT @@thread_pool_high_priority_connection = @max_val AS "Expect 1";
+Expect 1
+1
+SET @@thread_pool_high_priority_connection = TRUE;
+SELECT @@thread_pool_high_priority_connection = 1 AS "Expect 1";
+Expect 1
+1
+SET @@thread_pool_high_priority_connection = FALSE;
+SELECT @@thread_pool_high_priority_connection = 0 AS "Expect 1";
+Expect 1
+1
+SET @@thread_pool_high_priority_connection = 0;
+SELECT @@thread_pool_high_priority_connection = 0 AS "Expect 1";
+Expect 1
+1
+#---------------------BS_DYNVARS_102_04----------------------#
+SET @@thread_pool_high_priority_connection = @some_val;
+SET @@thread_pool_high_priority_connection = @max_val + 1;
+ERROR 42000: Variable 'thread_pool_high_priority_connection' can't be set to the value of '2'
+SELECT @@thread_pool_high_priority_connection = @some_val AS "Expect 1";
+Expect 1
+1
+SET @@thread_pool_high_priority_connection = @min_val - 1;
+ERROR 42000: Variable 'thread_pool_high_priority_connection' can't be set to the value of '-1'
+SELECT @@thread_pool_high_priority_connection = @some_val AS "Expect 1";
+Expect 1
+1
+SET @@thread_pool_high_priority_connection = -1;
+ERROR 42000: Variable 'thread_pool_high_priority_connection' can't be set to the value of '-1'
+SELECT @@thread_pool_high_priority_connection = @some_val AS "Expect 1";
+Expect 1
+1
+SET @@thread_pool_high_priority_connection = 0.1;
+ERROR 42000: Incorrect argument type to variable 'thread_pool_high_priority_connection'
+SELECT @@thread_pool_high_priority_connection = @some_val AS "Expect 1";
+Expect 1
+1
+SET @@thread_pool_high_priority_connection = 10E-1;
+ERROR 42000: Incorrect argument type to variable 'thread_pool_high_priority_connection'
+SELECT @@thread_pool_high_priority_connection = @some_val AS "Expect 1";
+Expect 1
+1
+SET @@SESSION.thread_pool_high_priority_connection = ON;
+ERROR 42000: Incorrect argument type to variable 'thread_pool_high_priority_connection'
+SELECT @@thread_pool_high_priority_connection = @some_val AS "Expect 1";
+Expect 1
+1
+SET @@SESSION.thread_pool_high_priority_connection = OFF;
+ERROR 42000: Incorrect argument type to variable 'thread_pool_high_priority_connection'
+SELECT @@thread_pool_high_priority_connection = @some_val AS "Expect 1";
+Expect 1
+1
+SET @@thread_pool_high_priority_connection = TRUEX;
+ERROR 42000: Incorrect argument type to variable 'thread_pool_high_priority_connection'
+SET @@thread_pool_high_priority_connection = XTRUE;
+ERROR 42000: Incorrect argument type to variable 'thread_pool_high_priority_connection'
+SET @@thread_pool_high_priority_connection = FALSEX;
+ERROR 42000: Incorrect argument type to variable 'thread_pool_high_priority_connection'
+SET @@thread_pool_high_priority_connection = XFALSE;
+ERROR 42000: Incorrect argument type to variable 'thread_pool_high_priority_connection'
+SET @@thread_pool_high_priority_connection = ' ';
+ERROR 42000: Incorrect argument type to variable 'thread_pool_high_priority_connection'
+SET @@thread_pool_high_priority_connection = " ";
+ERROR 42000: Incorrect argument type to variable 'thread_pool_high_priority_connection'
+SET @@thread_pool_high_priority_connection = '1.1';
+ERROR 42000: Incorrect argument type to variable 'thread_pool_high_priority_connection'
+SET @@thread_pool_high_priority_connection = NULL;
+ERROR 42000: Incorrect argument type to variable 'thread_pool_high_priority_connection'
+#---------------------BS_DYNVARS_102_05----------------------#
+SELECT @@GLOBAL.thread_pool_high_priority_connection = VARIABLE_VALUE AS "Expect 1"
+FROM performance_schema.global_variables
+WHERE VARIABLE_NAME = 'thread_pool_high_priority_connection';
+Expect 1
+1
+SELECT @@SESSION.thread_pool_high_priority_connection = VARIABLE_VALUE AS "Expect 1"
+FROM performance_schema.session_variables
+WHERE VARIABLE_NAME = 'thread_pool_high_priority_connection';
+Expect 1
+1
+SET @@GLOBAL.thread_pool_high_priority_connection = @initial_val;
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_i_s.result b/mysql-test/suite/thread_pool/r/thread_pool_i_s.result
new file mode 100644
index 000000000000..f5c1f6321e70
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_i_s.result
@@ -0,0 +1,241 @@
+SET @saved_deprecated_i_s_usage_count = (SELECT VARIABLE_VALUE
+FROM performance_schema.global_status WHERE VARIABLE_NAME = 'Deprecated_thread_pool_i_s_usage_count');
+SET @admin_thread_groups = 1;
+# 1. "pool of threads" functionality and its information_schema tables
+# are provided as plugin.
+SELECT PLUGIN_NAME, PLUGIN_STATUS, PLUGIN_TYPE, PLUGIN_LIBRARY,
+PLUGIN_AUTHOR, PLUGIN_LICENSE
+FROM INFORMATION_SCHEMA.PLUGINS
+WHERE PLUGIN_NAME IN
+('thread_pool','TP_THREAD_STATE','TP_THREAD_GROUP_STATE','TP_THREAD_GROUP_STATS');
+PLUGIN_NAME PLUGIN_STATUS PLUGIN_TYPE PLUGIN_LIBRARY PLUGIN_AUTHOR PLUGIN_LICENSE
+thread_pool ACTIVE DAEMON thread_pool. Oracle Corporation PROPRIETARY
+TP_THREAD_STATE ACTIVE INFORMATION SCHEMA thread_pool. Oracle Corporation PROPRIETARY
+TP_THREAD_GROUP_STATE ACTIVE INFORMATION SCHEMA thread_pool. Oracle Corporation PROPRIETARY
+TP_THREAD_GROUP_STATS ACTIVE INFORMATION SCHEMA thread_pool. Oracle Corporation PROPRIETARY
+# 2. Show the layout of the "pool of threads" tables.
+SHOW CREATE TABLE information_schema.TP_THREAD_GROUP_STATS;
+Table Create Table
+TP_THREAD_GROUP_STATS CREATE TEMPORARY TABLE `TP_THREAD_GROUP_STATS` (
+ `TP_GROUP_ID` int unsigned NOT NULL DEFAULT '0',
+ `CONNECTIONS_STARTED` bigint unsigned NOT NULL DEFAULT '0',
+ `CONNECTIONS_CLOSED` bigint unsigned NOT NULL DEFAULT '0',
+ `QUERIES_EXECUTED` bigint unsigned NOT NULL DEFAULT '0',
+ `QUERIES_QUEUED` bigint unsigned NOT NULL DEFAULT '0',
+ `THREADS_STARTED` bigint unsigned NOT NULL DEFAULT '0',
+ `PRIO_KICKUPS` bigint unsigned NOT NULL DEFAULT '0',
+ `STALLED_QUERIES_EXECUTED` bigint unsigned NOT NULL DEFAULT '0',
+ `BECOME_CONSUMER_THREAD` bigint unsigned NOT NULL DEFAULT '0',
+ `BECOME_RESERVE_THREAD` bigint unsigned NOT NULL DEFAULT '0',
+ `BECOME_WAITING_THREAD` bigint unsigned NOT NULL DEFAULT '0',
+ `WAKE_THREAD_STALL_CHECKER` bigint unsigned NOT NULL DEFAULT '0',
+ `SLEEP_WAITS` bigint unsigned NOT NULL DEFAULT '0',
+ `DISK_IO_WAITS` bigint unsigned NOT NULL DEFAULT '0',
+ `ROW_LOCK_WAITS` bigint unsigned NOT NULL DEFAULT '0',
+ `GLOBAL_LOCK_WAITS` bigint unsigned NOT NULL DEFAULT '0',
+ `META_DATA_LOCK_WAITS` bigint unsigned NOT NULL DEFAULT '0',
+ `TABLE_LOCK_WAITS` bigint unsigned NOT NULL DEFAULT '0',
+ `USER_LOCK_WAITS` bigint unsigned NOT NULL DEFAULT '0',
+ `BINLOG_WAITS` bigint unsigned NOT NULL DEFAULT '0',
+ `GROUP_COMMIT_WAITS` bigint unsigned NOT NULL DEFAULT '0',
+ `FSYNC_WAITS` bigint unsigned NOT NULL DEFAULT '0'
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3
+SHOW CREATE TABLE information_schema.TP_THREAD_GROUP_STATE;
+Table Create Table
+TP_THREAD_GROUP_STATE CREATE TEMPORARY TABLE `TP_THREAD_GROUP_STATE` (
+ `TP_GROUP_ID` int unsigned NOT NULL DEFAULT '0',
+ `CONSUMER_THREADS` int unsigned NOT NULL DEFAULT '0',
+ `RESERVE_THREADS` int unsigned NOT NULL DEFAULT '0',
+ `CONNECT_THREAD_COUNT` int unsigned NOT NULL DEFAULT '0',
+ `CONNECTION_COUNT` int unsigned NOT NULL DEFAULT '0',
+ `QUEUED_QUERIES` int unsigned NOT NULL DEFAULT '0',
+ `QUEUED_TRANSACTIONS` int unsigned NOT NULL DEFAULT '0',
+ `STALL_LIMIT` int unsigned NOT NULL DEFAULT '0',
+ `PRIO_KICKUP_TIMER` int unsigned NOT NULL DEFAULT '0',
+ `ALGORITHM` varchar(20) NOT NULL DEFAULT '',
+ `THREAD_COUNT` int unsigned NOT NULL DEFAULT '0',
+ `ACTIVE_THREAD_COUNT` int unsigned NOT NULL DEFAULT '0',
+ `STALLED_THREAD_COUNT` int unsigned NOT NULL DEFAULT '0',
+ `WAITING_THREAD_NUMBER` int unsigned DEFAULT NULL,
+ `OLDEST_QUEUED` bigint unsigned DEFAULT NULL,
+ `MAX_THREAD_IDS_IN_GROUP` int unsigned NOT NULL DEFAULT '0'
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3
+SHOW CREATE TABLE information_schema.TP_THREAD_STATE;
+Table Create Table
+TP_THREAD_STATE CREATE TEMPORARY TABLE `TP_THREAD_STATE` (
+ `TP_GROUP_ID` int unsigned NOT NULL DEFAULT '0',
+ `TP_THREAD_NUMBER` int unsigned NOT NULL DEFAULT '0',
+ `PROCESS_COUNT` bigint unsigned NOT NULL DEFAULT '0',
+ `WAIT_TYPE` varchar(30) DEFAULT NULL,
+ `TP_THREAD_TYPE` varchar(32) NOT NULL DEFAULT '',
+ `THREAD_ID` bigint unsigned DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3
+# 3. Show the columns of these tables how they are reported within
+# information_schema.columns.
+SELECT TABLE_NAME, COLUMN_NAME,COLUMN_DEFAULT,IS_NULLABLE,DATA_TYPE,
+CHARACTER_MAXIMUM_LENGTH,CHARACTER_OCTET_LENGTH,NUMERIC_PRECISION,
+NUMERIC_SCALE,CHARACTER_SET_NAME,COLLATION_NAME,COLUMN_TYPE,EXTRA,
+PRIVILEGES,COLUMN_COMMENT
+FROM information_schema.columns
+WHERE table_schema = 'information_schema'
+ AND table_name IN
+('TP_THREAD_GROUP_STATS','TP_THREAD_GROUP_STATE','TP_THREAD_STATE')
+ORDER BY table_name,column_name;
+TABLE_NAME COLUMN_NAME COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE EXTRA PRIVILEGES COLUMN_COMMENT
+TP_THREAD_GROUP_STATE ACTIVE_THREAD_COUNT NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATE ALGORITHM NO varchar 6 20 NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select
+TP_THREAD_GROUP_STATE CONNECT_THREAD_COUNT NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATE CONNECTION_COUNT NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATE CONSUMER_THREADS NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATE MAX_THREAD_IDS_IN_GROUP NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATE OLDEST_QUEUED YES bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATE PRIO_KICKUP_TIMER NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATE QUEUED_QUERIES NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATE QUEUED_TRANSACTIONS NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATE RESERVE_THREADS NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATE STALL_LIMIT NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATE STALLED_THREAD_COUNT NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATE THREAD_COUNT NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATE TP_GROUP_ID NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATE WAITING_THREAD_NUMBER YES int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATS BECOME_CONSUMER_THREAD NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS BECOME_RESERVE_THREAD NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS BECOME_WAITING_THREAD NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS BINLOG_WAITS NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS CONNECTIONS_CLOSED NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS CONNECTIONS_STARTED NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS DISK_IO_WAITS NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS FSYNC_WAITS NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS GLOBAL_LOCK_WAITS NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS GROUP_COMMIT_WAITS NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS META_DATA_LOCK_WAITS NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS PRIO_KICKUPS NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS QUERIES_EXECUTED NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS QUERIES_QUEUED NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS ROW_LOCK_WAITS NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS SLEEP_WAITS NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS STALLED_QUERIES_EXECUTED NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS TABLE_LOCK_WAITS NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS THREADS_STARTED NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS TP_GROUP_ID NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_GROUP_STATS USER_LOCK_WAITS NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_GROUP_STATS WAKE_THREAD_STALL_CHECKER NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_STATE PROCESS_COUNT NO bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_STATE THREAD_ID YES bigint NULL NULL NULL NULL NULL NULL bigint unsigned select
+TP_THREAD_STATE TP_GROUP_ID NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_STATE TP_THREAD_NUMBER NO int NULL NULL NULL NULL NULL NULL int unsigned select
+TP_THREAD_STATE TP_THREAD_TYPE NO varchar 10 32 NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) select
+TP_THREAD_STATE WAIT_TYPE YES varchar 10 30 NULL NULL utf8mb3 utf8mb3_general_ci varchar(30) select
+# 4. All these tables contain a column named TP_GROUP_ID and
+# these columns must be of the same type.
+SELECT COUNT(*) AS "Expect 1" FROM
+( SELECT COLUMN_DEFAULT,IS_NULLABLE,DATA_TYPE,NUMERIC_PRECISION,NUMERIC_SCALE,
+COLUMN_TYPE,EXTRA,PRIVILEGES
+FROM information_schema.columns
+WHERE table_schema = 'information_schema' AND column_name = 'TP_GROUP_ID' AND table_name = 'TP_THREAD_GROUP_STATS'
+ UNION DISTINCT
+SELECT COLUMN_DEFAULT,IS_NULLABLE,DATA_TYPE,NUMERIC_PRECISION,NUMERIC_SCALE,
+COLUMN_TYPE,EXTRA,PRIVILEGES
+FROM information_schema.columns
+WHERE table_schema = 'information_schema' AND column_name = 'TP_GROUP_ID' AND table_name = 'TP_THREAD_GROUP_STATE'
+ UNION DISTINCT
+SELECT COLUMN_DEFAULT,IS_NULLABLE,DATA_TYPE,NUMERIC_PRECISION,NUMERIC_SCALE,
+COLUMN_TYPE,EXTRA,PRIVILEGES
+FROM information_schema.columns
+WHERE table_schema = 'information_schema' AND column_name = 'TP_GROUP_ID' AND table_name = 'TP_THREAD_STATE') AS A;
+Expect 1
+1
+# 5. It must be impossible to alter the layout of these tables or
+# or to modify their content.
+DELETE FROM information_schema.TP_THREAD_GROUP_STATS;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
+ALTER TABLE information_schema.TP_THREAD_GROUP_STATS ADD COLUMN garbage VARCHAR(20);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
+DELETE FROM information_schema.TP_THREAD_GROUP_STATE;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
+ALTER TABLE information_schema.TP_THREAD_GROUP_STATE ADD COLUMN garbage VARCHAR(20);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
+DELETE FROM information_schema.TP_THREAD_STATE;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
+ALTER TABLE information_schema.TP_THREAD_STATE ADD COLUMN garbage VARCHAR(20);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
+# 6. It must be possible to SELECT on these tables.
+# The printing of results is partially suppressed.
+# A high privileged user should see the same like a low
+# privileged user. Example:
+# There must be @@global.thread_pool_size distinct TP_GROUP_ID
+# values per table.
+CREATE USER low_privilege@localhost;
+GRANT USAGE ON test.* TO low_privilege@localhost;
+# Establish connection (low_privilege,localhost,low_privilege,,test)
+SELECT * FROM information_schema.TP_THREAD_GROUP_STATS;
+SELECT * FROM information_schema.TP_THREAD_GROUP_STATE;
+SELECT * FROM information_schema.TP_THREAD_STATE;
+SET @admin_thread_groups = 1;
+SELECT COUNT(DISTINCT TP_GROUP_ID) = @@global.thread_pool_size + @admin_thread_groups AS "Expect 1",
+'TP_THREAD_GROUP_STATS' AS "Table"
+FROM information_schema.TP_THREAD_GROUP_STATS
+UNION ALL
+SELECT COUNT(DISTINCT TP_GROUP_ID) = @@global.thread_pool_size + @admin_thread_groups AS "Expect 1",
+'TP_THREAD_GROUP_STATE'
+FROM information_schema.TP_THREAD_GROUP_STATE
+UNION ALL
+SELECT COUNT(DISTINCT TP_GROUP_ID) = @@global.thread_pool_size + @admin_thread_groups AS "Expect 1",
+'TP_THREAD_STATE'
+FROM information_schema.TP_THREAD_STATE;
+Expect 1 Table
+1 TP_THREAD_GROUP_STATS
+1 TP_THREAD_GROUP_STATE
+1 TP_THREAD_STATE
+Warnings:
+Warning 1287 'information_schema.tp_thread_group_stats' is deprecated and will be removed in a future release. Please use performance_schema.tp_thread_group_stats instead
+Warning 1287 'information_schema.tp_thread_group_state' is deprecated and will be removed in a future release. Please use performance_schema.tp_thread_group_state instead
+Warning 1287 'information_schema.tp_thread_state' is deprecated and will be removed in a future release. Please use performance_schema.tp_thread_state instead
+# Switch to connection default
+SELECT * FROM information_schema.TP_THREAD_GROUP_STATS;
+SELECT * FROM information_schema.TP_THREAD_GROUP_STATE;
+SELECT * FROM information_schema.TP_THREAD_STATE;
+SELECT COUNT(DISTINCT TP_GROUP_ID) = @@global.thread_pool_size + @admin_thread_groups AS "Expect 1",
+'TP_THREAD_GROUP_STATS' AS "Table"
+FROM information_schema.TP_THREAD_GROUP_STATS
+UNION ALL
+SELECT COUNT(DISTINCT TP_GROUP_ID) = @@global.thread_pool_size + @admin_thread_groups AS "Expect 1",
+'TP_THREAD_GROUP_STATE'
+FROM information_schema.TP_THREAD_GROUP_STATE
+UNION ALL
+SELECT COUNT(DISTINCT TP_GROUP_ID) = @@global.thread_pool_size + @admin_thread_groups AS "Expect 1",
+'TP_THREAD_STATE'
+FROM information_schema.TP_THREAD_STATE;
+Expect 1 Table
+1 TP_THREAD_GROUP_STATS
+1 TP_THREAD_GROUP_STATE
+1 TP_THREAD_STATE
+Warnings:
+Warning 1287 'information_schema.tp_thread_group_stats' is deprecated and will be removed in a future release. Please use performance_schema.tp_thread_group_stats instead
+Warning 1287 'information_schema.tp_thread_group_state' is deprecated and will be removed in a future release. Please use performance_schema.tp_thread_group_state instead
+Warning 1287 'information_schema.tp_thread_state' is deprecated and will be removed in a future release. Please use performance_schema.tp_thread_state instead
+DROP USER low_privilege@localhost;
+#
+# Bug#34020058 - Extend PFS.tp_thread_state table to include PFS thread_id and TP thread type
+#
+# PFS thread id and thread type of each thread should be listed.
+SELECT TP_GROUP_ID, WAIT_TYPE, TP_THREAD_TYPE FROM information_schema.TP_THREAD_STATE WHERE TP_GROUP_ID = 0
+AND TP_THREAD_TYPE = 'CONNECTION_HANDLER_WORKER_THREAD';
+TP_GROUP_ID WAIT_TYPE TP_THREAD_TYPE
+0 NULL CONNECTION_HANDLER_WORKER_THREAD
+Warnings:
+Warning 1287 'information_schema.tp_thread_state' is deprecated and will be removed in a future release. Please use performance_schema.tp_thread_state instead
+SELECT TP_GROUP_ID, WAIT_TYPE, TP_THREAD_TYPE FROM information_schema.TP_THREAD_STATE WHERE TP_GROUP_ID = 0
+AND TP_THREAD_TYPE = 'QUERY_WORKER_THREAD' LIMIT 1;
+TP_GROUP_ID WAIT_TYPE TP_THREAD_TYPE
+0 NULL QUERY_WORKER_THREAD
+Warnings:
+Warning 1287 'information_schema.tp_thread_state' is deprecated and will be removed in a future release. Please use performance_schema.tp_thread_state instead
+#
+# Bug#36359860: No deprecation warning when accessing TP I_S tables
+#
+# Show increase in I_S usage counter from running this test
+SELECT VARIABLE_VALUE - @saved_deprecated_i_s_usage_count AS EXPECT_14
+FROM performance_schema.global_status WHERE VARIABLE_NAME = 'Deprecated_thread_pool_i_s_usage_count';
+EXPECT_14
+14
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_kill_case1.result b/mysql-test/suite/thread_pool/r/thread_pool_kill_case1.result
new file mode 100644
index 000000000000..d20ccaadbe2f
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_kill_case1.result
@@ -0,0 +1,7 @@
+SET @kill_target_id = ;
+SET SESSION debug="+d,info,enter,exit,error,query,make_query_very_long";
+SELECT SLEEP(1);
+SET SESSION debug="+d,enter,info,query,exit,error";
+SET SESSION debug="+d,enter,info,query,exit,error";
+SET SESSION debug="+d,enter,info,query,exit,error";
+KILL @kill_target_id;
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_kill_case2.result b/mysql-test/suite/thread_pool/r/thread_pool_kill_case2.result
new file mode 100644
index 000000000000..bbd07c657bc3
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_kill_case2.result
@@ -0,0 +1,8 @@
+SET @kill_target_id = ;
+SET SESSION debug="+d,info,enter,error,exit,query,thd_pool_post_kill_notification_hang";
+SET SESSION DEBUG="+d,info,enter,error,exit,query,wait_begin_waiter_thread";
+SELECT SLEEP(1);
+SELECT SLEEP(1);
+SELECT SLEEP(1);
+SELECT SLEEP(1);
+KILL @kill_target_id;
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_kill_case3.result b/mysql-test/suite/thread_pool/r/thread_pool_kill_case3.result
new file mode 100644
index 000000000000..82fc9133ecc4
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_kill_case3.result
@@ -0,0 +1,7 @@
+SET @kill_target_id = ;
+SET SESSION debug="+d,info,enter,exit,error,query,wait_begin_waiter_thread";
+SELECT SLEEP(1);
+SELECT SLEEP(1);
+SELECT SLEEP(1);
+SELECT SLEEP(1);
+KILL @kill_target_id;
diff --git a/mysql-test/suite/thread_pool/r/thread_pool_kill_case4.result b/mysql-test/suite/thread_pool/r/thread_pool_kill_case4.result
new file mode 100644
index 000000000000..6208f40caf7f
--- /dev/null
+++ b/mysql-test/suite/thread_pool/r/thread_pool_kill_case4.result
@@ -0,0 +1,17 @@
+SET @initial_debug_sync = @@DEBUG_SYNC;
+SET @kill_target_id_1 =