Reinstate open-addressing hash to work on concurrency improvements.#5419
Reinstate open-addressing hash to work on concurrency improvements.#5419
Conversation
This should help move us toward safer concurrent access to Hash, although most of these reads are still non-atomic and may be interrupted by another thread (e.g. an update happens between read of `start` and `end`). We at least reduce the possibility of another thread's updates via this change.
173b05f to
4b6d2ea
Compare
|
@headius - Are we planing to include in coming releases of 9.2.x.x ? |
|
That would be great, I'm still open for helping out 👍 |
|
@ChrisBr @anup1710 Unsure if we'll get to it for 9.2.7, or even 9.2.8, since priority right now is fixing some long-neglected areas (refinements, newer load/require logic) but this is still definitely in plan. I'll see about cleaning up what I've done on the branch. It constitutes more of an experiment. The general idea is trying to reduce the number of fields we have to update when adding to the Hash. My approach seems to be working, generally...I split the two implementations (linear search and open addressed) as different classes, so switching between them is switching atomically between two object instances. However, this means an extra hope, and the two impls themselves don't have any more thread-safety than they did before (except perhaps for a bit safer handling of the int values, since I pack them into longs. We have never managed to isolate the concurrency problems that @enebo found while trying to run rails with this Hash impl, but we suspect the problem is that the state changes happening for open addressing happen to be slightly "less threadsafe" than the already-not-threadsafe Hash on master. If we can mitigate that by simplifying, atomicizing, or otherwise synchronizing those state changes, we can land it. This may mean we have to go full-on thread-safe Hash, ideally just using atomic updates (i.e. no locks). We still very much want to land this! |
|
@headius - Hope we are moving on track to make this live in 9.3.x.x |
|
Yeah, happy to continue working on this 👍 @headius any plans how to move forward? |
|
This version went a bit too far in restructuring so I've rebooted this as #5967. |
See #5412.
This is a work in progress as we improve @ChrisBr's open-addressing Hash impl for better concurrency.