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. pick #37593 ## Proposed changes Issue Number: close #xxx <!--Describe your changes.-->
This commit is contained in:
@ -693,6 +693,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) {
|
||||
@ -727,6 +734,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);
|
||||
@ -772,8 +786,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 {
|
||||
@ -863,6 +875,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();
|
||||
@ -1071,7 +1090,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());
|
||||
@ -1113,6 +1132,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) {
|
||||
|
||||
Reference in New Issue
Block a user