-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
refactor: Restructure SQLRecognizer and UndoExecutor #1883
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1883 +/- ##
============================================
+ Coverage 55.3% 55.3% +<.01%
- Complexity 2388 2408 +20
============================================
Files 422 428 +6
Lines 14300 14318 +18
Branches 1702 1659 -43
============================================
+ Hits 7908 7918 +10
+ Misses 5678 5672 -6
- Partials 714 728 +14
|
Thanks for submitting again. |
It doesn't matter. That time, I accidentally messed up the code format locally, making the difference not easy to compare. Moreover, my change was later included in the PR of other developers. |
rm-datasource/src/main/java/io/seata/rm/datasource/sql/SQLRecognizerGroupFactory.java
Outdated
Show resolved
Hide resolved
@ggndnn please review together |
rm-datasource/src/main/java/io/seata/rm/datasource/sql/SQLRecognizerGroup.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/sql/SQLRecognizerGroup.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/undo/UndoExecutorFactory.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/sql/SQLRecognizerGroup.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/sql/druid/oracle/OracleRecognizerGroup.java
Outdated
Show resolved
Hide resolved
@CharmingRabbit Please link your git account email when submitting |
Thanks for the link! I've set it up |
@CharmingRabbit please move all |
This Ci error is caused by the rename of the class. I will solve it later |
removed |
rm-datasource/src/main/java/io/seata/rm/datasource/sql/druid/MySqlOperateRecognizerHolder.java
Outdated
Show resolved
Hide resolved
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
retry ci |
passed |
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
@CharmingRabbit Thank you for your contribution. |
Sorry, didn't notice this comment in time. |
|
<! -- make sure you have read and understood the contribution guide -- >
###I. describe what this PR has done
On the side of RM,
Add UndoExecutorGroupand and its corresponding factory. The UndoExecutorGroup interface abstracts executor that all kinds of databases need to provide (currently implemented by MySQL and Oracle)
Add SqlRecognizerGroup and its corresponding factory. SqlRecognizerGroup abstracts the recognizer (currently mqsql and Oracle) that all kinds of databases need to provide,
The benefits of this reconstruction are as follows:
Eliminate redundant code.
Enhance the scalability of the project (a new type of database can be added on RM side through resource configuration file)
When a new database type is to be added in the future, the capabilities it needs to provide will be roughly divided into three dimensions:
(1) extend AbstractUndoLogManager. (An existing abstraction provided in a previous PR,)
(2) implement UndoExecutorGroup.
(3) implement SQLRecognizerGroup.
To sum up, after refactoring, For the provider (the adaptation of each database type), will be defined and abstracted more clearly and cleanly; For the user (where to get the instance of executor or recognizer), it will be more convenient by calling factory methods directly.
###Does this request solve a problem?
<! -- if so, add "fixesාxxx" to the next line, for example, fixes97.
###III. why not add test cases (unit test / integration test)?
This PR is only for the adjustment of code structure, not involving the change of specific logic.
###IV. describe how to verify
It only adjusts the internal abstraction level and calling mode, without any specific logical changes. After pulling the latest code, test the official Seata demo project, and conduct overall verification.
###V. special notes for review
Note that in this submission, the two factories I provided (undoexecutor groupfactory and sqlrecognizergroupfactory) are the instances created directly by using the EnhancedServiceLoader to load specific implementation classes from the resource file,
This is mainly to consider: Although there are only two kinds of database adaptations now: mqsql and Oracle, in the future, when other developer expand other types of databases, they can directly add resource file to provide their implemention without changing the existing code.