bzhang-obsec opened a new pull request, #70711:
URL: https://github.com/apache/doris/pull/70711

   Cherry-pick of #70649 to branch-4.2. Two adaptations:
   
   - `InsertIntoTableCommand.runInternal` on this branch still returns early 
through
     `isEmptyInsert()` / `shouldExecuteEmptyInsert()` instead of master's 
`requiresTransaction()`, so
     `onSkipExecution()` is called before that return.
   - `OlapInsertExecutorTest` keeps this branch's `createExecutor(ctx)` helper 
and only adds the
     `needRegister` overload the new tests use.
   
   ### What problem does this PR solve?
   
   Issue Number: #70632
   
   Related PR: #70649
   
   Problem Summary: An OLAP `INSERT INTO ... SELECT` whose source the planner 
reduces to an empty set (for
   example a LIST partition that does not exist, or `WHERE 1 = 0`) registers an 
`InsertLoadJob` and then
   returns before `afterExec` / `onFail`, so the job stays PENDING in the 
master FE until it restarts. These
   jobs never expire, leak heap, and once more than `label_num_threshold` are 
stuck, every label-cleaner run
   removes all finished load jobs. The fix records the registered job as 
FINISHED with 0 rows on that
   early-return path.
   
   ### Release note
   
   Fix `INSERT INTO ... SELECT` statements whose source is planned empty 
leaving PENDING load jobs in the
   master FE, which leaked memory until restart.
   
   ### Check List (For Author)
   
   - Test: Unit Test (OlapInsertExecutorTest) and Regression test 
(load_p0/insert/test_insert_statistic),
     carried over from #70649; not run locally on this branch
   - Behavior changed: Yes. Such an INSERT now shows up in SHOW LOAD as 
FINISHED instead of PENDING
   - Does this need documentation: No
   
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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