Issue 1:
Which version of ShardingSphere did you use?

v4.1.1

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

jdbc

Expected behavior

Actual behavior

throws exception

Reason analyze (If you can)

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

If I package the program to jar and run the jar file, I'll get

Exception in thread "main" java.lang.UnsupportedOperationException: Cannot support database type 'MySQL'
at org.apache.shardingsphere.sql.parser.core.parser.SQLParserFactory.newInstance(SQLParserFactory.java:55)
at org.apache.shardingsphere.sql.parser.core.parser.SQLParserExecutor.towPhaseParse(SQLParserExecutor.java:55)
at org.apache.shardingsphere.sql.parser.core.parser.SQLParserExecutor.execute(SQLParserExecutor.java:47)
at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse0(SQLParserEngine.java:79)
at org.apache.shardingsphere.sql.parser.SQLParserEngine.parse(SQLParserEngine.java:61)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.createRouteContext(DataNodeRouter.java:97)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.executeRoute(DataNodeRouter.java:89)
at org.apache.shardingsphere.underlying.route.DataNodeRouter.route(DataNodeRouter.java:76)
at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.MasterSlaveStatement.execute(MasterSlaveStatement.java:161)
at com.test.TestMain.main(TestMain.java:50)

# code --- start
File yamlFile = new File(args[0]);
DataSource ds = YamlMasterSlaveDataSourceFactory.createDataSource(yamlFile);
Connection conn = ds.getConnection("proxy", "p123456");
Statement stmt = conn.createStatement()
stmt.execute("truncate table jmeter_test");
for ... {
stmt.execute("insert into jmeter_test values (null, now(), now(), now(), now(), " +
"now(), now(), now(), now(), now(), " +
"now(), now(), now(), now(), now(), " +
"now(), now(), now(), now(), now(), " +
"now(), now(), now(), now(), now(), " +
"now(), unix_timestamp(), unix_timestamp(), unix_timestamp(), unix_timestamp())");
}
...
# code --- end

# config-master_slave.yaml --- start
dataSources:
# 配置第 1 个数据源
ds_master: !!com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.252.246:3306/proxy?serverTimezone=UTC&useSSL=false
username: proxy
password: p123456
initialSize: 10 #连接池初始化连接数
minIdle: 10 #连接池最小连接数
maxActive: 10 #连接池最大连接数
# 配置第 2 个数据源
ds_slave0: !!com.alibaba.druid.pool.DruidDataSource
#!!org.apache.commons.dbcp2.BasicDataSource
#!!com.zaxxer.hikari.HikariDataSource
#!!com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.252.237:3306/proxy?serverTimezone=UTC&useSSL=false
username: proxy
password: p123456
initialSize: 10 #连接池初始化连接数
minIdle: 10 #连接池最小连接数
maxActive: 10 #连接池最大连接数

masterSlaveRule:
name: ds_ms
masterDataSourceName: ds_master
slaveDataSourceNames: [ds_slave0]

# config-master_slave.yaml --- end

Example codes for reproduce this issue (such as a github link).

Issue 2:
Feature Request

Describe the feature you would like.

Handle Transaction Failed.

Is your feature request related to a problem?

I was testing PostgreSQL Proxy with sysbench. FATAL occurred and the JDBC connection became unavailable because transaction failed and autosave was the default value never.

sysbench oltp_write_only --db-driver=pgsql --pgsql-host=${PROXY_HOST} --pgsql-port=${PROXY_PORT} --pgsql-user=root --pgsql-password='root' --pgsql-db=sbtest --tables=2 --table-size=10000 --report-interval=5 --time=30 --threads=8 --max-requests=0 --percentile=99 --range_selects=off --rand-type=uniform --auto_inc=off run | tee oltp_write_only.master.txt

sysbench log

sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)

Running the test with following options:
Number of threads: 8
Report intermediate results every 5 second(s)
Initializing random number generator from current time

Initializing worker threads...

Threads started!

FATAL: PQexecPrepared() failed: 7 current transaction is aborted, commands ignored until end of transaction block
FATAL: `thread_run' function failed: /usr/share/sysbench/oltp_common.lua:405: SQL error, errno = 0, state = '25P02': current transaction is aborted, commands ignored until end of transaction block
FATAL: PQexecPrepared() failed: 7 current transaction is aborted, commands ignored until end of transaction block
FATAL: `thread_run' function failed: /usr/share/sysbench/oltp_common.lua:405: SQL error, errno = 0, state = '25P02': current transaction is aborted, commands ignored until end of transaction block
FATAL: PQexecPrepared() failed: 7 current transaction is aborted, commands ignored until end of transaction block
FATAL: `thread_run' function failed: /usr/share/sysbench/oltp_common.lua:405: SQL error, errno = 0, state = '25P02': current transaction is aborted, commands ignored until end of transaction block
FATAL: PQexecPrepared() failed: 7 current transaction is aborted, commands ignored until end of transaction block
FATAL: `thread_run' function failed: /usr/share/sysbench/oltp_common.lua:405: SQL error, errno = 0, state = '25P02': current transaction is aborted, commands ignored until end of transaction block
FATAL: PQexecPrepared() failed: 7 current transaction is aborted, commands ignored until end of transaction block
FATAL: `thread_run' function failed: /usr/share/sysbench/oltp_common.lua:405: SQL error, errno = 0, state = '25P02': current transaction is aborted, commands ignored until end of transaction block
FATAL: PQexecPrepared() failed: 7 current transaction is aborted, commands ignored until end of transaction block
FATAL: `thread_run' function failed: /usr/share/sysbench/oltp_common.lua:405: SQL error, errno = 0, state = '25P02': current transaction is aborted, commands ignored until end of transaction block
FATAL: PQexecPrepared() failed: 7 current transaction is aborted, commands ignored until end of transaction block
FATAL: `thread_run' function failed: /usr/share/sysbench/oltp_common.lua:405: SQL error, errno = 0, state = '25P02': current transaction is aborted, commands ignored until end of transaction block
FATAL: PQexecPrepared() failed: 7 current transaction is aborted, commands ignored until end of transaction block
FATAL: `thread_run' function failed: /usr/share/sysbench/oltp_common.lua:405: SQL error, errno = 0, state = '25P02': current transaction is aborted, commands ignored until end of transaction block

Proxy Log

[ERROR] 23:46:44.910 [pool-19-thread-1] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:143)
at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:132)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.impl.ProxyPreparedStatementExecutorCallback.execute(ProxyPreparedStatementExecutorCallback.java:41)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:73)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:66)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:44)
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:101)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.parallelExecute(ExecutorEngine.java:97)
at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.execute(ExecutorEngine.java:82)
at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:65)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.ProxyJDBCExecutor.execute(ProxyJDBCExecutor.java:63)
at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.useDriverToExecute(ProxySQLExecutor.java:163)
at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:123)
at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:112)
at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.doExecute(ProxyLockEngine.java:103)
at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.execute(ProxyLockEngine.java:81)
at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:98)
at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.binary.bind.PostgreSQLComBindExecutor.execute(PostgreSQLComBindExecutor.java:88)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:94)
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)
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "sbtest1_6_pkey"
Detail: Key (id)=(9166) already exists.
... 32 common frames omitted