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: add sql parser type druid as constant #2156

Merged

Conversation

ggndnn
Copy link
Contributor

@ggndnn ggndnn commented Jan 8, 2020

Ⅰ. Describe what this PR did

According to the last review comment in #1703, added sql parser type druid as constant.

Ⅱ. 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

@codecov-io
Copy link

codecov-io commented Jan 8, 2020

Codecov Report

Merging #2156 into develop will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #2156      +/-   ##
=============================================
+ Coverage      54.39%   54.42%   +0.03%     
- Complexity      2469     2470       +1     
=============================================
  Files            445      445              
  Lines          14742    14742              
  Branches        1734     1734              
=============================================
+ Hits            8019     8024       +5     
+ Misses          5963     5957       -6     
- Partials         760      761       +1
Impacted Files Coverage Δ Complexity Δ
...ava/io/seata/core/constants/ConfigurationKeys.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...va/io/seata/sqlparser/druid/DruidDbTypeParser.java 100% <ø> (ø) 2 <0> (ø) ⬇️
...eata/server/store/db/DruidDataSourceGenerator.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...ata/sqlparser/druid/DruidSQLRecognizerFactory.java 47.05% <ø> (ø) 2 <0> (ø) ⬇️
...in/java/io/seata/rm/datasource/util/JdbcUtils.java 87.5% <100%> (ø) 3 <0> (ø) ⬇️
.../io/seata/rm/datasource/sql/SQLVisitorFactory.java 80% <100%> (ø) 2 <1> (ø) ⬇️
...in/java/io/seata/server/session/GlobalSession.java 84.13% <0%> (-0.49%) 67% <0%> (-1%)
...o/seata/server/coordinator/DefaultCoordinator.java 47.26% <0%> (-0.4%) 28% <0%> (ø)
...server/store/file/FileTransactionStoreManager.java 56.5% <0%> (+0.31%) 29% <0%> (ø) ⬇️
...mon/src/main/java/io/seata/common/util/IOUtil.java 70% <0%> (+10%) 3% <0%> (ø) ⬇️
... and 1 more

@zjinlei
Copy link
Contributor

zjinlei commented Jan 8, 2020

Could it be an enumeration class that put more sql parser types?

@ggndnn
Copy link
Contributor Author

ggndnn commented Jan 9, 2020

Could it be an enumeration class that put more sql parser types?

How about an abstract class contains sql parser type constants? Because @LoadLevel(name = "druid") needs constants. Any suggestion?

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. We may need to move ConfigurationKeys to the common module.

@zjinlei
Copy link
Contributor

zjinlei commented Jan 10, 2020

Could it be an enumeration class that put more sql parser types?

How about an abstract class contains sql parser type constants? Because @LoadLevel(name = "druid") needs constants. Any suggestion?

Enumeration attributes are constants, so why not consider it?
I think it is possible to build a SqlParserType class in seata-sqlparser-core.

@ggndnn
Copy link
Contributor Author

ggndnn commented Jan 12, 2020

Could it be an enumeration class that put more sql parser types?

How about an abstract class contains sql parser type constants? Because @LoadLevel(name = "druid") needs constants. Any suggestion?

Enumeration attributes are constants, so why not consider it?
I think it is possible to build a SqlParserType class in seata-sqlparser-core.

@LoadLevel(name= needs String type constants. I'm not sure how to add enum to it, so my suggestion is to create an abstract class SqlParserType contains string type constants or just use ConfigurationKeys.

public @interface LoadLevel {
    /**
     * Name string.
     *
     * @return the string
     */
    String name();

    /**
     * Order int.
     *
     * @return the int
     */
    int order() default 0;
}

@ggndnn
Copy link
Contributor Author

ggndnn commented Jan 12, 2020

LGTM. We may need to move ConfigurationKeys to the common module.

This can be considered.

@ggndnn
Copy link
Contributor Author

ggndnn commented Jan 12, 2020

LGTM. We may need to move ConfigurationKeys to the common module.

This can be considered.

@slievrly
Need to do this in this pr or in future pr after more extensive discussion?

@zjinlei
Copy link
Contributor

zjinlei commented Jan 12, 2020

ConfigurationKeys

Sorry, My low-level mistake.
But it is only a constant, not a configuration key, and there will be more sql parser types, I don't think it should be put in ConfigurationKeys.
Hope that there is a better way, can list more sql parser later.

@ggndnn
Copy link
Contributor Author

ggndnn commented Jan 13, 2020

ConfigurationKeys

Sorry, My low-level mistake.
But it is only a constant, not a configuration key, and there will be more sql parser types, I don't think it should be put in ConfigurationKeys.
Hope that there is a better way, can list more sql parser later.

@zjinlei

SqlParserType added.

@ggndnn ggndnn force-pushed the refactor_add_sql_parser_type_druid_as_constants branch from 753a3ed to 232f0bb Compare January 13, 2020 05:27
@ggndnn ggndnn force-pushed the refactor_add_sql_parser_type_druid_as_constants branch from 232f0bb to 9c30d75 Compare January 13, 2020 05:38
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

@slievrly slievrly merged commit ff070a5 into apache:develop Jan 13, 2020
dangquocbang pushed a commit to dangquocbang/seata that referenced this pull request Jan 14, 2020
* 'develop' of https://github.com/seata/seata: (125 commits)
  optimize: tcc module code style (apache#2103)
  refactor: change the package path of MySQL recognizer (apache#2125)
  optimize: fix query typo (apache#2176)
  refactor: add sql parser type druid as constant (apache#2156)
  test: enhance test coverage of seata common (apache#2170)
  optimize: gracefully close resources (apache#2139)
  Feature: Saga provide a switch to skip branch report on branch success, in order to optimize performance. (apache#2151)
  chore:use serializer instead of codec (apache#2097)
  optimize: spring module code style (apache#2159)
  optimize: Add Dubbo compatibility (apache#2036)
  optimize : seata-rm-datasource module code style (apache#2062)
  bugfix: Saga report branch status incorrect when service retried succeed (apache#2145)
  optimize:optimize log specifications (apache#2146)
  bugfix: when branchRollback failed, it will trigger retry of multi-tc. (apache#2113)
  refactor: create sql parser spi and a druid type sql parser (apache#1703)
  refactor: simplify to make seata-common more readable (apache#2038)
  feature: support FastThreadLocalContextCore (apache#2106)
  optimize: some typos (apache#2120)
  optimize: increase the oracle table meta cache code coverage (apache#2078)
  optimize: some typos (apache#2115)
  ...

# Conflicts:
#	pom.xml
@slievrly slievrly added this to the 1.1.0 milestone Feb 3, 2020
@ggndnn ggndnn deleted the refactor_add_sql_parser_type_druid_as_constants branch May 30, 2020 05:46
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