prisma
prisma-engines
BlogDocsChangelog

feat: add support for nested transaction rollbacks via savepoints in sql

#4506Closed
Comparing
integration/sql-nested-transactions2
(
e943433
) with
main
(
f2e5886
)
CodSpeed Performance Gauge
0%
Untouched
11

Benchmarks

Passed

medium_read
query-engine/request-handlers/benches/query_planning_bench.rs::benches::criterion_benchmark
CodSpeed Performance Gauge
0%
293.4 µs292.5 µs
large_read
query-engine/request-handlers/benches/query_planning_bench.rs::benches::criterion_benchmark
CodSpeed Performance Gauge
0%
1.6 ms1.5 ms
mutation
query-engine/request-handlers/benches/query_planning_bench.rs::benches::criterion_benchmark
CodSpeed Performance Gauge
0%
6.3 ms6.3 ms
validate (medium)
query-engine/schema/benches/schema_builder_bench.rs::benches::criterion_benchmark::psl
CodSpeed Performance Gauge
0%
11.8 ms11.8 ms
validate (small)
query-engine/schema/benches/schema_builder_bench.rs::benches::criterion_benchmark::psl
CodSpeed Performance Gauge
0%
1.8 ms1.8 ms
validate (large)
query-engine/schema/benches/schema_builder_bench.rs::benches::criterion_benchmark::psl
CodSpeed Performance Gauge
0%
52.4 ms52.4 ms
build (small)
query-engine/schema/benches/schema_builder_bench.rs::benches::criterion_benchmark::schema_builder
CodSpeed Performance Gauge
0%
266.3 µs266.6 µs
small_read
query-engine/request-handlers/benches/query_planning_bench.rs::benches::criterion_benchmark
CodSpeed Performance Gauge
0%
106.2 µs106.4 µs
build (large)
query-engine/schema/benches/schema_builder_bench.rs::benches::criterion_benchmark::schema_builder
CodSpeed Performance Gauge
0%
4.5 ms4.5 ms
deep_read_query
query-engine/request-handlers/benches/query_planning_bench.rs::benches::criterion_benchmark
CodSpeed Performance Gauge
-1%
1.8 ms1.8 ms
build (medium)
query-engine/schema/benches/schema_builder_bench.rs::benches::criterion_benchmark::schema_builder
CodSpeed Performance Gauge
-1%
2.2 ms2.2 ms

Commits

Click on a commit to change the comparison range
Base
main
f2e5886
+0.05%
feat: add support for nested transaction rollbacks via savepoints in sql This is my first OSS contribution for a Rust project, so I'm sure I've made some stupid mistakes, but I think it should mostly work :) This change adds a mutable depth counter, that can track how many levels deep a transaction is, and uses savepoints to implement correct rollback behaviour. Previously, once a nested transaction was complete, it would be saved with `COMMIT`, meaning that even if the outer transaction was rolled back, the operations in the inner transaction would persist. With this change, if the outer transaction gets rolled back, then all inner transactions will also be rolled back. Different flavours of SQL servers have different syntax for handling savepoints, so I've had to add new methods to the `Queryable` trait for getting the commit and rollback statements. These are both parameterized by the current depth. I've additionally had to modify the `begin_statement` method to accept a depth parameter, as it will need to conditionally create a savepoint. When opening a transaction via the transaction server, you can now pass the prior transaction ID to re-use the existing transaction, incrementing the depth. Signed-off-by: Lucian Buzzo <lucian.buzzo@gmail.com>
f486ca2
2 years ago
by LucianBuzzo
-0.22%
remove debug logs
e943433
2 years ago
by LucianBuzzo
© 2025 CodSpeed Technology
Home Terms Privacy Docs