You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/08/02 07:17:10 UTC
[GitHub] [shardingsphere] strongduanmu commented on issue #10996: Support encrypt route when config multiple data sources
strongduanmu commented on issue #10996:
URL: https://github.com/apache/shardingsphere/issues/10996#issuecomment-890785146
When I tested the read-write separation scenario and configured multiple data, the metadata was incorrectly loaded during single table refresh.
```java
private TableMetaData loadTableMetaData(final String tableName, final Collection<String> routeDataSourceNames,
final SchemaBuilderMaterials materials) throws SQLException {
for (String routeDataSourceName : routeDataSourceNames) {
DataSource dataSource = materials.getDataSourceMap().get(routeDataSourceName);
Optional<TableMetaData> tableMetaDataOptional = Objects.isNull(dataSource) ? Optional.empty()
: TableMetaDataLoader.load(dataSource, tableName, materials.getDatabaseType());
if (!tableMetaDataOptional.isPresent()) {
continue;
}
return tableMetaDataOptional.get();
}
return new TableMetaData();
}
```
The `routeDataSourceNames` parameter passes the logical data source name, and `materials.getDataSourceMap()` returns the real data source name in the configuration file, so you need to convert routeDataSourceNames to the real data source name, otherwise abnormal results will occur when the metadata refreshes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org