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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java:
##########
@@ -779,17 +779,8 @@ public ExternalDatabase<? extends ExternalTable> 
getDbNullable(String dbName) {
         if (StringUtils.isEmpty(dbName)) {
             return null;
         }
-        try {
-            makeSureInitialized();
-        } catch (Exception e) {
-            String diagnosticTrace = initErrorStackTrace(e);
-            if (diagnosticTrace != null) {
-                LOG.warn("failed to get db {} in catalog {}: {}", dbName, 
name, diagnosticTrace);
-            } else {
-                LOG.warn("failed to get db {} in catalog {}", dbName, name, e);
-            }
-            return null;
-        }
+        // Initialization errors do not establish that the requested database 
is absent.
+        makeSureInitialized();

Review Comment:
   [P2] Restore the full namespace when a remembered-database SWITCH fails
   
   Select `ext.db` while healthy, switch to `internal.local_db`, then reset 
`ext` while its remote cluster is unavailable. `SWITCH ext` now throws from 
this lookup, but `Env.changeCatalog()` has already called 
`changeDefaultCatalog(ext)`, clearing the previous database, before 
`setDatabase(lastDb)` fails. The command error handlers never restore the 
namespace, so the failed SWITCH leaves the session on `ext` with an empty 
database and ID -1 instead of `internal.local_db`. Previously the swallowed 
failure let SWITCH finish successfully with the remembered database. This is a 
distinct caller from the existing same-catalog USE issue: resolving before 
assignments inside `setDatabase()` cannot undo the earlier catalog switch. 
Capture and restore the complete `NameSpaceContext` around catalog switching, 
or resolve the target namespace before publishing it, and cover a failed SWITCH 
with a remembered external 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