xref: /f-stack/app/redis-5.0.5/deps/README.md (revision 572c4311)
1This directory contains all Redis dependencies, except for the libc that
2should be provided by the operating system.
3
4* **Jemalloc** is our memory allocator, used as replacement for libc malloc on Linux by default. It has good performances and excellent fragmentation behavior. This component is upgraded from time to time.
5* **geohash-int** is inside the dependencies directory but is actually part of the Redis project, since it is our private fork (heavily modified) of a library initially developed for Ardb, which is in turn a fork of Redis.
6* **hiredis** is the official C client library for Redis. It is used by redis-cli, redis-benchmark and Redis Sentinel. It is part of the Redis official ecosystem but is developed externally from the Redis repository, so we just upgrade it as needed.
7* **linenoise** is a readline replacement. It is developed by the same authors of Redis but is managed as a separated project and updated as needed.
8* **lua** is Lua 5.1 with minor changes for security and additional libraries.
9
10How to upgrade the above dependencies
11===
12
13Jemalloc
14---
15
16Jemalloc is modified with changes that allow us to implement the Redis
17active defragmentation logic. However this feature of Redis is not mandatory
18and Redis is able to understand if the Jemalloc version it is compiled
19against supports such Redis-specific modifications. So in theory, if you
20are not interested in the active defragmentation, you can replace Jemalloc
21just following tose steps:
22
231. Remove the jemalloc directory.
242. Substitute it with the new jemalloc source tree.
253. Edit the Makefile localted in the same directory as the README you are
26   reading, and change the --with-version in the Jemalloc configure script
27   options with the version you are using. This is required because otherwise
28   Jemalloc configuration script is broken and will not work nested in another
29   git repository.
30
31However 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 Redis data structures, in order to gain memory efficiency.
32
33If you want to upgrade Jemalloc while also providing support for
34active defragmentation, in addition to the above steps you need to perform
35the following additional steps:
36
375. In Jemalloc three, file `include/jemalloc/jemalloc_macros.h.in`, make sure
38   to add `#define JEMALLOC_FRAG_HINT`.
396. Implement the function `je_get_defrag_hint()` inside `src/jemalloc.c`. You
40   can see how it is implemented in the current Jemalloc source tree shipped
41   with Redis, and rewrite it according to the new Jemalloc internals, if they
42   changed, otherwise you could just copy the old implementation if you are
43   upgrading just to a similar version of Jemalloc.
44
45Geohash
46---
47
48This is never upgraded since it's part of the Redis project. If there are changes to merge from Ardb there is the need to manually check differences, but at this point the source code is pretty different.
49
50Hiredis
51---
52
53Hiredis uses the SDS string library, that must be the same version used inside Redis itself. Hiredis is also very critical for Sentinel. Historically Redis often used forked versions of hiredis in a way or the other. In order to upgrade it is advised to take a lot of care:
54
551. Check with diff if hiredis API changed and what impact it could have in Redis.
562. Make sure thet the SDS library inside Hiredis and inside Redis are compatible.
573. After the upgrade, run the Redis Sentinel test.
584. Check manually that redis-cli and redis-benchmark behave as expecteed, since we have no tests for CLI utilities currently.
59
60Linenoise
61---
62
63Linenoise is rarely upgraded as needed. The upgrade process is trivial since
64Redis uses a non modified version of linenoise, so to upgrade just do the
65following:
66
671. Remove the linenoise directory.
682. Substitute it with the new linenoise source tree.
69
70Lua
71---
72
73We use Lua 5.1 and no upgrade is planned currently, since we don't want to break
74Lua scripts for new Lua features: in the context of Redis Lua scripts the
75capabilities of 5.1 are usually more than enough, the release is rock solid,
76and we definitely don't want to break old scripts.
77
78So upgrading of Lua is up to the Redis project maintainers and should be a
79manual procedure performed by taking a diff between the different versions.
80
81Currently we have at least the following differences between official Lua 5.1
82and our version:
83
841. Makefile is modified to allow a different compiler than GCC.
852. We have the implementation source code, and directly link to the following external libraries: `lua_cjson.o`, `lua_struct.o`, `lua_cmsgpack.o` and `lua_bit.o`.
863. There is a security fix in `ldo.c`, line 498: The check for `LUA_SIGNATURE[0]` is removed in order toa void direct bytecode execution.
87
88
89