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

ADAP-761: Add retry logic to flaky MV tests to avoid "cannot open relation with OID" error #569

Merged
merged 4 commits into from
Aug 10, 2023

Conversation

mikealfare
Copy link
Contributor

@mikealfare mikealfare commented Aug 8, 2023

Problem

Materialized view tests are sporadically failing due to a "cannot open relation with OID" error. This error can occur when there are multiple objects being created and dropped in parallel, as happens with these integration tests. The appears to be caused by the fact that queries on the metadata tables are not locked like other queries, hence a record may exist on those tables that corresponds to an object that is in the process of being dropped.

Solution

Add retry logic that will retry the run_dbt_and_capture command up to ten times, until it returns successfully. If it does not return successfully, then it will return None.

This fix will need to be backported to 1.6.latest as it's affecting CI on both main and 1.6.latest.

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

@mikealfare mikealfare self-assigned this Aug 8, 2023
@mikealfare mikealfare requested a review from a team as a code owner August 8, 2023 18:21
@mikealfare mikealfare requested a review from Fleid August 8, 2023 18:21
@cla-bot cla-bot bot added the cla:yes label Aug 8, 2023
@mikealfare mikealfare removed the request for review from Fleid August 8, 2023 18:22
Copy link
Contributor

@colin-rogers-dbt colin-rogers-dbt left a comment

Choose a reason for hiding this comment

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

nit on function name but otherwise LGTM

@mikealfare
Copy link
Contributor Author

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Aug 10, 2023

The cla-bot has been summoned, and re-checked this pull request!

@mikealfare mikealfare merged commit cbb411d into main Aug 10, 2023
14 checks passed
@mikealfare mikealfare deleted the bug/materialized-views/flaky-tests branch August 10, 2023 00:20
mikealfare added a commit that referenced this pull request Aug 10, 2023
…ation with OID" error (#569)

* add retry logic to materialized view tests to avoid "could not open relation with OID" error

* changie

* update utility method name to be scope specific

(cherry picked from commit cbb411d)
mikealfare added a commit that referenced this pull request Aug 11, 2023
…ation with OID" error (#569) (#574)

* add retry logic to materialized view tests to avoid "could not open relation with OID" error

* changie

* update utility method name to be scope specific

(cherry picked from commit cbb411d)
abbywh pushed a commit to abbywh/dbt-redshift that referenced this pull request Oct 11, 2023
…ation with OID" error (dbt-labs#569)

* add retry logic to materialized view tests to avoid "could not open relation with OID" error

* changie

* update utility method name to be scope specific
@colin-rogers-dbt colin-rogers-dbt mentioned this pull request Oct 25, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants