Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: fix XA transaction start exception and rollback failure #5810

Merged
merged 4 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/en-us/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ The version is updated as follows:
- [[#5745](https://github.com/seata/seata/pull/5745)] fix the problem that the parameter prefix requirement of the setAttachment method in sofa-rpc is not met
- [[#5772](https://github.com/seata/seata/pull/5762)] change some fields type of TableMetaCache to avoid integer overflow
- [[#5787](https://github.com/seata/seata/pull/5794)] Solution cluster cannot be customized when redis serves as the registry
- [[#5810](https://github.com/seata/seata/pull/5810)] fix XA transaction start exception and rollback failure caused by druid dependency conflict

### optimize:
- [[#5208](https://github.com/seata/seata/pull/5208)] optimize throwable getCause once more
Expand Down
1 change: 1 addition & 0 deletions changes/zh-cn/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [[#5745](https://github.com/seata/seata/pull/5745)] 修复不满足 sofa-rpc 中 setAttachment 方法的参数前缀要求问题
- [[#5772](https://github.com/seata/seata/pull/5762)] 修复TableMetaCache的一些字段类型,避免溢出
- [[#5787](https://github.com/seata/seata/pull/5794)] 解决redis作为注册中心时cluster无法自定义的BUG
- [[#5810](https://github.com/seata/seata/pull/5810)] 修复druid依赖冲突导致的XA事务开始异常与回滚失败

### optimize:
- [[#5208](https://github.com/seata/seata/pull/5208)] 优化多次重复获取Throwable#getCause问题
Expand Down
117 changes: 116 additions & 1 deletion core/src/main/java/io/seata/core/constants/DBType.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,122 @@ public enum DBType {
/**
* Maria db type.
*/
MARIADB;
MARIADB,

/**
* JTDS db type.
*/
JTDS,

/**
* HyperSQL db type.
*/
HSQL,

/**
* Sybase db type.
*/
SYBASE,

/**
* Derby db type.
*/
DERBY,

/**
* HBase db type.
*/
HBASE,

/**
* Hive db type.
*/
HIVE,

/**
* DM db type.
*/
DM,

/**
* Kingbase db type.
*/
KINGBASE,

/**
* GBase db type.
*/
GBASE,

/**
* Xugu db type.
*/
XUGU,

/**
* OceanBase_Oracle db type.
*/
OCEANBASE_ORACLE,

/**
* Informix db type.
*/
INFORMIX,

/**
* ODPS db type.
*/
ODPS,

/**
* Teradata db type.
*/
TERADATA,

/**
* Log4jdbc db type.
*/
LOG4JDBC,

/**
* Phoenix db type.
*/
PHOENIX,

/**
* EDB db type.
*/
EDB,

/**
* Kylin db type.
*/
KYLIN,

/**
* Presto db type.
*/
PRESTO,

/**
* Elasticsearch db type.
*/
ELASTIC_SEARCH,

/**
* ClickHouse db type.
*/
CLICKHOUSE,

/**
* kdb db type.
*/
KDB,

/**
* PolarDB db type.
*/
POLARDB;

/**
* Valueof db type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static void initDataSourceResource(BaseDataSourceResource dataSourceResou
dataSourceResource.setResourceId(buildResourceId(jdbcUrl));
String driverClassName = com.alibaba.druid.util.JdbcUtils.getDriverClassName(jdbcUrl);
dataSourceResource.setDriver(loadDriver(driverClassName));
dataSourceResource.setDbType(com.alibaba.druid.util.JdbcUtils.getDbType(jdbcUrl, driverClassName));
dataSourceResource.setDbType(JdbcUtils.getDbType(jdbcUrl));
} catch (SQLException e) {
throw new IllegalStateException("can not init DataSourceResource with " + dataSource, e);
}
Expand All @@ -84,7 +84,7 @@ public static void initXADataSourceResource(BaseDataSourceResource dataSourceRes
dataSourceResource.setResourceId(buildResourceId(jdbcUrl));
String driverClassName = com.alibaba.druid.util.JdbcUtils.getDriverClassName(jdbcUrl);
dataSourceResource.setDriver(loadDriver(driverClassName));
dataSourceResource.setDbType(com.alibaba.druid.util.JdbcUtils.getDbType(jdbcUrl, driverClassName));
dataSourceResource.setDbType(JdbcUtils.getDbType(jdbcUrl));
} finally {
if (xaConnection != null) {
xaConnection.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;

import com.alibaba.druid.util.JdbcConstants;
import io.seata.common.DefaultValues;
import io.seata.common.util.StringUtils;
import io.seata.config.ConfigurationFactory;
Expand All @@ -32,6 +31,7 @@
import io.seata.rm.BaseDataSourceResource;
import io.seata.rm.DefaultResourceManager;
import io.seata.rm.datasource.util.SeataXAResource;
import io.seata.sqlparser.util.JdbcConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* @author ggndnn
*/
public interface JdbcConstants {

String ORACLE = "oracle";

String MYSQL = "mysql";
Expand All @@ -32,4 +33,54 @@ public interface JdbcConstants {
String POSTGRESQL = "postgresql";

String SQLSERVER = "sqlserver";

String JTDS = "jtds";

String HSQL = "hsql";

String SYBASE = "sybase";

String DERBY = "derby";

String HBASE = "hbase";

String HIVE = "hive";

String DM = "dm";

String KINGBASE = "kingbase";

String GBASE = "gbase";

String XUGU = "xugu";

String OCEANBASE = "oceanbase";

String OCEANBASE_ORACLE = "oceanbase_oracle";

String INFORMIX = "informix";

String ODPS = "odps";

String TERADATA = "teradata";

String LOG4JDBC = "log4jdbc";

String PHOENIX = "phoenix";

String EDB = "edb";

String KYLIN = "kylin";

String SQLITE = "sqlite";

String PRESTO = "presto";

String ELASTIC_SEARCH = "elastic_search";

String CLICKHOUSE = "clickhouse";

String KDB = "kdb";

String POLARDB = "polardb";
}
Loading