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

ShardingSphere-Proxy 5.5.1 failed to create encryption rule #34178

Open
flyer5200 opened this issue Dec 27, 2024 · 5 comments
Open

ShardingSphere-Proxy 5.5.1 failed to create encryption rule #34178

flyer5200 opened this issue Dec 27, 2024 · 5 comments

Comments

@flyer5200
Copy link

flyer5200 commented Dec 27, 2024

Bug Report

Failed to execute create encrypt rule

Version: ShardingSphere-Proxy 5.5.1 cluster mode (zookeeper)

Logs: the debug log output is as follows:

[DEBUG] 2024-12-27 15:38:04.027 [ShardingSphere-Command-0] o.a.s.p.f.m.c.MySQLCommandExecutorFactory - Execute packet type: COM_QUERY, sql: CREATE ENCRYPT RULE sms_send_record ( COLUMNS ( ( NAME = mobile, CIPHER = mobile_cipher, ENCRYPT_ALGORITHM(TYPE(NAME = 'AES', PROPERTIES('aes-key-value' = 'test-key-1111111'))) ) ), QUERY_WITH_CIPHER_COLUMN = TRUE ) [INFO ] 2024-12-27 15:38:04.027 [ShardingSphere-Command-0] o.a.s.i.m.ShardingSphereMetaData - contains database [qts-neptune]. [INFO ] 2024-12-27 15:38:04.027 [ShardingSphere-Command-0] o.a.s.i.m.ShardingSphereMetaData - contains database [qts-neptune]. [INFO ] 2024-12-27 15:38:04.027 [ShardingSphere-Command-0] o.a.s.i.m.ShardingSphereMetaData - Get database [qts-neptune]. [DEBUG] 2024-12-27 15:38:04.082 [ShardingSphere-Command-0] o.a.s.p.f.c.CommandExecutorTask - Exception occur: org.apache.shardingsphere.infra.exception.dialect.exception.syntax.sql.DialectSQLParsingException: You have an error in your SQL syntax: no viable alternative at input 'CREATEENCRYPT' at org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.getException(ShardingSphereSQLParserEngine.java:66) at org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse(ShardingSphereSQLParserEngine.java:59) at org.apache.shardingsphere.proxy.backend.handler.ProxySQLComQueryParser.parse(ProxySQLComQueryParser.java:50) at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.<init>(MySQLComQueryPacketExecutor.java:64) at org.apache.shardingsphere.proxy.frontend.mysql.command.MySQLCommandExecutorFactory.newInstance(MySQLCommandExecutorFactory.java:84) at org.apache.shardingsphere.proxy.frontend.mysql.command.MySQLCommandExecuteEngine.getCommandExecutor(MySQLCommandExecuteEngine.java:59) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:120) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78) at com.alibaba.ttl.TtlRunnable.run(TtlRunnable.java:60) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1583)

@terrymanu
Copy link
Member

How to reproduce it?

@flyer5200
Copy link
Author

Steps to reproduce:

1. deploy shardingsphere-proxy, version 5.5.1

  • use docker images apache/shardingsphere-proxy:5.5.1 deploy to kubernetes
  • global.yml configures the zookeeper cluster mode, create database-.yml with:
    - rules:
    - !SINGLE
    tables:
    - "
    .*"
  • mount global.yml and database-*.yml to shardingsphere-proxy container use kubernetes secret.

2. Wait for the container to start, connect using the mysql client, is ok, tables can be loaded normally.

3. use database and create encrypt rule, an exception was thrown.

image
image

@zzyReal666
Copy link
Contributor

remove QUERY_WITH_CIPHER_COLUMN = true and try again.

@flyer5200
Copy link
Author

remove QUERY_WITH_CIPHER_COLUMN = true and try again.

Thank you very much, after removing this option, I can successfully create encryption rules. I checked the source code and found #25383 , and understood the background of this change. Thanks again for your help!

@flyer5200
Copy link
Author

flyer5200 commented Dec 31, 2024

@terrymanu zzyReal666 has given a solution, it works.

The prompt when the error occurs has little to do with the cause of the error. It seems that the unsupported option should be prompted to clarify the cause of the error.

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

No branches or pull requests

4 participants