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/10/13 14:58:45 UTC

[GitHub] [doris] Jibing-Li opened a new pull request, #13363: [Improvement](multi-catalog)Support refresh external catalog.

Jibing-Li opened a new pull request, #13363:
URL: https://github.com/apache/doris/pull/13363

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   Support manually refresh external catalog metadata.
   1. refresh catalog external_catalog_name
   2. refresh database catalog.db OR refresh database db (current catalog)
   3. refresh table catalog.db.table OR refresh db.table (current catalog)
   
   Or the refresh operations above keep the database and table ids unchanged.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [ ] No
       - [ ] I don't know
   5. Has unit tests been added:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   6. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   7. Does it need to update dependencies:
       - [ ] Yes
       - [ ] No
   8. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [ ] 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] hello-stephen commented on pull request #13363: [Improvement](multi-catalog)Support refresh external catalog.

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

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 38.55 seconds
    load time: 601 seconds
    storage size: 17107956263 Bytes
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20221018160341_clickbench_pr_30794.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 #13363: [Improvement](multi-catalog)Support refresh external catalog.

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


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/RefreshDbStmt.java:
##########
@@ -34,16 +34,26 @@
 public class RefreshDbStmt extends DdlStmt {
     private static final Logger LOG = LogManager.getLogger(RefreshDbStmt.class);
 
+    private String catalogName;

Review Comment:
   return null will be very error-prone. we can fill this field in analysis phase, to use default catalog saved in connection context.



-- 
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] Jibing-Li commented on a diff in pull request #13363: [Improvement](multi-catalog)Support refresh external catalog.

Posted by GitBox <gi...@apache.org>.
Jibing-Li commented on code in PR #13363:
URL: https://github.com/apache/doris/pull/13363#discussion_r997693270


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/RefreshDbStmt.java:
##########
@@ -34,16 +34,26 @@
 public class RefreshDbStmt extends DdlStmt {
     private static final Logger LOG = LogManager.getLogger(RefreshDbStmt.class);
 
+    private String catalogName;

Review Comment:
   Is it a problem? catalogName could be null, for example when use execute 
   `refresh database db1`
   I think the caller of getCatalogName should handle the null value.



-- 
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] Jibing-Li commented on a diff in pull request #13363: [Improvement](multi-catalog)Support refresh external catalog.

Posted by GitBox <gi...@apache.org>.
Jibing-Li commented on code in PR #13363:
URL: https://github.com/apache/doris/pull/13363#discussion_r997700393


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/HMSExternalCatalog.java:
##########
@@ -84,10 +83,21 @@ private void init() {
             return;
         }
         for (String dbName : allDatabases) {
-            long dbId = Env.getCurrentEnv().getNextId();
-            dbNameToId.put(dbName, dbId);
-            idToDb.put(dbId, new HMSExternalDatabase(this, dbId, dbName));
+            long dbId;

Review Comment:
   I will modify `EsExternalCatalog` in next commit.



-- 
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] stalary commented on a diff in pull request #13363: [Improvement](multi-catalog)Support refresh external catalog.

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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/HMSExternalCatalog.java:
##########
@@ -84,10 +83,21 @@ private void init() {
             return;
         }
         for (String dbName : allDatabases) {
-            long dbId = Env.getCurrentEnv().getNextId();
-            dbNameToId.put(dbName, dbId);
-            idToDb.put(dbId, new HMSExternalDatabase(this, dbId, dbName));
+            long dbId;

Review Comment:
   Can you also modify `EsExternalCatalog` init logic?



-- 
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] Jibing-Li commented on a diff in pull request #13363: [Improvement](multi-catalog)Support refresh external catalog.

Posted by GitBox <gi...@apache.org>.
Jibing-Li commented on code in PR #13363:
URL: https://github.com/apache/doris/pull/13363#discussion_r997693270


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/RefreshDbStmt.java:
##########
@@ -34,16 +34,26 @@
 public class RefreshDbStmt extends DdlStmt {
     private static final Logger LOG = LogManager.getLogger(RefreshDbStmt.class);
 
+    private String catalogName;

Review Comment:
   Is it a problem? catalogName could be null, for example when execute 
   `refresh database db1`
   I think the caller of getCatalogName should handle the null value.



-- 
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 pull request #13363: [Improvement](multi-catalog)Support refresh external catalog.

Posted by GitBox <gi...@apache.org>.
morningman commented on PR #13363:
URL: https://github.com/apache/doris/pull/13363#issuecomment-1283594570

   Please add regress test after #13143 is merged


-- 
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 #13363: [Improvement](multi-catalog)Support refresh external catalog.

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


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/RefreshDbStmt.java:
##########
@@ -34,16 +34,26 @@
 public class RefreshDbStmt extends DdlStmt {
     private static final Logger LOG = LogManager.getLogger(RefreshDbStmt.class);
 
+    private String catalogName;

Review Comment:
   fill the `catalogName` field in `analyze()` method.
   To avoid return null from `getCatalogName()`



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/external/HMSExternalDatabase.java:
##########
@@ -66,14 +66,32 @@ private synchronized void makeSureInitialized() {
     private void init() {
         List<String> tableNames = extCatalog.listTableNames(null, name);
         if (tableNames != null) {
+            Map<String, Long> tmpTableNameToId = Maps.newConcurrentMap();
+            Map<Long, HMSExternalTable> tmpIdToTbl = Maps.newHashMap();
             for (String tableName : tableNames) {
-                long tblId = Env.getCurrentEnv().getNextId();
-                tableNameToId.put(tableName, tblId);
-                idToTbl.put(tblId, new HMSExternalTable(tblId, tableName, name, (HMSExternalCatalog) extCatalog));
+                long tblId;
+                if (tableNameToId != null && tableNameToId.containsKey(tableName)) {

Review Comment:
   `tableNameToId != null` is always true?



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/HMSExternalCatalog.java:
##########
@@ -84,10 +83,21 @@ private void init() {
             return;
         }
         for (String dbName : allDatabases) {
-            long dbId = Env.getCurrentEnv().getNextId();
-            dbNameToId.put(dbName, dbId);
-            idToDb.put(dbId, new HMSExternalDatabase(this, dbId, dbName));
+            long dbId;
+            if (dbNameToId != null && dbNameToId.containsKey(dbName)) {

Review Comment:
   `dbNameToId != null` is always true?



-- 
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 #13363: [Improvement](multi-catalog)Support refresh external catalog.

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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/HMSExternalCatalog.java:
##########
@@ -84,10 +83,21 @@ private void init() {
             return;
         }
         for (String dbName : allDatabases) {
-            long dbId = Env.getCurrentEnv().getNextId();
-            dbNameToId.put(dbName, dbId);
-            idToDb.put(dbId, new HMSExternalDatabase(this, dbId, dbName));
+            long dbId;

Review Comment:
   How about in next pr?



-- 
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 #13363: [Improvement](multi-catalog)Support refresh external catalog.

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


-- 
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