-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix](multicatalog) make lastdbofcatalog a session variable #37828
[fix](multicatalog) make lastdbofcatalog a session variable #37828
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
|
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConnectContext.get().addLastDBOfCatalog(ctx.getCurrentCatalog().getName(), currentDB); | |
ctx.addLastDBOfCatalog(ctx.getCurrentCatalog().getName(), currentDB); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
} | ||
ctx.changeDefaultCatalog(catalogName); | ||
String lastDb = catalogMgr.getLastDB(catalogName); | ||
String lastDb = ConnectContext.get().getLastDBOfCatalog(catalogName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String lastDb = ConnectContext.get().getLastDBOfCatalog(catalogName); | |
String lastDb = ctx.getLastDBOfCatalog(catalogName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to check whether ConnectContext.get()
is null.
Sometimes this operation is not within a connection session.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
TPC-DS: Total hot run time: 172221 ms
|
ClickBench: Total hot run time: 30.96 s
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should add assertTrue(false)
here.
Otherwise, if show tables
run successfully, there is no check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch! fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe
test {
sql "show tables"
exception "No database selected"
}
is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tks, done
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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