Skip to content

Destination S3: Deferred deletes on sync success in OVERWRITE - #42579

Merged
Gireesh Sreepathi (gisripa) merged 1 commit into
masterfrom
gireesh/07-26-s3-no-downtime-full-refresh
Aug 14, 2024
Merged

Gireesh Sreepathi (gisripa) merged 1 commit into
masterfrom
gireesh/07-26-s3-no-downtime-full-refresh

Conversation

@gisripa

@gisripa Gireesh Sreepathi (gisripa) commented Jul 27, 2024 •

Copy link
Copy Markdown
Contributor

What

Deferring the deletes until end of the sync to only delete on receving a COMPLETE for stream status.

How

  • Marking all the existing objects which matches the given pathFormat. This logic is similar to the earlier cleanUpObjects, instead of deleting them immediately, collecting all the object keys marked for delete and sending them to onClose function for actual deletion.

Review guide

  • New methods in BlobStorageOperations interface to support querying and cleaning the objects in a deferred fashion.
  • Storing keys marked for deletion in WriteConfig. Note that it is not thread-safe but onStart and onClose are only called once so nothing else is mutating that list in between.
  • Logical change in S3ConsumerFactory for deferring the deletion action
  • Test verifying that existing objects are left intact on failed attempts in OVERWRITE mode

User Impact

Can this PR be safely reverted and rolled back?

  • YES 💚
  • NO ❌

@vercel

vercel Bot commented Jul 27, 2024 •

Copy link
Copy Markdown

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

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 14, 2024 8:40pm

Gireesh Sreepathi (gisripa) commented Jul 27, 2024 •

Copy link
Copy Markdown
Contributor Author

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

Join Gireesh Sreepathi (@gisripa) and the rest of your teammates on Graphite Graphite

@gisripa
Gireesh Sreepathi (gisripa) force-pushed the epic-8349-certify-s3/issue-8556-s3-v2-fields-gt branch from 2c71cb7 to d66a66b Compare July 27, 2024 01:41
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the gireesh/07-26-s3-no-downtime-full-refresh branch 2 times, most recently from 005b367 to f2bdd27 Compare July 29, 2024 05:17
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the epic-8349-certify-s3/issue-8556-s3-v2-fields-gt branch from d66a66b to 2b602b5 Compare July 29, 2024 05:18
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the gireesh/07-26-s3-no-downtime-full-refresh branch from f2bdd27 to d1c1c0a Compare July 29, 2024 05:18
@johnny-schmidt
Johnny Schmidt (johnny-schmidt) force-pushed the epic-8349-certify-s3/issue-8556-s3-v2-fields-gt branch from 2b602b5 to cc558fa Compare July 29, 2024 18:02
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the epic-8349-certify-s3/issue-8556-s3-v2-fields-gt branch from cdf2021 to 32f91da Compare July 29, 2024 18:27
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the gireesh/07-26-s3-no-downtime-full-refresh branch from d1c1c0a to 3b439ea Compare July 29, 2024 18:27
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the epic-8349-certify-s3/issue-8556-s3-v2-fields-gt branch from 32f91da to 196731e Compare July 30, 2024 01:14
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the gireesh/07-26-s3-no-downtime-full-refresh branch 2 times, most recently from 14faf69 to 96cbf8f Compare July 30, 2024 01:30
@gisripa Gireesh Sreepathi (gisripa) changed the title s3-no-downtime-full-refresh Destination S3: Deferred deletes on sync success in OVERWRITE Jul 30, 2024
@gisripa
Gireesh Sreepathi (gisripa) marked this pull request as ready for review July 30, 2024 15:20
@gisripa
Gireesh Sreepathi (gisripa) requested a review from a team as a July 30, 2024 15:20

@edgao Edward Gao (edgao) left a comment

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.

lgtm, had some fyi/questions

@gisripa
Gireesh Sreepathi (gisripa) force-pushed the epic-8349-certify-s3/issue-8556-s3-v2-fields-gt branch from 196731e to 1627fdb Compare July 30, 2024 18:40
@gisripa
Gireesh Sreepathi (gisripa) requested a review from a team as a code owner July 30, 2024 18:40
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the gireesh/07-26-s3-no-downtime-full-refresh branch from 96cbf8f to 4ac9531 Compare July 30, 2024 18:40
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the epic-8349-certify-s3/issue-8556-s3-v2-fields-gt branch from e6055c8 to 475d5c2 Compare July 31, 2024 00:14
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the gireesh/07-26-s3-no-downtime-full-refresh branch from 4ac9531 to 1aaf8f9 Compare July 31, 2024 00:14
@johnny-schmidt
Johnny Schmidt (johnny-schmidt) force-pushed the epic-8349-certify-s3/issue-8556-s3-v2-fields-gt branch 2 times, most recently from 123df63 to 6629bba Compare July 31, 2024 16:46
@johnny-schmidt
Johnny Schmidt (johnny-schmidt) force-pushed the epic-8349-certify-s3/issue-8556-s3-v2-fields-gt branch 7 times, most recently from 5a747f0 to fce1f98 Compare August 9, 2024 16:11
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the epic-8349-certify-s3/issue-8556-s3-v2-fields-gt branch from fce1f98 to cc4cf39 Compare August 9, 2024 16:23
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the gireesh/07-26-s3-no-downtime-full-refresh branch from 00dca62 to 785fbf5 Compare August 9, 2024 16:24
@johnny-schmidt
Johnny Schmidt (johnny-schmidt) force-pushed the epic-8349-certify-s3/issue-8556-s3-v2-fields-gt branch 3 times, most recently from dd1f010 to edad67d Compare August 9, 2024 22:28
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the epic-8349-certify-s3/issue-8556-s3-v2-fields-gt branch from edad67d to cc4cf39 Compare August 10, 2024 02:42
@gisripa
Gireesh Sreepathi (gisripa) force-pushed the gireesh/07-26-s3-no-downtime-full-refresh branch from 785fbf5 to 8fcd413 Compare August 10, 2024 02:42

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.

Wrong test input caught once I added explicit check for append + 0 genId

@edgao Edward Gao (edgao) left a comment

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.

seems legit. I didn't read through the test code, lmk if you want more eyes on that. Binary search implementation looks correct, though it is one of those algos that can be weirdly finnicky 🤷

lgtm pending previous comments, plus a few nits on the new code

@edgao Edward Gao (edgao) left a comment

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.

one last question, lgtm once resolved

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.

are you intentionally keeping the regex matching stuff outside this method? (i.e. the Pattern.compile(getRegexFormat(namespace, streamName, pathFormat)) + objectSumaries.filter { regex.matcher(it).matches() } thing)

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.

yeah. wasn't sure if all usages are doing filter at the time of refactoring (turns out they seem to be)

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.

Not requesting a change to this, but I wonder if in the new CDK we should try to keep the BL out of the storage operations as much as possible.

Like this is really an object search with a metadata comparator?

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.

Another raised CDK question: what's the best way to handle accumulated stream state. Is appending to the config the right way? Does it make things less manageable?

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.

this is only remnant in S3 land, we avoided attaching to WriteConfig (or rather killed that object all together) and saving states at instance level of that StreamOperation class. If there is a "state" machine then the FSM executor should accumulate and pass it along right ?

@gisripa

Gireesh Sreepathi (gisripa) commented Aug 14, 2024 •

Copy link
Copy Markdown
Contributor Author

/publish-java-cdk

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

@gisripa

Copy link
Copy Markdown
Contributor Author

This branch was successfully deployed

1 active deployment
Preview — adfe4840 Deployed Aug 14, 2024 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/connectors Connector related issues area/documentation Improvements or additions to documentation CDK Connector Development Kit connectors/destination/s3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants