API Actions: PromoteToPrimary

API Actions: PromoteToPrimary

 

Request Syntax:

XML

POST /api/PromoteToPrimary HTTP/1.1
Host: use.your.host.name:82
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Content-Type: application/xml
X-Amz-Date: 20171115T202130Z
Authorization: AWS4-HMAC-SHA256 Credential= UQOPWUVNBALABCABCABC/20171115/us-east-1/cloudbasic/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date, Signature=995374189c189e8e68ed3de82c1764ca11971711fb5179eeab2b19edd883dd74
 
<?xml version="1.0" encoding="utf-8"?>
<PromoteToPrimaryRequest>
	<ReplicationId>998acaec-9211-4dac-b90b-196fd1d17993</ReplicationId>
	<CancelRunningCtProcess>true</CancelRunningCtProcess>
	<IgnoreDbDiscrepancies>true</IgnoreDbDiscrepancies>
</PromoteToPrimaryRequest>

JSON

POST /api/PromoteToPrimary HTTP/1.1
Host: use.your.host.name:82
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Content-Type: application/json
X-Amz-Date: 20171115T202130Z
Authorization: AWS4-HMAC-SHA256 Credential= UQOPWUVNBALABCABCABC/20171115/us-east-1/cloudbasic/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date, Signature=995374189c189e8e68ed3de82c1764ca11971711fb5179eeab2b19edd883dd74
 
{
	"replicationId": "998acaec-9211-4dac-b90b-196fd1d17993",
	"cancelRunningCtProcess"  : "true",
	"ignoreDbDiscrepancies" : "true"
}

 

Request Parameters

Parameter Description Required
ReplicationId The ReplicationID returned in the CreateReplication response. Yes
Type: String
Default: None
CancelRunningCtProcess The User Name that will be used when trying to login to the CloudBasic console. Must be unique among all users. Yes
Type: String
Default: False
Valid value: true/ false
IgnoreDbDiscrepancies Set this tag True to promote replica to primary even if discrepancies are found in 1 or more tables, or source DB is inaccessible.
Note:
If the tag is not included, or set False, an error will be returned if discrepancies are found in 1 or more tables, or source database is inaccessible. To retrieve discrepancy report details, call /AnalyzeReplication method.
Yes
Type: String
Default: False
Valid value: true/ false

Note:
In this version, DataReplication will be turned off first, and then attempt to promote the respective DB to primary. If there is a running change tracking process, this will result into an error. Keep calling /PromoteToPrimary until the running process completes at which point promotion to primary will be initiated. In cases where the primary database is no longer accessible, instead of waiting for the running change tracking process to finish, a forceful cancellation requested via the CancelRunningCtProcess tag.

Important: Even if PromoteToPrimary fails, DataReplication will remain turned off. Need to call /AlterRpelication to turn DataReplication back on.

 

Request Headers

This implementation uses only request headers that are common to all operations. For more information please see the section Common Request Headers

 

Response Syntax:

XML

HTTP/1.1 200
status: 200
 
<?xml version="1.0" encoding="utf-8"?>
<PromoteToPrimaryResponse>
    <DiscrepanciesFound>true</DiscrepanciesFound>
    <Status>Running</Status>
    <IsRunningCtProcessCancelled>true</IsRunningCtProcessCancelled>
    <IsDbDisrepancyFound>true</IsDbDisrepancyFound>
</PromoteToPrimaryResponse>

JSON

HTTP/1.1 200
status: 200

{
	"discrepanciesFound": false,
	"status": "Running"
}

 

Response Parameters

Parameter Description Optional
DiscrepanciesFound It is True when discrepancies in 1 or more tables were found.
Note:
If PromoteToPrimary is requested with <IgnoreDbDiscrepancies>true</IgnoreDbDiscrepancies>, the replica DB will be promoted to primary even if discrepancies in 1 or more tables are found or source DB is inaccessible. To retrieve discrepancy report details call /AnalyzeReport (applicable if source DB is accessible).
No
Status The current status of the PromoteToPrimary process. Possible values include:

  • Running
  • Failed
  • Success

Note:
Even if the asynchronous process completes instantly with status Failed or Success, logs will not be returned. Logs can be requested via api/PromoteToPrimaryStatus method.

No
IsRunningCtProcessCancelled It is True when a running Change Tracking process had to be forcefully canceled on this server or a remote cluster server. See tag CancelRunningCtProcess in api/PromoteToPrimary method. Yes
IsDbDisrepancyFound It is True when one or more DB discrepancies (row count) between source and replica were ignored. See IgnoreDbDiscrepancies tag in api/PromoteToPrimary method. This tag is not included if connection to primary couldn't be established when api/PromoteToPrimary was called. Yes

 

Error Response Syntax:

XML

HTTP/1.1 400
status: 400
 
<?xml version="1.0" encoding="utf-8"?>
<ErrorResponse> 
	<RequestId>request-id</RequestId> 
	<Errors> 
		<Error> Change Tracking process is still running </Error> 
	</Errors> 
</ErrorResponse>

JSON

HTTP/1.1 400
status: 400

{
   "errors": [
       "Change Tracking process is still running"
	],
	"requestId": 21
}