mattrobenolt / mattrobenolt/ps-http-sim
Transactions unexpected behavior (Prisma)
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 119
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
Hello, I have been working on setting up ps-http-sim in front of our MySQL docker container for our local development setup to give better parity with PlanetScale's actual DBs. Everything seems to be working great except that I am encountering strange errors with some of our transactional-based operations. The two unexpected behaviors I am seeing are:
- Transaction operations executing out of order. In many areas of our codebase we create an object, and then reuse that object later in the transaction. For example:
await prisma.$transaction([
prisma.user.create({ data: { id, ... } }),
prisma.foo.create(...),
prisma.user.update({ where: { id }, data: { ... } })
])
When using ps-http-sim I often, but not always, run into the error: An operation failed because it depends on one or more records that were required but not found. No record was found for an update. Which leads be to believe the transaction operations are being executed in parallel instead of strictly sequentially. This is also supported by the fact that every once in a while it will succeed (parallel operations just happen to be executed in the right order).
- The other issue is that when these transactions fail, the executed operations are not rolled back. In the example above, I have seen cases where the new
foorecord exists in the database after the transaction failed on theuser.updateoperation.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file or test is identified in the report. Start by reproducing the Prisma transaction example against ps-http-sim and compare its operation ordering and failure behavior with MySQL. Done means dependent operations run in order and failed transactions leave no partial records.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, mysql, typescript
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100