Skip to content

Commit

Permalink
[#9797] YSQL: Stubs for ysql major version upgrade RPCs
Browse files Browse the repository at this point in the history
Summary:
The pg15-upgrade branch has implementations of 3 RPCs needed for the YSQL major version upgrade:
 * StartYsqlMajorVersionUpgradeInitdb
 * IsYsqlMajorVersionUpgradeInitdbDone
 * RollbackYsqlMajorVersionUpgrade

In order to facilitate integration with tools such as YBA, add stubs for these methods to the master branch.

Upgrade/Downgrade safety:
No issues. New, unimplemented interface.

Jira: DB-1591

Test Plan:
Jenkins

Using a recent pg15-upgrade build, manually run:
  yb-admin ysql_major_version_upgrade_initdb
  yb-admin rollback_ysql_major_version_upgrade

Verify it shows something like the following errors:
  Error running ysql_major_version_upgrade_initdb: Not implemented (yb/master/catalog_manager.cc:3281): Unable to run initdb for ysql major version upgrade: Ysql major version upgrade is not supported
  Error running rollback_ysql_major_version_upgrade: Not implemented (yb/master/catalog_manager.cc:3294): Unable to roll back ysql major version upgrade: Ysql major version upgrade is not supported

Note yb-admin doesn't have a command for IsYsqlMajorVersionUpgradeInitdbDone because it implements its own blocking on the pg15-upgrade branch, but the code is similar for the 3 RPCs.

Reviewers: hsunder

Reviewed By: hsunder

Subscribers: vbansal, ybase, yql

Differential Revision: https://phorge.dev.yugabyte.com/D36940
  • Loading branch information
foucher committed Jul 31, 2024
1 parent 66890cb commit b2f24f2
Showing 4 changed files with 68 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/yb/master/catalog_manager.cc
Original file line number Diff line number Diff line change
@@ -3274,6 +3274,26 @@ Status CatalogManager::DdlLog(
return sys_catalog_->FetchDdlLog(resp->mutable_entries());
}

Status CatalogManager::StartYsqlMajorVersionUpgradeInitdb(
const StartYsqlMajorVersionUpgradeInitdbRequestPB* req,
StartYsqlMajorVersionUpgradeInitdbResponsePB* resp,
rpc::RpcContext* rpc, const LeaderEpoch& epoch) {
return STATUS(NotSupported, "Ysql major version upgrade is not supported");
}

Status CatalogManager::IsYsqlMajorVersionUpgradeInitdbDone(
const IsYsqlMajorVersionUpgradeInitdbDoneRequestPB* req,
IsYsqlMajorVersionUpgradeInitdbDoneResponsePB* resp, rpc::RpcContext* rpc) {
return STATUS(NotSupported, "Ysql major version upgrade is not supported");
}

Status CatalogManager::RollbackYsqlMajorVersionUpgrade(
const RollbackYsqlMajorVersionUpgradeRequestPB* req,
RollbackYsqlMajorVersionUpgradeResponsePB* resp,
rpc::RpcContext* rpc, const LeaderEpoch& epoch) {
return STATUS(NotSupported, "Ysql major version upgrade is not supported");
}

namespace {

Status ValidateCreateTableSchema(const Schema& schema, CreateTableResponsePB* resp) {
15 changes: 15 additions & 0 deletions src/yb/master/catalog_manager.h
Original file line number Diff line number Diff line change
@@ -1098,6 +1098,21 @@ class CatalogManager : public tserver::TabletPeerLookupIf,
Status DdlLog(
const DdlLogRequestPB* req, DdlLogResponsePB* resp, rpc::RpcContext* rpc);

// Not implemented.
Status StartYsqlMajorVersionUpgradeInitdb(const StartYsqlMajorVersionUpgradeInitdbRequestPB* req,
StartYsqlMajorVersionUpgradeInitdbResponsePB* resp,
rpc::RpcContext* rpc, const LeaderEpoch& epoch);

// Not implemented.
Status IsYsqlMajorVersionUpgradeInitdbDone(
const IsYsqlMajorVersionUpgradeInitdbDoneRequestPB* req,
IsYsqlMajorVersionUpgradeInitdbDoneResponsePB* resp, rpc::RpcContext* rpc);

// Not implemented.
Status RollbackYsqlMajorVersionUpgrade(const RollbackYsqlMajorVersionUpgradeRequestPB* req,
RollbackYsqlMajorVersionUpgradeResponsePB* resp,
rpc::RpcContext* rpc, const LeaderEpoch& epoch);

// Test wrapper around protected DoSplitTablet method.
Status TEST_SplitTablet(
const TabletInfoPtr& source_tablet_info,
30 changes: 30 additions & 0 deletions src/yb/master/master_admin.proto
Original file line number Diff line number Diff line change
@@ -177,6 +177,29 @@ message DdlLogResponsePB {
repeated DdlLogEntryPB entries = 2;
}

message StartYsqlMajorVersionUpgradeInitdbRequestPB {
}

message StartYsqlMajorVersionUpgradeInitdbResponsePB {
optional MasterErrorPB error = 1;
}

message IsYsqlMajorVersionUpgradeInitdbDoneRequestPB {
}

message IsYsqlMajorVersionUpgradeInitdbDoneResponsePB {
optional MasterErrorPB error = 1;
optional bool done = 2;
optional MasterErrorPB initdb_error = 3;
}

message RollbackYsqlMajorVersionUpgradeRequestPB {
}

message RollbackYsqlMajorVersionUpgradeResponsePB {
optional MasterErrorPB error = 1;
}

message CheckIfPitrActiveRequestPB {}

message CheckIfPitrActiveResponsePB {
@@ -268,6 +291,13 @@ service MasterAdmin {

rpc DdlLog(DdlLogRequestPB) returns (DdlLogResponsePB);

rpc StartYsqlMajorVersionUpgradeInitdb(StartYsqlMajorVersionUpgradeInitdbRequestPB)
returns (StartYsqlMajorVersionUpgradeInitdbResponsePB);
rpc IsYsqlMajorVersionUpgradeInitdbDone(IsYsqlMajorVersionUpgradeInitdbDoneRequestPB)
returns (IsYsqlMajorVersionUpgradeInitdbDoneResponsePB);
rpc RollbackYsqlMajorVersionUpgrade(RollbackYsqlMajorVersionUpgradeRequestPB)
returns (RollbackYsqlMajorVersionUpgradeResponsePB);

rpc CheckIfPitrActive(CheckIfPitrActiveRequestPB)
returns (CheckIfPitrActiveResponsePB);

3 changes: 3 additions & 0 deletions src/yb/master/master_admin_service.cc
Original file line number Diff line number Diff line change
@@ -49,6 +49,9 @@ class MasterAdminServiceImpl : public MasterServiceBase, public MasterAdminIf {
(GetCompactionStatus)
(CreateTransactionStatusTable)
(DdlLog)
(StartYsqlMajorVersionUpgradeInitdb)
(IsYsqlMajorVersionUpgradeInitdbDone)
(RollbackYsqlMajorVersionUpgrade)
(DeleteNotServingTablet)
(FlushSysCatalog)
(SplitTablet)

0 comments on commit b2f24f2

Please sign in to comment.