Commit Graph

5340 Commits

Author SHA1 Message Date
antirez 9df1f73e4c Modules: associate a fake client to timer context callback. 2018-09-18 13:19:33 +02:00
antirez bf18044082 Modules: associate a fake client to cluster message context callback.
Fixes #5354.
2018-09-18 13:15:40 +02:00
artix 81c4be42c1 Cluster Manager: clusterManagerFixOpenSlot now counts node's keys in slot
if node is neither migrating nor importing.
2018-09-17 16:26:46 +02:00
antirez 12fd92bf67 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2018-09-17 16:24:52 +02:00
antirez 9f43264f86 Revert "fix repeat argument issue and reduce unnessary loop times for redis-cli."
Reverts commit 9505dd2011
since the commit introduced the very serious bug issue #5286.
2018-09-17 16:24:07 +02:00
Salvatore Sanfilippo 54871412c2
Merge pull request #5348 from gkorland/patch-2
No need to return "OK"
2018-09-17 15:42:50 +02:00
Salvatore Sanfilippo f39bb4107c
Merge pull request #5352 from gkorland/patch-3
typo fix
2018-09-17 15:41:24 +02:00
Guy Korland 3176f8e955
Merge pull request #1 from gkorland/patch-5
Fix few typos
2018-09-17 14:15:39 +03:00
Guy Korland 3b0f008615
Fix few typos 2018-09-17 14:13:46 +03:00
Guy Korland 44f9e0d7c7
RedisModule_HashSet call must end with NULL
Extended the RedisModule_HashSet doc to mark that each call must end with NULL
2018-09-17 13:54:56 +03:00
Guy Korland b2fc998ad6
typo fix 2018-09-16 15:21:21 +03:00
antirez c560ade831 LOLWUT: split the command from version-specific implementations. 2018-09-14 12:35:59 +02:00
antirez 411f4b4c12 Slave removal: add a few forgotten aliases for CONFIG SET. 2018-09-13 21:43:15 +02:00
antirez 9849cf2df5 LOLWUT: add Redis version in the output.
This creates an incentive to run the command and as a side effect
experience the art piece inside.
2018-09-13 21:36:02 +02:00
Guy Korland 62015d4fb0
No need to return "OK"
No need to return "+OK" in this case since the result is an Array of all the nodes
2018-09-13 15:42:17 +03:00
antirez d23cae5f06 LOLWUT: Ness -> Nees. 2018-09-13 09:03:36 +02:00
antirez ffbf8f4b8e LOLWUT: Limit maximum CPU effort. 2018-09-13 08:31:55 +02:00
antirez 5c9a7b891f LOLWUT: change padding conditional to a more direct one. 2018-09-13 08:29:55 +02:00
antirez 02817d8b3d Merge branch 'unstable' of github.com:/antirez/redis into unstable 2018-09-13 08:08:56 +02:00
antirez 4dc37c240e LOLWUT: fix crash when col < 2.
Close #5345.
2018-09-13 08:08:30 +02:00
Slobodan Mišković 30377f154f
Fix spelling descrive -> describe 2018-09-12 12:10:07 -07:00
antirez 690560e8db LOLWUT: fix structure typo in comment. 2018-09-12 17:53:00 +02:00
antirez cf0abff567 LOLWUT: Fix license copyright year. 2018-09-12 12:40:40 +02:00
antirez 77bdfb5339 LOLWUT: increase the translation factor. 2018-09-12 12:28:28 +02:00
antirez 0dd8fd062d LOLWUT: change default size to fit a normal terminal better. 2018-09-12 12:26:33 +02:00
antirez 43385c4375 LOLWUT: wrap it into a proper command. 2018-09-12 11:34:10 +02:00
antirez eac2a79cf5 LOLWUT: draw Schotter by Georg Nees. 2018-09-12 11:16:07 +02:00
antirez 2ead41e05b LOLWUT: draw rotated squares using trivial trigonometry. 2018-09-12 10:36:02 +02:00
antirez a974531d1a LOLWUT: draw lines using Bresenham algorithm. 2018-09-11 21:15:43 +02:00
antirez 7777379814 LOLWUT: Rendering of the virtual canvas to a string. 2018-09-11 17:32:57 +02:00
antirez 096c74c886 LOLWUT: show the output verbatim in redis-cli. 2018-09-11 16:29:31 +02:00
antirez 2dbf2047ac LOLWUT: canvas structure and BSD license on top. 2018-09-11 16:09:24 +02:00
antirez 65ce839d09 LOLWUT: Emit Braille unicode according to pixel pattern. 2018-09-11 16:04:25 +02:00
antirez 0c1d28e2d0 Slave removal: remove slave from object.c. 2018-09-11 15:32:28 +02:00
antirez db146de086 Slave removal: server.c logs fixed. 2018-09-11 15:32:28 +02:00
antirez ca6aed02f8 Slave removal: replace very few things in Sentinel.
SENTINEL REPLICAS was added as an alias, in the configuration rewriting
now it uses known-replica, however all the rest is basically at API
level of logged events and messages having to do with the protocol, so
there is very little to do here compared to the Redis core itself, to
preserve compatibility.
2018-09-11 15:32:28 +02:00
antirez 1051d93837 Slave removal: scripting.c logs and other stuff fixed. 2018-09-11 15:32:28 +02:00
antirez 61b7a176ef Slave removal: replication.c logs fixed. 2018-09-11 15:32:28 +02:00
antirez cff5f36d94 Slave removal: networking.c logs fixed. 2018-09-11 15:32:28 +02:00
antirez 05e8db24ed Slave removal: blocked.c logs fixed. 2018-09-11 15:32:28 +02:00
antirez 8296e5c846 Slave removal: slave mode -> replica mode text in redis-cli. 2018-09-11 15:32:28 +02:00
antirez 6f3d357d8f Slave removal: slave -> replica in redis.conf and output buffer option. 2018-09-11 15:32:28 +02:00
antirez 6f58486139 Slave removal: config.c converted + config rewriting hacks.
Aliases added for all the commands mentioning slave. Moreover CONFIG
REWRITE will use the new names, and will be able to reuse the old lines
mentioning the old options.
2018-09-11 15:32:28 +02:00
antirez a9419e2386 Slave removal: Convert cluster.c log messages and command names. 2018-09-11 15:32:28 +02:00
antirez f579b77449 Slave removal: redis-cli --slave -> --replica.
--slave alias remains but is undocumented, just for backward
compatibiltiy.
2018-09-11 15:32:28 +02:00
antirez ef2c7a5bbb Slave removal: SLAVEOF -> REPLICAOF. SLAVEOF is now an alias. 2018-09-11 15:32:28 +02:00
Salvatore Sanfilippo 14629278e3
Merge pull request #5307 from mesbahamin/use_geohash_defines_in_check
Use geohash limit defines in constraint check
2018-09-07 12:31:27 +02:00
Salvatore Sanfilippo 83b8eaa638
Merge pull request #5239 from jeffreylovitz/cli-help-fix
CLI Help text loop verifies arg count
2018-09-07 12:28:22 +02:00
Salvatore Sanfilippo a62b8410ef
Merge pull request #5322 from youjiali1995/fix-sentinel-randomize
sentinel: fix randomized sentinelTimer.
2018-09-07 12:10:35 +02:00
Salvatore Sanfilippo aba57a1bb7
Merge pull request #5324 from youjiali1995/fix-bio
bio: fix bioWaitStepOfType.
2018-09-07 12:06:02 +02:00
zhaozhao.zz 8d24f8b46b Scripting & Streams: some commands need right flags
xadd with id * generates random stream id

xadd & xtrim with approximate maxlen count may
trim stream randomly

xinfo may get random radix-tree-keys/nodes

xpending may get random idletime

xclaim: master and slave may have different
idletime in stream
2018-09-06 21:12:46 +08:00
Weiliang Li db74d71eb3 fix usage typo in redis-cli 2018-09-06 13:40:05 +08:00
antirez 7895835df6 Use commands (effects) replication by default in scripts.
See issue #5250 and issue #5292 for more info.
2018-09-05 19:33:56 +02:00
antirez 7e11825ef4 Safer script stop condition on OOM.
Here the idea is that we do not want freeMemoryIfNeeded() to propagate a
DEL command before the script and change what happens in the script
execution once it reaches the slave. For example see this potential
issue (in the words of @soloestoy):

On master, we run the following script:

    if redis.call('get','key')
    then
        redis.call('set','xxx','yyy')
    end
    redis.call('set','c','d')

Then when redis attempts to execute redis.call('set','xxx','yyy'), we call freeMemoryIfNeeded(), and the key may get deleted, and because redis.call('set','xxx','yyy') has already been executed on master, this script will be replicated to slave.

But the slave received "DEL key" before the script, and will ignore maxmemory, so after that master has xxx and c, slave has only one key c.

Note that this patch (and other related work) was authored collaboratively in
issue #5250 with the help of @soloestoy and @oranagra.

Related to issue #5250.
2018-09-05 15:48:08 +02:00
antirez 092e4de613 Propagate read-only scripts as SCRIPT LOAD.
See issue #5250 and the new comments added to the code in this commit
for details.
2018-09-05 15:44:33 +02:00
antirez 51b627d916 Don't perform eviction when re-entering the event loop.
Related to #5250.
2018-09-05 13:10:07 +02:00
youjiali1995 c328834832 bio: fix bioWaitStepOfType. 2018-09-05 16:51:13 +08:00
youjiali1995 a8322f44b3 sentinel: fix randomized sentinelTimer. 2018-09-05 10:32:18 +08:00
antirez 4e5e0d3719 Clarify why remaining may be zero in readQueryFromClient().
See #5304.
2018-09-04 13:29:27 +02:00
antirez ff57b8d550 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2018-09-04 13:26:06 +02:00
Salvatore Sanfilippo 2ef829d65c
Merge pull request #5304 from soloestoy/fix-unexpected-readlen
networking: fix unexpected negative or zero readlen
2018-09-04 13:25:28 +02:00
Sascha Roland c1e9186f06 #5299 Fix blocking XREAD for streams that ran dry
The conclusion, that a xread request can be answered syncronously in
case that the stream's last_id is larger than the passed last-received-id
parameter, assumes, that there must be entries present, which could be
returned immediately.
This assumption fails for empty streams that actually contained some
entries which got removed by xdel, ... .

As result, the client is answered synchronously with an empty result,
instead of blocking for new entries to arrive.
An additional check for a non-empty stream is required.
2018-09-04 13:13:36 +02:00
Salvatore Sanfilippo d60c17cbb3
Merge pull request #5315 from soloestoy/optimize-parsing-large-bulk
networking: optimize parsing large bulk greater than 32k
2018-09-04 12:49:50 +02:00
antirez 6c001bfc0d Unblocked clients API refactoring. See #4418. 2018-09-03 18:39:18 +02:00
Salvatore Sanfilippo 2b689ad641
Merge pull request #4418 from soloestoy/fix-multiple-unblock
fix multiple unblock for clientsArePaused()
2018-09-03 18:31:02 +02:00
antirez 3e7349fdaf Make pending buffer processing safe for CLIENT_MASTER client.
Related to #5305.
2018-09-03 18:17:31 +02:00
zhaozhao.zz 247d2a734b networking: optimize parsing large bulk greater than 32k
If we are going to read a large object from network
try to make it likely that it will start at c->querybuf
boundary so that we can optimize object creation
avoiding a large copy of data.

But only when the data we have not parsed is less than
or equal to ll+2. If the data length is greater than
ll+2, trimming querybuf is just a waste of time, because
at this time the querybuf contains not only our bulk.

It's easy to reproduce the that:

Time1: call `client pause 10000` on slave.

Time2: redis-benchmark -t set -r 10000 -d 33000 -n 10000.

Then slave hung after 10 seconds.
2018-09-04 00:02:25 +08:00
zhaozhao.zz 2290c4bee1 if master is already unblocked, do not unblock it twice 2018-09-03 14:36:48 +08:00
zhaozhao.zz e3dfd8c811 fix multiple unblock for clientsArePaused() 2018-09-03 14:26:14 +08:00
Amin Mesbah a036c64c01 Use geohash limit defines in constraint check
Slight robustness improvement, especially if the limit values are
changed, as was suggested in antires/redis#4291 [1].

[1] https://github.com/antirez/redis/pull/4291
2018-09-02 00:06:20 -07:00
antirez 7fa493912e After slave Lua script leaves busy state, re-process the master buffer.
Technically speaking we don't really need to put the master client in
the clients that need to be processed, since in practice the PING
commands from the master will take care, however it is conceptually more
sane to do so.
2018-08-31 16:45:02 +02:00
antirez 9ab91b8c6c While the slave is busy, just accumulate master input.
Processing command from the master while the slave is in busy state is
not correct, however we cannot, also, just reply -BUSY to the
replication stream commands from the master. The correct solution is to
stop processing data from the master, but just accumulate the stream
into the buffers and resume the processing later.

Related to #5297.
2018-08-31 16:45:02 +02:00
antirez 83af8ef1fd Allow scripts to timeout even if from the master instance.
However the master scripts will be impossible to kill.

Related to #5297.
2018-08-31 16:45:02 +02:00
antirez f5b29c6444 Allow scripts to timeout on slaves as well.
See reasoning in #5297.
2018-08-31 16:45:01 +02:00
zhaozhao.zz dce7cefb7c networking: fix unexpected negative or zero readlen
To avoid copying buffers to create a large Redis Object which
exceeding PROTO_IOBUF_LEN 32KB, we just read the remaining data
we need, which may less than PROTO_IOBUF_LEN. But the remaining
len may be zero, if the bulklen+2 equals sdslen(c->querybuf),
in client pause context.

For example:

Time1:

python
>>> import os, socket
>>> server="127.0.0.1"
>>> port=6379
>>> data1="*3\r\n$3\r\nset\r\n$1\r\na\r\n$33000\r\n"
>>> data2="".join("x" for _ in range(33000)) + "\r\n"
>>> data3="\n\n"
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> s.settimeout(10)
>>> s.connect((server, port))
>>> s.send(data1)
28

Time2:

redis-cli client pause 10000

Time3:

>>> s.send(data2)
33002
>>> s.send(data3)
2
>>> s.send(data3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.error: [Errno 104] Connection reset by peer

To fix that, we should check if remaining is greater than zero.
2018-08-31 20:02:09 +08:00
Salvatore Sanfilippo d05f5c8f64
Merge pull request #5268 from 0xtonyxia/fix-latency-cmd-comments2
Revise the comments of latency command.
2018-08-29 16:19:13 +02:00
Salvatore Sanfilippo 476eea95da
Merge pull request #4216 from lamby/did-not-received-typos
Correct "did not received" -> "did not receive" typos/grammar.
2018-08-29 16:18:11 +02:00
zhaozhao.zz 7d39c149c4 Supplement to PR #4835, just take info/memory/command as random commands 2018-08-29 18:23:05 +08:00
Salvatore Sanfilippo 0e21efdb1c
Merge pull request #4835 from soloestoy/command-script-flag
some commands' flags should be set correctly, issue #4834
2018-08-29 12:13:50 +02:00
zhaozhao.zz 32844178ac some commands' flags should be set correctly, issue #4834 2018-08-29 18:07:01 +08:00
antirez e245a2046a Make slave-ignore-maxmemory configurable. 2018-08-27 12:27:17 +02:00
antirez 067647a783 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
antirez abf52c7cf4 Better variable meaning in processCommand(). 2018-08-27 12:17:34 +02:00
antirez 66b5afdaa4 Re-apply rebased #2358. 2018-08-27 12:17:14 +02:00
antirez c241f51607 Fix build errors caused by #2358. 2018-08-27 12:15:55 +02:00
Salvatore Sanfilippo 19880ab851
Merge pull request #5248 from soloestoy/rewrite-brpoplpush
rewrite BRPOPLPUSH as RPOPLPUSH to propagate
2018-08-26 16:31:24 +02:00
Salvatore Sanfilippo 80e1695652
Merge pull request #5244 from soloestoy/optimize-pipeline
pipeline: do not sdsrange querybuf unless all commands processed
2018-08-26 16:30:49 +02:00
Chris Lamb 132be8aed5 Correct "did not received" -> "did not receive" typos/grammar. 2018-08-26 14:45:39 +02:00
Salvatore Sanfilippo 46d89a9abb
Merge pull request #2992 from lamby/source-date-epoch
Use SOURCE_DATE_EPOCH over unreproducible uname + date calls.
2018-08-26 11:25:44 +02:00
Chris Lamb f63e81c202
Merge branch 'unstable' into config-set-maxmemory-grammar 2018-08-25 21:49:29 +02:00
zhaozhao.zz f2ad89a314 networking: make setProtocolError simple and clear
Function setProtocolError just records proctocol error
details in server log, set client as CLIENT_CLOSE_AFTER_REPLY.
It doesn't care about querybuf sdsrange, because we
will do it after procotol parsing.
2018-08-23 12:21:28 +08:00
dejun.xdj 1ab64d405e Revise the comments of latency command. 2018-08-22 18:07:02 +08:00
zhaozhao.zz 9a65f9cd3e block: format code 2018-08-14 20:59:32 +08:00
zhaozhao.zz 8a1219d93b block: rewrite BRPOPLPUSH as RPOPLPUSH to propagate 2018-08-14 20:58:58 +08:00
zhaozhao.zz ef2a95c461 networking: just move qb_pos instead of sdsrange in processInlineBuffer 2018-08-14 14:50:37 +08:00
zhaozhao.zz e623bd22ba networking: just return C_OK if multibulk processing saw a <= 0 length. 2018-08-14 13:55:30 +08:00
zhaozhao.zz 14c4ddb5a6 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
Oran Agra f4b27ae222 script cache memory in INFO and MEMORY includes both script code and overheads 2018-08-13 17:36:54 +03:00
Jeffrey Lovitz bd01334da1 CLI Help text loop verifies arg count 2018-08-12 12:47:01 -04:00
zhaozhao.zz a3a1460525 Streams: update listpack with new pointer in XDEL 2018-08-04 01:06:53 +08:00
zhaozhao.zz eb87da6127 AOF: discard if we lost EXEC when loading aof 2018-08-03 23:30:34 +08:00
Salvatore Sanfilippo 39c70e728b
Merge pull request #5146 from 0xtonyxia/fix-xclaim-id-parse
Streams: ID of xclaim command should start from the sixth argument.
2018-08-03 13:45:27 +02:00
Salvatore Sanfilippo 7b5e7f3ed0
Merge pull request #5151 from shenlongxing/fix-stream
Fix stream command paras
2018-08-03 13:39:32 +02:00
shenlongxing fe56c67405 Fix stream command paras 2018-08-03 19:01:15 +08:00
antirez 0ce8323c0d Fix AOF comment to report the current behavior.
Realted to #5201.
2018-08-03 12:46:06 +02:00
antirez 2f282aee0b Fix zslUpdateScore() edge case.
When the element new score is the same of prev/next node, the
lexicographical order kicks in, so we can safely update the node in
place only when the new score is strictly between the adjacent nodes
but never equal to one of them.

Technically speaking we could do extra checks to make sure that even if the
score is the same as one of the adjacent nodes, we can still update on
place, but this rarely happens, so probably not a good deal to make it
more complex.

Related to #5179.
2018-08-01 19:04:53 +02:00
antirez 29226a3919 More commenting of zslUpdateScore(). 2018-08-01 18:54:15 +02:00
antirez 12ff0c0d79 Explain what's the point of zslUpdateScore() in top comment. 2018-08-01 18:53:09 +02:00
antirez e3e94ec35c Remove old commented zslUpdateScore() from source. 2018-08-01 18:50:49 +02:00
antirez 0b800c4332 Optimize zslUpdateScore() as asked in #5179. 2018-08-01 18:50:31 +02:00
antirez 6dd0d6f7dd zsetAdd() refactored adding zslUpdateScore(). 2018-08-01 18:27:56 +02:00
zhaozhao.zz 9042d1c249 Streams: propagate specified MAXLEN instead of approximated
Slaves and rebooting redis may have different radix tree struct,
by different stream* config options. So propagating approximated
MAXLEN to AOF/slaves may lead to date inconsistency.
2018-08-01 10:34:12 +08:00
zhaozhao.zz 14d6318b32 Streams: reset approx_maxlen in every maxlen loop 2018-08-01 10:31:27 +08:00
zhaozhao.zz da6b7516f1 Streams: XTRIM will return an error if MAXLEN with a count < 0 2018-08-01 10:31:27 +08:00
zhaozhao.zz 20c6a7fe2c Streams: propagate original MAXLEN argument in XADD context
If we rewrite the MAXLEN argument as zero when no trimming
was performed, date between master and slave and aof will
be inconsistent, because `xtrim maxlen 0` means delete all
entries in stream.
2018-08-01 10:31:27 +08:00
antirez 2f2987ffc5 Streams IDs parsing refactoring.
Related to #5184.
2018-07-31 18:08:52 +02:00
Salvatore Sanfilippo 187fa78637
Merge pull request #5184 from 0xtonyxia/streams-id-opt
Streams: rearrange the usage of '-' and '+' IDs in stream commands.
2018-07-31 17:58:13 +02:00
Salvatore Sanfilippo 7b41701eb8
Merge pull request #5187 from oranagra/testsuite_improvements
Testsuite improvements
2018-07-31 17:20:09 +02:00
antirez e245ed9a44 Cluster cron announce IP minor refactoring. 2018-07-31 17:13:03 +02:00
Salvatore Sanfilippo 093adb7ef9
Merge pull request #5191 from shenlongxing/fix-memory-leak
Fix cluster-announce-ip memory leak
2018-07-31 17:11:16 +02:00
antirez b0392e75ec Tranfer -> transfer typo fixed. 2018-07-31 16:41:33 +02:00
Salvatore Sanfilippo 92b39a0abf
Merge pull request #5189 from soloestoy/refactor-dbOverwrite
refactor dbOverwrite to make lazyfree work
2018-07-31 16:40:35 +02:00
antirez db693be00d Refactoring: replace low-level checks with writeCommandsDeniedByDiskError(). 2018-07-31 13:16:43 +02:00
antirez 11dd3f4b03 Fix writeCommandsDeniedByDiskError() inverted return value. 2018-07-31 13:14:24 +02:00
antirez 0e49938b68 Better top comment for writeCommandsDeniedByDiskError(). 2018-07-31 13:10:37 +02:00
antirez 5401fe7fb9 Introduce writeCommandsDeniedByDiskError(). 2018-07-31 13:09:38 +02:00
shenlongxing 35ca670060 Fix cluster-announce-ip memory leak 2018-07-31 16:01:44 +08:00
zhaozhao.zz fddeeae724 refactor dbOverwrite to make lazyfree work 2018-07-31 12:07:57 +08:00
Salvatore Sanfilippo ac3c012a7f
Merge pull request #5153 from trevor211/fixLuaScript
Consider aof write error as well as rdb in lua script.
2018-07-30 18:10:06 +02:00
Pavel Rochnyack 1e394b73b7 INFO CPU: higher precision of reported values
Closes: #5033
2018-07-30 18:06:22 +02:00
Salvatore Sanfilippo 1465755e38
Merge pull request #5183 from gkorland/patch-1
Few typo fixes
2018-07-30 17:59:12 +02:00
antirez 3c19ae941d Add year in log.
User: "is there a reason why redis server logs  are missing the year in
the "date time"?"

Me: "I guess I did not imagine it would be stable enough to run for
several years".
2018-07-30 17:42:30 +02:00
dejun.xdj 6491717c88 Streams: rearrange the usage of '-' and '+' IDs in stream commands. 2018-07-30 21:33:01 +08:00
dejun.xdj d6f5ec6f09 Streams: add mmid_supp argument in streamParseIDOrReply().
If 'mmid_supp' is set to 0, "-" and "+" will be
treated as an invalid ID.
2018-07-30 21:32:07 +08:00
Guy Korland acaa18f1d1
Few typo fixes 2018-07-30 16:18:56 +03:00
antirez be28050ac0 Make dynamic hz actually configurable. 2018-07-30 13:44:52 +02:00
antirez c426d85c4c Control dynamic HZ via server configuration. 2018-07-30 13:37:30 +02:00
antirez 4e9c30a6ca Merge branch 'dynamic-hz' into unstable 2018-07-30 13:31:23 +02:00
Oran Agra 4a30adde31 add DEBUG LOG, to to assist test suite debugging 2018-07-30 12:23:51 +03:00
antirez fd174cca23 Remove useless conditional from emptyDb().
Related to #4852.
2018-07-25 16:34:57 +02:00
antirez 1c2352f0dd Make emptyDb() change introduced in #4852 simpler to read. 2018-07-25 16:32:52 +02:00
zhaozhao.zz dd071ff6c9 optimize flushdb, avoid useless loops 2018-07-25 18:13:34 +08:00
Salvatore Sanfilippo 73cbc33a0a
Merge pull request #5133 from soloestoy/fix-xdel-memory-leak
Streams: fix xdel memory leak
2018-07-24 18:57:05 +02:00
zhaozhao.zz eb0e5fe4e3 Streams: fix xdel memory leak 2018-07-25 00:06:27 +08:00
antirez 0bdeb861f4 Example the magic +1 in migrateCommand().
Related to #5154.
2018-07-24 17:31:43 +02:00
antirez 53d46fa712 Make changes of PR #5154 hopefully simpler. 2018-07-24 17:27:43 +02:00
Salvatore Sanfilippo e52a036ac6
Merge pull request #5154 from trevor211/optimizeMigrate
Do not migrate already expired keys.
2018-07-24 17:24:37 +02:00
antirez 8513f31be0 Streams: refactoring of next entry seek in the iterator.
After #5161 the code could be made a bit more obvious for newcomers.
2018-07-24 11:07:27 +02:00
Salvatore Sanfilippo 41a886605a
Merge pull request #5161 from soloestoy/optimize-stream-iterator
Streams: skip master fileds only when we are going forward in streamIteratorGetID
2018-07-24 10:59:55 +02:00
antirez f4ac796c34 string2ll(): better commenting. 2018-07-24 10:27:20 +02:00
antirez b9a8e56439 Merge branch 'removeRedundantCheck' of https://github.com/dsomeshwar/redis into unstable 2018-07-24 10:24:24 +02:00
antirez b28cbe90e1 Restore string2ll() to original version.
See PR #5157.
2018-07-24 10:22:12 +02:00
antirez 1a8d7cd9c2 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2018-07-24 00:21:49 +02:00
antirez e8f5d21940 string2ll(): remove duplicated check for special case.
Related to #5157. The PR author correctly indentified that the check was
duplicated, but removing the second one introduces a bug that was fixed
in the past (hence the duplication). Instead we can remove the first
instance of the check without issues.
2018-07-24 00:20:20 +02:00
antirez 1daee8c748 string2ll(): test for NULL pointer in all the cases. 2018-07-24 00:18:39 +02:00
Salvatore Sanfilippo ab1d5fe11a
Merge pull request #5160 from oranagra/fix_zmalloc_usable
fix recursion typo in zmalloc_usable
2018-07-24 00:07:59 +02:00
antirez 9a375e5408 Change 42 to 1000 as warning level for cached scripts.
Related to #4883.
2018-07-23 18:44:58 +02:00
Salvatore Sanfilippo 445a2a2b1b
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 b65ddfb16a Dynamic HZ: adapt cron frequency to number of clients. 2018-07-23 14:21:04 +02:00
antirez e6ea603ad3 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 993716c351 Adds Lua overheads to MEMORY STATS, smartens the MEMORY DOCTOR 2018-07-22 21:16:00 +03:00
zhaozhao.zz 9674ede85a Streams: skip master fileds only when we are going forward in streamIteratorGetID 2018-07-22 17:52:09 +08:00
Oran Agra 780815dd6e fix recursion typo in zmalloc_usable 2018-07-22 10:17:35 +03:00
dsomeshwar bb5b8b3a6f removing redundant check 2018-07-21 23:42:08 +05:30
WuYunlong 4017a11144 Do not migrate already expired keys. 2018-07-21 10:00:32 +08:00
WuYunlong dd760bd5e6 Consider aof write error as well as rdb in lua script. 2018-07-21 08:48:51 +08:00
antirez 4ff47a0b9b Top comment clientsCron(). 2018-07-20 09:46:18 +02:00
antirez aba6855282 Clarify that clientsCronTrackExpansiveClients() indexes may jump ahead. 2018-07-20 09:36:48 +02:00
antirez be88c0b16a Rename INFO CLIENT max buffers field names for correctness.
They are actually delayed a few seconds, so let's call them "recent".
2018-07-19 17:38:20 +02:00
antirez 0cf3794e6e Fix wrong array index variable in getExpansiveClientsInfo(). 2018-07-19 17:34:15 +02:00
antirez ea3a20c5d0 Change INFO CLIENTS sections to report pre-computed max/min client buffers. 2018-07-19 17:16:19 +02:00
dejun.xdj de5ca516ae Streams: ID of xclaim command starts from the sixth argument. 2018-07-19 20:48:08 +08:00
antirez 8f7e496ba5 Rename var in clientsCronTrackExpansiveClients() for clarity. 2018-07-19 13:59:13 +02:00
antirez 8d617596f1 Implement a function to retrieve the expansive clients mem usage. 2018-07-19 13:58:04 +02:00
antirez 85a1b4f807 clientsCronTrackExpansiveClients() actual implementation. 2018-07-19 13:54:20 +02:00
antirez d4c5fc57db clientsCronTrackExpansiveClients() skeleton and ideas. 2018-07-19 13:49:00 +02:00
antirez 1c95c07596 Make vars used only by INFO CLIENTS local to the block.
Related to #4727.
2018-07-19 12:23:05 +02:00
Salvatore Sanfilippo 16b8d364cc
Merge pull request #4727 from kingpeterpaule/redis-fix-info-cli
move getClientsMaxBuffers func into  info clients command
2018-07-19 12:21:35 +02:00
antirez 0aca977c47 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2018-07-18 17:41:37 +02:00
antirez 313b2240ae In addReplyErrorLength() only panic when replying to slave.
See #5135 for more context.
2018-07-18 17:41:16 +02:00
antirez 6183f0590d Refine comment in addReplyErrorLength() about replying to masters/slaves.
See #5135 for some context.
2018-07-18 17:40:07 +02:00
Salvatore Sanfilippo 22e9321c3e
Merge pull request #5138 from oranagra/improve_defrag_test
make active defrag test more stable
2018-07-18 11:05:03 +02:00
Oran Agra f89c93c8ad make active defrag test more stable
on slower machines, the active defrag test tended to fail.
although the fragmentation ratio was below the treshold, the defragger was
still in the middle of a scan cycle.

this commit changes:
- the defragger uses the current fragmentation state, rather than the cache one
  that is updated by server cron every 100ms. this actually fixes a bug of
  starting one excess scan cycle
- the test lets the defragger use more CPU cycles, in hope that the defrag
  will be faster, but also give it more time before we give up.
2018-07-18 10:16:33 +03:00
Salvatore Sanfilippo 8213f64d64
Merge pull request #5122 from trevor211/allowWritesWhenAofDisabled
Accept write commands if persisting is disabled
2018-07-17 18:08:46 +02:00
Salvatore Sanfilippo 46fd927800
Merge pull request #4237 from aspirewit/update-comment
Update the comment
2018-07-17 18:04:55 +02:00
antirez 6201f7b4e0 Streams: better error when $ is given with XREADGROUP. 2018-07-17 17:54:10 +02:00
Salvatore Sanfilippo 4bff45c7a6
Merge pull request #5136 from 0xtonyxia/fix-xread-id-parse
Fix xreadgroup with '$' ID.
2018-07-17 17:50:31 +02:00
antirez afc7e08a20 Panic when we are sending an error to our master/slave.
Related to #5135, see discussion there.
2018-07-17 17:42:30 +02:00
dejun.xdj 846cf12ae5 Streams: remove meaningless if condition.
It's already checked if xreadgroup is set and groupname is NULL.
2018-07-17 18:23:47 +08:00
dejun.xdj 6501b6bb6d Streams: return an error message if using xreadgroup with '$' ID.
Redis will always return an empty result when '$' ID is specified
with xreadgroup command, it's meaningless.
2018-07-17 18:19:10 +08:00
Oran Agra d55598988b fix rare replication stream corruption with disk-based replication
The slave sends \n keepalive messages to the master while parsing the rdb,
and later sends REPLCONF ACK once a second. rarely, the master recives both
a linefeed char and a REPLCONF in the same read, \n*3\r\n$8\r\nREPLCONF\r\n...
and it tries to trim two chars (\r\n) from the query buffer,
trimming the '*' from *3\r\n$8\r\nREPLCONF\r\n...

then the master tries to process a command starting with '3' and replies to
the slave a bunch of -ERR and one +OK.
although the slave silently ignores these (prints a log message), this corrupts
the replication offset at the slave since the slave increases the replication
offset, and the master did not.

other than the fix in processInlineBuffer, i did several other improvments
while hunting this very rare bug.

- when redis replies with "unknown command" it includes a portion of the
  arguments, not just the command name. so it would be easier to understand
  what was recived, in my case, on the slave side,  it was -ERR, but
  the "arguments" were the interesting part (containing info on the error).
- about a year ago i added code in addReplyErrorLength to print the error to
  the log in case of a reply to master (since this string isn't actually
  trasmitted to the master), now changed that block to print a similar log
  message to indicate an error being sent from the master to the slave.
  note that the slave is marked as CLIENT_SLAVE only after PSYNC was received,
  so this will not cause any harm for REPLCONF, and will only indicate problems
  that are gonna corrupt the replication stream anyway.
- two places were c->reply was emptied, and i wanted to reset sentlen
  this is a precaution (i did not actually see such a problem), since a
  non-zero sentlen will cause corruption to be transmitted on the socket.
2018-07-17 12:51:49 +03:00
antirez cefe21d28a dict.c: remove a few trailing spaces. 2018-07-17 10:39:47 +02:00
Salvatore Sanfilippo 4fc2099235
Merge pull request #5128 from kingpeterpaule/remove-one-loop-in-freeMemoryIfNeeded
remove ineffective loop in dictGetSomeKeys.
2018-07-17 10:38:55 +02:00
Salvatore Sanfilippo 9fbd49bbaf
Merge pull request #5113 from 0xtonyxia/using-compare-func-instead
Streams: using streamCompareID() instead of direct compare.
2018-07-16 18:34:35 +02:00
Salvatore Sanfilippo cab396761e
Merge pull request #5127 from oranagra/sds_req_type
bugfix in sdsReqType creating 64bit sds headers on 32bit systems
2018-07-16 18:32:14 +02:00
antirez f9c84d6d39 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
Salvatore Sanfilippo e22a1218bc
Merge pull request #5126 from oranagra/slave_buf_memory_2
slave buffers were wasteful and incorrectly counted causing eviction
2018-07-16 17:45:50 +02:00
Oran Agra bf680b6f8c 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
zhaozhao.zz 73306c6fed Streams: correctly propagate xdel if needed 2018-07-16 20:48:07 +08:00
antirez 103c5a1a3c Add a few comments to streamIteratorRemoveEntry(). 2018-07-16 12:41:55 +02:00
Salvatore Sanfilippo a317f55d25
Merge pull request #5131 from soloestoy/optimize-xdel
Streams: free lp if all elements are deleted
2018-07-16 12:39:38 +02:00
antirez 185e0d9cd8 Modify XINFO field from last-id to last-generated-id.
Related to #5129.
2018-07-16 12:25:26 +02:00
zhaozhao.zz c9324f81a2 Streams: free lp if all elements are deleted 2018-07-16 15:57:41 +08:00
paule b6ce7d5ddc
Update dict.c
change coding style.
2018-07-16 14:29:59 +08:00
zhaozhao.zz b4ba5ac840 Streams: show last id for streams and groups 2018-07-16 13:24:54 +08:00
peterpaule 816fc6cbc6 remove one ineffective loop in dictGetSomeKeys. 2018-07-16 11:28:22 +08:00
Oran Agra b05a22e261 bugfix in sdsReqType creating 64bit sds headers on 32bit systems 2018-07-15 18:24:18 +03:00
dejun.xdj 491682a668 Streams: using streamCompareID() instead of direct compare in block.c. 2018-07-14 15:03:05 +08:00
dejun.xdj a2177cd2b6 Streams: add streamCompareID() declaration in stream.h. 2018-07-14 15:02:24 +08:00
dejun.xdj 0484dbcf68 Streams: using streamCompareID() instead of direct compare. 2018-07-14 20:34:06 +08:00
WuYunlong 2d4366c544 Accept write commands if persisting is disabled,
event if we do have problems persisting on disk
previously.
2018-07-14 09:06:23 +08:00
andrewsensus 8dc08ae215
update leap year comment 2018-07-13 09:46:30 -06:00
Salvatore Sanfilippo a44a59340c
Merge pull request #5119 from trevor211/fixSlowlogConfig
Fix slowlog config
2018-07-13 17:35:15 +02:00
WuYunlong d6ba4fd56d Fix config set slowlog-log-slower-than and condition in createLatencyReport 2018-07-13 17:53:55 +08:00
artix d4182a0a0d Cluster Manager: more checks on --cluster-weight option. 2018-07-13 10:51:58 +02:00
artix d222eda9f0 Redis-trib deprecated: it no longer works and it
outputs a warning to the user.
2018-07-13 10:51:58 +02:00
artix 513eb5728c Cluster Manager: auth support (-a argument). 2018-07-13 10:51:58 +02:00
Shen Longxing c2a85fb3c5
Delete unused role checking.
When check rdb file, it is unnecessary to check role.
2018-07-12 21:21:37 +08:00
Salvatore Sanfilippo 4cb5bd4e9d
Merge pull request #4820 from charpty/wip-serverc-simplify
Remove unnecessary return statements
2018-07-12 13:42:15 +02:00
antirez b6260a0270 Streams: when re-delivering because of SETID, reset deliveries counter.
We don't want to increment the deliveries here, because the sysadmin
reset the consumer group so the desire is likely to restart processing,
and having the PEL polluted with old information is not useful but
probably confusing.

Related to #5111.
2018-07-12 13:19:39 +02:00
antirez a7c180e559 Simplify duplicated NACK #5112 fix.
We don't really need to distinguish between the case the consumer is the
same or is a different one.
2018-07-12 13:15:54 +02:00
Salvatore Sanfilippo bf4def0fbc
Merge pull request #5112 from 0xtonyxia/fix-xreadgroup-crash-after-setid
Streams: fix xreadgroup crash after xgroup SETID is sent.
2018-07-12 13:04:22 +02:00
tengfeng 9505dd2011 fix repeat argument issue and reduce unnessary loop times for redis-cli. 2018-07-10 20:58:01 +08:00
antirez 0420c3276f Merge branch 'unstable' of github.com:/antirez/redis into unstable 2018-07-10 12:06:44 +02:00
antirez 28e95c7c52 Streams: fix typo "consumer". 2018-07-10 12:04:31 +02:00
antirez a8c1bb310e Streams: fix new XREADGROUP sync logic. 2018-07-10 12:02:03 +02:00
antirez 1a02b5f6ee Streams: make blocking for > a truly special case.
To simplify the semantics of blocking for a group, this commit changes
the implementation to better match the description we provide of
conusmer groups: blocking for > will make the consumer waiting for new
elements in the group. However blocking for any other ID will always
serve the local history of the consumer.

However it must be noted that the > ID is actually an alias for the
special ID ms/seq of UINT64_MAX,UINT64_MAX.
2018-07-10 11:34:17 +02:00
antirez a71e814853 Streams: send an error to consumers blocked on non-existing group.
To detect when the group (or the whole key) is destroyed to send an
error to the consumers blocked in such group is a problem, so we leave
the consumers listening, the sysadmin is free to create or destroy
groups assuming she/he knows what to do. However a client may be blocked
in a given consumer group, that is later destroyed. Then the stream
receives new elements. In that case there is no sane behavior to serve
the consumer... but to report an error about the group no longer
existing.

More about detecting this synchronously and why it is not done:

1. Normally we don't do that, we leave clients blocked for other data
types such as lists.

2. When we free a stream object there is no longer information about
what was the key it was associated with, so while destroying the
consumer groups we miss the info to unblock the clients in that moment.

3. Objects can be reclaimed in other threads where it is no longer safe
to do client operations.
2018-07-10 11:19:06 +02:00
antirez 09327f11dd Streams: fix unblocking logic into a consumer group.
When a client blocks for a consumer group, we don't know the actual ID
we want to be served: other clients blocked in the same consumer group
may be served first, so the consumer group latest delivered ID changes.
This was not handled correctly, all the clients in the consumer group
were unblocked without data but the first.
2018-07-10 11:11:41 +02:00
dejun.xdj 3f8a3efe5f Streams: fix xreadgroup crash after xgroup SETID is sent.
For issue #5111.
2018-07-10 16:26:13 +08:00
Salvatore Sanfilippo 7239e9ca5f
Merge pull request #5095 from 0xtonyxia/fix-indentation
Fix indentation.
2018-07-09 13:56:39 +02:00
dejun.xdj 61f12973f7 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 b67f027699 redis-cli: fix #4990 additional argument in help. 2018-07-09 13:36:47 +02:00
antirez 18d65849fd redis-cli: fix #5096 double error message. 2018-07-09 13:25:48 +02:00
antirez 846203279c redis-cli: cliConnect() flags CC_FORCE and CC_QUIET.
We need CC_QUIET in order to fix #5096 by silently failing if needed.
2018-07-09 13:24:30 +02:00
dejun.xdj 289d8d9c2c CLIENT UNBLOCK: fix client unblock help message. 2018-07-09 13:03:57 +02:00
minkikim89 62a4a8c1d5 fix whitespace in redis-cli.c 2018-07-09 12:59:13 +02:00
WuYunlong 0a5805d7f1 fix compile warning in addReplySubcommandSyntaxError 2018-07-09 12:57:12 +02:00
antirez cb78c84235 Use nolocks_localtime() for safer logging. 2018-07-04 16:50:22 +02:00
antirez 81778d91bf 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
antirez 18d8205bbd Localtime: clarify is_leap_year() working with comments. 2018-07-04 15:50:41 +02:00
antirez 2964414450 Localtime: fix comment about leap year. 2018-07-04 15:16:54 +02:00
antirez 0ea39aa404 Localtime: fix daylight saving adjustment. Use * not +. 2018-07-04 15:16:20 +02:00
antirez 6614d30599 Localtime: fix daylight time documentation and computation. 2018-07-04 14:09:07 +02:00
dejun.xdj 46f5a2ca07 Fix indentation. 2018-07-04 20:04:06 +08:00
antirez 243c5a7a30 Localtime: add a test main() function to check the output. 2018-07-04 13:46:31 +02:00
antirez c25ee35a8b Localtime: day of month is 1 based. Convert from 0 based "days". 2018-07-04 13:35:40 +02:00
antirez b9f3383029 Localtime: fix timezone adjustment. 2018-07-04 13:35:15 +02:00
antirez 0c12cbedbb Localtime: compute year, month and day of the month. 2018-07-04 13:25:55 +02:00
antirez 06ca400f95 Localtime: basics initial calculations. Year missing. 2018-07-04 13:16:53 +02:00
antirez 6a52906758 Localtime function skeleton and file added. 2018-07-04 12:56:12 +02:00
Jack Drogon 93238575f7 Fix typo 2018-07-03 18:19:46 +02:00
antirez 94b3ee6142 Clarify the pending_querybuf field of clients. 2018-07-03 13:25:41 +02:00
antirez 549b8b9973 Improve style of PR #5084. 2018-07-03 13:23:29 +02:00
Salvatore Sanfilippo 526b30a7ce
Merge pull request #5084 from chendq8/pending-querybuf
limit the size of pending-querybuf in masterclient
2018-07-03 13:19:37 +02:00
antirez 677d10b2a8 Set repl_down_since to zero on state change.
PR #5081 fixes an "interesting" bug about Redis Cluster failover but in
general about the updating of repl_down_since, that is used in order to
count the time a slave was left disconnected from its master.

While the fix provided resolves the specific issue, in general the
validity of repl_down_since is limited to states that are different
than the state CONNECTED, and the disconnected time is set when the
state is DISCONNECTED. However from CONNECTED to other states, the state
machine must always go to DISCONNECTED first. So it makes sense to set
the field to zero (since it is meaningless in that context) when the
state is set to CONNECTED.
2018-07-03 12:42:14 +02:00
Salvatore Sanfilippo 02e385169e
Merge pull request #5081 from trevor211/fixClusterFailover
cluster failover bug
2018-07-03 12:36:53 +02:00
chendianqiang cbb2ac0799
Merge branch 'unstable' into pending-querybuf 2018-07-03 10:07:26 +08:00
antirez 2edcafb35d addReplySubSyntaxError() renamed to addReplySubcommandSyntaxError(). 2018-07-02 18:49:34 +02:00
Salvatore Sanfilippo bc6a004588
Merge pull request #4998 from itamarhaber/module_command_help
Module command help
2018-07-02 18:46:56 +02:00
Salvatore Sanfilippo f03ad96236
Merge pull request #5068 from shenlongxing/fix-rename-command
fix empty string for sentinel rename-command
2018-07-02 18:40:35 +02:00
chendianqiang 7de1ada070 limit the size of pending-querybuf in masterclient 2018-07-01 14:43:53 +08:00
WuYunlong 2e167f7d0e fix server.repl_down_since resetting, so that slaves could failover
automatically as expected.
2018-06-30 09:39:08 +08:00
antirez d751d98b50 Change CLIENT LIST TYPE help string.
Making it more similar to KILL.
2018-06-29 18:03:00 +02:00
Salvatore Sanfilippo a0b05a0424
Merge pull request #5075 from soloestoy/client-list-types
FEATURE: implements client list type option
2018-06-29 18:00:32 +02:00
Salvatore Sanfilippo aa2c390ef8
Merge pull request #5074 from soloestoy/fix-compile-warning
fix some compile warnings
2018-06-29 17:56:47 +02:00
Salvatore Sanfilippo a4ef94d2f7
Merge pull request #5076 from 0xtonyxia/add-no-auth-warning-option
Add no auth warning option
2018-06-29 13:32:58 +02:00
dejun.xdj 9f1856268c Check if password is used on command line interface. 2018-06-28 19:09:22 +08:00
dejun.xdj 1139070a0f Fix trailing white space. 2018-06-28 18:47:28 +08:00
dejun.xdj bbd0ca9522 Fix code format issue. 2018-06-28 18:39:42 +08:00
dejun.xdj 7becf54e51 Don't output password warning message when --no-auth-warning is used. 2018-06-28 18:38:24 +08:00
dejun.xdj bde05e9c32 Avoid -Woverlength-strings compile warning.
Using another fprintf call to output the rest help message.
2018-06-28 18:22:06 +08:00
antirez 5baf50d850 Rax library updated (node callback). 2018-06-28 12:19:06 +02:00
dejun.xdj 0b74fd6766 Add --no-auth-warning help message. 2018-06-28 18:17:04 +08:00
zhaozhao.zz b9cbd04b57 clients: add type option for client list 2018-06-28 17:43:05 +08:00
zhaozhao.zz f5538642cc clients: show pubsub flag in client list 2018-06-28 17:28:38 +08:00
zhaozhao.zz 1fcf2737a6 fix some compile warnings 2018-06-28 17:22:59 +08:00
antirez ab55f9da5e Make CLIENT HELP output nicer to the eyes. 2018-06-28 00:21:32 +02:00
antirez 75f1a7bdfc Merge branch 'unstable' of github.com:/antirez/redis into unstable 2018-06-28 00:17:21 +02:00
antirez 4a70ff7451 Add unblock in CLIENT HELP. 2018-06-28 00:17:10 +02:00
shenlongxing 3c27db1cd9 fix empty string for sentinel rename-command 2018-06-28 01:08:55 +08:00
Salvatore Sanfilippo 730a4cfa00
Merge pull request #5067 from mpaltun/mpaltun-doc-fix
Streams documentation fix
2018-06-27 18:54:27 +02:00
antirez 2214043b5c CLIENT UNBLOCK: support unblocking by error. 2018-06-27 18:51:06 +02:00
Mustafa Paltun 010dc172d4
Update t_stream.c 2018-06-27 16:35:30 +03:00
Mustafa Paltun 6d0acb330a
Update help.h 2018-06-27 16:33:31 +03:00
antirez 71295ee305 CLIENT UNBLOCK implemented. 2018-06-27 14:08:42 +02:00
antirez fb39bfd7af Take clients in a ID -> Client handle dictionary. 2018-06-27 14:08:42 +02:00
antirez ed65d734e7 CLIENT ID implemented. 2018-06-27 14:08:42 +02:00
Oran Agra 5616d4c603 add active defrag support for streams 2018-06-27 15:00:41 +03:00
Salvatore Sanfilippo bb666d445d
Merge pull request #5027 from tigertv/unstable
Update sort.c
2018-06-26 16:13:20 +02:00
Salvatore Sanfilippo eb052ba93a
Merge pull request #5059 from guybe7/fix_restore_warning
Fix compiler warning in restoreCommand
2018-06-26 14:41:48 +02:00
antirez 27178a3fde Fix type of argslen in sendSynchronousCommand().
Related to #5037.
2018-06-26 14:38:35 +02:00
antirez 1f1e724f47 Remove black space. 2018-06-26 14:37:22 +02:00
Salvatore Sanfilippo aa5eaad48c
Merge pull request #5037 from madolson/repl-auth-fix
Fixed replication authentication with whitespace password
2018-06-26 14:33:20 +02:00
antirez 3cf8dd2c84 Sentinel: fix SENTINEL SET error reporting.
Thanks to @shenlongxing for reporting the problem.
Related to #5062.
2018-06-26 09:17:38 +02:00
Madelyn Olson 45731edc4b Addressed comments 2018-06-26 00:57:35 +00:00
Madelyn Olson e8d68b6b72 Fixed replication authentication with whitespace in password 2018-06-26 00:48:37 +00:00
antirez fc0c9c8097 Sentinel: drop the renamed-command entry in a more natural way.
Instead of telling the user to set the renamed command to "" to remove
the renaming, to the obvious thing when a command is renamed to itself.

So if I want to remove the renaming of PING, I just rename it to PING
again.
2018-06-25 17:50:46 +02:00
antirez a8a76bda1b Merge branch 'unstable' of github.com:/antirez/redis into unstable 2018-06-25 17:34:12 +02:00
antirez 2358de6816 Sentinel command renaming: use case sensitive hashing for the dict. 2018-06-25 17:31:57 +02:00
antirez a9c5008895 Sentinel command renaming: fix CONFIG SET event logging. 2018-06-25 17:24:04 +02:00
antirez b72cecd7c8 Sentinel command renaming: fix CONFIG SET after refactoring. 2018-06-25 17:23:32 +02:00
antirez 91a384a5cd Sentinel command renaming: implement SENTINEL SET. 2018-06-25 17:13:20 +02:00
antirez 903582dd7b Sentinel: make SENTINEL SET able to handle different arities. 2018-06-25 17:12:39 +02:00
antirez c303e768bf Sentinel command renaming: config rewriting. 2018-06-25 16:55:01 +02:00
antirez 60df7dbea1 Sentinel command renaming: rename-command option parsing. 2018-06-25 16:47:50 +02:00
antirez 72e8a33b35 Sentinel command renaming: base machanism implemented. 2018-06-25 14:06:05 +02:00
Guy Benoish dfcc20f4fd Fix compiler warning in restoreCommand 2018-06-24 16:53:01 +07:00
Salvatore Sanfilippo cf7fcdbe4e
Merge pull request #4634 from soloestoy/special-auth
config: handle special configuration "" for auth
2018-06-22 15:48:33 +02:00
Salvatore Sanfilippo 70b7fa2c52
Merge pull request #5049 from youjiali1995/fix-load-rdb
Fix rdbLoadIntegerObject() to create shared objects when needed.
2018-06-22 15:47:45 +02:00
Salvatore Sanfilippo 54d66d39a0
Merge pull request #5053 from michael-grunder/zpopminmax-keypos
Update ZPOPMIN/ZPOPMAX command declaration
2018-06-22 15:35:36 +02:00
Salvatore Sanfilippo 199e704a42
Merge pull request #5050 from shenlongxing/fix-typo
fix typo
2018-06-22 15:34:36 +02:00
michael-grunder db6b99f90c Update ZPOPMIN/ZPOPMAX command declaration
Unlike the BZPOP variants, these functions take a single key.  This fixes
an erroneous CROSSSLOT error when passing a count to a cluster enabled
server.
2018-06-21 12:30:42 -07:00
Salvatore Sanfilippo a16aa03a67
Merge pull request #5051 from oranagra/streams_mem_estimate
fix streams memory estimation, missing raxSeek
2018-06-21 17:36:28 +02:00
Oran Agra 20e10dc7b8 fix streams memory estimation, missing raxSeek 2018-06-21 17:58:29 +03:00
shenlongxing ec55df117f fix typo 2018-06-21 22:08:09 +08:00
youjiali1995 df6644fe0e Fix rdbLoadIntegerObject() to create shared objects when needed. 2018-06-21 19:23:16 +08:00
Salvatore Sanfilippo c1e8240565
Merge pull request #5039 from oranagra/rdb_dbsize_hint
64 bit RDB_OPCODE_RESIZEDB in rdb saving
2018-06-20 11:18:31 +02:00
Salvatore Sanfilippo 79f55eeddd
Merge pull request #5040 from oranagra/memrev64ifbe_fix
use safe macro (non empty) in memrev64ifbe to eliminate empty if warning
2018-06-20 11:17:06 +02:00
Guy Benoish b5197f1fc9 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
Salvatore Sanfilippo c6fdebf533
Merge pull request #5042 from oranagra/malloc_usable_size_libc
add malloc_usable_size for libc malloc
2018-06-19 17:22:36 +02:00
Oran Agra 482785ac62 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
Salvatore Sanfilippo 4da296307c
Merge pull request #5023 from FX-HAO/unstable
Fix update_zmalloc_stat_alloc in zrealloc
2018-06-19 16:50:22 +02:00
Salvatore Sanfilippo 5f5e1199ef
Merge pull request #5041 from oranagra/redis-rdb-check_rdbLoadMillisecondTime
fix redis-rdb-check to provide proper arguments to rdbLoadMillisecondTime
2018-06-19 16:06:11 +02:00
antirez 4848fbec8b Modules: convert hash to hash table for big objects. 2018-06-19 16:03:00 +02:00
Oran Agra f31b0405f0 fix redis-rdb-check to provide proper arguments to rdbLoadMillisecondTime
due to incorrect forward declaration, it didn't provide all arguments.
this lead to random value being read from the stack and return of incorrect time,
which in this case doesn't matter since no one uses it.
2018-06-19 16:54:22 +03:00
antirez 333c98c43a AOF: remove no longer used variable "now". 2018-06-19 15:54:05 +02:00
antirez e94b2053c6 Modify clusterRedirectClient() to handle ZPOP and XREAD. 2018-06-19 15:53:32 +02:00
Oran Agra 26229aa607 use safe macro (non empty) in memrev64ifbe to eliminate empty if warning 2018-06-19 16:46:41 +03:00
Oran Agra 5cd3c9529d 64 bit RDB_OPCODE_RESIZEDB in rdb saving
this complication in the code is from times were rdbSaveLen didn't support 64 bits.
2018-06-19 16:43:12 +03:00
antirez ba92b517b8 Remove AOF optimization to skip expired keys.
Basically we cannot be sure that if the key is expired while writing the
AOF, the main thread will surely find the key expired. There are
possible race conditions like the moment at which the "now" is sampled,
and the fact that time may jump backward.

Think about the following:

SET a 5
EXPIRE a 1

AOF rewrite starts after about 1 second. The child process finds the key
expired, while in the main thread instead an INCR command is called
against the key "a" immediately after a fork, and the scheduler was
faster to give execution time to the main thread, so "a" is yet not
expired.

The main thread will generate an INCR a command to the AOF log that will
be appended to the rewritten AOF file, but that INCR command will target
a non existin "a" key, so a new non volatile key "a" will be created.

Two observations:

A) In theory by computing "now" before the fork, we should be sure that
if a key is expired at that time, it will be expired later when the
main thread will try to access to such key. However this does not take
into account the fact that the computer time may jump backward.

B) Technically we may still make the process safe by using a monotonic
time source.

However there were other similar related bugs, and in general the new
"vision" is that Redis persistence files should represent the memory
state without trying to be too smart: this makes the design more
consistent, bugs less likely to arise from complex interactions, and in
the end what is to fix is the Redis expire process to have less expired
keys in RAM.

Thanks to Oran Agra and Guy Benoish for writing me an email outlining
this problem, after they conducted a Redis 5 code review.
2018-06-19 15:43:06 +02:00
antirez 44571088d8 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2018-06-18 17:09:16 +02:00
antirez 6967d0bd5a Revert fix #4976 just leaving the flush() part. 2018-06-18 17:09:00 +02:00
antirez 0ed0dc3c02 Fix incrDecrCommand() to create shared objects when needed.
See #5011.
2018-06-18 16:56:31 +02:00
antirez bd92389c2d Refactor createObjectFromLongLong() to be suitable for value objects. 2018-06-18 16:55:16 +02:00
Salvatore Sanfilippo 3518bb66d7
Merge pull request #5020 from shenlongxing/fix-config
Fix config_set_numerical_field() integer overflow.
2018-06-18 16:02:23 +02:00
antirez 2076660843 Streams: fix xreadGetKeys() for correctness.
The old version could not handle the fact that "STREAMS" is a valid key
name for streams. Now we really try to parse the command like the
command implementation would do.

Related to #5028 and 4857.
2018-06-18 14:06:06 +02:00
Salvatore Sanfilippo e670ccffea
Merge pull request #4857 from youjiali1995/fix-command-getkeys
Fix core dump when using some commands with wrong arguments.
2018-06-18 13:54:38 +02:00
antirez a0b27dae85 Streams: fix xreadGetKeys() buffer overflow.
The loop allocated a buffer for the right number of keys positions, then
overflowed it going past the limit.

Related to #4857 and cause of the memory violation seen in #5028.
2018-06-18 13:51:19 +02:00
antirez 62f9ac6f43 Streams: Change XADD MAXLEN handling of values <= 0.
Now a MAXLEN of 0 really does what it means: it will create a zero
entries stream. This is useful in order to make sure that the behavior
is identical to XTRIM, that must be able to reduce the stream to zero
elements when MAXLEN is given.

Also now MAXLEN with a count < 0 will return an error.
2018-06-18 10:05:21 +02:00
Max Vetrov d4c4f20a45
Update sort.c
Redundant second if, and we may use "not" operation for bool, I suppose it's faster.
2018-06-17 21:25:51 +02:00
antirez 79a1c19ac2 XADD MAXLEN should return an error for values < 0. 2018-06-17 10:44:01 +02:00
Salvatore Sanfilippo 2e0ab4a807
Merge pull request #4976 from trevor211/fixDebugLoadaof
Critical: Fix server crash and data inconsistency in some cases.
2018-06-16 11:05:04 +02:00
Salvatore Sanfilippo 94658303e9
Merge pull request #4758 from soloestoy/rdb-save-incremental-fsync
Rdb save incremental fsync
2018-06-16 10:59:37 +02:00
antirez 6a66b93b18 Sentinel: add an option to deny online script reconfiguration.
The ability of "SENTINEL SET" to change the reconfiguration script at
runtime is a problem even in the security model of Redis: any client
inside the network may set any executable to be ran once a failover is
triggered.

This option adds protection for this problem: by default the two
SENTINEL SET subcommands modifying scripts paths are denied. However the
user is still able to rever that using the Sentinel configuration file
in order to allow such a feature.
2018-06-14 18:57:58 +02:00
antirez d353023a83 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2018-06-14 18:11:04 +02:00
antirez d6e8fe77af Fix infinite loop in dbRandomKey().
Thanks to @kevinmcgehee for signaling the issue and reasoning about the
consequences and potential fixes.

Issue #5015.
2018-06-14 18:08:21 +02:00
Salvatore Sanfilippo 40d5df6547
Merge pull request #5008 from zwkno1/unstable
fix geohashEncode bug when step > 30
2018-06-14 14:01:40 +02:00
Salvatore Sanfilippo 8bc3ffcb29
Merge pull request #5021 from soloestoy/fix-exists
fix exists command on slave
2018-06-14 13:58:30 +02:00
Salvatore Sanfilippo 6c7847a183
Merge pull request #5018 from soloestoy/optimize-reply
optimize reply list memory usage
2018-06-14 13:32:00 +02:00