This is an automated email from the ASF dual-hosted git repository. jakevin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new fae7296336 [Enhancement](fe-core) make UT-SelectRollupTest more stable (#13030) fae7296336 is described below commit fae7296336cd5a06f77655db99ff7495e5695e28 Author: DingGeGe <109070189+dinggege1...@users.noreply.github.com> AuthorDate: Thu Sep 29 14:25:01 2022 +0800 [Enhancement](fe-core) make UT-SelectRollupTest more stable (#13030) --- .../org/apache/doris/utframe/TestWithFeService.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/test/java/org/apache/doris/utframe/TestWithFeService.java b/fe/fe-core/src/test/java/org/apache/doris/utframe/TestWithFeService.java index 1e10f52a28..78049fe68f 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/utframe/TestWithFeService.java +++ b/fe/fe-core/src/test/java/org/apache/doris/utframe/TestWithFeService.java @@ -35,13 +35,17 @@ import org.apache.doris.analysis.SqlParser; import org.apache.doris.analysis.SqlScanner; import org.apache.doris.analysis.StatementBase; import org.apache.doris.analysis.UserIdentity; +import org.apache.doris.catalog.Database; import org.apache.doris.catalog.DiskInfo; import org.apache.doris.catalog.Env; +import org.apache.doris.catalog.OlapTable; +import org.apache.doris.catalog.Table; import org.apache.doris.cluster.ClusterNamespace; import org.apache.doris.common.AnalysisException; import org.apache.doris.common.Config; import org.apache.doris.common.DdlException; import org.apache.doris.common.FeConstants; +import org.apache.doris.common.MetaNotFoundException; import org.apache.doris.common.util.SqlParserUtils; import org.apache.doris.nereids.CascadesContext; import org.apache.doris.nereids.StatementContext; @@ -506,12 +510,12 @@ public abstract class TestWithFeService { protected void addRollup(String sql) throws Exception { AlterTableStmt alterTableStmt = (AlterTableStmt) UtFrameUtils.parseAndAnalyzeStmt(sql, connectContext); Env.getCurrentEnv().alterTable(alterTableStmt); + // waiting alter job state: finished AND table state: normal checkAlterJob(); - // waiting table state to normal Thread.sleep(100); } - private void checkAlterJob() throws InterruptedException { + private void checkAlterJob() throws InterruptedException, MetaNotFoundException { // check alter job Map<Long, AlterJobV2> alterJobs = Env.getCurrentEnv().getMaterializedViewHandler().getAlterJobsV2(); for (AlterJobV2 alterJobV2 : alterJobs.values()) { @@ -522,6 +526,17 @@ public abstract class TestWithFeService { } System.out.println("alter job " + alterJobV2.getDbId() + " is done. state: " + alterJobV2.getJobState()); Assert.assertEquals(AlterJobV2.JobState.FINISHED, alterJobV2.getJobState()); + + // Add table state check in case of below Exception: + // there is still a short gap between "job finish" and "table become normal", + // so if user send next alter job right after the "job finish", + // it may encounter "table's state not NORMAL" error. + Database db = + Env.getCurrentInternalCatalog().getDbOrMetaException(alterJobV2.getDbId()); + OlapTable tbl = (OlapTable) db.getTableOrMetaException(alterJobV2.getTableId(), Table.TableType.OLAP); + while (tbl.getState() != OlapTable.OlapTableState.NORMAL) { + Thread.sleep(1000); + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org