You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/06/04 02:46:20 UTC
[GitHub] [shardingsphere] LateAutumnWindow opened a new issue #10649: 整合Seata事务时无法取到分片SQL
LateAutumnWindow opened a new issue #10649:
URL: https://github.com/apache/shardingsphere/issues/10649
我也很想贡献一些东西但是不知道从哪里入手。在整合Seata的时候遇到了一些问题这个问题很长时间了。
**我的框架是**
1. SpringCloudAlibaba 2.1.4.RELEASE
2. SpringCloud Greenwich.SR6
3. SpringBoot 2.1.13.RELEASE
4. Seata 1.3.0
5. ShardingSphere 4.1.1
6. Nacos 1.4.1
7. MyBatis 2.0.0
**我的数据库表结构**
ds0
account_0
storage_0
t_order_0
t_order_1
undo_log
ds1
account_0
storage_0
t_order_0
t_order_1
undo_log
**我的分库分表配置**
sharding:
default-database-strategy:
inline:
sharding-column: user_id
algorithm-expression: ds$->{user_id % 2}
binding-tables: t_order
broadcast-tables: storage_0,account_0
tables:
t_order:
actual-data-nodes: ds$->{0..1}.t_order_$->{0..1}
table-strategy:
inline:
sharding-column: order_id
algorithm-expression: t_order_$->{order_id % 2}
key-generator:
column: order_id
type: SNOWFLAKE
**问题**
account_0,storage_0 这两张是广播表可以正常插入事务信息到UNDO_LOG表中 可是 t_order 插入不了,跟踪 DEBUG 一直到org.apache.ibatis.executor.statement.BaseStatementHandler 的方法中
protected BaseStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameterObject, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) {
this.configuration = mappedStatement.getConfiguration();
this.executor = executor;
this.mappedStatement = mappedStatement;
this.rowBounds = rowBounds;
this.typeHandlerRegistry = configuration.getTypeHandlerRegistry();
this.objectFactory = configuration.getObjectFactory();
if (boundSql == null) { // issue #435, get the key before calculating the statement
generateKeys(parameterObject);
boundSql = mappedStatement.getBoundSql(parameterObject);
}
this.boundSql = boundSql;
this.parameterHandler = configuration.newParameterHandler(mappedStatement, parameterObject, boundSql);
this.resultSetHandler = configuration.newResultSetHandler(executor, mappedStatement, rowBounds, parameterHandler,
resultHandler, boundSql);
}
这里给出的 boundSql 是MyBatis中的这个SQL 并不是分片后的
<insert id="createOrder" parameterType="com.yan.cloud.pojo.Order">
INSERT INTO t_order (
`user_id`,
`commodity_code`,
`count`,
`money`,
`order_id`
)
VALUES
( #{userId}, #{commodityCode}, #{count}, #{money}, #{orderId});
</insert>
我想这里应该给的是分片后的
INSERT INTO ds0.t_order_0 ( `user_id`, `commodity_code`, `count`, `money`, `order_id` )
VALUES ( #{userId}, #{commodityCode}, #{count}, #{money}, #{orderId});
--
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:
users@infra.apache.org
[GitHub] [shardingsphere] LateAutumnWindow commented on issue #10649: Unable to get partitioned SQL when integrating Seata transaction
Posted by GitBox <gi...@apache.org>.
LateAutumnWindow commented on issue #10649:
URL: https://github.com/apache/shardingsphere/issues/10649#issuecomment-854328662
> @LateAutumnWindow For English only, please translate the issue to English first.
Can you help me see what the problem is
--
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:
users@infra.apache.org
[GitHub] [shardingsphere] menghaoranss commented on issue #10649: 整合Seata事务时无法取到分片SQL
Posted by GitBox <gi...@apache.org>.
menghaoranss commented on issue #10649:
URL: https://github.com/apache/shardingsphere/issues/10649#issuecomment-854321244
@LateAutumnWindow For English only, please translate the issue to English first.
--
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:
users@infra.apache.org
[GitHub] [shardingsphere] LateAutumnWindow commented on issue #10649: Unable to get partitioned SQL when integrating Seata transaction
Posted by GitBox <gi...@apache.org>.
LateAutumnWindow commented on issue #10649:
URL: https://github.com/apache/shardingsphere/issues/10649#issuecomment-854328662
> @LateAutumnWindow For English only, please translate the issue to English first.
Can you help me see what the problem is
--
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:
users@infra.apache.org
[GitHub] [shardingsphere] menghaoranss commented on issue #10649: 整合Seata事务时无法取到分片SQL
Posted by GitBox <gi...@apache.org>.
menghaoranss commented on issue #10649:
URL: https://github.com/apache/shardingsphere/issues/10649#issuecomment-854321244
@LateAutumnWindow For English only, please translate the issue to English first.
--
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:
users@infra.apache.org
[GitHub] [shardingsphere] terrymanu closed issue #10649: Unable to get partitioned SQL when integrating Seata transaction
Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #10649:
URL: https://github.com/apache/shardingsphere/issues/10649
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] terrymanu commented on issue #10649: Unable to get partitioned SQL when integrating Seata transaction
Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #10649:
URL: https://github.com/apache/shardingsphere/issues/10649#issuecomment-927263944
The seata version of ShardingSphere is 1.0.0, it is better to upgrade the version, please see #12739.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org