-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAT-10615]Parallelize support bundle creation
Summary: Currently all components of support bundle are collected sequentially in a single thread. Added changes to add all components to a subtask group to be ran in parallel. This diff is part of the changes planned for the next phase of support bundle. More details in the [[ https://docs.google.com/document/d/1B1gkJiTVkxN5OAKVlvCIbEAWTYw6SCCtaFok-zpD6eM/edit?usp=sharing | Design doc ]]. Test Plan: Manually verified that collection of all components happens in parallel and the contents of the Support bundle are as expected. Reviewers: #yba-api-review!, nsingh, skurapati, anijhawan Reviewed By: nsingh, anijhawan Subscribers: anijhawan, yugaware Differential Revision: https://phorge.dev.yugabyte.com/D40620
- Loading branch information
1 parent
1cd04b8
commit e320bf2
Showing
7 changed files
with
293 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...main/java/com/yugabyte/yw/commissioner/tasks/subtasks/SupportBundleComponentDownload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright 2024 YugaByte, Inc. and Contributors | ||
* | ||
* Licensed under the Polyform Free Trial License 1.0.0 (the "License"); you | ||
* may not use this file except in compliance with the License. You | ||
* may obtain a copy of the License at | ||
* | ||
* http://github.com/YugaByte/yugabyte-db/blob/master/licenses/POLYFORM-FREE-TRIAL-LICENSE-1.0.0.txt | ||
*/ | ||
package com.yugabyte.yw.commissioner.tasks.subtasks; | ||
|
||
import com.google.inject.Inject; | ||
import com.yugabyte.yw.commissioner.AbstractTaskBase; | ||
import com.yugabyte.yw.commissioner.BaseTaskDependencies; | ||
import com.yugabyte.yw.commissioner.tasks.params.SupportBundleTaskParams; | ||
import com.yugabyte.yw.common.supportbundle.SupportBundleComponent; | ||
import com.yugabyte.yw.forms.AbstractTaskParams; | ||
import com.yugabyte.yw.models.Customer; | ||
import com.yugabyte.yw.models.Universe; | ||
import com.yugabyte.yw.models.helpers.NodeDetails; | ||
import java.nio.file.Path; | ||
import java.util.Date; | ||
import lombok.AllArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class SupportBundleComponentDownload extends AbstractTaskBase { | ||
|
||
@AllArgsConstructor | ||
public static class Params extends AbstractTaskParams { | ||
final SupportBundleComponent supportBundleComponent; | ||
final SupportBundleTaskParams supportBundleTaskParams; | ||
final Customer customer; | ||
final Universe universe; | ||
final Path bundlePath; | ||
final NodeDetails node; | ||
final Date startDate, endDate; | ||
} | ||
|
||
@Override | ||
public SupportBundleComponentDownload.Params taskParams() { | ||
return (SupportBundleComponentDownload.Params) taskParams; | ||
} | ||
|
||
@Inject | ||
public SupportBundleComponentDownload(BaseTaskDependencies baseTaskDependencies) { | ||
super(baseTaskDependencies); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
Params params = taskParams(); | ||
try { | ||
// Call the downloadComponentBetweenDates() function for all components. | ||
// Each component verifies if the dates are required and calls downloadComponent(). | ||
params.supportBundleComponent.downloadComponentBetweenDates( | ||
params.supportBundleTaskParams, | ||
params.customer, | ||
params.universe, | ||
params.bundlePath, | ||
params.startDate, | ||
params.endDate, | ||
params.node); | ||
} catch (Exception e) { | ||
// Log the error and continue with the rest of support bundle collection. | ||
log.error( | ||
"Error occurred in support bundle collection for component '{}' on {} node: {}", | ||
taskParams().supportBundleComponent.getClass().getSimpleName(), | ||
(taskParams().node == null) ? "YBA" : taskParams().node.getNodeName(), | ||
e.getMessage()); | ||
} | ||
} | ||
} |
Oops, something went wrong.