In some scenarios we need stop and resume a task. However for Hana trigger-based CDC task, if the option "Use log table" is enabled, resuming the task, or while you trying to startup the task from a given timestamp, you may get the below information (with SOURCE_CAPTURE set to Trace):
2021-09-09T22:12:34:881897 [SOURCE_CAPTURE ]T: Resume from 'timestamp:2021-09-09T20:30:00'
2021-09-09T22:12:34:881897 [SOURCE_CAPTURE ]T: Start from timestamp is not supported in the Log-Table mode
Environment
Replicate versions 6.6/7.0
Replicate version 2021.5
The option "Use log table" is enabled by an Internal Parameter in versions 6.6/7.0. In version 2021.5 it's in GUI property like below:
Resolution
Start the task by source change position, rather than the timestamp. Here is a query to prepare the stream position in the correct format by a timestamp:
;Get the stream position by timestamp ;Before using the query, please replace the $SCHEMA$ to your artifacts schema where the table "attrep_cdc_log" is located. ;The timestamp format is 'YYYY-MM-DD HH:MM:SS' (Note, the timestamp should be the one on HAHA Server side, not the replicate server's) ;The range will be from the first (not included) event that happened after the time specified to the last (included) event in the table
SELECT 'V1:'||MIN("$rowid$")||':'||MAX("$rowid$")||':0:'||MIN("$rowid$") AS "STREAM POSITION" from "$SCHEMA$"."attrep_cdc_log" WHERE "CHANGE_EVENT_TIME" >= 'YYYY-MM-DD HH:MM:SS'
A unique row will be returned:
V1:670636:686112:0:670333
Then in the Replicate UI, start the task by source change stream position:
Is this process still the way to go with Replicate 2022.11.0.628? Asking because we have a HANA trigger-based CDC task and we were hoping that we could just use EM API in a script that would automate the stop and resume actions.