influxdata / influxdata/influxdb

fix: use body of the post request for queries

Open
#22,694 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

For very large queries the InfluxDB's HTTP server returns `"431 Request Header Fields Too Large"` response..
looking at the code the `q=` is set at the URL, which as a limit..
Since the request is already `POST` method, this change moves the larger (`q=`, and `params`) key/value pairs to the body of the request.

from influxdb logs
used to be
```
[httpd] 10.244.0.27 - admin [18/Oct/2021:13:00:14 -0700] "POST /query?db=tsdb¶ms=null&q=SELECT+%2A+FROM+%22tsdb%22.%22default%22.%2Fstats%5C%2Ffpg%5C%2Fnu.%2A%2F++WHERE+%22dpu_id%22%3D%27c8%3Ac2%3A2b%3A00%3A0e%3Aec%27+AND++time+%3C%3D+now%28%29++ORDER+BY+time+DESC+LIMIT+1+%3BSELECT+%2A+FROM+%22tsdb%22.%22hourly%22.%2Fstats%5C%2Ffpg%5C%2Fnu.%2A%2F++WHERE+%22dpu_id%22%3D%27c8%3Ac2%3A2b%3A00%3A0e%3Aec%27+AND++time+%3C%3D+now%28%29++ORDER+BY+time+DESC+LIMIT+1+%3BSELECT+%2A+FROM+%22tsdb%22.%22daily%22.%2Fstats%5C%2Ffpg%5C%2Fnu.%2A%2F++WHERE+%22dpu_id%22%3D%27c8%3Ac2%3A2b%3A00%3A0e%3Aec%27+AND++time+%3C%3D+now%28%29++ORDER+BY+time+DESC+LIMIT+1+%3B HTTP/1.1 " 200 65 "-" "TMService/InfluxDB" 01fbcbd6-304e-11ec-a0fb-329a85d2c7b4 117205
```

now

```
[httpd] 127.0.0.1 - - [18/Oct/2021:13:01:35 -0700] "POST /query?db=tsdb HTTP/1.1 {'params': 'null'}, {'q': 'SELECT * FROM "tsdb"."default"./stats\/fpg\/nu.*/ WHERE "dpu_id"='c8:c2:2b:00:0e:c0' AND time <= now() ORDER BY time DESC LIMIT 1 ;SELECT * FROM "tsdb"."hourly"./stats\/fpg\/nu.*/ WHERE "dpu_id"='c8:c2:2b:00:0e:c0' AND time <= now() ORDER BY time DESC LIMIT 1 ;SELECT * FROM "tsdb"."daily"./stats\/fpg\/nu.*/ WHERE "dpu_id"='c8:c2:2b:00:0e:c0' AND time <= now() ORDER BY time DESC LIMIT 1 ;'}" 200 74604 "-" "curl/7.79.1" 328e5e8d-304e-11ec-af89-329a85d2c7b4 221527
`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the POST /query request construction and how the q and params values are encoded. Reproduce the long-query case, then verify that those values are sent in the request body rather than the URL and that the InfluxDB server accepts the request without a 431 response.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, rust
Domain
api, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.