Read continuously while rebuild is happening; collect any anomalies.
(idx_path, stop_event, errors)
| 282 | |
| 283 | |
| 284 | def _concurrent_reader(idx_path, stop_event, errors): |
| 285 | """Read continuously while rebuild is happening; collect any anomalies.""" |
| 286 | c = MmapCache(idx_path, size=256, slot_size=128, key_size=48) |
| 287 | while not stop_event.is_set(): |
| 288 | keys = c.list_keys() |
| 289 | # After rebuild the cache must be self-consistent: |
| 290 | # every key returned by list_keys must be gettable. |
| 291 | for k in keys: |
| 292 | v = c.get(k) |
| 293 | if v is None: |
| 294 | errors.append(f"list_keys returned {k!r} but get returned None") |
| 295 | c.close() |
| 296 | |
| 297 | |
| 298 | class TestAtomicRebuild: |