after create database in proxy,when excute `use database`, ERROR 1049 (42000): Unknown database 'encrypt_db'
Bug Report
For English only, other languages will not accept.
Before report a bug, make sure you have:
- Searched open and closed GitHub issues.
- Read documentation: ShardingSphere Doc.
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?
4638a95dd4488f932c8a18433733fcf9e5464adf
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
Proxy
Expected behavior
Actual behavior
[root@DB2 proxy_zk_test]# ./after/bin/start.sh
/usr/bin/java
we find java version: java8, full_version=1.8.0_312, full_path=/usr/bin/java
The classpath is /opt/test/proxy_zk_test/after/conf:/opt/test/proxy_zk_test/after/conf:.:/opt/test/proxy_zk_test/after/lib/*:/opt/test/proxy_zk_test/after/ext-lib/*
main class org.apache.shardingsphere.proxy.Bootstrap -1 /opt/test/proxy_zk_test/after/conf 0.0.0.0 false
Starting the ShardingSphere-Proxy ...
Please check the STDOUT file: /opt/test/proxy_zk_test/after/logs/stdout.log
[root@DB2 proxy_zk_test]#
[root@DB2 proxy_zk_test]#
[root@DB2 proxy_zk_test]# mysql -uroot -h127.0.0.1 -proot -P3307
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.22-ShardingSphere-Proxy 5.5.1-SNAPSHOT-4638a95 Source distribution
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| shardingsphere |
| sys |
+--------------------+
5 rows in set (0.01 sec)
mysql> create database encrypt_db;
Query OK, 0 rows affected (0.03 sec)
mysql> use encrypt_db
ERROR 1049 (42000): Unknown database 'encrypt_db'
mysql> CREATE ENCRYPT RULE t_encrypt_${i} (COLUMNS((NAME=user_id,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))), (NAME=order_id, CIPHER=order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))));
ERROR 1064 (42000): You have an error in your SQL syntax: no viable alternative at input 'CREATEENCRYPT' near '[@1,7:13='ENCRYPT',<866>,1:7]' at line 1
mysql> use encrypt_db
ERROR 1049 (42000): Unknown database 'encrypt_db'
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| shardingsphere |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| shardingsphere |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| shardingsphere |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql> refresh table metadata;
ERROR 1046 (3D000): No database selected
mysql> create database encrypt_db;
Query OK, 0 rows affected (0.00 sec)
mysql> use encrypt_db
ERROR 1049 (42000): Unknown database 'encrypt_db'
mysql>
Reason analyze (If you can)
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Example codes for reproduce this issue (such as a github link).
when my zk use "-Dzookeeper.log.file=${ZOO_LOG_FILE}" "-Dzookeeper.watchManagerName=org.apache.zookeeper.server.watch.WatchManagerOptimized" -Dzookeeper.snapCount='50000' \ , the problem will show
when my zk only use "-Dzookeeper.log.file=${ZOO_LOG_FILE}" ,the problem will not show
when my zk use
"-Dzookeeper.log.file=${ZOO_LOG_FILE}" "-Dzookeeper.watchManagerName=org.apache.zookeeper.server.watch.WatchManagerOptimized" -Dzookeeper.snapCount='50000' \, the problem will showwhen my zk only use
"-Dzookeeper.log.file=${ZOO_LOG_FILE}",the problem will not show
@wsm12138 Thanks for your feedback!
when my zk use
"-Dzookeeper.log.file=${ZOO_LOG_FILE}" "-Dzookeeper.watchManagerName=org.apache.zookeeper.server.watch.WatchManagerOptimized" -Dzookeeper.snapCount='50000' \, the problem will show when my zk only use"-Dzookeeper.log.file=${ZOO_LOG_FILE}",the problem will not show@wsm12138 Thanks for your feedback!
no thinks
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
When we support watchManagerName=org.apache.zookeeper.server.watch.WatchManagerOptimized , then we can discuss this issue