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

🎉 Destination snowflake: reduce memory consumption #10297

Merged
merged 10 commits into from
Feb 15, 2022

Conversation

tuliren
Copy link
Contributor

@tuliren tuliren commented Feb 12, 2022

What

🚨 User Impact 🚨

None expected.

Pre-merge Checklist

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the new connector version is published, connector version bumped in the seed directory as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here

@github-actions github-actions bot added the area/connectors Connector related issues label Feb 12, 2022
@tuliren tuliren force-pushed the liren/snowflake-memory branch from 94d47b9 to 069f610 Compare February 12, 2022 08:51
@tuliren tuliren temporarily deployed to more-secrets February 12, 2022 08:52 Inactive
@tuliren tuliren temporarily deployed to more-secrets February 12, 2022 08:52 Inactive
@tuliren tuliren marked this pull request as ready for review February 14, 2022 18:24
@@ -137,7 +128,8 @@ public final void insertRecords(final JdbcDatabase database,
throws Exception {
AirbyteSentry.executeWithTracing("InsertRecords",
() -> {
records.forEach(airbyteRecordMessage -> getDataAdapter().adapt(airbyteRecordMessage.getData()));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is bad. For every record message, a new data adapter object is created (in the getDataAdapter method).

Copy link
Contributor

@edgao edgao Feb 15, 2022

Choose a reason for hiding this comment

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

obviously this is already way better, but could we just dump the data adapter into a field rather than constructing one per record batch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, good point! Done.

@tuliren
Copy link
Contributor Author

tuliren commented Feb 14, 2022

/test connector=connectors/destination-snowflake

🕑 connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1843744731
❌ connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1843744731
🐛

@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets February 14, 2022 22:09 Inactive
Copy link
Contributor

@edgao edgao left a comment

Choose a reason for hiding this comment

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

lgtm!

@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 04:22 Inactive
@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 04:22 Inactive
@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 04:30 Inactive
@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 04:31 Inactive
@tuliren tuliren force-pushed the liren/snowflake-memory branch from 0121a61 to 7aaddd2 Compare February 15, 2022 05:27
@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 05:28 Inactive
@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 05:28 Inactive
@tuliren
Copy link
Contributor Author

tuliren commented Feb 15, 2022

/test connector=connectors/destination-snowflake

🕑 connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1845213186
✅ connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1845213186
Python tests coverage:

Name                                                                                                                            Stmts   Miss  Cover
---------------------------------------------------------------------------------------------------------------------------------------------------
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/__init__.py                      2      0   100%
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/models/__init__.py               1      0   100%
/actions-runner/_work/airbyte/airbyte/airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/models/airbyte_protocol.py     124      0   100%
normalization/__init__.py                                                                                                           4      0   100%
normalization/destination_type.py                                                                                                  13      0   100%
normalization/transform_catalog/__init__.py                                                                                         2      0   100%
normalization/transform_catalog/catalog_processor.py                                                                              143     77    46%
normalization/transform_catalog/destination_name_transformer.py                                                                   155      8    95%
normalization/transform_catalog/reserved_keywords.py                                                                               13      0   100%
normalization/transform_catalog/stream_processor.py                                                                               520    333    36%
normalization/transform_catalog/table_name_registry.py                                                                            174     34    80%
normalization/transform_catalog/transform.py                                                                                       45     26    42%
normalization/transform_catalog/utils.py                                                                                           33      7    79%
normalization/transform_config/__init__.py                                                                                          2      0   100%
normalization/transform_config/transform.py                                                                                       148     34    77%
---------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                            1379    519    62%

@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 05:38 Inactive
@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 05:38 Inactive
@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets February 15, 2022 05:40 Inactive
@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 05:52 Inactive
@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 05:52 Inactive
@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Feb 15, 2022
@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 06:34 Inactive
@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 06:34 Inactive
@tuliren
Copy link
Contributor Author

tuliren commented Feb 15, 2022

Interesting that when I pulled in the master branch (af4da72), which includes a commit that fixes the connector base build, the build still failed, as if the fix was not working.
It's only after I pushed a new commit to this PR (d5a0c23), did the build pass.

@tuliren
Copy link
Contributor Author

tuliren commented Feb 15, 2022

/publish connector=connectors/destination-snowflake run-tests=false

🕑 connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1845533217
✅ connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/1845533217

@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets February 15, 2022 07:19 Inactive
@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 07:36 Inactive
@tuliren tuliren temporarily deployed to more-secrets February 15, 2022 07:36 Inactive
@tuliren tuliren merged commit 6301cfa into master Feb 15, 2022
@tuliren tuliren deleted the liren/snowflake-memory branch February 15, 2022 07:37
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants