github-actions[bot] commented on code in PR #64043:
URL: https://github.com/apache/doris/pull/64043#discussion_r3351622875


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/PluginDrivenExternalCatalog.java:
##########
@@ -296,6 +300,59 @@ 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());
+        ConnectorSession session = buildConnectorSession();
+

Review Comment:
   This sends the Doris-visible database name directly to JDBC, but external 
catalog caches can expose a local name that differs from the remote schema. 
Existing external drop paths first resolve `getDbNullable(dbName)` and use 
`dorisDb.getRemoteName()` (for example Hive/Iceberg), which preserves 
`lower_case_database_names` and `meta_names_mapping`. With 
`lower_case_database_names=1`, a remote schema `Foo` is exposed locally as 
`foo`; `DROP DATABASE catalog.foo` reaches this line and issues `DROP DATABASE 
`foo`` against MySQL, so case-sensitive MySQL leaves/fails on the actual remote 
`Foo`. Please resolve the local DB to its `ExternalDatabase` and pass the 
remote name to the connector, while keeping unregister/logging keyed by the 
local name, and add coverage for a lowercase or mapped catalog.



-- 
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]

Reply via email to