Skip to content

Commit

Permalink
PMM-8706: Add specific error codes for incompatible service (#777)
Browse files Browse the repository at this point in the history
* PMM-8706: improve incompatible error

* clarify errors
  • Loading branch information
oter authored Nov 2, 2021
1 parent 862090f commit fdd067c
Show file tree
Hide file tree
Showing 13 changed files with 1,162 additions and 295 deletions.
626 changes: 343 additions & 283 deletions api/managementpb/backup/backups.pb.go

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions api/managementpb/backup/backups.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package backup.v1beta1;

option go_package = "api/managementpb/backup;backupv1beta1";

import "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options/annotations.proto";
import "github.com/mwitkow/go-proto-validators/validator.proto";
import "google/api/annotations.proto";
import "google/protobuf/duration.proto";
Expand Down Expand Up @@ -225,6 +226,9 @@ service Backups {
post: "/v1/management/backup/Backups/Start"
body: "*"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
description: "Could return the Error message in the details containing specific ErrorCode indicating failure reason:\nERROR_CODE_XTRABACKUP_NOT_INSTALLED - xtrabackup is not installed on the service\nERROR_CODE_INVALID_XTRABACKUP - different versions of xtrabackup and xbcloud\nERROR_CODE_INCOMPATIBLE_XTRABACKUP - xtrabackup is not compatible with MySQL for taking a backup"
};
}
// ListArtifactCompatibleServices lists compatible services for restoring a backup.
rpc ListArtifactCompatibleServices(ListArtifactCompatibleServicesRequest) returns (ListArtifactCompatibleServicesResponse) {
Expand All @@ -239,6 +243,9 @@ service Backups {
post: "/v1/management/backup/Backups/Restore"
body: "*"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
description: "Could return the Error message in the details containing specific ErrorCode indicating failure reason:\nERROR_CODE_XTRABACKUP_NOT_INSTALLED - xtrabackup is not installed on the service\nERROR_CODE_INVALID_XTRABACKUP - different versions of xtrabackup and xbcloud\nERROR_CODE_INCOMPATIBLE_XTRABACKUP - xtrabackup is not compatible with MySQL for taking a backup\nERROR_CODE_INCOMPATIBLE_TARGET_MYSQL - target MySQL version is not compatible with the artifact for performing a restore of the backup"
};
}
// ScheduleBackup schedules repeated backup.
rpc ScheduleBackup(ScheduleBackupRequest) returns (ScheduleBackupResponse) {
Expand Down
1 change: 1 addition & 0 deletions api/managementpb/backup/backups.validator.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

229 changes: 229 additions & 0 deletions api/managementpb/backup/errors.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions api/managementpb/backup/errors.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax = "proto3";

package backup.v1beta1;

option go_package = "api/managementpb/backup;backupv1beta1";

// ErrorCode is a set of specific errors that are not present in the standard set of errors
// and returned in the details field of the response.
enum ErrorCode {
ERROR_CODE_INVALID = 0;
// ERROR_CODE_XTRABACKUP_NOT_INSTALLED is returned if some xtrabackup component is missing.
ERROR_CODE_XTRABACKUP_NOT_INSTALLED = 1;
// ERROR_CODE_INVALID_XTRABACKUP is returned if xtrabackup components have different version.
ERROR_CODE_INVALID_XTRABACKUP = 2;
// ERROR_CODE_INCOMPATIBLE_XTRABACKUP is returned if xtrabackup is not compatible with the MySQL.
ERROR_CODE_INCOMPATIBLE_XTRABACKUP = 3;
// ERROR_CODE_INCOMPATIBLE_TARGET_MYSQL is returned if target version of MySQL is not compatible for restoring selected artifact.
ERROR_CODE_INCOMPATIBLE_TARGET_MYSQL = 4;
}

// Error represents error message returned in the details field in the response.
message Error {
ErrorCode code = 1;
}
19 changes: 19 additions & 0 deletions api/managementpb/backup/errors.validator.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fdd067c

Please sign in to comment.