Skip to content

[Enhancement] Make plugin install/uninstall idempotent#75563

Open
s4ch1n wants to merge 2 commits into
StarRocks:mainfrom
s4ch1n:main-plugin-id
Open

[Enhancement] Make plugin install/uninstall idempotent#75563
s4ch1n wants to merge 2 commits into
StarRocks:mainfrom
s4ch1n:main-plugin-id

Conversation

@s4ch1n

@s4ch1n s4ch1n commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Why I'm doing:

Add IF NOT EXISTS / IF EXISTS support for idempotent plugin install/uninstall

#74913

What I'm doing:

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.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

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

@mergify mergify Bot assigned s4ch1n Jun 29, 2026
@github-actions github-actions Bot added the documentation Documentation changes label Jun 30, 2026
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

🌎 Translation Required?

Thanks for your doc contribution! The following languages are missing or outdated for your changes.

🤖 Automated Translations

If you are fluent in any of the missing languages you can add them. If not, a maintainer can generate the translations below.

Maintainer: Check the ones you wish to generate:

docs/en/sql-reference/sql-statements/cluster-management/plugin/INSTALL_PLUGIN.md

  • zh for docs/en/sql-reference/sql-statements/cluster-management/plugin/INSTALL_PLUGIN.md (New)
  • ja for docs/en/sql-reference/sql-statements/cluster-management/plugin/INSTALL_PLUGIN.md (New)

docs/en/sql-reference/sql-statements/cluster-management/plugin/UNINSTALL_PLUGIN.md

  • zh for docs/en/sql-reference/sql-statements/cluster-management/plugin/UNINSTALL_PLUGIN.md (New)
  • ja for docs/en/sql-reference/sql-statements/cluster-management/plugin/UNINSTALL_PLUGIN.md (New)

Maintainers: Check boxes and reply with /translate to start.

🕒 Last updated: Fri, 10 Jul 2026 19:25:26 GMT

@github-actions github-actions Bot added the docs-maintainer Picked up by the weekly docs triage workflow label Jun 30, 2026
@s4ch1n

s4ch1n commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@HangyuanLiu FE Incremental coverage report seems stale, It should be more than 80%, Is there a way to check for staleness in the FE coverage pipeline ? I don't have access to CI logs to check

dirtysalt
dirtysalt previously approved these changes Jul 9, 2026

@dirtysalt dirtysalt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

Comment thread fe/fe-core/src/main/java/com/starrocks/plugin/PluginMgr.java
Comment thread fe/fe-core/src/main/java/com/starrocks/plugin/PluginMgr.java
@dirtysalt dirtysalt assigned dirtysalt and unassigned dirtysalt Jul 9, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Module-risk briefing for Codex review

This is review focus, not a finding list. Validate against the diff.

High-confidence risks

@s4ch1n s4ch1n removed their assignment Jul 10, 2026
@s4ch1n s4ch1n requested a review from gengjun-git July 10, 2026 19:59
@mergify mergify Bot assigned s4ch1n Jul 10, 2026
LOG.info("uninstall plugin[{}] which does not exist", pluginName);
return;
}
throw new DdlException("Plugin " + pluginName + " does not exist");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use String.format

@osscm

osscm commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

@s4ch1n @dirtysalt - trying to understand, how does this plugin zip in installed? adding to the plugin folder? and is there any other check SR does before adding to the plugins....

@dirtysalt
It is not about this PR, but in general, from security and safety purpose.
Should we have pre-check about what that plugin is trying to do, or this is SQL to do admin operations, instead of adding it manually to the build?

thanks

@s4ch1n

s4ch1n commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

@osscm I'll try to answer some of the questions.

how does this plugin zip in installed? adding to the plugin folder? and is there any other check SR does before adding to the plugins....

A plugin zip can be installed from either a local path or a remote http/https URL. Once fetched, StarRocks extracts it and moves it into $STARROCKS_HOME/plugins//. More info

Before installing, SR runs a PLUGIN system privilege check, validates required fields in plugin.properties (name, type, version, classname), and confirms the plugin class can actually be loaded - among other checks.

in general, from security and safety purpose. Should we have pre-check about what that plugin is trying to do, or this is SQL to do admin operations, instead of adding it manually to the build?

From a security standpoint though, By default, only root and db_admin roles hold the PLUGIN privilege, so it's already restricted to admin-tier roles. Once loaded, the plugin class runs with the full permissions of the FE JVM process there's no sandboxing or static analysis of intent, but given the lack of sandboxing, admins should treat INSTALL PLUGIN as equivalent to deploying arbitrary code onto the FE, and vet the plugin source themselves beforehand.

@github-actions

Copy link
Copy Markdown
Contributor

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

Copy link
Copy Markdown
Contributor

[FE Incremental Coverage Report]

pass : 8 / 8 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/plugin/PluginMgr.java 8 8 100.00% []

@github-actions

Copy link
Copy Markdown
Contributor

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@sonarqubecloud

Copy link
Copy Markdown

@dirtysalt dirtysalt enabled auto-merge (squash) July 13, 2026 04:24

@dirtysalt dirtysalt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-maintainer Picked up by the weekly docs triage workflow documentation Documentation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants