You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "horus-leonardo (via GitHub)" <gi...@apache.org> on 2026/04/27 17:09:32 UTC

[PR] fix(fe): clean DynamicPartitionScheduler.runtimeInfos on DROP TABLE [doris]

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

   
   ### What problem does this PR solve?
   
   Issue Number: close #62883
   
   Related PR: none
   
   Problem Summary:
   
   `DynamicPartitionScheduler.runtimeInfos` accumulates entries indefinitely. The map is keyed by `tableId` and gets a new entry every time the scheduler runs against a table with `dynamic_partition.enable=true` or `partitionRetentionCount > 0`.
   
   `removeRuntimeInfo(long tableId)` is called in exactly one place: `ShowDynamicPartitionCommand.doRun()`, which only fires when a user issues `SHOW DYNAMIC PARTITION` and only for tables still present in the catalog that have lost their `dynamic_partition` property. No catalog mutation path calls it — DROP TABLE, DROP DATABASE, and tables that turn off dynamic_partition or zero out `partitionRetentionCount` all leave permanent entries. In automated ETL workloads where nobody runs `SHOW`, the map grows unbounded.
   
   This patch wires `removeRuntimeInfo()` into the three canonical cleanup points:
   
   1. `InternalCatalog.unprotectDropTable()` — alongside `db.unregisterTable()`.
   2. `executeDynamicPartition()` `db == null` branch — after `iterator.remove()`.
   3. `executeDynamicPartition()` `olapTable` invalid/lost-properties branch — after `iterator.remove()`.
   
   Found via heap dump analysis after an FE OOM on 4.0.5-rc01 today (2026-04-27) in a high-DDL-churn ETL workload. The map had reached ~1.5M entries / 554 MB retained heap. We are rolling out a patched build to production now and will follow up on the issue thread with steady-state retention numbers after a week of uptime.
   
   Full bug report and heap dump details in #62883.
   
   ### Release note
   
   Fix FE memory leak in `DynamicPartitionScheduler.runtimeInfos` for tables that are dropped, lose their `dynamic_partition.enable` property, or have `partitionRetentionCount` reset to 0.
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [ ] Unit Test
       - [x] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
   
   Manual test: heap dump analysis on a 4.0.5-rc01 FE that OOMed under an ETL workload doing ~24K DDL/hour against `dynamic_partition` tables. The dump showed `runtimeInfos` holding ~1M–1.5M stale entries (2,097,152-bucket `ConcurrentHashMap$Node[]`, 554 MB retained on `DynamicPartitionScheduler`, 17% of live heap post-GC walk). The patched build is being deployed today; I will report steady-state heap numbers in the issue thread after a week of production uptime.
   
   A unit test reproducing the leak would need to drive the dynamic-partition scheduler against a synthetic catalog and assert `runtimeInfos.size()` after DROP. Happy to add one if maintainers prefer that over the production validation.
   
   - 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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] fix(fe): clean DynamicPartitionScheduler.runtimeInfos on DROP TABLE [doris]

Posted by "zclllyybb (via GitHub)" <gi...@apache.org>.
zclllyybb commented on code in PR #62884:
URL: https://github.com/apache/doris/pull/62884#discussion_r3159693240


##########
fe/fe-core/src/main/java/org/apache/doris/clone/DynamicPartitionScheduler.java:
##########
@@ -691,6 +692,7 @@ public void executeDynamicPartition(Collection<Pair<Long, Long>> dynamicPartitio
                             || !olapTable.getTableProperty().getDynamicPartitionProperty().getEnable())
                     && olapTable.getPartitionRetentionCount() <= 0) {
                 iterator.remove();
+                removeRuntimeInfo(tableId);
                 continue;

Review Comment:
   This issue should be considered. It may be better to handle this issue at the end of the relevant DML statements, rather than within the scheduler.



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] fix(fe): clean DynamicPartitionScheduler.runtimeInfos on DROP TABLE [doris]

Posted by "zclllyybb (via GitHub)" <gi...@apache.org>.
zclllyybb commented on PR #62884:
URL: https://github.com/apache/doris/pull/62884#issuecomment-4341514575

   /review


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] fix(fe): clean DynamicPartitionScheduler.runtimeInfos on DROP TABLE [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #62884:
URL: https://github.com/apache/doris/pull/62884#issuecomment-6430504064

   We're closing this PR because it hasn't been updated in a while.
   This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
   If you'd like to revive this PR, please reopen it and feel free a maintainer to remove the Stale tag!


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] fix(fe): clean DynamicPartitionScheduler.runtimeInfos on DROP TABLE [doris]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #62884:
URL: https://github.com/apache/doris/pull/62884#discussion_r3159121828


##########
fe/fe-core/src/main/java/org/apache/doris/clone/DynamicPartitionScheduler.java:
##########
@@ -691,6 +692,7 @@ public void executeDynamicPartition(Collection<Pair<Long, Long>> dynamicPartitio
                             || !olapTable.getTableProperty().getDynamicPartitionProperty().getEnable())
                     && olapTable.getPartitionRetentionCount() <= 0) {
                 iterator.remove();
+                removeRuntimeInfo(tableId);
                 continue;

Review Comment:
   The new cleanup in `executeDynamicPartition()` only runs when the scheduler itself iterates a `(dbId, tableId)` entry and decides to `iterator.remove()`. However, the normal DDL path for disabling dynamic partition / setting `partition.retention_count` back to 0 calls `DynamicPartitionUtil.registerOrRemoveDynamicPartitionTable(...)`, which removes the table from `dynamicPartitionTableInfo` via `removeDynamicPartitionTable(...)` without clearing `runtimeInfos`. Once removed from the set, `executeDynamicPartition()` will never visit it again, so its `runtimeInfos` entry can still become permanent. Consider clearing `runtimeInfos` as part of the removal path as well (e.g., in `removeDynamicPartitionTable(...)` or in `DynamicPartitionUtil.registerOrRemoveDynamicPartitionTable()` when unregistering).



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java:
##########
@@ -1043,6 +1043,8 @@ public boolean unprotectDropTable(Database db, Table table, boolean isForceDrop,
                 TableNameInfoUtils.fromDb(db, table.getName()),
                 !isForceDrop && !isReplay);
         db.unregisterTable(table.getId());
+        // Fix DynamicPartitionScheduler.runtimeInfos leak on DROP TABLE.
+        Env.getCurrentEnv().getDynamicPartitionScheduler().removeRuntimeInfo(table.getId());

Review Comment:
   There are existing FE unit tests around dynamic partition scheduling/runtime info (e.g. `DynamicPartitionTableTest#testRuntimeInfo`). Since this change is intended to prevent a memory leak, it would be good to add a unit test that creates runtime info for a table, drops the table via the catalog path, and asserts the relevant runtime info keys no longer return the previously stored values (i.e. the entry was actually removed).



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] fix(fe): clean DynamicPartitionScheduler.runtimeInfos on DROP TABLE [doris]

Posted by "github-actions[bot] (via GitHub) via commits" <co...@doris.apache.org>.
github-actions[bot] closed pull request #62884: fix(fe): clean DynamicPartitionScheduler.runtimeInfos on DROP TABLE
URL: https://github.com/apache/doris/pull/62884


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org