01A dictionary is currently rehashing. Predict the lookup path for an old key, a newly inserted key, and a missing key.introScenarioThe main keyspace dictionary has outgrown its table and is partway through an incremental rehash.AAn old key may be found in the old table, a new insert goes to the new table, and a missing key must be checked against both tables.BAll lookups go to the new table first and never touch the old one, since the old table is read-only while rehashing.CEvery key is checked in both tables and the two results merged, doubling the cost of all operations until rehashing ends.DOld keys are found through a forwarding pointer left behind in the old table after each entry migrates, the same trick virtual memory uses for relocated pages.
02Why does incremental rehashing trade implementation simplicity for latency stability?introScenarioYou are justifying why the dictionary migrates a few buckets at a time instead of all at once.AIncremental rehashing is both simpler and faster overall; the only cost it pays is temporary extra memory.BIncremental rehashing is more complex, but it spreads migration across many operations so one resize does not create a large latency spike.CIt trades correctness for speed, accepting a small window where a key can be missed during the migration, a risk considered acceptable because resizes are rare events.DIt avoids latency spikes by running the whole migration on a background thread, away from the event loop.
03What should happen to new inserts while two hash tables exist?appliedScenarioA SET command arrives for a brand-new key while the dictionary holds two live hash tables.AInserts go to the old table so it remains authoritative, then migrate together with everything else.BInserts go to whichever table the key's hash selects, keeping the load balanced between the two.CInserts are buffered in a queue and applied once rehashing completes, so neither table changes mid-migration.DNew inserts should go into the new table while rehashing continues, so the old table only drains.
04Why is rehashing connected to the event loop rather than only to data structure theory?appliedScenarioYou notice the rehash step function is called from the server cron as well as from dictionary operations.AThe event loop owns the hash function, so the dictionary cannot compute bucket indexes without it.BRehashing must pause the event loop entirely, so the connection exists to schedule that pause safely, ideally during a quiet period when few clients are connected.CRehashing connects to the event loop because migration work must be budgeted around command latency and timer or operation-driven progress.DThe connection is only for observability, letting the loop publish rehash progress metrics to monitoring.
05What can go wrong if deletes only check the new table during rehashing?advancedScenarioA bug report shows deletions behaving strangely whenever the keyspace dictionary is mid-rehash.ANothing goes wrong, because deletes that miss the new table fail fast and the caller simply retries after the rehash.BDeletes that check only the new table can leave old-table keys visible, duplicated, or undeleted until migration happens.CThe new table becomes corrupted, because delete tombstones have nowhere to migrate when their bucket moves.DMemory leaks but lookups stay correct, since lookups never consult the old table either.