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

optimize: using subqueries to reduce the retrieval of invalid content data. #7184

Open
wants to merge 5 commits into
base: 2.x
Choose a base branch
from

Conversation

MaoMaoandSnail
Copy link
Contributor

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

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

@@ -62,6 +62,10 @@ public String getQueryStateMachinesByNameAndTenantSql(String dbType) {
return queryStateMachinesByNameAndTenantSql;
}

public String getLastVersionStateMachine(String dbType) {
return getQueryStateMachinesByNameAndTenantSql(dbType) + " LIMIT 1";
Copy link
Member

Choose a reason for hiding this comment

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

The LIMIT syntax is not part of the SQL standard, and there are several databases that do not support the LIMIT syntax.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The LIMIT syntax is not part of the SQL standard, and there are several databases that do not support the LIMIT syntax.

OK, I will optimize it.

Copy link

codecov bot commented Mar 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.18%. Comparing base (757bf45) to head (0f0020c).

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7184      +/-   ##
============================================
+ Coverage     54.17%   54.18%   +0.01%     
- Complexity     7222     7223       +1     
============================================
  Files          1173     1173              
  Lines         41796    41796              
  Branches       4906     4906              
============================================
+ Hits          22642    22647       +5     
+ Misses        17013    17007       -6     
- Partials       2141     2142       +1     

see 3 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MaoMaoandSnail MaoMaoandSnail changed the title optimize: getLastVersionStateMachine sql adds condition 'LIMIT 1' optimize: using subqueries to reduce the retrieval of invalid content data. Mar 9, 2025
@@ -50,8 +50,12 @@ public StateMachine getStateMachineById(String stateMachineId) {

@Override
public StateMachine getLastVersionStateMachine(String stateMachineName, String tenantId) {
return selectOne(stateLangStoreSqls.getLastVersionStateMachine(dbType), RESULT_SET_TO_STATE_MACHINE,
stateMachineName, tenantId);
List<StateMachine> list = selectList(stateLangStoreSqls.getLastVersionStateMachine(dbType),
Copy link
Member

Choose a reason for hiding this comment

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

Has this change been fully tested by saga? I remember that tenant_id is an optional field, what happens if the upper layer doesn't pass the tenant_id parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Has this change been fully tested by saga? I remember that tenant_id is an optional field, what happens if the upper layer doesn't pass the tenant_id parameter?

I've performed local testing and executed the Saga test approach. When the tenant_id parameter is not provided, the system will automatically fill it with the defaultTenantId (000001).
image

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.

3 participants