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
Added oracle database support #902
Conversation
Now the com/alibaba/fescar is changed to io/seata |
thanks.could you do us a favor?the package name and copyright need to be updated. |
pom.xml
Outdated
<repository> | ||
<id>openSource</id> | ||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> | ||
<id>releases</id> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the following:
<distributionManagement>
<snapshotRepository>
<id>oss_seata</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
…lop_seata_oracle # Conflicts: # pom.xml # rm-datasource/src/main/java/io/seata/rm/datasource/ConnectionProxy.java # rm-datasource/src/main/java/io/seata/rm/datasource/DataSourceManager.java # rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java # rm-datasource/src/main/java/io/seata/rm/datasource/sql/SQLVisitorFactory.java # rm-datasource/src/main/java/io/seata/rm/datasource/undo/KeywordCheckerFactory.java # rm-datasource/src/main/java/io/seata/rm/datasource/undo/UndoExecutorFactory.java # server/src/main/resources/registry.conf
rm-datasource/src/main/java/io/seata/rm/datasource/undo/UndoExecutorFactory.java
Outdated
Show resolved
Hide resolved
@@ -36,6 +36,8 @@ | |||
public static KeywordChecker getKeywordChecker(String dbType) { | |||
if (dbType.equals(JdbcConstants.MYSQL)) { | |||
return MySQLKeywordChecker.getInstance(); | |||
} else if (dbType.equals(JdbcConstants.ORACLE)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe using switch here makes things more readable - I guess there will be even more types in the future.
/** | ||
* The type Table meta cache. | ||
*/ | ||
public class TableMetaCacheOracle { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is only used by the new undo manager, but the BaseTransactionalExecutor
still uses the default TableMetaCache
.
Additionally the resultSetMetaToSchema
method already contains parts for "H2 drivers" and other stuff. So I would think of having additional Oracle stuff in the already existing TableMetaCache
instead of inventing another class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我觉得还是在BaseTransactionalExecutor 这里加比较好。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but why does this class then contain some "H2 driver" parts? I mean this class is for Oracle only, right?
(see line 281)
@@ -66,7 +66,19 @@ public static SQLRecognizer get(String sql, String dbType) { | |||
recognizer = new MySQLSelectForUpdateRecognizer(sql, ast); | |||
} | |||
} | |||
} else { | |||
} else if (JdbcConstants.ORACLE.equalsIgnoreCase(dbType)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if equalsIgnoreCase
is really required here. Otherwise a switch statement would be a better solution.
@@ -184,7 +185,11 @@ private void processGlobalTransactionCommit() throws SQLException { | |||
|
|||
try { | |||
if (context.hasUndoLog()) { | |||
UndoLogManager.flushUndoLogs(this); | |||
if(JdbcConstants.ORACLE.equalsIgnoreCase(this.getDbType())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe some factory class should take care of returning an undo manager. Otherwise you will have this kind of logic at several places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
io.seata.rm.datasource.undo.*; is a wrong type
@@ -184,7 +185,11 @@ private void processGlobalTransactionCommit() throws SQLException { | |||
|
|||
try { | |||
if (context.hasUndoLog()) { | |||
UndoLogManager.flushUndoLogs(this); | |||
if(JdbcConstants.ORACLE.equalsIgnoreCase(this.getDbType())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
io.seata.rm.datasource.undo.*; is a wrong type
import io.seata.rm.datasource.sql.struct.TableMeta; | ||
import io.seata.rm.datasource.sql.struct.TableMetaCache; | ||
import io.seata.rm.datasource.sql.struct.TableRecords; | ||
import io.seata.rm.datasource.sql.struct.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- is a wrong type
pom.xml
Outdated
<repository> | ||
<id>openSource</id> | ||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> | ||
<id>releases</id> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the following:
<distributionManagement>
<snapshotRepository>
<id>oss_seata</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
Codecov Report
@@ Coverage Diff @@
## develop #902 +/- ##
=============================================
- Coverage 48.32% 45.76% -2.57%
Complexity 1653 1653
=============================================
Files 333 343 +10
Lines 11669 12322 +653
Branches 1448 1549 +101
=============================================
Hits 5639 5639
- Misses 5401 6053 +652
- Partials 629 630 +1
Continue to review full report at Codecov.
|
BaseTransactionalExecutor冲突解决了 |
server/src/main/resources/file.conf
Outdated
@@ -28,7 +28,7 @@ transport { | |||
} | |||
service { | |||
#vgroup->rgroup | |||
vgroup_mapping.my_test_tx_group = "default" | |||
vgroup_mapping.txServiceGroup = "default" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For metadata problems that must use the uppercase table name to get the oracle database, it is recommended to convert directly to uppercase.
rm-datasource/src/main/java/io/seata/rm/datasource/DataSourceManager.java
Outdated
Show resolved
Hide resolved
bug都修改完成了。 @slievrly |
rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/TableMetaCacheOracle.java
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/TableMetaCacheOracle.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/TableMetaCacheOracle.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/TableMetaCacheOracle.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/TableMetaCacheOracle.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/TableMetaCacheOracle.java
Outdated
Show resolved
Hide resolved
server/src/main/resources/file.conf
Outdated
@@ -76,7 +76,6 @@ store { | |||
datasource = "dbcp" | |||
## mysql/oracle/h2/oceanbase etc. | |||
db-type = "mysql" | |||
driver-class-name = "com.mysql.jdbc.Driver" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
重新提一次pr,和#649 的一样。