mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
This is living in a subdirectory for now so we can have better turnaround time on tests and not have to build everything else along with it. This covers the logic that we can have *without* actually using databases or the filesystem in any way, just to provide a framework that lets us validate the logic handling overlapping queries. The overall purpose of this is to prevent deadlocks, by ensuring that database locks are only taken when we have already proven that they are available. In short, the QueryContext preregisters its "scope" -- the set of things it may want to lock. The operation of creating the QueryContext can block, but it blocks with no database locks held. Once it is unblocked, the scope it has reported is now considered unavailable, and no other QueryContext using any overlapping scope can complete creation until this QueryContext completes. While it's running, the QueryContext can't request write access to anything outside its scope. Thus, once created, a QueryContext can always proceed, without being blocked, until it's done. Note that this does not fully address multi-node behaviors; once you have a QueryContext blocking things, you need to not make queries to other nodes that could be blocked in turn by those nodes. In short, no write queries to other nodes while holding a write-type QueryContext on the local node, because if two nodes do that to each other at once, they can both be blocked. We believe RBF is currently designed such that read-only accesses don't block progress on writes, so non-write access doesn't create problems. We also have some code to allow us to create dot-format output from the components of this system, which is mostly intended to be a debugging tool. |
||
|---|---|---|
| .. | ||
| testdata/fuzz/FuzzWriteRequests | ||
| doc.go | ||
| dot_test.go | ||
| query_context.go | ||
| query_context_test.go | ||
| rbf.go | ||
| TODO.txt | ||
| txstore.go | ||
| visualize.go | ||