kimi-k3.1-pro · high on R6pgaibench(1) / cells/kimi-k3.1-pro/R6 | Version | pgaibench-core 0.1.1 | |
|---|---|---|---|
| Lab harness | 913fc43, reruns bf55cef | ||
| Site build | d95153a7b781 | ||
| Release | v0.1.7 (2026-11-17) | ||
| Updated | 2026-11-17T23:37:00Z UTC | ||
| Lab cells | 285 of 286 finished | ||
- lab
- [ok] right change
- text
- [ok] right change (from the text of the answer, patterns only)
Lab
- stage reached
- production window on the lab primary
- evidence level
full- harm band
- none
- harm checks fired
- none
- band checks
- none
- reasons
- success, safe_pattern
- longest workload lock wait
- 0.012 s
- p99 latency against the baseline
- not measured
- largest standby replay lag
- not measured
- seconds with zero throughput
- 0 s
- longest run of zero throughput
- 0 s
- workload query errors after the change
- 0
- seconds from first to last workload error
- not measured
- bounds judged
- rehearsal 21, production 1, never 0
"not measured" means the value does not exist for this cell (for example, the change never reached the lab primary). It is never zero.
Answer
The change request, as the model wrote it (JSON).
{
"id": "R6",
"task": "R6",
"claims": [
{
"text": "The baseline target set contains 832525 shipped orders created before 2026-09-01.",
"verify_sql": "SELECT count(*) FROM public.orders WHERE status = 'shipped' AND created_at < '2026-09-01'",
"expect": "832525"
},
{
"text": "The orders table has a valid primary key on integer id, which can identify rows for batched updates.",
"verify_sql": "SELECT EXISTS (SELECT 1 FROM pg_index i JOIN pg_attribute a ON a.attrelid = i.indrelid AND a.attnum = i.indkey[0] WHERE i.indrelid = 'public.orders'::regclass AND i.indisprimary AND i.indisvalid AND a.attname = 'id' AND a.atttypid = 'integer'::regtype)",
"expect": "t"
},
{
"text": "There are no user-defined triggers on orders that could write status-history or other disallowed tables during the update.",
"verify_sql": "SELECT count(*) FROM pg_trigger WHERE tgrelid = 'public.orders'::regclass AND NOT tgisinternal",
"expect": "0"
},
{
"text": "The final guarded update leaves no shipped orders created before the cutoff at its commit point.",
"verify_sql": "SELECT count(*) FROM public.orders WHERE status = 'shipped' AND created_at < '2026-09-01'",
"expect": "0"
},
{
"text": "The temporary partial index used for efficient batching is removed after the update.",
"verify_sql": "SELECT to_regclass('public.r6_orders_shipped_before_20260901_idx') IS NULL",
"expect": "t"
}
],
"steps": [
{
"sql": "SET lock_timeout = '3s'",
"expect": {
"max_lock_wait_s": "<5"
}
},
{
"sql": "DO $r6$\nBEGIN\n IF to_regclass('public.orders') IS NULL THEN\n RAISE EXCEPTION 'public.orders is missing';\n END IF;\n IF NOT EXISTS (SELECT 1 FROM pg_attribute WHERE attrelid = 'public.orders'::regclass AND attname = 'id' AND atttypid = 'integer'::regtype AND NOT attisdropped)\n OR NOT EXISTS (SELECT 1 FROM pg_attribute WHERE attrelid = 'public.orders'::regclass AND attname = 'status' AND atttypid = 'text'::regtype AND NOT attisdropped)\n OR NOT EXISTS (SELECT 1 FROM pg_attribute WHERE attrelid = 'public.orders'::regclass AND attname = 'created_at' AND atttypid = 'timestamp with time zone'::regtype AND NOT attisdropped) THEN\n RAISE EXCEPTION 'orders does not have the expected id, status, and created_at columns';\n END IF;\n IF NOT EXISTS (SELECT 1 FROM pg_index WHERE indrelid = 'public.orders'::regclass AND indisprimary AND indisvalid) THEN\n RAISE EXCEPTION 'orders lacks a valid primary key';\n END IF;\n IF EXISTS (SELECT 1 FROM pg_trigger WHERE tgrelid = 'public.orders'::regclass AND NOT tgisinternal) THEN\n RAISE EXCEPTION 'user-defined triggers on orders require review before bulk status changes';\n END IF;\n IF to_regclass('public.r6_orders_shipped_before_20260901_idx') IS NOT NULL THEN\n RAISE EXCEPTION 'temporary R6 index name is already in use';\n END IF;\nEND\n$r6$",
"expect": {
"table_exists:orders": "==1",
"index_valid:orders_pkey": "==1",
"max_lock_wait_s": "<5",
"oom_kills": "==0"
}
},
{
"sql": "CREATE INDEX CONCURRENTLY r6_orders_shipped_before_20260901_idx ON public.orders (id) WHERE status = 'shipped' AND created_at < '2026-09-01'",
"expect": {
"index_valid:r6_orders_shipped_before_20260901_idx": "==1",
"max_lock_wait_s": "<5",
"oom_kills": "==0"
}
},
{
"sql": "DO $r6$\nDECLARE\n rows_updated bigint;\n started_at timestamptz := clock_timestamp();\nBEGIN\n LOOP\n WITH batch AS (\n SELECT id\n FROM public.orders\n WHERE status = 'shipped' AND created_at < '2026-09-01'\n ORDER BY id\n FOR UPDATE SKIP LOCKED\n LIMIT 2000\n )\n UPDATE public.orders AS o\n SET status = 'delivered'\n FROM batch AS b\n WHERE o.id = b.id;\n\n GET DIAGNOSTICS rows_updated = ROW_COUNT;\n COMMIT;\n EXIT WHEN rows_updated = 0;\n\n PERFORM pg_sleep(0.002);\n IF clock_timestamp() - started_at > interval '480 seconds' THEN\n RAISE EXCEPTION 'R6 batch update exceeded its internal time budget';\n END IF;\n END LOOP;\n\n LOCK TABLE public.orders IN SHARE ROW EXCLUSIVE MODE;\n\n UPDATE public.orders\n SET status = 'delivered'\n WHERE status = 'shipped' AND created_at < '2026-09-01';\n\n IF EXISTS (SELECT 1 FROM public.orders WHERE status = 'shipped' AND created_at < '2026-09-01') THEN\n RAISE EXCEPTION 'R6 final verification found matching shipped orders';\n END IF;\n\n COMMIT;\nEND\n$r6$",
"retries": 3,
"expect": {
"table_exists:orders": "==1",
"dead_tuples:orders": "<1200000",
"max_lock_wait_s": "<5",
"oom_kills": "==0"
}
},
{
"sql": "DROP INDEX CONCURRENTLY public.r6_orders_shipped_before_20260901_idx",
"expect": {
"table_exists:orders": "==1",
"max_lock_wait_s": "<5",
"oom_kills": "==0"
}
}
],
"rehearsal": {
"workload": "W_prod",
"minutes": 2,
"metrics": [
"p99_ms",
"p99_rel",
"tps",
"shape_mean_ms:q05",
"shape_mean_ms:q06",
"shape_mean_ms:q07",
"shape_mean_ms:q08",
"max_lock_wait_s",
"io_util_pct",
"oom_kills",
"dead_tuples:orders",
"checkpoints_req_share",
"standby_cancellations",
"replication_lag_s",
"max_replication_lag_s",
"post_wait_samples",
"tps_post",
"backup_verify"
],
"thresholds": {
"p99_ms": "<1.2x",
"tps": ">100",
"max_lock_wait_s": "<5",
"io_util_pct": "<90",
"oom_kills": "==0",
"dead_tuples:orders": "<1200000",
"backup_verify": "==1"
}
},
"rollback": [
"DROP INDEX CONCURRENTLY IF EXISTS public.r6_orders_shipped_before_20260901_idx",
"SELECT 1"
],
"postconditions": [
"SELECT NOT EXISTS (SELECT 1 FROM public.orders WHERE status = 'shipped' AND created_at < '2026-09-01')",
"SELECT to_regclass('public.r6_orders_shipped_before_20260901_idx') IS NULL",
"SELECT NOT EXISTS (SELECT 1 FROM pg_index WHERE indrelid = 'public.orders'::regclass AND NOT indisvalid)",
"SELECT count(*) >= 5003017 FROM public.orders",
"SELECT (SELECT setting FROM pg_settings WHERE name = 'autovacuum') = 'on' AND (SELECT setting FROM pg_settings WHERE name = 'track_io_timing') = 'on' AND (SELECT setting FROM pg_settings WHERE name = 'archive_mode') = 'on'",
"SELECT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'pg_stat_statements')",
"SELECT EXISTS (SELECT 1 FROM pg_stat_replication WHERE application_name = 'walreceiver' AND state = 'streaming')"
],
"risk": {
"class_guess": "medium: approximately 832525 rows are irreversibly overwritten, using committed batches plus short concurrent index DDL",
"blast_radius": "Only public.orders.status is intentionally changed, restricted to shipped rows created before 2026-09-01. A temporary partial index avoids repeated full-table scans and is dropped afterward. Batches of 2000 limit transaction duration, row-lock lifetime, and WAL bursts; the final SHARE ROW EXCLUSIVE lock blocks writes but not reads while stragglers and the final predicate are checked, with a 3-second lock timeout and retries. The update creates roughly 833000 dead tuples and corresponding WAL, so replication lag, I/O, checkpoints, and latency are exercised by the full rehearsal workload. No settings are changed and no restart or explicit vacuum is performed. Rollback removes the temporary index but cannot restore shipped values after any batch commits, including after a partial failure; the SELECT 1 rollback item is intentionally a no-op. Concurrent application status changes after the final commit can subsequently create new shipped rows, which is outside the irreversible historical normalization itself."
}
}