{"record":{"id":"70ec6f095ab2a9c6","repo":"tursodatabase/turso","slug":"search-results-require-at-least-one-sample-per-connection","errorCode":null,"errorMessage":"search results require at least one sample per connection and the requested query count","messagePattern":"search results require at least one sample per connection and the requested query count","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"perf/fts/plot/plot-fts.py","lineNumber":132,"sourceCode":"            seen.add(query)\n            series[query].append(read_measurement(row, percentile))\n    if not runs:\n        raise ValueError(f\"{path}: no results found\")\n    return configuration, runs\n\n\ndef read_measurement(row, percentile):\n    queries = int(row[\"queries\"])\n    positive_number(queries)\n    if row[\"benchmark\"] != \"memory\":\n        seconds = positive_number(row[\"seconds\"])\n    if row[\"benchmark\"] == \"memory\":\n        if row[\"engine\"] != \"turso\" or queries != int(row[\"requested_queries\"]) * int(row[\"connections\"]):\n            raise ValueError(\"heap results require Turso and the requested queries per connection\")\n        value = float(row[\"peak_heap_bytes\"]) / (1024 * 1024)\n    elif row[\"benchmark\"] == \"search\":\n        if not 0 < int(row[\"connections\"]) <= queries or queries != int(row[\"requested_queries\"]):\n            raise ValueError(\"search results require at least one sample per connection and the requested query count\")\n        value = float(row[f\"{percentile}_ms\"])\n    elif row[\"benchmark\"] == \"throughput\":\n        minimum = positive_number(row[\"min_seconds\"])\n        if seconds < minimum:\n            raise ValueError(\"throughput results must meet a positive minimum duration\")\n        value = queries / seconds\n    else:\n        raise ValueError(\"unknown benchmark\")\n    return positive_number(value)\n\n\ndef positive_number(value):\n    value = float(value)\n    if not np.isfinite(value) or value <= 0:\n        raise ValueError(\"measurements must be finite and positive\")\n    return value\n\n","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/tursodatabase/turso/blob/8d4a589f8d13ac184700d2a8f724f27e1995be3b/perf/fts/plot/plot-fts.py#L114-L150","documentation":"For benchmark='search' rows, the script requires 0 < connections <= queries and queries == requested_queries so every connection has at least one latency sample and the planned query count was actually executed. Otherwise percentile latency would be computed over an incomplete or inconsistent sample set.","triggerScenarios":"A search row where connections exceeds queries, connections is zero/negative, or executed queries differ from requested_queries.","commonSituations":"Benchmark aborted early so fewer queries ran than requested; connections set higher than the query count; misconfigured requested_queries column.","solutions":["Re-run the search benchmark so all requested queries complete on every connection","Fix connections/queries/requested_queries columns to satisfy connections <= queries and queries == requested_queries","Remove incomplete search rows from the CSV"],"exampleFix":"// before (CSV)\nbenchmark=search,queries=10,requested_queries=100,connections=20\n// after\nbenchmark=search,queries=100,requested_queries=100,connections=20","handlingStrategy":"validation","validationCode":"def validate_search_row(row):\n    q, rq, c = int(row[\"queries\"]), int(row[\"requested_queries\"]), int(row[\"connections\"])\n    if not 0 < c <= q or q != rq:\n        raise ValueError(\"search results require at least one sample per connection and the requested query count\")","typeGuard":"def is_valid_search_row(row) -> bool:\n    q, rq, c = int(row[\"queries\"]), int(row[\"requested_queries\"]), int(row[\"connections\"])\n    return 0 < c <= q and q == rq","tryCatchPattern":"try:\n    configuration, runs = read_runs(path, percentile)\nexcept ValueError as e:\n    print(f\"incomplete search run: {e}\")","preventionTips":["Verify the benchmark finished all requested queries before saving results","Keep connections <= total queries when configuring runs","Sanity-check executed query counts after each run"],"tags":["python","benchmark","validation"],"backgroundTag":"value-out-of-range","analyzedSha":"8d4a589f8d13ac184700d2a8f724f27e1995be3b","analyzedAt":"2026-09-20T13:18:14.658Z","contentChangedAt":"2026-09-20T13:18:14.658Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}