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

refactor: log store sql with spi #2369

Merged
merged 18 commits into from
Apr 8, 2020

Conversation

l81893521
Copy link
Contributor

Ⅰ. Describe what this PR did

refactor log store sqls with spi

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@l81893521 l81893521 added the Do Not Merge Do not merge into develop label Mar 6, 2020
@codecov-io
Copy link

codecov-io commented Mar 6, 2020

Codecov Report

Merging #2369 into develop will increase coverage by 0.30%.
The diff coverage is 90.74%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #2369      +/-   ##
=============================================
+ Coverage      51.36%   51.66%   +0.30%     
- Complexity      2663     2686      +23     
=============================================
  Files            529      535       +6     
  Lines          16983    16932      -51     
  Branches        2051     2027      -24     
=============================================
+ Hits            8723     8748      +25     
+ Misses          7432     7372      -60     
+ Partials         828      812      -16     
Impacted Files Coverage Δ Complexity Δ
...ata/core/store/db/sql/log/LogStoreSqlsFactory.java 57.14% <57.14%> (ø) 2.00 <2.00> (?)
...a/server/storage/db/store/LogStoreDataBaseDAO.java 71.76% <84.61%> (ø) 34.00 <9.00> (ø)
...ta/core/store/db/sql/log/AbstractLogStoreSqls.java 100.00% <100.00%> (ø) 10.00 <10.00> (?)
...io/seata/core/store/db/sql/log/H2LogStoreSqls.java 100.00% <100.00%> (ø) 1.00 <1.00> (?)
...seata/core/store/db/sql/log/MysqlLogStoreSqls.java 100.00% <100.00%> (ø) 7.00 <7.00> (?)
...a/core/store/db/sql/log/OceanbaseLogStoreSqls.java 100.00% <100.00%> (ø) 1.00 <1.00> (?)
...eata/core/store/db/sql/log/OracleLogStoreSqls.java 100.00% <100.00%> (ø) 7.00 <7.00> (?)
.../core/store/db/sql/log/PostgresqlLogStoreSqls.java 100.00% <100.00%> (ø) 7.00 <7.00> (?)
...zer/seata/protocol/AbstractResultMessageCodec.java 67.74% <0.00%> (-7.26%) 5.00% <0.00%> (ø%)
...java/io/seata/server/AbstractTCInboundHandler.java 1.21% <0.00%> (-0.77%) 1.00% <0.00%> (-1.00%)
... and 13 more

@zjinlei zjinlei changed the title optimize: Refactor log store sql with spi refactor: log store sql with spi Mar 7, 2020
* @author will
*/
@LoadLevel(name = "oceanbase")
public class OceanbaseLogStoreSqls extends MysqlLogStoreSqls {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why here inherit mysql?,This will lead to a strong correlation between Oceanbase and Mysql.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I think oceanbase was compatible with mysql

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I think oceanbase was compatible with mysql

is ok.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tidb as same as mysql too, please add.

Copy link
Contributor

@objcoding objcoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL.

*/
public class LogStoreSqlsFactory {

private static Map<String, LogStoreSqls> LOG_STORE_SQLS_MAP = new ConcurrentHashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not support multiple database, Can be changed to a single.

Copy link
Contributor

@objcoding objcoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a 'log' directory under the 'sql' directory.

Copy link
Contributor

@objcoding objcoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

…_sql_with_spi

# Conflicts:
#	server/src/main/java/io/seata/server/storage/db/store/LogStoreSqls.java
#	server/src/test/java/io/seata/server/lock/db/sql/log/LogStoreSqlsFactoryTest.java
@slievrly slievrly added this to the 1.2.0 milestone Mar 23, 2020
@slievrly slievrly removed the Do Not Merge Do not merge into develop label Mar 27, 2020
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

/**
* @author will
*/
public class LogStoreSqlsFactory {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2135 has merged, LogStoreSqlsFactory can be deleted.


@Override
public String getInsertGlobalTransactionSQL(String globalTable) {
throw new NotSupportYetException("unknown dbType:" + CONFIG.getConfig(ConfigurationKeys.STORE_DB_TYPE));
Copy link
Contributor

@zjinlei zjinlei Apr 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest:
return getInsertGlobalTransactionSQL().replace(GLOBAL_TABLE_PLACEHOLD, globalTable);
abstract String getInsertGlobalTransactionSQL();
Same for other sql

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

@zjinlei zjinlei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zjinlei zjinlei merged commit 94e09c2 into apache:develop Apr 8, 2020
@l81893521 l81893521 deleted the refactor_log_store_sql_with_spi branch April 10, 2020 06:51
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

Successfully merging this pull request may close these issues.

None yet

5 participants