2987 Commits

Author SHA1 Message Date
antirez
ad9976cd90 redis-cli --latency-dist now uses a color palette.
Still not happy with the result but low grays are hard to see in certain
monitors with a non perfect gamma.
2015-02-10 14:51:25 +01:00
antirez
b857578ba2 redis-cli latency dist: add new top HL. 2015-02-10 14:51:25 +01:00
antirez
630634a37a Add missing latency-dest legend symbol. 2015-02-10 14:51:25 +01:00
antirez
cdf30ba8c7 Initial implementation of redis-cli --latency-dist. 2015-02-10 14:51:25 +01:00
mattcollier
7db39b7fd3 Update redis-cli.c
Code was adding '\n'  (line 521) to the end of NIL values exlusively making csv output inconsistent.  Removed '\n'
2015-02-02 22:50:45 +01:00
antirez
9b3a1c3c40 Redis 2.9.103 (3.0.0 Release Candidate 3). 2015-01-30 15:34:16 +01:00
antirez
55f2bc646a Cluster: some bias towwards FAIL/PFAIL nodes in gossip sections.
This improves PFAIL -> FAIL switch. Too late at this point in the RC
releases to add proper PFAIL/FAIL separate dictionary to do this in a
less randomized way. Tested in practice with experiments that this
helps. PFAIL -> FAIL average with 20 nodes and node-timeout set to 5
seconds takes 2.5 seconds without this commit, 1 second with this
commit.
2015-01-30 12:18:42 +01:00
antirez
0f1b9c3db1 More correct wanted / maxiterations values in clusterSendPing(). 2015-01-30 12:18:42 +01:00
antirez
2553f6c9e5 Cluster: initialized not used fileds in gossip section.
Otherwise we risk sending not initialized data to other nodes, that may
contain anything. This was actually not possible only because the
initialization of the buffer where the cluster packets header is created
was larger than the 3 gossip sections we use, so the memory was already
all filled with zeroes by the memset().
2015-01-29 15:52:17 +01:00
antirez
2616d6f6dc Cluster: magical 10% of nodes explained in comments. 2015-01-29 15:44:54 +01:00
antirez
92f29b8904 CLUSTER count-failure-reports command added. 2015-01-29 15:44:49 +01:00
antirez
8dd3263216 Cluster: use a number of gossip sections proportional to cluster size.
Otherwise it is impossible to receive the majority of failure reports in
the node_timeout*2 window in larger clusters.

Still with a 200 nodes cluster, 20 gossip sections are a very reasonable
amount of bytes to send.

A side effect of this change is also fater cluster nodes joins for large
clusters, because the cluster layout makes less time to propagate.
2015-01-29 15:44:46 +01:00
antirez
71da1b15c8 The seed must be static in getRandomHexChars(). 2015-01-22 11:12:28 +01:00
antirez
4e73b305f0 counter must be static in getRandomHexChars(). 2015-01-22 11:12:28 +01:00
antirez
b25154a387 getRandomHexChars(): use /dev/urandom just to seed.
On Darwin /dev/urandom depletes terribly fast. This is not an issue
normally, but with Redis Cluster we generate a lot of unique IDs, for
example during nodes handshakes. Our IDs need just to be unique without
other strong crypto requirements, so this commit turns the function into
something that gets a 20 bytes seed from /dev/urandom, and produces the
rest of the output just using SHA1 in counter mode.
2015-01-22 11:12:28 +01:00
Matt Stancliff
ebb07a0b48 Fix cluster migrate memory leak
Fixes valgrind error:
48 bytes in 1 blocks are definitely lost in loss record 196 of 373
   at 0x4910D3: je_malloc (jemalloc.c:944)
   by 0x42807D: zmalloc (zmalloc.c:125)
   by 0x41FA0D: dictGetIterator (dict.c:543)
   by 0x41FA48: dictGetSafeIterator (dict.c:555)
   by 0x459B73: clusterHandleSlaveMigration (cluster.c:2776)
   by 0x45BF27: clusterCron (cluster.c:3123)
   by 0x423344: serverCron (redis.c:1239)
   by 0x41D6CD: aeProcessEvents (ae.c:311)
   by 0x41D8EA: aeMain (ae.c:455)
   by 0x41A84B: main (redis.c:3832)
2015-01-22 10:35:40 +01:00
Matt Stancliff
98faed3a3f Fix potential invalid read past end of array
If array has N elements, we can't read +1 if we are already at N.

Also, we need to move elements by their storage size in the array,
not just by individual bytes.
2015-01-22 10:35:36 +01:00
Matt Stancliff
97ffeb7c09 Fix cluster reset memory leak
[maybe] Fixes valgrind errors:
32 bytes in 4 blocks are definitely lost in loss record 107 of 228
   at 0x80EA447: je_malloc (jemalloc.c:944)
   by 0x806E59C: zrealloc (zmalloc.c:125)
   by 0x80A9AFC: clusterSetMaster (cluster.c:801)
   by 0x80AEDC9: clusterCommand (cluster.c:3994)
   by 0x80682A5: call (redis.c:2049)
   by 0x8068A20: processCommand (redis.c:2309)
   by 0x8076497: processInputBuffer (networking.c:1143)
   by 0x8073BAF: readQueryFromClient (networking.c:1208)
   by 0x8060E98: aeProcessEvents (ae.c:412)
   by 0x806123B: aeMain (ae.c:455)
   by 0x806C3DB: main (redis.c:3832)

64 bytes in 8 blocks are definitely lost in loss record 143 of 228
   at 0x80EA447: je_malloc (jemalloc.c:944)
   by 0x806E59C: zrealloc (zmalloc.c:125)
   by 0x80AAB40: clusterProcessPacket (cluster.c:801)
   by 0x80A847F: clusterReadHandler (cluster.c:1975)
   by 0x30000FF: ???

80 bytes in 10 blocks are definitely lost in loss record 148 of 228
   at 0x80EA447: je_malloc (jemalloc.c:944)
   by 0x806E59C: zrealloc (zmalloc.c:125)
   by 0x80AAB40: clusterProcessPacket (cluster.c:801)
   by 0x80A847F: clusterReadHandler (cluster.c:1975)
   by 0x2FFFFFF: ???
2015-01-22 10:35:32 +01:00
Matt Stancliff
4a36350d9f Fix sending uninitialized bytes
Fixes valgrind error:
Syscall param write(buf) points to uninitialised byte(s)
   at 0x514C35D: ??? (syscall-template.S:81)
   by 0x456B81: clusterWriteHandler (cluster.c:1907)
   by 0x41D596: aeProcessEvents (ae.c:416)
   by 0x41D8EA: aeMain (ae.c:455)
   by 0x41A84B: main (redis.c:3832)
 Address 0x5f268e2 is 2,274 bytes inside a block of size 8,192 alloc'd
   at 0x4932D1: je_realloc (jemalloc.c:1297)
   by 0x428185: zrealloc (zmalloc.c:162)
   by 0x4269E0: sdsMakeRoomFor.part.0 (sds.c:142)
   by 0x426CD7: sdscatlen (sds.c:251)
   by 0x4579E7: clusterSendMessage (cluster.c:1995)
   by 0x45805A: clusterSendPing (cluster.c:2140)
   by 0x45BB03: clusterCron (cluster.c:2944)
   by 0x423344: serverCron (redis.c:1239)
   by 0x41D6CD: aeProcessEvents (ae.c:311)
   by 0x41D8EA: aeMain (ae.c:455)
   by 0x41A84B: main (redis.c:3832)
 Uninitialised value was created by a stack allocation
   at 0x457810: nodeUpdateAddressIfNeeded (cluster.c:1236)
2015-01-22 10:35:27 +01:00
antirez
0a3edcbe51 Cluster: node deletion cleanup / centralization. 2015-01-22 10:35:12 +01:00
antirez
5130c2536b Cluster: set the slaves->slaveof filed to NULL when master is freed.
Related to issue #2289.
2015-01-22 10:35:08 +01:00
antirez
26698af37d luaRedisGenericCommand(): log error at WARNING level when re-entered.
Rationale is that when re-entering, it is likely due to Lua debugging
hooks. Returning an error will be ignored in most cases, going totally
unnoticed. With the log at least we leave a trace.

Related to issue #2302.
2015-01-22 10:34:44 +01:00
antirez
9b92edddfa luaRedisGenericCommand() recursion: just return an error.
Instead of calling redisPanic() to abort the server.

Related to issue #2302.
2015-01-22 10:34:38 +01:00
antirez
83a6cc3398 Panic on recursive calls to luaRedisGenericCommand().
Related to issue #2302.
2015-01-22 10:34:34 +01:00
antirez
23cc0a3f1c AOF rewrite: set iterator var to NULL when freed.
The cleanup code expects that if 'di' is not NULL, it is a valid
iterator that should be freed.

The result of this bug was a crash of the AOF rewriting process if an
error occurred after the DBs data are written and the iterator is no
longer valid.
2015-01-21 16:42:38 +01:00
antirez
12dcd2d7ac Redis 2.9.102 (3.0.0 Release Candidate 2). 2015-01-13 18:09:57 +01:00
antirez
df1a7fc4fe Cluster: fetch my IP even if msg is not MEET for the first time.
In order to avoid that misconfigured cluster nodes at some time may
force an IP update on other nodes, it is required that nodes update
their own address only on MEET messages. However it does not make sense
to do this the first time a node is contacted and yet does not have an
IP, we just risk that myself->ip remains not assigned if there are
messages lost or cluster creation procedures that don't make sure
everybody is targeted by at least one incoming MEET message.

Also fix the logging of the IP switch avoiding the :-1 tail.
2015-01-13 16:23:48 +01:00
antirez
45e2a26ded Cluster: clusterMsgDataGossip structure, explict padding + minor stuff.
Also explicitly set version to 0, add a protocol version define, improve
comments in the gossip structure.

Note that the structure layout is the same after the change, we are just
making the padding explicit with an additional not used 16 bits field.
So this commit is still able to talk with the previous versions of
cluster nodes.
2015-01-13 16:23:44 +01:00
antirez
799a3ccac1 Suppress valgrind error about write sending uninitialized data.
Valgrind checks that the buffers we transfer via syscalls are all
composed of bytes actually initialized. This is useful, it makes we able
to avoid leaking informations in non initialized parts fo messages
transferred to other hosts. This commit fixes one of such issues.
2015-01-13 16:23:40 +01:00
antirez
1584c7a31b Cluster: initialize mf_end.
Can't be initialized by resetManualFailover() since it's actual state
the function uses, so we need to initialize it at startup time. Not
really a bug in practical terms, but showed up into valgrind and is not
technically correct anyway.
2015-01-12 15:40:30 +01:00
antirez
8be8780d4a Add "-lrt" in Makefile for Solaris.
This fix is from @NanXiao, however I was not able to retain authorship
because the Pull Request original repository was removed.
2015-01-09 11:54:50 +01:00
antirez
f2348a2b7f Check for __sun macro in solarisfixes.h, not in includers. 2015-01-09 11:22:14 +01:00
antirez
6f3553a2fe Prevent Lua scripts from violating Redis Cluster keyspace access rules.
Before this commit scripts were able to access / create keys outside the
set of hash slots served by the local node.
2015-01-09 10:39:05 +01:00
Matt Stancliff
67cc0d0851 Remove end of line whitespace from redis-trib 2015-01-08 19:46:02 +01:00
Matt Stancliff
d1b607aa66 Fix redis-trib cluster create
Under certain conditions the node list wasn't being fully populated
and 'create' would fail trying to call methods on nil objects.
2015-01-08 19:46:02 +01:00
Matt Stancliff
6742dab413 Improve redis-trib replica assignment
This tiny bit of code has gone through so many revisions.  Hopefully
it's more correct now.

Fixes #2204
2015-01-08 19:46:02 +01:00
antirez
1e8f1577c5 INFO loading stats: three fixes.
1. Server unxtime may remain not updated while loading AOF, so ETA is
not updated correctly.

2. Number of processed byte was not initialized.

3. Possible division by zero condition (likely cause of issue #1932).
2014-12-23 14:54:31 +01:00
Alon Diamant
aad0c512cc Fixed memory leaks in rdbSaveToSlavesSockets() 2014-12-22 11:01:17 +01:00
antirez
9cb99f547d Fix adjustOpenFilesLimit() logging to match real state.
Fixes issue #2225.
2014-12-19 10:05:07 +01:00
Matt Stancliff
8bce654246 Cluster: Notify user on accept error
If we woke up to accept a connection, but we can't
accept it, inform the user of the error going on
with their networking.

(The previous message was the same for success or error!)
2014-12-17 17:48:55 +01:00
Rhommel Lamas
6aba87be82 Add redis-sentinel symlink to a relative path 2014-12-17 12:27:41 +01:00
antirez
86213b4e03 Fix comment in clusterHandleSlaveFailover(). 2014-12-16 15:03:23 +01:00
antirez
2c6dc9f15f Make sure buffer is enough in clusterSendPing(). 2014-12-15 10:18:29 +01:00
antirez
722faed62a Don't log admin commands in MONITOR.
Otherwise there are security risks, especially when providing Redis as a
service, the user may "sniff" for admin commands renamed to an
unguessable string via rename-command in redis.conf.
2014-12-13 08:58:34 +01:00
antirez
cc7b9171ca List of commands flagged as admin commands modified.
The old list did not made much sense... and the flag is currently not
used at all, so no side effects.
2014-12-13 08:58:34 +01:00
Rhommel Lamas
31bf7976b5 Add symlink to redis-sentinel during make install 2014-12-12 22:59:28 +01:00
antirez
814cd40215 SORT: Don't sort Set elements if not needed.
Related to #2094.
2014-12-11 15:58:29 +01:00
Matt Stancliff
77bbc0dfad Fix zero-ordering SORT when called against lists
People mostly use SORT against lists, but our prior
behavior was pretending lists were an unordered bag
requiring a forced-sort when no sort was requested.

We can just use the native list ordering to ensure
consistency across replicaion and scripting calls.

Closes #2079
Closes #545 (again)
2014-12-11 15:58:29 +01:00
zhanghailei
e1524f5010 FIXED redis-benchmark's idle mode.With idle mode shouldn't create write event 2014-12-11 15:21:42 +01:00
Nan Xiao
cc14d7f51d Fix function prototype in redis-cli.c.
Fix function prototype in redis-cli.c.
2014-12-11 15:09:20 +01:00