{
  "repo": "pingcap/tidb-operator",
  "binary": "testing-workload",
  "binary_path": "cmd/testing-workload/main.go",
  "dependencies": {
    "Runtime TestingWorkloadLifecycle.ParseFlagsAndConnect": {
      "infrastructure": {
        "runtime_flags": [
          {
            "operation": "PARSE FLAGS",
            "target": "host, duration, max-connections, sleep-interval, and long-txn-sleep",
            "conditions": [
              "Always at process start"
            ],
            "implementation": "cmd/testing-workload/main.go:39-45"
          }
        ]
      },
      "services": [
        {
          "name": "tidb-mysql",
          "target_interface": "MySQL protocol on :4000",
          "operation_type": "sql_client",
          "target_repo": "pingcap/tidb",
          "conditions": [
            "Always after flag parsing",
            "Process panics immediately if sql.Open or db.Ping fails"
          ],
          "operations": [
            {
              "operation": "CONNECT",
              "trigger": "Open the shared MySQL connection pool against root@(<host>:4000)/test",
              "conditions": [
                "host is reachable on port 4000"
              ],
              "implementation": "cmd/testing-workload/main.go:47-57"
            }
          ]
        }
      ]
    },
    "Runtime TestingWorkloadLifecycle.PrepareSchema": {
      "infrastructure": {},
      "services": [
        {
          "name": "tidb-mysql",
          "target_interface": "DDL on test.e2e_test",
          "operation_type": "sql_exec",
          "target_repo": "pingcap/tidb",
          "conditions": [
            "Always after the connection pool is ready"
          ],
          "operations": [
            {
              "operation": "CREATE TABLE IF NOT EXISTS",
              "trigger": "Ensure the workload table exists before starting workers",
              "conditions": [
                "Always"
              ],
              "implementation": "cmd/testing-workload/main.go:59-64"
            }
          ]
        }
      ]
    },
    "Runtime TestingWorkloadLifecycle.RunConcurrentWorkload": {
      "infrastructure": {
        "background_runtime": [
          {
            "operation": "START WORKERS",
            "target": "max-connections goroutines plus duration-bound context",
            "conditions": [
              "Always after schema preparation succeeds"
            ],
            "implementation": "cmd/testing-workload/main.go:66-96"
          }
        ]
      },
      "services": [
        {
          "name": "tidb-mysql",
          "target_interface": "transaction workload on test.e2e_test",
          "operation_type": "sql_workload",
          "target_repo": "pingcap/tidb",
          "conditions": [
            "Each worker loops until the timeout context is canceled",
            "Failures are counted and only cause process panic after all workers finish"
          ],
          "operations": [
            {
              "operation": "RUN TRANSACTION LOOP",
              "trigger": "Generate sustained write workload against TiDB",
              "conditions": [
                "Workers sleep sleep-interval seconds between transaction attempts"
              ],
              "implementation": "cmd/testing-workload/main.go:71-95"
            }
          ]
        }
      ]
    },
    "Runtime TestingWorkloadLifecycle.ExecuteSimpleTransaction": {
      "infrastructure": {},
      "services": [
        {
          "name": "tidb-mysql",
          "target_interface": "BEGIN, REPLACE, UPDATE, optional sleep, and COMMIT",
          "operation_type": "sql_transaction",
          "target_repo": "pingcap/tidb",
          "conditions": [
            "Always when a worker enters the default transaction path",
            "Sleeps long-txn-sleep seconds only when worker id % 3 == 0"
          ],
          "operations": [
            {
              "operation": "BEGIN TRANSACTION",
              "trigger": "Start one workload transaction",
              "conditions": [
                "Always"
              ],
              "implementation": "cmd/testing-workload/main.go:99-103"
            },
            {
              "operation": "REPLACE ROW",
              "trigger": "Upsert worker-specific row",
              "conditions": [
                "Always after BEGIN succeeds"
              ],
              "implementation": "cmd/testing-workload/main.go:110-116"
            },
            {
              "operation": "UPDATE ROW",
              "trigger": "Mutate the same row inside the transaction",
              "conditions": [
                "Always after REPLACE succeeds"
              ],
              "implementation": "cmd/testing-workload/main.go:118-122"
            },
            {
              "operation": "COMMIT",
              "trigger": "Finish the transaction after the optional long-transaction sleep",
              "conditions": [
                "Only if the transaction was not already rolled back on error"
              ],
              "implementation": "cmd/testing-workload/main.go:124-133"
            }
          ]
        }
      ]
    }
  }
}
