Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support plugin start argument for tidb instance #412

Merged
merged 3 commits into from
Apr 22, 2019
Merged

Support plugin start argument for tidb instance #412

merged 3 commits into from
Apr 22, 2019

Conversation

sdojjy
Copy link
Member

@sdojjy sdojjy commented Apr 20, 2019

Support plugin start argument for tidb instance. The default value is disabled

Tests

  • enable the plugin, ARGS is appended as expected.
    ARGS="${ARGS} --plugin-dir /pulugins --plugin-load whitelist-1 "
  • disable the plugin, no plugin argument is added

@CLAassistant
Copy link

CLAassistant commented Apr 20, 2019

CLA assistant check
All committers have signed the CLA.

@sdojjy sdojjy requested review from onlymellb and aylei April 20, 2019 08:49
@@ -192,6 +192,15 @@ tidb:
cpu: 20m
memory: 5Mi

# tidb plugin configuration
plugin:
# enable pulgin or not
Copy link
Contributor

Choose a reason for hiding this comment

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

s/pulgin/plugin

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

# enable pulgin or not
enable: false
# the start argument to specify the folder containing
directory: /pulugins
Copy link
Contributor

Choose a reason for hiding this comment

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

s/pulugins//plugins

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@sdojjy sdojjy requested a review from LinuxGit April 20, 2019 09:26
# the start argument to specify the folder containing
directory: /plugins
# the start argument to specify the plugin id (name "-" version) that needs to be loaded, e.g. 'conn_limit-1'.
list: whitelist-1
Copy link
Contributor

@LinuxGit LinuxGit Apr 20, 2019

Choose a reason for hiding this comment

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

If there're multiple plugins, is list a comma separated string? I found a example, but not sure it works or not.https://github.com/helm/charts/blob/master/stable/opa/templates/deployment.yaml#L96

Copy link
Member Author

Choose a reason for hiding this comment

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

yes!
From the design document.
https://github.com/pingcap/tidb/blob/master/docs/design/2018-12-10-plugin-framework.md#Management

and tidb uage document
https://github.com/pingcap/tidb/blob/11d7199fcfbb66b1205ffa00f770f90f7b1ee9c1/tidb-server/main.go#L114

and the code that load plugins
https://github.com/pingcap/tidb/blob/11d7199fcfbb66b1205ffa00f770f90f7b1ee9c1/session/session.go#L1305

	if len(cfg.Plugin.Load) > 0 {
		err := plugin.Load(context.Background(), plugin.Config{
			Plugins:        strings.Split(cfg.Plugin.Load, ","),
			PluginDir:      cfg.Plugin.Dir,
			GlobalSysVar:   &variable.SysVars,
			PluginVarNames: &variable.PluginVarNames,
		})
		if err != nil {
			return nil, err
		}
	}

Copy link
Member Author

Choose a reason for hiding this comment

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

the plugin.list is changed to array

Copy link
Contributor

@LinuxGit LinuxGit left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@tennix tennix left a comment

Choose a reason for hiding this comment

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

LGTM

@sdojjy sdojjy requested a review from LinuxGit April 22, 2019 01:38
@sdojjy sdojjy merged commit 2ad0a47 into pingcap:master Apr 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants