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

Cannot use extension auth plugin in init sql script #54671

Closed
yzhan1 opened this issue Jul 17, 2024 · 0 comments · Fixed by #54670
Closed

Cannot use extension auth plugin in init sql script #54671

yzhan1 opened this issue Jul 17, 2024 · 0 comments · Fixed by #54670
Assignees
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@yzhan1
Copy link
Contributor

yzhan1 commented Jul 17, 2024

Bug Report

Currently, users cannot create users with extension auth plugin in the init sql script. If they do so, TiDB will complain about plugin not loaded during the execution and causing the SQL statements to fail.

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. Write an auth plugin using the extension system following the example in https://github.com/pingcap/tidb/blob/master/pkg/extension/README.md
  2. Create an init sql file with content:
CREATE USER myuser IDENTIFIED WITH 'my_auth_plugin' AS 'mypwd';
  1. Start the server with this init SQL file

2. What did you expect to see? (Required)

Logging in as the user should succeed since the user should be created successfully.

3. What did you see instead (Required)

Logging in fails because the user is not created. The CREATE USER statement hits the following error:

[2024/07/16 21:54:04.259 -07:00] [INFO] [session.go:4008] ["CRUCIAL OPERATION"] [conn=0] [schemaVersion=51] ["secure text"="create user {myuser@% password = ***}"] [user=]
[2024/07/16 21:54:04.259 -07:00] [INFO] [tidb.go:269] ["rollbackTxn called due to ddl/autocommit failure"]
[2024/07/16 21:54:04.259 -07:00] [WARN] [session.go:2162] ["run statement failed"] [schemaVersion=51] [error="[executor:1524]Plugin 'my_auth_plugin' is not loaded"] [session="{\n  \"currDBName\": \"\",\n  \"id\": 0,\n  \"status\": 2,\n  \"strictMode\": true,\n  \"user\": null\n}"]
[2024/07/16 21:54:04.259 -07:00] [WARN] [bootstrap.go:3249] ["InitializeSQLFile error"] [error="[executor:1524]Plugin 'my_auth_plugin' is not loaded"]

4. What is your TiDB version? (Required)

mysql> SELECT tidb_version();
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                       |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.2.0-alpha-606-gecf9031c1b-dirty
Edition: Community
Git Commit Hash: ecf9031c1b8e8243ac9dd7cc1439818d4d85e160
Git Branch: extbootstrap
UTC Build Time: 2024-07-17 04:53:08
GoVersion: go1.21.6
Race Enabled: false
Check Table Before Drop: false
Store: unistore |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
@yzhan1 yzhan1 added the type/bug The issue is confirmed as a bug. label Jul 17, 2024
@jebter jebter added the sig/sql-infra SIG: SQL Infra label Jul 18, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in a7865a6 Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants