Open liuzhenghua opened 3 months ago
The problem lies with PostgreSQL. I am using postgres:15-alpine, and this issue occurs after configuring storage units, whether in standalone mode or cluster mode. It doesn't happen with MySQL.
Any error log in ShardingSphere-Proxy?
Only the logs showing successful startups are available, while on the client side, there is an indefinite block. Additionally, when using ZooKeeper to start the provider in cluster mode, there is another issue: after executing the register storage unit, it initially cannot be found, but after a while, some can be retrieved. There was an error reported on the backend, but the specific logs were not saved.
Add proxy-frontend-database-protocol-type: MySQL
in props
configuration.
Add
proxy-frontend-database-protocol-type: MySQL
inprops
configuration.
It worked but I need delete the repository file which created before, Is there any way that do not need delete the old rules?
there is an error in console logs but it does not effect the usage, the stack trace is as follows:
[INFO ] 2024-07-18 09:04:08.547 [ShardingSphere-Command-0] ShardingSphere-SQL - Actual SQL: ds_0 ::: SHOW COLUMNS FROM users
[ERROR] 2024-07-18 09:04:09.491 [ShardingSphere-Command-0] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
org.postgresql.util.PSQLException: ERROR: syntax error at or near "FROM"
Position: 14
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2725)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2412)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:371)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:502)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:419)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:341)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:326)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:302)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:297)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:1310)
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:102)
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
at org.apache.shardingsphere.proxy.backend.connector.jdbc.executor.callback.impl.ProxyStatementExecutorCallback.execute(ProxyStatementExecutorCallback.java:44)
at org.apache.shardingsphere.proxy.backend.connector.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:69)
at org.apache.shardingsphere.proxy.backend.connector.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:46)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:85)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:64)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.syncExecute(ExecutorEngine.java:99)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.parallelExecute(ExecutorEngine.java:95)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.execute(ExecutorEngine.java:78)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:66)
at org.apache.shardingsphere.proxy.backend.connector.jdbc.executor.ProxyJDBCExecutor.execute(ProxyJDBCExecutor.java:73)
at org.apache.shardingsphere.proxy.backend.connector.ProxySQLExecutor.useDriverToExecute(ProxySQLExecutor.java:217)
at org.apache.shardingsphere.proxy.backend.connector.ProxySQLExecutor.execute(ProxySQLExecutor.java:176)
at org.apache.shardingsphere.proxy.backend.connector.DatabaseConnector.doExecute(DatabaseConnector.java:220)
at org.apache.shardingsphere.proxy.backend.connector.DatabaseConnector.execute(DatabaseConnector.java:173)
at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.fieldlist.MySQLComFieldListPacketExecutor.execute(MySQLComFieldListPacketExecutor.java:76)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.doExecuteCommand(CommandExecutorTask.java:126)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:121)
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)
this error is caused by executing sql select * from users;
, I found that SHOW COLUMNS FROM users is the syntax of mysql, not for postgres.
Bug Report
For English only, other languages will not accept.
Before report a bug, make sure you have:
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.5.0
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
Expected behavior
mysql client can connect.
Actual behavior
mysql client blocked.
Reason analyze (If you can)
If I clean the config repository,the mysql client can connect successfully.
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
authority: users:
transaction: defaultType: XA providerType: Atomikos
sqlParser: sqlStatementCache: initialCapacity: 2000 maximumSize: 65535 parseTreeCache: initialCapacity: 128 maximumSize: 1024
logging: loggers:
sqlFederation: sqlFederationEnabled: false executionPlanCache: initialCapacity: 2000 maximumSize: 65535
props: system-log-level: INFO max-connections-size-per-query: 1 kernel-executor-size: 16 # Infinite by default. proxy-frontend-flush-threshold: 128 # The default value is 128.
sql-show is the same as props in logger ShardingSphere-SQL, and its priority is lower than logging rule
sql-show: true check-table-metadata-enabled: false
Proxy backend query fetch size. A larger value may increase the memory usage of ShardingSphere Proxy.
proxy-backend-query-fetch-size: -1 proxy-frontend-executor-size: 0 # Proxy frontend executor size. The default value is 0, which means let Netty decide. proxy-frontend-max-connections: 0 # Less than or equal to 0 means no limitation. proxy-default-port: 3307 # Proxy default port. proxy-netty-backlog: 1024 # Proxy netty backlog. cdc-server-port: 33071 # CDC server port proxy-frontend-ssl-enabled: false proxy-frontend-ssl-cipher: '' proxy-frontend-ssl-version: TLSv1.2,TLSv1.3
REGISTER STORAGE UNIT IF NOT EXISTS ds_0 ( URL="jdbc:postgresql:///db_0?serverTimezone=UTC&sslmode=disable&allowMultiQueries=true",
USER="app_user",
PASSWORD="123456",
PROPERTIES("maximumPoolSize"=10, "idleTimeout"="30000")
);
REGISTER STORAGE UNIT IF NOT EXISTS ds_1 (
URL="jdbc:postgresql:///db_1?serverTimezone=UTC&sslmode=disable&allowMultiQueries=true",
USER="app_user",
PASSWORD="123456",
PROPERTIES("maximumPoolSize"=10, "idleTimeout"="30000")
);
REGISTER STORAGE UNIT IF NOT EXISTS ds_2 (
URL="jdbc:postgresql:///db_2?serverTimezone=UTC&sslmode=disable&allowMultiQueries=true",
USER="app_user",
PASSWORD="123456",
PROPERTIES("maximumPoolSize"=10, "idleTimeout"="30000")
);
REGISTER STORAGE UNIT IF NOT EXISTS ds_3 (
URL="jdbc:postgresql:///db_3?serverTimezone=UTC&sslmode=disable&allowMultiQueries=true",
USER="app_user",
PASSWORD="123456",
PROPERTIES("maximumPoolSize"=10, "idleTimeout"="30000")
);
Example codes for reproduce this issue (such as a github link).