zed icon indicating copy to clipboard operation
zed copied to clipboard

Unexpected response from query endpoint

Open jameskerr opened this issue 2 years ago • 2 comments

I performed from :pools on a lake that had no pools and got a response like this:

{"kind":"QueryChannelEnd","value":{"channel_id":0}}
{"kind":"QueryStats","value":{"start_time":{"sec":1643051497,"ns":957445000},"update_time":{"sec":1643051497,"ns":957516000},"bytes_read":0,"bytes_matched":0,"records_read":0,"records_matched":0}}

It seems like we should have received a QueryChannelSet message even if there were no results.

jameskerr avatar Jan 24 '22 19:01 jameskerr

I've confirmed that this is still with us at current Zed commit 9c0f097.

Against an empty pool, there's no QueryChannelSet message as @jameskerr indicated.

$ curl http://localhost:9867/version
{"version":"v1.2.0-49-g9c0f0973"}

$ curl -X POST \
      -H 'Accept: application/x-zjson' \
      -H 'Content-Type: application/json' \
      http://localhost:9867/query?ctrl=T -d '{"query":"from :pools"}'
{"type":"QueryChannelEnd","value":{"channel_id":0}}
{"type":"QueryStats","value":{"start_time":{"sec":1663173943,"ns":159435000},"update_time":{"sec":1663173943,"ns":159517000},"bytes_read":0,"bytes_matched":0,"records_read":0,"records_matched":0}}

But then once I add one pool, now it's present.

$ zed create foo
pool created: foo 2EldD5zRUluNEFIXKFB6wCHnJTO

$ curl -X POST \
       -H 'Accept: application/x-zjson' \
       -H 'Content-Type: application/json' \
       http://localhost:9867/query?ctrl=T -d '{"query":"from :pools"}'
{"type":"QueryChannelSet","value":{"channel_id":0}}
{"type":{"kind":"named","id":39,"name":"pools.Config","type":{"kind":"record","id":38,"fields":[{"name":"ts","type":{"kind":"primitive","name":"time"}},{"name":"name","type":{"kind":"primitive","name":"string"}},{"name":"id","type":{"kind":"named","id":30,"name":"ksuid.KSUID","type":{"kind":"primitive","name":"bytes"}}},{"name":"layout","type":{"kind":"named","id":37,"name":"order.Layout","type":{"kind":"record","id":36,"fields":[{"name":"order","type":{"kind":"named","id":31,"name":"order.Which","type":{"kind":"primitive","name":"string"}}},{"name":"keys","type":{"kind":"named","id":35,"name":"field.List","type":{"kind":"array","id":34,"type":{"kind":"named","id":33,"name":"field.Path","type":{"kind":"array","id":32,"type":{"kind":"primitive","name":"string"}}}}}}]}}},{"name":"seek_stride","type":{"kind":"primitive","name":"int64"}},{"name":"threshold","type":{"kind":"primitive","name":"int64"}}]}},"value":["2022-09-14T16:46:21.542036Z","foo","0x0fafb75dc97c79e8577d4d30b6a09d45c42d3df2",["desc",[["ts"]]],"65536","524288000"]}
{"type":"QueryChannelEnd","value":{"channel_id":0}}
{"type":"QueryStats","value":{"start_time":{"sec":1663174128,"ns":108882000},"update_time":{"sec":1663174128,"ns":109002000},"bytes_read":54,"bytes_matched":54,"records_read":1,"records_matched":1}}

philrz avatar Sep 14 '22 16:09 philrz

I've confirmed with @jameskerr that this is not needed right away.

philrz avatar Sep 21 '22 21:09 philrz