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

1.8.0版本XA模式如何支持达梦数据库 #6367

Open
1 task
wuchaococo opened this issue Feb 21, 2024 · 10 comments
Open
1 task

1.8.0版本XA模式如何支持达梦数据库 #6367

wuchaococo opened this issue Feb 21, 2024 · 10 comments

Comments

@wuchaococo
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

1.8.0版本XA模式如何支持达梦数据库,以及其它支持XA的数据库

Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

Just paste your stack trace here!

Ⅲ. Describe what you expected to happen

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. xxx
  2. xxx
  3. xxx

Minimal yet complete reproducer code (or URL to code):

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • JDK version(e.g. java -version):
  • Seata client/server version:
  • Database version:
  • OS(e.g. uname -a):
  • Others:
@leizhiyuan
Copy link
Contributor

check #3672

now it is at mode

@wuchaococo
Copy link
Author

check #3672

now it is at mode

XA模式如何支持

@funky-eyes
Copy link
Contributor

check #3672
now it is at mode

XA模式如何支持

Can I submit a supported pr and you can help me to test it? Because I don't have a dameng database environment

@wuchaococo
Copy link
Author

check #3672
now it is at mode

XA模式如何支持

Can I submit a supported pr and you can help me to test it? Because I don't have a dameng database environment

public static XAConnection createXAConnection(Connection physicalConn, Driver driver, String dbType) throws SQLException {
if (JdbcConstants.MYSQL.equals(dbType)) {
return MySqlUtils.createXAConnection(driver, physicalConn);
} else {
switch (dbType) {
case JdbcConstants.ORACLE:
try {
// alibaba/druid#3707
// before Druid issue fixed, just make ORACLE XA connection in my way.
// return OracleUtils.OracleXAConnection(physicalConn);
String physicalConnClassName = physicalConn.getClass().getName();
if ("oracle.jdbc.driver.T4CConnection".equals(physicalConnClassName)) {
return createOracleXAConnection(physicalConn, "oracle.jdbc.driver.T4CXAConnection");
} else {
return createOracleXAConnection(physicalConn, "oracle.jdbc.xa.client.OracleXAConnection");
}
} catch (XAException xae) {
throw new SQLException("create xaConnection error", xae);
}
case JdbcConstants.MARIADB:
return new MariaXaConnection((MariaDbConnection)physicalConn);
case JdbcConstants.POSTGRESQL:
return PGUtils.createXAConnection(physicalConn);
default:
throw new SQLException("xa not support dbType: " + dbType);
}
}
}
这里没有考虑dameng数据库,如果dameng数据库需要使用XA模式应该如何处理

@funky-eyes
Copy link
Contributor

如果你读懂了这些代码的意思,并且知道dameng如何创建xaconnection,你就可以提交一个pr来进行支持,比如你可以参考mariadbdb是如何被支持的
If you read and understand what the code means, and know how dameng creates xaconnection, you can submit a pr for support, for example you can refer to how mariadbdb is supported

@wuchaococo
Copy link
Author

如果你读懂了这些代码的意思,并且知道dameng如何创建xaconnection,你就可以提交一个pr来进行支持,比如你可以参考mariadbdb是如何被支持的 If you read and understand what the code means, and know how dameng creates xaconnection, you can submit a pr for support, for example you can refer to how mariadbdb is supported

代码没有问题,我是希望SEATA可以留有扩展点,用于自行实现,而不是这样固定代码

@funky-eyes
Copy link
Contributor

如果你读懂了这些代码的意思,并且知道dameng如何创建xaconnection,你就可以提交一个pr来进行支持,比如你可以参考mariadbdb是如何被支持的 If you read and understand what the code means, and know how dameng creates xaconnection, you can submit a pr for support, for example you can refer to how mariadbdb is supported

代码没有问题,我是希望SEATA可以留有扩展点,用于自行实现,而不是这样固定代码

You are welcome to submit a pr to transform createxaconnection into an extended implementation by way of spi.

@funky-eyes
Copy link
Contributor

The spi may have to consider how different database implementations can be common, for example, sqlserver does not support building xaconnection through the connection of a normal datasource, it can only create xaconnection by building xadatasource.

@wuchaococo
Copy link
Author

The spi may have to consider how different database implementations can be common, for example, sqlserver does not support building xaconnection through the connection of a normal datasource, it can only create xaconnection by building xadatasource.

扩展可以保留吧,是否可以再更高层进行扩展,而不是在util中进行处理

@funky-eyes
Copy link
Contributor

You can look at seata's xa implementation, in fact, there are not many extensible points, because the final implementation of xa for each database has some deviation, such as oracle and mysql are different, mysql high version relative to the current mariadb and different, in the first stage and second stage processing is also different, which in the adaption of a more messy, not very easy to carry out a unified abstraction
你可以看下seata的xa实现,实际上可扩展的点并不多,因为每个数据库的xa最终的实现上都有一些偏差,比如oracle和mysql就不同,mysql高版本相对当前的mariadb又有不同,在一阶段和二阶段处理上也有不同,这在适配上比较凌乱,不太容易进行统一抽象

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants