morningman commented on code in PR #37828:
URL: https://github.com/apache/doris/pull/37828#discussion_r1677560872
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -5381,11 +5381,11 @@ public void changeCatalog(ConnectContext ctx, String
catalogName) throws DdlExce
if (StringUtils.isNotEmpty(currentDB)) {
// When dropped the current catalog in current context, the
current catalog will be null.
if (ctx.getCurrentCatalog() != null) {
-
catalogMgr.addLastDBOfCatalog(ctx.getCurrentCatalog().getName(), currentDB);
+
ConnectContext.get().addLastDBOfCatalog(ctx.getCurrentCatalog().getName(),
currentDB);
}
}
ctx.changeDefaultCatalog(catalogName);
- String lastDb = catalogMgr.getLastDB(catalogName);
+ String lastDb = ConnectContext.get().getLastDBOfCatalog(catalogName);
Review Comment:
```suggestion
String lastDb = ctx.getLastDBOfCatalog(catalogName);
```
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -5381,11 +5381,11 @@ public void changeCatalog(ConnectContext ctx, String
catalogName) throws DdlExce
if (StringUtils.isNotEmpty(currentDB)) {
// When dropped the current catalog in current context, the
current catalog will be null.
if (ctx.getCurrentCatalog() != null) {
-
catalogMgr.addLastDBOfCatalog(ctx.getCurrentCatalog().getName(), currentDB);
+
ConnectContext.get().addLastDBOfCatalog(ctx.getCurrentCatalog().getName(),
currentDB);
Review Comment:
```suggestion
ctx.addLastDBOfCatalog(ctx.getCurrentCatalog().getName(),
currentDB);
```
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java:
##########
@@ -306,10 +296,11 @@ public void alterCatalogName(AlterCatalogNameStmt stmt)
throws UserException {
replayAlterCatalogName(log);
Env.getCurrentEnv().getEditLog().logCatalogLog(OperationType.OP_ALTER_CATALOG_NAME,
log);
- String db = lastDBOfCatalog.get(stmt.getCatalogName());
+ ConnectContext ctx = ConnectContext.get();
Review Comment:
check null
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java:
##########
@@ -282,7 +272,7 @@ public void dropCatalog(DropCatalogStmt stmt) throws
UserException {
replayDropCatalog(log);
Env.getCurrentEnv().getEditLog().logCatalogLog(OperationType.OP_DROP_CATALOG,
log);
- lastDBOfCatalog.remove(stmt.getCatalogName());
+ ConnectContext.get().removeLastDBOfCatalog(stmt.getCatalogName());
Review Comment:
check null
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java:
##########
@@ -140,7 +138,7 @@ private CatalogIf removeCatalog(long catalogId) {
if (catalog != null) {
catalog.onClose();
nameToCatalog.remove(catalog.getName());
- lastDBOfCatalog.remove(catalog.getName());
+ ConnectContext.get().removeLastDBOfCatalog(catalog.getName());
Review Comment:
Need to check whether `ConnectContext.get()` is null.
Sometimes this operation is not within a connection session.
--
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]