apiVersion: api/v1
kind: Case
name: br_pitr_paypay_pitr_restore_pitr_repeatedly
framework:
    generic:
        command:
            - /pitrPayPayRepeatRestorePiTR
        workingDir: /
        image: hub-new.pingcap.net/tools/br-pitr-paypay-repeat-restore-pitr
        imagePullPolicy: Always
        defaultTimeout: 36000
parameters:
    - type: RESOURCE
      name: dst_tidb
      default: dst-tidb
    - type: RESOURCE
      name: src_tidb
      default: src-tidb
    - type: RESOURCE
      name: br
      default: br
    - type: RESOURCE
      name: mc
      default: mc
    - type: RESOURCE
      name: workload
      default: workload
    - type: RESOURCE
      name: syncdiff
      default: syncdiff
    - 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", "backup-log-options": ["--check-requirements=false"]}
    - 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", "backup-options": ["--check-requirements=false"]}
    - 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", "restore-point-options": ["--concurrency=8", "--check-requirements=false"]}
    - type: STRING
      name: global_variable
      default: '[{"name": "tidb_multi_statement_mode", "value": "on"}]'
    - type: STRING
      name: mc_rm_opts
      default: |
          {"path":"qa-minio/tmp/br-log-backup","timeout":"120m"}

summary: start log backup -> do full backup every sometime -> run paypay workload -> do pitr restore with latest full backup repeatedly (clean target TiDB eachtime)
steps: |
    1. Start log backup
    2. Do full backup
    3. Start workload, and keep it running in background
    4. Sleep sometime
    5. Wait checkpoint move forward
    6. Do a PiTR restore, and check data consistency (restored-ts = ts1)
    7. Do a full backup (snapshot #2), sleep sometime (to ts2), wait checkpoint move foward to ts2, do a PiTR restore with snapshot #2 to ts2, and check data consistency
    8. repeat step 7 for several times.
expectedResult: |
    1. log backup checkpoint is normal
    2. PiTR restore is successful, and data consistency check passed
category: FUNCTIONALITY
priority: P1
supportedVersions:
    - '>6.1'
automation: AUTOMATED
tags:
    - br
    - acceptance
designer: zhangfubin@pingcap.com
