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


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

Review Comment:
   `createDb()` still sends the caller spelling directly to MySQL without first 
checking the Doris-visible local namespace. With a JDBC catalog using 
`lower_case_meta_names=true`, `CREATE DATABASE catalog.MixedCaseTestDB` creates 
remote `MixedCaseTestDB` and Doris exposes it as local `mixedcasetestdb`. A 
later `CREATE DATABASE IF NOT EXISTS catalog.mixedcasetestdb` should be a no-op 
because the database already exists from Doris' perspective, but this line 
executes remote `CREATE DATABASE IF NOT EXISTS `mixedcasetestdb``. On 
case-sensitive MySQL that creates a second remote schema; the next metadata 
refresh maps both remote schemas to the same lowercase local name and hits the 
conflict path in `getFilteredDatabaseNames()`, breaking the catalog until one 
remote schema is removed. Please resolve/check the requested name against the 
local catalog namespace before remote CREATE, and add coverage for `IF NOT 
EXISTS` with the lower-cased visible name after creating a mixed-case database.



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