From 11ddd8b289215b11e7afd797cb9ba83195d9f376 Mon Sep 17 00:00:00 2001 From: Parth <661497+parthpatel@users.noreply.github.com> Date: Tue, 26 Mar 2024 19:55:37 -0700 Subject: [PATCH 01/49] Changing Redis references in files documenting development guidelines (#26) (#45) Changing some references from Redis to placeholderkv. Signed-off-by: Parth Patel <661497+parthpatel@users.noreply.github.com> --- BUGS | 2 +- CONTRIBUTING.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BUGS b/BUGS index 7af2593407..0c9a1d8e6a 100644 --- a/BUGS +++ b/BUGS @@ -1 +1 @@ -Please check https://github.com/redis/redis/issues +Please check https://github.com/placeholderkv/placeholderkv/issues diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 42322af7dc..2bfbec92ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,9 +19,9 @@ There is also an active community of Redis users at Stack Overflow: https://stackoverflow.com/questions/tagged/redis -Issues and pull requests for documentation belong on the redis-doc repo: +Issues and pull requests for documentation belong on the placeholderkv-doc repo: - https://github.com/redis/redis-doc + https://github.com/placeholderkv/placeholderkv-doc If you are reporting a security bug or vulnerability, see SECURITY.md. @@ -37,7 +37,7 @@ Here you can see if there is consensus about your idea. 2. If in step 1 you get an acknowledgment from the project leaders, use the following procedure to submit a patch: - a. Fork Redis on GitHub ( https://docs.github.com/en/github/getting-started-with-github/fork-a-repo ) + a. Fork placeholderkv on GitHub ( https://docs.github.com/en/github/getting-started-with-github/fork-a-repo ) b. Create a topic branch (git checkout -b my_branch) c. Push to your branch (git push origin my_branch) d. Initiate a pull request on GitHub ( https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request ) From c7df0f06e79659fcac7d6716f7ad0f4449bcacae Mon Sep 17 00:00:00 2001 From: Roshan Khatri <117414976+roshkhatri@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:19:04 -0700 Subject: [PATCH 02/49] Makefile respect user's SERVER_CFLAGS and OPT (#55) Makefile respect user's SERVER_CFLAGS and OPT. This was unintentionally modified by https://github.com/placeholderkv/placeholderkv/commit/38632278fd06fe186f7707e4fa099f666d805547#diff-3e2513390df543315686d7c85bd901ca9256268970032298815d2f893a9f0685. Signed-off-by: Roshan Khatri --- src/Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Makefile b/src/Makefile index f776fd29d8..5747e1ae8a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -16,17 +16,20 @@ release_hdr := $(shell sh -c './mkreleasehdr.sh') uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') CLANG := $(findstring clang,$(shell sh -c '$(CC) --version | head -1')) + +# Optimization flags. To override, the OPTIMIZATION variable can be passed, but +# some automatic defaults are added to it. To specify optimization flags +# explicitly without any defaults added, pass the OPT variable instead. OPTIMIZATION?=-O3 ifeq ($(OPTIMIZATION),-O3) ifeq (clang,$(CLANG)) - SERVER_CFLAGS+=-flto + OPTIMIZATION+=-flto else - SERVER_CFLAGS+=-flto=auto + OPTIMIZATION+=-flto=auto endif - SERVER_LDFLAGS+=-O3 -flto endif ifneq ($(OPTIMIZATION),-O0) - SERVER_CFLAGS+=-fno-omit-frame-pointer + OPTIMIZATION+=-fno-omit-frame-pointer endif DEPENDENCY_TARGETS=hiredis linenoise lua hdr_histogram fpconv NODEPS:=clean distclean @@ -120,7 +123,7 @@ endif -include .make-settings FINAL_CFLAGS=$(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(SERVER_CFLAGS) -FINAL_LDFLAGS=$(LDFLAGS) $(SERVER_LDFLAGS) $(DEBUG) +FINAL_LDFLAGS=$(LDFLAGS) $(OPT) $(SERVER_LDFLAGS) $(DEBUG) FINAL_LIBS=-lm DEBUG=-g -ggdb From 699f62e8e3f55bfd665ab234e559081d2bd68230 Mon Sep 17 00:00:00 2001 From: Madelyn Olson <34459052+madolson@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:24:42 -0700 Subject: [PATCH 03/49] Updated contributing file with DCO (#48) Update the contributor file to include a DCO, which are going to require for all incoming contributions to provide indication that the contributor has the rights to contribute the code. I also fixed the formatting of contribution HOWTO, since it was getting mangled. Signed-off-by: Madelyn Olson --- CONTRIBUTING.md | 55 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2bfbec92ca..37fce03da3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,6 +25,46 @@ Issues and pull requests for documentation belong on the placeholderkv-doc repo: If you are reporting a security bug or vulnerability, see SECURITY.md. +## Developer Certificate of Origin + +We respect the intellectual property rights of others and we want to make sure all incoming contributions are correctly attributed and licensed. A Developer Certificate of Origin (DCO) is a lightweight mechanism to do that. The DCO is a declaration attached to every commit. In the commit message of the contribution, the developer simply adds a `Signed-off-by` statement and thereby agrees to the DCO, which you can find below or at [DeveloperCertificate.org](http://developercertificate.org/). + +``` +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the + best of my knowledge, is covered under an appropriate open + source license and I have the right under that license to + submit that work with modifications, whether created in whole + or in part by me, under the same open source license (unless + I am permitted to submit under a different license), as + Indicated in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including + all personal information I submit with it, including my + sign-off) is maintained indefinitely and may be redistributed + consistent with this project or the open source license(s) + involved. + ``` + +We require that every contribution to placeholderkv to be signed with a DCO. We require the usage of known identity (such as a real or preferred name). We do not accept anonymous contributors nor those utilizing pseudonyms. A DCO signed commit will contain a line like: + +``` +Signed-off-by: Jane Smith +``` +You may type this line on your own when writing your commit messages. However, if your user.name and user.email are set in your git configs, you can use `git commit` with `-s` or `--signoff` to add the `Signed-off-by` line to the end of the commit message. We also require revert commits to include a DCO. + # How to provide a patch for a new feature 1. If it is a major feature or a semantical change, please don't start coding @@ -34,14 +74,13 @@ and creating an issue at Github with the description of, exactly, what you want to accomplish and why. Use cases are important for features to be accepted. Here you can see if there is consensus about your idea. -2. If in step 1 you get an acknowledgment from the project leaders, use the - following procedure to submit a patch: - - a. Fork placeholderkv on GitHub ( https://docs.github.com/en/github/getting-started-with-github/fork-a-repo ) - b. Create a topic branch (git checkout -b my_branch) - c. Push to your branch (git push origin my_branch) - d. Initiate a pull request on GitHub ( https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request ) - e. Done :) +2. If in step 1 you get an acknowledgment from the project leaders, use the following procedure to submit a patch: + 1. Fork placeholderkv on GitHub ( https://docs.github.com/en/github/getting-started-with-github/fork-a-repo ) + 1. Create a topic branch (git checkout -b my_branch) + 1. Make the needed changes and commit with a DCO. (git commit -s) + 1. Push to your branch (git push origin my_branch) + 1. Initiate a pull request on GitHub ( https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request ) + 1. Done :) 3. Keep in mind that we are very overloaded, so issues and PRs sometimes wait for a *very* long time. However this is not a lack of interest, as the project From c120a4587494989454057a9f3c96526f4b82f237 Mon Sep 17 00:00:00 2001 From: Harkrishn Patro Date: Wed, 27 Mar 2024 21:29:44 -0700 Subject: [PATCH 04/49] Sharded pubsub command execution within multi/exec (#13) Allow SPUBLISH command within multi/exec on replica. --- src/cluster.c | 15 +++---- tests/unit/cluster/sharded-pubsub.tcl | 56 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 tests/unit/cluster/sharded-pubsub.tcl diff --git a/src/cluster.c b/src/cluster.c index 2a9d33a57d..60f5cc3b4e 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -1030,9 +1030,11 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in mc.cmd = cmd; } - int is_pubsubshard = cmd->proc == ssubscribeCommand || - cmd->proc == sunsubscribeCommand || - cmd->proc == spublishCommand; + uint64_t cmd_flags = getCommandFlags(c); + + /* Only valid for sharded pubsub as regular pubsub can operate on any node and bypasses this layer. */ + int pubsubshard_included = (cmd_flags & CMD_PUBSUB) || + (c->cmd->proc == execCommand && (c->mstate.cmd_flags & CMD_PUBSUB)); /* Check that all the keys are in the same hash slot, and obtain this * slot and the node associated. */ @@ -1109,7 +1111,7 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in * node until the migration completes with CLUSTER SETSLOT * NODE . */ int flags = LOOKUP_NOTOUCH | LOOKUP_NOSTATS | LOOKUP_NONOTIFY | LOOKUP_NOEXPIRE; - if ((migrating_slot || importing_slot) && !is_pubsubshard) + if ((migrating_slot || importing_slot) && !pubsubshard_included) { if (lookupKeyReadWithFlags(&server.db[0], thiskey, flags) == NULL) missing_keys++; else existing_keys++; @@ -1122,11 +1124,10 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in * without redirections or errors in all the cases. */ if (n == NULL) return myself; - uint64_t cmd_flags = getCommandFlags(c); /* Cluster is globally down but we got keys? We only serve the request * if it is a read command and when allow_reads_when_down is enabled. */ if (!isClusterHealthy()) { - if (is_pubsubshard) { + if (pubsubshard_included) { if (!server.cluster_allow_pubsubshard_when_down) { if (error_code) *error_code = CLUSTER_REDIR_DOWN_STATE; return NULL; @@ -1189,7 +1190,7 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in * is serving, we can reply without redirection. */ int is_write_command = (cmd_flags & CMD_WRITE) || (c->cmd->proc == execCommand && (c->mstate.cmd_flags & CMD_WRITE)); - if (((c->flags & CLIENT_READONLY) || is_pubsubshard) && + if (((c->flags & CLIENT_READONLY) || pubsubshard_included) && !is_write_command && clusterNodeIsSlave(myself) && clusterNodeGetSlaveof(myself) == n) diff --git a/tests/unit/cluster/sharded-pubsub.tcl b/tests/unit/cluster/sharded-pubsub.tcl new file mode 100644 index 0000000000..b5b19ff481 --- /dev/null +++ b/tests/unit/cluster/sharded-pubsub.tcl @@ -0,0 +1,56 @@ +start_cluster 1 1 {tags {external:skip cluster}} { + set primary_id 0 + set replica1_id 1 + + set primary [Rn $primary_id] + set replica [Rn $replica1_id] + + test "Sharded pubsub publish behavior within multi/exec" { + foreach {node} {primary replica} { + set node [set $node] + $node MULTI + $node SPUBLISH ch1 "hello" + $node EXEC + } + } + + test "Sharded pubsub within multi/exec with cross slot operation" { + $primary MULTI + $primary SPUBLISH ch1 "hello" + $primary GET foo + catch {[$primary EXEC]} err + assert_match {CROSSSLOT*} $err + } + + test "Sharded pubsub publish behavior within multi/exec with read operation on primary" { + $primary MULTI + $primary SPUBLISH foo "hello" + $primary GET foo + $primary EXEC + } {0 {}} + + test "Sharded pubsub publish behavior within multi/exec with read operation on replica" { + $replica MULTI + $replica SPUBLISH foo "hello" + catch {[$replica GET foo]} err + assert_match {MOVED*} $err + catch {[$replica EXEC]} err + assert_match {EXECABORT*} $err + } + + test "Sharded pubsub publish behavior within multi/exec with write operation on primary" { + $primary MULTI + $primary SPUBLISH foo "hello" + $primary SET foo bar + $primary EXEC + } {0 OK} + + test "Sharded pubsub publish behavior within multi/exec with write operation on replica" { + $replica MULTI + $replica SPUBLISH foo "hello" + catch {[$replica SET foo bar]} err + assert_match {MOVED*} $err + catch {[$replica EXEC]} err + assert_match {EXECABORT*} $err + } +} \ No newline at end of file From 57789d4d08fbe794c178a7d6a7c267f15a32b7b4 Mon Sep 17 00:00:00 2001 From: Madelyn Olson <34459052+madolson@users.noreply.github.com> Date: Thu, 28 Mar 2024 09:58:28 -0700 Subject: [PATCH 05/49] Update naming to to Valkey (#62) Documentation references should use `Valkey` while server and cli references are all under `valkey`. --------- Signed-off-by: Madelyn Olson --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/coverity.yml | 8 +- .github/workflows/daily.yml | 140 +++++++++--------- .github/workflows/external.yml | 20 +-- .gitignore | 14 +- BUGS | 2 +- CONTRIBUTING.md | 8 +- README.md | 103 ++++++------- src/Makefile | 2 +- src/server.c | 8 +- tests/cluster/tests/04-resharding.tcl | 2 +- .../cluster/tests/12-replica-migration-2.tcl | 4 +- .../tests/12.1-replica-migration-3.tcl | 2 +- tests/cluster/tests/includes/utils.tcl | 6 +- tests/instances.tcl | 4 +- tests/integration/aof-race.tcl | 2 +- tests/integration/aof.tcl | 32 ++-- tests/integration/psync2-reg.tcl | 2 +- tests/support/benchmark.tcl | 6 +- tests/support/cli.tcl | 4 +- tests/support/server.tcl | 2 +- tests/support/util.tcl | 2 +- tests/unit/acl.tcl | 4 +- tests/unit/cluster/cli.tcl | 46 +++--- tests/unit/introspection.tcl | 24 +-- tests/unit/moduleapi/cluster.tcl | 8 +- tests/unit/moduleapi/moduleconfigs.tcl | 6 +- tests/unit/other.tcl | 2 +- utils/generate-commands-json.py | 2 +- 29 files changed, 230 insertions(+), 237 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 684e04e5b2..34e18674f2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -10,7 +10,7 @@ jobs: analyze: name: Analyze runs-on: ubuntu-latest - if: github.event_name != 'schedule' || github.repository == 'placeholderkv/placeholderkv' + if: github.event_name != 'schedule' || github.repository == 'valkey-io/valkey' strategy: fail-fast: false diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 4ffd72fef7..36d7cf7ae3 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -8,16 +8,16 @@ on: workflow_dispatch: jobs: coverity: - if: github.repository == 'placeholderkv/placeholderkv' + if: github.repository == 'valkey-io/valkey' runs-on: ubuntu-latest steps: - uses: actions/checkout@main - name: Download and extract the Coverity Build Tool run: | - wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=placeholderkv-unstable" -O cov-analysis-linux64.tar.gz + wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=valkey-unstable" -O cov-analysis-linux64.tar.gz mkdir cov-analysis-linux64 tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64 - - name: Install placeholderkv dependencies + - name: Install Valkey dependencies run: sudo apt install -y gcc tcl8.6 tclx procps libssl-dev - name: Build with cov-build run: cov-analysis-linux64/bin/cov-build --dir cov-int make @@ -25,7 +25,7 @@ jobs: run: | tar czvf cov-int.tgz cov-int curl \ - --form project=placeholderkv-unstable \ + --form project=valkey-unstable \ --form email=${{ secrets.COVERITY_SCAN_EMAIL }} \ --form token=${{ secrets.COVERITY_SCAN_TOKEN }} \ --form file=@cov-int.tgz \ diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 41304202ca..f67540b1c1 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -10,7 +10,7 @@ on: default: 'valgrind,sanitizer,tls,freebsd,macos,alpine,32bit,iothreads,ubuntu,centos,malloc,specific,fortify,reply-schema' skiptests: description: 'tests to skip (delete the ones you wanna keep, do not leave empty)' - default: 'placeholderkv,modules,sentinel,cluster,unittest' + default: 'valkey,modules,sentinel,cluster,unittest' test_args: description: 'extra test arguments' default: '' @@ -19,7 +19,7 @@ on: default: '' use_repo: description: 'repo owner and name' - default: 'placeholderkv/placeholderkv' + default: 'valkey-io/valkey' use_git_ref: description: 'git branch or sha to use' default: 'unstable' @@ -30,7 +30,7 @@ jobs: test-ubuntu-jemalloc: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'ubuntu') timeout-minutes: 14400 steps: @@ -52,7 +52,7 @@ jobs: - name: testprep run: sudo apt-get install tcl8.6 tclx - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}} - name: module api test if: true && !contains(github.event.inputs.skiptests, 'modules') @@ -65,12 +65,12 @@ jobs: run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}} - name: unittest if: true && !contains(github.event.inputs.skiptests, 'unittest') - run: ./src/placeholderkv-server test all --accurate + run: ./src/valkey-server test all --accurate test-ubuntu-jemalloc-fortify: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'fortify') container: ubuntu:lunar timeout-minutes: 14400 @@ -96,7 +96,7 @@ jobs: - name: testprep run: apt-get install -y tcl8.6 tclx procps - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}} - name: module api test if: true && !contains(github.event.inputs.skiptests, 'modules') @@ -109,12 +109,12 @@ jobs: run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}} - name: unittest if: true && !contains(github.event.inputs.skiptests, 'unittest') - run: ./src/placeholderkv-server test all --accurate + run: ./src/valkey-server test all --accurate test-ubuntu-libc-malloc: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'malloc') timeout-minutes: 14400 steps: @@ -136,7 +136,7 @@ jobs: - name: testprep run: sudo apt-get install tcl8.6 tclx - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}} - name: module api test if: true && !contains(github.event.inputs.skiptests, 'modules') @@ -151,7 +151,7 @@ jobs: test-ubuntu-no-malloc-usable-size: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'malloc') timeout-minutes: 14400 steps: @@ -173,7 +173,7 @@ jobs: - name: testprep run: sudo apt-get install tcl8.6 tclx - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}} - name: module api test if: true && !contains(github.event.inputs.skiptests, 'modules') @@ -188,7 +188,7 @@ jobs: test-ubuntu-32bit: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, '32bit') timeout-minutes: 14400 steps: @@ -212,7 +212,7 @@ jobs: - name: testprep run: sudo apt-get install tcl8.6 tclx - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}} - name: module api test if: true && !contains(github.event.inputs.skiptests, 'modules') @@ -227,12 +227,12 @@ jobs: run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}} - name: unittest if: true && !contains(github.event.inputs.skiptests, 'unittest') - run: ./src/placeholderkv-server test all --accurate + run: ./src/valkey-server test all --accurate test-ubuntu-tls: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'tls') timeout-minutes: 14400 steps: @@ -257,7 +257,7 @@ jobs: sudo apt-get install tcl8.6 tclx tcl-tls ./utils/gen-test-certs.sh - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: | ./runtest --accurate --verbose --dump-logs --tls --dump-logs ${{github.event.inputs.test_args}} - name: module api test @@ -276,7 +276,7 @@ jobs: test-ubuntu-tls-no-tls: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'tls') timeout-minutes: 14400 steps: @@ -301,7 +301,7 @@ jobs: sudo apt-get install tcl8.6 tclx tcl-tls ./utils/gen-test-certs.sh - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: | ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}} - name: module api test @@ -320,7 +320,7 @@ jobs: test-ubuntu-io-threads: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'iothreads') timeout-minutes: 14400 steps: @@ -343,7 +343,7 @@ jobs: - name: testprep run: sudo apt-get install tcl8.6 tclx - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --config io-threads 4 --config io-threads-do-reads yes --accurate --verbose --tags network --dump-logs ${{github.event.inputs.test_args}} - name: cluster tests if: true && !contains(github.event.inputs.skiptests, 'cluster') @@ -352,7 +352,7 @@ jobs: test-ubuntu-reclaim-cache: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'specific') timeout-minutes: 14400 steps: @@ -379,19 +379,19 @@ jobs: mkdir /tmp/slave - name: warm up run: | - ./src/placeholderkv-server --daemonize yes --logfile /dev/null - ./src/placeholderkv-benchmark -n 1 > /dev/null - ./src/placeholderkv-cli save | grep OK > /dev/null + ./src/valkey-server --daemonize yes --logfile /dev/null + ./src/valkey-benchmark -n 1 > /dev/null + ./src/valkey-cli save | grep OK > /dev/null vmtouch -v ./dump.rdb > /dev/null - name: test run: | echo "test SAVE doesn't increase cache" CACHE0=$(grep -w file /sys/fs/cgroup/memory.stat | awk '{print $2}') echo "$CACHE0" - ./src/placeholderkv-server --daemonize yes --logfile /dev/null --dir /tmp/master --port 8080 --repl-diskless-sync no --pidfile /tmp/master/placeholderkv.pid --rdbcompression no --enable-debug-command yes - ./src/placeholderkv-cli -p 8080 debug populate 10000 k 102400 - ./src/placeholderkv-server --daemonize yes --logfile /dev/null --dir /tmp/slave --port 8081 --repl-diskless-load disabled --rdbcompression no - ./src/placeholderkv-cli -p 8080 save > /dev/null + ./src/valkey-server --daemonize yes --logfile /dev/null --dir /tmp/master --port 8080 --repl-diskless-sync no --pidfile /tmp/master/valkey.pid --rdbcompression no --enable-debug-command yes + ./src/valkey-cli -p 8080 debug populate 10000 k 102400 + ./src/valkey-server --daemonize yes --logfile /dev/null --dir /tmp/slave --port 8081 --repl-diskless-load disabled --rdbcompression no + ./src/valkey-cli -p 8080 save > /dev/null VMOUT=$(vmtouch -v /tmp/master/dump.rdb) echo $VMOUT grep -q " 0%" <<< $VMOUT @@ -400,8 +400,8 @@ jobs: if [ "$(( $CACHE-$CACHE0 ))" -gt "8000000" ]; then exit 1; fi echo "test replication doesn't increase cache" - ./src/placeholderkv-cli -p 8081 REPLICAOF 127.0.0.1 8080 > /dev/null - while [ $(./src/placeholderkv-cli -p 8081 info replication | grep "master_link_status:down") ]; do sleep 1; done; + ./src/valkey-cli -p 8081 REPLICAOF 127.0.0.1 8080 > /dev/null + while [ $(./src/valkey-cli -p 8081 info replication | grep "master_link_status:down") ]; do sleep 1; done; sleep 1 # wait for the completion of cache reclaim bio VMOUT=$(vmtouch -v /tmp/master/dump.rdb) echo $VMOUT @@ -414,11 +414,11 @@ jobs: if [ "$(( $CACHE-$CACHE0 ))" -gt "8000000" ]; then exit 1; fi echo "test reboot doesn't increase cache" - PID=$(cat /tmp/master/placeholderkv.pid) + PID=$(cat /tmp/master/valkey.pid) kill -15 $PID while [ -x /proc/${PID} ]; do sleep 1; done - ./src/placeholderkv-server --daemonize yes --logfile /dev/null --dir /tmp/master --port 8080 - while [ $(./src/placeholderkv-cli -p 8080 info persistence | grep "loading:1") ]; do sleep 1; done; + ./src/valkey-server --daemonize yes --logfile /dev/null --dir /tmp/master --port 8080 + while [ $(./src/valkey-cli -p 8080 info persistence | grep "loading:1") ]; do sleep 1; done; sleep 1 # wait for the completion of cache reclaim bio VMOUT=$(vmtouch -v /tmp/master/dump.rdb) echo $VMOUT @@ -430,8 +430,8 @@ jobs: test-valgrind-test: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && - !contains(github.event.inputs.skipjobs, 'valgrind') && !contains(github.event.inputs.skiptests, 'placeholderkv') + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && + !contains(github.event.inputs.skipjobs, 'valgrind') && !contains(github.event.inputs.skiptests, 'valkey') timeout-minutes: 14400 steps: - name: prep @@ -454,13 +454,13 @@ jobs: sudo apt-get update sudo apt-get install tcl8.6 tclx valgrind -y - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs ${{github.event.inputs.test_args}} test-valgrind-misc: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'valgrind') && !(contains(github.event.inputs.skiptests, 'modules') && contains(github.event.inputs.skiptests, 'unittest')) timeout-minutes: 14400 steps: @@ -489,14 +489,14 @@ jobs: - name: unittest if: true && !contains(github.event.inputs.skiptests, 'unittest') run: | - valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/placeholderkv-server test all --valgrind + valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/valkey-server test all --valgrind if grep -q 0x err.txt; then cat err.txt; exit 1; fi test-valgrind-no-malloc-usable-size-test: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && - !contains(github.event.inputs.skipjobs, 'valgrind') && !contains(github.event.inputs.skiptests, 'placeholderkv') + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && + !contains(github.event.inputs.skipjobs, 'valgrind') && !contains(github.event.inputs.skiptests, 'valkey') timeout-minutes: 14400 steps: - name: prep @@ -519,13 +519,13 @@ jobs: sudo apt-get update sudo apt-get install tcl8.6 tclx valgrind -y - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs ${{github.event.inputs.test_args}} test-valgrind-no-malloc-usable-size-misc: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'valgrind') && !(contains(github.event.inputs.skiptests, 'modules') && contains(github.event.inputs.skiptests, 'unittest')) timeout-minutes: 14400 steps: @@ -554,13 +554,13 @@ jobs: - name: unittest if: true && !contains(github.event.inputs.skiptests, 'unittest') run: | - valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/placeholderkv-server test all --valgrind + valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/valkey-server test all --valgrind if grep -q 0x err.txt; then cat err.txt; exit 1; fi test-sanitizer-address: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'sanitizer') timeout-minutes: 14400 strategy: @@ -591,7 +591,7 @@ jobs: sudo apt-get install tcl8.6 tclx -y sudo sysctl vm.mmap_rnd_bits=28 - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}} - name: module api test if: true && !contains(github.event.inputs.skiptests, 'modules') @@ -604,12 +604,12 @@ jobs: run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}} - name: unittest if: true && !contains(github.event.inputs.skiptests, 'unittest') - run: ./src/placeholderkv-server test all + run: ./src/valkey-server test all test-sanitizer-undefined: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'sanitizer') timeout-minutes: 14400 strategy: @@ -638,7 +638,7 @@ jobs: sudo apt-get update sudo apt-get install tcl8.6 tclx -y - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}} - name: module api test if: true && !contains(github.event.inputs.skiptests, 'modules') @@ -651,12 +651,12 @@ jobs: run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}} - name: unittest if: true && !contains(github.event.inputs.skiptests, 'unittest') - run: ./src/placeholderkv-server test all --accurate + run: ./src/valkey-server test all --accurate test-centos7-jemalloc: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'centos') container: centos:7 timeout-minutes: 14400 @@ -681,7 +681,7 @@ jobs: - name: testprep run: yum -y install which tcl tclx - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}} - name: module api test if: true && !contains(github.event.inputs.skiptests, 'modules') @@ -696,7 +696,7 @@ jobs: test-centos7-tls-module: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'tls') container: centos:7 timeout-minutes: 14400 @@ -724,7 +724,7 @@ jobs: yum -y install tcl tcltls tclx ./utils/gen-test-certs.sh - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: | ./runtest --accurate --verbose --dump-logs --tls-module --dump-logs ${{github.event.inputs.test_args}} - name: module api test @@ -743,7 +743,7 @@ jobs: test-centos7-tls-module-no-tls: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'tls') container: centos:7 timeout-minutes: 14400 @@ -771,7 +771,7 @@ jobs: yum -y install tcl tcltls tclx ./utils/gen-test-certs.sh - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: | ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}} - name: module api test @@ -790,8 +790,8 @@ jobs: test-macos-latest: runs-on: macos-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && - !contains(github.event.inputs.skipjobs, 'macos') && !(contains(github.event.inputs.skiptests, 'placeholderkv') && contains(github.event.inputs.skiptests, 'modules')) + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && + !contains(github.event.inputs.skipjobs, 'macos') && !(contains(github.event.inputs.skiptests, 'valkey') && contains(github.event.inputs.skiptests, 'modules')) timeout-minutes: 14400 steps: - name: prep @@ -810,7 +810,7 @@ jobs: - name: make run: make SERVER_CFLAGS='-Werror' - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --accurate --verbose --clients 1 --no-latency --dump-logs ${{github.event.inputs.test_args}} - name: module api test if: true && !contains(github.event.inputs.skiptests, 'modules') @@ -819,7 +819,7 @@ jobs: test-macos-latest-sentinel: runs-on: macos-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'macos') && !contains(github.event.inputs.skiptests, 'sentinel') timeout-minutes: 14400 steps: @@ -845,7 +845,7 @@ jobs: test-macos-latest-cluster: runs-on: macos-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'macos') && !contains(github.event.inputs.skiptests, 'cluster') timeout-minutes: 14400 steps: @@ -874,7 +874,7 @@ jobs: os: [macos-11, macos-13] runs-on: ${{ matrix.os }} if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'macos') timeout-minutes: 14400 steps: @@ -900,7 +900,7 @@ jobs: test-freebsd: runs-on: macos-12 if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'freebsd') timeout-minutes: 14400 steps: @@ -928,7 +928,7 @@ jobs: test-alpine-jemalloc: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'alpine') container: alpine:latest steps: @@ -952,7 +952,7 @@ jobs: - name: testprep run: apk add tcl procps tclx - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}} - name: module api test if: true && !contains(github.event.inputs.skiptests, 'modules') @@ -967,7 +967,7 @@ jobs: test-alpine-libc-malloc: runs-on: ubuntu-latest if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'alpine') container: alpine:latest steps: @@ -991,7 +991,7 @@ jobs: - name: testprep run: apk add tcl procps tclx - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}} - name: module api test if: true && !contains(github.event.inputs.skiptests, 'modules') @@ -1007,7 +1007,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 14400 if: | - (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'placeholderkv/placeholderkv')) && + (github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) && !contains(github.event.inputs.skipjobs, 'reply-schema') steps: - name: prep @@ -1028,7 +1028,7 @@ jobs: - name: testprep run: sudo apt-get install tcl8.6 tclx - name: test - if: true && !contains(github.event.inputs.skiptests, 'placeholderkv') + if: true && !contains(github.event.inputs.skiptests, 'valkey') run: ./runtest --log-req-res --no-latency --dont-clean --force-resp3 --tags -slow --verbose --dump-logs ${{github.event.inputs.test_args}} - name: module api test if: true && !contains(github.event.inputs.skiptests, 'modules') @@ -1044,5 +1044,5 @@ jobs: with: path: "./utils/req-res-validator/requirements.txt" - name: validator - run: ./utils/req-res-log-validator.py --verbose --fail-missing-reply-schemas ${{ (!contains(github.event.inputs.skiptests, 'placeholderkv') && !contains(github.event.inputs.skiptests, 'module') && !contains(github.event.inputs.sentinel, 'placeholderkv') && !contains(github.event.inputs.skiptests, 'cluster')) && github.event.inputs.test_args == '' && github.event.inputs.cluster_test_args == '' && '--fail-commands-not-all-hit' || '' }} + run: ./utils/req-res-log-validator.py --verbose --fail-missing-reply-schemas ${{ (!contains(github.event.inputs.skiptests, 'valkey') && !contains(github.event.inputs.skiptests, 'module') && !contains(github.event.inputs.sentinel, 'valkey') && !contains(github.event.inputs.skiptests, 'cluster')) && github.event.inputs.test_args == '' && github.event.inputs.cluster_test_args == '' && '--fail-commands-not-all-hit' || '' }} diff --git a/.github/workflows/external.yml b/.github/workflows/external.yml index 3633f00a10..0113858fec 100644 --- a/.github/workflows/external.yml +++ b/.github/workflows/external.yml @@ -9,15 +9,15 @@ on: jobs: test-external-standalone: runs-on: ubuntu-latest - if: github.event_name != 'schedule' || github.repository == 'placeholderkv/placeholderkv' + if: github.event_name != 'schedule' || github.repository == 'valkey-io/valkey' timeout-minutes: 14400 steps: - uses: actions/checkout@v3 - name: Build run: make SERVER_CFLAGS=-Werror - - name: Start placeholderkv-server + - name: Start valkey-server run: | - ./src/placeholderkv-server --daemonize yes --save "" --logfile external-server.log \ + ./src/valkey-server --daemonize yes --save "" --logfile external-server.log \ --enable-protected-configs yes --enable-debug-command yes --enable-module-command yes - name: Run external test run: | @@ -34,18 +34,18 @@ jobs: test-external-cluster: runs-on: ubuntu-latest - if: github.event_name != 'schedule' || github.repository == 'placeholderkv/placeholderkv' + if: github.event_name != 'schedule' || github.repository == 'valkey-io/valkey' timeout-minutes: 14400 steps: - uses: actions/checkout@v3 - name: Build run: make SERVER_CFLAGS=-Werror - - name: Start placeholderkv-server + - name: Start valkey-server run: | - ./src/placeholderkv-server --cluster-enabled yes --daemonize yes --save "" --logfile external-server.log \ + ./src/valkey-server --cluster-enabled yes --daemonize yes --save "" --logfile external-server.log \ --enable-protected-configs yes --enable-debug-command yes --enable-module-command yes - name: Create a single node cluster - run: ./src/placeholderkv-cli cluster addslots $(for slot in {0..16383}; do echo $slot; done); sleep 5 + run: ./src/valkey-cli cluster addslots $(for slot in {0..16383}; do echo $slot; done); sleep 5 - name: Run external test run: | ./runtest \ @@ -62,15 +62,15 @@ jobs: test-external-nodebug: runs-on: ubuntu-latest - if: github.event_name != 'schedule' || github.repository == 'placeholderkv/placeholderkv' + if: github.event_name != 'schedule' || github.repository == 'valkey-io/valkey' timeout-minutes: 14400 steps: - uses: actions/checkout@v3 - name: Build run: make SERVER_CFLAGS=-Werror - - name: Start placeholderkv-server + - name: Start valkey-server run: | - ./src/placeholderkv-server --daemonize yes --save "" --logfile external-server.log + ./src/valkey-server --daemonize yes --save "" --logfile external-server.log - name: Run external test run: | ./runtest \ diff --git a/.gitignore b/.gitignore index 9862c0cc58..c9ea5d33c4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,13 +5,13 @@ *.d *.log dump.rdb -placeholderkv-benchmark -placeholderkv-check-aof -placeholderkv-check-rdb -placeholderkv-check-dump -placeholderkv-cli -placeholderkv-sentinel -placeholderkv-server +*-benchmark +*-check-aof +*-check-rdb +*-check-dump +*-cli +*-sentinel +*-server doc-tools release misc/* diff --git a/BUGS b/BUGS index 0c9a1d8e6a..02d5070fe9 100644 --- a/BUGS +++ b/BUGS @@ -1 +1 @@ -Please check https://github.com/placeholderkv/placeholderkv/issues +Please check https://github.com/valkey-io/valkey/issues diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 37fce03da3..548204eb83 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,9 +19,9 @@ There is also an active community of Redis users at Stack Overflow: https://stackoverflow.com/questions/tagged/redis -Issues and pull requests for documentation belong on the placeholderkv-doc repo: +Issues and pull requests for documentation belong on the valkey-doc repo: - https://github.com/placeholderkv/placeholderkv-doc + https://github.com/valkey-io/valkey-doc If you are reporting a security bug or vulnerability, see SECURITY.md. @@ -58,7 +58,7 @@ By making a contribution to this project, I certify that: involved. ``` -We require that every contribution to placeholderkv to be signed with a DCO. We require the usage of known identity (such as a real or preferred name). We do not accept anonymous contributors nor those utilizing pseudonyms. A DCO signed commit will contain a line like: +We require that every contribution to Valkey to be signed with a DCO. We require the usage of known identity (such as a real or preferred name). We do not accept anonymous contributors nor those utilizing pseudonyms. A DCO signed commit will contain a line like: ``` Signed-off-by: Jane Smith @@ -75,7 +75,7 @@ to accomplish and why. Use cases are important for features to be accepted. Here you can see if there is consensus about your idea. 2. If in step 1 you get an acknowledgment from the project leaders, use the following procedure to submit a patch: - 1. Fork placeholderkv on GitHub ( https://docs.github.com/en/github/getting-started-with-github/fork-a-repo ) + 1. Fork Valkey on GitHub ( https://docs.github.com/en/github/getting-started-with-github/fork-a-repo ) 1. Create a topic branch (git checkout -b my_branch) 1. Make the needed changes and commit with a DCO. (git commit -s) 1. Push to your branch (git push origin my_branch) diff --git a/README.md b/README.md index cd654fdf31..7da887f2b3 100644 --- a/README.md +++ b/README.md @@ -4,19 +4,20 @@ This project was forked from the open source Redis project right before the tran This README is just a fast *quick start* document. We are currently working on a more permanent documentation page. -What is PlaceHolderKV? +What is Valkey? -------------- -The name is temporary, as we work to find a new name that the community accepts. It also happens to be a very easy string to search for. +Valkey is a high-performance data structure server that primarily serves key/value workloads. +It supports a wide range of native structures and an extensible plugin system for adding new data structures and access patterns. -Building PlaceHolderKV +Building Valkey -------------- -PlaceHolderKV can be compiled and used on Linux, OSX, OpenBSD, NetBSD, FreeBSD. +Valkey can be compiled and used on Linux, OSX, OpenBSD, NetBSD, FreeBSD. We support big endian and little endian architectures, and both 32 bit and 64 bit systems. It may compile on Solaris derived systems (for instance SmartOS) but our -support for this platform is *best effort* and PlaceHolderKV is not guaranteed to +support for this platform is *best effort* and Valkey is not guaranteed to work as well as in Linux, OSX, and \*BSD. It is as simple as: @@ -33,15 +34,15 @@ as libsystemd-dev on Debian/Ubuntu or systemd-devel on CentOS) and run: % make USE_SYSTEMD=yes -To append a suffix to PlaceHolderKV program names, use: +To append a suffix to Valkey program names, use: % make PROG_SUFFIX="-alt" -You can build a 32 bit PlaceHolderKV binary using: +You can build a 32 bit Valkey binary using: % make 32bit -After building PlaceHolderKV, it is a good idea to test it using: +After building Valkey, it is a good idea to test it using: % make test @@ -55,7 +56,7 @@ installed): Fixing build problems with dependencies or cached build options --------- -PlaceHolderKV has some dependencies which are included in the `deps` directory. +Valkey has some dependencies which are included in the `deps` directory. `make` does not automatically rebuild dependencies even if something in the source code of dependencies changes. @@ -65,7 +66,7 @@ command in order to really clean everything and rebuild from scratch: % make distclean -This will clean: jemalloc, lua, hiplaceholderkv, linenoise and other dependencies. +This will clean: jemalloc, lua, hiredis, linenoise and other dependencies. Also if you force certain build options like 32bit target, no C compiler optimizations (for debugging purposes), and other similar build time options, @@ -75,11 +76,11 @@ command. Fixing problems building 32 bit binaries --------- -If after building PlaceHolderKV with a 32 bit target you need to rebuild it +If after building Valkey with a 32 bit target you need to rebuild it with a 64 bit target, or the other way around, you need to perform a -`make distclean` in the root directory of the PlaceHolderKV distribution. +`make distclean` in the root directory of the Valkey distribution. -In case of build errors when trying to build a 32 bit binary of PlaceHolderKV, try +In case of build errors when trying to build a 32 bit binary of Valkey, try the following steps: * Install the package libc6-dev-i386 (also try g++-multilib). @@ -89,8 +90,8 @@ the following steps: Allocator --------- -Selecting a non-default memory allocator when building PlaceHolderKV is done by setting -the `MALLOC` environment variable. PlaceHolderKV is compiled and linked against libc +Selecting a non-default memory allocator when building Valkey is done by setting +the `MALLOC` environment variable. Valkey is compiled and linked against libc malloc by default, with the exception of jemalloc being the default on Linux systems. This default was picked because jemalloc has proven to have fewer fragmentation problems than libc malloc. @@ -106,7 +107,7 @@ To compile against jemalloc on Mac OS X systems, use: Monotonic clock --------------- -By default, PlaceHolderKV will build using the POSIX clock_gettime function as the +By default, Valkey will build using the POSIX clock_gettime function as the monotonic clock source. On most modern systems, the internal processor clock can be used to improve performance. Cautions can be found here: http://oliveryang.net/2015/09/pitfalls-of-TSC-usage/ @@ -118,64 +119,64 @@ To build with support for the processor's internal instruction clock, use: Verbose build ------------- -PlaceHolderKV will build with a user-friendly colorized output by default. +Valkey will build with a user-friendly colorized output by default. If you want to see a more verbose output, use the following: % make V=1 -Running PlaceHolderKV +Running Valkey ------------- -To run PlaceHolderKV with the default configuration, just type: +To run Valkey with the default configuration, just type: % cd src - % ./placeholderkv-server + % ./valkey-server -If you want to provide your placeholderkv.conf, you have to run it using an additional +If you want to provide your valkey.conf, you have to run it using an additional parameter (the path of the configuration file): % cd src - % ./placeholderkv-server /path/to/placeholderkv.conf + % ./valkey-server /path/to/valkey.conf -It is possible to alter the PlaceHolderKV configuration by passing parameters directly +It is possible to alter the Valkey configuration by passing parameters directly as options using the command line. Examples: - % ./placeholderkv-server --port 9999 --replicaof 127.0.0.1 6379 - % ./placeholderkv-server /etc/placeholderkv/6379.conf --loglevel debug + % ./valkey-server --port 9999 --replicaof 127.0.0.1 6379 + % ./valkey-server /etc/valkey/6379.conf --loglevel debug -All the options in placeholderkv.conf are also supported as options using the command +All the options in valkey.conf are also supported as options using the command line, with exactly the same name. -Running PlaceHolderKV with TLS: +Running Valkey with TLS: ------------------ Please consult the [TLS.md](TLS.md) file for more information on -how to use PlaceHolderKV with TLS. +how to use Valkey with TLS. -Playing with PlaceHolderKV +Playing with Valkey ------------------ -You can use placeholderkv-cli to play with PlaceHolderKV. Start a placeholderkv-server instance, +You can use valkey-cli to play with Valkey. Start a valkey-server instance, then in another terminal try the following: % cd src - % ./placeholderkv-cli - placeholderkv> ping + % ./valkey-cli + valkey> ping PONG - placeholderkv> set foo bar + valkey> set foo bar OK - placeholderkv> get foo + valkey> get foo "bar" - placeholderkv> incr mycounter + valkey> incr mycounter (integer) 1 - placeholderkv> incr mycounter + valkey> incr mycounter (integer) 2 - placeholderkv> + valkey> -Installing PlaceHolderKV +Installing Valkey ----------------- -In order to install PlaceHolderKV binaries into /usr/local/bin, just use: +In order to install Valkey binaries into /usr/local/bin, just use: % make install @@ -184,7 +185,7 @@ different destination. `make install` will just install binaries in your system, but will not configure init scripts and configuration files in the appropriate place. This is not -needed if you just want to play a bit with PlaceHolderKV, but if you are installing +needed if you just want to play a bit with Valkey, but if you are installing it the proper way for a production system, we have a script that does this for Ubuntu and Debian systems: @@ -194,24 +195,16 @@ for Ubuntu and Debian systems: _Note_: `install_server.sh` will not work on Mac OSX; it is built for Linux only. The script will ask you a few questions and will setup everything you need -to run PlaceHolderKV properly as a background daemon that will start again on +to run Valkey properly as a background daemon that will start again on system reboots. -You'll be able to stop and start PlaceHolderKV using the script named -`/etc/init.d/placeholderkv_`, for instance `/etc/init.d/placeholderkv_6379`. +You'll be able to stop and start Valkey using the script named +`/etc/init.d/valkey_`, for instance `/etc/init.d/valkey_6379`. Code contributions ----------------- +Please see the [CONTRIBUTING.md][2]. For security bugs and vulnerabilities, please see [SECURITY.md][3]. -Note: By contributing code to the PlaceHolderKV project in any form, including sending -a pull request via Github, a code fragment or patch via private email or -public discussion groups, you agree to release your code under the terms -of the BSD license that you can find in the [COPYING][1] file included in the PlaceHolderKV -source distribution. - -Please see the [CONTRIBUTING.md][2] file in this source distribution for more -information. For security bugs and vulnerabilities, please see [SECURITY.md][3]. - -[1]: https://github.com/madolson/placeholderkv/blob/unstable/COPYING -[2]: https://github.com/madolson/placeholderkv/blob/unstable/CONTRIBUTING.md -[3]: https://github.com/madolson/placeholderkv/blob/unstable/SECURITY.md +[1]: https://github.com/valkey-io/valkey/blob/unstable/COPYING +[2]: https://github.com/valkey-io/valkey/blob/unstable/CONTRIBUTING.md +[3]: https://github.com/valkey-io/valkey/blob/unstable/SECURITY.md diff --git a/src/Makefile b/src/Makefile index 5747e1ae8a..f762e2912c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -349,7 +349,7 @@ else GEN_COMMANDS_FLAGS= endif -ENGINE_NAME=placeholderkv +ENGINE_NAME=valkey SERVER_NAME=$(ENGINE_NAME)-server$(PROG_SUFFIX) ENGINE_SENTINEL_NAME=$(ENGINE_NAME)-sentinel$(PROG_SUFFIX) ENGINE_SERVER_OBJ=threads_mngr.o adlist.o quicklist.o ae.o anet.o dict.o kvstore.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o cluster_legacy.o crc16.o endianconv.o slowlog.o eval.o bio.o rio.o rand.o memtest.o syscheck.o crcspeed.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o redis-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o acl.o tracking.o socket.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o resp_parser.o call_reply.o script_lua.o script.o functions.o function_lua.o commands.o strl.o connection.o unix.o logreqres.o diff --git a/src/server.c b/src/server.c index 3050859d62..221ab00365 100644 --- a/src/server.c +++ b/src/server.c @@ -6612,9 +6612,9 @@ void dismissMemoryInChild(void) { void memtest(size_t megabytes, int passes); /* Returns 1 if there is --sentinel among the arguments or if - * executable name contains "placeholderkv-sentinel". */ + * executable name contains "valkey-sentinel". */ int checkForSentinelMode(int argc, char **argv, char *exec_name) { - if (strstr(exec_name,"placeholderkv-sentinel") != NULL) return 1; + if (strstr(exec_name,"valkey-sentinel") != NULL) return 1; for (int j = 1; j < argc; j++) if (!strcmp(argv[j],"--sentinel")) return 1; @@ -6995,9 +6995,9 @@ int main(int argc, char **argv) { /* Check if we need to start in redis-check-rdb/aof mode. We just execute * the program main. However the program is part of the Redis executable * so that we can easily execute an RDB check on loading errors. */ - if (strstr(exec_name,"placeholderkv-check-rdb") != NULL) + if (strstr(exec_name,"valkey-check-rdb") != NULL) redis_check_rdb_main(argc,argv,NULL); - else if (strstr(exec_name,"placeholderkv-check-aof") != NULL) + else if (strstr(exec_name,"valkey-check-aof") != NULL) redis_check_aof_main(argc,argv); if (argc >= 2) { diff --git a/tests/cluster/tests/04-resharding.tcl b/tests/cluster/tests/04-resharding.tcl index 3a08c70802..f7cb7e4988 100644 --- a/tests/cluster/tests/04-resharding.tcl +++ b/tests/cluster/tests/04-resharding.tcl @@ -84,7 +84,7 @@ test "Cluster consistency during live resharding" { flush stdout set target [dict get [get_myself [randomInt 5]] id] set tribpid [lindex [exec \ - ../../../src/placeholderkv-cli --cluster reshard \ + ../../../src/valkey-cli --cluster reshard \ 127.0.0.1:[get_instance_attrib redis 0 port] \ --cluster-from all \ --cluster-to $target \ diff --git a/tests/cluster/tests/12-replica-migration-2.tcl b/tests/cluster/tests/12-replica-migration-2.tcl index b41edf9c83..5c3edeb8e5 100644 --- a/tests/cluster/tests/12-replica-migration-2.tcl +++ b/tests/cluster/tests/12-replica-migration-2.tcl @@ -38,7 +38,7 @@ test "Set allow-replica-migration yes" { set master0_id [dict get [get_myself 0] id] test "Resharding all the master #0 slots away from it" { set output [exec \ - ../../../src/placeholderkv-cli --cluster rebalance \ + ../../../src/valkey-cli --cluster rebalance \ 127.0.0.1:[get_instance_attrib redis 0 port] \ {*}[rediscli_tls_config "../../../tests"] \ --cluster-weight ${master0_id}=0 >@ stdout ] @@ -59,7 +59,7 @@ test "Resharding back some slot to master #0" { # new resharding. after 10000 set output [exec \ - ../../../src/placeholderkv-cli --cluster rebalance \ + ../../../src/valkey-cli --cluster rebalance \ 127.0.0.1:[get_instance_attrib redis 0 port] \ {*}[rediscli_tls_config "../../../tests"] \ --cluster-weight ${master0_id}=.01 \ diff --git a/tests/cluster/tests/12.1-replica-migration-3.tcl b/tests/cluster/tests/12.1-replica-migration-3.tcl index 9015062e8a..3515425e14 100644 --- a/tests/cluster/tests/12.1-replica-migration-3.tcl +++ b/tests/cluster/tests/12.1-replica-migration-3.tcl @@ -37,7 +37,7 @@ test "Set allow-replica-migration no" { set master0_id [dict get [get_myself 0] id] test "Resharding all the master #0 slots away from it" { set output [exec \ - ../../../src/placeholderkv-cli --cluster rebalance \ + ../../../src/valkey-cli --cluster rebalance \ 127.0.0.1:[get_instance_attrib redis 0 port] \ {*}[rediscli_tls_config "../../../tests"] \ --cluster-weight ${master0_id}=0 >@ stdout ] diff --git a/tests/cluster/tests/includes/utils.tcl b/tests/cluster/tests/includes/utils.tcl index ee71a4747c..f0c6d94b3c 100644 --- a/tests/cluster/tests/includes/utils.tcl +++ b/tests/cluster/tests/includes/utils.tcl @@ -8,7 +8,7 @@ proc config_set_all_nodes {keyword value} { proc fix_cluster {addr} { set code [catch { - exec ../../../src/placeholderkv-cli {*}[rediscli_tls_config "../../../tests"] --cluster fix $addr << yes + exec ../../../src/valkey-cli {*}[rediscli_tls_config "../../../tests"] --cluster fix $addr << yes } result] if {$code != 0} { puts "redis-cli --cluster fix returns non-zero exit code, output below:\n$result" @@ -17,7 +17,7 @@ proc fix_cluster {addr} { # but we can ignore that and rely on the check below. assert_cluster_state ok wait_for_condition 100 100 { - [catch {exec ../../../src/placeholderkv-cli {*}[rediscli_tls_config "../../../tests"] --cluster check $addr} result] == 0 + [catch {exec ../../../src/valkey-cli {*}[rediscli_tls_config "../../../tests"] --cluster check $addr} result] == 0 } else { puts "redis-cli --cluster check returns non-zero exit code, output below:\n$result" fail "Cluster could not settle with configuration" @@ -26,7 +26,7 @@ proc fix_cluster {addr} { proc wait_cluster_stable {} { wait_for_condition 1000 50 { - [catch {exec ../../../src/placeholderkv-cli --cluster \ + [catch {exec ../../../src/valkey-cli --cluster \ check 127.0.0.1:[get_instance_attrib redis 0 port] \ {*}[rediscli_tls_config "../../../tests"] \ }] == 0 diff --git a/tests/instances.tcl b/tests/instances.tcl index 5daf69a26e..d4ecfbfd84 100644 --- a/tests/instances.tcl +++ b/tests/instances.tcl @@ -48,9 +48,9 @@ if {[catch {cd tmp}]} { # the provided configuration file. Returns the PID of the process. proc exec_instance {type dirname cfgfile} { if {$type eq "redis"} { - set prgname placeholderkv-server + set prgname valkey-server } elseif {$type eq "sentinel"} { - set prgname placeholderkv-sentinel + set prgname valkey-sentinel } else { error "Unknown instance type." } diff --git a/tests/integration/aof-race.tcl b/tests/integration/aof-race.tcl index 1220472c40..26e728afb6 100644 --- a/tests/integration/aof-race.tcl +++ b/tests/integration/aof-race.tcl @@ -8,7 +8,7 @@ tags {"aof external:skip"} { # was subsequently appended to the new AOF, resulting in duplicate commands. start_server_aof [list dir $server_path] { set client [redis [srv host] [srv port] 0 $::tls] - set bench [open "|src/placeholderkv-benchmark -q -s [srv unixsocket] -c 20 -n 20000 incr foo" "r+"] + set bench [open "|src/valkey-benchmark -q -s [srv unixsocket] -c 20 -n 20000 incr foo" "r+"] wait_for_condition 100 1 { [$client get foo] > 0 diff --git a/tests/integration/aof.tcl b/tests/integration/aof.tcl index e22923403c..31afee7268 100644 --- a/tests/integration/aof.tcl +++ b/tests/integration/aof.tcl @@ -107,7 +107,7 @@ tags {"aof external:skip"} { ## Test that redis-check-aof indeed sees this AOF is not valid test "Short read: Utility should confirm the AOF is not valid" { catch { - exec src/placeholderkv-check-aof $aof_manifest_file + exec src/valkey-check-aof $aof_manifest_file } result assert_match "*not valid*" $result } @@ -119,13 +119,13 @@ tags {"aof external:skip"} { } catch { - exec src/placeholderkv-check-aof $aof_manifest_file + exec src/valkey-check-aof $aof_manifest_file } result assert_match "*ok_up_to_line=8*" $result } test "Short read: Utility should be able to fix the AOF" { - set result [exec src/placeholderkv-check-aof --fix $aof_manifest_file << "y\n"] + set result [exec src/valkey-check-aof --fix $aof_manifest_file << "y\n"] assert_match "*Successfully truncated AOF*" $result } @@ -397,7 +397,7 @@ tags {"aof external:skip"} { test {Truncate AOF to specific timestamp} { # truncate to timestamp 1628217473 - exec src/placeholderkv-check-aof --truncate-to-timestamp 1628217473 $aof_manifest_file + exec src/valkey-check-aof --truncate-to-timestamp 1628217473 $aof_manifest_file start_server_aof [list dir $server_path] { set c [redis [srv host] [srv port] 0 $::tls] wait_done_loading $c @@ -407,7 +407,7 @@ tags {"aof external:skip"} { } # truncate to timestamp 1628217471 - exec src/placeholderkv-check-aof --truncate-to-timestamp 1628217471 $aof_manifest_file + exec src/valkey-check-aof --truncate-to-timestamp 1628217471 $aof_manifest_file start_server_aof [list dir $server_path] { set c [redis [srv host] [srv port] 0 $::tls] wait_done_loading $c @@ -417,7 +417,7 @@ tags {"aof external:skip"} { } # truncate to timestamp 1628217470 - exec src/placeholderkv-check-aof --truncate-to-timestamp 1628217470 $aof_manifest_file + exec src/valkey-check-aof --truncate-to-timestamp 1628217470 $aof_manifest_file start_server_aof [list dir $server_path] { set c [redis [srv host] [srv port] 0 $::tls] wait_done_loading $c @@ -426,7 +426,7 @@ tags {"aof external:skip"} { } # truncate to timestamp 1628217469 - catch {exec src/placeholderkv-check-aof --truncate-to-timestamp 1628217469 $aof_manifest_file} e + catch {exec src/valkey-check-aof --truncate-to-timestamp 1628217469 $aof_manifest_file} e assert_match {*aborting*} $e } @@ -476,7 +476,7 @@ tags {"aof external:skip"} { } catch { - exec src/placeholderkv-check-aof $aof_file + exec src/valkey-check-aof $aof_file } result assert_match "*Start checking Old-Style AOF*is valid*" $result } @@ -488,14 +488,14 @@ tags {"aof external:skip"} { } catch { - exec src/placeholderkv-check-aof $aof_file + exec src/valkey-check-aof $aof_file } result assert_match "*Start checking Old-Style AOF*is valid*" $result } test {Test redis-check-aof for old style rdb-preamble AOF} { catch { - exec src/placeholderkv-check-aof tests/assets/rdb-preamble.aof + exec src/valkey-check-aof tests/assets/rdb-preamble.aof } result assert_match "*Start checking Old-Style AOF*RDB preamble is OK, proceeding with AOF tail*is valid*" $result } @@ -517,7 +517,7 @@ tags {"aof external:skip"} { } catch { - exec src/placeholderkv-check-aof $aof_manifest_file + exec src/valkey-check-aof $aof_manifest_file } result assert_match "*Start checking Multi Part AOF*Start to check BASE AOF (RESP format)*BASE AOF*is valid*Start to check INCR files*INCR AOF*is valid*All AOF files and manifest are valid*" $result } @@ -536,7 +536,7 @@ tags {"aof external:skip"} { } catch { - exec src/placeholderkv-check-aof $aof_manifest_file + exec src/valkey-check-aof $aof_manifest_file } result assert_match "*Start checking Multi Part AOF*Start to check BASE AOF (RDB format)*DB preamble is OK, proceeding with AOF tail*BASE AOF*is valid*Start to check INCR files*INCR AOF*is valid*All AOF files and manifest are valid*" $result } @@ -549,7 +549,7 @@ tags {"aof external:skip"} { } catch { - exec src/placeholderkv-check-aof $aof_manifest_file + exec src/valkey-check-aof $aof_manifest_file } result assert_match "*Invalid AOF manifest file format*" $result } @@ -572,12 +572,12 @@ tags {"aof external:skip"} { } catch { - exec src/placeholderkv-check-aof $aof_manifest_file + exec src/valkey-check-aof $aof_manifest_file } result assert_match "*not valid*" $result catch { - exec src/placeholderkv-check-aof --fix $aof_manifest_file + exec src/valkey-check-aof --fix $aof_manifest_file } result assert_match "*Failed to truncate AOF*because it is not the last file*" $result } @@ -605,7 +605,7 @@ tags {"aof external:skip"} { } catch { - exec src/placeholderkv-check-aof --truncate-to-timestamp 1628217473 $aof_manifest_file + exec src/valkey-check-aof --truncate-to-timestamp 1628217473 $aof_manifest_file } result assert_match "*Failed to truncate AOF*to timestamp*because it is not the last file*" $result } diff --git a/tests/integration/psync2-reg.tcl b/tests/integration/psync2-reg.tcl index 8317f1e365..a803d82a8a 100644 --- a/tests/integration/psync2-reg.tcl +++ b/tests/integration/psync2-reg.tcl @@ -40,7 +40,7 @@ start_server {} { } set cycle_start_time [clock milliseconds] - set bench_pid [exec src/placeholderkv-benchmark -s $R_unixsocket(0) -n 10000000 -r 1000 incr __rand_int__ > /dev/null &] + set bench_pid [exec src/valkey-benchmark -s $R_unixsocket(0) -n 10000000 -r 1000 incr __rand_int__ > /dev/null &] while 1 { set elapsed [expr {[clock milliseconds]-$cycle_start_time}] if {$elapsed > $duration*1000} break diff --git a/tests/support/benchmark.tcl b/tests/support/benchmark.tcl index 3d49ee16f8..35a8d26232 100644 --- a/tests/support/benchmark.tcl +++ b/tests/support/benchmark.tcl @@ -12,21 +12,21 @@ proc redisbenchmark_tls_config {testsdir} { } proc redisbenchmark {host port {opts {}}} { - set cmd [list src/placeholderkv-benchmark -h $host -p $port] + set cmd [list src/valkey-benchmark -h $host -p $port] lappend cmd {*}[redisbenchmark_tls_config "tests"] lappend cmd {*}$opts return $cmd } proc redisbenchmarkuri {host port {opts {}}} { - set cmd [list src/placeholderkv-benchmark -u redis://$host:$port] + set cmd [list src/valkey-benchmark -u redis://$host:$port] lappend cmd {*}[redisbenchmark_tls_config "tests"] lappend cmd {*}$opts return $cmd } proc redisbenchmarkuriuserpass {host port user pass {opts {}}} { - set cmd [list src/placeholderkv-benchmark -u redis://$user:$pass@$host:$port] + set cmd [list src/valkey-benchmark -u redis://$user:$pass@$host:$port] lappend cmd {*}[redisbenchmark_tls_config "tests"] lappend cmd {*}$opts return $cmd diff --git a/tests/support/cli.tcl b/tests/support/cli.tcl index a83ad43187..4bd693369b 100644 --- a/tests/support/cli.tcl +++ b/tests/support/cli.tcl @@ -13,7 +13,7 @@ proc rediscli_tls_config {testsdir} { # Returns command line for executing redis-cli proc rediscli {host port {opts {}}} { - set cmd [list src/placeholderkv-cli -h $host -p $port] + set cmd [list src/valkey-cli -h $host -p $port] lappend cmd {*}[rediscli_tls_config "tests"] lappend cmd {*}$opts return $cmd @@ -21,7 +21,7 @@ proc rediscli {host port {opts {}}} { # Returns command line for executing redis-cli with a unix socket address proc rediscli_unixsocket {unixsocket {opts {}}} { - return [list src/placeholderkv-cli -s $unixsocket {*}$opts] + return [list src/valkey-cli -s $unixsocket {*}$opts] } # Run redis-cli with specified args on the server of specified level. diff --git a/tests/support/server.tcl b/tests/support/server.tcl index ae8c83ea81..43f619b251 100644 --- a/tests/support/server.tcl +++ b/tests/support/server.tcl @@ -275,7 +275,7 @@ proc create_server_config_file {filename config config_lines} { } proc spawn_server {config_file stdout stderr args} { - set cmd [list src/placeholderkv-server $config_file] + set cmd [list src/valkey-server $config_file] set args {*}$args if {[llength $args] > 0} { lappend cmd {*}$args diff --git a/tests/support/util.tcl b/tests/support/util.tcl index ecb86fc78b..00d94ff338 100644 --- a/tests/support/util.tcl +++ b/tests/support/util.tcl @@ -1143,7 +1143,7 @@ proc system_backtrace_supported {} { # libmusl does not support backtrace. Also return 0 on # static binaries (ldd exit code 1) where we can't detect libmusl catch { - set ldd [exec ldd src/placeholderkv-server] + set ldd [exec ldd src/valkey-server] if {![string match {*libc.*musl*} $ldd]} { return 1 } diff --git a/tests/unit/acl.tcl b/tests/unit/acl.tcl index 60e409f474..95b8a376ef 100644 --- a/tests/unit/acl.tcl +++ b/tests/unit/acl.tcl @@ -1227,10 +1227,10 @@ start_server [list overrides [list "dir" $server_path "aclfile" "user.acl"] tags } test {Test loading duplicate users in config on startup} { - catch {exec src/placeholderkv-server --user foo --user foo} err + catch {exec src/valkey-server --user foo --user foo} err assert_match {*Duplicate user*} $err - catch {exec src/placeholderkv-server --user default --user default} err + catch {exec src/valkey-server --user default --user default} err assert_match {*Duplicate user*} $err } {} {external:skip} } diff --git a/tests/unit/cluster/cli.tcl b/tests/unit/cluster/cli.tcl index e96b3bcef0..136984da88 100644 --- a/tests/unit/cluster/cli.tcl +++ b/tests/unit/cluster/cli.tcl @@ -20,7 +20,7 @@ start_multiple_servers 3 [list overrides $base_conf] { set node3_rd [redis_deferring_client -2] test {Create 3 node cluster} { - exec src/placeholderkv-cli --cluster-yes --cluster create \ + exec src/valkey-cli --cluster-yes --cluster create \ 127.0.0.1:[srv 0 port] \ 127.0.0.1:[srv -1 port] \ 127.0.0.1:[srv -2 port] @@ -47,7 +47,7 @@ start_multiple_servers 3 [list overrides $base_conf] { } test "Perform a Resharding" { - exec src/placeholderkv-cli --cluster-yes --cluster reshard 127.0.0.1:[srv -2 port] \ + exec src/valkey-cli --cluster-yes --cluster reshard 127.0.0.1:[srv -2 port] \ --cluster-to [$node1 cluster myid] \ --cluster-from [$node3 cluster myid] \ --cluster-slots 1 @@ -68,9 +68,9 @@ start_multiple_servers 3 [list overrides $base_conf] { # waiting for cluster_state to be okay is an independent check that all the # nodes actually believe each other are healthy, prevent cluster down error. wait_for_condition 1000 50 { - [catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv 0 port]}] == 0 && - [catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -1 port]}] == 0 && - [catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -2 port]}] == 0 && + [catch {exec src/valkey-cli --cluster check 127.0.0.1:[srv 0 port]}] == 0 && + [catch {exec src/valkey-cli --cluster check 127.0.0.1:[srv -1 port]}] == 0 && + [catch {exec src/valkey-cli --cluster check 127.0.0.1:[srv -2 port]}] == 0 && [CI 0 cluster_state] eq {ok} && [CI 1 cluster_state] eq {ok} && [CI 2 cluster_state] eq {ok} @@ -92,8 +92,8 @@ start_multiple_servers 3 [list overrides $base_conf] { assert_error "*MOVED $slot_for_foo :*" {$node1 set foo bar} # when in cluster mode, redirect using previous hostip - assert_equal "[exec src/placeholderkv-cli -h 127.0.0.1 -p [srv 0 port] -c set foo bar]" {OK} - assert_match "[exec src/placeholderkv-cli -h 127.0.0.1 -p [srv 0 port] -c get foo]" {bar} + assert_equal "[exec src/valkey-cli -h 127.0.0.1 -p [srv 0 port] -c set foo bar]" {OK} + assert_match "[exec src/valkey-cli -h 127.0.0.1 -p [srv 0 port] -c get foo]" {bar} assert_equal [$node1 CONFIG SET cluster-preferred-endpoint-type "$endpoint_type_before_set"] {OK} } @@ -164,7 +164,7 @@ start_multiple_servers 5 [list overrides $base_conf] { set node5_rd [redis_client -4] test {Functions are added to new node on redis-cli cluster add-node} { - exec src/placeholderkv-cli --cluster-yes --cluster create \ + exec src/valkey-cli --cluster-yes --cluster create \ 127.0.0.1:[srv 0 port] \ 127.0.0.1:[srv -1 port] \ 127.0.0.1:[srv -2 port] @@ -179,13 +179,13 @@ start_multiple_servers 5 [list overrides $base_conf] { } # upload a function to all the cluster - exec src/placeholderkv-cli --cluster-yes --cluster call 127.0.0.1:[srv 0 port] \ + exec src/valkey-cli --cluster-yes --cluster call 127.0.0.1:[srv 0 port] \ FUNCTION LOAD {#!lua name=TEST redis.register_function('test', function() return 'hello' end) } # adding node to the cluster - exec src/placeholderkv-cli --cluster-yes --cluster add-node \ + exec src/valkey-cli --cluster-yes --cluster add-node \ 127.0.0.1:[srv -3 port] \ 127.0.0.1:[srv 0 port] @@ -213,7 +213,7 @@ start_multiple_servers 5 [list overrides $base_conf] { # adding node 5 to the cluster should failed because it already contains the 'test' function catch { - exec src/placeholderkv-cli --cluster-yes --cluster add-node \ + exec src/valkey-cli --cluster-yes --cluster add-node \ 127.0.0.1:[srv -4 port] \ 127.0.0.1:[srv 0 port] } e @@ -227,7 +227,7 @@ test {Migrate the last slot away from a node using redis-cli} { start_multiple_servers 4 [list overrides $base_conf] { # Create a cluster of 3 nodes - exec src/placeholderkv-cli --cluster-yes --cluster create \ + exec src/valkey-cli --cluster-yes --cluster create \ 127.0.0.1:[srv 0 port] \ 127.0.0.1:[srv -1 port] \ 127.0.0.1:[srv -2 port] @@ -241,11 +241,11 @@ test {Migrate the last slot away from a node using redis-cli} { } # Insert some data - assert_equal OK [exec src/placeholderkv-cli -c -p [srv 0 port] SET foo bar] - set slot [exec src/placeholderkv-cli -c -p [srv 0 port] CLUSTER KEYSLOT foo] + assert_equal OK [exec src/valkey-cli -c -p [srv 0 port] SET foo bar] + set slot [exec src/valkey-cli -c -p [srv 0 port] CLUSTER KEYSLOT foo] # Add new node to the cluster - exec src/placeholderkv-cli --cluster-yes --cluster add-node \ + exec src/valkey-cli --cluster-yes --cluster add-node \ 127.0.0.1:[srv -3 port] \ 127.0.0.1:[srv 0 port] @@ -283,10 +283,10 @@ test {Migrate the last slot away from a node using redis-cli} { # Using --cluster check make sure we won't get `Not all slots are covered by nodes`. # Wait for the cluster to become stable make sure the cluster is up during MIGRATE. wait_for_condition 1000 50 { - [catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv 0 port]}] == 0 && - [catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -1 port]}] == 0 && - [catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -2 port]}] == 0 && - [catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -3 port]}] == 0 && + [catch {exec src/valkey-cli --cluster check 127.0.0.1:[srv 0 port]}] == 0 && + [catch {exec src/valkey-cli --cluster check 127.0.0.1:[srv -1 port]}] == 0 && + [catch {exec src/valkey-cli --cluster check 127.0.0.1:[srv -2 port]}] == 0 && + [catch {exec src/valkey-cli --cluster check 127.0.0.1:[srv -3 port]}] == 0 && [CI 0 cluster_state] eq {ok} && [CI 1 cluster_state] eq {ok} && [CI 2 cluster_state] eq {ok} && @@ -296,7 +296,7 @@ test {Migrate the last slot away from a node using redis-cli} { } # Move the only slot back to original node using redis-cli - exec src/placeholderkv-cli --cluster reshard 127.0.0.1:[srv -3 port] \ + exec src/valkey-cli --cluster reshard 127.0.0.1:[srv -3 port] \ --cluster-from $newnode_id \ --cluster-to $owner_id \ --cluster-slots 1 \ @@ -341,7 +341,7 @@ start_server [list overrides [list cluster-enabled yes cluster-node-timeout 1 cl # The last two are used to test --cluster add-node test "redis-cli -4 --cluster create using $ip_or_localhost with cluster-port" { - exec src/placeholderkv-cli -4 --cluster-yes --cluster create \ + exec src/valkey-cli -4 --cluster-yes --cluster create \ $ip_or_localhost:[srv 0 port] \ $ip_or_localhost:[srv -1 port] \ $ip_or_localhost:[srv -2 port] @@ -362,7 +362,7 @@ start_server [list overrides [list cluster-enabled yes cluster-node-timeout 1 cl test "redis-cli -4 --cluster add-node using $ip_or_localhost with cluster-port" { # Adding node to the cluster (without cluster-port) - exec src/placeholderkv-cli -4 --cluster-yes --cluster add-node \ + exec src/valkey-cli -4 --cluster-yes --cluster add-node \ $ip_or_localhost:[srv -3 port] \ $ip_or_localhost:[srv 0 port] @@ -378,7 +378,7 @@ start_server [list overrides [list cluster-enabled yes cluster-node-timeout 1 cl } # Adding node to the cluster (with cluster-port) - exec src/placeholderkv-cli -4 --cluster-yes --cluster add-node \ + exec src/valkey-cli -4 --cluster-yes --cluster add-node \ $ip_or_localhost:[srv -4 port] \ $ip_or_localhost:[srv 0 port] diff --git a/tests/unit/introspection.tcl b/tests/unit/introspection.tcl index 391a1f6453..8e077992f3 100644 --- a/tests/unit/introspection.tcl +++ b/tests/unit/introspection.tcl @@ -708,44 +708,44 @@ start_server {tags {"introspection"}} { test {redis-server command line arguments - error cases} { # Take '--invalid' as the option. - catch {exec src/placeholderkv-server --invalid} err + catch {exec src/valkey-server --invalid} err assert_match {*Bad directive or wrong number of arguments*} $err - catch {exec src/placeholderkv-server --port} err + catch {exec src/valkey-server --port} err assert_match {*'port'*wrong number of arguments*} $err - catch {exec src/placeholderkv-server --port 6380 --loglevel} err + catch {exec src/valkey-server --port 6380 --loglevel} err assert_match {*'loglevel'*wrong number of arguments*} $err # Take `6379` and `6380` as the port option value. - catch {exec src/placeholderkv-server --port 6379 6380} err + catch {exec src/valkey-server --port 6379 6380} err assert_match {*'port "6379" "6380"'*wrong number of arguments*} $err # Take `--loglevel` and `verbose` as the port option value. - catch {exec src/placeholderkv-server --port --loglevel verbose} err + catch {exec src/valkey-server --port --loglevel verbose} err assert_match {*'port "--loglevel" "verbose"'*wrong number of arguments*} $err # Take `--bla` as the port option value. - catch {exec src/placeholderkv-server --port --bla --loglevel verbose} err + catch {exec src/valkey-server --port --bla --loglevel verbose} err assert_match {*'port "--bla"'*argument couldn't be parsed into an integer*} $err # Take `--bla` as the loglevel option value. - catch {exec src/placeholderkv-server --logfile --my--log--file --loglevel --bla} err + catch {exec src/valkey-server --logfile --my--log--file --loglevel --bla} err assert_match {*'loglevel "--bla"'*argument(s) must be one of the following*} $err # Using MULTI_ARG's own check, empty option value - catch {exec src/placeholderkv-server --shutdown-on-sigint} err + catch {exec src/valkey-server --shutdown-on-sigint} err assert_match {*'shutdown-on-sigint'*argument(s) must be one of the following*} $err - catch {exec src/placeholderkv-server --shutdown-on-sigint "now force" --shutdown-on-sigterm} err + catch {exec src/valkey-server --shutdown-on-sigint "now force" --shutdown-on-sigterm} err assert_match {*'shutdown-on-sigterm'*argument(s) must be one of the following*} $err # Something like `redis-server --some-config --config-value1 --config-value2 --loglevel debug` would break, # because if you want to pass a value to a config starting with `--`, it can only be a single value. - catch {exec src/placeholderkv-server --replicaof 127.0.0.1 abc} err + catch {exec src/valkey-server --replicaof 127.0.0.1 abc} err assert_match {*'replicaof "127.0.0.1" "abc"'*Invalid master port*} $err - catch {exec src/placeholderkv-server --replicaof --127.0.0.1 abc} err + catch {exec src/valkey-server --replicaof --127.0.0.1 abc} err assert_match {*'replicaof "--127.0.0.1" "abc"'*Invalid master port*} $err - catch {exec src/placeholderkv-server --replicaof --127.0.0.1 --abc} err + catch {exec src/valkey-server --replicaof --127.0.0.1 --abc} err assert_match {*'replicaof "--127.0.0.1"'*wrong number of arguments*} $err } {} {external:skip} diff --git a/tests/unit/moduleapi/cluster.tcl b/tests/unit/moduleapi/cluster.tcl index 1d1b2df799..4c0a49d48d 100644 --- a/tests/unit/moduleapi/cluster.tcl +++ b/tests/unit/moduleapi/cluster.tcl @@ -43,7 +43,7 @@ start_cluster 3 0 [list config_lines $modules] { test "Perform a Resharding" { - exec src/placeholderkv-cli --cluster-yes --cluster reshard 127.0.0.1:[srv -2 port] \ + exec src/valkey-cli --cluster-yes --cluster reshard 127.0.0.1:[srv -2 port] \ --cluster-to [$node1 cluster myid] \ --cluster-from [$node3 cluster myid] \ --cluster-slots 1 @@ -69,9 +69,9 @@ start_cluster 3 0 [list config_lines $modules] { test "Wait for cluster to be stable" { wait_for_condition 1000 50 { - [catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv 0 port]}] == 0 && - [catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -1 port]}] == 0 && - [catch {exec src/placeholderkv-cli --cluster check 127.0.0.1:[srv -2 port]}] == 0 && + [catch {exec src/valkey-cli --cluster check 127.0.0.1:[srv 0 port]}] == 0 && + [catch {exec src/valkey-cli --cluster check 127.0.0.1:[srv -1 port]}] == 0 && + [catch {exec src/valkey-cli --cluster check 127.0.0.1:[srv -2 port]}] == 0 && [CI 0 cluster_state] eq {ok} && [CI 1 cluster_state] eq {ok} && [CI 2 cluster_state] eq {ok} diff --git a/tests/unit/moduleapi/moduleconfigs.tcl b/tests/unit/moduleapi/moduleconfigs.tcl index 56dc5e9033..44f994d2d0 100644 --- a/tests/unit/moduleapi/moduleconfigs.tcl +++ b/tests/unit/moduleapi/moduleconfigs.tcl @@ -221,15 +221,15 @@ start_server {tags {"modules"}} { } test {startup moduleconfigs} { # No loadmodule directive - catch {exec src/placeholderkv-server --moduleconfigs.string "hello"} err + catch {exec src/valkey-server --moduleconfigs.string "hello"} err assert_match {*Module Configuration detected without loadmodule directive or no ApplyConfig call: aborting*} $err # Bad config value - catch {exec src/placeholderkv-server --loadmodule "$testmodule" --moduleconfigs.string "rejectisfreed"} err + catch {exec src/valkey-server --loadmodule "$testmodule" --moduleconfigs.string "rejectisfreed"} err assert_match {*Issue during loading of configuration moduleconfigs.string : Cannot set string to 'rejectisfreed'*} $err # missing LoadConfigs call - catch {exec src/placeholderkv-server --loadmodule "$testmodule" noload --moduleconfigs.string "hello"} err + catch {exec src/valkey-server --loadmodule "$testmodule" noload --moduleconfigs.string "hello"} err assert_match {*Module Configurations were not set, likely a missing LoadConfigs call. Unloading the module.*} $err # successful diff --git a/tests/unit/other.tcl b/tests/unit/other.tcl index 8658071548..b364fc74a7 100644 --- a/tests/unit/other.tcl +++ b/tests/unit/other.tcl @@ -403,7 +403,7 @@ start_server {tags {"other external:skip"}} { set cmdline [read_proc_title [srv 0 pid]] assert_equal "TEST" [lindex $cmdline 0] - assert_match "*/placeholderkv-server" [lindex $cmdline 1] + assert_match "*/valkey-server" [lindex $cmdline 1] if {$::tls} { set expect_port [srv 0 pport] diff --git a/utils/generate-commands-json.py b/utils/generate-commands-json.py index 4cd95ffd9b..59957b9f1f 100755 --- a/utils/generate-commands-json.py +++ b/utils/generate-commands-json.py @@ -103,7 +103,7 @@ def convert_entry_to_objects_array(cmd, docs): if __name__ == '__main__': opts = { 'description': 'Transform the output from `redis-cli --json` using COMMAND and COMMAND DOCS to a single commands.json format.', - 'epilog': f'Usage example: {argv[0]} --cli src/placeholderkv-cli --port 6379 > commands.json' + 'epilog': f'Usage example: {argv[0]} --cli src/valkey-cli --port 6379 > commands.json' } parser = argparse.ArgumentParser(**opts) parser.add_argument('--host', type=str, default='localhost') From 1fa8da3359c76ef713a46e47933cbe2ce4309249 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Fri, 29 Mar 2024 10:34:07 +0800 Subject: [PATCH 06/49] Rename functionsLibMataData to functionsLibMetaData (#71) Signed-off-by: John Vandenberg --- src/functions.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/functions.c b/src/functions.c index 646ef63084..bee5ce232b 100644 --- a/src/functions.c +++ b/src/functions.c @@ -59,11 +59,11 @@ struct functionsLibCtx { dict *engines_stats; /* Per engine statistics */ }; -typedef struct functionsLibMataData { +typedef struct functionsLibMetaData { sds engine; sds name; sds code; -} functionsLibMataData; +} functionsLibMetaData; dictType engineDictType = { dictSdsCaseHash, /* hash function */ @@ -886,7 +886,7 @@ static int functionsVerifyName(sds name) { return C_OK; } -int functionExtractLibMetaData(sds payload, functionsLibMataData *md, sds *err) { +int functionExtractLibMetaData(sds payload, functionsLibMetaData *md, sds *err) { sds name = NULL; sds engine = NULL; if (strncmp(payload, "#!", 2) != 0) { @@ -945,7 +945,7 @@ int functionExtractLibMetaData(sds payload, functionsLibMataData *md, sds *err) return C_ERR; } -void functionFreeLibMetaData(functionsLibMataData *md) { +void functionFreeLibMetaData(functionsLibMetaData *md) { if (md->code) sdsfree(md->code); if (md->name) sdsfree(md->name); if (md->engine) sdsfree(md->engine); @@ -958,7 +958,7 @@ sds functionsCreateWithLibraryCtx(sds code, int replace, sds* err, functionsLibC dictEntry *entry = NULL; functionLibInfo *new_li = NULL; functionLibInfo *old_li = NULL; - functionsLibMataData md = {0}; + functionsLibMetaData md = {0}; if (functionExtractLibMetaData(code, &md, err) != C_OK) { return NULL; } From 9be3a1d5aba7cff8fa7561188504a5d070bdf720 Mon Sep 17 00:00:00 2001 From: Vitah Lin Date: Fri, 29 Mar 2024 23:25:51 +0800 Subject: [PATCH 07/49] Fix renameing names in SECURITY.md (#74) Signed-off-by: Vitah Lin --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index 79437a9bfc..285b6d3d62 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,6 +1,6 @@ # Security Policy -PlaceHolderKV is under development, more information will become available. +Valkey is under development, more information will become available. ## Reporting a Vulnerability From 1950acd1e2b8c2282d51e528377f6e564eb447cd Mon Sep 17 00:00:00 2001 From: Ping Xie Date: Fri, 29 Mar 2024 10:38:13 -0700 Subject: [PATCH 08/49] Fix remaining names in CONTRIBUTING.md (#70) Signed-off-by: Ping Xie --- .gitignore | 1 + CONTRIBUTING.md | 35 ++++++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index c9ea5d33c4..fa53b69d67 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ Makefile.dep .ccls-cache/* compile_commands.json redis.code-workspace +.cache diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 548204eb83..ad257664c5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,14 +1,14 @@ -Note: by contributing code to the Redis project in any form, including sending +Note: by contributing code to the Valkey project in any form, including sending a pull request via GitHub, a code fragment or patch via private email or public discussion groups, you agree to release your code under the terms -of the Redis license that you can find in the COPYING file included in the Redis +of the Valkey license that you can find in the COPYING file included in the Valkey source distribution. -# IMPORTANT: HOW TO USE REDIS GITHUB ISSUES +# IMPORTANT: HOW TO USE VALKEY GITHUB ISSUES GitHub issues SHOULD ONLY BE USED to report bugs and for DETAILED feature requests. Everything else should be asked on Discord: - + https://discord.gg/zbcPa5umUB PLEASE DO NOT POST GENERAL QUESTIONS that are not about bugs or suspected @@ -27,9 +27,14 @@ If you are reporting a security bug or vulnerability, see SECURITY.md. ## Developer Certificate of Origin -We respect the intellectual property rights of others and we want to make sure all incoming contributions are correctly attributed and licensed. A Developer Certificate of Origin (DCO) is a lightweight mechanism to do that. The DCO is a declaration attached to every commit. In the commit message of the contribution, the developer simply adds a `Signed-off-by` statement and thereby agrees to the DCO, which you can find below or at [DeveloperCertificate.org](http://developercertificate.org/). +We respect the intellectual property rights of others and we want to make sure +all incoming contributions are correctly attributed and licensed. A Developer +Certificate of Origin (DCO) is a lightweight mechanism to do that. The DCO is +a declaration attached to every commit. In the commit message of the contribution, +the developer simply adds a `Signed-off-by` statement and thereby agrees to the DCO, +which you can find below or at [DeveloperCertificate.org](http://developercertificate.org/). -``` +```text Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: @@ -56,14 +61,21 @@ By making a contribution to this project, I certify that: sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. - ``` +``` -We require that every contribution to Valkey to be signed with a DCO. We require the usage of known identity (such as a real or preferred name). We do not accept anonymous contributors nor those utilizing pseudonyms. A DCO signed commit will contain a line like: +We require that every contribution to Valkey to be signed with a DCO. We require the +usage of known identity (such as a real or preferred name). We do not accept anonymous +contributors nor those utilizing pseudonyms. A DCO signed commit will contain a line like: -``` + +```text Signed-off-by: Jane Smith ``` -You may type this line on your own when writing your commit messages. However, if your user.name and user.email are set in your git configs, you can use `git commit` with `-s` or `--signoff` to add the `Signed-off-by` line to the end of the commit message. We also require revert commits to include a DCO. + +You may type this line on your own when writing your commit messages. However, if your +user.name and user.email are set in your git configs, you can use `git commit` with `-s` +or `--signoff` to add the `Signed-off-by` line to the end of the commit message. We also +require revert commits to include a DCO. # How to provide a patch for a new feature @@ -74,7 +86,8 @@ and creating an issue at Github with the description of, exactly, what you want to accomplish and why. Use cases are important for features to be accepted. Here you can see if there is consensus about your idea. -2. If in step 1 you get an acknowledgment from the project leaders, use the following procedure to submit a patch: +2. If in step 1 you get an acknowledgment from the project leaders, use the following +procedure to submit a patch: 1. Fork Valkey on GitHub ( https://docs.github.com/en/github/getting-started-with-github/fork-a-repo ) 1. Create a topic branch (git checkout -b my_branch) 1. Make the needed changes and commit with a DCO. (git commit -s) From 289eb47eb96d30f08543d721880fe99b623abd48 Mon Sep 17 00:00:00 2001 From: Mikel Olasagasti Uranga Date: Sat, 30 Mar 2024 14:23:50 +0100 Subject: [PATCH 09/49] Replace offensive term (#86) Signed-off-by: Mikel Olasagasti Uranga --- Makefile | 2 +- deps/linenoise/linenoise.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e614ede891..5c16c36eba 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# Top level makefile, the real shit is at src/Makefile +# Top level makefile, the real magic is at src/Makefile default: all diff --git a/deps/linenoise/linenoise.c b/deps/linenoise/linenoise.c index 75306390ec..36d266f891 100644 --- a/deps/linenoise/linenoise.c +++ b/deps/linenoise/linenoise.c @@ -233,7 +233,7 @@ static int isUnsupportedTerm(void) { return 0; } -/* Raw mode: 1960 magic shit. */ +/* Raw mode: 1960's magic. */ static int enableRawMode(int fd) { struct termios raw; From 3ab066f71002de28025a7b28af4e90310294e40e Mon Sep 17 00:00:00 2001 From: Roshan Khatri <117414976+roshkhatri@users.noreply.github.com> Date: Sat, 30 Mar 2024 07:42:00 -0700 Subject: [PATCH 10/49] For additional compatibility this adds REDIS_CFLAGS and REDIS_LDFLAGS support to MAKEFILE (#66) This resolves (1.viii) from https://github.com/valkey-io/valkey/issues/43 > REDIS_FLAGS will be updated to SERVER_FLAGS. Maybe we should also allow REDIS_FLAGS -> SERVER_FLAGS as well, for an extra layer of compatibility. --------- Signed-off-by: Roshan Khatri --- src/Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index f762e2912c..e8d6fcca37 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,12 +1,12 @@ -# Redis Makefile +# Valkey Makefile # Copyright (C) 2009 Salvatore Sanfilippo # This file is released under the BSD license, see the COPYING file # # The Makefile composes the final FINAL_CFLAGS and FINAL_LDFLAGS using -# what is needed for Redis plus the standard CFLAGS and LDFLAGS passed. +# what is needed for Valkey plus the standard CFLAGS and LDFLAGS passed. # However when building the dependencies (Jemalloc, Lua, Hiredis, ...) # CFLAGS and LDFLAGS are propagated to the dependencies, so to pass -# flags only to be used when compiling / linking Redis itself SERVER_CFLAGS +# flags only to be used when compiling / linking Valkey itself SERVER_CFLAGS # and SERVER_LDFLAGS are used instead (this is the case of 'make gcov'). # # Dependencies are stored in the Makefile.dep file. To rebuild this file @@ -76,7 +76,7 @@ ifeq ($(uname_S),Linux) MALLOC=jemalloc endif -# To get ARM stack traces if Redis crashes we need a special C flag. +# To get ARM stack traces if Valkey crashes we need a special C flag. ifneq (,$(filter aarch64 armv%,$(uname_M))) CFLAGS+=-funwind-tables endif @@ -122,6 +122,14 @@ endif # Override default settings if possible -include .make-settings +# For added compatibility REDIS_CFLAGS and REDIS_LDFLAGS are also supported. +ifdef REDIS_CFLAGS + SERVER_CFLAGS := $(REDIS_CFLAGS) +endif +ifdef REDIS_LDFLAGS + SERVER_LDFLAGS := $(REDIS_LDFLAGS) +endif + FINAL_CFLAGS=$(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(SERVER_CFLAGS) FINAL_LDFLAGS=$(LDFLAGS) $(OPT) $(SERVER_LDFLAGS) $(DEBUG) FINAL_LIBS=-lm From de311aea53fa2fd039ae4f7652150e2166dfbaea Mon Sep 17 00:00:00 2001 From: Vitah Lin Date: Sat, 30 Mar 2024 23:24:21 +0800 Subject: [PATCH 11/49] Doc add SECURITY.md link inside CONTRIBUTING.md (#96) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Vitah Lin Signed-off-by: Viktor Söderqvist --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad257664c5..5969bce874 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ Issues and pull requests for documentation belong on the valkey-doc repo: https://github.com/valkey-io/valkey-doc -If you are reporting a security bug or vulnerability, see SECURITY.md. +If you are reporting a security bug or vulnerability, see [SECURITY.md](SECURITY.md). ## Developer Certificate of Origin From b2a397366b1704b03f5042395ff620cd2096f598 Mon Sep 17 00:00:00 2001 From: ranshid <88133677+ranshid@users.noreply.github.com> Date: Sat, 30 Mar 2024 21:50:16 +0300 Subject: [PATCH 12/49] Change ascii logo with temporal valkey logo (#77) --- src/asciilogo.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/asciilogo.h b/src/asciilogo.h index a62f68cf94..baa55e3fb2 100644 --- a/src/asciilogo.h +++ b/src/asciilogo.h @@ -28,20 +28,20 @@ */ const char *ascii_logo = -" _._ \n" -" _.-``__ ''-._ \n" -" _.-`` `. `_. ''-._ Redis %s (%s/%d) %s bit\n" -" .-`` .-```. ```\\/ _.,_ ''-._ \n" -" ( ' , .-` | `, ) Running in %s mode\n" -" |`-._`-...-` __...-.``-._|'` _.-'| Port: %d\n" -" | `-._ `._ / _.-' | PID: %ld\n" -" `-._ `-._ `-./ _.-' _.-' \n" -" |`-._`-._ `-.__.-' _.-'_.-'| \n" -" | `-._`-._ _.-'_.-' | https://redis.io \n" -" `-._ `-._`-.__.-'_.-' _.-' \n" -" |`-._`-._ `-.__.-' _.-'_.-'| \n" -" | `-._`-._ _.-'_.-' | \n" -" `-._ `-._`-.__.-'_.-' _.-' \n" -" `-._ `-.__.-' _.-' \n" -" `-._ _.-' \n" -" `-.__.-' \n\n"; +" ___ ___ \n" +" ( ) ( ) \n" +" ___ ___ .---. | | | | ___ .--. ___ ___ \n" +"( )( ) / .-, \\ | | | | ( ) / \\ ( )( ) Valkey %s (%s/%d) %s bit \n" +" | | | | (__) ; | | | | | ' / | .-. ; | | | | \n" +" | | | | .'` | | | | |,' / | | | | | | | | Running in %s mode \n" +" | | | | / .'| | | | | . '. | |/ | | ' | | Port: %d \n" +" | | | | | / | | | | | | `. \\ | ' _.' ' `-' | PID: %ld \n" +" ' ' ; ' ; | ; | | | | | \\ \\ | .'.-. `.__. | \n" +" \\ `' / ' `-' | | | | | \\ . ' `-' / ___ | | \n" +" '_.' `.__.'_. (___) (___ ) (___) `.__.' ( )' | https://valkey.io\n" +" ; `-' ' \n" +" .__.' \n" +" \n" +" \n\n"; + + From af1b0de92de2ace4a01e74cf9ed7d7d6f3dedf70 Mon Sep 17 00:00:00 2001 From: Cong Chen Date: Sun, 31 Mar 2024 13:11:13 +0800 Subject: [PATCH 13/49] Fix typo (#84) A simple PR to fix a typo. Signed-off-by: Cong Chen --- src/acl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acl.c b/src/acl.c index 26827f97a0..81f8b38499 100644 --- a/src/acl.c +++ b/src/acl.c @@ -635,7 +635,7 @@ void ACLSelectorRemoveCommandRule(aclSelector *selector, sds new_rule) { sdsupdatelen(selector->command_rules); } -/* This function is resopnsible for updating the command_rules struct so that relative ordering of +/* This function is responsible for updating the command_rules struct so that relative ordering of * commands and categories is maintained and can be reproduced without loss. */ void ACLUpdateCommandRules(aclSelector *selector, const char *rule, int allow) { sds new_rule = sdsnew(rule); From 253fe9dcedbab88bd2f3d85b3be7a5d037c4a4a5 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Mon, 1 Apr 2024 03:38:22 +0800 Subject: [PATCH 14/49] Fix typos and replace 'codespell' with 'typos' (#72) Uses https://github.com/taiki-e/install-action to install https://github.com/crate-ci/typos in CI This finds many more/different typos than https://github.com/codespell-project/codespell , while having very few false positives. Signed-off-by: John Vandenberg --- .codespell/.codespellrc | 5 -- .codespell/requirements.txt | 1 - .codespell/wordlist.txt | 21 --------- .config/typos.toml | 61 +++++++++++++++++++++++++ .github/dependabot.yml | 6 +-- .github/workflows/spell-check.yml | 13 ++---- src/atomicvar.h | 2 +- src/script_lua.h | 2 +- src/server.c | 4 +- src/server.h | 4 +- src/util.c | 2 +- tests/assets/test_cli_hint_suite.txt | 2 +- tests/integration/rdb.tcl | 2 +- tests/modules/fork.c | 8 ++-- tests/support/response_transformers.tcl | 52 ++++++++++----------- tests/unit/acl.tcl | 6 +-- tests/unit/moduleapi/misc.tcl | 2 +- tests/unit/multi.tcl | 6 +-- tests/unit/type/stream-cgroups.tcl | 2 +- tests/unit/type/zset.tcl | 2 +- 20 files changed, 114 insertions(+), 89 deletions(-) delete mode 100644 .codespell/.codespellrc delete mode 100644 .codespell/requirements.txt delete mode 100644 .codespell/wordlist.txt create mode 100644 .config/typos.toml diff --git a/.codespell/.codespellrc b/.codespell/.codespellrc deleted file mode 100644 index 75b9257429..0000000000 --- a/.codespell/.codespellrc +++ /dev/null @@ -1,5 +0,0 @@ -[codespell] -quiet-level = 2 -count = -skip = ./deps,./src/crc16_slottable.h,tmp*,./.git,./lcov-html -ignore-words = ./.codespell/wordlist.txt diff --git a/.codespell/requirements.txt b/.codespell/requirements.txt deleted file mode 100644 index ddff454685..0000000000 --- a/.codespell/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -codespell==2.2.5 diff --git a/.codespell/wordlist.txt b/.codespell/wordlist.txt deleted file mode 100644 index 0bc0beb1ee..0000000000 --- a/.codespell/wordlist.txt +++ /dev/null @@ -1,21 +0,0 @@ -ake -bale -fle -fo -gameboy -mutli -nd -nees -oll -optin -ot -smove -te -tre -cancelability -ist -statics -filetest -ro -exat -clen \ No newline at end of file diff --git a/.config/typos.toml b/.config/typos.toml new file mode 100644 index 0000000000..e810af9a14 --- /dev/null +++ b/.config/typos.toml @@ -0,0 +1,61 @@ +# See https://github.com/crate-ci/typos/blob/master/docs/reference.md to configure typos + +[files] +extend-exclude = [ + "deps/", + # crc16_slottable is primarily pre-generated random strings. + "src/crc16_slottable.h", +] + +[default.extend-words] +exat = "exat" +optin = "optin" +smove = "smove" + +[type.c] +extend-ignore-re = [ + "BA3E2571", # sha1.c + "D4C4DAA4", # sha1.c + "Georg Nees", + "\\[l\\]ist", # eval.c +] + +[type.tcl] +extend-ignore-re = [ + "DUMPed", +] + +[type.sv.extend-identifiers] +# sv = .h +module_gil_acquring = "module_gil_acquring" + +[type.c.extend-identifiers] +clen = "clen" +fle = "fle" +module_gil_acquring = "module_gil_acquring" +nd = "nd" +ot = "ot" + +[type.tcl.extend-identifiers] +fo = "fo" +oll = "oll" +stressers = "stressers" + +[type.sv.extend-words] +# sv = .h +fo = "fo" +seeked = "seeked" + +[type.c.extend-words] +fo = "fo" +limite = "limite" +seeked = "seeked" +tre = "tre" + +[type.systemd.extend-words] +# systemd = .conf +ake = "ake" + +[type.tcl.extend-words] +fo = "fo" +tre = "tre" diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f00019d2ec..376c4171a6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,14 +2,10 @@ # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - +--- version: 2 updates: - package-ecosystem: github-actions directory: / schedule: interval: weekly - - package-ecosystem: pip - directory: /.codespell - schedule: - interval: weekly diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index 77f5437ca2..dfbb33008d 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -18,15 +18,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: pip cache - uses: actions/cache@v4 + - name: Install typos + uses: taiki-e/install-action@v2 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: ${{ runner.os }}-pip- - - - name: Install prerequisites - run: sudo pip install -r ./.codespell/requirements.txt + tool: typos - name: Spell check - run: codespell --config=./.codespell/.codespellrc + run: typos --config=./.config/typos.toml diff --git a/src/atomicvar.h b/src/atomicvar.h index 1cbfd5b9df..bcabdccc58 100644 --- a/src/atomicvar.h +++ b/src/atomicvar.h @@ -32,7 +32,7 @@ * (if the flag was 0 -> set to 1, if it's already 1 -> do nothing, but the final result is that the flag is set), * and also it has a full barrier (__sync_lock_test_and_set has acquire barrier). * - * NOTE2: Unlike other atomic type, which aren't guaranteed to be lock free, c11 atmoic_flag does. + * NOTE2: Unlike other atomic type, which aren't guaranteed to be lock free, c11 atomic_flag does. * To check whether a type is lock free, atomic_is_lock_free() can be used. * It can be considered to limit the flag type to atomic_flag to improve performance. * diff --git a/src/script_lua.h b/src/script_lua.h index 4c2b34804e..fc665a1c65 100644 --- a/src/script_lua.h +++ b/src/script_lua.h @@ -36,7 +36,7 @@ * * * Execute Lua code, assuming that the code is located on * the top of the Lua stack. In addition, parsing the execution - * result and convert it to the resp and reply ot the client. + * result and convert it to the resp and reply to the client. * * * Run Redis commands from within the Lua code (Including * parsing the reply and create a Lua object out of it). diff --git a/src/server.c b/src/server.c index 221ab00365..999d799cab 100644 --- a/src/server.c +++ b/src/server.c @@ -2575,7 +2575,7 @@ void resetServerStats(void) { } /* Make the thread killable at any time, so that kill threads functions - * can work reliably (default cancelability type is PTHREAD_CANCEL_DEFERRED). + * can work reliably (default cancellability type is PTHREAD_CANCEL_DEFERRED). * Needed for pthread_cancel used by the fast memory test used by the crash report. */ void makeThreadKillable(void) { pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); @@ -6580,7 +6580,7 @@ void dismissClientMemory(client *c) { /* In the child process, we don't need some buffers anymore, and these are * likely to change in the parent when there's heavy write traffic. * We dismiss them right away, to avoid CoW. - * see dismissMemeory(). */ + * see dismissMemory(). */ void dismissMemoryInChild(void) { /* madvise(MADV_DONTNEED) may not work if Transparent Huge Pages is enabled. */ if (server.thp_enabled) return; diff --git a/src/server.h b/src/server.h index 411edadec4..b9dbd65e7e 100644 --- a/src/server.h +++ b/src/server.h @@ -1989,7 +1989,7 @@ struct redisServer { xor of NOTIFY_... flags. */ kvstore *pubsubshard_channels; /* Map shard channels in every slot to list of subscribed clients */ unsigned int pubsub_clients; /* # of clients in Pub/Sub mode */ - unsigned int watching_clients; /* # of clients are wathcing keys */ + unsigned int watching_clients; /* # of clients are watching keys */ /* Cluster */ int cluster_enabled; /* Is cluster enabled? */ int cluster_port; /* Set the cluster port for a node. */ @@ -3432,7 +3432,7 @@ void blockForAofFsync(client *c, mstime_t timeout, long long offset, int numloca void signalDeletedKeyAsReady(redisDb *db, robj *key, int type); void updateStatsOnUnblock(client *c, long blocked_us, long reply_us, int had_errors); void scanDatabaseForDeletedKeys(redisDb *emptied, redisDb *replaced_with); -void totalNumberOfStatefulKeys(unsigned long *blocking_keys, unsigned long *bloking_keys_on_nokey, unsigned long *watched_keys); +void totalNumberOfStatefulKeys(unsigned long *blocking_keys, unsigned long *blocking_keys_on_nokey, unsigned long *watched_keys); void blockedBeforeSleep(void); /* timeout.c -- Blocked clients timeout and connections timeout. */ diff --git a/src/util.c b/src/util.c index 47de1c8d1a..ac17cd187b 100644 --- a/src/util.c +++ b/src/util.c @@ -1631,7 +1631,7 @@ static void test_reclaimFilePageCache(void) { assert(!cache_exist(fd)); unlink(tmpfile); - printf("reclaimFilePageCach test is ok\n"); + printf("reclaimFilePageCache test is ok\n"); } #endif diff --git a/tests/assets/test_cli_hint_suite.txt b/tests/assets/test_cli_hint_suite.txt index 18c1fe07a4..b4a20163fb 100644 --- a/tests/assets/test_cli_hint_suite.txt +++ b/tests/assets/test_cli_hint_suite.txt @@ -36,7 +36,7 @@ # Two-word command with multiple non-token block args: CONFIG SET parameter value [parameter value ...] "CONFIG SET param " "value [parameter value ...]" "CONFIG SET param val " "[parameter value ...]" -"CONFIG SET param val parm2 val2 " "[parameter value ...]" +"CONFIG SET param val param2 val2 " "[parameter value ...]" # Command with nested optional args: ZRANDMEMBER key [count [WITHSCORES]] "ZRANDMEMBER k " "[count [WITHSCORES]]" diff --git a/tests/integration/rdb.tcl b/tests/integration/rdb.tcl index cce21671f8..106fc0b50c 100644 --- a/tests/integration/rdb.tcl +++ b/tests/integration/rdb.tcl @@ -387,7 +387,7 @@ start_server {} { # make sure a write command fails assert_error {MISCONF *} {r set x y} - # repeate with script + # repeat with script assert_error {MISCONF *} {r eval { return redis.call('set','x',1) } 1 x diff --git a/tests/modules/fork.c b/tests/modules/fork.c index d7a0d154f1..cad09d5bb5 100644 --- a/tests/modules/fork.c +++ b/tests/modules/fork.c @@ -11,11 +11,11 @@ #define UNUSED(V) ((void) V) int child_pid = -1; -int exitted_with_code = -1; +int exited_with_code = -1; void done_handler(int exitcode, int bysignal, void *user_data) { child_pid = -1; - exitted_with_code = exitcode; + exited_with_code = exitcode; assert(user_data==(void*)0xdeadbeef); UNUSED(bysignal); } @@ -36,7 +36,7 @@ int fork_create(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) RedisModule_StringToLongLong(argv[1], &code_to_exit_with); RedisModule_StringToLongLong(argv[2], &usleep_us); - exitted_with_code = -1; + exited_with_code = -1; int fork_child_pid = RedisModule_Fork(done_handler, (void*)0xdeadbeef); if (fork_child_pid < 0) { RedisModule_ReplyWithError(ctx, "Fork failed"); @@ -61,7 +61,7 @@ int fork_exitcode(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { UNUSED(argv); UNUSED(argc); - RedisModule_ReplyWithLongLong(ctx, exitted_with_code); + RedisModule_ReplyWithLongLong(ctx, exited_with_code); return REDISMODULE_OK; } diff --git a/tests/support/response_transformers.tcl b/tests/support/response_transformers.tcl index 45b3cf8f2e..c49bbb15c3 100644 --- a/tests/support/response_transformers.tcl +++ b/tests/support/response_transformers.tcl @@ -20,7 +20,7 @@ namespace eval response_transformers {} # Transform a map response into an array of tuples (tuple = array with 2 elements) # Used for XREAD[GROUP] -proc transfrom_map_to_tupple_array {argv response} { +proc transform_map_to_tuple_array {argv response} { set tuparray {} foreach {key val} $response { set tmp {} @@ -32,7 +32,7 @@ proc transfrom_map_to_tupple_array {argv response} { } # Transform an array of tuples to a flat array -proc transfrom_tuple_array_to_flat_array {argv response} { +proc transform_tuple_array_to_flat_array {argv response} { set flatarray {} foreach pair $response { lappend flatarray {*}$pair @@ -42,10 +42,10 @@ proc transfrom_tuple_array_to_flat_array {argv response} { # With HRANDFIELD, we only need to transform the response if the request had WITHVALUES # (otherwise the returned response is a flat array in both RESPs) -proc transfrom_hrandfield_command {argv response} { +proc transform_hrandfield_command {argv response} { foreach ele $argv { if {[string compare -nocase $ele "WITHVALUES"] == 0} { - return [transfrom_tuple_array_to_flat_array $argv $response] + return [transform_tuple_array_to_flat_array $argv $response] } } return $response @@ -53,10 +53,10 @@ proc transfrom_hrandfield_command {argv response} { # With some zset commands, we only need to transform the response if the request had WITHSCORES # (otherwise the returned response is a flat array in both RESPs) -proc transfrom_zset_withscores_command {argv response} { +proc transform_zset_withscores_command {argv response} { foreach ele $argv { if {[string compare -nocase $ele "WITHSCORES"] == 0} { - return [transfrom_tuple_array_to_flat_array $argv $response] + return [transform_tuple_array_to_flat_array $argv $response] } } return $response @@ -64,29 +64,29 @@ proc transfrom_zset_withscores_command {argv response} { # With ZPOPMIN/ZPOPMAX, we only need to transform the response if the request had COUNT (3rd arg) # (otherwise the returned response is a flat array in both RESPs) -proc transfrom_zpopmin_zpopmax {argv response} { +proc transform_zpopmin_zpopmax {argv response} { if {[llength $argv] == 3} { - return [transfrom_tuple_array_to_flat_array $argv $response] + return [transform_tuple_array_to_flat_array $argv $response] } return $response } -set ::trasformer_funcs { - XREAD transfrom_map_to_tupple_array - XREADGROUP transfrom_map_to_tupple_array - HRANDFIELD transfrom_hrandfield_command - ZRANDMEMBER transfrom_zset_withscores_command - ZRANGE transfrom_zset_withscores_command - ZRANGEBYSCORE transfrom_zset_withscores_command - ZRANGEBYLEX transfrom_zset_withscores_command - ZREVRANGE transfrom_zset_withscores_command - ZREVRANGEBYSCORE transfrom_zset_withscores_command - ZREVRANGEBYLEX transfrom_zset_withscores_command - ZUNION transfrom_zset_withscores_command - ZDIFF transfrom_zset_withscores_command - ZINTER transfrom_zset_withscores_command - ZPOPMIN transfrom_zpopmin_zpopmax - ZPOPMAX transfrom_zpopmin_zpopmax +set ::transformer_funcs { + XREAD transform_map_to_tuple_array + XREADGROUP transform_map_to_tuple_array + HRANDFIELD transform_hrandfield_command + ZRANDMEMBER transform_zset_withscores_command + ZRANGE transform_zset_withscores_command + ZRANGEBYSCORE transform_zset_withscores_command + ZRANGEBYLEX transform_zset_withscores_command + ZREVRANGE transform_zset_withscores_command + ZREVRANGEBYSCORE transform_zset_withscores_command + ZREVRANGEBYLEX transform_zset_withscores_command + ZUNION transform_zset_withscores_command + ZDIFF transform_zset_withscores_command + ZINTER transform_zset_withscores_command + ZPOPMIN transform_zpopmin_zpopmax + ZPOPMAX transform_zpopmin_zpopmax } proc ::response_transformers::transform_response_if_needed {id argv response} { @@ -95,11 +95,11 @@ proc ::response_transformers::transform_response_if_needed {id argv response} { } set key [string toupper [lindex $argv 0]] - if {![dict exists $::trasformer_funcs $key]} { + if {![dict exists $::transformer_funcs $key]} { return $response } - set transform [dict get $::trasformer_funcs $key] + set transform [dict get $::transformer_funcs $key] return [$transform $argv $response] } diff --git a/tests/unit/acl.tcl b/tests/unit/acl.tcl index 95b8a376ef..1457b57b77 100644 --- a/tests/unit/acl.tcl +++ b/tests/unit/acl.tcl @@ -666,16 +666,16 @@ start_server {tags {"acl external:skip"}} { for {set j 0} {$j < 10} {incr j} { assert_error "*WRONGPASS*" {r AUTH user1 doo} } - set entry_id_lastest_error [dict get [lindex [r ACL LOG] 0] entry-id] + set entry_id_latest_error [dict get [lindex [r ACL LOG] 0] entry-id] set timestamp_created_updated [dict get [lindex [r ACL LOG] 0] timestamp-created] set timestamp_last_updated_after_update [dict get [lindex [r ACL LOG] 0] timestamp-last-updated] - assert {$entry_id_lastest_error eq $entry_id_initial_error} + assert {$entry_id_latest_error eq $entry_id_initial_error} assert {$timestamp_last_update_original < $timestamp_last_updated_after_update} assert {$timestamp_created_original eq $timestamp_created_updated} r ACL setuser user2 >doo assert_error "*WRONGPASS*" {r AUTH user2 foo} set new_error_entry_id [dict get [lindex [r ACL LOG] 0] entry-id] - assert {$new_error_entry_id eq $entry_id_lastest_error + 1 } + assert {$new_error_entry_id eq $entry_id_latest_error + 1 } } test {ACL LOG shows failed command executions at toplevel} { diff --git a/tests/unit/moduleapi/misc.tcl b/tests/unit/moduleapi/misc.tcl index 78def54772..41f9dd3fa1 100644 --- a/tests/unit/moduleapi/misc.tcl +++ b/tests/unit/moduleapi/misc.tcl @@ -466,7 +466,7 @@ start_server {overrides {save {900 1}} tags {"modules"}} { # rm_call in script mode assert_error {MISCONF *} {r test.rm_call_flags S set x 1} - # repeate with script + # repeat with script assert_error {MISCONF *} {r test.rm_call eval { return redis.call('set','x',1) } 1 x diff --git a/tests/unit/multi.tcl b/tests/unit/multi.tcl index 4e8e807256..85d20ddf38 100644 --- a/tests/unit/multi.tcl +++ b/tests/unit/multi.tcl @@ -553,7 +553,7 @@ start_server {tags {"multi"}} { catch { $r2 exec; } e assert_match {EXECABORT*previous errors*} $e set xx [r get xx] - # make sure that either the whole transcation passed or none of it (we actually expect none) + # make sure that either the whole transaction passed or none of it (we actually expect none) assert { $xx == 1 || $xx == 3} # check that the connection is no longer in multi state set pong [$r2 ping asdf] @@ -578,7 +578,7 @@ start_server {tags {"multi"}} { r script kill after 200 ; # Give some time to Lua to call the hook again... set xx [r get xx] - # make sure that either the whole transcation passed or none of it (we actually expect none) + # make sure that either the whole transaction passed or none of it (we actually expect none) assert { $xx == 1 || $xx == 3} # check that the connection is no longer in multi state set pong [$r2 ping asdf] @@ -603,7 +603,7 @@ start_server {tags {"multi"}} { catch { $r2 exec; } e assert_match {EXECABORT*previous errors*} $e set xx [r get xx] - # make sure that either the whole transcation passed or none of it (we actually expect none) + # make sure that either the whole transaction passed or none of it (we actually expect none) assert { $xx == 1 || $xx == 3} # check that the connection is no longer in multi state set pong [$r2 ping asdf] diff --git a/tests/unit/type/stream-cgroups.tcl b/tests/unit/type/stream-cgroups.tcl index 9b457dc676..a86488a78c 100644 --- a/tests/unit/type/stream-cgroups.tcl +++ b/tests/unit/type/stream-cgroups.tcl @@ -1051,7 +1051,7 @@ start_server { set n_consumers [lindex $grpinfo 3] # All consumers are created via XREADGROUP, regardless of whether they managed - # to read any entries ot not + # to read any entries or not assert_equal $n_consumers 3 $rd close } diff --git a/tests/unit/type/zset.tcl b/tests/unit/type/zset.tcl index dc0554d841..03f451c797 100644 --- a/tests/unit/type/zset.tcl +++ b/tests/unit/type/zset.tcl @@ -289,7 +289,7 @@ start_server {tags {"zset"}} { assert {[r zscore ztmp x] == 25} } - test "ZADD INCR works with a single score-elemenet pair - $encoding" { + test "ZADD INCR works with a single score-element pair - $encoding" { r del ztmp r zadd ztmp 10 x 20 y 30 z catch {r zadd ztmp INCR 15 x 10 y} err From bdd7314f419e07e5ad0b21b0d3e801aef280f902 Mon Sep 17 00:00:00 2001 From: Ping Xie Date: Sun, 31 Mar 2024 19:56:24 -0700 Subject: [PATCH 15/49] Fine-tune ASCII art (#103) --- src/asciilogo.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/asciilogo.h b/src/asciilogo.h index baa55e3fb2..b291ca76bb 100644 --- a/src/asciilogo.h +++ b/src/asciilogo.h @@ -28,17 +28,17 @@ */ const char *ascii_logo = -" ___ ___ \n" +" ___ ___ \n" " ( ) ( ) \n" " ___ ___ .---. | | | | ___ .--. ___ ___ \n" -"( )( ) / .-, \\ | | | | ( ) / \\ ( )( ) Valkey %s (%s/%d) %s bit \n" +"( )( ) / .-, \\ | | | | ( ) / \\ ( )( ) Valkey %s (%s/%d) %s bit \n" " | | | | (__) ; | | | | | ' / | .-. ; | | | | \n" " | | | | .'` | | | | |,' / | | | | | | | | Running in %s mode \n" " | | | | / .'| | | | | . '. | |/ | | ' | | Port: %d \n" " | | | | | / | | | | | | `. \\ | ' _.' ' `-' | PID: %ld \n" -" ' ' ; ' ; | ; | | | | | \\ \\ | .'.-. `.__. | \n" -" \\ `' / ' `-' | | | | | \\ . ' `-' / ___ | | \n" -" '_.' `.__.'_. (___) (___ ) (___) `.__.' ( )' | https://valkey.io\n" +" ' ' ; ' ; | ; | | | | | \\ \\ | .'.-. `.__. | \n" +" \\ `' / ' `-' | | | | | \\ . ' `-' / ___ | | \n" +" \\__/ `.__.'_. (___) (___ ) (___) `.__.' ( )' | https://valkey.io\n" " ; `-' ' \n" " .__.' \n" " \n" From 3630dd08a6d3a7449cef738f965ae2c781f6b29b Mon Sep 17 00:00:00 2001 From: Roshan Khatri <117414976+roshkhatri@users.noreply.github.com> Date: Mon, 1 Apr 2024 09:55:01 -0700 Subject: [PATCH 16/49] Restore all tests state prior to fork (#117) Related to https://github.com/valkey-io/valkey/pull/11#issuecomment-2028930612 Restore all tests state prior to fork and re-enables Daily tests on PRs on release branches. Reverts https://github.com/valkey-io/valkey/commit/2aa820f945a7db9a09203b1f60dfb70662cdd3a6 --------- Signed-off-by: Roshan Khatri --- .github/workflows/daily.yml | 4 ++++ .github/workflows/external.yml | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index f67540b1c1..85ee899bac 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -1,6 +1,10 @@ name: Daily on: + pull_request: + branches: + # any PR to a release branch. + - '[0-9].[0-9]' schedule: - cron: '0 0 * * *' workflow_dispatch: diff --git a/.github/workflows/external.yml b/.github/workflows/external.yml index 0113858fec..8c35d5c88c 100644 --- a/.github/workflows/external.yml +++ b/.github/workflows/external.yml @@ -1,10 +1,10 @@ name: External Server Tests on: - pull_request: - push: - schedule: - - cron: '* * * * *' + pull_request: + push: + schedule: + - cron: '0 0 * * *' jobs: test-external-standalone: From 0a51ceca88ac1951c51fa901f228b58c9a386a5b Mon Sep 17 00:00:00 2001 From: ICHINOSE Shogo Date: Tue, 2 Apr 2024 10:44:21 +0900 Subject: [PATCH 17/49] bump actions/checkout v4 (#87) Node.js 16 actions are deprecated. To result them we are updating to actions/checkout@v4. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/. e.g. failure https://github.com/valkey-io/valkey/actions/runs/8482578610 --------- Signed-off-by: ICHINOSE Shogo --- .github/workflows/ci.yml | 15 ++++--- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/daily.yml | 52 +++++++++++----------- .github/workflows/external.yml | 6 +-- .github/workflows/reply-schemas-linter.yml | 2 +- .github/workflows/spell-check.yml | 2 +- 6 files changed, 41 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf50c31e32..7bd01183f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: test-ubuntu-latest: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: make # Fail build if there are warnings # build with TLS just for compilation coverage @@ -28,7 +28,7 @@ jobs: test-sanitizer-address: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: make # build with TLS module just for compilation coverage run: make SANITIZER=address SERVER_CFLAGS='-Werror -DDEBUG_ASSERTIONS' BUILD_TLS=module @@ -46,7 +46,7 @@ jobs: runs-on: ubuntu-latest container: debian:buster steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: make run: | apt-get update && apt-get install -y build-essential @@ -55,14 +55,14 @@ jobs: build-macos-latest: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: make run: make SERVER_CFLAGS='-Werror' build-32bit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: make run: | sudo apt-get update && sudo apt-get install libc6-dev-i386 @@ -71,7 +71,7 @@ jobs: build-libc-malloc: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: make run: make SERVER_CFLAGS='-Werror' MALLOC=libc @@ -79,7 +79,10 @@ jobs: runs-on: ubuntu-latest container: centos:7 steps: + # on centos7, actions/checkout@v4 does not work, so we use v3 + # ref. https://github.com/actions/checkout/issues/1487 - uses: actions/checkout@v3 + - name: make run: | yum -y install gcc make diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 34e18674f2..4c7484b99b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize CodeQL uses: github/codeql-action/init@v3 diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 85ee899bac..bb0a7daf07 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -47,7 +47,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -88,7 +88,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -131,7 +131,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -168,7 +168,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -205,7 +205,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -249,7 +249,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -293,7 +293,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -337,7 +337,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -369,7 +369,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -447,7 +447,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -477,7 +477,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -512,7 +512,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -542,7 +542,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -582,7 +582,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -631,7 +631,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -674,7 +674,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -714,7 +714,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -761,7 +761,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -807,7 +807,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -836,7 +836,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -862,7 +862,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -894,7 +894,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -913,7 +913,7 @@ jobs: run: | echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -945,7 +945,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -984,7 +984,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -1023,7 +1023,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} diff --git a/.github/workflows/external.yml b/.github/workflows/external.yml index 8c35d5c88c..bd6b438394 100644 --- a/.github/workflows/external.yml +++ b/.github/workflows/external.yml @@ -12,7 +12,7 @@ jobs: if: github.event_name != 'schedule' || github.repository == 'valkey-io/valkey' timeout-minutes: 14400 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build run: make SERVER_CFLAGS=-Werror - name: Start valkey-server @@ -37,7 +37,7 @@ jobs: if: github.event_name != 'schedule' || github.repository == 'valkey-io/valkey' timeout-minutes: 14400 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build run: make SERVER_CFLAGS=-Werror - name: Start valkey-server @@ -65,7 +65,7 @@ jobs: if: github.event_name != 'schedule' || github.repository == 'valkey-io/valkey' timeout-minutes: 14400 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build run: make SERVER_CFLAGS=-Werror - name: Start valkey-server diff --git a/.github/workflows/reply-schemas-linter.yml b/.github/workflows/reply-schemas-linter.yml index 6893bb3dca..a57a97ab3d 100644 --- a/.github/workflows/reply-schemas-linter.yml +++ b/.github/workflows/reply-schemas-linter.yml @@ -12,7 +12,7 @@ jobs: reply-schemas-linter: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup nodejs uses: actions/setup-node@v4 - name: Install packages diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index dfbb33008d..1e6f58aacb 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install typos uses: taiki-e/install-action@v2 From 0ba2f1b14e03172f51c0b6ec2fed6af0d8378191 Mon Sep 17 00:00:00 2001 From: Madelyn Olson <34459052+madolson@users.noreply.github.com> Date: Mon, 1 Apr 2024 21:31:17 -0700 Subject: [PATCH 18/49] Update coverity to reflect project name (#127) Fix the coverity name to reflect the actual name in coverity. See successful build here: https://github.com/valkey-io/valkey/actions/runs/8516329554. Also removed unnecessary TCL dependency from the install. Signed-off-by: Madelyn Olson --- .github/workflows/coverity.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 36d7cf7ae3..791bb275b2 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -14,19 +14,18 @@ jobs: - uses: actions/checkout@main - name: Download and extract the Coverity Build Tool run: | - wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=valkey-unstable" -O cov-analysis-linux64.tar.gz + wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=valkey-io%2Fvalkey" -O cov-analysis-linux64.tar.gz mkdir cov-analysis-linux64 tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64 - name: Install Valkey dependencies - run: sudo apt install -y gcc tcl8.6 tclx procps libssl-dev + run: sudo apt install -y gcc procps libssl-dev - name: Build with cov-build run: cov-analysis-linux64/bin/cov-build --dir cov-int make - name: Upload the result run: | tar czvf cov-int.tgz cov-int curl \ - --form project=valkey-unstable \ --form email=${{ secrets.COVERITY_SCAN_EMAIL }} \ --form token=${{ secrets.COVERITY_SCAN_TOKEN }} \ --form file=@cov-int.tgz \ - https://scan.coverity.com/builds + https://scan.coverity.com/builds?project=valkey-io%2Fvalkey From 4d7fff9abacab3c8c7618caea419aebeb71f266e Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:37:19 +0700 Subject: [PATCH 19/49] Remove unused var desc in luaRegisterFunctionReadPositionalArgs (#130) desc is set to NULL, never set to anything, and then checked if it should be freed on the error path if it's NULL. This can be cleaned up, since it's really unused. Fixes #129 Signed-off-by: 0del --- src/function_lua.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/function_lua.c b/src/function_lua.c index be79dc1638..8b334fcd24 100644 --- a/src/function_lua.c +++ b/src/function_lua.c @@ -354,7 +354,6 @@ static int luaRegisterFunctionReadNamedArgs(lua_State *lua, registerFunctionArgs static int luaRegisterFunctionReadPositionalArgs(lua_State *lua, registerFunctionArgs *register_f_args) { char *err = NULL; sds name = NULL; - sds desc = NULL; luaFunctionCtx *lua_f_ctx = NULL; if (!(name = luaGetStringSds(lua, 1))) { err = "first argument to redis.register_function must be a string"; @@ -377,7 +376,6 @@ static int luaRegisterFunctionReadPositionalArgs(lua_State *lua, registerFunctio error: if (name) sdsfree(name); - if (desc) sdsfree(desc); luaPushError(lua, err); return C_ERR; } From e35d86f2a28bd39fc883132c361a2def7a463094 Mon Sep 17 00:00:00 2001 From: Vitah Lin Date: Tue, 2 Apr 2024 15:43:37 +0800 Subject: [PATCH 20/49] Fix rename REDIS_TEST to SERVER_TEST to pass the Daily workflow (#131) The test flag `REDIS_TEST` has already be changed to `SERVER_TEST` in `.github/workflows/daily.yml`, the name in the src directory need to be changed as well. ```shell run: | sudo apt-get update && sudo apt-get install libc6-dev-i386 make 32bit SERVER_CFLAGS='-Werror -DSERVER_TEST' ``` Signed-off-by: Vitah Lin --- deps/hiredis/sds.h | 2 +- src/crc64.c | 2 +- src/crc64.h | 2 +- src/dict.c | 2 +- src/dict.h | 2 +- src/endianconv.c | 2 +- src/endianconv.h | 2 +- src/intset.c | 2 +- src/intset.h | 2 +- src/kvstore.c | 2 +- src/kvstore.h | 2 +- src/listpack.c | 2 +- src/listpack.h | 2 +- src/quicklist.c | 6 +++--- src/quicklist.h | 2 +- src/sds.c | 2 +- src/sds.h | 2 +- src/server.c | 4 ++-- src/sha1.c | 2 +- src/sha1.h | 2 +- src/util.c | 2 +- src/util.h | 2 +- src/ziplist.c | 2 +- src/ziplist.h | 2 +- src/zipmap.c | 2 +- src/zipmap.h | 2 +- src/zmalloc.c | 2 +- src/zmalloc.h | 2 +- 28 files changed, 31 insertions(+), 31 deletions(-) diff --git a/deps/hiredis/sds.h b/deps/hiredis/sds.h index 80784bc838..7f0ca5dfa5 100644 --- a/deps/hiredis/sds.h +++ b/deps/hiredis/sds.h @@ -273,7 +273,7 @@ void *hi_sds_malloc(size_t size); void *hi_sds_realloc(void *ptr, size_t size); void hi_sds_free(void *ptr); -#ifdef REDIS_TEST +#ifdef SERVER_TEST int hi_sdsTest(int argc, char *argv[]); #endif diff --git a/src/crc64.c b/src/crc64.c index 73e0391453..f51d6819c6 100644 --- a/src/crc64.c +++ b/src/crc64.c @@ -123,7 +123,7 @@ uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l) { } /* Test main */ -#ifdef REDIS_TEST +#ifdef SERVER_TEST #include #define UNUSED(x) (void)(x) diff --git a/src/crc64.h b/src/crc64.h index e0fccd98bb..3debc3295a 100644 --- a/src/crc64.h +++ b/src/crc64.h @@ -6,7 +6,7 @@ void crc64_init(void); uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l); -#ifdef REDIS_TEST +#ifdef SERVER_TEST int crc64Test(int argc, char *argv[], int flags); #endif diff --git a/src/dict.c b/src/dict.c index d04f9e1231..7e584f079a 100644 --- a/src/dict.c +++ b/src/dict.c @@ -1755,7 +1755,7 @@ void dictGetStats(char *buf, size_t bufsize, dict *d, int full) { /* ------------------------------- Benchmark ---------------------------------*/ -#ifdef REDIS_TEST +#ifdef SERVER_TEST #include "testhelp.h" #define UNUSED(V) ((void) V) diff --git a/src/dict.h b/src/dict.h index b5dc1f19a2..8aaacd41e3 100644 --- a/src/dict.h +++ b/src/dict.h @@ -249,7 +249,7 @@ dictStats* dictGetStatsHt(dict *d, int htidx, int full); void dictCombineStats(dictStats *from, dictStats *into); void dictFreeStats(dictStats *stats); -#ifdef REDIS_TEST +#ifdef SERVER_TEST int dictTest(int argc, char *argv[], int flags); #endif diff --git a/src/endianconv.c b/src/endianconv.c index 8eb6b22288..9344c39ad6 100644 --- a/src/endianconv.c +++ b/src/endianconv.c @@ -101,7 +101,7 @@ uint64_t intrev64(uint64_t v) { return v; } -#ifdef REDIS_TEST +#ifdef SERVER_TEST #include #define UNUSED(x) (void)(x) diff --git a/src/endianconv.h b/src/endianconv.h index bfe9b7d0ac..0a7ad2a12d 100644 --- a/src/endianconv.h +++ b/src/endianconv.h @@ -71,7 +71,7 @@ uint64_t intrev64(uint64_t v); #define ntohu64(v) intrev64(v) #endif -#ifdef REDIS_TEST +#ifdef SERVER_TEST int endianconvTest(int argc, char *argv[], int flags); #endif diff --git a/src/intset.c b/src/intset.c index 621a74283a..221278fc49 100644 --- a/src/intset.c +++ b/src/intset.c @@ -342,7 +342,7 @@ int intsetValidateIntegrity(const unsigned char *p, size_t size, int deep) { return 1; } -#ifdef REDIS_TEST +#ifdef SERVER_TEST #include #include diff --git a/src/intset.h b/src/intset.h index 41cc7b8222..2da0e9bf1d 100644 --- a/src/intset.h +++ b/src/intset.h @@ -50,7 +50,7 @@ uint32_t intsetLen(const intset *is); size_t intsetBlobLen(intset *is); int intsetValidateIntegrity(const unsigned char *is, size_t size, int deep); -#ifdef REDIS_TEST +#ifdef SERVER_TEST int intsetTest(int argc, char *argv[], int flags); #endif diff --git a/src/kvstore.c b/src/kvstore.c index 62b799dddc..1195db67b8 100644 --- a/src/kvstore.c +++ b/src/kvstore.c @@ -866,7 +866,7 @@ int kvstoreDictDelete(kvstore *kvs, int didx, const void *key) { return ret; } -#ifdef REDIS_TEST +#ifdef SERVER_TEST #include #include "testhelp.h" diff --git a/src/kvstore.h b/src/kvstore.h index bce45fe4c1..b3d8a0e4aa 100644 --- a/src/kvstore.h +++ b/src/kvstore.h @@ -72,7 +72,7 @@ dictEntry *kvstoreDictTwoPhaseUnlinkFind(kvstore *kvs, int didx, const void *key void kvstoreDictTwoPhaseUnlinkFree(kvstore *kvs, int didx, dictEntry *he, dictEntry **plink, int table_index); int kvstoreDictDelete(kvstore *kvs, int didx, const void *key); -#ifdef REDIS_TEST +#ifdef SERVER_TEST int kvstoreTest(int argc, char *argv[], int flags); #endif diff --git a/src/listpack.c b/src/listpack.c index ecc7e9f6fb..470a8f9920 100644 --- a/src/listpack.c +++ b/src/listpack.c @@ -1679,7 +1679,7 @@ void lpRepr(unsigned char *lp) { printf("{end}\n\n"); } -#ifdef REDIS_TEST +#ifdef SERVER_TEST #include #include "adlist.h" diff --git a/src/listpack.h b/src/listpack.h index a60f089f9c..9e51704178 100644 --- a/src/listpack.h +++ b/src/listpack.h @@ -99,7 +99,7 @@ unsigned char *lpNextRandom(unsigned char *lp, unsigned char *p, unsigned int *i int lpSafeToAdd(unsigned char* lp, size_t add); void lpRepr(unsigned char *lp); -#ifdef REDIS_TEST +#ifdef SERVER_TEST int listpackTest(int argc, char *argv[], int flags); #endif diff --git a/src/quicklist.c b/src/quicklist.c index 7fe3430fce..b9f6911700 100644 --- a/src/quicklist.c +++ b/src/quicklist.c @@ -212,7 +212,7 @@ void quicklistRelease(quicklist *quicklist) { * Returns 1 if listpack compressed successfully. * Returns 0 if compression failed or if listpack too small to compress. */ REDIS_STATIC int __quicklistCompressNode(quicklistNode *node) { -#ifdef REDIS_TEST +#ifdef SERVER_TEST node->attempted_compress = 1; #endif if (node->dont_compress) return 0; @@ -254,7 +254,7 @@ REDIS_STATIC int __quicklistCompressNode(quicklistNode *node) { /* Uncompress the listpack in 'node' and update encoding details. * Returns 1 on successful decode, 0 on failure to decode. */ REDIS_STATIC int __quicklistDecompressNode(quicklistNode *node) { -#ifdef REDIS_TEST +#ifdef SERVER_TEST node->attempted_compress = 0; #endif node->recompress = 0; @@ -1791,7 +1791,7 @@ void quicklistBookmarksClear(quicklist *ql) { } /* The rest of this file is test cases and test helpers. */ -#ifdef REDIS_TEST +#ifdef SERVER_TEST #include #include #include "testhelp.h" diff --git a/src/quicklist.h b/src/quicklist.h index c4b07e0c00..4658ba8271 100644 --- a/src/quicklist.h +++ b/src/quicklist.h @@ -204,7 +204,7 @@ quicklistNode *quicklistBookmarkFind(quicklist *ql, const char *name); void quicklistBookmarksClear(quicklist *ql); int quicklistSetPackedThreshold(size_t sz); -#ifdef REDIS_TEST +#ifdef SERVER_TEST int quicklistTest(int argc, char *argv[], int flags); #endif diff --git a/src/sds.c b/src/sds.c index 4ed792e5cd..84edef97d7 100644 --- a/src/sds.c +++ b/src/sds.c @@ -1229,7 +1229,7 @@ sds sdstemplate(const char *template, sdstemplate_callback_t cb_func, void *cb_a return NULL; } -#ifdef REDIS_TEST +#ifdef SERVER_TEST #include #include #include "testhelp.h" diff --git a/src/sds.h b/src/sds.h index 208eaa210d..e65d7a139f 100644 --- a/src/sds.h +++ b/src/sds.h @@ -280,7 +280,7 @@ void *sds_malloc(size_t size); void *sds_realloc(void *ptr, size_t size); void sds_free(void *ptr); -#ifdef REDIS_TEST +#ifdef SERVER_TEST int sdsTest(int argc, char *argv[], int flags); #endif diff --git a/src/server.c b/src/server.c index 999d799cab..1605938d0e 100644 --- a/src/server.c +++ b/src/server.c @@ -6855,7 +6855,7 @@ int iAmMaster(void) { (server.cluster_enabled && clusterNodeIsMaster(getMyClusterNode()))); } -#ifdef REDIS_TEST +#ifdef SERVER_TEST #include "testhelp.h" #include "intset.h" /* Compact integer set structure */ @@ -6901,7 +6901,7 @@ int main(int argc, char **argv) { int j; char config_from_stdin = 0; -#ifdef REDIS_TEST +#ifdef SERVER_TEST monotonicInit(); /* Required for dict tests, that are relying on monotime during dict rehashing. */ if (argc >= 3 && !strcasecmp(argv[1], "test")) { int flags = 0; diff --git a/src/sha1.c b/src/sha1.c index 4d8c14094d..3a722933fc 100644 --- a/src/sha1.c +++ b/src/sha1.c @@ -208,7 +208,7 @@ void SHA1Final(unsigned char digest[20], SHA1_CTX* context) } /* ================ end of sha1.c ================ */ -#ifdef REDIS_TEST +#ifdef SERVER_TEST #define BUFSIZE 4096 #define UNUSED(x) (void)(x) diff --git a/src/sha1.h b/src/sha1.h index a6cb6e8857..1765117967 100644 --- a/src/sha1.h +++ b/src/sha1.h @@ -21,7 +21,7 @@ void SHA1Init(SHA1_CTX* context); __attribute__((noinline)) void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len); void SHA1Final(unsigned char digest[20], SHA1_CTX* context); -#ifdef REDIS_TEST +#ifdef SERVER_TEST int sha1Test(int argc, char **argv, int flags); #endif #endif diff --git a/src/util.c b/src/util.c index ac17cd187b..3f9533369b 100644 --- a/src/util.c +++ b/src/util.c @@ -1375,7 +1375,7 @@ int snprintf_async_signal_safe(char *to, size_t n, const char *fmt, ...) { return result; } -#ifdef REDIS_TEST +#ifdef SERVER_TEST #include #include #include "testhelp.h" diff --git a/src/util.h b/src/util.h index 8a47f96acf..e924ba8cf6 100644 --- a/src/util.h +++ b/src/util.h @@ -100,7 +100,7 @@ int snprintf_async_signal_safe(char *to, size_t n, const char *fmt, ...); size_t redis_strlcpy(char *dst, const char *src, size_t dsize); size_t redis_strlcat(char *dst, const char *src, size_t dsize); -#ifdef REDIS_TEST +#ifdef SERVER_TEST int utilTest(int argc, char **argv, int flags); #endif diff --git a/src/ziplist.c b/src/ziplist.c index c891625a93..490d5e3931 100644 --- a/src/ziplist.c +++ b/src/ziplist.c @@ -1686,7 +1686,7 @@ unsigned int ziplistRandomPairsUnique(unsigned char *zl, unsigned int count, zip return picked; } -#ifdef REDIS_TEST +#ifdef SERVER_TEST #include #include "adlist.h" #include "sds.h" diff --git a/src/ziplist.h b/src/ziplist.h index f210ba6c92..73cff214d3 100644 --- a/src/ziplist.h +++ b/src/ziplist.h @@ -67,7 +67,7 @@ void ziplistRandomPairs(unsigned char *zl, unsigned int count, ziplistEntry *key unsigned int ziplistRandomPairsUnique(unsigned char *zl, unsigned int count, ziplistEntry *keys, ziplistEntry *vals); int ziplistSafeToAdd(unsigned char* zl, size_t add); -#ifdef REDIS_TEST +#ifdef SERVER_TEST int ziplistTest(int argc, char *argv[], int flags); #endif diff --git a/src/zipmap.c b/src/zipmap.c index 4e984ba6d9..214c49d2fc 100644 --- a/src/zipmap.c +++ b/src/zipmap.c @@ -441,7 +441,7 @@ int zipmapValidateIntegrity(unsigned char *zm, size_t size, int deep) { #undef OUT_OF_RANGE } -#ifdef REDIS_TEST +#ifdef SERVER_TEST static void zipmapRepr(unsigned char *p) { unsigned int l; diff --git a/src/zipmap.h b/src/zipmap.h index 482c96ddd8..d95c48ec55 100644 --- a/src/zipmap.h +++ b/src/zipmap.h @@ -47,7 +47,7 @@ size_t zipmapBlobLen(unsigned char *zm); void zipmapRepr(unsigned char *p); int zipmapValidateIntegrity(unsigned char *zm, size_t size, int deep); -#ifdef REDIS_TEST +#ifdef SERVER_TEST int zipmapTest(int argc, char *argv[], int flags); #endif diff --git a/src/zmalloc.c b/src/zmalloc.c index 56330ff1cc..c1d10a5f0f 100644 --- a/src/zmalloc.c +++ b/src/zmalloc.c @@ -908,7 +908,7 @@ size_t zmalloc_get_memory_size(void) { #endif } -#ifdef REDIS_TEST +#ifdef SERVER_TEST #include "testhelp.h" #include "redisassert.h" diff --git a/src/zmalloc.h b/src/zmalloc.h index 461d0d1ac7..9baa36b3de 100644 --- a/src/zmalloc.h +++ b/src/zmalloc.h @@ -168,7 +168,7 @@ __attribute__((alloc_size(2),noinline)) void *extend_to_usable(void *ptr, size_t int get_proc_stat_ll(int i, long long *res); -#ifdef REDIS_TEST +#ifdef SERVER_TEST int zmalloc_test(int argc, char **argv, int flags); #endif From 83507d74b8588d2d8561a263466d34ee669d9812 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Tue, 2 Apr 2024 20:51:14 +0800 Subject: [PATCH 21/49] Update for latest 'typos' (#139) Signed-off-by: john vandenberg Co-authored-by: john vandenberg --- .config/typos.toml | 8 ++++++++ tests/unit/acl.tcl | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.config/typos.toml b/.config/typos.toml index e810af9a14..d378b5655a 100644 --- a/.config/typos.toml +++ b/.config/typos.toml @@ -8,8 +8,10 @@ extend-exclude = [ ] [default.extend-words] +advices = "advices" exat = "exat" optin = "optin" +ro = "ro" smove = "smove" [type.c] @@ -30,6 +32,7 @@ extend-ignore-re = [ module_gil_acquring = "module_gil_acquring" [type.c.extend-identifiers] +ang = "ang" clen = "clen" fle = "fle" module_gil_acquring = "module_gil_acquring" @@ -47,10 +50,14 @@ fo = "fo" seeked = "seeked" [type.c.extend-words] +arange = "arange" fo = "fo" +frst = "frst" limite = "limite" +pn = "pn" seeked = "seeked" tre = "tre" +ws = "ws" [type.systemd.extend-words] # systemd = .conf @@ -58,4 +65,5 @@ ake = "ake" [type.tcl.extend-words] fo = "fo" +lst = "lst" tre = "tre" diff --git a/tests/unit/acl.tcl b/tests/unit/acl.tcl index 1457b57b77..cdd12511e2 100644 --- a/tests/unit/acl.tcl +++ b/tests/unit/acl.tcl @@ -612,7 +612,7 @@ start_server {tags {"acl external:skip"}} { r ACL SETUSER adv-test -@all +select|0 +select|0 +debug|segfault +debug assert_equal "-@all +select|0 +debug" [dict get [r ACL getuser adv-test] commands] - # Unnecessary categories are retained for potentional future compatibility + # Unnecessary categories are retained for potential future compatibility r ACL SETUSER adv-test -@all -@dangerous assert_equal "-@all -@dangerous" [dict get [r ACL getuser adv-test] commands] From ba8bda9cffe80345cd4a74dfd98ab96b3bd52fb0 Mon Sep 17 00:00:00 2001 From: LiiNen Date: Tue, 2 Apr 2024 22:36:53 +0900 Subject: [PATCH 22/49] Fix shutdown syntax hint, following intention (#116) Change syntax hint from SHUTDOWN [NOSAVE | SAVE] [NOW] [FORCE] [ABORT] to SHUTDOWN [[NOSAVE | SAVE] [NOW] [FORCE] | ABORT] It's not that important for docs, but the latter is preferred for valkey-cli's automatic syntax hints. Signed-off-by: LiiNen --- src/commands.def | 24 ++++++++++---- src/commands/shutdown.json | 66 ++++++++++++++++++++++---------------- src/db.c | 1 + 3 files changed, 57 insertions(+), 34 deletions(-) diff --git a/src/commands.def b/src/commands.def index 0a86f44bab..2d68e36d77 100644 --- a/src/commands.def +++ b/src/commands.def @@ -7431,18 +7431,28 @@ commandHistory SHUTDOWN_History[] = { #define SHUTDOWN_Keyspecs NULL #endif -/* SHUTDOWN save_selector argument table */ -struct COMMAND_ARG SHUTDOWN_save_selector_Subargs[] = { +/* SHUTDOWN abort_selector save_selector_block save_selector argument table */ +struct COMMAND_ARG SHUTDOWN_abort_selector_save_selector_block_save_selector_Subargs[] = { {MAKE_ARG("nosave",ARG_TYPE_PURE_TOKEN,-1,"NOSAVE",NULL,NULL,CMD_ARG_NONE,0,NULL)}, {MAKE_ARG("save",ARG_TYPE_PURE_TOKEN,-1,"SAVE",NULL,NULL,CMD_ARG_NONE,0,NULL)}, }; -/* SHUTDOWN argument table */ -struct COMMAND_ARG SHUTDOWN_Args[] = { -{MAKE_ARG("save-selector",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,2,NULL),.subargs=SHUTDOWN_save_selector_Subargs}, +/* SHUTDOWN abort_selector save_selector_block argument table */ +struct COMMAND_ARG SHUTDOWN_abort_selector_save_selector_block_Subargs[] = { +{MAKE_ARG("save-selector",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,2,NULL),.subargs=SHUTDOWN_abort_selector_save_selector_block_save_selector_Subargs}, {MAKE_ARG("now",ARG_TYPE_PURE_TOKEN,-1,"NOW",NULL,"7.0.0",CMD_ARG_OPTIONAL,0,NULL)}, {MAKE_ARG("force",ARG_TYPE_PURE_TOKEN,-1,"FORCE",NULL,"7.0.0",CMD_ARG_OPTIONAL,0,NULL)}, -{MAKE_ARG("abort",ARG_TYPE_PURE_TOKEN,-1,"ABORT",NULL,"7.0.0",CMD_ARG_OPTIONAL,0,NULL)}, +}; + +/* SHUTDOWN abort_selector argument table */ +struct COMMAND_ARG SHUTDOWN_abort_selector_Subargs[] = { +{MAKE_ARG("save-selector-block",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_NONE,3,NULL),.subargs=SHUTDOWN_abort_selector_save_selector_block_Subargs}, +{MAKE_ARG("abort",ARG_TYPE_PURE_TOKEN,-1,"ABORT",NULL,"7.0.0",CMD_ARG_NONE,0,NULL)}, +}; + +/* SHUTDOWN argument table */ +struct COMMAND_ARG SHUTDOWN_Args[] = { +{MAKE_ARG("abort-selector",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL,2,NULL),.subargs=SHUTDOWN_abort_selector_Subargs}, }; /********** SLAVEOF ********************/ @@ -10798,7 +10808,7 @@ struct COMMAND_STRUCT redisCommandTable[] = { {MAKE_CMD("restore-asking","An internal command for migrating keys in a cluster.","O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)).","3.0.0",CMD_DOC_SYSCMD,NULL,NULL,"server",COMMAND_GROUP_SERVER,RESTORE_ASKING_History,3,RESTORE_ASKING_Tips,0,restoreCommand,-4,CMD_WRITE|CMD_DENYOOM|CMD_ASKING,ACL_CATEGORY_KEYSPACE|ACL_CATEGORY_DANGEROUS,RESTORE_ASKING_Keyspecs,1,NULL,7),.args=RESTORE_ASKING_Args}, {MAKE_CMD("role","Returns the replication role.","O(1)","2.8.12",CMD_DOC_NONE,NULL,NULL,"server",COMMAND_GROUP_SERVER,ROLE_History,0,ROLE_Tips,0,roleCommand,1,CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_FAST|CMD_SENTINEL,ACL_CATEGORY_ADMIN|ACL_CATEGORY_DANGEROUS,ROLE_Keyspecs,0,NULL,0)}, {MAKE_CMD("save","Synchronously saves the database(s) to disk.","O(N) where N is the total number of keys in all databases","1.0.0",CMD_DOC_NONE,NULL,NULL,"server",COMMAND_GROUP_SERVER,SAVE_History,0,SAVE_Tips,0,saveCommand,1,CMD_NO_ASYNC_LOADING|CMD_ADMIN|CMD_NOSCRIPT|CMD_NO_MULTI,0,SAVE_Keyspecs,0,NULL,0)}, -{MAKE_CMD("shutdown","Synchronously saves the database(s) to disk and shuts down the server.","O(N) when saving, where N is the total number of keys in all databases when saving data, otherwise O(1)","1.0.0",CMD_DOC_NONE,NULL,NULL,"server",COMMAND_GROUP_SERVER,SHUTDOWN_History,1,SHUTDOWN_Tips,0,shutdownCommand,-1,CMD_ADMIN|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_NO_MULTI|CMD_SENTINEL|CMD_ALLOW_BUSY,0,SHUTDOWN_Keyspecs,0,NULL,4),.args=SHUTDOWN_Args}, +{MAKE_CMD("shutdown","Synchronously saves the database(s) to disk and shuts down the server.","O(N) when saving, where N is the total number of keys in all databases when saving data, otherwise O(1)","1.0.0",CMD_DOC_NONE,NULL,NULL,"server",COMMAND_GROUP_SERVER,SHUTDOWN_History,1,SHUTDOWN_Tips,0,shutdownCommand,-1,CMD_ADMIN|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_NO_MULTI|CMD_SENTINEL|CMD_ALLOW_BUSY,0,SHUTDOWN_Keyspecs,0,NULL,1),.args=SHUTDOWN_Args}, {MAKE_CMD("slaveof","Sets a server as a replica of another, or promotes it to being a master.","O(1)","1.0.0",CMD_DOC_DEPRECATED,"`REPLICAOF`","5.0.0","server",COMMAND_GROUP_SERVER,SLAVEOF_History,0,SLAVEOF_Tips,0,replicaofCommand,3,CMD_NO_ASYNC_LOADING|CMD_ADMIN|CMD_NOSCRIPT|CMD_STALE,0,SLAVEOF_Keyspecs,0,NULL,1),.args=SLAVEOF_Args}, {MAKE_CMD("slowlog","A container for slow log commands.","Depends on subcommand.","2.2.12",CMD_DOC_NONE,NULL,NULL,"server",COMMAND_GROUP_SERVER,SLOWLOG_History,0,SLOWLOG_Tips,0,NULL,-2,0,0,SLOWLOG_Keyspecs,0,NULL,0),.subcommands=SLOWLOG_Subcommands}, {MAKE_CMD("swapdb","Swaps two databases.","O(N) where N is the count of clients watching or blocking on keys from both databases.","4.0.0",CMD_DOC_NONE,NULL,NULL,"server",COMMAND_GROUP_SERVER,SWAPDB_History,0,SWAPDB_Tips,0,swapdbCommand,3,CMD_WRITE|CMD_FAST,ACL_CATEGORY_KEYSPACE|ACL_CATEGORY_DANGEROUS,SWAPDB_Keyspecs,0,NULL,2),.args=SWAPDB_Args}, diff --git a/src/commands/shutdown.json b/src/commands/shutdown.json index f47f067535..8c88da34a0 100644 --- a/src/commands/shutdown.json +++ b/src/commands/shutdown.json @@ -23,42 +23,54 @@ ], "arguments": [ { - "name": "save-selector", + "name": "abort-selector", "type": "oneof", "optional": true, "arguments": [ { - "name": "nosave", - "type": "pure-token", - "token": "NOSAVE" + "name": "save-selector-block", + "type": "block", + "arguments": [ + { + "name": "save-selector", + "type": "oneof", + "optional": true, + "arguments": [ + { + "name": "nosave", + "type": "pure-token", + "token": "NOSAVE" + }, + { + "name": "save", + "type": "pure-token", + "token": "SAVE" + } + ] + }, + { + "name": "now", + "type": "pure-token", + "token": "NOW", + "optional": true, + "since": "7.0.0" + }, + { + "name": "force", + "type": "pure-token", + "token": "FORCE", + "optional": true, + "since": "7.0.0" + } + ] }, { - "name": "save", + "name": "abort", "type": "pure-token", - "token": "SAVE" + "token": "ABORT", + "since": "7.0.0" } ] - }, - { - "name": "now", - "type": "pure-token", - "token": "NOW", - "optional": true, - "since": "7.0.0" - }, - { - "name": "force", - "type": "pure-token", - "token": "FORCE", - "optional": true, - "since": "7.0.0" - }, - { - "name": "abort", - "type": "pure-token", - "token": "ABORT", - "optional": true, - "since": "7.0.0" } ], "reply_schema": { diff --git a/src/db.c b/src/db.c index 82e61b496b..43b1ba5586 100644 --- a/src/db.c +++ b/src/db.c @@ -1234,6 +1234,7 @@ void typeCommand(client *c) { addReplyStatus(c, getObjectTypeName(o)); } +/* SHUTDOWN [[NOSAVE | SAVE] [NOW] [FORCE] | ABORT] */ void shutdownCommand(client *c) { int flags = SHUTDOWN_NOFLAGS; int abort = 0; From 98e7b41b8504f02aa2f30ef2a2690bf05cb53d54 Mon Sep 17 00:00:00 2001 From: Vitah Lin Date: Tue, 2 Apr 2024 21:42:50 +0800 Subject: [PATCH 23/49] Fix rename redis to valkey to pass reply-schemas-validator job (#133) Signed-off-by: Vitah Lin --- utils/req-res-log-validator.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/utils/req-res-log-validator.py b/utils/req-res-log-validator.py index 46c110019f..e2d471370c 100755 --- a/utils/req-res-log-validator.py +++ b/utils/req-res-log-validator.py @@ -26,7 +26,7 @@ 1. Goes over req-res files, generated by redis-servers, spawned by the testsuite (see logreqres.c) 2. For each request-response pair, it validates the response against the request's reply_schema (obtained from COMMAND DOCS) -This script spins up a redis-server and a redis-cli in order to obtain COMMAND DOCS. +This script spins up a valkey-server and a valkey-cli in order to obtain COMMAND DOCS. In order to use this file you must run the redis testsuite with the following flags: ./runtest --dont-clean --force-resp3 --log-req-res @@ -241,7 +241,7 @@ def fetch_schemas(cli, port, args, docs): while True: try: - print('Connecting to Redis...') + print('Connecting to Valkey...') r = redis.Redis(port=port) r.ping() break @@ -271,9 +271,9 @@ def fetch_schemas(cli, port, args, docs): testdir = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../tests") parser = argparse.ArgumentParser() - parser.add_argument('--server', type=str, default='%s/redis-server' % srcdir) + parser.add_argument('--server', type=str, default='%s/valkey-server' % srcdir) parser.add_argument('--port', type=int, default=6534) - parser.add_argument('--cli', type=str, default='%s/redis-cli' % srcdir) + parser.add_argument('--cli', type=str, default='%s/valkey-cli' % srcdir) parser.add_argument('--module', type=str, action='append', default=[]) parser.add_argument('--verbose', action='store_true') parser.add_argument('--fail-commands-not-all-hit', action='store_true') @@ -282,8 +282,8 @@ def fetch_schemas(cli, port, args, docs): docs = dict() - # Fetch schemas from a Redis instance - print('Starting Redis server') + # Fetch schemas from a Valkey instance + print('Starting Valkey server') redis_args = [args.server, '--port', str(args.port)] for module in args.module: redis_args += ['--loadmodule', 'tests/modules/%s.so' % module] @@ -291,7 +291,7 @@ def fetch_schemas(cli, port, args, docs): fetch_schemas(args.cli, args.port, redis_args, docs) # Fetch schemas from a sentinel - print('Starting Redis sentinel') + print('Starting Valkey sentinel') # Sentinel needs a config file to start config_file = "tmpsentinel.conf" @@ -347,4 +347,3 @@ def fetch_schemas(cli, port, args, docs): if args.fail_commands_not_all_hit: print("ERROR! at least one command was not hit by the tests") sys.exit(1) - From a1516d53defdad5cf5f65a4080b44e6a9fbdd889 Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Tue, 2 Apr 2024 20:56:17 +0700 Subject: [PATCH 24/49] Rename files redisassert to serverassert (#138) Signed-off-by: 0del --- src/Makefile | 4 ++-- src/ae.c | 2 +- src/dict.c | 2 +- src/intset.c | 2 +- src/kvstore.c | 2 +- src/listpack.c | 2 +- src/memtest.c | 2 +- src/monotonic.c | 2 +- src/quicklist.c | 2 +- src/rax.c | 2 +- src/sds.c | 2 +- src/{redisassert.c => serverassert.c} | 0 src/{redisassert.h => serverassert.h} | 0 src/ziplist.c | 2 +- src/zmalloc.c | 4 ++-- 15 files changed, 15 insertions(+), 15 deletions(-) rename src/{redisassert.c => serverassert.c} (100%) rename src/{redisassert.h => serverassert.h} (100%) diff --git a/src/Makefile b/src/Makefile index e8d6fcca37..83255feee7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -362,9 +362,9 @@ SERVER_NAME=$(ENGINE_NAME)-server$(PROG_SUFFIX) ENGINE_SENTINEL_NAME=$(ENGINE_NAME)-sentinel$(PROG_SUFFIX) ENGINE_SERVER_OBJ=threads_mngr.o adlist.o quicklist.o ae.o anet.o dict.o kvstore.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o cluster_legacy.o crc16.o endianconv.o slowlog.o eval.o bio.o rio.o rand.o memtest.o syscheck.o crcspeed.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o redis-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o acl.o tracking.o socket.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o resp_parser.o call_reply.o script_lua.o script.o functions.o function_lua.o commands.o strl.o connection.o unix.o logreqres.o ENGINE_CLI_NAME=$(ENGINE_NAME)-cli$(PROG_SUFFIX) -ENGINE_CLI_OBJ=anet.o adlist.o dict.o redis-cli.o zmalloc.o release.o ae.o redisassert.o crcspeed.o crc64.o siphash.o crc16.o monotonic.o cli_common.o mt19937-64.o strl.o cli_commands.o +ENGINE_CLI_OBJ=anet.o adlist.o dict.o redis-cli.o zmalloc.o release.o ae.o serverassert.o crcspeed.o crc64.o siphash.o crc16.o monotonic.o cli_common.o mt19937-64.o strl.o cli_commands.o ENGINE_BENCHMARK_NAME=$(ENGINE_NAME)-benchmark$(PROG_SUFFIX) -ENGINE_BENCHMARK_OBJ=ae.o anet.o redis-benchmark.o adlist.o dict.o zmalloc.o redisassert.o release.o crcspeed.o crc64.o siphash.o crc16.o monotonic.o cli_common.o mt19937-64.o strl.o +ENGINE_BENCHMARK_OBJ=ae.o anet.o redis-benchmark.o adlist.o dict.o zmalloc.o serverassert.o release.o crcspeed.o crc64.o siphash.o crc16.o monotonic.o cli_common.o mt19937-64.o strl.o ENGINE_CHECK_RDB_NAME=$(ENGINE_NAME)-check-rdb$(PROG_SUFFIX) ENGINE_CHECK_AOF_NAME=$(ENGINE_NAME)-check-aof$(PROG_SUFFIX) ALL_SOURCES=$(sort $(patsubst %.o,%.c,$(ENGINE_SERVER_OBJ) $(ENGINE_CLI_OBJ) $(ENGINE_BENCHMARK_OBJ))) diff --git a/src/ae.c b/src/ae.c index 99c0b86004..839d23b51d 100644 --- a/src/ae.c +++ b/src/ae.c @@ -32,7 +32,7 @@ #include "ae.h" #include "anet.h" -#include "redisassert.h" +#include "serverassert.h" #include #include diff --git a/src/dict.c b/src/dict.c index 7e584f079a..d2767939bc 100644 --- a/src/dict.c +++ b/src/dict.c @@ -45,7 +45,7 @@ #include "dict.h" #include "zmalloc.h" -#include "redisassert.h" +#include "serverassert.h" #include "monotonic.h" /* Using dictSetResizeEnabled() we make possible to disable diff --git a/src/intset.c b/src/intset.c index 221278fc49..fea4173b43 100644 --- a/src/intset.c +++ b/src/intset.c @@ -34,7 +34,7 @@ #include "intset.h" #include "zmalloc.h" #include "endianconv.h" -#include "redisassert.h" +#include "serverassert.h" /* Note that these encodings are ordered, so: * INTSET_ENC_INT16 < INTSET_ENC_INT32 < INTSET_ENC_INT64. */ diff --git a/src/kvstore.c b/src/kvstore.c index 1195db67b8..acfe62bb85 100644 --- a/src/kvstore.c +++ b/src/kvstore.c @@ -43,7 +43,7 @@ #include "zmalloc.h" #include "kvstore.h" -#include "redisassert.h" +#include "serverassert.h" #include "monotonic.h" #define UNUSED(V) ((void) V) diff --git a/src/listpack.c b/src/listpack.c index 470a8f9920..27becc9faa 100644 --- a/src/listpack.c +++ b/src/listpack.c @@ -42,7 +42,7 @@ #include "listpack.h" #include "listpack_malloc.h" -#include "redisassert.h" +#include "serverassert.h" #include "util.h" #define LP_HDR_SIZE 6 /* 32 bit total len + 16 bit number of elements. */ diff --git a/src/memtest.c b/src/memtest.c index ee1ba92f1a..47e65a9048 100644 --- a/src/memtest.c +++ b/src/memtest.c @@ -38,7 +38,7 @@ #include #endif #include "config.h" -#include "redisassert.h" +#include "serverassert.h" #if (ULONG_MAX == 4294967295UL) #define MEMTEST_32BIT diff --git a/src/monotonic.c b/src/monotonic.c index 6da03677bd..e55b5eb0c0 100644 --- a/src/monotonic.c +++ b/src/monotonic.c @@ -3,7 +3,7 @@ #include #include #include -#include "redisassert.h" +#include "serverassert.h" /* The function pointer for clock retrieval. */ monotime (*getMonotonicUs)(void) = NULL; diff --git a/src/quicklist.c b/src/quicklist.c index b9f6911700..06c699af66 100644 --- a/src/quicklist.c +++ b/src/quicklist.c @@ -37,7 +37,7 @@ #include "listpack.h" #include "util.h" /* for ll2string */ #include "lzf.h" -#include "redisassert.h" +#include "serverassert.h" #ifndef REDIS_STATIC #define REDIS_STATIC static diff --git a/src/rax.c b/src/rax.c index 100744d790..27a5756538 100644 --- a/src/rax.c +++ b/src/rax.c @@ -36,7 +36,7 @@ #include #include #include "rax.h" -#include "redisassert.h" +#include "serverassert.h" #ifndef RAX_MALLOC_INCLUDE #define RAX_MALLOC_INCLUDE "rax_malloc.h" diff --git a/src/sds.c b/src/sds.c index 84edef97d7..b8457ae0f7 100644 --- a/src/sds.c +++ b/src/sds.c @@ -35,7 +35,7 @@ #include #include #include -#include "redisassert.h" +#include "serverassert.h" #include "sds.h" #include "sdsalloc.h" #include "util.h" diff --git a/src/redisassert.c b/src/serverassert.c similarity index 100% rename from src/redisassert.c rename to src/serverassert.c diff --git a/src/redisassert.h b/src/serverassert.h similarity index 100% rename from src/redisassert.h rename to src/serverassert.h diff --git a/src/ziplist.c b/src/ziplist.c index 490d5e3931..1a16945852 100644 --- a/src/ziplist.c +++ b/src/ziplist.c @@ -190,7 +190,7 @@ #include "ziplist.h" #include "config.h" #include "endianconv.h" -#include "redisassert.h" +#include "serverassert.h" #define ZIP_END 255 /* Special "end of ziplist" entry. */ #define ZIP_BIG_PREVLEN 254 /* ZIP_BIG_PREVLEN - 1 is the max number of bytes of diff --git a/src/zmalloc.c b/src/zmalloc.c index c1d10a5f0f..27b64dc0d7 100644 --- a/src/zmalloc.c +++ b/src/zmalloc.c @@ -628,7 +628,7 @@ size_t zmalloc_get_rss(void) { #if defined(USE_JEMALLOC) -#include "redisassert.h" +#include "serverassert.h" #define STRINGIFY_(x) #x #define STRINGIFY(x) STRINGIFY_(x) @@ -910,7 +910,7 @@ size_t zmalloc_get_memory_size(void) { #ifdef SERVER_TEST #include "testhelp.h" -#include "redisassert.h" +#include "serverassert.h" #define TEST(name) printf("test — %s\n", name); From 621edbafba74c2d6211bf81d54be8b1da8543d4e Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Tue, 2 Apr 2024 22:44:00 +0700 Subject: [PATCH 25/49] Rename redisassert to serverassert in comment (#142) Signed-off-by: 0del --- src/serverassert.c | 4 ++-- src/serverassert.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/serverassert.c b/src/serverassert.c index 9f7402e748..7d6ab8ed68 100644 --- a/src/serverassert.c +++ b/src/serverassert.c @@ -1,8 +1,8 @@ -/* redisassert.c -- Implement the default _serverAssert and _serverPanic which +/* serverassert.c -- Implement the default _serverAssert and _serverPanic which * simply print stack trace to standard error stream. * * This file is shared by those modules that try to print some logs about stack trace - * but don't have their own implementations of functions in redisassert.h. + * but don't have their own implementations of functions in serverassert.h. * * ---------------------------------------------------------------------------- * diff --git a/src/serverassert.h b/src/serverassert.h index a3f95da091..1cbc9fb6cf 100644 --- a/src/serverassert.h +++ b/src/serverassert.h @@ -1,4 +1,4 @@ -/* redisassert.h -- Drop in replacements assert.h that prints the stack trace +/* serverassert.h -- Drop in replacements assert.h that prints the stack trace * in the Redis logs. * * This file should be included instead of "assert.h" inside libraries used by From 42e00635af0717b79a6d214889fe2cdd883928d4 Mon Sep 17 00:00:00 2001 From: pragnesh Date: Tue, 2 Apr 2024 22:45:23 +0530 Subject: [PATCH 26/49] Fix inconsistencies in the json command file descriptions (#63) Grammar. Use full sentences. Signed-off-by: Pragnesh --- src/commands/acl-cat.json | 2 +- src/commands/acl-deluser.json | 2 +- src/commands/acl-getuser.json | 8 +- src/commands/acl-help.json | 2 +- src/commands/acl-list.json | 2 +- src/commands/acl-users.json | 2 +- src/commands/bitop.json | 2 +- src/commands/bitpos.json | 4 +- src/commands/client-info.json | 2 +- src/commands/client-kill.json | 4 +- src/commands/client-tracking.json | 2 +- src/commands/client-unblock.json | 4 +- src/commands/cluster-bumpepoch.json | 4 +- .../cluster-count-failure-reports.json | 2 +- src/commands/cluster-countkeysinslot.json | 2 +- src/commands/cluster-getkeysinslot.json | 4 +- src/commands/cluster-links.json | 16 ++-- src/commands/cluster-myid.json | 2 +- src/commands/cluster-myshardid.json | 2 +- src/commands/cluster-nodes.json | 2 +- src/commands/cluster-replicas.json | 4 +- src/commands/cluster-shards.json | 6 +- src/commands/cluster-slaves.json | 4 +- src/commands/cluster-slots.json | 34 ++++---- src/commands/command-docs.json | 26 +++--- src/commands/command-info.json | 42 +++++----- src/commands/command-list.json | 2 +- src/commands/copy.json | 4 +- src/commands/del.json | 2 +- src/commands/function-dump.json | 2 +- src/commands/function-list.json | 14 ++-- src/commands/function-stats.json | 18 ++-- src/commands/geodist.json | 4 +- src/commands/georadius.json | 20 ++--- src/commands/georadius_ro.json | 18 ++-- src/commands/georadiusbymember.json | 20 ++--- src/commands/georadiusbymember_ro.json | 18 ++-- src/commands/geosearch.json | 18 ++-- src/commands/geosearchstore.json | 2 +- src/commands/hscan.json | 6 +- src/commands/keys.json | 2 +- src/commands/latency-history.json | 4 +- src/commands/linsert.json | 4 +- src/commands/lpushx.json | 2 +- src/commands/memory-doctor.json | 2 +- src/commands/memory-stats.json | 2 +- src/commands/move.json | 4 +- src/commands/object-encoding.json | 4 +- src/commands/object-freq.json | 2 +- src/commands/object-idletime.json | 2 +- src/commands/object-refcount.json | 2 +- src/commands/pfadd.json | 4 +- src/commands/publish.json | 2 +- src/commands/pubsub-channels.json | 2 +- src/commands/pubsub-numpat.json | 2 +- src/commands/pubsub-numsub.json | 2 +- src/commands/pubsub-shardchannels.json | 2 +- src/commands/pubsub-shardnumsub.json | 2 +- src/commands/randomkey.json | 4 +- src/commands/renamenx.json | 4 +- src/commands/replicaof.json | 2 +- src/commands/role.json | 34 ++++---- src/commands/scan.json | 6 +- src/commands/script-exists.json | 4 +- src/commands/slaveof.json | 2 +- src/commands/sort.json | 6 +- src/commands/sort_ro.json | 4 +- src/commands/spublish.json | 2 +- src/commands/sscan.json | 6 +- src/commands/touch.json | 2 +- src/commands/unlink.json | 2 +- src/commands/xclaim.json | 10 +-- src/commands/xinfo-stream.json | 84 +++++++++---------- src/commands/xread.json | 10 +-- src/commands/zrangebyscore.json | 12 +-- src/commands/zrevrange.json | 4 +- src/commands/zrevrangebyscore.json | 12 +-- src/commands/zscan.json | 6 +- 78 files changed, 298 insertions(+), 298 deletions(-) diff --git a/src/commands/acl-cat.json b/src/commands/acl-cat.json index dfbe4c43ef..cf86106773 100644 --- a/src/commands/acl-cat.json +++ b/src/commands/acl-cat.json @@ -24,7 +24,7 @@ }, { "type": "array", - "description": "In case `category` was given, list of commands that fall under the provided ACL category", + "description": "In case `category` was given, list of commands that fall under the provided ACL category.", "items": { "type": "string" } diff --git a/src/commands/acl-deluser.json b/src/commands/acl-deluser.json index 80e8a7ad51..d300f88cec 100644 --- a/src/commands/acl-deluser.json +++ b/src/commands/acl-deluser.json @@ -20,7 +20,7 @@ ], "reply_schema": { "type": "integer", - "description": "The number of users that were deleted" + "description": "The number of users that were deleted." }, "arguments": [ { diff --git a/src/commands/acl-getuser.json b/src/commands/acl-getuser.json index 535389bc53..cedd35f5cc 100644 --- a/src/commands/acl-getuser.json +++ b/src/commands/acl-getuser.json @@ -33,7 +33,7 @@ "reply_schema": { "oneOf": [ { - "description": "a set of ACL rule definitions for the user", + "description": "A set of ACL rule definitions for the user.", "type": "object", "additionalProperties": false, "properties": { @@ -50,15 +50,15 @@ } }, "commands": { - "description": "root selector's commands", + "description": "Root selector's commands.", "type": "string" }, "keys": { - "description": "root selector's keys", + "description": "Root selector's keys.", "type": "string" }, "channels": { - "description": "root selector's channels", + "description": "Root selector's channels.", "type": "string" }, "selectors": { diff --git a/src/commands/acl-help.json b/src/commands/acl-help.json index 3c95914dbd..e31024327f 100644 --- a/src/commands/acl-help.json +++ b/src/commands/acl-help.json @@ -14,7 +14,7 @@ ], "reply_schema": { "type": "array", - "description": "A list of subcommands and their description", + "description": "A list of subcommands and their description.", "items": { "type": "string" } diff --git a/src/commands/acl-list.json b/src/commands/acl-list.json index 0d75b137f3..415cdf59b7 100644 --- a/src/commands/acl-list.json +++ b/src/commands/acl-list.json @@ -16,7 +16,7 @@ ], "reply_schema": { "type": "array", - "description": "A list of currently active ACL rules", + "description": "A list of currently active ACL rules.", "items": { "type": "string" } diff --git a/src/commands/acl-users.json b/src/commands/acl-users.json index 1a6bc75579..98ab53d0d3 100644 --- a/src/commands/acl-users.json +++ b/src/commands/acl-users.json @@ -16,7 +16,7 @@ ], "reply_schema": { "type": "array", - "description": "List of existing ACL users", + "description": "List of existing ACL users.", "items": { "type": "string" } diff --git a/src/commands/bitop.json b/src/commands/bitop.json index d9e1ff9ef7..8d60cffa59 100644 --- a/src/commands/bitop.json +++ b/src/commands/bitop.json @@ -91,7 +91,7 @@ } ], "reply_schema": { - "description": "the size of the string stored in the destination key, that is equal to the size of the longest input string", + "description": "The size of the string stored in the destination key, that is equal to the size of the longest input string.", "type": "integer", "minimum": 0 } diff --git a/src/commands/bitpos.json b/src/commands/bitpos.json index 11b0851e85..b0834dd5dc 100644 --- a/src/commands/bitpos.json +++ b/src/commands/bitpos.json @@ -92,12 +92,12 @@ "reply_schema": { "oneOf": [ { - "description": "the position of the first bit set to 1 or 0 according to the request", + "description": "The position of the first bit set to 1 or 0 according to the request.", "type": "integer", "minimum": 0 }, { - "description": "In case the `bit` argument is 1 and the string is empty or composed of just zero bytes", + "description": "In case the `bit` argument is 1 and the string is empty or composed of just zero bytes.", "const": -1 } ] diff --git a/src/commands/client-info.json b/src/commands/client-info.json index 93fa008f52..f974da437b 100644 --- a/src/commands/client-info.json +++ b/src/commands/client-info.json @@ -20,7 +20,7 @@ "NONDETERMINISTIC_OUTPUT" ], "reply_schema": { - "description": "a unique string, as described at the CLIENT LIST page, for the current client", + "description": "A unique string, as described at the CLIENT LIST page, for the current client.", "type": "string" } } diff --git a/src/commands/client-kill.json b/src/commands/client-kill.json index 7efd805081..01079ad993 100644 --- a/src/commands/client-kill.json +++ b/src/commands/client-kill.json @@ -156,11 +156,11 @@ "reply_schema": { "oneOf": [ { - "description": "when called in 3 argument format", + "description": "When called in 3 argument format.", "const": "OK" }, { - "description": "when called in filter/value format, the number of clients killed", + "description": "When called in filter/value format, the number of clients killed.", "type": "integer", "minimum": 0 } diff --git a/src/commands/client-tracking.json b/src/commands/client-tracking.json index 28e84eceb1..2c3768c2fb 100644 --- a/src/commands/client-tracking.json +++ b/src/commands/client-tracking.json @@ -73,7 +73,7 @@ } ], "reply_schema": { - "description": "if the client was successfully put into or taken out of tracking mode", + "description": "If the client was successfully put into or taken out of tracking mode.", "const": "OK" } } diff --git a/src/commands/client-unblock.json b/src/commands/client-unblock.json index d028f47149..d391ede9e9 100644 --- a/src/commands/client-unblock.json +++ b/src/commands/client-unblock.json @@ -21,11 +21,11 @@ "oneOf": [ { "const": 0, - "description": "if the client was unblocked successfully" + "description": "If the client was unblocked successfully." }, { "const": 1, - "description": "if the client wasn't unblocked" + "description": "If the client wasn't unblocked." } ] }, diff --git a/src/commands/cluster-bumpepoch.json b/src/commands/cluster-bumpepoch.json index 786723c5c2..03a8370334 100644 --- a/src/commands/cluster-bumpepoch.json +++ b/src/commands/cluster-bumpepoch.json @@ -18,12 +18,12 @@ "reply_schema": { "oneOf": [ { - "description": "if the epoch was incremented", + "description": "If the epoch was incremented.", "type": "string", "pattern": "^BUMPED [0-9]*$" }, { - "description": "if the node already has the greatest config epoch in the cluster", + "description": "If the node already has the greatest config epoch in the cluster.", "type": "string", "pattern": "^STILL [0-9]*$" } diff --git a/src/commands/cluster-count-failure-reports.json b/src/commands/cluster-count-failure-reports.json index b80632d0fa..ad185dafc6 100644 --- a/src/commands/cluster-count-failure-reports.json +++ b/src/commands/cluster-count-failure-reports.json @@ -21,7 +21,7 @@ } ], "reply_schema": { - "description": "the number of active failure reports for the node", + "description": "The number of active failure reports for the node.", "type": "integer", "minimum": 0 } diff --git a/src/commands/cluster-countkeysinslot.json b/src/commands/cluster-countkeysinslot.json index caeec51320..e270990b15 100644 --- a/src/commands/cluster-countkeysinslot.json +++ b/src/commands/cluster-countkeysinslot.json @@ -17,7 +17,7 @@ } ], "reply_schema": { - "description": "The number of keys in the specified hash slot", + "description": "The number of keys in the specified hash slot.", "type": "integer", "minimum": 0 } diff --git a/src/commands/cluster-getkeysinslot.json b/src/commands/cluster-getkeysinslot.json index 039dfeabf6..6444a761fd 100644 --- a/src/commands/cluster-getkeysinslot.json +++ b/src/commands/cluster-getkeysinslot.json @@ -24,10 +24,10 @@ } ], "reply_schema": { - "description": "an array with up to count elements", + "description": "An array with up to count elements.", "type": "array", "items": { - "description": "key name", + "description": "Key name.", "type": "string" } } diff --git a/src/commands/cluster-links.json b/src/commands/cluster-links.json index 07b2e833b3..6f81e1a9e6 100644 --- a/src/commands/cluster-links.json +++ b/src/commands/cluster-links.json @@ -14,7 +14,7 @@ "NONDETERMINISTIC_OUTPUT" ], "reply_schema": { - "description": "an array of cluster links and their attributes", + "description": "An array of cluster links and their attributes.", "type": "array", "items": { "type": "object", @@ -23,33 +23,33 @@ "description": "This link is established by the local node _to_ the peer, or accepted by the local node _from_ the peer.", "oneOf": [ { - "description": "connection initiated from peer", + "description": "Connection initiated from peer.", "const": "from" }, { - "description": "connection initiated to peer", + "description": "Connection initiated to peer.", "const": "to" } ] }, "node": { - "description": "the node id of the peer", + "description": "The node id of the peer.", "type": "string" }, "create-time": { - "description": "unix time creation time of the link. (In the case of a _to_ link, this is the time when the TCP link is created by the local node, not the time when it is actually established.)", + "description": "Unix time creation time of the link. (In the case of a _to_ link, this is the time when the TCP link is created by the local node, not the time when it is actually established.)", "type": "integer" }, "events": { - "description": "events currently registered for the link. r means readable event, w means writable event", + "description": "Events currently registered for the link. r means readable event, w means writable event.", "type": "string" }, "send-buffer-allocated": { - "description": "allocated size of the link's send buffer, which is used to buffer outgoing messages toward the peer", + "description": "Allocated size of the link's send buffer, which is used to buffer outgoing messages toward the peer.", "type": "integer" }, "send-buffer-used": { - "description": "size of the portion of the link's send buffer that is currently holding data(messages)", + "description": "Size of the portion of the link's send buffer that is currently holding data(messages).", "type": "integer" } }, diff --git a/src/commands/cluster-myid.json b/src/commands/cluster-myid.json index 340d425fd3..caa62de756 100644 --- a/src/commands/cluster-myid.json +++ b/src/commands/cluster-myid.json @@ -11,7 +11,7 @@ "STALE" ], "reply_schema": { - "description": "the node id", + "description": "The node id.", "type": "string" } } diff --git a/src/commands/cluster-myshardid.json b/src/commands/cluster-myshardid.json index 7db63fd190..88a7107309 100644 --- a/src/commands/cluster-myshardid.json +++ b/src/commands/cluster-myshardid.json @@ -15,7 +15,7 @@ "NONDETERMINISTIC_OUTPUT" ], "reply_schema": { - "description": "the node's shard id", + "description": "The node's shard id.", "type": "string" } } diff --git a/src/commands/cluster-nodes.json b/src/commands/cluster-nodes.json index ce34944e19..9c5fcbe9a4 100644 --- a/src/commands/cluster-nodes.json +++ b/src/commands/cluster-nodes.json @@ -14,7 +14,7 @@ "NONDETERMINISTIC_OUTPUT" ], "reply_schema": { - "description": "the serialized cluster configuration", + "description": "The serialized cluster configuration.", "type": "string" } } diff --git a/src/commands/cluster-replicas.json b/src/commands/cluster-replicas.json index e01617feeb..4e8bd4204c 100644 --- a/src/commands/cluster-replicas.json +++ b/src/commands/cluster-replicas.json @@ -21,11 +21,11 @@ } ], "reply_schema": { - "description": "a list of replica nodes replicating from the specified master node provided in the same format used by CLUSTER NODES", + "description": "A list of replica nodes replicating from the specified master node provided in the same format used by CLUSTER NODES.", "type": "array", "items": { "type": "string", - "description": "the serialized cluster configuration" + "description": "The serialized cluster configuration." } } } diff --git a/src/commands/cluster-shards.json b/src/commands/cluster-shards.json index e7a0829534..472e957ea5 100644 --- a/src/commands/cluster-shards.json +++ b/src/commands/cluster-shards.json @@ -16,21 +16,21 @@ "NONDETERMINISTIC_OUTPUT" ], "reply_schema": { - "description": "a nested list of a map of hash ranges and shard nodes describing individual shards", + "description": "A nested list of a map of hash ranges and shard nodes describing individual shards.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "slots": { - "description": "an even number element array specifying the start and end slot numbers for slot ranges owned by this shard", + "description": "An even number element array specifying the start and end slot numbers for slot ranges owned by this shard.", "type": "array", "items": { "type": "integer" } }, "nodes": { - "description": "nodes that handle these slot ranges", + "description": "Nodes that handle these slot ranges.", "type": "array", "items": { "type": "object", diff --git a/src/commands/cluster-slaves.json b/src/commands/cluster-slaves.json index a736088e4c..db66a1c1db 100644 --- a/src/commands/cluster-slaves.json +++ b/src/commands/cluster-slaves.json @@ -26,11 +26,11 @@ } ], "reply_schema": { - "description": "a list of replica nodes replicating from the specified master node provided in the same format used by CLUSTER NODES", + "description": "A list of replica nodes replicating from the specified master node provided in the same format used by CLUSTER NODES.", "type": "array", "items": { "type": "string", - "description": "the serialized cluster configuration" + "description": "The serialized cluster configuration." } } } diff --git a/src/commands/cluster-slots.json b/src/commands/cluster-slots.json index b00cc60f47..13f8c26612 100644 --- a/src/commands/cluster-slots.json +++ b/src/commands/cluster-slots.json @@ -30,7 +30,7 @@ "NONDETERMINISTIC_OUTPUT" ], "reply_schema": { - "description": "nested list of slot ranges with networking information", + "description": "Nested list of slot ranges with networking information.", "type": "array", "items": { "type": "array", @@ -38,42 +38,42 @@ "maxItems": 4294967295, "items": [ { - "description": "start slot number", + "description": "Start slot number.", "type": "integer" }, { - "description": "end slot number", + "description": "End slot number.", "type": "integer" }, { "type": "array", - "description": "Master node for the slot range", + "description": "Master node for the slot range.", "minItems": 4, "maxItems": 4, "items": [ { - "description": "endpoint description", + "description": "Endpoint description.", "oneOf": [ { - "description": "hostname or ip", + "description": "Hostname or ip.", "type": "string" }, { - "description": "unknown type", + "description": "Unknown type.", "type": "null" } ] }, { - "description": "port", + "description": "Port.", "type": "integer" }, { - "description": "node name", + "description": "Node name.", "type": "string" }, { - "description": "array of node descriptions", + "description": "Array of node descriptions.", "type": "object", "additionalProperties": false, "properties": { @@ -90,33 +90,33 @@ ], "additionalItems": { "type": "array", - "description": "Replica node for the slot range", + "description": "Replica node for the slot range.", "minItems": 4, "maxItems": 4, "items": [ { - "description": "endpoint description", + "description": "Endpoint description.", "oneOf": [ { - "description": "hostname or ip", + "description": "Hostname or ip.", "type": "string" }, { - "description": "unknown type", + "description": "Unknown type.", "type": "null" } ] }, { - "description": "port", + "description": "Port.", "type": "integer" }, { - "description": "node name", + "description": "Node name.", "type": "string" }, { - "description": "array of node descriptions", + "description": "Array of node descriptions.", "type": "object", "additionalProperties": false, "properties": { diff --git a/src/commands/command-docs.json b/src/commands/command-docs.json index ea575b0437..60a7ee423f 100644 --- a/src/commands/command-docs.json +++ b/src/commands/command-docs.json @@ -28,15 +28,15 @@ "additionalProperties": false, "properties": { "summary": { - "description": "short command description", + "description": "Short command description.", "type": "string" }, "since": { - "description": "the server version that added the command (or for module commands, the module version).", + "description": "The server version that added the command (or for module commands, the module version).", "type": "string" }, "group": { - "description": "the functional group to which the command belongs", + "description": "The functional group to which the command belongs.", "oneOf": [ { "const": "bitmap" @@ -95,38 +95,38 @@ ] }, "complexity": { - "description": "a short explanation about the command's time complexity.", + "description": "A short explanation about the command's time complexity.", "type": "string" }, "module": { "type": "string" }, "doc_flags": { - "description": "an array of documentation flags", + "description": "An array of documentation flags.", "type": "array", "items": { "oneOf": [ { - "description": "the command is deprecated.", + "description": "The command is deprecated.", "const": "deprecated" }, { - "description": "a system command that isn't meant to be called by users.", + "description": "A system command that isn't meant to be called by users.", "const": "syscmd" } ] } }, "deprecated_since": { - "description": "the server version that deprecated the command (or for module commands, the module version)", + "description": "The server version that deprecated the command (or for module commands, the module version).", "type": "string" }, "replaced_by": { - "description": "the alternative for a deprecated command.", + "description": "The alternative for a deprecated command.", "type": "string" }, "history": { - "description": "an array of historical notes describing changes to the command's behavior or arguments.", + "description": "An array of historical notes describing changes to the command's behavior or arguments.", "type": "array", "items": { "type": "array", @@ -145,7 +145,7 @@ } }, "arguments": { - "description": "an array of maps that describe the command's arguments.", + "description": "An array of maps that describe the command's arguments.", "type": "array", "items": { "type": "object", @@ -188,11 +188,11 @@ } }, "reply_schema": { - "description": "command reply schema", + "description": "Command reply schema.", "type": "object" }, "subcommands": { - "description": "A map where each key is a subcommand, and each value is the documentary information", + "description": "A map where each key is a subcommand, and each value is the documentary information.", "$ref": "#" } } diff --git a/src/commands/command-info.json b/src/commands/command-info.json index 8c69060959..d37d140e1e 100644 --- a/src/commands/command-info.json +++ b/src/commands/command-info.json @@ -37,61 +37,61 @@ "items": { "oneOf": [ { - "description": "command does not exist", + "description": "Command does not exist.", "type": "null" }, { - "description": "command info array output", + "description": "Command info array output.", "type": "array", "minItems": 10, "maxItems": 10, "items": [ { - "description": "command name", + "description": "Command name.", "type": "string" }, { - "description": "command arity", + "description": "Command arity.", "type": "integer" }, { - "description": "command flags", + "description": "Command flags.", "type": "array", "items": { - "description": "command flag", + "description": "Command flag.", "type": "string" } }, { - "description": "command first key index", + "description": "Command first key index.", "type": "integer" }, { - "description": "command last key index", + "description": "Command last key index.", "type": "integer" }, { - "description": "command key step index", + "description": "Command key step index.", "type": "integer" }, { - "description": "command categories", + "description": "Command categories.", "type": "array", "items": { - "description": "command category", + "description": "Command category.", "type": "string" } }, { - "description": "command tips", + "description": "Command tips.", "type": "array", "items": { - "description": "command tip", + "description": "Command tip.", "type": "string" } }, { - "description": "command key specs", + "description": "Command key specs.", "type": "array", "items": { "type": "object", @@ -116,12 +116,12 @@ "spec": { "anyOf": [ { - "description": "unknown type, empty map", + "description": "Unknown type, empty map.", "type": "object", "additionalProperties": false }, { - "description": "index type", + "description": "Index type.", "type": "object", "additionalProperties": false, "properties": { @@ -131,7 +131,7 @@ } }, { - "description": "keyword type", + "description": "Keyword type.", "type": "object", "additionalProperties": false, "properties": { @@ -157,12 +157,12 @@ "spec": { "anyOf": [ { - "description": "unknown type", + "description": "Unknown type.", "type": "object", "additionalProperties": false }, { - "description": "range type", + "description": "Range type.", "type": "object", "additionalProperties": false, "properties": { @@ -178,7 +178,7 @@ } }, { - "description": "keynum type", + "description": "Keynum type.", "type": "object", "additionalProperties": false, "properties": { @@ -202,7 +202,7 @@ }, { "type": "array", - "description": "subcommands" + "description": "Subcommands." } ] } diff --git a/src/commands/command-list.json b/src/commands/command-list.json index 7f4e3f5da0..e050968517 100644 --- a/src/commands/command-list.json +++ b/src/commands/command-list.json @@ -46,7 +46,7 @@ "reply_schema": { "type": "array", "items": { - "description": "command name", + "description": "Command name.", "type": "string" }, "uniqueItems": true diff --git a/src/commands/copy.json b/src/commands/copy.json index b30ddaeae7..7774782f45 100644 --- a/src/commands/copy.json +++ b/src/commands/copy.json @@ -78,11 +78,11 @@ "reply_schema": { "oneOf": [ { - "description": "source was copied", + "description": "Source was copied.", "const": 1 }, { - "description": "source was not copied", + "description": "Source was not copied.", "const": 0 } ] diff --git a/src/commands/del.json b/src/commands/del.json index 2727b536c2..c8c7524f5f 100644 --- a/src/commands/del.json +++ b/src/commands/del.json @@ -37,7 +37,7 @@ } ], "reply_schema": { - "description": "the number of keys that were removed", + "description": "The number of keys that were removed.", "type": "integer", "minimum": 0 }, diff --git a/src/commands/function-dump.json b/src/commands/function-dump.json index d117241de3..da95fcd2fb 100644 --- a/src/commands/function-dump.json +++ b/src/commands/function-dump.json @@ -14,7 +14,7 @@ "SCRIPTING" ], "reply_schema": { - "description": "the serialized payload", + "description": "The serialized payload.", "type": "string" } } diff --git a/src/commands/function-list.json b/src/commands/function-list.json index 2ab1cf510c..d34176bca6 100644 --- a/src/commands/function-list.json +++ b/src/commands/function-list.json @@ -23,26 +23,26 @@ "additionalProperties": false, "properties": { "library_name": { - "description": " the name of the library", + "description": "The name of the library.", "type": "string" }, "engine": { - "description": "the engine of the library", + "description": "The engine of the library.", "type": "string" }, "functions": { - "description": "the list of functions in the library", + "description": "The list of functions in the library.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "name": { - "description": "the name of the function", + "description": "The name of the function.", "type": "string" }, "description": { - "description": "the function's description", + "description": "The function's description.", "oneOf": [ { "type": "null" @@ -53,7 +53,7 @@ ] }, "flags": { - "description": "an array of function flags", + "description": "An array of function flags.", "type": "array", "items": { "type": "string" @@ -63,7 +63,7 @@ } }, "library_code": { - "description": "the library's source code (when given the WITHCODE modifier)", + "description": "The library's source code (when given the WITHCODE modifier).", "type": "string" } } diff --git a/src/commands/function-stats.json b/src/commands/function-stats.json index 65519db1c3..42a3c032eb 100644 --- a/src/commands/function-stats.json +++ b/src/commands/function-stats.json @@ -24,30 +24,30 @@ "additionalProperties": false, "properties": { "running_script": { - "description": "information about the running script.", + "description": "Information about the running script.", "oneOf": [ { - "description": "If there's no in-flight function", + "description": "If there's no in-flight function.", "type": "null" }, { - "description": "a map with the information about the running script", + "description": "A map with the information about the running script.", "type": "object", "additionalProperties": false, "properties": { "name": { - "description": "the name of the function.", + "description": "The name of the function.", "type": "string" }, "command": { - "description": "the command and arguments used for invoking the function.", + "description": "The command and arguments used for invoking the function.", "type": "array", "items": { "type": "string" } }, "duration_ms": { - "description": "the function's runtime duration in milliseconds.", + "description": "The function's runtime duration in milliseconds.", "type": "integer" } } @@ -59,16 +59,16 @@ "type": "object", "patternProperties": { "^.*$": { - "description": "Engine map contains statistics about the engine", + "description": "Engine map contains statistics about the engine.", "type": "object", "additionalProperties": false, "properties": { "libraries_count": { - "description": "number of libraries", + "description": "Number of libraries.", "type": "integer" }, "functions_count": { - "description": "number of functions", + "description": "Number of functions.", "type": "integer" } } diff --git a/src/commands/geodist.json b/src/commands/geodist.json index 145ca718a8..b49705d0cd 100644 --- a/src/commands/geodist.json +++ b/src/commands/geodist.json @@ -77,11 +77,11 @@ "reply_schema": { "oneOf": [ { - "description": "one or both of elements are missing", + "description": "One or both of elements are missing.", "type": "null" }, { - "description": "distance as a double (represented as a string) in the specified units", + "description": "Distance as a double (represented as a string) in the specified units.", "type": "string", "pattern": "^[0-9]*(.[0-9]*)?$" } diff --git a/src/commands/georadius.json b/src/commands/georadius.json index 6ced9049ce..2e01b2b3d8 100644 --- a/src/commands/georadius.json +++ b/src/commands/georadius.json @@ -208,13 +208,13 @@ } ], "reply_schema": { - "description": "Array of matched members information", + "description": "Array of matched members information.", "anyOf": [ { - "description": "If no WITH* option is specified, array of matched members names", + "description": "If no WITH* option is specified, array of matched members names.", "type": "array", "items": { - "description": "name", + "description": "Name.", "type": "string" } }, @@ -226,32 +226,32 @@ "maxItems": 4, "items": [ { - "description": "Matched member name", + "description": "Matched member name.", "type": "string" } ], "additionalItems": { "oneOf": [ { - "description": "If WITHDIST option is specified, the distance from the center as a floating point number, in the same unit specified in the radius", + "description": "If WITHDIST option is specified, the distance from the center as a floating point number, in the same unit specified in the radius.", "type": "string" }, { - "description": "If WITHHASH option is specified, the geohash integer", + "description": "If WITHHASH option is specified, the geohash integer.", "type": "integer" }, { - "description": "If WITHCOORD option is specified, the coordinates as a two items x,y array (longitude,latitude)", + "description": "If WITHCOORD option is specified, the coordinates as a two items x,y array (longitude,latitude).", "type": "array", "minItems": 2, "maxItems": 2, "items": [ { - "description": "latitude (x)", + "description": "Latitude (x).", "type": "number" }, { - "description": "longitude (y)", + "description": "Longitude (y).", "type": "number" } ] @@ -261,7 +261,7 @@ } }, { - "description": "number of items stored in key", + "description": "Number of items stored in key.", "type": "integer" } ] diff --git a/src/commands/georadius_ro.json b/src/commands/georadius_ro.json index b3d335d4a1..ac6dcba510 100644 --- a/src/commands/georadius_ro.json +++ b/src/commands/georadius_ro.json @@ -147,13 +147,13 @@ } ], "reply_schema": { - "description": "Array of matched members information", + "description": "Array of matched members information.", "anyOf": [ { - "description": "If no WITH* option is specified, array of matched members names", + "description": "If no WITH* option is specified, array of matched members names.", "type": "array", "items": { - "description": "name", + "description": "Name.", "type": "string" } }, @@ -165,32 +165,32 @@ "maxItems": 4, "items": [ { - "description": "Matched member name", + "description": "Matched member name.", "type": "string" } ], "additionalItems": { "oneOf": [ { - "description": "If WITHDIST option is specified, the distance from the center as a floating point number, in the same unit specified in the radius", + "description": "If WITHDIST option is specified, the distance from the center as a floating point number, in the same unit specified in the radius.", "type": "string" }, { - "description": "If WITHHASH option is specified, the geohash integer", + "description": "If WITHHASH option is specified, the geohash integer.", "type": "integer" }, { - "description": "If WITHCOORD option is specified, the coordinates as a two items x,y array (longitude,latitude)", + "description": "If WITHCOORD option is specified, the coordinates as a two items x,y array (longitude,latitude).", "type": "array", "minItems": 2, "maxItems": 2, "items": [ { - "description": "latitude (x)", + "description": "Latitude (x).", "type": "number" }, { - "description": "longitude (y)", + "description": "Longitude (y).", "type": "number" } ] diff --git a/src/commands/georadiusbymember.json b/src/commands/georadiusbymember.json index 6102a1b163..7600b4da39 100644 --- a/src/commands/georadiusbymember.json +++ b/src/commands/georadiusbymember.json @@ -203,13 +203,13 @@ } ], "reply_schema": { - "description": "Array of matched members information", + "description": "Array of matched members information.", "anyOf": [ { - "description": "If no WITH* option is specified, array of matched members names", + "description": "If no WITH* option is specified, array of matched members names.", "type": "array", "items": { - "description": "name", + "description": "Name", "type": "string" } }, @@ -221,32 +221,32 @@ "maxItems": 4, "items": [ { - "description": "Matched member name", + "description": "Matched member name.", "type": "string" } ], "additionalItems": { "oneOf": [ { - "description": "If WITHDIST option is specified, the distance from the center as a floating point number, in the same unit specified in the radius", + "description": "If WITHDIST option is specified, the distance from the center as a floating point number, in the same unit specified in the radius.", "type": "string" }, { - "description": "If WITHHASH option is specified, the geohash integer", + "description": "If WITHHASH option is specified, the geohash integer.", "type": "integer" }, { - "description": "If WITHCOORD option is specified, the coordinates as a two items x,y array (longitude,latitude)", + "description": "If WITHCOORD option is specified, the coordinates as a two items x,y array (longitude,latitude).", "type": "array", "minItems": 2, "maxItems": 2, "items": [ { - "description": "latitude (x)", + "description": "Latitude (x).", "type": "number" }, { - "description": "longitude (y)", + "description": "Longitude (y).", "type": "number" } ] @@ -256,7 +256,7 @@ } }, { - "description": "number of items stored in key", + "description": "Number of items stored in key.", "type": "integer" } ] diff --git a/src/commands/georadiusbymember_ro.json b/src/commands/georadiusbymember_ro.json index 0cc599feff..ea4f94bddb 100644 --- a/src/commands/georadiusbymember_ro.json +++ b/src/commands/georadiusbymember_ro.json @@ -142,13 +142,13 @@ } ], "reply_schema": { - "description": "Array of matched members information", + "description": "Array of matched members information.", "anyOf": [ { - "description": "If no WITH* option is specified, array of matched members names", + "description": "If no WITH* option is specified, array of matched members names.", "type": "array", "items": { - "description": "name", + "description": "Name.", "type": "string" } }, @@ -160,32 +160,32 @@ "maxItems": 4, "items": [ { - "description": "Matched member name", + "description": "Matched member name.", "type": "string" } ], "additionalItems": { "oneOf": [ { - "description": "If WITHDIST option is specified, the distance from the center as a floating point number, in the same unit specified in the radius", + "description": "If WITHDIST option is specified, the distance from the center as a floating point number, in the same unit specified in the radius.", "type": "string" }, { - "description": "If WITHHASH option is specified, the geohash integer", + "description": "If WITHHASH option is specified, the geohash integer.", "type": "integer" }, { - "description": "If WITHCOORD option is specified, the coordinates as a two items x,y array (longitude,latitude)", + "description": "If WITHCOORD option is specified, the coordinates as a two items x,y array (longitude,latitude).", "type": "array", "minItems": 2, "maxItems": 2, "items": [ { - "description": "latitude (x)", + "description": "Latitude (x).", "type": "number" }, { - "description": "longitude (y)", + "description": "Longitude (y).", "type": "number" } ] diff --git a/src/commands/geosearch.json b/src/commands/geosearch.json index b2e2825d96..2214c4a8a6 100644 --- a/src/commands/geosearch.json +++ b/src/commands/geosearch.json @@ -209,13 +209,13 @@ } ], "reply_schema": { - "description": "Array of matched members information", + "description": "Array of matched members information.", "anyOf": [ { - "description": "If no WITH* option is specified, array of matched members names", + "description": "If no WITH* option is specified, array of matched members names.", "type": "array", "items": { - "description": "name", + "description": "Name.", "type": "string" } }, @@ -227,32 +227,32 @@ "maxItems": 4, "items": [ { - "description": "Matched member name", + "description": "Matched member name.", "type": "string" } ], "additionalItems": { "oneOf": [ { - "description": "If WITHDIST option is specified, the distance from the center as a floating point number, in the same unit specified in the radius", + "description": "If WITHDIST option is specified, the distance from the center as a floating point number, in the same unit specified in the radius.", "type": "string" }, { - "description": "If WITHHASH option is specified, the geohash integer", + "description": "If WITHHASH option is specified, the geohash integer.", "type": "integer" }, { - "description": "If WITHCOORD option is specified, the coordinates as a two items x,y array (longitude,latitude)", + "description": "If WITHCOORD option is specified, the coordinates as a two items x,y array (longitude,latitude).", "type": "array", "minItems": 2, "maxItems": 2, "items": [ { - "description": "latitude (x)", + "description": "Latitude (x).", "type": "number" }, { - "description": "longitude (y)", + "description": "Longitude (y).", "type": "number" } ] diff --git a/src/commands/geosearchstore.json b/src/commands/geosearchstore.json index dfbdaaaeca..0e7f61a8f8 100644 --- a/src/commands/geosearchstore.json +++ b/src/commands/geosearchstore.json @@ -221,7 +221,7 @@ } ], "reply_schema": { - "description": "the number of elements in the resulting set", + "description": "The number of elements in the resulting set.", "type": "integer" } } diff --git a/src/commands/hscan.json b/src/commands/hscan.json index 99e916574f..9e6099c2f2 100644 --- a/src/commands/hscan.json +++ b/src/commands/hscan.json @@ -65,17 +65,17 @@ } ], "reply_schema": { - "description": "cursor and scan response in array form", + "description": "Cursor and scan response in array form.", "type": "array", "minItems": 2, "maxItems": 2, "items": [ { - "description": "cursor", + "description": "Cursor.", "type": "string" }, { - "description": "list of key/value pairs from the hash where each even element is the key, and each odd element is the value, or when novalues option is on, a list of keys from the hash", + "description": "List of key/value pairs from the hash where each even element is the key, and each odd element is the value, or when novalues option is on, a list of keys from the hash.", "type": "array", "items": { "type": "string" diff --git a/src/commands/keys.json b/src/commands/keys.json index 9dd4e1101b..2aa9c280fd 100644 --- a/src/commands/keys.json +++ b/src/commands/keys.json @@ -24,7 +24,7 @@ } ], "reply_schema": { - "description": "list of keys matching pattern", + "description": "List of keys matching pattern.", "type": "array", "items": { "type": "string" diff --git a/src/commands/latency-history.json b/src/commands/latency-history.json index 7c3591aa2d..0c825004eb 100644 --- a/src/commands/latency-history.json +++ b/src/commands/latency-history.json @@ -27,12 +27,12 @@ "maxItems": 2, "items": [ { - "description": "timestamp of the event", + "description": "Timestamp of the event.", "type": "integer", "minimum": 0 }, { - "description": "latency of the event", + "description": "Latency of the event.", "type": "integer", "minimum": 0 } diff --git a/src/commands/linsert.json b/src/commands/linsert.json index 8059dc50d4..f26e679f8c 100644 --- a/src/commands/linsert.json +++ b/src/commands/linsert.json @@ -41,11 +41,11 @@ "minimum": 1 }, { - "description": "in case key doesn't exist.", + "description": "In case key doesn't exist.", "const": 0 }, { - "description": "when the pivot wasn't found.", + "description": "When the pivot wasn't found.", "const": -1 } ] diff --git a/src/commands/lpushx.json b/src/commands/lpushx.json index 5f6d17cbc7..59a31539c9 100644 --- a/src/commands/lpushx.json +++ b/src/commands/lpushx.json @@ -42,7 +42,7 @@ ], "reply_schema": { "type": "integer", - "description": "the length of the list after the push operation", + "description": "The length of the list after the push operation.", "minimum": 0 }, "arguments": [ diff --git a/src/commands/memory-doctor.json b/src/commands/memory-doctor.json index c0c8c22a8e..7bc0e1e6e2 100644 --- a/src/commands/memory-doctor.json +++ b/src/commands/memory-doctor.json @@ -13,7 +13,7 @@ "RESPONSE_POLICY:SPECIAL" ], "reply_schema": { - "description": "memory problems report", + "description": "Memory problems report.", "type": "string" } } diff --git a/src/commands/memory-stats.json b/src/commands/memory-stats.json index 98e49b7d27..e32f5a291b 100644 --- a/src/commands/memory-stats.json +++ b/src/commands/memory-stats.json @@ -13,7 +13,7 @@ "RESPONSE_POLICY:SPECIAL" ], "reply_schema": { - "description": "memory usage details", + "description": "Memory usage details.", "type": "object", "additionalProperties": false, "properties": { diff --git a/src/commands/move.json b/src/commands/move.json index 203068067f..54ec2f21ec 100644 --- a/src/commands/move.json +++ b/src/commands/move.json @@ -48,11 +48,11 @@ "reply_schema": { "oneOf": [ { - "description": "key was moved", + "description": "Key was moved.", "const": 1 }, { - "description": "key wasn't moved", + "description": "Key wasn't moved.", "const": 0 } ] diff --git a/src/commands/object-encoding.json b/src/commands/object-encoding.json index 3fab4aadb5..4ccf3f04b6 100644 --- a/src/commands/object-encoding.json +++ b/src/commands/object-encoding.json @@ -45,11 +45,11 @@ "reply_schema": { "oneOf": [ { - "description": "key doesn't exist", + "description": "Key doesn't exist.", "type": "null" }, { - "description": "encoding of the object", + "description": "Encoding of the object.", "type": "string" } ] diff --git a/src/commands/object-freq.json b/src/commands/object-freq.json index 7a7553b188..7e1b2e24e1 100644 --- a/src/commands/object-freq.json +++ b/src/commands/object-freq.json @@ -43,7 +43,7 @@ } ], "reply_schema": { - "description": "the counter's value", + "description": "The counter's value.", "type": "integer" } } diff --git a/src/commands/object-idletime.json b/src/commands/object-idletime.json index dc1d254c8e..372ff3ad00 100644 --- a/src/commands/object-idletime.json +++ b/src/commands/object-idletime.json @@ -43,7 +43,7 @@ } ], "reply_schema": { - "description": "the idle time in seconds", + "description": "The idle time in seconds.", "type": "integer" } } diff --git a/src/commands/object-refcount.json b/src/commands/object-refcount.json index 48009bbf75..3586f85a0f 100644 --- a/src/commands/object-refcount.json +++ b/src/commands/object-refcount.json @@ -43,7 +43,7 @@ } ], "reply_schema": { - "description": "the number of references", + "description": "The number of references.", "type": "integer" } } diff --git a/src/commands/pfadd.json b/src/commands/pfadd.json index 7d8448ad89..769a2f010c 100644 --- a/src/commands/pfadd.json +++ b/src/commands/pfadd.json @@ -50,11 +50,11 @@ "reply_schema": { "oneOf": [ { - "description": "if at least 1 HyperLogLog internal register was altered", + "description": "If at least 1 HyperLogLog internal register was altered.", "const": 1 }, { - "description": "if no HyperLogLog internal register were altered", + "description": "If no HyperLogLog internal register were altered.", "const": 0 } ] diff --git a/src/commands/publish.json b/src/commands/publish.json index 51890bf9c7..0dade72064 100644 --- a/src/commands/publish.json +++ b/src/commands/publish.json @@ -25,7 +25,7 @@ } ], "reply_schema": { - "description": "the number of clients that received the message. Note that in a Cluster, only clients that are connected to the same node as the publishing client are included in the count", + "description": "The number of clients that received the message. Note that in a Cluster, only clients that are connected to the same node as the publishing client are included in the count.", "type": "integer", "minimum": 0 } diff --git a/src/commands/pubsub-channels.json b/src/commands/pubsub-channels.json index 08505b3eba..1060131620 100644 --- a/src/commands/pubsub-channels.json +++ b/src/commands/pubsub-channels.json @@ -20,7 +20,7 @@ } ], "reply_schema": { - "description": "a list of active channels, optionally matching the specified pattern", + "description": "A list of active channels, optionally matching the specified pattern.", "type": "array", "uniqueItems": true, "items": { diff --git a/src/commands/pubsub-numpat.json b/src/commands/pubsub-numpat.json index ae653b74f6..8d3114f2e6 100644 --- a/src/commands/pubsub-numpat.json +++ b/src/commands/pubsub-numpat.json @@ -13,7 +13,7 @@ "STALE" ], "reply_schema": { - "description": "the number of patterns all the clients are subscribed to", + "description": "The number of patterns all the clients are subscribed to.", "type": "integer", "minimum": 0 } diff --git a/src/commands/pubsub-numsub.json b/src/commands/pubsub-numsub.json index 1cfe8e2ef1..e4b4ccdce4 100644 --- a/src/commands/pubsub-numsub.json +++ b/src/commands/pubsub-numsub.json @@ -21,7 +21,7 @@ } ], "reply_schema": { - "description": "the number of subscribers per channel, each even element (including 0th) is channel name, each odd element is the number of subscribers", + "description": "The number of subscribers per channel, each even element (including 0th) is channel name, each odd element is the number of subscribers.", "type": "array" } } diff --git a/src/commands/pubsub-shardchannels.json b/src/commands/pubsub-shardchannels.json index 7aa0a7a878..921a4a4327 100644 --- a/src/commands/pubsub-shardchannels.json +++ b/src/commands/pubsub-shardchannels.json @@ -20,7 +20,7 @@ } ], "reply_schema": { - "description": "a list of active channels, optionally matching the specified pattern", + "description": "A list of active channels, optionally matching the specified pattern.", "type": "array", "items": { "type": "string" diff --git a/src/commands/pubsub-shardnumsub.json b/src/commands/pubsub-shardnumsub.json index 43675340fa..8eeca4e31b 100644 --- a/src/commands/pubsub-shardnumsub.json +++ b/src/commands/pubsub-shardnumsub.json @@ -21,7 +21,7 @@ } ], "reply_schema": { - "description": "the number of subscribers per shard channel, each even element (including 0th) is channel name, each odd element is the number of subscribers", + "description": "The number of subscribers per shard channel, each even element (including 0th) is channel name, each odd element is the number of subscribers.", "type": "array" } } diff --git a/src/commands/randomkey.json b/src/commands/randomkey.json index eeef61aef1..29e54f6e24 100644 --- a/src/commands/randomkey.json +++ b/src/commands/randomkey.json @@ -21,11 +21,11 @@ "reply_schema": { "oneOf": [ { - "description": "when the database is empty", + "description": "When the database is empty.", "type": "null" }, { - "description": "random key in db", + "description": "Random key in db.", "type": "string" } ] diff --git a/src/commands/renamenx.json b/src/commands/renamenx.json index 72f0569d8e..e59c53bfcc 100644 --- a/src/commands/renamenx.json +++ b/src/commands/renamenx.json @@ -73,11 +73,11 @@ "reply_schema": { "oneOf": [ { - "description": "key was renamed to newkey", + "description": "Key was renamed to newkey.", "const": 1 }, { - "description": "new key already exists", + "description": "New key already exists.", "const": 0 } ] diff --git a/src/commands/replicaof.json b/src/commands/replicaof.json index 95e5cb400b..6ddedf2d68 100644 --- a/src/commands/replicaof.json +++ b/src/commands/replicaof.json @@ -51,7 +51,7 @@ } ], "reply_schema": { - "description": "replicaOf status", + "description": "ReplicaOf status.", "type": "string", "pattern": "OK*" } diff --git a/src/commands/role.json b/src/commands/role.json index a0299fa73e..1c3a4490ca 100644 --- a/src/commands/role.json +++ b/src/commands/role.json @@ -28,11 +28,11 @@ "const": "master" }, { - "description": "current replication master offset", + "description": "Current replication master offset.", "type": "integer" }, { - "description": "connected replicas", + "description": "Connected replicas.", "type": "array", "items": { "type": "array", @@ -40,15 +40,15 @@ "maxItems": 3, "items": [ { - "description": "replica ip", + "description": "Replica IP.", "type": "string" }, { - "description": "replica port", + "description": "Replica port.", "type": "string" }, { - "description": "last acknowledged replication offset", + "description": "Last acknowledged replication offset.", "type": "string" } ] @@ -65,48 +65,48 @@ "const": "slave" }, { - "description": "ip of master", + "description": "IP of master.", "type": "string" }, { - "description": "port number of master", + "description": "Port number of master.", "type": "integer" }, { - "description": "state of the replication from the point of view of the master", + "description": "State of the replication from the point of view of the master.", "oneOf": [ { - "description": "the instance is in handshake with its master", + "description": "The instance is in handshake with its master.", "const": "handshake" }, { - "description": "the instance in not active", + "description": "The instance in not active.", "const": "none" }, { - "description": "the instance needs to connect to its master", + "description": "The instance needs to connect to its master.", "const": "connect" }, { - "description": "the master-replica connection is in progress", + "description": "The master-replica connection is in progress.", "const": "connecting" }, { - "description": "the master and replica are trying to perform the synchronization", + "description": "The master and replica are trying to perform the synchronization.", "const": "sync" }, { - "description": "the replica is online", + "description": "The replica is online.", "const": "connected" }, { - "description": "instance state is unknown", + "description": "Instance state is unknown.", "const": "unknown" } ] }, { - "description": "the amount of data received from the replica so far in terms of master replication offset", + "description": "The amount of data received from the replica so far in terms of master replication offset.", "type": "integer" } ] @@ -120,7 +120,7 @@ "const": "sentinel" }, { - "description": "list of master names monitored by this sentinel instance", + "description": "List of master names monitored by this sentinel instance.", "type": "array", "items": { "type": "string" diff --git a/src/commands/scan.json b/src/commands/scan.json index a7df78a218..2b43c98056 100644 --- a/src/commands/scan.json +++ b/src/commands/scan.json @@ -50,17 +50,17 @@ } ], "reply_schema": { - "description": "cursor and scan response in array form", + "description": "Cursor and scan response in array form.", "type": "array", "minItems": 2, "maxItems": 2, "items": [ { - "description": "cursor", + "description": "Cursor.", "type": "string" }, { - "description": "list of keys", + "description": "List of keys.", "type": "array", "items": { "type": "string" diff --git a/src/commands/script-exists.json b/src/commands/script-exists.json index d8c47e4824..6c98fd78be 100644 --- a/src/commands/script-exists.json +++ b/src/commands/script-exists.json @@ -30,11 +30,11 @@ "items": { "oneOf": [ { - "description": "sha1 hash exists in script cache", + "description": "Sha1 hash exists in script cache.", "const": 1 }, { - "description": "sha1 hash does not exist in script cache", + "description": "Sha1 hash does not exist in script cache.", "const": 0 } ] diff --git a/src/commands/slaveof.json b/src/commands/slaveof.json index af5b54fae0..ca30982887 100644 --- a/src/commands/slaveof.json +++ b/src/commands/slaveof.json @@ -56,7 +56,7 @@ } ], "reply_schema": { - "description": "slaveOf status", + "description": "SlaveOf status.", "type": "string", "pattern": "OK*" } diff --git a/src/commands/sort.json b/src/commands/sort.json index d5f6511142..f2bd187e36 100644 --- a/src/commands/sort.json +++ b/src/commands/sort.json @@ -137,12 +137,12 @@ "reply_schema": { "oneOf": [ { - "description": "when the store option is specified the command returns the number of sorted elements in the destination list", + "description": "When the store option is specified the command returns the number of sorted elements in the destination list.", "type": "integer", "minimum": 0 }, { - "description": "when not passing the store option the command returns a list of sorted elements", + "description": "When not passing the store option the command returns a list of sorted elements.", "type": "array", "items": { "oneOf": [ @@ -150,7 +150,7 @@ "type": "string" }, { - "description": "GET option is specified, but no object was found", + "description": "GET option is specified, but no object was found.", "type": "null" } ] diff --git a/src/commands/sort_ro.json b/src/commands/sort_ro.json index 04cc3c8417..668888cfcc 100644 --- a/src/commands/sort_ro.json +++ b/src/commands/sort_ro.json @@ -114,7 +114,7 @@ } ], "reply_schema": { - "description": "a list of sorted elements", + "description": "A list of sorted elements.", "type": "array", "items": { "oneOf": [ @@ -122,7 +122,7 @@ "type": "string" }, { - "description": "GET option is specified, but no object was found", + "description": "GET option is specified, but no object was found.", "type": "null" } ] diff --git a/src/commands/spublish.json b/src/commands/spublish.json index 1016bd2826..da1360de7c 100644 --- a/src/commands/spublish.json +++ b/src/commands/spublish.json @@ -43,7 +43,7 @@ } ], "reply_schema": { - "description": "the number of clients that received the message. Note that in a Cluster, only clients that are connected to the same node as the publishing client are included in the count", + "description": "The number of clients that received the message. Note that in a Cluster, only clients that are connected to the same node as the publishing client are included in the count.", "type": "integer", "minimum": 0 } diff --git a/src/commands/sscan.json b/src/commands/sscan.json index b221c94cf1..1b78ee3db3 100644 --- a/src/commands/sscan.json +++ b/src/commands/sscan.json @@ -59,17 +59,17 @@ } ], "reply_schema": { - "description": "cursor and scan response in array form", + "description": "Cursor and scan response in array form.", "type": "array", "minItems": 2, "maxItems": 2, "items": [ { - "description": "cursor", + "description": "Cursor.", "type": "string" }, { - "description": "list of set members", + "description": "List of set members.", "type": "array", "items": { "type": "string" diff --git a/src/commands/touch.json b/src/commands/touch.json index fd1dc61c3b..03fc7b8de3 100644 --- a/src/commands/touch.json +++ b/src/commands/touch.json @@ -45,7 +45,7 @@ } ], "reply_schema": { - "description": "the number of touched keys", + "description": "The number of touched keys.", "type": "integer", "minimum": 0 } diff --git a/src/commands/unlink.json b/src/commands/unlink.json index a05704a1b3..81892b35ec 100644 --- a/src/commands/unlink.json +++ b/src/commands/unlink.json @@ -46,7 +46,7 @@ } ], "reply_schema": { - "description": "the number of keys that were unlinked", + "description": "The number of keys that were unlinked.", "type": "integer", "minimum": 0 } diff --git a/src/commands/xclaim.json b/src/commands/xclaim.json index 5c44746067..a908a0de87 100644 --- a/src/commands/xclaim.json +++ b/src/commands/xclaim.json @@ -100,16 +100,16 @@ "description": "Stream entries with IDs matching the specified range.", "anyOf": [ { - "description": "If JUSTID option is specified, return just an array of IDs of messages successfully claimed", + "description": "If JUSTID option is specified, return just an array of IDs of messages successfully claimed.", "type": "array", "items": { - "description": "Entry ID", + "description": "Entry ID.", "type": "string", "pattern": "[0-9]+-[0-9]+" } }, { - "description": "array of stream entries that contains each entry as an array of 2 elements, the Entry ID and the entry data itself", + "description": "Array of stream entries that contains each entry as an array of 2 elements, the Entry ID and the entry data itself.", "type": "array", "uniqueItems": true, "items": { @@ -118,12 +118,12 @@ "maxItems": 2, "items": [ { - "description": "Entry ID", + "description": "Entry ID.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, { - "description": "Data", + "description": "Data.", "type": "array", "items": { "type": "string" diff --git a/src/commands/xinfo-stream.json b/src/commands/xinfo-stream.json index 609dc336d5..f98ea6acdc 100644 --- a/src/commands/xinfo-stream.json +++ b/src/commands/xinfo-stream.json @@ -55,42 +55,42 @@ "additionalProperties": false, "properties": { "length": { - "description": "the number of entries in the stream (see `XLEN`)", + "description": "The number of entries in the stream (see `XLEN`).", "type": "integer" }, "radix-tree-keys": { - "description": "the number of keys in the underlying radix data structure", + "description": "The number of keys in the underlying radix data structure.", "type": "integer" }, "radix-tree-nodes": { - "description": "the number of nodes in the underlying radix data structure", + "description": "The number of nodes in the underlying radix data structure.", "type": "integer" }, "last-generated-id": { - "description": "the ID of the least-recently entry that was added to the stream", + "description": "The ID of the least-recently entry that was added to the stream.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, "max-deleted-entry-id": { - "description": "the maximal entry ID that was deleted from the stream", + "description": "The maximal entry ID that was deleted from the stream.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, "recorded-first-entry-id": { - "description": "cached copy of the first entry ID", + "description": "Cached copy of the first entry ID.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, "entries-added": { - "description": "the count of all entries added to the stream during its lifetime", + "description": "The count of all entries added to the stream during its lifetime.", "type": "integer" }, "groups": { - "description": "the number of consumer groups defined for the stream", + "description": "The number of consumer groups defined for the stream.", "type": "integer" }, "first-entry": { - "description": "the first entry of the stream", + "description": "The first entry of the stream.", "oneOf": [ { "type": "null" @@ -101,12 +101,12 @@ "maxItems": 2, "items": [ { - "description": "entry ID", + "description": "Entry ID.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, { - "description": "data", + "description": "Data.", "type": "array", "items": { "type": "string" @@ -117,7 +117,7 @@ ] }, "last-entry": { - "description": "the last entry of the stream", + "description": "The last entry of the stream.", "oneOf": [ { "type": "null" @@ -128,12 +128,12 @@ "maxItems": 2, "items": [ { - "description": "entry ID", + "description": "Entry ID.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, { - "description": "data", + "description": "Data.", "type": "array", "items": { "type": "string" @@ -151,38 +151,38 @@ "additionalProperties": false, "properties": { "length": { - "description": "the number of entries in the stream (see `XLEN`)", + "description": "The number of entries in the stream (see `XLEN`).", "type": "integer" }, "radix-tree-keys": { - "description": "the number of keys in the underlying radix data structure", + "description": "The number of keys in the underlying radix data structure.", "type": "integer" }, "radix-tree-nodes": { - "description": "the number of nodes in the underlying radix data structure", + "description": "The number of nodes in the underlying radix data structure.", "type": "integer" }, "last-generated-id": { - "description": "the ID of the least-recently entry that was added to the stream", + "description": "The ID of the least-recently entry that was added to the stream.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, "max-deleted-entry-id": { - "description": "the maximal entry ID that was deleted from the stream", + "description": "The maximal entry ID that was deleted from the stream.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, "recorded-first-entry-id": { - "description": "cached copy of the first entry ID", + "description": "Cached copy of the first entry ID.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, "entries-added": { - "description": "the count of all entries added to the stream during its lifetime", + "description": "The count of all entries added to the stream during its lifetime.", "type": "integer" }, "entries": { - "description": "all the entries of the stream", + "description": "All the entries of the stream.", "type": "array", "uniqueItems": true, "items": { @@ -191,12 +191,12 @@ "maxItems": 2, "items": [ { - "description": "entry ID", + "description": "Entry ID.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, { - "description": "data", + "description": "Data.", "type": "array", "items": { "type": "string" @@ -212,16 +212,16 @@ "additionalProperties": false, "properties": { "name": { - "description": "group name", + "description": "Group name.", "type": "string" }, "last-delivered-id": { - "description": "last entry ID that was delivered to a consumer", + "description": "Last entry ID that was delivered to a consumer.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, "entries-read": { - "description": "total number of entries ever read by consumers in the group", + "description": "Total number of entries ever read by consumers in the group.", "oneOf": [ { "type": "null" @@ -232,7 +232,7 @@ ] }, "lag": { - "description": "number of entries left to be consumed from the stream", + "description": "Number of entries left to be consumed from the stream.", "oneOf": [ { "type": "null" @@ -243,11 +243,11 @@ ] }, "pel-count": { - "description": "total number of unacknowledged entries", + "description": "Total number of unacknowledged entries.", "type": "integer" }, "pending": { - "description": "data about all of the unacknowledged entries", + "description": "Data about all of the unacknowledged entries.", "type": "array", "items": { "type": "array", @@ -255,27 +255,27 @@ "maxItems": 4, "items": [ { - "description": "Entry ID", + "description": "Entry ID.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, { - "description": "Consumer name", + "description": "Consumer name.", "type": "string" }, { - "description": "Delivery timestamp", + "description": "Delivery timestamp.", "type": "integer" }, { - "description": "Delivery count", + "description": "Delivery count.", "type": "integer" } ] } }, "consumers": { - "description": "data about all of the consumers of the group", + "description": "Data about all of the consumers of the group.", "type": "array", "items": { "type": "object", @@ -287,20 +287,20 @@ "minimum": 0 }, "name": { - "description": "consumer name", + "description": "Consumer name.", "type": "string" }, "seen-time": { - "description": "timestamp of the last interaction attempt of the consumer", + "description": "Timestamp of the last interaction attempt of the consumer.", "type": "integer", "minimum": 0 }, "pel-count": { - "description": "number of unacknowledged entries that belong to the consumer", + "description": "Number of unacknowledged entries that belong to the consumer.", "type": "integer" }, "pending": { - "description": "data about the unacknowledged entries", + "description": "Data about the unacknowledged entries.", "type": "array", "items": { "type": "array", @@ -308,16 +308,16 @@ "maxItems": 3, "items": [ { - "description": "Entry ID", + "description": "Entry ID.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, { - "description": "Delivery timestamp", + "description": "Delivery timestamp.", "type": "integer" }, { - "description": "Delivery count", + "description": "Delivery count.", "type": "integer" } ] diff --git a/src/commands/xread.json b/src/commands/xread.json index 95e22c494e..b448903bb6 100644 --- a/src/commands/xread.json +++ b/src/commands/xread.json @@ -69,11 +69,11 @@ "reply_schema": { "oneOf": [ { - "description": "A map of key-value elements when each element composed of key name and the entries reported for that key", + "description": "A map of key-value elements when each element composed of key name and the entries reported for that key.", "type": "object", "patternProperties": { "^.*$": { - "description": "The entries reported for that key", + "description": "The entries reported for that key.", "type": "array", "items": { "type": "array", @@ -81,12 +81,12 @@ "maxItems": 2, "items": [ { - "description": "entry id", + "description": "Entry id.", "type": "string", "pattern": "[0-9]+-[0-9]+" }, { - "description": "array of field-value pairs", + "description": "A map of key-value elements when each element composed of key name and the entries reported for that key.", "type": "array", "items": { "type": "string" @@ -98,7 +98,7 @@ } }, { - "description": "If BLOCK option is given, and a timeout occurs, or there is no stream we can serve", + "description": "If BLOCK option is given, and a timeout occurs, or there is no stream we can serve.", "type": "null" } ] diff --git a/src/commands/zrangebyscore.json b/src/commands/zrangebyscore.json index 557ef1dc62..c89607e104 100644 --- a/src/commands/zrangebyscore.json +++ b/src/commands/zrangebyscore.json @@ -47,29 +47,29 @@ "anyOf": [ { "type": "array", - "description": "List of the elements in the specified score range, as not WITHSCORES", + "description": "List of the elements in the specified score range, as not WITHSCORES.", "uniqueItems": true, "items": { "type": "string", - "description": "Element" + "description": "Element." } }, { "type": "array", - "description": "List of the elements and their scores in the specified score range, as WITHSCORES used", + "description": "List of the elements and their scores in the specified score range, as WITHSCORES used.", "uniqueItems": true, "items": { "type": "array", - "description": "Tuple of element and its score", + "description": "Tuple of element and its score.", "minItems": 2, "maxItems": 2, "items": [ { - "description": "element", + "description": "Element.", "type": "string" }, { - "description": "score", + "description": "Score.", "type": "number" } ] diff --git a/src/commands/zrevrange.json b/src/commands/zrevrange.json index 116fe82b24..a143f72153 100644 --- a/src/commands/zrevrange.json +++ b/src/commands/zrevrange.json @@ -57,11 +57,11 @@ "maxItems": 2, "items": [ { - "description": "member", + "description": "Member.", "type": "string" }, { - "description": "score", + "description": "Score.", "type": "number" } ] diff --git a/src/commands/zrevrangebyscore.json b/src/commands/zrevrangebyscore.json index ab040527e1..0eb9e86956 100644 --- a/src/commands/zrevrangebyscore.json +++ b/src/commands/zrevrangebyscore.json @@ -47,30 +47,30 @@ "anyOf": [ { "type": "array", - "description": "List of the elements in the specified score range, as not WITHSCORES", + "description": "List of the elements in the specified score range, as not WITHSCORES.", "uniqueItems": true, "items": { "type": "string", - "description": "Element" + "description": "Element." } }, { "type": "array", - "description": "List of the elements and their scores in the specified score range, as WITHSCORES used", + "description": "List of the elements and their scores in the specified score range, as WITHSCORES used.", "uniqueItems": true, "items": { "type": "array", - "description": "Tuple of element and its score", + "description": "Tuple of element and its score.", "minItems": 2, "maxItems": 2, "items": [ { "type": "string", - "description": "element" + "description": "Element." }, { "type": "number", - "description": "score" + "description": "Score." } ] } diff --git a/src/commands/zscan.json b/src/commands/zscan.json index 7c69ccf65a..edadb8561b 100644 --- a/src/commands/zscan.json +++ b/src/commands/zscan.json @@ -59,17 +59,17 @@ } ], "reply_schema": { - "description": "cursor and scan response in array form", + "description": "Cursor and scan response in array form.", "type": "array", "minItems": 2, "maxItems": 2, "items": [ { - "description": "cursor", + "description": "Cursor.", "type": "string" }, { - "description": "list of elements of the sorted set, where each even element is the member, and each odd value is its associated score", + "description": "List of elements of the sorted set, where each even element is the member, and each odd value is its associated score.", "type": "array", "items": { "type": "string" From c9fff601789e82dd409a0231eb698c31447b8f61 Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Wed, 3 Apr 2024 00:48:26 +0700 Subject: [PATCH 27/49] Pin 'typos' spellcheck to fixed version in CI (#151) Pin aiki-e/install-action to v2.32.2 (currently the latest version). Fixes #140. Signed-off-by: 0del --- .github/workflows/spell-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index 1e6f58aacb..e146b79c94 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -19,7 +19,7 @@ jobs: uses: actions/checkout@v4 - name: Install typos - uses: taiki-e/install-action@v2 + uses: taiki-e/install-action@v2.32.2 with: tool: typos From c0a83c00583ed2959079ae34ed8ca4cf7f90a264 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Tue, 2 Apr 2024 14:48:12 -0400 Subject: [PATCH 28/49] Fix CI centos issue (#150) Because centos do not support actions/checkout@v4, we need roll back to actions/checkout@v3 Please check the run result https://github.com/hwware/placeholderkv/actions/runs/8526052560/job/23354458574 It looks our CI make happy now Signed-off-by: hwware --- .github/workflows/daily.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index bb0a7daf07..a4ecf31ecf 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -674,7 +674,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -714,7 +714,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} @@ -761,7 +761,7 @@ jobs: echo "skiptests: ${{github.event.inputs.skiptests}}" echo "test_args: ${{github.event.inputs.test_args}}" echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}" - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 with: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} From 7a7288b2922231a38fb02238b299525c074d9dc7 Mon Sep 17 00:00:00 2001 From: Gabi Ganam Date: Wed, 3 Apr 2024 02:03:31 +0300 Subject: [PATCH 29/49] Log unused module configuration entries that cause redis to abort (#132) Log unused module configuration entries that cause redis to abort on startup. Example: ``` 17797:M 31 Mar 2024 12:26:12.146 # Unused Module Configuration: module1.whatever 17797:M 31 Mar 2024 12:26:12.146 # Unused Module Configuration: module2.test 17797:M 31 Mar 2024 12:26:12.146 # Module Configuration detected without loadmodule directive or no ApplyConfig call: aborting ``` Signed-off-by: Gabi Ganam --- src/module.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/module.c b/src/module.c index 416506dc57..4fa96e9526 100644 --- a/src/module.c +++ b/src/module.c @@ -12109,6 +12109,13 @@ void moduleLoadFromQueue(void) { listDelNode(server.loadmodule_queue, ln); } if (dictSize(server.module_configs_queue)) { + dictIterator *di = dictGetSafeIterator(server.module_configs_queue); + dictEntry *de; + while ((de = dictNext(di)) != NULL) { + const char *moduleConfigName = dictGetKey(de); + serverLog(LL_WARNING, "Unused Module Configuration: %s", moduleConfigName); + } + dictReleaseIterator(di); serverLog(LL_WARNING, "Module Configuration detected without loadmodule directive or no ApplyConfig call: aborting"); exit(1); } From 98892bb5c37c181199a66ea7cb85d47f87a357cd Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Wed, 3 Apr 2024 09:29:42 +0700 Subject: [PATCH 30/49] Rename redisMemOverhead to serverMemOverhead (#159) Part of #144. Signed-off-by: 0del --- src/object.c | 12 ++++++------ src/server.c | 2 +- src/server.h | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/object.c b/src/object.c index ee3564657f..6e151f17b3 100644 --- a/src/object.c +++ b/src/object.c @@ -1161,20 +1161,20 @@ size_t objectComputeSize(robj *key, robj *o, size_t sample_size, int dbid) { } /* Release data obtained with getMemoryOverheadData(). */ -void freeMemoryOverheadData(struct redisMemOverhead *mh) { +void freeMemoryOverheadData(struct serverMemOverhead *mh) { zfree(mh->db); zfree(mh); } -/* Return a struct redisMemOverhead filled with memory overhead +/* Return a struct serverMemOverhead filled with memory overhead * information used for the MEMORY OVERHEAD and INFO command. The returned * structure pointer should be freed calling freeMemoryOverheadData(). */ -struct redisMemOverhead *getMemoryOverheadData(void) { +struct serverMemOverhead *getMemoryOverheadData(void) { int j; size_t mem_total = 0; size_t mem = 0; size_t zmalloc_used = zmalloc_used_memory(); - struct redisMemOverhead *mh = zcalloc(sizeof(*mh)); + struct serverMemOverhead *mh = zcalloc(sizeof(*mh)); mh->total_allocated = zmalloc_used; mh->startup_allocated = server.initial_memory_usage; @@ -1309,7 +1309,7 @@ sds getMemoryDoctorReport(void) { int big_client_buf = 0; /* Client buffers are too big. */ int many_scripts = 0; /* Script cache has too many scripts. */ int num_reports = 0; - struct redisMemOverhead *mh = getMemoryOverheadData(); + struct serverMemOverhead *mh = getMemoryOverheadData(); if (mh->total_allocated < (1024*1024*5)) { empty = 1; @@ -1562,7 +1562,7 @@ NULL usage += dictEntryMemUsage(); addReplyLongLong(c,usage); } else if (!strcasecmp(c->argv[1]->ptr,"stats") && c->argc == 2) { - struct redisMemOverhead *mh = getMemoryOverheadData(); + struct serverMemOverhead *mh = getMemoryOverheadData(); addReplyMapLen(c,31+mh->num_dbs); diff --git a/src/server.c b/src/server.c index 1605938d0e..37feaeac73 100644 --- a/src/server.c +++ b/src/server.c @@ -5660,7 +5660,7 @@ sds genRedisInfoString(dict *section_dict, int all_sections, int everything) { const char *evict_policy = evictPolicyToString(); long long memory_lua = evalMemory(); long long memory_functions = functionsMemory(); - struct redisMemOverhead *mh = getMemoryOverheadData(); + struct serverMemOverhead *mh = getMemoryOverheadData(); /* Peak memory is updated from time to time by serverCron() so it * may happen that the instantaneous value is slightly bigger than diff --git a/src/server.h b/src/server.h index b9dbd65e7e..809c6bd29e 100644 --- a/src/server.h +++ b/src/server.h @@ -1396,7 +1396,7 @@ typedef struct redisOpArray { /* This structure is returned by the getMemoryOverheadData() function in * order to return memory overhead information. */ -struct redisMemOverhead { +struct serverMemOverhead { size_t peak_allocated; size_t total_allocated; size_t startup_allocated; @@ -3104,8 +3104,8 @@ void activeDefragCycle(void); unsigned int getLRUClock(void); unsigned int LRU_CLOCK(void); const char *evictPolicyToString(void); -struct redisMemOverhead *getMemoryOverheadData(void); -void freeMemoryOverheadData(struct redisMemOverhead *mh); +struct serverMemOverhead *getMemoryOverheadData(void); +void freeMemoryOverheadData(struct serverMemOverhead *mh); void checkChildrenDone(void); int setOOMScoreAdj(int process_class); void rejectCommandFormat(client *c, const char *fmt, ...); From 717dfe80221463e78cd5033c24ca71c1c582957c Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Wed, 3 Apr 2024 10:02:43 +0700 Subject: [PATCH 31/49] Rename redisDb to serverDb (#156) A task of #144. Signed-off-by: 0del --- src/aof.c | 2 +- src/blocked.c | 6 +-- src/db.c | 94 +++++++++++++++++++++++------------------------ src/debug.c | 4 +- src/defrag.c | 20 +++++----- src/evict.c | 4 +- src/expire.c | 10 ++--- src/lazyfree.c | 2 +- src/module.c | 2 +- src/multi.c | 6 +-- src/object.c | 2 +- src/rdb.c | 4 +- src/replication.c | 8 ++-- src/server.c | 6 +-- src/server.h | 88 ++++++++++++++++++++++---------------------- src/sort.c | 2 +- 16 files changed, 130 insertions(+), 130 deletions(-) diff --git a/src/aof.c b/src/aof.c index 34385f41e7..cfa3df83a9 100644 --- a/src/aof.c +++ b/src/aof.c @@ -2260,7 +2260,7 @@ int rewriteAppendOnlyFileRio(rio *aof) { for (j = 0; j < server.dbnum; j++) { char selectcmd[] = "*2\r\n$6\r\nSELECT\r\n"; - redisDb *db = server.db + j; + serverDb *db = server.db + j; if (kvstoreSize(db->keys) == 0) continue; /* SELECT the new DB */ diff --git a/src/blocked.c b/src/blocked.c index ff915aab06..aeac106706 100644 --- a/src/blocked.c +++ b/src/blocked.c @@ -453,7 +453,7 @@ static blocking_type getBlockedTypeByType(int type) { * made by a script or in the context of MULTI/EXEC. * * The list will be finally processed by handleClientsBlockedOnKeys() */ -static void signalKeyAsReadyLogic(redisDb *db, robj *key, int type, int deleted) { +static void signalKeyAsReadyLogic(serverDb *db, robj *key, int type, int deleted) { readyList *rl; /* Quick returns. */ @@ -548,11 +548,11 @@ static void releaseBlockedEntry(client *c, dictEntry *de, int remove_key) { dictDelete(c->bstate.keys, key); } -void signalKeyAsReady(redisDb *db, robj *key, int type) { +void signalKeyAsReady(serverDb *db, robj *key, int type) { signalKeyAsReadyLogic(db, key, type, 0); } -void signalDeletedKeyAsReady(redisDb *db, robj *key, int type) { +void signalDeletedKeyAsReady(serverDb *db, robj *key, int type) { signalKeyAsReadyLogic(db, key, type, 1); } diff --git a/src/db.c b/src/db.c index 43b1ba5586..e54d4e471e 100644 --- a/src/db.c +++ b/src/db.c @@ -52,9 +52,9 @@ typedef enum { KEY_DELETED /* The key was deleted now. */ } keyStatus; -keyStatus expireIfNeeded(redisDb *db, robj *key, int flags); -int keyIsExpired(redisDb *db, robj *key); -static void dbSetValue(redisDb *db, robj *key, robj *val, int overwrite, dictEntry *de); +keyStatus expireIfNeeded(serverDb *db, robj *key, int flags); +int keyIsExpired(serverDb *db, robj *key); +static void dbSetValue(serverDb *db, robj *key, robj *val, int overwrite, dictEntry *de); /* Update LFU when an object is accessed. * Firstly, decrement the counter if the decrement time is reached. @@ -92,7 +92,7 @@ void updateLFU(robj *val) { * Even if the key expiry is master-driven, we can correctly report a key is * expired on replicas even if the master is lagging expiring our key via DELs * in the replication link. */ -robj *lookupKey(redisDb *db, robj *key, int flags) { +robj *lookupKey(serverDb *db, robj *key, int flags) { dictEntry *de = dbFind(db, key->ptr); robj *val = NULL; if (de) { @@ -155,14 +155,14 @@ robj *lookupKey(redisDb *db, robj *key, int flags) { * This function is equivalent to lookupKey(). The point of using this function * rather than lookupKey() directly is to indicate that the purpose is to read * the key. */ -robj *lookupKeyReadWithFlags(redisDb *db, robj *key, int flags) { +robj *lookupKeyReadWithFlags(serverDb *db, robj *key, int flags) { serverAssert(!(flags & LOOKUP_WRITE)); return lookupKey(db, key, flags); } /* Like lookupKeyReadWithFlags(), but does not use any flag, which is the * common case. */ -robj *lookupKeyRead(redisDb *db, robj *key) { +robj *lookupKeyRead(serverDb *db, robj *key) { return lookupKeyReadWithFlags(db,key,LOOKUP_NONE); } @@ -172,11 +172,11 @@ robj *lookupKeyRead(redisDb *db, robj *key) { * * Returns the linked value object if the key exists or NULL if the key * does not exist in the specified DB. */ -robj *lookupKeyWriteWithFlags(redisDb *db, robj *key, int flags) { +robj *lookupKeyWriteWithFlags(serverDb *db, robj *key, int flags) { return lookupKey(db, key, flags | LOOKUP_WRITE); } -robj *lookupKeyWrite(redisDb *db, robj *key) { +robj *lookupKeyWrite(serverDb *db, robj *key) { return lookupKeyWriteWithFlags(db, key, LOOKUP_NONE); } @@ -197,7 +197,7 @@ robj *lookupKeyWriteOrReply(client *c, robj *key, robj *reply) { * * If the update_if_existing argument is false, the program is aborted * if the key already exists, otherwise, it can fall back to dbOverwrite. */ -static void dbAddInternal(redisDb *db, robj *key, robj *val, int update_if_existing) { +static void dbAddInternal(serverDb *db, robj *key, robj *val, int update_if_existing) { dictEntry *existing; int slot = getKeySlot(key->ptr); dictEntry *de = kvstoreDictAddRaw(db->keys, slot, key->ptr, &existing); @@ -213,7 +213,7 @@ static void dbAddInternal(redisDb *db, robj *key, robj *val, int update_if_exist notifyKeyspaceEvent(NOTIFY_NEW,"new",key,db->id); } -void dbAdd(redisDb *db, robj *key, robj *val) { +void dbAdd(serverDb *db, robj *key, robj *val) { dbAddInternal(db, key, val, 0); } @@ -251,7 +251,7 @@ int getKeySlot(sds key) { * The function returns 1 if the key was added to the database, taking * ownership of the SDS string, otherwise 0 is returned, and is up to the * caller to free the SDS string. */ -int dbAddRDBLoad(redisDb *db, sds key, robj *val) { +int dbAddRDBLoad(serverDb *db, sds key, robj *val) { int slot = getKeySlot(key); dictEntry *de = kvstoreDictAddRaw(db->keys, slot, key, NULL); if (de == NULL) return 0; @@ -272,7 +272,7 @@ int dbAddRDBLoad(redisDb *db, sds key, robj *val) { * The dictEntry input is optional, can be used if we already have one. * * The program is aborted if the key was not already present. */ -static void dbSetValue(redisDb *db, robj *key, robj *val, int overwrite, dictEntry *de) { +static void dbSetValue(serverDb *db, robj *key, robj *val, int overwrite, dictEntry *de) { int slot = getKeySlot(key->ptr); if (!de) de = kvstoreDictFind(db->keys, slot, key->ptr); serverAssertWithInfo(NULL,key,de != NULL); @@ -304,7 +304,7 @@ static void dbSetValue(redisDb *db, robj *key, robj *val, int overwrite, dictEnt /* Replace an existing key with a new value, we just replace value and don't * emit any events */ -void dbReplaceValue(redisDb *db, robj *key, robj *val) { +void dbReplaceValue(serverDb *db, robj *key, robj *val) { dbSetValue(db, key, val, 0, NULL); } @@ -321,7 +321,7 @@ void dbReplaceValue(redisDb *db, robj *key, robj *val) { * All the new keys in the database should be created via this interface. * The client 'c' argument may be set to NULL if the operation is performed * in a context where there is no clear client performing the operation. */ -void setKey(client *c, redisDb *db, robj *key, robj *val, int flags) { +void setKey(client *c, serverDb *db, robj *key, robj *val, int flags) { int keyfound = 0; if (flags & SETKEY_ALREADY_EXIST) @@ -347,7 +347,7 @@ void setKey(client *c, redisDb *db, robj *key, robj *val, int flags) { * If there are no keys, NULL is returned. * * The function makes sure to return keys not already expired. */ -robj *dbRandomKey(redisDb *db) { +robj *dbRandomKey(serverDb *db) { dictEntry *de; int maxtries = 100; int allvolatile = kvstoreSize(db->keys) == kvstoreSize(db->expires); @@ -383,7 +383,7 @@ robj *dbRandomKey(redisDb *db) { } /* Helper for sync and async delete. */ -int dbGenericDelete(redisDb *db, robj *key, int async, int flags) { +int dbGenericDelete(serverDb *db, robj *key, int async, int flags) { dictEntry **plink; int table; int slot = getKeySlot(key->ptr); @@ -417,19 +417,19 @@ int dbGenericDelete(redisDb *db, robj *key, int async, int flags) { } /* Delete a key, value, and associated expiration entry if any, from the DB */ -int dbSyncDelete(redisDb *db, robj *key) { +int dbSyncDelete(serverDb *db, robj *key) { return dbGenericDelete(db, key, 0, DB_FLAG_KEY_DELETED); } /* Delete a key, value, and associated expiration entry if any, from the DB. If * the value consists of many allocations, it may be freed asynchronously. */ -int dbAsyncDelete(redisDb *db, robj *key) { +int dbAsyncDelete(serverDb *db, robj *key) { return dbGenericDelete(db, key, 1, DB_FLAG_KEY_DELETED); } /* This is a wrapper whose behavior depends on the Redis lazy free * configuration. Deletes the key synchronously or asynchronously. */ -int dbDelete(redisDb *db, robj *key) { +int dbDelete(serverDb *db, robj *key) { return dbGenericDelete(db, key, server.lazyfree_lazy_server_del, DB_FLAG_KEY_DELETED); } @@ -460,7 +460,7 @@ int dbDelete(redisDb *db, robj *key) { * At this point the caller is ready to modify the object, for example * using an sdscat() call to append some data, or anything else. */ -robj *dbUnshareStringValue(redisDb *db, robj *key, robj *o) { +robj *dbUnshareStringValue(serverDb *db, robj *key, robj *o) { serverAssert(o->type == OBJ_STRING); if (o->refcount != 1 || o->encoding != OBJ_ENCODING_RAW) { robj *decoded = getDecodedObject(o); @@ -477,7 +477,7 @@ robj *dbUnshareStringValue(redisDb *db, robj *key, robj *o) { * The dbnum can be -1 if all the DBs should be emptied, or the specified * DB index if we want to empty only a single database. * The function returns the number of keys removed from the database(s). */ -long long emptyDbStructure(redisDb *dbarray, int dbnum, int async, +long long emptyDbStructure(serverDb *dbarray, int dbnum, int async, void(callback)(dict*)) { long long removed = 0; @@ -562,14 +562,14 @@ long long emptyData(int dbnum, int flags, void(callback)(dict*)) { } /* Initialize temporary db on replica for use during diskless replication. */ -redisDb *initTempDb(void) { +serverDb *initTempDb(void) { int slot_count_bits = 0; int flags = KVSTORE_ALLOCATE_DICTS_ON_DEMAND; if (server.cluster_enabled) { slot_count_bits = CLUSTER_SLOT_MASK_BITS; flags |= KVSTORE_FREE_EMPTY_DICTS; } - redisDb *tempDb = zcalloc(sizeof(redisDb)*server.dbnum); + serverDb *tempDb = zcalloc(sizeof(serverDb)*server.dbnum); for (int i=0; iblocking_keys); while((de = dictNext(di)) != NULL) { @@ -1531,7 +1531,7 @@ void scanDatabaseForReadyKeys(redisDb *db) { /* Since we are unblocking XREADGROUP clients in the event the * key was deleted/overwritten we must do the same in case the * database was flushed/swapped. */ -void scanDatabaseForDeletedKeys(redisDb *emptied, redisDb *replaced_with) { +void scanDatabaseForDeletedKeys(serverDb *emptied, serverDb *replaced_with) { dictEntry *de; dictIterator *di = dictGetSafeIterator(emptied->blocking_keys); while((de = dictNext(di)) != NULL) { @@ -1573,8 +1573,8 @@ int dbSwapDatabases(int id1, int id2) { if (id1 < 0 || id1 >= server.dbnum || id2 < 0 || id2 >= server.dbnum) return C_ERR; if (id1 == id2) return C_OK; - redisDb aux = server.db[id1]; - redisDb *db1 = &server.db[id1], *db2 = &server.db[id2]; + serverDb aux = server.db[id1]; + serverDb *db1 = &server.db[id1], *db2 = &server.db[id2]; /* Swapdb should make transaction fail if there is any * client watching keys */ @@ -1615,10 +1615,10 @@ int dbSwapDatabases(int id1, int id2) { /* Logically, this discards (flushes) the old main database, and apply the newly loaded * database (temp) as the main (active) database, the actual freeing of old database * (which will now be placed in the temp one) is done later. */ -void swapMainDbWithTempDb(redisDb *tempDb) { +void swapMainDbWithTempDb(serverDb *tempDb) { for (int i=0; iexpires, getKeySlot(key->ptr), key->ptr) == DICT_OK; } @@ -1699,7 +1699,7 @@ int removeExpire(redisDb *db, robj *key) { * of an user calling a command 'c' is the client, otherwise 'c' is set * to NULL. The 'when' parameter is the absolute unix time in milliseconds * after which the key will no longer be considered valid. */ -void setExpire(client *c, redisDb *db, robj *key, long long when) { +void setExpire(client *c, serverDb *db, robj *key, long long when) { dictEntry *kde, *de, *existing; /* Reuse the sds from the main dict in the expire dict */ @@ -1720,7 +1720,7 @@ void setExpire(client *c, redisDb *db, robj *key, long long when) { /* Return the expire time of the specified key, or -1 if no expire * is associated with this key (i.e. the key is non volatile) */ -long long getExpire(redisDb *db, robj *key) { +long long getExpire(serverDb *db, robj *key) { dictEntry *de; if ((de = dbFindExpires(db, key->ptr)) == NULL) @@ -1730,7 +1730,7 @@ long long getExpire(redisDb *db, robj *key) { } /* Delete the specified expired key and propagate expire. */ -void deleteExpiredKeyAndPropagate(redisDb *db, robj *keyobj) { +void deleteExpiredKeyAndPropagate(serverDb *db, robj *keyobj) { mstime_t expire_latency; latencyStartMonitor(expire_latency); dbGenericDelete(db,keyobj,server.lazyfree_lazy_expire,DB_FLAG_KEY_EXPIRED); @@ -1761,7 +1761,7 @@ void deleteExpiredKeyAndPropagate(redisDb *db, robj *keyobj) { * postExecutionUnitOperations, preferably just after a * single deletion batch, so that DEL/UNLINK will NOT be wrapped * in MULTI/EXEC */ -void propagateDeletion(redisDb *db, robj *key, int lazy) { +void propagateDeletion(serverDb *db, robj *key, int lazy) { robj *argv[2]; argv[0] = lazy ? shared.unlink : shared.del; @@ -1781,7 +1781,7 @@ void propagateDeletion(redisDb *db, robj *key, int lazy) { } /* Check if the key is expired. */ -int keyIsExpired(redisDb *db, robj *key) { +int keyIsExpired(serverDb *db, robj *key) { /* Don't expire anything while loading. It will be done later. */ if (server.loading) return 0; @@ -1827,7 +1827,7 @@ int keyIsExpired(redisDb *db, robj *key) { * The return value of the function is KEY_VALID if the key is still valid. * The function returns KEY_EXPIRED if the key is expired BUT not deleted, * or returns KEY_DELETED if the key is expired and deleted. */ -keyStatus expireIfNeeded(redisDb *db, robj *key, int flags) { +keyStatus expireIfNeeded(serverDb *db, robj *key, int flags) { if (server.lazy_expire_disabled) return KEY_VALID; if (!keyIsExpired(db,key)) return KEY_VALID; @@ -1905,11 +1905,11 @@ static int dbExpandGeneric(kvstore *kvs, uint64_t db_size, int try_expand) { return ret? C_OK : C_ERR; } -int dbExpand(redisDb *db, uint64_t db_size, int try_expand) { +int dbExpand(serverDb *db, uint64_t db_size, int try_expand) { return dbExpandGeneric(db->keys, db_size, try_expand); } -int dbExpandExpires(redisDb *db, uint64_t db_size, int try_expand) { +int dbExpandExpires(serverDb *db, uint64_t db_size, int try_expand) { return dbExpandGeneric(db->expires, db_size, try_expand); } @@ -1917,19 +1917,19 @@ static dictEntry *dbFindGeneric(kvstore *kvs, void *key) { return kvstoreDictFind(kvs, getKeySlot(key), key); } -dictEntry *dbFind(redisDb *db, void *key) { +dictEntry *dbFind(serverDb *db, void *key) { return dbFindGeneric(db->keys, key); } -dictEntry *dbFindExpires(redisDb *db, void *key) { +dictEntry *dbFindExpires(serverDb *db, void *key) { return dbFindGeneric(db->expires, key); } -unsigned long long dbSize(redisDb *db) { +unsigned long long dbSize(serverDb *db) { return kvstoreSize(db->keys); } -unsigned long long dbScan(redisDb *db, unsigned long long cursor, dictScanFunction *scan_cb, void *privdata) { +unsigned long long dbScan(serverDb *db, unsigned long long cursor, dictScanFunction *scan_cb, void *privdata) { return kvstoreScan(db->keys, cursor, -1, scan_cb, NULL, privdata); } diff --git a/src/debug.c b/src/debug.c index c1327ed48a..676a1c32dd 100644 --- a/src/debug.c +++ b/src/debug.c @@ -142,7 +142,7 @@ void mixStringObjectDigest(unsigned char *digest, robj *o) { * Note that this function does not reset the initial 'digest' passed, it * will continue mixing this object digest to anything that was already * present. */ -void xorObjectDigest(redisDb *db, robj *keyobj, unsigned char *digest, robj *o) { +void xorObjectDigest(serverDb *db, robj *keyobj, unsigned char *digest, robj *o) { uint32_t aux = htonl(o->type); mixDigest(digest,&aux,sizeof(aux)); long long expiretime = getExpire(db,keyobj); @@ -288,7 +288,7 @@ void computeDatasetDigest(unsigned char *final) { memset(final,0,20); /* Start with a clean result */ for (j = 0; j < server.dbnum; j++) { - redisDb *db = server.db+j; + serverDb *db = server.db+j; if (kvstoreSize(db->keys) == 0) continue; kvstoreIterator *kvs_it = kvstoreIteratorInit(db->keys); diff --git a/src/defrag.c b/src/defrag.c index 40bba2d33b..30d72993c0 100644 --- a/src/defrag.c +++ b/src/defrag.c @@ -349,7 +349,7 @@ void activeDefragQuickListNodes(quicklist *ql) { /* when the value has lots of elements, we want to handle it later and not as * part of the main dictionary scan. this is needed in order to prevent latency * spikes when handling large items */ -void defragLater(redisDb *db, dictEntry *kde) { +void defragLater(serverDb *db, dictEntry *kde) { sds key = sdsdup(dictGetKey(kde)); listAddNodeTail(db->defrag_later, key); } @@ -449,7 +449,7 @@ void scanLaterHash(robj *ob, unsigned long *cursor) { *cursor = dictScanDefrag(d, *cursor, scanCallbackCountScanned, &defragfns, NULL); } -void defragQuicklist(redisDb *db, dictEntry *kde) { +void defragQuicklist(serverDb *db, dictEntry *kde) { robj *ob = dictGetVal(kde); quicklist *ql = ob->ptr, *newql; serverAssert(ob->type == OBJ_LIST && ob->encoding == OBJ_ENCODING_QUICKLIST); @@ -461,7 +461,7 @@ void defragQuicklist(redisDb *db, dictEntry *kde) { activeDefragQuickListNodes(ql); } -void defragZsetSkiplist(redisDb *db, dictEntry *kde) { +void defragZsetSkiplist(serverDb *db, dictEntry *kde) { robj *ob = dictGetVal(kde); zset *zs = (zset*)ob->ptr; zset *newzs; @@ -490,7 +490,7 @@ void defragZsetSkiplist(redisDb *db, dictEntry *kde) { zs->dict = newdict; } -void defragHash(redisDb *db, dictEntry *kde) { +void defragHash(serverDb *db, dictEntry *kde) { robj *ob = dictGetVal(kde); dict *d, *newd; serverAssert(ob->type == OBJ_HASH && ob->encoding == OBJ_ENCODING_HT); @@ -504,7 +504,7 @@ void defragHash(redisDb *db, dictEntry *kde) { ob->ptr = newd; } -void defragSet(redisDb *db, dictEntry *kde) { +void defragSet(serverDb *db, dictEntry *kde) { robj *ob = dictGetVal(kde); dict *d, *newd; serverAssert(ob->type == OBJ_SET && ob->encoding == OBJ_ENCODING_HT); @@ -657,7 +657,7 @@ void* defragStreamConsumerGroup(raxIterator *ri, void *privdata) { return NULL; } -void defragStream(redisDb *db, dictEntry *kde) { +void defragStream(serverDb *db, dictEntry *kde) { robj *ob = dictGetVal(kde); serverAssert(ob->type == OBJ_STREAM && ob->encoding == OBJ_ENCODING_STREAM); stream *s = ob->ptr, *news; @@ -681,7 +681,7 @@ void defragStream(redisDb *db, dictEntry *kde) { /* Defrag a module key. This is either done immediately or scheduled * for later. Returns then number of pointers defragged. */ -void defragModule(redisDb *db, dictEntry *kde) { +void defragModule(serverDb *db, dictEntry *kde) { robj *obj = dictGetVal(kde); serverAssert(obj->type == OBJ_MODULE); @@ -696,7 +696,7 @@ void defragKey(defragCtx *ctx, dictEntry *de) { robj *newob, *ob; unsigned char *newzl; sds newsds; - redisDb *db = ctx->privdata; + serverDb *db = ctx->privdata; int slot = ctx->slot; /* Try to defrag the key name. */ newsds = activeDefragSds(keysds); @@ -884,7 +884,7 @@ static sds defrag_later_current_key = NULL; static unsigned long defrag_later_cursor = 0; /* returns 0 if no more work needs to be been done, and 1 if time is up and more work is needed. */ -int defragLaterStep(redisDb *db, int slot, long long endtime) { +int defragLaterStep(serverDb *db, int slot, long long endtime) { unsigned int iterations = 0; unsigned long long prev_defragged = server.stat_active_defrag_hits; unsigned long long prev_scanned = server.stat_active_defrag_scanned; @@ -993,7 +993,7 @@ void activeDefragCycle(void) { static int defrag_later_item_in_progress = 0; static int defrag_stage = 0; static unsigned long defrag_cursor = 0; - static redisDb *db = NULL; + static serverDb *db = NULL; static long long start_scan, start_stat; unsigned int iterations = 0; unsigned long long prev_defragged = server.stat_active_defrag_hits; diff --git a/src/evict.c b/src/evict.c index f40612627d..e3b7ebcece 100644 --- a/src/evict.c +++ b/src/evict.c @@ -143,7 +143,7 @@ void evictionPoolAlloc(void) { * We insert keys on place in ascending order, so keys with the smaller * idle time are on the left, and keys with the higher idle time on the * right. */ -int evictionPoolPopulate(redisDb *db, kvstore *samplekvs, struct evictionPoolEntry *pool) { +int evictionPoolPopulate(serverDb *db, kvstore *samplekvs, struct evictionPoolEntry *pool) { int j, k, count; dictEntry *samples[server.maxmemory_samples]; @@ -579,7 +579,7 @@ int performEvictions(void) { static unsigned int next_db = 0; sds bestkey = NULL; int bestdbid; - redisDb *db; + serverDb *db; dictEntry *de; if (server.maxmemory_policy & (MAXMEMORY_FLAG_LRU|MAXMEMORY_FLAG_LFU) || diff --git a/src/expire.c b/src/expire.c index 2092c5a09b..4f0868d715 100644 --- a/src/expire.c +++ b/src/expire.c @@ -55,7 +55,7 @@ static double avg_ttl_factor[16] = {0.98, 0.9604, 0.941192, 0.922368, 0.903921, * * The parameter 'now' is the current time in milliseconds as is passed * to the function to avoid too many gettimeofday() syscalls. */ -int activeExpireCycleTryExpire(redisDb *db, dictEntry *de, long long now) { +int activeExpireCycleTryExpire(serverDb *db, dictEntry *de, long long now) { long long t = dictGetSignedIntegerVal(de); if (now > t) { enterExecutionUnit(1, 0); @@ -118,7 +118,7 @@ int activeExpireCycleTryExpire(redisDb *db, dictEntry *de, long long now) { /* Data used by the expire dict scan callback. */ typedef struct { - redisDb *db; + serverDb *db; long long now; unsigned long sampled; /* num keys checked */ unsigned long expired; /* num keys expired */ @@ -242,7 +242,7 @@ void activeExpireCycle(int type) { data.ttl_sum = 0; data.ttl_samples = 0; - redisDb *db = server.db+(current_db % server.dbnum); + serverDb *db = server.db+(current_db % server.dbnum); data.db = db; int db_done = 0; /* The scan of the current DB is done? */ @@ -429,7 +429,7 @@ void expireSlaveKeys(void) { int dbid = 0; while(dbids && dbid < server.dbnum) { if ((dbids & 1) != 0) { - redisDb *db = server.db+dbid; + serverDb *db = server.db+dbid; dictEntry *expire = dbFindExpires(db, keyname); int expired = 0; @@ -474,7 +474,7 @@ void expireSlaveKeys(void) { /* Track keys that received an EXPIRE or similar command in the context * of a writable slave. */ -void rememberSlaveKeyWithExpire(redisDb *db, robj *key) { +void rememberSlaveKeyWithExpire(serverDb *db, robj *key) { if (slaveKeysWithExpire == NULL) { static dictType dt = { dictSdsHash, /* hash function */ diff --git a/src/lazyfree.c b/src/lazyfree.c index 80c4607d3e..cd220fca15 100644 --- a/src/lazyfree.c +++ b/src/lazyfree.c @@ -185,7 +185,7 @@ void freeObjAsync(robj *key, robj *obj, int dbid) { /* Empty a Redis DB asynchronously. What the function does actually is to * create a new empty set of hash tables and scheduling the old ones for * lazy freeing. */ -void emptyDbAsync(redisDb *db) { +void emptyDbAsync(serverDb *db) { int slot_count_bits = 0; int flags = KVSTORE_ALLOCATE_DICTS_ON_DEMAND; if (server.cluster_enabled) { diff --git a/src/module.c b/src/module.c index 4fa96e9526..f06952df74 100644 --- a/src/module.c +++ b/src/module.c @@ -189,7 +189,7 @@ typedef struct RedisModuleCtx RedisModuleCtx; /* This represents a Redis key opened with RM_OpenKey(). */ struct RedisModuleKey { RedisModuleCtx *ctx; - redisDb *db; + serverDb *db; robj *key; /* Key name object. */ robj *value; /* Value object, or NULL if the key was not found. */ void *iter; /* Iterator. */ diff --git a/src/multi.c b/src/multi.c index a51687363e..c3adf82b7a 100644 --- a/src/multi.c +++ b/src/multi.c @@ -274,7 +274,7 @@ void execCommand(client *c) { typedef struct watchedKey { listNode node; robj *key; - redisDb *db; + serverDb *db; client *client; unsigned expired:1; /* Flag that we're watching an already expired key. */ } watchedKey; @@ -377,7 +377,7 @@ int isWatchedKeyExpired(client *c) { /* "Touch" a key, so that if this key is being WATCHed by some client the * next EXEC will fail. */ -void touchWatchedKey(redisDb *db, robj *key) { +void touchWatchedKey(serverDb *db, robj *key) { list *clients; listIter li; listNode *ln; @@ -425,7 +425,7 @@ void touchWatchedKey(redisDb *db, robj *key) { * replaced_with: for SWAPDB, the WATCH should be invalidated if * the key exists in either of them, and skipped only if it * doesn't exist in both. */ -void touchAllWatchedKeysInDb(redisDb *emptied, redisDb *replaced_with) { +void touchAllWatchedKeysInDb(serverDb *emptied, serverDb *replaced_with) { listIter li; listNode *ln; dictEntry *de; diff --git a/src/object.c b/src/object.c index 6e151f17b3..8c00adbcba 100644 --- a/src/object.c +++ b/src/object.c @@ -1245,7 +1245,7 @@ struct serverMemOverhead *getMemoryOverheadData(void) { mem_total+=mh->functions_caches; for (j = 0; j < server.dbnum; j++) { - redisDb *db = server.db+j; + serverDb *db = server.db+j; if (!kvstoreNumAllocatedDicts(db->keys)) continue; unsigned long long keyscount = kvstoreSize(db->keys); diff --git a/src/rdb.c b/src/rdb.c index a633a49615..688437ddd5 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -1305,7 +1305,7 @@ ssize_t rdbSaveDb(rio *rdb, int dbid, int rdbflags, long *key_counter) { static long long info_updated_time = 0; char *pname = (rdbflags & RDBFLAGS_AOF_PREAMBLE) ? "AOF rewrite" : "RDB"; - redisDb *db = server.db + dbid; + serverDb *db = server.db + dbid; unsigned long long int db_size = kvstoreSize(db->keys); if (db_size == 0) return 0; @@ -3033,7 +3033,7 @@ int rdbLoadRioWithLoadingCtx(rio *rdb, int rdbflags, rdbSaveInfo *rsi, rdbLoadin int type, rdbver; uint64_t db_size = 0, expires_size = 0; int should_expand_db = 0; - redisDb *db = rdb_loading_ctx->dbarray+0; + serverDb *db = rdb_loading_ctx->dbarray+0; char buf[1024]; int error; long long empty_keys_skipped = 0; diff --git a/src/replication.c b/src/replication.c index 28c4b14111..d2ea5bbf23 100644 --- a/src/replication.c +++ b/src/replication.c @@ -1840,13 +1840,13 @@ static int useDisklessLoad(void) { /* Helper function for readSyncBulkPayload() to initialize tempDb * before socket-loading the new db from master. The tempDb may be populated * by swapMainDbWithTempDb or freed by disklessLoadDiscardTempDb later. */ -redisDb *disklessLoadInitTempDb(void) { +serverDb *disklessLoadInitTempDb(void) { return initTempDb(); } /* Helper function for readSyncBulkPayload() to discard our tempDb * when the loading succeeded or failed. */ -void disklessLoadDiscardTempDb(redisDb *tempDb) { +void disklessLoadDiscardTempDb(serverDb *tempDb) { discardTempDb(tempDb, replicationEmptyDbCallback); } @@ -1870,7 +1870,7 @@ void readSyncBulkPayload(connection *conn) { char buf[PROTO_IOBUF_LEN]; ssize_t nread, readlen, nwritten; int use_diskless_load = useDisklessLoad(); - redisDb *diskless_load_tempDb = NULL; + serverDb *diskless_load_tempDb = NULL; functionsLibCtx* temp_functions_lib_ctx = NULL; int empty_db_flags = server.repl_slave_lazy_flush ? EMPTYDB_ASYNC : EMPTYDB_NO_FLAGS; @@ -2088,7 +2088,7 @@ void readSyncBulkPayload(connection *conn) { rdbSaveInfo rsi = RDB_SAVE_INFO_INIT; if (use_diskless_load) { rio rdb; - redisDb *dbarray; + serverDb *dbarray; functionsLibCtx* functions_lib_ctx; int asyncLoading = 0; diff --git a/src/server.c b/src/server.c index 37feaeac73..2b2dafd640 100644 --- a/src/server.c +++ b/src/server.c @@ -1082,7 +1082,7 @@ void databasesCron(void) { if (dbs_per_call > server.dbnum) dbs_per_call = server.dbnum; for (j = 0; j < dbs_per_call; j++) { - redisDb *db = &server.db[resize_db % server.dbnum]; + serverDb *db = &server.db[resize_db % server.dbnum]; kvstoreTryResizeDicts(db->keys, CRON_DICTS_PER_DB); kvstoreTryResizeDicts(db->expires, CRON_DICTS_PER_DB); resize_db++; @@ -1092,7 +1092,7 @@ void databasesCron(void) { if (server.activerehashing) { uint64_t elapsed_us = 0; for (j = 0; j < dbs_per_call; j++) { - redisDb *db = &server.db[rehash_db % server.dbnum]; + serverDb *db = &server.db[rehash_db % server.dbnum]; elapsed_us += kvstoreIncrementallyRehash(db->keys, INCREMENTAL_REHASHING_THRESHOLD_US - elapsed_us); if (elapsed_us >= INCREMENTAL_REHASHING_THRESHOLD_US) break; @@ -2655,7 +2655,7 @@ void initServer(void) { strerror(errno)); exit(1); } - server.db = zmalloc(sizeof(redisDb)*server.dbnum); + server.db = zmalloc(sizeof(server)*server.dbnum); /* Create the Redis databases, and initialize other internal state. */ int slot_count_bits = 0; diff --git a/src/server.h b/src/server.h index 809c6bd29e..1d911cc8d2 100644 --- a/src/server.h +++ b/src/server.h @@ -974,7 +974,7 @@ typedef struct replBufBlock { /* Redis database representation. There are multiple databases identified * by integers from 0 (the default database) up to the max configured * database. The database number is the 'id' field in the structure. */ -typedef struct redisDb { +typedef struct serverDb { kvstore *keys; /* The keyspace for this DB */ kvstore *expires; /* Timeout of keys with a timeout set */ dict *blocking_keys; /* Keys with clients waiting for data (BLPOP)*/ @@ -987,7 +987,7 @@ typedef struct redisDb { long long avg_ttl; /* Average TTL, just for stats */ unsigned long expires_cursor; /* Cursor of the active expire cycle. */ list *defrag_later; /* List of key names to attempt to defrag one by one, gradually. */ -} redisDb; +} serverDb; /* forward declaration for functions ctx */ typedef struct functionsLibCtx functionsLibCtx; @@ -998,7 +998,7 @@ typedef struct functionsLibCtx functionsLibCtx; * For example: dbarray need to be set as main database on * successful loading and dropped on failure. */ typedef struct rdbLoadingCtx { - redisDb* dbarray; + serverDb* dbarray; functionsLibCtx* functions_lib_ctx; }rdbLoadingCtx; @@ -1062,7 +1062,7 @@ typedef struct blockingState { * where we make sure to remember if a given key was already added in the * server.ready_keys list. */ typedef struct readyList { - redisDb *db; + serverDb *db; robj *key; } readyList; @@ -1164,7 +1164,7 @@ typedef struct client { uint64_t flags; /* Client flags: CLIENT_* macros. */ connection *conn; int resp; /* RESP protocol version. Can be 2 or 3. */ - redisDb *db; /* Pointer to currently SELECTed DB. */ + serverDb *db; /* Pointer to currently SELECTed DB. */ robj *name; /* As set by CLIENT SETNAME. */ robj *lib_name; /* The client library name as set by CLIENT SETINFO. */ robj *lib_ver; /* The client library version as set by CLIENT SETINFO. */ @@ -1558,7 +1558,7 @@ struct redisServer { mode_t umask; /* The umask value of the process on startup */ int hz; /* serverCron() calls frequency in hertz */ int in_fork_child; /* indication that this is a fork child */ - redisDb *db; + serverDb *db; dict *commands; /* Command table */ dict *orig_commands; /* Command table before command renaming. */ aeEventLoop *el; @@ -2745,9 +2745,9 @@ void initClientMultiState(client *c); void freeClientMultiState(client *c); void queueMultiCommand(client *c, uint64_t cmd_flags); size_t multiStateMemOverhead(client *c); -void touchWatchedKey(redisDb *db, robj *key); +void touchWatchedKey(serverDb *db, robj *key); int isWatchedKeyExpired(client *c); -void touchAllWatchedKeysInDb(redisDb *emptied, redisDb *replaced_with); +void touchAllWatchedKeysInDb(serverDb *emptied, serverDb *replaced_with); void discardTransaction(client *c); void flagTransaction(client *c); void execCommandAbort(client *c, sds error); @@ -3123,12 +3123,12 @@ int getKeySlot(sds key); int calculateKeySlot(sds key); /* kvstore wrappers */ -int dbExpand(redisDb *db, uint64_t db_size, int try_expand); -int dbExpandExpires(redisDb *db, uint64_t db_size, int try_expand); -dictEntry *dbFind(redisDb *db, void *key); -dictEntry *dbFindExpires(redisDb *db, void *key); -unsigned long long dbSize(redisDb *db); -unsigned long long dbScan(redisDb *db, unsigned long long cursor, dictScanFunction *scan_cb, void *privdata); +int dbExpand(serverDb *db, uint64_t db_size, int try_expand); +int dbExpandExpires(serverDb *db, uint64_t db_size, int try_expand); +dictEntry *dbFind(serverDb *db, void *key); +dictEntry *dbFindExpires(serverDb *db, void *key); +unsigned long long dbSize(serverDb *db); +unsigned long long dbScan(serverDb *db, unsigned long long cursor, dictScanFunction *scan_cb, void *privdata); /* Set data type */ robj *setTypeCreate(sds value, size_t size_hint); @@ -3267,19 +3267,19 @@ long long getModuleNumericConfig(ModuleConfig *module_config); int setModuleNumericConfig(ModuleConfig *config, long long val, const char **err); /* db.c -- Keyspace access API */ -int removeExpire(redisDb *db, robj *key); -void deleteExpiredKeyAndPropagate(redisDb *db, robj *keyobj); -void propagateDeletion(redisDb *db, robj *key, int lazy); -int keyIsExpired(redisDb *db, robj *key); -long long getExpire(redisDb *db, robj *key); -void setExpire(client *c, redisDb *db, robj *key, long long when); +int removeExpire(serverDb *db, robj *key); +void deleteExpiredKeyAndPropagate(serverDb *db, robj *keyobj); +void propagateDeletion(serverDb *db, robj *key, int lazy); +int keyIsExpired(serverDb *db, robj *key); +long long getExpire(serverDb *db, robj *key); +void setExpire(client *c, serverDb *db, robj *key, long long when); int checkAlreadyExpired(long long when); -robj *lookupKeyRead(redisDb *db, robj *key); -robj *lookupKeyWrite(redisDb *db, robj *key); +robj *lookupKeyRead(serverDb *db, robj *key); +robj *lookupKeyWrite(serverDb *db, robj *key); robj *lookupKeyReadOrReply(client *c, robj *key, robj *reply); robj *lookupKeyWriteOrReply(client *c, robj *key, robj *reply); -robj *lookupKeyReadWithFlags(redisDb *db, robj *key, int flags); -robj *lookupKeyWriteWithFlags(redisDb *db, robj *key, int flags); +robj *lookupKeyReadWithFlags(serverDb *db, robj *key, int flags); +robj *lookupKeyWriteWithFlags(serverDb *db, robj *key, int flags); robj *objectCommandLookup(client *c, robj *key); robj *objectCommandLookupOrReply(client *c, robj *key, robj *reply); int objectSetLRUOrLFU(robj *val, long long lfu_freq, long long lru_idle, @@ -3292,40 +3292,40 @@ int objectSetLRUOrLFU(robj *val, long long lfu_freq, long long lru_idle, #define LOOKUP_NOEXPIRE (1<<4) /* Avoid deleting lazy expired keys. */ #define LOOKUP_NOEFFECTS (LOOKUP_NONOTIFY | LOOKUP_NOSTATS | LOOKUP_NOTOUCH | LOOKUP_NOEXPIRE) /* Avoid any effects from fetching the key */ -void dbAdd(redisDb *db, robj *key, robj *val); -int dbAddRDBLoad(redisDb *db, sds key, robj *val); -void dbReplaceValue(redisDb *db, robj *key, robj *val); +void dbAdd(serverDb *db, robj *key, robj *val); +int dbAddRDBLoad(serverDb *db, sds key, robj *val); +void dbReplaceValue(serverDb *db, robj *key, robj *val); #define SETKEY_KEEPTTL 1 #define SETKEY_NO_SIGNAL 2 #define SETKEY_ALREADY_EXIST 4 #define SETKEY_DOESNT_EXIST 8 #define SETKEY_ADD_OR_UPDATE 16 /* Key most likely doesn't exists */ -void setKey(client *c, redisDb *db, robj *key, robj *val, int flags); -robj *dbRandomKey(redisDb *db); -int dbGenericDelete(redisDb *db, robj *key, int async, int flags); -int dbSyncDelete(redisDb *db, robj *key); -int dbDelete(redisDb *db, robj *key); -robj *dbUnshareStringValue(redisDb *db, robj *key, robj *o); +void setKey(client *c, serverDb *db, robj *key, robj *val, int flags); +robj *dbRandomKey(serverDb *db); +int dbGenericDelete(serverDb *db, robj *key, int async, int flags); +int dbSyncDelete(serverDb *db, robj *key); +int dbDelete(serverDb *db, robj *key); +robj *dbUnshareStringValue(serverDb *db, robj *key, robj *o); #define EMPTYDB_NO_FLAGS 0 /* No flags. */ #define EMPTYDB_ASYNC (1<<0) /* Reclaim memory in another thread. */ #define EMPTYDB_NOFUNCTIONS (1<<1) /* Indicate not to flush the functions. */ long long emptyData(int dbnum, int flags, void(callback)(dict*)); -long long emptyDbStructure(redisDb *dbarray, int dbnum, int async, void(callback)(dict*)); +long long emptyDbStructure(serverDb *dbarray, int dbnum, int async, void(callback)(dict*)); void flushAllDataAndResetRDB(int flags); long long dbTotalServerKeyCount(void); -redisDb *initTempDb(void); -void discardTempDb(redisDb *tempDb, void(callback)(dict*)); +serverDb *initTempDb(void); +void discardTempDb(serverDb *tempDb, void(callback)(dict*)); int selectDb(client *c, int id); -void signalModifiedKey(client *c, redisDb *db, robj *key); +void signalModifiedKey(client *c, serverDb *db, robj *key); void signalFlushedDb(int dbid, int async); void scanGenericCommand(client *c, robj *o, unsigned long long cursor); int parseScanCursorOrReply(client *c, robj *o, unsigned long long *cursor); -int dbAsyncDelete(redisDb *db, robj *key); -void emptyDbAsync(redisDb *db); +int dbAsyncDelete(serverDb *db, robj *key); +void emptyDbAsync(serverDb *db); size_t lazyfreeGetPendingObjectsCount(void); size_t lazyfreeGetFreedObjectsCount(void); void lazyfreeResetStats(void); @@ -3423,15 +3423,15 @@ void replyToBlockedClientTimedOut(client *c); int getTimeoutFromObjectOrReply(client *c, robj *object, mstime_t *timeout, int unit); void disconnectAllBlockedClients(void); void handleClientsBlockedOnKeys(void); -void signalKeyAsReady(redisDb *db, robj *key, int type); +void signalKeyAsReady(serverDb *db, robj *key, int type); void blockForKeys(client *c, int btype, robj **keys, int numkeys, mstime_t timeout, int unblock_on_nokey); void blockClientShutdown(client *c); void blockPostponeClient(client *c); void blockForReplication(client *c, mstime_t timeout, long long offset, long numreplicas); void blockForAofFsync(client *c, mstime_t timeout, long long offset, int numlocal, long numreplicas); -void signalDeletedKeyAsReady(redisDb *db, robj *key, int type); +void signalDeletedKeyAsReady(serverDb *db, robj *key, int type); void updateStatsOnUnblock(client *c, long blocked_us, long reply_us, int had_errors); -void scanDatabaseForDeletedKeys(redisDb *emptied, redisDb *replaced_with); +void scanDatabaseForDeletedKeys(serverDb *emptied, serverDb *replaced_with); void totalNumberOfStatefulKeys(unsigned long *blocking_keys, unsigned long *blocking_keys_on_nokey, unsigned long *watched_keys); void blockedBeforeSleep(void); @@ -3444,7 +3444,7 @@ int clientsCronHandleTimeout(client *c, mstime_t now_ms); /* expire.c -- Handling of expired keys */ void activeExpireCycle(int type); void expireSlaveKeys(void); -void rememberSlaveKeyWithExpire(redisDb *db, robj *key); +void rememberSlaveKeyWithExpire(serverDb *db, robj *key); void flushSlaveKeysWithExpireList(void); size_t getSlaveKeyWithExpireCount(void); @@ -3771,7 +3771,7 @@ void debugDelay(int usec); void killIOThreads(void); void killThreads(void); void makeThreadKillable(void); -void swapMainDbWithTempDb(redisDb *tempDb); +void swapMainDbWithTempDb(serverDb *tempDb); sds getVersion(void); /* Use macro for checking log level to avoid evaluating arguments in cases log diff --git a/src/sort.c b/src/sort.c index bd1f10064d..86255ca265 100644 --- a/src/sort.c +++ b/src/sort.c @@ -59,7 +59,7 @@ redisSortOperation *createSortOperation(int type, robj *pattern) { * * The returned object will always have its refcount increased by 1 * when it is non-NULL. */ -robj *lookupKeyByPattern(redisDb *db, robj *pattern, robj *subst) { +robj *lookupKeyByPattern(serverDb *db, robj *pattern, robj *subst) { char *p, *f, *k; sds spat, ssub; robj *keyobj, *fieldobj = NULL, *o; From cbbaf69d1de08c92c415a64e241ee8d79dac682d Mon Sep 17 00:00:00 2001 From: Vitah Lin Date: Wed, 3 Apr 2024 12:24:55 +0800 Subject: [PATCH 32/49] Remove unused REDIS_TEST_MAIN dead code in crc64.c (#160) We use `#ifdef SERVER_TEST` to run the relavent tests, we can now remove the dead code `#ifdef REDIS_TEST_MAIN`. Signed-off-by: Vitah Lin --- src/crc64.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/crc64.c b/src/crc64.c index f51d6819c6..0f71eea780 100644 --- a/src/crc64.c +++ b/src/crc64.c @@ -152,10 +152,3 @@ int crc64Test(int argc, char *argv[], int flags) { } #endif - -#ifdef REDIS_TEST_MAIN -int main(int argc, char *argv[]) { - return crc64Test(argc, argv); -} - -#endif From 730174445b72bb04c446c635d4c34041270b596b Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Wed, 3 Apr 2024 11:26:20 +0700 Subject: [PATCH 33/49] Rename redisOpArray to serverOpArray (#157) A task of #144 Signed-off-by: 0del --- src/server.c | 8 ++++---- src/server.h | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/server.c b/src/server.c index 2b2dafd640..75ab399800 100644 --- a/src/server.c +++ b/src/server.c @@ -3117,7 +3117,7 @@ void resetErrorTableStats(void) { /* ========================== Redis OP Array API ============================ */ -int redisOpArrayAppend(redisOpArray *oa, int dbid, robj **argv, int argc, int target) { +int serverOpArrayAppend(serverOpArray *oa, int dbid, robj **argv, int argc, int target) { redisOp *op; int prev_capacity = oa->capacity; @@ -3138,7 +3138,7 @@ int redisOpArrayAppend(redisOpArray *oa, int dbid, robj **argv, int argc, int ta return oa->numops; } -void redisOpArrayFree(redisOpArray *oa) { +void serverOpArrayFree(serverOpArray *oa) { while(oa->numops) { int j; redisOp *op; @@ -3322,7 +3322,7 @@ void alsoPropagate(int dbid, robj **argv, int argc, int target) { argvcopy[j] = argv[j]; incrRefCount(argv[j]); } - redisOpArrayAppend(&server.also_propagate,dbid,argvcopy,argc,target); + serverOpArrayAppend(&server.also_propagate,dbid,argvcopy,argc,target); } /* It is possible to call the function forceCommandPropagation() inside a @@ -3419,7 +3419,7 @@ static void propagatePendingCommands(void) { propagateNow(-1,&shared.exec,1,PROPAGATE_AOF|PROPAGATE_REPL); } - redisOpArrayFree(&server.also_propagate); + serverOpArrayFree(&server.also_propagate); } /* Performs operations that should be performed after an execution unit ends. diff --git a/src/server.h b/src/server.h index 1d911cc8d2..ec07b0a8ca 100644 --- a/src/server.h +++ b/src/server.h @@ -1385,14 +1385,14 @@ typedef struct redisOp { /* Defines an array of Redis operations. There is an API to add to this * structure in an easy way. * - * int redisOpArrayAppend(redisOpArray *oa, int dbid, robj **argv, int argc, int target); - * void redisOpArrayFree(redisOpArray *oa); + * int serverOpArrayAppend(serverOpArray *oa, int dbid, robj **argv, int argc, int target); + * void serverOpArrayFree(serverOpArray *oa); */ -typedef struct redisOpArray { +typedef struct serverOpArray { redisOp *ops; int numops; int capacity; -} redisOpArray; +} serverOpArray; /* This structure is returned by the getMemoryOverheadData() function in * order to return memory overhead information. */ @@ -1844,7 +1844,7 @@ struct redisServer { int child_info_pipe[2]; /* Pipe used to write the child_info_data. */ int child_info_nread; /* Num of bytes of the last read from pipe */ /* Propagation of commands in AOF / replication */ - redisOpArray also_propagate; /* Additional command to propagate. */ + serverOpArray also_propagate; /* Additional command to propagate. */ int replication_allowed; /* Are we allowed to replicate? */ /* Logging */ char *logfile; /* Path of log file */ @@ -3065,7 +3065,7 @@ int incrCommandStatsOnError(struct redisCommand *cmd, int flags); void call(client *c, int flags); void alsoPropagate(int dbid, robj **argv, int argc, int target); void postExecutionUnitOperations(void); -void redisOpArrayFree(redisOpArray *oa); +void serverOpArrayFree(serverOpArray *oa); void forceCommandPropagation(client *c, int flags); void preventCommandPropagation(client *c); void preventCommandAOF(client *c); From 69d28be0f1939683d63546ef88ab949ee2e2847d Mon Sep 17 00:00:00 2001 From: Jun Luo Date: Wed, 3 Apr 2024 01:39:16 -0700 Subject: [PATCH 34/49] Rename redis to valkey in create-cluster script (#165) Otherwise currently create-cluster will not work (because there is no redis-*). Signed-off-by: Jun Luo --- utils/create-cluster/create-cluster | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/utils/create-cluster/create-cluster b/utils/create-cluster/create-cluster index dd20083313..f4f44871fc 100755 --- a/utils/create-cluster/create-cluster +++ b/utils/create-cluster/create-cluster @@ -28,7 +28,7 @@ then while [ $((PORT < ENDPORT)) != "0" ]; do PORT=$((PORT+1)) echo "Starting $PORT" - $BIN_PATH/redis-server --port $PORT --protected-mode $PROTECTED_MODE --cluster-enabled yes --cluster-config-file nodes-${PORT}.conf --cluster-node-timeout $TIMEOUT --appendonly yes --appendfilename appendonly-${PORT}.aof --appenddirname appendonlydir-${PORT} --dbfilename dump-${PORT}.rdb --logfile ${PORT}.log --daemonize yes ${ADDITIONAL_OPTIONS} + $BIN_PATH/valkey-server --port $PORT --protected-mode $PROTECTED_MODE --cluster-enabled yes --cluster-config-file nodes-${PORT}.conf --cluster-node-timeout $TIMEOUT --appendonly yes --appendfilename appendonly-${PORT}.aof --appenddirname appendonlydir-${PORT} --dbfilename dump-${PORT}.rdb --logfile ${PORT}.log --daemonize yes ${ADDITIONAL_OPTIONS} done exit 0 fi @@ -44,7 +44,7 @@ then if [ "$2" == "-f" ]; then OPT_ARG="--cluster-yes" fi - $BIN_PATH/redis-cli --cluster create $HOSTS --cluster-replicas $REPLICAS $OPT_ARG + $BIN_PATH/valkey-cli --cluster create $HOSTS --cluster-replicas $REPLICAS $OPT_ARG exit 0 fi @@ -53,7 +53,7 @@ then while [ $((PORT < ENDPORT)) != "0" ]; do PORT=$((PORT+1)) echo "Stopping $PORT" - $BIN_PATH/redis-cli -p $PORT shutdown nosave + $BIN_PATH/valkey-cli -p $PORT shutdown nosave done exit 0 fi @@ -64,13 +64,13 @@ then while [ $((PORT < ENDPORT)) != "0" ]; do PORT=$((PORT+1)) echo "Stopping $PORT" - $BIN_PATH/redis-cli -p $PORT shutdown nosave + $BIN_PATH/valkey-cli -p $PORT shutdown nosave done PORT=$OLD_PORT while [ $((PORT < ENDPORT)) != "0" ]; do PORT=$((PORT+1)) echo "Starting $PORT" - $BIN_PATH/redis-server --port $PORT --protected-mode $PROTECTED_MODE --cluster-enabled yes --cluster-config-file nodes-${PORT}.conf --cluster-node-timeout $TIMEOUT --appendonly yes --appendfilename appendonly-${PORT}.aof --appenddirname appendonlydir-${PORT} --dbfilename dump-${PORT}.rdb --logfile ${PORT}.log --daemonize yes ${ADDITIONAL_OPTIONS} + $BIN_PATH/valkey-server --port $PORT --protected-mode $PROTECTED_MODE --cluster-enabled yes --cluster-config-file nodes-${PORT}.conf --cluster-node-timeout $TIMEOUT --appendonly yes --appendfilename appendonly-${PORT}.aof --appenddirname appendonlydir-${PORT} --dbfilename dump-${PORT}.rdb --logfile ${PORT}.log --daemonize yes ${ADDITIONAL_OPTIONS} done exit 0 fi @@ -81,7 +81,7 @@ then while [ 1 ]; do clear date - $BIN_PATH/redis-cli -p $PORT cluster nodes | head -30 + $BIN_PATH/valkey-cli -p $PORT cluster nodes | head -30 sleep 1 done exit 0 @@ -105,7 +105,7 @@ if [ "$1" == "call" ] then while [ $((PORT < ENDPORT)) != "0" ]; do PORT=$((PORT+1)) - $BIN_PATH/redis-cli -p $PORT $2 $3 $4 $5 $6 $7 $8 $9 + $BIN_PATH/valkey-cli -p $PORT $2 $3 $4 $5 $6 $7 $8 $9 done exit 0 fi @@ -131,10 +131,10 @@ then fi echo "Usage: $0 [start|create|stop|restart|watch|tail|tailall|clean|clean-logs|call]" -echo "start -- Launch Redis Cluster instances." -echo "create [-f] -- Create a cluster using redis-cli --cluster create." -echo "stop -- Stop Redis Cluster instances." -echo "restart -- Restart Redis Cluster instances." +echo "start -- Launch Valkey Cluster instances." +echo "create [-f] -- Create a cluster using valkey-cli --cluster create." +echo "stop -- Stop Valkey Cluster instances." +echo "restart -- Restart Valkey Cluster instances." echo "watch -- Show CLUSTER NODES output (first 30 lines) of first node." echo "tail -- Run tail -f of instance at base port + ID." echo "tailall -- Run tail -f for all the log files at once." From def09488aa2787038a2e8047a836dd2e76763a7c Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Wed, 3 Apr 2024 16:07:28 +0700 Subject: [PATCH 35/49] Rename redis_member2struct ro server_member2struct (#166) part of #144 Signed-off-by: 0del --- src/multi.c | 4 ++-- src/server.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/multi.c b/src/multi.c index c3adf82b7a..cb082f91e1 100644 --- a/src/multi.c +++ b/src/multi.c @@ -390,7 +390,7 @@ void touchWatchedKey(serverDb *db, robj *key) { /* Check if we are already watching for this key */ listRewind(clients,&li); while((ln = listNext(&li))) { - watchedKey *wk = redis_member2struct(watchedKey, node, ln); + watchedKey *wk = server_member2struct(watchedKey, node, ln); client *c = wk->client; if (wk->expired) { @@ -443,7 +443,7 @@ void touchAllWatchedKeysInDb(serverDb *emptied, serverDb *replaced_with) { if (!clients) continue; listRewind(clients,&li); while((ln = listNext(&li))) { - watchedKey *wk = redis_member2struct(watchedKey, node, ln); + watchedKey *wk = server_member2struct(watchedKey, node, ln); if (wk->expired) { if (!replaced_with || !dbFind(replaced_with, key->ptr)) { /* Expired key now deleted. No logical change. Clear the diff --git a/src/server.h b/src/server.h index ec07b0a8ca..f3613f8778 100644 --- a/src/server.h +++ b/src/server.h @@ -103,7 +103,7 @@ struct hdr_histogram; #define max(a, b) ((a) > (b) ? (a) : (b)) /* Get the pointer of the outer struct from a member address */ -#define redis_member2struct(struct_name, member_name, member_addr) \ +#define server_member2struct(struct_name, member_name, member_addr) \ ((struct_name *)((char*)member_addr - offsetof(struct_name, member_name))) /* Error codes */ From 99bdcc0ed0df95843de02422c98b76e2b72c6e98 Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Wed, 3 Apr 2024 23:29:59 +0700 Subject: [PATCH 36/49] Rename redisCommandGroup to serverCommandGroup (#172) Part of issue #144 Signed-off-by: 0del --- src/commands.def | 2 +- src/server.h | 4 ++-- utils/generate-command-code.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands.def b/src/commands.def index 2d68e36d77..fd94d22ebc 100644 --- a/src/commands.def +++ b/src/commands.def @@ -5,7 +5,7 @@ * the fantastic * Redis Command Table! */ -/* Must match redisCommandGroup */ +/* Must match serverCommandGroup */ const char *COMMAND_GROUP_STR[] = { "generic", "string", diff --git a/src/server.h b/src/server.h index f3613f8778..6e99d2903e 100644 --- a/src/server.h +++ b/src/server.h @@ -2235,7 +2235,7 @@ typedef enum { COMMAND_GROUP_STREAM, COMMAND_GROUP_BITMAP, COMMAND_GROUP_MODULE, -} redisCommandGroup; +} serverCommandGroup; typedef void redisCommandProc(client *c); typedef int redisGetKeysProc(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); @@ -2343,7 +2343,7 @@ struct redisCommand { int doc_flags; /* Flags for documentation (see CMD_DOC_*). */ const char *replaced_by; /* In case the command is deprecated, this is the successor command. */ const char *deprecated_since; /* In case the command is deprecated, when did it happen? */ - redisCommandGroup group; /* Command group */ + serverCommandGroup group; /* Command group */ commandHistory *history; /* History of the command */ int num_history; const char **tips; /* An array of strings that are meant to be tips for clients/proxies regarding this command */ diff --git a/utils/generate-command-code.py b/utils/generate-command-code.py index 2d7cc5b0d2..236bf40cfa 100755 --- a/utils/generate-command-code.py +++ b/utils/generate-command-code.py @@ -578,7 +578,7 @@ def create_command(name, desc): * the fantastic * Redis Command Table! */ -/* Must match redisCommandGroup */ +/* Must match serverCommandGroup */ const char *COMMAND_GROUP_STR[] = { "generic", "string", From a236fc8ef0cd9094adda29b7a8d4859c2e36ee77 Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Wed, 3 Apr 2024 23:33:33 +0700 Subject: [PATCH 37/49] Rename redisCommandProc, redisGetKeysProc to server prefix (#173) Part of #144 Signed-off-by: 0del --- src/db.c | 2 +- src/networking.c | 2 +- src/server.h | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/db.c b/src/db.c index e54d4e471e..e5de136063 100644 --- a/src/db.c +++ b/src/db.c @@ -2149,7 +2149,7 @@ int doesCommandHaveKeys(struct redisCommand *cmd) { /* A simplified channel spec table that contains all of the redis commands * and which channels they have and how they are accessed. */ typedef struct ChannelSpecs { - redisCommandProc *proc; /* Command procedure to match against */ + serverCommandProc *proc; /* Command procedure to match against */ uint64_t flags; /* CMD_CHANNEL_* flags for this command */ int start; /* The initial position of the first channel */ int count; /* The number of channels, or -1 if all remaining diff --git a/src/networking.c b/src/networking.c index 5d0167fc18..c4414f5a49 100644 --- a/src/networking.c +++ b/src/networking.c @@ -2075,7 +2075,7 @@ int handleClientsWithPendingWrites(void) { /* resetClient prepare the client to process the next command */ void resetClient(client *c) { - redisCommandProc *prevcmd = c->cmd ? c->cmd->proc : NULL; + serverCommandProc *prevcmd = c->cmd ? c->cmd->proc : NULL; freeClientArgv(c); c->cur_script = NULL; diff --git a/src/server.h b/src/server.h index 6e99d2903e..e78d5a0f64 100644 --- a/src/server.h +++ b/src/server.h @@ -2237,8 +2237,8 @@ typedef enum { COMMAND_GROUP_MODULE, } serverCommandGroup; -typedef void redisCommandProc(client *c); -typedef int redisGetKeysProc(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); +typedef void serverCommandProc(client *c); +typedef int serverGetKeysProc(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); /* Redis command structure. * @@ -2348,7 +2348,7 @@ struct redisCommand { int num_history; const char **tips; /* An array of strings that are meant to be tips for clients/proxies regarding this command */ int num_tips; - redisCommandProc *proc; /* Command implementation */ + serverCommandProc *proc; /* Command implementation */ int arity; /* Number of arguments, it is possible to use -N to say >= N */ uint64_t flags; /* Command flags, see CMD_*. */ uint64_t acl_categories; /* ACl categories, see ACL_CATEGORY_*. */ @@ -2356,7 +2356,7 @@ struct redisCommand { int key_specs_num; /* Use a function to determine keys arguments in a command line. * Used for Redis Cluster redirect (may be NULL) */ - redisGetKeysProc *getkeys_proc; + serverGetKeysProc *getkeys_proc; int num_args; /* Length of args array. */ /* Array of subcommands (may be NULL) */ struct redisCommand *subcommands; From b19ebaf551de6b8b4aa35e1d054aece8dd8b900f Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Wed, 3 Apr 2024 23:54:33 +0700 Subject: [PATCH 38/49] Rename redisCommand to serverCommand (#174) Part of #144 --------- Signed-off-by: 0del --- src/acl.c | 32 ++++++++-------- src/aof.c | 2 +- src/cluster.c | 4 +- src/cluster.h | 2 +- src/commands.c | 2 +- src/config.c | 2 +- src/db.c | 54 +++++++++++++------------- src/latency.c | 8 ++-- src/module.c | 36 +++++++++--------- src/multi.c | 2 +- src/networking.c | 2 +- src/script.c | 4 +- src/script_lua.c | 2 +- src/server.c | 90 ++++++++++++++++++++++---------------------- src/server.h | 98 ++++++++++++++++++++++++------------------------ 15 files changed, 170 insertions(+), 170 deletions(-) diff --git a/src/acl.c b/src/acl.c index 81f8b38499..244e7f0826 100644 --- a/src/acl.c +++ b/src/acl.c @@ -649,7 +649,7 @@ void ACLUpdateCommandRules(aclSelector *selector, const char *rule, int allow) { /* This function is used to allow/block a specific command. * Allowing/blocking a container command also applies for its subcommands */ -void ACLChangeSelectorPerm(aclSelector *selector, struct redisCommand *cmd, int allow) { +void ACLChangeSelectorPerm(aclSelector *selector, struct serverCommand *cmd, int allow) { unsigned long id = cmd->id; ACLSetSelectorCommandBit(selector,id,allow); ACLResetFirstArgsForCommand(selector,id); @@ -657,7 +657,7 @@ void ACLChangeSelectorPerm(aclSelector *selector, struct redisCommand *cmd, int dictEntry *de; dictIterator *di = dictGetSafeIterator(cmd->subcommands_dict); while((de = dictNext(di)) != NULL) { - struct redisCommand *sub = (struct redisCommand *)dictGetVal(de); + struct serverCommand *sub = (struct serverCommand *)dictGetVal(de); ACLSetSelectorCommandBit(selector,sub->id,allow); } dictReleaseIterator(di); @@ -674,7 +674,7 @@ void ACLSetSelectorCommandBitsForCategory(dict *commands, aclSelector *selector, dictIterator *di = dictGetIterator(commands); dictEntry *de; while ((de = dictNext(di)) != NULL) { - struct redisCommand *cmd = dictGetVal(de); + struct serverCommand *cmd = dictGetVal(de); if (cmd->acl_categories & cflag) { ACLChangeSelectorPerm(selector,cmd,value); } @@ -738,7 +738,7 @@ void ACLCountCategoryBitsForCommands(dict *commands, aclSelector *selector, unsi dictIterator *di = dictGetIterator(commands); dictEntry *de; while ((de = dictNext(di)) != NULL) { - struct redisCommand *cmd = dictGetVal(de); + struct serverCommand *cmd = dictGetVal(de); if (cmd->acl_categories & cflag) { if (ACLGetSelectorCommandBit(selector,cmd->id)) (*on)++; @@ -922,8 +922,8 @@ robj *ACLDescribeUser(user *u) { /* Get a command from the original command table, that is not affected * by the command renaming operations: we base all the ACL work from that * table, so that ACLs are valid regardless of command renaming. */ -struct redisCommand *ACLLookupCommand(const char *name) { - struct redisCommand *cmd; +struct serverCommand *ACLLookupCommand(const char *name) { + struct serverCommand *cmd; sds sdsname = sdsnew(name); cmd = lookupCommandBySdsLogic(server.orig_commands,sdsname); sdsfree(sdsname); @@ -1140,7 +1140,7 @@ int ACLSetSelector(aclSelector *selector, const char* op, size_t oplen) { selector->flags &= ~SELECTOR_FLAG_ALLCHANNELS; } else if (op[0] == '+' && op[1] != '@') { if (strrchr(op,'|') == NULL) { - struct redisCommand *cmd = ACLLookupCommand(op+1); + struct serverCommand *cmd = ACLLookupCommand(op+1); if (cmd == NULL) { errno = ENOENT; return C_ERR; @@ -1154,7 +1154,7 @@ int ACLSetSelector(aclSelector *selector, const char* op, size_t oplen) { sub[0] = '\0'; sub++; - struct redisCommand *cmd = ACLLookupCommand(copy); + struct serverCommand *cmd = ACLLookupCommand(copy); /* Check if the command exists. We can't check the * first-arg to see if it is valid. */ @@ -1203,7 +1203,7 @@ int ACLSetSelector(aclSelector *selector, const char* op, size_t oplen) { zfree(copy); } } else if (op[0] == '-' && op[1] != '@') { - struct redisCommand *cmd = ACLLookupCommand(op+1); + struct serverCommand *cmd = ACLLookupCommand(op+1); if (cmd == NULL) { errno = ENOENT; return C_ERR; @@ -1699,7 +1699,7 @@ void cleanupACLKeyResultCache(aclKeyResultCache *cache) { * command cannot be executed because the selector is not allowed to run such * command, the second and third if the command is denied because the selector is trying * to access a key or channel that are not among the specified patterns. */ -static int ACLSelectorCheckCmd(aclSelector *selector, struct redisCommand *cmd, robj **argv, int argc, int *keyidxptr, aclKeyResultCache *cache) { +static int ACLSelectorCheckCmd(aclSelector *selector, struct serverCommand *cmd, robj **argv, int argc, int *keyidxptr, aclKeyResultCache *cache) { uint64_t id = cmd->id; int ret; if (!(selector->flags & SELECTOR_FLAG_ALLCOMMANDS) && !(cmd->flags & CMD_NO_AUTH)) { @@ -1799,7 +1799,7 @@ int ACLUserCheckKeyPerm(user *u, const char *key, int keylen, int flags) { * granted in addition to the access required by the command. Returns 1 * if the user has access or 0 otherwise. */ -int ACLUserCheckCmdWithUnrestrictedKeyAccess(user *u, struct redisCommand *cmd, robj **argv, int argc, int flags) { +int ACLUserCheckCmdWithUnrestrictedKeyAccess(user *u, struct serverCommand *cmd, robj **argv, int argc, int flags) { listIter li; listNode *ln; int local_idxptr; @@ -1858,7 +1858,7 @@ int ACLUserCheckChannelPerm(user *u, sds channel, int is_pattern) { * If the command fails an ACL check, idxptr will be to set to the first argv entry that * causes the failure, either 0 if the command itself fails or the idx of the key/channel * that causes the failure */ -int ACLCheckAllUserCommandPerm(user *u, struct redisCommand *cmd, robj **argv, int argc, int *idxptr) { +int ACLCheckAllUserCommandPerm(user *u, struct serverCommand *cmd, robj **argv, int argc, int *idxptr) { listIter li; listNode *ln; @@ -2754,7 +2754,7 @@ void addACLLogEntry(client *c, int reason, int context, int argpos, sds username } } -sds getAclErrorMessage(int acl_res, user *user, struct redisCommand *cmd, sds errored_val, int verbose) { +sds getAclErrorMessage(int acl_res, user *user, struct serverCommand *cmd, sds errored_val, int verbose) { switch (acl_res) { case ACL_DENIED_CMD: return sdscatfmt(sdsempty(), "User %S has no permissions to run " @@ -2787,7 +2787,7 @@ void aclCatWithFlags(client *c, dict *commands, uint64_t cflag, int *arraylen) { dictIterator *di = dictGetIterator(commands); while ((de = dictNext(di)) != NULL) { - struct redisCommand *cmd = dictGetVal(de); + struct serverCommand *cmd = dictGetVal(de); if (cmd->flags & CMD_MODULE) continue; if (cmd->acl_categories & cflag) { addReplyBulkCBuffer(c, cmd->fullname, sdslen(cmd->fullname)); @@ -3127,7 +3127,7 @@ void aclCommand(client *c) { addReplyLongLong(c, le->ctime); } } else if (!strcasecmp(sub,"dryrun") && c->argc >= 4) { - struct redisCommand *cmd; + struct serverCommand *cmd; user *u = ACLGetUserByName(c->argv[2]->ptr,sdslen(c->argv[2]->ptr)); if (u == NULL) { addReplyErrorFormat(c, "User '%s' not found", (char *)c->argv[2]->ptr); @@ -3191,7 +3191,7 @@ NULL } } -void addReplyCommandCategories(client *c, struct redisCommand *cmd) { +void addReplyCommandCategories(client *c, struct serverCommand *cmd) { int flagcount = 0; void *flaglen = addReplyDeferredLen(c); for (int j = 0; ACLCommandCategories[j].flag != 0; j++) { diff --git a/src/aof.c b/src/aof.c index cfa3df83a9..cb9c431364 100644 --- a/src/aof.c +++ b/src/aof.c @@ -1481,7 +1481,7 @@ int loadSingleAppendOnlyFile(char *filename) { robj **argv; char buf[AOF_ANNOTATION_LINE_MAX_LEN]; sds argsds; - struct redisCommand *cmd; + struct serverCommand *cmd; /* Serve the clients from time to time */ if (!(loops++ % 1024)) { diff --git a/src/cluster.c b/src/cluster.c index 60f5cc3b4e..ca002a17bb 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -990,7 +990,7 @@ void clusterCommand(client *c) { * * CLUSTER_REDIR_DOWN_STATE and CLUSTER_REDIR_DOWN_RO_STATE if the cluster is * down but the user attempts to execute a command that addresses one or more keys. */ -clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, int argc, int *hashslot, int *error_code) { +clusterNode *getNodeByQuery(client *c, struct serverCommand *cmd, robj **argv, int argc, int *hashslot, int *error_code) { clusterNode *myself = getMyClusterNode(); clusterNode *n = NULL; robj *firstkey = NULL; @@ -1039,7 +1039,7 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in /* Check that all the keys are in the same hash slot, and obtain this * slot and the node associated. */ for (i = 0; i < ms->count; i++) { - struct redisCommand *mcmd; + struct serverCommand *mcmd; robj **margv; int margc, numkeys, j; keyReference *keyindex; diff --git a/src/cluster.h b/src/cluster.h index f21f1e9c16..463b4940d9 100644 --- a/src/cluster.h +++ b/src/cluster.h @@ -105,7 +105,7 @@ long long clusterNodeReplOffset(clusterNode *node); clusterNode *clusterLookupNode(const char *name, int length); /* functions with shared implementations */ -clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, int argc, int *hashslot, int *ask); +clusterNode *getNodeByQuery(client *c, struct serverCommand *cmd, robj **argv, int argc, int *hashslot, int *ask); int clusterRedirectBlockedClientIfNeeded(client *c); void clusterRedirectClient(client *c, clusterNode *n, int hashslot, int error_code); void migrateCloseTimedoutSockets(void); diff --git a/src/commands.c b/src/commands.c index 5dcfe19738..6d8e5696f3 100644 --- a/src/commands.c +++ b/src/commands.c @@ -3,7 +3,7 @@ #define MAKE_CMD(name,summary,complexity,since,doc_flags,replaced,deprecated,group,group_enum,history,num_history,tips,num_tips,function,arity,flags,acl,key_specs,key_specs_num,get_keys,numargs) name,summary,complexity,since,doc_flags,replaced,deprecated,group_enum,history,num_history,tips,num_tips,function,arity,flags,acl,key_specs,key_specs_num,get_keys,numargs #define MAKE_ARG(name,type,key_spec_index,token,summary,since,flags,numsubargs,deprecated_since) name,type,key_spec_index,token,summary,since,flags,deprecated_since,numsubargs -#define COMMAND_STRUCT redisCommand +#define COMMAND_STRUCT serverCommand #define COMMAND_ARG redisCommandArg #ifdef LOG_REQ_RES diff --git a/src/config.c b/src/config.c index 14d45b6721..731a3304c7 100644 --- a/src/config.c +++ b/src/config.c @@ -537,7 +537,7 @@ void loadServerConfigFromString(char *config) { if (!strcasecmp(argv[0],"include") && argc == 2) { loadServerConfig(argv[1], 0, NULL); } else if (!strcasecmp(argv[0],"rename-command") && argc == 3) { - struct redisCommand *cmd = lookupCommandBySds(argv[1]); + struct serverCommand *cmd = lookupCommandBySds(argv[1]); int retval; if (!cmd) { diff --git a/src/db.c b/src/db.c index e5de136063..f58bde45df 100644 --- a/src/db.c +++ b/src/db.c @@ -1970,7 +1970,7 @@ keyReference *getKeysPrepareResult(getKeysResult *result, int numkeys) { /* Returns a bitmask with all the flags found in any of the key specs of the command. * The 'inv' argument means we'll return a mask with all flags that are missing in at least one spec. */ -int64_t getAllKeySpecsFlags(struct redisCommand *cmd, int inv) { +int64_t getAllKeySpecsFlags(struct serverCommand *cmd, int inv) { int64_t flags = 0; for (int j = 0; j < cmd->key_specs_num; j++) { keySpec *spec = cmd->key_specs + j; @@ -1986,7 +1986,7 @@ int64_t getAllKeySpecsFlags(struct redisCommand *cmd, int inv) { * GET_KEYSPEC_RETURN_PARTIAL: Skips invalid and incomplete keyspecs but returns the keys * found in other valid keyspecs. */ -int getKeysUsingKeySpecs(struct redisCommand *cmd, robj **argv, int argc, int search_flags, getKeysResult *result) { +int getKeysUsingKeySpecs(struct serverCommand *cmd, robj **argv, int argc, int search_flags, getKeysResult *result) { int j, i, last, first, step; keyReference *keys; serverAssert(result->numkeys == 0); /* caller should initialize or reset it */ @@ -2111,9 +2111,9 @@ int getKeysUsingKeySpecs(struct redisCommand *cmd, robj **argv, int argc, int se * Along with the position, this command also returns the flags that are * associated with how Redis will access the key. * - * 'cmd' must be point to the corresponding entry into the redisCommand + * 'cmd' must be point to the corresponding entry into the serverCommand * table, according to the command name in argv[0]. */ -int getKeysFromCommandWithSpecs(struct redisCommand *cmd, robj **argv, int argc, int search_flags, getKeysResult *result) { +int getKeysFromCommandWithSpecs(struct serverCommand *cmd, robj **argv, int argc, int search_flags, getKeysResult *result) { /* The command has at least one key-spec not marked as NOT_KEY */ int has_keyspec = (getAllKeySpecsFlags(cmd, 1) & CMD_KEY_NOT_KEY); /* The command has at least one key-spec marked as VARIABLE_FLAGS */ @@ -2140,7 +2140,7 @@ int getKeysFromCommandWithSpecs(struct redisCommand *cmd, robj **argv, int argc, } /* This function returns a sanity check if the command may have keys. */ -int doesCommandHaveKeys(struct redisCommand *cmd) { +int doesCommandHaveKeys(struct serverCommand *cmd) { return cmd->getkeys_proc || /* has getkeys_proc (non modules) */ (cmd->flags & CMD_MODULE_GETKEYS) || /* module with GETKEYS */ (getAllKeySpecsFlags(cmd, 1) & CMD_KEY_NOT_KEY); /* has at least one key-spec not marked as NOT_KEY */ @@ -2170,7 +2170,7 @@ ChannelSpecs commands_with_channels[] = { /* Returns 1 if the command may access any channels matched by the flags * argument. */ -int doesCommandHaveChannelsWithFlags(struct redisCommand *cmd, int flags) { +int doesCommandHaveChannelsWithFlags(struct serverCommand *cmd, int flags) { /* If a module declares get channels, we are just going to assume * has channels. This API is allowed to return false positives. */ if (cmd->flags & CMD_MODULE_GETCHANNELS) { @@ -2195,9 +2195,9 @@ int doesCommandHaveChannelsWithFlags(struct redisCommand *cmd, int flags) { * Along with the position, this command also returns the flags that are * associated with how Redis will access the channel. * - * 'cmd' must be point to the corresponding entry into the redisCommand + * 'cmd' must be point to the corresponding entry into the serverCommand * table, according to the command name in argv[0]. */ -int getChannelsFromCommand(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int getChannelsFromCommand(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { keyReference *keys; /* If a module declares get channels, use that. */ if (cmd->flags & CMD_MODULE_GETCHANNELS) { @@ -2232,7 +2232,7 @@ int getChannelsFromCommand(struct redisCommand *cmd, robj **argv, int argc, getK * * NOTE: This function does not guarantee populating the flags for * the keys, in order to get flags you should use getKeysUsingKeySpecs. */ -int getKeysUsingLegacyRangeSpec(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int getKeysUsingLegacyRangeSpec(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { int j, i = 0, last, first, step; keyReference *keys; UNUSED(argv); @@ -2282,12 +2282,12 @@ int getKeysUsingLegacyRangeSpec(struct redisCommand *cmd, robj **argv, int argc, * so the actual return value is a heap allocated array of integers. The * length of the array is returned by reference into *numkeys. * - * 'cmd' must be point to the corresponding entry into the redisCommand + * 'cmd' must be point to the corresponding entry into the serverCommand * table, according to the command name in argv[0]. * * This function uses the command table if a command-specific helper function * is not required, otherwise it calls the command-specific function. */ -int getKeysFromCommand(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int getKeysFromCommand(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { if (cmd->flags & CMD_MODULE_GETKEYS) { return moduleGetCommandKeysViaAPI(cmd,argv,argc,result); } else if (cmd->getkeys_proc) { @@ -2346,47 +2346,47 @@ int genericGetKeys(int storeKeyOfs, int keyCountOfs, int firstKeyOfs, int keySte return result->numkeys; } -int sintercardGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int sintercardGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { UNUSED(cmd); return genericGetKeys(0, 1, 2, 1, argv, argc, result); } -int zunionInterDiffStoreGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int zunionInterDiffStoreGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { UNUSED(cmd); return genericGetKeys(1, 2, 3, 1, argv, argc, result); } -int zunionInterDiffGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int zunionInterDiffGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { UNUSED(cmd); return genericGetKeys(0, 1, 2, 1, argv, argc, result); } -int evalGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int evalGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { UNUSED(cmd); return genericGetKeys(0, 2, 3, 1, argv, argc, result); } -int functionGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int functionGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { UNUSED(cmd); return genericGetKeys(0, 2, 3, 1, argv, argc, result); } -int lmpopGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int lmpopGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { UNUSED(cmd); return genericGetKeys(0, 1, 2, 1, argv, argc, result); } -int blmpopGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int blmpopGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { UNUSED(cmd); return genericGetKeys(0, 2, 3, 1, argv, argc, result); } -int zmpopGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int zmpopGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { UNUSED(cmd); return genericGetKeys(0, 1, 2, 1, argv, argc, result); } -int bzmpopGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int bzmpopGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { UNUSED(cmd); return genericGetKeys(0, 2, 3, 1, argv, argc, result); } @@ -2401,7 +2401,7 @@ int bzmpopGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult * implementation to fetch the keys. * * This command declares incomplete keys, so the flags are correctly set for this function */ -int sortROGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int sortROGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { keyReference *keys; UNUSED(cmd); UNUSED(argv); @@ -2423,7 +2423,7 @@ int sortROGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult * correctly identify keys in the "STORE" option. * * This command declares incomplete keys, so the flags are correctly set for this function */ -int sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int sortGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { int i, j, num, found_store = 0; keyReference *keys; UNUSED(cmd); @@ -2468,7 +2468,7 @@ int sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult * } /* This command declares incomplete keys, so the flags are correctly set for this function */ -int migrateGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int migrateGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { int i, j, num, first; keyReference *keys; UNUSED(cmd); @@ -2525,7 +2525,7 @@ int migrateGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResul * GEORADIUSBYMEMBER key member radius unit ... options ... * * This command has a fully defined keyspec, so returning flags isn't needed. */ -int georadiusGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int georadiusGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { int i, num; keyReference *keys; UNUSED(cmd); @@ -2566,7 +2566,7 @@ int georadiusGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysRes * STREAMS key_1 key_2 ... key_N ID_1 ID_2 ... ID_N * * This command has a fully defined keyspec, so returning flags isn't needed. */ -int xreadGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int xreadGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { int i, num = 0; keyReference *keys; UNUSED(cmd); @@ -2614,7 +2614,7 @@ int xreadGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult /* Helper function to extract keys from the SET command, which may have * a read flag if the GET argument is passed in. */ -int setGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int setGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { keyReference *keys; UNUSED(cmd); @@ -2639,7 +2639,7 @@ int setGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *r /* Helper function to extract keys from the BITFIELD command, which may be * read-only if the BITFIELD GET subcommand is used. */ -int bitfieldGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int bitfieldGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { keyReference *keys; int readonly = 1; UNUSED(cmd); diff --git a/src/latency.c b/src/latency.c index 4805508e75..b5ec6e3823 100644 --- a/src/latency.c +++ b/src/latency.c @@ -493,10 +493,10 @@ void fillCommandCDF(client *c, struct hdr_histogram* histogram) { void latencyAllCommandsFillCDF(client *c, dict *commands, int *command_with_data) { dictIterator *di = dictGetSafeIterator(commands); dictEntry *de; - struct redisCommand *cmd; + struct serverCommand *cmd; while((de = dictNext(di)) != NULL) { - cmd = (struct redisCommand *) dictGetVal(de); + cmd = (struct serverCommand *) dictGetVal(de); if (cmd->latency_histogram) { addReplyBulkCBuffer(c, cmd->fullname, sdslen(cmd->fullname)); fillCommandCDF(c, cmd->latency_histogram); @@ -516,7 +516,7 @@ void latencySpecificCommandsFillCDF(client *c) { void *replylen = addReplyDeferredLen(c); int command_with_data = 0; for (int j = 2; j < c->argc; j++){ - struct redisCommand *cmd = lookupCommandBySds(c->argv[j]->ptr); + struct serverCommand *cmd = lookupCommandBySds(c->argv[j]->ptr); /* If the command does not exist we skip the reply */ if (cmd == NULL) { continue; @@ -533,7 +533,7 @@ void latencySpecificCommandsFillCDF(client *c) { dictIterator *di = dictGetSafeIterator(cmd->subcommands_dict); while ((de = dictNext(di)) != NULL) { - struct redisCommand *sub = dictGetVal(de); + struct serverCommand *sub = dictGetVal(de); if (sub->latency_histogram) { addReplyBulkCBuffer(c, sub->fullname, sdslen(sub->fullname)); fillCommandCDF(c, sub->latency_histogram); diff --git a/src/module.c b/src/module.c index f06952df74..1545e6d9c4 100644 --- a/src/module.c +++ b/src/module.c @@ -238,7 +238,7 @@ typedef void (*RedisModuleDisconnectFunc) (RedisModuleCtx *ctx, struct RedisModu struct RedisModuleCommand { struct RedisModule *module; RedisModuleCmdFunc func; - struct redisCommand *rediscmd; + struct serverCommand *rediscmd; }; typedef struct RedisModuleCommand RedisModuleCommand; @@ -959,7 +959,7 @@ void RedisModuleCommandDispatcher(client *c) { * In order to accomplish its work, the module command is called, flagging * the context in a way that the command can recognize this is a special * "get keys" call by calling RedisModule_IsKeysPositionRequest(ctx). */ -int moduleGetCommandKeysViaAPI(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int moduleGetCommandKeysViaAPI(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { RedisModuleCommand *cp = cmd->module_cmd; RedisModuleCtx ctx; moduleCreateContext(&ctx, cp->module, REDISMODULE_CTX_KEYS_POS_REQUEST); @@ -979,7 +979,7 @@ int moduleGetCommandKeysViaAPI(struct redisCommand *cmd, robj **argv, int argc, /* This function returns the list of channels, with the same interface as * moduleGetCommandKeysViaAPI, for modules that declare "getchannels-api" * during registration. Unlike keys, this is the only way to declare channels. */ -int moduleGetCommandChannelsViaAPI(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { +int moduleGetCommandChannelsViaAPI(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result) { RedisModuleCommand *cp = cmd->module_cmd; RedisModuleCtx ctx; moduleCreateContext(&ctx, cp->module, REDISMODULE_CTX_CHANNELS_POS_REQUEST); @@ -1301,7 +1301,7 @@ int RM_CreateCommand(RedisModuleCtx *ctx, const char *name, RedisModuleCmdFunc c * Function will take the ownership of both 'declared_name' and 'fullname' SDS. */ RedisModuleCommand *moduleCreateCommandProxy(struct RedisModule *module, sds declared_name, sds fullname, RedisModuleCmdFunc cmdfunc, int64_t flags, int firstkey, int lastkey, int keystep) { - struct redisCommand *rediscmd; + struct serverCommand *rediscmd; RedisModuleCommand *cp; /* Create a command "proxy", which is a structure that is referenced @@ -1352,7 +1352,7 @@ RedisModuleCommand *moduleCreateCommandProxy(struct RedisModule *module, sds dec * * The command doesn't belong to the calling module */ RedisModuleCommand *RM_GetCommand(RedisModuleCtx *ctx, const char *name) { - struct redisCommand *cmd = lookupCommandByCString(name); + struct serverCommand *cmd = lookupCommandByCString(name); if (!cmd || !(cmd->flags & CMD_MODULE)) return NULL; @@ -1399,7 +1399,7 @@ int RM_CreateSubcommand(RedisModuleCommand *parent, const char *name, RedisModul if ((flags & CMD_MODULE_NO_CLUSTER) && server.cluster_enabled) return REDISMODULE_ERR; - struct redisCommand *parent_cmd = parent->rediscmd; + struct serverCommand *parent_cmd = parent->rediscmd; if (parent_cmd->parent) return REDISMODULE_ERR; /* We don't allow more than one level of subcommands */ @@ -1553,7 +1553,7 @@ int RM_SetCommandACLCategories(RedisModuleCommand *command, const char *aclflags if (!command || !command->module || !command->module->onload) return REDISMODULE_ERR; int64_t categories_flags = aclflags ? categoryFlagsFromString((char*)aclflags) : 0; if (categories_flags == -1) return REDISMODULE_ERR; - struct redisCommand *rcmd = command->rediscmd; + struct serverCommand *rcmd = command->rediscmd; rcmd->acl_categories = categories_flags; /* ACL categories flags for module command */ command->module->num_commands_with_acl_categories++; return REDISMODULE_OK; @@ -1866,7 +1866,7 @@ int RM_SetCommandInfo(RedisModuleCommand *command, const RedisModuleCommandInfo return REDISMODULE_ERR; } - struct redisCommand *cmd = command->rediscmd; + struct serverCommand *cmd = command->rediscmd; /* Check if any info has already been set. Overwriting info involves freeing * the old info, which is not implemented. */ @@ -2038,7 +2038,7 @@ static int moduleValidateCommandInfo(const RedisModuleCommandInfo *info) { moduleCmdKeySpecAt(version, info->key_specs, j); if (j >= INT_MAX) { serverLog(LL_WARNING, "Invalid command info: Too many key specs"); - return 0; /* redisCommand.key_specs_num is an int. */ + return 0; /* serverCommand.key_specs_num is an int. */ } /* Flags. Exactly one flag in a group is set if and only if the @@ -2256,7 +2256,7 @@ void *moduleGetHandleByName(char *modulename) { } /* Returns 1 if `cmd` is a command of the module `modulename`. 0 otherwise. */ -int moduleIsModuleCommand(void *module_handle, struct redisCommand *cmd) { +int moduleIsModuleCommand(void *module_handle, struct serverCommand *cmd) { if (cmd->proc != RedisModuleCommandDispatcher) return 0; if (module_handle == NULL) @@ -3578,7 +3578,7 @@ int RM_ReplyWithLongDouble(RedisModuleCtx *ctx, long double ld) { * The command returns REDISMODULE_ERR if the format specifiers are invalid * or the command name does not belong to a known command. */ int RM_Replicate(RedisModuleCtx *ctx, const char *cmdname, const char *fmt, ...) { - struct redisCommand *cmd; + struct serverCommand *cmd; robj **argv = NULL; int argc = 0, flags = 0, j; va_list ap; @@ -6773,7 +6773,7 @@ const char *moduleTypeModuleName(moduleType *mt) { } /* Return the module name from a module command */ -const char *moduleNameFromCommand(struct redisCommand *cmd) { +const char *moduleNameFromCommand(struct serverCommand *cmd) { serverAssert(cmd->proc == RedisModuleCommandDispatcher); RedisModuleCommand *cp = cmd->module_cmd; @@ -7528,7 +7528,7 @@ int RM_GetDbIdFromDigest(RedisModuleDigest *dig) { * handling is performed by Redis itself. */ void RM_EmitAOF(RedisModuleIO *io, const char *cmdname, const char *fmt, ...) { if (io->error) return; - struct redisCommand *cmd; + struct serverCommand *cmd; robj **argv = NULL; int argc = 0, flags = 0, j; va_list ap; @@ -9722,7 +9722,7 @@ RedisModuleUser *RM_GetModuleUserFromUserName(RedisModuleString *name) { */ int RM_ACLCheckCommandPermissions(RedisModuleUser *user, RedisModuleString **argv, int argc) { int keyidxptr; - struct redisCommand *cmd; + struct serverCommand *cmd; /* Find command */ if ((cmd = lookupCommand(argv, argc)) == NULL) { @@ -12154,7 +12154,7 @@ void moduleFreeArgs(struct redisCommandArg *args, int num_args) { * Note that caller needs to handle the deletion of the command table dict, * and after that needs to free the command->fullname and the command itself. */ -int moduleFreeCommand(struct RedisModule *module, struct redisCommand *cmd) { +int moduleFreeCommand(struct RedisModule *module, struct serverCommand *cmd) { if (cmd->proc != RedisModuleCommandDispatcher) return C_ERR; @@ -12193,7 +12193,7 @@ int moduleFreeCommand(struct RedisModule *module, struct redisCommand *cmd) { dictEntry *de; dictIterator *di = dictGetSafeIterator(cmd->subcommands_dict); while ((de = dictNext(di)) != NULL) { - struct redisCommand *sub = dictGetVal(de); + struct serverCommand *sub = dictGetVal(de); if (moduleFreeCommand(module, sub) != C_OK) continue; serverAssert(dictDelete(cmd->subcommands_dict, sub->declared_name) == DICT_OK); @@ -12213,7 +12213,7 @@ void moduleUnregisterCommands(struct RedisModule *module) { dictIterator *di = dictGetSafeIterator(server.commands); dictEntry *de; while ((de = dictNext(di)) != NULL) { - struct redisCommand *cmd = dictGetVal(de); + struct serverCommand *cmd = dictGetVal(de); if (moduleFreeCommand(module, cmd) != C_OK) continue; serverAssert(dictDelete(server.commands, cmd->fullname) == DICT_OK); @@ -13363,7 +13363,7 @@ int RM_ModuleTypeReplaceValue(RedisModuleKey *key, moduleType *mt, void *new_val */ int *RM_GetCommandKeysWithFlags(RedisModuleCtx *ctx, RedisModuleString **argv, int argc, int *num_keys, int **out_flags) { UNUSED(ctx); - struct redisCommand *cmd; + struct serverCommand *cmd; int *res = NULL; /* Find command */ diff --git a/src/multi.c b/src/multi.c index cb082f91e1..e8adeccde4 100644 --- a/src/multi.c +++ b/src/multi.c @@ -149,7 +149,7 @@ void execCommand(client *c) { int j; robj **orig_argv; int orig_argc, orig_argv_len; - struct redisCommand *orig_cmd; + struct serverCommand *orig_cmd; if (!(c->flags & CLIENT_MULTI)) { addReplyError(c,"EXEC without MULTI"); diff --git a/src/networking.c b/src/networking.c index c4414f5a49..90825ca284 100644 --- a/src/networking.c +++ b/src/networking.c @@ -385,7 +385,7 @@ void _addReplyProtoToList(client *c, list *reply_list, const char *s, size_t len /* The subscribe / unsubscribe command family has a push as a reply, * or in other words, it responds with a push (or several of them * depending on how many arguments it got), and has no reply. */ -int cmdHasPushAsReply(struct redisCommand *cmd) { +int cmdHasPushAsReply(struct serverCommand *cmd) { if (!cmd) return 0; return cmd->proc == subscribeCommand || cmd->proc == unsubscribeCommand || cmd->proc == psubscribeCommand || cmd->proc == punsubscribeCommand || diff --git a/src/script.c b/src/script.c index 4a6461c0b4..fd7c616717 100644 --- a/src/script.c +++ b/src/script.c @@ -319,7 +319,7 @@ void scriptKill(client *c, int is_eval) { addReply(c, shared.ok); } -static int scriptVerifyCommandArity(struct redisCommand *cmd, int argc, sds *err) { +static int scriptVerifyCommandArity(struct serverCommand *cmd, int argc, sds *err) { if (!cmd || ((cmd->arity > 0 && cmd->arity != argc) || (argc < -cmd->arity))) { if (cmd) *err = sdsnew("Wrong number of args calling Redis command from script"); @@ -541,7 +541,7 @@ void scriptCall(scriptRunCtx *run_ctx, sds *err) { /* Process module hooks */ moduleCallCommandFilters(c); - struct redisCommand *cmd = lookupCommand(c->argv, c->argc); + struct serverCommand *cmd = lookupCommand(c->argv, c->argc); c->cmd = c->lastcmd = c->realcmd = cmd; if (scriptVerifyCommandArity(cmd, c->argc, err) != C_OK) { goto error; diff --git a/src/script_lua.c b/src/script_lua.c index 3587bb2771..1126422582 100644 --- a/src/script_lua.c +++ b/src/script_lua.c @@ -1143,7 +1143,7 @@ static int luaRedisAclCheckCmdPermissionsCommand(lua_State *lua) { if (argv == NULL) return luaError(lua); /* Find command */ - struct redisCommand *cmd; + struct serverCommand *cmd; if ((cmd = lookupCommand(argv, argc)) == NULL) { luaPushError(lua, "Invalid command passed to redis.acl_check_cmd()"); raise_error = 1; diff --git a/src/server.c b/src/server.c index 75ab399800..53c2b57a21 100644 --- a/src/server.c +++ b/src/server.c @@ -2906,7 +2906,7 @@ void InitServerLast(void) { * because anyway the legacy (first,last,step) spec is to be deprecated * and one should use the new key specs scheme. */ -void populateCommandLegacyRangeSpec(struct redisCommand *c) { +void populateCommandLegacyRangeSpec(struct serverCommand *c) { memset(&c->legacy_range_key_spec, 0, sizeof(c->legacy_range_key_spec)); /* Set the movablekeys flag if we have a GETKEYS flag for modules. @@ -2985,7 +2985,7 @@ sds catSubCommandFullname(const char *parent_name, const char *sub_name) { return sdscatfmt(sdsempty(), "%s|%s", parent_name, sub_name); } -void commandAddSubcommand(struct redisCommand *parent, struct redisCommand *subcommand, const char *declared_name) { +void commandAddSubcommand(struct serverCommand *parent, struct serverCommand *subcommand, const char *declared_name) { if (!parent->subcommands_dict) parent->subcommands_dict = dictCreate(&commandTableDictType); @@ -2996,8 +2996,8 @@ void commandAddSubcommand(struct redisCommand *parent, struct redisCommand *subc } /* Set implicit ACl categories (see comment above the definition of - * struct redisCommand). */ -void setImplicitACLCategories(struct redisCommand *c) { + * struct serverCommand). */ +void setImplicitACLCategories(struct serverCommand *c) { if (c->flags & CMD_WRITE) c->acl_categories |= ACL_CATEGORY_WRITE; /* Exclude scripting commands from the RO category. */ @@ -3021,7 +3021,7 @@ void setImplicitACLCategories(struct redisCommand *c) { * * On success, the function return C_OK. Otherwise C_ERR is returned and we won't * add this command in the commands dict. */ -int populateCommandStructure(struct redisCommand *c) { +int populateCommandStructure(struct serverCommand *c) { /* If the command marks with CMD_SENTINEL, it exists in sentinel. */ if (!(c->flags & CMD_SENTINEL) && server.sentinel_mode) return C_ERR; @@ -3047,7 +3047,7 @@ int populateCommandStructure(struct redisCommand *c) { /* Handle subcommands */ if (c->subcommands) { for (int j = 0; c->subcommands[j].declared_name; j++) { - struct redisCommand *sub = c->subcommands+j; + struct serverCommand *sub = c->subcommands+j; sub->fullname = catSubCommandFullname(c->declared_name, sub->declared_name); if (populateCommandStructure(sub) == C_ERR) @@ -3060,13 +3060,13 @@ int populateCommandStructure(struct redisCommand *c) { return C_OK; } -extern struct redisCommand redisCommandTable[]; +extern struct serverCommand redisCommandTable[]; /* Populates the Redis Command Table dict from the static table in commands.c * which is auto generated from the json files in the commands folder. */ void populateCommandTable(void) { int j; - struct redisCommand *c; + struct serverCommand *c; for (j = 0;; j++) { c = redisCommandTable + j; @@ -3088,13 +3088,13 @@ void populateCommandTable(void) { } void resetCommandTableStats(dict* commands) { - struct redisCommand *c; + struct serverCommand *c; dictEntry *de; dictIterator *di; di = dictGetSafeIterator(commands); while((de = dictNext(di)) != NULL) { - c = (struct redisCommand *) dictGetVal(de); + c = (struct serverCommand *) dictGetVal(de); c->microseconds = 0; c->calls = 0; c->rejected_calls = 0; @@ -3156,12 +3156,12 @@ void serverOpArrayFree(serverOpArray *oa) { /* ====================== Commands lookup and execution ===================== */ int isContainerCommandBySds(sds s) { - struct redisCommand *base_cmd = dictFetchValue(server.commands, s); + struct serverCommand *base_cmd = dictFetchValue(server.commands, s); int has_subcommands = base_cmd && base_cmd->subcommands_dict; return has_subcommands; } -struct redisCommand *lookupSubcommand(struct redisCommand *container, sds sub_name) { +struct serverCommand *lookupSubcommand(struct serverCommand *container, sds sub_name) { return dictFetchValue(container->subcommands_dict, sub_name); } @@ -3173,8 +3173,8 @@ struct redisCommand *lookupSubcommand(struct redisCommand *container, sds sub_na * name (e.g. in COMMAND INFO) rather than to find the command * a user requested to execute (in processCommand). */ -struct redisCommand *lookupCommandLogic(dict *commands, robj **argv, int argc, int strict) { - struct redisCommand *base_cmd = dictFetchValue(commands, argv[0]->ptr); +struct serverCommand *lookupCommandLogic(dict *commands, robj **argv, int argc, int strict) { + struct serverCommand *base_cmd = dictFetchValue(commands, argv[0]->ptr); int has_subcommands = base_cmd && base_cmd->subcommands_dict; if (argc == 1 || !has_subcommands) { if (strict && argc != 1) @@ -3189,11 +3189,11 @@ struct redisCommand *lookupCommandLogic(dict *commands, robj **argv, int argc, i } } -struct redisCommand *lookupCommand(robj **argv, int argc) { +struct serverCommand *lookupCommand(robj **argv, int argc) { return lookupCommandLogic(server.commands,argv,argc,0); } -struct redisCommand *lookupCommandBySdsLogic(dict *commands, sds s) { +struct serverCommand *lookupCommandBySdsLogic(dict *commands, sds s) { int argc, j; sds *strings = sdssplitlen(s,sdslen(s),"|",1,&argc); if (strings == NULL) @@ -3212,17 +3212,17 @@ struct redisCommand *lookupCommandBySdsLogic(dict *commands, sds s) { argv[j] = &objects[j]; } - struct redisCommand *cmd = lookupCommandLogic(commands,argv,argc,1); + struct serverCommand *cmd = lookupCommandLogic(commands,argv,argc,1); sdsfreesplitres(strings,argc); return cmd; } -struct redisCommand *lookupCommandBySds(sds s) { +struct serverCommand *lookupCommandBySds(sds s) { return lookupCommandBySdsLogic(server.commands,s); } -struct redisCommand *lookupCommandByCStringLogic(dict *commands, const char *s) { - struct redisCommand *cmd; +struct serverCommand *lookupCommandByCStringLogic(dict *commands, const char *s) { + struct serverCommand *cmd; sds name = sdsnew(s); cmd = lookupCommandBySdsLogic(commands,name); @@ -3230,7 +3230,7 @@ struct redisCommand *lookupCommandByCStringLogic(dict *commands, const char *s) return cmd; } -struct redisCommand *lookupCommandByCString(const char *s) { +struct serverCommand *lookupCommandByCString(const char *s) { return lookupCommandByCStringLogic(server.commands,s); } @@ -3241,8 +3241,8 @@ struct redisCommand *lookupCommandByCString(const char *s) { * This is used by functions rewriting the argument vector such as * rewriteClientCommandVector() in order to set client->cmd pointer * correctly even if the command was renamed. */ -struct redisCommand *lookupCommandOrOriginal(robj **argv ,int argc) { - struct redisCommand *cmd = lookupCommandLogic(server.commands, argv, argc, 0); +struct serverCommand *lookupCommandOrOriginal(robj **argv ,int argc) { + struct serverCommand *cmd = lookupCommandLogic(server.commands, argv, argc, 0); if (!cmd) cmd = lookupCommandLogic(server.orig_commands, argv, argc, 0); return cmd; @@ -3352,7 +3352,7 @@ void preventCommandReplication(client *c) { } /* Log the last command a client executed into the slowlog. */ -void slowlogPushCurrentCommand(client *c, struct redisCommand *cmd, ustime_t duration) { +void slowlogPushCurrentCommand(client *c, struct serverCommand *cmd, ustime_t duration) { /* Some commands may contain sensitive data that should not be available in the slowlog. */ if (cmd->flags & CMD_SKIP_SLOWLOG) return; @@ -3459,7 +3459,7 @@ void postExecutionUnitOperations(void) { * twice, its possible to pass a NULL cmd value to indicate that the error was counted elsewhere. * * The function returns true if stats was updated and false if not. */ -int incrCommandStatsOnError(struct redisCommand *cmd, int flags) { +int incrCommandStatsOnError(struct serverCommand *cmd, int flags) { /* hold the prev error count captured on the last command execution */ static long long prev_err_count = 0; int res = 0; @@ -3516,7 +3516,7 @@ int incrCommandStatsOnError(struct redisCommand *cmd, int flags) { void call(client *c, int flags) { long long dirty; uint64_t client_old_flags = c->flags; - struct redisCommand *real_cmd = c->realcmd; + struct serverCommand *real_cmd = c->realcmd; client *prev_client = server.executing_client; server.executing_client = c; @@ -4640,7 +4640,7 @@ void addReplyCommandFlags(client *c, uint64_t flags, replyFlagNames *replyFlags) } } -void addReplyFlagsForCommand(client *c, struct redisCommand *cmd) { +void addReplyFlagsForCommand(client *c, struct serverCommand *cmd) { replyFlagNames flagNames[] = { {CMD_WRITE, "write"}, {CMD_READONLY, "readonly"}, @@ -4672,7 +4672,7 @@ void addReplyFlagsForCommand(client *c, struct redisCommand *cmd) { addReplyCommandFlags(c, cmd->flags, flagNames); } -void addReplyDocFlagsForCommand(client *c, struct redisCommand *cmd) { +void addReplyDocFlagsForCommand(client *c, struct serverCommand *cmd) { replyFlagNames docFlagNames[] = { {CMD_DOC_DEPRECATED, "deprecated"}, {CMD_DOC_SYSCMD, "syscmd"}, @@ -4818,7 +4818,7 @@ void addReplyJson(client *c, struct jsonObject *rs) { #endif -void addReplyCommandHistory(client *c, struct redisCommand *cmd) { +void addReplyCommandHistory(client *c, struct serverCommand *cmd) { addReplySetLen(c, cmd->num_history); for (int j = 0; jnum_history; j++) { addReplyArrayLen(c, 2); @@ -4827,14 +4827,14 @@ void addReplyCommandHistory(client *c, struct redisCommand *cmd) { } } -void addReplyCommandTips(client *c, struct redisCommand *cmd) { +void addReplyCommandTips(client *c, struct serverCommand *cmd) { addReplySetLen(c, cmd->num_tips); for (int j = 0; jnum_tips; j++) { addReplyBulkCString(c, cmd->tips[j]); } } -void addReplyCommandKeySpecs(client *c, struct redisCommand *cmd) { +void addReplyCommandKeySpecs(client *c, struct serverCommand *cmd) { addReplySetLen(c, cmd->key_specs_num); for (int i = 0; i < cmd->key_specs_num; i++) { int maplen = 3; @@ -4931,7 +4931,7 @@ void addReplyCommandKeySpecs(client *c, struct redisCommand *cmd) { } /* Reply with an array of sub-command using the provided reply callback. */ -void addReplyCommandSubCommands(client *c, struct redisCommand *cmd, void (*reply_function)(client*, struct redisCommand*), int use_map) { +void addReplyCommandSubCommands(client *c, struct serverCommand *cmd, void (*reply_function)(client*, struct serverCommand*), int use_map) { if (!cmd->subcommands_dict) { addReplySetLen(c, 0); return; @@ -4944,7 +4944,7 @@ void addReplyCommandSubCommands(client *c, struct redisCommand *cmd, void (*repl dictEntry *de; dictIterator *di = dictGetSafeIterator(cmd->subcommands_dict); while((de = dictNext(di)) != NULL) { - struct redisCommand *sub = (struct redisCommand *)dictGetVal(de); + struct serverCommand *sub = (struct serverCommand *)dictGetVal(de); if (use_map) addReplyBulkCBuffer(c, sub->fullname, sdslen(sub->fullname)); reply_function(c, sub); @@ -4953,7 +4953,7 @@ void addReplyCommandSubCommands(client *c, struct redisCommand *cmd, void (*repl } /* Output the representation of a Redis command. Used by the COMMAND command and COMMAND INFO. */ -void addReplyCommandInfo(client *c, struct redisCommand *cmd) { +void addReplyCommandInfo(client *c, struct serverCommand *cmd) { if (!cmd) { addReplyNull(c); } else { @@ -4981,7 +4981,7 @@ void addReplyCommandInfo(client *c, struct redisCommand *cmd) { } /* Output the representation of a Redis command. Used by the COMMAND DOCS. */ -void addReplyCommandDocs(client *c, struct redisCommand *cmd) { +void addReplyCommandDocs(client *c, struct serverCommand *cmd) { /* Count our reply len so we don't have to use deferred reply. */ long maplen = 1; if (cmd->summary) maplen++; @@ -5054,7 +5054,7 @@ void addReplyCommandDocs(client *c, struct redisCommand *cmd) { /* Helper for COMMAND GETKEYS and GETKEYSANDFLAGS */ void getKeysSubcommandImpl(client *c, int with_flags) { - struct redisCommand *cmd = lookupCommand(c->argv+2,c->argc-2); + struct serverCommand *cmd = lookupCommand(c->argv+2,c->argc-2); getKeysResult result = GETKEYS_RESULT_INIT; int j; @@ -5138,7 +5138,7 @@ typedef struct { } cache; } commandListFilter; -int shouldFilterFromCommandList(struct redisCommand *cmd, commandListFilter *filter) { +int shouldFilterFromCommandList(struct serverCommand *cmd, commandListFilter *filter) { switch (filter->type) { case (COMMAND_LIST_FILTER_MODULE): if (!filter->cache.valid) { @@ -5170,7 +5170,7 @@ void commandListWithFilter(client *c, dict *commands, commandListFilter filter, dictIterator *di = dictGetIterator(commands); while ((de = dictNext(di)) != NULL) { - struct redisCommand *cmd = dictGetVal(de); + struct serverCommand *cmd = dictGetVal(de); if (!shouldFilterFromCommandList(cmd,&filter)) { addReplyBulkCBuffer(c, cmd->fullname, sdslen(cmd->fullname)); (*numcmds)++; @@ -5189,7 +5189,7 @@ void commandListWithoutFilter(client *c, dict *commands, int *numcmds) { dictIterator *di = dictGetIterator(commands); while ((de = dictNext(di)) != NULL) { - struct redisCommand *cmd = dictGetVal(de); + struct serverCommand *cmd = dictGetVal(de); addReplyBulkCBuffer(c, cmd->fullname, sdslen(cmd->fullname)); (*numcmds)++; @@ -5273,7 +5273,7 @@ void commandDocsCommand(client *c) { addReplyMapLen(c, dictSize(server.commands)); di = dictGetIterator(server.commands); while ((de = dictNext(di)) != NULL) { - struct redisCommand *cmd = dictGetVal(de); + struct serverCommand *cmd = dictGetVal(de); addReplyBulkCBuffer(c, cmd->fullname, sdslen(cmd->fullname)); addReplyCommandDocs(c, cmd); } @@ -5283,7 +5283,7 @@ void commandDocsCommand(client *c) { int numcmds = 0; void *replylen = addReplyDeferredLen(c); for (i = 2; i < c->argc; i++) { - struct redisCommand *cmd = lookupCommandBySds(c->argv[i]->ptr); + struct serverCommand *cmd = lookupCommandBySds(c->argv[i]->ptr); if (!cmd) continue; addReplyBulkCBuffer(c, cmd->fullname, sdslen(cmd->fullname)); @@ -5405,13 +5405,13 @@ const char *getSafeInfoString(const char *s, size_t len, char **tmp) { } sds genRedisInfoStringCommandStats(sds info, dict *commands) { - struct redisCommand *c; + struct serverCommand *c; dictEntry *de; dictIterator *di; di = dictGetSafeIterator(commands); while((de = dictNext(di)) != NULL) { char *tmpsafe; - c = (struct redisCommand *) dictGetVal(de); + c = (struct serverCommand *) dictGetVal(de); if (c->calls || c->failed_calls || c->rejected_calls) { info = sdscatprintf(info, "cmdstat_%s:calls=%lld,usec=%lld,usec_per_call=%.2f" @@ -5445,13 +5445,13 @@ sds genRedisInfoStringACLStats(sds info) { } sds genRedisInfoStringLatencyStats(sds info, dict *commands) { - struct redisCommand *c; + struct serverCommand *c; dictEntry *de; dictIterator *di; di = dictGetSafeIterator(commands); while((de = dictNext(di)) != NULL) { char *tmpsafe; - c = (struct redisCommand *) dictGetVal(de); + c = (struct serverCommand *) dictGetVal(de); if (c->latency_histogram) { info = fillPercentileDistributionLatencies(info, getSafeInfoString(c->fullname, sdslen(c->fullname), &tmpsafe), diff --git a/src/server.h b/src/server.h index e78d5a0f64..d4d5495a98 100644 --- a/src/server.h +++ b/src/server.h @@ -202,7 +202,7 @@ extern int configOOMScoreAdjValuesDefaults[CONFIG_OOM_COUNT]; /* Hash table parameters */ #define HASHTABLE_MAX_LOAD_FACTOR 1.618 /* Maximum hash table load factor. */ -/* Command flags. Please check the definition of struct redisCommand in this file +/* Command flags. Please check the definition of struct serverCommand in this file * for more information about the meaning of every flag. */ #define CMD_WRITE (1ULL<<0) #define CMD_READONLY (1ULL<<1) @@ -1007,7 +1007,7 @@ typedef struct multiCmd { robj **argv; int argv_len; int argc; - struct redisCommand *cmd; + struct serverCommand *cmd; } multiCmd; typedef struct multiState { @@ -1177,8 +1177,8 @@ typedef struct client { int original_argc; /* Num of arguments of original command if arguments were rewritten. */ robj **original_argv; /* Arguments of original command if arguments were rewritten. */ size_t argv_len_sum; /* Sum of lengths of objects in argv list. */ - struct redisCommand *cmd, *lastcmd; /* Last command executed. */ - struct redisCommand *realcmd; /* The original command that was executed by the client, + struct serverCommand *cmd, *lastcmd; /* Last command executed. */ + struct serverCommand *realcmd; /* The original command that was executed by the client, Used to update error stats in case the c->cmd was modified during the command invocation (like on GEOADD for example). */ user *user; /* User associated with this connection. If the @@ -2238,7 +2238,7 @@ typedef enum { } serverCommandGroup; typedef void serverCommandProc(client *c); -typedef int serverGetKeysProc(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); +typedef int serverGetKeysProc(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); /* Redis command structure. * @@ -2333,7 +2333,7 @@ typedef int serverGetKeysProc(struct redisCommand *cmd, robj **argv, int argc, g * specific data structures, such as: DEL, RENAME, MOVE, SELECT, * TYPE, EXPIRE*, PEXPIRE*, TTL, PTTL, ... */ -struct redisCommand { +struct serverCommand { /* Declarative data */ const char *declared_name; /* A string representing the command declared_name. * It is a const char * for native commands and SDS for module commands. */ @@ -2359,7 +2359,7 @@ struct redisCommand { serverGetKeysProc *getkeys_proc; int num_args; /* Length of args array. */ /* Array of subcommands (may be NULL) */ - struct redisCommand *subcommands; + struct serverCommand *subcommands; /* Array of arguments (may be NULL) */ struct redisCommandArg *args; #ifdef LOG_REQ_RES @@ -2381,8 +2381,8 @@ struct redisCommand { * we can still support the reply format of * COMMAND INFO and COMMAND GETKEYS */ dict *subcommands_dict; /* A dictionary that holds the subcommands, the key is the subcommand sds name - * (not the fullname), and the value is the redisCommand structure pointer. */ - struct redisCommand *parent; + * (not the fullname), and the value is the serverCommand structure pointer. */ + struct serverCommand *parent; struct RedisModuleCommand *module_cmd; /* A pointer to the module command data (NULL if native command) */ }; @@ -2488,7 +2488,7 @@ extern dict *modules; *----------------------------------------------------------------------------*/ /* Command metadata */ -void populateCommandLegacyRangeSpec(struct redisCommand *c); +void populateCommandLegacyRangeSpec(struct serverCommand *c); /* Modules */ void moduleInitModulesSystem(void); @@ -2497,14 +2497,14 @@ void modulesCron(void); int moduleLoad(const char *path, void **argv, int argc, int is_loadex); int moduleUnload(sds name, const char **errmsg); void moduleLoadFromQueue(void); -int moduleGetCommandKeysViaAPI(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int moduleGetCommandChannelsViaAPI(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); +int moduleGetCommandKeysViaAPI(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int moduleGetCommandChannelsViaAPI(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); moduleType *moduleTypeLookupModuleByID(uint64_t id); moduleType *moduleTypeLookupModuleByName(const char *name); moduleType *moduleTypeLookupModuleByNameIgnoreCase(const char *name); void moduleTypeNameByID(char *name, uint64_t moduleid); const char *moduleTypeModuleName(moduleType *mt); -const char *moduleNameFromCommand(struct redisCommand *cmd); +const char *moduleNameFromCommand(struct serverCommand *cmd); void moduleFreeContext(struct RedisModuleCtx *ctx); void moduleCallCommandUnblockedHandler(client *c); int isModuleClientUnblocked(client *c); @@ -2541,7 +2541,7 @@ int moduleDefragValue(robj *key, robj *obj, int dbid); int moduleLateDefrag(robj *key, robj *value, unsigned long *cursor, long long endtime, int dbid); void moduleDefragGlobals(void); void *moduleGetHandleByName(char *modulename); -int moduleIsModuleCommand(void *module_handle, struct redisCommand *cmd); +int moduleIsModuleCommand(void *module_handle, struct serverCommand *cmd); /* Utils */ long long ustime(void); @@ -2950,8 +2950,8 @@ void ACLClearCommandID(void); user *ACLGetUserByName(const char *name, size_t namelen); int ACLUserCheckKeyPerm(user *u, const char *key, int keylen, int flags); int ACLUserCheckChannelPerm(user *u, sds channel, int literal); -int ACLCheckAllUserCommandPerm(user *u, struct redisCommand *cmd, robj **argv, int argc, int *idxptr); -int ACLUserCheckCmdWithUnrestrictedKeyAccess(user *u, struct redisCommand *cmd, robj **argv, int argc, int flags); +int ACLCheckAllUserCommandPerm(user *u, struct serverCommand *cmd, robj **argv, int argc, int *idxptr); +int ACLUserCheckCmdWithUnrestrictedKeyAccess(user *u, struct serverCommand *cmd, robj **argv, int argc, int flags); int ACLCheckAllPerm(client *c, int *idxptr); int ACLSetUser(user *u, const char *op, ssize_t oplen); sds ACLStringSetUser(user *u, sds username, sds *argv, int argc); @@ -2963,11 +2963,11 @@ const char *ACLSetUserStringError(void); int ACLLoadConfiguredUsers(void); robj *ACLDescribeUser(user *u); void ACLLoadUsersAtStartup(void); -void addReplyCommandCategories(client *c, struct redisCommand *cmd); +void addReplyCommandCategories(client *c, struct serverCommand *cmd); user *ACLCreateUnlinkedUser(void); void ACLFreeUserAndKillClients(user *u); void addACLLogEntry(client *c, int reason, int context, int argpos, sds username, sds object); -sds getAclErrorMessage(int acl_res, user *user, struct redisCommand *cmd, sds errored_val, int verbose); +sds getAclErrorMessage(int acl_res, user *user, struct serverCommand *cmd, sds errored_val, int verbose); void ACLUpdateDefaultUserPassword(sds password); sds genRedisInfoStringACLStats(sds info); void ACLRecomputeCommandBitsFromCommandRulesAllUsers(void); @@ -3051,17 +3051,17 @@ int createSocketAcceptHandler(connListener *sfd, aeFileProc *accept_handler); connListener *listenerByType(const char *typename); int changeListener(connListener *listener); void closeListener(connListener *listener); -struct redisCommand *lookupSubcommand(struct redisCommand *container, sds sub_name); -struct redisCommand *lookupCommand(robj **argv, int argc); -struct redisCommand *lookupCommandBySdsLogic(dict *commands, sds s); -struct redisCommand *lookupCommandBySds(sds s); -struct redisCommand *lookupCommandByCStringLogic(dict *commands, const char *s); -struct redisCommand *lookupCommandByCString(const char *s); -struct redisCommand *lookupCommandOrOriginal(robj **argv, int argc); +struct serverCommand *lookupSubcommand(struct serverCommand *container, sds sub_name); +struct serverCommand *lookupCommand(robj **argv, int argc); +struct serverCommand *lookupCommandBySdsLogic(dict *commands, sds s); +struct serverCommand *lookupCommandBySds(sds s); +struct serverCommand *lookupCommandByCStringLogic(dict *commands, const char *s); +struct serverCommand *lookupCommandByCString(const char *s); +struct serverCommand *lookupCommandOrOriginal(robj **argv, int argc); int commandCheckExistence(client *c, sds *err); int commandCheckArity(client *c, sds *err); void startCommandExecution(void); -int incrCommandStatsOnError(struct redisCommand *cmd, int flags); +int incrCommandStatsOnError(struct serverCommand *cmd, int flags); void call(client *c, int flags); void alsoPropagate(int dbid, robj **argv, int argc, int target); void postExecutionUnitOperations(void); @@ -3070,7 +3070,7 @@ void forceCommandPropagation(client *c, int flags); void preventCommandPropagation(client *c); void preventCommandAOF(client *c); void preventCommandReplication(client *c); -void slowlogPushCurrentCommand(client *c, struct redisCommand *cmd, ustime_t duration); +void slowlogPushCurrentCommand(client *c, struct serverCommand *cmd, ustime_t duration); void updateCommandLatencyHistogram(struct hdr_histogram** latency_histogram, int64_t duration_hist); int prepareForShutdown(int flags); void replyToClientsBlockedOnShutdown(void); @@ -3337,29 +3337,29 @@ void freeReplicationBacklogRefMemAsync(list *blocks, rax *index); #define GET_KEYSPEC_INCLUDE_NOT_KEYS (1<<0) /* Consider 'fake' keys as keys */ #define GET_KEYSPEC_RETURN_PARTIAL (1<<1) /* Return all keys that can be found */ -int getKeysFromCommandWithSpecs(struct redisCommand *cmd, robj **argv, int argc, int search_flags, getKeysResult *result); +int getKeysFromCommandWithSpecs(struct serverCommand *cmd, robj **argv, int argc, int search_flags, getKeysResult *result); keyReference *getKeysPrepareResult(getKeysResult *result, int numkeys); -int getKeysFromCommand(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int doesCommandHaveKeys(struct redisCommand *cmd); -int getChannelsFromCommand(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int doesCommandHaveChannelsWithFlags(struct redisCommand *cmd, int flags); +int getKeysFromCommand(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int doesCommandHaveKeys(struct serverCommand *cmd); +int getChannelsFromCommand(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int doesCommandHaveChannelsWithFlags(struct serverCommand *cmd, int flags); void getKeysFreeResult(getKeysResult *result); -int sintercardGetKeys(struct redisCommand *cmd,robj **argv, int argc, getKeysResult *result); -int zunionInterDiffGetKeys(struct redisCommand *cmd,robj **argv, int argc, getKeysResult *result); -int zunionInterDiffStoreGetKeys(struct redisCommand *cmd,robj **argv, int argc, getKeysResult *result); -int evalGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int functionGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int sortROGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int migrateGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int georadiusGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int xreadGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int lmpopGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int blmpopGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int zmpopGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int bzmpopGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int setGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); -int bitfieldGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result); +int sintercardGetKeys(struct serverCommand *cmd,robj **argv, int argc, getKeysResult *result); +int zunionInterDiffGetKeys(struct serverCommand *cmd,robj **argv, int argc, getKeysResult *result); +int zunionInterDiffStoreGetKeys(struct serverCommand *cmd,robj **argv, int argc, getKeysResult *result); +int evalGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int functionGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int sortGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int sortROGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int migrateGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int georadiusGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int xreadGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int lmpopGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int blmpopGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int zmpopGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int bzmpopGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int setGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); +int bitfieldGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult *result); unsigned short crc16(const char *buf, int len); @@ -3766,7 +3766,7 @@ int memtest_preserving_test(unsigned long *m, size_t bytes, int passes); void mixDigest(unsigned char *digest, const void *ptr, size_t len); void xorDigest(unsigned char *digest, const void *ptr, size_t len); sds catSubCommandFullname(const char *parent_name, const char *sub_name); -void commandAddSubcommand(struct redisCommand *parent, struct redisCommand *subcommand, const char *declared_name); +void commandAddSubcommand(struct serverCommand *parent, struct serverCommand *subcommand, const char *declared_name); void debugDelay(int usec); void killIOThreads(void); void killThreads(void); From 25122b140e8fb6a6b93e1f49f22e8fd522b754bc Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Thu, 4 Apr 2024 00:04:51 +0700 Subject: [PATCH 39/49] Rename redisObject to serverObject (#175) Part of #144 Signed-off-by: 0del --- src/evict.c | 2 +- src/module.c | 4 ++-- src/rio.h | 4 ++-- src/server.h | 18 +++++++++--------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/evict.c b/src/evict.c index e3b7ebcece..be8cfad75f 100644 --- a/src/evict.c +++ b/src/evict.c @@ -69,7 +69,7 @@ static struct evictionPoolEntry *EvictionPoolLRU; /* Return the LRU clock, based on the clock resolution. This is a time * in a reduced-bits format that can be used to set and check the - * object->lru field of redisObject structures. */ + * object->lru field of serverObject structures. */ unsigned int getLRUClock(void) { return (mstime()/LRU_CLOCK_RESOLUTION) & LRU_CLOCK_MAX; } diff --git a/src/module.c b/src/module.c index 1545e6d9c4..1a08a9af8e 100644 --- a/src/module.c +++ b/src/module.c @@ -430,7 +430,7 @@ typedef struct RedisModuleUser { /* This is a structure used to export some meta-information such as dbid to the module. */ typedef struct RedisModuleKeyOptCtx { - struct redisObject *from_key, *to_key; /* Optional name of key processed, NULL when unknown. + struct serverObject *from_key, *to_key; /* Optional name of key processed, NULL when unknown. In most cases, only 'from_key' is valid, but in callbacks such as `copy2`, both 'from_key' and 'to_key' are valid. */ int from_dbid, to_dbid; /* The dbid of the key being processed, -1 when unknown. @@ -13430,7 +13430,7 @@ const char *RM_GetCurrentCommandName(RedisModuleCtx *ctx) { struct RedisModuleDefragCtx { long long int endtime; unsigned long *cursor; - struct redisObject *key; /* Optional name of key processed, NULL when unknown. */ + struct serverObject *key; /* Optional name of key processed, NULL when unknown. */ int dbid; /* The dbid of the key being processed, -1 when unknown. */ }; diff --git a/src/rio.h b/src/rio.h index 9dd59d32b1..2b71c5881e 100644 --- a/src/rio.h +++ b/src/rio.h @@ -175,8 +175,8 @@ size_t rioWriteBulkString(rio *r, const char *buf, size_t len); size_t rioWriteBulkLongLong(rio *r, long long l); size_t rioWriteBulkDouble(rio *r, double d); -struct redisObject; -int rioWriteBulkObject(rio *r, struct redisObject *obj); +struct serverObject; +int rioWriteBulkObject(rio *r, struct serverObject *obj); void rioGenericUpdateChecksum(rio *r, const void *buf, size_t len); void rioSetAutoSync(rio *r, off_t bytes); diff --git a/src/server.h b/src/server.h index d4d5495a98..4d7c94bd73 100644 --- a/src/server.h +++ b/src/server.h @@ -81,7 +81,7 @@ typedef long long ustime_t; /* microsecond time type. */ #include "connection.h" /* Connection abstraction */ #define REDISMODULE_CORE 1 -typedef struct redisObject robj; +typedef struct serverObject robj; #include "redismodule.h" /* Redis modules API defines. */ /* Following includes allow test functions to be called from Redis main() */ @@ -750,14 +750,14 @@ typedef void *(*moduleTypeLoadFunc)(struct RedisModuleIO *io, int encver); typedef void (*moduleTypeSaveFunc)(struct RedisModuleIO *io, void *value); typedef int (*moduleTypeAuxLoadFunc)(struct RedisModuleIO *rdb, int encver, int when); typedef void (*moduleTypeAuxSaveFunc)(struct RedisModuleIO *rdb, int when); -typedef void (*moduleTypeRewriteFunc)(struct RedisModuleIO *io, struct redisObject *key, void *value); +typedef void (*moduleTypeRewriteFunc)(struct RedisModuleIO *io, struct serverObject *key, void *value); typedef void (*moduleTypeDigestFunc)(struct RedisModuleDigest *digest, void *value); typedef size_t (*moduleTypeMemUsageFunc)(const void *value); typedef void (*moduleTypeFreeFunc)(void *value); -typedef size_t (*moduleTypeFreeEffortFunc)(struct redisObject *key, const void *value); -typedef void (*moduleTypeUnlinkFunc)(struct redisObject *key, void *value); -typedef void *(*moduleTypeCopyFunc)(struct redisObject *fromkey, struct redisObject *tokey, const void *value); -typedef int (*moduleTypeDefragFunc)(struct RedisModuleDefragCtx *ctx, struct redisObject *key, void **value); +typedef size_t (*moduleTypeFreeEffortFunc)(struct serverObject *key, const void *value); +typedef void (*moduleTypeUnlinkFunc)(struct serverObject *key, void *value); +typedef void *(*moduleTypeCopyFunc)(struct serverObject *fromkey, struct serverObject *tokey, const void *value); +typedef int (*moduleTypeDefragFunc)(struct RedisModuleDefragCtx *ctx, struct serverObject *key, void **value); typedef size_t (*moduleTypeMemUsageFunc2)(struct RedisModuleKeyOptCtx *ctx, const void *value, size_t sample_size); typedef void (*moduleTypeFreeFunc2)(struct RedisModuleKeyOptCtx *ctx, void *value); typedef size_t (*moduleTypeFreeEffortFunc2)(struct RedisModuleKeyOptCtx *ctx, const void *value); @@ -846,7 +846,7 @@ struct RedisModuleIO { moduleType *type; /* Module type doing the operation. */ int error; /* True if error condition happened. */ struct RedisModuleCtx *ctx; /* Optional context, see RM_GetContextFromIO()*/ - struct redisObject *key; /* Optional name of key processed */ + struct serverObject *key; /* Optional name of key processed */ int dbid; /* The dbid of the key being processed, -1 when unknown. */ sds pre_flush_buffer; /* A buffer that should be flushed before next write operation * See rdbSaveSingleModuleAux for more details */ @@ -873,7 +873,7 @@ struct RedisModuleIO { struct RedisModuleDigest { unsigned char o[20]; /* Ordered elements. */ unsigned char x[20]; /* Xored elements. */ - struct redisObject *key; /* Optional name of key processed */ + struct serverObject *key; /* Optional name of key processed */ int dbid; /* The dbid of the key being processed */ }; @@ -909,7 +909,7 @@ struct RedisModuleDigest { #define OBJ_SHARED_REFCOUNT INT_MAX /* Global object never destroyed. */ #define OBJ_STATIC_REFCOUNT (INT_MAX-1) /* Object allocated in the stack. */ #define OBJ_FIRST_SPECIAL_REFCOUNT OBJ_STATIC_REFCOUNT -struct redisObject { +struct serverObject { unsigned type:4; unsigned encoding:4; unsigned lru:LRU_BITS; /* LRU time (relative to global lru_clock) or From c413834da1183a85ea8a8e1447428a47a62c2be2 Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Thu, 4 Apr 2024 00:06:01 +0700 Subject: [PATCH 40/49] Rename redisTLSContextConfig to serverTLSContextConfig (#176) Part of #144 Signed-off-by: 0del --- src/server.h | 6 +++--- src/tls.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server.h b/src/server.h index 4d7c94bd73..2b904309a9 100644 --- a/src/server.h +++ b/src/server.h @@ -1475,7 +1475,7 @@ struct malloc_stats { * TLS Context Configuration *----------------------------------------------------------------------------*/ -typedef struct redisTLSContextConfig { +typedef struct serverTLSContextConfig { char *cert_file; /* Server side and optionally client side cert file name */ char *key_file; /* Private key filename for cert_file */ char *key_file_pass; /* Optional password for key_file */ @@ -1492,7 +1492,7 @@ typedef struct redisTLSContextConfig { int session_caching; int session_cache_size; int session_cache_timeout; -} redisTLSContextConfig; +} serverTLSContextConfig; /*----------------------------------------------------------------------------- * AOF manifest definition @@ -2050,7 +2050,7 @@ struct redisServer { int tls_cluster; int tls_replication; int tls_auth_clients; - redisTLSContextConfig tls_ctx_config; + serverTLSContextConfig tls_ctx_config; /* cpu affinity */ char *server_cpulist; /* cpu affinity list of redis server main/io thread. */ char *bio_cpulist; /* cpu affinity list of bio thread. */ diff --git a/src/tls.c b/src/tls.c index d011c16ea1..a6bd066097 100644 --- a/src/tls.c +++ b/src/tls.c @@ -203,7 +203,7 @@ static int tlsPasswordCallback(char *buf, int size, int rwflag, void *u) { /* Create a *base* SSL_CTX using the SSL configuration provided. The base context * includes everything that's common for both client-side and server-side connections. */ -static SSL_CTX *createSSLContext(redisTLSContextConfig *ctx_config, int protocols, int client) { +static SSL_CTX *createSSLContext(serverTLSContextConfig *ctx_config, int protocols, int client) { const char *cert_file = client ? ctx_config->client_cert_file : ctx_config->cert_file; const char *key_file = client ? ctx_config->client_key_file : ctx_config->key_file; const char *key_file_pass = client ? ctx_config->client_key_file_pass : ctx_config->key_file_pass; @@ -282,12 +282,12 @@ static SSL_CTX *createSSLContext(redisTLSContextConfig *ctx_config, int protocol /* Attempt to configure/reconfigure TLS. This operation is atomic and will * leave the SSL_CTX unchanged if fails. - * @priv: config of redisTLSContextConfig. + * @priv: config of serverTLSContextConfig. * @reconfigure: if true, ignore the previous configure; if false, only * configure from @ctx_config if redis_tls_ctx is NULL. */ static int tlsConfigure(void *priv, int reconfigure) { - redisTLSContextConfig *ctx_config = (redisTLSContextConfig *)priv; + serverTLSContextConfig *ctx_config = (serverTLSContextConfig *)priv; char errbuf[256]; SSL_CTX *ctx = NULL; SSL_CTX *client_ctx = NULL; From 1629e28f86c598bf8663c1a0ede81b68bc04a8c2 Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Thu, 4 Apr 2024 00:12:34 +0700 Subject: [PATCH 41/49] Rename redisError to serverError (#177) Part of #144 Signed-off-by: 0del --- src/server.c | 8 ++++---- src/server.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server.c b/src/server.c index 53c2b57a21..f2ecd3488f 100644 --- a/src/server.c +++ b/src/server.c @@ -4246,11 +4246,11 @@ void incrementErrorCount(const char *fullerr, size_t namelen) { return; } - struct redisError *error = zmalloc(sizeof(*error)); + struct serverError *error = zmalloc(sizeof(*error)); error->count = 1; raxInsert(server.errors,(unsigned char*)fullerr,namelen,error,NULL); } else { - struct redisError *error = result; + struct serverError *error = result; error->count++; } } @@ -6071,10 +6071,10 @@ sds genRedisInfoString(dict *section_dict, int all_sections, int everything) { raxIterator ri; raxStart(&ri,server.errors); raxSeek(&ri,"^",NULL,0); - struct redisError *e; + struct serverError *e; while(raxNext(&ri)) { char *tmpsafe; - e = (struct redisError *) ri.data; + e = (struct serverError *) ri.data; info = sdscatprintf(info, "errorstat_%.*s:count=%lld\r\n", (int)ri.key_len, getSafeInfoString((char *) ri.key, ri.key_len, &tmpsafe), e->count); diff --git a/src/server.h b/src/server.h index 2b904309a9..a5e6761be9 100644 --- a/src/server.h +++ b/src/server.h @@ -2386,7 +2386,7 @@ struct serverCommand { struct RedisModuleCommand *module_cmd; /* A pointer to the module command data (NULL if native command) */ }; -struct redisError { +struct serverError { long long count; }; From 1736018aa92b3d635248b2730bf3ebb498778b57 Mon Sep 17 00:00:00 2001 From: Harkrishn Patro Date: Wed, 3 Apr 2024 10:47:26 -0700 Subject: [PATCH 42/49] Remove trademarked wording on configuration file and individual configs (#29) Remove trademarked wording on configuration layer. Following changes for release notes: 1. Rename redis.conf to valkey.conf 2. Pre-filled config in the template config file: Changing pidfile to `/var/run/valkey_6379.pid` Signed-off-by: Harkrishn Patro --- .gitignore | 3 +- sentinel.conf | 4 +- src/acl.c | 6 +- src/config.c | 4 +- src/module.c | 2 +- src/server.c | 18 +- src/server.h | 4 +- tests/support/server.tcl | 2 +- tests/test_helper.tcl | 2 +- tests/unit/other.tcl | 2 +- utils/install_server.sh | 2 +- utils/systemd-redis_server.service | 4 +- redis.conf => valkey.conf | 371 ++++++++++++++--------------- 13 files changed, 206 insertions(+), 218 deletions(-) rename redis.conf => valkey.conf (88%) diff --git a/.gitignore b/.gitignore index fa53b69d67..920e32eca7 100644 --- a/.gitignore +++ b/.gitignore @@ -23,8 +23,7 @@ release.h src/transfer.sh src/configs redis.ds -src/redis.conf -src/nodes.conf +src/*.conf deps/lua/src/lua deps/lua/src/luac deps/lua/src/liblua.a diff --git a/sentinel.conf b/sentinel.conf index b7b3604f0e..0180558b4f 100644 --- a/sentinel.conf +++ b/sentinel.conf @@ -146,7 +146,7 @@ sentinel down-after-milliseconds mymaster 30000 # # For more information about ACL configuration please refer to the Redis # website at https://redis.io/topics/acl and redis server configuration -# template redis.conf. +# template valkey.conf. # ACL LOG # @@ -164,7 +164,7 @@ acllog-max-len 128 # ACL file, the server will refuse to start. # # The format of the external ACL user file is exactly the same as the -# format that is used inside redis.conf to describe users. +# format that is used inside valkey.conf to describe users. # # aclfile /etc/redis/sentinel-users.acl diff --git a/src/acl.c b/src/acl.c index 244e7f0826..f0668a4ecd 100644 --- a/src/acl.c +++ b/src/acl.c @@ -64,7 +64,7 @@ static unsigned long nextid = 0; /* Next command id that has not been assigned * struct ACLCategoryItem { char *name; uint64_t flag; -} ACLDefaultCommandCategories[] = { /* See redis.conf for details on each category. */ +} ACLDefaultCommandCategories[] = { /* See valkey.conf for details on each category. */ {"keyspace", ACL_CATEGORY_KEYSPACE}, {"read", ACL_CATEGORY_READ}, {"write", ACL_CATEGORY_WRITE}, @@ -2272,7 +2272,7 @@ int ACLLoadConfiguredUsers(void) { /* This function loads the ACL from the specified filename: every line * is validated and should be either empty or in the format used to specify - * users in the redis.conf configuration or in the ACL file, that is: + * users in the valkey.conf or in the ACL file, that is: * * user ... rules ... * @@ -2566,7 +2566,7 @@ int ACLSaveToFile(const char *filename) { /* This function is called once the server is already running, modules are * loaded, and we are ready to start, in order to load the ACLs either from - * the pending list of users defined in redis.conf, or from the ACL file. + * the pending list of users defined in valkey.conf, or from the ACL file. * The function will just exit with an error if the user is trying to mix * both the loading methods. */ void ACLLoadUsersAtStartup(void) { diff --git a/src/config.c b/src/config.c index 731a3304c7..888567a157 100644 --- a/src/config.c +++ b/src/config.c @@ -1275,7 +1275,7 @@ int rewriteConfigRewriteLine(struct rewriteConfigState *state, const char *optio } /* Write the long long 'bytes' value as a string in a way that is parsable - * inside redis.conf. If possible uses the GB, MB, KB notation. */ + * inside valkey.conf. If possible uses the GB, MB, KB notation. */ int rewriteConfigFormatMemory(char *buf, size_t len, long long bytes) { int gb = 1024*1024*1024; int mb = 1024*1024; @@ -1473,7 +1473,7 @@ void rewriteConfigReplicaOfOption(standardConfig *config, const char *name, stru /* If this is a master, we want all the slaveof config options * in the file to be removed. Note that if this is a cluster instance - * we don't want a slaveof directive inside redis.conf. */ + * we don't want a slaveof directive inside valkey.conf. */ if (server.cluster_enabled || server.masterhost == NULL) { rewriteConfigMarkAsProcessed(state, name); return; diff --git a/src/module.c b/src/module.c index 1a08a9af8e..af0d92cf8b 100644 --- a/src/module.c +++ b/src/module.c @@ -8703,7 +8703,7 @@ void moduleReleaseGIL(void) { * used to send anything to the client, and has the db number where the event * occurred as its selected db number. * - * Notice that it is not necessary to enable notifications in redis.conf for + * Notice that it is not necessary to enable notifications in valkey.conf for * module notifications to work. * * Warning: the notification callbacks are performed in a synchronous manner, diff --git a/src/server.c b/src/server.c index f2ecd3488f..eab88ce7ba 100644 --- a/src/server.c +++ b/src/server.c @@ -2142,7 +2142,7 @@ void initServerConfig(void) { /* Command table -- we initialize it here as it is part of the * initial configuration, since command names may be changed via - * redis.conf using the rename-command directive. */ + * valkey.conf using the rename-command directive. */ server.commands = dictCreate(&commandTableDictType); server.orig_commands = dictCreate(&commandTableDictType); populateCommandTable(); @@ -3081,7 +3081,7 @@ void populateCommandTable(void) { retval1 = dictAdd(server.commands, sdsdup(c->fullname), c); /* Populate an additional dictionary that will be unaffected - * by rename-command statements in redis.conf. */ + * by rename-command statements in valkey.conf. */ retval2 = dictAdd(server.orig_commands, sdsdup(c->fullname), c); serverAssert(retval1 == DICT_OK && retval2 == DICT_OK); } @@ -3236,7 +3236,7 @@ struct serverCommand *lookupCommandByCString(const char *s) { /* Lookup the command in the current table, if not found also check in * the original table containing the original command names unaffected by - * redis.conf rename-command statement. + * valkey.conf rename-command statement. * * This is used by functions rewriting the argument vector such as * rewriteClientCommandVector() in order to set client->cmd pointer @@ -6275,7 +6275,7 @@ sds getVersion(void) { } void usage(void) { - fprintf(stderr,"Usage: ./redis-server [/path/to/redis.conf] [options] [-]\n"); + fprintf(stderr,"Usage: ./redis-server [/path/to/valkey.conf] [options] [-]\n"); fprintf(stderr," ./redis-server - (read config from stdin)\n"); fprintf(stderr," ./redis-server -v or --version\n"); fprintf(stderr," ./redis-server -h or --help\n"); @@ -6285,11 +6285,11 @@ void usage(void) { fprintf(stderr,"Examples:\n"); fprintf(stderr," ./redis-server (run the server with default conf)\n"); fprintf(stderr," echo 'maxmemory 128mb' | ./redis-server -\n"); - fprintf(stderr," ./redis-server /etc/redis/6379.conf\n"); + fprintf(stderr," ./redis-server /etc/valkey/6379.conf\n"); fprintf(stderr," ./redis-server --port 7777\n"); fprintf(stderr," ./redis-server --port 7777 --replicaof 127.0.0.1 8888\n"); - fprintf(stderr," ./redis-server /etc/myredis.conf --loglevel verbose -\n"); - fprintf(stderr," ./redis-server /etc/myredis.conf --loglevel verbose\n\n"); + fprintf(stderr," ./redis-server /etc/myvalkey.conf --loglevel verbose -\n"); + fprintf(stderr," ./redis-server /etc/myvalkey.conf --loglevel verbose\n\n"); fprintf(stderr,"Sentinel mode:\n"); fprintf(stderr," ./redis-server /etc/sentinel.conf --sentinel\n"); exit(1); @@ -6306,7 +6306,7 @@ void redisAsciiArt(void) { /* Show the ASCII logo if: log file is stdout AND stdout is a * tty AND syslog logging is disabled. Also show logo if the user - * forced us to do so via redis.conf. */ + * forced us to do so via valkey.conf. */ int show_logo = ((!server.syslog_enabled && server.logfile[0] == '\0' && isatty(fileno(stdout))) || @@ -6700,7 +6700,7 @@ void redisOutOfMemoryHandler(size_t allocation_size) { allocation_size); } -/* Callback for sdstemplate on proc-title-template. See redis.conf for +/* Callback for sdstemplate on proc-title-template. See valkey.conf for * supported variables. */ static sds redisProcTitleGetVariable(const sds varname, void *arg) diff --git a/src/server.h b/src/server.h index a5e6761be9..b248445da0 100644 --- a/src/server.h +++ b/src/server.h @@ -1734,7 +1734,7 @@ struct redisServer { durationStats duration_stats[EL_DURATION_TYPE_NUM]; /* Configuration */ - int verbosity; /* Loglevel in redis.conf */ + int verbosity; /* Loglevel verbosity */ int maxidletime; /* Client timeout in seconds */ int tcpkeepalive; /* Set SO_KEEPALIVE if non-zero. */ int active_expire_enabled; /* Can be disabled for testing purposes. */ @@ -2314,7 +2314,7 @@ typedef int serverGetKeysProc(struct serverCommand *cmd, robj **argv, int argc, * * The following additional flags are only used in order to put commands * in a specific ACL category. Commands can have multiple ACL categories. - * See redis.conf for the exact meaning of each. + * See valkey.conf for the exact meaning of each. * * @keyspace, @read, @write, @set, @sortedset, @list, @hash, @string, @bitmap, * @hyperloglog, @stream, @admin, @fast, @slow, @pubsub, @blocking, @dangerous, diff --git a/tests/support/server.tcl b/tests/support/server.tcl index 43f619b251..3cf41c2a2e 100644 --- a/tests/support/server.tcl +++ b/tests/support/server.tcl @@ -536,7 +536,7 @@ proc start_server {options {code undefined}} { } # write new configuration to temporary file - set config_file [tmpfile redis.conf] + set config_file [tmpfile valkey.conf] create_server_config_file $config_file $config $config_lines set stdout [format "%s/%s" [dict get $config "dir"] "stdout"] diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index c110885c12..3e51541580 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -327,7 +327,7 @@ proc run_solo {name code} { proc cleanup {} { if {!$::quiet} {puts -nonewline "Cleanup: may take some time... "} flush stdout - catch {exec rm -rf {*}[glob tests/tmp/redis.conf.*]} + catch {exec rm -rf {*}[glob tests/tmp/valkey.conf.*]} catch {exec rm -rf {*}[glob tests/tmp/server*.*]} catch {exec rm -rf {*}[glob tests/tmp/*.acl.*]} if {!$::quiet} {puts "OK"} diff --git a/tests/unit/other.tcl b/tests/unit/other.tcl index b364fc74a7..4fab1db041 100644 --- a/tests/unit/other.tcl +++ b/tests/unit/other.tcl @@ -419,7 +419,7 @@ start_server {tags {"other external:skip"}} { assert_equal $expect_port [lindex $cmdline 3] assert_equal $expect_tls_port [lindex $cmdline 4] assert_match "*/tests/tmp/server.*/socket" [lindex $cmdline 5] - assert_match "*/tests/tmp/redis.conf.*" [lindex $cmdline 6] + assert_match "*/tests/tmp/valkey.conf.*" [lindex $cmdline 6] # Try setting a bad template catch {r config set "proc-title-template" "{invalid-var}"} err diff --git a/utils/install_server.sh b/utils/install_server.sh index efda7da1c3..e22d88bb40 100755 --- a/utils/install_server.sh +++ b/utils/install_server.sh @@ -166,7 +166,7 @@ mkdir -p "$REDIS_DATA_DIR" || die "Could not create redis data directory" #render the templates TMP_FILE="/tmp/${REDIS_PORT}.conf" -DEFAULT_CONFIG="${SCRIPTPATH}/../redis.conf" +DEFAULT_CONFIG="${SCRIPTPATH}/../valkey.conf" INIT_TPL_FILE="${SCRIPTPATH}/redis_init_script.tpl" INIT_SCRIPT_DEST="/etc/init.d/redis_${REDIS_PORT}" PIDFILE="/var/run/redis_${REDIS_PORT}.pid" diff --git a/utils/systemd-redis_server.service b/utils/systemd-redis_server.service index cf158644ae..15400b439e 100644 --- a/utils/systemd-redis_server.service +++ b/utils/systemd-redis_server.service @@ -24,9 +24,9 @@ Wants=network-online.target After=network-online.target [Service] -ExecStart=/usr/local/bin/redis-server --supervised systemd --daemonize no +ExecStart=/usr/local/bin/valkey-server --supervised systemd --daemonize no ## Alternatively, have redis-server load a configuration file: -#ExecStart=/usr/local/bin/redis-server /path/to/your/redis.conf +#ExecStart=/usr/local/bin/valkey-server /path/to/your/valkey.conf LimitNOFILE=10032 NoNewPrivileges=yes #OOMScoreAdjust=-900 diff --git a/redis.conf b/valkey.conf similarity index 88% rename from redis.conf rename to valkey.conf index 65e01b0742..33442b340d 100644 --- a/redis.conf +++ b/valkey.conf @@ -1,9 +1,9 @@ -# Redis configuration file example. +# Valkey configuration file example. # -# Note that in order to read the configuration file, Redis must be +# Note that in order to read the configuration file, the server must be # started with the file path as first argument: # -# ./redis-server /path/to/redis.conf +# ./valkey-server /path/to/valkey.conf # Note on units: when memory size is needed, it is possible to specify # it in the usual form of 1k 5GB 4M and so forth: @@ -20,12 +20,12 @@ ################################## INCLUDES ################################### # Include one or more other config files here. This is useful if you -# have a standard template that goes to all Redis servers but also need +# have a standard template that goes to all servers but also need # to customize a few per-server settings. Include files can include # other files, so use this wisely. # # Note that option "include" won't be rewritten by command "CONFIG REWRITE" -# from admin or Redis Sentinel. Since Redis always uses the last processed +# from admin or Sentinel. Since the server always uses the last processed # line as value of a configuration directive, you'd better put includes # at the beginning of this file to avoid overwriting config change at runtime. # @@ -55,11 +55,11 @@ ################################## NETWORK ##################################### -# By default, if no "bind" configuration directive is specified, Redis listens +# By default, if no "bind" configuration directive is specified, the server listens # for connections from all available network interfaces on the host machine. # It is possible to listen to just one or multiple selected interfaces using # the "bind" configuration directive, followed by one or more IP addresses. -# Each address can be prefixed by "-", which means that redis will not fail to +# Each address can be prefixed by "-", which means that the server will not fail to # start if the address is not available. Being not available only refers to # addresses that does not correspond to any network interface. Addresses that # are already in use will always fail, and unsupported protocols will always BE @@ -71,11 +71,11 @@ # bind 127.0.0.1 ::1 # listens on loopback IPv4 and IPv6 # bind * -::* # like the default, all available interfaces # -# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the +# ~~~ WARNING ~~~ If the computer running the server is directly exposed to the # internet, binding to all the interfaces is dangerous and will expose the # instance to everybody on the internet. So by default we uncomment the -# following bind directive, that will force Redis to listen only on the -# IPv4 and IPv6 (if available) loopback interface addresses (this means Redis +# following bind directive, that will force the server to listen only on the +# IPv4 and IPv6 (if available) loopback interface addresses (this means the server # will only be able to accept client connections from the same host that it is # running on). # @@ -100,26 +100,26 @@ bind 127.0.0.1 -::1 # bind-source-addr 10.0.0.1 # Protected mode is a layer of security protection, in order to avoid that -# Redis instances left open on the internet are accessed and exploited. +# the server instances left open on the internet are accessed and exploited. # # When protected mode is on and the default user has no password, the server # only accepts local connections from the IPv4 address (127.0.0.1), IPv6 address # (::1) or Unix domain sockets. # # By default protected mode is enabled. You should disable it only if -# you are sure you want clients from other hosts to connect to Redis +# you are sure you want clients from other hosts to connect to the server # even if no authentication is configured. protected-mode yes -# Redis uses default hardened security configuration directives to reduce the +# The server uses default hardened security configuration directives to reduce the # attack surface on innocent users. Therefore, several sensitive configuration # directives are immutable, and some potentially-dangerous commands are blocked. # -# Configuration directives that control files that Redis writes to (e.g., 'dir' +# Configuration directives that control files that the server writes to (e.g., 'dir' # and 'dbfilename') and that aren't usually modified during runtime # are protected by making them immutable. # -# Commands that can increase the attack surface of Redis and that aren't usually +# Commands that can increase the attack surface of the server and that aren't usually # called by users are blocked by default. # # These can be exposed to either all connections or just local ones by setting @@ -135,7 +135,7 @@ protected-mode yes # enable-module-command no # Accept connections on the specified port, default is 6379 (IANA #815344). -# If port 0 is specified Redis will not listen on a TCP socket. +# If port 0 is specified the server will not listen on a TCP socket. port 6379 # TCP listen() backlog. @@ -150,10 +150,10 @@ tcp-backlog 511 # Unix socket. # # Specify the path for the Unix socket that will be used to listen for -# incoming connections. There is no default, so Redis will not listen +# incoming connections. There is no default, so the server will not listen # on a unix socket when not specified. # -# unixsocket /run/redis.sock +# unixsocket /run/valkey.sock # unixsocketperm 700 # Close the connection after a client is idle for N seconds (0 to disable) @@ -171,9 +171,6 @@ timeout 0 # On Linux, the specified value (in seconds) is the period used to send ACKs. # Note that to close the connection the double of the time is needed. # On other kernels the period depends on the kernel configuration. -# -# A reasonable value for this option is 300 seconds, which is the new -# Redis default starting with Redis 3.2.1. tcp-keepalive 300 # Apply OS-specific mechanism to mark the listening socket with the specified @@ -199,15 +196,15 @@ tcp-keepalive 300 # server to connected clients, masters or cluster peers. These files should be # PEM formatted. # -# tls-cert-file redis.crt -# tls-key-file redis.key +# tls-cert-file valkey.crt +# tls-key-file valkey.key # # If the key file is encrypted using a passphrase, it can be included here # as well. # # tls-key-file-pass secret -# Normally Redis uses the same certificate for both server functions (accepting +# Normally the server uses the same certificate for both server functions (accepting # connections) and client functions (replicating from a master, establishing # cluster bus connections, etc.). # @@ -228,10 +225,10 @@ tcp-keepalive 300 # required by older versions of OpenSSL (<3.0). Newer versions do not require # this configuration and recommend against it. # -# tls-dh-params-file redis.dh +# tls-dh-params-file valkey.dh # Configure a CA certificate(s) bundle or directory to authenticate TLS/SSL -# clients and peers. Redis requires an explicit configuration of at least one +# clients and peers. The server requires an explicit configuration of at least one # of these, and will not implicitly use the system wide configuration. # # tls-ca-cert-file ca.crt @@ -247,14 +244,14 @@ tcp-keepalive 300 # tls-auth-clients no # tls-auth-clients optional -# By default, a Redis replica does not attempt to establish a TLS connection +# By default, a replica does not attempt to establish a TLS connection # with its master. # # Use the following directive to enable TLS on replication links. # # tls-replication yes -# By default, the Redis Cluster bus uses a plain TCP connection. To enable +# By default, the cluster bus uses a plain TCP connection. To enable # TLS for the bus protocol, use the following directive: # # tls-cluster yes @@ -304,18 +301,18 @@ tcp-keepalive 300 ################################# GENERAL ##################################### -# By default Redis does not run as a daemon. Use 'yes' if you need it. -# Note that Redis will write a pid file in /var/run/redis.pid when daemonized. -# When Redis is supervised by upstart or systemd, this parameter has no impact. +# By default the server does not run as a daemon. Use 'yes' if you need it. +# Note that the server will write a pid file in /var/run/valkey.pid when daemonized. +# When the server is supervised by upstart or systemd, this parameter has no impact. daemonize no -# If you run Redis from upstart or systemd, Redis can interact with your +# If you run the server from upstart or systemd, the server can interact with your # supervision tree. Options: # supervised no - no supervision interaction -# supervised upstart - signal upstart by putting Redis into SIGSTOP mode +# supervised upstart - signal upstart by putting the server into SIGSTOP mode # requires "expect stop" in your upstart job config # supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET -# on startup, and updating Redis status on a regular +# on startup, and updating the server status on a regular # basis. # supervised auto - detect upstart or systemd method based on # UPSTART_JOB or NOTIFY_SOCKET environment variables @@ -327,19 +324,19 @@ daemonize no # # supervised auto -# If a pid file is specified, Redis writes it where specified at startup +# If a pid file is specified, the server writes it where specified at startup # and removes it at exit. # # When the server runs non daemonized, no pid file is created if none is # specified in the configuration. When the server is daemonized, the pid file -# is used even if not specified, defaulting to "/var/run/redis.pid". +# is used even if not specified, defaulting to "/var/run/valkey.pid". # -# Creating a pid file is best effort: if Redis is not able to create it +# Creating a pid file is best effort: if the server is not able to create it # nothing bad happens, the server will start and run normally. # -# Note that on modern Linux systems "/run/redis.pid" is more conforming +# Note that on modern Linux systems "/run/valkey.pid" is more conforming # and should be used instead. -pidfile /var/run/redis_6379.pid +pidfile /var/run/valkey_6379.pid # Specify the server verbosity level. # This can be one of: @@ -351,7 +348,7 @@ pidfile /var/run/redis_6379.pid loglevel notice # Specify the log file name. Also the empty string can be used to force -# Redis to log on the standard output. Note that if you use standard +# the server to log on the standard output. Note that if you use standard # output for logging but daemonize, logs will be sent to /dev/null logfile "" @@ -371,7 +368,7 @@ logfile "" # crash-log-enabled no # To disable the fast memory check that's run as part of the crash log, which -# will possibly let redis terminate sooner, uncomment the following: +# will possibly let the server terminate sooner, uncomment the following: # # crash-memcheck-enabled no @@ -380,7 +377,7 @@ logfile "" # dbid is a number between 0 and 'databases'-1 databases 16 -# By default Redis shows an ASCII art logo only when started to log to the +# By default the server shows an ASCII art logo only when started to log to the # standard output and if the standard output is a TTY and syslog logging is # disabled. Basically this means that normally a logo is displayed only in # interactive sessions. @@ -389,12 +386,12 @@ databases 16 # ASCII art logo in startup logs by setting the following option to yes. always-show-logo no -# By default, Redis modifies the process title (as seen in 'top' and 'ps') to +# By default, the server modifies the process title (as seen in 'top' and 'ps') to # provide some runtime information. It is possible to disable this and leave # the process name as executed by setting the following to no. set-proc-title yes -# When changing the process title, Redis uses the following template to construct +# When changing the process title, the server uses the following template to construct # the modified title. # # Template variables are specified in curly brackets. The following variables are @@ -422,7 +419,7 @@ locale-collate "" # # save [ ...] # -# Redis will save the DB if the given number of seconds elapsed and it +# The server will save the DB if the given number of seconds elapsed and it # surpassed the given number of write operations against the DB. # # Snapshotting can be completely disabled with a single empty string argument @@ -430,7 +427,7 @@ locale-collate "" # # save "" # -# Unless specified otherwise, by default Redis will save the DB: +# Unless specified otherwise, by default the server will save the DB: # * After 3600 seconds (an hour) if at least 1 change was performed # * After 300 seconds (5 minutes) if at least 100 changes were performed # * After 60 seconds if at least 10000 changes were performed @@ -439,17 +436,17 @@ locale-collate "" # # save 3600 1 300 100 60 10000 -# By default Redis will stop accepting writes if RDB snapshots are enabled +# By default the server will stop accepting writes if RDB snapshots are enabled # (at least one save point) and the latest background save failed. # This will make the user aware (in a hard way) that data is not persisting # on disk properly, otherwise chances are that no one will notice and some # disaster will happen. # -# If the background saving process will start working again Redis will +# If the background saving process will start working again, the server will # automatically allow writes again. # -# However if you have setup your proper monitoring of the Redis server -# and persistence, you may want to disable this feature so that Redis will +# However if you have setup your proper monitoring of the server +# and persistence, you may want to disable this feature so that the server will # continue to work as usual even if there are problems with disk, # permissions, and so forth. stop-writes-on-bgsave-error yes @@ -512,18 +509,18 @@ dir ./ ################################# REPLICATION ################################# -# Master-Replica replication. Use replicaof to make a Redis instance a copy of -# another Redis server. A few things to understand ASAP about Redis replication. +# Master-Replica replication. Use replicaof to make a server a copy of +# another server. A few things to understand ASAP about replication. # # +------------------+ +---------------+ # | Master | ---> | Replica | # | (receive writes) | | (exact copy) | # +------------------+ +---------------+ # -# 1) Redis replication is asynchronous, but you can configure a master to +# 1) Replication is asynchronous, but you can configure a master to # stop accepting writes if it appears to be not connected with at least # a given number of replicas. -# 2) Redis replicas are able to perform a partial resynchronization with the +# 2) Replicas are able to perform a partial resynchronization with the # master if the replication link is lost for a relatively small amount of # time. You may want to configure the replication backlog size (see the next # sections of this file) with a sensible value depending on your needs. @@ -540,8 +537,8 @@ dir ./ # # masterauth # -# However this is not enough if you are using Redis ACLs (for Redis version -# 6 or greater), and the default user is not capable of running the PSYNC +# However this is not enough if you are using ACLs +# and the default user is not capable of running the PSYNC # command and/or other commands needed for replication. In this case it's # better to configure a special user to use with replication, and specify the # masteruser configuration as such: @@ -573,7 +570,7 @@ replica-serve-stale-data yes # may also cause problems if clients are writing to it because of a # misconfiguration. # -# Since Redis 2.6 by default replicas are read-only. +# By default, replicas are read-only. # # Note: read only replicas are not designed to be exposed to untrusted clients # on the internet. It's just a protection layer against misuse of the instance. @@ -592,10 +589,10 @@ replica-read-only yes # # The transmission can happen in two different ways: # -# 1) Disk-backed: The Redis master creates a new process that writes the RDB +# 1) Disk-backed: The master creates a new process that writes the RDB # file on disk. Later the file is transferred by the parent # process to the replicas incrementally. -# 2) Diskless: The Redis master creates a new process that directly writes the +# 2) Diskless: The master creates a new process that directly writes the # RDB file to replica sockets, without touching the disk at all. # # With disk-backed replication, while the RDB file is generated, more replicas @@ -627,13 +624,13 @@ repl-diskless-sync-delay 5 # When diskless replication is enabled with a delay, it is possible to let # the replication start before the maximum delay is reached if the maximum # number of replicas expected have connected. Default of 0 means that the -# maximum is not defined and Redis will wait the full delay. +# maximum is not defined and the server will wait the full delay. repl-diskless-sync-max-replicas 0 # ----------------------------------------------------------------------------- # WARNING: Since in this setup the replica does not immediately store an RDB on -# disk, it may cause data loss during failovers. RDB diskless load + Redis -# modules not handling I/O reads may cause Redis to abort in case of I/O errors +# disk, it may cause data loss during failovers. RDB diskless load + server +# modules not handling I/O reads may cause the server to abort in case of I/O errors # during the initial synchronization stage with the master. # ----------------------------------------------------------------------------- # @@ -683,7 +680,7 @@ repl-diskless-load disabled # Disable TCP_NODELAY on the replica socket after SYNC? # -# If you select "yes" Redis will use a smaller number of TCP packets and +# If you select "yes", the server will use a smaller number of TCP packets and # less bandwidth to send data to replicas. But this can add a delay for # the data to appear on the replica side, up to 40 milliseconds with # Linux kernels using a default configuration. @@ -722,8 +719,8 @@ repl-disable-tcp-nodelay no # # repl-backlog-ttl 3600 -# The replica priority is an integer number published by Redis in the INFO -# output. It is used by Redis Sentinel in order to select a replica to promote +# The replica priority is an integer number published by the server in the INFO +# output. It is used by Sentinel in order to select a replica to promote # into a master if the master is no longer working correctly. # # A replica with a low priority number is considered better for promotion, so @@ -732,18 +729,15 @@ repl-disable-tcp-nodelay no # # However a special priority of 0 marks the replica as not able to perform the # role of master, so a replica with priority of 0 will never be selected by -# Redis Sentinel for promotion. +# Sentinel for promotion. # # By default the priority is 100. replica-priority 100 -# The propagation error behavior controls how Redis will behave when it is +# The propagation error behavior controls how the server will behave when it is # unable to handle a command being processed in the replication stream from a master # or processed while reading from an AOF file. Errors that occur during propagation -# are unexpected, and can cause data inconsistency. However, there are edge cases -# in earlier versions of Redis where it was possible for the server to replicate or persist -# commands that would fail on future versions. For this reason the default behavior -# is to ignore such errors and continue processing commands. +# are unexpected, and can cause data inconsistency. # # If an application wants to ensure there is no data divergence, this configuration # should be set to 'panic' instead. The value can also be set to 'panic-on-replicas' @@ -756,17 +750,15 @@ replica-priority 100 # Replica ignore disk write errors controls the behavior of a replica when it is # unable to persist a write command received from its master to disk. By default, # this configuration is set to 'no' and will crash the replica in this condition. -# It is not recommended to change this default, however in order to be compatible -# with older versions of Redis this config can be toggled to 'yes' which will just -# log a warning and execute the write command it got from the master. +# It is not recommended to change this default. # # replica-ignore-disk-write-errors no # ----------------------------------------------------------------------------- -# By default, Redis Sentinel includes all replicas in its reports. A replica -# can be excluded from Redis Sentinel's announcements. An unannounced replica +# By default, Sentinel includes all replicas in its reports. A replica +# can be excluded from Sentinel's announcements. An unannounced replica # will be ignored by the 'sentinel replicas ' command and won't be -# exposed to Redis Sentinel's clients. +# exposed to Sentinel's clients. # # This option does not change the behavior of replica-priority. Even with # replica-announced set to 'no', the replica can be promoted to master. To @@ -796,10 +788,10 @@ replica-priority 100 # By default min-replicas-to-write is set to 0 (feature disabled) and # min-replicas-max-lag is set to 10. -# A Redis master is able to list the address and port of the attached +# A master is able to list the address and port of the attached # replicas in different ways. For example the "INFO replication" section # offers this information, which is used, among other tools, by -# Redis Sentinel in order to discover replica instances. +# Sentinel in order to discover replica instances. # Another place where this info is available is in the output of the # "ROLE" command of a master. # @@ -827,7 +819,7 @@ replica-priority 100 ############################### KEYS TRACKING ################################# -# Redis implements server assisted support for client side caching of values. +# The client side caching of values is assisted via server-side support. # This is implemented using an invalidation table that remembers, using # a radix key indexed by key name, what clients have which keys. In turn # this is used in order to send invalidation messages to clients. Please @@ -836,22 +828,22 @@ replica-priority 100 # https://redis.io/topics/client-side-caching # # When tracking is enabled for a client, all the read only queries are assumed -# to be cached: this will force Redis to store information in the invalidation +# to be cached: this will force the server to store information in the invalidation # table. When keys are modified, such information is flushed away, and # invalidation messages are sent to the clients. However if the workload is -# heavily dominated by reads, Redis could use more and more memory in order +# heavily dominated by reads, the server could use more and more memory in order # to track the keys fetched by many clients. # # For this reason it is possible to configure a maximum fill value for the # invalidation table. By default it is set to 1M of keys, and once this limit -# is reached, Redis will start to evict keys in the invalidation table +# is reached, the server will start to evict keys in the invalidation table # even if they were not modified, just to reclaim memory: this will in turn # force the clients to invalidate the cached values. Basically the table # maximum size is a trade off between the memory you want to spend server # side to track information about who cached what, and the ability of clients # to retain cached objects in memory. # -# If you set the value to 0, it means there are no limits, and Redis will +# If you set the value to 0, it means there are no limits, and the server will # retain as many keys as needed in the invalidation table. # In the "stats" INFO section, you can find information about the number of # keys in the invalidation table at every given moment. @@ -863,7 +855,7 @@ replica-priority 100 ################################## SECURITY ################################### -# Warning: since Redis is pretty fast, an outside user can try up to +# Warning: since the server is pretty fast, an outside user can try up to # 1 million passwords per second against a modern box. This means that you # should use very strong passwords, otherwise they will be very easy to break. # Note that because the password is really a shared secret between the client @@ -871,7 +863,7 @@ replica-priority 100 # can be easily a long string from /dev/urandom or whatever, so by using a # long and unguessable password no brute force attack will be possible. -# Redis ACL users are defined in the following format: +# ACL users are defined in the following format: # # user ... acl rules ... # @@ -902,7 +894,7 @@ replica-priority 100 # +@ Allow the execution of all the commands in such category # with valid categories are like @admin, @set, @sortedset, ... # and so forth, see the full list in the server.c file where -# the Redis command table is described and defined. +# the server command table is described and defined. # The special category @all means all the commands, but currently # present in the server, and that will be loaded in the future # via modules. @@ -1011,7 +1003,7 @@ replica-priority 100 # * stream - Data type: streams related. # # For more information about ACL configuration please refer to -# the Redis web site at https://redis.io/topics/acl +# the Valkey web site at https://redis.io/topics/acl # ACL LOG # @@ -1029,11 +1021,11 @@ acllog-max-len 128 # ACL file, the server will refuse to start. # # The format of the external ACL user file is exactly the same as the -# format that is used inside redis.conf to describe users. +# format that is used inside valkey.conf to describe users. # -# aclfile /etc/redis/users.acl +# aclfile /etc/valkey/users.acl -# IMPORTANT NOTE: starting with Redis 6 "requirepass" is just a compatibility +# IMPORTANT NOTE: "requirepass" is just a compatibility # layer on top of the new ACL system. The option effect will be just setting # the password for the default user. Clients will still authenticate using # AUTH as usually, or more explicitly with AUTH default @@ -1044,16 +1036,13 @@ acllog-max-len 128 # # requirepass foobared -# New users are initialized with restrictive permissions by default, via the -# equivalent of this ACL rule 'off resetkeys -@all'. Starting with Redis 6.2, it -# is possible to manage access to Pub/Sub channels with ACL rules as well. The -# default Pub/Sub channels permission if new users is controlled by the +# The default Pub/Sub channels permission for new users is controlled by the # acl-pubsub-default configuration directive, which accepts one of these values: # # allchannels: grants access to all Pub/Sub channels # resetchannels: revokes access to all Pub/Sub channels # -# From Redis 7.0, acl-pubsub-default defaults to 'resetchannels' permission. +# acl-pubsub-default defaults to 'resetchannels' permission. # # acl-pubsub-default resetchannels @@ -1085,15 +1074,15 @@ acllog-max-len 128 ################################### CLIENTS #################################### # Set the max number of connected clients at the same time. By default -# this limit is set to 10000 clients, however if the Redis server is not +# this limit is set to 10000 clients, however if the server is not # able to configure the process file limit to allow for the specified limit # the max number of allowed clients is set to the current file limit -# minus 32 (as Redis reserves a few file descriptors for internal uses). +# minus 32 (as the server reserves a few file descriptors for internal uses). # -# Once the limit is reached Redis will close all the new connections sending +# Once the limit is reached the server will close all the new connections sending # an error 'max number of clients reached'. # -# IMPORTANT: When Redis Cluster is used, the max number of connections is also +# IMPORTANT: With a cluster-enabled setup, the max number of connections is also # shared with the cluster bus: every node in the cluster will use two # connections, one incoming and another outgoing. It is important to size the # limit accordingly in case of very large clusters. @@ -1103,15 +1092,15 @@ acllog-max-len 128 ############################## MEMORY MANAGEMENT ################################ # Set a memory usage limit to the specified amount of bytes. -# When the memory limit is reached Redis will try to remove keys +# When the memory limit is reached the server will try to remove keys # according to the eviction policy selected (see maxmemory-policy). # -# If Redis can't remove keys according to the policy, or if the policy is -# set to 'noeviction', Redis will start to reply with errors to commands +# If the server can't remove keys according to the policy, or if the policy is +# set to 'noeviction', the server will start to reply with errors to commands # that would use more memory, like SET, LPUSH, and so on, and will continue # to reply to read-only commands like GET. # -# This option is usually useful when using Redis as an LRU or LFU cache, or to +# This option is usually useful when using the server as an LRU or LFU cache, or to # set a hard memory limit for an instance (using the 'noeviction' policy). # # WARNING: If you have replicas attached to an instance with maxmemory on, @@ -1127,7 +1116,7 @@ acllog-max-len 128 # # maxmemory -# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory +# MAXMEMORY POLICY: how the server will select what to remove when maxmemory # is reached. You can select one from the following behaviors: # # volatile-lru -> Evict using approximated LRU, only keys with an expire set. @@ -1146,7 +1135,7 @@ acllog-max-len 128 # randomized algorithms. # # Note: with any of the above policies, when there are no suitable keys for -# eviction, Redis will return an error on write operations that require +# eviction, the server will return an error on write operations that require # more memory. These are usually commands that create new keys, add data or # modify existing keys. A few examples are: SET, INCR, HSET, LPUSH, SUNIONSTORE, # SORT (due to the STORE argument), and EXEC (if the transaction includes any @@ -1158,7 +1147,7 @@ acllog-max-len 128 # LRU, LFU and minimal TTL algorithms are not precise algorithms but approximated # algorithms (in order to save memory), so you can tune it for speed or -# accuracy. By default Redis will check five keys and pick the one that was +# accuracy. By default the server will check five keys and pick the one that was # used least recently, you can change the sample size using the following # configuration directive. # @@ -1176,7 +1165,7 @@ acllog-max-len 128 # # maxmemory-eviction-tenacity 10 -# Starting from Redis 5, by default a replica will ignore its maxmemory setting +# By default a replica will ignore its maxmemory setting # (unless it is promoted to master after a failover or manually). It means # that the eviction of keys will be just handled by the master, sending the # DEL commands to the replica as keys evict in the master side. @@ -1196,7 +1185,7 @@ acllog-max-len 128 # # replica-ignore-maxmemory yes -# Redis reclaims expired keys in two ways: upon access when those keys are +# The server reclaims expired keys in two ways: upon access when those keys are # found to be expired, and also in background, in what is called the # "active expire key". The key space is slowly and interactively scanned # looking for expired keys to reclaim, so that it is possible to free memory @@ -1215,16 +1204,16 @@ acllog-max-len 128 ############################# LAZY FREEING #################################### -# Redis has two primitives to delete keys. One is called DEL and is a blocking +# The server has two primitives to delete keys. One is called DEL and is a blocking # deletion of the object. It means that the server stops processing new commands # in order to reclaim all the memory associated with an object in a synchronous # way. If the key deleted is associated with a small object, the time needed # in order to execute the DEL command is very small and comparable to most other -# O(1) or O(log_N) commands in Redis. However if the key is associated with an +# O(1) or O(log_N) commands in the server. However if the key is associated with an # aggregated value containing millions of elements, the server can block for # a long time (even seconds) in order to complete the operation. # -# For the above reasons Redis also offers non blocking deletion primitives +# For the above reasons the server also offers non blocking deletion primitives # such as UNLINK (non blocking DEL) and the ASYNC option of FLUSHALL and # FLUSHDB commands, in order to reclaim memory in background. Those commands # are executed in constant time. Another thread will incrementally free the @@ -1232,9 +1221,9 @@ acllog-max-len 128 # # DEL, UNLINK and ASYNC option of FLUSHALL and FLUSHDB are user-controlled. # It's up to the design of the application to understand when it is a good -# idea to use one or the other. However the Redis server sometimes has to +# idea to use one or the other. However the server sometimes has to # delete keys or flush the whole database as a side effect of other operations. -# Specifically Redis deletes objects independently of a user call in the +# Specifically the server deletes objects independently of a user call in the # following scenarios: # # 1) On eviction, because of the maxmemory and maxmemory policy configurations, @@ -1278,21 +1267,21 @@ lazyfree-lazy-user-flush no ################################ THREADED I/O ################################# -# Redis is mostly single threaded, however there are certain threaded +# The server is mostly single threaded, however there are certain threaded # operations such as UNLINK, slow I/O accesses and other things that are # performed on side threads. # -# Now it is also possible to handle Redis clients socket reads and writes +# Now it is also possible to handle the server clients socket reads and writes # in different I/O threads. Since especially writing is so slow, normally -# Redis users use pipelining in order to speed up the Redis performances per +# users use pipelining in order to speed up the server performances per # core, and spawn multiple instances in order to scale more. Using I/O -# threads it is possible to easily speedup two times Redis without resorting +# threads it is possible to easily speedup two times the server without resorting # to pipelining nor sharding of the instance. # # By default threading is disabled, we suggest enabling it only in machines # that have at least 4 or more cores, leaving at least one spare core. # Using more than 8 threads is unlikely to help much. We also recommend using -# threaded I/O only if you actually have performance problems, with Redis +# threaded I/O only if you actually have performance problems, with # instances being able to use a quite big percentage of CPU time, otherwise # there is no point in using this feature. # @@ -1317,9 +1306,9 @@ lazyfree-lazy-user-flush no # CONFIG SET. Also, this feature currently does not work when SSL is # enabled. # -# NOTE 2: If you want to test the Redis speedup using redis-benchmark, make +# NOTE 2: If you want to test the server speedup using valkey-benchmark, make # sure you also run the benchmark itself in threaded mode, using the -# --threads option to match the number of Redis threads, otherwise you'll not +# --threads option to match the number of server threads, otherwise you'll not # be able to notice the improvements. ############################ KERNEL OOM CONTROL ############################## @@ -1327,12 +1316,12 @@ lazyfree-lazy-user-flush no # On Linux, it is possible to hint the kernel OOM killer on what processes # should be killed first when out of memory. # -# Enabling this feature makes Redis actively control the oom_score_adj value +# Enabling this feature makes the server actively control the oom_score_adj value # for all its processes, depending on their role. The default scores will # attempt to have background child processes killed before all others, and # replicas killed before masters. # -# Redis supports these options: +# The server supports these options: # # no: Don't make changes to oom-score-adj (default). # yes: Alias to "relative" see below. @@ -1359,7 +1348,7 @@ oom-score-adj-values 0 200 800 # Usually the kernel Transparent Huge Pages control is set to "madvise" or # or "never" by default (/sys/kernel/mm/transparent_hugepage/enabled), in which # case this config has no effect. On systems in which it is set to "always", -# redis will attempt to disable it specifically for the redis process in order +# the server will attempt to disable it specifically for the server process in order # to avoid latency problems specifically with fork(2) and CoW. # If for some reason you prefer to keep it enabled, you can set this config to # "no" and the kernel global to "always". @@ -1368,20 +1357,20 @@ disable-thp yes ############################## APPEND ONLY MODE ############################### -# By default Redis asynchronously dumps the dataset on disk. This mode is -# good enough in many applications, but an issue with the Redis process or +# By default the server asynchronously dumps the dataset on disk. This mode is +# good enough in many applications, but an issue with the server process or # a power outage may result into a few minutes of writes lost (depending on # the configured save points). # # The Append Only File is an alternative persistence mode that provides # much better durability. For instance using the default data fsync policy -# (see later in the config file) Redis can lose just one second of writes in a +# (see later in the config file) the server can lose just one second of writes in a # dramatic event like a server power outage, or a single write if something -# wrong with the Redis process itself happens, but the operating system is +# wrong with the process itself happens, but the operating system is # still running correctly. # # AOF and RDB persistence can be enabled at the same time without problems. -# If the AOF is enabled on startup Redis will load the AOF, that is the file +# If the AOF is enabled on startup the server will load the AOF, that is the file # with the better durability guarantees. # # Note that changing this value in a config file of an existing database and @@ -1394,7 +1383,7 @@ appendonly no # The base name of the append only file. # -# Redis 7 and newer use a set of append-only files to persist the dataset +# The server uses a set of append-only files to persist the dataset # and changes applied to it. There are two basic types of files in use: # # - Base files, which are a snapshot representing the complete state of the @@ -1406,7 +1395,7 @@ appendonly no # In addition, manifest files are used to track the files and the order in # which they were created and should be applied. # -# Append-only file names are created by Redis following a specific pattern. +# Append-only file names are created by the server following a specific pattern. # The file name's prefix is based on the 'appendfilename' configuration # parameter, followed by additional information about the sequence and type. # @@ -1419,7 +1408,7 @@ appendonly no appendfilename "appendonly.aof" -# For convenience, Redis stores all persistent append-only files in a dedicated +# For convenience, the server stores all persistent append-only files in a dedicated # directory. The name of the directory is determined by the appenddirname # configuration parameter. @@ -1429,7 +1418,7 @@ appenddirname "appendonlydir" # instead of waiting for more data in the output buffer. Some OS will really flush # data on disk, some other OS will just try to do it ASAP. # -# Redis supports three different modes: +# The server supports three different modes: # # no: don't fsync, just let the OS flush the data when it wants. Faster. # always: fsync after every write to the append only log. Slow, Safest. @@ -1455,7 +1444,7 @@ appendfsync everysec # When the AOF fsync policy is set to always or everysec, and a background # saving process (a background save or AOF log background rewriting) is # performing a lot of I/O against the disk, in some Linux configurations -# Redis may block too long on the fsync() call. Note that there is no fix for +# the server may block too long on the fsync() call. Note that there is no fix for # this currently, as even performing fsync in a different thread will block # our synchronous write(2) call. # @@ -1463,7 +1452,7 @@ appendfsync everysec # that will prevent fsync() from being called in the main process while a # BGSAVE or BGREWRITEAOF is in progress. # -# This means that while another child is saving, the durability of Redis is +# This means that while another child is saving, the durability of the server is # the same as "appendfsync no". In practical terms, this means that it is # possible to lose up to 30 seconds of log in the worst scenario (with the # default Linux settings). @@ -1474,10 +1463,10 @@ appendfsync everysec no-appendfsync-on-rewrite no # Automatic rewrite of the append only file. -# Redis is able to automatically rewrite the log file implicitly calling +# The server is able to automatically rewrite the log file implicitly calling # BGREWRITEAOF when the AOF log size grows by the specified percentage. # -# This is how it works: Redis remembers the size of the AOF file after the +# This is how it works: The server remembers the size of the AOF file after the # latest rewrite (if no rewrite has happened since the restart, the size of # the AOF at startup is used). # @@ -1493,36 +1482,36 @@ no-appendfsync-on-rewrite no auto-aof-rewrite-percentage 100 auto-aof-rewrite-min-size 64mb -# An AOF file may be found to be truncated at the end during the Redis +# An AOF file may be found to be truncated at the end during the server # startup process, when the AOF data gets loaded back into memory. -# This may happen when the system where Redis is running +# This may happen when the system where the server is running # crashes, especially when an ext4 filesystem is mounted without the -# data=ordered option (however this can't happen when Redis itself +# data=ordered option (however this can't happen when the server itself # crashes or aborts but the operating system still works correctly). # -# Redis can either exit with an error when this happens, or load as much +# The server can either exit with an error when this happens, or load as much # data as possible (the default now) and start if the AOF file is found # to be truncated at the end. The following option controls this behavior. # # If aof-load-truncated is set to yes, a truncated AOF file is loaded and -# the Redis server starts emitting a log to inform the user of the event. +# the server starts emitting a log to inform the user of the event. # Otherwise if the option is set to no, the server aborts with an error # and refuses to start. When the option is set to no, the user requires -# to fix the AOF file using the "redis-check-aof" utility before to restart +# to fix the AOF file using the "valkey-check-aof" utility before to restart # the server. # # Note that if the AOF file will be found to be corrupted in the middle # the server will still exit with an error. This option only applies when -# Redis will try to read more data from the AOF file but not enough bytes +# the server will try to read more data from the AOF file but not enough bytes # will be found. aof-load-truncated yes -# Redis can create append-only base files in either RDB or AOF formats. Using +# The server can create append-only base files in either RDB or AOF formats. Using # the RDB format is always faster and more efficient, and disabling it is only # supported for backward compatibility purposes. aof-use-rdb-preamble yes -# Redis supports recording timestamp annotations in the AOF to support restoring +# The server supports recording timestamp annotations in the AOF to support restoring # the data from a specific point-in-time. However, using this capability changes # the AOF format in a way that may not be compatible with existing AOF parsers. aof-timestamp-enabled no @@ -1541,7 +1530,7 @@ aof-timestamp-enabled no # # shutdown-timeout 10 -# When Redis receives a SIGINT or SIGTERM, shutdown is initiated and by default +# When the server receives a SIGINT or SIGTERM, shutdown is initiated and by default # an RDB snapshot is written to disk in a blocking operation if save points are configured. # The options used on signaled shutdown can include the following values: # default: Saves RDB snapshot only if save points are configured. @@ -1560,12 +1549,12 @@ aof-timestamp-enabled no ################ NON-DETERMINISTIC LONG BLOCKING COMMANDS ##################### # Maximum time in milliseconds for EVAL scripts, functions and in some cases -# modules' commands before Redis can start processing or rejecting other clients. +# modules' commands before the server can start processing or rejecting other clients. # -# If the maximum execution time is reached Redis will start to reply to most +# If the maximum execution time is reached the server will start to reply to most # commands with a BUSY error. # -# In this state Redis will only allow a handful of commands to be executed. +# In this state the server will only allow a handful of commands to be executed. # For instance, SCRIPT KILL, FUNCTION KILL, SHUTDOWN NOSAVE and possibly some # module specific 'allow-busy' commands. # @@ -1581,17 +1570,17 @@ aof-timestamp-enabled no # lua-time-limit 5000 # busy-reply-threshold 5000 -################################ REDIS CLUSTER ############################### +################################ VALKEY CLUSTER ############################### -# Normal Redis instances can't be part of a Redis Cluster; only nodes that are -# started as cluster nodes can. In order to start a Redis instance as a +# Normal server instances can't be part of a cluster; only nodes that are +# started as cluster nodes can. In order to start a server instance as a # cluster node enable the cluster support uncommenting the following: # # cluster-enabled yes # Every cluster node has a cluster configuration file. This file is not -# intended to be edited by hand. It is created and updated by Redis nodes. -# Every Redis Cluster node requires a different cluster configuration file. +# intended to be edited by hand. It is created and updated by each node. +# Every cluster node requires a different cluster configuration file. # Make sure that instances running in the same system do not have # overlapping cluster configuration file names. # @@ -1681,7 +1670,7 @@ aof-timestamp-enabled no # # cluster-allow-replica-migration yes -# By default Redis Cluster nodes stop accepting queries if they detect there +# By default cluster nodes stop accepting queries if they detect there # is at least a hash slot uncovered (no available node is serving it). # This way if the cluster is partially down (for example a range of hash slots # are no longer covered) all the cluster becomes, eventually, unavailable. @@ -1776,11 +1765,11 @@ aof-timestamp-enabled no ########################## CLUSTER DOCKER/NAT support ######################## -# In certain deployments, Redis Cluster nodes address discovery fails, because +# In certain deployments, cluster node's address discovery fails, because # addresses are NAT-ted or because ports are forwarded (the typical case is # Docker and other containers). # -# In order to make Redis Cluster working in such environments, a static +# In order to make a cluster work in such environments, a static # configuration where each node knows its public address is needed. The # following four options are used for this scope, and are: # @@ -1798,7 +1787,7 @@ aof-timestamp-enabled no # to zero, then cluster-announce-port refers to the TLS port. Note also that # cluster-announce-tls-port has no effect if tls-cluster is set to no. # -# If the above options are not used, the normal Redis Cluster auto-detection +# If the above options are not used, the normal cluster auto-detection # will be used instead. # # Note that when remapped, the bus port may not be at the fixed offset of @@ -1815,14 +1804,14 @@ aof-timestamp-enabled no ################################## SLOW LOG ################################### -# The Redis Slow Log is a system to log queries that exceeded a specified +# The server Slow Log is a system to log queries that exceeded a specified # execution time. The execution time does not include the I/O operations # like talking with the client, sending the reply and so forth, # but just the time needed to actually execute the command (this is the only # stage of command execution where the thread is blocked and can not serve # other requests in the meantime). # -# You can configure the slow log with two parameters: one tells Redis +# You can configure the slow log with two parameters: one tells the server # what is the execution time, in microseconds, to exceed in order for the # command to get logged, and the other parameter is the length of the # slow log. When a new command is logged the oldest one is removed from the @@ -1839,9 +1828,9 @@ slowlog-max-len 128 ################################ LATENCY MONITOR ############################## -# The Redis latency monitoring subsystem samples different operations +# The server latency monitoring subsystem samples different operations # at runtime in order to collect data related to possible sources of -# latency of a Redis instance. +# latency of a server instance. # # Via the LATENCY command this information is available to the user that can # print graphs and obtain reports. @@ -1860,7 +1849,7 @@ latency-monitor-threshold 0 ################################ LATENCY TRACKING ############################## -# The Redis extended latency monitoring tracks the per command latencies and enables +# The server's extended latency monitoring tracks the per command latencies and enables # exporting the percentile distribution via the INFO latencystats command, # and cumulative latency distributions (histograms) via the LATENCY command. # @@ -1874,7 +1863,7 @@ latency-monitor-threshold 0 ############################# EVENT NOTIFICATION ############################## -# Redis can notify Pub/Sub clients about events happening in the key space. +# The server can notify Pub/Sub clients about events happening in the key space. # This feature is documented at https://redis.io/topics/notifications # # For instance if keyspace events notification is enabled, and a client @@ -1884,7 +1873,7 @@ latency-monitor-threshold 0 # PUBLISH __keyspace@0__:foo del # PUBLISH __keyevent@0__:del foo # -# It is possible to select the events that Redis will notify among a set +# It is possible to select the events that the server will notify among a set # of classes. Every class is identified by a single character: # # K Keyspace events, published with __keyspace@__ prefix. @@ -2009,8 +1998,8 @@ stream-node-max-bytes 4096 stream-node-max-entries 100 # Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in -# order to help rehashing the main Redis hash table (the one mapping top-level -# keys to values). The hash table implementation Redis uses (see dict.c) +# order to help rehashing the main server hash table (the one mapping top-level +# keys to values). The hash table implementation the server uses (see dict.c) # performs a lazy rehashing: the more operation you run into a hash table # that is rehashing, the more rehashing "steps" are performed, so if the # server is idle the rehashing is never complete and some more memory is used @@ -2021,7 +2010,7 @@ stream-node-max-entries 100 # # If unsure: # use "activerehashing no" if you have hard latency requirements and it is -# not a good thing in your environment that Redis can reply from time to time +# not a good thing in your environment that the server can reply from time to time # to queries with 2 milliseconds delay. # # use "activerehashing yes" if you don't have such hard requirements but @@ -2099,21 +2088,21 @@ client-output-buffer-limit pubsub 32mb 8mb 60 # eviction at 5% of maxmemory: # maxmemory-clients 5% -# In the Redis protocol, bulk requests, that are, elements representing single +# In the server protocol, bulk requests, that are, elements representing single # strings, are normally limited to 512 mb. However you can change this limit # here, but must be 1mb or greater # # proto-max-bulk-len 512mb -# Redis calls an internal function to perform many background tasks, like +# The server calls an internal function to perform many background tasks, like # closing connections of clients in timeout, purging expired keys that are # never requested, and so forth. # -# Not all tasks are performed with the same frequency, but Redis checks for +# Not all tasks are performed with the same frequency, but the server checks for # tasks to perform according to the specified "hz" value. # # By default "hz" is set to 10. Raising the value will use more CPU when -# Redis is idle, but at the same time will make Redis more responsive when +# the server is idle, but at the same time will make the server more responsive when # there are many keys expiring at the same time, and timeouts may be # handled with more precision. # @@ -2127,7 +2116,7 @@ hz 10 # avoid too many clients are processed for each background task invocation # in order to avoid latency spikes. # -# Since the default HZ value by default is conservatively set to 10, Redis +# Since the default HZ value by default is conservatively set to 10, the server # offers, and enables by default, the ability to use an adaptive HZ value # which will temporarily raise when there are many connected clients. # @@ -2144,22 +2133,22 @@ dynamic-hz yes # big latency spikes. aof-rewrite-incremental-fsync yes -# When redis saves RDB file, if the following option is enabled +# When the server saves RDB file, if the following option is enabled # the file will be fsync-ed every 4 MB of data generated. This is useful # in order to commit the file to the disk more incrementally and avoid # big latency spikes. rdb-save-incremental-fsync yes -# Redis LFU eviction (see maxmemory setting) can be tuned. However it is a good +# The server's LFU eviction (see maxmemory setting) can be tuned. However it is a good # idea to start with the default settings and only change them after investigating # how to improve the performances and how the keys LFU change over time, which # is possible to inspect via the OBJECT FREQ command. # -# There are two tunable parameters in the Redis LFU implementation: the +# There are two tunable parameters in the server LFU implementation: the # counter logarithm factor and the counter decay time. It is important to # understand what the two parameters mean before changing them. # -# The LFU counter is just 8 bits per key, it's maximum value is 255, so Redis +# The LFU counter is just 8 bits per key, it's maximum value is 255, so the server # uses a probabilistic increment with logarithmic behavior. Given the value # of the old counter, when a key is accessed, the counter is incremented in # this way: @@ -2186,8 +2175,8 @@ rdb-save-incremental-fsync yes # # NOTE: The above table was obtained by running the following commands: # -# redis-benchmark -n 1000000 incr foo -# redis-cli object freq foo +# valkey-benchmark -n 1000000 incr foo +# valkey-cli object freq foo # # NOTE 2: The counter initial value is 5 in order to give new objects a chance # to accumulate hits. @@ -2226,7 +2215,7 @@ rdb-save-incremental-fsync yes # What is active defragmentation? # ------------------------------- # -# Active (online) defragmentation allows a Redis server to compact the +# Active (online) defragmentation allows a server to compact the # spaces left between small allocations and deallocations of data in memory, # thus allowing to reclaim back memory. # @@ -2234,11 +2223,11 @@ rdb-save-incremental-fsync yes # less so with Jemalloc, fortunately) and certain workloads. Normally a server # restart is needed in order to lower the fragmentation, or at least to flush # away all the data and create it again. However thanks to this feature -# implemented by Oran Agra for Redis 4.0 this process can happen at runtime +# implemented by Oran Agra, this process can happen at runtime # in a "hot" way, while the server is running. # # Basically when the fragmentation is over a certain level (see the -# configuration options below) Redis will start to create new copies of the +# configuration options below) the server will start to create new copies of the # values in contiguous memory regions by exploiting certain specific Jemalloc # features (in order to understand if an allocation is causing fragmentation # and to allocate it in a better place), and at the same time, will release the @@ -2247,8 +2236,8 @@ rdb-save-incremental-fsync yes # # Important things to understand: # -# 1. This feature is disabled by default, and only works if you compiled Redis -# to use the copy of Jemalloc we ship with the source code of Redis. +# 1. This feature is disabled by default, and only works if you compiled the server +# to use the copy of Jemalloc we ship with the source code of the server. # This is the default with Linux builds. # # 2. You never need to enable this feature if you don't have fragmentation @@ -2288,20 +2277,20 @@ rdb-save-incremental-fsync yes # Jemalloc background thread for purging will be enabled by default jemalloc-bg-thread yes -# It is possible to pin different threads and processes of Redis to specific +# It is possible to pin different threads and processes of the server to specific # CPUs in your system, in order to maximize the performances of the server. -# This is useful both in order to pin different Redis threads in different -# CPUs, but also in order to make sure that multiple Redis instances running +# This is useful both in order to pin different server threads in different +# CPUs, but also in order to make sure that multiple server instances running # in the same host will be pinned to different CPUs. # # Normally you can do this using the "taskset" command, however it is also -# possible to this via Redis configuration directly, both in Linux and FreeBSD. +# possible to do this via the server configuration directly, both in Linux and FreeBSD. # # You can pin the server/IO threads, bio threads, aof rewrite child process, and # the bgsave child process. The syntax to specify the cpu list is the same as # the taskset command: # -# Set redis server/io threads to cpu affinity 0,2,4,6: +# Set server/io threads to cpu affinity 0,2,4,6: # server-cpulist 0-7:2 # # Set bio threads to cpu affinity 1,3: @@ -2313,7 +2302,7 @@ jemalloc-bg-thread yes # Set bgsave child process to cpu affinity 1,10,11 # bgsave-cpulist 1,10-11 -# In some cases redis will emit warnings and even refuse to start if it detects +# In some cases the server will emit warnings and even refuse to start if it detects # that the system is in bad state, it is possible to suppress these warnings # by setting the following config which takes a space delimited list of warnings # to suppress From add5f5615cd3206dc859476b13a81a3b4da287ee Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Thu, 4 Apr 2024 01:24:01 +0700 Subject: [PATCH 43/49] Rename some redis structs to server (#178) - redisFunctionSym -> serverFunctionSym - redisSortObject -> serverSortObject - redisSortOperation -> serverSortOperation #144 Signed-off-by: 0del --- src/server.h | 10 +++++----- src/sort.c | 18 +++++++++--------- utils/build-static-symbols.tcl | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/server.h b/src/server.h index b248445da0..3b05c7ca33 100644 --- a/src/server.h +++ b/src/server.h @@ -2390,23 +2390,23 @@ struct serverError { long long count; }; -struct redisFunctionSym { +struct serverFunctionSym { char *name; unsigned long pointer; }; -typedef struct _redisSortObject { +typedef struct _serverSortObject { robj *obj; union { double score; robj *cmpobj; } u; -} redisSortObject; +} serverSortObject; -typedef struct _redisSortOperation { +typedef struct _serverSortOperation { int type; robj *pattern; -} redisSortOperation; +} serverSortOperation; /* Structure to hold list iteration abstraction. */ typedef struct { diff --git a/src/sort.c b/src/sort.c index 86255ca265..78d15a7199 100644 --- a/src/sort.c +++ b/src/sort.c @@ -36,8 +36,8 @@ zskiplistNode* zslGetElementByRank(zskiplist *zsl, unsigned long rank); -redisSortOperation *createSortOperation(int type, robj *pattern) { - redisSortOperation *so = zmalloc(sizeof(*so)); +serverSortOperation *createSortOperation(int type, robj *pattern) { + serverSortOperation *so = zmalloc(sizeof(*so)); so->type = type; so->pattern = pattern; return so; @@ -137,7 +137,7 @@ robj *lookupKeyByPattern(serverDb *db, robj *pattern, robj *subst) { * the additional parameter is not standard but a BSD-specific we have to * pass sorting parameters via the global 'server' structure */ int sortCompare(const void *s1, const void *s2) { - const redisSortObject *so1 = s1, *so2 = s2; + const serverSortObject *so1 = s1, *so2 = s2; int cmp; if (!server.sort_alpha) { @@ -197,7 +197,7 @@ void sortCommandGeneric(client *c, int readonly) { int int_conversion_error = 0; int syntax_error = 0; robj *sortval, *sortby = NULL, *storekey = NULL; - redisSortObject *vector; /* Resulting vector to sort */ + serverSortObject *vector; /* Resulting vector to sort */ int user_has_full_key_access = 0; /* ACL - used in order to verify 'get' and 'by' options can be used */ /* Create a list of operations to perform for every sorted element. * Operations can be GET */ @@ -363,7 +363,7 @@ void sortCommandGeneric(client *c, int readonly) { } /* Load the sorting vector with all the objects to sort */ - vector = zmalloc(sizeof(redisSortObject)*vectorlen); + vector = zmalloc(sizeof(serverSortObject)*vectorlen); j = 0; if (sortval->type == OBJ_LIST && dontsort) { @@ -516,9 +516,9 @@ void sortCommandGeneric(client *c, int readonly) { server.sort_bypattern = sortby ? 1 : 0; server.sort_store = storekey ? 1 : 0; if (sortby && (start != 0 || end != vectorlen-1)) - pqsort(vector,vectorlen,sizeof(redisSortObject),sortCompare, start,end); + pqsort(vector,vectorlen,sizeof(serverSortObject),sortCompare, start,end); else - qsort(vector,vectorlen,sizeof(redisSortObject),sortCompare); + qsort(vector,vectorlen,sizeof(serverSortObject),sortCompare); } /* Send command output to the output buffer, performing the specified @@ -536,7 +536,7 @@ void sortCommandGeneric(client *c, int readonly) { if (!getop) addReplyBulk(c,vector[j].obj); listRewind(operations,&li); while((ln = listNext(&li))) { - redisSortOperation *sop = ln->value; + serverSortOperation *sop = ln->value; robj *val = lookupKeyByPattern(c->db,sop->pattern, vector[j].obj); @@ -568,7 +568,7 @@ void sortCommandGeneric(client *c, int readonly) { } else { listRewind(operations,&li); while((ln = listNext(&li))) { - redisSortOperation *sop = ln->value; + serverSortOperation *sop = ln->value; robj *val = lookupKeyByPattern(c->db,sop->pattern, vector[j].obj); diff --git a/utils/build-static-symbols.tcl b/utils/build-static-symbols.tcl index e634cbe0ff..0aa8f72402 100644 --- a/utils/build-static-symbols.tcl +++ b/utils/build-static-symbols.tcl @@ -12,7 +12,7 @@ while {[gets $fd line] != -1} { } } set symlist [lsort -unique $symlist] -puts "static struct redisFunctionSym symsTable\[\] = {" +puts "static struct serverFunctionSym symsTable\[\] = {" foreach sym $symlist { puts "{\"$sym\",(unsigned long)$sym}," } From f753db514166c1e2cbb63a6cbbf4c5f3722204e2 Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Thu, 4 Apr 2024 01:26:33 +0700 Subject: [PATCH 44/49] rename redis functions in server.h (#179) redisPopcount -> serverPopcount redisSetProcTitle -> serverSetProcTitle redisCommunicateSystemd -> serverCommunicateSystemd redisSetCpuAffinity -> serverSetCpuAffinity redisFork -> serverFork #144 Signed-off-by: 0del --- src/aof.c | 6 +++--- src/bio.c | 2 +- src/bitops.c | 6 +++--- src/cluster_legacy.c | 2 +- src/config.c | 2 +- src/eval.c | 2 +- src/module.c | 4 ++-- src/networking.c | 2 +- src/rdb.c | 12 ++++++------ src/replication.c | 4 ++-- src/server.c | 36 ++++++++++++++++++------------------ src/server.h | 10 +++++----- 12 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/aof.c b/src/aof.c index cb9c431364..c775d5b612 100644 --- a/src/aof.c +++ b/src/aof.c @@ -2467,12 +2467,12 @@ int rewriteAppendOnlyFileBackground(void) { server.stat_aof_rewrites++; - if ((childpid = redisFork(CHILD_TYPE_AOF)) == 0) { + if ((childpid = serverFork(CHILD_TYPE_AOF)) == 0) { char tmpfile[256]; /* Child */ - redisSetProcTitle("redis-aof-rewrite"); - redisSetCpuAffinity(server.aof_rewrite_cpulist); + serverSetProcTitle("redis-aof-rewrite"); + serverSetCpuAffinity(server.aof_rewrite_cpulist); snprintf(tmpfile,256,"temp-rewriteaof-bg-%d.aof", (int) getpid()); if (rewriteAppendOnlyFile(tmpfile) == C_OK) { serverLog(LL_NOTICE, diff --git a/src/bio.c b/src/bio.c index 10ecf8db29..da62222426 100644 --- a/src/bio.c +++ b/src/bio.c @@ -212,7 +212,7 @@ void *bioProcessBackgroundJobs(void *arg) { redis_set_thread_title(bio_worker_title[worker]); - redisSetCpuAffinity(server.bio_cpulist); + serverSetCpuAffinity(server.bio_cpulist); makeThreadKillable(); diff --git a/src/bitops.c b/src/bitops.c index 925c2a71dd..bc76d9acb5 100644 --- a/src/bitops.c +++ b/src/bitops.c @@ -37,7 +37,7 @@ /* Count number of bits set in the binary array pointed by 's' and long * 'count' bytes. The implementation of this function is required to * work with an input string length up to 512 MB or more (server.proto_max_bulk_len) */ -long long redisPopcount(void *s, long count) { +long long serverPopcount(void *s, long count) { long long bits = 0; unsigned char *p = s; uint32_t *p4; @@ -870,7 +870,7 @@ void bitcountCommand(client *c) { addReply(c,shared.czero); } else { long bytes = (long)(end-start+1); - long long count = redisPopcount(p+start,bytes); + long long count = serverPopcount(p+start,bytes); if (first_byte_neg_mask != 0 || last_byte_neg_mask != 0) { unsigned char firstlast[2] = {0, 0}; /* We may count bits of first byte and last byte which are out of @@ -878,7 +878,7 @@ void bitcountCommand(client *c) { * bits in the range to zero. So these bit will not be excluded. */ if (first_byte_neg_mask != 0) firstlast[0] = p[start] & first_byte_neg_mask; if (last_byte_neg_mask != 0) firstlast[1] = p[end] & last_byte_neg_mask; - count -= redisPopcount(firstlast,2); + count -= serverPopcount(firstlast,2); } addReplyLongLong(c,count); } diff --git a/src/cluster_legacy.c b/src/cluster_legacy.c index 4e4f9425d6..edb510d6e1 100644 --- a/src/cluster_legacy.c +++ b/src/cluster_legacy.c @@ -805,7 +805,7 @@ int clusterLockConfig(char *filename) { * we'll retain the lock to the file as long as the process exists. * * After fork, the child process will get the fd opened by the parent process, - * we need save `fd` to `cluster_config_file_lock_fd`, so that in redisFork(), + * we need save `fd` to `cluster_config_file_lock_fd`, so that in serverFork(), * it will be closed in the child process. * If it is not closed, when the main process is killed -9, but the child process * (redis-aof-rewrite) is still alive, the fd(lock) will still be held by the diff --git a/src/config.c b/src/config.c index 888567a157..8b193891cf 100644 --- a/src/config.c +++ b/src/config.c @@ -2445,7 +2445,7 @@ static int updateLocaleCollate(const char **err) { } static int updateProcTitleTemplate(const char **err) { - if (redisSetProcTitle(NULL) == C_ERR) { + if (serverSetProcTitle(NULL) == C_ERR) { *err = "failed to set process title"; return 0; } diff --git a/src/eval.c b/src/eval.c index a0e6a65737..2561322f3d 100644 --- a/src/eval.c +++ b/src/eval.c @@ -865,7 +865,7 @@ void ldbSendLogs(void) { int ldbStartSession(client *c) { ldb.forked = (c->flags & CLIENT_LUA_DEBUG_SYNC) == 0; if (ldb.forked) { - pid_t cp = redisFork(CHILD_TYPE_LDB); + pid_t cp = serverFork(CHILD_TYPE_LDB); if (cp == -1) { addReplyErrorFormat(c,"Fork() failed: can't run EVAL in debugging mode: %s", strerror(errno)); return 0; diff --git a/src/module.c b/src/module.c index af0d92cf8b..2314845461 100644 --- a/src/module.c +++ b/src/module.c @@ -11248,9 +11248,9 @@ int RM_ScanKey(RedisModuleKey *key, RedisModuleScanCursor *cursor, RedisModuleSc int RM_Fork(RedisModuleForkDoneHandler cb, void *user_data) { pid_t childpid; - if ((childpid = redisFork(CHILD_TYPE_MODULE)) == 0) { + if ((childpid = serverFork(CHILD_TYPE_MODULE)) == 0) { /* Child */ - redisSetProcTitle("redis-module-fork"); + serverSetProcTitle("redis-module-fork"); } else if (childpid == -1) { serverLog(LL_WARNING,"Can't fork for module: %s", strerror(errno)); } else { diff --git a/src/networking.c b/src/networking.c index 90825ca284..e979e2ecc3 100644 --- a/src/networking.c +++ b/src/networking.c @@ -4226,7 +4226,7 @@ void *IOThreadMain(void *myid) { snprintf(thdname, sizeof(thdname), "io_thd_%ld", id); redis_set_thread_title(thdname); - redisSetCpuAffinity(server.server_cpulist); + serverSetCpuAffinity(server.server_cpulist); makeThreadKillable(); while(1) { diff --git a/src/rdb.c b/src/rdb.c index 688437ddd5..1039340493 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -1577,12 +1577,12 @@ int rdbSaveBackground(int req, char *filename, rdbSaveInfo *rsi, int rdbflags) { server.dirty_before_bgsave = server.dirty; server.lastbgsave_try = time(NULL); - if ((childpid = redisFork(CHILD_TYPE_RDB)) == 0) { + if ((childpid = serverFork(CHILD_TYPE_RDB)) == 0) { int retval; /* Child */ - redisSetProcTitle("redis-rdb-bgsave"); - redisSetCpuAffinity(server.bgsave_cpulist); + serverSetProcTitle("redis-rdb-bgsave"); + serverSetCpuAffinity(server.bgsave_cpulist); retval = rdbSave(req, filename,rsi,rdbflags); if (retval == C_OK) { sendChildCowInfo(CHILD_INFO_TYPE_RDB_COW_SIZE, "RDB"); @@ -3583,7 +3583,7 @@ int rdbSaveToSlavesSockets(int req, rdbSaveInfo *rsi) { } /* Create the child process. */ - if ((childpid = redisFork(CHILD_TYPE_RDB)) == 0) { + if ((childpid = serverFork(CHILD_TYPE_RDB)) == 0) { /* Child */ int retval, dummy; rio rdb; @@ -3594,8 +3594,8 @@ int rdbSaveToSlavesSockets(int req, rdbSaveInfo *rsi) { * get a write error and exit. */ close(server.rdb_pipe_read); - redisSetProcTitle("redis-rdb-to-slaves"); - redisSetCpuAffinity(server.bgsave_cpulist); + serverSetProcTitle("redis-rdb-to-slaves"); + serverSetCpuAffinity(server.bgsave_cpulist); retval = rdbSaveRioWithEOFMark(req,&rdb,NULL,rsi); if (retval == C_OK && rioFlush(&rdb) == 0) diff --git a/src/replication.c b/src/replication.c index d2ea5bbf23..eec67e06b1 100644 --- a/src/replication.c +++ b/src/replication.c @@ -2288,7 +2288,7 @@ void readSyncBulkPayload(connection *conn) { serverLog(LL_NOTICE, "MASTER <-> REPLICA sync: Finished with success"); if (server.supervised_mode == SUPERVISED_SYSTEMD) { - redisCommunicateSystemd("STATUS=MASTER <-> REPLICA sync: Finished with success. Ready to accept connections in read-write mode.\n"); + serverCommunicateSystemd("STATUS=MASTER <-> REPLICA sync: Finished with success. Ready to accept connections in read-write mode.\n"); } /* Send the initial ACK immediately to put this replica in online state. */ @@ -2859,7 +2859,7 @@ void syncWithMaster(connection *conn) { if (psync_result == PSYNC_CONTINUE) { serverLog(LL_NOTICE, "MASTER <-> REPLICA sync: Master accepted a Partial Resynchronization."); if (server.supervised_mode == SUPERVISED_SYSTEMD) { - redisCommunicateSystemd("STATUS=MASTER <-> REPLICA sync: Partial Resynchronization accepted. Ready to accept connections in read-write mode.\n"); + serverCommunicateSystemd("STATUS=MASTER <-> REPLICA sync: Partial Resynchronization accepted. Ready to accept connections in read-write mode.\n"); } return; } diff --git a/src/server.c b/src/server.c index eab88ce7ba..43727a24e6 100644 --- a/src/server.c +++ b/src/server.c @@ -4318,7 +4318,7 @@ int prepareForShutdown(int flags) { serverLog(LL_NOTICE,"User requested shutdown..."); if (server.supervised_mode == SUPERVISED_SYSTEMD) - redisCommunicateSystemd("STOPPING=1\n"); + serverCommunicateSystemd("STOPPING=1\n"); /* If we have any replicas, let them catch up the replication offset before * we shut down, to avoid data loss. */ @@ -4454,7 +4454,7 @@ int finishShutdown(void) { } else { serverLog(LL_WARNING, "Writing initial AOF, can't exit."); if (server.supervised_mode == SUPERVISED_SYSTEMD) - redisCommunicateSystemd("STATUS=Writing initial AOF, can't exit.\n"); + serverCommunicateSystemd("STATUS=Writing initial AOF, can't exit.\n"); goto error; } } @@ -4476,7 +4476,7 @@ int finishShutdown(void) { if ((server.saveparamslen > 0 && !nosave) || save) { serverLog(LL_NOTICE,"Saving the final RDB snapshot before exiting."); if (server.supervised_mode == SUPERVISED_SYSTEMD) - redisCommunicateSystemd("STATUS=Saving the final RDB snapshot\n"); + serverCommunicateSystemd("STATUS=Saving the final RDB snapshot\n"); /* Snapshotting. Perform a SYNC SAVE and exit */ rdbSaveInfo rsi, *rsiptr; rsiptr = rdbPopulateSaveInfo(&rsi); @@ -4492,7 +4492,7 @@ int finishShutdown(void) { } else { serverLog(LL_WARNING,"Error trying to save the DB, can't exit."); if (server.supervised_mode == SUPERVISED_SYSTEMD) - redisCommunicateSystemd("STATUS=Error trying to save the DB, can't exit.\n"); + serverCommunicateSystemd("STATUS=Error trying to save the DB, can't exit.\n"); goto error; } } @@ -6349,7 +6349,7 @@ int changeListener(connListener *listener) { /* Just close the server if port disabled */ if (listener->port == 0) { - if (server.set_proc_title) redisSetProcTitle(NULL); + if (server.set_proc_title) serverSetProcTitle(NULL); return C_OK; } @@ -6363,7 +6363,7 @@ int changeListener(connListener *listener) { serverPanic("Unrecoverable error creating %s accept handler.", listener->ct->get_type(NULL)); } - if (server.set_proc_title) redisSetProcTitle(NULL); + if (server.set_proc_title) serverSetProcTitle(NULL); return C_OK; } @@ -6449,7 +6449,7 @@ void closeChildUnusedResourceAfterFork(void) { } /* purpose is one of CHILD_TYPE_ types */ -int redisFork(int purpose) { +int serverFork(int purpose) { if (isMutuallyExclusiveChildType(purpose)) { if (hasActiveChildProcess()) { errno = EEXIST; @@ -6749,7 +6749,7 @@ int validateProcTitleTemplate(const char *template) { return ok; } -int redisSetProcTitle(char *title) { +int serverSetProcTitle(char *title) { #ifdef USE_SETPROCTITLE if (!title) title = server.exec_argv[0]; sds proc_title = expandProcTitleTemplate(server.proc_title_template, title); @@ -6764,7 +6764,7 @@ int redisSetProcTitle(char *title) { return C_OK; } -void redisSetCpuAffinity(const char *cpulist) { +void serverSetCpuAffinity(const char *cpulist) { #ifdef USE_SETCPUAFFINITY setcpuaffinity(cpulist); #else @@ -6774,7 +6774,7 @@ void redisSetCpuAffinity(const char *cpulist) { /* Send a notify message to systemd. Returns sd_notify return code which is * a positive number on success. */ -int redisCommunicateSystemd(const char *sd_notify_msg) { +int serverCommunicateSystemd(const char *sd_notify_msg) { #ifdef HAVE_LIBSYSTEMD int ret = sd_notify(0, sd_notify_msg); @@ -6812,7 +6812,7 @@ static int redisSupervisedSystemd(void) { "systemd supervision requested or auto-detected, but Redis is compiled without libsystemd support!"); return 0; #else - if (redisCommunicateSystemd("STATUS=Redis is loading...\n") <= 0) + if (serverCommunicateSystemd("STATUS=Redis is loading...\n") <= 0) return 0; serverLog(LL_NOTICE, "Supervised by systemd. Please make sure you set appropriate values for TimeoutStartSec and TimeoutStopSec in your service unit."); @@ -7169,7 +7169,7 @@ int main(int argc, char **argv) { initServer(); if (background || server.pidfile) createPidFile(); - if (server.set_proc_title) redisSetProcTitle(NULL); + if (server.set_proc_title) serverSetProcTitle(NULL); redisAsciiArt(); checkTcpBacklogSettings(); if (server.cluster_enabled) { @@ -7207,17 +7207,17 @@ int main(int argc, char **argv) { if (server.supervised_mode == SUPERVISED_SYSTEMD) { if (!server.masterhost) { - redisCommunicateSystemd("STATUS=Ready to accept connections\n"); + serverCommunicateSystemd("STATUS=Ready to accept connections\n"); } else { - redisCommunicateSystemd("STATUS=Ready to accept connections in read-only mode. Waiting for MASTER <-> REPLICA sync\n"); + serverCommunicateSystemd("STATUS=Ready to accept connections in read-only mode. Waiting for MASTER <-> REPLICA sync\n"); } - redisCommunicateSystemd("READY=1\n"); + serverCommunicateSystemd("READY=1\n"); } } else { sentinelIsRunning(); if (server.supervised_mode == SUPERVISED_SYSTEMD) { - redisCommunicateSystemd("STATUS=Ready to accept connections\n"); - redisCommunicateSystemd("READY=1\n"); + serverCommunicateSystemd("STATUS=Ready to accept connections\n"); + serverCommunicateSystemd("READY=1\n"); } } @@ -7226,7 +7226,7 @@ int main(int argc, char **argv) { serverLog(LL_WARNING,"WARNING: You specified a maxmemory value that is less than 1MB (current value is %llu bytes). Are you sure this is what you really want?", server.maxmemory); } - redisSetCpuAffinity(server.server_cpulist); + serverSetCpuAffinity(server.server_cpulist); setOOMScoreAdj(-1); aeMain(server.el); diff --git a/src/server.h b/src/server.h index 3b05c7ca33..07dd1485d5 100644 --- a/src/server.h +++ b/src/server.h @@ -2551,11 +2551,11 @@ void getRandomHexChars(char *p, size_t len); void getRandomBytes(unsigned char *p, size_t len); uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l); void exitFromChild(int retcode); -long long redisPopcount(void *s, long count); -int redisSetProcTitle(char *title); +long long serverPopcount(void *s, long count); +int serverSetProcTitle(char *title); int validateProcTitleTemplate(const char *template); -int redisCommunicateSystemd(const char *sd_notify_msg); -void redisSetCpuAffinity(const char *cpulist); +int serverCommunicateSystemd(const char *sd_notify_msg); +void serverSetCpuAffinity(const char *cpulist); /* afterErrorReply flags */ #define ERR_REPLY_FLAG_NO_STATS_UPDATE (1ULL<<0) /* Indicating that we should not update @@ -2906,7 +2906,7 @@ void sendChildInfo(childInfoType info_type, size_t keys, char *pname); void receiveChildInfo(void); /* Fork helpers */ -int redisFork(int purpose); +int serverFork(int purpose); int hasActiveChildProcess(void); void resetChildState(void); int isMutuallyExclusiveChildType(int type); From 8b3ab8f74fe7cfc45f6e97b0f702210afada776d Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Thu, 4 Apr 2024 01:29:33 +0700 Subject: [PATCH 45/49] Rename redisAtomic to serverAtomic (#180) https://github.com/valkey-io/valkey/issues/144 Signed-off-by: 0del --- src/atomicvar.h | 8 ++++---- src/lazyfree.c | 4 ++-- src/networking.c | 2 +- src/redis-benchmark.c | 14 +++++++------- src/server.h | 26 +++++++++++++------------- src/threads_mngr.c | 4 ++-- src/zmalloc.c | 2 +- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/atomicvar.h b/src/atomicvar.h index bcabdccc58..b506c5d29e 100644 --- a/src/atomicvar.h +++ b/src/atomicvar.h @@ -80,8 +80,8 @@ #ifndef __ATOMIC_VAR_H #define __ATOMIC_VAR_H -/* Define redisAtomic for atomic variable. */ -#define redisAtomic +/* Define serverAtomic for atomic variable. */ +#define serverAtomic /* To test Redis with Helgrind (a Valgrind tool) it is useful to define * the following macro, so that __sync macros are used: those can be detected @@ -109,8 +109,8 @@ #if !defined(__ATOMIC_VAR_FORCE_SYNC_MACROS) && defined(__STDC_VERSION__) && \ (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__) /* Use '_Atomic' keyword if the compiler supports. */ -#undef redisAtomic -#define redisAtomic _Atomic +#undef serverAtomic +#define serverAtomic _Atomic /* Implementation using _Atomic in C11. */ #include diff --git a/src/lazyfree.c b/src/lazyfree.c index cd220fca15..4733d8f99a 100644 --- a/src/lazyfree.c +++ b/src/lazyfree.c @@ -4,8 +4,8 @@ #include "functions.h" #include "cluster.h" -static redisAtomic size_t lazyfree_objects = 0; -static redisAtomic size_t lazyfreed_objects = 0; +static serverAtomic size_t lazyfree_objects = 0; +static serverAtomic size_t lazyfreed_objects = 0; /* Release objects from the lazyfree thread. It's just decrRefCount() * updating the count of objects to release. */ diff --git a/src/networking.c b/src/networking.c index e979e2ecc3..5bb7706e7d 100644 --- a/src/networking.c +++ b/src/networking.c @@ -4195,7 +4195,7 @@ void processEventsWhileBlocked(void) { #endif typedef struct __attribute__((aligned(CACHE_LINE_SIZE))) threads_pending { - redisAtomic unsigned long value; + serverAtomic unsigned long value; } threads_pending; pthread_t io_threads[IO_THREADS_MAX_NUM]; diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index f1cc39a7ed..48d178109c 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -85,11 +85,11 @@ static struct config { int tls; struct cliSSLconfig sslconfig; int numclients; - redisAtomic int liveclients; + serverAtomic int liveclients; int requests; - redisAtomic int requests_issued; - redisAtomic int requests_finished; - redisAtomic int previous_requests_finished; + serverAtomic int requests_issued; + serverAtomic int requests_finished; + serverAtomic int previous_requests_finished; int last_printed_bytes; long long previous_tick; int keysize; @@ -118,9 +118,9 @@ static struct config { struct redisConfig *redis_config; struct hdr_histogram* latency_histogram; struct hdr_histogram* current_sec_latency_histogram; - redisAtomic int is_fetching_slots; - redisAtomic int is_updating_slots; - redisAtomic int slots_last_update; + serverAtomic int is_fetching_slots; + serverAtomic int is_updating_slots; + serverAtomic int slots_last_update; int enable_tracking; pthread_mutex_t liveclients_mutex; pthread_mutex_t is_updating_slots_mutex; diff --git a/src/server.h b/src/server.h index 07dd1485d5..4226bd99dd 100644 --- a/src/server.h +++ b/src/server.h @@ -1594,7 +1594,7 @@ struct redisServer { int module_pipe[2]; /* Pipe used to awake the event loop by module threads. */ pid_t child_pid; /* PID of current child */ int child_type; /* Type of current child */ - redisAtomic int module_gil_acquring; /* Indicates whether the GIL is being acquiring by the main thread. */ + serverAtomic int module_gil_acquring; /* Indicates whether the GIL is being acquiring by the main thread. */ /* Networking */ int port; /* TCP listening port */ int tls_port; /* TLS listening port */ @@ -1633,7 +1633,7 @@ struct redisServer { pause_event client_pause_per_purpose[NUM_PAUSE_PURPOSES]; char neterr[ANET_ERR_LEN]; /* Error buffer for anet.c */ dict *migrate_cached_sockets;/* MIGRATE cached sockets */ - redisAtomic uint64_t next_client_id; /* Next client unique ID. Incremental. */ + serverAtomic uint64_t next_client_id; /* Next client unique ID. Incremental. */ int protected_mode; /* Don't accept external connections. */ int io_threads_num; /* Number of IO threads to use. */ int io_threads_do_reads; /* Read and parse from IO threads? */ @@ -1689,10 +1689,10 @@ struct redisServer { long long slowlog_log_slower_than; /* SLOWLOG time limit (to get logged) */ unsigned long slowlog_max_len; /* SLOWLOG max number of items logged */ struct malloc_stats cron_malloc_stats; /* sampled in serverCron(). */ - redisAtomic long long stat_net_input_bytes; /* Bytes read from network. */ - redisAtomic long long stat_net_output_bytes; /* Bytes written to network. */ - redisAtomic long long stat_net_repl_input_bytes; /* Bytes read during replication, added to stat_net_input_bytes in 'info'. */ - redisAtomic long long stat_net_repl_output_bytes; /* Bytes written during replication, added to stat_net_output_bytes in 'info'. */ + serverAtomic long long stat_net_input_bytes; /* Bytes read from network. */ + serverAtomic long long stat_net_output_bytes; /* Bytes written to network. */ + serverAtomic long long stat_net_repl_input_bytes; /* Bytes read during replication, added to stat_net_input_bytes in 'info'. */ + serverAtomic long long stat_net_repl_output_bytes; /* Bytes written during replication, added to stat_net_output_bytes in 'info'. */ size_t stat_current_cow_peak; /* Peak size of copy on write bytes. */ size_t stat_current_cow_bytes; /* Copy on write bytes while child is active. */ monotime stat_current_cow_updated; /* Last update time of stat_current_cow_bytes */ @@ -1709,9 +1709,9 @@ struct redisServer { long long stat_dump_payload_sanitizations; /* Number deep dump payloads integrity validations. */ long long stat_io_reads_processed; /* Number of read events processed by IO / Main threads */ long long stat_io_writes_processed; /* Number of write events processed by IO / Main threads */ - redisAtomic long long stat_total_reads_processed; /* Total number of read events processed */ - redisAtomic long long stat_total_writes_processed; /* Total number of write events processed */ - redisAtomic long long stat_client_qbuf_limit_disconnections; /* Total number of clients reached query buf length limit */ + serverAtomic long long stat_total_reads_processed; /* Total number of read events processed */ + serverAtomic long long stat_total_writes_processed; /* Total number of write events processed */ + serverAtomic long long stat_client_qbuf_limit_disconnections; /* Total number of clients reached query buf length limit */ long long stat_client_outbuf_limit_disconnections; /* Total number of clients reached output buf length limit */ /* The following two are used to track instantaneous metrics, like * number of operations per second, network traffic. */ @@ -1800,8 +1800,8 @@ struct redisServer { int aof_last_write_errno; /* Valid if aof write/fsync status is ERR */ int aof_load_truncated; /* Don't stop on unexpected AOF EOF. */ int aof_use_rdb_preamble; /* Specify base AOF to use RDB encoding on AOF rewrites. */ - redisAtomic int aof_bio_fsync_status; /* Status of AOF fsync in bio job. */ - redisAtomic int aof_bio_fsync_errno; /* Errno of AOF fsync in bio job. */ + serverAtomic int aof_bio_fsync_status; /* Status of AOF fsync in bio job. */ + serverAtomic int aof_bio_fsync_errno; /* Errno of AOF fsync in bio job. */ aofManifest *aof_manifest; /* Used to track AOFs. */ int aof_disable_auto_gc; /* If disable automatically deleting HISTORY type AOFs? default no. (for testings). */ @@ -1866,7 +1866,7 @@ struct redisServer { char replid2[CONFIG_RUN_ID_SIZE+1]; /* replid inherited from master*/ long long master_repl_offset; /* My current replication offset */ long long second_replid_offset; /* Accept offsets up to this for replid2. */ - redisAtomic long long fsynced_reploff_pending;/* Largest replication offset to + serverAtomic long long fsynced_reploff_pending;/* Largest replication offset to * potentially have been fsynced, applied to fsynced_reploff only when AOF state is AOF_ON (not during the initial rewrite) */ @@ -1974,7 +1974,7 @@ struct redisServer { int list_max_listpack_size; int list_compress_depth; /* time cache */ - redisAtomic time_t unixtime; /* Unix time sampled every cron cycle. */ + serverAtomic time_t unixtime; /* Unix time sampled every cron cycle. */ time_t timezone; /* Cached timezone. As set by tzset(). */ int daylight_active; /* Currently in daylight saving time. */ mstime_t mstime; /* 'unixtime' in milliseconds. */ diff --git a/src/threads_mngr.c b/src/threads_mngr.c index 01080c8221..2d71ffacd0 100644 --- a/src/threads_mngr.c +++ b/src/threads_mngr.c @@ -46,10 +46,10 @@ static const clock_t RUN_ON_THREADS_TIMEOUT = 2; static run_on_thread_cb g_callback = NULL; static volatile size_t g_tids_len = 0; -static redisAtomic size_t g_num_threads_done = 0; +static serverAtomic size_t g_num_threads_done = 0; /* This flag is set while ThreadsManager_runOnThreads is running */ -static redisAtomic int g_in_progress = 0; +static serverAtomic int g_in_progress = 0; /*============================ Internal prototypes ========================== */ diff --git a/src/zmalloc.c b/src/zmalloc.c index 27b64dc0d7..65ad1f4c6a 100644 --- a/src/zmalloc.c +++ b/src/zmalloc.c @@ -90,7 +90,7 @@ void zlibc_free(void *ptr) { #define update_zmalloc_stat_alloc(__n) atomicIncr(used_memory,(__n)) #define update_zmalloc_stat_free(__n) atomicDecr(used_memory,(__n)) -static redisAtomic size_t used_memory = 0; +static serverAtomic size_t used_memory = 0; static void zmalloc_default_oom(size_t size) { fprintf(stderr, "zmalloc: Out of memory trying to allocate %zu bytes\n", From edee864b34b8bd1b08f864aff909af96dfd8bf19 Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Thu, 4 Apr 2024 01:30:30 +0700 Subject: [PATCH 46/49] rename redisOp to serverOp (#181) https://github.com/valkey-io/valkey/issues/144 Signed-off-by: 0del --- src/server.c | 8 ++++---- src/server.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/server.c b/src/server.c index 43727a24e6..b073de2da0 100644 --- a/src/server.c +++ b/src/server.c @@ -3118,7 +3118,7 @@ void resetErrorTableStats(void) { /* ========================== Redis OP Array API ============================ */ int serverOpArrayAppend(serverOpArray *oa, int dbid, robj **argv, int argc, int target) { - redisOp *op; + serverOp *op; int prev_capacity = oa->capacity; if (oa->numops == 0) { @@ -3128,7 +3128,7 @@ int serverOpArrayAppend(serverOpArray *oa, int dbid, robj **argv, int argc, int } if (prev_capacity != oa->capacity) - oa->ops = zrealloc(oa->ops,sizeof(redisOp)*oa->capacity); + oa->ops = zrealloc(oa->ops,sizeof(serverOp)*oa->capacity); op = oa->ops+oa->numops; op->dbid = dbid; op->argv = argv; @@ -3141,7 +3141,7 @@ int serverOpArrayAppend(serverOpArray *oa, int dbid, robj **argv, int argc, int void serverOpArrayFree(serverOpArray *oa) { while(oa->numops) { int j; - redisOp *op; + serverOp *op; oa->numops--; op = oa->ops+oa->numops; @@ -3385,7 +3385,7 @@ static void propagatePendingCommands(void) { return; int j; - redisOp *rop; + serverOp *rop; /* If we got here it means we have finished an execution-unit. * If that unit has caused propagation of multiple commands, they diff --git a/src/server.h b/src/server.h index 4226bd99dd..730ef2b5bb 100644 --- a/src/server.h +++ b/src/server.h @@ -1371,16 +1371,16 @@ typedef struct clientBufferLimitsConfig { extern clientBufferLimitsConfig clientBufferLimitsDefaults[CLIENT_TYPE_OBUF_COUNT]; -/* The redisOp structure defines a Redis Operation, that is an instance of +/* The serverOp structure defines a Redis Operation, that is an instance of * a command with an argument vector, database ID, propagation target * (PROPAGATE_*), and command pointer. * * Currently only used to additionally propagate more commands to AOF/Replication * after the propagation of the executed command. */ -typedef struct redisOp { +typedef struct serverOp { robj **argv; int argc, dbid, target; -} redisOp; +} serverOp; /* Defines an array of Redis operations. There is an API to add to this * structure in an easy way. @@ -1389,7 +1389,7 @@ typedef struct redisOp { * void serverOpArrayFree(serverOpArray *oa); */ typedef struct serverOpArray { - redisOp *ops; + serverOp *ops; int numops; int capacity; } serverOpArray; From 3a0ba0ad93be5a2981c0ec0efc8c7a55be0a58e6 Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Thu, 4 Apr 2024 01:33:38 +0700 Subject: [PATCH 47/49] rename redisCommandArgType serverCommandArgType (#182) redisCommandArgType -> serverCommandArgType redisCommandArg -> serverCommandArg https://github.com/valkey-io/valkey/issues/144 Signed-off-by: 0del --- src/cli_commands.h | 2 +- src/commands.c | 2 +- src/commands.h | 10 +++++----- src/module.c | 18 +++++++++--------- src/server.c | 4 ++-- src/server.h | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/cli_commands.h b/src/cli_commands.h index eb5a476e38..d8455116dc 100644 --- a/src/cli_commands.h +++ b/src/cli_commands.h @@ -11,7 +11,7 @@ /* Syntax specifications for a command argument. */ typedef struct cliCommandArg { char *name; - redisCommandArgType type; + serverCommandArgType type; char *token; char *since; int flags; diff --git a/src/commands.c b/src/commands.c index 6d8e5696f3..bb93f98183 100644 --- a/src/commands.c +++ b/src/commands.c @@ -4,7 +4,7 @@ #define MAKE_CMD(name,summary,complexity,since,doc_flags,replaced,deprecated,group,group_enum,history,num_history,tips,num_tips,function,arity,flags,acl,key_specs,key_specs_num,get_keys,numargs) name,summary,complexity,since,doc_flags,replaced,deprecated,group_enum,history,num_history,tips,num_tips,function,arity,flags,acl,key_specs,key_specs_num,get_keys,numargs #define MAKE_ARG(name,type,key_spec_index,token,summary,since,flags,numsubargs,deprecated_since) name,type,key_spec_index,token,summary,since,flags,deprecated_since,numsubargs #define COMMAND_STRUCT serverCommand -#define COMMAND_ARG redisCommandArg +#define COMMAND_ARG serverCommandArg #ifdef LOG_REQ_RES #include "commands_with_reply_schema.def" diff --git a/src/commands.h b/src/commands.h index 1eefab4812..f093781160 100644 --- a/src/commands.h +++ b/src/commands.h @@ -12,7 +12,7 @@ typedef enum { ARG_TYPE_PURE_TOKEN, ARG_TYPE_ONEOF, /* Has subargs */ ARG_TYPE_BLOCK /* Has subargs */ -} redisCommandArgType; +} serverCommandArgType; #define CMD_ARG_NONE (0) #define CMD_ARG_OPTIONAL (1<<0) @@ -20,9 +20,9 @@ typedef enum { #define CMD_ARG_MULTIPLE_TOKEN (1<<2) /* Must be compatible with RedisModuleCommandArg. See moduleCopyCommandArgs. */ -typedef struct redisCommandArg { +typedef struct serverCommandArg { const char *name; - redisCommandArgType type; + serverCommandArgType type; int key_spec_index; const char *token; const char *summary; @@ -30,9 +30,9 @@ typedef struct redisCommandArg { int flags; const char *deprecated_since; int num_args; - struct redisCommandArg *subargs; + struct serverCommandArg *subargs; const char *display_text; -} redisCommandArg; +} serverCommandArg; /* Returns the command group name by group number. */ const char *commandGroupStr(int index); diff --git a/src/module.c b/src/module.c index 2314845461..44c983f2e3 100644 --- a/src/module.c +++ b/src/module.c @@ -500,9 +500,9 @@ static int moduleValidateCommandInfo(const RedisModuleCommandInfo *info); static int64_t moduleConvertKeySpecsFlags(int64_t flags, int from_api); static int moduleValidateCommandArgs(RedisModuleCommandArg *args, const RedisModuleCommandInfoVersion *version); -static struct redisCommandArg *moduleCopyCommandArgs(RedisModuleCommandArg *args, +static struct serverCommandArg *moduleCopyCommandArgs(RedisModuleCommandArg *args, const RedisModuleCommandInfoVersion *version); -static redisCommandArgType moduleConvertArgType(RedisModuleCommandArgType type, int *error); +static serverCommandArgType moduleConvertArgType(RedisModuleCommandArgType type, int *error); static int moduleConvertArgFlags(int flags); void moduleCreateContext(RedisModuleCtx *out_ctx, RedisModule *module, int ctx_flags); @@ -1450,7 +1450,7 @@ moduleCmdArgAt(const RedisModuleCommandInfoVersion *version, /* Recursively populate the args structure (setting num_args to the number of * subargs) and return the number of args. */ -int populateArgsStructure(struct redisCommandArg *args) { +int populateArgsStructure(struct serverCommandArg *args) { if (!args) return 0; int count = 0; @@ -2197,13 +2197,13 @@ static int moduleValidateCommandArgs(RedisModuleCommandArg *args, } /* Converts an array of RedisModuleCommandArg into a freshly allocated array of - * struct redisCommandArg. */ -static struct redisCommandArg *moduleCopyCommandArgs(RedisModuleCommandArg *args, + * struct serverCommandArg. */ +static struct serverCommandArg *moduleCopyCommandArgs(RedisModuleCommandArg *args, const RedisModuleCommandInfoVersion *version) { size_t count = 0; while (moduleCmdArgAt(version, args, count)->name) count++; - serverAssert(count < SIZE_MAX / sizeof(struct redisCommandArg)); - struct redisCommandArg *realargs = zcalloc((count+1) * sizeof(redisCommandArg)); + serverAssert(count < SIZE_MAX / sizeof(struct serverCommandArg)); + struct serverCommandArg *realargs = zcalloc((count+1) * sizeof(serverCommandArg)); for (size_t j = 0; j < count; j++) { RedisModuleCommandArg *arg = moduleCmdArgAt(version, args, j); @@ -2224,7 +2224,7 @@ static struct redisCommandArg *moduleCopyCommandArgs(RedisModuleCommandArg *args return realargs; } -static redisCommandArgType moduleConvertArgType(RedisModuleCommandArgType type, int *error) { +static serverCommandArgType moduleConvertArgType(RedisModuleCommandArgType type, int *error) { if (error) *error = 0; switch (type) { case REDISMODULE_ARG_TYPE_STRING: return ARG_TYPE_STRING; @@ -12132,7 +12132,7 @@ void moduleFreeModuleStructure(struct RedisModule *module) { zfree(module); } -void moduleFreeArgs(struct redisCommandArg *args, int num_args) { +void moduleFreeArgs(struct serverCommandArg *args, int num_args) { for (int j = 0; j < num_args; j++) { zfree((char *)args[j].name); zfree((char *)args[j].token); diff --git a/src/server.c b/src/server.c index b073de2da0..efd7f7b3be 100644 --- a/src/server.c +++ b/src/server.c @@ -4699,7 +4699,7 @@ void addReplyFlagsForKeyArgs(client *c, uint64_t flags) { addReplyCommandFlags(c, flags, docFlagNames); } -/* Must match redisCommandArgType */ +/* Must match serverCommandArgType */ const char *ARG_TYPE_STR[] = { "string", "integer", @@ -4722,7 +4722,7 @@ void addReplyFlagsForArg(client *c, uint64_t flags) { addReplyCommandFlags(c, flags, argFlagNames); } -void addReplyCommandArgList(client *c, struct redisCommandArg *args, int num_args) { +void addReplyCommandArgList(client *c, struct serverCommandArg *args, int num_args) { addReplyArrayLen(c, num_args); for (int j = 0; j Date: Thu, 4 Apr 2024 01:34:18 +0700 Subject: [PATCH 48/49] rename redisServer to valkeyServer (#183) https://github.com/valkey-io/valkey/issues/144 Signed-off-by: 0del --- src/server.c | 2 +- src/server.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server.c b/src/server.c index efd7f7b3be..3dde30c8f4 100644 --- a/src/server.c +++ b/src/server.c @@ -89,7 +89,7 @@ double R_Zero, R_PosInf, R_NegInf, R_Nan; /*================================= Globals ================================= */ /* Global vars */ -struct redisServer server; /* Server global state */ +struct valkeyServer server; /* Server global state */ /*============================ Internal prototypes ========================== */ diff --git a/src/server.h b/src/server.h index 711486b9cf..0925ee6dba 100644 --- a/src/server.h +++ b/src/server.h @@ -1544,7 +1544,7 @@ typedef enum childInfoType { CHILD_INFO_TYPE_MODULE_COW_SIZE } childInfoType; -struct redisServer { +struct valkeyServer { /* General */ pid_t pid; /* Main process pid. */ pthread_t main_thread_id; /* Main thread id */ @@ -2462,7 +2462,7 @@ extern int io_threads_op; * Extern declarations *----------------------------------------------------------------------------*/ -extern struct redisServer server; +extern struct valkeyServer server; extern struct sharedObjectsStruct shared; extern dictType objectKeyPointerValueDictType; extern dictType objectKeyHeapPointerValueDictType; From 125a2987af1f779af45966f539ec1f63650f8593 Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Thu, 4 Apr 2024 01:46:23 +0700 Subject: [PATCH 49/49] rename git sha related (#184) redisGitSHA1 -> serverGitSHA1 redisGitDirty -> serverGitDirty redisBuildId -> serverBuildId redisBuildIdRaw -> serverBuildIdRaw redisBuildIdString -> serverBuildIdString #144 #170 Signed-off-by: 0del --- src/cli_common.c | 10 +++++----- src/release.c | 12 ++++++------ src/server.c | 20 ++++++++++---------- src/server.h | 10 +++++----- src/tls.c | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/cli_common.c b/src/cli_common.c index 49cae3eabf..368906bcef 100644 --- a/src/cli_common.c +++ b/src/cli_common.c @@ -50,8 +50,8 @@ #define UNUSED(V) ((void) V) -char *redisGitSHA1(void); -char *redisGitDirty(void); +char *serverGitSHA1(void); +char *serverGitDirty(void); /* Wrapper around redisSecureConnection to avoid hiredis_ssl dependencies if * not building with TLS support. @@ -416,9 +416,9 @@ sds cliVersion(void) { sds version = sdscatprintf(sdsempty(), "%s", REDIS_VERSION); /* Add git commit and working tree status when available. */ - if (strtoll(redisGitSHA1(),NULL,16)) { - version = sdscatprintf(version, " (git:%s", redisGitSHA1()); - if (strtoll(redisGitDirty(),NULL,10)) + if (strtoll(serverGitSHA1(),NULL,16)) { + version = sdscatprintf(version, " (git:%s", serverGitSHA1()); + if (strtoll(serverGitDirty(),NULL,10)) version = sdscatprintf(version, "-dirty"); version = sdscat(version, ")"); } diff --git a/src/release.c b/src/release.c index adc7e55ddb..fdc1dbd5b2 100644 --- a/src/release.c +++ b/src/release.c @@ -37,19 +37,19 @@ #include "release.h" #include "crc64.h" -char *redisGitSHA1(void) { +char *serverGitSHA1(void) { return REDIS_GIT_SHA1; } -char *redisGitDirty(void) { +char *serverGitDirty(void) { return REDIS_GIT_DIRTY; } -const char *redisBuildIdRaw(void) { +const char *serverBuildIdRaw(void) { return REDIS_BUILD_ID_RAW; } -uint64_t redisBuildId(void) { +uint64_t serverBuildId(void) { char *buildid = REDIS_BUILD_ID_RAW; return crc64(0,(unsigned char*)buildid,strlen(buildid)); @@ -58,11 +58,11 @@ uint64_t redisBuildId(void) { /* Return a cached value of the build string in order to avoid recomputing * and converting it in hex every time: this string is shown in the INFO * output that should be fast. */ -char *redisBuildIdString(void) { +char *serverBuildIdString(void) { static char buf[32]; static int cached = 0; if (!cached) { - snprintf(buf,sizeof(buf),"%llx",(unsigned long long) redisBuildId()); + snprintf(buf,sizeof(buf),"%llx",(unsigned long long) serverBuildId()); cached = 1; } return buf; diff --git a/src/server.c b/src/server.c index 3dde30c8f4..df5adac183 100644 --- a/src/server.c +++ b/src/server.c @@ -5585,9 +5585,9 @@ sds genRedisInfoString(dict *section_dict, int all_sections, int everything) { info = sdscatfmt(info, "# Server\r\n" FMTARGS( "redis_version:%s\r\n", REDIS_VERSION, - "redis_git_sha1:%s\r\n", redisGitSHA1(), - "redis_git_dirty:%i\r\n", strtol(redisGitDirty(),NULL,10) > 0, - "redis_build_id:%s\r\n", redisBuildIdString(), + "redis_git_sha1:%s\r\n", serverGitSHA1(), + "redis_git_dirty:%i\r\n", strtol(serverGitDirty(),NULL,10) > 0, + "redis_build_id:%s\r\n", serverBuildIdString(), "redis_mode:%s\r\n", mode, "os:%s", name.sysname, " %s", name.release, @@ -6266,11 +6266,11 @@ sds getVersion(void) { sds version = sdscatprintf(sdsempty(), "v=%s sha=%s:%d malloc=%s bits=%d build=%llx", REDIS_VERSION, - redisGitSHA1(), - atoi(redisGitDirty()) > 0, + serverGitSHA1(), + atoi(serverGitDirty()) > 0, ZMALLOC_LIB, sizeof(long) == 4 ? 32 : 64, - (unsigned long long) redisBuildId()); + (unsigned long long) serverBuildId()); return version; } @@ -6320,8 +6320,8 @@ void redisAsciiArt(void) { } else { snprintf(buf,1024*16,ascii_logo, REDIS_VERSION, - redisGitSHA1(), - strtol(redisGitDirty(),NULL,10) > 0, + serverGitSHA1(), + strtol(serverGitDirty(),NULL,10) > 0, (sizeof(long) == 8) ? "64" : "32", mode, server.port ? server.port : server.tls_port, (long) getpid() @@ -7157,8 +7157,8 @@ int main(int argc, char **argv) { "Redis version=%s, bits=%d, commit=%s, modified=%d, pid=%d, just started", REDIS_VERSION, (sizeof(long) == 8) ? 64 : 32, - redisGitSHA1(), - strtol(redisGitDirty(),NULL,10) > 0, + serverGitSHA1(), + strtol(serverGitDirty(),NULL,10) > 0, (int)getpid()); if (argc == 1) { diff --git a/src/server.h b/src/server.h index 0925ee6dba..ef492763b8 100644 --- a/src/server.h +++ b/src/server.h @@ -3470,11 +3470,11 @@ void dictListDestructor(dict *d, void *val); void *dictSdsDup(dict *d, const void *key); /* Git SHA1 */ -char *redisGitSHA1(void); -char *redisGitDirty(void); -uint64_t redisBuildId(void); -const char *redisBuildIdRaw(void); -char *redisBuildIdString(void); +char *serverGitSHA1(void); +char *serverGitDirty(void); +uint64_t serverBuildId(void); +const char *serverBuildIdRaw(void); +char *serverBuildIdString(void); /* Commands prototypes */ void authCommand(client *c); diff --git a/src/tls.c b/src/tls.c index a6bd066097..bb1cee14c7 100644 --- a/src/tls.c +++ b/src/tls.c @@ -1176,7 +1176,7 @@ int RedisModule_OnLoad(void *ctx, RedisModuleString **argv, int argc) { UNUSED(argc); /* Connection modules must be part of the same build as redis. */ - if (strcmp(REDIS_BUILD_ID_RAW, redisBuildIdRaw())) { + if (strcmp(REDIS_BUILD_ID_RAW, serverBuildIdRaw())) { serverLog(LL_NOTICE, "Connection type %s was not built together with the redis-server used.", CONN_TYPE_TLS); return REDISMODULE_ERR; }