Skip to content

fix(frontend): support JDBC session read-only mode - #29193

Merged
XuPeng-SH merged 13 commits into
matrixorigin:mainfrom
Lundomn:fix/issue-29185-jdbc-read-only
Sep 25, 2026
Merged

XuPeng-SH merged 13 commits into
matrixorigin:mainfrom
Lundomn:fix/issue-29185-jdbc-read-only

Conversation

@Lundomn

@Lundomn Lundomn commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Fixes #29185
Fixes #29278

What this PR does / why we need it:

Connector/J's Connection.setReadOnly(true) sends SET SESSION TRANSACTION READ ONLY. MatrixOne must accept that session access-mode statement and allow switching back with setReadOnly(false).

  • Keep transaction_read_only and tx_read_only consistent across session assignment, defaults, legacy aliases, and connection migration.
  • Validate transaction scope, isolation, static values, active-transaction restrictions, and GLOBAL privileges before applying static transaction assignments.
  • Preflight all leading literal/DEFAULT transaction assignments across unrelated static settings, while preserving the existing left-to-right boundary at the first dynamic expression.
  • Preserve an already active transaction when a transaction-characteristic statement is rejected.
  • Add public SQL/protocol regression coverage for active-transaction visibility/rollback, mixed static assignments, dynamic-expression boundaries, and non-admin mixed SESSION/GLOBAL atomicity.
  • Update the SET BVT expectations and Connector/J pool-reset probe for the supported session behavior.
  • Fix old-snapshot visibility for temporary tables with hidden unique indexes: the shared name/ID fallback admits a hidden index only when its generated temporary name, SystemIndexRel kind, live same-account/database/session temporary parent, exact parent ID, and reciprocal child-ID membership all validate.
  • Preserve the caller's transaction snapshot and normal snapshot-first behavior; do not change persisted relation kinds or standalone CREATE INDEX behavior.

Access-mode SET TRANSACTION (next transaction) and SET GLOBAL TRANSACTION remain unsupported. This PR does not add server-side write enforcement or general atomicity for arbitrary dynamic SET expressions.

Verification

Final head: 106123355142f41c5172539c673fdf75ba38ba06, rebased onto main at 16d8e5106caaedfe0a7296e4f628683e1b6a92b4.

Passed after the test cleanup:

  • .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=180s -run '^(TestCommittedTemporaryIndexCatalogVisibility|TestTemporaryIndexIDLookupRejectsSnapshotNameIdentityMismatch|TestTemporaryIndexFallbackRejectsOutOfScopeItems)$' ./pkg/vm/engine/disttae
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/vm/engine/disttae
  • gofmt and git diff --check
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/frontend passed after rebase; the only subsequent change was test-only cleanup in disttae.
  • Independent final review: GPT-6 Astra, medium, approved this exact head with no findings.

The specific Proxy multi-CN temp_ddl_transactions.sql BVT has not been run locally on this head. GitHub checks were triggered by the push; no updated-head CI success is claimed until they finish.

@Lundomn
Lundomn requested a review from XuPeng-SH as a code owner September 21, 2026 07:00
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@matrix-meow matrix-meow added the size/S Denotes a PR that changes [10,99] lines label Sep 21, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Sep 21, 2026
@Lundomn
Lundomn marked this pull request as draft September 21, 2026 07:10
@matrix-meow matrix-meow added size/M Denotes a PR that changes [100,499] lines and removed size/S Denotes a PR that changes [10,99] lines labels Sep 21, 2026
@Lundomn
Lundomn force-pushed the fix/issue-29185-jdbc-read-only branch from 393695c to fa8ffea Compare September 22, 2026 05:56
@matrix-meow matrix-meow added size/XL Denotes a PR that changes [1000, 1999] lines and removed size/L Denotes a PR that changes [500,999] lines labels Sep 22, 2026
@Lundomn

Lundomn commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the requested public-path coverage and rebased the PR onto current main.

  • Added active-transaction mixed-SET coverage: rejection, unchanged session variables, same-session visibility, cross-session isolation, and rollback cleanup.
  • Added non-admin mixed SESSION/GLOBAL assignment coverage in both orders, verifying privilege rejection and unchanged session/global values.
  • Final head: 0d94ab40fc4da4b1e345b51290c62f5c62e7bb39.
  • Final-head validation: pkg/frontend passed; parser scope tests passed; BVTs passed 17/17, 18/18, and existing set_transaction.sql 30/30; final make build and git diff --check passed.
  • Independent final review found no P0/P1/P2 blocker. Updated-head CI is currently pending/skipping.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

GPT-6 High deep review at exact head 1061233 against base 16d8e51: APPROVE. Previous blockers are resolved: static preflight now continues across unrelated literal assignments, and public-path tests prove rejected statements preserve session/global state, uncommitted visibility, cross-session isolation, and rollback behavior. Verified current-head CI, including the named BVT results, plus Connector/J Pool Reset E2E on all four configured versions. No remaining blocking findings.

@gouhongshen gouhongshen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Codex automated review

Reviewed the full diff and all prior reviews/comments. The prior partial-mutation and public-path evidence blockers are resolved at this head. SESSION access-mode behavior, alias synchronization, default/privilege/active-transaction validation, migration compatibility, and fail-closed temporary-index visibility are consistent with the documented contracts. Focused source inspection passed; exact-head CI and Connector/J E2E are green.

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/test-ci size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

6 participants