yanghaoyu opened a new issue #12249:
URL: https://github.com/apache/shardingsphere/issues/12249
### Which version of ShardingSphere did you use?
master branch(5.0.0-RC1)
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
### Expected behavior
create CREDENTIAL table successfully, in actual table,this is four table on
mysql server
### Actual behavior
o.a.s.p.f.c.CommandExecutorTask - Exception
occur:com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
Can't write; duplicate key in table 'credential_1'
### Reason analyze (If you can)
The foreign key name was not changed when the table was split
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
```
schemaName: test
dataSources:
ds_0:
url: jdbc:mysql://db:3306/test?useSSL=false
username: root
password: root
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
rules:
- !SHARDING
tables:
CREDENTIAL:
actualDataNodes: ds_0.CREDENTIAL_${0..3}
tableStrategy:
standard:
shardingColumn: ID
shardingAlgorithmName: credential_inline
defaultDatabaseStrategy:
none:
defaultTableStrategy:
none:
bindingTables:
- CREDENTIAL
shardingAlgorithms:
credential_inline:
type: INLINE
props:
algorithm-expression: CREDENTIAL_${Math.abs(ID.hashCode() % 4)}
keyGenerators:
snowflake:
type: SNOWFLAKE
props:
worker-id: 123
```
Create database statement is
CREATE TABLE `CREDENTIAL` (
`ID` varchar(36) NOT NULL,
`SALT` tinyblob,
`TYPE` varchar(255) DEFAULT NULL,
`USER_ID` varchar(36) DEFAULT NULL,
`CREATED_DATE` bigint(20) DEFAULT NULL,
`USER_LABEL` varchar(255) DEFAULT NULL,
`SECRET_DATA` longtext,
`CREDENTIAL_DATA` longtext,
`PRIORITY` int(11) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `IDX_USER_CREDENTIAL` (`USER_ID`),
CONSTRAINT `FK_PFYR0GLASQYL0DEI3KL69R6V0` FOREIGN KEY (`USER_ID`)
REFERENCES `USER_ENTITY` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
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]