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: Implement isolation levels for batch transactions #3199
Merged
Conversation
This file contains 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
SevInf
added a commit
to prisma/prisma
that referenced
this pull request
Sep 16, 2022
Engines part: prisma/prisma-engines#3199 Batch `$transaction` call will now receive optional options objects with `isolationLevel` property, allowing to pick any level, supporting by current transaction. Internally, refactors a bunch of things about the way transaction info is stored in `PrismaPromise`, `Request` and `InternalRequest` types. - All transaction-related properties are now grouped under `transaction` key. Distiction between iTx and batch transaction is done explcitly via discriminated union type. - `runInTransaction` property is removed. Empty `transaction` field now means that request is not running in transaction. For testing we are checking that engine correctly generates corresponding SQL. Properly testing different isolation level effects would be very difficult, especially in case of batch transactions, where we can not execute any code between the queries. Ref #9678
garrensmith
suggested changes
Sep 19, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some small changes. But this looks really good. Nice work.
query-engine/connector-test-kit-rs/query-engine-tests/tests/new/interactive_tx.rs
Show resolved
Hide resolved
Add optional `isolation_level` field to `MultiDoc` and propogate it up to connector. This mostly reuses iTx isolation level logic, implemented on connector level. Test-wise, we also test them in a same way iTx are tested right now: check that valid value is accepted, invalid is rejected and rely on quaint tests to do the right thing.
SevInf
force-pushed
the
feat/batch-isolation-level
branch
from
September 19, 2022 13:29
6a098ec
to
3eb13fb
Compare
SevInf
added a commit
to prisma/prisma
that referenced
this pull request
Sep 19, 2022
Engines part: prisma/prisma-engines#3199 Batch `$transaction` call will now receive optional options objects with `isolationLevel` property, allowing to pick any level, supporting by current transaction. Internally, refactors a bunch of things about the way transaction info is stored in `PrismaPromise`, `Request` and `InternalRequest` types. - All transaction-related properties are now grouped under `transaction` key. Distiction between iTx and batch transaction is done explcitly via discriminated union type. - `runInTransaction` property is removed. Empty `transaction` field now means that request is not running in transaction. For testing we are checking that engine correctly generates corresponding SQL. Properly testing different isolation level effects would be very difficult, especially in case of batch transactions, where we can not execute any code between the queries. Ref #9678
garrensmith
approved these changes
Sep 20, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done. Thanks.
SevInf
added a commit
to prisma/prisma
that referenced
this pull request
Sep 20, 2022
Engines part: prisma/prisma-engines#3199 Batch `$transaction` call will now receive optional options objects with `isolationLevel` property, allowing to pick any level, supporting by current transaction. Internally, refactors a bunch of things about the way transaction info is stored in `PrismaPromise`, `Request` and `InternalRequest` types. - All transaction-related properties are now grouped under `transaction` key. Distiction between iTx and batch transaction is done explcitly via discriminated union type. - `runInTransaction` property is removed. Empty `transaction` field now means that request is not running in transaction. For testing we are checking that engine correctly generates corresponding SQL. Properly testing different isolation level effects would be very difficult, especially in case of batch transactions, where we can not execute any code between the queries. Ref #9678
SevInf
added a commit
to prisma/prisma
that referenced
this pull request
Sep 20, 2022
Engines part: prisma/prisma-engines#3199 Batch `$transaction` call will now receive optional options objects with `isolationLevel` property, allowing to pick any level, supporting by current transaction. Internally, refactors a bunch of things about the way transaction info is stored in `PrismaPromise`, `Request` and `InternalRequest` types. - All transaction-related properties are now grouped under `transaction` key. Distiction between iTx and batch transaction is done explcitly via discriminated union type. - `runInTransaction` property is removed from everywhere expcept middleware public APIs. `transaction` field now indicates that the request should run in transaction. For testing we are checking that engine correctly generates corresponding SQL. Properly testing different isolation level effects would be very difficult, especially in case of batch transactions, where we can not execute any code between the queries. Ref #9678
SevInf
added a commit
to prisma/prisma
that referenced
this pull request
Sep 20, 2022
Engines part: prisma/prisma-engines#3199 Batch `$transaction` call will now receive optional options objects with `isolationLevel` property, allowing to pick any level, supporting by current transaction. Internally, refactors a bunch of things about the way transaction info is stored in `PrismaPromise`, `Request` and `InternalRequest` types. - All transaction-related properties are now grouped under `transaction` key. Distiction between iTx and batch transaction is done explcitly via discriminated union type. - `runInTransaction` property is removed from everywhere expcept middleware public APIs. `transaction` field now indicates that the request should run in transaction. For testing we are checking that engine correctly generates corresponding SQL. Properly testing different isolation level effects would be very difficult, especially in case of batch transactions, where we can not execute any code between the queries. Ref #9678
SevInf
added a commit
to prisma/prisma
that referenced
this pull request
Sep 20, 2022
Engines part: prisma/prisma-engines#3199 Batch `$transaction` call will now receive optional options objects with `isolationLevel` property, allowing to pick any level, supporting by current transaction. Internally, refactors a bunch of things about the way transaction info is stored in `PrismaPromise`, `Request` and `InternalRequest` types. - All transaction-related properties are now grouped under `transaction` key. Distiction between iTx and batch transaction is done explcitly via discriminated union type. - `runInTransaction` property is removed from everywhere expcept middleware public APIs. `transaction` field now indicates that the request should run in transaction. For testing we are checking that engine correctly generates corresponding SQL. Properly testing different isolation level effects would be very difficult, especially in case of batch transactions, where we can not execute any code between the queries. Ref #9678
SevInf
added a commit
to prisma/prisma
that referenced
this pull request
Sep 20, 2022
Engines part: prisma/prisma-engines#3199 Batch `$transaction` call will now receive optional options objects with `isolationLevel` property, allowing to pick any level, supporting by current transaction. Internally, refactors a bunch of things about the way transaction info is stored in `PrismaPromise`, `Request` and `InternalRequest` types. - All transaction-related properties are now grouped under `transaction` key. Distiction between iTx and batch transaction is done explcitly via discriminated union type. - `runInTransaction` property is removed from everywhere expcept middleware public APIs. `transaction` field now indicates that the request should run in transaction. For testing we are checking that engine correctly generates corresponding SQL. Properly testing different isolation level effects would be very difficult, especially in case of batch transactions, where we can not execute any code between the queries. Ref #9678
SevInf
added a commit
to prisma/prisma
that referenced
this pull request
Sep 20, 2022
Engines part: prisma/prisma-engines#3199 Batch `$transaction` call will now receive optional options objects with `isolationLevel` property, allowing to pick any level, supporting by current transaction. Internally, refactors a bunch of things about the way transaction info is stored in `PrismaPromise`, `Request` and `InternalRequest` types. - All transaction-related properties are now grouped under `transaction` key. Distiction between iTx and batch transaction is done explcitly via discriminated union type. - `runInTransaction` property is removed from everywhere expcept middleware public APIs. `transaction` field now indicates that the request should run in transaction. For testing we are checking that engine correctly generates corresponding SQL. Properly testing different isolation level effects would be very difficult, especially in case of batch transactions, where we can not execute any code between the queries. Ref #9678
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.
Add optional
isolation_level
field toMultiDoc
and propogate it upto connector. This mostly reuses iTx isolation level logic, implemented
on connector level.
Test-wise, we also test them in a same way iTx are tested right now:
check that valid value is accepted, invalid is rejected and rely on
quaint tests to do the right thing.