Concurrent use of portals and simple queries invalidates portals
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 1.7k
- Forks
- 175
- Avg merge
- 5d 14h
- Merged PRs (30d)
- 9
Description
To reproduce:
//from CursorTest.scala
sessionTest("invalidation") { s =>
cursor(s).use { c =>
for {
_ <- c.fetch(1)
_ <- s.execute(sql"select 1;".query(int4))
_ <- c.fetch(1)
} yield ()
}
}
This will fail with exception Problem: Portal "portal_2" does not exist.
From what is seen on tcpdump and wireshark, Portal get invalidated implicitly and server takes it as a given and not sends any message for its invalidation.
expected behavior:
This is hard to say, as it is exactly what postgres do which is inconvenient IMO, but this is issue can be mitigated by warnings on document, method docs etc.
Contributor guide
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
Start with the invalidation test in CursorTest.scala and run the sessionTest("invalidation") reproduction. Trace the interaction between c.fetch(1) and s.execute(sql"select 1;".query(int4)); done should prevent the portal_2 failure or clearly document the portal invalidation behavior and its mitigation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgres, scala
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100