Skip to content

πŸ› Source S3 (V4): Ensure all files are not resync'd when migrating from v3 to v4 - #29418

Merged
Alexandre Girard (girarda) merged 28 commits into
masterfrom
alex/issue29410
Aug 16, 2023
Merged

Alexandre Girard (girarda) merged 28 commits into
masterfrom
alex/issue29410

Conversation

@girarda

@girarda Alexandre Girard (girarda) commented Aug 14, 2023 •

Copy link
Copy Markdown
Collaborator

What

How

When converting the v3 state to v4:

  • Set the file's datetime in the state history to the min(end of day, state's cursor datetime)
    • On master, we're setting it to the beginning of day, which means we'll resync all files because their real timestamp will be later than the one in the state's history

Update _should_sync_file logic:

  1. If the connection evolved from v4, never sync files that were last updated before 1 hour before the legacy state's _ab_source_file_last_modified
  2. If the current sync is migrating from v3 to v4, sync all files modified later than 1 hour before the legacy state's _ab_source_file_last_modified. This ensure we don't accidentally lose files due to setting the files' datetime to the end of the day
  3. Else, using the default logic

Recommended reading order

  1. airbyte-integrations/connectors/source-s3/source_s3/v4/cursor.py
  2. airbyte-integrations/connectors/source-s3/unit_tests/v4/test_cursor.py

@octavia-squidington-iii Octavia Squidington III (octavia-squidington-iii) added area/connectors Connector related issues CDK Connector Development Kit labels Aug 14, 2023
@github-actions

github-actions Bot commented Aug 14, 2023 •

Copy link
Copy Markdown
Contributor

Before Merging a Connector Pull Request

Wow! What a great pull request you have here! πŸŽ‰

To merge this PR, ensure the following has been done/considered for each connector added or updated:

  • PR name follows PR naming conventions
  • Breaking changes are considered. If a Breaking Change is being introduced, ensure an Airbyte engineer has created a Breaking Change Plan.
  • Connector version has been incremented in the Dockerfile and metadata.yaml according to our Semantic Versioning for Connectors guidelines
  • You've updated the connector's metadata.yaml file any other relevant changes, including a breakingChanges entry for major version bumps. See metadata.yaml docs
  • Secrets in the connector's spec are annotated with airbyte_secret
  • All documentation files are up to date. (README.md, bootstrap.md, docs.md, etc...)
  • Changelog updated in docs/integrations/<source or destination>/<name>.md with an entry for the new version. See changelog example
  • Migration guide updated in docs/integrations/<source or destination>/<name>-migrations.md with an entry for the new version, if the version is a breaking change. See migration guide example
  • If set, you've ensured the icon is present in the platform-internal repo. (Docs)

If the checklist is complete, but the CI check is failing,

  1. Check for hidden checklists in your PR description

  2. Toggle the github label checklist-action-run on/off to re-run the checklist CI.

@octavia-squidington-iii Octavia Squidington III (octavia-squidington-iii) removed the CDK Connector Development Kit label Aug 14, 2023
@girarda Alexandre Girard (girarda) changed the title Alex/issue29410 πŸ› Source S3 (V4): Ensure all files are not resync'd when migrating from v3 to v4 Aug 15, 2023
@girarda
Alexandre Girard (girarda) marked this pull request as ready for review August 15, 2023 01:11

@staticmethod
def _convert_legacy_state(legacy_state: StreamState) -> MutableMapping[str, str]:
def _convert_legacy_state(legacy_state: StreamState) -> MutableMapping[str, Any]:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this already returned a MutableMapping[str, Any] because the value for "history" is a dict, not a str

@octavia-squidington-iii

Copy link
Copy Markdown
Collaborator

source-s3 test report (commit 78be172989) - ❌

⏲️ Total pipeline duration: 13mn51s

Step Result
Validate airbyte-integrations/connectors/source-s3/metadata.yaml βœ…
Connector version semver check βœ…
Connector version increment check ❌
QA checks βœ…
Code format checks βœ…
Connector package install βœ…
Build source-s3 docker image for platform linux/x86_64 βœ…
Unit tests βœ…
Integration tests βœ…
Acceptance tests βœ…

πŸ”— View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-s3 test

@octavia-squidington-iii

Copy link
Copy Markdown
Collaborator

source-s3 test report (commit 8ffa826edb) - ❌

⏲️ Total pipeline duration: 13mn34s

Step Result
Validate airbyte-integrations/connectors/source-s3/metadata.yaml βœ…
Connector version semver check βœ…
Connector version increment check ❌
QA checks βœ…
Code format checks βœ…
Connector package install βœ…
Build source-s3 docker image for platform linux/x86_64 βœ…
Unit tests βœ…
Integration tests βœ…
Acceptance tests βœ…

πŸ”— View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-s3 test

@octavia-squidington-iii

Copy link
Copy Markdown
Collaborator

source-s3 test report (commit 02c29b73e4) - ❌

⏲️ Total pipeline duration: 13mn45s

Step Result
Validate airbyte-integrations/connectors/source-s3/metadata.yaml βœ…
Connector version semver check βœ…
Connector version increment check ❌
QA checks βœ…
Code format checks βœ…
Connector package install βœ…
Build source-s3 docker image for platform linux/x86_64 βœ…
Unit tests βœ…
Integration tests βœ…
Acceptance tests βœ…

πŸ”— View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-s3 test

@octavia-squidington-iii

Copy link
Copy Markdown
Collaborator

source-s3 test report (commit ad4ed826fd) - ❌

⏲️ Total pipeline duration: 13mn14s

Step Result
Validate airbyte-integrations/connectors/source-s3/metadata.yaml βœ…
Connector version semver check βœ…
Connector version increment check ❌
QA checks βœ…
Code format checks βœ…
Connector package install βœ…
Build source-s3 docker image for platform linux/x86_64 βœ…
Unit tests βœ…
Integration tests βœ…
Acceptance tests βœ…

πŸ”— View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-s3 test

@octavia-squidington-iii

Copy link
Copy Markdown
Collaborator

source-s3 test report (commit 02bfa689d8) - ❌

⏲️ Total pipeline duration: 03mn23s

Step Result
Validate airbyte-integrations/connectors/source-s3/metadata.yaml βœ…
Connector version semver check βœ…
Connector version increment check ❌
QA checks βœ…
Code format checks βœ…
Connector package install βœ…
Build source-s3 docker image for platform linux/x86_64 βœ…
Unit tests ❌

πŸ”— View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-s3 test

@octavia-squidington-iii

Copy link
Copy Markdown
Collaborator

source-s3 test report (commit 966a58020c) - ❌

⏲️ Total pipeline duration: 03mn24s

Step Result
Validate airbyte-integrations/connectors/source-s3/metadata.yaml βœ…
Connector version semver check βœ…
Connector version increment check ❌
QA checks βœ…
Code format checks βœ…
Connector package install βœ…
Build source-s3 docker image for platform linux/x86_64 βœ…
Unit tests ❌

πŸ”— View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-s3 test

@octavia-squidington-iii

Copy link
Copy Markdown
Collaborator

source-s3 test report (commit 3acda16582) - ❌

⏲️ Total pipeline duration: 03mn45s

Step Result
Validate airbyte-integrations/connectors/source-s3/metadata.yaml βœ…
Connector version semver check βœ…
Connector version increment check ❌
QA checks βœ…
Code format checks βœ…
Connector package install βœ…
Build source-s3 docker image for platform linux/x86_64 βœ…
Unit tests ❌

πŸ”— View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-s3 test

@clnoll Catherine Noll (clnoll) 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.

Nice Alexandre Girard (@girarda), just one question for you.

RemoteFile(uri="file4.txt", last_modified=_create_datetime("2023-08-01T00:00:00.000000Z")),
],
[RemoteFile(uri="file4.txt", last_modified=_create_datetime("2023-08-01T00:00:00.000000Z"))],
id="input_state_is_v4_with_new_file_earlier_than_cursor",

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.

There's one difference between this and the issue - "3. Store a special key in the v4 state message if it was created from a v3 state, v3_min_sync_date (?), whose value is the earliest date in the v3 history. If this key is present, v4 will not sync files before that date."

The purpose of this was to allow us to sync files >1 hour if they weren't already in the history. Did we ultimately decide it wasn't needed?

If we do want it we'll want to add these tests:

  • v4 state message + there is one new file, but it's before the v3_min_sync_date (as I called it in the issue; this file should not be synced)
  • v4 state message + there's one new file and it's between the v3_min_sync_date and the earliest file (this should be synced).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

my bad - you're right. We do need to keep track of v3_min_sync_date because v3 removes files from the history based on the time window.

@octavia-squidington-iii

Copy link
Copy Markdown
Collaborator

source-s3 test report (commit 3491ab6df0) - ❌

⏲️ Total pipeline duration: 13mn43s

Step Result
Validate airbyte-integrations/connectors/source-s3/metadata.yaml βœ…
Connector version semver check βœ…
Connector version increment check ❌
QA checks βœ…
Code format checks βœ…
Connector package install βœ…
Build source-s3 docker image for platform linux/x86_64 βœ…
Unit tests βœ…
Integration tests βœ…
Acceptance tests βœ…

πŸ”— View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-s3 test

@clnoll Catherine Noll (clnoll) 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.

Looks great Alexandre Girard (@girarda)!

Awesome test coverage 😍

@octavia-squidington-iii

Copy link
Copy Markdown
Collaborator

source-s3 test report (commit 503152d7bb) - ❌

⏲️ Total pipeline duration: 13mn49s

Step Result
Validate airbyte-integrations/connectors/source-s3/metadata.yaml βœ…
Connector version semver check βœ…
Connector version increment check ❌
QA checks βœ…
Code format checks βœ…
Connector package install βœ…
Build source-s3 docker image for platform linux/x86_64 βœ…
Unit tests βœ…
Integration tests βœ…
Acceptance tests βœ…

πŸ”— View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-s3 test

@octavia-squidington-iii Octavia Squidington III (octavia-squidington-iii) added the area/documentation Improvements or additions to documentation label Aug 16, 2023
@octavia-squidington-iii

Copy link
Copy Markdown
Collaborator

source-s3 test report (commit 4ff1e5fcc5) - βœ…

⏲️ Total pipeline duration: 11mn31s

Step Result
Validate airbyte-integrations/connectors/source-s3/metadata.yaml βœ…
Connector version semver check βœ…
Connector version increment check βœ…
QA checks βœ…
Code format checks βœ…
Connector package install βœ…
Build source-s3 docker image for platform linux/x86_64 βœ…
Unit tests βœ…
Integration tests βœ…
Acceptance tests βœ…

πŸ”— View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-s3 test

@girarda
Alexandre Girard (girarda) merged commit 7e95c1d into master Aug 16, 2023
@girarda
Alexandre Girard (girarda) deleted the alex/issue29410 branch August 16, 2023 01:11
Harry Touloupas (harrytou) pushed a commit to KYVENetwork/airbyte that referenced this pull request Sep 1, 2023
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 connectors/source/s3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants