• debing.sun's avatar
    Trigger Lua GC after script loading (#13407) · 88af96c7
    debing.sun authored
    Nowdays we do not trigger LUA GC after loading lua script. This means
    that when a large number of scripts are loaded, such as when functions
    are propagating from the master to the replica, if the LUA scripts are
    never touched on the replica, the garbage might remain there
    indefinitely.
    
    Before this PR, we would share a gc_count between scripts and functions.
    This means that, under certain circumstances, the GC trigger for scripts
    and functions was not fair.
    For example, loading a large number of scripts followed by a small
    number of functions could result in the functions triggering GC.
    In this PR, we assign a unique `gc_count` to each of them, so the GC
    triggers between them will no longer affect each other.
    
    on the other hand, this PR will to bring regession for script loading
    commands(`FUNCTION LOAD` and `SCRIPT LOAD`), but they are not hot path,
    we can ignore it, and it will be replaced
    https://github.com/redis/redis/pull/13375
    
     in the future.
    
    ---------
    Co-authored-by: default avatarOran Agra <oran@redislabs.com>
    88af96c7
function_lua.c 16.9 KB