Creating a Comparison Task
Function
This API is used to create a comparison task
Constraints
In the current version, a comparison task can be created only when the task is in the INCRE_TRANSFER_STARTED state. The parent task cannot call the API.
URI
POST /v3/{project_id}/jobs/create-compare-task
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID of a tenant in a region For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
The content type. The default value is application/json. |
X-Auth-Token |
Yes |
String |
User token obtained from IAM. |
X-Language |
No |
String |
Request language type Default value: en-us Values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
job_id |
Yes |
String |
Task ID. |
object_level_compare_type |
No |
String |
Object-level comparison type. If the value is empty, the object-level comparison is not created. If both object_level_compare_type and data_level_compare_info are left empty, only the created comparison task list is queried. Value: objects |
data_level_compare_info |
No |
Object |
Data-level comparison information. If no data-level comparison is created, this parameter does not need to be transferred. If both object_level_compare_type and data_level_compare_info are left empty, only the created comparison task list is queried. For details, see Table 4. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
conflict_policy |
Yes |
String |
Only one unfinished data-level comparison task can exist. This field determines how to process unfinished data-level comparison tasks. cancel: Cancel the unfinished task and create a new one. keep: Retain the unfinished task. Values:
|
compare_type |
Yes |
String |
Data-level comparison type. lines: indicates row comparison. contents: indicates value comparison. Values:
|
compare_mode |
No |
String |
Data-level comparison mode. If the value is empty, the object information needs to be transferred in compare_object_infos or compare_object_infos_with_token. quick_comparison: indicates quick comparison, which can be used only by whitelisted users. Default value: quick_comparison Value: quick_comparison |
start_time |
No |
String |
Start time of a comparison task. If the value is empty, the task is started immediately. |
compare_object_infos |
No |
Array of objects |
Data-level comparison object. In non-quick comparison mode, either compare_object_infos or compare_object_infos_with_token must be specified based on the migration scenario. For details, see Table 5. |
compare_object_infos_with_token |
No |
Array of objects |
Object for data-level comparison (Cassandra DR only, with token information). In non-quick comparison mode, either compare_object_infos or compare_object_infos_with_token must be specified based on the migration scenario. For details, see Table 6. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
db_name |
Yes |
String |
Database name. |
table_name |
No |
Array of strings |
List of table names in the database. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
db_name |
Yes |
String |
Database name. |
table_name_with_token |
No |
Array of objects |
List of tables (with tokens) in the database. For details, see Table 7. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
job_id |
String |
Task ID |
object_level_compare_create_result |
Object |
Result of creating an object-level comparison task. For details, see Table 9. |
data_level_compare_create_result |
Object |
Result of creating a data-level comparison task. For details, see Table 9. |
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Parameter |
Type |
Description |
---|---|---|
compare_task_id |
String |
After the comparison task is created, the ID of the comparison task is returned for querying the result of the comparison task. |
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Example Request
Creating object-level comparison and data-level row comparison tasks
https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/create-compare-task { "job_id" : "94800607-3cd8-4f7d-a340-63a10f8jb502", "object_level_compare_type" : "objects", "data_level_compare_info" : { "conflict_policy" : "keep", "compare_type" : "lines", "compare_mode" : null, "start_time" : null, "compare_object_infos" : [ { "db_name" : "may_5", "table_name" : [ "table_name_0", "table_name_1" ] } ] } }
Example Response
Status code: 200
OK
{ "job_id" : "94800607-3cd8-4f7d-a340-63a10f8jb502", "object_level_compare_create_result" : { "compare_task_id" : "dc1683d9-bdf2-4be9-967f-6ef0953369bc" }, "data_level_compare_create_result" : { "compare_task_id" : "08cad1f8-9de2-42fa-b8ce-6c36daf730f6" } }
Status Code
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
Error Code
For details, see Error Code.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.