strongduanmu commented on code in PR #25172:
URL: https://github.com/apache/shardingsphere/pull/25172#discussion_r1168871484
##########
kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/factory/ExternalMetaDataFactory.java:
##########
@@ -76,12 +85,26 @@ private static Map<String, ShardingSphereDatabase>
createGenericDatabases(final
String databaseName = entry.getKey();
if (!entry.getValue().getDataSources().isEmpty() ||
!protocolType.getSystemSchemas().contains(databaseName)) {
Map<String, DatabaseType> storageTypes =
DatabaseTypeEngine.getStorageTypes(entry.getKey(), entry.getValue());
+ checkSupportedStorageTypes(entry.getValue().getDataSources(),
databaseName, storageTypes);
result.put(databaseName.toLowerCase(),
ShardingSphereDatabase.create(databaseName, protocolType, storageTypes,
entry.getValue(), props, instanceContext));
}
}
return result;
}
+ private static void checkSupportedStorageTypes(final Map<String,
DataSource> dataSources, final String databaseName, final Map<String,
DatabaseType> storageTypes) throws SQLException {
+ if (dataSources.isEmpty()) {
+ return;
+ }
+ try (Connection connection =
dataSources.values().iterator().next().getConnection()) {
+ String url = connection.getMetaData().getURL();
+ if (MOCKED_URL.stream().anyMatch(url::startsWith)) {
+ return;
+ }
+ }
+ storageTypes.forEach((key, value) ->
ShardingSpherePreconditions.checkState(!SQL92DatabaseType.class.equals(value.getClass()),
() -> new UnsupportedStorageTypeException(databaseName, key)));
Review Comment:
Why only check sql92?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]