• Meir Shpilraien (Spielrein)'s avatar
    Remove dead code on sorting reply on Lua scripts. (#10701) · dad7f71f
    Meir Shpilraien (Spielrein) authored
    On v6.2.7 a new mechanism was added to Lua scripts that allows
    filtering the globals of the Lua interpreter. This mechanism was
    added on the following commit: https://github.com/redis/redis/commit/11b602fbf8f9cdf8fc741c24625ab6287ab998a9
    
    One of the globals that was filtered out was `__redis__compare_helper`. This global
    was missed and was not added to the allow list or to the deny list. This is
    why we get the following warning when Redis starts:
    `A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.`
    
    After investigating the git blame log, the conclusion is that `__redis__compare_helper`
    is no longer needed, the PR deletes this function, and fixes the warning.
    
    Detailed Explanation:
    
    `__redis__compare_helper` was added on this commit: https://github.com/redis/redis/commit/2c861050c1
    Its purpose is to sort the replies of `SORT` command when script replication is enable and keep the replies
    deterministic and avoid primary and replica synchronization issues. On `SORT` command, there was a need for
    special compare function that are able to compare boolean values.
    
    The need to sort the `SORT` command reply was removed on this commit: https://github.com/redis/redis/commit/36741b2c818a95e8ef167818271614ee6b1bc414
    The sorting was moved to be part of the `SORT` command and there was not longer a need
    to sort it on the Lua interpreter. The commit made `__redis__compare_helper` a dead code but did
    not deleted it.
    
    (cherry picked from commit 64c657a8)
    dad7f71f
scripting.c 98.6 KB