diff --git a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java index f68387febd33d6..fb204e70b428c7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java +++ b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java @@ -157,7 +157,7 @@ private void addBinlog(long dbId, List tableIds, long commitSeq, long time if (tableIds.size() > 1) { anyEnable = anyEnable || tableBinlogEnable; } else { - anyEnable = anyEnable && tableBinlogEnable; + anyEnable = tableBinlogEnable; } if (anyEnable) { break; diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java index a8e429cd5441aa..525eed11803335 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java @@ -40,6 +40,7 @@ import org.apache.doris.common.Config; import org.apache.doris.common.DdlException; import org.apache.doris.common.ErrorCode; +import org.apache.doris.common.FeConstants; import org.apache.doris.common.Status; import org.apache.doris.common.UserException; import org.apache.doris.common.util.DebugUtil; @@ -379,7 +380,9 @@ public void init() { } sessionId = UUID.randomUUID().toString(); - Env.getCurrentEnv().registerSessionInfo(sessionId); + if (!FeConstants.runningUnitTest) { + Env.getCurrentEnv().registerSessionInfo(sessionId); + } } public ConnectContext() { diff --git a/fe/fe-core/src/test/java/org/apache/doris/analysis/GroupByClauseTest.java b/fe/fe-core/src/test/java/org/apache/doris/analysis/GroupByClauseTest.java index 09208b307a6ead..0b1d935099e75b 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/analysis/GroupByClauseTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/analysis/GroupByClauseTest.java @@ -18,12 +18,14 @@ package org.apache.doris.analysis; import org.apache.doris.common.AnalysisException; +import org.apache.doris.common.FeConstants; import org.apache.doris.datasource.InternalCatalog; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; import org.junit.Assert; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import java.lang.reflect.Field; @@ -41,6 +43,8 @@ public class GroupByClauseTest { @Before public void setUp() throws AnalysisException { + FeConstants.runningUnitTest = true; + Analyzer analyzerBase = AccessTestUtil.fetchTableAnalyzer(); analyzer = new Analyzer(analyzerBase.getEnv(), analyzerBase.getContext()); try { diff --git a/fe/fe-core/src/test/java/org/apache/doris/analysis/VirtualSlotRefTest.java b/fe/fe-core/src/test/java/org/apache/doris/analysis/VirtualSlotRefTest.java index 3b090c63891609..4045c25f8ddcc9 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/analysis/VirtualSlotRefTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/analysis/VirtualSlotRefTest.java @@ -19,6 +19,7 @@ import org.apache.doris.catalog.Type; import org.apache.doris.common.AnalysisException; +import org.apache.doris.common.FeConstants; import org.apache.doris.common.FeMetaVersion; import org.apache.doris.datasource.InternalCatalog; import org.apache.doris.meta.MetaContext; @@ -27,6 +28,7 @@ import com.google.common.collect.Multimap; import org.junit.Assert; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import java.io.IOException; @@ -40,8 +42,15 @@ public class VirtualSlotRefTest { private TupleDescriptor virtualTuple; private VirtualSlotRef virtualSlot; + @BeforeClass + public static void beforeClass() throws Exception { + + } + @Before public void setUp() throws IOException, AnalysisException { + FeConstants.runningUnitTest = true; + Analyzer analyzerBase = AccessTestUtil.fetchTableAnalyzer(); // read objects from file MetaContext metaContext = new MetaContext(); diff --git a/fe/fe-core/src/test/java/org/apache/doris/mysql/MysqlProtoTest.java b/fe/fe-core/src/test/java/org/apache/doris/mysql/MysqlProtoTest.java index 4ab2ba275de67a..07398032e86470 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/mysql/MysqlProtoTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/mysql/MysqlProtoTest.java @@ -23,6 +23,7 @@ import org.apache.doris.common.AuthenticationException; import org.apache.doris.common.Config; import org.apache.doris.common.DdlException; +import org.apache.doris.common.FeConstants; import org.apache.doris.datasource.InternalCatalog; import org.apache.doris.mysql.authenticate.AuthenticateRequest; import org.apache.doris.mysql.authenticate.AuthenticatorManager; @@ -76,6 +77,7 @@ public class MysqlProtoTest { @Before public void setUp() throws DdlException, AuthenticationException, IOException { + FeConstants.runningUnitTest = true; // mock auth new Expectations() { diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriverTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriverTest.java index a39bc664e1c1de..4a62930174d4a3 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriverTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriverTest.java @@ -19,6 +19,7 @@ import org.apache.doris.catalog.ColocateTableIndex; import org.apache.doris.catalog.Env; +import org.apache.doris.common.FeConstants; import org.apache.doris.common.IdGenerator; import org.apache.doris.common.Pair; import org.apache.doris.nereids.hint.DistributeHint; @@ -88,6 +89,8 @@ class ChildOutputPropertyDeriverTest { @BeforeEach public void setUp() { + FeConstants.runningUnitTest = true; + new MockUp() { @Mock ColocateTableIndex getCurrentColocateIndex() { diff --git a/regression-test/suites/backup_restore/test_backup_restore.groovy b/regression-test/suites/backup_restore/test_backup_restore.groovy index 011a6c052103f6..77e5aea95aa00e 100644 --- a/regression-test/suites/backup_restore/test_backup_restore.groovy +++ b/regression-test/suites/backup_restore/test_backup_restore.groovy @@ -84,15 +84,16 @@ suite("test_backup_restore", "backup_restore") { as select * from ${dbName}.${tableName}; """ - sql """ - BACKUP SNAPSHOT ${dbName}.${snapshotName}_1 - TO `${repoName}` - ON (test_temp_table_backup) - """ - syncer.waitSnapshotFinish(dbName) - def show_data = sql "show backup from ${dbName} where SnapshotName = '${snapshotName}_1'" - assertTrue(show_data.size() >= 1) - assertTrue(show_data[0][12].contains("test_temp_table_backup does not exist")) + try { + sql """ + BACKUP SNAPSHOT ${dbName}.${snapshotName}_1 + TO `${repoName}` + ON (test_temp_table_backup) + """ + throw new IllegalStateException("Should throw error") + } catch (Exception ex) { + assertTrue(ex.getMessage().contains("is a temporary table, do not support backup"), ex.getMessage()) + } sql "DROP TABLE ${dbName}.test_temp_table_backup FORCE" sql "DROP TABLE ${dbName}.${tableName} FORCE"