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

driver-adapters: remove dispose method for JS transaction interface #4489

Merged

Conversation

aqrln
Copy link
Member

@aqrln aqrln commented Nov 21, 2023

Remove the boilerplate Transaction.dispose method from the public
driver adapter interface and move the corresponding functionality
directly to the destructor of TransactionProxy.

Refs: #4286
Closes: https://github.com/prisma/team-orm/issues/391

@aqrln aqrln requested a review from a team as a code owner November 21, 2023 20:07
@aqrln aqrln requested review from miguelff and Druue and removed request for a team November 21, 2023 20:07
@aqrln aqrln marked this pull request as draft November 21, 2023 20:07
@aqrln aqrln force-pushed the driver-adapters-remove-dispose-method-for-js-transaction-interface branch from 222f720 to 47179e6 Compare November 21, 2023 20:08
@aqrln aqrln added this to the 5.7.0 milestone Nov 21, 2023
@aqrln aqrln self-assigned this Nov 21, 2023
Copy link

codspeed-hq bot commented Nov 21, 2023

CodSpeed Performance Report

Merging #4489 will not alter performance

Comparing driver-adapters-remove-dispose-method-for-js-transaction-interface (8e0f716) with main (8ddef72)

Summary

✅ 11 untouched benchmarks

@@ -0,0 +1,24 @@
use query_engine_tests::*;

#[test_suite(schema(generic), only(JS, Sqlite))]
Copy link
Member Author

@aqrln aqrln Nov 22, 2023

Choose a reason for hiding this comment

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

JS-only because after adding the test turned out that it's actually broken with native SQLite connector, this scenario has never been tested before (except indirectly via smoke tests for driver adapters which uncovered the issue back then):

[2023-11-22T14:21:52Z] called `Result::unwrap()` on an `Err` value: QueryCoreError(ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(SqliteError { extended_code: 1, message: Some("cannot start a transaction within a transaction") }), transient: false }))

I'll open an issue with TypeScript reproduction, and we can fix it separately.

Copy link
Member Author

Choose a reason for hiding this comment

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

The fix might be to move the logic added in this PR somewhere to the level above, let me know if you'd prefer it to be done in this PR rather than separately.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that should maybe be blanket Drop for Transaction from quaint? If that's easy enough to do, then I'd prefer to do it here and fix the issue for all driver, otherwise follow-up should be fine too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that should maybe be blanket Drop for Transaction from quaint?

Unfortunately this violates orphan rules, and if it didn't, the fact that we also need some state and not just the Drop impl could make this a little awkward. I think it would be better to wrap the quaint transaction into some struct that will take care of this. Let's do that as a follow-up so we can land this PR already.

@aqrln aqrln marked this pull request as ready for review November 22, 2023 14:43
aqrln added a commit to prisma/prisma that referenced this pull request Nov 22, 2023
This method will not be used anymore after
prisma/prisma-engines#4489 as this logic is
de-duplicated and moved to the Rust side.
Remove the boilerplate `Transaction.dispose` method from the public
driver adapter interface and move the corresponding functionality
directly to the destructor of `TransactionProxy`.

Refs: #4286
Closes: prisma/team-orm#391
@aqrln aqrln force-pushed the driver-adapters-remove-dispose-method-for-js-transaction-interface branch from 39eaaa8 to 5ab9f4f Compare November 23, 2023 13:18
aqrln and others added 3 commits November 24, 2023 15:54
Co-authored-by: Miguel Fernández <fernandez@prisma.io>
There's no need in release-store in commit/rollback and acquire-load in
destructor anymore since we don't care for commit to have finished in
the destructor anymore.
@aqrln aqrln merged commit 31deaad into main Nov 27, 2023
35 checks passed
@aqrln aqrln deleted the driver-adapters-remove-dispose-method-for-js-transaction-interface branch November 27, 2023 13:05
aqrln added a commit to prisma/prisma that referenced this pull request Nov 27, 2023
This method will not be used anymore after
prisma/prisma-engines#4489 as this logic is
de-duplicated and moved to the Rust side.
jkomyno pushed a commit to prisma/prisma that referenced this pull request Nov 27, 2023
…22069)

This method will not be used anymore after
prisma/prisma-engines#4489 as this logic is
de-duplicated and moved to the Rust side.
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

3 participants