This is an automated email from the ASF dual-hosted git repository.

924060929 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 25a15f932a2 [Fix](test) Isolate profile manager in cloud insert retry 
tests (#69015)
25a15f932a2 is described below

commit 25a15f932a2f5cf0c92f82bddcf962ac5a8bf5b2
Author: linrrarity <[email protected]>
AuthorDate: Wed Oct 14 22:42:16 2026 +0800

    [Fix](test) Isolate profile manager in cloud insert retry tests (#69015)
    
    ### What problem does this PR solve?
    
    Related PR: #68658
    
    Problem Summary:
    
    CloudInsertProfileRetryTest uses the ProfileManager singleton, which
    starts a periodic storage thread. After an INSERT retry succeeds, this
    thread can persist the finished profile and clear its execution profiles
    before the test assertions run, causing intermittent failures.
    
    Use a dedicated ProfileManager without starting its periodic thread and
    redirect singleton access through a scoped static mock. Preserve the
    explicit background storage probe to verify that profiles remain
    ineligible for storage while the outer retry decision is pending.
---
 .../plans/commands/insert/CloudInsertProfileRetryTest.java | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/insert/CloudInsertProfileRetryTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/insert/CloudInsertProfileRetryTest.java
index 56e0d267c85..b32328a67fd 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/insert/CloudInsertProfileRetryTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/insert/CloudInsertProfileRetryTest.java
@@ -87,6 +87,16 @@ public class CloudInsertProfileRetryTest extends 
TestWithFeService {
             "MERGE_SUCCESS_EMPTY_WITH_SESSION_REVERT"})
     @ResourceLock("global")
     public void testInsertProfileRemainsOpenUntilOuterRetryDecision(String 
caseName, @TempDir Path storage) throws Exception {
+        // Keep the periodic storage thread from releasing the finished 
profile before assertions.
+        // The explicit backgroundStorage probe below still exercises storage 
eligibility during retry.
+        ProfileManager manager = new TestProfileManager();
+        try (MockedStatic<ProfileManager> managers = 
Mockito.mockStatic(ProfileManager.class)) {
+            managers.when(ProfileManager::getInstance).thenReturn(manager);
+            runInsertProfileRetryCase(caseName, storage, manager);
+        }
+    }
+
+    private void runInsertProfileRetryCase(String caseName, Path storage, 
ProfileManager manager) throws Exception {
         boolean merge = caseName.startsWith("MERGE_");
         String outcome = merge ? caseName.substring("MERGE_".length()) : 
caseName;
         boolean realExecution = merge && 
"SUCCESS_EMPTY_WITH_SESSION_REVERT".equals(outcome);
@@ -127,7 +137,6 @@ public class CloudInsertProfileRetryTest extends 
TestWithFeService {
             executor.setParsedStmt(adapter);
         }
         Profile profile = executor.getProfile();
-        ProfileManager manager = ProfileManager.getInstance();
         NereidsPlanner planner = Mockito.mock(NereidsPlanner.class);
         
Mockito.when(planner.getPhysicalRelations()).thenReturn(Collections.emptyList());
         OlapTable table = Mockito.mock(OlapTable.class);
@@ -400,6 +409,9 @@ public class CloudInsertProfileRetryTest extends 
TestWithFeService {
         }
     }
 
+    private static class TestProfileManager extends ProfileManager {
+    }
+
     private static TQueryProfile completeBackendReport(TUniqueId queryId) {
         TRuntimeProfileNode pipeline = new TRuntimeProfileNode();
         pipeline.setName("Pipeline 0");


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to