diff options
author | Oran Agra <oran@redislabs.com> | 2022-02-13 18:37:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-13 18:37:32 +0200 |
commit | b099889a3a6dccf5243135f0611b8cdb11cab7b8 (patch) | |
tree | 6dbf613779a6d8ec2aa0d6c17f9f1aec72e4fabf /src/call_reply.h | |
parent | 1193e96d0275470e11ae6b6b6d9ffedecf99958b (diff) | |
download | redis-b099889a3a6dccf5243135f0611b8cdb11cab7b8.tar.gz |
Fix and improve module error reply statistics (#10278)
This PR handles several aspects
1. Calls to RM_ReplyWithError from thread safe contexts don't violate thread safety.
2. Errors returning from RM_Call to the module aren't counted in the statistics (they
might be handled silently by the module)
3. When a module propagates a reply it got from RM_Call to it's client, then the error
statistics are counted.
This is done by:
1. When appending an error reply to the output buffer, we avoid updating the global
error statistics, instead we cache that error in a deferred list in the client struct.
2. When creating a RedisModuleCallReply object, the deferred error list is moved from
the client into that object.
3. when a module calls RM_ReplyWithCallReply we copy the deferred replies to the dest
client (if that's a real client, then that's when the error statistics are updated to the server)
Note about RM_ReplyWithCallReply: if the original reply had an array with errors, and the module
replied with just a portion of the original reply, and not the entire reply, the errors are currently not
propagated and the errors stats will not get propagated.
Fix #10180
Diffstat (limited to 'src/call_reply.h')
-rw-r--r-- | src/call_reply.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/call_reply.h b/src/call_reply.h index 5b07dc437..ff98f7f5a 100644 --- a/src/call_reply.h +++ b/src/call_reply.h @@ -34,7 +34,7 @@ typedef struct CallReply CallReply; -CallReply *callReplyCreate(sds reply, void *private_data); +CallReply *callReplyCreate(sds reply, list *deferred_error_list, void *private_data); int callReplyType(CallReply *rep); const char *callReplyGetString(CallReply *rep, size_t *len); long long callReplyGetLongLong(CallReply *rep); @@ -51,6 +51,7 @@ const char *callReplyGetVerbatim(CallReply *rep, size_t *len, const char **forma const char *callReplyGetProto(CallReply *rep, size_t *len); void *callReplyGetPrivateData(CallReply *rep); int callReplyIsResp3(CallReply *rep); +list *callReplyDeferredErrorList(CallReply *rep); void freeCallReply(CallReply *rep); #endif /* SRC_CALL_REPLY_H_ */ |