dzr171712 opened a new pull request, #66752:
URL: https://github.com/apache/doris/pull/66752

   ### What problem does this PR solve?
   
   Issue Number: close #xxx
   
   Related PR: None
   
   Problem Summary:
   
   In Cloud mode, cumulative compaction requests the tablet global compaction
   lock before increasing `_cumu_compaction_thread_pool_used_threads`.
   
   The cleanup `Defer` is created before the lock request. If the global lock
   request fails, the task returns before the thread counter is incremented, but
   the cleanup logic still decrements the counter. As a result,
   `_cumu_compaction_thread_pool_used_threads` can become negative.
   
   A negative thread counter can cause the cumulative compaction scheduling 
logic
   to calculate the remaining thread capacity incorrectly and affect the
   large-task delay decision.
   
   This PR adds a guard to ensure that the thread counter is decremented only
   when it has actually been incremented.
   
   A regression unit test is added to simulate global compaction lock failure 
and
   verify that the counter remains balanced.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
     - [ ] Regression test
     - [✅] Unit Test
     - [ ] Manual test (add detailed scripts or steps below)
     - [ ] No need to test or manual test. Explain why:
       - [ ] This is a refactor/code format and no logic has been changed.
       - [ ] Previous test can cover this change.
       - [ ] No code files have been changed.
       - [ ] Other reason <!-- Add your reason?  -->
   
     Test case:
   
     ```text
     CloudCompactionTest.cumulative


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to