This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 7568630c87d Decouple UnicastDatabaseProxyBackendHandler and 
ProxyContext (#36818)
7568630c87d is described below

commit 7568630c87d2530ef9bb3d55309abf03220730db
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Oct 8 17:22:42 2025 +0800

    Decouple UnicastDatabaseProxyBackendHandler and ProxyContext (#36818)
---
 .../backend/handler/data/type/UnicastDatabaseProxyBackendHandler.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/type/UnicastDatabaseProxyBackendHandler.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/type/UnicastDatabaseProxyBackendHandler.java
index 96248be90c0..682b1777535 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/type/UnicastDatabaseProxyBackendHandler.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/type/UnicastDatabaseProxyBackendHandler.java
@@ -67,7 +67,7 @@ public final class UnicastDatabaseProxyBackendHandler 
implements DatabaseProxyBa
     private String getFirstDatabaseName() {
         Collection<String> databaseNames = 
ProxyContext.getInstance().getAllDatabaseNames();
         ShardingSpherePreconditions.checkNotEmpty(databaseNames, 
NoDatabaseSelectedException::new);
-        AuthorityRule authorityRule = 
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getSingleRule(AuthorityRule.class);
+        AuthorityRule authorityRule = 
connectionSession.getQueryContext().getMetaData().getGlobalRuleMetaData().getSingleRule(AuthorityRule.class);
         Optional<ShardingSpherePrivileges> privileges = 
authorityRule.findPrivileges(connectionSession.getConnectionContext().getGrantee());
         Stream<String> storageUnitContainedDatabaseNames = 
databaseNames.stream().filter(each -> 
ProxyContext.getInstance().getContextManager().getDatabase(each).containsDataSource());
         Optional<String> result = privileges.map(optional -> 
storageUnitContainedDatabaseNames.filter(optional::hasPrivileges).findFirst()).orElseGet(storageUnitContainedDatabaseNames::findFirst);

Reply via email to