Skip to content

Fix sorting of stream during full_table sync with composite PK#108

Merged
dmosorast merged 4 commits intomasterfrom
fix/composite-key-query
Sep 20, 2019
Merged

Fix sorting of stream during full_table sync with composite PK#108
dmosorast merged 4 commits intomasterfrom
fix/composite-key-query

Conversation

@dmosorast
Copy link
Contributor

Currently, the resumable full_table query is built with the WHERE clause of the format:

WHERE pk1 > bookmark1 AND pk2 > bookmark2 ...

In this situation, it doesn't actually replicate all records in the table when resuming, due to the usage of AND. The set is bounded from below by the latest value for all columns in the PK exclusively, rather than cascading through the PK fields like the behavior of ORDER BY. This PR will change the query building for resuming full_table extraction to be of the form:

WHERE pk1 > bookmark1 OR (pk1 = bookmark1 AND pk2 > bookmark2) ...

This will give the tap a true bookmark into the previous, interrupted sync.

@dmosorast dmosorast merged commit 47f3139 into master Sep 20, 2019
@dmosorast dmosorast deleted the fix/composite-key-query branch September 20, 2019 14:34
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.

1 participant