Skip to content

2.25.2.0-b139

@es1024 es1024 tagged this 11 Mar 18:06
Summary:
This diff adds `RobustHashMap`, which is a simple hash map that is able to
recover from process crash while the container is being modified.

`RobustHashMap` is similar to `std::unordered_map` in interface with a couple of differences:
- `operator[]` not provided, since it can be misleading (`map[1] = 2` can result in `{1: 0}`
  permanently, since `operator[]` will first default construct a value, and we can crash right then
  and there)
- advancing iterators is not guaranteed constant-time (but iterating the entire container is still
  linear-time)

This will be used in future changes to place the lock manager for table locks in shared
memory.
Jira: DB-14774

Test Plan:
Added unit tests:
```
./yb_build.sh --cxx-test 'util_robust_hash_map-test'
```

Reviewers: sergei, bkolagani

Reviewed By: sergei

Subscribers: svc_phabricator, ybase, zdrudi, amitanand

Differential Revision: https://phorge.dev.yugabyte.com/D40722
Assets 2
Loading