@@ -2133,6 +2133,7 @@ class Suite implements GroovyInterceptable {
21332133 AS ${ mv_sql}
21342134 """
21352135 waitingMVTaskFinishedByMvName(db, table_name, mv_name)
2136+ sql """ sync;"""
21362137 }
21372138
21382139 def create_async_mv = { db , mv_name , mv_sql ->
@@ -2148,6 +2149,8 @@ class Suite implements GroovyInterceptable {
21482149 def job_name = getJobName(db, mv_name);
21492150 waitingMTMVTaskFinished(job_name)
21502151 sql " analyze table ${ db} .${ mv_name} with sync;"
2152+ // force meta sync to avoid stale meta data on follower fe
2153+ sql """ sync;"""
21512154 }
21522155
21532156 def create_async_partition_mv = { db , mv_name , mv_sql , partition_col ->
@@ -2164,6 +2167,8 @@ class Suite implements GroovyInterceptable {
21642167 def job_name = getJobName(db, mv_name);
21652168 waitingMTMVTaskFinished(job_name)
21662169 sql " analyze table ${ db} .${ mv_name} with sync;"
2170+ // force meta sync to avoid stale meta data on follower fe
2171+ sql """ sync;"""
21672172 }
21682173
21692174 // mv not part in rewrite process
@@ -2207,6 +2212,8 @@ class Suite implements GroovyInterceptable {
22072212 void mv_rewrite_success (query_sql , mv_name , is_partition_statistics_ready = true ) {
22082213 logger. info(" query_sql = " + query_sql + " , mv_name = " + mv_name
22092214 + " , is_partition_statistics_ready = " + is_partition_statistics_ready)
2215+ // force meta sync to avoid stale meta data on follower fe
2216+ sql """ sync;"""
22102217 if (! is_partition_statistics_ready) {
22112218 // If partition statistics is no ready, degrade to without check cbo chosen
22122219 mv_rewrite_success_without_check_chosen(query_sql, mv_name)
@@ -2224,6 +2231,8 @@ class Suite implements GroovyInterceptable {
22242231 void mv_rewrite_all_success ( query_sql , mv_names , is_partition_statistics_ready = true ) {
22252232 logger. info(" query_sql = " + query_sql + " , mv_names = " + mv_names
22262233 + " , is_partition_statistics_ready = " + is_partition_statistics_ready)
2234+ // force meta sync to avoid stale meta data on follower fe
2235+ sql """ sync;"""
22272236 if (! is_partition_statistics_ready) {
22282237 // If partition statistics is no ready, degrade to without check cbo chosen
22292238 mv_rewrite_all_success_without_check_chosen(query_sql, mv_names)
@@ -2250,6 +2259,8 @@ class Suite implements GroovyInterceptable {
22502259 void mv_rewrite_any_success (query_sql , mv_names , is_partition_statistics_ready = true ) {
22512260 logger. info(" query_sql = " + query_sql + " , mv_names = " + mv_names
22522261 + " , is_partition_statistics_ready = " + is_partition_statistics_ready)
2262+ // force meta sync to avoid stale meta data on follower fe
2263+ sql """ sync;"""
22532264 if (! is_partition_statistics_ready) {
22542265 // If partition statistics is no ready, degrade to without check cbo chosen
22552266 mv_rewrite_any_success_without_check_chosen(query_sql, mv_names)
@@ -2273,6 +2284,8 @@ class Suite implements GroovyInterceptable {
22732284 // multi mv part in rewrite process, all rewrte success without check if chosen by cbo
22742285 void mv_rewrite_all_success_without_check_chosen (query_sql , mv_names ) {
22752286 logger. info(" query_sql = " + query_sql + " , mv_names = " + mv_names)
2287+ // force meta sync to avoid stale meta data on follower fe
2288+ sql """ sync;"""
22762289 explain {
22772290 sql(" memo plan ${ query_sql} " )
22782291 check {result ->
@@ -2292,6 +2305,8 @@ class Suite implements GroovyInterceptable {
22922305 // multi mv part in rewrite process, any of them rewrte success without check if chosen by cbo or not
22932306 void mv_rewrite_any_success_without_check_chosen (query_sql , mv_names ) {
22942307 logger. info(" query_sql = " + query_sql + " , mv_names = " + mv_names)
2308+ // force meta sync to avoid stale meta data on follower fe
2309+ sql """ sync;"""
22952310 explain {
22962311 sql(" memo plan ${ query_sql} " )
22972312 check { result ->
@@ -2310,6 +2325,8 @@ class Suite implements GroovyInterceptable {
23102325 // multi mv part in rewrite process, rewrte success without check if chosen by cbo or not
23112326 void mv_rewrite_success_without_check_chosen (query_sql , mv_name ) {
23122327 logger. info(" query_sql = " + query_sql + " , mv_name = " + mv_name)
2328+ // force meta sync to avoid stale meta data on follower fe
2329+ sql """ sync;"""
23132330 explain {
23142331 sql(" memo plan ${ query_sql} " )
23152332 check { result ->
@@ -2321,6 +2338,8 @@ class Suite implements GroovyInterceptable {
23212338 // single mv part in rewrite process, rewrte fail
23222339 void mv_rewrite_fail (query_sql , mv_name ) {
23232340 logger. info(" query_sql = " + query_sql + " , mv_name = " + mv_name)
2341+ // force meta sync to avoid stale meta data on follower fe
2342+ sql """ sync;"""
23242343 explain {
23252344 sql(" memo plan ${ query_sql} " )
23262345 contains(" .${ mv_name} fail" )
@@ -2330,6 +2349,8 @@ class Suite implements GroovyInterceptable {
23302349 // multi mv part in rewrite process, all rewrte fail
23312350 void mv_rewrite_all_fail (query_sql , mv_names ) {
23322351 logger. info(" query_sql = " + query_sql + " , mv_names = " + mv_names)
2352+ // force meta sync to avoid stale meta data on follower fe
2353+ sql """ sync;"""
23332354 explain {
23342355 sql(" memo plan ${ query_sql} " )
23352356 check {result ->
@@ -2349,6 +2370,8 @@ class Suite implements GroovyInterceptable {
23492370 // multi mv part in rewrite process, any rewrte fail
23502371 void mv_rewrite_any_fail (query_sql , mv_names ) {
23512372 logger. info(" query_sql = " + query_sql + " , mv_names = " + mv_names)
2373+ // force meta sync to avoid stale meta data on follower fe
2374+ sql """ sync;"""
23522375 explain {
23532376 sql(" memo plan ${ query_sql} " )
23542377 check { result ->
@@ -2376,6 +2399,8 @@ class Suite implements GroovyInterceptable {
23762399 """
23772400 def job_name = getJobName(db, mv_name);
23782401 waitingMTMVTaskFinished(job_name)
2402+ // force meta sync to avoid stale meta data on follower fe
2403+ sql """ sync;"""
23792404 mv_rewrite_success(query_sql, mv_name)
23802405 }
23812406
@@ -2392,6 +2417,8 @@ class Suite implements GroovyInterceptable {
23922417
23932418 def job_name = getJobName(db, mv_name);
23942419 waitingMTMVTaskFinished(job_name)
2420+ // force meta sync to avoid stale meta data on follower fe
2421+ sql """ sync;"""
23952422 mv_rewrite_success_without_check_chosen(query_sql, mv_name)
23962423 }
23972424
@@ -2409,6 +2436,8 @@ class Suite implements GroovyInterceptable {
24092436
24102437 def job_name = getJobName(db, mv_name);
24112438 waitingMTMVTaskFinished(job_name)
2439+ // force meta sync to avoid stale meta data on follower fe
2440+ sql """ sync;"""
24122441 mv_rewrite_fail(query_sql, mv_name)
24132442 }
24142443
@@ -2424,6 +2453,8 @@ class Suite implements GroovyInterceptable {
24242453
24252454 def job_name = getJobName(db, mv_name);
24262455 waitingMTMVTaskFinished(job_name)
2456+ // force meta sync to avoid stale meta data on follower fe
2457+ sql """ sync;"""
24272458 }
24282459
24292460 def token = context. config. metaServiceToken
0 commit comments