You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/12/03 15:10:59 UTC

[GitHub] [doris] Yulei-Yang opened a new pull request, #14793: [fix][multi-catalog] use last used database for catalog when switch back

Yulei-Yang opened a new pull request, #14793:
URL: https://github.com/apache/doris/pull/14793

   remember last used database of every catalog and use it when switch back
   
   # Proposed changes
   
   Issue Number: close #14792
   
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [x] Yes
       - [ ] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [ ] Yes
       - [x] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [x] No
       - [ ] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [x] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [x] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morningman commented on a diff in pull request #14793: [fix](multi-catalog) use last used database for catalog when switch back

Posted by GitBox <gi...@apache.org>.
morningman commented on code in PR #14793:
URL: https://github.com/apache/doris/pull/14793#discussion_r1039076149


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java:
##########
@@ -74,6 +74,8 @@ public class CatalogMgr implements Writable, GsonPostProcessable {
     private final Map<Long, CatalogIf> idToCatalog = Maps.newConcurrentMap();
     // this map will be regenerated from idToCatalog, so not need to persist.
     private final Map<String, CatalogIf> nameToCatalog = Maps.newConcurrentMap();
+    // record last used database of every catalog
+    private final Map<String, String> lastDBOfCatalog = Maps.newConcurrentMap();

Review Comment:
   You need to clear this map when catalog is droped.
   And please add some regression test for this case.



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morningman commented on a diff in pull request #14793: [fix](multi-catalog) use last used database for catalog when switch back

Posted by GitBox <gi...@apache.org>.
morningman commented on code in PR #14793:
URL: https://github.com/apache/doris/pull/14793#discussion_r1039076375


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -4443,8 +4443,16 @@ public void changeCatalog(ConnectContext ctx, String catalogName) throws DdlExce
             throw new DdlException(ErrorCode.ERR_UNKNOWN_CATALOG.formatErrorMsg(catalogName),
                     ErrorCode.ERR_UNKNOWN_CATALOG);
         }
+
+        String currentDB = ctx.getDatabase();
+        if (StringUtils.isNotEmpty(currentDB)) {
+            catalogMgr.addLastDBOfCatalog(ctx.getCurrentCatalog().getName(), currentDB);
+        }
         ctx.changeDefaultCatalog(catalogName);
-        if (catalogIf instanceof EsExternalCatalog) {
+        String lastDb = catalogMgr.getLastDB(catalogName);
+        if (StringUtils.isNotEmpty(lastDb)) {
+            ctx.setDatabase(lastDb);
+        } else if (catalogIf instanceof EsExternalCatalog) {

Review Comment:
   ```suggestion
           }
           if (catalogIf instanceof EsExternalCatalog) {
   ```



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #14793: [fix](multi-catalog) use last used database for catalog when switch back

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #14793:
URL: https://github.com/apache/doris/pull/14793#issuecomment-1340940068

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] hello-stephen commented on pull request #14793: [fix][multi-catalog] use last used database for catalog when switch back

Posted by GitBox <gi...@apache.org>.
hello-stephen commented on PR #14793:
URL: https://github.com/apache/doris/pull/14793#issuecomment-1336183582

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 35.04 seconds
    load time: 443 seconds
    storage size: 17123356242 Bytes
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20221203153208_clickbench_pr_57230.html


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morningman commented on a diff in pull request #14793: [fix](multi-catalog) use last used database for catalog when switch back

Posted by GitBox <gi...@apache.org>.
morningman commented on code in PR #14793:
URL: https://github.com/apache/doris/pull/14793#discussion_r1042233280


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java:
##########
@@ -241,6 +251,8 @@ public void dropCatalog(DropCatalogStmt stmt) throws UserException {
             CatalogLog log = CatalogFactory.constructorCatalogLog(catalog.getId(), stmt);
             replayDropCatalog(log);
             Env.getCurrentEnv().getEditLog().logCatalogLog(OperationType.OP_DROP_CATALOG, log);
+
+            lastDBOfCatalog.remove(stmt.getCatalogName());

Review Comment:
   Need to modify `removeCatalog()` too.
   Because `removeCatalog()` will be called when replaying edit log



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morningman merged pull request #14793: [fix](multi-catalog) use last used database for catalog when switch back

Posted by GitBox <gi...@apache.org>.
morningman merged PR #14793:
URL: https://github.com/apache/doris/pull/14793


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org