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 2 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
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