horus-leonardo opened a new pull request, #70897:
URL: https://github.com/apache/doris/pull/70897

   Supersedes #62884 (closed by the stale bot, which the author cannot reopen). 
Reworked as suggested in the review there.
   
   ### What problem does this PR solve?
   
   Issue Number: close #62883
   
   Related PR: none
   
   Problem Summary:
   
   `createOlapTable` records `LAST_UPDATE_TIME` in 
`DynamicPartitionScheduler.runtimeInfos` for every OLAP table it creates, with 
or without dynamic partition. Nothing removes that entry when the table goes 
away: the only caller of `removeRuntimeInfo` is `SHOW DYNAMIC PARTITION 
TABLES`, and only for tables that still exist. On an FE with heavy CREATE/DROP 
churn the map keeps one entry per dropped table until the FE restarts. We hit 
an FE OOM on 4.0.5 with ~1.5M entries / 554 MB retained (details in #62883).
   
   Following the review, the cleanup now happens at the end of the DDL that 
removes the table, not in the scheduler:
   
   1. `InternalCatalog.unprotectDropTable()`, next to `removeTableStats`. This 
covers DROP TABLE, DROP DATABASE (which drops each table through it) and replay.
   2. `Alter.replaceTableInternal()` when `swap = false`, where the original 
table is dropped, also next to `removeTableStats`.
   
   On the case raised in the previous review (dynamic partition disabled, or 
`partition.retention_count` back to 0): the table still exists and still shows 
in `SHOW DYNAMIC PARTITION TABLES` with its last state, so its entry is bounded 
by the number of live tables and is not part of the leak. This PR leaves that 
behavior unchanged.
   
   ### Release note
   
   Fix FE memory growth in `DynamicPartitionScheduler.runtimeInfos`, which kept 
one entry per dropped OLAP table until restart.
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [x] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
   
   `DynamicPartitionTableTest#testRuntimeInfoRemovedWithTable`: creates a plain 
OLAP table, checks that runtime info exists, drops it and checks it is gone; 
then runs `REPLACE WITH TABLE ... ('swap' = 'false')` and checks that the 
original table's entry is gone and the replacement's is kept. The leak is not 
visible through SQL (dropped tables are not listed anywhere), so a 
regression-test suite cannot observe it; the FE unit test checks the map 
directly.
   
   - Behavior changed:
       - [x] No.
       - [ ] Yes.
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label
   


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