# Perform a switchover precheck
Description
You can call this operation to perform a precheck before a switchover between the primary and standby tenants.
Call description
Prerequisites
You have the permission to modify tenants.
For more information about the permissions, see Overview and Overview.
You have passed the authentication for the OceanBase Cloud Platform (OCP) application service.
Request path
POST /api/v2/ob/clusters/{id}/tenants/{tenantId}/switchoverPreCheck
Request parameters
Path parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| id | Integer | Yes | 1 | The ID of the cluster. |
| tenantId | Integer | Yes | 1001 | The ID of the tenant. |
Body parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| tenantId | Long | Yes | 1 | The ID of the primary tenant. |
| standbyTenantId | Long | Yes | 2 | The ID of the standby tenant. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| data | SwitchoverPreCheckResult | The check result. For more information, see Data structure of SwitchoverPreCheckResult. |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The amount of time taken by the server to process the request, in milliseconds. |
| status | Integer | The HTTP status code. |
| traceId | String | The trace ID of the request. This trace ID is used for troubleshooting. |
| server | String | The address of the application server that responded to the request. |
Data structure of SwitchoverPreCheckResult
| Parameter | Type | Description |
|---|---|---|
| valid | Boolean | Indicates whether the precheck succeeded. |
| tenantId | Long | The ID of the primary tenant. |
| name | String | The name of the primary tenant. |
| clusterId | Long | The ID of cluster to which the primary tenant belongs. |
| clusterName | String | The name of cluster to which the primary tenant belongs. |
| standbyCheckResults | ObTenantPreCheckResult | For more information, see Data structure of ObTenantPreCheckResult. |
Data structure of ObTenantPreCheckResult
| Parameter | Type | Description |
|---|---|---|
| valid | Boolean | Indicates whether the standby tenant is available for switchover. |
| tenantId | Long | The ID of the standby tenant. |
| name | String | The name of the standby tenant. |
| clusterId | Long | The ID of cluster to which the standby tenant belongs. |
| clusterName | String | The name of cluster to which the standby tenant belongs. |
| syncScn | Long | The synchronization latency of the standby tenant. |
| primaryTenantServiceName | String | The service name of the primary tenant. |
| checkResults | PreCheckResult | The failure information if the precheck failed. For more information, see Data structure of PreCheckResult. |
Data structure of PreCheckResult
| Parameter | Type | Description |
|---|---|---|
| warning | Boolean | Indicates whether a warning is generated as the precheck result. The value true indicates a warning, which does not affect the switchover process. The value false indicates an error, which will affect the switchover process. |
| errorCode | String | The error code. |
| errorMessage | String | The error message. |
Examples
Sample request
POST /api/v2/ob/clusters/{id: [\\d]+}/tenants/{tenantId: [\\d]+}/switchoverPreCheck
Body:
{
"tenantId": 1,
"standbyTenantId": 2
}
Sample response
{
"data": {
"clusterId": 3000009,
"clusterName": "OB42_B",
"name": "ohayo_1",
"standbyCheckResults": [
{
"checkResults": [
{
"errorCode": "OBE26009",
"errorMessage": "This operation is not allowed because the log synchronization latency of the ohayo_2 tenant is 14,883,430 ms, which exceeds 10,000 ms."
"warning": false
},
{
"errorCode": "OBE26107",
"errorMessage": "Automatic routing cannot be implemented after the switchover because the clusters of the primary and standby tenants are not associated with the same OBProxy cluster.",
"warning": true
}
],
"clusterId": 3000010,
"clusterName": "OB424_A",
"name": "ohayo_2",
"tenantId": 2000025,
"valid": false
}
],
"tenantId": 2000022,
"valid": false
},
"duration": 624,
"server": "3af57a8e6b",
"status": 200,
"successful": true,
"timestamp": "2024-07-23T17:15:57.809+08:00",
"traceId": "ba76464b48326028"
}