API Actions: AnalyzeReplication

API Actions: AnalyzeReplication

This action generates a report containing information about pending changes and discrepancies (SQL to SQL replications only).

Request Syntax:

JSON

POST /api/AnalyzeReplication 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": "594ed5c8-e0aa-4fd0-987f-fcfd2aaf1763",
        "tablesWithoutPkOnly": false, -- 12.319 and above
        "excludeReplicaRowCounts": false, default=false; value=true is not compatible with "preciseRowCounts":{"iterations" > 0}
        "tableList": "[dbo].[table1], [dbo].[table2]" -- 12.298 and above: not required; default = all tables  
        
         -- 12.319 and above: 
              if discrepancies are found for one or a subset of tables, 
              determined based on table row counts obtained from server statistics,
              for ONLY the subset of tables marked to potentially have discrepancies, 
              will confirm discrepancies by selecting direct table row numbers. 
        "preciseRowCounts": { 
           "maxIterations": 2, -- default=1; maxInterations=0 turns preciseRowCounts off;
                                  number of times to repeat selecting precise counts, if discrepancies persist 
                                  (for at least one table), after pausing for the time specified in delayInSeconds. 
                                  This also allows delayed changes to be registered by CDC. 
           "delayInSeconds" : 5 -- default=5; delay/pause prior to running the first iteration, and prior to running iterations thereafter
 
        },
        "parallelTablesLimit": 5 -- 13.32 and above: Default = 1; limits the number of concurrently processed tables
}

Request Parameters

Parameter Description Required
ReplicationId The GUID that identifies the Replication to be analyzed as returned by CreateReplication API method. Yes
Type: String
Default: None
TablesWithNoPrimaryKeysOnly
(12.122 and above)
If this parameter is set to True, returned result would include only tables without Primary Keys. No
Type: boolean
Default: False
ExcludeReplicaRowCounts
(12.122 and above)
If this parameter is set to True, returned result would not include replica row counts. No
Type: boolean
Default: False
TableList
(12.298 and above)
If this parameter is set to True, returned result would include information only for the requested tables. No
Type: boolean
Default: False

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:

Response Syntax with status Success for a Redshift Replication – using XML parameter encoding:

<?xml version="1.0" encoding="utf-8"?>
<AnalyzeReplicationResponse>
	<RequestTimestamp>Friday, February 2, 2018 1:38:24 AM</RequestTimestamp>
	<LastSuccessfulCtEndTime>Friday, February 2, 2018 1:37:31 AM</LastSuccessfulCtEndTime>
	<LastSuccessfulRedshiftEndTime>Friday, February 2, 2018 1:37:31 AM</LastSuccessfulRedshiftEndTime>
	<Tables>
		<Table>
			<Name>[dbo].[Departments]</Name>
			<SourceCount>113</SourceCount>
			<PendingChanges>0</PendingChanges>
			<ChangeTracking>OK for Change Tracking</ChangeTracking>
			<StagingCount>113</StagingCount>
			<RedshiftCount>13</RedshiftCount><!-- Returned only if the replication type is MSSQL-to-Redshift -->
			<RedshiftPendingChanges>100</RedshiftPendingChanges><!-- Returned only if the replication type is MSSQL-to-Redshift -->
		</Table>
		<Table>
			<Name>[dbo].[Managers]</Name>
			<SourceCount>1100</SourceCount>
			<PendingChanges>0</PendingChanges>
			<ChangeTracking>OK for Change Tracking</ChangeTracking>
			<StagingCount>1100</StagingCount>
			<RedshiftCount>1050</RedshiftCount>
			<RedshiftPendingChanges>50</RedshiftPendingChanges>
		</Table>
		<Table>
			<Name>[dbo].[NoPkTable]</Name>
			<SourceCount>0</SourceCount>
			<PendingChanges>0</PendingChanges>
			<ChangeTracking>Excluded from Change Tracking</ChangeTracking>
			<StagingCount>0</StagingCount>
			<RedshiftCount>0</RedshiftCount>
			<RedshiftPendingChanges>0</RedshiftPendingChanges>
		</Table>
		<Table>
			<Name>[dbo].[TempDepartments]</Name>
			<SourceCount>10</SourceCount>
			<PendingChanges>0</PendingChanges>
			<ChangeTracking>Excluded from Change Tracking</ChangeTracking>
			<StagingCount>0</StagingCount>
			<RedshiftCount>0</RedshiftCount>
			<TempTablePendingChanges>0</TempTablePendingChanges>
		</Table>
	</Tables>
</AnalyzeReplicationResponse>

Response Syntax with status Running – using XML parameter encoding:

<?xml version="1.0" encoding="utf-8"?>
<AnalyzeReplicationResponse>
   <RequestTimestamp>Wednesday, November 8, 2017 12:00:17 AM</RequestTimestamp>
   <SeedingStatus>Running</SeedingStatus>
   <ReplicationTables></ReplicationTables>
</AnalyzeReplicationResponse>

Response Syntax with status Success:
Note: 12.298 and above: if parameter <TableList> is provided, the result list would included information only for the requested list of tables.

JSON

HTTP/1.1 200
status: 200
{
	"requestTimestamp":"Wednesday, November 8, 2017 12:00:17 AM",
	"seedingStatus":"Success",
	"lastSuccessfulCtEndTime": "Wednesday, November 8, 2017 9:00:17 AM",
	"replicationTables": [
        {
            "name": "[dbo].[__MigrationHistory]",
            "sourceCount": 1,
            "destinationCount": 1,
            "pendingChanges": 0,
            "changeTracking": "Yes",
            "hasDiscrepancies": "false", 
            "isReseeding": "false" -- 12.280 and later versions
        },
        {
            "name": "[dbo].[AspNetRoles]",
            "sourceCount": 1,
            "pendingChanges": 0,
            "destinationCount": 1,
            "changeTracking": "Yes",
            "hasDiscrepancies": "false",
            "isReseeding": "false" 
        }
    ]
}

XML

HTTP/1.1 200
status: 200
<?xml version="1.0" encoding="utf-8"?>
<AnalyzeReplicationResponse>
	<RequestTimestamp>Wednesday, November 8, 2017 12:00:17 AM</RequestTimestamp>
	<SeedingStatus>Success</SeedingStatus>
	<LastSuccessfulCtEndTime>Wednesday, November 8, 2017 12:00:17 AM</LastSuccessfulCtEndTime>
	<ReplicationTables>
		<Table>
			<Name>[dbo].[__MigrationHistory]</Name>
			<SourceCount>1</SourceCount>
			<DestinationCount>1</DestinationCount>
			<PendingChanges>0</PendingChanges>
			<ChangeTracking>OK for Change Tracking</ChangeTracking>
                        <HasDiscrepancies>false</HasDiscrepancies>
                        <IsReseeding>false</IsReseeding> <!-- 12.280 and later -->
		</Table>
		<Table>
			<Name>[dbo].[AspNetRoles]</Name>
			<SourceCount>1</SourceCount>
			<DestinationCount>1</DestinationCount>
			<PendingChanges>0</PendingChanges>
			<ChangeTracking>OK for Change Tracking</ChangeTracking>
                        <HasDiscrepancies>false</HasDiscrepancies>
                        <IsReseeding>false</IsReseeding>
		</Table>
	</ReplicationTables>
</AnaylzeReplicationResponse>

Response Parameters

Response Parameters for a Redshift Replication:

Parameter Description Optional
RequestTimestamp The time of the request submission. No
LastSuccessfulCtEndTime Time since pending changes (see PendingChanges) have been accumulating. Yes
LastSuccessfulRedshiftEndTime Last Successful Redshift export process end time. Yes
Tables The list of tables that are subject to replication along with status information.
When SeedingStatus is Running, the list of tables is not available.
No report is generated if either the Seeding failed or it was canceled in the UI.
Yes
Name The name of the table.
SourceCount Number of records in the source table.
PendingChanges Number of changes that still need to be replicated from the source to the staging SQL Server table. This value represents the counts at the time of the request submission (see RequestTimestamp).
ChangeTracking Indicates whether the ChangeTracking is activated for the table.
StagingCount Number of records in the staging SQL Server table.
RedshiftCount Number of records in the destination Redshift table.
RedshiftPendingChanges Number of changes that still need to be replicated from the staging SQL Server table to the Redshift table. This value represents the counts at the time of the request submission (see RequestTimestamp).

Response Parameters for a SQL-to-SQL Replication:

Parameter Description Optional
RequestTimestamp The time of the request submission. No
SeedingStatus The current status of the AnalyzeReplication process. Possible values include:

  • Running
  • RunningWithErrors
  • RunningWithWarnings
  • Failed
  • Canceled *
  • Success
  • CompletedWithError
  • CompletedWithWarning
No
LastSuccessfulCtEndTime Time since pending changes (see PendingChanges) have been accumulating. Yes
ReplicationTables The list of tables that are subject to replication along with status information.
When SeedingStatus is Running, the list of tables is not available.
No report is generated if either the Seeding failed or it was canceled in the UI.
Yes
Name The name of the table.
SourceCount
---PendingChanges
Number of records in the source table.
---
Number of changes that still need to be replicated from the staging to the destination table. This value represents the counts at the time of the request submission (see RequestTimestamp).
DestinationCount Number of records in the destination table.
HasDiscrepancies

---

IsReseeding
(12.280 and later)

Indicates if there are discrepancies in source:destination count (if PendingChanges=0 and SourceCount<>DestinationCount)
---Indicates if the table is in the process of reseeding (initiated via calling /api/ReseedTable or in UI console). If IsReseeding=True then HasDiscrepancies value must be disregarded as NA.
ChangeTracking Indicates whether the ChangeTracking is activated for the table.

*This status indicates that Seeding was canceled in the UI.

Error Response Syntax:

JSON

HTTP/1.1 400
status: 400

{
   "errors": [
       "error 1"
	],
	"requestId": 20
}


XML

HTTP/1.1 400
status: 400

<?xml version="1.0" encoding="utf-8"?>
<ErrorResponse> 
	<RequestId>request-id</RequestId> 
	<Errors> 
		<Error> {ReplicationId}:Replication not found </Error> 
	</Errors> 
</ErrorResponse>