• Nils Goroll's avatar
    Accurate ban statistics except for a few remaining corner cases · 6cbd0d9f
    Nils Goroll authored
    For ban statistics, we updated VSC_C_main directly, so if we raced
    Pool_Sumstat(), that could undo our changes.
    
    This patch fixes statistics by using the per-worker statistics
    cache except for the following remaining corner cases:
    
    * bans_persisted_* counters receive absolut updates, which does
      not seem to fit the incremental updates via the per-worker stats.
    
      I've kept these cases untouched and marked with comments. Worst
      that should happen here are temporary inconsistencies until the
      next absolute update.
    
    * For BAN_Reload(), my understanding is that it should only
      happen during init, so we continue to update VSC_C_main
      directly.
    
    * For bans via the cli, we would need to grab the wstat lock,
      which, at the moment, is private to the worker implementation.
    
      Until we make a change here, we could miss a ban increment
      from the cli.
    
    * for VCL bans from vcl_init / fini, we do not have access
      to the worker struct at the moment, so for now we also
      accept an inconsistency here.
    
    Fixes #2716 for relevant cases
    6cbd0d9f
cache_ban.c 18.7 KB