├── INSTALL ├── pkg ├── deb │ ├── debian │ │ ├── compat │ │ ├── keydb-server.docs │ │ ├── source │ │ │ ├── format │ │ │ └── lintian-overrides │ │ ├── keydb-server.manpages │ │ ├── keydb-sentinel.manpages │ │ ├── keydb-tools.examples │ │ ├── keydb-server.install │ │ ├── tests │ │ │ ├── 0002-benchmark │ │ │ ├── 0003-keydb-check-aof │ │ │ ├── 0001-keydb-cli │ │ │ ├── control │ │ │ └── 0004-keydb-check-rdb │ │ ├── keydb-sentinel.install │ │ ├── keydb-tools.manpages │ │ ├── watch │ │ ├── keydb-sentinel.logrotate │ │ ├── keydb-server.logrotate │ │ ├── keydb-tools.postrm │ │ ├── keydb-sentinel.postrm │ │ ├── keydb-server.postrm │ │ ├── keydb-tools.install │ │ ├── keydb-server.postinst │ │ ├── keydb-sentinel.postinst │ │ ├── keydb-check-aof.1 │ │ ├── keydb-check-rdb.1 │ │ ├── keydb-tools.postinst │ │ ├── keydb-cli.1 │ │ ├── keydb-server.1 │ │ └── keydb-sentinel.1 │ ├── debian_dh9 │ │ ├── compat │ │ ├── source │ │ │ ├── format │ │ │ ├── options │ │ │ ├── include-binaries │ │ │ └── lintian-overrides │ │ ├── keydb-server.docs │ │ ├── keydb-server.manpages │ │ ├── keydb-sentinel.manpages │ │ ├── keydb-tools.examples │ │ ├── files │ │ ├── gbp.conf │ │ ├── keydb-server.install │ │ ├── keydb-sentinel.install │ │ ├── tests │ │ │ ├── 0002-benchmark │ │ │ ├── 0003-keydb-check-aof │ │ │ ├── 0001-keydb-cli │ │ │ ├── control │ │ │ └── 0004-keydb-check-rdb │ │ ├── keydb-tools.manpages │ │ ├── watch │ │ ├── keydb-server.logrotate │ │ ├── keydb-sentinel.logrotate │ │ ├── keydb-tools.postrm │ │ ├── keydb-server.postrm │ │ ├── keydb-sentinel.postrm │ │ ├── patches │ │ │ ├── series │ │ │ └── 0001-fix-ftbfs-on-kfreebsd.patch │ │ ├── keydb-server.maintscript │ │ ├── keydb-server.default │ │ ├── keydb-tools.install │ │ ├── keydb-sentinel.maintscript │ │ ├── keydb-sentinel.default │ │ ├── NEWS │ │ ├── keydb-server.postinst │ │ ├── keydb-sentinel.postinst │ │ ├── keydb-check-aof.1 │ │ ├── keydb-check-rdb.1 │ │ ├── keydb-tools.postinst │ │ ├── keydb-cli.1 │ │ ├── keydb-server.1 │ │ └── keydb-sentinel.1 │ └── deb_files_generated │ │ └── .gitkeep ├── rpm │ ├── rpm_files_generated │ │ └── .gitkeep │ ├── keydb_build │ │ └── keydb_rpm │ │ │ ├── usr │ │ │ └── share │ │ │ │ └── man │ │ │ │ ├── man1 │ │ │ │ ├── keydb-cli.1.gz │ │ │ │ ├── keydb-server.1.gz │ │ │ │ ├── keydb-benchmark.1.gz │ │ │ │ ├── keydb-check-aof.1.gz │ │ │ │ ├── keydb-check-rdb.1.gz │ │ │ │ └── keydb-sentinel.1.gz │ │ │ │ └── man5 │ │ │ │ ├── keydb.conf.5.gz │ │ │ │ └── keydb-sentinel.conf.5.gz │ │ │ └── etc │ │ │ ├── logrotate.d │ │ │ └── keydb │ │ │ └── systemd │ │ │ └── system │ │ │ ├── keydb.service.d │ │ │ └── limit.conf │ │ │ └── keydb-sentinel.service.d │ │ │ └── limit.conf │ └── README.md └── docker │ └── README.md ├── tests ├── tmp │ └── .gitignore ├── cluster │ ├── tmp │ │ └── .gitignore │ ├── tests │ │ ├── helpers │ │ │ └── onlydots.tcl │ │ ├── 01-faildet.tcl │ │ └── includes │ │ │ └── utils.tcl │ └── run.tcl ├── sentinel │ ├── tmp │ │ └── .gitignore │ ├── tests │ │ ├── 03-runtime-reconf.tcl │ │ ├── 04-slave-selection.tcl │ │ └── includes │ │ │ ├── sentinel.conf │ │ │ └── start-init-tests.tcl │ └── run.tcl ├── assets │ ├── nodefaultuser.acl │ ├── encodings.rdb │ ├── hash-zipmap.rdb │ ├── redis-save.rdb │ ├── corrupt_ziplist.rdb │ ├── redis-module-save.rdb │ ├── corrupt_empty_keys.rdb │ ├── user.acl │ ├── minimal.conf │ └── default.conf ├── integration │ └── rdb-repl-tests ├── unit │ ├── printver.tcl │ ├── type │ │ └── list-common.tcl │ ├── moduleapi │ │ ├── basics.tcl │ │ ├── zset.tcl │ │ ├── load.tcl │ │ ├── fork.tcl │ │ └── test_lazyfree.tcl │ ├── replication.tcl │ ├── limits.tcl │ └── rreplay.tcl ├── helpers │ ├── bg_complex_data.tcl │ ├── gen_climbing_load.tcl │ └── gen_write_load.tcl └── support │ ├── tmpfile.tcl │ ├── cli.tcl │ └── benchmark.tcl ├── deps ├── jemalloc │ ├── config.stamp.in │ ├── VERSION │ ├── .gitattributes │ ├── test │ │ ├── unit │ │ │ ├── junk_alloc.c │ │ │ ├── junk_free.c │ │ │ ├── arena_reset_prof.sh │ │ │ ├── binshard.sh │ │ │ ├── decay.sh │ │ │ ├── arena_reset_prof.c │ │ │ ├── prof_log.sh │ │ │ ├── junk.sh │ │ │ ├── pack.sh │ │ │ ├── prof_tctx.sh │ │ │ ├── safety_check.sh │ │ │ ├── zero.sh │ │ │ ├── junk_alloc.sh │ │ │ ├── junk_free.sh │ │ │ ├── prof_thread_name.sh │ │ │ ├── prof_reset.sh │ │ │ ├── prof_gdump.sh │ │ │ ├── prof_active.sh │ │ │ ├── prof_accum.sh │ │ │ ├── prof_idump.sh │ │ │ ├── a0.c │ │ │ ├── spin.c │ │ │ ├── div.c │ │ │ ├── pages.c │ │ │ ├── test_hooks.c │ │ │ ├── prof_idump.c │ │ │ ├── slab.c │ │ │ └── sc.c │ │ ├── src │ │ │ ├── math.c │ │ │ ├── btalloc_0.c │ │ │ ├── btalloc_1.c │ │ │ ├── btalloc.c │ │ │ ├── mq.c │ │ │ └── thd.c │ │ ├── integration │ │ │ ├── extent.sh │ │ │ ├── mallocx.sh │ │ │ ├── xallocx.sh │ │ │ ├── smallocx.sh │ │ │ ├── slab_sizes.sh │ │ │ ├── malloc.c │ │ │ └── cpp │ │ │ │ └── basic.cpp │ │ └── include │ │ │ └── test │ │ │ ├── thd.h │ │ │ ├── jemalloc_test_defs.h.in │ │ │ ├── timer.h │ │ │ ├── mtx.h │ │ │ └── btalloc.h │ ├── run_tests.sh │ ├── msvc │ │ ├── test_threads │ │ │ ├── test_threads.h │ │ │ └── test_threads_main.cpp │ │ └── ReadMe.txt │ ├── .autom4te.cfg │ ├── src │ │ ├── hash.c │ │ ├── prng.c │ │ ├── ticker.c │ │ ├── test_hooks.c │ │ ├── mutex_pool.c │ │ ├── safety_check.c │ │ └── extent_mmap.c │ ├── include │ │ ├── jemalloc │ │ │ ├── internal │ │ │ │ ├── private_namespace.sh │ │ │ │ ├── public_unnamespace.sh │ │ │ │ ├── public_namespace.sh │ │ │ │ ├── tsd_types.h │ │ │ │ ├── arena_structs_a.h │ │ │ │ ├── base_inlines.h │ │ │ │ ├── extent_mmap.h │ │ │ │ ├── bin_types.h │ │ │ │ ├── spin.h │ │ │ │ ├── extent_types.h │ │ │ │ ├── extent_dss.h │ │ │ │ ├── safety_check.h │ │ │ │ ├── test_hooks.h │ │ │ │ └── base_externs.h │ │ │ ├── jemalloc_rename.sh │ │ │ └── jemalloc.sh │ │ └── msvc_compat │ │ │ ├── windows_extra.h │ │ │ └── C99 │ │ │ └── stdbool.h │ ├── bin │ │ └── jemalloc.sh.in │ ├── doc │ │ ├── manpages.xsl.in │ │ ├── html.xsl.in │ │ └── stylesheet.xsl │ ├── autogen.sh │ ├── jemalloc.pc.in │ ├── .cirrus.yml │ └── README ├── memkind │ ├── src │ │ ├── README.md │ │ ├── debian │ │ │ ├── compat │ │ │ ├── changelog │ │ │ └── rules │ │ ├── jemalloc │ │ │ ├── config.stamp.in │ │ │ ├── .gitattributes │ │ │ ├── test │ │ │ │ ├── unit │ │ │ │ │ ├── junk_alloc.c │ │ │ │ │ ├── junk_free.c │ │ │ │ │ ├── arena_reset_prof.sh │ │ │ │ │ ├── decay.sh │ │ │ │ │ ├── arena_reset_prof.c │ │ │ │ │ ├── junk.sh │ │ │ │ │ ├── pack.sh │ │ │ │ │ ├── prof_tctx.sh │ │ │ │ │ ├── zero.sh │ │ │ │ │ ├── junk_free.sh │ │ │ │ │ ├── junk_alloc.sh │ │ │ │ │ ├── prof_thread_name.sh │ │ │ │ │ ├── prof_reset.sh │ │ │ │ │ ├── prof_gdump.sh │ │ │ │ │ ├── prof_active.sh │ │ │ │ │ ├── prof_accum.sh │ │ │ │ │ ├── prof_idump.sh │ │ │ │ │ ├── a0.c │ │ │ │ │ ├── spin.c │ │ │ │ │ ├── pages.c │ │ │ │ │ ├── hooks.c │ │ │ │ │ ├── prof_idump.c │ │ │ │ │ └── slab.c │ │ │ │ ├── src │ │ │ │ │ ├── math.c │ │ │ │ │ ├── btalloc_0.c │ │ │ │ │ ├── btalloc_1.c │ │ │ │ │ ├── btalloc.c │ │ │ │ │ ├── mq.c │ │ │ │ │ └── thd.c │ │ │ │ ├── integration │ │ │ │ │ ├── extent.sh │ │ │ │ │ ├── mallocx.sh │ │ │ │ │ └── xallocx.sh │ │ │ │ └── include │ │ │ │ │ └── test │ │ │ │ │ ├── thd.h │ │ │ │ │ ├── jemalloc_test_defs.h.in │ │ │ │ │ ├── timer.h │ │ │ │ │ ├── mtx.h │ │ │ │ │ └── btalloc.h │ │ │ ├── run_tests.sh │ │ │ ├── msvc │ │ │ │ ├── projects │ │ │ │ │ └── vc2015 │ │ │ │ │ │ └── test_threads │ │ │ │ │ │ ├── test_threads.h │ │ │ │ │ │ ├── test_threads_main.cpp │ │ │ │ │ │ └── test_threads.vcxproj.filters │ │ │ │ └── ReadMe.txt │ │ │ ├── .autom4te.cfg │ │ │ ├── src │ │ │ │ ├── spin.c │ │ │ │ ├── hash.c │ │ │ │ ├── prng.c │ │ │ │ ├── ticker.c │ │ │ │ ├── hooks.c │ │ │ │ ├── mutex_pool.c │ │ │ │ └── extent_mmap.c │ │ │ ├── include │ │ │ │ ├── jemalloc │ │ │ │ │ ├── internal │ │ │ │ │ │ ├── private_namespace.sh │ │ │ │ │ │ ├── public_unnamespace.sh │ │ │ │ │ │ ├── public_namespace.sh │ │ │ │ │ │ ├── base_types.h │ │ │ │ │ │ ├── base_inlines.h │ │ │ │ │ │ ├── extent_types.h │ │ │ │ │ │ ├── tsd_types.h │ │ │ │ │ │ ├── arena_structs_a.h │ │ │ │ │ │ ├── stats_tsd.h │ │ │ │ │ │ ├── extent_mmap.h │ │ │ │ │ │ ├── spin.h │ │ │ │ │ │ ├── extent_dss.h │ │ │ │ │ │ ├── hooks.h │ │ │ │ │ │ └── base_externs.h │ │ │ │ │ ├── jemalloc_rename.sh │ │ │ │ │ └── jemalloc.sh │ │ │ │ └── msvc_compat │ │ │ │ │ ├── windows_extra.h │ │ │ │ │ └── C99 │ │ │ │ │ └── stdbool.h │ │ │ ├── bin │ │ │ │ └── jemalloc.sh.in │ │ │ ├── doc │ │ │ │ ├── manpages.xsl.in │ │ │ │ ├── html.xsl.in │ │ │ │ └── stylesheet.xsl │ │ │ ├── autogen.sh │ │ │ └── jemalloc.pc.in │ │ ├── test │ │ │ ├── memkind-pytests.ts │ │ │ ├── memkind-afts-ext.ts │ │ │ ├── memkind-perf-ext.ts │ │ │ ├── memkind-perf.ts │ │ │ ├── memkind-slts.ts │ │ │ └── memkind-afts.ts │ │ ├── src │ │ │ └── .memkind_pmem.c.swp │ │ └── copying_headers │ │ │ └── MANIFEST.freeBSD3 │ └── Makefile ├── cpp-statsd-client │ ├── .gitignore │ ├── cmake │ │ ├── cpp-statsd-clientConfig.cmake.in │ │ └── Config.cmake.in │ ├── .github │ │ └── workflows │ │ │ ├── lint.yml │ │ │ ├── windows.yml │ │ │ ├── linux.yml │ │ │ └── coverage.yml │ ├── Makefile │ ├── images │ │ └── logo.svg │ └── LICENSE.md ├── linenoise │ ├── .gitignore │ └── Makefile ├── lua │ ├── doc │ │ ├── logo.gif │ │ ├── cover.png │ │ ├── manual.css │ │ └── readme.html │ ├── etc │ │ ├── lua.ico │ │ ├── lua.hpp │ │ ├── lua.pc │ │ ├── all.c │ │ ├── min.c │ │ ├── Makefile │ │ ├── strict.lua │ │ └── README │ ├── test │ │ ├── life.lua │ │ ├── echo.lua │ │ ├── hello.lua │ │ ├── printf.lua │ │ ├── env.lua │ │ ├── luac.lua │ │ ├── fibfor.lua │ │ ├── readonly.lua │ │ ├── table.lua │ │ ├── cf.lua │ │ ├── xd.lua │ │ ├── globals.lua │ │ ├── bisect.lua │ │ ├── fib.lua │ │ ├── factorial.lua │ │ ├── sieve.lua │ │ ├── trace-calls.lua │ │ └── trace-globals.lua │ └── src │ │ ├── lapi.h │ │ ├── fpconv.h │ │ ├── linit.c │ │ ├── lstring.h │ │ └── lundump.h ├── license │ ├── keycheck.h │ ├── x64 │ │ └── libkey.a │ └── arm64 │ │ └── libkey.a ├── hiredis │ ├── .gitignore │ ├── fmacros.h │ ├── hiredis_ssl.pc.in │ ├── hiredis-config.cmake.in │ ├── hiredis_ssl-config.cmake.in │ ├── hiredis.pc.in │ ├── examples │ │ └── example-qt.h │ └── appveyor.yml ├── update-jemalloc.sh └── hdr_histogram │ ├── Makefile │ └── README.md ├── utils ├── hyperloglog │ ├── .gitignore │ └── hll-err.rb ├── create-cluster │ └── .gitignore ├── releasetools │ ├── 01_create_tarball.sh │ ├── 04_release_hash.sh │ ├── 03_test_release.sh │ └── 02_upload_tarball.sh ├── hashtable │ └── README ├── srandmember │ ├── showfreq.rb │ ├── README.md │ └── showdist.rb ├── build-static-symbols.tcl ├── graphs │ └── commits-over-time │ │ └── README.md ├── whatisdoing.sh └── lru │ └── README ├── src ├── modules │ ├── .gitignore │ └── keydb_modstatsd │ │ └── Makefile ├── .gitignore ├── t_nhash.h ├── storage │ └── rocksdbfactory.h ├── keydbutils.cpp ├── motd.h ├── new.h ├── crc64.h ├── cron.h ├── geo.h ├── uuid.h ├── valgrind.sup ├── version.h ├── storage.h ├── mkreleasehdr.sh ├── sha1.h ├── meminfo.cpp ├── new.cpp ├── serverassert.h └── AsyncWorkQueue.h ├── BUGS ├── fuzz └── rdb │ ├── testcases │ ├── set.rdb │ ├── empty.rdb │ ├── expire.rdb │ ├── string.rdb │ ├── integer.rdb │ ├── multidb.rdb │ ├── replica.rdb │ ├── expireonload.rdb │ └── integer_shared.rdb │ └── dict.txt ├── .github └── ISSUE_TEMPLATE │ ├── other_stuff.md │ ├── crash_report.md │ ├── bug_report.md │ └── feature_request.md ├── .gitmodules ├── machamp_scripts └── build.sh ├── Makefile ├── runtest-cluster ├── runtest-sentinel ├── runtest ├── runtest-rotation └── .gitignore /INSTALL: -------------------------------------------------------------------------------- 1 | See README 2 | -------------------------------------------------------------------------------- /pkg/deb/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /tests/tmp/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /deps/jemalloc/config.stamp.in: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /deps/memkind/src/README.md: -------------------------------------------------------------------------------- 1 | README -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /deps/cpp-statsd-client/.gitignore: -------------------------------------------------------------------------------- 1 | bin -------------------------------------------------------------------------------- /deps/jemalloc/VERSION: -------------------------------------------------------------------------------- 1 | 5.2.1-0-g0 2 | -------------------------------------------------------------------------------- /deps/memkind/src/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /pkg/deb/deb_files_generated/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utils/hyperloglog/.gitignore: -------------------------------------------------------------------------------- 1 | *.txt 2 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/config.stamp.in: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/modules/.gitignore: -------------------------------------------------------------------------------- 1 | *.so 2 | *.xo 3 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-server.docs: -------------------------------------------------------------------------------- 1 | README.md 2 | -------------------------------------------------------------------------------- /pkg/deb/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /deps/jemalloc/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-server.docs: -------------------------------------------------------------------------------- 1 | README.md 2 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/junk_alloc.c: -------------------------------------------------------------------------------- 1 | #include "junk.c" 2 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/junk_free.c: -------------------------------------------------------------------------------- 1 | #include "junk.c" 2 | -------------------------------------------------------------------------------- /tests/cluster/tmp/.gitignore: -------------------------------------------------------------------------------- 1 | redis_* 2 | sentinel_* 3 | -------------------------------------------------------------------------------- /tests/sentinel/tmp/.gitignore: -------------------------------------------------------------------------------- 1 | redis_* 2 | sentinel_* 3 | -------------------------------------------------------------------------------- /BUGS: -------------------------------------------------------------------------------- 1 | Please check https://github.com/redis/redis/issues 2 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-server.manpages: -------------------------------------------------------------------------------- 1 | debian/keydb-server.1 2 | -------------------------------------------------------------------------------- /pkg/rpm/rpm_files_generated/.gitkeep: -------------------------------------------------------------------------------- 1 | # keep this directory 2 | -------------------------------------------------------------------------------- /deps/memkind/src/test/memkind-pytests.ts: -------------------------------------------------------------------------------- 1 | -k "test_TC_MEMKIND_" 2 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-sentinel.manpages: -------------------------------------------------------------------------------- 1 | debian/keydb-sentinel.1 2 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-server.manpages: -------------------------------------------------------------------------------- 1 | debian/keydb-server.1 2 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/junk_alloc.c: -------------------------------------------------------------------------------- 1 | #include "junk.c" 2 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/junk_free.c: -------------------------------------------------------------------------------- 1 | #include "junk.c" 2 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-tools.examples: -------------------------------------------------------------------------------- 1 | src/redis-trib.rb 2 | utils/lru 3 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-sentinel.manpages: -------------------------------------------------------------------------------- 1 | debian/keydb-sentinel.1 2 | -------------------------------------------------------------------------------- /deps/jemalloc/run_tests.sh: -------------------------------------------------------------------------------- 1 | $(dirname "$)")/scripts/gen_run_tests.py | bash 2 | -------------------------------------------------------------------------------- /deps/linenoise/.gitignore: -------------------------------------------------------------------------------- 1 | linenoise_example 2 | *.dSYM 3 | history.txt 4 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-tools.examples: -------------------------------------------------------------------------------- 1 | src/redis-trib.rb 2 | utils/lru 3 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/source/options: -------------------------------------------------------------------------------- 1 | extend-diff-ignore = "^\.travis\.yml$" 2 | -------------------------------------------------------------------------------- /deps/jemalloc/test/src/math.c: -------------------------------------------------------------------------------- 1 | #define MATH_C_ 2 | #include "test/jemalloc_test.h" 3 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/files: -------------------------------------------------------------------------------- 1 | keydb_5.3.3-1~bionic1_source.buildinfo database optional 2 | -------------------------------------------------------------------------------- /utils/create-cluster/.gitignore: -------------------------------------------------------------------------------- 1 | config.sh 2 | *.rdb 3 | *.aof 4 | *.conf 5 | *.log 6 | -------------------------------------------------------------------------------- /deps/jemalloc/msvc/test_threads/test_threads.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | int test_threads(); 4 | -------------------------------------------------------------------------------- /deps/lua/doc/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/deps/lua/doc/logo.gif -------------------------------------------------------------------------------- /deps/lua/etc/lua.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/deps/lua/etc/lua.ico -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/run_tests.sh: -------------------------------------------------------------------------------- 1 | $(dirname "$)")/scripts/gen_run_tests.py | bash 2 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | *.gcda 2 | *.gcno 3 | *.gcov 4 | redis.info 5 | KeyDB.info 6 | lcov-html 7 | -------------------------------------------------------------------------------- /deps/jemalloc/test/src/btalloc_0.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | btalloc_n_gen(0) 4 | -------------------------------------------------------------------------------- /deps/jemalloc/test/src/btalloc_1.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | btalloc_n_gen(1) 4 | -------------------------------------------------------------------------------- /deps/license/keycheck.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | bool FValidKey(const char *key, size_t cch); 4 | -------------------------------------------------------------------------------- /deps/lua/doc/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/deps/lua/doc/cover.png -------------------------------------------------------------------------------- /deps/lua/test/life.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/deps/lua/test/life.lua -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/src/math.c: -------------------------------------------------------------------------------- 1 | #define MATH_C_ 2 | #include "test/jemalloc_test.h" 3 | -------------------------------------------------------------------------------- /tests/assets/nodefaultuser.acl: -------------------------------------------------------------------------------- 1 | user alice on nopass ~* +@all 2 | user bob on nopass ~* &* +@all -------------------------------------------------------------------------------- /deps/license/x64/libkey.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/deps/license/x64/libkey.a -------------------------------------------------------------------------------- /fuzz/rdb/testcases/set.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/fuzz/rdb/testcases/set.rdb -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/gbp.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | debian-branch=debian/sid 3 | upstream-branch=upstream/sid 4 | -------------------------------------------------------------------------------- /tests/assets/encodings.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/tests/assets/encodings.rdb -------------------------------------------------------------------------------- /tests/sentinel/tests/03-runtime-reconf.tcl: -------------------------------------------------------------------------------- 1 | # Test runtime reconfiguration command SENTINEL SET. 2 | -------------------------------------------------------------------------------- /deps/license/arm64/libkey.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/deps/license/arm64/libkey.a -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/src/btalloc_0.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | btalloc_n_gen(0) 4 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/src/btalloc_1.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | btalloc_n_gen(1) 4 | -------------------------------------------------------------------------------- /fuzz/rdb/testcases/empty.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/fuzz/rdb/testcases/empty.rdb -------------------------------------------------------------------------------- /fuzz/rdb/testcases/expire.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/fuzz/rdb/testcases/expire.rdb -------------------------------------------------------------------------------- /fuzz/rdb/testcases/string.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/fuzz/rdb/testcases/string.rdb -------------------------------------------------------------------------------- /tests/assets/hash-zipmap.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/tests/assets/hash-zipmap.rdb -------------------------------------------------------------------------------- /tests/assets/redis-save.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/tests/assets/redis-save.rdb -------------------------------------------------------------------------------- /fuzz/rdb/testcases/integer.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/fuzz/rdb/testcases/integer.rdb -------------------------------------------------------------------------------- /fuzz/rdb/testcases/multidb.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/fuzz/rdb/testcases/multidb.rdb -------------------------------------------------------------------------------- /fuzz/rdb/testcases/replica.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/fuzz/rdb/testcases/replica.rdb -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/arena_reset_prof.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export MALLOC_CONF="prof:true,lg_prof_sample:0" 4 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/source/include-binaries: -------------------------------------------------------------------------------- 1 | keydb_5.0.6.orig.tar.gz 2 | keydb_5.0.6-1chl1~bionic1.debian.tar.xz 3 | -------------------------------------------------------------------------------- /tests/assets/corrupt_ziplist.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/tests/assets/corrupt_ziplist.rdb -------------------------------------------------------------------------------- /tests/assets/redis-module-save.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/tests/assets/redis-module-save.rdb -------------------------------------------------------------------------------- /deps/lua/test/echo.lua: -------------------------------------------------------------------------------- 1 | -- echo command line arguments 2 | 3 | for i=0,table.getn(arg) do 4 | print(i,arg[i]) 5 | end 6 | -------------------------------------------------------------------------------- /deps/lua/test/hello.lua: -------------------------------------------------------------------------------- 1 | -- the first program in every language 2 | 3 | io.write("Hello world, from ",_VERSION,"!\n") 4 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/msvc/projects/vc2015/test_threads/test_threads.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | int test_threads(); 4 | -------------------------------------------------------------------------------- /fuzz/rdb/testcases/expireonload.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/fuzz/rdb/testcases/expireonload.rdb -------------------------------------------------------------------------------- /tests/assets/corrupt_empty_keys.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/tests/assets/corrupt_empty_keys.rdb -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/arena_reset_prof.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export MALLOC_CONF="prof:true,lg_prof_sample:0" 4 | -------------------------------------------------------------------------------- /fuzz/rdb/testcases/integer_shared.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/fuzz/rdb/testcases/integer_shared.rdb -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-server.install: -------------------------------------------------------------------------------- 1 | debian/keydb-server.service /lib/systemd/system/ 2 | pkg/deb/conf/keydb.conf /etc/keydb 3 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/binshard.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export MALLOC_CONF="narenas:1,bin_shards:1-160:16|129-512:4|256-256:8" 4 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/decay.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export MALLOC_CONF="dirty_decay_ms:1000,muzzy_decay_ms:1000,lg_tcache_max:0" 4 | -------------------------------------------------------------------------------- /deps/memkind/src/src/.memkind_pmem.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/deps/memkind/src/src/.memkind_pmem.c.swp -------------------------------------------------------------------------------- /pkg/deb/debian/tests/0002-benchmark: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Run the benchmarking 4 | 5 | set -eu 6 | 7 | keydb-benchmark -P 10 8 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-server.install: -------------------------------------------------------------------------------- 1 | debian/keydb-server.service /lib/systemd/system 2 | pkg/deb/conf/keydb.conf /etc/keydb 3 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-sentinel.install: -------------------------------------------------------------------------------- 1 | debian/keydb-sentinel.service /lib/systemd/system/ 2 | pkg/deb/conf/sentinel.conf /etc/keydb 3 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-sentinel.install: -------------------------------------------------------------------------------- 1 | debian/keydb-sentinel.service /lib/systemd/system 2 | pkg/deb/conf/sentinel.conf /etc/keydb 3 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/tests/0002-benchmark: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Run the benchmarking 4 | 5 | set -eu 6 | 7 | keydb-benchmark -P 10 8 | -------------------------------------------------------------------------------- /pkg/deb/debian/tests/0003-keydb-check-aof: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Smoke test keydb-check-aof 4 | 5 | keydb-check-aof 2>&1 | grep -qsi usage: 6 | -------------------------------------------------------------------------------- /deps/jemalloc/.autom4te.cfg: -------------------------------------------------------------------------------- 1 | begin-language: "Autoconf-without-aclocal-m4" 2 | args: --no-cache 3 | end-language: "Autoconf-without-aclocal-m4" 4 | -------------------------------------------------------------------------------- /deps/jemalloc/test/integration/extent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="junk:false" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/jemalloc/test/integration/mallocx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="junk:false" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/jemalloc/test/integration/xallocx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="junk:false" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/arena_reset_prof.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | #define ARENA_RESET_PROF_C_ 3 | 4 | #include "arena_reset.c" 5 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/decay.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export MALLOC_CONF="dirty_decay_ms:1000,muzzy_decay_ms:1000,lg_tcache_max:0" 4 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-tools.manpages: -------------------------------------------------------------------------------- 1 | debian/keydb-benchmark.1 2 | debian/keydb-check-aof.1 3 | debian/keydb-check-rdb.1 4 | debian/keydb-cli.1 5 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/tests/0003-keydb-check-aof: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Smoke test keydb-check-aof 4 | 5 | keydb-check-aof 2>&1 | grep -qsi usage: 6 | -------------------------------------------------------------------------------- /tests/assets/user.acl: -------------------------------------------------------------------------------- 1 | user alice on allcommands allkeys >alice 2 | user bob on -@all +@set +acl ~set* >bob 3 | user default on nopass ~* +@all 4 | -------------------------------------------------------------------------------- /deps/hiredis/.gitignore: -------------------------------------------------------------------------------- 1 | /hiredis-test 2 | /examples/hiredis-example* 3 | /*.o 4 | /*.so 5 | /*.dylib 6 | /*.a 7 | /*.pc 8 | *.dSYM 9 | tags 10 | -------------------------------------------------------------------------------- /deps/jemalloc/test/integration/smallocx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="junk:false" 5 | fi 6 | -------------------------------------------------------------------------------- /pkg/deb/debian/source/lintian-overrides: -------------------------------------------------------------------------------- 1 | # Upstream do not provide signed tarballs. 2 | keydb-pro source: debian-watch-does-not-check-gpg-signature 3 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-tools.manpages: -------------------------------------------------------------------------------- 1 | debian/keydb-benchmark.1 2 | debian/keydb-check-aof.1 3 | debian/keydb-check-rdb.1 4 | debian/keydb-cli.1 5 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/source/lintian-overrides: -------------------------------------------------------------------------------- 1 | # Upstream do not provide signed tarballs. 2 | keydb source: debian-watch-does-not-check-gpg-signature 3 | -------------------------------------------------------------------------------- /src/t_nhash.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void freeNestedHashObject(robj_roptr o); 4 | 5 | void nhsetCommand(client *c); 6 | void nhgetCommand(client *c); 7 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/prof_log.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/.autom4te.cfg: -------------------------------------------------------------------------------- 1 | begin-language: "Autoconf-without-aclocal-m4" 2 | args: --no-cache 3 | end-language: "Autoconf-without-aclocal-m4" 4 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/arena_reset_prof.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | #define ARENA_RESET_PROF_C_ 3 | 4 | #include "arena_reset.c" 5 | -------------------------------------------------------------------------------- /pkg/deb/debian/tests/0001-keydb-cli: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Show the INFO from "keydb-cli" 4 | 5 | set -eu 6 | 7 | keydb-cli INFO 8 | keydb-cli LOLWUT 9 | -------------------------------------------------------------------------------- /pkg/deb/debian/watch: -------------------------------------------------------------------------------- 1 | version=6 2 | opts=uversionmangle=s/-?(alpha|beta|rc)/~$1/ \ 3 | https://github.com/EQ-Alpha/KeyDB/releases .*/archive/(.*).tar.gz 4 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/tests/0001-keydb-cli: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Show the INFO from "keydb-cli" 4 | 5 | set -eu 6 | 7 | keydb-cli INFO 8 | keydb-cli LOLWUT 9 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/junk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="abort:false,zero:false,junk:true" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/pack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Immediately purge to minimize fragmentation. 4 | export MALLOC_CONF="dirty_decay_ms:0,muzzy_decay_ms:0" 5 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/prof_tctx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/safety_check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/zero.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="abort:false,junk:false,zero:true" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/src/spin.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_SPIN_C_ 2 | #include "jemalloc/internal/jemalloc_preamble.h" 3 | 4 | #include "jemalloc/internal/spin.h" 5 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/integration/extent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="junk:false" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/integration/mallocx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="junk:false" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/integration/xallocx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="junk:false" 5 | fi 6 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/watch: -------------------------------------------------------------------------------- 1 | version=4 2 | opts=uversionmangle=s/-?(alpha|beta|rc)/~$1/ \ 3 | https://github.com/EQ-Alpha/KeyDB/releases .*/archive/(.*).tar.gz 4 | -------------------------------------------------------------------------------- /deps/jemalloc/src/hash.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_HASH_C_ 2 | #include "jemalloc/internal/jemalloc_preamble.h" 3 | #include "jemalloc/internal/jemalloc_internal_includes.h" 4 | -------------------------------------------------------------------------------- /deps/jemalloc/src/prng.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_PRNG_C_ 2 | #include "jemalloc/internal/jemalloc_preamble.h" 3 | #include "jemalloc/internal/jemalloc_internal_includes.h" 4 | -------------------------------------------------------------------------------- /deps/jemalloc/test/integration/slab_sizes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Some screwy-looking slab sizes. 4 | export MALLOC_CONF="slab_sizes:1-4096:17|100-200:1|128-128:2" 5 | -------------------------------------------------------------------------------- /deps/jemalloc/test/src/btalloc.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | void * 4 | btalloc(size_t size, unsigned bits) { 5 | return btalloc_0(size, bits); 6 | } 7 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/junk_alloc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="abort:false,zero:false,junk:alloc" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/junk_free.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="abort:false,zero:false,junk:free" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/prof_thread_name.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_active:false" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/jemalloc/src/ticker.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_TICKER_C_ 2 | #include "jemalloc/internal/jemalloc_preamble.h" 3 | #include "jemalloc/internal/jemalloc_internal_includes.h" 4 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/junk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="abort:false,zero:false,junk:true" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/pack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Immediately purge to minimize fragmentation. 4 | export MALLOC_CONF="dirty_decay_ms:0,muzzy_decay_ms:0" 5 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/prof_tctx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/zero.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="abort:false,junk:false,zero:true" 5 | fi 6 | -------------------------------------------------------------------------------- /src/storage/rocksdbfactory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class IStorageFactory *CreateRocksDBStorageFactory(const char *path, int dbnum, const char *rgchConfig, size_t cchConfig); -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/private_namespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for symbol in `cat "$@"` ; do 4 | echo "#define ${symbol} JEMALLOC_N(${symbol})" 5 | done 6 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/prof_reset.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_active:false,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/junk_free.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="abort:false,zero:false,junk:free" 5 | fi 6 | -------------------------------------------------------------------------------- /pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man1/keydb-cli.1.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man1/keydb-cli.1.gz -------------------------------------------------------------------------------- /pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man5/keydb.conf.5.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man5/keydb.conf.5.gz -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other_stuff.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other 3 | about: Can't find the right issue type? Use this one! 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/prof_gdump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_active:false,prof_gdump:true" 5 | fi 6 | 7 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/src/hash.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_HASH_C_ 2 | #include "jemalloc/internal/jemalloc_preamble.h" 3 | #include "jemalloc/internal/jemalloc_internal_includes.h" 4 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/src/prng.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_PRNG_C_ 2 | #include "jemalloc/internal/jemalloc_preamble.h" 3 | #include "jemalloc/internal/jemalloc_internal_includes.h" 4 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/src/btalloc.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | void * 4 | btalloc(size_t size, unsigned bits) { 5 | return btalloc_0(size, bits); 6 | } 7 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/junk_alloc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="abort:false,zero:false,junk:alloc" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/prof_thread_name.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_active:false" 5 | fi 6 | -------------------------------------------------------------------------------- /pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man1/keydb-server.1.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man1/keydb-server.1.gz -------------------------------------------------------------------------------- /tests/assets/minimal.conf: -------------------------------------------------------------------------------- 1 | # Minimal configuration for testing. 2 | bind 127.0.0.1 3 | always-show-logo yes 4 | daemonize no 5 | pidfile /var/run/keydb.pid 6 | loglevel verbose 7 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/private_namespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for symbol in `cat "$@"` ; do 4 | echo "#define ${symbol} JEMALLOC_N(${symbol})" 5 | done 6 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/src/ticker.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_TICKER_C_ 2 | #include "jemalloc/internal/jemalloc_preamble.h" 3 | #include "jemalloc/internal/jemalloc_internal_includes.h" 4 | -------------------------------------------------------------------------------- /pkg/deb/debian/tests/control: -------------------------------------------------------------------------------- 1 | Tests: 0001-keydb-cli 2 | 3 | Tests: 0002-benchmark 4 | 5 | Tests: 0003-keydb-check-aof 6 | 7 | Tests: 0004-keydb-check-rdb 8 | Restrictions: needs-root 9 | -------------------------------------------------------------------------------- /pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man1/keydb-benchmark.1.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man1/keydb-benchmark.1.gz -------------------------------------------------------------------------------- /pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man1/keydb-check-aof.1.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man1/keydb-check-aof.1.gz -------------------------------------------------------------------------------- /pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man1/keydb-check-rdb.1.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man1/keydb-check-rdb.1.gz -------------------------------------------------------------------------------- /pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man1/keydb-sentinel.1.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man1/keydb-sentinel.1.gz -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/prof_active.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_thread_active_init:false,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/prof_reset.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_active:false,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-sentinel.logrotate: -------------------------------------------------------------------------------- 1 | /var/log/keydb/keydb-sentinel*.log { 2 | weekly 3 | missingok 4 | rotate 12 5 | compress 6 | notifempty 7 | } 8 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-server.logrotate: -------------------------------------------------------------------------------- 1 | /var/log/keydb/keydb-server*.log { 2 | weekly 3 | missingok 4 | rotate 12 5 | compress 6 | notifempty 7 | } 8 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-server.logrotate: -------------------------------------------------------------------------------- 1 | /var/log/keydb/keydb-server*.log { 2 | weekly 3 | missingok 4 | rotate 12 5 | compress 6 | notifempty 7 | } 8 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/tests/control: -------------------------------------------------------------------------------- 1 | Tests: 0001-keydb-cli 2 | 3 | Tests: 0002-benchmark 4 | 5 | Tests: 0003-keydb-check-aof 6 | 7 | Tests: 0004-keydb-check-rdb 8 | Restrictions: needs-root 9 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/public_unnamespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for nm in `cat $1` ; do 4 | n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` 5 | echo "#undef je_${n}" 6 | done 7 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/prof_accum.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/prof_gdump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_active:false,prof_gdump:true" 5 | fi 6 | 7 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-sentinel.logrotate: -------------------------------------------------------------------------------- 1 | /var/log/keydb/keydb-sentinel*.log { 2 | weekly 3 | missingok 4 | rotate 12 5 | compress 6 | notifempty 7 | } 8 | -------------------------------------------------------------------------------- /pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man5/keydb-sentinel.conf.5.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/KeyDB/HEAD/pkg/rpm/keydb_build/keydb_rpm/usr/share/man/man5/keydb-sentinel.conf.5.gz -------------------------------------------------------------------------------- /deps/cpp-statsd-client/cmake/cpp-statsd-clientConfig.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") 4 | check_required_components("@PROJECT_NAME@") 5 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/prof_active.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_thread_active_init:false,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/jemalloc/include/msvc_compat/windows_extra.h: -------------------------------------------------------------------------------- 1 | #ifndef MSVC_COMPAT_WINDOWS_EXTRA_H 2 | #define MSVC_COMPAT_WINDOWS_EXTRA_H 3 | 4 | #include 5 | 6 | #endif /* MSVC_COMPAT_WINDOWS_EXTRA_H */ 7 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/public_unnamespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for nm in `cat $1` ; do 4 | n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` 5 | echo "#undef je_${n}" 6 | done 7 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/prof_accum.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/public_namespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for nm in `cat $1` ; do 4 | n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` 5 | echo "#define je_${n} JEMALLOC_N(${n})" 6 | done 7 | -------------------------------------------------------------------------------- /deps/memkind/Makefile: -------------------------------------------------------------------------------- 1 | export JE_PREFIX=jemk_ 2 | 3 | .PHONY: all 4 | all: 5 | cd src; ./build_jemalloc.sh 6 | cd src; ./build.sh 7 | 8 | .PHONY: clean 9 | clean: 10 | cd src; make clean 11 | 12 | 13 | -------------------------------------------------------------------------------- /deps/lua/test/printf.lua: -------------------------------------------------------------------------------- 1 | -- an implementation of printf 2 | 3 | function printf(...) 4 | io.write(string.format(...)) 5 | end 6 | 7 | printf("Hello %s from %s on %s\n",os.getenv"USER" or "there",_VERSION,os.date()) 8 | -------------------------------------------------------------------------------- /deps/memkind/src/debian/changelog: -------------------------------------------------------------------------------- 1 | memkind (0.0.0) UNRELEASED; urgency=low 2 | 3 | * See ChangeLog for more details 4 | 5 | -- Krzysztof Kulakowski Mon, 12 Dec 2016 15:53:31 +0000 6 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/msvc_compat/windows_extra.h: -------------------------------------------------------------------------------- 1 | #ifndef MSVC_COMPAT_WINDOWS_EXTRA_H 2 | #define MSVC_COMPAT_WINDOWS_EXTRA_H 3 | 4 | #include 5 | 6 | #endif /* MSVC_COMPAT_WINDOWS_EXTRA_H */ 7 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/public_namespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for nm in `cat $1` ; do 4 | n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` 5 | echo "#define je_${n} JEMALLOC_N(${n})" 6 | done 7 | -------------------------------------------------------------------------------- /pkg/rpm/keydb_build/keydb_rpm/etc/logrotate.d/keydb: -------------------------------------------------------------------------------- 1 | /var/log/keydb/*.log { 2 | weekly 3 | rotate 10 4 | copytruncate 5 | delaycompress 6 | compress 7 | notifempty 8 | missingok 9 | } 10 | -------------------------------------------------------------------------------- /deps/jemalloc/bin/jemalloc.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | 7 | @LD_PRELOAD_VAR@=${libdir}/libjemalloc.@SOREV@ 8 | export @LD_PRELOAD_VAR@ 9 | exec "$@" 10 | -------------------------------------------------------------------------------- /deps/lua/test/env.lua: -------------------------------------------------------------------------------- 1 | -- read environment variables as if they were global variables 2 | 3 | local f=function (t,i) return os.getenv(i) end 4 | setmetatable(getfenv(),{__index=f}) 5 | 6 | -- an example 7 | print(a,USER,PATH) 8 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-tools.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | if [ "${1}" = "purge" ] 6 | then 7 | userdel keydb || true 8 | rm -rf /var/lib/keydb /var/log/keydb 9 | fi 10 | 11 | #DEBHELPER# 12 | 13 | exit 0 14 | -------------------------------------------------------------------------------- /tests/integration/rdb-repl-tests: -------------------------------------------------------------------------------- 1 | diskless no replicas drop during rdb pipe 2 | diskless slow replicas drop during rdb pipe 3 | diskless timeout replicas drop during rdb pipe 4 | Kill rdb child process if its dumping RDB is not useful -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-tools.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | if [ "${1}" = "purge" ] 6 | then 7 | userdel keydb || true 8 | rm -rf /var/lib/keydb /var/log/keydb 9 | fi 10 | 11 | #DEBHELPER# 12 | 13 | exit 0 14 | -------------------------------------------------------------------------------- /tests/unit/printver.tcl: -------------------------------------------------------------------------------- 1 | start_server {} { 2 | set i [r info] 3 | regexp {redis_version:(.*?)\r\n} $i - version 4 | regexp {redis_git_sha1:(.*?)\r\n} $i - sha1 5 | puts "Testing Redis version $version ($sha1)" 6 | } 7 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/bin/jemalloc.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | 7 | @LD_PRELOAD_VAR@=${libdir}/libjemalloc.@SOREV@ 8 | export @LD_PRELOAD_VAR@ 9 | exec "$@" 10 | -------------------------------------------------------------------------------- /deps/memkind/src/test/memkind-afts-ext.ts: -------------------------------------------------------------------------------- 1 | /usr/share/mpss/test/memkind-dt/all_tests -a --gtest_filter=-PerformanceTest.* 2 | /usr/share/mpss/test/memkind-dt/decorator_test -a 3 | /usr/share/mpss/test/memkind-dt/gb_page_tests_bind_policy -a 4 | -------------------------------------------------------------------------------- /deps/memkind/src/test/memkind-perf-ext.ts: -------------------------------------------------------------------------------- 1 | /usr/share/mpss/test/memkind-dt/all_tests -a --gtest_filter=PerformanceTest.* 2 | /usr/share/mpss/test/memkind-dt/allocator_perf_tool_tests -a --gtest_filter=HeapManagerInitPerfTest*:AllocPerformanceTest* 3 | -------------------------------------------------------------------------------- /pkg/deb/debian/tests/0004-keydb-check-rdb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Test keydb-check-rdb 4 | 5 | set -eu 6 | 7 | # Perform a synchronous save to ensure .rdb file eixsts 8 | keydb-cli SAVE 9 | 10 | keydb-check-rdb /var/lib/keydb/dump.rdb 11 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/tests/0004-keydb-check-rdb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Test keydb-check-rdb 4 | 5 | set -eu 6 | 7 | # Perform a synchronous save to ensure .rdb file eixsts 8 | keydb-cli SAVE 9 | 10 | keydb-check-rdb /var/lib/keydb/dump.rdb 11 | -------------------------------------------------------------------------------- /src/keydbutils.cpp: -------------------------------------------------------------------------------- 1 | #include "server.h" 2 | 3 | namespace keydbutils 4 | { 5 | template<> 6 | size_t hash(const sdsview& t) 7 | { 8 | return (size_t)dictGenHashFunction(static_cast(t), t.size()); 9 | } 10 | } -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/rocksdb"] 2 | path = deps/rocksdb 3 | url = https://github.com/facebook/rocksdb.git 4 | [submodule "deps/depot_tools"] 5 | path = deps/depot_tools 6 | url = https://chromium.googlesource.com/chromium/tools/depot_tools.git 7 | -------------------------------------------------------------------------------- /deps/jemalloc/doc/manpages.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /deps/lua/etc/lua.hpp: -------------------------------------------------------------------------------- 1 | // lua.hpp 2 | // Lua header files for C++ 3 | // <> not supplied automatically because Lua also compiles as C++ 4 | 5 | extern "C" { 6 | #include "lua.h" 7 | #include "lualib.h" 8 | #include "lauxlib.h" 9 | } 10 | -------------------------------------------------------------------------------- /deps/memkind/src/test/memkind-perf.ts: -------------------------------------------------------------------------------- 1 | /usr/share/mpss/test/memkind-dt/all_tests -a --gtest_filter=PerformanceTest.* 2 | /usr/share/mpss/test/memkind-dt/allocator_perf_tool_tests -a --gtest_filter=HeapManagerInitPerfTest*:AllocPerformanceTest*:-*.*ext* 3 | -------------------------------------------------------------------------------- /machamp_scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # make the build 4 | git submodule init && git submodule update 5 | make BUILD_TLS=yes ENABLE_FLASH=yes -j$(nproc) KEYDB_CFLAGS='-Werror' KEYDB_CXXFLAGS='-Werror' 6 | 7 | # gen-cert 8 | ./utils/gen-test-certs.sh -------------------------------------------------------------------------------- /fuzz/rdb/dict.txt: -------------------------------------------------------------------------------- 1 | ="repl-stream-db" 2 | ="repl-id" 3 | ="repl-offset" 4 | ="lua" 5 | ="redis-ver" 6 | ="ctime" 7 | ="used-mem" 8 | ="aof-preamble" 9 | ="redis-bits" 10 | ="mvcc-tstamp" 11 | ="keydb-subexpire-key" 12 | ="keydb-subexpire-when" 13 | 14 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/doc/manpages.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-server.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | CONFFILE="/etc/keydb/keydb.conf" 6 | 7 | if [ "${1}" = "purge" ] 8 | then 9 | dpkg-statoverride --remove ${CONFFILE} || test $? -eq 2 10 | fi 11 | 12 | #DEBHELPER# 13 | 14 | exit 0 15 | -------------------------------------------------------------------------------- /tests/sentinel/tests/04-slave-selection.tcl: -------------------------------------------------------------------------------- 1 | # Test slave selection algorithm. 2 | # 3 | # This unit should test: 4 | # 1) That when there are no suitable slaves no failover is performed. 5 | # 2) That among the available slaves, the one with better offset is picked. 6 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Top level makefile, this just calls into src/Makefile where the real work is done. Changes should be made there. 2 | 3 | default: all 4 | 5 | .DEFAULT: 6 | cd src && $(MAKE) $@ 7 | 8 | install: 9 | cd src && $(MAKE) $@ 10 | 11 | .PHONY: install 12 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/prof_idump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export MALLOC_CONF="tcache:false" 4 | if [ "x${enable_prof}" = "x1" ] ; then 5 | export MALLOC_CONF="${MALLOC_CONF},prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0,lg_prof_interval:0" 6 | fi 7 | 8 | 9 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-sentinel.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | CONFFILE="/etc/keydb/sentinel.conf" 6 | 7 | if [ "$1" = "purge" ] 8 | then 9 | dpkg-statoverride --remove ${CONFFILE} || test $? -eq 2 10 | fi 11 | 12 | #DEBHELPER# 13 | 14 | exit 0 15 | -------------------------------------------------------------------------------- /deps/lua/test/luac.lua: -------------------------------------------------------------------------------- 1 | -- bare-bones luac in Lua 2 | -- usage: lua luac.lua file.lua 3 | 4 | assert(arg[1]~=nil and arg[2]==nil,"usage: lua luac.lua file.lua") 5 | f=assert(io.open("luac.out","wb")) 6 | assert(f:write(string.dump(assert(loadfile(arg[1]))))) 7 | assert(f:close()) 8 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/base_types.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_BASE_TYPES_H 2 | #define JEMALLOC_INTERNAL_BASE_TYPES_H 3 | 4 | typedef struct base_block_s base_block_t; 5 | typedef struct base_s base_t; 6 | 7 | #endif /* JEMALLOC_INTERNAL_BASE_TYPES_H */ 8 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/prof_idump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export MALLOC_CONF="tcache:false" 4 | if [ "x${enable_prof}" = "x1" ] ; then 5 | export MALLOC_CONF="${MALLOC_CONF},prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0,lg_prof_interval:0" 6 | fi 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/unit/type/list-common.tcl: -------------------------------------------------------------------------------- 1 | # We need a value larger than list-max-ziplist-value to make sure 2 | # the list has the right encoding when it is swapped in again. 3 | array set largevalue {} 4 | set largevalue(ziplist) "hello" 5 | set largevalue(linkedlist) [string repeat "hello" 4] 6 | -------------------------------------------------------------------------------- /deps/jemalloc/doc/html.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /deps/memkind/src/test/memkind-slts.ts: -------------------------------------------------------------------------------- 1 | /usr/share/mpss/test/memkind-dt/allocator_perf_tool_tests -a --gtest_filter=AllocateToMaxStressTests*:-HugePageTest* 2 | /usr/share/mpss/test/memkind-dt/allocator_perf_tool_tests -a --gtest_filter=HugePageTest* --gtest_repeat=10 --gtest_break_on_failure 3 | -------------------------------------------------------------------------------- /src/motd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | extern const char *motd_url; 4 | extern const char *motd_cache_file; 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | char *fetchMOTD(int fCache, int enable_motd); 10 | void freeMOTD(const char*); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | -------------------------------------------------------------------------------- /deps/hiredis/fmacros.h: -------------------------------------------------------------------------------- 1 | #ifndef __HIREDIS_FMACRO_H 2 | #define __HIREDIS_FMACRO_H 3 | 4 | #define _XOPEN_SOURCE 600 5 | #define _POSIX_C_SOURCE 200112L 6 | 7 | #if defined(__APPLE__) && defined(__MACH__) 8 | /* Enable TCP_KEEPALIVE */ 9 | #define _DARWIN_C_SOURCE 10 | #endif 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /deps/jemalloc/test/include/test/thd.h: -------------------------------------------------------------------------------- 1 | /* Abstraction layer for threading in tests. */ 2 | #ifdef _WIN32 3 | typedef HANDLE thd_t; 4 | #else 5 | typedef pthread_t thd_t; 6 | #endif 7 | 8 | void thd_create(thd_t *thd, void *(*proc)(void *), void *arg); 9 | void thd_join(thd_t thd, void **ret); 10 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-sentinel.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | CONFFILE="/etc/keydb/sentinel.conf" 6 | 7 | if [ "$1" = "purge" ] 8 | then 9 | dpkg-statoverride --remove ${CONFFILE} || test $? -eq 2 10 | fi 11 | 12 | #DEBHELPER# 13 | 14 | systemctl daemon-reload 15 | 16 | exit 0 17 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-server.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | CONFFILE="/etc/keydb/keydb.conf" 6 | 7 | if [ "${1}" = "purge" ] 8 | then 9 | dpkg-statoverride --remove ${CONFFILE} || test $? -eq 2 10 | fi 11 | 12 | #DEBHELPER# 13 | 14 | systemctl daemon-reload 15 | 16 | exit 0 17 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/patches/series: -------------------------------------------------------------------------------- 1 | 0001-fix-ftbfs-on-kfreebsd.patch 2 | #debian-packaging/0003-dpkg-buildflags.patch 3 | #debian-packaging/0007-Set-Debian-configuration-defaults.patch 4 | #0010-Use-get_current_dir_name-over-PATHMAX-etc.patch 5 | #0011-Add-support-for-a-USE_SYSTEM_LUA-flag.patch 6 | #test 7 | -------------------------------------------------------------------------------- /deps/jemalloc/msvc/test_threads/test_threads_main.cpp: -------------------------------------------------------------------------------- 1 | #include "test_threads.h" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std::chrono_literals; 7 | 8 | int main(int argc, char** argv) { 9 | int rc = test_threads(); 10 | return rc; 11 | } 12 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/doc/html.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/base_inlines.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_BASE_INLINES_H 2 | #define JEMALLOC_INTERNAL_BASE_INLINES_H 3 | 4 | static inline unsigned 5 | base_ind_get(const base_t *base) { 6 | return base->ind; 7 | } 8 | 9 | #endif /* JEMALLOC_INTERNAL_BASE_INLINES_H */ 10 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/include/test/thd.h: -------------------------------------------------------------------------------- 1 | /* Abstraction layer for threading in tests. */ 2 | #ifdef _WIN32 3 | typedef HANDLE thd_t; 4 | #else 5 | typedef pthread_t thd_t; 6 | #endif 7 | 8 | void thd_create(thd_t *thd, void *(*proc)(void *), void *arg); 9 | void thd_join(thd_t thd, void **ret); 10 | -------------------------------------------------------------------------------- /pkg/rpm/keydb_build/keydb_rpm/etc/systemd/system/keydb.service.d/limit.conf: -------------------------------------------------------------------------------- 1 | # If you need to change max open file limit 2 | # for example, when you change maxclient in configuration 3 | # you can change the LimitNOFILE value below 4 | # see "man systemd.exec" for information 5 | 6 | [Service] 7 | LimitNOFILE=10240 8 | -------------------------------------------------------------------------------- /tests/unit/moduleapi/basics.tcl: -------------------------------------------------------------------------------- 1 | set testmodule [file normalize tests/modules/basics.so] 2 | 3 | 4 | start_server {tags {"modules"}} { 5 | r module load $testmodule 6 | 7 | test {test module api basics} { 8 | r test.basics 9 | } {ALL TESTS PASSED} 10 | 11 | r module unload test 12 | } 13 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-tools.install: -------------------------------------------------------------------------------- 1 | debian/bash_completion.d/* /usr/share/bash-completion/completions 2 | src/keydb-benchmark /usr/bin 3 | src/keydb-check-aof /usr/bin 4 | src/keydb-check-rdb /usr/bin 5 | src/keydb-cli /usr/bin 6 | src/keydb-server /usr/bin 7 | src/keydb-sentinel /usr/bin 8 | src/keydb-diagnostic-tool /usr/bin 9 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-server.maintscript: -------------------------------------------------------------------------------- 1 | rm_conffile /etc/keydb/keydb-server.post-down.d/00_example 4:4.0.2-3~ 2 | rm_conffile /etc/keydb/keydb-server.post-up.d/00_example 4:4.0.2-3~ 3 | rm_conffile /etc/keydb/keydb-server.pre-down.d/00_example 4:4.0.2-3~ 4 | rm_conffile /etc/keydb/keydb-server.pre-up.d/00_example 4:4.0.2-3~ 5 | -------------------------------------------------------------------------------- /pkg/rpm/keydb_build/keydb_rpm/etc/systemd/system/keydb-sentinel.service.d/limit.conf: -------------------------------------------------------------------------------- 1 | # If you need to change max open file limit 2 | # for example, when you change maxclient in configuration 3 | # you can change the LimitNOFILE value below 4 | # see "man systemd.exec" for information 5 | 6 | [Service] 7 | LimitNOFILE=10240 8 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/a0.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_a0) { 4 | void *p; 5 | 6 | p = a0malloc(1); 7 | assert_ptr_not_null(p, "Unexpected a0malloc() error"); 8 | a0dalloc(p); 9 | } 10 | TEST_END 11 | 12 | int 13 | main(void) { 14 | return test_no_malloc_init( 15 | test_a0); 16 | } 17 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/msvc/projects/vc2015/test_threads/test_threads_main.cpp: -------------------------------------------------------------------------------- 1 | #include "test_threads.h" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std::chrono_literals; 7 | 8 | int main(int argc, char** argv) { 9 | int rc = test_threads(); 10 | return rc; 11 | } 12 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-server.default: -------------------------------------------------------------------------------- 1 | # keydb-server configure options 2 | 3 | # ULIMIT: Call ulimit -n with this argument prior to invoking Redis itself. 4 | # This may be required for high-concurrency environments. KeyDB itself cannot 5 | # alter its limits as it is not being run as root. (default: 65536) 6 | # 7 | ULIMIT=65536 8 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-tools.install: -------------------------------------------------------------------------------- 1 | debian/bash_completion.d/* /usr/share/bash-completion/completions 2 | src/keydb-server /usr/bin 3 | src/keydb-benchmark /usr/bin 4 | src/keydb-check-aof /usr/bin 5 | src/keydb-check-rdb /usr/bin 6 | src/keydb-cli /usr/bin 7 | src/keydb-sentinel /usr/bin 8 | src/keydb-diagnostic-tool /usr/bin 9 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-sentinel.maintscript: -------------------------------------------------------------------------------- 1 | rm_conffile /etc/keydb/keydb-sentinel.post-down.d/00_example 4:4.0.2-3~ 2 | rm_conffile /etc/keydb/keydb-sentinel.post-up.d/00_example 4:4.0.2-3~ 3 | rm_conffile /etc/keydb/keydb-sentinel.pre-down.d/00_example 4:4.0.2-3~ 4 | rm_conffile /etc/keydb/keydb-sentinel.pre-up.d/00_example 4:4.0.2-3~ 5 | -------------------------------------------------------------------------------- /deps/lua/test/fibfor.lua: -------------------------------------------------------------------------------- 1 | -- example of for with generator functions 2 | 3 | function generatefib (n) 4 | return coroutine.wrap(function () 5 | local a,b = 1, 1 6 | while a <= n do 7 | coroutine.yield(a) 8 | a, b = b, a+b 9 | end 10 | end) 11 | end 12 | 13 | for i in generatefib(1000) do print(i) end 14 | -------------------------------------------------------------------------------- /deps/lua/test/readonly.lua: -------------------------------------------------------------------------------- 1 | -- make global variables readonly 2 | 3 | local f=function (t,i) error("cannot redefine global variable `"..i.."'",2) end 4 | local g={} 5 | local G=getfenv() 6 | setmetatable(g,{__index=G,__newindex=f}) 7 | setfenv(1,g) 8 | 9 | -- an example 10 | rawset(g,"x",3) 11 | x=2 12 | y=1 -- cannot redefine `y' 13 | -------------------------------------------------------------------------------- /src/new.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include // std::size_t 3 | #include "storage.h" 4 | 5 | void *operator new(size_t size, enum MALLOC_CLASS mclass); 6 | 7 | #ifndef SANITIZE 8 | void *operator new(size_t size); 9 | 10 | void operator delete(void * p) noexcept; 11 | void operator delete(void *p, std::size_t) noexcept; 12 | #endif -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/extent_types.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_EXTENT_TYPES_H 2 | #define JEMALLOC_INTERNAL_EXTENT_TYPES_H 3 | 4 | typedef struct extent_s extent_t; 5 | typedef struct extents_s extents_t; 6 | 7 | #define EXTENT_HOOKS_INITIALIZER NULL 8 | 9 | #endif /* JEMALLOC_INTERNAL_EXTENT_TYPES_H */ 10 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/a0.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_a0) { 4 | void *p; 5 | 6 | p = a0malloc(1); 7 | assert_ptr_not_null(p, "Unexpected a0malloc() error"); 8 | a0dalloc(p); 9 | } 10 | TEST_END 11 | 12 | int 13 | main(void) { 14 | return test_no_malloc_init( 15 | test_a0); 16 | } 17 | -------------------------------------------------------------------------------- /deps/update-jemalloc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | VER=$1 3 | URL="http://www.canonware.com/download/jemalloc/jemalloc-${VER}.tar.bz2" 4 | echo "Downloading $URL" 5 | curl $URL > /tmp/jemalloc.tar.bz2 6 | tar xvjf /tmp/jemalloc.tar.bz2 7 | rm -rf jemalloc 8 | mv jemalloc-${VER} jemalloc 9 | echo "Use git status, add all files and commit changes." 10 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/tsd_types.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_TSD_TYPES_H 2 | #define JEMALLOC_INTERNAL_TSD_TYPES_H 3 | 4 | #define MALLOC_TSD_CLEANUPS_MAX 2 5 | 6 | typedef struct tsd_s tsd_t; 7 | typedef struct tsdn_s tsdn_t; 8 | typedef bool (*malloc_tsd_cleanup_t)(void); 9 | 10 | #endif /* JEMALLOC_INTERNAL_TSD_TYPES_H */ 11 | -------------------------------------------------------------------------------- /deps/lua/src/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /deps/memkind/src/test/memkind-afts.ts: -------------------------------------------------------------------------------- 1 | /usr/share/mpss/test/memkind-dt/all_tests -a --gtest_filter=-PerformanceTest.*:*.*ext* 2 | /usr/share/mpss/test/memkind-dt/decorator_test -a 3 | /usr/share/mpss/test/memkind-dt/gb_page_tests_bind_policy -a --gtest_filter=-*.*ext* 4 | /usr/share/mpss/test/memkind-dt/gb_page_tests_bind_policy -a --gtest_filter=-*.*ext* 5 | -------------------------------------------------------------------------------- /deps/jemalloc/test/integration/malloc.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_zero_alloc) { 4 | void *res = malloc(0); 5 | assert(res); 6 | size_t usable = malloc_usable_size(res); 7 | assert(usable > 0); 8 | free(res); 9 | } 10 | TEST_END 11 | 12 | int 13 | main(void) { 14 | return test( 15 | test_zero_alloc); 16 | } 17 | -------------------------------------------------------------------------------- /deps/lua/test/table.lua: -------------------------------------------------------------------------------- 1 | -- make table, grouping all data for the same item 2 | -- input is 2 columns (item, data) 3 | 4 | local A 5 | while 1 do 6 | local l=io.read() 7 | if l==nil then break end 8 | local _,_,a,b=string.find(l,'"?([_%w]+)"?%s*(.*)$') 9 | if a~=A then A=a io.write("\n",a,":") end 10 | io.write(" ",b) 11 | end 12 | io.write("\n") 13 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-sentinel.default: -------------------------------------------------------------------------------- 1 | # keydb-sentinel configure options 2 | 3 | # ULIMIT: Call ulimit -n with this argument prior to invoking KeyDB Sentinel 4 | # itself. This may be required for high-concurrency environments. KeyDB 5 | # Sentinel itself cannot alter its limits as it is not being run as root. 6 | # (default: 65536) 7 | # 8 | ULIMIT=65536 9 | -------------------------------------------------------------------------------- /runtest-cluster: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | TCL_VERSIONS="8.5 8.6" 3 | TCLSH="" 4 | 5 | for VERSION in $TCL_VERSIONS; do 6 | TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL 7 | done 8 | 9 | if [ -z $TCLSH ] 10 | then 11 | echo "You need tcl 8.5 or newer in order to run the KeyDB Cluster test" 12 | exit 1 13 | fi 14 | $TCLSH tests/cluster/run.tcl $* 15 | -------------------------------------------------------------------------------- /runtest-sentinel: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | TCL_VERSIONS="8.5 8.6" 3 | TCLSH="" 4 | 5 | for VERSION in $TCL_VERSIONS; do 6 | TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL 7 | done 8 | 9 | if [ -z $TCLSH ] 10 | then 11 | echo "You need tcl 8.5 or newer in order to run the KeyDB Sentinel test" 12 | exit 1 13 | fi 14 | $TCLSH tests/sentinel/run.tcl $* 15 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/tsd_types.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_TSD_TYPES_H 2 | #define JEMALLOC_INTERNAL_TSD_TYPES_H 3 | 4 | #define MALLOC_TSD_CLEANUPS_MAX 2 5 | 6 | typedef struct tsd_s tsd_t; 7 | typedef struct tsdn_s tsdn_t; 8 | typedef bool (*malloc_tsd_cleanup_t)(void); 9 | 10 | #endif /* JEMALLOC_INTERNAL_TSD_TYPES_H */ 11 | -------------------------------------------------------------------------------- /deps/jemalloc/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in autoconf; do 4 | echo "$i" 5 | $i 6 | if [ $? -ne 0 ]; then 7 | echo "Error $? in $i" 8 | exit 1 9 | fi 10 | done 11 | 12 | echo "./configure --enable-autogen $@" 13 | ./configure --enable-autogen $@ 14 | if [ $? -ne 0 ]; then 15 | echo "Error $? in ./configure" 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /deps/hdr_histogram/Makefile: -------------------------------------------------------------------------------- 1 | STD= 2 | WARN= -Wall 3 | OPT= -Os 4 | 5 | R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) 6 | R_LDFLAGS= $(LDFLAGS) 7 | DEBUG= -g 8 | 9 | R_CC=$(CC) $(R_CFLAGS) 10 | R_LD=$(CC) $(R_LDFLAGS) 11 | 12 | hdr_histogram.o: hdr_histogram.h hdr_histogram.c 13 | 14 | .c.o: 15 | $(R_CC) -c $< 16 | 17 | clean: 18 | rm -f *.o 19 | 20 | 21 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/spin.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #include "jemalloc/internal/spin.h" 4 | 5 | TEST_BEGIN(test_spin) { 6 | spin_t spinner = SPIN_INITIALIZER; 7 | 8 | for (unsigned i = 0; i < 100; i++) { 9 | spin_adaptive(&spinner); 10 | } 11 | } 12 | TEST_END 13 | 14 | int 15 | main(void) { 16 | return test( 17 | test_spin); 18 | } 19 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in autoconf; do 4 | echo "$i" 5 | $i 6 | if [ $? -ne 0 ]; then 7 | echo "Error $? in $i" 8 | exit 1 9 | fi 10 | done 11 | 12 | echo "./configure --enable-autogen $@" 13 | ./configure --enable-autogen $@ 14 | if [ $? -ne 0 ]; then 15 | echo "Error $? in ./configure" 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /deps/jemalloc/test/include/test/jemalloc_test_defs.h.in: -------------------------------------------------------------------------------- 1 | #include "jemalloc/internal/jemalloc_internal_defs.h" 2 | #include "jemalloc/internal/jemalloc_internal_decls.h" 3 | 4 | /* 5 | * For use by SFMT. configure.ac doesn't actually define HAVE_SSE2 because its 6 | * dependencies are notoriously unportable in practice. 7 | */ 8 | #undef HAVE_SSE2 9 | #undef HAVE_ALTIVEC 10 | -------------------------------------------------------------------------------- /deps/hiredis/hiredis_ssl.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | pkgincludedir=${includedir}/hiredis 6 | 7 | Name: hiredis_ssl 8 | Description: SSL Support for hiredis. 9 | Version: @PROJECT_VERSION@ 10 | Requires: hiredis 11 | Libs: -L${libdir} -lhiredis_ssl 12 | Libs.private: -lssl -lcrypto 13 | -------------------------------------------------------------------------------- /deps/lua/test/cf.lua: -------------------------------------------------------------------------------- 1 | -- temperature conversion table (celsius to farenheit) 2 | 3 | for c0=-20,50-1,10 do 4 | io.write("C ") 5 | for c=c0,c0+10-1 do 6 | io.write(string.format("%3.0f ",c)) 7 | end 8 | io.write("\n") 9 | 10 | io.write("F ") 11 | for c=c0,c0+10-1 do 12 | f=(9/5)*c+32 13 | io.write(string.format("%3.0f ",f)) 14 | end 15 | io.write("\n\n") 16 | end 17 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/spin.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #include "jemalloc/internal/spin.h" 4 | 5 | TEST_BEGIN(test_spin) { 6 | spin_t spinner = SPIN_INITIALIZER; 7 | 8 | for (unsigned i = 0; i < 100; i++) { 9 | spin_adaptive(&spinner); 10 | } 11 | } 12 | TEST_END 13 | 14 | int 15 | main(void) { 16 | return test( 17 | test_spin); 18 | } 19 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/NEWS: -------------------------------------------------------------------------------- 1 | keydb (4:4.0.2-3) unstable; urgency=medium 2 | 3 | This version drops the Debian-specific support for the 4 | /etc/keydb/keydb-{server,sentinel}.{pre,post}-{up,down}.d directories in 5 | favour of using systemd's ExecStartPre, ExecStartPost, ExecStopPre, 6 | ExecStopPost commands. 7 | 8 | -- Chris Lamb Wed, 11 Oct 2017 22:55:00 -0400 9 | -------------------------------------------------------------------------------- /pkg/docker/README.md: -------------------------------------------------------------------------------- 1 | This Dockerfile will clone the KeyDB repo, build, and generate a Docker image you can use 2 | 3 | To build, use experimental mode to enable use of build args. Tag the build and specify branch name. The command below will generate your docker image: 4 | 5 | ``` 6 | DOCKER_CLI_EXPERIMENTAL=enabled docker build --build-arg BRANCH= -t 7 | ``` 8 | -------------------------------------------------------------------------------- /deps/memkind/src/copying_headers/MANIFEST.freeBSD3: -------------------------------------------------------------------------------- 1 | examples/pmem_kinds.c 2 | examples/pmem_malloc.c 3 | examples/pmem_malloc_unlimited.c 4 | examples/pmem_usable_size.c 5 | examples/pmem_alignment.c 6 | examples/pmem_and_default_kind 7 | examples/pmem_multithreads.c 8 | examples/pmem_multithreads_onekind.c 9 | examples/pmem_free_with_unknown_kind.c 10 | examples/pmem_cpp_allocator.cpp 11 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/include/test/jemalloc_test_defs.h.in: -------------------------------------------------------------------------------- 1 | #include "jemalloc/internal/jemalloc_internal_defs.h" 2 | #include "jemalloc/internal/jemalloc_internal_decls.h" 3 | 4 | /* 5 | * For use by SFMT. configure.ac doesn't actually define HAVE_SSE2 because its 6 | * dependencies are notoriously unportable in practice. 7 | */ 8 | #undef HAVE_SSE2 9 | #undef HAVE_ALTIVEC 10 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/arena_structs_a.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_ARENA_STRUCTS_A_H 2 | #define JEMALLOC_INTERNAL_ARENA_STRUCTS_A_H 3 | 4 | #include "jemalloc/internal/bitmap.h" 5 | 6 | struct arena_slab_data_s { 7 | /* Per region allocated/deallocated bitmap. */ 8 | bitmap_t bitmap[BITMAP_GROUPS_MAX]; 9 | }; 10 | 11 | #endif /* JEMALLOC_INTERNAL_ARENA_STRUCTS_A_H */ 12 | -------------------------------------------------------------------------------- /deps/jemalloc/test/include/test/timer.h: -------------------------------------------------------------------------------- 1 | /* Simple timer, for use in benchmark reporting. */ 2 | 3 | typedef struct { 4 | nstime_t t0; 5 | nstime_t t1; 6 | } timedelta_t; 7 | 8 | void timer_start(timedelta_t *timer); 9 | void timer_stop(timedelta_t *timer); 10 | uint64_t timer_usec(const timedelta_t *timer); 11 | void timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen); 12 | -------------------------------------------------------------------------------- /deps/cpp-statsd-client/.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: [push, pull_request] 4 | jobs: 5 | lint: 6 | runs-on: ubuntu-20.04 7 | steps: 8 | - uses: actions/checkout@v2 9 | - name: lint 10 | uses: DoozyX/clang-format-lint-action@v0.12 11 | with: 12 | clangFormatVersion: 12 13 | source: './include/cpp-statsd-client ./tests' 14 | -------------------------------------------------------------------------------- /deps/hiredis/hiredis-config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | set_and_check(hiredis_INCLUDEDIR "@PACKAGE_INCLUDE_INSTALL_DIR@") 4 | 5 | IF (NOT TARGET hiredis::hiredis) 6 | INCLUDE(${CMAKE_CURRENT_LIST_DIR}/hiredis-targets.cmake) 7 | ENDIF() 8 | 9 | SET(hiredis_LIBRARIES hiredis::hiredis) 10 | SET(hiredis_INCLUDE_DIRS ${hiredis_INCLUDEDIR}) 11 | 12 | check_required_components(hiredis) 13 | 14 | -------------------------------------------------------------------------------- /tests/unit/replication.tcl: -------------------------------------------------------------------------------- 1 | 2 | start_server {tags {"repl"}} { 3 | test "incr of expired key on replica doesn't cause a crash" { 4 | r debug force-master yes 5 | r set testkey 1 6 | r pexpire testkey 1 7 | after 500 8 | r incr testkey 9 | r incr testkey 10 | r debug force-master no 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/arena_structs_a.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_ARENA_STRUCTS_A_H 2 | #define JEMALLOC_INTERNAL_ARENA_STRUCTS_A_H 3 | 4 | #include "jemalloc/internal/bitmap.h" 5 | 6 | struct arena_slab_data_s { 7 | /* Per region allocated/deallocated bitmap. */ 8 | bitmap_t bitmap[BITMAP_GROUPS_MAX]; 9 | }; 10 | 11 | #endif /* JEMALLOC_INTERNAL_ARENA_STRUCTS_A_H */ 12 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/stats_tsd.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_STATS_TSD_H 2 | #define JEMALLOC_INTERNAL_STATS_TSD_H 3 | 4 | typedef struct tcache_bin_stats_s { 5 | /* 6 | * Number of allocation requests that corresponded to the size of this 7 | * bin. 8 | */ 9 | uint64_t nrequests; 10 | } tcache_bin_stats_t; 11 | 12 | #endif /* JEMALLOC_INTERNAL_STATS_TSD_H */ 13 | -------------------------------------------------------------------------------- /pkg/rpm/README.md: -------------------------------------------------------------------------------- 1 | ### Generate RPM files for the generated binaries 2 | 3 | After making the binaries you can run the following script 4 | 5 | Usage: 6 | ``` 7 | $ cd KeyDB/pkg/rpm 8 | $ sudo ./generate-rpms.sh 9 | ``` 10 | 11 | This rpm script is currently tested on centos 7 and centos 8 builds 12 | 13 | Dependencies: 14 | ``` 15 | yum install -y scl-utils centos-release-scl rpm-build 16 | ``` 17 | -------------------------------------------------------------------------------- /src/crc64.h: -------------------------------------------------------------------------------- 1 | #ifndef CRC64_H 2 | #define CRC64_H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void crc64_init(void); 11 | uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l); 12 | 13 | #ifdef REDIS_TEST 14 | int crc64Test(int argc, char *argv[], int accurate); 15 | #endif 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/include/test/timer.h: -------------------------------------------------------------------------------- 1 | /* Simple timer, for use in benchmark reporting. */ 2 | 3 | typedef struct { 4 | nstime_t t0; 5 | nstime_t t1; 6 | } timedelta_t; 7 | 8 | void timer_start(timedelta_t *timer); 9 | void timer_stop(timedelta_t *timer); 10 | uint64_t timer_usec(const timedelta_t *timer); 11 | void timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen); 12 | -------------------------------------------------------------------------------- /runtest: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | TCL_VERSIONS="8.5 8.6" 3 | TCLSH="" 4 | 5 | export ASAN_OPTIONS=allocator_may_return_null=1 $ASAN_OPTIONS 6 | 7 | for VERSION in $TCL_VERSIONS; do 8 | TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL 9 | done 10 | 11 | if [ -z $TCLSH ] 12 | then 13 | echo "You need tcl 8.5 or newer in order to run the KeyDB test" 14 | exit 1 15 | fi 16 | $TCLSH tests/test_helper.tcl "${@}" 17 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/base_inlines.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_BASE_INLINES_H 2 | #define JEMALLOC_INTERNAL_BASE_INLINES_H 3 | 4 | static inline unsigned 5 | base_ind_get(const base_t *base) { 6 | return base->ind; 7 | } 8 | 9 | static inline bool 10 | metadata_thp_enabled(void) { 11 | return (opt_metadata_thp != metadata_thp_disabled); 12 | } 13 | #endif /* JEMALLOC_INTERNAL_BASE_INLINES_H */ 14 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/extent_mmap.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_EXTENT_MMAP_EXTERNS_H 2 | #define JEMALLOC_INTERNAL_EXTENT_MMAP_EXTERNS_H 3 | 4 | extern bool opt_retain; 5 | 6 | void *extent_alloc_mmap(void *new_addr, size_t size, size_t alignment, 7 | bool *zero, bool *commit); 8 | bool extent_dalloc_mmap(void *addr, size_t size); 9 | 10 | #endif /* JEMALLOC_INTERNAL_EXTENT_MMAP_EXTERNS_H */ 11 | -------------------------------------------------------------------------------- /src/cron.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct cronjob 4 | { 5 | sdsstring script; 6 | uint64_t interval; 7 | uint64_t startTime; 8 | std::vector veckeys; 9 | std::vector vecargs; 10 | int dbNum = 0; 11 | bool fSingleShot = false; 12 | }; 13 | 14 | void freeCronObject(robj_roptr o); 15 | void executeCronJobExpireHook(const char *key, robj *o); 16 | void cronCommand(client *c); -------------------------------------------------------------------------------- /tests/sentinel/tests/includes/sentinel.conf: -------------------------------------------------------------------------------- 1 | # assume master is down after being unresponsive for 20s 2 | sentinel down-after-milliseconds setmaster 20000 3 | # reconfigure one slave at a time 4 | sentinel parallel-syncs setmaster 2 5 | # wait for 4m before assuming failover went wrong 6 | sentinel failover-timeout setmaster 240000 7 | # monitoring set 8 | sentinel monitor setmaster 10.0.0.1 30000 2 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/modules/keydb_modstatsd/Makefile: -------------------------------------------------------------------------------- 1 | MODULE_FLAGS := -fPIC -O2 -Wall -Werror 2 | 3 | OBJECT_FILES := modmain.o 4 | MODSNAP_CXX_FLAGS := -std=gnu++14 5 | 6 | %.o: %.cpp 7 | $(CXX) -o $@ -c $< $(MODULE_FLAGS) -I../../../deps/cpp-statsd-client/include $(MODSNAP_CXX_FLAGS) -g 8 | 9 | modstatsd.so: $(OBJECT_FILES) 10 | $(CXX) -shared $(OBJECT_FILES) -o modstatsd.so 11 | 12 | clean: 13 | rm -f $(OBJECT_FILES) modstatsd.so 14 | -------------------------------------------------------------------------------- /utils/releasetools/01_create_tarball.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ $# != "1" ] 3 | then 4 | echo "Usage: ./utils/releasetools/01_create_tarball.sh " 5 | exit 1 6 | fi 7 | 8 | TAG=$1 9 | TARNAME="redis-${TAG}.tar" 10 | echo "Generating /tmp/${TARNAME}" 11 | git archive $TAG --prefix redis-${TAG}/ > /tmp/$TARNAME || exit 1 12 | echo "Gizipping the archive" 13 | rm -f /tmp/$TARNAME.gz 14 | gzip -9 /tmp/$TARNAME 15 | -------------------------------------------------------------------------------- /deps/hiredis/hiredis_ssl-config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | set_and_check(hiredis_ssl_INCLUDEDIR "@PACKAGE_INCLUDE_INSTALL_DIR@") 4 | 5 | IF (NOT TARGET hiredis::hiredis_ssl) 6 | INCLUDE(${CMAKE_CURRENT_LIST_DIR}/hiredis_ssl-targets.cmake) 7 | ENDIF() 8 | 9 | SET(hiredis_ssl_LIBRARIES hiredis::hiredis_ssl) 10 | SET(hiredis_ssl_INCLUDE_DIRS ${hiredis_ssl_INCLUDEDIR}) 11 | 12 | check_required_components(hiredis_ssl) 13 | 14 | -------------------------------------------------------------------------------- /deps/linenoise/Makefile: -------------------------------------------------------------------------------- 1 | STD= 2 | WARN= -Wall 3 | OPT= -Os 4 | 5 | R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) 6 | R_LDFLAGS= $(LDFLAGS) 7 | DEBUG= -g 8 | 9 | R_CC=$(CC) $(R_CFLAGS) 10 | R_LD=$(CC) $(R_LDFLAGS) 11 | 12 | linenoise.o: linenoise.h linenoise.c 13 | 14 | linenoise_example: linenoise.o example.o 15 | $(R_LD) -o $@ $^ 16 | 17 | .c.o: 18 | $(R_CC) -c $< 19 | 20 | clean: 21 | rm -f linenoise_example *.o 22 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/extent_mmap.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_EXTENT_MMAP_EXTERNS_H 2 | #define JEMALLOC_INTERNAL_EXTENT_MMAP_EXTERNS_H 3 | 4 | extern bool opt_retain; 5 | 6 | void *extent_alloc_mmap(void *new_addr, size_t size, size_t alignment, 7 | bool *zero, bool *commit); 8 | bool extent_dalloc_mmap(void *addr, size_t size); 9 | 10 | #endif /* JEMALLOC_INTERNAL_EXTENT_MMAP_EXTERNS_H */ 11 | -------------------------------------------------------------------------------- /deps/hiredis/hiredis.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | install_libdir=@CMAKE_INSTALL_LIBDIR@ 3 | exec_prefix=${prefix} 4 | libdir=${exec_prefix}/${install_libdir} 5 | includedir=${prefix}/include 6 | pkgincludedir=${includedir}/hiredis 7 | 8 | Name: hiredis 9 | Description: Minimalistic C client library for Redis. 10 | Version: @PROJECT_VERSION@ 11 | Libs: -L${libdir} -lhiredis 12 | Cflags: -I${pkgincludedir} -D_FILE_OFFSET_BITS=64 13 | -------------------------------------------------------------------------------- /deps/lua/test/xd.lua: -------------------------------------------------------------------------------- 1 | -- hex dump 2 | -- usage: lua xd.lua < file 3 | 4 | local offset=0 5 | while true do 6 | local s=io.read(16) 7 | if s==nil then return end 8 | io.write(string.format("%08X ",offset)) 9 | string.gsub(s,"(.)", 10 | function (c) io.write(string.format("%02X ",string.byte(c))) end) 11 | io.write(string.rep(" ",3*(16-string.len(s)))) 12 | io.write(" ",string.gsub(s,"%c","."),"\n") 13 | offset=offset+16 14 | end 15 | -------------------------------------------------------------------------------- /tests/helpers/bg_complex_data.tcl: -------------------------------------------------------------------------------- 1 | source tests/support/keydb.tcl 2 | source tests/support/util.tcl 3 | 4 | set ::tlsdir "tests/tls" 5 | 6 | proc bg_complex_data {host port db ops tls} { 7 | set r [redis $host $port 0 $tls] 8 | $r client setname LOAD_HANDLER 9 | $r select $db 10 | createComplexDataset $r $ops 11 | } 12 | 13 | bg_complex_data [lindex $argv 0] [lindex $argv 1] [lindex $argv 2] [lindex $argv 3] [lindex $argv 4] 14 | -------------------------------------------------------------------------------- /deps/lua/doc/manual.css: -------------------------------------------------------------------------------- 1 | h3 code { 2 | font-family: inherit ; 3 | font-size: inherit ; 4 | } 5 | 6 | pre, code { 7 | font-size: 12pt ; 8 | } 9 | 10 | span.apii { 11 | float: right ; 12 | font-family: inherit ; 13 | font-style: normal ; 14 | font-size: small ; 15 | color: gray ; 16 | } 17 | 18 | p+h1, ul+h1 { 19 | padding-top: 0.4em ; 20 | padding-bottom: 0.4em ; 21 | padding-left: 30px ; 22 | margin-left: -30px ; 23 | background-color: #E0E0FF ; 24 | } 25 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/jemalloc.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | install_suffix=@install_suffix@ 6 | 7 | Name: jemalloc 8 | Description: A general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. 9 | URL: http://jemalloc.net/ 10 | Version: @jemalloc_version@ 11 | Cflags: -I${includedir} 12 | Libs: -L${libdir} -ljemalloc${install_suffix} 13 | -------------------------------------------------------------------------------- /utils/hashtable/README: -------------------------------------------------------------------------------- 1 | Hash table implementation related utilities. 2 | 3 | rehashing.c 4 | --- 5 | 6 | Visually show buckets in the two hash tables between rehashings. Also stress 7 | test getRandomKeys() implementation, that may actually disappear from 8 | Redis soon, However the visualization code is reusable in new bugs 9 | investigation. 10 | 11 | Compile with: 12 | 13 | cc -I ../../src/ rehashing.c ../../src/zmalloc.c ../../src/dict.c -o rehashing_test 14 | -------------------------------------------------------------------------------- /deps/jemalloc/doc/stylesheet.xsl: -------------------------------------------------------------------------------- 1 | 2 | ansi 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /deps/jemalloc/src/test_hooks.c: -------------------------------------------------------------------------------- 1 | #include "jemalloc/internal/jemalloc_preamble.h" 2 | 3 | /* 4 | * The hooks are a little bit screwy -- they're not genuinely exported in the 5 | * sense that we want them available to end-users, but we do want them visible 6 | * from outside the generated library, so that we can use them in test code. 7 | */ 8 | JEMALLOC_EXPORT 9 | void (*test_hooks_arena_new_hook)() = NULL; 10 | 11 | JEMALLOC_EXPORT 12 | void (*test_hooks_libc_hook)() = NULL; 13 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/src/hooks.c: -------------------------------------------------------------------------------- 1 | #include "jemalloc/internal/jemalloc_preamble.h" 2 | 3 | /* 4 | * The hooks are a little bit screwy -- they're not genuinely exported in the 5 | * sense that we want them available to end-users, but we do want them visible 6 | * from outside the generated library, so that we can use them in test code. 7 | */ 8 | JEMALLOC_EXPORT 9 | void (*hooks_arena_new_hook)() = NULL; 10 | 11 | JEMALLOC_EXPORT 12 | void (*hooks_libc_hook)() = NULL; 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/crash_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Crash report 3 | about: Submit a crash report 4 | title: '[CRASH]' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Crash report** 11 | 12 | Paste the complete crash log between the quotes below. Please include a few lines from the log preceding the crash report to provide some context. 13 | 14 | ``` 15 | ``` 16 | 17 | **Aditional information** 18 | 19 | 1. OS distribution and version 20 | 2. Steps to reproduce (if any) 21 | -------------------------------------------------------------------------------- /tests/support/tmpfile.tcl: -------------------------------------------------------------------------------- 1 | set ::tmpcounter 0 2 | set ::tmproot "./tests/tmp" 3 | file mkdir $::tmproot 4 | 5 | # returns a dirname unique to this process to write to 6 | proc tmpdir {basename} { 7 | set dir [file join $::tmproot $basename.[pid].[incr ::tmpcounter]] 8 | file mkdir $dir 9 | set _ $dir 10 | } 11 | 12 | # return a filename unique to this process to write to 13 | proc tmpfile {basename} { 14 | file join $::tmproot $basename.[pid].[incr ::tmpcounter] 15 | } 16 | -------------------------------------------------------------------------------- /deps/lua/test/globals.lua: -------------------------------------------------------------------------------- 1 | -- reads luac listings and reports global variable usage 2 | -- lines where a global is written to are marked with "*" 3 | -- typical usage: luac -p -l file.lua | lua globals.lua | sort | lua table.lua 4 | 5 | while 1 do 6 | local s=io.read() 7 | if s==nil then break end 8 | local ok,_,l,op,g=string.find(s,"%[%-?(%d*)%]%s*([GS])ETGLOBAL.-;%s+(.*)$") 9 | if ok then 10 | if op=="S" then op="*" else op="" end 11 | io.write(g,"\t",l,op,"\n") 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/doc/stylesheet.xsl: -------------------------------------------------------------------------------- 1 | 2 | ansi 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/geo.h: -------------------------------------------------------------------------------- 1 | #ifndef __GEO_H__ 2 | #define __GEO_H__ 3 | 4 | #include "server.h" 5 | 6 | /* Structures used inside geo.c in order to represent points and array of 7 | * points on the earth. */ 8 | typedef struct geoPoint { 9 | double longitude; 10 | double latitude; 11 | double dist; 12 | double score; 13 | char *member; 14 | } geoPoint; 15 | 16 | typedef struct geoArray { 17 | struct geoPoint *array; 18 | size_t buckets; 19 | size_t used; 20 | } geoArray; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/uuid.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define UUID_BINARY_LEN 16 4 | 5 | static inline int FUuidNil(unsigned char *uuid) 6 | { 7 | unsigned char val = 0; 8 | for (int i = 0; i < UUID_BINARY_LEN; ++i) 9 | val |= uuid[i]; 10 | return (val == 0); 11 | } 12 | 13 | static inline int FUuidEqual(unsigned char *uuid1, unsigned char *uuid2) 14 | { 15 | unsigned char val = 0; 16 | for (int i = 0; i < UUID_BINARY_LEN; ++i) 17 | val |= (uuid1[i] ^ uuid2[i]); 18 | return (val == 0); 19 | } -------------------------------------------------------------------------------- /src/valgrind.sup: -------------------------------------------------------------------------------- 1 | { 2 | 3 | Memcheck:Cond 4 | fun:lzf_compress 5 | } 6 | 7 | { 8 | 9 | Memcheck:Value4 10 | fun:lzf_compress 11 | } 12 | 13 | { 14 | 15 | Memcheck:Value8 16 | fun:lzf_compress 17 | } 18 | 19 | { 20 | 21 | Memcheck:FishyValue 22 | malloc(size) 23 | fun:malloc 24 | fun:ztrymalloc_usable 25 | fun:ztrymalloc 26 | } 27 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-server.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | USER="keydb" 6 | GROUP="$USER" 7 | CONFFILE="/etc/keydb/keydb.conf" 8 | 9 | if [ "$1" = "configure" ] 10 | then 11 | if ! dpkg-statoverride --list ${CONFFILE} >/dev/null 2>&1 12 | then 13 | dpkg-statoverride --update --add ${USER} ${GROUP} 640 ${CONFFILE} 14 | fi 15 | fi 16 | 17 | #DEBHELPER# 18 | 19 | if [ "$1" = "configure" ] 20 | then 21 | find /etc/keydb -maxdepth 1 -type d -name 'keydb-server.*.d' -empty -delete 22 | fi 23 | 24 | exit 0 25 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-sentinel.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | USER="keydb" 6 | GROUP="$USER" 7 | CONFFILE="/etc/keydb/sentinel.conf" 8 | 9 | if [ "$1" = "configure" ] 10 | then 11 | if ! dpkg-statoverride --list ${CONFFILE} >/dev/null 2>&1 12 | then 13 | dpkg-statoverride --update --add ${USER} ${GROUP} 640 ${CONFFILE} 14 | fi 15 | fi 16 | 17 | #DEBHELPER# 18 | 19 | if [ "$1" = "configure" ] 20 | then 21 | find /etc/keydb -maxdepth 1 -type d -name 'keydb-sentinel.*.d' -empty -delete 22 | fi 23 | 24 | exit 0 25 | -------------------------------------------------------------------------------- /deps/jemalloc/jemalloc.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | install_suffix=@install_suffix@ 6 | 7 | Name: jemalloc 8 | Description: A general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. 9 | URL: http://jemalloc.net/ 10 | Version: @jemalloc_version_major@.@jemalloc_version_minor@.@jemalloc_version_bugfix@_@jemalloc_version_nrev@ 11 | Cflags: -I${includedir} 12 | Libs: -L${libdir} -ljemalloc${install_suffix} 13 | -------------------------------------------------------------------------------- /tests/helpers/gen_climbing_load.tcl: -------------------------------------------------------------------------------- 1 | source tests/support/keydb.tcl 2 | 3 | 4 | set ::tlsdir "tests/tls" 5 | 6 | proc gen_climbing_load {host port db ops tls} { 7 | set start_time [clock seconds] 8 | set r [redis $host $port 1 $tls] 9 | $r client setname LOAD_HANDLER 10 | $r select $db 11 | set x 0 12 | while {$x < $ops} { 13 | incr x 14 | $r set [expr $x] [expr rand()] 15 | } 16 | } 17 | 18 | gen_climbing_load [lindex $argv 0] [lindex $argv 1] [lindex $argv 2] [lindex $argv 3] [lindex $argv 4] 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Help us improve KeyDB by reporting a bug 4 | title: '[BUG]' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | 12 | A short description of the bug. 13 | 14 | **To reproduce** 15 | 16 | Steps to reproduce the behavior and/or a minimal code sample. 17 | 18 | **Expected behavior** 19 | 20 | A description of what you expected to happen. 21 | 22 | **Additional information** 23 | 24 | Any additional information that is relevant to the problem. 25 | -------------------------------------------------------------------------------- /deps/hdr_histogram/README.md: -------------------------------------------------------------------------------- 1 | HdrHistogram_c v0.11.0 2 | 3 | ---------------------------------------------- 4 | 5 | This port contains a subset of the 'C' version of High Dynamic Range (HDR) Histogram available at [github.com/HdrHistogram/HdrHistogram_c](https://github.com/HdrHistogram/HdrHistogram_c). 6 | 7 | 8 | The code present on `hdr_histogram.c`, `hdr_histogram.h`, and `hdr_atomic.c` was Written by Gil Tene, Michael Barker, 9 | and Matt Warren, and released to the public domain, as explained at 10 | http://creativecommons.org/publicdomain/zero/1.0/. -------------------------------------------------------------------------------- /utils/srandmember/showfreq.rb: -------------------------------------------------------------------------------- 1 | require 'redis' 2 | 3 | r = Redis.new 4 | r.select(9) 5 | r.del("myset"); 6 | r.sadd("myset",(0..999).to_a) 7 | freq = {} 8 | 500.times { 9 | res = r.pipelined { 10 | 1000.times { 11 | r.srandmember("myset") 12 | } 13 | } 14 | res.each{|ele| 15 | freq[ele] = 0 if freq[ele] == nil 16 | freq[ele] += 1 17 | } 18 | } 19 | 20 | # Print the frequency each element was yeld to process it with gnuplot 21 | freq.each{|item,count| 22 | puts "#{item} #{count}" 23 | } 24 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-server.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | USER="keydb" 6 | GROUP="$USER" 7 | CONFFILE="/etc/keydb/keydb.conf" 8 | 9 | if [ "$1" = "configure" ] 10 | then 11 | if ! dpkg-statoverride --list ${CONFFILE} >/dev/null 2>&1 12 | then 13 | dpkg-statoverride --update --add ${USER} ${GROUP} 640 ${CONFFILE} 14 | fi 15 | fi 16 | 17 | #DEBHELPER# 18 | 19 | if [ "$1" = "configure" ] 20 | then 21 | find /etc/keydb -maxdepth 1 -type d -name 'keydb-server.*.d' -empty -delete 22 | fi 23 | 24 | systemctl daemon-reload 25 | 26 | exit 0 27 | -------------------------------------------------------------------------------- /utils/releasetools/04_release_hash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ $# != "1" ] 3 | then 4 | echo "Usage: ./utils/releasetools/04_release_hash.sh " 5 | exit 1 6 | fi 7 | 8 | SHA=$(curl -s http://download.redis.io/releases/redis-${1}.tar.gz | shasum -a 256 | cut -f 1 -d' ') 9 | ENTRY="hash redis-${1}.tar.gz sha256 $SHA http://download.redis.io/releases/redis-${1}.tar.gz" 10 | echo $ENTRY >> ../redis-hashes/README 11 | echo "Press any key to commit, Ctrl-C to abort)." 12 | read yes 13 | (cd ../redis-hashes; git commit -a -m "${1} hash."; git push) 14 | -------------------------------------------------------------------------------- /tests/helpers/gen_write_load.tcl: -------------------------------------------------------------------------------- 1 | source tests/support/keydb.tcl 2 | 3 | set ::tlsdir "tests/tls" 4 | 5 | proc gen_write_load {host port seconds tls} { 6 | set start_time [clock seconds] 7 | set r [redis $host $port 1 $tls] 8 | $r client setname LOAD_HANDLER 9 | $r select 9 10 | while 1 { 11 | $r set [expr rand()] [expr rand()] 12 | if {[clock seconds]-$start_time > $seconds} { 13 | exit 0 14 | } 15 | } 16 | } 17 | 18 | gen_write_load [lindex $argv 0] [lindex $argv 1] [lindex $argv 2] [lindex $argv 3] 19 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-sentinel.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | USER="keydb" 6 | GROUP="$USER" 7 | CONFFILE="/etc/keydb/sentinel.conf" 8 | 9 | if [ "$1" = "configure" ] 10 | then 11 | if ! dpkg-statoverride --list ${CONFFILE} >/dev/null 2>&1 12 | then 13 | dpkg-statoverride --update --add ${USER} ${GROUP} 640 ${CONFFILE} 14 | fi 15 | fi 16 | 17 | #DEBHELPER# 18 | 19 | if [ "$1" = "configure" ] 20 | then 21 | find /etc/keydb -maxdepth 1 -type d -name 'keydb-sentinel.*.d' -empty -delete 22 | fi 23 | 24 | systemctl daemon-reload 25 | 26 | exit 0 27 | -------------------------------------------------------------------------------- /tests/unit/moduleapi/zset.tcl: -------------------------------------------------------------------------------- 1 | set testmodule [file normalize tests/modules/zset.so] 2 | 3 | start_server {tags {"modules"}} { 4 | r module load $testmodule 5 | 6 | test {Module zset rem} { 7 | r del k 8 | r zadd k 100 hello 200 world 9 | assert_equal 1 [r zset.rem k hello] 10 | assert_equal 0 [r zset.rem k hello] 11 | assert_equal 1 [r exists k] 12 | # Check that removing the last element deletes the key 13 | assert_equal 1 [r zset.rem k world] 14 | assert_equal 0 [r exists k] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/assets/default.conf: -------------------------------------------------------------------------------- 1 | # KeyDB configuration for testing. 2 | 3 | always-show-logo yes 4 | notify-keyspace-events KEA 5 | daemonize no 6 | pidfile /var/run/keydb.pid 7 | port 6379 8 | timeout 0 9 | bind 127.0.0.1 10 | loglevel verbose 11 | logfile '' 12 | databases 16 13 | latency-monitor-threshold 1 14 | 15 | save 900 1 16 | save 300 10 17 | save 60 10000 18 | 19 | rdbcompression yes 20 | dbfilename dump.rdb 21 | dir ./ 22 | 23 | slave-serve-stale-data yes 24 | appendonly no 25 | appendfsync everysec 26 | no-appendfsync-on-rewrite no 27 | activerehashing yes 28 | 29 | -------------------------------------------------------------------------------- /tests/cluster/tests/helpers/onlydots.tcl: -------------------------------------------------------------------------------- 1 | # Read the standard input and only shows dots in the output, filtering out 2 | # all the other characters. Designed to avoid bufferization so that when 3 | # we get the output of keydb-trib and want to show just the dots, we'll see 4 | # the dots as soon as keydb-trib will output them. 5 | 6 | fconfigure stdin -buffering none 7 | 8 | while 1 { 9 | set c [read stdin 1] 10 | if {$c eq {}} { 11 | exit 0; # EOF 12 | } elseif {$c eq {.}} { 13 | puts -nonewline . 14 | flush stdout 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /deps/jemalloc/include/msvc_compat/C99/stdbool.h: -------------------------------------------------------------------------------- 1 | #ifndef stdbool_h 2 | #define stdbool_h 3 | 4 | #include 5 | 6 | /* MSVC doesn't define _Bool or bool in C, but does have BOOL */ 7 | /* Note this doesn't pass autoconf's test because (bool) 0.5 != true */ 8 | /* Clang-cl uses MSVC headers, so needs msvc_compat, but has _Bool as 9 | * a built-in type. */ 10 | #ifndef __clang__ 11 | typedef BOOL _Bool; 12 | #endif 13 | 14 | #define bool _Bool 15 | #define true 1 16 | #define false 0 17 | 18 | #define __bool_true_false_are_defined 1 19 | 20 | #endif /* stdbool_h */ 21 | -------------------------------------------------------------------------------- /deps/jemalloc/src/mutex_pool.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_MUTEX_POOL_C_ 2 | 3 | #include "jemalloc/internal/jemalloc_preamble.h" 4 | #include "jemalloc/internal/jemalloc_internal_includes.h" 5 | 6 | #include "jemalloc/internal/mutex.h" 7 | #include "jemalloc/internal/mutex_pool.h" 8 | 9 | bool 10 | mutex_pool_init(mutex_pool_t *pool, const char *name, witness_rank_t rank) { 11 | for (int i = 0; i < MUTEX_POOL_SIZE; ++i) { 12 | if (malloc_mutex_init(&pool->mutexes[i], name, rank, 13 | malloc_mutex_address_ordered)) { 14 | return true; 15 | } 16 | } 17 | return false; 18 | } 19 | -------------------------------------------------------------------------------- /deps/jemalloc/test/integration/cpp/basic.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "test/jemalloc_test.h" 3 | 4 | TEST_BEGIN(test_basic) { 5 | auto foo = new long(4); 6 | assert_ptr_not_null(foo, "Unexpected new[] failure"); 7 | delete foo; 8 | // Test nullptr handling. 9 | foo = nullptr; 10 | delete foo; 11 | 12 | auto bar = new long; 13 | assert_ptr_not_null(bar, "Unexpected new failure"); 14 | delete bar; 15 | // Test nullptr handling. 16 | bar = nullptr; 17 | delete bar; 18 | } 19 | TEST_END 20 | 21 | int 22 | main() { 23 | return test( 24 | test_basic); 25 | } 26 | -------------------------------------------------------------------------------- /deps/cpp-statsd-client/.github/workflows/windows.yml: -------------------------------------------------------------------------------- 1 | name: Windows 2 | 3 | on: [push, pull_request] 4 | jobs: 5 | windows: 6 | runs-on: windows-latest 7 | steps: 8 | - uses: actions/checkout@v2 9 | - name: dependencies 10 | run: | 11 | choco install cmake 12 | - name: build 13 | run: | 14 | cmake -S . -B build -G "Visual Studio 16 2019" -A x64 15 | cmake --build build --target ALL_BUILD --config Release 16 | - name: test 17 | run: | 18 | cmake --build build --target RUN_TESTS --config Release 19 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/bin_types.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_BIN_TYPES_H 2 | #define JEMALLOC_INTERNAL_BIN_TYPES_H 3 | 4 | #include "jemalloc/internal/sc.h" 5 | 6 | #define BIN_SHARDS_MAX (1 << EXTENT_BITS_BINSHARD_WIDTH) 7 | #define N_BIN_SHARDS_DEFAULT 1 8 | 9 | /* Used in TSD static initializer only. Real init in arena_bind(). */ 10 | #define TSD_BINSHARDS_ZERO_INITIALIZER {{UINT8_MAX}} 11 | 12 | typedef struct tsd_binshards_s tsd_binshards_t; 13 | struct tsd_binshards_s { 14 | uint8_t binshard[SC_NBINS]; 15 | }; 16 | 17 | #endif /* JEMALLOC_INTERNAL_BIN_TYPES_H */ 18 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/msvc_compat/C99/stdbool.h: -------------------------------------------------------------------------------- 1 | #ifndef stdbool_h 2 | #define stdbool_h 3 | 4 | #include 5 | 6 | /* MSVC doesn't define _Bool or bool in C, but does have BOOL */ 7 | /* Note this doesn't pass autoconf's test because (bool) 0.5 != true */ 8 | /* Clang-cl uses MSVC headers, so needs msvc_compat, but has _Bool as 9 | * a built-in type. */ 10 | #ifndef __clang__ 11 | typedef BOOL _Bool; 12 | #endif 13 | 14 | #define bool _Bool 15 | #define true 1 16 | #define false 0 17 | 18 | #define __bool_true_false_are_defined 1 19 | 20 | #endif /* stdbool_h */ 21 | -------------------------------------------------------------------------------- /deps/memkind/src/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | # Uncomment this to turn on verbose mode. 5 | #export DH_VERBOSE=1 6 | 7 | # ignore tests during build 8 | override_dh_auto_test: 9 | 10 | override_dh_auto_configure: 11 | ./build_jemalloc.sh 12 | ./autogen.sh 13 | dh_auto_configure -- --prefix=/usr --libdir=/usr/lib \ 14 | --includedir=/usr/include --sbindir=/usr/sbin --enable-cxx11 \ 15 | --mandir=/usr/share/man --docdir=/usr/share/doc/memkind 16 | 17 | override_dh_auto_build: 18 | dh_auto_build -- checkprogs 19 | 20 | %: 21 | dh $@ 22 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/src/mutex_pool.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_MUTEX_POOL_C_ 2 | 3 | #include "jemalloc/internal/jemalloc_preamble.h" 4 | #include "jemalloc/internal/jemalloc_internal_includes.h" 5 | 6 | #include "jemalloc/internal/mutex.h" 7 | #include "jemalloc/internal/mutex_pool.h" 8 | 9 | bool 10 | mutex_pool_init(mutex_pool_t *pool, const char *name, witness_rank_t rank) { 11 | for (int i = 0; i < MUTEX_POOL_SIZE; ++i) { 12 | if (malloc_mutex_init(&pool->mutexes[i], name, rank, 13 | malloc_mutex_address_ordered)) { 14 | return true; 15 | } 16 | } 17 | return false; 18 | } 19 | -------------------------------------------------------------------------------- /deps/cpp-statsd-client/Makefile: -------------------------------------------------------------------------------- 1 | # simple makefile to build, test and clean 2 | 3 | BUILD_MODE ?= Release 4 | ENABLE_COVERAGE ?= On 5 | 6 | build: clean 7 | @echo "Build in ${BUILD_MODE} mode" 8 | mkdir -p bin/${BUILD_MODE} 9 | @cd bin/${BUILD_MODE}; cmake ../../ -DCMAKE_BUILD_TYPE=${BUILD_MODE} -DENABLE_COVERAGE=${ENABLE_COVERAGE} 10 | @cd bin/${BUILD_MODE}; make 11 | 12 | test: build 13 | @cd bin/${BUILD_MODE}; make test 14 | 15 | coverage: build 16 | @cd bin/${BUILD_MODE}; make coverage 17 | 18 | install: build 19 | @cd bin/${BUILD_MODE}; make install 20 | 21 | clean: 22 | @rm -rf bin 23 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/jemalloc_rename.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | public_symbols_txt=$1 4 | 5 | cat < 8 && $c <= 10} 19 | set e 20 | } $expected_code 21 | } 22 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/msvc/ReadMe.txt: -------------------------------------------------------------------------------- 1 | 2 | How to build jemalloc for Windows 3 | ================================= 4 | 5 | 1. Install Cygwin with at least the following packages: 6 | * autoconf 7 | * autogen 8 | * gawk 9 | * grep 10 | * sed 11 | 12 | 2. Install Visual Studio 2015 with Visual C++ 13 | 14 | 3. Add Cygwin\bin to the PATH environment variable 15 | 16 | 4. Open "VS2015 x86 Native Tools Command Prompt" 17 | (note: x86/x64 doesn't matter at this point) 18 | 19 | 5. Generate header files: 20 | sh -c "CC=cl ./autogen.sh" 21 | 22 | 6. Now the project can be opened and built in Visual Studio: 23 | msvc\jemalloc_vc2015.sln 24 | 25 | -------------------------------------------------------------------------------- /utils/releasetools/03_test_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | if [ $# != "1" ] 4 | then 5 | echo "Usage: ./utils/releasetools/03_test_release.sh " 6 | exit 1 7 | fi 8 | 9 | TAG=$1 10 | TARNAME="redis-${TAG}.tar.gz" 11 | DOWNLOADURL="http://download.redis.io/releases/${TARNAME}" 12 | 13 | echo "Doing sanity test on the actual tarball" 14 | 15 | cd /tmp 16 | rm -rf test_release_tmp_dir 17 | mkdir test_release_tmp_dir 18 | cd test_release_tmp_dir 19 | rm -f $TARNAME 20 | rm -rf redis-${TAG} 21 | wget $DOWNLOADURL 22 | tar xvzf $TARNAME 23 | cd redis-${TAG} 24 | make 25 | ./runtest 26 | ./runtest-sentinel 27 | ./runtest-cluster 28 | ./runtest-moduleapi 29 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | #define KEYDB_REAL_VERSION "255.255.255" 2 | #define KEYDB_VERSION_NUM 0x00ffffff 3 | extern const char *KEYDB_SET_VERSION; // Unlike real version, this can be overriden by the config 4 | 5 | enum VersionCompareResult 6 | { 7 | EqualVersion, 8 | OlderVersion, 9 | NewerVersion, 10 | IncompatibleVersion, 11 | }; 12 | 13 | struct SymVer 14 | { 15 | long major; 16 | long minor; 17 | long build; 18 | }; 19 | 20 | #ifdef __cplusplus 21 | extern "C" 22 | { 23 | #endif 24 | 25 | struct SymVer parseVersion(const char *version); 26 | enum VersionCompareResult compareVersion(struct SymVer *pver); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /deps/jemalloc/src/safety_check.c: -------------------------------------------------------------------------------- 1 | #include "jemalloc/internal/jemalloc_preamble.h" 2 | #include "jemalloc/internal/jemalloc_internal_includes.h" 3 | 4 | static void (*safety_check_abort)(const char *message); 5 | 6 | void safety_check_set_abort(void (*abort_fn)(const char *)) { 7 | safety_check_abort = abort_fn; 8 | } 9 | 10 | void safety_check_fail(const char *format, ...) { 11 | char buf[MALLOC_PRINTF_BUFSIZE]; 12 | 13 | va_list ap; 14 | va_start(ap, format); 15 | malloc_vsnprintf(buf, MALLOC_PRINTF_BUFSIZE, format, ap); 16 | va_end(ap); 17 | 18 | if (safety_check_abort == NULL) { 19 | malloc_write(buf); 20 | abort(); 21 | } else { 22 | safety_check_abort(buf); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/patches/0001-fix-ftbfs-on-kfreebsd.patch: -------------------------------------------------------------------------------- 1 | From: Chris Lamb 2 | Date: Fri, 30 Oct 2015 10:53:42 +0000 3 | Subject: fix-ftbfs-on-kfreebsd 4 | 5 | --- 6 | src/fmacros.h | 2 +- 7 | 1 file changed, 1 insertion(+), 1 deletion(-) 8 | 9 | diff --git a/src/fmacros.h b/src/fmacros.h 10 | index 6e56c75..d490aec 100644 11 | --- a/src/fmacros.h 12 | +++ b/src/fmacros.h 13 | @@ -41,7 +41,7 @@ 14 | #define _ALL_SOURCE 15 | #endif 16 | 17 | -#if defined(__linux__) || defined(__OpenBSD__) 18 | +#if defined(__linux__) || defined(__OpenBSD__) || defined(__GLIBC__) 19 | #define _XOPEN_SOURCE 700 20 | /* 21 | * On NetBSD, _XOPEN_SOURCE undefines _NETBSD_SOURCE and 22 | -------------------------------------------------------------------------------- /utils/srandmember/README.md: -------------------------------------------------------------------------------- 1 | The utilities in this directory plot the distribution of SRANDMEMBER to 2 | evaluate how fair it is. 3 | 4 | See http://theshfl.com/redis_sets for more information on the topic that lead 5 | to such investigation fix. 6 | 7 | showdist.rb -- shows the distribution of the frequency elements are returned. 8 | The x axis is the number of times elements were returned, and 9 | the y axis is how many elements were returned with such 10 | frequency. 11 | 12 | showfreq.rb -- shows the frequency each element was returned. 13 | The x axis is the element number. 14 | The y axis is the times it was returned. 15 | -------------------------------------------------------------------------------- /utils/build-static-symbols.tcl: -------------------------------------------------------------------------------- 1 | # Build a symbol table for static symbols of redis.c 2 | # Useful to get stack traces on segfault without a debugger. See redis.c 3 | # for more information. 4 | # 5 | # Copyright(C) 2009 Salvatore Sanfilippo, under the BSD license. 6 | 7 | set fd [open redis.c] 8 | set symlist {} 9 | while {[gets $fd line] != -1} { 10 | if {[regexp {^static +[A-z0-9]+[ *]+([A-z0-9]*)\(} $line - sym]} { 11 | lappend symlist $sym 12 | } 13 | } 14 | set symlist [lsort -unique $symlist] 15 | puts "static struct redisFunctionSym symsTable\[\] = {" 16 | foreach sym $symlist { 17 | puts "{\"$sym\",(unsigned long)$sym}," 18 | } 19 | puts "{NULL,0}" 20 | puts "};" 21 | 22 | close $fd 23 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/include/test/mtx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mtx is a slightly simplified version of malloc_mutex. This code duplication 3 | * is unfortunate, but there are allocator bootstrapping considerations that 4 | * would leak into the test infrastructure if malloc_mutex were used directly 5 | * in tests. 6 | */ 7 | 8 | typedef struct { 9 | #ifdef _WIN32 10 | CRITICAL_SECTION lock; 11 | #elif (defined(JEMALLOC_OS_UNFAIR_LOCK)) 12 | os_unfair_lock lock; 13 | #elif (defined(JEMALLOC_OSSPIN)) 14 | OSSpinLock lock; 15 | #else 16 | pthread_mutex_t lock; 17 | #endif 18 | } mtx_t; 19 | 20 | bool mtx_init(mtx_t *mtx); 21 | void mtx_fini(mtx_t *mtx); 22 | void mtx_lock(mtx_t *mtx); 23 | void mtx_unlock(mtx_t *mtx); 24 | -------------------------------------------------------------------------------- /tests/sentinel/tests/includes/start-init-tests.tcl: -------------------------------------------------------------------------------- 1 | test "(start-init) Flush config and compare rewrite config file lines" { 2 | foreach_sentinel_id id { 3 | assert_match "OK" [S $id SENTINEL FLUSHCONFIG] 4 | set file1 ../tests/includes/sentinel.conf 5 | set file2 [file join "sentinel_${id}" "sentinel.conf"] 6 | set fh1 [open $file1 r] 7 | set fh2 [open $file2 r] 8 | while {[gets $fh1 line1]} { 9 | if {[gets $fh2 line2]} { 10 | assert [string equal $line1 $line2] 11 | } else { 12 | fail "sentinel config file rewrite sequence changed" 13 | } 14 | } 15 | close $fh1 16 | close $fh2 17 | } 18 | } -------------------------------------------------------------------------------- /utils/srandmember/showdist.rb: -------------------------------------------------------------------------------- 1 | require 'redis' 2 | 3 | r = Redis.new 4 | r.select(9) 5 | r.del("myset"); 6 | r.sadd("myset",(0..999).to_a) 7 | freq = {} 8 | 100.times { 9 | res = r.pipelined { 10 | 1000.times { 11 | r.srandmember("myset") 12 | } 13 | } 14 | res.each{|ele| 15 | freq[ele] = 0 if freq[ele] == nil 16 | freq[ele] += 1 17 | } 18 | } 19 | 20 | # Convert into frequency distribution 21 | dist = {} 22 | freq.each{|item,count| 23 | dist[count] = 0 if dist[count] == nil 24 | dist[count] += 1 25 | } 26 | 27 | min = dist.keys.min 28 | max = dist.keys.max 29 | (min..max).each{|x| 30 | count = dist[x] 31 | count = 0 if count == nil 32 | puts "#{x} -> #{"*"*count}" 33 | } 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest a feature for KeyDB 4 | title: '[NEW]' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **The problem/use-case that the feature addresses** 11 | 12 | A description of the problem that the feature will solve, or the use-case with which the feature will be used. 13 | 14 | **Description of the feature** 15 | 16 | A description of what you want to happen. 17 | 18 | **Alternatives you've considered** 19 | 20 | Any alternative solutions or features you've considered, including references to existing open and closed feature requests in this repository. 21 | 22 | **Additional information** 23 | 24 | Any additional information that is relevant to the feature request. 25 | -------------------------------------------------------------------------------- /deps/cpp-statsd-client/.github/workflows/linux.yml: -------------------------------------------------------------------------------- 1 | name: Linux 2 | 3 | on: [push, pull_request] 4 | jobs: 5 | linux: 6 | runs-on: ubuntu-20.04 7 | steps: 8 | - uses: actions/checkout@v2 9 | - name: dependencies 10 | shell: bash 11 | run: | 12 | sudo apt-get update 13 | sudo apt-get install -y -qq make cmake gcc g++ 14 | - name: build 15 | shell: bash 16 | run: | 17 | export LD_LIBRARY_PATH=.:$(cat /etc/ld.so.conf.d/* | grep -vF "#" | tr "\\n" ":" | sed -e "s/:$//g") 18 | cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_SANITIZERS=On 19 | make all -j$(nproc) 20 | - name: test 21 | shell: bash 22 | run: | 23 | make test 24 | -------------------------------------------------------------------------------- /deps/jemalloc/.cirrus.yml: -------------------------------------------------------------------------------- 1 | env: 2 | CIRRUS_CLONE_DEPTH: 1 3 | ARCH: amd64 4 | 5 | task: 6 | freebsd_instance: 7 | matrix: 8 | image: freebsd-12-0-release-amd64 9 | image: freebsd-11-2-release-amd64 10 | install_script: 11 | - sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf 12 | - pkg upgrade -y 13 | - pkg install -y autoconf gmake 14 | script: 15 | - autoconf 16 | #- ./configure ${COMPILER_FLAGS:+ CC="$CC $COMPILER_FLAGS" CXX="$CXX $COMPILER_FLAGS" } $CONFIGURE_FLAGS 17 | - ./configure 18 | - export JFLAG=`sysctl -n kern.smp.cpus` 19 | - gmake -j${JFLAG} 20 | - gmake -j${JFLAG} tests 21 | - gmake check 22 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-check-aof.1: -------------------------------------------------------------------------------- 1 | .TH KEYDB-CHECK-AOF 1 "August 17, 2019" 2 | .SH NAME 3 | keydb-check-aof \- Check integrity of a KeyDB .AOF file 4 | .SH SYNOPSIS 5 | .B keydb-check-aof 6 | filename 7 | .SH DESCRIPTION 8 | KeyDB is a key-value database. It is similar to memcached but the dataset is 9 | not volatile and other datatypes (such as lists and sets) are natively 10 | supported. 11 | .PP 12 | This utility checks the integrity of a dumped .AOF file. 13 | .SH AUTHOR 14 | \fBkeydb-check-aof\fP was written by John Sully, originating as a fork of Redis. Redis was written by Salvatore Sanfilippo. 15 | .PP 16 | This manual page was written by Chris Lamb for the Debian 17 | project (but may be used by others). Modified by Ben Schermel 18 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-check-aof.1: -------------------------------------------------------------------------------- 1 | .TH KEYDB-CHECK-AOF 1 "August 17, 2019" 2 | .SH NAME 3 | keydb-check-aof \- Check integrity of a KeyDB .AOF file 4 | .SH SYNOPSIS 5 | .B keydb-check-aof 6 | filename 7 | .SH DESCRIPTION 8 | KeyDB is a key-value database. It is similar to memcached but the dataset is 9 | not volatile and other datatypes (such as lists and sets) are natively 10 | supported. 11 | .PP 12 | This utility checks the integrity of a dumped .AOF file. 13 | .SH AUTHOR 14 | \fBkeydb-check-aof\fP was written by John Sully, originating as a fork of Redis. Redis was written by Salvatore Sanfilippo. 15 | .PP 16 | This manual page was written by Chris Lamb for the Debian 17 | project (but may be used by others). Modified by Ben Schermel 18 | -------------------------------------------------------------------------------- /utils/hyperloglog/hll-err.rb: -------------------------------------------------------------------------------- 1 | # hll-err.rb - Copyright (C) 2014 Salvatore Sanfilippo 2 | # BSD license, See the COPYING file for more information. 3 | # 4 | # Check error of HyperLogLog Redis implementation for different set sizes. 5 | 6 | require 'rubygems' 7 | require 'redis' 8 | require 'digest/sha1' 9 | 10 | r = Redis.new 11 | r.del('hll') 12 | i = 0 13 | while true do 14 | 100.times { 15 | elements = [] 16 | 1000.times { 17 | ele = Digest::SHA1.hexdigest(i.to_s) 18 | elements << ele 19 | i += 1 20 | } 21 | r.pfadd('hll',elements) 22 | } 23 | approx = r.pfcount('hll') 24 | abs_err = (approx-i).abs 25 | rel_err = 100.to_f*abs_err/i 26 | puts "#{i} vs #{approx}: #{rel_err}%" 27 | end 28 | -------------------------------------------------------------------------------- /deps/lua/test/bisect.lua: -------------------------------------------------------------------------------- 1 | -- bisection method for solving non-linear equations 2 | 3 | delta=1e-6 -- tolerance 4 | 5 | function bisect(f,a,b,fa,fb) 6 | local c=(a+b)/2 7 | io.write(n," c=",c," a=",a," b=",b,"\n") 8 | if c==a or c==b or math.abs(a-b) for the Debian 17 | project (but may be used by others). Modified by Ben Schermel 18 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-check-rdb.1: -------------------------------------------------------------------------------- 1 | .TH KEYDB-CHECK-RDB 1 "August 17, 2019" 2 | .SH NAME 3 | keydb-check-rdb \- Check integrity of KeyDB dumped database file 4 | .SH SYNOPSIS 5 | .B keydb-check-rdb 6 | filename 7 | .SH DESCRIPTION 8 | KeyDB is a key-value database. It is similar to memcached but the dataset is 9 | not volatile and other datatypes (such as lists and sets) are natively 10 | supported. 11 | .PP 12 | This utility checks the integrity of a dumped database file. 13 | .SH AUTHOR 14 | \fBredis-check-rdb\fP was written by John Sully, originating as a fork of Redis. Redis was written by Salvatore Sanfilippo. 15 | .PP 16 | This manual page was written by Chris Lamb for the Debian 17 | project (but may be used by others). Modified by Ben Schermel 18 | -------------------------------------------------------------------------------- /deps/hiredis/examples/example-qt.h: -------------------------------------------------------------------------------- 1 | #ifndef __HIREDIS_EXAMPLE_QT_H 2 | #define __HIREDIS_EXAMPLE_QT_H 3 | 4 | #include 5 | 6 | class ExampleQt : public QObject { 7 | 8 | Q_OBJECT 9 | 10 | public: 11 | ExampleQt(const char * value, QObject * parent = 0) 12 | : QObject(parent), m_value(value) {} 13 | 14 | signals: 15 | void finished(); 16 | 17 | public slots: 18 | void run(); 19 | 20 | private: 21 | void finish() { emit finished(); } 22 | 23 | private: 24 | const char * m_value; 25 | redisAsyncContext * m_ctx; 26 | RedisQtAdapter m_adapter; 27 | 28 | friend 29 | void getCallback(redisAsyncContext *, void *, void *); 30 | }; 31 | 32 | #endif /* !__HIREDIS_EXAMPLE_QT_H */ 33 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/spin.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_SPIN_H 2 | #define JEMALLOC_INTERNAL_SPIN_H 3 | 4 | #ifdef JEMALLOC_SPIN_C_ 5 | # define SPIN_INLINE extern inline 6 | #else 7 | # define SPIN_INLINE inline 8 | #endif 9 | 10 | #define SPIN_INITIALIZER {0U} 11 | 12 | typedef struct { 13 | unsigned iteration; 14 | } spin_t; 15 | 16 | SPIN_INLINE void 17 | spin_adaptive(spin_t *spin) { 18 | volatile uint32_t i; 19 | 20 | if (spin->iteration < 5) { 21 | for (i = 0; i < (1U << spin->iteration); i++) { 22 | CPU_SPINWAIT; 23 | } 24 | spin->iteration++; 25 | } else { 26 | #ifdef _WIN32 27 | SwitchToThread(); 28 | #else 29 | sched_yield(); 30 | #endif 31 | } 32 | } 33 | 34 | #undef SPIN_INLINE 35 | 36 | #endif /* JEMALLOC_INTERNAL_SPIN_H */ 37 | -------------------------------------------------------------------------------- /src/storage.h: -------------------------------------------------------------------------------- 1 | #ifndef __STORAGE_H__ 2 | #define __STORAGE_H__ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | enum MALLOC_CLASS 9 | { 10 | MALLOC_LOCAL, 11 | MALLOC_SHARED, 12 | }; 13 | 14 | void storage_init(const char *tmpfilePath, size_t cbFileReserve); 15 | 16 | void *salloc(size_t cb, enum MALLOC_CLASS mclass); 17 | void *scalloc(size_t cb, size_t c, enum MALLOC_CLASS mclass); 18 | void sfree(void*); 19 | void *srealloc(void *pv, size_t cb, enum MALLOC_CLASS mclass); 20 | size_t salloc_usable_size(void *ptr); 21 | 22 | struct redisObject *salloc_objembstr(); 23 | void sfree_objembstr(struct redisObject *obj); 24 | struct redisObject *salloc_obj(); 25 | void sfree_obj(struct redisObject *obj); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /utils/graphs/commits-over-time/README.md: -------------------------------------------------------------------------------- 1 | This Tcl script is what I used in order to generate the graph you 2 | can find at http://antirez.com/news/98. It's really quick & dirty, more 3 | a trow away program than anything else, but probably could be reused or 4 | modified in the future in order to visualize other similar data or an 5 | updated version of the same data. 6 | 7 | The usage is trivial: 8 | 9 | ./genhtml.tcl > output.html 10 | 11 | The generated HTML is quite broken but good enough to grab a screenshot 12 | from the browser. Feel free to improve it if you got time / interest. 13 | 14 | Note that the code filtering the tags, and the hardcoded branch name, does 15 | not make the script, as it is, able to analyze a different repository. 16 | However the changes needed are trivial. 17 | -------------------------------------------------------------------------------- /deps/lua/test/fib.lua: -------------------------------------------------------------------------------- 1 | -- fibonacci function with cache 2 | 3 | -- very inefficient fibonacci function 4 | function fib(n) 5 | N=N+1 6 | if n<2 then 7 | return n 8 | else 9 | return fib(n-1)+fib(n-2) 10 | end 11 | end 12 | 13 | -- a general-purpose value cache 14 | function cache(f) 15 | local c={} 16 | return function (x) 17 | local y=c[x] 18 | if not y then 19 | y=f(x) 20 | c[x]=y 21 | end 22 | return y 23 | end 24 | end 25 | 26 | -- run and time it 27 | function test(s,f) 28 | N=0 29 | local c=os.clock() 30 | local v=f(n) 31 | local t=os.clock()-c 32 | print(s,n,v,t,N) 33 | end 34 | 35 | n=arg[1] or 24 -- for other values, do lua fib.lua XX 36 | n=tonumber(n) 37 | print("","n","value","time","evals") 38 | test("plain",fib) 39 | fib=cache(fib) 40 | test("cached",fib) 41 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/pages.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_pages_huge) { 4 | size_t alloc_size; 5 | bool commit; 6 | void *pages, *hugepage; 7 | 8 | alloc_size = HUGEPAGE * 2 - PAGE; 9 | commit = true; 10 | pages = pages_map(NULL, alloc_size, PAGE, &commit); 11 | assert_ptr_not_null(pages, "Unexpected pages_map() error"); 12 | 13 | hugepage = (void *)(ALIGNMENT_CEILING((uintptr_t)pages, HUGEPAGE)); 14 | assert_b_ne(pages_huge(hugepage, HUGEPAGE), config_thp, 15 | "Unexpected pages_huge() result"); 16 | assert_false(pages_nohuge(hugepage, HUGEPAGE), 17 | "Unexpected pages_nohuge() result"); 18 | 19 | pages_unmap(pages, alloc_size); 20 | } 21 | TEST_END 22 | 23 | int 24 | main(void) { 25 | return test( 26 | test_pages_huge); 27 | } 28 | -------------------------------------------------------------------------------- /src/mkreleasehdr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | GIT_SHA1=`(git show-ref --head --hash=8 2> /dev/null || echo 00000000) | head -n1` 3 | GIT_DIRTY=`git diff --no-ext-diff 2> /dev/null | wc -l` 4 | BUILD_ID=`uname -n`"-"`date +%s` 5 | if [ -n "$SOURCE_DATE_EPOCH" ]; then 6 | BUILD_ID=$(date -u -d "@$SOURCE_DATE_EPOCH" +%s 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" +%s 2>/dev/null || date -u +%s) 7 | fi 8 | test -f release.h || touch release.h 9 | (cat release.h | grep SHA1 | grep $GIT_SHA1) && \ 10 | (cat release.h | grep DIRTY | grep $GIT_DIRTY) && exit 0 # Already up-to-date 11 | echo "#define REDIS_GIT_SHA1 \"$GIT_SHA1\"" > release.h 12 | echo "#define REDIS_GIT_DIRTY \"$GIT_DIRTY\"" >> release.h 13 | echo "#define REDIS_BUILD_ID \"$BUILD_ID\"" >> release.h 14 | touch release.c # Force recompile of release.c 15 | -------------------------------------------------------------------------------- /src/sha1.h: -------------------------------------------------------------------------------- 1 | #ifndef SHA1_H 2 | #define SHA1_H 3 | /* ================ sha1.h ================ */ 4 | /* 5 | SHA-1 in C 6 | By Steve Reid 7 | 100% Public Domain 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct { 15 | uint32_t state[5]; 16 | uint32_t count[2]; 17 | unsigned char buffer[64]; 18 | } SHA1_CTX; 19 | 20 | void SHA1Transform(uint32_t state[5], const unsigned char buffer[64]); 21 | void SHA1Init(SHA1_CTX* context); 22 | void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len); 23 | void SHA1Final(unsigned char digest[20], SHA1_CTX* context); 24 | 25 | #ifdef REDIS_TEST 26 | int sha1Test(int argc, char **argv, int accurate); 27 | #endif 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /deps/lua/etc/lua.pc: -------------------------------------------------------------------------------- 1 | # lua.pc -- pkg-config data for Lua 2 | 3 | # vars from install Makefile 4 | 5 | # grep '^V=' ../Makefile 6 | V= 5.1 7 | # grep '^R=' ../Makefile 8 | R= 5.1.5 9 | 10 | # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/' 11 | prefix= /usr/local 12 | INSTALL_BIN= ${prefix}/bin 13 | INSTALL_INC= ${prefix}/include 14 | INSTALL_LIB= ${prefix}/lib 15 | INSTALL_MAN= ${prefix}/man/man1 16 | INSTALL_LMOD= ${prefix}/share/lua/${V} 17 | INSTALL_CMOD= ${prefix}/lib/lua/${V} 18 | 19 | # canonical vars 20 | exec_prefix=${prefix} 21 | libdir=${exec_prefix}/lib 22 | includedir=${prefix}/include 23 | 24 | Name: Lua 25 | Description: An Extensible Extension Language 26 | Version: ${R} 27 | Requires: 28 | Libs: -L${libdir} -llua -lm 29 | Cflags: -I${includedir} 30 | 31 | # (end of lua.pc) 32 | -------------------------------------------------------------------------------- /utils/whatisdoing.sh: -------------------------------------------------------------------------------- 1 | # This script is from http://poormansprofiler.org/ 2 | # 3 | # NOTE: Instead of using this script, you should use the Redis 4 | # Software Watchdog, which provides a similar functionality but in 5 | # a more reliable / easy to use way. 6 | # 7 | # Check https://redis.io/topics/latency for more information. 8 | 9 | #!/bin/bash 10 | nsamples=1 11 | sleeptime=0 12 | pid=$(ps auxww | grep '[r]edis-server' | awk '{print $2}') 13 | 14 | for x in $(seq 1 $nsamples) 15 | do 16 | gdb -ex "set pagination 0" -ex "thread apply all bt" -batch -p $pid 17 | sleep $sleeptime 18 | done | \ 19 | awk ' 20 | BEGIN { s = ""; } 21 | /Thread/ { print s; s = ""; } 22 | /^\#/ { if (s != "" ) { s = s "," $4} else { s = $4 } } 23 | END { print s }' | \ 24 | sort | uniq -c | sort -r -n -k 1,1 25 | -------------------------------------------------------------------------------- /deps/cpp-statsd-client/cmake/Config.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016, Ruslan Baratov 2 | # 3 | # Licensed under the MIT License (the "License"); you may not use this file except 4 | # in compliance with the License. You may obtain a copy of the License at 5 | # 6 | # http://opensource.org/licenses/MIT 7 | # 8 | # Unless required by applicable law or agreed to in writing, software distributed 9 | # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 10 | # CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | # specific language governing permissions and limitations under the License. 12 | 13 | @PACKAGE_INIT@ 14 | 15 | find_package(Threads REQUIRED) 16 | 17 | include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") 18 | check_required_components("@PROJECT_NAME@") 19 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-tools.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | USER="keydb" 6 | 7 | Setup_dir () { 8 | DIR="${1}" 9 | MODE="${2}" 10 | GROUP="${3}" 11 | 12 | mkdir -p ${DIR} 13 | 14 | case "${DIR}" in 15 | /var/log/keydb) 16 | MODE="02750" 17 | GROUP="adm" 18 | ;; 19 | *) 20 | MODE="750" 21 | GROUP="${USER}" 22 | ;; 23 | esac 24 | 25 | if ! dpkg-statoverride --list ${DIR} >/dev/null 2>&1 26 | then 27 | chown ${USER}:${GROUP} ${DIR} 28 | chmod ${MODE} ${DIR} 29 | fi 30 | } 31 | 32 | if [ "$1" = "configure" ] 33 | then 34 | adduser \ 35 | --system \ 36 | --home /var/lib/keydb \ 37 | --quiet \ 38 | --group \ 39 | ${USER} || true 40 | 41 | Setup_dir /var/log/keydb ${USER}:adm 2750 42 | Setup_dir /var/lib/keydb ${USER}:${USER} 750 43 | fi 44 | 45 | #DEBHELPER# 46 | 47 | exit 0 48 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-tools.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | USER="keydb" 6 | 7 | Setup_dir () { 8 | DIR="${1}" 9 | MODE="${2}" 10 | GROUP="${3}" 11 | 12 | mkdir -p ${DIR} 13 | 14 | case "${DIR}" in 15 | /var/log/keydb) 16 | MODE="02750" 17 | GROUP="adm" 18 | ;; 19 | *) 20 | MODE="750" 21 | GROUP="${USER}" 22 | ;; 23 | esac 24 | 25 | if ! dpkg-statoverride --list ${DIR} >/dev/null 2>&1 26 | then 27 | chown ${USER}:${GROUP} ${DIR} 28 | chmod ${MODE} ${DIR} 29 | fi 30 | } 31 | 32 | if [ "$1" = "configure" ] 33 | then 34 | adduser \ 35 | --system \ 36 | --home /var/lib/keydb \ 37 | --quiet \ 38 | --group \ 39 | ${USER} || true 40 | 41 | Setup_dir /var/log/keydb ${USER}:adm 2750 42 | Setup_dir /var/lib/keydb ${USER}:${USER} 750 43 | fi 44 | 45 | #DEBHELPER# 46 | 47 | exit 0 48 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/spin.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_SPIN_H 2 | #define JEMALLOC_INTERNAL_SPIN_H 3 | 4 | #define SPIN_INITIALIZER {0U} 5 | 6 | typedef struct { 7 | unsigned iteration; 8 | } spin_t; 9 | 10 | static inline void 11 | spin_cpu_spinwait() { 12 | # if HAVE_CPU_SPINWAIT 13 | CPU_SPINWAIT; 14 | # else 15 | volatile int x = 0; 16 | x = x; 17 | # endif 18 | } 19 | 20 | static inline void 21 | spin_adaptive(spin_t *spin) { 22 | volatile uint32_t i; 23 | 24 | if (spin->iteration < 5) { 25 | for (i = 0; i < (1U << spin->iteration); i++) { 26 | spin_cpu_spinwait(); 27 | } 28 | spin->iteration++; 29 | } else { 30 | #ifdef _WIN32 31 | SwitchToThread(); 32 | #else 33 | sched_yield(); 34 | #endif 35 | } 36 | } 37 | 38 | #undef SPIN_INLINE 39 | 40 | #endif /* JEMALLOC_INTERNAL_SPIN_H */ 41 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/div.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #include "jemalloc/internal/div.h" 4 | 5 | TEST_BEGIN(test_div_exhaustive) { 6 | for (size_t divisor = 2; divisor < 1000 * 1000; ++divisor) { 7 | div_info_t div_info; 8 | div_init(&div_info, divisor); 9 | size_t max = 1000 * divisor; 10 | if (max < 1000 * 1000) { 11 | max = 1000 * 1000; 12 | } 13 | for (size_t dividend = 0; dividend < 1000 * divisor; 14 | dividend += divisor) { 15 | size_t quotient = div_compute( 16 | &div_info, dividend); 17 | assert_zu_eq(dividend, quotient * divisor, 18 | "With divisor = %zu, dividend = %zu, " 19 | "got quotient %zu", divisor, dividend, quotient); 20 | } 21 | } 22 | } 23 | TEST_END 24 | 25 | int 26 | main(void) { 27 | return test_no_reentrancy( 28 | test_div_exhaustive); 29 | } 30 | -------------------------------------------------------------------------------- /src/meminfo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static size_t getMemKey(std::string key) { 6 | # ifdef __linux__ 7 | std::string token; 8 | std::ifstream f("/proc/meminfo"); 9 | while (f >> token) { 10 | if (token == key) { 11 | size_t mem_val; 12 | if (f >> mem_val) { 13 | return mem_val * 1024; // values are in kB 14 | } else { 15 | return 0; 16 | } 17 | f.ignore(std::numeric_limits::max(), '\n'); 18 | } 19 | } 20 | return 0; 21 | # else 22 | (void)key; 23 | return 0; 24 | # endif 25 | } 26 | 27 | size_t getMemAvailable() { 28 | return getMemKey("MemAvailable:"); 29 | } 30 | 31 | size_t getMemTotal() { 32 | return getMemKey("MemTotal:"); 33 | } -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/extent_types.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_EXTENT_TYPES_H 2 | #define JEMALLOC_INTERNAL_EXTENT_TYPES_H 3 | 4 | typedef struct extent_s extent_t; 5 | typedef struct extents_s extents_t; 6 | 7 | typedef struct extent_util_stats_s extent_util_stats_t; 8 | typedef struct extent_util_stats_verbose_s extent_util_stats_verbose_t; 9 | 10 | #define EXTENT_HOOKS_INITIALIZER NULL 11 | 12 | /* 13 | * When reuse (and split) an active extent, (1U << opt_lg_extent_max_active_fit) 14 | * is the max ratio between the size of the active extent and the new extent. 15 | */ 16 | #define LG_EXTENT_MAX_ACTIVE_FIT_DEFAULT 6 17 | 18 | typedef enum { 19 | EXTENT_NOT_HEAD, 20 | EXTENT_IS_HEAD /* Only relevant for Windows && opt.retain. */ 21 | } extent_head_state_t; 22 | 23 | #endif /* JEMALLOC_INTERNAL_EXTENT_TYPES_H */ 24 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-cli.1: -------------------------------------------------------------------------------- 1 | .TH KEYDB-CLI 1 "August 17, 2019" 2 | .SH NAME 3 | keydb-cli \- Command-line client to keydb-server 4 | .SH SYNOPSIS 5 | .B keydb-cli 6 | .RI [options] 7 | .SH DESCRIPTION 8 | KeyDB is a key-value database. It is similar to memcached but the dataset is 9 | not volatile and other datatypes (such as lists and sets) are natively 10 | supported. 11 | .PP 12 | \fBkeydb-cli\fP provides a simple command-line interface to a KeyDB server. 13 | .SH OPTIONS 14 | See \fBkeydb-doc\fP for more information on the commands KeyDB accepts. 15 | .SH AUTHOR 16 | \fBkeydb-cli\fP was written by John Sully, originating as a fork of Redis. Redis was written by Salvatore Sanfilippo. 17 | .PP 18 | This manual page was written by Chris Lamb for the Debian 19 | project (but may be used by others). Modified by Ben Schermel 20 | -------------------------------------------------------------------------------- /utils/lru/README: -------------------------------------------------------------------------------- 1 | The test-lru.rb program can be used in order to check the behavior of the 2 | Redis approximated LRU algorithm against the theoretical output of true 3 | LRU algorithm. 4 | 5 | In order to use the program you need to recompile Redis setting the define 6 | REDIS_LRU_CLOCK_RESOLUTION to 1, by editing the file server.h. 7 | This allows to execute the program in a fast way since the 1 ms resolution 8 | is enough for all the objects to have a different enough time stamp during 9 | the test. 10 | 11 | The program is executed like this: 12 | 13 | ruby test-lru.rb /tmp/lru.html 14 | 15 | You can optionally specify a number of times to run, so that the program 16 | will output averages of different runs, by adding an additional argument. 17 | For instance in order to run the test 10 times use: 18 | 19 | ruby test-lru.rb /tmp/lru.html 10 20 | -------------------------------------------------------------------------------- /deps/lua/etc/all.c: -------------------------------------------------------------------------------- 1 | /* 2 | * all.c -- Lua core, libraries and interpreter in a single file 3 | */ 4 | 5 | #define luaall_c 6 | 7 | #include "lapi.c" 8 | #include "lcode.c" 9 | #include "ldebug.c" 10 | #include "ldo.c" 11 | #include "ldump.c" 12 | #include "lfunc.c" 13 | #include "lgc.c" 14 | #include "llex.c" 15 | #include "lmem.c" 16 | #include "lobject.c" 17 | #include "lopcodes.c" 18 | #include "lparser.c" 19 | #include "lstate.c" 20 | #include "lstring.c" 21 | #include "ltable.c" 22 | #include "ltm.c" 23 | #include "lundump.c" 24 | #include "lvm.c" 25 | #include "lzio.c" 26 | 27 | #include "lauxlib.c" 28 | #include "lbaselib.c" 29 | #include "ldblib.c" 30 | #include "liolib.c" 31 | #include "linit.c" 32 | #include "lmathlib.c" 33 | #include "loadlib.c" 34 | #include "loslib.c" 35 | #include "lstrlib.c" 36 | #include "ltablib.c" 37 | 38 | #include "lua.c" 39 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-cli.1: -------------------------------------------------------------------------------- 1 | .TH KEYDB-CLI 1 "August 17, 2019" 2 | .SH NAME 3 | keydb-cli \- Command-line client to keydb-server 4 | .SH SYNOPSIS 5 | .B keydb-cli 6 | .RI [options] 7 | .SH DESCRIPTION 8 | KeyDB is a key-value database. It is similar to memcached but the dataset is 9 | not volatile and other datatypes (such as lists and sets) are natively 10 | supported. 11 | .PP 12 | \fBkeydb-cli\fP provides a simple command-line interface to a KeyDB server. 13 | .SH OPTIONS 14 | See \fBkeydb-doc\fP for more information on the commands KeyDB accepts. 15 | .SH AUTHOR 16 | \fBkeydb-cli\fP was written by John Sully, originating as a fork of Redis. Redis was written by Salvatore Sanfilippo. 17 | .PP 18 | This manual page was written by Chris Lamb for the Debian 19 | project (but may be used by others). Modified by Ben Schermel 20 | -------------------------------------------------------------------------------- /deps/hiredis/appveyor.yml: -------------------------------------------------------------------------------- 1 | # Appveyor configuration file for CI build of hiredis on Windows (under Cygwin) 2 | environment: 3 | matrix: 4 | - CYG_BASH: C:\cygwin64\bin\bash 5 | CC: gcc 6 | - CYG_BASH: C:\cygwin\bin\bash 7 | CC: gcc 8 | CFLAGS: -m32 9 | CXXFLAGS: -m32 10 | LDFLAGS: -m32 11 | 12 | clone_depth: 1 13 | 14 | # Attempt to ensure we don't try to convert line endings to Win32 CRLF as this will cause build to fail 15 | init: 16 | - git config --global core.autocrlf input 17 | 18 | # Install needed build dependencies 19 | install: 20 | - '%CYG_BASH% -lc "cygcheck -dc cygwin"' 21 | 22 | build_script: 23 | - 'echo building...' 24 | - '%CYG_BASH% -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0/dev/null` && TCLSH=$TCL 9 | done 10 | 11 | if [ -z $TCLSH ] 12 | then 13 | echo "You need tcl 8.5 or newer in order to run the KeyDB test" 14 | exit 1 15 | fi 16 | if [ ! -r tests/tls ] || [ ! -r tests/tls_1 ] || [ ! -r tests/tls_2 ]; 17 | then 18 | echo "Generating neccessary certificates for TLS rotation testing." 19 | rm -rf tests/tls tests/tls_1 tests/tls_2 20 | 21 | utils/gen-test-certs.sh 22 | mv tests/tls tests/tls_1 23 | utils/gen-test-certs.sh 24 | mv tests/tls tests/tls_2 25 | utils/gen-test-certs.sh 26 | fi 27 | $TCLSH tests/test_helper.tcl \ 28 | --single unit/tls-rotation \ 29 | --tls \ 30 | --config server-threads 3 \ 31 | "${@}" 32 | -------------------------------------------------------------------------------- /tests/sentinel/run.tcl: -------------------------------------------------------------------------------- 1 | # Sentinel test suite. Copyright (C) 2014 Salvatore Sanfilippo antirez@gmail.com 2 | # This software is released under the BSD License. See the COPYING file for 3 | # more information. 4 | 5 | cd tests/sentinel 6 | source ../instances.tcl 7 | 8 | set ::instances_count 5 ; # How many instances we use at max. 9 | set ::tlsdir "../../tls" 10 | 11 | proc main {} { 12 | parse_options 13 | if {$::leaked_fds_file != ""} { 14 | set ::env(LEAKED_FDS_FILE) $::leaked_fds_file 15 | } 16 | spawn_instance sentinel $::sentinel_base_port $::instances_count [list "sentinel deny-scripts-reconfig no"] "../tests/includes/sentinel.conf" 17 | spawn_instance redis $::redis_base_port $::instances_count 18 | run_tests 19 | cleanup 20 | end_tests 21 | } 22 | 23 | if {[catch main e]} { 24 | puts $::errorInfo 25 | cleanup 26 | exit 1 27 | } 28 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/extent_dss.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_EXTENT_DSS_H 2 | #define JEMALLOC_INTERNAL_EXTENT_DSS_H 3 | 4 | typedef enum { 5 | dss_prec_disabled = 0, 6 | dss_prec_primary = 1, 7 | dss_prec_secondary = 2, 8 | 9 | dss_prec_limit = 3 10 | } dss_prec_t; 11 | #define DSS_PREC_DEFAULT dss_prec_secondary 12 | #define DSS_DEFAULT "secondary" 13 | 14 | extern const char *dss_prec_names[]; 15 | 16 | extern const char *opt_dss; 17 | 18 | dss_prec_t extent_dss_prec_get(void); 19 | bool extent_dss_prec_set(dss_prec_t dss_prec); 20 | void *extent_alloc_dss(tsdn_t *tsdn, arena_t *arena, void *new_addr, 21 | size_t size, size_t alignment, bool *zero, bool *commit); 22 | bool extent_in_dss(void *addr); 23 | bool extent_dss_mergeable(void *addr_a, void *addr_b); 24 | void extent_dss_boot(void); 25 | 26 | #endif /* JEMALLOC_INTERNAL_EXTENT_DSS_H */ 27 | -------------------------------------------------------------------------------- /tests/cluster/run.tcl: -------------------------------------------------------------------------------- 1 | # Cluster test suite. Copyright (C) 2014 Salvatore Sanfilippo antirez@gmail.com 2 | # This software is released under the BSD License. See the COPYING file for 3 | # more information. 4 | 5 | cd tests/cluster 6 | source cluster.tcl 7 | source ../instances.tcl 8 | source ../../support/cluster.tcl ; # Redis Cluster client. 9 | 10 | set ::instances_count 20 ; # How many instances we use at max. 11 | set ::tlsdir "../../tls" 12 | 13 | proc main {} { 14 | parse_options 15 | spawn_instance redis $::redis_base_port $::instances_count { 16 | "bind 127.0.0.1" 17 | "cluster-enabled yes" 18 | "appendonly yes" 19 | "testmode yes" 20 | "server-threads 3" 21 | } 22 | run_tests 23 | cleanup 24 | end_tests 25 | } 26 | 27 | if {[catch main e]} { 28 | puts $::errorInfo 29 | if {$::pause_on_error} pause_on_error 30 | cleanup 31 | exit 1 32 | } 33 | -------------------------------------------------------------------------------- /deps/lua/test/sieve.lua: -------------------------------------------------------------------------------- 1 | -- the sieve of of Eratosthenes programmed with coroutines 2 | -- typical usage: lua -e N=1000 sieve.lua | column 3 | 4 | -- generate all the numbers from 2 to n 5 | function gen (n) 6 | return coroutine.wrap(function () 7 | for i=2,n do coroutine.yield(i) end 8 | end) 9 | end 10 | 11 | -- filter the numbers generated by `g', removing multiples of `p' 12 | function filter (p, g) 13 | return coroutine.wrap(function () 14 | while 1 do 15 | local n = g() 16 | if n == nil then return end 17 | if math.mod(n, p) ~= 0 then coroutine.yield(n) end 18 | end 19 | end) 20 | end 21 | 22 | N=N or 1000 -- from command line 23 | x = gen(N) -- generate primes up to N 24 | while 1 do 25 | local n = x() -- pick a number until done 26 | if n == nil then break end 27 | print(n) -- must be a prime number 28 | x = filter(n, x) -- now remove its multiples 29 | end 30 | -------------------------------------------------------------------------------- /deps/lua/test/trace-calls.lua: -------------------------------------------------------------------------------- 1 | -- trace calls 2 | -- example: lua -ltrace-calls bisect.lua 3 | 4 | local level=0 5 | 6 | local function hook(event) 7 | local t=debug.getinfo(3) 8 | io.write(level," >>> ",string.rep(" ",level)) 9 | if t~=nil and t.currentline>=0 then io.write(t.short_src,":",t.currentline," ") end 10 | t=debug.getinfo(2) 11 | if event=="call" then 12 | level=level+1 13 | else 14 | level=level-1 if level<0 then level=0 end 15 | end 16 | if t.what=="main" then 17 | if event=="call" then 18 | io.write("begin ",t.short_src) 19 | else 20 | io.write("end ",t.short_src) 21 | end 22 | elseif t.what=="Lua" then 23 | -- table.foreach(t,print) 24 | io.write(event," ",t.name or "(Lua)"," <",t.linedefined,":",t.short_src,">") 25 | else 26 | io.write(event," ",t.name or "(C)"," [",t.what,"] ") 27 | end 28 | io.write("\n") 29 | end 30 | 31 | debug.sethook(hook,"cr") 32 | level=0 33 | -------------------------------------------------------------------------------- /deps/lua/test/trace-globals.lua: -------------------------------------------------------------------------------- 1 | -- trace assigments to global variables 2 | 3 | do 4 | -- a tostring that quotes strings. note the use of the original tostring. 5 | local _tostring=tostring 6 | local tostring=function(a) 7 | if type(a)=="string" then 8 | return string.format("%q",a) 9 | else 10 | return _tostring(a) 11 | end 12 | end 13 | 14 | local log=function (name,old,new) 15 | local t=debug.getinfo(3,"Sl") 16 | local line=t.currentline 17 | io.write(t.short_src) 18 | if line>=0 then io.write(":",line) end 19 | io.write(": ",name," is now ",tostring(new)," (was ",tostring(old),")","\n") 20 | end 21 | 22 | local g={} 23 | local set=function (t,name,value) 24 | log(name,g[name],value) 25 | g[name]=value 26 | end 27 | setmetatable(getfenv(),{__index=g,__newindex=set}) 28 | end 29 | 30 | -- an example 31 | 32 | a=1 33 | b=2 34 | a=10 35 | b=20 36 | b=nil 37 | b=200 38 | print(a,b,c) 39 | -------------------------------------------------------------------------------- /deps/jemalloc/test/src/thd.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifdef _WIN32 4 | void 5 | thd_create(thd_t *thd, void *(*proc)(void *), void *arg) { 6 | LPTHREAD_START_ROUTINE routine = (LPTHREAD_START_ROUTINE)proc; 7 | *thd = CreateThread(NULL, 0, routine, arg, 0, NULL); 8 | if (*thd == NULL) { 9 | test_fail("Error in CreateThread()\n"); 10 | } 11 | } 12 | 13 | void 14 | thd_join(thd_t thd, void **ret) { 15 | if (WaitForSingleObject(thd, INFINITE) == WAIT_OBJECT_0 && ret) { 16 | DWORD exit_code; 17 | GetExitCodeThread(thd, (LPDWORD) &exit_code); 18 | *ret = (void *)(uintptr_t)exit_code; 19 | } 20 | } 21 | 22 | #else 23 | void 24 | thd_create(thd_t *thd, void *(*proc)(void *), void *arg) { 25 | if (pthread_create(thd, NULL, proc, arg) != 0) { 26 | test_fail("Error in pthread_create()\n"); 27 | } 28 | } 29 | 30 | void 31 | thd_join(thd_t thd, void **ret) { 32 | pthread_join(thd, ret); 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/hooks.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_HOOKS_H 2 | #define JEMALLOC_INTERNAL_HOOKS_H 3 | 4 | extern JEMALLOC_EXPORT void (*hooks_arena_new_hook)(); 5 | extern JEMALLOC_EXPORT void (*hooks_libc_hook)(); 6 | 7 | #define JEMALLOC_HOOK(fn, hook) ((void)(hook != NULL && (hook(), 0)), fn) 8 | 9 | #define open JEMALLOC_HOOK(open, hooks_libc_hook) 10 | #define read JEMALLOC_HOOK(read, hooks_libc_hook) 11 | #define write JEMALLOC_HOOK(write, hooks_libc_hook) 12 | #define readlink JEMALLOC_HOOK(readlink, hooks_libc_hook) 13 | #define close JEMALLOC_HOOK(close, hooks_libc_hook) 14 | #define creat JEMALLOC_HOOK(creat, hooks_libc_hook) 15 | #define secure_getenv JEMALLOC_HOOK(secure_getenv, hooks_libc_hook) 16 | /* Note that this is undef'd and re-define'd in src/prof.c. */ 17 | #define _Unwind_Backtrace JEMALLOC_HOOK(_Unwind_Backtrace, hooks_libc_hook) 18 | 19 | #endif /* JEMALLOC_INTERNAL_HOOKS_H */ 20 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/src/thd.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifdef _WIN32 4 | void 5 | thd_create(thd_t *thd, void *(*proc)(void *), void *arg) { 6 | LPTHREAD_START_ROUTINE routine = (LPTHREAD_START_ROUTINE)proc; 7 | *thd = CreateThread(NULL, 0, routine, arg, 0, NULL); 8 | if (*thd == NULL) { 9 | test_fail("Error in CreateThread()\n"); 10 | } 11 | } 12 | 13 | void 14 | thd_join(thd_t thd, void **ret) { 15 | if (WaitForSingleObject(thd, INFINITE) == WAIT_OBJECT_0 && ret) { 16 | DWORD exit_code; 17 | GetExitCodeThread(thd, (LPDWORD) &exit_code); 18 | *ret = (void *)(uintptr_t)exit_code; 19 | } 20 | } 21 | 22 | #else 23 | void 24 | thd_create(thd_t *thd, void *(*proc)(void *), void *arg) { 25 | if (pthread_create(thd, NULL, proc, arg) != 0) { 26 | test_fail("Error in pthread_create()\n"); 27 | } 28 | } 29 | 30 | void 31 | thd_join(thd_t thd, void **ret) { 32 | pthread_join(thd, ret); 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /deps/lua/src/linit.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Initialization of libraries for lua.c 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #define linit_c 9 | #define LUA_LIB 10 | 11 | #include "lua.h" 12 | 13 | #include "lualib.h" 14 | #include "lauxlib.h" 15 | 16 | 17 | static const luaL_Reg lualibs[] = { 18 | {"", luaopen_base}, 19 | {LUA_LOADLIBNAME, luaopen_package}, 20 | {LUA_TABLIBNAME, luaopen_table}, 21 | {LUA_IOLIBNAME, luaopen_io}, 22 | {LUA_OSLIBNAME, luaopen_os}, 23 | {LUA_STRLIBNAME, luaopen_string}, 24 | {LUA_MATHLIBNAME, luaopen_math}, 25 | {LUA_DBLIBNAME, luaopen_debug}, 26 | {NULL, NULL} 27 | }; 28 | 29 | 30 | LUALIB_API void luaL_openlibs (lua_State *L) { 31 | const luaL_Reg *lib = lualibs; 32 | for (; lib->func; lib++) { 33 | lua_pushcfunction(L, lib->func); 34 | lua_pushstring(L, lib->name); 35 | lua_call(L, 1, 0); 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/safety_check.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_SAFETY_CHECK_H 2 | #define JEMALLOC_INTERNAL_SAFETY_CHECK_H 3 | 4 | void safety_check_fail(const char *format, ...); 5 | /* Can set to NULL for a default. */ 6 | void safety_check_set_abort(void (*abort_fn)()); 7 | 8 | JEMALLOC_ALWAYS_INLINE void 9 | safety_check_set_redzone(void *ptr, size_t usize, size_t bumped_usize) { 10 | assert(usize < bumped_usize); 11 | for (size_t i = usize; i < bumped_usize && i < usize + 32; ++i) { 12 | *((unsigned char *)ptr + i) = 0xBC; 13 | } 14 | } 15 | 16 | JEMALLOC_ALWAYS_INLINE void 17 | safety_check_verify_redzone(const void *ptr, size_t usize, size_t bumped_usize) 18 | { 19 | for (size_t i = usize; i < bumped_usize && i < usize + 32; ++i) { 20 | if (unlikely(*((unsigned char *)ptr + i) != 0xBC)) { 21 | safety_check_fail("Use after free error\n"); 22 | } 23 | } 24 | } 25 | 26 | #endif /*JEMALLOC_INTERNAL_SAFETY_CHECK_H */ 27 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/include/jemalloc/internal/base_externs.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_BASE_EXTERNS_H 2 | #define JEMALLOC_INTERNAL_BASE_EXTERNS_H 3 | 4 | base_t *b0get(void); 5 | base_t *base_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks); 6 | void base_delete(base_t *base); 7 | extent_hooks_t *base_extent_hooks_get(base_t *base); 8 | extent_hooks_t *base_extent_hooks_set(base_t *base, 9 | extent_hooks_t *extent_hooks); 10 | void *base_alloc(tsdn_t *tsdn, base_t *base, size_t size, size_t alignment); 11 | extent_t *base_alloc_extent(tsdn_t *tsdn, base_t *base); 12 | void base_stats_get(tsdn_t *tsdn, base_t *base, size_t *allocated, 13 | size_t *resident, size_t *mapped); 14 | void base_prefork(tsdn_t *tsdn, base_t *base); 15 | void base_postfork_parent(tsdn_t *tsdn, base_t *base); 16 | void base_postfork_child(tsdn_t *tsdn, base_t *base); 17 | bool base_boot(tsdn_t *tsdn); 18 | 19 | #endif /* JEMALLOC_INTERNAL_BASE_EXTERNS_H */ 20 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/hooks.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | static bool hook_called = false; 4 | 5 | static void 6 | hook() { 7 | hook_called = true; 8 | } 9 | 10 | static int 11 | func_to_hook(int arg1, int arg2) { 12 | return arg1 + arg2; 13 | } 14 | 15 | #define func_to_hook JEMALLOC_HOOK(func_to_hook, hooks_libc_hook) 16 | 17 | TEST_BEGIN(unhooked_call) { 18 | hooks_libc_hook = NULL; 19 | hook_called = false; 20 | assert_d_eq(3, func_to_hook(1, 2), "Hooking changed return value."); 21 | assert_false(hook_called, "Nulling out hook didn't take."); 22 | } 23 | TEST_END 24 | 25 | TEST_BEGIN(hooked_call) { 26 | hooks_libc_hook = &hook; 27 | hook_called = false; 28 | assert_d_eq(3, func_to_hook(1, 2), "Hooking changed return value."); 29 | assert_true(hook_called, "Hook should have executed."); 30 | } 31 | TEST_END 32 | 33 | int 34 | main(void) { 35 | return test( 36 | unhooked_call, 37 | hooked_call); 38 | } 39 | -------------------------------------------------------------------------------- /tests/cluster/tests/01-faildet.tcl: -------------------------------------------------------------------------------- 1 | # Check the basic monitoring and failover capabilities. 2 | 3 | source "../tests/includes/init-tests.tcl" 4 | 5 | test "Create a 5 nodes cluster" { 6 | create_cluster 5 5 7 | } 8 | 9 | test "Cluster should start ok" { 10 | assert_cluster_state ok 11 | } 12 | 13 | test "Killing two slave nodes" { 14 | kill_instance redis 5 15 | kill_instance redis 6 16 | } 17 | 18 | test "Cluster should be still up" { 19 | assert_cluster_state ok 20 | } 21 | 22 | test "Killing one master node" { 23 | kill_instance redis 0 24 | } 25 | 26 | # Note: the only slave of instance 0 is already down so no 27 | # failover is possible, that would change the state back to ok. 28 | test "Cluster should be down now" { 29 | assert_cluster_state fail 30 | } 31 | 32 | test "Restarting master node" { 33 | restart_instance redis 0 34 | } 35 | 36 | test "Cluster should be up again" { 37 | assert_cluster_state ok 38 | } 39 | -------------------------------------------------------------------------------- /deps/lua/src/lstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** String table (keep all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstring_h 8 | #define lstring_h 9 | 10 | 11 | #include "lgc.h" 12 | #include "lobject.h" 13 | #include "lstate.h" 14 | 15 | 16 | #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) 17 | 18 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) 19 | 20 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) 21 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 22 | (sizeof(s)/sizeof(char))-1)) 23 | 24 | #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) 25 | 26 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 27 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); 28 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/test_hooks.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | static bool hook_called = false; 4 | 5 | static void 6 | hook() { 7 | hook_called = true; 8 | } 9 | 10 | static int 11 | func_to_hook(int arg1, int arg2) { 12 | return arg1 + arg2; 13 | } 14 | 15 | #define func_to_hook JEMALLOC_HOOK(func_to_hook, test_hooks_libc_hook) 16 | 17 | TEST_BEGIN(unhooked_call) { 18 | test_hooks_libc_hook = NULL; 19 | hook_called = false; 20 | assert_d_eq(3, func_to_hook(1, 2), "Hooking changed return value."); 21 | assert_false(hook_called, "Nulling out hook didn't take."); 22 | } 23 | TEST_END 24 | 25 | TEST_BEGIN(hooked_call) { 26 | test_hooks_libc_hook = &hook; 27 | hook_called = false; 28 | assert_d_eq(3, func_to_hook(1, 2), "Hooking changed return value."); 29 | assert_true(hook_called, "Hook should have executed."); 30 | } 31 | TEST_END 32 | 33 | int 34 | main(void) { 35 | return test( 36 | unhooked_call, 37 | hooked_call); 38 | } 39 | -------------------------------------------------------------------------------- /tests/unit/moduleapi/fork.tcl: -------------------------------------------------------------------------------- 1 | set testmodule [file normalize tests/modules/fork.so] 2 | 3 | proc count_log_message {pattern} { 4 | set result [exec grep -c $pattern < [srv 0 stdout]] 5 | } 6 | 7 | start_server {tags {"modules"}} { 8 | r module load $testmodule 9 | 10 | test {Module fork} { 11 | # the argument to fork.create is the exitcode on termination 12 | r fork.create 3 13 | wait_for_condition 20 100 { 14 | [r fork.exitcode] != -1 15 | } else { 16 | fail "fork didn't terminate" 17 | } 18 | r fork.exitcode 19 | } {3} 20 | 21 | test {Module fork kill} { 22 | r fork.create 3 23 | after 250 24 | r fork.kill 25 | 26 | assert {[count_log_message "fork child started"] eq "2"} 27 | assert {[count_log_message "Received SIGUSR1 in child"] eq "1"} 28 | assert {[count_log_message "fork child exiting"] eq "1"} 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /deps/jemalloc/test/include/test/btalloc.h: -------------------------------------------------------------------------------- 1 | /* btalloc() provides a mechanism for allocating via permuted backtraces. */ 2 | void *btalloc(size_t size, unsigned bits); 3 | 4 | #define btalloc_n_proto(n) \ 5 | void *btalloc_##n(size_t size, unsigned bits); 6 | btalloc_n_proto(0) 7 | btalloc_n_proto(1) 8 | 9 | #define btalloc_n_gen(n) \ 10 | void * \ 11 | btalloc_##n(size_t size, unsigned bits) { \ 12 | void *p; \ 13 | \ 14 | if (bits == 0) { \ 15 | p = mallocx(size, 0); \ 16 | } else { \ 17 | switch (bits & 0x1U) { \ 18 | case 0: \ 19 | p = (btalloc_0(size, bits >> 1)); \ 20 | break; \ 21 | case 1: \ 22 | p = (btalloc_1(size, bits >> 1)); \ 23 | break; \ 24 | default: not_reached(); \ 25 | } \ 26 | } \ 27 | /* Intentionally sabotage tail call optimization. */ \ 28 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); \ 29 | return p; \ 30 | } 31 | -------------------------------------------------------------------------------- /deps/lua/etc/min.c: -------------------------------------------------------------------------------- 1 | /* 2 | * min.c -- a minimal Lua interpreter 3 | * loads stdin only with minimal error handling. 4 | * no interaction, and no standard library, only a "print" function. 5 | */ 6 | 7 | #include 8 | 9 | #include "lua.h" 10 | #include "lauxlib.h" 11 | 12 | static int print(lua_State *L) 13 | { 14 | int n=lua_gettop(L); 15 | int i; 16 | for (i=1; i<=n; i++) 17 | { 18 | if (i>1) printf("\t"); 19 | if (lua_isstring(L,i)) 20 | printf("%s",lua_tostring(L,i)); 21 | else if (lua_isnil(L,i)) 22 | printf("%s","nil"); 23 | else if (lua_isboolean(L,i)) 24 | printf("%s",lua_toboolean(L,i) ? "true" : "false"); 25 | else 26 | printf("%s:%p",luaL_typename(L,i),lua_topointer(L,i)); 27 | } 28 | printf("\n"); 29 | return 0; 30 | } 31 | 32 | int main(void) 33 | { 34 | lua_State *L=lua_open(); 35 | lua_register(L,"print",print); 36 | if (luaL_dofile(L,NULL)!=0) fprintf(stderr,"%s\n",lua_tostring(L,-1)); 37 | lua_close(L); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/include/test/btalloc.h: -------------------------------------------------------------------------------- 1 | /* btalloc() provides a mechanism for allocating via permuted backtraces. */ 2 | void *btalloc(size_t size, unsigned bits); 3 | 4 | #define btalloc_n_proto(n) \ 5 | void *btalloc_##n(size_t size, unsigned bits); 6 | btalloc_n_proto(0) 7 | btalloc_n_proto(1) 8 | 9 | #define btalloc_n_gen(n) \ 10 | void * \ 11 | btalloc_##n(size_t size, unsigned bits) { \ 12 | void *p; \ 13 | \ 14 | if (bits == 0) { \ 15 | p = mallocx(size, 0); \ 16 | } else { \ 17 | switch (bits & 0x1U) { \ 18 | case 0: \ 19 | p = (btalloc_0(size, bits >> 1)); \ 20 | break; \ 21 | case 1: \ 22 | p = (btalloc_1(size, bits >> 1)); \ 23 | break; \ 24 | default: not_reached(); \ 25 | } \ 26 | } \ 27 | /* Intentionally sabotage tail call optimization. */ \ 28 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); \ 29 | return p; \ 30 | } 31 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/test_hooks.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_TEST_HOOKS_H 2 | #define JEMALLOC_INTERNAL_TEST_HOOKS_H 3 | 4 | extern JEMALLOC_EXPORT void (*test_hooks_arena_new_hook)(); 5 | extern JEMALLOC_EXPORT void (*test_hooks_libc_hook)(); 6 | 7 | #define JEMALLOC_HOOK(fn, hook) ((void)(hook != NULL && (hook(), 0)), fn) 8 | 9 | #define open JEMALLOC_HOOK(open, test_hooks_libc_hook) 10 | #define read JEMALLOC_HOOK(read, test_hooks_libc_hook) 11 | #define write JEMALLOC_HOOK(write, test_hooks_libc_hook) 12 | #define readlink JEMALLOC_HOOK(readlink, test_hooks_libc_hook) 13 | #define close JEMALLOC_HOOK(close, test_hooks_libc_hook) 14 | #define creat JEMALLOC_HOOK(creat, test_hooks_libc_hook) 15 | #define secure_getenv JEMALLOC_HOOK(secure_getenv, test_hooks_libc_hook) 16 | /* Note that this is undef'd and re-define'd in src/prof.c. */ 17 | #define _Unwind_Backtrace JEMALLOC_HOOK(_Unwind_Backtrace, test_hooks_libc_hook) 18 | 19 | #endif /* JEMALLOC_INTERNAL_TEST_HOOKS_H */ 20 | -------------------------------------------------------------------------------- /src/new.cpp: -------------------------------------------------------------------------------- 1 | #include // std::size_t 2 | #include "server.h" 3 | #include "new.h" 4 | #include 5 | 6 | #ifdef SANITIZE 7 | void *operator new(size_t size, enum MALLOC_CLASS mclass) 8 | { 9 | (void)mclass; 10 | return ::operator new(size); 11 | } 12 | 13 | #else 14 | [[deprecated]] 15 | void *operator new(size_t size) 16 | { 17 | return zmalloc(size, MALLOC_LOCAL); 18 | } 19 | 20 | void *operator new(size_t size, enum MALLOC_CLASS mclass) 21 | { 22 | return zmalloc(size, mclass); 23 | } 24 | 25 | void *operator new(std::size_t size, const std::nothrow_t &) noexcept 26 | { 27 | return zmalloc(size, MALLOC_LOCAL); 28 | } 29 | 30 | //need to do null checks for delete since the compiler can optimize out null checks in zfree 31 | void operator delete(void * p) noexcept 32 | { 33 | if (p != nullptr) 34 | zfree(p); 35 | } 36 | 37 | void operator delete(void *p, std::size_t) noexcept 38 | { 39 | if (p != nullptr) 40 | zfree(p); 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-server.1: -------------------------------------------------------------------------------- 1 | .TH KEYDB-SERVER 1 "August 17, 2019" 2 | .SH NAME 3 | keydb-server \- Persistent key-value database 4 | .SH SYNOPSIS 5 | .B keydb-server 6 | .RI configfile 7 | .SH DESCRIPTION 8 | KeyDB is a key-value database. It is similar to memcached but the dataset is 9 | not volatile and other datatypes (such as lists and sets) are natively 10 | supported. 11 | .PP 12 | .SH OPTIONS 13 | .IP "configfile" 14 | Read options from specified configuration file. 15 | .SH NOTES 16 | On Debian GNU/Linux systems, \fBkeydb-server\fP is typically started via the 17 | \fB/etc/init.d/keydb-server\fP initscript, not manually. This defaults to using 18 | \fB/etc/keydb/keydb.conf\fP as a configuration file. 19 | .SH AUTHOR 20 | \fBkeydb-server\fP was written by John Sully, originating as a fork of Redis. Redis was written by Salvatore Sanfilippo. 21 | .PP 22 | This manual page was written by Chris Lamb for the Debian 23 | project (but may be used by others). Modified by Ben Schermel 24 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-server.1: -------------------------------------------------------------------------------- 1 | .TH KEYDB-SERVER 1 "August 17, 2019" 2 | .SH NAME 3 | keydb-server \- Persistent key-value database 4 | .SH SYNOPSIS 5 | .B keydb-server 6 | .RI configfile 7 | .SH DESCRIPTION 8 | KeyDB is a key-value database. It is similar to memcached but the dataset is 9 | not volatile and other datatypes (such as lists and sets) are natively 10 | supported. 11 | .PP 12 | .SH OPTIONS 13 | .IP "configfile" 14 | Read options from specified configuration file. 15 | .SH NOTES 16 | On Debian GNU/Linux systems, \fBkeydb-server\fP is typically started via the 17 | \fB/etc/init.d/keydb-server\fP initscript, not manually. This defaults to using 18 | \fB/etc/keydb/keydb.conf\fP as a configuration file. 19 | .SH AUTHOR 20 | \fBkeydb-server\fP was written by John Sully, originating as a fork of Redis. Redis was written by Salvatore Sanfilippo. 21 | .PP 22 | This manual page was written by Chris Lamb for the Debian 23 | project (but may be used by others). Modified by Ben Schermel 24 | -------------------------------------------------------------------------------- /deps/lua/doc/readme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Lua documentation 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 | Lua 12 | Documentation 13 |

14 | 15 | This is the documentation included in the source distribution of Lua 5.1.5. 16 | 17 | 25 | 26 | Lua's 27 | official web site 28 | contains updated documentation, 29 | especially the 30 | reference manual. 31 |

32 | 33 |


34 | 35 | Last update: 36 | Fri Feb 3 09:44:42 BRST 2012 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/serverassert.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void _serverAssertWithInfo(const struct client *c, class robj_roptr o, const char *estr, const char *file, int line); 4 | extern "C" void _serverAssert(const char *estr, const char *file, int line); 5 | #ifdef __GNUC__ 6 | extern "C" void _serverPanic(const char *file, int line, const char *msg, ...) 7 | __attribute__ ((format (printf, 3, 4))); 8 | #else 9 | extern "C" void _serverPanic(const char *file, int line, const char *msg, ...); 10 | #endif 11 | 12 | extern int g_fInCrash; 13 | 14 | /* We can print the stacktrace, so our assert is defined this way: */ 15 | #define serverAssertWithInfo(_c,_o,_e) ((_e)?(void)0 : (_serverAssertWithInfo(_c,_o,#_e,__FILE__,__LINE__),_exit(1))) 16 | #define serverAssert(_e) (((_e) || g_fInCrash) ?(void)0 : (_serverAssert(#_e,__FILE__,__LINE__),_exit(1))) 17 | #ifdef _DEBUG 18 | #define serverAssertDebug(_e) serverAssert(_e) 19 | #else 20 | #define serverAssertDebug(_e) 21 | #endif 22 | #define serverPanic(...) _serverPanic(__FILE__,__LINE__,__VA_ARGS__),_exit(1) -------------------------------------------------------------------------------- /tests/unit/rreplay.tcl: -------------------------------------------------------------------------------- 1 | start_server {tags {"rreplay"} overrides {active-replica yes}} { 2 | 3 | test {RREPLAY use current db} { 4 | r debug force-master yes 5 | r select 4 6 | r set dbnum invalid 7 | r rreplay "f4d5b2b5-4f07-4ee5-a4f2-5dc98507dfce" "*3\r\n\$3\r\nSET\r\n\$5\r\ndbnum\r\n\$4\r\nfour\r\n" 8 | r get dbnum 9 | } {four} 10 | reconnect 11 | 12 | test {RREPLAY db different} { 13 | r debug force-master yes 14 | r select 4 15 | r set testkey four 16 | r rreplay "f4d5b2b5-4f07-4ee5-a4f2-5dc98507dfce" "*3\r\n\$3\r\nSET\r\n\$7\r\ntestkey\r\n\$4\r\nbebe\r\n" 2 17 | r select 4 18 | assert { [r get testkey] == "four" } 19 | r select 2 20 | r get testkey 21 | } {bebe} 22 | 23 | reconnect 24 | 25 | test {RREPLAY not master} { 26 | assert_error "*master*" {r rreplay "f4d5b2b5-4f07-4ee5-a4f2-5dc98507dfce" "*3\r\n\$3\r\nSET\r\n\$7\r\ntestkey\r\n\$4\r\nbebe\r\n" 2} 27 | } 28 | 29 | r flushdb 30 | } 31 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/prof_idump.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | static bool did_prof_dump_open; 4 | 5 | static int 6 | prof_dump_open_intercept(bool propagate_err, const char *filename) { 7 | int fd; 8 | 9 | did_prof_dump_open = true; 10 | 11 | fd = open("/dev/null", O_WRONLY); 12 | assert_d_ne(fd, -1, "Unexpected open() failure"); 13 | 14 | return fd; 15 | } 16 | 17 | TEST_BEGIN(test_idump) { 18 | bool active; 19 | void *p; 20 | 21 | test_skip_if(!config_prof); 22 | 23 | active = true; 24 | assert_d_eq(mallctl("prof.active", NULL, NULL, (void *)&active, 25 | sizeof(active)), 0, 26 | "Unexpected mallctl failure while activating profiling"); 27 | 28 | prof_dump_open = prof_dump_open_intercept; 29 | 30 | did_prof_dump_open = false; 31 | p = mallocx(1, 0); 32 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); 33 | dallocx(p, 0); 34 | assert_true(did_prof_dump_open, "Expected a profile dump"); 35 | } 36 | TEST_END 37 | 38 | int 39 | main(void) { 40 | return test( 41 | test_idump); 42 | } 43 | -------------------------------------------------------------------------------- /deps/cpp-statsd-client/images/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Artboard Copy 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /pkg/deb/debian/keydb-sentinel.1: -------------------------------------------------------------------------------- 1 | .TH KEYDB-SENTINEL 1 "August 17, 2019" 2 | .SH NAME 3 | keydb-sentinel \- Persistent key-value database (cluster mode) 4 | .SH SYNOPSIS 5 | .B keydb-sentinel 6 | .RI configfile 7 | .SH DESCRIPTION 8 | KeyDB is a key-value database. It is similar to memcached but the dataset is 9 | not volatile and other datatypes (such as lists and sets) are natively 10 | supported. 11 | .PP 12 | .SH OPTIONS 13 | .IP "configfile" 14 | Read options from specified configuration file. 15 | .SH NOTES 16 | On Debian GNU/Linux systems, \fBkeydb-sentinel\fP is typically started via the 17 | \fB/etc/init.d/keydb-sentinel\fP initscript, not manually. This defaults to using 18 | \fB/etc/keydb/sentinel.conf\fP as a configuration file. 19 | .SH AUTHOR 20 | \fBkeydb-sentinel\fP was written by John Sully, originating as a fork of Redis. Redis was written by Salvatore Sanfilippo. 21 | .PP 22 | This manual page was written by Chris Lamb for the Debian 23 | project (but may be used by others). Modified by Ben Schermel 24 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/prof_idump.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | static bool did_prof_dump_open; 4 | 5 | static int 6 | prof_dump_open_intercept(bool propagate_err, const char *filename) { 7 | int fd; 8 | 9 | did_prof_dump_open = true; 10 | 11 | fd = open("/dev/null", O_WRONLY); 12 | assert_d_ne(fd, -1, "Unexpected open() failure"); 13 | 14 | return fd; 15 | } 16 | 17 | TEST_BEGIN(test_idump) { 18 | bool active; 19 | void *p; 20 | 21 | test_skip_if(!config_prof); 22 | 23 | active = true; 24 | assert_d_eq(mallctl("prof.active", NULL, NULL, (void *)&active, 25 | sizeof(active)), 0, 26 | "Unexpected mallctl failure while activating profiling"); 27 | 28 | prof_dump_open = prof_dump_open_intercept; 29 | 30 | did_prof_dump_open = false; 31 | p = mallocx(1, 0); 32 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); 33 | dallocx(p, 0); 34 | assert_true(did_prof_dump_open, "Expected a profile dump"); 35 | } 36 | TEST_END 37 | 38 | int 39 | main(void) { 40 | return test( 41 | test_idump); 42 | } 43 | -------------------------------------------------------------------------------- /pkg/deb/debian_dh9/keydb-sentinel.1: -------------------------------------------------------------------------------- 1 | .TH KEYDB-SENTINEL 1 "August 17, 2019" 2 | .SH NAME 3 | keydb-sentinel \- Persistent key-value database (cluster mode) 4 | .SH SYNOPSIS 5 | .B keydb-sentinel 6 | .RI configfile 7 | .SH DESCRIPTION 8 | KeyDB is a key-value database. It is similar to memcached but the dataset is 9 | not volatile and other datatypes (such as lists and sets) are natively 10 | supported. 11 | .PP 12 | .SH OPTIONS 13 | .IP "configfile" 14 | Read options from specified configuration file. 15 | .SH NOTES 16 | On Debian GNU/Linux systems, \fBkeydb-sentinel\fP is typically started via the 17 | \fB/etc/init.d/keydb-sentinel\fP initscript, not manually. This defaults to using 18 | \fB/etc/keydb/sentinel.conf\fP as a configuration file. 19 | .SH AUTHOR 20 | \fBkeydb-sentinel\fP was written by John Sully, originating as a fork of Redis. Redis was written by Salvatore Sanfilippo. 21 | .PP 22 | This manual page was written by Chris Lamb for the Debian 23 | project (but may be used by others). Modified by Ben Schermel 24 | -------------------------------------------------------------------------------- /deps/lua/src/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "lobject.h" 11 | #include "lzio.h" 12 | 13 | /* load one chunk; from lundump.c */ 14 | LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); 15 | 16 | /* make header; from lundump.c */ 17 | LUAI_FUNC void luaU_header (char* h); 18 | 19 | /* dump one chunk; from ldump.c */ 20 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); 21 | 22 | #ifdef luac_c 23 | /* print one chunk; from print.c */ 24 | LUAI_FUNC void luaU_print (const Proto* f, int full); 25 | #endif 26 | 27 | /* for header of binary files -- this is Lua 5.1 */ 28 | #define LUAC_VERSION 0x51 29 | 30 | /* for header of binary files -- this is the official format */ 31 | #define LUAC_FORMAT 0 32 | 33 | /* size of header of binary files */ 34 | #define LUAC_HEADERSIZE 12 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/base_externs.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_BASE_EXTERNS_H 2 | #define JEMALLOC_INTERNAL_BASE_EXTERNS_H 3 | 4 | extern metadata_thp_mode_t opt_metadata_thp; 5 | extern const char *metadata_thp_mode_names[]; 6 | 7 | base_t *b0get(void); 8 | base_t *base_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks); 9 | void base_delete(tsdn_t *tsdn, base_t *base); 10 | extent_hooks_t *base_extent_hooks_get(base_t *base); 11 | extent_hooks_t *base_extent_hooks_set(base_t *base, 12 | extent_hooks_t *extent_hooks); 13 | void *base_alloc(tsdn_t *tsdn, base_t *base, size_t size, size_t alignment); 14 | extent_t *base_alloc_extent(tsdn_t *tsdn, base_t *base); 15 | void base_stats_get(tsdn_t *tsdn, base_t *base, size_t *allocated, 16 | size_t *resident, size_t *mapped, size_t *n_thp); 17 | void base_prefork(tsdn_t *tsdn, base_t *base); 18 | void base_postfork_parent(tsdn_t *tsdn, base_t *base); 19 | void base_postfork_child(tsdn_t *tsdn, base_t *base); 20 | bool base_boot(tsdn_t *tsdn); 21 | 22 | #endif /* JEMALLOC_INTERNAL_BASE_EXTERNS_H */ 23 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/test/unit/slab.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_arena_slab_regind) { 4 | szind_t binind; 5 | 6 | for (binind = 0; binind < NBINS; binind++) { 7 | size_t regind; 8 | extent_t slab; 9 | const arena_bin_info_t *bin_info = &arena_bin_info[binind]; 10 | extent_init(&slab, NULL, mallocx(bin_info->slab_size, 11 | MALLOCX_LG_ALIGN(LG_PAGE)), bin_info->slab_size, true, 12 | binind, 0, extent_state_active, false, true); 13 | assert_ptr_not_null(extent_addr_get(&slab), 14 | "Unexpected malloc() failure"); 15 | for (regind = 0; regind < bin_info->nregs; regind++) { 16 | void *reg = (void *)((uintptr_t)extent_addr_get(&slab) + 17 | (bin_info->reg_size * regind)); 18 | assert_zu_eq(arena_slab_regind(&slab, binind, reg), 19 | regind, 20 | "Incorrect region index computed for size %zu", 21 | bin_info->reg_size); 22 | } 23 | free(extent_addr_get(&slab)); 24 | } 25 | } 26 | TEST_END 27 | 28 | int 29 | main(void) { 30 | return test( 31 | test_arena_slab_regind); 32 | } 33 | -------------------------------------------------------------------------------- /tests/cluster/tests/includes/utils.tcl: -------------------------------------------------------------------------------- 1 | source "../../../tests/support/cli.tcl" 2 | 3 | proc config_set_all_nodes {keyword value} { 4 | foreach_redis_id id { 5 | R $id config set $keyword $value 6 | } 7 | } 8 | 9 | proc fix_cluster {addr} { 10 | set code [catch { 11 | exec ../../../src/keydb-cli {*}[rediscli_tls_config "../../../tests"] --cluster fix $addr << yes 12 | } result] 13 | if {$code != 0} { 14 | puts "keydb-cli --cluster fix returns non-zero exit code, output below:\n$result" 15 | } 16 | # Note: keydb-cli --cluster fix may return a non-zero exit code if nodes don't agree, 17 | # but we can ignore that and rely on the check below. 18 | assert_cluster_state ok 19 | wait_for_condition 100 100 { 20 | [catch {exec ../../../src/keydb-cli {*}[rediscli_tls_config "../../../tests"] --cluster check $addr} result] == 0 21 | } else { 22 | puts "keydb-cli --cluster check returns non-zero exit code, output below:\n$result" 23 | fail "Cluster could not settle with configuration" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/slab.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_arena_slab_regind) { 4 | szind_t binind; 5 | 6 | for (binind = 0; binind < SC_NBINS; binind++) { 7 | size_t regind; 8 | extent_t slab; 9 | const bin_info_t *bin_info = &bin_infos[binind]; 10 | extent_init(&slab, NULL, mallocx(bin_info->slab_size, 11 | MALLOCX_LG_ALIGN(LG_PAGE)), bin_info->slab_size, true, 12 | binind, 0, extent_state_active, false, true, true, 13 | EXTENT_NOT_HEAD); 14 | assert_ptr_not_null(extent_addr_get(&slab), 15 | "Unexpected malloc() failure"); 16 | for (regind = 0; regind < bin_info->nregs; regind++) { 17 | void *reg = (void *)((uintptr_t)extent_addr_get(&slab) + 18 | (bin_info->reg_size * regind)); 19 | assert_zu_eq(arena_slab_regind(&slab, binind, reg), 20 | regind, 21 | "Incorrect region index computed for size %zu", 22 | bin_info->reg_size); 23 | } 24 | free(extent_addr_get(&slab)); 25 | } 26 | } 27 | TEST_END 28 | 29 | int 30 | main(void) { 31 | return test( 32 | test_arena_slab_regind); 33 | } 34 | -------------------------------------------------------------------------------- /utils/releasetools/02_upload_tarball.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ $# != "1" ] 3 | then 4 | echo "Usage: ./utils/releasetools/02_upload_tarball.sh " 5 | exit 1 6 | fi 7 | 8 | echo "Uploading..." 9 | scp /tmp/redis-${1}.tar.gz ubuntu@host.redis.io:/var/www/download/releases/ 10 | echo "Updating web site... " 11 | echo "Please check the github action tests for the release." 12 | echo "Press any key if it is a stable release, or Ctrl+C to abort" 13 | read x 14 | ssh ubuntu@host.redis.io "cd /var/www/download; 15 | rm -rf redis-${1}.tar.gz; 16 | wget http://download.redis.io/releases/redis-${1}.tar.gz; 17 | tar xvzf redis-${1}.tar.gz; 18 | rm -rf redis-stable; 19 | mv redis-${1} redis-stable; 20 | tar cvzf redis-stable.tar.gz redis-stable; 21 | rm -rf redis-${1}.tar.gz; 22 | shasum -a 256 redis-stable.tar.gz > redis-stable.tar.gz.SHA256SUM; 23 | " 24 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/sc.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_update_slab_size) { 4 | sc_data_t data; 5 | memset(&data, 0, sizeof(data)); 6 | sc_data_init(&data); 7 | sc_t *tiny = &data.sc[0]; 8 | size_t tiny_size = (ZU(1) << tiny->lg_base) 9 | + (ZU(tiny->ndelta) << tiny->lg_delta); 10 | size_t pgs_too_big = (tiny_size * BITMAP_MAXBITS + PAGE - 1) / PAGE + 1; 11 | sc_data_update_slab_size(&data, tiny_size, tiny_size, (int)pgs_too_big); 12 | assert_zu_lt((size_t)tiny->pgs, pgs_too_big, "Allowed excessive pages"); 13 | 14 | sc_data_update_slab_size(&data, 1, 10 * PAGE, 1); 15 | for (int i = 0; i < data.nbins; i++) { 16 | sc_t *sc = &data.sc[i]; 17 | size_t reg_size = (ZU(1) << sc->lg_base) 18 | + (ZU(sc->ndelta) << sc->lg_delta); 19 | if (reg_size <= PAGE) { 20 | assert_d_eq(sc->pgs, 1, "Ignored valid page size hint"); 21 | } else { 22 | assert_d_gt(sc->pgs, 1, 23 | "Allowed invalid page size hint"); 24 | } 25 | } 26 | } 27 | TEST_END 28 | 29 | int 30 | main(void) { 31 | return test( 32 | test_update_slab_size); 33 | } 34 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/msvc/projects/vc2015/test_threads/test_threads.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | 22 | 23 | Header Files 24 | 25 | 26 | -------------------------------------------------------------------------------- /deps/cpp-statsd-client/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Vincent Thiery 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /deps/lua/etc/Makefile: -------------------------------------------------------------------------------- 1 | # makefile for Lua etc 2 | 3 | TOP= .. 4 | LIB= $(TOP)/src 5 | INC= $(TOP)/src 6 | BIN= $(TOP)/src 7 | SRC= $(TOP)/src 8 | TST= $(TOP)/test 9 | 10 | CC= gcc 11 | CFLAGS= -O2 -Wall -I$(INC) $(MYCFLAGS) 12 | MYCFLAGS= 13 | MYLDFLAGS= -Wl,-E 14 | MYLIBS= -lm 15 | #MYLIBS= -lm -Wl,-E -ldl -lreadline -lhistory -lncurses 16 | RM= rm -f 17 | 18 | default: 19 | @echo 'Please choose a target: min noparser one strict clean' 20 | 21 | min: min.c 22 | $(CC) $(CFLAGS) $@.c -L$(LIB) -llua $(MYLIBS) 23 | echo 'print"Hello there!"' | ./a.out 24 | 25 | noparser: noparser.o 26 | $(CC) noparser.o $(SRC)/lua.o -L$(LIB) -llua $(MYLIBS) 27 | $(BIN)/luac $(TST)/hello.lua 28 | -./a.out luac.out 29 | -./a.out -e'a=1' 30 | 31 | one: 32 | $(CC) $(CFLAGS) all.c $(MYLIBS) 33 | ./a.out $(TST)/hello.lua 34 | 35 | strict: 36 | -$(BIN)/lua -e 'print(a);b=2' 37 | -$(BIN)/lua -lstrict -e 'print(a)' 38 | -$(BIN)/lua -e 'function f() b=2 end f()' 39 | -$(BIN)/lua -lstrict -e 'function f() b=2 end f()' 40 | 41 | clean: 42 | $(RM) a.out core core.* *.o luac.out 43 | 44 | .PHONY: default min noparser one strict clean 45 | -------------------------------------------------------------------------------- /deps/lua/etc/strict.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- strict.lua 3 | -- checks uses of undeclared global variables 4 | -- All global variables must be 'declared' through a regular assignment 5 | -- (even assigning nil will do) in a main chunk before being used 6 | -- anywhere or assigned to inside a function. 7 | -- 8 | 9 | local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget 10 | 11 | local mt = getmetatable(_G) 12 | if mt == nil then 13 | mt = {} 14 | setmetatable(_G, mt) 15 | end 16 | 17 | mt.__declared = {} 18 | 19 | local function what () 20 | local d = getinfo(3, "S") 21 | return d and d.what or "C" 22 | end 23 | 24 | mt.__newindex = function (t, n, v) 25 | if not mt.__declared[n] then 26 | local w = what() 27 | if w ~= "main" and w ~= "C" then 28 | error("assign to undeclared variable '"..n.."'", 2) 29 | end 30 | mt.__declared[n] = true 31 | end 32 | rawset(t, n, v) 33 | end 34 | 35 | mt.__index = function (t, n) 36 | if not mt.__declared[n] and what() ~= "C" then 37 | error("variable '"..n.."' is not declared", 2) 38 | end 39 | return rawget(t, n) 40 | end 41 | 42 | -------------------------------------------------------------------------------- /tests/unit/moduleapi/test_lazyfree.tcl: -------------------------------------------------------------------------------- 1 | set testmodule [file normalize tests/modules/test_lazyfree.so] 2 | 3 | start_server {tags {"modules"}} { 4 | r module load $testmodule 5 | 6 | test "modules allocated memory can be reclaimed in the background" { 7 | set orig_mem [s used_memory] 8 | set rd [redis_deferring_client] 9 | 10 | # LAZYFREE_THRESHOLD is 64 11 | for {set i 0} {$i < 10000} {incr i} { 12 | $rd lazyfreelink.insert lazykey $i 13 | } 14 | 15 | for {set j 0} {$j < 10000} {incr j} { 16 | $rd read 17 | } 18 | 19 | assert {[r lazyfreelink.len lazykey] == 10000} 20 | 21 | set peak_mem [s used_memory] 22 | assert {[r unlink lazykey] == 1} 23 | assert {$peak_mem > $orig_mem+10000} 24 | wait_for_condition 50 100 { 25 | [s used_memory] < $peak_mem && 26 | [s used_memory] < $orig_mem*2 && 27 | [string match {*lazyfreed_objects:1*} [r info Memory]] 28 | } else { 29 | fail "Module memory is not reclaimed by UNLINK" 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .*.swp 2 | core 3 | *.o 4 | *.xo 5 | *.so 6 | *.d 7 | !**/bash_completion.d 8 | !**/logrotate.d 9 | !**/keydb.service.d 10 | !**/keydb-sentinel.service.d 11 | *.log 12 | dump.rdb 13 | src/keydb-server 14 | **/bin/keydb-server 15 | **/app/keydb-server 16 | *.deb 17 | *.rpm 18 | src/keydb-cli 19 | **/bin/keydb-cli 20 | **/app/keydb-cli 21 | src/keydb-sentinel 22 | **/bin/keydb-sentinel 23 | **/app/keydb-sentinel 24 | redis-benchmark 25 | keydb-benchmark 26 | redis-check-aof 27 | keydb-check-aof 28 | redis-check-rdb 29 | keydb-check-rdb 30 | redis-check-dump 31 | keydb-check-dump 32 | keydb-diagnostic-tool 33 | redis-cli 34 | redis-sentinel 35 | redis-server 36 | doc-tools 37 | release 38 | misc/* 39 | src/release.h 40 | appendonly.aof 41 | SHORT_TERM_TODO 42 | release.h 43 | src/transfer.sh 44 | src/configs 45 | redis.ds 46 | src/keydb.conf 47 | src/nodes.conf 48 | deps/lua/src/lua 49 | deps/lua/src/luac 50 | deps/lua/src/liblua.a 51 | tests/tls*/* 52 | .make-* 53 | .prerequisites 54 | *.dSYM 55 | Makefile.dep 56 | .vscode/* 57 | .idea/* 58 | .ccls 59 | .ccls-cache/* 60 | compile_commands.json 61 | keydb.code-workspace 62 | -------------------------------------------------------------------------------- /deps/memkind/src/jemalloc/src/extent_mmap.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_EXTENT_MMAP_C_ 2 | #include "jemalloc/internal/jemalloc_preamble.h" 3 | #include "jemalloc/internal/jemalloc_internal_includes.h" 4 | 5 | #include "jemalloc/internal/assert.h" 6 | #include "jemalloc/internal/extent_mmap.h" 7 | 8 | /******************************************************************************/ 9 | /* Data. */ 10 | 11 | bool opt_retain = 12 | #ifdef JEMALLOC_RETAIN 13 | true 14 | #else 15 | false 16 | #endif 17 | ; 18 | 19 | /******************************************************************************/ 20 | 21 | void * 22 | extent_alloc_mmap(void *new_addr, size_t size, size_t alignment, bool *zero, 23 | bool *commit) { 24 | void *ret = pages_map(new_addr, size, ALIGNMENT_CEILING(alignment, 25 | PAGE), commit); 26 | if (ret == NULL) { 27 | return NULL; 28 | } 29 | assert(ret != NULL); 30 | if (*commit) { 31 | *zero = true; 32 | } 33 | return ret; 34 | } 35 | 36 | bool 37 | extent_dalloc_mmap(void *addr, size_t size) { 38 | if (!opt_retain) { 39 | pages_unmap(addr, size); 40 | } 41 | return opt_retain; 42 | } 43 | -------------------------------------------------------------------------------- /deps/jemalloc/README: -------------------------------------------------------------------------------- 1 | jemalloc is a general purpose malloc(3) implementation that emphasizes 2 | fragmentation avoidance and scalable concurrency support. jemalloc first came 3 | into use as the FreeBSD libc allocator in 2005, and since then it has found its 4 | way into numerous applications that rely on its predictable behavior. In 2010 5 | jemalloc development efforts broadened to include developer support features 6 | such as heap profiling and extensive monitoring/tuning hooks. Modern jemalloc 7 | releases continue to be integrated back into FreeBSD, and therefore versatility 8 | remains critical. Ongoing development efforts trend toward making jemalloc 9 | among the best allocators for a broad range of demanding applications, and 10 | eliminating/mitigating weaknesses that have practical repercussions for real 11 | world applications. 12 | 13 | The COPYING file contains copyright and licensing information. 14 | 15 | The INSTALL file contains information on how to configure, build, and install 16 | jemalloc. 17 | 18 | The ChangeLog file contains a brief summary of changes for each release. 19 | 20 | URL: http://jemalloc.net/ 21 | -------------------------------------------------------------------------------- /src/AsyncWorkQueue.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "fastlock.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class AsyncWorkQueue 12 | { 13 | struct WorkItem 14 | { 15 | WorkItem(std::function &&fnAsync) 16 | : fnAsync(std::move(fnAsync)) 17 | {} 18 | 19 | WorkItem(WorkItem&&) = default; 20 | std::function fnAsync; 21 | }; 22 | std::vector m_vecthreads; 23 | std::vector m_vecpthreadVars; 24 | std::deque m_workqueue; 25 | std::mutex m_mutex; 26 | std::condition_variable m_cvWakeup; 27 | std::atomic m_fQuitting { false }; 28 | 29 | void WorkerThreadMain(); 30 | public: 31 | AsyncWorkQueue(int nthreads); 32 | ~AsyncWorkQueue(); 33 | 34 | void AddWorkFunction(std::function &&fnAsync, bool fHiPri = false); 35 | bool removeClientAsyncWrites(struct client *c); 36 | 37 | void shutdown(); 38 | 39 | void abandonThreads(); 40 | }; -------------------------------------------------------------------------------- /deps/cpp-statsd-client/.github/workflows/coverage.yml: -------------------------------------------------------------------------------- 1 | name: Coverage 2 | 3 | on: [push, pull_request] 4 | jobs: 5 | coverage: 6 | runs-on: ubuntu-20.04 7 | steps: 8 | - uses: actions/checkout@v2 9 | - name: dependencies 10 | shell: bash 11 | run: | 12 | sudo apt-get update 13 | sudo apt-get install -y -qq make cmake gcc g++ lcov bc 14 | - name: build 15 | shell: bash 16 | run: | 17 | export LD_LIBRARY_PATH=.:$(cat /etc/ld.so.conf.d/* | grep -vF "#" | tr "\\n" ":" | sed -e "s/:$//g") 18 | cmake . -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=On 19 | make all -j$(nproc) 20 | - name: coverage 21 | shell: bash 22 | run: | 23 | make coverage 24 | lines=$(lcov --summary coverage.info | grep -F lines | awk '{print $2}' | sed -e "s/%//g") 25 | if (( $(echo "${lines} < ${COVERAGE_THRESHOLD}" | bc -l) )); then 26 | echo "Line coverage dropped below ${COVERAGE_THRESHOLD}% to ${lines}%" 27 | exit 1 28 | fi 29 | env: 30 | COVERAGE_THRESHOLD: 85.0 31 | -------------------------------------------------------------------------------- /deps/jemalloc/src/extent_mmap.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_EXTENT_MMAP_C_ 2 | #include "jemalloc/internal/jemalloc_preamble.h" 3 | #include "jemalloc/internal/jemalloc_internal_includes.h" 4 | 5 | #include "jemalloc/internal/assert.h" 6 | #include "jemalloc/internal/extent_mmap.h" 7 | 8 | /******************************************************************************/ 9 | /* Data. */ 10 | 11 | bool opt_retain = 12 | #ifdef JEMALLOC_RETAIN 13 | true 14 | #else 15 | false 16 | #endif 17 | ; 18 | 19 | /******************************************************************************/ 20 | 21 | void * 22 | extent_alloc_mmap(void *new_addr, size_t size, size_t alignment, bool *zero, 23 | bool *commit) { 24 | assert(alignment == ALIGNMENT_CEILING(alignment, PAGE)); 25 | void *ret = pages_map(new_addr, size, alignment, commit); 26 | if (ret == NULL) { 27 | return NULL; 28 | } 29 | assert(ret != NULL); 30 | if (*commit) { 31 | *zero = true; 32 | } 33 | return ret; 34 | } 35 | 36 | bool 37 | extent_dalloc_mmap(void *addr, size_t size) { 38 | if (!opt_retain) { 39 | pages_unmap(addr, size); 40 | } 41 | return opt_retain; 42 | } 43 | -------------------------------------------------------------------------------- /deps/lua/etc/README: -------------------------------------------------------------------------------- 1 | This directory contains some useful files and code. 2 | Unlike the code in ../src, everything here is in the public domain. 3 | 4 | If any of the makes fail, you're probably not using the same libraries 5 | used to build Lua. Set MYLIBS in Makefile accordingly. 6 | 7 | all.c 8 | Full Lua interpreter in a single file. 9 | Do "make one" for a demo. 10 | 11 | lua.hpp 12 | Lua header files for C++ using 'extern "C"'. 13 | 14 | lua.ico 15 | A Lua icon for Windows (and web sites: save as favicon.ico). 16 | Drawn by hand by Markus Gritsch . 17 | 18 | lua.pc 19 | pkg-config data for Lua 20 | 21 | luavs.bat 22 | Script to build Lua under "Visual Studio .NET Command Prompt". 23 | Run it from the toplevel as etc\luavs.bat. 24 | 25 | min.c 26 | A minimal Lua interpreter. 27 | Good for learning and for starting your own. 28 | Do "make min" for a demo. 29 | 30 | noparser.c 31 | Linking with noparser.o avoids loading the parsing modules in lualib.a. 32 | Do "make noparser" for a demo. 33 | 34 | strict.lua 35 | Traps uses of undeclared global variables. 36 | Do "make strict" for a demo. 37 | 38 | --------------------------------------------------------------------------------