zodb / relstorage

A backend for ZODB that stores pickles in a relational database.
Other
55 stars 46 forks source link

Checkpoint for issue 311 #333

Closed jamadden closed 5 years ago

jamadden commented 5 years ago

This does a great deal for #311. You could probably say it fixes #311 (it definitely fixed a few random issues I discovered; every time the cache gets better, it seems like I find a new corner case. It's about 50/50 whether it's a genuine bug or just the tests previously getting lucky and working in one particular state of checkpoints). It introduces a shared PollingState object that handles deciding when checkpoints need to be rebuilt, and only doing that in one thread/connection, so we don't have this cascade effect where lots of connections decide they need to rebuild checkpoints and spend lots of time thrashing with each other on large queries. (Code gets interesting for PollingState starting around here.) There are still some rough edges and TODOs, but tests all pass as does some stress testing.

However, I think it's just a waypoint and I won't bother sanding down those edges (here). Centralizing control of polling and checkpoint (re)building got me thinking much more about #134, and I think we're not that far away from being able to implement that in a way that ought to get us away from checkpoints entirely, while being more efficient, especially on workloads that are adding/updating but also reading older objects that don't change. I'm getting a start on that in this branch; it'll probably take a couple days.