Skip to content

[BugFix] fix mem leak when caching mv plan context (backport #72300)#72390

Merged
wanpengfei-git merged 2 commits into
branch-4.0from
mergify/bp/branch-4.0/pr-72300
May 8, 2026
Merged

[BugFix] fix mem leak when caching mv plan context (backport #72300)#72390
wanpengfei-git merged 2 commits into
branch-4.0from
mergify/bp/branch-4.0/pr-72300

Conversation

@mergify

@mergify mergify Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Why I'm doing:

There are lots of LakeTablet object on FOLLOWER after frequently drop&create same materialized view.
And objects can't be releazed after fe transfers to LEADER.

 num     #instances         #bytes  class name (module)
-------------------------------------------------------
   1:      24469095     1080226352  [B (java.base@17.0.2)
   2:      13197226     1055778080  com.starrocks.lake.LakeTablet

What I'm doing:

Removed dropped materialized view object from pending cache and double check materialized view still exists before be added to context cache.

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
    • This pr needs auto generate documentation
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.1
    • 4.0
    • 3.5
    • 3.4

This is an automatic backport of pull request #72300 done by [Mergify](https://mergify.com).

Signed-off-by: kaijian.ding <kaijian.ding@gmail.com>
(cherry picked from commit 33ccc4a)

# Conflicts:
#	fe/fe-core/src/test/java/com/starrocks/planner/MaterializedViewTextBasedRewriteTest.java
@mergify mergify Bot added the conflicts label Apr 30, 2026
@mergify

mergify Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

Cherry-pick of 33ccc4a has failed:

On branch mergify/bp/branch-4.0/pr-72300
Your branch is up to date with 'origin/branch-4.0'.

You are currently cherry-picking commit 33ccc4ae03.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   fe/fe-core/src/main/java/com/starrocks/sql/optimizer/CachingMvPlanContextBuilder.java

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   fe/fe-core/src/test/java/com/starrocks/planner/MaterializedViewTextBasedRewriteTest.java

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@wanpengfei-git wanpengfei-git enabled auto-merge (squash) April 30, 2026 06:06
@mergify mergify Bot closed this Apr 30, 2026
auto-merge was automatically disabled April 30, 2026 06:07

Pull request was closed

@mergify

mergify Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

@mergify[bot]: Backport conflict, please reslove the conflict and resubmit the pr

@kevincai kevincai reopened this May 8, 2026
@wanpengfei-git wanpengfei-git enabled auto-merge (squash) May 8, 2026 12:39
@kevincai

kevincai commented May 8, 2026

Copy link
Copy Markdown
Contributor

@copilot fix the backport conflict in single commit, don't edit pull request description.

Agent-Logs-Url: https://github.com/StarRocks/starrocks/sessions/3b691f9b-73a0-489a-b822-714734858a99

Co-authored-by: kevincai <771299+kevincai@users.noreply.github.com>
auto-merge was automatically disabled May 8, 2026 12:42

Head branch was pushed to by a user without write access

Copilot AI commented May 8, 2026

Copy link
Copy Markdown
Contributor

@copilot fix the backport conflict in single commit, don't edit pull request description.

Fixed in 684a365. I resolved the backport conflict in MaterializedViewTextBasedRewriteTest by removing the committed merge markers and keeping the correct branch-4.0 imports.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • mirror.iscas.ac.cn
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.14/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.14/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.14 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.14/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/starrocks/starrocks/fe org.codehaus.plexus.classworlds.launcher.Launcher -pl fe-core -Dtest=MaterializedViewTextBasedRewriteTest -DfailIfNoTests=false test (dns block)
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.14/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.14/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.14 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.14/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/starrocks/starrocks/fe org.codehaus.plexus.classworlds.launcher.Launcher -pl fe-core -DskipTests compile (dns block)
  • repository.cloudera.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.14/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.14/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.14 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.14/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/starrocks/starrocks/fe org.codehaus.plexus.classworlds.launcher.Launcher -pl fe-core -Dtest=MaterializedViewTextBasedRewriteTest -DfailIfNoTests=false test (dns block)
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.14/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.14/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.14 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.14/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/starrocks/starrocks/fe org.codehaus.plexus.classworlds.launcher.Launcher -pl fe-core -DskipTests compile (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from kevincai May 8, 2026 12:44
@wanpengfei-git wanpengfei-git enabled auto-merge (squash) May 8, 2026 14:23
@wanpengfei-git wanpengfei-git merged commit d3178cf into branch-4.0 May 8, 2026
26 of 27 checks passed
@wanpengfei-git wanpengfei-git deleted the mergify/bp/branch-4.0/pr-72300 branch May 8, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants