Features
The steps for updating a task that is in the PENDING state. You can modify either autoRun or stepParam, or both.
API details
Constraints
You must have the SOP_TASK:UPDATE permission on this task and the UPDATE permission on the target resource. The step must be PENDING. The template editable=true is required only when autoRun is specified in the request.
Request path
PATCH /api/v2/sop/tasks/{taskId}/execution/steps/{stepIndex}
Request parameters
Parameter |
Location |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|---|
| taskId | Path | Long | Yes | 1001 |
Task ID. |
| stepIndex | Path | Integer | Yes | 5 |
The serial number of the step that has been started in the execution instance. |
| autoRun | Body | Boolean | No | true |
Automatic execution switch. If not specified, the value is not modified. The step must be editable when it is specified. |
| stepParam | Body | Object | No | {"replacementHostId":200} |
Step-level parameters. If not specified, the parameter remains unchanged. An empty object is saved as an empty object. At runtime, fields with the same name will overwrite task-level parameters. |
The following table describes the business fields and constraints of stepParam:
SOP Type / Step |
field |
Type |
Required |
constraint |
|---|---|---|---|---|
OBSERVER_DATA_REBUILD / ADD_OBSERVER |
replacementHostId |
Long | Not nullstepParamWhen is it? |
Must be a positive number. Can only appear alone or withreplacementHostIpappear simultaneously. |
OBSERVER_DATA_REBUILD / ADD_OBSERVER |
replacementHostIp |
String | No | It must be a non-empty string. The server will use it to determine thereplacementHostIdSupplement or overwrite the actual private IP address. |
REBUILD_STANDBY_TENANT / CREATE_STANDBY_TENANT |
createStandbyTenantParamJson |
Object or JSON String | When you perform this step, | The complete parameter object for creating a new standby tenant. You must set this before executing this step. For details about complete fields, nested fields, and examples, see the following sections. |
Detailed parameters of createStandbyTenantParamJson
It is recommended to pass a JSON object directly; passing a JSON string is also supported. If a string is passed, the server will attempt to parse it and convert it into an object during saving. This object is used only for the CREATE_STANDBY_TENANT step of REBUILD_STANDBY_TENANT and cannot be written to other steps.
field |
Type |
Required |
Valid values/Constraints |
Description |
|---|---|---|---|---|
| name | String | Yes | Must be non-empty; format:^[a-zA-Z][a-zA-Z_0-9]{1,63}$It must start with a letter, be 2 to 64 characters in length, and contain only letters, digits, and underscores. |
The name of the newly created standby tenant. |
| primaryTenantId | Long | Yes | A positive integer. | Corresponding primary tenant ID. |
| standbyClusterId | Long | Yes | A positive integer. | The ID of the OceanBase cluster where the new standby tenant will be located. If this cluster does not belong to the current OCP, corresponding resource access authorization is also required. |
| logTransportMode | String | Yes | Can only be filled withNETWORKorLOG_BACKUP, and must match the one used when creating the SOP task.targetParam.logTransportModeCompletely consistent**. |
Log transfer mode for the new standby tenant. |
| mode | String | No | MYSQLorORACLE. If not specified, the default value of the backend is used.MYSQL. |
New standby tenant compatibility mode. |
| primaryZone | String | No | Up to 128 characters. | The primary zone configuration for the new tenant. |
| standbyROPassword | String | No | String; sensitive information should not be recorded in logs or documentation examples. | Standby tenant log synchronization requires read-only user credentials. |
| primaryRootPassword | String | No | String; for internal use only. External callers should not pass or persist this parameter. | Root password of the primary tenant. |
| primaryOcpClusterId | Long | No | When it is a positive integer, it indicates the ID of the OCP cluster where the primary tenant resides. | Identifies the OCP where the primary tenant resides in a multi-OCP scenario. |
| recoveryDelaySeconds | Long | No | Non-negative integer.nullor0Indicates no delay. |
Latency for log restoration in the standby tenant, in seconds. |
| restoreTenant | Boolean | No | true/false; onlylogTransportMode=NETWORKSometimes meaningful, defaultfalse. |
Whether to create a network standby tenant based on the backup set. |
| enableArbitration | Boolean | No | true/falseDefault:false. |
Whether to enable arbitration for the new standby tenant. |
| serviceName | String | No | String. | The service name of the new tenant. |
| description | String | No | String. | Description of the new tenant. |
| loadType | String | No | EXPRESS_OLTP、COMPLEX_OLTP、HTAP、OLAP、KV、EXPRESS_OLTP_PERF. |
Tenant workload type. |
| zones | Array | Yes | The array cannot be empty. The element structure is described in the following table. | Replica zone configuration for the new tenant. |
| parameters | Array | No | If not specified, the backend uses an empty array by default.[]; cannot be when explicitly passed innull, which allows an empty array. The element structure is described in the following table. |
Tenant parameters and system variables. |
| backupConfig | Object | No | LOG_BACKUPor when backup/archival recovery is required, fill in the information as shown in the following table. |
Backup and recovery configuration. |
Each item in zones[] must contain the following fields:
field |
Type |
Required |
Valid values/Constraints |
Description |
|---|---|---|---|---|
| zones[].name | String | Yes | Cannot be empty. | The name of the zone. |
| zones[].replicaType | String | Yes | FULL、LOGONLY、READONLY、COLUMNSTORE. |
The replica type of this zone. |
| zones[].resourcePool | Object | Yes | The following resource pool fields are required. | Resource pool configuration of the zone. |
| zones[].resourcePool.unitSpecName | String | Yes | Cannot be empty. | Unit specification name. |
| zones[].resourcePool.unitCount | Long | Yes | Cannot be empty. It is recommended to enter a positive integer. The actual available range is determined by the validation of downstream resource pools. | The number of units used in this zone. |
Each element of parameters[] has the following fields:
field |
Type |
Required |
Valid values/Constraints |
Description |
|---|---|---|---|---|
| parameters[].name | String | Yes | Cannot be empty. | Tenant parameter or system variable name. |
| parameters[].value | String | Yes | Cannot be empty. | Parameter value. |
| parameters[].parameterType | String | No | OB_TENANT_PARAMETER(Tenant parameter) orOB_SYSTEM_VARIABLE(System variable). |
Parameter category. If this parameter is not specified, the downstream tenant creation logic will handle it according to the default behavior. |
The fields of backupConfig are as follows. When useCustomStorage=true, both dataBackupUrl and logBackupUrl must be non-empty. Whitespace in the paths will be removed, and consecutive slashes will be normalized.
field |
Type |
Required |
Description |
|---|---|---|---|
| backupConfig.useCustomStorage | Boolean | No | Whether to use a custom backup storage directory. Default:false. |
| backupConfig.backupStorageType | String | No | Backup storage type. The value must be a storage type supported by the current OCP. |
| backupConfig.storageUrl | String | No | The storage path configured for the backup policy. |
| backupConfig.dataBackupUrl | String | Condition Required | The data backup path that must be specified when custom storage is configured. |
| backupConfig.logBackupUrl | String | Condition Required | The log backup path, which is required when custom storage is configured. |
| backupConfig.ossSecretModel | Object | No | Object storage access credentials. The fields areendpoint、accessKeyId、accessKeySecret, all three fields are required;regionThis parameter is required only for AWS S3 scenarios.appIdFor COS scenarios. Sensitive fields must not be written to logs. |
| backupConfig.advancedConfigsList | Array | No | Advanced backup parameters array; each item contains a non-empty string.nameand non-empty string arrays.values. |
Response parameters
Parameter |
Type |
Description |
|
|---|---|---|---|
| successful | Boolean | Returns 0 on success.true. |
|
| data.stepIndex | Integer | The updated step number. | |
| data.stepKey | String | Unique identifier of the step. | |
| data.stepName | String | Step display name. | |
| data.status | String | Current Status:PENDING、RUNNING、SUCCESSFULorFAILED. |
|
| data.autoRun | Boolean | The updated auto-execution switch. | |
| data.stepParam | Object \ | null | The updated parameter of the saved step. If not set, it isnull. |
| data.taskInstanceIds | Array<Long> | Associated OCP task instance ID; an empty array if not available. | |
| data.retryCount | Integer | Current retry count. | |
| data.errorMessage | String \ | null | Information about the most recent failure. |
| data.startTime | Datetime \ | null | Step start time. |
| data.finishTime | Datetime \ | null | Step end time. |
| timestamp | Datetime | The time taken by the server to create the response. | |
| duration | Long | The time consumed by the server for processing, in milliseconds. | |
| status | Integer | HTTP status code. In case of success, it is200. |
|
| traceId | String | Request link ID, used for log troubleshooting. |
Error codes
HTTP |
Error Code |
Description |
|---|---|---|
| 404 | SOP10008 |
The task does not exist. |
| 404 | SOP10015 |
The task has not been started, or the step number does not exist. |
| 400 | SOP10018 |
Step is notPENDINGand cannot be updated. |
| 400 | SOP10019 |
Request modificationautoRun, but the steps cannot be edited. |
| 400 | SOP10002 |
The step parameters do not meet the business validation requirements of the current step. |
Examples
Request example
PATCH /api/v2/sop/tasks/1001/execution/steps/5
{
"stepParam": {
"createStandbyTenantParamJson": {
"name": "standby_tenant_new",
"mode": "MYSQL",
"primaryTenantId": 1002,
"standbyClusterId": 1001,
"logTransportMode": "NETWORK",
"recoveryDelaySeconds": 0,
"restoreTenant": false,
"enableArbitration": false,
"zones": [
{
"name": "zone1",
"replicaType": "FULL",
"resourcePool": {
"unitSpecName": "unit_s1",
"unitCount": 1
}
}
],
"parameters": [
{
"name": "ob_compatibility_mode",
"value": "mysql",
"parameterType": "OB_TENANT_PARAMETER"
}
]
}
}
}
