github-actions[bot] commented on code in PR #64043:
URL: https://github.com/apache/doris/pull/64043#discussion_r3353209314
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/PluginDrivenExternalCatalog.java:
##########
@@ -296,6 +300,72 @@ public void gsonPostProcess() throws IOException {
}
}
+ @Override
+ public void createDb(String dbName, boolean ifNotExists, Map<String,
String> properties)
+ throws DdlException {
+ makeSureInitialized();
+ LOG.info("Creating database {} in catalog {} (ifNotExists={})",
dbName, getName(), ifNotExists);
+ HashMap<String, String> props = new HashMap<>(properties);
+ props.put("jdbc_if_not_exists", String.valueOf(ifNotExists));
+ ConnectorSession session = buildConnectorSession();
+
+ // Execute remote CREATE DATABASE
+ connector.getMetadata(session).createDatabase(session, dbName, props);
+
+ // Invalidate cache so next listDatabaseNames() re-fetches from remote
+ resetMetaCacheNames();
+
+ // Write edit log so follower FEs can replay cache invalidation
+ Env.getCurrentEnv().getEditLog().logCreateDb(new
CreateDbInfo(getName(), dbName, null));
+ }
+
+ @Override
+ public void dropDb(String dbName, boolean ifExists, boolean force) throws
DdlException {
+ makeSureInitialized();
+ LOG.info("Dropping database {} from catalog {}", dbName, getName());
+
+ // Resolve local name to remote name for identifier mapping support
+ ExternalDatabase<?> dorisDb = getDbNullable(dbName);
+ if (dorisDb == null) {
Review Comment:
This lookup still uses the caller-supplied name as the Doris local name, so
it misses databases whose local name was transformed by
`lower_case_meta_names`. The new regression demonstrates the failure: after
`CREATE DATABASE catalog_lower.MixedCaseTestDB`, `SHOW DATABASES` exposes
`mixedcasetestdb`, but `DROP DATABASE IF EXISTS catalog_lower.MixedCaseTestDB`
reaches this branch with `dorisDb == null` and returns success without dropping
anything. That makes a create followed by drop using the same SQL spelling
silently leave the remote schema behind whenever the catalog lowercases
metadata names. Please normalize/resolve the input to the actual local name
before the existence check and unregister/log using that resolved local name;
the test should assert that the first DROP removes the database rather than
asserting it still exists.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]