qidaye opened a new issue, #16066: URL: https://github.com/apache/doris/issues/16066
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues. ### Version master ### What's Wrong? Switch catalog after drop got NPE. fe.log ``` 2023-01-18 16:56:06,492 WARN (mysql-nio-pool-8|454) [StmtExecutor.execute():604] execute Exception. stmt[112, 701c3b3343314e4f-8e7ff7d46f644de6] java.lang.NullPointerException: null at org.apache.doris.catalog.Env.changeCatalog(Env.java:4354) ~[doris-fe.jar:1.2-SNAPSHOT] at org.apache.doris.qe.StmtExecutor.handleSwitchStmt(StmtExecutor.java:1618) ~[doris-fe.jar:1.2-SNAPSHOT] at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:557) ~[doris-fe.jar:1.2-SNAPSHOT] at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:411) ~[doris-fe.jar:1.2-SNAPSHOT] at org.apache.doris.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:329) ~[doris-fe.jar:1.2-SNAPSHOT] at org.apache.doris.qe.ConnectProcessor.dispatch(ConnectProcessor.java:470) ~[doris-fe.jar:1.2-SNAPSHOT] at org.apache.doris.qe.ConnectProcessor.processOnce(ConnectProcessor.java:697) ~[doris-fe.jar:1.2-SNAPSHOT] at org.apache.doris.mysql.nio.ReadListener.lambda$handleEvent$0(ReadListener.java:52) ~[doris-fe.jar:1.2-SNAPSHOT] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_331] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_331] at java.lang.Thread.run(Thread.java:750) ~[?:1.8.0_331] ``` ### What You Expected? Switch normally. ### How to Reproduce? ```sql mysql> CREATE CATALOG es WITH RESOURCE es_resource; Query OK, 0 rows affected (9.60 sec) mysql> mysql> CREATE CATALOG es7 WITH RESOURCE es7_resource; Query OK, 0 rows affected (0.01 sec) mysql> mysql> CREATE CATALOG es8 WITH RESOURCE es8_resource; Query OK, 0 rows affected (0.00 sec) mysql> show catalogs; +-----------+-------------+----------+-----------+ | CatalogId | CatalogName | Type | IsCurrent | +-----------+-------------+----------+-----------+ | 11342 | es | es | | | 11343 | es7 | es | | | 11344 | es8 | es | | | 0 | internal | internal | yes | +-----------+-------------+----------+-----------+ 4 rows in set (0.01 sec) mysql> switch es; Query OK, 0 rows affected (0.23 sec) mysql> drop catalog es; Query OK, 0 rows affected (0.00 sec) mysql> switch es; ERROR 5086 (42000): errCode = 2, detailMessage = Unknown catalog 'es' mysql> show catalogs; ERROR 1105 (HY000): errCode = 2, detailMessage = Current catalog is not exist, please switch catalog. mysql> switch es7; ERROR 1105 (HY000): NullPointerException, msg: java.lang.NullPointerException: null ``` ### Anything Else? _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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: commits-unsubscr...@doris.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org