# test name 
name: "txn_keep_alive"
creator: "zhenjing"
# type is the type of the test, supported type: prepare / test
# we will run the prepare tests before all test tests
type: "test"
tags:
  - transaction

environment: 
  # machine resources
  resources:
    limits:
      cpu: 1000m
      memory: 2Gi
    requests:
      cpu: 500m
      memory: 1Gi
  # image is a docker execution image for running test 
  # default image: hub.pingcap.net/schrodinger/agent:latest
  # image: hub.pingcap.net/schrodinger/agent:latest

  # execution arguments
  args: ""

# manual for users 
manual:
  # description is to introduce the test purpose and instructions for this case.
  description: |-
    Tests whether keep alive mechanism for pessimistic transactions (and also will be used for large transactions)
    works properly.
    The points are:
    * A pessimistic transaction T1 will use txn_heart_beat to continuously enlarge the primary lock's TTL to keep the
      transaction alive
    * Another transaction T2 that meets T1's lock will check it's primary. If the primary's TTL is not expired, it
      willnot break T1.
    * When T1 is done (committed, rolled back or killed, and maybe more), T2 can continue executing then.
  # describe the purpose of the parameters and optional values
  parameters: |-
    mode: case mode, support values online / dev, default value online
    db: the name of the created database
    time-limit: how long to run the test, default 1h
    table-size: how large is the table to run the test, default: 10000
    threads: how many threads to run the test concurrently, default: 64
  # notes is to list all matters which need to be noted
  # eg: the special requirements of the test environment
  notes: |-
    If you are running in dev mode, you need to set:
      export TIDBS="127.0.0.1:4000"--your local tidb cluster
      export TIDB_SERVICE="127.0.0.1:4000"--your local tidb cluster
