Commit 67548ed
feat: add explicit FLUSH PRIVILEGES to refresh role cache for query node (#19066)
* feat: add explicit FLUSH PRIVILEGES to refresh role cache for query node
* - SystemPlan is only produced by the SQL binder and that binder always runs in a QueryContext whose tenant is fixed to GlobalConfig::instance().query.tenant_id unless the server
is in management mode. When management mode is enabled, ManagementModeAccess blocks Plan::System altogether so no user query can ever build a system
action with a different tenant. As a result, the tenant field inside SystemPlan was guaranteed to equal the global config tenant and provided no extra routing information anywhere else in the stack.
- All flight actions (system_action, kill_query, set_priority, truncate_table) run inside a query server whose GlobalConfig already defines a single tenant. There is no supported deployment where a single query process serves
multiple tenants concurrently over flight RPC. Therefore, the create_session helper in src/query/service/src/servers/flight/v1/actions/mod.rs can safely derive the tenant from GlobalConfig every time; the optional parameter was
never used to switch context to another tenant.
- Because both ends (planner and flight handler) collapse to the same static tenant, the tenant field in SystemPlan and the Option<Tenant> parameter to create_session were redundant wiring that couldn't change behavior. Removing
them simplifies the code without affecting any observable semantics and makes it clear that system/flight actions always run under the server's configured tenant.
---------
Co-authored-by: TCeason <tai_chong@foxmail.com>1 parent 2b36a0b commit 67548ed
File tree
9 files changed
+27
-7
lines changed- src/query
- ast/src
- ast/statements
- parser
- service/src
- interpreters
- servers/flight/v1/actions
- sql/src/planner
- binder
- plans
- tests
- nox/java_client
- sqllogictests/suites/base/20+_others
9 files changed
+27
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5054 | 5054 | | |
5055 | 5055 | | |
5056 | 5056 | | |
5057 | | - | |
| 5057 | + | |
5058 | 5058 | | |
5059 | 5059 | | |
5060 | 5060 | | |
5061 | 5061 | | |
5062 | 5062 | | |
| 5063 | + | |
| 5064 | + | |
| 5065 | + | |
| 5066 | + | |
| 5067 | + | |
| 5068 | + | |
5063 | 5069 | | |
5064 | 5070 | | |
5065 | | - | |
| 5071 | + | |
5066 | 5072 | | |
5067 | 5073 | | |
5068 | 5074 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
683 | 683 | | |
684 | 684 | | |
685 | 685 | | |
| 686 | + | |
| 687 | + | |
686 | 688 | | |
687 | 689 | | |
688 | 690 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
93 | 98 | | |
94 | 99 | | |
95 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 60 | + | |
64 | 61 | | |
65 | 62 | | |
66 | 63 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
0 commit comments