[fix](multicatalog) make lastdbofcatalog a session variable#37828
[fix](multicatalog) make lastdbofcatalog a session variable#37828morningman merged 7 commits intoapache:masterfrom
Conversation
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
|
run buildall |
TPC-H: Total hot run time: 39287 ms |
| // 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); |
There was a problem hiding this comment.
| ConnectContext.get().addLastDBOfCatalog(ctx.getCurrentCatalog().getName(), currentDB); | |
| ctx.addLastDBOfCatalog(ctx.getCurrentCatalog().getName(), currentDB); |
| } | ||
| ctx.changeDefaultCatalog(catalogName); | ||
| String lastDb = catalogMgr.getLastDB(catalogName); | ||
| String lastDb = ConnectContext.get().getLastDBOfCatalog(catalogName); |
There was a problem hiding this comment.
| String lastDb = ConnectContext.get().getLastDBOfCatalog(catalogName); | |
| String lastDb = ctx.getLastDBOfCatalog(catalogName); |
| catalog.onClose(); | ||
| nameToCatalog.remove(catalog.getName()); | ||
| lastDBOfCatalog.remove(catalog.getName()); | ||
| ConnectContext.get().removeLastDBOfCatalog(catalog.getName()); |
There was a problem hiding this comment.
Need to check whether ConnectContext.get() is null.
Sometimes this operation is not within a connection session.
| Env.getCurrentEnv().getEditLog().logCatalogLog(OperationType.OP_DROP_CATALOG, log); | ||
|
|
||
| lastDBOfCatalog.remove(stmt.getCatalogName()); | ||
| ConnectContext.get().removeLastDBOfCatalog(stmt.getCatalogName()); |
TPC-DS: Total hot run time: 172221 ms |
ClickBench: Total hot run time: 30.96 s |
morrySnow
left a comment
There was a problem hiding this comment.
add a case, connect->switch catalog1->use db1->disconnect->connect->switch catalog1->select one table from db1. should thrown no db selected exception
|
run buildall |
TPC-H: Total hot run time: 39900 ms |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
TPC-DS: Total hot run time: 173118 ms |
ClickBench: Total hot run time: 31.09 s |
|
run external |
|
run cloud_p0 |
| def result1 = connect(user=user, password="${pwd}", url=context.config.jdbcUrl) { | ||
| sql """switch hms;""" | ||
| try { | ||
| sql """show tables;""" |
There was a problem hiding this comment.
should add assertTrue(false) here.
Otherwise, if show tables run successfully, there is no check
There was a problem hiding this comment.
good catch! fixed
There was a problem hiding this comment.
maybe
test {
sql "show tables"
exception "No database selected"
}
is better
|
run buildall |
TPC-H: Total hot run time: 40013 ms |
TPC-DS: Total hot run time: 174630 ms |
ClickBench: Total hot run time: 30.36 s |
|
run p0 |
2 similar comments
|
run p0 |
|
run p0 |
|
run buildall |
TPC-H: Total hot run time: 39838 ms |
TPC-DS: Total hot run time: 173323 ms |
ClickBench: Total hot run time: 30.77 s |
|
PR approved by at least one committer and no changes requested. |
bring by: #14793 issue: lastdbofcatalog is a global variable, so all login user share it. that's not correct, should be a session variable
bring by: #14793
issue:
lastdbofcatalog is a global variable, so all login user share it. that's not correct, should be a session variable