Skip to content

Commit 43076dd

Browse files
committed
Merge remote-tracking branch 'origin/unstable' into reply_offload
2 parents 724bfee + 20a49ff commit 43076dd

File tree

264 files changed

+31602
-15258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+31602
-15258
lines changed

.github/workflows/daily.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ jobs:
11261126
if: true && !contains(github.event.inputs.skiptests, 'cluster')
11271127
run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
11281128

1129-
build-macos:
1129+
build-old-macos-versions:
11301130
strategy:
11311131
fail-fast: false
11321132
matrix:
@@ -1343,7 +1343,7 @@ jobs:
13431343
- test-macos-latest
13441344
- test-macos-latest-sentinel
13451345
- test-macos-latest-cluster
1346-
- build-macos
1346+
- build-old-macos-versions
13471347
- test-freebsd
13481348
- test-alpine-jemalloc
13491349
- test-alpine-libc-malloc

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ option(BUILD_EXAMPLE_MODULES "Build example modules" OFF)
1919

2020
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
2121
project("valkey")
22+
add_compile_options(-Wundef)
2223

2324
set(CMAKE_C_STANDARD 11)
2425
set(CMAKE_C_STANDARD_REQUIRED ON)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ command in order to really clean everything and rebuild from scratch:
8787

8888
% make distclean
8989

90-
This will clean: jemalloc, lua, hiredis, linenoise and other dependencies.
90+
This will clean: jemalloc, lua, libvalkey, linenoise and other dependencies.
9191

9292
Also if you force certain build options like 32bit target, no C compiler
9393
optimizations (for debugging purposes), and other similar build time options,

cmake/Modules/SourceFiles.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ set(VALKEY_CLI_SRCS
116116
${CMAKE_SOURCE_DIR}/src/anet.c
117117
${CMAKE_SOURCE_DIR}/src/adlist.c
118118
${CMAKE_SOURCE_DIR}/src/dict.c
119+
${CMAKE_SOURCE_DIR}/src/sds.c
120+
${CMAKE_SOURCE_DIR}/src/sha256.c
121+
${CMAKE_SOURCE_DIR}/src/util.c
119122
${CMAKE_SOURCE_DIR}/src/valkey-cli.c
120123
${CMAKE_SOURCE_DIR}/src/zmalloc.c
121124
${CMAKE_SOURCE_DIR}/src/release.c
@@ -136,6 +139,9 @@ set(VALKEY_CLI_SRCS
136139
set(VALKEY_BENCHMARK_SRCS
137140
${CMAKE_SOURCE_DIR}/src/ae.c
138141
${CMAKE_SOURCE_DIR}/src/anet.c
142+
${CMAKE_SOURCE_DIR}/src/sds.c
143+
${CMAKE_SOURCE_DIR}/src/sha256.c
144+
${CMAKE_SOURCE_DIR}/src/util.c
139145
${CMAKE_SOURCE_DIR}/src/valkey-benchmark.c
140146
${CMAKE_SOURCE_DIR}/src/adlist.c
141147
${CMAKE_SOURCE_DIR}/src/dict.c

cmake/Modules/ValkeySetup.cmake

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,19 @@ macro (valkey_build_and_install_bin target sources ld_flags libs link_name)
8383

8484
# Place this line last to ensure that ${ld_flags} is placed last on the linker line
8585
target_link_libraries(${target} ${libs} ${ld_flags})
86-
target_link_libraries(${target} hiredis)
86+
target_link_libraries(${target} valkey::valkey)
8787
if (USE_TLS)
8888
# Add required libraries needed for TLS
89-
target_link_libraries(${target} OpenSSL::SSL hiredis_ssl)
89+
target_link_libraries(${target} OpenSSL::SSL valkey::valkey_tls)
90+
endif ()
91+
92+
if (USE_RDMA)
93+
# Add required libraries needed for RDMA
94+
# Bug in libvalkey 0.1.0: The order is important and we need to link
95+
# valkey::valkey after valkey::valkey_rdma. This will be fixed upstream.
96+
# TODO: Next time we lift libvalkey, remove valkey::valkey from
97+
# the next line.
98+
target_link_libraries(${target} valkey::valkey_rdma valkey::valkey)
9099
endif ()
91100

92101
if (IS_FREEBSD)
@@ -101,30 +110,6 @@ macro (valkey_build_and_install_bin target sources ld_flags libs link_name)
101110
valkey_create_symlink(${target} ${link_name})
102111
endmacro ()
103112

104-
# Helper function that defines, builds and installs `target` module.
105-
macro (valkey_build_and_install_module target sources ld_flags libs)
106-
add_library(${target} SHARED ${sources})
107-
108-
if (USE_JEMALLOC)
109-
# Using jemalloc
110-
target_link_libraries(${target} jemalloc)
111-
endif ()
112-
113-
# Place this line last to ensure that ${ld_flags} is placed last on the linker line
114-
target_link_libraries(${target} ${libs} ${ld_flags})
115-
if (USE_TLS)
116-
# Add required libraries needed for TLS
117-
target_link_libraries(${target} OpenSSL::SSL hiredis_ssl)
118-
endif ()
119-
120-
if (IS_FREEBSD)
121-
target_link_libraries(${target} execinfo)
122-
endif ()
123-
124-
# Install cli tool and create a redis symbolic link
125-
valkey_install_bin(${target})
126-
endmacro ()
127-
128113
# Determine if we are building in Release or Debug mode
129114
if (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DebugFull)
130115
set(VALKEY_DEBUG_BUILD 1)
@@ -296,7 +281,7 @@ if (BUILD_SANITIZER)
296281
endif ()
297282
endif ()
298283

299-
include_directories("${CMAKE_SOURCE_DIR}/deps/hiredis")
284+
include_directories("${CMAKE_SOURCE_DIR}/deps/libvalkey/include")
300285
include_directories("${CMAKE_SOURCE_DIR}/deps/linenoise")
301286
include_directories("${CMAKE_SOURCE_DIR}/deps/lua/src")
302287
include_directories("${CMAKE_SOURCE_DIR}/deps/hdr_histogram")

deps/CMakeLists.txt

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,36 @@ if (USE_JEMALLOC)
33
endif ()
44
add_subdirectory(lua)
55

6-
# Set hiredis options. We need to disable the defaults set in the OPTION(..) we do this by setting them in the CACHE
6+
# Set libvalkey options. We need to disable the defaults set in the OPTION(..) we do this by setting them in the CACHE
77
set(BUILD_SHARED_LIBS
88
OFF
99
CACHE BOOL "Build shared libraries")
1010
set(DISABLE_TESTS
1111
ON
1212
CACHE BOOL "If tests should be compiled or not")
1313
if (USE_TLS) # Module or no module
14-
message(STATUS "Building hiredis_ssl")
15-
set(ENABLE_SSL
14+
message(STATUS "Building valkey_tls")
15+
set(ENABLE_TLS
1616
ON
17-
CACHE BOOL "Should we test SSL connections")
17+
CACHE BOOL "If TLS support should be compiled or not")
1818
endif ()
19+
if (USE_RDMA) # Module or no module
20+
message(STATUS "Building valkey_rdma")
21+
set(ENABLE_RDMA
22+
ON
23+
CACHE BOOL "If RDMA support should be compiled or not")
24+
endif ()
25+
# Let libvalkey use sds and dict provided by valkey.
26+
set(DICT_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src)
27+
set(SDS_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src)
1928

20-
add_subdirectory(hiredis)
29+
add_subdirectory(libvalkey)
2130
add_subdirectory(linenoise)
2231
add_subdirectory(fpconv)
2332
add_subdirectory(hdr_histogram)
2433

25-
# Clear any cached variables passed to hiredis from the cache
34+
# Clear any cached variables passed to libvalkey from the cache
2635
unset(BUILD_SHARED_LIBS CACHE)
2736
unset(DISABLE_TESTS CACHE)
28-
unset(ENABLE_SSL CACHE)
37+
unset(ENABLE_TLS CACHE)
38+
unset(ENABLE_RDMA CACHE)

deps/Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ifneq ($(shell sh -c '[ -f .make-ldflags ] && cat .make-ldflags || echo none'),
3636
endif
3737

3838
distclean:
39-
-(cd hiredis && $(MAKE) clean) > /dev/null || true
39+
-(cd libvalkey && $(MAKE) clean) > /dev/null || true
4040
-(cd linenoise && $(MAKE) clean) > /dev/null || true
4141
-(cd lua && $(MAKE) clean) > /dev/null || true
4242
-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
@@ -47,15 +47,20 @@ distclean:
4747

4848
.PHONY: distclean
4949

50+
LIBVALKEY_MAKE_FLAGS = SDS_INCLUDE_DIR=../../src/ DICT_INCLUDE_DIR=../../src/
5051
ifneq (,$(filter $(BUILD_TLS),yes module))
51-
HIREDIS_MAKE_FLAGS = USE_SSL=1
52+
LIBVALKEY_MAKE_FLAGS += USE_TLS=1
5253
endif
5354

54-
hiredis: .make-prerequisites
55+
ifneq (,$(filter $(BUILD_RDMA),yes module))
56+
LIBVALKEY_MAKE_FLAGS += USE_RDMA=1
57+
endif
58+
59+
libvalkey: .make-prerequisites
5560
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
56-
cd hiredis && $(MAKE) static $(HIREDIS_MAKE_FLAGS)
61+
cd libvalkey && $(MAKE) static $(LIBVALKEY_MAKE_FLAGS)
5762

58-
.PHONY: hiredis
63+
.PHONY: libvalkey
5964

6065
linenoise: .make-prerequisites
6166
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)

deps/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ This directory contains all Valkey dependencies, except for the libc that
22
should be provided by the operating system.
33

44
* **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-
* **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.
5+
* **libvalkey** is the official C client library for Valkey. It is used by valkey-cli, valkey-benchmark and Valkey Sentinel. It is managed in a separate project and updated as needed.
66
* **linenoise** is a readline replacement. It is developed by the same authors of Valkey but is managed as a separated project and updated as needed.
77
* **lua** is Lua 5.1 with minor changes for security and additional libraries.
88
* **hdr_histogram** Used for per-command latency tracking histograms.
@@ -59,14 +59,15 @@ cd deps/jemalloc
5959
4. Update jemalloc's version in `deps/Makefile`: search for "`--with-version=<old-version-tag>-0-g0`" and update it accordingly.
6060
5. Commit the changes (VERSION,configure,Makefile).
6161

62-
Hiredis
62+
Libvalkey
6363
---
6464

65-
Hiredis is used by Sentinel, `valkey-cli` and `valkey-benchmark`. Like Valkey, uses the SDS string library, but not necessarily the same version. In order to avoid conflicts, this version has all SDS identifiers prefixed by `hi`.
65+
Libvalkey is used by Sentinel, `valkey-cli` and `valkey-benchmark`.
66+
The library is built without its own version of the sds and dict type and uses the Valkey provided variant instead.
6667

67-
1. `git subtree pull --prefix deps/hiredis https://github.com/redis/hiredis.git <version-tag> --squash`<br>
68+
1. `git subtree pull --prefix deps/libvalkey https://github.com/valkey-io/libvalkey.git <version-tag> --squash`<br>
6869
This should hopefully merge the local changes into the new version.
69-
2. Conflicts will arise (due to our changes) you'll need to resolve them and commit.
70+
2. Commit the changes.
7071

7172
Linenoise
7273
---

0 commit comments

Comments
 (0)