diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c3e9f5b9a6..8697a41b896 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,8 +99,10 @@ jobs: run: | sudo apt-get update sudo apt-get -y install libsnappy-dev zlib1g-dev libstdc++6 liburing-dev libevent-dev libunwind-dev libgoogle-glog-dev - - name: make test - run: LD_LIBRARY_PATH=/home/runner/work/Redis-On-Rocks/Redis-On-Rocks/deps/rocksdb/_build_folly/libs/glog/lib:/home/runner/work/Redis-On-Rocks/Redis-On-Rocks/deps/rocksdb/_build_folly/libs/libevent/lib make SWAP=1 test -j8 + - name: make + run: make SWAP=1 -j8 + - name: test + run: LD_LIBRARY_PATH=/home/runner/work/Redis-On-Rocks/Redis-On-Rocks/deps/rocksdb/_build_folly/libs/glog/lib:/home/runner/work/Redis-On-Rocks/Redis-On-Rocks/deps/rocksdb/_build_folly/libs/libevent/lib make SWAP=1 test # SWAP mode with Address Sanitizer swap-asan: diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index 4395d62f80f..00000000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: "Codecov" - -# Enabling on each push is to display the coverage changes in every PR, -# where each PR needs to be compared against the coverage of the head commit -on: [push, pull_request] - -jobs: - code-coverage: - runs-on: ubuntu-22.04 - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: true - - - name: Install dependencies and lcov - run: | - sudo apt-get update - sudo apt-get install -y lcov libsnappy-dev zlib1g-dev libstdc++6 liburing-dev libevent-dev libunwind-dev libgoogle-glog-dev - - - name: Run test with coverage - run: make lcov - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./src/redis.info diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index c5411b96c19..00000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: "CodeQL" - -on: - pull_request: - schedule: - # run weekly new vulnerability was added to the database - - cron: '0 0 * * 0' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - if: github.event_name != 'schedule' || github.repository == 'redis/redis' - - strategy: - fail-fast: false - matrix: - language: [ 'cpp' ] - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/external.yml b/.github/workflows/external.yml deleted file mode 100644 index 0cc863a6913..00000000000 --- a/.github/workflows/external.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: External Server Tests - -on: - pull_request: - push: - schedule: - - cron: '0 0 * * *' - -jobs: - test-external-standalone: - runs-on: ubuntu-latest - if: github.event_name != 'schedule' || github.repository == 'redis/redis' - timeout-minutes: 14400 - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - name: install dependencies - run: | - sudo apt-get update - sudo apt-get -y install tcl8.6 tclx libsnappy-dev zlib1g-dev libstdc++6 liburing-dev libevent-dev libgoogle-glog-dev - - name: Build - run: make -j8 - - name: Start redis-server - run: | - ./src/redis-server --daemonize yes --save "" --logfile external-redis.log \ - --enable-protected-configs yes --enable-debug-command yes --enable-module-command yes - - name: Run external test - run: | - ./runtest \ - --host 127.0.0.1 --port 6379 \ - --verbose \ - --tags -slow - - name: Archive redis log - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: test-external-redis-log - path: external-redis.log - - test-external-cluster: - runs-on: ubuntu-latest - if: github.event_name != 'schedule' || github.repository == 'redis/redis' - timeout-minutes: 14400 - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - name: install dependencies - run: | - sudo apt-get update - sudo apt-get -y install tcl8.6 tclx libsnappy-dev zlib1g-dev libstdc++6 liburing-dev libevent-dev libgoogle-glog-dev - - name: Build - run: make -j8 - - name: Start redis-server - run: | - ./src/redis-server --cluster-enabled yes --daemonize yes --save "" --logfile external-redis-cluster.log \ - --enable-protected-configs yes --enable-debug-command yes --enable-module-command yes - - name: Create a single node cluster - run: ./src/redis-cli cluster addslots $(for slot in {0..16383}; do echo $slot; done); sleep 5 - - name: Run external test - run: | - ./runtest \ - --host 127.0.0.1 --port 6379 \ - --verbose \ - --cluster-mode \ - --tags -slow - - name: Archive redis log - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: test-external-cluster-log - path: external-redis-cluster.log - - test-external-nodebug: - runs-on: ubuntu-latest - if: github.event_name != 'schedule' || github.repository == 'redis/redis' - timeout-minutes: 14400 - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - name: install dependencies - run: | - sudo apt-get update - sudo apt-get -y install tcl8.6 tclx libsnappy-dev zlib1g-dev libstdc++6 liburing-dev libevent-dev libgoogle-glog-dev - - name: Build - run: make -j8 - - name: Start redis-server - run: | - ./src/redis-server --daemonize yes --save "" --logfile external-redis-nodebug.log - - name: Run external test - run: | - ./runtest \ - --host 127.0.0.1 --port 6379 \ - --verbose \ - --tags "-slow -needs:debug" - - name: Archive redis log - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: test-external-redis-nodebug-log - path: external-redis-nodebug.log diff --git a/deps/Makefile b/deps/Makefile index 3edeecb4ed1..c8b913332ee 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -53,6 +53,7 @@ ifneq ($(shell sh -c '[ -f .make-ldflags ] && cat .make-ldflags || echo none'), endif distclean: + @echo "==================== DEPS DISTCLEAN CALLED ====================" -(cd hiredis && $(MAKE) clean) > /dev/null || true -(cd linenoise && $(MAKE) clean) > /dev/null || true -(cd lua && $(MAKE) clean) > /dev/null || true @@ -63,6 +64,7 @@ distclean: -(cd xredis-gtid && [ -f Makefile ] && $(MAKE) clean) > /dev/null || true -(cd tdigest && $(MAKE) clean) > /dev/null || true -(rm -f .make-*) + @echo "==================== DEPS DISTCLEAN FINISHED ====================" .PHONY: distclean @@ -74,7 +76,7 @@ endif # modifies these variables in its Makefile. hiredis: .make-prerequisites @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) - cd hiredis && $(MAKE) static $(HIREDIS_MAKE_FLAGS) HIREDIS_CFLAGS="$(DEPS_CFLAGS)" HIREDIS_LDFLAGS="$(DEPS_LDFLAGS)" + cd hiredis && $(MAKE) static $(HIREDIS_MAKE_FLAGS) .PHONY: hiredis @@ -160,43 +162,48 @@ ROCKSDB_CFLAGS = $(CFLAGS) ROCKSDB_BUILD_FOLLY_FLAGS=ROCKSDB_DISABLE_BZIP=1 ROCKSDB_DISABLE_LZ4=1 ROCKSDB_DISABLE_ZSTD=1 ROCKSDB_DISABLE_MALLOC_USABLE_SIZE=1 ROCKSDB_DISABLE_MEMKIND=1 PORTABLE=1 ROCKSDB_USE_IO_URING=1 ROCKSDB_BUILD_FLAGS=USE_COROUTINES=1 USE_FOLLY=1 $(ROCKSDB_BUILD_FOLLY_FLAGS) -./rocksdb/_build_folly/libs/folly/lib/libfolly.a: - if [ ! -f rocksdb/_build_folly/installed/folly/lib/libfolly.a ]; then \ +./rocksdb/_build_folly/folly/lib/libfolly.a: + @if [ ! -f rocksdb/_build_folly/installed/folly/lib/libfolly.a ]; then \ + echo "Building folly for the first time..."; \ cd rocksdb && ${ROCKSDB_BUILD_FOLLY_FLAGS} ${MAKE} checkout_folly && ${ROCKSDB_BUILD_FOLLY_FLAGS} ${MAKE} build_folly; \ fi - rm -rf ./rocksdb/_build_folly/libs - mkdir -p ./rocksdb/_build_folly/libs - FBUILD_PATH=`ls -d ./rocksdb/_build_folly*`; \ - BOOST_PATH=`ls -d $${FBUILD_PATH}/installed/boost*`; \ - DBL_CONV_PATH=`ls -d $${FBUILD_PATH}/installed/double-conversion*`; \ - FMT_PATH=`ls -d $${FBUILD_PATH}/installed/fmt*`; \ - GLOG_PATH=`ls -d $${FBUILD_PATH}/installed/glog*`; \ - GFLAGS_PATH=`ls -d $${FBUILD_PATH}/installed/gflags*`; \ - LIBEVENT_PATH=`ls -d $${FBUILD_PATH}/installed/libevent*`; \ - GLOG_LIB_PATH=`ls -d $${GLOG_PATH}/lib*`; \ - FMT_LIB_PATH=`ls -d $${FMT_PATH}/lib*`; \ - cp -r $${BOOST_PATH} ./rocksdb/_build_folly/libs/boost; \ - cp -r $${DBL_CONV_PATH} ./rocksdb/_build_folly/libs/double-conversion; \ - mkdir -p ./rocksdb/_build_folly/libs/fmt; \ - cp -r $${FMT_PATH}/include ./rocksdb/_build_folly/libs/fmt/include; \ - cp -r $${FMT_LIB_PATH} ./rocksdb/_build_folly/libs/fmt/lib; \ - mkdir -p ./rocksdb/_build_folly/libs/glog; \ - cp -r $${GLOG_PATH}/include ./rocksdb/_build_folly/libs/glog/include; \ - cp -r $${GLOG_LIB_PATH} ./rocksdb/_build_folly/libs/glog/lib; \ - mkdir -p ./rocksdb/_build_folly/libs/libiberty; \ - cp -r $${GFLAGS_PATH} ./rocksdb/_build_folly/libs/gflags; \ - cp -r $${LIBEVENT_PATH} ./rocksdb/_build_folly/libs/libevent; \ - cp -r $${FBUILD_PATH}/installed/folly ./rocksdb/_build_folly/libs/folly - - - -rocksdb: rocksdb/librocksdb.a ./rocksdb/_build_folly/libs/folly/lib/libfolly.a - -rocksdb/librocksdb.a: ./rocksdb/_build_folly/libs/folly/lib/libfolly.a - @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)rocksdb$(ENDCOLOR) + @if [ ! -f ./rocksdb/_build_folly/libs/folly/lib/libfolly.a ]; then \ + echo "Copying libraries from installed to libs directory..."; \ + rm -rf ./rocksdb/_build_folly/libs; \ + mkdir -p ./rocksdb/_build_folly/libs; \ + FBUILD_PATH=`ls -d ./rocksdb/_build_folly*`; \ + BOOST_PATH=`ls -d $${FBUILD_PATH}/installed/boost*`; \ + DBL_CONV_PATH=`ls -d $${FBUILD_PATH}/installed/double-conversion*`; \ + FMT_PATH=`ls -d $${FBUILD_PATH}/installed/fmt*`; \ + GLOG_PATH=`ls -d $${FBUILD_PATH}/installed/glog*`; \ + GFLAGS_PATH=`ls -d $${FBUILD_PATH}/installed/gflags*`; \ + LIBEVENT_PATH=`ls -d $${FBUILD_PATH}/installed/libevent*`; \ + GLOG_LIB_PATH=`ls -d $${GLOG_PATH}/lib*`; \ + FMT_LIB_PATH=`ls -d $${FMT_PATH}/lib*`; \ + cp -r $${BOOST_PATH} ./rocksdb/_build_folly/libs/boost; \ + cp -r $${DBL_CONV_PATH} ./rocksdb/_build_folly/libs/double-conversion; \ + mkdir -p ./rocksdb/_build_folly/libs/fmt; \ + cp -r $${FMT_PATH}/include ./rocksdb/_build_folly/libs/fmt/include; \ + cp -r $${FMT_LIB_PATH} ./rocksdb/_build_folly/libs/fmt/lib; \ + mkdir -p ./rocksdb/_build_folly/libs/glog; \ + cp -r $${GLOG_PATH}/include ./rocksdb/_build_folly/libs/glog/include; \ + cp -r $${GLOG_LIB_PATH} ./rocksdb/_build_folly/libs/glog/lib; \ + mkdir -p ./rocksdb/_build_folly/libs/libiberty; \ + cp -r $${GFLAGS_PATH} ./rocksdb/_build_folly/libs/gflags; \ + cp -r $${LIBEVENT_PATH} ./rocksdb/_build_folly/libs/libevent; \ + cp -r $${FBUILD_PATH}/installed/folly ./rocksdb/_build_folly/libs/folly; \ + echo "Libraries copied successfully."; \ + else \ + echo "libs directory already exists, skipping copy to preserve timestamps."; \ + fi + + + +rocksdb: ./rocksdb/_build_folly/folly/lib/libfolly.a .make-prerequisites + @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) cd rocksdb && $(ROCKSDB_BUILD_FLAGS) $(MAKE) CFLAGS="$(ROCKSDB_CFLAGS)" static_lib -# Remove .PHONY for rocksdb to enable incremental builds +.PHONY: rocksdb XREDIS_GTID_CFLAGS= -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops $(CFLAGS) XREDIS_GTID_LDFLAGS= $(LDFLAGS) diff --git a/src/Makefile b/src/Makefile index dcd8a5facbc..9d8125609b3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -36,10 +36,10 @@ ifneq ($(OPTIMIZATION),-O0) OPTIMIZATION+=-fno-omit-frame-pointer endif DEPENDENCY_TARGETS=hiredis linenoise lua hdr_histogram fpconv fast_float xredis-gtid -NODEPS:=clean distclean ifdef SWAP - DEPENDENCY_TARGETS+=tdigest + DEPENDENCY_TARGETS+=tdigest rocksdb endif +NODEPS:=clean distclean # Default settings STD=-pedantic -DREDIS_STATIC='' @@ -414,7 +414,7 @@ all: $(REDIS_SERVER_NAME) $(REDIS_SENTINEL_NAME) $(REDIS_CLI_NAME) $(REDIS_BENCH @echo "Hint: It's a good idea to run 'make test' ;)" @echo "" -Makefile.dep: .make-compile-prerequisites +Makefile.dep: .make-prerequisites -$(REDIS_CC) -MM $(ALL_SOURCES) > Makefile.dep 2> /dev/null || true ifeq (0, $(words $(findstring $(MAKECMDGOALS), $(NODEPS)))) @@ -436,42 +436,24 @@ persist-settings: echo REDIS_LDFLAGS=$(REDIS_LDFLAGS) >> .make-settings echo PREV_FINAL_CFLAGS=$(FINAL_CFLAGS) >> .make-settings echo PREV_FINAL_LDFLAGS=$(FINAL_LDFLAGS) >> .make-settings - @(cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS) > /dev/null 2>&1) + @echo "==================== Building dependencies ====================" + cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS) || { echo "ERROR: Dependency build failed!"; exit 1; } .PHONY: persist-settings -# Prerequisites target - separated for compile-time and link-time deps -# Always build dependencies on first run (when .make-compile-prerequisites doesn't exist) -.make-compile-prerequisites: - @if [ ! -f $@ ]; then \ - echo "Building compile dependencies for first time..."; \ - touch $@; \ - echo STD=$(STD) > .make-settings; \ - echo WARN=$(WARN) >> .make-settings; \ - echo OPT=$(OPT) >> .make-settings; \ - echo MALLOC=$(MALLOC) >> .make-settings; \ - echo BUILD_TLS=$(BUILD_TLS) >> .make-settings; \ - echo USE_SYSTEMD=$(USE_SYSTEMD) >> .make-settings; \ - echo CFLAGS=$(CFLAGS) >> .make-settings; \ - echo LDFLAGS=$(LDFLAGS) >> .make-settings; \ - echo REDIS_CFLAGS=$(REDIS_CFLAGS) >> .make-settings; \ - echo REDIS_LDFLAGS=$(REDIS_LDFLAGS) >> .make-settings; \ - echo PREV_FINAL_CFLAGS=$(FINAL_CFLAGS) >> .make-settings; \ - echo PREV_FINAL_LDFLAGS=$(FINAL_LDFLAGS) >> .make-settings; \ - (cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS) > /dev/null 2>&1); \ - else \ - touch $@; \ - fi - -# Clean everything, persist settings and build compile dependencies if anything changed -# Note: These conditional dependencies have been removed to prevent circular dependency issues -# They were originally designed to trigger rebuilds when CFLAGS/LDFLAGS changed - -# Build link dependencies separately -.make-link-prerequisites: .make-compile-prerequisites +# Prerequisites target +.make-prerequisites: @touch $@ -# Build rocksdb independently to support caching +# Clean everything, persist settings and build dependencies if anything changed +ifneq ($(strip $(PREV_FINAL_CFLAGS)), $(strip $(FINAL_CFLAGS))) +.make-prerequisites: persist-settings +endif + +ifneq ($(strip $(PREV_FINAL_LDFLAGS)), $(strip $(FINAL_LDFLAGS))) +.make-prerequisites: persist-settings +endif + ../deps/rocksdb/librocksdb.a: cd ../deps && $(MAKE) rocksdb @@ -495,7 +477,7 @@ SWAP_LIBS= ../deps/rocksdb/librocksdb.a ../deps/tdigest/tdigest.o endif # redis-server -$(REDIS_SERVER_NAME): $(REDIS_SERVER_OBJ) $(REDIS_VEC_SETS_OBJ) .make-link-prerequisites +$(REDIS_SERVER_NAME): $(REDIS_SERVER_OBJ) $(REDIS_VEC_SETS_OBJ) .make-prerequisites $(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/lua/src/liblua.a ../deps/hdr_histogram/libhdrhistogram.a ../deps/fpconv/libfpconv.a ../deps/fast_float/libfast_float.a ../deps/xredis-gtid/lib/libgtid.a $(SWAP_LIBS) $(FINAL_LIBS) # redis-sentinel @@ -515,12 +497,22 @@ $(TLS_MODULE_NAME): $(REDIS_SERVER_NAME) $(QUIET_CC)$(CC) -o $@ tls.c -shared -fPIC $(TLS_MODULE_CFLAGS) $(TLS_CLIENT_LIBS) # redis-cli +ifdef SWAP +$(REDIS_CLI_NAME): $(REDIS_CLI_OBJ) ../deps/rocksdb/librocksdb.a + $(REDIS_LD) -o $@ $(REDIS_CLI_OBJ) ../deps/hiredis/libhiredis.a ../deps/linenoise/linenoise.o ../deps/hdr_histogram/libhdrhistogram.a $(FINAL_LIBS) $(TLS_CLIENT_LIBS) +else $(REDIS_CLI_NAME): $(REDIS_CLI_OBJ) $(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/linenoise/linenoise.o ../deps/hdr_histogram/libhdrhistogram.a $(FINAL_LIBS) $(TLS_CLIENT_LIBS) +endif # redis-benchmark +ifdef SWAP +$(REDIS_BENCHMARK_NAME): $(REDIS_BENCHMARK_OBJ) ../deps/rocksdb/librocksdb.a + $(REDIS_LD) -o $@ $(REDIS_BENCHMARK_OBJ) ../deps/hiredis/libhiredis.a ../deps/hdr_histogram/libhdrhistogram.a $(FINAL_LIBS) $(TLS_CLIENT_LIBS) +else $(REDIS_BENCHMARK_NAME): $(REDIS_BENCHMARK_OBJ) $(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/hdr_histogram/libhdrhistogram.a $(FINAL_LIBS) $(TLS_CLIENT_LIBS) +endif DEP = $(REDIS_SERVER_OBJ:%.o=%.d) $(REDIS_VEC_SETS_OBJ:%.o=%.d) $(REDIS_CLI_OBJ:%.o=%.d) $(REDIS_BENCHMARK_OBJ:%.o=%.d) -include $(DEP) @@ -528,11 +520,11 @@ DEP = $(REDIS_SERVER_OBJ:%.o=%.d) $(REDIS_VEC_SETS_OBJ:%.o=%.d) $(REDIS_CLI_OBJ: # Because the jemalloc.h header is generated as a part of the jemalloc build, # building it should complete before building any other object. Instead of # depending on a single artifact, build all compile dependencies first. -%.o: %.c .make-compile-prerequisites +%.o: %.c .make-prerequisites $(REDIS_CC) -MMD -o $@ -c $< # commands.o specifically depends on the generated command definition file -commands.o: commands.c $(COMMANDS_DEF_FILENAME).def .make-compile-prerequisites +commands.o: commands.c $(COMMANDS_DEF_FILENAME).def .make-prerequisites $(REDIS_CC) -MMD -o $@ -c $< # The following files are checked in and don't normally need to be rebuilt. They diff --git a/src/commands_swap/spublish.json.merge b/src/commands_swap/spublish.json.merge new file mode 100644 index 00000000000..42509afb833 --- /dev/null +++ b/src/commands_swap/spublish.json.merge @@ -0,0 +1,6 @@ +{ + "SPUBLISH": { + "swap_command_flags": [], + "intention": "SWAP_NOP" + } +} diff --git a/src/networking.c b/src/networking.c index 4240d9c96ee..907687bf063 100644 --- a/src/networking.c +++ b/src/networking.c @@ -5015,7 +5015,9 @@ void evictClients(void) { size_t client_eviction_limit = getClientEvictionLimit(); if (client_eviction_limit == 0) return; - while (server.stat_clients_type_memory[CLIENT_TYPE_TRACKING] >= client_eviction_limit) { + while (server.stat_clients_type_memory[CLIENT_TYPE_TRACKING] + + server.stat_clients_type_memory[CLIENT_TYPE_PUBSUB] + + server.stat_clients_type_memory[CLIENT_TYPE_NORMAL] >= client_eviction_limit) { listNode *ln = listNext(&bucket_iter); if (ln) { client *c = ln->value; diff --git a/src/server.c b/src/server.c index 09285960b07..58795faf3eb 100644 --- a/src/server.c +++ b/src/server.c @@ -1023,7 +1023,7 @@ int clientEvictionAllowed(client *c) { return 0; } int type = getClientType(c); - return (type == CLIENT_TYPE_TRACKING); + return (type == CLIENT_TYPE_TRACKING || type == CLIENT_TYPE_NORMAL || type == CLIENT_TYPE_PUBSUB); } diff --git a/tests/integration/client_rate_limit_bug_hash_hget.tcl b/tests/integration/client_rate_limit_bug_hash_hget.tcl deleted file mode 100644 index 12024533c1d..00000000000 --- a/tests/integration/client_rate_limit_bug_hash_hget.tcl +++ /dev/null @@ -1,30 +0,0 @@ -source tests/support/redis.tcl -source tests/support/util.tcl -set ::tlsdir "tests/tls" -proc format_command {args} { - set cmd "*[llength $args]\r\n" - foreach a $args { - append cmd "$[string length $a]\r\n$a\r\n" - } - set _ $cmd -} - -proc gen_write_hset_load {host port seconds tls db start end} { - set start_time [clock seconds] - set i $start - while {$i < $end} { - set r [redis $host $port 0 $tls] - if {$db != 0} { - $r select $db - } - for {set j 0} {$j < 10} {incr j} { - $r write [format_command hget $i $j] - } - $r flush - catch {close [$r channel]} - incr i - } - -} - -gen_write_hset_load [lindex $argv 0] [lindex $argv 1] [lindex $argv 2] [lindex $argv 3] [lindex $argv 4] [lindex $argv 5] [lindex $argv 6] diff --git a/tests/integration/client_rate_limit_bug_hash_hset.tcl b/tests/integration/client_rate_limit_bug_hash_hset.tcl deleted file mode 100644 index dfbb76088f2..00000000000 --- a/tests/integration/client_rate_limit_bug_hash_hset.tcl +++ /dev/null @@ -1,32 +0,0 @@ -source tests/support/redis.tcl -source tests/support/util.tcl -set ::tlsdir "tests/tls" -proc format_command {args} { - set cmd "*[llength $args]\r\n" - foreach a $args { - append cmd "$[string length $a]\r\n$a\r\n" - } - set _ $cmd -} - -proc gen_write_hset_load {host port seconds tls db start end} { - set start_time [clock seconds] - set r [redis $host $port 1 $tls] - $r client setname LOAD_HANDLER - $r select $db - set i $start - set val [randstring 100000 100000 binary] - while {$i < $end} { - for {set j 0} {$j < 10} {incr j} { - $r write [format_command hset $i $j $val ] - } - $r flush - for {set j 0} {$j < 10} {incr j} { - $r read - } - incr i - } - -} - -gen_write_hset_load [lindex $argv 0] [lindex $argv 1] [lindex $argv 2] [lindex $argv 3] [lindex $argv 4] [lindex $argv 5] [lindex $argv 6] diff --git a/tests/integration/replication.tcl b/tests/integration/replication.tcl index 38442f2a011..cd80e796fcb 100644 --- a/tests/integration/replication.tcl +++ b/tests/integration/replication.tcl @@ -101,12 +101,14 @@ start_server {tags {"repl external:skip"}} { } } + tags {memonly} { test {INCRBYFLOAT replication, should not remove expire} { r set test 1 EX 100 r incrbyfloat test 0.1 wait_for_ofs_sync $A $B assert_equal [$A debug digest] [$B debug digest] } + } test {GETSET replication} { $A config resetstat @@ -143,6 +145,7 @@ start_server {tags {"repl external:skip"}} { $rd close } + tags {memonly} { test {BRPOPLPUSH replication, list exists} { $A config resetstat r lpush c 1 @@ -185,6 +188,7 @@ start_server {tags {"repl external:skip"}} { } } } + } test {BLPOP followed by role change, issue #2473} { set rd [redis_deferring_client] @@ -326,6 +330,7 @@ start_server {tags {"repl external:skip"}} { } } +tags {memonly} { foreach mdl {no yes} rdbchannel {no yes} { foreach sdl {disabled swapdb} { start_server {tags {"repl external:skip"} overrides {save {}}} { @@ -422,8 +427,9 @@ foreach mdl {no yes} rdbchannel {no yes} { } } } +} -start_server {tags {"repl external:skip"} overrides {save {}}} { +start_server {tags {"repl external:skip" "memonly"} overrides {save {}}} { set master [srv 0 client] set master_host [srv 0 host] set master_port [srv 0 port] @@ -468,7 +474,7 @@ start_server {tags {"repl external:skip"} overrides {save {}}} { # Diskless load swapdb when NOT async_loading (different master replid) foreach testType {Successful Aborted} rdbchannel {yes no} { - start_server {tags {"repl external:skip"}} { + start_server {tags {"repl external:skip" "memonly"}} { set replica [srv 0 client] set replica_host [srv 0 host] set replica_port [srv 0 port] @@ -737,7 +743,7 @@ foreach testType {Successful Aborted} { } test {diskless loading short read} { - start_server {tags {"repl"} overrides {save ""}} { + start_server {tags {"repl" "memonly"} overrides {save ""}} { set replica [srv 0 client] set replica_host [srv 0 host] set replica_port [srv 0 port] @@ -910,7 +916,7 @@ start_server {tags {"repl external:skip tsan:skip"} overrides {save ""}} { set replicas {} set replicas_alive {} # start one replica that will read the rdb fast, and one that will be slow - start_server {overrides {save ""}} { + start_server {tags {memonly} overrides {save ""}} { lappend replicas [srv 0 client] lappend replicas_alive [srv 0 client] start_server {overrides {save ""}} { @@ -1042,7 +1048,7 @@ test "diskless replication child being killed is collected" { # when diskless master is waiting for the replica to become writable # it removes the read event from the rdb pipe so if the child gets killed # the replica will hung. and the master may not collect the pid with waitpid - start_server {tags {"repl"} overrides {save ""}} { + start_server {tags {"repl" "memonly"} overrides {save ""}} { set master [srv 0 client] set master_host [srv 0 host] set master_port [srv 0 port] @@ -1140,7 +1146,7 @@ test "diskless replication read pipe cleanup" { $master config set rdb-key-save-delay 100000 $master debug populate 20000 test 10000 $master config set rdbcompression no - start_server {overrides {save ""}} { + start_server {tags {memonly} overrides {save ""}} { set replica [srv 0 client] set loglines [count_log_lines 0] $replica config set repl-diskless-load swapdb diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index 5824eaba2cb..8c09006560e 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -24,6 +24,10 @@ set dir [pwd] set ::all_tests [] set test_dirs { + unit + unit/type + unit/cluster + integration } @@ -48,14 +52,17 @@ proc load_tests {dir test_dirs} { } set ::gtid_test_dirs { - + gtid } set ::gtid_tests [load_tests $dir $::gtid_test_dirs] set ::disk_test_dirs { - tmptest + swap/unit + swap/ported/unit + swap/ported/unit/type + swap/ported/integration } set ::disk_tests [load_tests $dir $::disk_test_dirs] @@ -757,7 +764,7 @@ if {[is_swap_enabled]} { set ::singledb 1 set ::target_db 0 lappend ::denytags {memonly} - set ::all_tests [concat $::disk_tests $::all_tests] + set ::all_tests [concat $::disk_tests $::gtid_tests] source tests/swap/support/util.tcl } set filtered_tests {} diff --git a/tests/tmptest/sing.tcl b/tests/tmptest/sing.tcl deleted file mode 100644 index d7667a07292..00000000000 --- a/tests/tmptest/sing.tcl +++ /dev/null @@ -1,99 +0,0 @@ -start_server {tags {"client tracking heartbeat"}} { - set rd1 [redis_client] - set rd2 [redis_client] - set r [redis_client] - - $rd1 HELLO 3 - $rd2 HELLO 3 - $r HELLO 3 - - test {heartbeat info is correct} { - - $rd1 CLIENT tracking on bcast PREFIX prefix1 PREFIX prefix2 heartbeat systime 1 - $rd2 CLIENT tracking on bcast PREFIX prefix1 PREFIX prefix2 heartbeat mkps 1 - - set info [r info] - regexp "\r\nheartbeat_clients:(.*?)\r\n" $info _ heartbeat_clients - assert {$heartbeat_clients == 2} - - $rd1 CLIENT tracking off - $rd2 CLIENT tracking on bcast PREFIX prefix3 PREFIX prefix4 - set info [r info] - regexp "\r\nheartbeat_clients:(.*?)\r\n" $info _ heartbeat_clients - assert {$heartbeat_clients == 0} - } - - test {Client heartbeat without wrong options} { - - $r HELLO 3 - catch {$r CLIENT tracking on bcast PREFIX prefix1 PREFIX prefix2 heartbeat mkps} output - assert_match "ERR* syntax error" $output - - catch {$r CLIENT tracking on bcast PREFIX prefix1 PREFIX prefix2 heartbeat} output - assert_match "ERR* syntax error" $output - - catch {$r CLIENT tracking on bcast PREFIX prefix1 PREFIX prefix2 heartbeat mkps 1 systime} output - assert_match "ERR* syntax error" $output - - catch {$r CLIENT tracking on bcast PREFIX prefix1 PREFIX prefix2 heartbeat mkps 1 mkps 2} output - assert_match "ERR* Duplicate mkps option in heartbeat" $output - - catch {$r CLIENT tracking on bcast PREFIX prefix1 PREFIX prefix2 heartbeat mkps 1 systime 2 systime 3} output - assert_match "ERR* Duplicate systime option in heartbeat" $output - - catch {$r CLIENT tracking on bcast PREFIX prefix1 PREFIX prefix2 heartbeat mkps 1 sys 2 systime 3} output - assert_match "ERR* syntax error" $output - } - - test {Client heartbeat works with systime} { - - $r HELLO 3 - $r CLIENT tracking on bcast PREFIX prefix1 PREFIX prefix2 heartbeat systime 1 - after 1500 - assert_match "systime 17*" [$r read] - } - - test {Client heartbeat works with mkps} { - - $r CLIENT tracking off - $r HELLO 3 - $r CLIENT tracking on bcast PREFIX prefix1 PREFIX prefix2 heartbeat mkps 1 - - after 1500 - assert_match "mkps *" [$r read] - } - - - test {Client heartbeat works with two actions} { - - $r CLIENT tracking off - $r HELLO 3 - $r CLIENT tracking on bcast PREFIX prefix1 PREFIX prefix2 heartbeat mkps 1 systime 10 - - after 1500 - assert_match "mkps *" [$r read] - } - - test {Client can switch mkps and systime mode without disable heartbeat} { - - $r CLIENT tracking off - $r HELLO 3 - $r CLIENT tracking on bcast PREFIX prefix1 PREFIX prefix2 heartbeat mkps 1 systime 10 - - catch {$r CLIENT tracking on bcast heartbeat mkps 1} output - assert_match "OK" $output - - catch {$r CLIENT tracking on bcast heartbeat systime 3} output - assert_match "OK" $output - - catch {$r CLIENT tracking ON bcast heartbeat systime 1 mkps 3} output - assert_match "OK" $output - - after 1500 - assert_match "systime 17*" [$r read] - } - - $rd1 close - $rd2 close - $r close -} diff --git a/tests/unit/expire.tcl b/tests/unit/expire.tcl index 69fa0d11151..d20221e39e6 100644 --- a/tests/unit/expire.tcl +++ b/tests/unit/expire.tcl @@ -241,7 +241,7 @@ start_server {tags {"expire"}} { r set foo bar catch {r expire foo ""} e set e - } {*not an integer*} + } {*not an integer*} {memonly} test {SET with EX with big integer should report an error} { catch {r set foo bar EX 10000000000000000} e diff --git a/tests/unit/introspection-2.tcl b/tests/unit/introspection-2.tcl index a2156fa3bd6..bf32a533d17 100644 --- a/tests/unit/introspection-2.tcl +++ b/tests/unit/introspection-2.tcl @@ -136,7 +136,7 @@ start_server {tags {"introspection"}} { assert_match {*calls=2,*} [cmdstat set] assert_match {*calls=1,*} [cmdstat expire] assert_match {*calls=1,*} [cmdstat geoadd] - } {} {needs:config-resetstat} + } {} {needs:config-resetstat memonly} test {COMMAND COUNT get total number of Redis commands} { assert_morethan [r command count] 0 diff --git a/tests/unit/introspection.tcl b/tests/unit/introspection.tcl index f7d8a3bf021..1a9fb4cfba4 100644 --- a/tests/unit/introspection.tcl +++ b/tests/unit/introspection.tcl @@ -417,7 +417,7 @@ start_server {tags {"introspection"}} { $rd close } - + test {MONITOR log blocked command only once} { # need to reconnect in order to reset the clients state @@ -603,6 +603,50 @@ start_server {tags {"introspection"}} { req-res-logfile client-default-resp vset-force-single-threaded-execution + swap-mode + jemalloc-max-bg-threads + swap-threads + gtid-enabled + rocksdb.cache_index_and_filter_blocks + rocksdb.data.cache_index_and_filter_blocks + rocksdb.meta.cache_index_and_filter_blocks + rocksdb.enable_pipelined_write + rocksdb.compaction_dynamic_level_bytes + rocksdb.data.compaction_dynamic_level_bytes + rocksdb.meta.compaction_dynamic_level_bytes + rocksdb.max_open_files + rocksdb.max_background_compactions + rocksdb.max_background_flushes + rocksdb.max_subcompactions + rocksdb.block_size + rocksdb.data.block_size + rocksdb.meta.block_size + rocksdb.suggest_compact_deletion_percentage + rocksdb.data.suggest_compact_deletion_percentage + rocksdb.meta.suggest_compact_deletion_percentage + rocksdb.block_cache_size + rocksdb.data.block_cache_size + rocksdb.meta.block_cache_size + rocksdb.ratelimiter.rate_per_sec + rocksdb.bytes_per_sync + rocksdb.max_background_jobs + rocksdb.max_subcompactions + rocksdb.WAL_ttl_seconds + rocksdb.WAL_size_limit_MB + rocksdb.max_total_wal_size + rocksdb.suggest_compact_sliding_window_size + rocksdb.data.suggest_compact_sliding_window_size + rocksdb.meta.suggest_compact_sliding_window_size + rocksdb.suggest_compact_num_dels_trigger + rocksdb.data.suggest_compact_num_dels_trigger + rocksdb.meta.suggest_compact_num_dels_trigger + rocksdb.read_enable_async_io + swap-threads-auto-scale-max + swap-scan-session-bits + swap-cuckoo-filter-bit-per-key + swap-cuckoo-filter-estimated-keys + ctrip-monitor-port + swap-persist-enabled } if {!$::tls} { diff --git a/tests/unit/io_thread.tcl b/tests/unit/io_thread.tcl index 827940f24e1..64c993d78e5 100644 --- a/tests/unit/io_thread.tcl +++ b/tests/unit/io_thread.tcl @@ -22,7 +22,7 @@ proc get_kv_value {input key} { } start_server {overrides {}} { - r set k v + r set k v test "threads 1 => n and n => 1" { diff --git a/tests/unit/keyspace.tcl b/tests/unit/keyspace.tcl index d7c14e42904..079a6c6a284 100644 --- a/tests/unit/keyspace.tcl +++ b/tests/unit/keyspace.tcl @@ -24,15 +24,15 @@ start_server {tags {"keyspace"}} { r set $key hello } lsort [r keys foo*] - } {foo_a foo_b foo_c} + } {foo_a foo_b foo_c} {memonly} test {KEYS to get all keys} { lsort [r keys *] - } {foo_a foo_b foo_c key_x key_y key_z} + } {foo_a foo_b foo_c key_x key_y key_z} {memonly} test {DBSIZE} { r dbsize - } {6} + } {6} {memonly} test {KEYS with hashtag} { foreach key {"{a}x" "{a}y" "{a}z" "{b}a" "{b}b" "{b}c"} { @@ -45,7 +45,7 @@ start_server {tags {"keyspace"}} { test {DEL all keys} { foreach key [r keys *] {r del $key} r dbsize - } {0} + } {0} {memonly} test "DEL against expired key" { r debug set-active-expire 0 @@ -171,7 +171,7 @@ start_server {tags {"keyspace"}} { r del $key } r dbsize - } {0} + } {0} {memonly} test {DEL all keys again (DB 1)} { r select 10 @@ -181,8 +181,9 @@ start_server {tags {"keyspace"}} { set res [r dbsize] r select 9 format $res - } {0} {singledb:skip} + } {0} {singledb:skip memonly} + tags {memonly} { test {COPY basic usage for string} { r set mykey{t} foobar set res {} @@ -199,19 +200,20 @@ start_server {tags {"keyspace"}} { r select 9 assert_equal [list foobar 2 foobar 1] [format $res] } - } + } + } test {COPY for string does not replace an existing key without REPLACE option} { r set mykey2{t} hello catch {r copy mykey2{t} mynewkey{t} DB 10} e set e - } {0} {singledb:skip} + } {0} {singledb:skip memonly} test {COPY for string can replace an existing key with REPLACE option} { r copy mykey2{t} mynewkey{t} DB 10 REPLACE r select 10 r get mynewkey{t} - } {hello} {singledb:skip} + } {hello} {singledb:skip memonly} test {COPY for string ensures that copied data is independent of copying data} { r flushdb @@ -229,13 +231,13 @@ start_server {tags {"keyspace"}} { r flushdb r select 9 format $res - } [list foobar hoge foobar] {singledb:skip} + } [list foobar hoge foobar] {singledb:skip memonly} test {COPY for string does not copy data to no-integer DB} { r set mykey{t} foobar catch {r copy mykey{t} mynewkey{t} DB notanumber} e set e - } {ERR value is not an integer or out of range} + } {ERR value is not an integer or out of range} {memonly} test {COPY can copy key expire metadata as well} { r set mykey{t} foobar ex 100 @@ -307,6 +309,7 @@ foreach {type large} [array get largevalue] { assert_equal $digest [debug_digest_value newzset1{t}] } + tags {memonly} { test {COPY basic usage for skiplist sorted set} { r del zset2{t} newzset2{t} set original_max [lindex [r config get zset-max-ziplist-entries] 1] @@ -324,6 +327,7 @@ foreach {type large} [array get largevalue] { assert_equal $digest [debug_digest_value newzset2{t}] r config set zset-max-ziplist-entries $original_max } + } test {COPY basic usage for listpack hash} { r config set hash-max-listpack-entries 512 @@ -357,6 +361,7 @@ foreach {type large} [array get largevalue] { r config set hash-max-ziplist-entries $original_max } + tags {memonly} { test {COPY basic usage for stream} { r del mystream{t} mynewstream{t} for {set i 0} {$i < 1000} {incr i} { @@ -370,7 +375,9 @@ foreach {type large} [array get largevalue] { r del mystream{t} assert_equal $digest [debug_digest_value mynewstream{t}] } + } + tags {memonly} { test {COPY basic usage for stream-cgroups} { r del x{t} r XADD x{t} 100 a 1 @@ -398,6 +405,7 @@ foreach {type large} [array get largevalue] { assert_equal $info [r xinfo stream newx{t} full] r flushdb } + } test {MOVE basic usage} { r set mykey foobar @@ -410,18 +418,18 @@ foreach {type large} [array get largevalue] { lappend res [r dbsize] r select 9 format $res - } [list 0 0 foobar 1] {singledb:skip} + } [list 0 0 foobar 1] {singledb:skip memonly} test {MOVE against key existing in the target DB} { r set mykey hello r move mykey 10 - } {0} {singledb:skip} + } {0} {singledb:skip memonly} test {MOVE against non-integer DB (#1428)} { r set mykey hello catch {r move mykey notanumber} e set e - } {ERR value is not an integer or out of range} {singledb:skip} + } {ERR value is not an integer or out of range} {singledb:skip memonly} test {MOVE can move key expire metadata as well} { r select 10 @@ -434,7 +442,7 @@ foreach {type large} [array get largevalue] { assert {[r ttl mykey] > 0 && [r ttl mykey] <= 100} assert {[r get mykey] eq "foo"} r select 9 - } {OK} {singledb:skip} + } {OK} {singledb:skip memonly} test {MOVE does not create an expire if it does not exist} { r select 10 @@ -447,7 +455,7 @@ foreach {type large} [array get largevalue] { assert {[r ttl mykey] == -1} assert {[r get mykey] eq "foo"} r select 9 - } {OK} {singledb:skip} + } {OK} {singledb:skip memonly} test {SET/GET keys in different DBs} { r set a hello @@ -464,7 +472,7 @@ foreach {type large} [array get largevalue] { lappend res [r get b] r select 9 format $res - } {hello world foo bared} {singledb:skip} + } {hello world foo bared} {singledb:skip memonly} test {RANDOMKEY} { r flushdb @@ -501,7 +509,7 @@ foreach {type large} [array get largevalue] { r set dlskeriewrioeuwqoirueioqwrueoqwrueqw test r keys * r keys * - } {dlskeriewrioeuwqoirueioqwrueoqwrueqw} + } {dlskeriewrioeuwqoirueioqwrueoqwrueqw} {memonly} test {Regression for pattern matching long nested loops} { r flushdb diff --git a/tests/unit/maxmemory.tcl b/tests/unit/maxmemory.tcl index 23a9daab89c..5ebd3b7584e 100644 --- a/tests/unit/maxmemory.tcl +++ b/tests/unit/maxmemory.tcl @@ -1,4 +1,4 @@ -start_server {tags {"maxmemory" "external:skip"}} { +start_server {tags {"maxmemory" "external:skip" "memonly"}} { r config set maxmemory 11mb r config set maxmemory-policy allkeys-lru set server_pid [s process_id] @@ -147,7 +147,7 @@ start_server {tags {"maxmemory" "external:skip"}} { } -start_server {tags {"maxmemory external:skip"}} { +start_server {tags {"maxmemory external:skip" "memonly"}} { foreach policy { allkeys-random allkeys-lru allkeys-lfu volatile-lru volatile-lfu volatile-random volatile-ttl @@ -283,8 +283,8 @@ proc slave_query_buffer {srv} { proc test_slave_buffers {test_name cmd_count payload_len limit_memory pipeline} { start_server {tags {"maxmemory external:skip"}} { - start_server {} { - set slave_pid [s process_id] + start_server {tags {memonly} } { + set slave_pid [s process_id] test "$test_name" { set slave [srv 0 client] set slave_host [srv 0 host] @@ -395,7 +395,7 @@ test_slave_buffers {slave buffer are counted correctly} 1000000 10 0 1 # test again with fewer (and bigger) commands without pipeline, but with eviction test_slave_buffers "replica buffer don't induce eviction" 100000 100 1 0 -start_server {tags {"maxmemory external:skip"}} { +start_server {tags {"maxmemory external:skip" "memonly"}} { test {Don't rehash if used memory exceeds maxmemory after rehash} { r config set latency-tracking no r config set maxmemory 0 diff --git a/tests/unit/multi.tcl b/tests/unit/multi.tcl index 4e8e8072561..c761a05880f 100644 --- a/tests/unit/multi.tcl +++ b/tests/unit/multi.tcl @@ -245,7 +245,7 @@ start_server {tags {"multi"}} { r multi r ping r exec - } {PONG} + } {PONG} {memonly} test {FLUSHDB is able to touch the watched keys} { r set x 30 @@ -254,7 +254,7 @@ start_server {tags {"multi"}} { r multi r ping r exec - } {} + } {} {memonly} test {FLUSHDB does not touch non affected keys} { r del x @@ -263,7 +263,7 @@ start_server {tags {"multi"}} { r multi r ping r exec - } {PONG} + } {PONG} {memonly} test {SWAPDB is able to touch the watched keys that exist} { r flushall @@ -274,7 +274,7 @@ start_server {tags {"multi"}} { r multi r ping r exec - } {} {singledb:skip} + } {} {singledb:skip memonly} test {SWAPDB is able to touch the watched keys that do not exist} { r flushall @@ -286,7 +286,7 @@ start_server {tags {"multi"}} { r multi r ping r exec - } {} {singledb:skip} + } {} {singledb:skip memonly} test {SWAPDB does not touch watched stale keys} { r flushall @@ -347,7 +347,7 @@ start_server {tags {"multi"}} { # Restore original DB r select 9 set res - } {PONG} {singledb:skip} + } {PONG} {singledb:skip memonly} test {WATCH will consider touched keys target of EXPIRE} { r del x @@ -922,4 +922,4 @@ start_server {overrides {appendonly {yes} appendfilename {appendonly.aof} append } r get foo } {} -} +} \ No newline at end of file diff --git a/tests/unit/obuf-limits.tcl b/tests/unit/obuf-limits.tcl index 507affee635..2484c7d837a 100644 --- a/tests/unit/obuf-limits.tcl +++ b/tests/unit/obuf-limits.tcl @@ -21,7 +21,7 @@ start_server {tags {"obuf-limits external:skip logreqres:skip"}} { r config set client-output-buffer-limit "normal 1mb 2mb 60 replica 3mb 4mb 70 pubsub 5mb 6mb 80" set res [lindex [r config get client-output-buffer-limit] 1] - assert_equal $res "normal 1048576 2097152 60 slave 3145728 4194304 70 pubsub 5242880 6291456 80" + assert_equal $res "normal 1048576 2097152 60 slave 3145728 4194304 70 pubsub 5242880 6291456 80 tracking 33554432 8388608 60" # Set back to the original value. r config set client-output-buffer-limit $oldval @@ -267,4 +267,36 @@ start_server {tags {"obuf-limits external:skip logreqres:skip"}} { set fd [$rd channel] assert_equal {} [read $fd] } + + test {No response for tracking client if output buffer hard limit is enforced} { + r config set client-output-buffer-limit {tracking 100000 0 0} + # Total size of all items must be more than 100k + set item [string repeat "x" 1000] + for {set i 0} {$i < 150} {incr i} { + r lpush mylist $item + } + set orig_mem [s used_memory] + # Set client name and get all items + set rd [redis_deferring_client] + $rd client setname mybiglist + assert {[$rd read] eq "OK"} + + $rd client tracking on + after 100 + assert {[$rd read] eq "OK"} + + $rd lrange mylist 0 -1 + after 100 + + # Before we read reply, redis will close this client. + set clients [r client list] + assert_no_match "*name=mybiglist*" $clients + set cur_mem [s used_memory] + # 10k just is a deviation threshold + assert {$cur_mem < 10000 + $orig_mem} + + # Read nothing + set fd [$rd channel] + assert_equal {} [read $fd] + } } diff --git a/tests/unit/other.tcl b/tests/unit/other.tcl index 2faa7e9afba..e066567ac81 100644 --- a/tests/unit/other.tcl +++ b/tests/unit/other.tcl @@ -62,7 +62,7 @@ start_server {tags {"other"}} { } } - start_server {overrides {save ""} tags {external:skip}} { + start_server {overrides {save ""} tags {external:skip memonly}} { test {FLUSHALL should not reset the dirty counter if we disable save} { r set key value r flushall @@ -108,7 +108,7 @@ start_server {tags {"other"}} { set _ $err } {*index is out of range*} {cluster:skip} - tags {consistency} { + tags {consistency memonly} { proc check_consistency {dumpname code} { set dump [csvdump r] set sha1 [debug_digest] @@ -147,7 +147,7 @@ start_server {tags {"other"}} { r debug reload } } - } {1} {needs:debug} + } {1} {needs:debug memonly} test {Same dataset digest if saving/reloading as AOF?} { if {$::ignoredigest} { @@ -160,7 +160,7 @@ start_server {tags {"other"}} { r debug loadaof } } - } {1} {needs:debug} + } {1} {needs:debug memonly} } test {EXPIRES after a reload (snapshot + append only file rewrite)} { @@ -177,7 +177,7 @@ start_server {tags {"other"}} { set ttl [r ttl x] set e2 [expr {$ttl > 900 && $ttl <= 1000}] list $e1 $e2 - } {1 1} {needs:debug needs:save} + } {1 1} {needs:debug needs:save memonly} test {EXPIRES after AOF reload (without rewrite)} { r flushdb @@ -217,7 +217,7 @@ start_server {tags {"other"}} { set ttl [r ttl pz] assert {$ttl > 2900 && $ttl <= 3000} r config set appendonly no - } {OK} {needs:debug} + } {OK} {needs:debug memonly} tags {protocol} { test {PIPELINING stresser (also a regression for the old epoll bug)} { diff --git a/tests/unit/scripting.tcl b/tests/unit/scripting.tcl index 921cc2adada..ade3f1bfbca 100644 --- a/tests/unit/scripting.tcl +++ b/tests/unit/scripting.tcl @@ -56,7 +56,7 @@ if {$is_eval == 1} { } } -start_server {tags {"scripting"}} { +start_server {tags {"scripting" "memonly"}} { if {$is_eval eq 1} { test {Script - disallow write on OOM} { @@ -835,7 +835,7 @@ start_server {tags {"scripting"}} { # this test needs a fresh server so that lua_argv_size is 0. # glibc realloc can return the same pointer even when the size changes # still this test isn't able to trigger the issue, but we keep it anyway. - start_server {tags {"scripting"}} { + start_server {tags {"scripting" "memonly"}} { set repl [attach_to_replication_stream] # a command with 5 argsument r eval {redis.call('hmget', KEYS[1], 1, 2, 3)} 1 key @@ -1129,7 +1129,7 @@ start_server {tags {"scripting"}} { # Start a new server since the last test in this stanza will kill the # instance at all. -start_server {tags {"scripting"}} { +start_server {tags {"scripting" "memonly"}} { test {Timedout read-only scripts can be killed by SCRIPT KILL} { set rd [redis_deferring_client] r config set lua-time-limit 10 @@ -1299,7 +1299,7 @@ start_server {tags {"scripting"}} { } start_server {tags {"scripting repl needs:debug external:skip"}} { - start_server {} { + start_server {tags {memonly} } { test "Before the replica connects we issue two EVAL commands" { # One with an error, but still executing a command. # SHA is: 67164fc43fa971f76fd1aaeeaf60c1c178d25876 @@ -1391,7 +1391,7 @@ start_server {tags {"scripting"}} { } else { fail "Master-Replica desync after Lua script using SELECT." } - } {} {singledb:skip} + } {} {singledb:skip memonly} } } @@ -1507,7 +1507,7 @@ start_server {tags {"scripting repl external:skip"}} { } if {$is_eval eq 1} { -start_server {tags {"scripting external:skip"}} { +start_server {tags {"scripting external:skip" "memonly"}} { r script debug sync r eval {return 'hello'} 0 r eval {return 'hello'} 0 diff --git a/tests/unit/sort.tcl b/tests/unit/sort.tcl index 35ec1606e1e..319590f4444 100644 --- a/tests/unit/sort.tcl +++ b/tests/unit/sort.tcl @@ -1,5 +1,5 @@ start_server { - tags {"sort"} + tags {"sort" "memonly"} overrides { "list-max-ziplist-size" 16 "set-max-intset-entries" 32 diff --git a/tests/unit/type/stream-cgroups.tcl b/tests/unit/type/stream-cgroups.tcl index 2fbe794bfa9..5399aa8976a 100644 --- a/tests/unit/type/stream-cgroups.tcl +++ b/tests/unit/type/stream-cgroups.tcl @@ -1437,7 +1437,7 @@ start_server { } } - start_server {tags {"external:skip"}} { + start_server {tags {"external:skip" "memonly"}} { set master [srv -1 client] set master_host [srv -1 host] set master_port [srv -1 port]