Parent: #481
Describe the bug
The stream output records query metrics at stream end. A cancelled query never reaches that point.
The query store then holds no row for the query. The atlas_* counters are lost too.
A slow query that a client abandons leaves no trace.
Impact
These queries need diagnosis the most. A user reports a slow query. The query store holds nothing about it.
The two output routes differ here. run_query_to_file records metrics after the write. The code says so at runtime.rs:237.
Expected behavior
A cancelled query records the metrics it collected.
Open decision
The row is partial. A reader must not read it as a complete query.
Pick one option:
- Add a state column. Values: complete, cancelled.
- Add a boolean column for a partial row.
- Mark the row in an existing column.
Option 1 is clearer. It also costs a schema change in the query store.
Suggested fix
- Pick an option above.
- Record the metrics when the stream drops.
- Mark the row with the chosen column.
A Drop implementation on the stream wrapper is one way. CoalesceSqlStream already wraps the stream.
Keep the record step cheap. A drop runs on the runtime.
Files
beacon-db/beacon-core/src/runtime.rs
beacon-server/beacon-server/src/axum/client/query.rs
Scope
Every stream query. The format does not matter.
Parent: #481
Describe the bug
The stream output records query metrics at stream end. A cancelled query never reaches that point.
The query store then holds no row for the query. The
atlas_*counters are lost too.A slow query that a client abandons leaves no trace.
Impact
These queries need diagnosis the most. A user reports a slow query. The query store holds nothing about it.
The two output routes differ here.
run_query_to_filerecords metrics after the write. The code says so atruntime.rs:237.Expected behavior
A cancelled query records the metrics it collected.
Open decision
The row is partial. A reader must not read it as a complete query.
Pick one option:
Option 1 is clearer. It also costs a schema change in the query store.
Suggested fix
A
Dropimplementation on the stream wrapper is one way.CoalesceSqlStreamalready wraps the stream.Keep the record step cheap. A drop runs on the runtime.
Files
beacon-db/beacon-core/src/runtime.rsbeacon-server/beacon-server/src/axum/client/query.rsScope
Every stream query. The format does not matter.