Fix Eval scripts defrag (broken 7.0 in RC1)#10271
Conversation
In redis#10126 the global `lua_script` dict became a dict to a custom `luaScript` struct with an internal `robj` in it instead of a generic `sds` -> `robj` dict. This means we need custom code to defrag it and since scripts should never really cause much fragmentation it makes more sense to simply remove the defrag code for scripts.
|
My general comments about the active defrag in relation to this PR: The basic idea behind defrag is that the allocations for the dataset might become very fragmented over time and at the same time the dataset is organized through a single dictionary. So it's easy to defrag it. If we decide to defrag everything then at some point we'll probably run into the following:
We should try to keep defrag to dataset because it's by definition accessed only from a single location and tends to have more "public" interfaces for its data structures. Alternatively we can simply fix the existing code in the following way: |
|
i'm not sure defrag is only about data set. it's about anything that can grow large and remain for long! for instance, there's no point in defraging users, since they're not expected to grow much, and are also kinda static, and there's no point in defragging output buffers, since they're temporary. However, Eval script remain for long, and in some cases can be unintentionally bloated. Functions may be less of a problem, since i think they'll tend to be more static, and won't be unintentionally bloated. |
This test was introduced in upstream PR [1], but it fails in some situations, like when the src_test phase is run in a container. At least this is where I was able to reproduce it. [1] redis/redis#10271 Closes: https://bugs.gentoo.org/851654 Signed-off-by: Petr Vaněk <[email protected]>
This test was introduced in upstream PR [1], but it fails in some situations, like when the src_test phase is run in a container. At least this is where I was able to reproduce it. [1] redis/redis#10271 Closes: https://bugs.gentoo.org/851654 Signed-off-by: Petr Vaněk <[email protected]> Signed-off-by: Sam James <[email protected]>
Fix scripts defragger since it was broken since #10126 (released in 7.0 RC1).
would crash the server if defragger starts in a server that contains eval scripts.
In #10126 the global
lua_scriptdict became a dict to a customluaScriptstruct with an internalrobjin it instead of a genericsds->robjdict.