microsoft / garnet

Garnet is a remote cache-store from Microsoft Research that offers strong performance (throughput and latency), scalability, storage, recovery, cluster sharding, key migration, and replication features. Garnet can work with existing Redis clients.
https://microsoft.github.io/garnet/
MIT License
9.71k stars 459 forks source link

Remove `Worker.ReplicationOffset` in `ClusterConfig` #489

Closed chenhao-ye closed 1 day ago

chenhao-ye commented 5 days ago

Remove the field ReplicationOffset from struct Worker for the following reasons:

  1. It is barely used: Only the local worker (ClusterConfig.workers[1]) carries a meaningful replication offset, other workers have ReplicationOffset = 0 upon initialization but never being updated later (this field is not updated during gossip).
  2. It is redundant: the local replication offset is already available in replication info (by command INFO).
  3. Most importantly, it does not match the semantics of ClusterConfig: the cluster configuration is not expected to be updated in a steady state (i.e., no cluster membership changes) while replication offset can change rapidly as long as there is new data. The cluster epoch should not be updated simply because there is new data being replicated.
chenhao-ye commented 1 day ago

Redis CLUSTER SHARDS will return the replication offset, so this change may break the compatibility with Redis.

This also means, Worker.ReplicationOffset not being updated during gossip might be something to fix.