376 Commits

Author SHA1 Message Date
zhenwei pi
2c853869bf Support setcpuaffinity on linux/bsd
Currently, there are several types of threads/child processes of a
redis server. Sometimes we need deeply optimise the performance of
redis, so we would like to isolate threads/processes.

There were some discussion about cpu affinity cases in the issue:
https://github.com/antirez/redis/issues/2863

So implement cpu affinity setting by redis.conf in this patch, then
we can config server_cpulist/bio_cpulist/aof_rewrite_cpulist/
bgsave_cpulist by cpu list.

Examples of cpulist in redis.conf:
server_cpulist 0-7:2      means cpu affinity 0,2,4,6
bio_cpulist 1,3           means cpu affinity 1,3
aof_rewrite_cpulist 8-11  means cpu affinity 8,9,10,11
bgsave_cpulist 1,10-11    means cpu affinity 1,10,11

Test on linux/freebsd, both work fine.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2020-05-02 21:19:47 +08:00
Salvatore Sanfilippo
a58de4cff0 Merge pull request #6243 from soloestoy/expand-lazy-free-server-del
lazyfree: add a new configuration lazyfree-lazy-user-del
2020-04-06 17:27:39 +02:00
antirez
3b5ca2f19f ACL: Make Redis 6 more backward compatible with requirepass.
Note that this as a side effect fixes Sentinel "requirepass" mode.
2020-03-16 16:57:12 +01:00
antirez
b3134c8dd3 Make sync RDB deletion configurable. Default to no. 2020-03-04 17:44:21 +01:00
antirez
efd2cf9b78 Show Redis version when not understanding a config directive.
This makes simpler to give people help when posting such kind of errors
in the mailing list or other help forums, because sometimes the
directive looks well spelled, but the version of Redis they are using is
not able to support it.
2020-02-27 18:21:12 +01:00
antirez
e45e07a268 Fix SDS misuse in enumConfigSet(). Related to #6778. 2020-02-27 17:51:30 +01:00
antirez
adaa89c8a4 Remove useless comment from enumConfigSet(). 2020-02-27 17:45:56 +01:00
Salvatore Sanfilippo
e6270c77f1 Merge pull request #6778 from pponnuvel/fix_possible_overflow
Fix a potential overflow with strncpy
2020-02-27 17:45:02 +01:00
antirez
c64fa84e08 Tracking: fix max-keys configuration directive. 2020-02-19 19:00:29 +01:00
antirez
dcb43f4530 Tracking: minor change of names and new INFO field. 2020-02-07 18:12:45 +01:00
antirez
2700fae0b7 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2020-02-06 11:24:22 +01:00
Salvatore Sanfilippo
f27243d2da Merge pull request #6844 from oranagra/bind_config_leak
Memory leak when bind config is provided twice
2020-02-06 10:33:40 +01:00
Oran Agra
e41c1824d6 fix maxmemory config warning
the warning condition was if usage > limit (saying it'll cause eviction
or oom), but in fact the eviction and oom depends on used minus slave
buffers.

other than fixing the condition, i add info about the current usage and
limit, which may be useful when looking at the log.
2020-02-06 09:23:22 +02:00
Oran Agra
f7bb301644 Memory leak when bind config is provided twice 2020-02-06 09:17:39 +02:00
Oran Agra
097a0a52d6 config.c verbose error replies for CONFIG SET, like config file parsing
We noticed that the error replies for the generic mechanism for enums
are very verbose for config file parsing, but not for config set
command.

instead of replicating this code, i did a small refactoring to share
code between CONFIG SET and config file parsing.

and also renamed the enum group functions to be consistent with the
naming of other types.
2020-02-05 11:41:24 +02:00
antirez
f1518f63b1 ACL LOG: make max log entries configurable. 2020-02-04 13:19:40 +01:00
Ponnuvel Palaniyappan
9df0a501ee Fix a potential overflow with strncpy 2020-01-14 08:10:39 +00:00
Salvatore Sanfilippo
6c1ce6b565 Merge pull request #6715 from trevor211/fixPotentialClusterLinkError
Fix petential cluster link error.
2020-01-09 17:05:54 +01:00
Itamar Haber
74a4290063 Adjusts 'io_threads_num' max to 128
Instead of 512, use the defined max from networking.c
2020-01-04 18:33:24 +02:00
WuYunlong
8aa821fd0a Fix petential cluster link error.
Funcion adjustOpenFilesLimit() has an implicit parameter, which is server.maxclients.
This function aims to ajust maximum file descriptor number according to server.maxclients
by best effort, which is "bestlimit" could be lower than "maxfiles" but greater than "oldlimit".
When we try to increase "maxclients" using CONFIG SET command, we could increase maximum
file descriptor number to a bigger value without calling aeResizeSetSize the same time.
When later more and more clients connect to server, the allocated fd could be bigger and bigger,
and eventually exceeds events size of aeEventLoop.events. When new nodes joins the cluster,
new link is created, together with new fd, but when calling aeCreateFileEvent, we did not
check the return value. In this case, we have a non-null "link" but the associated fd is not
registered.

So when we dynamically set "maxclients" we could reach an inconsistency between maximum file
descriptor number of the process and server.maxclients. And later could cause cluster link and link
fd inconsistency.

While setting "maxclients" dynamically, we consider it as failed when resulting "maxclients" is not
the same as expected. We try to restore back the maximum file descriptor number when we failed to set
"maxclients" to the specified value, so that server.maxclients could act as a guard as before.
2019-12-31 18:16:30 +08:00
Oran Agra
f10051c5fd config.c adjust config limits and mutable
- make lua-replicate-commands mutable (it never was, but i don't see why)
- make tcp-backlog immutable (fix a recent refactory mistake)
- increase the max limit of a few configs to match what they were before
the recent refactory
2019-12-26 15:16:15 +02:00
zhaozhao.zz
498f483890 lazyfree: add a new configuration lazyfree-lazy-user-del
Delete keys in async way when executing DEL command, if
lazyfree-lazy-user-del is yes.
2019-12-18 16:54:49 +08:00
Madelyn Olson
2d2f4ee475 Resolved merge miss 2019-12-16 23:40:19 -08:00
Madelyn Olson
d9c79ff75c Add configuration option for allowing reads on cluster down 2019-12-16 23:33:16 -08:00
Oran Agra
015136bf06 config.c post refactory cleanup 2019-12-01 08:19:25 +02:00
Oran Agra
493cc493b6 Converting more configs to use generic infra, and moving defaults to config.c
Changes in behavior:
- Change server.stream_node_max_entries from int64_t to long long, so that it can be used by the generic infra
- standard error reply instead of "repl-backlog-size must be 1 or greater" and such
- tls-port and a few TLS booleans were readable (config get) even when USE_OPENSSL was off (now they aren't)
- syslog-enabled, syslog-ident, cluster-enabled, appendfilename, and supervised didn't have a get (now they do)
- pidfile was initialized to NULL in InitServerConfig but had CONFIG_DEFAULT_PID_FILE in rewriteConfig (so the real default was "", but rewrite would cause it to be set), fixed the rewrite.
- TLS config in server.h was uninitialized (if no tls config args were provided)

Adding test for sanity and coverage
2019-11-28 11:24:57 +02:00
Oran Agra
0462896e15 More improvements and fixes to generic config infra
- Adding is_valid_fn and update_fn, both return 1 for success and 0 for failure with an optional error message.
- Bugfix in handling boundary check of unsigned numeric types (was boundaries as signed)
- Adding more numeric types to generic mechanism: uint, ulonglong, long, time_t, off_t
- More verbose error replies ("argument must be between" in out of range CONFIG SET (like config file parsing)
2019-11-28 11:11:07 +02:00
Oran Agra
82e997c043 Additional config.c refactory and bugfixes
- add capability for each config to have a callback to check if value is valid and return error string
  will enable converting many of the remaining custom configs into generic ones (reducing the x4 repetition for set,get,config,rewrite)
- add capability for each config to  to run some update code after config is changed (only for CONFIG SET)
  will also enable converting many of the remaining custom configs into generic ones
- add capability to move default values from server.h and server.c to config.c
  will reduce many excess lines in server.h and server.c (plus, no need to rebuild the entire code base when a default change 8-))

other behavior changes:
- fix bug in bool config get (always returning 'yes')
- fix a bug in modifying jemalloc-bg-thread at runtime (didn't call set_jemalloc_bg_thread, due to bad merge conflict resolution (my fault))
- side effect when a failed attempt to enable activedefrag at runtime, we now respond with -ERR and not with -DISABLED
2019-11-26 16:52:28 +02:00
antirez
b7d9ef6033 config.c: remove trailing spaces, trim comments to 80 cols. 2019-11-22 17:54:22 +01:00
Madelyn Olson
678cf14f4a Changed a tab to a space 2019-11-22 06:44:12 +00:00
Madelyn Olson
c0891d5cca Fixed a bug with enum log printing 2019-11-22 06:28:50 +00:00
Madelyn Olson
1f35b8ce05 Fixed some linux warnings 2019-11-22 05:49:52 +00:00
Madelyn Olson
d57a2b9ef2 Added a flag for strings that are stored as NULL 2019-11-21 21:31:53 -08:00
Madelyn Olson
faeed15627 Refactored renaming types in config 2019-11-20 09:22:38 -08:00
antirez
c7d07138c7 Expire cycle: make expire effort configurable. 2019-11-18 11:33:44 +01:00
Yossi Gottlieb
85d7f38136 Merge remote-tracking branch 'upstream/unstable' into tls 2019-10-16 17:08:07 +03:00
Yossi Gottlieb
514e5aa8ef TLS: Improve CA certifiate configuration options.
This adds support for explicit configuration of a CA certs directory (in
addition to the previously supported bundle file).  For redis-cli, if no
explicit CA configuration is supplied the system-wide default
configuration will be adopted.
2019-10-08 17:58:50 +03:00
Yossi Gottlieb
df08b624bd TLS: Configuration options.
Add configuration options for TLS protocol versions, ciphers/cipher
suites selection, etc.
2019-10-07 21:07:27 +03:00
Oran Agra
6fd5ff8c98 diskless replication rdb transfer uses pipe, and writes to sockets form the parent process.
misc:
- handle SSL_has_pending by iterating though these in beforeSleep, and setting timeout of 0 to aeProcessEvents
- fix issue with epoll signaling EPOLLHUP and EPOLLERR only to the write handlers. (needed to detect the rdb pipe was closed)
- add key-load-delay config for testing
- trim connShutdown which is no longer needed
- rioFdsetWrite -> rioFdWrite - simplified since there's no longer need to write to multiple FDs
- don't detect rdb child exited (don't call wait3) until we detect the pipe is closed
- Cleanup bad optimization from rio.c, add another one
2019-10-07 21:06:30 +03:00
Yossi Gottlieb
10ffeb03e4 TLS: Connections refactoring and TLS support.
* Introduce a connection abstraction layer for all socket operations and
integrate it across the code base.
* Provide an optional TLS connections implementation based on OpenSSL.
* Pull a newer version of hiredis with TLS support.
* Tests, redis-cli updates for TLS support.
2019-10-07 21:06:13 +03:00
Oran Agra
7737e5814a Merge remote-tracking branch 'antirez/unstable' into jemalloc_purge_bg 2019-10-04 13:53:40 +03:00
Salvatore Sanfilippo
14a50854cc Merge pull request #6308 from oranagra/repl-diskless-load-config
fix error handling on config parsing of repl-diskless-load
2019-10-04 11:56:08 +02:00
antirez
31a20f0fbb Make config.c always_replicate_commands more uniform.
Better if it resembles the other similar code paths.
2019-09-20 11:46:35 +02:00
antirez
e7444fde2d Remove redundant statement in config.c.
Thanks to @guybe7 for spotting the error in the original PR I merged.
2019-09-20 11:44:32 +02:00
WuYunlong
dd077faf49 Fix bad handling of unexpected option while loading config "lua-replicate-commands". 2019-09-20 08:14:36 +08:00
Oran Agra
f1c8492bca fix error handling on config parsing of repl-diskless-load 2019-08-08 14:53:36 +03:00
antirez
d427b312ea Merge branch 'unstable' of github.com:/antirez/redis into unstable 2019-07-24 11:45:19 +02:00
antirez
83b8fbf580 Client side caching: config option for table fill rate. 2019-07-24 11:35:01 +02:00
Salvatore Sanfilippo
ece91a4bc7 Merge pull request #6265 from madolson/dev-unstable-remove-create-object
Removed unnecessary creation of Redis objects
2019-07-23 17:05:10 +02:00
Madelyn Olson
dedbc9d4d2 Removed unecessary creation of Redis objects 2019-07-22 22:52:16 -07:00