Repository navigation
feat(sql): support administrator FLUSH PRIVILEGES as a no-op - #31834
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Addressed the fixture-validity finding in
Exact-head CI has started for this commit and is still in progress. XuPeng-SH, please re-review the addressed P2 finding. Deployment QA remains separate and has not been performed. |
|
mo-bot review · Commit: Review discussion changed before publication; a fresh contextual review is queued. |
iamlinjunhong
left a comment
There was a problem hiding this comment.
Reviewed db91943a751eca0b31f0ae43b0c6ca4fbf2fc90d for the FLUSH PRIVILEGES compatibility item in #30468.
- [P1] Preserve unquoted identifiers named
flush(pkg/sql/parsers/dialect/mysql/keywords.go:479). The scanner now emitsFLUSHfor unquotedflush, while therole_namerule atpkg/sql/parsers/dialect/mysql/mysql_sql.y:10046takes bare names throughIDand enumerates keyword exceptions separately. The base parser acceptsCREATE ROLE flush,SET ROLE flush, andDROP ROLE flush. All three return syntax errors on this head, including for scripts managing a role created before upgrade. The same token change breaks unqualified calls to a UDF namedflushand unquotedFOR ICEBERG REF flush. Keep the keyword contextual to the statement or preserve those identifier paths. Add regression cases for the affected syntax.
The previous binary PREPARE fixture finding is addressed. The author's reply explains the fixture changes. The current tests require the parser-specific error, and the wire test checks the connection afterward.
I reproduced the parser regression locally with mysql.ParseOne using the current parser and the base parser files. Parser regeneration matched the checked-in output byte for byte, and git diff --check passed. I did not rerun frontend tests or service BVT locally.
The exact-head snapshot contains 30 checks. Of those, 14 succeeded, 14 were skipped, and 2 were neutral. There are no failures or pending checks. CI Required succeeded.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: db91943a751eca0b31f0ae43b0c6ca4fbf2fc90d
Assessment: request_changes
The administrator-only no-op reuses the existing authorization and transaction paths. The revised binary PREPARE tests address the earlier fixture finding by requiring a parser error. The global keyword mapping still breaks existing SQL that uses flush as an unquoted role name, function name, or Iceberg ref.
Model: gpt-6.2-sol / xhigh
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
- P2
pkg/sql/parsers/dialect/mysql/keywords.go:479: RunCREATE ROLE flush,SET ROLE flush,DROP ROLE flush,SELECT flush(1), or a query withFOR ICEBERG REF flush.
Impact: Existing scripts can no longer manage or activate the unquoted role, call the function, or query the named Iceberg ref. The candidate still acceptsCREATE FUNCTION flush(...), so users can create a function whose ordinary invocation fails. Quoted role and Iceberg ref names still parse.
Evidence: The lexer now emitsFLUSHwhererole_name,function_call_generic, andiceberg_ref_nameexpectID. The lexer and generated-table comparison inidentifier-parser.stdoutconfirmed all five regressions against the merge base. It also confirmed that the role statements and function call worked in v4.2.5. RecognizeFLUSHin the command context while preserving existing identifier syntax, and add regression cases for these forms.
Validation:
-
Verified the frozen patch and clean source, all 797 existing token numbers, and all 80 SQL/result pairs. Reconciled the retained same-head parser regeneration byte for byte with the checked-in file.
-
Compared scanner output and generated parser tables for v4.2.5, the merge base, and the candidate. Controls covered ordinary identifiers, quoted role and ref names, and the new statement. See
identifier-parser.stdoutand receipt1794998849192524107-2.json. -
The exact-head CI snapshot reports successful unit tests, static analysis, coverage, shared build, PROXY and PESSIMISTIC multi-CN BVT, and CI Required.
Limitations:
-
The comparison exercised the scanner and parser tables. Frontend package tests, service BVT, and deployment QA were not rerun locally.
-
The fresh parser regeneration timed out during toolchain setup. The retained successful regeneration matched the current frozen source.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 154447a06678d5f001e385d5df5663a0a99dc4ef
Assessment: approve
FLUSH PRIVILEGES uses the existing active-admin authorization and frontend status response. It preserves open transactions and rejects PREPARE. The revised grammar restores all five previously broken uses of unquoted flush.
Model: gpt-6.2-sol / xhigh
Session: 01a1ee80-0d82-7030-a965-b51f496c3054 · slot 2 · generation 1
Validation:
-
The full MySQL parser package passed all 297 top-level tests, including the five identifier regressions. See parser-go.jsonl and checks/1795004357733797608-4.json.
-
All four focused frontend tests passed, covering role authorization, transaction admission, and PREPARE rejection at both the request and wire layers. See frontend-go.jsonl and checks/1795004517338855224-3.json.
-
Parser regeneration matched the checked-in output byte for byte, reported zero conflicts, and preserved 797 existing token numbers. The frozen patch, formatting, and all 80 SQL/result pairs passed the audit. See parser-audit.log and checks/1795004164801860734-3.json.
-
All 19 discussion entries were reconciled in discussion-assessment.json. The frozen CI snapshot reports successful shared build, UT, SCA, coverage, PROXY and pessimistic multi-CN BVT, and CI Required.
Limitations:
- The frozen CI snapshot contains job-level results. Current-head logs for the individual SQL case and independent deployment QA were unavailable.
iamlinjunhong
left a comment
There was a problem hiding this comment.
Reviewed 154447a06678d5f001e385d5df5663a0a99dc4ef against the FLUSH PRIVILEGES scope of #30468.
- [P1] Restrict
FLUSH PRIVILEGESto the top-level statement list (pkg/sql/parsers/dialect/mysql/mysql_sql.y:1250). The new alternative is onstmt, whichcommon_table_expralso uses at line 7567.WITH c AS (FLUSH PRIVILEGES) SELECT 1is rejected by the base parser but now parses as aSelectwith aFlushPrivilegesCTE body. The binder registers an unused CTE without validating its body, so this nested form is not rejected as the top-level-only design requires. Move the alternative to a rule used only bystmt_listand add a negative CTE regression case.
The previous identifier regression is fixed for all five reported forms, and the author replied directly. The earlier binary PREPARE fixture finding also remains addressed: the tests require a parser error, and the wire test checks the connection afterward, as explained in the author’s reply.
Local validation: compared mysql.ParseOne on the exact head and on the base keyword map and generated parser using a Go overlay. Both focused parser tests (TestFlushPrivilegesSyntax and TestFlushKeywordPreservesIdentifierUses), git diff --check, and the PR artifact check passed. The nested acceptance was reproduced at the parser level; no local frontend or service BVT rerun.
Exact-head CI was not all green: 14 of 30 checks succeeded, 14 were skipped, and 2 were neutral. None failed or remained pending. CI Required succeeded.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 154447a06678d5f001e385d5df5663a0a99dc4ef
Assessment: request_changes
The same-head follow-up confirmed a grammar defect that changes the prior approval. The earlier fixes for unquoted flush identifiers and the PREPARE tests still hold.
Model: gpt-6.2-sol / xhigh
Session: 01a1eecd-3287-70c0-bb93-ab923faf5f3f · slot 0 · generation 2
- P2
pkg/sql/parsers/dialect/mysql/mysql_sql.y:1250: A WITH clause placesFLUSH PRIVILEGESin an unused CTE body.
Impact: The parser accepts syntax outside the documented top-level-only contract. The planner leaves the unused CTE body unbound, allowing the outer SELECT to succeed.
Evidence:common_table_exprconsumesstmtat line 7567. The generated parser audit confirmed that this path accepts the new FLUSH production. The planner registers CTEs at query_builder.go:6385 and binds their bodies at reference sites. Move the production to a rule used only bystmt_listand add a negative CTE case toTestFlushPrivilegesSyntax.
Validation:
-
Patch whitespace and the generated CTE grammar audit passed. See diff-check.log, cte-grammar-audit.log, and their receipts in validation-assessment.md.
-
Reconciled the prior exact-head results for 297 parser tests, four focused frontend tests, and byte-for-byte parser regeneration.
-
Reconciled all 23 discussion entries in discussion-assessment.json.
Limitations:
- The follow-up verified the generated parser states and binder source. The peer review reports parser execution. Exact-case service logs and independent deployment QA remain unavailable.
|
@XuPeng-SH The CTE grammar finding is fixed on |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: f0e69c4f3ccb5ff2a2c07583a65e310bc7878497
Assessment: approve
FLUSH PRIVILEGES is accepted only at the top level and reuses the existing active-admin authorization, transaction policy, and frontend OK response. The earlier CTE, unquoted identifier, and binary PREPARE fixture findings are resolved.
Model: gpt-6.2-sol / xhigh
Session: 01a1eecd-3287-70c0-bb93-ab923faf5f3f · slot 0 · generation 2
Validation:
-
The MySQL parser package passed 298 top-level tests, including the CTE rejection, identifier regressions, and a mixed-statement probe. See parser-tests-native.jsonl and checks/1795019086458179041-3.json.
-
Four focused frontend tests passed under race detection. The binary PREPARE wire test also passed 100 repetitions. See frontend-focused-race-retry.jsonl and frontend-wire-race-repeat.jsonl with receipts 1795019679368286237-3 and 1795019694427609947-3.
-
Parser regeneration matched the checked-in output byte for byte with zero conflicts and preserved all 797 existing token numbers. The source audit reconciled 28 discussion entries and 80 BVT SQL/result pairs. See parser-generation.log and review-audit.log with receipts 1795018903547451874-4 and 1795019272684153435-5.
-
Frozen CI for this head records successful unit tests, static analysis, both complementary multi-CN BVT jobs, and CI Required.
Limitations:
-
Individual BVT case logs and independent deployment QA results were unavailable.
-
The initial local checks encountered missing native headers and a module download error. Both setup issues were resolved before the passing runs. The retained logs and receipts are reconciled in validation-reconciliation.json.
iamlinjunhong
left a comment
There was a problem hiding this comment.
Reviewed f0e69c4f3ccb5ff2a2c07583a65e310bc7878497 for the FLUSH PRIVILEGES compatibility item. No findings remain. Issue #30468
- The previous CTE acceptance issue is fixed. The grammar accepts
FLUSH PRIVILEGESonly in the top-level statement list, including after a statement separator. CTE bodies still use the genericstmtrule, and the parser test requiresWITH c AS (FLUSH PRIVILEGES) SELECT 1to fail. Author’s reply - The five previously reported unquoted
flushuses remain covered. The binary PREPARE tests still require a parser error, and the wire test checks that the connection remains usable after rejection. Identifier follow-up · Binary PREPARE follow-up
I checked the grammar against the generated parser, confirmed all 797 existing token numbers are preserved, and traced authorization, transaction handling, and PREPARE rejection. git diff --check and the PR artifact check passed. For runtime validation I used the current-head CI and peer review results in place of repeating local Go and service BVT runs. Current-head validation
Of the 30 checks on this head, 14 succeeded, 14 were skipped, and 2 were neutral. None failed or were pending. Unit tests and both multi-CN BVT jobs succeeded. CI Required succeeded.
|
mo-bot review · Commit: New discussion was assessed; the previous review remains unchanged. |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
1 similar comment
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
mo-bot review · Commit: "interrupted" |
|
@Mergifyio refresh |
✅ Pull request refreshed |
🚫 Left the queue · pull request dequeued3 h 6 min in the queue, with no time running CI. So far
Reason Pull request #31834 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
To get back in the queue
Merge conditions not met when it left the queue
Tick the box to put this pull request back in the merge queue (same as
2 merge conditions met
Times in UTC · dashboard · how the merge queue works |
合入后部署验收 · FLUSH PRIVILEGES请在包含
合并前 PR 头 本次验收只覆盖 #30468 中的 |
What type of PR is this?
Which issue(s) this PR fixes:
Refs #30468, FLUSH PRIVILEGES subitem only. This does not close the broader compatibility issue.
What this PR does / why we need it:
Accept FLUSH PRIVILEGES for the active moadmin/accountadmin role and return an OK response without modifying privileges or invalidating caches. Add parser/AST support, explicit frontend authorization and execution handling, and regression coverage. FLUSH remains a nonreserved identifier.
This is a limited script-compatibility feature, not full MySQL FLUSH semantics: it uses existing administrator roles rather than introducing a grantable RELOAD privilege, preserves the current transaction rather than implicitly committing, and follows the existing mo_rollback_txn_on_error policy on rejected statements. PREPARE and other FLUSH variants remain unsupported. FLUSH TABLES, RESOURCE GROUP, and EXPLAIN FORMAT=JSON are outside this patch.
Design record:
docs/design/flush-privileges-noop.mdrecords the bounded design review; it is separate from GitHub human approval. The older fengttt approval predates this head. XuPeng-SH and iamlinjunhong have since approved exact headf0e69c4f3ccb5ff2a2c07583a65e310bc7878497; LeftHandCold and aptend remain requested. Independent deployment QA is pending. This head also adds a binary COM_STMT_PREPARE request-path regression.The earlier DELETE-source baseline repair is already present in integrated main. Focused tests retain coverage of the fail-closed missing/derived-source behavior.
Current head
The current head is
a9922c1e1f947544cac7e6ad5063444abe1f71b5, synchronized withmainat9bf005bfcd06ef722351bccd9c9a59833ce2b5bd.FLUSH PRIVILEGESis now a direct production of the top-levelstmt_list; genericstmtno longer accepts it, socommon_table_exprcannot parse it as a CTE body.TestFlushPrivilegesSyntaxrejectsWITH c AS (FLUSH PRIVILEGES) SELECT 1. The prior regressions for unquotedflushidentifiers remain covered and pass.Validation
At
a9922c1e1f947544cac7e6ad5063444abe1f71b5, the MySQL parser was regenerated from the merged grammar. The full MySQL parser package and focused frontend authorization, transaction, binary PREPARE, and unused window diagnostics tests passed with-race. Both packages passedgo vet -race. Remote CI is pending. Deployment QA remains pending.Historical candidate: 05ddb48; tree e05ea06f22f10b3fcebbb0c3349383bcd95ecee6.
Historical integration at c0de195
d24f446e1e94a58c329d422519f7aad621cdcd05and regenerated the MySQL parser from the combined grammar with no grammar conflicts.pkg/frontendandpkg/sql/parsers/dialect/mysqlpackages passed.c0de195f10d64cd036e99d9053ca1c1d676b9579;flush_privileges.sqlpassed normal mo-tester comparison twice, 80/80 each, with JDBC metadata ignored as in the existing harness. Test accounts, role and databases were checked absent between runs, and the owned service terminated.go vet, incremental lint andgit diff --checkpassed.Previous exact-head CI validation (54f0a88; superseded by ab779e7)
On head
54f0a880b1daed493406998ea72432465886c36c, workflow run 43200809588, attempt 2 completed withCI Requiredsuccessful. Ubuntu/x86 UT, Linux/arm64 SCA, shared build, PROXY and PESSIMISTIC multi-CN BVT, coverage, and preflight passed. Conditional compatibility/upgrade and disabled jobs were skipped and are not counted as passes.The PR remains open and Ready with review requests outstanding. Deployment QA for tenant-role authorization and transaction behavior remains required; no deployment or merge is claimed.
Previous exact-head CI and acceptance status (ab779e7; superseded by 4abb1ed)
The ALL run
43376977351completed successfully on the prior headab779e77d3cf357a8ec0b8eedead49b7529e5ea2. Conditional and disabled jobs were skipped and are not counted as passes. The human review requests and deployment QA remained pending after that head.Previous exact-head CI and acceptance status (4abb1ed; superseded by 453c54e)
On run 44084089899 at head
4abb1ede2f077a14e04b1b7afe5bca5af6738efc, CI completed with failed Ubuntu/x86 UT, Linux/arm64 SCA andCI Required. The UT failure waspkg/fileservice/TestLocalFS/file_service/treeending in context deadline exceeded;pkg/fileserviceis unchanged by this PR. The SCA finding wassqlclosecheckon the newly addeddb.Prepare("flush privileges")inpkg/frontend/server_test.go; it was fixed in453c54eby closing a non-nil statement on the unexpected success path. Focused localsqlclosecheckandgit diff --checkpass for the fix. This failed run is historical for the prior head and is superseded by the current-head run below.Previous exact-head CI and acceptance status (453c54e; superseded by db91943)
The PR is OPEN and Ready at head
453c54e595d0723cfb32375658a3e64c9da1974b, based on7fc45a2be2424d887199c5949362855cbacfe30f. On run 44249308908, CI preflight, coverage eligibility, Iceberg adapter tidy, PR-size-label and the workflow summary succeeded. Ubuntu/x86 UT, UT Coverage and Linux/arm64 SCA are in progress; shared build and Connector/J Pool Reset E2E succeeded. Conditional jobs are skipped, not passes; the Mergify queue check is neutral while waiting forCI Required, and there is no terminalCI Requiredresult. XuPeng-SH's latest formal APPROVED review is on the earlier headab779e77d3cf357a8ec0b8eedead49b7529e5ea2; LeftHandCold, iamlinjunhong and aptend remain requested. Independent deployment QA is pending. The prior head's SCA finding was reproduced locally with focusedsqlclosecheckand fixed; the same focused check andgit diff --checkpass on this change. No tests were run for the statement-close-only edit. No merge is claimed.Previous exact-head CI and acceptance status (db91943; superseded by 154447a)
The PR is OPEN and Ready at head
db91943a751eca0b31f0ae43b0c6ca4fbf2fc90d. This head passes both focused binary FLUSH PREPARE regression tests,go vet ./pkg/frontend, incrementalgolangci-lint, formatting, andgit diff --check.The current check-run snapshot has 27 checks: 8 successful, 4 in progress, 13 skipped, and 2 neutral; none failed, and there is no terminal
CI Requiredresult. Skipped and neutral checks are not counted as passes. XuPeng-SH's CHANGES_REQUESTED review is on the prior head453c54e595d0723cfb32375658a3e64c9da1974b; its P2 finding is addressed on this head, and review acceptance remains pending. LeftHandCold, XuPeng-SH, iamlinjunhong, and aptend remain requested. No unresolved inline review threads were found. Independent deployment QA remains pending. No merge or deployment is claimed.Previous exact-head CI and acceptance status (154447a06678d5df5663a0a99dc4ef; superseded by f0e69c4)
The PR remains OPEN and Ready at head
154447a06678d5f001e385d5df5663a0a99dc4ef, based on7fc45a2be2424d887199c5949362855cbacfe30f. The MySQL parser package and focused FLUSH tests pass locally; goyacc reports zero conflicts, andgit diff --checkpasses.The exact-head snapshot has 30 checks: 14 successful, 14 skipped, and 2 neutral; none failed.
CI Requiredsucceeded. Skipped and neutral checks are not passes.XuPeng-SH and iamlinjunhong have both approved exact head
f0e69c4f3ccb5ff2a2c07583a65e310bc7878497; iamlinjunhong's earlier P1 finding is resolved, and no unresolved inline review threads remain. LeftHandCold and aptend remain requested. Independent deployment QA is pending. No merge or deployment is claimed.Previous exact-head validation (f0e69c4; checked 2026-11-18 17:06:51 UTC)
TestFlushPrivilegesSyntaxacceptedWITH c AS (FLUSH PRIVILEGES) SELECT 1. The fix makesFLUSH PRIVILEGEStop-level only; the CTE rejection, identifier cases and binary PREPARE rejection are covered.pkg/sql/parsers/dialect/mysqlpackage pass. Parser regeneration matched checked-in output with zero conflicts and preserved all 797 existing token numbers. The binary PREPARE wire regression passed 100 repetitions.CI Requiredpassed and both multi-CN BVT jobs passed. The PESSIMISTIC BVT job executedtest/distributed/cases/zz_accesscontrol/flush_privileges.sqlwith 80/80 success and 0 failures. Skipped/neutral checks are not counted as passes.mo-testercheckout or running MatrixOne service. The independent deployment QA for tenant-role authorization and transaction behavior remains pending.