Skip to content

Add intermediate bookmarking implementation#40

Open
RushiT0122 wants to merge 12 commits into
masterfrom
add-intermediate-bookmarking-implementation
Open

Add intermediate bookmarking implementation#40
RushiT0122 wants to merge 12 commits into
masterfrom
add-intermediate-bookmarking-implementation

Conversation

@RushiT0122

@RushiT0122 RushiT0122 commented May 15, 2024

Copy link
Copy Markdown
Contributor

Description of change

Support ticket TDL-25734:
Tap was writing stream bookmark after complete extraction of all stream records. Because of this issue, in some cases we observed that long running historical syncs, after interruption were restarting from the start data and re-extracting duplicate records.

To fix this issue,

  • For incremental steams, we will order the response and bookmark the max replication value after every offset_bookmark_limit=1000 records.
  • For full table streams, we will save the offset after every offset_bookmark_limit=1000 records

This will allow interrupted extractions resume from the last bookmark value and reduce duplicate record extraction.

Manual QA steps

  • Verified the fix with locally for incremental and full table syncs
  • Verified fix with different offset_bookmark_limit values

Risks

Rollback steps

  • revert this branch

@shantanu73

Copy link
Copy Markdown
Contributor

Please add associated JIRA ticket with this PR


if next(iter(self.replication_keys or []), None):
return state.get('bookmarks', {}).get(stream, default), 0
else:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't need this else statement

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread tap_activecampaign/streams.py Outdated
self.stream_name, bookmark_field, last_datetime))
now_datetime = utils.now()
last_dttm = strptime_to_utc(last_datetime)
LOGGER.info('stream: {}, bookmark_field: {}, last_datetime: {}, offset: {}'.format(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use f-strings instead of format.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@RushiT0122 RushiT0122 requested a review from shantanu73 May 15, 2024 12:18
@RushiT0122

Copy link
Copy Markdown
Contributor Author

Addressed the review comments.

@shantanu73

Copy link
Copy Markdown
Contributor

Verified interrupted sync and intermediate bookmarking at my end. Apart from my previous comments everything looks fine.
Approving this.
Please merge after the CCi passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants