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

Add exception handler for ACL resource exhaustion case #1887

Merged
merged 18 commits into from
Jan 27, 2025

Conversation

pshapiro4broad
Copy link
Member

@pshapiro4broad pshapiro4broad commented Jan 13, 2025

Jira ticket: https://broadworkbench.atlassian.net/browse/DT-1097

Addresses

If a user hits a BigQuery quota when creating a snapshot, the error returned doesn't include information about the underlying problem or how to fix it. This change adds that information to the flight's error response.

Summary of changes

In the case where this problem occurs, a GoogleResourceException is thrown with a wrapped cause of BigQueryException with the message Too many authorized entities in this dataset. The maximum number of authorized views, routines, and datasets combined is 2500.. The code checks for this case and returns a custom exception. When the user later retrieves the flight result, they'll get a 400 response and see the custom error message.

$ curl -i -X 'GET' \
  'http://localhost:8080/api/repository/v1/jobs/KenKJ8q8RfmHQmn-8pFlTw/result' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <TOKEN>'
HTTP/1.1 400 
X-Request-ID: axRrgBO3
Content-Type: application/json
Content-Length: 222
Date: Wed, 15 Jan 2025 21:45:39 GMT
Connection: close

{"message":"Too many authorized entities in this dataset. The maximum number of authorized views, routines, and datasets combined is 2500. Resolve this by deleting snapshots or creating a second dataset.","errorDetail":[]}
$

Testing Strategy

  • run integration tests locally and force the error by modifying the code to throw an exception

@pshapiro4broad pshapiro4broad requested a review from a team as a code owner January 13, 2025 20:03
@pshapiro4broad pshapiro4broad requested review from rushtong and snf2ye and removed request for a team January 13, 2025 20:03
Copy link
Contributor

@snf2ye snf2ye left a comment

Choose a reason for hiding this comment

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

LGTM - It makes sense that we need to do this per snapshot create type and I like the shared utility. Glad to take another look after tests are added!

Copy link
Contributor

@rushtong rushtong left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me 👍🏽

Copy link
Contributor

@fboulnois fboulnois left a comment

Choose a reason for hiding this comment

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

once tests pass, lgtm 👍

Copy link
Contributor

@rushtong rushtong left a comment

Choose a reason for hiding this comment

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

Looks reasonable 👍🏽

Copy link
Contributor

@fboulnois fboulnois left a comment

Choose a reason for hiding this comment

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

Looks reasonable 👍

Copy link
Contributor

@snf2ye snf2ye left a comment

Choose a reason for hiding this comment

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

One thought, but otherwise LGTM!
As we talked about in standup, if there a lower overhead way to add a unit test, I think that would be good, but not necessary to merge in my opinion.

@pshapiro4broad pshapiro4broad enabled auto-merge (squash) January 16, 2025 21:53
@pshapiro4broad pshapiro4broad enabled auto-merge (squash) January 23, 2025 18:08
Test - remove exception handler code
@pshapiro4broad pshapiro4broad merged commit b9c198e into develop Jan 27, 2025
14 checks passed
@pshapiro4broad pshapiro4broad deleted the ps/dt-1097-better-quota-error-reporting branch January 27, 2025 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants