Skip to content

Commit

Permalink
[PLAT-15949] Robustness fix around task percentage reporting on success
Browse files Browse the repository at this point in the history
Summary: Make sure 100% is returned for successful tasks. We still want to record subtasks which were not run. So, they are left intact.

Test Plan: Manually modified task_info to test. Also aborted and retried tasks for the freeze part.

Reviewers: cwang, vkumar, anijhawan

Reviewed By: vkumar, anijhawan

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D39670
  • Loading branch information
nkhogen committed Nov 1, 2024
1 parent 3bbbed5 commit 54a922a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1270,12 +1270,12 @@ public Universe lockAndFreezeUniverseForUpdate(
if (isFirstTry()) {
createFreezeUniverseTask(universeUuid, firstRunTxnCallback)
.setSubTaskGroupType(SubTaskGroupType.ValidateConfigurations);
// Run to apply the change first before adding the rest of the subtasks.
getRunnableTask().runSubTasks();
} else {
createFreezeUniverseTask(universeUuid)
.setSubTaskGroupType(SubTaskGroupType.ValidateConfigurations);
}
// Run to apply the change first before adding the rest of the subtasks.
getRunnableTask().runSubTasks();
return Universe.getOrBadRequest(universeUuid);
} catch (RuntimeException e) {
unlockUniverseForUpdate(universeUuid);
Expand Down
6 changes: 3 additions & 3 deletions managed/src/main/java/com/yugabyte/yw/models/TaskInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,11 @@ public UserTaskDetails getUserTaskDetails(List<TaskInfo> subTaskInfos, TaskCache
*/
@JsonIgnore
public double getPercentCompleted() {
if (getTaskState() == TaskInfo.State.Success) {
return 100.0;
}
int numSubtasks = TaskInfo.find.query().where().eq("parent_uuid", getUuid()).findCount();
if (numSubtasks == 0) {
if (getTaskState() == TaskInfo.State.Success) {
return 100.0;
}
return 0.0;
}
int numSubtasksCompleted =
Expand Down
8 changes: 4 additions & 4 deletions managed/src/main/resources/swagger-strict.json
Original file line number Diff line number Diff line change
Expand Up @@ -8456,8 +8456,8 @@
"type" : "string"
},
"nodeName" : {
"description" : "The node's name",
"example" : "India node",
"description" : "The node's name in a universe",
"example" : "universe_node1",
"readOnly" : true,
"type" : "string"
},
Expand Down Expand Up @@ -8509,8 +8509,8 @@
"uniqueItems" : true
},
"nodeName" : {
"description" : "Node name",
"example" : "India node",
"description" : "Node name in a universe",
"example" : "universe_node1",
"readOnly" : true,
"type" : "string"
},
Expand Down
8 changes: 4 additions & 4 deletions managed/src/main/resources/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -8507,8 +8507,8 @@
"type" : "string"
},
"nodeName" : {
"description" : "The node's name",
"example" : "India node",
"description" : "The node's name in a universe",
"example" : "universe_node1",
"readOnly" : true,
"type" : "string"
},
Expand Down Expand Up @@ -8560,8 +8560,8 @@
"uniqueItems" : true
},
"nodeName" : {
"description" : "Node name",
"example" : "India node",
"description" : "Node name in a universe",
"example" : "universe_node1",
"readOnly" : true,
"type" : "string"
},
Expand Down

0 comments on commit 54a922a

Please sign in to comment.