• Oran Agra's avatar
    Fix and improve module error reply statistics (#10278) · b099889a
    Oran Agra authored
    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
    b099889a
blockedclient.tcl 6.74 KB