kxw07 opened a new issue #11066:
URL: https://github.com/apache/shardingsphere/issues/11066
I was testing XA and use shardingsphere-jdbc-core,
shardingsphere-transaction-xa-core 5.0.0-beta
have a table in db
```sql
CREATE TABLE test_order (order_id bigint NOT NULL, user_id bigint DEFAULT
NULL, PRIMARY KEY(order_id)
```
And already have a row in table
order_id, user_id
123, 123
Then insert a row with same value (123, 123) again, there's no error in log.
I think it should show duplicate entry error.
```java
try (Connection conn = dataSource.getConnection()) { // connection auto
commit is true.
PreparedStatement ps = conn.prepareStatement("INSERT INTO test_order
(order_id, user_id) VALUES (?, ?)");
ps.setLong(1, 123L);
ps.setLong(2, 123L);
ps.execute();
}
```
Here is my yaml
```yaml
dataSources:
ds_0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
jdbcUrl: jdbc:mysql://localhost:3316/java_course
username: root
password:
ds_1:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
jdbcUrl: jdbc:mysql://localhost:3336/java_course
username: root
password:
rules:
- !SHARDING
tables:
test_order:
actualDataNodes: ds_${0..1}.test_order_${0..15}
tableStrategy:
standard:
shardingColumn: order_id
shardingAlgorithmName: table_inline
keyGenerateStrategy:
column: order_id
keyGeneratorName: snowflake
defaultDatabaseStrategy:
standard:
shardingColumn: user_id
shardingAlgorithmName: database_inline
defaultTableStrategy:
none:
shardingAlgorithms:
database_inline:
type: INLINE
props:
algorithm-expression: ds_${user_id % 2}
table_inline:
type: INLINE
props:
algorithm-expression: test_order_${order_id % 16}
keyGenerators:
snowflake:
type: SNOWFLAKE
props:
worker-id: 123
props:
sql-show: true
```
--
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]