This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new c7f2021491a [fix](readconsistency) avoid table not exist error (#37593) c7f2021491a is described below commit c7f2021491aeaf07121377c4106a1bdca7dc4c38 Author: Yongqiang YANG <98214048+dataroar...@users.noreply.github.com> AuthorDate: Thu Jul 11 11:05:44 2024 +0800 [fix](readconsistency) avoid table not exist error (#37593) Query following createting table would throw table not exist error. For example. t1: client issue create table to master fe t2: client issue query sql to observer fe, the query would fail due to not exist table in plan phase. t3: observer fe receive editlog creating the table from the master fe After the pr: query at t2 would wait until latest edit log is received from master fe in the observer fe. --- .../java/org/apache/doris/qe/StmtExecutor.java | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java index 8114df770d4..99f40cd6a32 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java @@ -723,6 +723,13 @@ public class StmtExecutor { return; } } + + // Query following createting table would throw table not exist error. + // For example. + // t1: client issues create table to master fe + // t2: client issues query sql to observer fe, the query would fail due to not exist table in plan phase. + // t3: observer fe receive editlog creating the table from the master fe + syncJournalIfNeeded(); try { ((Command) logicalPlan).run(context, this); } catch (MustFallbackException e) { @@ -757,6 +764,13 @@ public class StmtExecutor { } else { context.getState().setIsQuery(true); // create plan + // Query following createting table would throw table not exist error. + // For example. + // t1: client issues create table to master fe + // t2: client issues query sql to observer fe, the query would fail due to not exist table in + // plan phase. + // t3: observer fe receive editlog creating the table from the master fe + syncJournalIfNeeded(); planner = new NereidsPlanner(statementContext); if (context.getSessionVariable().isEnableMaterializedViewRewrite()) { planner.addHook(InitMaterializationContextHook.INSTANCE); @@ -803,7 +817,6 @@ public class StmtExecutor { private void handleQueryWithRetry(TUniqueId queryId) throws Exception { // queue query here - syncJournalIfNeeded(); int retryTime = Config.max_query_retry_time; for (int i = 0; i <= retryTime; i++) { try { @@ -953,6 +966,13 @@ public class StmtExecutor { } } } else { + // Query following createting table would throw table not exist error. + // For example. + // t1: client issues create table to master fe + // t2: client issues query sql to observer fe, the query would fail due to not exist table + // in plan phase. + // t3: observer fe receive editlog creating the table from the master fe + syncJournalIfNeeded(); analyzer = new Analyzer(context.getEnv(), context); parsedStmt.analyze(analyzer); parsedStmt.checkPriv(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org