Skip to content

Use EVALSHA in replication channel #558

Closed

Description

@antirez

Currently the full script is sent in the replication channel (and the master makes sure to remember the full original source of a script into an hash table). However taking track of what was already sent to a given slave is pretty straightforward, even using constant memory and evicting elements at random or using sampling and oldest time.

The implementation of this thing should look like that (but don't consider this a final specification as probably I may change something during the implementation):

  • Slave don't accept SCRIPT FLUSH command.
  • Master propagates SCRIPT FLUSH command to slave.
  • There is a per-slave hash table mapping SHA1 -> time, with all the scripts already transmitted to the slave.
  • Optionally we can evict SHA1s if a given limit per slave is reached, but likely not a good idea to start. In sane environments scripts are just a few.
  • SCRIPT FLUSH on master flushes also the per-slave dictionaries, other than propagating a SCRIPT FLUSH everywhere.

Maybe the same approach could be used for the AOF as well? Think about it.

Activity

  1. ghost assigned on Jun 18, 2012
  2. antirez commented on Sep 17, 2012

    @antirez
    ContributorAuthor

    Moved to 2.8 milestone in order to release 2.6 final ASAP.

  3. antirez commented on Jun 27, 2013

    @antirez
    ContributorAuthor

    Done, closing.

  4. added a commit that references this issue on Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions