This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new c7e492deb44 [fix](readconsistency) avoid table not exist error #37593
(#37709)
c7e492deb44 is described below
commit c7e492deb44a7cfd9b0e90f0055ce5188cca9f1b
Author: Yongqiang YANG <[email protected]>
AuthorDate: Sat Jul 13 22:18:53 2024 +0800
[fix](readconsistency) avoid table not exist error #37593 (#37709)
pick #37593
## Proposed changes
Issue Number: close #xxx
<!--Describe your changes.-->
---
.../java/org/apache/doris/qe/StmtExecutor.java | 31 ++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
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 03ec39818b8..342b38892da 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
@@ -588,6 +588,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 (QueryStateException e) {
@@ -611,6 +618,13 @@ public class StmtExecutor {
ConnectContext.get().setStatsErrorEstimator(new
StatsErrorEstimator());
}
// 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);
try {
planner.plan(parsedStmt,
context.getSessionVariable().toThrift());
@@ -643,7 +657,6 @@ public class StmtExecutor {
private void handleQueryWithRetry(TUniqueId queryId) throws Exception {
// queue query here
- syncJournalIfNeeded();
QueueOfferToken offerRet = null;
QueryQueue queryQueue = null;
if (!parsedStmt.isExplain() && Config.enable_workload_group &&
Config.enable_query_queue
@@ -760,6 +773,13 @@ public class StmtExecutor {
LOG.debug("no need to transfer to Master. stmt: {}",
context.getStmtId());
}
} 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();
@@ -947,7 +967,7 @@ public class StmtExecutor {
}
// Analyze one statement to structure in memory.
- public void analyze(TQueryOptions tQueryOptions) throws UserException,
InterruptedException {
+ public void analyze(TQueryOptions tQueryOptions) throws UserException,
InterruptedException, Exception {
if (LOG.isDebugEnabled()) {
LOG.debug("begin to analyze stmt: {}, forwarded stmt id: {}",
context.getStmtId(),
context.getForwardedStmtId());
@@ -988,6 +1008,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();
analyzer = new Analyzer(context.getEnv(), context);
if (parsedStmt instanceof PrepareStmt || context.getCommand() ==
MysqlCommand.COM_STMT_PREPARE) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]