TeslaCN opened a new issue #10273:
URL: https://github.com/apache/shardingsphere/issues/10273


   ## 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`.
   ```bash
   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
   ```
   


-- 
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:
[email protected]


Reply via email to