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

feature: Realize the interface of console: get global session and global lock in the db mode #4320

Merged
merged 19 commits into from
Mar 6, 2022

Conversation

lvekee
Copy link
Contributor

@lvekee lvekee commented Jan 19, 2022

Ⅰ. Describe what this PR did

Realize the interface of console: get global session and global lock in the db mode

Ⅱ. Does this pull request fix one issue?

fixes #4256.
fixes #4257.

@lightClouds917
Copy link
Contributor

1.readme.md添加一下pr记录;
2.如果自测还没完成,就加个[WIP]前缀,自测通过了再去掉,我们再详细的review;
3.实现类author把自己添加一下;

@lvekee lvekee changed the title feature: Realize the interface of console: get global session and global lock in the db mode [WIP]feature: Realize the interface of console: get global session and global lock in the db mode Jan 20, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 20, 2022

Codecov Report

Merging #4320 (d3eb970) into develop (6fab0e8) will decrease coverage by 0.17%.
The diff coverage is 8.39%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #4320      +/-   ##
=============================================
- Coverage      48.44%   48.27%   -0.18%     
- Complexity      3965     3969       +4     
=============================================
  Files            733      734       +1     
  Lines          25163    25277     +114     
  Branches        3086     3105      +19     
=============================================
+ Hits           12191    12202      +11     
- Misses         11658    11760     +102     
- Partials        1314     1315       +1     
Impacted Files Coverage Δ
.../java/io/seata/core/console/result/PageResult.java 0.00% <ø> (ø)
...a/core/store/db/sql/lock/AbstractLockStoreSql.java 57.77% <0.00%> (ø)
...ta/core/store/db/sql/log/AbstractLogStoreSqls.java 84.61% <0.00%> (-7.06%) ⬇️
...erver/console/controller/GlobalLockController.java 50.00% <ø> (ø)
...er/console/controller/GlobalSessionController.java 50.00% <ø> (ø)
...er/console/impl/db/BranchSessionDBServiceImpl.java 0.00% <0.00%> (ø)
...erver/console/impl/db/GlobalLockDBServiceImpl.java 0.00% <0.00%> (ø)
...er/console/impl/db/GlobalSessionDBServiceImpl.java 0.00% <0.00%> (ø)
...n/src/main/java/io/seata/common/util/PageUtil.java 50.00% <50.00%> (ø)
...in/java/io/seata/server/session/GlobalSession.java 79.83% <0.00%> (-0.41%) ⬇️
... and 3 more

@funky-eyes funky-eyes added this to the 1.5.0 milestone Jan 22, 2022
# Conflicts:
#	changes/1.5.0.md
#	changes/en-us/1.5.0.md
#	server/src/main/java/io/seata/server/console/controller/GlobalLockController.java
#	server/src/main/java/io/seata/server/console/controller/GlobalSessionController.java
@lvekee lvekee changed the title [WIP]feature: Realize the interface of console: get global session and global lock in the db mode feature: Realize the interface of console: get global session and global lock in the db mode Jan 23, 2022
@lgtm-com
Copy link

lgtm-com bot commented Jan 23, 2022

This pull request fixes 6 alerts when merging 2f127c6 into 3993984 - view on LGTM.com

fixed alerts:

  • 6 for Query built from user-controlled sources

default:
throw new NotSupportYetException("PageUtil not support this dbType:" + dbType);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

这个抽一下是不是好点

public static final List<String> SUPPORT_DB = Arrays.asList("mysql", "h2","postgresql","oceanbase","oracle");
public static String countSql(String sourceSql, String dbType) {
        if(SUPPORT_DB.contains(dbType)){
                return sourceSql.replaceAll("(?i)(?<=select)(.*)(?=from)", " count(1) ");
        }else {
                throw new NotSupportYetException("PageUtil not support this dbType:" + dbType);
        }
    }

*/
public static final String XID_PLACEHOLD = " #xid# ";
public static final String WHERE_PLACEHOLD = " #where# ";
Copy link
Contributor

Choose a reason for hiding this comment

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

这些place hold要不要抽个类出来?现在已经有两个类都有 #where# 了

# Conflicts:
#	changes/1.5.0.md
#	changes/en-us/1.5.0.md
#	server/src/main/java/io/seata/server/console/controller/GlobalLockController.java
#	server/src/main/java/io/seata/server/console/controller/GlobalSessionController.java
@lgtm-com
Copy link

lgtm-com bot commented Feb 15, 2022

This pull request fixes 6 alerts when merging 9b560f5 into ca8ff3f - view on LGTM.com

fixed alerts:

  • 6 for Query built from user-controlled sources

@objcoding objcoding self-requested a review February 16, 2022 15:50
@lightClouds917
Copy link
Contributor

lock和session里有部分代码可以公用,是否可以考虑抽取一下。

# Conflicts:
#	changes/1.5.0.md
#	changes/en-us/1.5.0.md
#	core/src/main/java/io/seata/core/console/result/PageResult.java
@lgtm-com
Copy link

lgtm-com bot commented Feb 26, 2022

This pull request fixes 6 alerts when merging 06f4344 into 4622746 - view on LGTM.com

fixed alerts:

  • 6 for Query built from user-controlled sources

@lgtm-com
Copy link

lgtm-com bot commented Feb 26, 2022

This pull request fixes 6 alerts when merging eff45fd into 4622746 - view on LGTM.com

fixed alerts:

  • 6 for Query built from user-controlled sources

@lgtm-com
Copy link

lgtm-com bot commented Feb 26, 2022

This pull request fixes 6 alerts when merging a226d1e into 4622746 - view on LGTM.com

fixed alerts:

  • 6 for Query built from user-controlled sources

@lgtm-com
Copy link

lgtm-com bot commented Feb 28, 2022

This pull request fixes 6 alerts when merging 20b4de8 into 16f0bfa - view on LGTM.com

fixed alerts:

  • 6 for Query built from user-controlled sources

Copy link
Contributor

@lightClouds917 lightClouds917 left a comment

Choose a reason for hiding this comment

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

LGTM

@lgtm-com
Copy link

lgtm-com bot commented Mar 5, 2022

This pull request fixes 6 alerts when merging 23ae12c into 4c88984 - view on LGTM.com

fixed alerts:

  • 6 for Query built from user-controlled sources

Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

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

LGTM

@lgtm-com
Copy link

lgtm-com bot commented Mar 6, 2022

This pull request fixes 6 alerts when merging d3eb970 into 6fab0e8 - view on LGTM.com

fixed alerts:

  • 6 for Query built from user-controlled sources

@funky-eyes funky-eyes added the module/server server module label Mar 6, 2022
@funky-eyes funky-eyes merged commit 1f2a02f into apache:develop Mar 6, 2022
liuqiufeng pushed a commit to liuqiufeng/seata that referenced this pull request Mar 6, 2022
*/
public static String pageSql(String sourceSql, String dbType, int pageNum, int pageSize) {
switch (dbType) {
case "mysql":
Copy link
Member

Choose a reason for hiding this comment

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

io.seata.core.constants.DBType

* @return the string
*/
String getAllLockSQL(String lockTable, String tableName);
String getAllLockSql(String lockTable, String whereCondition);
Copy link
Member

Choose a reason for hiding this comment

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

Non compliance with design principles.

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