Skip to content

*: support MySQL dual passwords (release-8.5)#69735

Merged
ti-chi-bot[bot] merged 4 commits into
pingcap:release-8.5-20260710-v8.5.7from
bb7133:bb7133/dual-password-release-8.5
Jul 10, 2026
Merged

*: support MySQL dual passwords (release-8.5)#69735
ti-chi-bot[bot] merged 4 commits into
pingcap:release-8.5-20260710-v8.5.7from
bb7133:bb7133/dual-password-release-8.5

Conversation

@bb7133

@bb7133 bb7133 commented Jul 9, 2026

Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number: ref #60587

Problem Summary:

This PR backports MySQL 8.0 dual-password support to release-8.5.

It includes two upstream pieces because release-8.5 does not yet have the parser prerequisite:

What changed and how does it work?

Backport of #68028 and #68393:

  • Add parser/AST support for ALTER USER ... RETAIN CURRENT PASSWORD, ALTER USER ... DISCARD OLD PASSWORD, and SET PASSWORD ... RETAIN CURRENT PASSWORD.
  • Store the retained password in mysql.user.User_attributes.$.additional_password, matching MySQL.
  • Add APPLICATION_PASSWORD_ADMIN dynamic privilege.
  • Allow login fallback to the retained password for password-based authentication plugins.
  • Add executor behavior, MySQL-compatible error codes/messages, unit tests, and integration tests.

Backport-specific notes:

  • Parser generated files were regenerated on top of the release-8.5 grammar instead of copying master output.
  • Conflict resolution intentionally excluded unrelated master-only changes such as RETURNING parser changes and traffic dynamic privileges.
  • default_authentication_plugin handling was adapted to the release-8.5 privilege/domain code path.

Check List

Tests

  • Unit test
    • cd pkg/parser && go test . ./ast -count=1
    • go test --tags=intest ./pkg/executor -run 'Test(AlterUserHasPrivilegedOptions|AuthenticatedUserNameAndHost|BuildAdditionalPasswordEntry|EffectiveAuthPlugin|DualPassword)' -count=1
    • go test --tags=intest ./pkg/executor/test/passwordtest -run 'TestDualPassword|TestSetPassword' -count=1
    • go test --tags=intest ./pkg/executor/test/passwordtest -count=1
    • go test --tags=intest ./pkg/privilege/privileges -run 'Test' -count=1
  • Integration test
    • tests/integrationtest/t/executor/dual_password.test
  • Manual test (add detailed scripts or steps below)
    • make parser_yacc
    • git diff --check origin/release-8.5...HEAD -- . ':(exclude)tests/integrationtest/r/**/*.result'
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Support MySQL-compatible dual passwords via `ALTER USER ... IDENTIFIED BY '<new>' RETAIN CURRENT PASSWORD`, `ALTER USER ... DISCARD OLD PASSWORD`, and `SET PASSWORD FOR u = '<new>' RETAIN CURRENT PASSWORD`. The secondary password is stored in `mysql.user.User_attributes.$.additional_password` and is hidden from `SHOW CREATE USER` output, matching MySQL 8.0. The new `APPLICATION_PASSWORD_ADMIN` dynamic privilege gates self-service retain/discard; cross-user retain/discard requires `CREATE USER`. During a rolling upgrade, a retained secondary password authenticates only on already-upgraded TiDB nodes; complete the cluster upgrade before relying on dual-password rotation.

Summary by CodeRabbit

  • New Features
    • Added MySQL-style dual-password handling for ALTER USER and SET PASSWORD with RETAIN CURRENT PASSWORD and DISCARD OLD PASSWORD.
    • Added APPLICATION_PASSWORD_ADMIN support for the required authorization paths.
  • Bug Fixes
    • Improved handling of retained secondary password verification and plugin-related edge cases, including legacy accounts.
    • Enforced correct CREATE USER/ALTER USER behavior for unsupported or invalid dual-password combinations.
  • Tests
    • Expanded unit, integration, and parser coverage for dual-password syntax, privilege gating, and persistence/normalization behavior.

… DISCARD OLD PASSWORD) (pingcap#68028)

ref pingcap#60587

(cherry picked from commit b254c43)
Signed-off-by: bb7133 <bb7133@gmail.com>
…sts) (pingcap#68393)

ref pingcap#60587

(cherry picked from commit 60996fd)
Signed-off-by: bb7133 <bb7133@gmail.com>
@ti-chi-bot ti-chi-bot Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/cherry-pick-not-approved size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds MySQL 8.0 dual-password support across SQL parsing, executor handling, privilege decoding, authentication fallback, error reporting, and test coverage. The change tracks retained secondary passwords in user_attributes, resolves empty-plugin cases through default_authentication_plugin, and introduces APPLICATION_PASSWORD_ADMIN.

Changes

Dual-Password Feature

Layer / File(s) Summary
Error codes and parser
errors.toml, pkg/errno/errcode.go, pkg/errno/errname.go, pkg/util/dbterror/exeerrors/errors.go, pkg/parser/*
Adds dual-password error mappings, new keywords and grammar for RETAIN CURRENT PASSWORD / DISCARD OLD PASSWORD, AST fields and restore logic, and parser coverage for valid and invalid clause combinations.
Privilege cache and auth verification
pkg/domain/domain.go, pkg/privilege/privileges/cache.go, pkg/privilege/privileges/privileges.go
Carries retained-password state through privilege decoding, resolves empty plugin rows with global variables, adds APPLICATION_PASSWORD_ADMIN, and checks retained secondary passwords during login.
Password encoding helpers
pkg/executor/utils.go
Centralizes plugin-aware password encoding and hash validation for executor paths.
CREATE USER and ALTER USER execution
pkg/executor/simple.go, pkg/executor/simple_internal_test.go
Rejects dual-password clauses in CREATE USER and adds ALTER USER dual-password handling, identity resolution, privilege gating, password checks, and user_attributes updates.
SET PASSWORD execution
pkg/executor/simple.go
Updates SET PASSWORD for self-service detection, resolved-plugin encoding, privilege checks, and retained secondary-password writes.
Tests and fixtures
pkg/executor/BUILD.bazel, pkg/executor/test/passwordtest/*, tests/integrationtest/{r,t}/executor/*
Adds unit and integration coverage for parsing, executor behavior, privilege rules, plugin resolution, retention/discard flows, and expected outputs.

Estimated code review effort: 4 (Complex) | ~75 minutes

Possibly related PRs

  • pingcap/tidb#68028: Implements the same dual-password feature across parser, executor, and error handling.
  • pingcap/tidb#68998: Updates ALTER USER USER() identity resolution, which overlaps with the authenticated-account handling here.

Suggested labels: approved, lgtm

Suggested reviewers: D3Hunter, terry1purcell

Poem

I hop through clauses, swift and bright,
RETAIN by moon, DISCARD by light.
Two passwords now can share the nest,
And every login knows the test. 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 64.15% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately summarizes the main change: MySQL dual-password support backported to release-8.5.
Description check ✅ Passed The description matches the template well, with issue link, problem summary, change details, tests, side effects, documentation, and release note.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
pkg/privilege/privileges/cache.go (1)

1016-1029: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Hoist defaultAuthPlugin resolution out of the per-row closure.

decodeUserTableRow returns a closure that's invoked once per row in mysql.user. The defaultAuthPlugin lookup (p.globalVars.GetGlobalSysVar(...)) is computed inside that closure, so it re-runs for every user row even though the value is invariant for the whole table load. Move it out to before return func(...) so it's computed once per decodeUserTableRow call instead of once per row.

♻️ Proposed fix
 func (p *MySQLPrivilege) decodeUserTableRow(userList map[string]struct{}) func(chunk.Row, []*resolve.ResultField) error {
+	defaultAuthPlugin := ""
+	if p.globalVars != nil {
+		if val, err := p.globalVars.GetGlobalSysVar(variable.DefaultAuthPlugin); err == nil {
+			defaultAuthPlugin = val
+		}
+	}
+	if defaultAuthPlugin == "" {
+		defaultAuthPlugin = mysql.AuthNativePassword
+	}
 	return func(row chunk.Row, fs []*resolve.ResultField) error {
 		var value UserRecord
-		defaultAuthPlugin := ""
-		if p.globalVars != nil {
-			val, err := p.globalVars.GetGlobalSysVar(variable.DefaultAuthPlugin)
-			if err == nil {
-				defaultAuthPlugin = val
-			}
-		}
-		if defaultAuthPlugin == "" {
-			defaultAuthPlugin = mysql.AuthNativePassword
-		}
 		for i, f := range fs {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/privilege/privileges/cache.go` around lines 1016 - 1029,
`decodeUserTableRow` is recalculating `defaultAuthPlugin` inside the returned
row-processing closure, which repeats the same lookup for every `mysql.user`
row. Move the `p.globalVars.GetGlobalSysVar(variable.DefaultAuthPlugin)`
resolution and fallback to `mysql.AuthNativePassword` outside the `return
func(row chunk.Row, fs []*resolve.ResultField) error` closure so it runs once
per `MySQLPrivilege.decodeUserTableRow` call, then have the closure reuse that
captured value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/executor/simple.go`:
- Around line 2748-2766: The RETAIN eligibility check in
isDualPasswordCapablePlugin is using mysql.IsAuthPluginClearText, which matches
the clear-text plugin instead of the dual-password-capable authentication
plugins. Update this helper to use a dedicated allowlist for the supported
password-based plugins (such as mysql_native_password, caching_sha2_password,
and tidb_sm3_password) so RETAIN is accepted for the correct users while still
excluding LDAP/socket/token plugins.

---

Nitpick comments:
In `@pkg/privilege/privileges/cache.go`:
- Around line 1016-1029: `decodeUserTableRow` is recalculating
`defaultAuthPlugin` inside the returned row-processing closure, which repeats
the same lookup for every `mysql.user` row. Move the
`p.globalVars.GetGlobalSysVar(variable.DefaultAuthPlugin)` resolution and
fallback to `mysql.AuthNativePassword` outside the `return func(row chunk.Row,
fs []*resolve.ResultField) error` closure so it runs once per
`MySQLPrivilege.decodeUserTableRow` call, then have the closure reuse that
captured value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 42856281-81c3-4549-bdee-f374e312fe40

📥 Commits

Reviewing files that changed from the base of the PR and between 202b7f4 and 4536a30.

📒 Files selected for processing (24)
  • errors.toml
  • pkg/domain/domain.go
  • pkg/errno/errcode.go
  • pkg/errno/errname.go
  • pkg/executor/BUILD.bazel
  • pkg/executor/simple.go
  • pkg/executor/simple_internal_test.go
  • pkg/executor/test/passwordtest/BUILD.bazel
  • pkg/executor/test/passwordtest/dual_password_test.go
  • pkg/executor/utils.go
  • pkg/parser/ast/misc.go
  • pkg/parser/ast/misc_test.go
  • pkg/parser/keywords.go
  • pkg/parser/keywords_test.go
  • pkg/parser/misc.go
  • pkg/parser/parser.go
  • pkg/parser/parser.y
  • pkg/parser/parser_test.go
  • pkg/privilege/privileges/cache.go
  • pkg/privilege/privileges/privileges.go
  • pkg/util/dbterror/exeerrors/errors.go
  • tests/integrationtest/r/executor/dual_password.result
  • tests/integrationtest/r/executor/executor.result
  • tests/integrationtest/t/executor/dual_password.test

Comment thread pkg/executor/simple.go
Comment on lines +2748 to +2766
// isDualPasswordCapablePlugin reports whether a user whose plugin is `plugin` is
// eligible to hold a secondary ("additional") password. Dual passwords are only
// meaningful for password-based plugins. LDAP / socket / token plugins are excluded,
// matching MySQL 8.0 behavior.
//
// It delegates to mysql.IsAuthPluginClearText, the canonical predicate for
// "the plugin derives a server-side hash from a clear-text password"
// (mysql_native_password / caching_sha2_password / tidb_sm3_password): those
// are exactly the plugins that can hold a second stored hash. If the two sets
// ever need to diverge, split this back into its own list and document the
// difference.
//
// Callers MUST pass the resolved plugin (see effectiveAuthPlugin): an empty
// `plugin` column on a legacy mysql.user row could resolve to anything via
// `default_authentication_plugin`, and treating "" as natively capable would
// wrongly allow RETAIN on an LDAP-default deployment.
func isDualPasswordCapablePlugin(plugin string) bool {
return mysql.IsAuthPluginClearText(plugin)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect IsAuthPluginClearText definition and the plugins it accepts on this branch.
fd -t f 'const.go|type.go|util.go' pkg/parser/mysql | xargs rg -nP -C4 'func IsAuthPluginClearText'

Repository: pingcap/tidb

Length of output: 1976


🌐 Web query:

pingcap tidb release-8.5 mysql IsAuthPluginClearText pkg/parser/mysql auth plugin clear text

💡 Result:

In TiDB, the mysql_clear_password authentication plugin is supported primarily to facilitate the tidb_auth_token authentication mechanism, which allows clients to send authentication tokens in plain text [1][2]. Because this mechanism transmits credentials in plain text, TiDB documentation mandates that TLS must be enabled between the client and the server when using tidb_auth_token to ensure security [2][3]. For MySQL command-line clients and other applications using libmysqlclient, the mysql_clear_password plugin is not enabled by default for security reasons [4]. To use it, you must explicitly enable it: 1. Command-line clients: Use the --enable-cleartext-plugin flag [2][3][4]. 2. Environment configuration: Set the LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN environment variable to 1, Y, or y [4]. 3. Client-specific tools: Tools like mycli typically enable this plugin by default [2][3][5]. Within the TiDB codebase, authentication plugin information is handled within the pkg/parser package, which maintains the Abstract Syntax Tree (AST) definitions and necessary structures for parsing SQL statements (such as CREATE USER) that involve authentication options [6][7]. The parser supports the storage and management of authentication plugin names, enabling compatibility with various MySQL authentication methods [6]. TiDB 8.5 (an LTS release) continues to support these authentication standards to maintain MySQL compatibility while providing its own authentication extensions [8][9]. Developers interacting with pkg/parser or internal authentication logic will find these structures in the ast (Abstract Syntax Tree) and auth related sub-packages within the TiDB repository [6][7].

Citations:


🌐 Web query:

site:github.com/pingcap/tidb "func IsAuthPluginClearText" "pkg/parser/mysql"

💡 Result:

IsAuthPluginClearText(authPlugin string) bool exists in TiDB’s github.com/pingcap/tidb/parser/mysql package (the repo is pingcap/tidb). It’s documented as: “used to indicated that the plugin need clear-text password.” (pkg.go.dev)

If you want, I can also help locate the exact source file and line in the GitHub repo.

Citations:


🌐 Web query:

pingcap tidb parser mysql IsAuthPluginClearText source body switch authPlugin clear text mysql_native_password caching_sha2_password tidb_sm3_password

💡 Result:

TiDB's handling of authentication plugins and the "clear text" authentication flow is designed for MySQL protocol compatibility [1]. Authentication Plugin Support TiDB supports several authentication plugins, including mysql_native_password, caching_sha2_password, and auth_socket [2]. These constants are defined within the TiDB parser package (specifically in parser/mysql/const.go) to facilitate protocol handling [2]. Clear Text Authentication and Auth Switching The TiDB server implementation handles authentication switches—a mechanism in the MySQL protocol—to negotiate authentication methods between the client and server [3][4]. For instance, when a client attempts to connect using a method the server may not fully prefer or when a "change user" command is issued, the server can request a switch to a supported plugin, such as downgrading from caching_sha2_password to mysql_native_password for compatibility [3][4]. Regarding "clear text" (often associated with full authentication in caching_sha2_password): 1. In the MySQL protocol, "full authentication" for caching_sha2_password involves sending the clear-text password over a secure (TLS/SSL) connection [5]. 2. TiDB supports this full authentication flow [5]. 3. Because security is paramount, TiDB requires an encrypted connection for this process [6]. 4. Unlike MySQL, which may utilize a "fast authentication" cache, TiDB has historically prioritized and implemented the "complete authentication" (full authentication) path for caching_sha2_password [6]. Codebase Context Relevant logic for managing these plugins is dispersed across the parser and server packages: - Parser/AST: Updates have been made to the SQL parser to support authentication plugins in statements like CREATE USER, including compatibility for caching_sha2_password hashing formats [7][8]. - Server: The server connection handling logic (e.g., pkg/server/conn.go) manages the actual handshake, including enforcing TLS for certain plugins and handling auth switch requests [3][6][4]. In summary, TiDB manages authentication via its parser's constant definitions [2] and the server's handshake/switch logic, ensuring that protocols like caching_sha2_password are handled securely via encrypted full authentication [5][6].

Citations:


🌐 Web query:

site:github.com/pingcap/tidb/blob release-8.5 "IsAuthPluginClearText" "mysql_native_password" "caching_sha2_password" "tidb_sm3_password"

💡 Result:

In TiDB’s pkg/parser/auth for the current release-8.5 line, I found caching_sha2_password, mysql_native_password, and tidb_sm3_password support, with source files for all three auth paths listed. The docs also say CheckHashingPassword handles caching_sha2_password and tidb_sm3_password. (pkg.go.dev)

I did not find IsAuthPluginClearText in that package/docs search. (pkg.go.dev)

Citations:


🌐 Web query:

site:github.com/pingcap/tidb "func IsAuthPluginClearText" "parser/mysql/const.go" release-8.5

💡 Result:

I cannot provide specific information about a function named IsAuthPluginClearText in the file parser/mysql/const.go for TiDB release-8.5. The provided search results confirm that TiDB release-8.5 exists as a branch [1][2], but there is no documentation or indexed source code confirming the existence or implementation details of a function by that exact name in the specified file path [3][1][4][2][5].

Citations:


🌐 Web query:

site:github.com/pingcap/tidb release-8.5 "IsAuthPluginClearText(" "mysql_native_password" "caching_sha2_password" "tidb_sm3_password" "auth_socket" "mysql_clear_password"

💡 Result:

In TiDB 8.5, IsAuthPluginClearText should be true only for mysql_clear_password. TiDB’s docs say tidb_auth_token requires clients to support mysql_clear_password to send the token in plain text; the listed password-based plugins (mysql_native_password, caching_sha2_password, tidb_sm3_password) and auth_socket are not described as clear-text plugins. (docs.pingcap.com)

So for your list:

  • mysql_native_passwordfalse
  • caching_sha2_passwordfalse
  • tidb_sm3_passwordfalse
  • auth_socketfalse
  • mysql_clear_passwordtrue (docs.pingcap.com)

Citations:


mysql.IsAuthPluginClearText is the wrong gate for RETAIN
On release-8.5 it maps to mysql_clear_password, so this would reject RETAIN for mysql_native_password, caching_sha2_password, and tidb_sm3_password users. Keep a dedicated allowlist for the dual-password-capable plugins here.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/executor/simple.go` around lines 2748 - 2766, The RETAIN eligibility
check in isDualPasswordCapablePlugin is using mysql.IsAuthPluginClearText, which
matches the clear-text plugin instead of the dual-password-capable
authentication plugins. Update this helper to use a dedicated allowlist for the
supported password-based plugins (such as mysql_native_password,
caching_sha2_password, and tidb_sm3_password) so RETAIN is accepted for the
correct users while still excluding LDAP/socket/token plugins.

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.37472% with 84 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release-8.5-20260710-v8.5.7@202b7f4). Learn more about missing BASE report.

Additional details and impacted files
@@                       Coverage Diff                        @@
##             release-8.5-20260710-v8.5.7     #69735   +/-   ##
================================================================
  Coverage                               ?   55.6606%           
================================================================
  Files                                  ?       1849           
  Lines                                  ?     666728           
  Branches                               ?          0           
================================================================
  Hits                                   ?     371105           
  Misses                                 ?     268011           
  Partials                               ?      27612           
Flag Coverage Δ
integration 39.1335% <64.7450%> (?)
unit 65.2107% <80.2660%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 55.3108% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 63.0637% <0.0000%> (?)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@takaidohigasi

Copy link
Copy Markdown
Contributor

wow, I am also taking a look for the test failure

@takaidohigasi

Copy link
Copy Markdown
Contributor

/test check-dev2

@takaidohigasi

Copy link
Copy Markdown
Contributor
  CI failures — 3 failing, all diagnosed, none are behavior bugs

  ┌────────────────────┬─────────────────────────────────────────────────────────────┬────────────────────────────┐
  │       Check        │                         Root cause                          │         Fix needed         │
  ├────────────────────┼─────────────────────────────────────────────────────────────┼────────────────────────────┤
  │                    │ Parser error-message text differs between branches: the     │ Re-record                  │
  │ check_dev          │ recorded (master) result for CREATE USER … RETAIN expects   │ dual_password.result on    │
  │ (integrationtest)  │ near "retain current password", but 8.5's parser prints     │ release-8.5 (one line)     │
  │                    │ near "retain current password;" (includes the ;)            │                            │
  ├────────────────────┼─────────────────────────────────────────────────────────────┼────────────────────────────┤
  │                    │ grant.test's SHOW PRIVILEGES golden output in the           │                            │
  │ mysql-test         │ pingcap/tidb-test repo (release-8.5 branch) doesn't list    │ Add the row to tidb-test's │
  │                    │ the new APPLICATION_PASSWORD_ADMIN row (master's tidb-test  │  release-8.5 grant.result  │
  │                    │ already has it)                                             │                            │
  ├────────────────────┼─────────────────────────────────────────────────────────────┼────────────────────────────┤
  │                    │ TestFailure in brietest/operator_test.go — "service gc      │                            │
  │ check_dev_2        │ safepoint exists" leaked from a prior test in the shared    │ /retest                    │
  │                    │ cluster. Unrelated flake, same class as the master-side     │                            │
  │                    │ flake we saw                                                │                            │
  └────────────────────┴─────────────────────────────────────────────────────────────┴────────────────────────────┘

@takaidohigasi

Copy link
Copy Markdown
Contributor

Confirmed this backport against the current head of the master PR (#68393 @ 902f1d5e4f), plus a root-cause analysis of the three failing checks. TL;DR: the dual-password behavior is identical to master and none of the CI failures indicate a code problem — two golden-file updates and one flake retry are needed.

Backport content verification

  • All dual-password test files are byte-identical to the master branch head (dual_password_test.go, integration .test/.result, simple_internal_test.go), so the snapshot includes every review follow-up (the self-service gate fixes, resolved-plugin encoding, Handle.UpdateAll sysvar accessor fix, alterUserHasPrivilegedOptions, and the AdditionalAuthString rename).
  • Diffing simple.go / privileges.go / cache.go between this PR and master: zero dual-password-related lines differ; the remaining diff is release-8.5 base divergence only (vardef package split, keyspace username policy, etc.).

CI failures

1. check_dev — integrationtest executor/dual_password: test-driver difference, safe to re-record

The failing case is the negative CREATE USER ... RETAIN CURRENT PASSWORD parse check: the recorded result expects near "retain current password" but release-8.5 produces near "retain current password;" (trailing ;).

This is not a parser behavior difference:

  • Scanner.Errorf is byte-identical on both branches — the near text is just the raw remaining input from the failure offset (s.r.s[s.lastScanOffset:]).
  • Feeding master's parser both input variants directly reproduces both outputs: with ; in the input it prints near "retain current password;" (exactly what 8.5 CI got); without it, near "retain current password" (exactly what the master-recorded result contains). Error code (1064) and position (line 1 column 41) are identical either way.
  • The actual cause is the branch-pinned mysql-tester version in tests/integrationtest/run-tests.sh: master pins f2d90ea9 (sends the statement without the trailing ;), release-8.5 pins 314107b2 (sends it with ;). Same server bytes-in → same parser behavior; different bytes-in → different excerpt.

So re-recording dual_password.result on release-8.5 (only that one error line changes) is the correct fix, not a workaround. Any negative parse test recorded on master would hit the same thing on this branch.

2. mysql-testgrant.test: tidb-test golden file needs the new privilege row

SHOW PRIVILEGES now lists APPLICATION_PASSWORD_ADMIN, but the release-8.5 branch of pingcap/tidb-test grant.result does not have that row yet (master's tidb-test already does, which is why master CI passes). The release-8.5 grant.result needs the one-line addition:

APPLICATION_PASSWORD_ADMIN	Server Admin	

3. check_dev_2 — unrelated flake

TestFailure in tests/realtikvtest/brietest/operator_test.go fails with "the service gc safepoint exists" (a br-… service safepoint leaked from a prior test in the shared cluster). Unrelated to this PR; a /retest should clear it.

@takaidohigasi

Copy link
Copy Markdown
Contributor

🙏

Signed-off-by: bb7133 <bb7133@gmail.com>
@takaidohigasi

Copy link
Copy Markdown
Contributor

/test check-dev2

@bb7133
bb7133 changed the base branch from release-8.5 to release-8.5-20260710-v8.5.7 July 9, 2026 23:05
Signed-off-by: bb7133 <bb7133@gmail.com>
@takaidohigasi

Copy link
Copy Markdown
Contributor

thanks so much for the work 🙇

@ti-chi-bot ti-chi-bot Bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 10, 2026
@ti-chi-bot ti-chi-bot Bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 10, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2026-07-10 03:16:38.626136011 +0000 UTC m=+337984.662231057: ☑️ agreed by D3Hunter.
  • 2026-07-10 04:57:37.169153739 +0000 UTC m=+344043.205248795: ☑️ agreed by tiancaiamao.

@ti-chi-bot

ti-chi-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: D3Hunter, tiancaiamao, yudongusa

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added the approved label Jul 10, 2026
@ti-chi-bot
ti-chi-bot Bot merged commit 7e355f5 into pingcap:release-8.5-20260710-v8.5.7 Jul 10, 2026
20 checks passed
takaidohigasi added a commit to takaidohigasi/docs that referenced this pull request Jul 10, 2026
pingcap/tidb#69735 backported the feature to release-8.5 and it ships in
the v8.5.7 train, so "Starting from v9.0.0" becomes "Starting from v8.5.7"
in the three version notes (password-management.md intro + section,
sql-statement-set-password.md).

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants