- Notifications
You must be signed in to change notification settings - Fork 4.9k
[source-postgres] Disable incremental sync for view in Postgres xmin replication mode #42108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
| } | ||
| | ||
| public static AirbyteStream setFullRefreshToView(final JdbcDatabase database, final AirbyteStream stream) throws SQLException { | ||
| if (isStreamAView(database, stream)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this means we will run this query N times, once for all N streams. Could we load up the list of streams once instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! I just pushed a commit that implements this idea. Please take another look, thanks!
| */ | ||
| public static AirbyteStream overrideSyncModes(final AirbyteStream stream, Map<String, List<String>> viewsBySchema) { | ||
| if (isStreamAView(viewsBySchema, stream)) { | ||
| return stream.withSupportedSyncModes(Lists.newArrayList(SyncMode.FULL_REFRESH)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but I thought in an xmin sync, full refreshes were still incremental... and the therefore still dependent on a usable cursor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The full refreshes are still incremental (based on CTID), but I didn't think a cursor needed to be explicitly set? So I think fixing the sync modes might work
cc : @xiaohansong who might know this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes - cursor is not needed for full refresh. We should support full refresh anyway, for views they would be non resumable.
...ce-postgres/src/main/java/io/airbyte/integrations/source/postgres/PostgresCatalogHelper.java Show resolved Hide resolved
…replication mode (#42108) Fixes airbytehq/airbyte-internal-issues#8559 Fixes airbytehq/oncall#5581 This patch disables incremental sync when a stream is found to be a view. This is done only for Postgres sources configured in xmin mode. This is done by adding a check in discovery() to only allow FULL_REFRESH sync mode.
| @theyueli @xiaohansong If I understand this change correctly, we can no longer sync a view in an incremental mode, right? I think instead of removing the option out right, this change should be implemented in a different way. |
Only when using the xmin replication mode |
| @evantahler precisely, that's what our usecase is. We just have a filter on the start date of the source table in our view, everything else stays as is. |
…es xmin replication mode (airbytehq#42108)" This reverts commit c7a1213

What
Fixes https://github.com/airbytehq/airbyte-internal-issues/issues/8559
Fixes https://github.com/airbytehq/oncall/issues/5581
This patch disables incremental sync when a stream is found to be a view. This is done only for Postgres sources configured in xmin mode.
How
Adding a check in discovery() to only allow
FULL_REFRESHsync mode.Review guide
User Impact
In the UI, user will only see full refresh sync option for view. See the picture below.

Can this PR be safely reverted and rolled back?