Unverified Commit d136bf28 authored by Madelyn Olson's avatar Madelyn Olson Committed by GitHub
Browse files

Explicitly send function commands to monitor (#11510)

Both functions and eval are marked as "no-monitor", since we want to explicitly feed in the script command before the commands generated by the script. Note that we want this behavior generally, so that commands can redact arguments before being added to the monitor.
parent a4bcdbcf
...@@ -616,6 +616,9 @@ uint64_t fcallGetCommandFlags(client *c, uint64_t cmd_flags) { ...@@ -616,6 +616,9 @@ uint64_t fcallGetCommandFlags(client *c, uint64_t cmd_flags) {
} }
static void fcallCommandGeneric(client *c, int ro) { static void fcallCommandGeneric(client *c, int ro) {
/* Functions need to be fed to monitors before the commands they execute. */
replicationFeedMonitors(c,server.monitors,c->db->id,c->argv,c->argc);
robj *function_name = c->argv[1]; robj *function_name = c->argv[1];
functionInfo *fi = dictFetchValue(curr_functions_lib_ctx->functions, function_name->ptr); functionInfo *fi = dictFetchValue(curr_functions_lib_ctx->functions, function_name->ptr);
if (!fi) { if (!fi) {
......
...@@ -115,6 +115,19 @@ start_server {tags {"introspection"}} { ...@@ -115,6 +115,19 @@ start_server {tags {"introspection"}} {
$rd close $rd close
} }
test {MONITOR can log commands issued by functions} {
r function load replace {#!lua name=test
redis.register_function('test', function() return redis.call('set', 'foo', 'bar') end)
}
set rd [redis_deferring_client]
$rd monitor
$rd read ;# Discard the OK
r fcall test 0
assert_match {*fcall*test*} [$rd read]
assert_match {*lua*"set"*"foo"*"bar"*} [$rd read]
$rd close
}
test {MONITOR supports redacting command arguments} { test {MONITOR supports redacting command arguments} {
set rd [redis_deferring_client] set rd [redis_deferring_client]
$rd monitor $rd monitor
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment