Skip to content
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

Destinations CDK: Correctly detect when real raw/final table is correct generation during truncate sync #42503

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

edgao
Copy link
Contributor

@edgao edgao commented Jul 24, 2024

from https://github.com/airbytehq/airbyte-internal-issues/issues/8784, for the new interfaces. I'll stack PRs on top of this for bigquery+redshift+snowflake.

add a new check for the real raw table during truncate sync startup, to see if it belongs to the correct generation. Also handle this new behavior during sync finalization (i.e. don't overwrite the raw table if we weren't using a temp raw table to begin with).

Adds two new unit tests for this.

Copy link

vercel bot commented Jul 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Visit Preview Aug 19, 2024 5:16pm

@octavia-squidington-iii octavia-squidington-iii added the CDK Connector Development Kit label Jul 24, 2024
Copy link
Contributor Author

edgao commented Jul 24, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @edgao and the rest of your teammates on Graphite Graphite

@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch from 3175892 to 5f9fbcf Compare July 24, 2024 17:43
@@ -85,7 +85,7 @@ class AbstractStreamOperationTest {
val initialState =
mockk<DestinationInitialStatus<MinimumDestinationState.Impl>> {
every { streamConfig } returns this@Truncate.streamConfig
every { initialRawTableStatus } returns mockk<InitialRawTableStatus>()
every { initialRawTableStatus.rawTableExists } returns false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these diffs are just to handle the new behavior. They don't affect the test in any relevant way.

@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch 2 times, most recently from dbcc2c2 to d59f5d8 Compare July 24, 2024 17:55
@edgao edgao marked this pull request as ready for review July 24, 2024 17:55
@edgao edgao requested a review from a team as a code owner July 24, 2024 17:55
Copy link
Contributor

@gisripa gisripa left a comment

Choose a reason for hiding this comment

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

lgtm.

looks like line 190-198 & 201-209 are same, wondering if there is a a negative guard condition to return early (ignore if it gets ugly with !tmpTableExists || something..)

@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch from d59f5d8 to 3d9cf10 Compare July 24, 2024 18:19
@edgao
Copy link
Contributor Author

edgao commented Jul 24, 2024

(copying from DM)

line 190-198 & 201-209 are same

trying to do this without that duplication yields a weird if -> if -> early return, which seems confusing. leaving it as-is

@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch from 3d9cf10 to 341ae0d Compare July 26, 2024 17:45
@edgao edgao changed the base branch from master to edgao/expected_broken_bigquery_tests July 26, 2024 17:45
@edgao edgao force-pushed the edgao/expected_broken_bigquery_tests branch from d9889dc to bf62d6b Compare July 26, 2024 20:29
@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch from 341ae0d to 8a53e44 Compare July 26, 2024 20:29
@edgao edgao force-pushed the edgao/expected_broken_bigquery_tests branch from bf62d6b to aef6bf6 Compare July 26, 2024 22:44
@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch from 8a53e44 to 3922cf7 Compare July 26, 2024 22:44
@edgao edgao force-pushed the edgao/expected_broken_bigquery_tests branch from aef6bf6 to 6f61517 Compare July 29, 2024 16:33
@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch from 3922cf7 to b9bf10d Compare July 29, 2024 16:33
@edgao
Copy link
Contributor Author

edgao commented Jul 29, 2024

from #42514 - this doesn't correctly handle the final table >.>

i.e. the raw table is correctly preserved during the second sync, but the final table is still nuked (b/c we unconditionally create a temp final table, T+D ignores the previous sync's records b/c they have nonnull loaded_at, and then we overwrite the final table using the empty temp final table)

@edgao edgao force-pushed the edgao/expected_broken_bigquery_tests branch 3 times, most recently from cc09978 to 020d792 Compare August 6, 2024 17:11
@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch from 7fdef81 to ad24e27 Compare August 6, 2024 17:11
@edgao edgao force-pushed the edgao/expected_broken_bigquery_tests branch from 020d792 to be63bdc Compare August 9, 2024 22:46
@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch from ad24e27 to 1d5f768 Compare August 9, 2024 22:46
@edgao edgao changed the base branch from edgao/expected_broken_bigquery_tests to edgao/refresh_massive_test August 9, 2024 22:46
@edgao edgao changed the title Destinations CDK: Correctly detect when real raw table is correct generation during truncate sync Destinations CDK: Correctly detect when real raw/final table is correct generation during truncate sync Aug 9, 2024
@edgao edgao force-pushed the edgao/refresh_massive_test branch from 7d4f94e to 4c8180c Compare August 12, 2024 17:18
@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch 2 times, most recently from dd2e935 to 707b94d Compare August 12, 2024 18:40
@edgao edgao changed the base branch from edgao/refresh_massive_test to master August 12, 2024 18:40
@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch 3 times, most recently from 790075d to 3aa5155 Compare August 12, 2024 23:35
@edgao edgao requested a review from gisripa August 13, 2024 16:08
Copy link
Contributor

@gisripa gisripa left a comment

Choose a reason for hiding this comment

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

lgtm.

// In this case, there is no existing temp raw table, and there is a real raw table
// which already belongs to the correct generation.
// Check for that case now.
val realStageGeneration = storageOperation.getStageGeneration(stream.id, NO_SUFFIX)
Copy link
Contributor

Choose a reason for hiding this comment

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

wait what ? 🤯

@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch 3 times, most recently from 99ecb80 to 30fecb2 Compare August 16, 2024 20:10
@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch from 95ac402 to 7270022 Compare August 19, 2024 16:42
@edgao edgao force-pushed the edgao/refreshes_recover_from_real_raw_table branch from 7270022 to 840e346 Compare August 19, 2024 17:16
@edgao edgao requested a review from a team as a code owner August 19, 2024 17:16
@edgao
Copy link
Contributor Author

edgao commented Aug 19, 2024

/publish-java-cdk

🕑 https://github.com/airbytehq/airbyte/actions/runs/10457880532
✅ Successfully published Java CDK version=0.44.14!

@edgao edgao merged commit e3cc022 into master Aug 19, 2024
29 checks passed
@edgao edgao deleted the edgao/refreshes_recover_from_real_raw_table branch August 19, 2024 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CDK Connector Development Kit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants