3632 Commits

Author SHA1 Message Date
daniele
b8b49e54de redis-trib.rb: --timeout XXXXX option added to fix and reshard commands. Defaults to 15000 milliseconds 2015-12-11 10:59:00 +01:00
antirez
6b8a6c2ad9 Cluster: replica migration with delay.
We wait a fixed amount of time (5 seconds currently) much greater than
the usual Cluster node to node communication latency, before migrating.
This way when a failover occurs, before detecting the new master as a
target for migration, we give the time to its natural slaves (the slaves
of the failed over master) to announce they switched to the new master,
preventing an useless migration operation.
2015-12-11 09:23:15 +01:00
antirez
50ca1398e2 Remove debugging message left there for error. 2015-12-10 08:56:57 +01:00
antirez
45b03ddaa6 unlinkClient(): clear flags according to ops performed. 2015-12-10 08:05:04 +01:00
antirez
db65f6d374 Fix replicas migration by adding a new flag.
Some time ago I broken replicas migration (reported in #2924).
The idea was to prevent masters without replicas from getting replicas
because of replica migration, I remember it to create issues with tests,
but there is no clue in the commit message about why it was so
undesirable.

However my patch as a side effect totally ruined the concept of replicas
migration since we want it to work also for instances that, technically,
never had slaves in the past: promoted slaves.

So now instead the ability to be targeted by replicas migration, is a
new flag "migrate-to". It only applies to masters, and is set in the
following two cases:

1. When a master gets a slave, it is set.
2. When a slave turns into a master because of fail over, it is set.

This way replicas migration targets are only masters that used to have
slaves, and slaves of masters (that used to have slaves... obviously)
and are promoted.

The new flag is only internal, and is never exposed in the output nor
persisted in the nodes configuration, since all the information to
handle it are implicit in the cluster configuration we already have.
2015-12-09 23:04:44 +01:00
antirez
c5f8c80a1e Centralize slave replication handshake aborting.
Now we have a single function to call in any state of the slave
handshake, instead of using different functions for different states
which is error prone. Change performed in the context of issue #2479 but
does not fix it, since should be functionally identical to the past.
Just an attempt to make replication.c simpler to follow.
2015-12-03 10:43:39 +01:00
antirez
4916d2051e fix sprintf and snprintf format string
There are some cases of printing unsigned integer with %d conversion
specificator and vice versa (signed integer with %u specificator).

Patch by Sergey Polovko. Backported to Redis from Disque.
2015-11-28 09:06:32 +01:00
Itamar Haber
47daa9b0c0 Revert Lua's redis.LOG_<level> to original
Fixes #2898
2015-11-27 16:12:56 +01:00
antirez
1cc7a45440 Handle wait3() errors.
My guess was that wait3() with WNOHANG could never return -1 and an
error. However issue #2897 may possibly indicate that this could happen
under non clear conditions. While we try to understand this better,
better to handle a return value of -1 explicitly, otherwise in the
case a BGREWRITE is in progress but wait3() returns -1, the effect is to
match the first branch of the if/else block since server.rdb_child_pid
is -1, and call backgroundSaveDoneHandler() without a good reason, that
will, in turn, crash the Redis server with an assertion.
2015-11-27 16:10:55 +01:00
antirez
f58a674a4e Redis Cluster: hint about validity factor when slave can't failover. 2015-11-27 11:33:58 +01:00
antirez
00eb8a63e9 Lua debugger: infinite loop detection. 2015-11-19 22:43:32 +01:00
antirez
cd840bf0ee Lua debugger: fix trace command infinite loop.
Thanks to Itamar Haber for bug report and test case to reproduce.
2015-11-19 22:43:31 +01:00
antirez
848c92a30b Lua debugger: redis-cli: allow restart after end of session. 2015-11-19 22:43:31 +01:00
antirez
5535784b63 Lua debugger: redis-cli can restart Lua debugging sessions. 2015-11-19 22:43:31 +01:00
antirez
79c6e6892e Lua debugger: maxlen command implemented.
Let the user control the replies truncation.
2015-11-19 22:43:31 +01:00
antirez
714dc0c43a Lua debugger: trace command implemented. 2015-11-19 22:43:31 +01:00
antirez
267ebb67c1 Lua debugger: redis-cli: show compile errors in LDB mode. 2015-11-19 22:43:31 +01:00
antirez
971571ba7c Lua debugger: print without args show all local vars. 2015-11-19 22:43:31 +01:00
antirez
185b2dcb22 Lua debugger: default behavior of "list" command changed.
Now it lists code around the current position by default. Can list any
other part using other arguments, but a new "whole" command was added in
order to show the whole source code easily.
2015-11-19 22:43:31 +01:00
antirez
57d38d541c Lua debugger: redis-cli error when --ldb is without --eval.
Otherwise the result is a messed CLI without prompt.
Thanks to Itamar Haber for reporting this issue.
2015-11-19 22:43:31 +01:00
antirez
b9429fd821 Lua debugger: use sds_malloc() to allocate eval cli array.
Redis-cli handles the debugger "eval" command in a special way since
sdssplitargs() would not be ok: we need to send the Redis debugger the
whole Lua script without any parsing. However in order to later free the
argument vector inside redis-cli using just sdsfreesplitres(), we need
to allocate the array of SDS pointers using the same allocator SDS is
using, that may differ to what Redis is using.

So now a newer version of SDS exports sds_malloc() and other allocator
functions to give access, to the program it is linked to, the allocator
used internally by SDS.
2015-11-19 22:43:31 +01:00
antirez
bcc4913641 Lua debugging: fix error message for SCRIPT DEBUG.
"async" -> "sync".

Thanks to Itamar Haber for reporting.
2015-11-19 22:43:31 +01:00
antirez
c62b66fd5b Lua debugger: reply +OK to SCRIPT DEBUG no.
Thanks to Itamar Haber for reporting.
2015-11-19 22:43:31 +01:00
antirez
c912df9afb Lua debugger: call wait3() if there are pending forked debugging sessions. 2015-11-19 22:43:31 +01:00
antirez
e132b20fb3 Lua debugger: abort implemented. 2015-11-19 22:43:31 +01:00
antirez
4a00bccff1 Lua debugger: ldbSendLogs() memory leak fixed. 2015-11-19 22:43:31 +01:00
antirez
75788d6af1 Lua debugger: better support for synchronous mode. 2015-11-19 22:43:31 +01:00
antirez
cdb9241200 Lua debugger: handle forked sessions children during shutdown. 2015-11-19 22:43:31 +01:00
antirez
85faf61b64 Lua debugger: inform user changes are rolled back.
When redis-cli will support the synchronous mode, this will not be
printed.
2015-11-19 22:43:31 +01:00
antirez
d530cbd102 Lua debugger: fix help typo, beark -> break. 2015-11-19 22:43:31 +01:00
antirez
629acd61b8 Lua debugger: clear end of session protocol.
When the debugger exits now it produces an <endsession> tag that informs
redis-cli (or other debugging clients) that the session terminated.
This way the client knows there is yet another reply to read (the one of
the EVAL script itself), and can switch to non-debugging mode ASAP.
2015-11-19 22:43:31 +01:00
antirez
8f8c6b3b17 Lua debugger: redis.debug() implemented. 2015-11-19 22:43:31 +01:00
antirez
129cf33ede Lua debugger: redis-cli, mark end of debugging session. 2015-11-19 22:43:30 +01:00
antirez
2cb1019126 Lua debugger: removing breakpoints now works. 2015-11-19 22:43:30 +01:00
antirez
649904e2ed Lua debugger: redis command implemented. 2015-11-19 22:43:30 +01:00
antirez
bc9b2093dd Lua debugger: try to eval as expression first.
It's handly to just eval "5+5" without the return and see it printed on
the screen as result. However prepending "return" does not always result
into valid Lua code. So what we do is to exploit a common Lua community
trick of trying to compile with return prepended, and if compilation
fails then it's not an expression that can be returned, so we try again
without prepending "return". Works great apparently.
2015-11-19 22:43:30 +01:00
antirez
878725def9 Lua debugger: much better Lua values pretty printer. 2015-11-19 22:43:30 +01:00
antirez
435f9500cc Lua debugger: print now handles ARGV and KEYS. 2015-11-19 22:43:30 +01:00
antirez
8566857930 Lua debugger: added comment about helper functions. 2015-11-19 22:43:30 +01:00
antirez
51de527a2e Lua debugger: redis.breakpoint() implemented. 2015-11-19 22:43:30 +01:00
antirez
8a0020f117 Lua debugger: output improvements, eval command. 2015-11-19 22:43:30 +01:00
antirez
0d43a421ad Lua debugger: breakpoints. 2015-11-19 22:43:30 +01:00
antirez
44686bf984 Lua debugger: ability to show local vars content. 2015-11-19 22:43:30 +01:00
antirez
89bf9696c5 Lua debugger: log Redis commands. List command. 2015-11-19 22:43:30 +01:00
antirez
02de5d9980 Lua debugger: initial REPL. 2015-11-19 22:43:30 +01:00
antirez
def3163612 Lua debugger: foundations implemented. 2015-11-19 22:43:30 +01:00
antirez
b96938b1a9 Remove "s" flag for MIGRATE in command table.
Maybe there are legitimate use cases for MIGRATE inside Lua scripts, at
least for now. When the command will be executed in an asynchronous
fashion (planned) it is possible we'll no longer be able to permit it
from within Lua scripts.
2015-11-17 15:43:09 +01:00
antirez
37400954b7 Update redis-cli help and the script to generate it. 2015-11-17 15:40:13 +01:00
antirez
1236471b7b Fix MIGRATE entry in command table.
Thanks to Oran Agra (@oranagra) for reporting. Key extraction would not
work otherwise and it does not make sense to take wrong data in the
command table.
2015-11-17 15:35:42 +01:00
antirez
39e87e10e1 AOF: rewriting child killed by SIGUSR1 is not an error. 2015-11-13 09:32:23 +01:00