morningman commented on code in PR #13746: URL: https://github.com/apache/doris/pull/13746#discussion_r1011352564
########## fe/fe-core/src/main/java/org/apache/doris/catalog/external/EsExternalDatabase.java: ########## @@ -60,13 +60,24 @@ public EsExternalDatabase(ExternalCatalog extCatalog, long id, String name) { super(extCatalog, id, name); } - public void addTable(ExternalTable table) { - if (!(table instanceof EsExternalTable)) { - LOG.warn("Table {} is not EsExternalTable.", table.getName()); - return; + public synchronized void replayInitDb(InitDatabaseLog log, ExternalCatalog catalog) { Review Comment: Do we need `synchronized`? ########## fe/fe-core/src/main/java/org/apache/doris/catalog/external/EsExternalDatabase.java: ########## @@ -135,12 +145,14 @@ public Set<String> getTableNamesWithLock() { @Override public List<EsExternalTable> getTables() { makeSureInitialized(); + MasterCatalogExecutor.waitJournalReplay(replayToJournalId); Review Comment: Why not move `MasterCatalogExecutor.waitJournalReplay(replayToJournalId);` into `makeSureInitialized()`? ########## fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java: ########## @@ -85,12 +93,20 @@ public abstract class ExternalCatalog implements CatalogIf<ExternalDatabase>, Wr public abstract void makeSureInitialized(); - public abstract void addDb(ExternalDatabase db); - public void setInitialized(boolean initialized) { this.initialized = initialized; } + protected void waitJournalReplay() { + if (!Env.getCurrentEnv().isMaster()) { + try { + ConnectContext.get().getEnv().getJournalObservable().waitOn(replayToJournalId, 3000); Review Comment: I think this should be done in `MasterCatalogExecutor`? -- 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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org