You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/03/03 10:35:07 UTC
[GitHub] [shardingsphere] tuohai666 opened a new issue #9579: CREATE TABLE failed in Encrypt mode
tuohai666 opened a new issue #9579:
URL: https://github.com/apache/shardingsphere/issues/9579
## Bug Report
**For English only**, other languages will not accept.
Before report a bug, make sure you have:
- Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
- Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will **close it**.
Please answer these questions before submitting your issue. Thanks!
### Which version of ShardingSphere did you use?
5.0.0-RC1-SNAPSHOT
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
### Expected behavior
CREATE TABLE executed correctly.
### Actual behavior
Either
```
mysql> CREATE TABLE `t_encrypt` ( `user_id` bigint DEFAULT NULL, `order_id` bigint DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
ERROR 19999 (C1999): 9Unknown exception: [null]
```
or
```
mysql> CREATE TABLE `t_encrypt` (
-> `user_id` bigint DEFAULT NULL,
-> `order_id` bigint DEFAULT NULL,
-> `user_cipher` varchar(100) DEFAULT NULL,
-> `order_cipher` varchar(100) DEFAULT NULL
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
ERROR 19999 (C1999): 9Unknown exception: [null]
```
### Reason analyze (If you can)
```
[INFO ] 2021-03-03 18:23:47.852 [ShardingSphere-Command-2] ShardingSphere-SQL - Logic SQL: CREATE TABLE `t_encrypt` ( `user_id` bigint DEFAULT NULL, `order_id` bigint DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
[INFO ] 2021-03-03 18:23:47.852 [ShardingSphere-Command-2] ShardingSphere-SQL - SQLStatement: MySQLCreateTableStatement(isNotExisted=false)
[INFO ] 2021-03-03 18:23:47.852 [ShardingSphere-Command-2] ShardingSphere-SQL - Actual SQL: dataSource ::: CREATE TABLE `t_encrypt` ( `user_id` bigint DEFAULT NULL, `order_id` bigint DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
[ERROR] 2021-03-03 18:23:47.914 [ShardingSphere-Command-2] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
java.util.NoSuchElementException: null
at java.util.ArrayList$Itr.next(ArrayList.java:862)
at org.apache.shardingsphere.infra.metadata.schema.refresher.type.CreateTableStatementSchemaRefresher.refresh(CreateTableStatementSchemaRefresher.java:50)
at org.apache.shardingsphere.infra.metadata.schema.refresher.type.CreateTableStatementSchemaRefresher.refresh(CreateTableStatementSchemaRefresher.java:37)
at org.apache.shardingsphere.infra.metadata.engine.MetadataRefreshEngine.refreshSchema(MetadataRefreshEngine.java:75)
at org.apache.shardingsphere.infra.metadata.engine.MetadataRefreshEngine.refresh(MetadataRefreshEngine.java:64)
at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.refreshMetadata(DatabaseCommunicationEngine.java:190)
at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:113)
at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:101)
at org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:55)
at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:57)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:93)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:71)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
```
And
```
[INFO ] 2021-03-03 18:13:11.271 [ShardingSphere-Command-1] ShardingSphere-SQL - Logic SQL: CREATE TABLE `t_encrypt` (
`user_id` bigint DEFAULT NULL,
`order_id` bigint DEFAULT NULL,
`user_cipher` varchar(100) DEFAULT NULL,
`order_cipher` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
[INFO ] 2021-03-03 18:13:11.271 [ShardingSphere-Command-1] ShardingSphere-SQL - SQLStatement: MySQLCreateTableStatement(isNotExisted=false)
[INFO ] 2021-03-03 18:13:11.271 [ShardingSphere-Command-1] ShardingSphere-SQL - Actual SQL: dataSource ::: CREATE TABLE `t_encrypt` (
`user_id` bigint DEFAULT NULL,
`order_id` bigint DEFAULT NULL,
`user_cipher` varchar(100) DEFAULT NULL,
`order_cipher` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
[ERROR] 2021-03-03 18:13:11.383 [ShardingSphere-Command-1] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
java.util.NoSuchElementException: null
at java.util.ArrayList$Itr.next(ArrayList.java:862)
at org.apache.shardingsphere.infra.metadata.schema.refresher.type.CreateTableStatementSchemaRefresher.refresh(CreateTableStatementSchemaRefresher.java:50)
at org.apache.shardingsphere.infra.metadata.schema.refresher.type.CreateTableStatementSchemaRefresher.refresh(CreateTableStatementSchemaRefresher.java:37)
at org.apache.shardingsphere.infra.metadata.engine.MetadataRefreshEngine.refreshSchema(MetadataRefreshEngine.java:75)
at org.apache.shardingsphere.infra.metadata.engine.MetadataRefreshEngine.refresh(MetadataRefreshEngine.java:64)
at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.refreshMetadata(DatabaseCommunicationEngine.java:190)
at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:113)
at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:101)
at org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:55)
at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:57)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:93)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:71)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
```
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
config-encrypt.yaml
```
schemaName: encrypt_db
dataSource:
url: jdbc:mysql://127.0.0.1:3306/demo_ds?serverTimezone=UTC&useSSL=false
username: root
password:
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
rules:
- !ENCRYPT
encryptors:
aes_encryptor:
type: AES
props:
aes-key-value: 123456abc
md5_encryptor:
type: MD5
tables:
t_encrypt:
columns:
user_id:
cipherColumn: user_cipher
encryptorName: md5_encryptor
order_id:
cipherColumn: order_cipher
encryptorName: md5_encryptor
```
server.yaml
```
authentication:
users:
root:
password: root
hostname: '%'
sharding:
password: sharding
props:
max-connections-size-per-query: 1
executor-size: 16 # Infinite by default.
proxy-frontend-flush-threshold: 128 # The default value is 128.
# LOCAL: Proxy will run with LOCAL transaction.
# XA: Proxy will run with XA transaction.
# BASE: Proxy will run with B.A.S.E transaction.
proxy-transaction-type: LOCAL
xa-transaction-manager-type: Atomikos
proxy-opentracing-enabled: false
proxy-hint-enabled: false
query-with-cipher-column: true
sql-show: true
check-table-metadata-enabled: false
lock-wait-timeout-milliseconds: 50000 # The maximum time to wait for a lock
```
### Example codes for reproduce this issue (such as a github link).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] terrymanu commented on issue #9579: CREATE TABLE failed in Encrypt mode
Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #9579:
URL: https://github.com/apache/shardingsphere/issues/9579#issuecomment-799134149
Duplicate with #9610
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] JiekerTime commented on issue #9579: CREATE TABLE failed in Encrypt mode
Posted by GitBox <gi...@apache.org>.
JiekerTime commented on issue #9579:
URL: https://github.com/apache/shardingsphere/issues/9579#issuecomment-790327432
The cause of https://github.com/apache/shardingsphere/issues/9576 is the same as the current problem, which is caused by the RouteContext failing to obtain the expected value.
But the current problem occurs in CreateTableStatementSchemaRefresher.refresh:
![Uploading image.png…]()
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] JiekerTime edited a comment on issue #9579: CREATE TABLE failed in Encrypt mode
Posted by GitBox <gi...@apache.org>.
JiekerTime edited a comment on issue #9579:
URL: https://github.com/apache/shardingsphere/issues/9579#issuecomment-790327432
The cause of https://github.com/apache/shardingsphere/issues/9576 is the same as the current problem, which is caused by the RouteContext failing to obtain the expected value.
But the current problem occurs in CreateTableStatementSchemaRefresher.refresh:

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] terrymanu closed issue #9579: CREATE TABLE failed in Encrypt mode
Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #9579:
URL: https://github.com/apache/shardingsphere/issues/9579
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on issue #9579: CREATE TABLE failed in Encrypt mode
Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #9579:
URL: https://github.com/apache/shardingsphere/issues/9579#issuecomment-790381324
Appended here,
Two pieces of work are needed to support `create encrypt table` with `encrypted rule`.
This issue **just focuses on** `refresh` one, and #9570 is for `rewrite`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] JiekerTime edited a comment on issue #9579: CREATE TABLE failed in Encrypt mode
Posted by GitBox <gi...@apache.org>.
JiekerTime edited a comment on issue #9579:
URL: https://github.com/apache/shardingsphere/issues/9579#issuecomment-790327432
The cause of https://github.com/apache/shardingsphere/issues/9576 is the same as the current problem, which is caused by the RouteContext failing to obtain the expected value.
But the current problem occurs in CreateTableStatementSchemaRefresher.refresh:

It is worth noting that this type of problem can also be triggered in the case of a single table.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org