deps/README.md
This directory contains all Valkey dependencies, except for the libc that should be provided by the operating system.
Jemalloc is modified with changes that allow us to implement the Valkey active defragmentation logic. However this feature of Valkey is not mandatory and Valkey is able to understand if the Jemalloc version it is compiled against supports such Valkey-specific modifications. So in theory, if you are not interested in the active defragmentation, you can replace Jemalloc just following these steps:
However note that we change Jemalloc settings via the configure script of Jemalloc using the --with-lg-quantum option, setting it to the value of 3 instead of 4. This provides us with more size classes that better suit the Valkey data structures, in order to gain memory efficiency.
If you want to upgrade Jemalloc while also providing support for active defragmentation, in addition to the above steps you need to perform the following additional steps:
include/jemalloc/jemalloc_macros.h.in, make sure
to add #define JEMALLOC_FRAG_HINT.je_get_defrag_hint() inside src/jemalloc.c. You
can see how it is implemented in the current Jemalloc source tree shipped
with Valkey, and rewrite it according to the new Jemalloc internals, if they
changed, otherwise you could just copy the old implementation if you are
upgrading just to a similar version of Jemalloc.The jemalloc directory is pulled as a subtree from the upstream jemalloc github repo. To update it you should run from the project root:
git subtree pull --prefix deps/jemalloc https://github.com/jemalloc/jemalloc.git <version-tag> --squashThis should hopefully merge the local changes into the new version. 2. In case any conflicts arise (due to our changes) you'll need to resolve them and commit. 3. Reconfigure jemalloc:
rm deps/jemalloc/VERSION deps/jemalloc/configure
cd deps/jemalloc
./autogen.sh --with-version=<version-tag>-0-g0
deps/Makefile: search for "--with-version=<old-version-tag>-0-g0" and update it accordingly.Libvalkey is used by Sentinel, valkey-cli and valkey-benchmark.
The library is built without its own version of the sds and dict type and uses the Valkey provided variant instead.
git subtree pull --prefix deps/libvalkey https://github.com/valkey-io/libvalkey.git <version-tag> --squashThis should hopefully merge the local changes into the new version. 2. Commit the changes.
Linenoise is rarely upgraded as needed. The upgrade process is trivial since Valkey uses a non modified version of linenoise, so to upgrade just do the following:
We use Lua 5.1 and no upgrade is planned currently, since we don't want to break Lua scripts for new Lua features: in the context of Valkey Lua scripts the capabilities of 5.1 are usually more than enough, the release is rock solid, and we definitely don't want to break old scripts.
So upgrading of Lua is up to the Valkey project maintainers and should be a manual procedure performed by taking a diff between the different versions.
Currently we have at least the following differences between official Lua 5.1 and our version:
lua_cjson.o, lua_struct.o, lua_cmsgpack.o and lua_bit.o.ldo.c, line 498: The check for LUA_SIGNATURE[0] is removed in order to avoid direct bytecode execution.lstring.c, the luaS_newlstr function's hash calculation has been upgraded from a simple hash function to MurmurHash3, implemented within the same file, to enhance performance, particularly for operations involving large strings.Updated source can be found here: https://github.com/HdrHistogram/HdrHistogram_c We use a customized version based on master branch commit e4448cf6d1cd08fff519812d3b1e58bd5a94ac42.
ffc.h is a pure C99 port of the fast_float library, providing fast string-to-double conversion without requiring a C++ compiler.
To upgrade the library,
The deps/gtest-parallel directory is imported from the upstream
https://github.com/google/gtest-parallel repository as a subtree snapshot (not a real Git subtree).
Current upstream version:
cd488bd (from google/gtest-parallel)Updating gtest-parallel
Run the following from the repository root.
Add the remote and fetch upstream:
git remote add gtest-parallel https://github.com/google/gtest-parallel.git
git fetch gtest-parallel master
Remove any previous import and commit (commit A):
rm -rf deps/gtest-parallel
Update the subtree from upstream:
git subtree add --prefix=deps/gtest-parallel gtest-parallel master --squash
Reset back to commit A with proper sign-off:
git reset --soft <commit-A-hash>
Commit the changes.