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: [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]