apiVersion: api/v1
kind: Case
name: br_pitr_all_tikv_io_delay
framework:
    generic:
        command:
            - /case
        workingDir: /
        image: hub-new.pingcap.net/qa/br-pitr-all-tikv-io-delay
        imagePullPolicy: Always
        defaultTimeout: 3600
parameters:
    - type: RESOURCE
      name: upstream
      default: upstream
    - type: RESOURCE
      name: downstream
      default: downstream
    - type: RESOURCE
      name: br
      default: br
    - type: RESOURCE
      name: mc
      default: mc
    - type: RESOURCE
      name: syncdiff
    - type: RESOURCE
      name: workload
    - type: STRING
      name: br_log_opts
      default: |
          {"storage":"s3://tmp/br-log-backup?access-key=minioadmin&secret-access-key=minioadmin&endpoint=http%3a%2f%2fminio.pingcap.net%3a9000&force-path-style=true","timeout":"10m", "task-name": "task1"}
    - type: STRING
      name: br_opts
      default: |
          {"storage":"s3://tmp/br-log-backup?access-key=minioadmin&secret-access-key=minioadmin&endpoint=http%3a%2f%2fminio.pingcap.net%3a9000&force-path-style=true","timeout":"30m"}
    - type: STRING
      name: br_log_restore_opts
      default: |
          {"storage":"s3://tmp/br-log-backup?access-key=minioadmin&secret-access-key=minioadmin&endpoint=http%3a%2f%2fminio.pingcap.net%3a9000&force-path-style=true","timeout":"120m"}
    - type: STRING
      name: mc_rm_opts
      default: |
          {"path":"qa-minio/tmp/br-log-backup","timeout":"120m"}
    - type: STRING
      name: global_variable
      default: '[{"name": "tidb_multi_statement_mode", "value": "on"}]'

summary: inject io delay chaos,do log backup and full backup, and do PiTR restore when
steps: |
    1. Start log backup
    2. Do full backup
    3. inject io delay chaos (100% 20s delay)
    4. Sleep sometime, and wait checkpoint move forward
    5. Do a PiTR restore, and check data consistency (restored-ts = ts1)
    6. Sleep sometime, and wait checkpoint move forward to ts2
    7. Do a log restore from ts1 to ts2, and check data consistency

expectedResult: |
    1. log backup checkpoint is normal
    2. PiTR and log restore is successful, and data consistency check passed

category: FUNCTIONALITY
priority: P1
supportedVersions:
    - '>=6.1'
automation: AUTOMATED
tags:
    - br
    - acceptance
    - pitr
designer: dong.xie@pingcap.com
