110117 opened a new issue, #19517:
URL: https://github.com/apache/shardingsphere/issues/19517
Shardingsphere-JDBC version is 5.0.0
Seata version is 1.4.2
sharding.yml
```yml
spring:
shardingsphere:
mode:
type: Standalone
repository:
type: File
props:
path: ${spring.application.workdir}/.shardingsphere
overwrite: true
datasource:
names: master0,master0slave0,master1,master1slave0
master0:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: org.postgresql.Driver
url:
jdbc:postgresql://192.168.1.16:5432/platform-osm?stringtype=unspecified
username: postgres
password: postgres
master0slave0: # only read
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: org.postgresql.Driver
url:
jdbc:postgresql://192.168.1.17:5432/platform?stringtype=unspecified
username: postgres
password: postgres
master1:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: org.postgresql.Driver
url:
jdbc:postgresql://192.168.1.18:5432/platform?stringtype=unspecified
username: postgres
password: postgres
master1slave0: # only read
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: org.postgresql.Driver
url:
jdbc:postgresql://192.168.1.19:5432/platform?stringtype=unspecified
username: postgres
password: postgres
props:
sql-show: true
rules:
readwrite-splitting:
load-balancers:
round-robin:
type: ROUND_ROBIN
data-sources:
ds-0:
write-data-source-name: master0
read-data-source-names: master0slave0
load-balancer-name: round-robin
ds-1:
write-data-source-name: master1
read-data-source-names: master1slave0
load-balancer-name: round-robin
sharding:
key-generators:
snowflake:
type: SNOWFLAKE
props:
worker-id: ${random.int[0,1023]}
sharding-algorithms:
database-inline:
type: INLINE
props:
algorithm-expression: ds-$->{user_id % 2}
bill-inline:
type: INLINE
props:
algorithm-expression: bill_$->{cost_id % 5}
bill-log-inline:
type: INLINE
props:
algorithm-expression: bill_log_$->{bid % 5}
binding-tables:
- bill,bill_state_log
broadcast-tables:
#分库策略
default-database-strategy:
standard:
sharding-column: user_id
sharding-algorithm-name: database-inline
tables:
chain_bill:
actual-data-nodes: ds-$->{0..1}.bill_$->{0..4}
key-generate-strategy:
column: bid
key-generator-name: snowflake
table-strategy:
standard:
sharding-column: cost_id
sharding-algorithm-name: bill-inline
chain_bill_state_log:
actual-data-nodes: ds-$->{0..1}.bill_log_$->{0..4}
key-generate-strategy:
column: log_id
key-generator-name: snowflake
table-strategy:
standard:
sharding-column: bid
sharding-algorithm-name: bill-log-inline
```
seata.yml
``` seata.yml
seata:
enabled: true
application-id: coor-test
tx-service-group: test_tx_group #定义事务分组
data-source-proxy-mode: AT
enable-auto-data-source-proxy: false
use-jdk-proxy: false
registry:
type: nacos
nacos:
application: seata-server
server-addr: ${spring.cloud.nacos.discovery.server-addr}
username: ${spring.cloud.nacos.discovery.username}
password: ${spring.cloud.nacos.discovery.password}
namespace: ${spring.cloud.nacos.discovery.namespace}
group: DEFAULT_GROUP
config:
type: file
service:
vgroup-mapping:
king_tx_group: default
enable-degrade: false
disable-global-transaction: false
client:
rm:
async-commit-buffer-limit: 10000
report-retry-count: 5
table-meta-check-enable: false
report-success-enable: false
saga-branch-register-enable: false
saga-json-parser: fastjson
saga-retry-persist-mode-update: false
saga-compensate-persist-mode-update: false
lock:
retry-interval: 10
retry-times: 30
retry-policy-branch-rollback-on-conflict: true
tm:
commit-retry-count: 5
rollback-retry-count: 5
default-global-transaction-timeout: 60000
degrade-check: false
degrade-check-period: 2000
degrade-check-allow-times: 10
undo:
data-validation: true
log-serialization: jackson
log-table: undo_log
only-care-update-columns: true
compress:
enable: true
type: zip
threshold: 64k
load-balance:
type: RandomLoadBalance
virtual-nodes: 10
transport:
shutdown:
wait: 3
thread-factory:
boss-thread-prefix: NettyBoss
worker-thread-prefix: NettyServerNIOWorker
server-executor-thread-prefix: NettyServerBizHandler
share-boss-worker: false
client-selector-thread-prefix: NettyClientSelector
client-selector-thread-size: 1
client-worker-thread-prefix: NettyClientWorkerThread
worker-thread-size: default
boss-thread-size: 1
type: TCP
server: NIO
heartbeat: true
serialization: seata
compressor: none
enable-client-batch-send-request: true
log:
exception-rate: 100
```
seata.conf
```seata.conf
sharding.transaction.seata.at.enable = true
client {
application.id = coor-test
transaction.service.group = test_tx_group
}
```
```error
2022-07-24 11:41:36.857 INFO [appName=coor-test,traceId=,spanId=]
io.seata.core.rpc.processor.client.RmUndoLogProcessor - rm handle undo log
process:UndoLogDeleteRequest{resourceId='jdbc:postgresql://192.168.1.16:5432/postgres',
saveDays=7, branchType=AT}
2022-07-24 11:41:36.858 INFO [appName=coor-test,traceId=,spanId=]
io.seata.core.rpc.processor.client.RmUndoLogProcessor - rm handle undo log
process:UndoLogDeleteRequest{resourceId='jdbc:postgresql://192.168.1.17:5432/postgres',
saveDays=7, branchType=AT}
2022-07-24 11:41:36.861 INFO [appName=coor-test,traceId=,spanId=]
io.seata.core.rpc.processor.client.RmUndoLogProcessor - rm handle undo log
process:UndoLogDeleteRequest{resourceId='jdbc:postgresql://192.168.1.18:5432/postgres',
saveDays=7, branchType=AT}
2022-07-24 11:41:36.861 INFO [appName=coor-test,traceId=,spanId=]
io.seata.core.rpc.processor.client.RmUndoLogProcessor - rm handle undo log
process:UndoLogDeleteRequest{resourceId='jdbc:postgresql://192.168.1.19:5432/postgres',
saveDays=7, branchType=AT}
2022-07-24 11:41:36.881 ERROR [appName=coor-test,traceId=,spanId=]
io.seata.rm.RMHandlerAT - Failed to delete expired undo_log, error:ERROR:
cannot execute DELETE in a read-only transaction
org.postgresql.util.PSQLException: ERROR: cannot execute DELETE in a
read-only transaction
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:354)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:484)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:404)
at
org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:162)
at
org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:130)
at
com.alibaba.druid.pool.DruidPooledPreparedStatement.executeUpdate(DruidPooledPreparedStatement.java:255)
at
io.seata.rm.datasource.undo.postgresql.PostgresqlUndoLogManager.deleteUndoLogByLogCreated(PostgresqlUndoLogManager.java:59)
at io.seata.rm.RMHandlerAT.handle(RMHandlerAT.java:59)
at io.seata.rm.DefaultRMHandler.handle(DefaultRMHandler.java:73)
at
io.seata.core.protocol.transaction.UndoLogDeleteRequest.handle(UndoLogDeleteRequest.java:70)
at io.seata.rm.AbstractRMHandler.onRequest(AbstractRMHandler.java:150)
at
io.seata.core.rpc.processor.client.RmUndoLogProcessor.handleUndoLogDelete(RmUndoLogProcessor.java:56)
at
io.seata.core.rpc.processor.client.RmUndoLogProcessor.process(RmUndoLogProcessor.java:51)
at
io.seata.core.rpc.netty.AbstractNettyRemoting.lambda$processMessage$2(AbstractNettyRemoting.java:279)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
2022-07-24 11:41:36.881 ERROR [appName=coor-test,traceId=,spanId=]
io.seata.rm.RMHandlerAT - Failed to delete expired undo_log, error:ERROR:
cannot execute DELETE in a read-only transaction
org.postgresql.util.PSQLException: ERROR: cannot execute DELETE in a
read-only transaction
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:354)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:484)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:404)
at
org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:162)
at
org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:130)
at
com.alibaba.druid.pool.DruidPooledPreparedStatement.executeUpdate(DruidPooledPreparedStatement.java:255)
at
io.seata.rm.datasource.undo.postgresql.PostgresqlUndoLogManager.deleteUndoLogByLogCreated(PostgresqlUndoLogManager.java:59)
at io.seata.rm.RMHandlerAT.handle(RMHandlerAT.java:59)
at io.seata.rm.DefaultRMHandler.handle(DefaultRMHandler.java:73)
at
io.seata.core.protocol.transaction.UndoLogDeleteRequest.handle(UndoLogDeleteRequest.java:70)
at io.seata.rm.AbstractRMHandler.onRequest(AbstractRMHandler.java:150)
at
io.seata.core.rpc.processor.client.RmUndoLogProcessor.handleUndoLogDelete(RmUndoLogProcessor.java:56)
at
io.seata.core.rpc.processor.client.RmUndoLogProcessor.process(RmUndoLogProcessor.java:51)
at
io.seata.core.rpc.netty.AbstractNettyRemoting.lambda$processMessage$2(AbstractNettyRemoting.java:279)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
```
--
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.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]