Skip to content

[Fix-#6783] fix: #6783 switchVersion error (#6783)#6784

Merged
brave-lee merged 5 commits intoapache:devfrom
zwZjut:#6783
Nov 16, 2021
Merged

[Fix-#6783] fix: #6783 switchVersion error (#6783)#6784
brave-lee merged 5 commits intoapache:devfrom
zwZjut:#6783

Conversation

@zwZjut
Copy link
Contributor

@zwZjut zwZjut commented Nov 11, 2021

Purpose of the pull request

#6783

Brief change log

Verify this pull request

This pull request is code cleanup without any test coverage.

(or)

This pull request is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

@zwZjut zwZjut changed the title [fix-#6783] switchVersion error (#6783) [Fix-#6783] switchVersion error (#6783) Nov 11, 2021
@zwZjut
Copy link
Contributor Author

zwZjut commented Nov 11, 2021

@JinyLeeChina

@CalvinKirs CalvinKirs requested a review from brave-lee November 11, 2021 03:56
@zhongjiajie
Copy link
Member

Hi @zwZjut , to target specific issue from PR, we recommend use keyword fix: #issue_id or close: #issue_id or closes: #issue_id in your PR describe. I would not only connect issue to PR but also close issue automatically when PR is be closed.

TaskDefinitionLog taskDefinitionUpdate = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, version);
taskDefinitionUpdate.setUserId(loginUser.getId());
taskDefinitionUpdate.setUpdateTime(new Date());
taskDefinitionUpdate.setId(taskDefinition.getId());
Copy link
Member

Choose a reason for hiding this comment

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

I do not think directly set task definitions log id here. I think both task definition and task definition log id could be auto increase. Am I wrong @JinyLeeChina

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in my opinion , switchVersion is to set the version of t_ds_task_definition , which reference from t_ds_task_definition_log, let's see the metadata, version=6 id=8 in t_ds_task_definition, but version=6 id=22 in t_ds_task_definition_log, taskDefinitionMapper.updateById(t_ds_task_definition_log) will throw "Switch task definition version error" because id=22 not in t_ds_task_definition, or maybe I am wrong, but the problem I got when I call openapi "switchTaskDefinitionVersion"
image

Copy link
Member

Choose a reason for hiding this comment

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

I go to our UI try to find out which place call service switchVersion but failed 😢 Did one know where we call it?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I got your point. You means that function switchVersion it's get task definition from task_definition_log and recover the snapshot to task_definition? If so your change make sense.

But the total logic is odd, could anyone tell me where would call this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's not used yet, because task versions is not open to users now , I'am just testing all openapis by create httprequest to help myself get familiar with the code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

update t_ds_task_definition by taskDefinitionLog will never succeed. int switchVersion = taskDefinitionMapper.updateById(taskDefinitionLog); line 288 , TaskDefinitionServiceImpl.java id is differnet between t_ds_task_definition and t_ds_task_definition, you may see the metadata of picture and it's explanation above

Copy link
Contributor

Choose a reason for hiding this comment

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

One line of code is missing here, taskDefinitionLog.setId(taskDefinition.getId()); , Can you submit a PR to fix it ?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, I was careless, you have added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this pr is to fix what you mentioned , taskDefinitionUpdate.setId(taskDefinition.getId()); (line 294) and I just change the java obj name "taskDefinitionLog" to "taskDefinitionUpdate" is to underline that we get obj from t_ds_task_definition_log it to update t_ds_task_definition

Copy link
Contributor

Choose a reason for hiding this comment

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

right, very good

@zwZjut zwZjut changed the title [Fix-#6783] switchVersion error (#6783) [Fix-#6783] fix: #6783 switchVersion error (#6783) Nov 11, 2021
@codecov-commenter
Copy link

codecov-commenter commented Nov 11, 2021

Codecov Report

Merging #6784 (cc1bda5) into dev (dfe4945) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##                dev    #6784      +/-   ##
============================================
- Coverage     41.79%   41.78%   -0.02%     
+ Complexity     3615     3611       -4     
============================================
  Files           641      641              
  Lines         25890    25891       +1     
  Branches       2795     2795              
============================================
- Hits          10821    10818       -3     
  Misses        14094    14094              
- Partials        975      979       +4     
Impacted Files Coverage Δ
...er/api/service/impl/TaskDefinitionServiceImpl.java 33.83% <100.00%> (+0.33%) ⬆️
...er/master/dispatch/host/assign/RandomSelector.java 77.77% <0.00%> (-5.56%) ⬇️
...inscheduler/common/thread/ThreadPoolExecutors.java 19.23% <0.00%> (-1.93%) ⬇️
...dolphinscheduler/remote/future/ResponseFuture.java 81.35% <0.00%> (-1.70%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dfe4945...cc1bda5. Read the comment docs.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@brave-lee brave-lee left a comment

Choose a reason for hiding this comment

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

+1

@brave-lee brave-lee merged commit 94352a4 into apache:dev Nov 16, 2021
lenboo pushed a commit that referenced this pull request Nov 17, 2021
Co-authored-by: honghuo.zw <honghuo.zw@alibaba-inc.com>
Co-authored-by: Kirs <acm_master@163.com>
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.

5 participants