Commit Graph

177 Commits

Author SHA1 Message Date
fa87879bab Nested MULTI/EXEC may replicate in different cases.
For example:
1. A module command called within a MULTI section.
2. A Lua script with replicate_commands() called within a MULTI section.
3. A module command called from a Lua script in the above context.
2017-11-23 15:15:50 +01:00
07631ff18e Fix lua ldb command log 2017-07-24 14:11:33 +02:00
ba7737245a Fix abort typo in Lua debugger help screen. 2017-06-30 12:12:14 +02:00
6e1489ae50 Set lua-time-limit default value at safe place.
Otherwise, as it was, it will overwrite whatever the user set.

Close #3703.
2017-04-18 16:17:11 +02:00
b44ad302d2 Merge pull request #732 from evilpacket/remove_dofile
Removes dofile() from Lua
2016-05-08 18:04:41 +02:00
2205c465ca Cluster: don't check scripts key slots during AOF loading. 2016-05-05 23:37:08 +02:00
f0fcc36ce1 Merge pull request #2956 from pkulchenko/global-protection-msg-typo
Update global protection error message
2016-05-05 17:26:35 +02:00
e85d6f22cf Fix INFO commandstats reporting when argv is rewritten.
We want to report the original command in the stats, for example GEOADD,
even when what is actually executed is the ZADD implementation.
2016-03-02 08:56:50 +01:00
f43c794b0b Scripting: handle trailing comments.
This fix, provided by Paul Kulchenko (@pkulchenko), allows the Lua
scripting engine to evaluate statements with a trailing comment like the
following one:

    EVAL "print() --comment" 0

Lua can't parse the above if the string does not end with a newline, so
now a final newline is always added automatically. This does not change
the SHA1 of scripts since the SHA1 is computed on the body we pass to
EVAL, without the other code we add to register the function.

Close #2951.
2016-01-08 15:44:21 +01:00
a75aa4bf92 Lua debugger: fix crash printing nested or deep objects.
Example of offending code:

> script debug yes
OK
> eval "local a = {1} a[1] = a\nprint(a)" 0
1) * Stopped at 1, stop reason = step over
2) -> 1   local a = {1} a[1] = a
> next
1) * Stopped at 2, stop reason = step over
2) -> 2   print(a)
> print

... server crash ...

Close #2955.
2016-01-08 09:14:13 +01:00
075ea1646f Merge pull request #2954 from pkulchenko/debug-table-pretty-printing
Update pretty printing during debugging to generate valid Lua code for tables
2015-12-22 09:00:36 +01:00
f054b4ac47 Merge pull request #2957 from pkulchenko/debug-userdata-pretty-printing
Update pretty printing in debugging to generate valid Lua code for userdata-like types.
2015-12-22 08:59:48 +01:00
b9aeb98156 Suppress harmless warnings. 2015-12-16 12:36:32 +01:00
b754c8e18b Update pretty printing in debugging to generate valid Lua code for userdata-like types. 2015-12-15 20:24:41 -08:00
3969e9d3df Update pretty printing in debugging to generate valid Lua code for tables. 2015-12-15 18:15:39 -08:00
2f3f3fd5e0 Update global protection error message to fix a typo. 2015-12-15 18:13:09 -08:00
36801f7e43 Revert Lua's redis.LOG_<level> to original
Fixes #2898
2015-11-27 15:55:38 +02:00
4b0b28b469 Lua debugger: infinite loop detection. 2015-11-18 10:23:49 +01:00
1f35f2dd5a Lua debugger: fix trace command infinite loop.
Thanks to Itamar Haber for bug report and test case to reproduce.
2015-11-17 16:24:27 +01:00
0cc19174f9 Lua debugger: maxlen command implemented.
Let the user control the replies truncation.
2015-11-17 15:43:24 +01:00
c560c645e9 Lua debugger: trace command implemented. 2015-11-17 15:43:24 +01:00
70a51694de Lua debugger: print without args show all local vars. 2015-11-17 15:43:23 +01:00
fb53459ce8 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-17 15:43:23 +01:00
34aadf79c3 Lua debugging: fix error message for SCRIPT DEBUG.
"async" -> "sync".

Thanks to Itamar Haber for reporting.
2015-11-17 15:43:23 +01:00
3d24cd6bf8 Lua debugger: reply +OK to SCRIPT DEBUG no.
Thanks to Itamar Haber for reporting.
2015-11-17 15:43:23 +01:00
333547dab6 Lua debugger: call wait3() if there are pending forked debugging sessions. 2015-11-17 15:43:23 +01:00
01636435fa Lua debugger: abort implemented. 2015-11-17 15:43:23 +01:00
d99ce09343 Lua debugger: ldbSendLogs() memory leak fixed. 2015-11-17 15:43:23 +01:00
87672adee2 Lua debugger: better support for synchronous mode. 2015-11-17 15:43:22 +01:00
7be9170585 Lua debugger: handle forked sessions children during shutdown. 2015-11-17 15:43:22 +01:00
56d9bb8c55 Lua debugger: fix help typo, beark -> break. 2015-11-17 15:43:22 +01:00
e386cd8ccf 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-17 15:43:22 +01:00
7492237c3c Lua debugger: redis.debug() implemented. 2015-11-17 15:43:22 +01:00
cd112db0ae Lua debugger: removing breakpoints now works. 2015-11-17 15:43:22 +01:00
a076e421e9 Lua debugger: redis command implemented. 2015-11-17 15:43:22 +01:00
e6eb6eadec 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-17 15:43:21 +01:00
1f8fdafe65 Lua debugger: much better Lua values pretty printer. 2015-11-17 15:43:21 +01:00
f4805800dc Lua debugger: print now handles ARGV and KEYS. 2015-11-17 15:43:21 +01:00
36392dd867 Lua debugger: added comment about helper functions. 2015-11-17 15:43:21 +01:00
3a04cb05ee Lua debugger: redis.breakpoint() implemented. 2015-11-17 15:43:21 +01:00
cf4700bda4 Lua debugger: output improvements, eval command. 2015-11-17 15:43:21 +01:00
1f8d614423 Lua debugger: breakpoints. 2015-11-17 15:43:21 +01:00
5c4f492844 Lua debugger: ability to show local vars content. 2015-11-17 15:43:21 +01:00
5417217c87 Lua debugger: log Redis commands. List command. 2015-11-17 15:43:21 +01:00
d3d1fa9437 Lua debugger: initial REPL. 2015-11-17 15:43:20 +01:00
c494db89b5 Lua debugger: foundations implemented. 2015-11-17 15:43:20 +01:00
c950facf43 Merge pull request #2848 from badboy/removed-printf
Remove printf
2015-11-09 18:06:41 +01:00
1b5d24eb2b Scripting: fix redis.call() error reporting.
Arguments arity and arguments type error of redis.call() were not
reported correctly to Lua, so the command acted in this regard like
redis.pcall(), but just for two commands. Redis.call() should always
raise errors instead.
2015-11-09 11:43:51 +01:00
cd8f19e9ca Initialize all Lua scripting related things into scripting.c 2015-11-05 11:37:39 +01:00
9aa1f94449 scripting.c source code better organized into sections. 2015-11-05 10:37:10 +01:00