fivenines

Practice / target 80%

Hash Table And Rehashing Practice

01

A dictionary is currently rehashing. Predict the lookup path for an old key, a newly inserted key, and a missing key.

intro

Scenario

The main keyspace dictionary has outgrown its table and is partway through an incremental rehash.

02

Why does incremental rehashing trade implementation simplicity for latency stability?

intro

Scenario

You are justifying why the dictionary migrates a few buckets at a time instead of all at once.

03

What should happen to new inserts while two hash tables exist?

applied

Scenario

A SET command arrives for a brand-new key while the dictionary holds two live hash tables.

04

Why is rehashing connected to the event loop rather than only to data structure theory?

applied

Scenario

You notice the rehash step function is called from the server cron as well as from dictionary operations.

05

What can go wrong if deletes only check the new table during rehashing?

advanced

Scenario

A bug report shows deletions behaving strangely whenever the keyspace dictionary is mid-rehash.