594 Commits

Author SHA1 Message Date
antirez
9325d288f6 RESP3: put RESP version in the client structure. 2019-01-09 17:00:29 +01:00
antirez
036e10dcb9 RESP3: Use new deferred len API in server.c. 2019-01-09 17:00:29 +01:00
antirez
689949fb30 RESP3: Aggregate deferred lengths functions. 2019-01-09 17:00:29 +01:00
antirez
f7e99b07f3 Modules shared API: initial core functions.
Based on ideas and code in PR #5560 by @MeirShpilraien.
2018-12-20 17:57:35 +01:00
antirez
ea2d253238 Revert shared APIs to modify the design. 2018-12-20 17:56:38 +01:00
MeirShpilraien
2a907e7d00 added module ability to register api to be used by other modules 2018-12-20 17:55:18 +01:00
antirez
421c242dd0 freeMemoryIfNeeded() small refactoring.
Related to issue #5686 and PR #5689.
2018-12-12 11:37:15 +01:00
antirez
83b0df508c Reject EXEC containing write commands against RO replica.
Thanks to @soloestoy for discovering this issue in #5667.
This is an alternative fix in order to avoid both cycling the clients
and also disconnecting clients just having valid read-only transactions
pending.
2018-12-11 11:39:21 +01:00
Oran Agra
bad0b20979 fix #5580, display fragmentation and rss overhead bytes as signed
these metrics become negative when RSS is smaller than the used_memory.
This can easily happen when the program allocated a lot of memory and haven't
written to it yet, in which case the kernel doesn't allocate any pages to the process
2018-12-02 15:29:20 +02:00
antirez
8e399f0e01 Streams: XSTREAM SETID -> XSETID.
Keep vanilla stream commands at toplevel, see #5426.
2018-10-16 13:17:14 +02:00
Salvatore Sanfilippo
ff1b36c825 Merge pull request #5426 from soloestoy/feature-xstream
Bugfix data inconsistency after aof rewrite, and add XSTREAM command.
2018-10-16 13:10:36 +02:00
antirez
b10d99a13b Fix propagation of consumer groups last ID.
Issue #5433.
2018-10-10 12:51:02 +02:00
antirez
4e851f8044 Introduce protectClient() + some refactoring.
The idea is to have an API for the cases like -BUSY state and DEBUG
RELOAD where we have to manually deinstall the read handler.
See #4804.
2018-10-09 13:15:41 +02:00
zhaozhao.zz
7e2c73d79b Streams: add a new command XTREAM
XSTREAM CREATE <key> <id or *> -- Create a new empty stream.
XSTREAM SETID <key> <id or $>  -- Set the current stream ID.
2018-10-09 13:11:04 +08:00
antirez
96ceafbe4d Module cluster flags: initial vars / defines added. 2018-09-19 11:20:52 +02:00
antirez
55d85db425 LOLWUT: wrap it into a proper command. 2018-09-12 11:34:10 +02:00
antirez
bdca5b9be5 Slave removal: SLAVEOF -> REPLICAOF. SLAVEOF is now an alias. 2018-09-11 15:32:28 +02:00
antirez
02306736c9 Unblocked clients API refactoring. See #4418. 2018-09-03 18:39:18 +02:00
antirez
f0348a6543 Make pending buffer processing safe for CLIENT_MASTER client.
Related to #5305.
2018-09-03 18:17:31 +02:00
antirez
d85194c4e1 Introduce repl_slave_ignore_maxmemory flag internally.
Note: this breaks backward compatibility with Redis 4, since now slaves
by default are exact copies of masters and do not try to evict keys
independently.
2018-08-27 12:20:27 +02:00
Salvatore Sanfilippo
38bcee980a Merge pull request #5248 from soloestoy/rewrite-brpoplpush
rewrite BRPOPLPUSH as RPOPLPUSH to propagate
2018-08-26 16:31:24 +02:00
zhaozhao.zz
b448b16718 block: rewrite BRPOPLPUSH as RPOPLPUSH to propagate 2018-08-14 20:58:58 +08:00
zhaozhao.zz
59c4b6bf00 pipeline: do not sdsrange querybuf unless all commands processed
This is an optimization for processing pipeline, we discussed a
problem in issue #5229: clients may be paused if we apply `CLIENT
PAUSE` command, and then querybuf may grow too large, the cost of
memmove in sdsrange after parsing a completed command will be
horrible. The optimization is that parsing all commands in queyrbuf
, after that we can just call sdsrange only once.
2018-08-14 00:43:42 +08:00
Salvatore Sanfilippo
b1092d1424 Merge pull request #5189 from soloestoy/refactor-dbOverwrite
refactor dbOverwrite to make lazyfree work
2018-07-31 16:40:35 +02:00
antirez
8442c25722 Introduce writeCommandsDeniedByDiskError(). 2018-07-31 13:09:38 +02:00
zhaozhao.zz
b880a352d6 refactor dbOverwrite to make lazyfree work 2018-07-31 12:07:57 +08:00
antirez
1a722347b0 Control dynamic HZ via server configuration. 2018-07-30 13:37:30 +02:00
antirez
f3bf122c28 Merge branch 'dynamic-hz' into unstable 2018-07-30 13:31:23 +02:00
Salvatore Sanfilippo
63171b81b0 Merge pull request #4883 from itamarhaber/lua_scripts-in-info-memory
Adds memory information about the scripts' cache to INFO
2018-07-23 18:43:05 +02:00
antirez
89c6c7bd88 Dynamic HZ: adapt cron frequency to number of clients. 2018-07-23 14:21:04 +02:00
antirez
2f58f65ee8 Dynamic HZ: separate hz from the configured hz.
This way we can remember what the user configured HZ is, but change the
actual HZ dynamically if needed in the dynamic HZ feature
implementation.
2018-07-23 14:13:58 +02:00
Itamar Haber
a3c4ec8a84 Adds Lua overheads to MEMORY STATS, smartens the MEMORY DOCTOR 2018-07-22 21:16:00 +03:00
antirez
b5034b01f8 Hopefully improve commenting of #5126.
Reading the PR gave me the opportunity to better specify what the code
was doing in places where I was not immediately sure about what was
going on. Moreover I documented the structure in server.h so that people
reading the header file will immediately understand what the structure
is useful for.
2018-07-16 17:56:54 +02:00
Oran Agra
28cf208bf3 slave buffers were wasteful and incorrectly counted causing eviction
A) slave buffers didn't count internal fragmentation and sds unused space,
   this caused them to induce eviction although we didn't mean for it.

B) slave buffers were consuming about twice the memory of what they actually needed.
- this was mainly due to sdsMakeRoomFor growing to twice as much as needed each time
  but networking.c not storing more than 16k (partially fixed recently in 237a38737).
- besides it wasn't able to store half of the new string into one buffer and the
  other half into the next (so the above mentioned fix helped mainly for small items).
- lastly, the sds buffers had up to 30% internal fragmentation that was wasted,
  consumed but not used.

C) inefficient performance due to starting from a small string and reallocing many times.

what i changed:
- creating dedicated buffers for reply list, counting their size with zmalloc_size
- when creating a new reply node from, preallocate it to at least 16k.
- when appending a new reply to the buffer, first fill all the unused space of the
  previous node before starting a new one.

other changes:
- expose mem_not_counted_for_evict info field for the benefit of the test suite
- add a test to make sure slave buffers are counted correctly and that they don't cause eviction
2018-07-16 16:43:42 +03:00
dejun.xdj
07ef48956d Bugfix: PEL is incorrect when consumer is blocked using xreadgroup with NOACK option.
Save NOACK option into client.blockingState structure.
2018-07-09 13:40:29 +02:00
antirez
7eb135bc8f Cache timezone and daylight active flag for safer logging.
With such information will be able to use a private localtime()
implementation serverLog(), which does not use any locking and is both
thread and fork() safe.
2018-07-04 16:45:00 +02:00
Jack Drogon
bae1d36e5d Fix typo 2018-07-03 18:19:46 +02:00
antirez
abe790cae3 Clarify the pending_querybuf field of clients. 2018-07-03 13:25:41 +02:00
chendianqiang
602d502e5c Merge branch 'unstable' into pending-querybuf 2018-07-03 10:07:26 +08:00
antirez
938d879c2a addReplySubSyntaxError() renamed to addReplySubcommandSyntaxError(). 2018-07-02 18:49:34 +02:00
Salvatore Sanfilippo
c44be0ab9b Merge pull request #4998 from itamarhaber/module_command_help
Module command help
2018-07-02 18:46:56 +02:00
chendianqiang
117a76ac63 limit the size of pending-querybuf in masterclient 2018-07-01 14:43:53 +08:00
zhaozhao.zz
c9c7dab4f3 clients: add type option for client list 2018-06-28 17:43:05 +08:00
antirez
a80eb8a554 Take clients in a ID -> Client handle dictionary. 2018-06-27 14:08:42 +02:00
Guy Benoish
4330bc3e3a Enhance RESTORE with RDBv9 new features
RESTORE now supports:
1. Setting LRU/LFU
2. Absolute-time TTL

Other related changes:
1. RDB loading will not override LRU bits when RDB file
   does not contain the LRU opcode.
2. RDB loading will not set LRU/LFU bits if the server's
   maxmemory-policy does not match.
2018-06-20 15:11:08 +07:00
Oran Agra
e520abc41b add malloc_usable_size for libc malloc
this reduces the extra 8 bytes we save before each pointer.
but more importantly maybe, it makes the valgrind runs to be more similiar
to our normal runs.

note: the change in malloc_stats struct in server.h is to eliminate an name conflict.
structs that are not typedefed are resolved from a separate name space.
2018-06-19 18:18:23 +03:00
antirez
1c783a2051 Refactor createObjectFromLongLong() to be suitable for value objects. 2018-06-18 16:55:16 +02:00
Salvatore Sanfilippo
6263f40b76 Merge pull request #4758 from soloestoy/rdb-save-incremental-fsync
Rdb save incremental fsync
2018-06-16 10:59:37 +02:00
Itamar Haber
eeb3211b4a Merge branch 'unstable' into module_command_help 2018-06-09 21:10:53 +03:00
Salvatore Sanfilippo
120152a9c3 Merge pull request #4519 from soloestoy/zset-int-problem
Zset int problem
2018-06-08 12:45:11 +02:00