Skip to content

Commit

Permalink
[PLAT-16938]: Send whether ysql major version upgrade is required in …
Browse files Browse the repository at this point in the history
…the software upgrade info api

Summary:
Added wether the target version during software upgrade results in ysql major version upgrade in
the software upgrade api.

Test Plan: Tested manually

Reviewers: sneelakantan, dkumar, sanketh

Reviewed By: dkumar

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D42284
  • Loading branch information
vipul-yb committed Mar 4, 2025
1 parent 0aba681 commit ca4c58b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.yugabyte.yw.common.KubernetesManagerFactory;
import com.yugabyte.yw.common.KubernetesUtil;
import com.yugabyte.yw.common.PlatformServiceException;
import com.yugabyte.yw.common.SoftwareUpgradeHelper;
import com.yugabyte.yw.common.Util;
import com.yugabyte.yw.common.XClusterUniverseService;
import com.yugabyte.yw.common.backuprestore.ybc.YbcManager;
Expand Down Expand Up @@ -83,6 +84,7 @@ public class UpgradeUniverseHandler {
private final AutoFlagUtil autoFlagUtil;
private final XClusterUniverseService xClusterUniverseService;
private final TelemetryProviderService telemetryProviderService;
private final SoftwareUpgradeHelper softwareUpgradeHelper;

@Inject
public UpgradeUniverseHandler(
Expand All @@ -94,7 +96,8 @@ public UpgradeUniverseHandler(
CertificateHelper certificateHelper,
AutoFlagUtil autoFlagUtil,
XClusterUniverseService xClusterUniverseService,
TelemetryProviderService telemetryProviderService) {
TelemetryProviderService telemetryProviderService,
SoftwareUpgradeHelper softwareUpgradeHelper) {
this.commissioner = commissioner;
this.kubernetesManagerFactory = kubernetesManagerFactory;
this.runtimeConfigFactory = runtimeConfigFactory;
Expand All @@ -104,6 +107,7 @@ public UpgradeUniverseHandler(
this.autoFlagUtil = autoFlagUtil;
this.xClusterUniverseService = xClusterUniverseService;
this.telemetryProviderService = telemetryProviderService;
this.softwareUpgradeHelper = softwareUpgradeHelper;
}

public UUID restartUniverse(
Expand Down Expand Up @@ -682,6 +686,9 @@ public SoftwareUpgradeInfoResponse softwareUpgradeInfo(
SoftwareUpgradeInfoResponse response = new SoftwareUpgradeInfoResponse();
try {
response.setFinalizeRequired(autoFlagUtil.upgradeRequireFinalize(currentVersion, newVersion));
response.setYsqlMajorVersionUpgrade(
softwareUpgradeHelper.isYsqlMajorVersionUpgradeRequired(
universe, currentVersion, newVersion));
} catch (IOException e) {
log.error("Error: ", e);
throw new PlatformServiceException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,10 @@ public class SoftwareUpgradeInfoResponse {
accessMode = AccessMode.READ_ONLY)
@YbaApi(visibility = YbaApiVisibility.PREVIEW, sinceYBAVersion = "2.20.2.0")
private boolean finalizeRequired;

@ApiModelProperty(
value = "WARNING: This is a preview API that could change. YSQL Major version upgrade",
accessMode = AccessMode.READ_ONLY)
@YbaApi(visibility = YbaApiVisibility.PREVIEW, sinceYBAVersion = "2025.1.0.0")
private boolean ysqlMajorVersionUpgrade;
}
5 changes: 5 additions & 0 deletions managed/src/main/resources/swagger-strict.json
Original file line number Diff line number Diff line change
Expand Up @@ -18978,6 +18978,11 @@
"description" : "WARNING: This is a preview API that could change. Finalize required",
"readOnly" : true,
"type" : "boolean"
},
"ysqlMajorVersionUpgrade" : {
"description" : "WARNING: This is a preview API that could change. YSQL Major version upgrade",
"readOnly" : true,
"type" : "boolean"
}
},
"type" : "object"
Expand Down
5 changes: 5 additions & 0 deletions managed/src/main/resources/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -19106,6 +19106,11 @@
"description" : "WARNING: This is a preview API that could change. Finalize required",
"readOnly" : true,
"type" : "boolean"
},
"ysqlMajorVersionUpgrade" : {
"description" : "WARNING: This is a preview API that could change. YSQL Major version upgrade",
"readOnly" : true,
"type" : "boolean"
}
},
"type" : "object"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.yugabyte.yw.common.KubernetesManagerFactory;
import com.yugabyte.yw.common.ModelFactory;
import com.yugabyte.yw.common.PlatformServiceException;
import com.yugabyte.yw.common.SoftwareUpgradeHelper;
import com.yugabyte.yw.common.XClusterUniverseService;
import com.yugabyte.yw.common.backuprestore.ybc.YbcManager;
import com.yugabyte.yw.common.certmgmt.CertificateHelper;
Expand Down Expand Up @@ -81,7 +82,8 @@ public void setUp() {
mock(CertificateHelper.class),
mock(AutoFlagUtil.class),
mock(XClusterUniverseService.class),
mock(TelemetryProviderService.class));
mock(TelemetryProviderService.class),
mock(SoftwareUpgradeHelper.class));
}

private static Object[] tlsToggleCustomTypeNameParams() {
Expand Down

0 comments on commit ca4c58b

Please sign in to comment.