Updated on 2025-01-26 GMT+08:00

Modifying the Comparison Policy

Function

This API is only available for synchronization tasks from MySQL to MySQL, MySQL to TaurusDB, MySQL to GaussDB(DWS), TaurusDB to MySQL, migration tasks from MySQL to MySQL and MySQL to TaurusDB, DR tasks from MySQL to MySQL, MySQL to TaurusDB, TaurusDB to TaurusDB, and DDM to DDM.

URI

PUT /v5/{project_id}/jobs/{job_id}/compare-policy

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

For details, see Obtaining a Project ID.

job_id

Yes

String

Task ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

MIME type of the request body. Use the default value application/json. For APIs used to upload objects or images, the value varies depending on the flow type.

The default value is application/json.

X-Auth-Token

Yes

String

User token obtained from IAM.

It is a response to the API for obtaining a user token. This API is the only one that does not require authentication.

After a request is processed, the value of X-Subject-Token in the header is the token value.

X-Language

No

String

Request language type.

Default value: en-us

Enumerated values:

  • en-us
  • zh-cn
Table 3 Request body parameters

Parameter

Mandatory

Type

Description

action

Yes

String

Indicates whether to enable the comparison policy.

  • open
  • closed

period

No

String

Comparison policy period. This parameter is mandatory when action is set to open.

  • Weekly comparison: The format is * * 1,3,5, where 1, 3, 5 indicates Monday, Wednesday, and Friday, respectively. Set this parameter based on the site requirements.
  • Daily comparison: The value is fixed at * * 1,2,3,4,5,6,7.
  • Hourly comparison: The value is fixed at * * 1,2,3,4,5,6,7.

begin_time

No

String

Start time of the comparison policy. This parameter is mandatory when action is set to open. The value is UTC time in the 24-hour format of HH:mm:ss. For example, 00:00:00 indicates 00:00:00 UTC time and 08:00:00 Beijing time (UTC+08:00).

end_time

No

String

End time of the comparison policy. This parameter is mandatory when action is set to open. The value is UTC time in the 24-hour format of HH:mm:ss. For example, 04:00:00 indicates 04:00:00 UTC time and 12:00:00 Beijing time (UTC+08:00).

compare_type

No

Array of strings

Comparison type. This parameter is mandatory when action is set to open.

  • object_comparison: object-level comparison.
  • lines: row comparison.
  • account: Account-level comparison.

compare_policy

No

String

Comparison policy.

  • normal: One-to-one comparison.
  • manyToOne: Many-to-one comparison.

interval_hour

No

Integer

Interval at which the comparison is performed. This parameter is required when the comparison is performed by hour. The unit is hour.

Response Parameters

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum length: 12

Maximum length: 12

error_msg

String

Error message.

Minimum length: 1

Maximum length: 512

Example Request

  • Enabling periodic comparison and setting the policy to daily comparison, the effective time to 00:00:00 to 04:00:00 UTC and 08:00:00 to 12:00:00 Beijing time (UTC+08:00), and the comparison type to row comparison
    https://{endpoint}/v5/5237e10fe9aa4ad5b16b6a5245248314/jobs/163b98e8-6088-46c3-8b86-c18fea6jb502/compare-policy
    
    {
      "action" : "open",
      "begin_time" : "00:00:00",
      "compare_policy" : "normal",
      "compare_type" : [ "lines" ],
      "end_time" : "04:00:00",
      "period" : "* * 1,2,3,4,5,6,7"
    }
  • Enabling periodic comparison and setting the policy to Monday, Wednesday, and Friday every week, the effective time to 00:00:00 to 09:00:00 UTC and 08:00:00 to 17:00:00 Beijing time (UTC+08:00), and the comparison type to row comparison and object comparison
    https://{endpoint}/v5/5237e10fe9aa4ad5b16b6a5245248314/jobs/163b98e8-6088-46c3-8b86-c18fea6jb502/compare-policy
    
    {
      "action" : "open",
      "begin_time" : "00:00:00",
      "compare_type" : [ "lines", "object_comparison" ],
      "end_time" : "09:00:00",
      "period" : "* * 1,3,5"
    }
  • Disabling periodic comparison
    https://{endpoint}/v5/5237e10fe9aa4ad5b16b6a5245248314/jobs/163b98e8-6088-46c3-8b86-c18fea6jb502/compare-policy
    
    {
      "action" : "close"
    }
  • Enabling periodic comparison and setting the policy to hourly comparison, the effective time to 00:00:00 to 04:00:00 UTC and 08:00:00 to 12:00:00 Beijing time (UTC+08:00), the comparison interval to 1 hour, and the comparison type to row comparison and object comparison
    https://{endpoint}/v5/5237e10fe9aa4ad5b16b6a5245248314/jobs/163b98e8-6088-46c3-8b86-c18fea6jb502/compare-policy
    
    {
      "action" : "open",
      "begin_time" : "00:00:00",
      "compare_policy" : "normal",
      "compare_type" : [ "lines", "object_comparison" ],
      "end_time" : "04:00:00",
      "period" : "* * 1,2,3,4,5,6,7",
      "interval_hour" : 1
    }

Example Response

Status code: 200

OK

{ }

Status code: 400

Bad Request

{
  "error_code" : "DRS.10000001",
  "error_msg" : "Failed."
}

Status Code

Status Code

Description

200

OK

400

Bad Request

Error Code

For details, see Error Code.