Repository navigation
remove secondary role - #26734
Merged
Merged
remove secondary role#26734
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? |
ghost
approved these changes
Aug 6, 2026
Contributor
Merge Queue Status
This pull request spent 1 hour 24 minutes 45 seconds in the queue, including 45 minutes 44 seconds running CI. Required conditions to merge
|
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
此分支将 secondary role 功能改为兼容性 no-op: - SET SECONDARY ROLE ALL/NONE 保留语法并成功执行,但不改变会话状态。 - 用户始终只有一个有效角色;secondary role 的权限不会自动合并。 - 删除启用 secondary role 时查询、加载角色的执行逻辑。 - 避免 no-op 语句触发权限缓存失效。 - 保留 SET ROLE <role>,用户可显式切换到另一个单独角色。 - 更新前端 UT 和新增 BVT,覆盖 no-op 后角色不变、secondary 权限不生效、显式切换角色后权限生效。 Approved by: @XuPeng-SH, @heni02
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
此分支将 secondary role 功能改为兼容性 no-op: - SET SECONDARY ROLE ALL/NONE 保留语法并成功执行,但不改变会话状态。 - 用户始终只有一个有效角色;secondary role 的权限不会自动合并。 - 删除启用 secondary role 时查询、加载角色的执行逻辑。 - 避免 no-op 语句触发权限缓存失效。 - 保留 SET ROLE <role>,用户可显式切换到另一个单独角色。 - 更新前端 UT 和新增 BVT,覆盖 no-op 后角色不变、secondary 权限不生效、显式切换角色后权限生效。 Approved by: @XuPeng-SH, @heni02
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
此分支将 secondary role 功能改为兼容性 no-op: - SET SECONDARY ROLE ALL/NONE 保留语法并成功执行,但不改变会话状态。 - 用户始终只有一个有效角色;secondary role 的权限不会自动合并。 - 删除启用 secondary role 时查询、加载角色的执行逻辑。 - 避免 no-op 语句触发权限缓存失效。 - 保留 SET ROLE <role>,用户可显式切换到另一个单独角色。 - 更新前端 UT 和新增 BVT,覆盖 no-op 后角色不变、secondary 权限不生效、显式切换角色后权限生效。 Approved by: @XuPeng-SH, @heni02
1 of 7 tasks
XuPeng-SH
added a commit
that referenced
this pull request
Dec 3, 2026
…3692) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes #33696. Related to #33377 (4.2-dev active-role enforcement) and #29148 (prepared-statement authorization). ## What this PR does / why we need it: Proxy opens a fresh authenticated connection on the destination CN. On main at `faafdf4fef03` and on #33568 at `89068bb76c96`, a session that had run `SET ROLE` could move under the login default role. The 4.2-dev fix in #33389 already kept the source connection when its active role differed from the target login. The source adds the active role ID and name to the existing account and user identity. The destination compares this identity at preflight and again before importing session state. A mismatch keeps the client on its source CN. Checking both role fields preserves `CURRENT_ROLE_ID()` and `CURRENT_ROLE()` across a rename and prevents a different role from matching a reused name. Export action 0 and `PrincipalVerified` field 2 retain their existing wire numbers. Main gives each session one active role. `SET SECONDARY ROLE ALL/NONE` leaves that role unchanged. The main protocol carries the role ID in field 3 and its name in field 5. Tag 4 is reserved. The 4.2-dev role snapshot uses tag 4 for its enabled secondary-role mode. [Main role semantics](#26734) · [4.2-dev role selection](https://github.com/matrixorigin/matrixone/blob/355a64c9bf9bd657d366f366e0aec05d85511012/pkg/frontend/authenticate.go#L3653-L3681) ### Validation on `5dbde1d75806` Local PR SCA selected `./...` because of `proto/query.proto`. Both `molint` and `golangci-lint` passed with the repository configuration. All 11 targeted race tests across four packages passed, including authenticated session migration between two CNs. A separate arm64 check with `GOEXPERIMENT=simd` reproduced the same `checkunsafe` warning in `distance_func_narrow_arm64.go:40` on clean main at `4a3e5182a6e3` and on this commit. ### Validation on `82ef44b94f8c` The full PR patch is identical before and after the rebase onto main at `c13851c20654` (#33635). The tests below ran with the updated dependency. One authenticated client connected through Proxy to two CNs. Each of three race-detector runs checked four transfers. A different login default, a renamed role with the same ID, and a reused role name with a different ID kept the source connection. Matching role ID and name moved the same connection to the other CN. Every attempt checked the backend address, role ID, role name, one allowed table read and one denied table read. [Two-CN assertions](https://github.com/matrixorigin/matrixone/blob/82ef44b94f8cd54dfd7a495529f1549c87104f7f/pkg/proxy/migration_principal_integration_test.go#L121-L154) <details> <summary>Two-CN test command and terminal output</summary> The checkout was clean, with the repository's CPU native libraries on Darwin/arm64. The sandbox isolates an unrelated local HAKeeper listener. ```sh git rev-parse HEAD go version export GOWORK=off GOEXPERIMENT=simd GOMAXPROCS=4 GOMEMLIMIT=5GiB export TMPDIR="$(mktemp -d)" printf '%s\n' '(version 1)' '(allow default)' '(deny network-outbound (remote ip "localhost:32001"))' > "$TMPDIR/hakeeper.sb" .agents/skills/mo-dev/scripts/mo-cgo-test -mod=readonly -p=2 -race -timeout=12m \ -exec "/usr/bin/sandbox-exec -f $TMPDIR/hakeeper.sb" \ -count=3 -v -run '^TestRenameUserProxyMigrationPrincipal$' ./pkg/proxy ``` ```text 82ef44b go version go1.27.1 darwin/arm64 === RUN TestRenameUserProxyMigrationPrincipal migration_principal_integration_test.go:142: different login default: backend 127.0.0.1:10120 -> 127.0.0.1:10120, role 3/migration_rb, allowed read on b and denied read on a migration_principal_integration_test.go:145: matching active role: backend 127.0.0.1:10120 -> 127.0.0.1:10160, role 3/migration_rb, allowed read on b and denied read on a migration_principal_integration_test.go:148: same role ID, renamed role: backend 127.0.0.1:10160 -> 127.0.0.1:10160, role 3/migration_rb, allowed read on b and denied read on a migration_principal_integration_test.go:151: same role name, different ID: backend 127.0.0.1:10160 -> 127.0.0.1:10160, role 3/migration_rb, allowed read on b and denied read on a --- PASS: TestRenameUserProxyMigrationPrincipal (16.21s) === RUN TestRenameUserProxyMigrationPrincipal migration_principal_integration_test.go:142: different login default: backend 127.0.0.1:10120 -> 127.0.0.1:10120, role 10002/migration_rb, allowed read on b and denied read on a migration_principal_integration_test.go:145: matching active role: backend 127.0.0.1:10120 -> 127.0.0.1:10160, role 10002/migration_rb, allowed read on b and denied read on a migration_principal_integration_test.go:148: same role ID, renamed role: backend 127.0.0.1:10160 -> 127.0.0.1:10160, role 10002/migration_rb, allowed read on b and denied read on a migration_principal_integration_test.go:151: same role name, different ID: backend 127.0.0.1:10160 -> 127.0.0.1:10160, role 10002/migration_rb, allowed read on b and denied read on a --- PASS: TestRenameUserProxyMigrationPrincipal (21.01s) === RUN TestRenameUserProxyMigrationPrincipal migration_principal_integration_test.go:142: different login default: backend 127.0.0.1:10120 -> 127.0.0.1:10120, role 10002/migration_rb, allowed read on b and denied read on a migration_principal_integration_test.go:145: matching active role: backend 127.0.0.1:10120 -> 127.0.0.1:10160, role 10002/migration_rb, allowed read on b and denied read on a migration_principal_integration_test.go:148: same role ID, renamed role: backend 127.0.0.1:10160 -> 127.0.0.1:10160, role 10002/migration_rb, allowed read on b and denied read on a migration_principal_integration_test.go:151: same role name, different ID: backend 127.0.0.1:10160 -> 127.0.0.1:10160, role 10002/migration_rb, allowed read on b and denied read on a --- PASS: TestRenameUserProxyMigrationPrincipal (18.84s) PASS ok github.com/matrixorigin/matrixone/pkg/proxy 59.630s exit 0 ``` </details> - 336 top-level Proxy tests, 59 frontend migration tests and 5 wire and prepared-statement regressions passed under the race detector. The prepared-statement cases include revoking SELECT between preflight and replay. - The combined tree with #33568 at `89068bb76c96` (`2c94a66d3aaf`) passed six migration and routing tests three times each under the race detector. - Go vet, molint and incremental golangci-lint passed. The generator reproduced the main binding byte for byte. The protobuf descriptor differs from main only in the two added fields and the reserved tag.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
issue #25465
What this PR does / why we need it:
此分支将 secondary role 功能改为兼容性 no-op: