diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteContextDecorator.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteContextDecorator.java index f2f116b575f2d..eefa515ed635b 100644 --- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteContextDecorator.java +++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteContextDecorator.java @@ -48,12 +48,12 @@ public static void decorate(final RouteContext routeContext, final ShadowRule ru for (RouteUnit each : routeContext.getRouteUnits()) { String logicName = each.getDataSourceMapper().getLogicName(); String actualName = each.getDataSourceMapper().getActualName(); - Optional sourceDataSourceName = rule.findProductionDataSourceName(actualName); - if (sourceDataSourceName.isPresent()) { - String shadowDataSourceName = shadowDataSourceMappings.get(sourceDataSourceName.get()); + Optional productionDataSourceName = rule.findProductionDataSourceName(actualName); + if (productionDataSourceName.isPresent()) { + String shadowDataSourceName = shadowDataSourceMappings.get(productionDataSourceName.get()); toBeRemovedRouteUnit.add(each); toBeAddedRouteUnit.add(null == shadowDataSourceName - ? new RouteUnit(new RouteMapper(logicName, sourceDataSourceName.get()), each.getTableMappers()) + ? new RouteUnit(new RouteMapper(logicName, productionDataSourceName.get()), each.getTableMappers()) : new RouteUnit(new RouteMapper(logicName, shadowDataSourceName), each.getTableMappers())); } }