From 0f6148a70b905f0b6be3eedd17fbdbbeeece541b Mon Sep 17 00:00:00 2001 From: seawinde Date: Mon, 13 Jul 2026 11:30:09 +0800 Subject: [PATCH] [fix](test) Stabilize lineage skip internal schema test (#65235) Related PR: #61004 Problem Summary: `LineageUtilsSkipTest.testSkipInternalSchemaInsert` could fail intermittently in FE UT with `Failed to acquire catalog lock. Try again`. Root cause: In `LineageUtilsSkipTest.beforeCluster()`, the test enabled `FeConstants.enableInternalSchemaDb` before the mocked FE cluster started. This allowed the background `InternalSchemaInitializer` to run during test startup. The background initializer and the test method both performed DDL, so they could race on the catalog lock used by `InternalCatalog.createDb()`. This PR keeps the background internal schema initializer disabled for the unit test and creates the required internal schema synchronously in `runBeforeAll()`. | File | Change Description | |------|--------------------| | `LineageUtilsSkipTest.java` | Stop enabling the background internal schema initializer, create the internal schema synchronously before the test body, and remove duplicate per-test initialization. | --- .../nereids/lineage/LineageUtilsSkipTest.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/lineage/LineageUtilsSkipTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/lineage/LineageUtilsSkipTest.java index 33c49eb9939e59..400b9b227972de 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/lineage/LineageUtilsSkipTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/lineage/LineageUtilsSkipTest.java @@ -41,17 +41,12 @@ public class LineageUtilsSkipTest extends TestWithFeService { private String[] originalPlugins; - private boolean originalEnableInternalSchemaDb; @Override - protected void beforeCluster() { - originalEnableInternalSchemaDb = FeConstants.enableInternalSchemaDb; - FeConstants.enableInternalSchemaDb = true; - } - - @Override - protected void runAfterAll() throws Exception { - FeConstants.enableInternalSchemaDb = originalEnableInternalSchemaDb; + protected void runBeforeAll() throws Exception { + FeConstants.runningUnitTest = true; + InternalSchemaInitializer.createDb(); + InternalSchemaInitializer.createTbl(); } @BeforeEach @@ -73,9 +68,6 @@ public void testSkipInternalSchemaInsert() throws Exception { createTable("create table " + dbName + ".src(k1 int) " + "distributed by hash(k1) buckets 1 properties('replication_num'='1');"); - InternalSchemaInitializer.createDb(); - InternalSchemaInitializer.createTbl(); - String sql = "insert into `internal`.`__internal_schema`.`column_statistics`" + "(`id`, `catalog_id`, `db_id`, `tbl_id`, `idx_id`, `col_id`, `part_id`," + " `count`, `ndv`, `null_count`, `min`, `max`, `data_size_in_bytes`, `update_time`, `hot_value`)"