valkey icon indicating copy to clipboard operation
valkey copied to clipboard

[Feature] Implement CLUSTER FLUSHSLOT command

Open madolson opened this issue 4 months ago • 5 comments

As part of the per-slot dictionary effort, we implemented all of the needed changes so that we could efficiently unlink and free the data in a single slot with lazyfree. This is useful in two cases:

  1. When a primary loses ownership of a slot, it will temporarily freeze while it synchronously frees the slot.
  2. When doing resharding, you may prefer to forcibly delete all the data from a slot and assign it to another node.

The main point where code needs to be updated: https://github.com/valkey-io/valkey/blob/b5eb7930797023f46331d68b964b3871625da79d/src/cluster_legacy.c#L6040

Alternative naming conventions (Naming was finalized, leaving for historical purposes):

  1. SFLUSH (presumably slot flush). The S prefix is also used for set, so it may not make the most sense to emulate.
  2. FLUSHSLOT. Since this is mostly be an admin command, it might make sense to attach the cluster.

madolson avatar Oct 07 '24 03:10 madolson