{
  "experiment": "database",
  "executed_at": "2026-11-13T17:41:15.538956+00:00",
  "version": "CockroachDB CCL v24.1.24 (aarch64-apple-darwin21.2, built 2025/09/17 18:30:04, go1.22.12 X:nocoverageredesign)",
  "topology": {
    "nodes": [
      {
        "node_id": 1,
        "address": "127.0.0.1:19300"
      },
      {
        "node_id": 2,
        "address": "127.0.0.1:19301"
      },
      {
        "node_id": 3,
        "address": "127.0.0.1:19302"
      }
    ],
    "replicas_per_range": 3,
    "single_host": true,
    "bind": "127.0.0.1",
    "each_node_cache_mib": 64,
    "each_node_sql_mib": 64
  },
  "ranges": [
    {
      "start_key": "\u2026/<TableMin>",
      "end_key": "\u2026/1/1000",
      "range_id": 71,
      "range_size_mb": "0.000025000000000000000000",
      "lease_holder": 3,
      "lease_holder_locality": "labnode=3",
      "replicas": [
        1,
        2,
        3
      ],
      "replica_localities": [
        "labnode=1",
        "labnode=2",
        "labnode=3"
      ],
      "voting_replicas": [
        1,
        3,
        2
      ],
      "non_voting_replicas": [],
      "learner_replicas": [],
      "split_enforced_until": null,
      "range_size": 25,
      "span_stats": {
        "approximate_disk_bytes": 16242,
        "intent_bytes": 0,
        "intent_count": 0,
        "key_bytes": 17,
        "key_count": 1,
        "live_bytes": 25,
        "live_count": 1,
        "sys_bytes": 428,
        "sys_count": 6,
        "val_bytes": 8,
        "val_count": 1
      }
    },
    {
      "start_key": "\u2026/1/1000",
      "end_key": "\u2026/1/2000",
      "range_id": 69,
      "range_size_mb": "0.000027000000000000000000",
      "lease_holder": 1,
      "lease_holder_locality": "labnode=1",
      "replicas": [
        1,
        2,
        3
      ],
      "replica_localities": [
        "labnode=1",
        "labnode=2",
        "labnode=3"
      ],
      "voting_replicas": [
        1,
        3,
        2
      ],
      "non_voting_replicas": [],
      "learner_replicas": [],
      "split_enforced_until": "2262-04-11 23:47:16.854776",
      "range_size": 27,
      "span_stats": {
        "approximate_disk_bytes": 16242,
        "intent_bytes": 0,
        "intent_count": 0,
        "key_bytes": 19,
        "key_count": 1,
        "live_bytes": 27,
        "live_count": 1,
        "sys_bytes": 618,
        "sys_count": 5,
        "val_bytes": 8,
        "val_count": 1
      }
    },
    {
      "start_key": "\u2026/1/2000",
      "end_key": "<after:/Max>",
      "range_id": 70,
      "range_size_mb": "0.000027000000000000000000",
      "lease_holder": 2,
      "lease_holder_locality": "labnode=2",
      "replicas": [
        1,
        2,
        3
      ],
      "replica_localities": [
        "labnode=1",
        "labnode=2",
        "labnode=3"
      ],
      "voting_replicas": [
        1,
        2,
        3
      ],
      "non_voting_replicas": [],
      "learner_replicas": [],
      "split_enforced_until": "2262-04-11 23:47:16.854776",
      "range_size": 27,
      "span_stats": {
        "approximate_disk_bytes": 7219,
        "intent_bytes": 0,
        "intent_count": 0,
        "key_bytes": 19,
        "key_count": 1,
        "live_bytes": 27,
        "live_count": 1,
        "sys_bytes": 619,
        "sys_count": 6,
        "val_bytes": 8,
        "val_count": 1
      }
    }
  ],
  "transfer": {
    "before": [
      100,
      100,
      100
    ],
    "after": [
      {
        "id": 1,
        "balance": 93
      },
      {
        "id": 1001,
        "balance": 107
      },
      {
        "id": 2001,
        "balance": 100
      }
    ],
    "amount": 7,
    "sum": 300,
    "kv_trace": [
      {
        "age": "0:00:00.003027",
        "message": "querying next range at /Table/104/1/1/0",
        "location": "kv/kvclient/kvcoord/range_iter.go:183",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.003057",
        "message": "key: /Table/104/1/1/0, desc: r71:/Table/104{-/1/1000} [(n1,s1):1, (n3,s3):2, (n2,s2):3, next=4, gen=6]",
        "location": "kv/kvclient/kvcoord/range_iter.go:220",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.003084",
        "message": "r71: sending batch 1 Get to (n3,s3):2",
        "location": "kv/kvclient/kvcoord/dist_sender.go:2633",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.004359",
        "message": "Put /Table/104/1/1/0 -> /TUPLE/2:2:Int/93",
        "location": "sql/row/writer.go:222",
        "operation": "count"
      },
      {
        "age": "0:00:00.004786",
        "message": "querying next range at /Table/104/1/1/0",
        "location": "kv/kvclient/kvcoord/range_iter.go:183",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.004808",
        "message": "key: /Table/104/1/1/0, desc: r71:/Table/104{-/1/1000} [(n1,s1):1, (n3,s3):2, (n2,s2):3, next=4, gen=6]",
        "location": "kv/kvclient/kvcoord/range_iter.go:220",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.004821",
        "message": "r71: sending batch 1 Put to (n3,s3):2",
        "location": "kv/kvclient/kvcoord/dist_sender.go:2633",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.005494",
        "message": "rows affected: 1",
        "location": "sql/conn_executor_exec.go:1173",
        "operation": "sql query"
      },
      {
        "age": "0:00:00.006567",
        "message": "querying next range at /Table/104/1/1001/0",
        "location": "kv/kvclient/kvcoord/range_iter.go:183",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.006594",
        "message": "key: /Table/104/1/1001/0, desc: r69:/Table/104/1/{1000-2000} [(n1,s1):1, (n3,s3):2, (n2,s2):3, next=4, gen=6, sticky=9223372036.854775807,2147483647]",
        "location": "kv/kvclient/kvcoord/range_iter.go:220",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.006608",
        "message": "r69: sending batch 1 Get to (n1,s1):1",
        "location": "kv/kvclient/kvcoord/dist_sender.go:2633",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.006947",
        "message": "Put /Table/104/1/1001/0 -> /TUPLE/2:2:Int/107",
        "location": "sql/row/writer.go:222",
        "operation": "count"
      },
      {
        "age": "0:00:00.007011",
        "message": "querying next range at /Table/104/1/1001/0",
        "location": "kv/kvclient/kvcoord/range_iter.go:183",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.007032",
        "message": "key: /Table/104/1/1001/0, desc: r69:/Table/104/1/{1000-2000} [(n1,s1):1, (n3,s3):2, (n2,s2):3, next=4, gen=6, sticky=9223372036.854775807,2147483647]",
        "location": "kv/kvclient/kvcoord/range_iter.go:220",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.007045",
        "message": "r69: sending batch 1 Put to (n1,s1):1",
        "location": "kv/kvclient/kvcoord/dist_sender.go:2633",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.007343",
        "message": "rows affected: 1",
        "location": "sql/conn_executor_exec.go:1173",
        "operation": "sql query"
      },
      {
        "age": "0:00:00.007616",
        "message": "querying next range at /Table/104/1/1/0",
        "location": "kv/kvclient/kvcoord/range_iter.go:183",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.007640",
        "message": "key: /Table/104/1/1/0, desc: r71:/Table/104{-/1/1000} [(n1,s1):1, (n3,s3):2, (n2,s2):3, next=4, gen=6]",
        "location": "kv/kvclient/kvcoord/range_iter.go:220",
        "operation": "dist sender send"
      },
      {
        "age": "0:00:00.007654",
        "message": "r71: sending batch 1 EndTxn to (n3,s3):2",
        "location": "kv/kvclient/kvcoord/dist_sender.go:2633",
        "operation": "dist sender send"
      }
    ]
  },
  "conflict": {
    "schedule": "Both SERIALIZABLE transactions read total=300; A subtracts 80 at id=1, B at id=1001; commits concurrently. Business rule: remaining total >=220.",
    "read_totals": [
      300,
      300
    ],
    "outcomes": [
      {
        "client": "A",
        "status": "retry_required",
        "sqlstate": "40001",
        "message": "restart transaction: TransactionRetryWithProtoRefreshError: TransactionRetryError: retry txn (RETRY_SERIALIZABLE - failed preemptive refresh due to conflicting locks on /Table/104/1/1001/0 [reason=wait_policy] - conflicting txn: meta={id=1d35d81a key=/Table/104/1/1001/0 iso=Serializable pri=0.02877540 epo=0 ts=1794591675.365402000,0 min=1794591675.365402000,0 seq=1}): \"sql txn\" meta={id=002f2cdd key=/Table/104/1/1/0 iso=Serializable pri=0.01618410 epo=0 ts=1794591675.365402000,1 min=1794591675.358445000,0 seq=1} lock=true stat=PENDING rts=1794591675.358445000,0 wto=false gul=1794591675.858445000,0",
        "elapsed_ms": 33.20224999333732
      },
      {
        "client": "B",
        "status": "committed",
        "sqlstate": "00000",
        "elapsed_ms": 15.271832991857082
      }
    ],
    "after": [
      {
        "id": 1,
        "balance": 93
      },
      {
        "id": 1001,
        "balance": 27
      },
      {
        "id": 2001,
        "balance": 100
      }
    ],
    "retry": {
      "fresh_total": 220,
      "minimum_total": 220,
      "withdrawal": 80,
      "decision": "declined"
    },
    "final": [
      {
        "id": 1,
        "balance": 93
      },
      {
        "id": 1001,
        "balance": 27
      },
      {
        "id": 2001,
        "balance": 100
      }
    ]
  },
  "plan": [
    "planning time: 180\u00b5s",
    "execution time: 1ms",
    "distribution: full",
    "vectorized: true",
    "plan type: custom",
    "rows decoded from KV: 3 (93 B, 3 gRPC calls)",
    "cumulative time spent in KV: 376\u00b5s",
    "maximum memory usage: 70 KiB",
    "network usage: 352 B (6 messages)",
    "sql cpu time: 52\u00b5s",
    "isolation level: serializable",
    "priority: normal",
    "quality of service: regular",
    "",
    "\u2022 group (scalar)",
    "\u2502 nodes: n1",
    "\u2502 actual row count: 1",
    "\u2502 sql cpu time: 8\u00b5s",
    "\u2502",
    "\u2514\u2500\u2500 \u2022 scan",
    "      nodes: n1, n2, n3",
    "      actual row count: 3",
    "      KV time: 376\u00b5s",
    "      KV contention time: 0\u00b5s",
    "      KV rows decoded: 3",
    "      KV bytes read: 93 B",
    "      KV gRPC calls: 3",
    "      estimated max memory allocated: 60 KiB",
    "      sql cpu time: 27\u00b5s",
    "      missing stats",
    "      table: accounts@accounts_pkey",
    "      spans: FULL SCAN"
  ],
  "metrics_before": [
    {
      "http_port": 19400,
      "counters": {
        "txn_restarts_serializable": 1.0,
        "sql_txn_begin_count": 0.0,
        "txn_restarts_writetooold": 0.0,
        "txn_aborts": 1.0,
        "txn_commits": 1545.0,
        "sql_txn_abort_count": 0.0,
        "sql_txn_commit_count": 0.0
      }
    },
    {
      "http_port": 19401,
      "counters": {
        "sql_txn_begin_count": 0.0,
        "sql_txn_abort_count": 0.0,
        "sql_txn_commit_count": 0.0,
        "txn_commits": 241.0,
        "txn_restarts_serializable": 0.0,
        "txn_aborts": 1.0,
        "txn_restarts_writetooold": 0.0
      }
    },
    {
      "http_port": 19402,
      "counters": {
        "txn_commits": 255.0,
        "txn_aborts": 1.0,
        "sql_txn_begin_count": 0.0,
        "txn_restarts_writetooold": 0.0,
        "txn_restarts_serializable": 0.0,
        "sql_txn_commit_count": 0.0,
        "sql_txn_abort_count": 0.0
      }
    }
  ],
  "metrics_after": [
    {
      "http_port": 19400,
      "counters": {
        "txn_restarts_serializable": 2.0,
        "sql_txn_begin_count": 2.0,
        "txn_restarts_writetooold": 0.0,
        "txn_aborts": 2.0,
        "txn_commits": 1552.0,
        "sql_txn_abort_count": 0.0,
        "sql_txn_commit_count": 1.0
      }
    },
    {
      "http_port": 19401,
      "counters": {
        "txn_aborts": 1.0,
        "txn_restarts_writetooold": 0.0,
        "sql_txn_begin_count": 1.0,
        "sql_txn_abort_count": 0.0,
        "sql_txn_commit_count": 1.0,
        "txn_commits": 248.0,
        "txn_restarts_serializable": 0.0
      }
    },
    {
      "http_port": 19402,
      "counters": {
        "sql_txn_commit_count": 0.0,
        "sql_txn_abort_count": 0.0,
        "txn_commits": 255.0,
        "txn_aborts": 1.0,
        "sql_txn_begin_count": 0.0,
        "txn_restarts_writetooold": 0.0,
        "txn_restarts_serializable": 0.0
      }
    }
  ],
  "method": "Real three-process cluster, replicated ranges and verified distinct leaseholders. A cross-range transfer commits two updates atomically; a separate write-skew schedule on distinct keys produces a real 40001 error without fault injection. Timing is diagnostic only. No network partition, node-failure, multi-host scaling, production capacity or disk durability validation. Binary is a pinned non-production teaching baseline; no paid feature or cloud account used."
}