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

qe: Identify which request in a batch caused error #3384

Merged
merged 3 commits into from Nov 15, 2022
Merged

Conversation

SevInf
Copy link
Contributor

@SevInf SevInf commented Nov 11, 2022

Adds batch_request_idx property to user facing errors. On the client,
that would allow us to build correct error message for $transaction
errors.

Ref: prisma/prisma#15433, prisma/prisma#14373

SevInf added a commit to prisma/prisma that referenced this pull request Nov 11, 2022
Engine PR: prisma/prisma-engines#3384

Uses newly added `batch_request_idx` property of an errors to identify
and correctly report error location within a batch.

Fix #15433
Fix #14373
Adds `batch_request_idx` property to user facing errors. On the client,
that would allow us to build correct error message for `$transaction`
errors.

Ref: prisma/prisma#15433, prisma/prisma#14373
SevInf added a commit to prisma/prisma that referenced this pull request Nov 11, 2022
Engine PR: prisma/prisma-engines#3384

Uses newly added `batch_request_idx` property of an errors to identify
and correctly report error location within a batch.

Fix #15433
Fix #14373
SevInf added a commit to prisma/prisma that referenced this pull request Nov 11, 2022
Engine PR: prisma/prisma-engines#3384

Uses newly added `batch_request_idx` property of an errors to identify
and correctly report error location within a batch.

Fix #15433
Fix #14373
@SevInf SevInf added this to the 4.7.0 milestone Nov 11, 2022
@SevInf SevInf marked this pull request as ready for review November 11, 2022 16:16
Copy link
Collaborator

@miguelff miguelff left a comment

Choose a reason for hiding this comment

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

Code is clear, well done! Would it make sense to write a test exercising that the new property is being populated correctly? Other than that changes look good!

Comment on lines +53 to 55
.await;

histogram!(PRISMA_CLIENT_QUERIES_HISTOGRAM_MS, operation_timer.elapsed());
Copy link
Member

Choose a reason for hiding this comment

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

This might be an unintentional change, but previously this metric wouldn't have been logged if there was an error, right? The new behaviour sounds more correct to me, but we might want to check what happens in other places and if it's consistent.

Copy link
Member

Choose a reason for hiding this comment

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

Yep, in execute_single_query we write this histogram regardless of whether the result is Ok or Err. Looks like another unrelated bug fixed here at the same time 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

good catch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even amount of errors = correct result 😆

Copy link
Contributor

@garrensmith garrensmith left a comment

Choose a reason for hiding this comment

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

This is nice and clean. I agree with @miguelff could you add a test cause for this so we know it works as expected.

Comment on lines +53 to 55
.await;

histogram!(PRISMA_CLIENT_QUERIES_HISTOGRAM_MS, operation_timer.elapsed());
Copy link
Contributor

Choose a reason for hiding this comment

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

good catch.

@SevInf
Copy link
Contributor Author

SevInf commented Nov 14, 2022

@miguelff @garrensmith now second attempt: this time a proper test, not the snapshot one

SevInf added a commit to prisma/prisma that referenced this pull request Nov 14, 2022
Engine PR: prisma/prisma-engines#3384

Uses newly added `batch_request_idx` property of an errors to identify
and correctly report error location within a batch.

Fix #15433
Fix #14373
@SevInf SevInf merged commit ea33eec into main Nov 15, 2022
@SevInf SevInf deleted the feat/error-req-idx branch November 15, 2022 09:31
SevInf added a commit to prisma/prisma that referenced this pull request Nov 15, 2022
Engine PR: prisma/prisma-engines#3384

Uses newly added `batch_request_idx` property of an errors to identify
and correctly report error location within a batch.

Fix #15433
Fix #14373
SevInf added a commit to prisma/prisma that referenced this pull request Nov 15, 2022
Engine PR: prisma/prisma-engines#3384

Uses newly added `batch_request_idx` property of an errors to identify
and correctly report error location within a batch.

Fix #15433
Fix #14373
SevInf added a commit to prisma/prisma that referenced this pull request Nov 16, 2022
Engine PR: prisma/prisma-engines#3384

Uses newly added `batch_request_idx` property of an errors to identify
and correctly report error location within a batch.

Fix #15433
Fix #14373
SevInf added a commit to prisma/prisma that referenced this pull request Nov 16, 2022
Engine PR: prisma/prisma-engines#3384

Uses newly added `batch_request_idx` property of an errors to identify
and correctly report error location within a batch.

Fix #15433
Fix #14373
SevInf added a commit to prisma/prisma that referenced this pull request Nov 17, 2022
Engine PR: prisma/prisma-engines#3384

Uses newly added `batch_request_idx` property of an errors to identify
and correctly report error location within a batch.

Fix #15433
Fix #14373
SevInf added a commit to prisma/prisma that referenced this pull request Nov 17, 2022
…6240)

Engine PR: prisma/prisma-engines#3384

Uses newly added `batch_request_idx` property of an errors to identify
and correctly report error location within a batch.

Fix #15433
Fix #14373
jkomyno pushed a commit to prisma/prisma that referenced this pull request Dec 21, 2022
…6240)

Engine PR: prisma/prisma-engines#3384

Uses newly added `batch_request_idx` property of an errors to identify
and correctly report error location within a batch.

Fix #15433
Fix #14373
jkomyno pushed a commit to prisma/prisma that referenced this pull request Dec 21, 2022
…6240)

Engine PR: prisma/prisma-engines#3384

Uses newly added `batch_request_idx` property of an errors to identify
and correctly report error location within a batch.

Fix #15433
Fix #14373
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.

None yet

4 participants