• chenyang8094's avatar
    Adapt redis-check-aof tool for Multi Part Aof (#10061) · a50aa29b
    chenyang8094 authored
    Modifications of this PR:
    1. Support the verification of `Multi Part AOF`, while still maintaining support for the
      old-style `AOF/RDB-preamble`. `redis-check-aof` will automatically choose which
      mode to use according to the incoming file format.
       
    `Usage: redis-check-aof [--fix|--truncate-to-timestamp $timestamp] <AOF/manifest>`
     
    2. Refactor part of the code to make it easier to understand
    3. Currently only supports truncate  (`--fix` or `--truncate-to-timestamp`) the last AOF
      file (may be `BASE` or `INCR`)
    
    The reasons for 3 above:
    - for `--fix`: Only the last AOF may be truncated, this is guaranteed by redis
    - for `--truncate-to-timestamp`:  Normally, we only have `BASE` + `INCR` files
      at most, and `BASE` cannot be truncated(It only contains a timestamp annotation
      at the beginning of the file), so only `INCR` can be truncated. If we have a
      `BASE+INCR1+INCR2` file (meaning we have an interrupted AOFRW), Only `INCR2`
      files can be truncated at this time. If we still insist on truncate `INCR1`, we need to
      manually delete `INCR2` and update the manifest file, then re-run `redis-check-aof`
    - If we want to support truncate any file, we need to add very complicated code to support
      the atomic modification of multiple file deletion and update manifest, I think this is unnecessary
    a50aa29b
aof-multi-part.tcl 45.3 KB