fix(bigquery): Retry stale 404s when querying tables in tests#894
Draft
jmqd wants to merge 4 commits into
Draft
Conversation
A table queried right after being dropped and recreated can return a stale NOT_FOUND while BigQuery metadata propagates. Retry 404s within the existing query budget instead of returning None on the first one. Tables that stay missing for the whole budget still yield None.
query_table gets a 60 second budget with retry logging, since a view recreated under the same name can serve stale NOT_FOUND well past the previous budget. Absence assertions move to a new table_exists helper backed by the tables metadata API, which answers existence consistently and without polling.
The six CDC tests assert that delete events emptied the table, which the table_exists check got wrong since the table legitimately survives. Poll for an empty query result with the short budget instead; a 404 counts as no rows visible, matching the prior behavior of these assertions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes flakey test behavior.
A table queried right after being dropped and recreated can return a stale NOT_FOUND while BigQuery metadata propagates. Retry 404s within the existing query budget instead of returning None on the first one. Tables that stay missing for the whole budget still yield None.