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

postgresql sharding proxy 4.0.0-RC3 Error #3591

Closed
xilipilige opened this issue Nov 25, 2019 · 10 comments
Closed

postgresql sharding proxy 4.0.0-RC3 Error #3591

xilipilige opened this issue Nov 25, 2019 · 10 comments
Assignees

Comments

@xilipilige
Copy link

the error info is

[ERROR] 16:28:29.726 [pool-4-thread-1] o.a.s.s.f.c.CommandExecutorTask - Exception occur: java.lang.NullPointerException: null at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.createConnection(JDBCBackendDataSource.java:150) at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:123) at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.connection.BackendConnection.getConnectionFromUnderlying(BackendConnection.java:198) at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:181) at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:150) at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.execute.callback.ProxyJDBCExecutePrepareCallback.getConnections(ProxyJDBCExecutePrepareCallback.java:56) at org.apache.shardingsphere.core.execute.sql.prepare.SQLExecutePrepareTemplate.getSQLExecuteGroups(SQLExecutePrepareTemplate.java:89) at org.apache.shardingsphere.core.execute.sql.prepare.SQLExecutePrepareTemplate.getSynchronizedExecuteUnitGroups(SQLExecutePrepareTemplate.java:67) at org.apache.shardingsphere.core.execute.sql.prepare.SQLExecutePrepareTemplate.getExecuteUnitGroups(SQLExecutePrepareTemplate.java:59) at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.execute.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:80) at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:93) at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:78) at org.apache.shardingsphere.shardingproxy.frontend.postgresql.command.query.binary.bind.PostgreSQLComBindExecutor.execute(PostgreSQLComBindExecutor.java:81) at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:86) at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:66) 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)

this configuration file:

server.ymal

`
authentication:
users:
root:
password: root
sharding:
password: sharding
authorizedSchemas: sharding_db

props:
max.connections.size.per.query: 1
acceptor.size: 16 # The default value is available processors count * 2.
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
proxy.opentracing.enabled: false
query.with.cipher.column: true
sql.show: false
`

config-sharding.yaml

`schemaName: sharding_db

dataSources:
ds_0:
url: jdbc:postgresql://192.168.51.119:5432/demo_ds_0?serverTimezone=UTC&useSSL=false
username: postgres
password: postgres
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
ds_1:
url: jdbc:postgresql://192.168.51.119:5432/demo_ds_1?serverTimezone=UTC&useSSL=false
username: postgres
password: postgres
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50

shardingRule:
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
tableStrategy:
inline:
shardingColumn: order_id
algorithmExpression: t_order_${order_id % 2}
keyGenerator:
type: SNOWFLAKE
column: order_id
t_order_item:
actualDataNodes: ds_${0..1}.t_order_item_${0..1}
tableStrategy:
inline:
shardingColumn: order_id
algorithmExpression: t_order_item_${order_id % 2}
keyGenerator:
type: SNOWFLAKE
column: order_item_id
bindingTables:
- t_order,t_order_item
defaultDatabaseStrategy:
inline:
shardingColumn: user_id
algorithmExpression: ds_${user_id % 2}
defaultTableStrategy:
none:
`

@RaigorJiang
Copy link
Contributor

What is your SQL? @xilipilige

@xilipilige
Copy link
Author

I just use the dbeaver to try to connect to the sharding proxy, but report this exception
@RaigorJiang

@xilipilige
Copy link
Author

this is my debug info
@RaigorJiang
In addition, I found that sharding proxy does not support PostgreSQL as well as mysql

@RaigorJiang
Copy link
Contributor

RaigorJiang commented Nov 25, 2019

So what is your DBeaver version?

Yes, there are some issues for Proxy with PostgreSQL, like #3104 , #3555, #3556 ,
If you are interested, we can improve it together.

@xilipilige
Copy link
Author

DBeaver's version is 5.1.2 Community Edition

I like shardingsphere very much. I will try my best to participate in the community

@RaigorJiang
Copy link
Contributor

When I use DBeaver 6.0 to connect to Proxy, the error is like #3104 , I will try your version.

@terrymanu
Copy link
Member

@RaigorJiang Great, assigned

@RaigorJiang
Copy link
Contributor

RaigorJiang commented Nov 26, 2019

Hi, @xilipilige
I test DBeaver 5.1.2 Community Edition, with sharding proxy 4.0.0-RC3 binary package, the exception is as same as yours.

Then I use DBeaver 5.1.2 to test the latest source code of SS(dev branch), and the exception is still
java.lang.IllegalArgumentException: Cannot find JDBC type '2003' in PostgreSQL column type.

When the exception occurs, logic sql is :
SELECT db.oid,db.* FROM pg_catalog.pg_database db WHERE datallowconn AND NOT datistemplate ORDER BY db.datname

@RaigorJiang
Copy link
Contributor

UPDATE:
For current version 4.0.1, the SQL
SELECT db.oid,db.* FROM pg_catalog.pg_database db WHERE datallowconn AND NOT datistemplate ORDER BY db.datname
can be executed successful, but after that, DBeaver sends another SQL
SELECT current_schema(),session_user,
it causes ANTLR visit error.
Maybe we should pend current issue, and pay some more time to fix and test Proxy with DBeaver.

Hi, @xilipilige
I test DBeaver 5.1.2 Community Edition, with sharding proxy 4.0.0-RC3 binary package, the exception is as same as yours.

Then I use DBeaver 5.1.2 to test the latest source code of SS(dev branch), and the exception is still
java.lang.IllegalArgumentException: Cannot find JDBC type '2003' in PostgreSQL column type.

When the exception occurs, logic sql is :
SELECT db.oid,db.* FROM pg_catalog.pg_database db WHERE datallowconn AND NOT datistemplate ORDER BY db.datname

@tuohai666
Copy link
Member

Duplicated with #6408 .

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