You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2020/10/11 03:41:37 UTC
[shardingsphere] branch master updated: Fix route problem for first
route cannot get result (#7739)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 fb1b0b7 Fix route problem for first route cannot get result (#7739)
fb1b0b7 is described below
commit fb1b0b730d39f8c7a34b6d275be803d254e2a36d
Author: Liang Zhang <te...@163.com>
AuthorDate: Sun Oct 11 11:41:15 2020 +0800
Fix route problem for first route cannot get result (#7739)
---
.../apache/shardingsphere/infra/route/engine/SQLRouteEngine.java | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngine.java b/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngine.java
index b2cbe5f..d956bc3 100644
--- a/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngine.java
+++ b/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngine.java
@@ -75,17 +75,14 @@ public final class SQLRouteEngine {
@SuppressWarnings({"unchecked", "rawtypes"})
private RouteContext doRoute(final LogicSQL logicSQL) {
- RouteContext result = null;
+ RouteContext result = new RouteContext();
for (Entry<ShardingSphereRule, SQLRouter> entry : routers.entrySet()) {
- if (null == result) {
+ if (result.getRouteUnits().isEmpty()) {
result = entry.getValue().createRouteContext(logicSQL, entry.getKey(), props);
} else {
entry.getValue().decorateRouteContext(result, logicSQL, entry.getKey(), props);
}
}
- if (null == result) {
- result = new RouteContext();
- }
new UnconfiguredSchemaSQLRouter().decorate(result, logicSQL);
return result;
}