Uh oh!
There was an error while loading. Please reload this page.
[fix](temp-table) not clean temp table temporary until fix mem leak - #59535
Merged
Conversation
morrySnow
requested review from
CalvinKirs, dataroaring and morningman
as code ownersJanuary 4, 2026 08:53
hello-stephen
commented
Jan 4, 2026
Contributor
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
morrySnow
commented
Jan 4, 2026
ContributorAuthor
run buildall |
doris-robot
commented
Jan 4, 2026
TPC-H: Total hot run time: 31584 ms |
doris-robot
commented
Jan 4, 2026
TPC-DS: Total hot run time: 172568 ms |
doris-robot
commented
Jan 4, 2026
ClickBench: Total hot run time: 26.93 s |
hello-stephen
commented
Jan 4, 2026
Contributor
FE UT Coverage ReportIncrement line coverage |
hello-stephen
commented
Jan 4, 2026
Contributor
FE Regression Coverage ReportIncrement line coverage |
Contributor
PR approved by at least one committer and no changes requested. |
Contributor
PR approved by anyone and no changes requested. |
924060929
approved these changes
Jan 5, 2026
Uh oh!
There was an error while loading. Please reload this page.
github-actionsBot
pushed a commit
that referenced
this pull request
Jan 5, 2026
…59535) ### What problem does this PR solve? Related PR: #40680 Problem Summary: This pull request temporarily disables session tracking and automatic cleanup for temporary tables due to a memory leak issue involving `Env#sessionReportTimeMap` and `Env#aliveSessionSet`. The affected logic is commented out with TODO notes, and related imports are cleaned up. Session management changes: * Disabled the code that adds sessions to `aliveSessionSet` in `Env.registerSessionInfo`, preventing new session tracking until the memory leak is fixed. * Disabled the code that updates session report times in `Env.refreshSession`, pausing session activity tracking. Temporary table cleanup changes: * Commented out the logic in `TemporaryTableMgr.runAfterCatalogReady` that deletes temporary tables when their creating session is gone, halting automatic cleanup. ### 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) - [x] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [x] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [x] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [x] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
16 tasks
seawinde pushed a commit
to seawinde/doris
that referenced
this pull request
Jan 30, 2026
…porary until fix mem leak apache#59535 (apache#6479) cherry-picks from apache#59535 Related to apache#6477 Co-authored-by: morrySnow <zhangwenxin@selectdb.com>
ybtsdst pushed a commit
to ybtsdst/doris
that referenced
this pull request
Feb 27, 2026
…x mem leak apache#59535 (apache#59551) Cherry-picked from apache#59535 Co-authored-by: morrySnow <zhangwenxin@selectdb.com>
Ryan19929 added a commit
to Ryan19929/doris
that referenced
this pull request
Sep 1, 2026
…rolling upgrade ### What problem does this PR solve? Related PR: apache#59535 Problem Summary: apache#59535 disabled the leaking session-tracking bookkeeping (Env#aliveSessionSet / Env#sessionReportTimeMap) by commenting out registerSessionInfo/refreshSession, so aliveSessionSet always stays empty. During a rolling upgrade, an old-version master FE still queries follower FEs for their alive session ids (getAllAliveSessionIds RPC) and drops temporary tables whose owning session is not reported alive after loss_conn_fe_temp_table_keep_second (default 60s). A new-version follower would report an empty list, so the old master would wrongly delete temp tables of sessions that are actually alive on the new follower. Fix: derive getAllAliveSessionIds() from the live connection registry (ExecuteEnv -> ConnectScheduler -> getConnectionMap, which covers both the MySQL protocol pool and the Arrow Flight SQL pool) instead of the always-empty aliveSessionSet. The registry always reflects real client connections and needs no register/unregister bookkeeping, so alive-session reporting stays accurate for an old-version master while the leak fix of apache#59535 remains intact (registerSessionInfo/refreshSession/TemporaryTableMgr stay commented out). ### Release note None ### Check List (For Author) - Test: Unit Test (EnvTest#testGetAllAliveSessionIds), ./build.sh --fe - Behavior changed: No - Does this need documentation: No
Ryan19929 added a commit
to Ryan19929/doris
that referenced
this pull request
Sep 2, 2026
…n disconnect ### What problem does this PR solve? Related PR: apache#59535 Problem Summary: When a client connects to a follower FE and creates a temporary table, the CREATE statement is forwarded to master FE and executed there with a proxy ConnectContext (isProxy=true). Env.registerTempTableAndSession() therefore records the temp table's inner name only in the master-side proxy session, and the original client session's dbToTempTableNamesMap on the follower stays empty. When the follower session later disconnects, times out or is killed, ConnectContext.deleteTempTable() iterates an empty map and drops nothing. apache#59535 disabled the TemporaryTableMgr background cleanup that previously collected such orphan temp tables, so temp tables created via a follower leak permanently (unbounded metadata/tablet/storage leak). Fix: after a statement is successfully forwarded to master FE (StmtExecutor.forwardToMaster), if it is a CREATE TEMPORARY TABLE (nereids CreateTableCommand or legacy CreateTableStmt), register the deterministic inner name (sessionId + sign + tableName, same as master side since the session id is forwarded) into the follower session's dbToTempTableNamesMap; if it is a forwarded DROP TABLE, remove the entry symmetrically so a later disconnect does not re-drop it. Also fix the previously dead non-master branch of ConnectContext.deleteTempTable() to qualify the forwarded DROP with the db name recorded in the map, instead of relying on the session's current database at disconnect time. ### Release note Fix the issue that temporary tables created on a follower FE are not cleaned up after the session disconnects. ### Check List (For Author) - Test: Unit Test (existing org.apache.doris.catalog.EnvTest passed); added docker regression test temp_table_p0/test_temp_table_follower_disconnect (NOT run locally, docker regression environment unavailable) - Behavior changed: Yes - temporary tables created through a follower FE connection are now dropped when the session exits, as originally intended - Does this need documentation: No
wenzhenghu pushed a commit
to HYDCP/hy-doris
that referenced
this pull request
Sep 2, 2026
…pache#59535) (#93) * [fix](temp-table) not clean temp table temporary until fix mem leak (apache#59535) ### What problem does this PR solve? Related PR: apache#40680 Problem Summary: This pull request temporarily disables session tracking and automatic cleanup for temporary tables due to a memory leak issue involving `Env#sessionReportTimeMap` and `Env#aliveSessionSet`. The affected logic is commented out with TODO notes, and related imports are cleaned up. Session management changes: * Disabled the code that adds sessions to `aliveSessionSet` in `Env.registerSessionInfo`, preventing new session tracking until the memory leak is fixed. * Disabled the code that updates session report times in `Env.refreshSession`, pausing session activity tracking. Temporary table cleanup changes: * Commented out the logic in `TemporaryTableMgr.runAfterCatalogReady` that deletes temporary tables when their creating session is gone, halting automatic cleanup. ### 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) - [x] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [x] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [x] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [x] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into --> (cherry picked from commit d172147) * [test](regression) Skip test_temp_table_with_restart after apache#59535 backport ### What problem does this PR solve? Related PR: apache#59535 Problem Summary: The backport of apache#59535 disables orphan temporary table auto-cleanup (TemporaryTableMgr) to stop the aliveSessionSet memory leak. test_temp_table_with_restart asserts exactly that auto-cleanup behavior and would always fail now. Skip it, mirroring upstream's practice in apache#64525. ### Release note None ### Check List (For Author) - Test: No need to test (test-only change, skipping a case) - Behavior changed: No - Does this need documentation: No * [fix](temp-table) Preserve alive-session reporting for mixed-version rolling upgrade ### What problem does this PR solve? Related PR: apache#59535 Problem Summary: apache#59535 disabled the leaking session-tracking bookkeeping (Env#aliveSessionSet / Env#sessionReportTimeMap) by commenting out registerSessionInfo/refreshSession, so aliveSessionSet always stays empty. During a rolling upgrade, an old-version master FE still queries follower FEs for their alive session ids (getAllAliveSessionIds RPC) and drops temporary tables whose owning session is not reported alive after loss_conn_fe_temp_table_keep_second (default 60s). A new-version follower would report an empty list, so the old master would wrongly delete temp tables of sessions that are actually alive on the new follower. Fix: derive getAllAliveSessionIds() from the live connection registry (ExecuteEnv -> ConnectScheduler -> getConnectionMap, which covers both the MySQL protocol pool and the Arrow Flight SQL pool) instead of the always-empty aliveSessionSet. The registry always reflects real client connections and needs no register/unregister bookkeeping, so alive-session reporting stays accurate for an old-version master while the leak fix of apache#59535 remains intact (registerSessionInfo/refreshSession/TemporaryTableMgr stay commented out). ### Release note None ### Check List (For Author) - Test: Unit Test (EnvTest#testGetAllAliveSessionIds), ./build.sh --fe - Behavior changed: No - Does this need documentation: No * [fix](temp-table) Register follower-created temp tables for cleanup on disconnect ### What problem does this PR solve? Related PR: apache#59535 Problem Summary: When a client connects to a follower FE and creates a temporary table, the CREATE statement is forwarded to master FE and executed there with a proxy ConnectContext (isProxy=true). Env.registerTempTableAndSession() therefore records the temp table's inner name only in the master-side proxy session, and the original client session's dbToTempTableNamesMap on the follower stays empty. When the follower session later disconnects, times out or is killed, ConnectContext.deleteTempTable() iterates an empty map and drops nothing. apache#59535 disabled the TemporaryTableMgr background cleanup that previously collected such orphan temp tables, so temp tables created via a follower leak permanently (unbounded metadata/tablet/storage leak). Fix: after a statement is successfully forwarded to master FE (StmtExecutor.forwardToMaster), if it is a CREATE TEMPORARY TABLE (nereids CreateTableCommand or legacy CreateTableStmt), register the deterministic inner name (sessionId + sign + tableName, same as master side since the session id is forwarded) into the follower session's dbToTempTableNamesMap; if it is a forwarded DROP TABLE, remove the entry symmetrically so a later disconnect does not re-drop it. Also fix the previously dead non-master branch of ConnectContext.deleteTempTable() to qualify the forwarded DROP with the db name recorded in the map, instead of relying on the session's current database at disconnect time. ### Release note Fix the issue that temporary tables created on a follower FE are not cleaned up after the session disconnects. ### Check List (For Author) - Test: Unit Test (existing org.apache.doris.catalog.EnvTest passed); added docker regression test temp_table_p0/test_temp_table_follower_disconnect (NOT run locally, docker regression environment unavailable) - Behavior changed: Yes - temporary tables created through a follower FE connection are now dropped when the session exits, as originally intended - Does this need documentation: No --------- Co-authored-by: morrySnow <zhangwenxin@selectdb.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Related PR: #40680
Problem Summary:
This pull request temporarily disables session tracking and automatic cleanup for temporary tables due to a memory leak issue involving
Env#sessionReportTimeMapandEnv#aliveSessionSet. The affected logic is commented out with TODO notes, and related imports are cleaned up.Session management changes:
aliveSessionSetinEnv.registerSessionInfo, preventing new session tracking until the memory leak is fixed.Env.refreshSession, pausing session activity tracking.Temporary table cleanup changes:
TemporaryTableMgr.runAfterCatalogReadythat deletes temporary tables when their creating session is gone, halting automatic cleanup.Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)