Commit Graph

6450 Commits

Author SHA1 Message Date
antirez
4acd6973bf Fix migrateCommand() access of not initialized byte. 2018-01-18 12:41:23 +01:00
Guy Benoish
548e4fe088 Replication buffer fills up on high rate traffic.
When feeding the master with a high rate traffic the the slave's feed is much slower.
This causes the replication buffer to grow (indefinitely) which leads to slave disconnection.
The problem is that writeToClient() decides to stop writing after NET_MAX_WRITES_PER_EVENT
writes (In order to be fair to clients).
We should ignore this when the client is a slave.
It's better if clients wait longer, the alternative is that the slave has no chance to stay in
sync in this situation.
2018-01-18 12:16:50 +01:00
antirez
efa7063c52 Cluster: improve anti-affinity algo in redis-trib.rb.
See #3462 and related PRs.

We use a simple algorithm to calculate the level of affinity violation,
and then an optimizer that performs random swaps until things improve.
2018-01-18 12:16:46 +01:00
antirez
48568ab6d7 Remove useless comment from serverCron().
The behavior is well specified by the code itself.
2018-01-18 12:16:42 +01:00
heqin
0201dea577 fixbug for #4545 dead loop aof rewrite 2018-01-18 12:16:37 +01:00
antirez
926beaa3c4 Hopefully more clear comment to explain the change in #4607. 2018-01-18 12:16:31 +01:00
qinchao
019ad3e2e3 fix assert problem in ZIP_DECODE_PREVLENSIZE
, see issue: https://github.com/antirez/redis/issues/4587
2018-01-18 12:16:23 +01:00
Oran Agra
8d9dff84ce PSYNC2 fix - promoted slave should hold on to it's backlog
after a slave is promoted (assuming it has no slaves
and it booted over an hour ago), it will lose it's replication
backlog at the next replication cron, rather than waiting for slaves
to connect to it.
so on a simple master/slave faiover, if the new slave doesn't connect
immediately, it may be too later and PSYNC2 will fail.
2018-01-18 12:16:05 +01:00
zhaozhao.zz
fba2e169f9 aof: format code and comment 2018-01-18 12:15:57 +01:00
antirez
7777be7b0f Put more details in the comment introduced by #4601. 2018-01-18 12:15:53 +01:00
zhaozhao.zz
91c1568b1a lazyfree: fix memory leak for lazyfree-lazy-server-del 2018-01-18 12:15:47 +01:00
antirez
f9c2c1acc6 Fix getKeysUsingCommandTable() in the case of nagative arity.
This fixes a crash with Redis Cluster when OBJECT is mis-used, because
getKeysUsingCommandTable() will call serverPanic() detecting we are
accessing an invalid argument in the case "OBJECT foo" is called.

This bug was introduced when OBJECT HELP was introduced, because the key
argument is set fixed at index 2 in the command table, however now
OBJECT may be called with an insufficient number of arguments to extract
the key.

The "Right Thing" would be to have a specific function to extract keys
from the OBJECT command, however this is kinda of an overkill, so I
preferred to make getKeysUsingCommandTable() more robust and just return
no keys when it's not possible to honor the command table, because new
commands are often added and also there are a number with an HELP
subcommand violating the normal form, and crashing for this trivial
reason or having many command-specific key extraction functions is not
great.
2018-01-18 12:15:23 +01:00
antirez
61135f1806 Document new protocol options in #4568 into redis.conf. 2018-01-18 12:15:12 +01:00
antirez
e77fba4d03 proto-max-querybuf-len -> client-query-buffer-limit.
We already had client buffer limits exported as configuration options.
Stick with the naming scheme already used.

See #4568.
2018-01-18 12:15:00 +01:00
antirez
87fe813b3a New config options about protocol prefixed with "proto".
Related to #4568.
2018-01-18 12:14:53 +01:00
gnuhpc
2e0d241420 Fix a typo(maybe instruction?) in crash log 2018-01-18 12:14:48 +01:00
Dvir Volk
9f7e214e8c Added RM_UnlinkKey - a low level analog to UNLINK command 2018-01-18 12:14:42 +01:00
zhaozhao.zz
947077bbcb redis-benchmark: bugfix - handle zero liveclients in right way 2018-01-18 12:14:22 +01:00
Oran Agra
ff2e628f4e Add config options for max-bulk-len and max-querybuf-len mainly to support RESTORE of large keys 2018-01-18 12:13:50 +01:00
Oran Agra
aefa9caacf fix processing of large bulks (above 2GB)
- protocol parsing (processMultibulkBuffer) was limitted to 32big positions in the buffer
  readQueryFromClient potential overflow
- rioWriteBulkCount used int, although rioWriteBulkString gave it size_t
- several places in sds.c that used int for string length or index.
- bugfix in RM_SaveAuxField (return was 1 or -1 and not length)
- RM_SaveStringBuffer was limitted to 32bit length
2018-01-18 12:13:25 +01:00
heqin
896cf1a9d9 fixbug for #4545 dead loop aof rewrite 2018-01-18 12:12:58 +01:00
antirez
5abb12e04f Hyperloglog: refresh hdr variable correctly.
This is a fix for the #3819 improvements. The o->ptr may change because
of hllSparseSet() calls, so 'hdr' must be correctly re-fetched.
2018-01-09 18:51:04 +01:00
antirez
c39a0f7c2a Hyperloglog: Support for PFMERGE sparse encoding as target.
This is a fix for #3819.
2018-01-09 18:51:01 +01:00
antirez
8a012df9c6 Hyperloglog: refactoring of sparse/dense add function.
The commit splits the add functions into a set() and add() set of
functions, so that it's possible to set registers in an independent way
just having the index and count.

Related to #3819, otherwise a fix is not possible.
2018-01-09 18:50:58 +01:00
antirez
549409ffa5 Test: MIGRATE AUTH test added.
Related to #2507.
2018-01-09 18:49:45 +01:00
antirez
47717222b6 Rewrite MIGRATE AUTH option.
See PR #2507. This is a reimplementation of the fix that contained
different problems.
2018-01-09 18:49:41 +01:00
heqin
d8da89ea5d fixbug for #4538 Error opening /setting AOF rewrite IPC pipes: No such file or directory 2018-01-09 18:42:37 +01:00
antirez
4fcc564a97 safe_write -> aofWrite. Function commented.
Related to #4498.
2018-01-09 18:42:19 +01:00
zhaozhao.zz
27d9c729e5 aof: cast sdslen to ssize_t 2018-01-09 18:41:56 +01:00
zhaozhao.zz
de4fb877e8 aof: fix the short write 2018-01-09 18:41:53 +01:00
Tomasz Poradowski
1fade3d3b6 always enable command history in redis-cli
- when redis-cli is running in a TTY - always enable command history
buffering, regardless if history file path can be successfully
determined
2018-01-09 18:39:29 +01:00
antirez
9f4d4eef8f Cluster: allow read-only EVAL/EVALSHA in slaves.
Fix #3665.
2018-01-09 18:39:22 +01:00
nashe
8eeceabdc2 Prevent off-by-one read in stringmatchlen() (fixes #4527) 2018-01-09 18:39:08 +01:00
gnuhpc
733af14822 Fix memory usage list bug 2018-01-05 11:53:45 +01:00
zhaozhao.zz
c9cb699bfb dict: fix the int problem for defrag 2017-12-05 15:38:50 +01:00
zhaozhao.zz
b37099a145 dict: fix the int problem 2017-12-05 15:38:50 +01:00
zhaozhao.zz
8fe586d344 set: fix the int problem for qsort 2017-12-05 15:38:50 +01:00
zhaozhao.zz
219e29af65 set: fix the int problem for SPOP & SRANDMEMBER 2017-12-05 15:38:50 +01:00
antirez
1980bcb7f6 Redis 4.0.6. 2017-12-04 18:01:09 +01:00
zhaozhao.zz
57786b14e3 quicklist: change the len of quicklist to unsigned long 2017-12-04 17:39:28 +01:00
zhaozhao.zz
2211540d93 quicklist: fix the return value of quicklistCount 2017-12-04 17:39:19 +01:00
antirez
c85c84be6b Refactoring: improve luaCreateFunction() API.
The function in its initial form, and after the fixes for the PSYNC2
bugs, required code duplication in multiple spots. This commit modifies
it in order to always compute the script name independently, and to
return the SDS of the SHA of the body: this way it can be used in all
the places, including for SCRIPT LOAD, without duplicating the code to
create the Lua function name. Note that this requires to re-compute the
body SHA1 in the case of EVAL seeing a script for the first time, but
this should not change scripting performance in any way because new
scripts definition is a rare event happening the first time a script is
seen, and the SHA1 computation is anyway not a very slow process against
the typical Redis script and compared to the actua Lua byte compiling of
the body.

Note that the function used to assert() if a duplicated script was
loaded, however actually now two times over three, we want the function
to handle duplicated scripts just fine: this happens in SCRIPT LOAD and
in RDB AUX "lua" loading. Moreover the assert was not defending against
some obvious failure mode, so now the function always tests against
already defined functions at start.
2017-12-04 15:25:11 +01:00
antirez
85b2477099 Remove useless variable check from luaCreateFunction().
The block is already inside if (allow_dup).
2017-12-04 15:25:07 +01:00
antirez
a945e5c066 Fix issue #4505, Lua RDB AUX field loading of existing scripts.
Unfortunately, as outlined by @soloestoy in #4505, "lua" AUX RDB field
loading in case of duplicated script was still broken. This commit fixes
this problem and also a memory leak introduced by the past commit.

Note that now we have a regression test able to duplicate the issue, so
this commit was actually tested against the regression. The original PR
also had a valid fix, but I prefer to hide the details of scripting.c
outside scripting.c, and later "SCRIPT LOAD" should also be able to use
the function luaCreateFunction() instead of redoing the work.
2017-12-04 15:25:05 +01:00
antirez
65a2e40ae4 Regression test for #4505 (Lua AUX field loading). 2017-12-04 15:25:02 +01:00
antirez
d6c70f22cd DEBUG change-repl-id implemented.
With PSYNC2 to force a full SYNC in tests is hard. With this new DEBUG
subcommand we just need to call it and then CLIENT KILL TYPE master in
the slave.
2017-12-04 15:24:59 +01:00
antirez
012bcd49ee Redis 4.0.5. 2017-12-01 16:04:41 +01:00
antirez
1198f7ceff Fix loading of RDB files lua AUX fields when the script is defined.
In the case of slaves loading the RDB from master, or in other similar
cases, the script is already defined, and the function registering the
script should not fail in the assert() call.
2017-12-01 16:03:05 +01:00
antirez
cb2f001f52 Redis 4.0.4. 2017-11-30 18:44:38 +01:00
antirez
8449227f55 PSYNC2: Fix off by one buffer size in luaCreateFunction(). 2017-11-30 18:41:05 +01:00