• Oran Agra's avatar
    Allow most CONFIG SET during loading, block some commands in async-loading (#9878) · 41e6e05d
    Oran Agra authored
    ## background
    Till now CONFIG SET was blocked during loading.
    (In the not so distant past, GET was disallowed too)
    
    We recently (not released yet) added an async-loading mode, see #9323,
    and during that time it'll serve CONFIG SET and any other command.
    And now we realized (#9770) that some configs, and commands are dangerous
    during async-loading.
    
    ## changes
    * Allow most CONFIG SET during loading (both on async-loading and normal loading)
    * Allow CONFIG REWRITE and CONFIG RESETSTAT during loading
    * Block a few config during loading (`appendonly`, `repl-diskless-load`, and `dir`)
    * Block a few commands during loading (list below)
    
    ## the blocked commands:
    * SAVE - obviously we don't wanna start a foregreound save during loading 8-)
    * BGSAVE - we don't mind to schedule one, but we don't wanna fork now
    * BGREWRITEAOF - we don't mind to schedule one, but we don't wanna fork now
    * MODULE - we obviously don't wanna unload a module during replication / rdb loading
      (MODULE HELP and MODULE LIST are not blocked)
    * SYNC / PSYNC - we're in the middle of RDB loading from master, must not allow sync
      requests now.
    * REPLICAOF / SLAVEOF - we're in the middle of replicating, maybe it makes sense to let
      the user abort it, but he couldn't do that so far, i don't wanna take any risk of bugs due to odd state.
    * CLUSTER - only allow [HELP, SLOTS, NODES, INFO, MYID, LINKS, KEYSLOT, COUNTKEYSINSLOT,
      GETKEYSINSLOT, RESET, REPLICAS, COUNT_FAILURE_REPORTS], for others, preserve the status quo
    
    ## other fixes
    * processEventsWhileBlocked had an issue when being nested, this could happen with a busy script
      during async loading (new), but also in a busy script during AOF loading (old). this lead to a crash in
      the scenario described in #6988
    41e6e05d
replication.tcl 52.6 KB