You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "morningman (via GitHub)" <gi...@apache.org> on 2023/04/12 11:51:23 UTC

[GitHub] [doris] morningman commented on a diff in pull request #18592: [Fix](multi catalog)Refresh table object while refresh external table.

morningman commented on code in PR #18592:
URL: https://github.com/apache/doris/pull/18592#discussion_r1164017919


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/external/ExternalDatabase.java:
##########
@@ -107,21 +107,25 @@ public boolean isInitialized() {
     }
 
     public final synchronized void makeSureInitialized() {
-        if (!initialized) {
-            if (!Env.getCurrentEnv().isMaster()) {
-                // Forward to master and wait the journal to replay.
-                int waitTimeOut = ConnectContext.get() == null ? 300 : ConnectContext.get().getExecTimeout();
-                MasterCatalogExecutor remoteExecutor = new MasterCatalogExecutor(waitTimeOut * 1000);
-                try {
-                    remoteExecutor.forward(extCatalog.getId(), id);
-                } catch (Exception e) {
-                    Util.logAndThrowRuntimeException(LOG,
-                            String.format("failed to forward init external db %s operation to master", name), e);
-                }
-                return;
+        if (initialized && extCatalog.isInitialized()) {
+            return;
+        }
+        if (!extCatalog.isInitialized()) {

Review Comment:
   I think we can move `extCatalog.isInitialized()` into `extCatalog.makeSureInitialized()`. Because `extCatalog.makeSureInitialized();` is a reentryable method



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/external/ExternalTable.java:
##########
@@ -103,7 +105,16 @@ public boolean isView() {
     }
 
     protected void makeSureInitialized() {
-        throw new NotImplementedException();
+        try {
+            // getDbOrAnalysisException will call makeSureInitialized in ExternalCatalog.
+            ExternalDatabase db = catalog.getDbOrAnalysisException(dbName);
+            if (db.isInitialized()) {
+                return;
+            }
+            db.makeSureInitialized();

Review Comment:
   I think we can move `db.isInitialized()` into `db.makeSureInitialized()`. Because `db.makeSureInitialized();` is a reentryable method



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