docs: add docs for kv_max_value_size (#7405)
Apart from the added docs, the error messages are similar now and are pointing to the corresponding options. Fixes #6708.
This commit is contained in:
parent
bc87976708
commit
eb8bdc372e
|
@ -197,7 +197,11 @@ func (s *HTTPServer) KVSPut(resp http.ResponseWriter, req *http.Request, args *s
|
||||||
// Check the content-length
|
// Check the content-length
|
||||||
if req.ContentLength > int64(s.agent.config.KVMaxValueSize) {
|
if req.ContentLength > int64(s.agent.config.KVMaxValueSize) {
|
||||||
resp.WriteHeader(http.StatusRequestEntityTooLarge)
|
resp.WriteHeader(http.StatusRequestEntityTooLarge)
|
||||||
fmt.Fprintf(resp, "Value exceeds %d byte limit", s.agent.config.KVMaxValueSize)
|
fmt.Fprintf(resp,
|
||||||
|
"Request body(%d bytes) too large, max size: %d bytes. See %s.",
|
||||||
|
req.ContentLength, s.agent.config.KVMaxValueSize,
|
||||||
|
"https://www.consul.io/docs/agent/options.html#kv_max_value_size",
|
||||||
|
)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,11 @@ func (s *HTTPServer) convertOps(resp http.ResponseWriter, req *http.Request) (st
|
||||||
// Check Content-Length first before decoding to return early
|
// Check Content-Length first before decoding to return early
|
||||||
if req.ContentLength > maxTxnLen {
|
if req.ContentLength > maxTxnLen {
|
||||||
resp.WriteHeader(http.StatusRequestEntityTooLarge)
|
resp.WriteHeader(http.StatusRequestEntityTooLarge)
|
||||||
fmt.Fprintf(resp, "Request body too large, max size: %v bytes", maxTxnLen)
|
fmt.Fprintf(resp,
|
||||||
|
"Request body(%d bytes) too large, max size: %d bytes. See %s.",
|
||||||
|
req.ContentLength, maxTxnLen,
|
||||||
|
"https://www.consul.io/docs/agent/options.html#txn_max_req_len",
|
||||||
|
)
|
||||||
return nil, 0, false
|
return nil, 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +103,11 @@ func (s *HTTPServer) convertOps(resp http.ResponseWriter, req *http.Request) (st
|
||||||
// The request size is also verified during decoding to double check
|
// The request size is also verified during decoding to double check
|
||||||
// if the Content-Length header was not set by the client.
|
// if the Content-Length header was not set by the client.
|
||||||
resp.WriteHeader(http.StatusRequestEntityTooLarge)
|
resp.WriteHeader(http.StatusRequestEntityTooLarge)
|
||||||
fmt.Fprintf(resp, "Request body too large, max size: %v bytes", maxTxnLen)
|
fmt.Fprintf(resp,
|
||||||
|
"Request body too large, max size: %d bytes. See %s.",
|
||||||
|
maxTxnLen,
|
||||||
|
"https://www.consul.io/docs/agent/options.html#txn_max_req_len",
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
// Note the body is in API format, and not the RPC format. If we can't
|
// Note the body is in API format, and not the RPC format. If we can't
|
||||||
// decode it, we will return a 400 since we don't have enough context to
|
// decode it, we will return a 400 since we don't have enough context to
|
||||||
|
|
|
@ -1449,12 +1449,23 @@ Valid time units are 'ns', 'us' (or 'µs'), 'ms', 's', 'm', 'h'."
|
||||||
single RPC call to a Consul server. See
|
single RPC call to a Consul server. See
|
||||||
https://en.wikipedia.org/wiki/Token_bucket for more details about how
|
https://en.wikipedia.org/wiki/Token_bucket for more details about how
|
||||||
token bucket rate limiters operate.
|
token bucket rate limiters operate.
|
||||||
|
* <a name="kv_max_value_size"></a><a href="#kv_max_value_size">
|
||||||
|
`kv_max_value_size`</a> - **(Advanced)** Configures the maximum number of
|
||||||
|
bytes for a kv request body to the [`/v1/kv`](/api/kv.html) endpoint.
|
||||||
|
This limit defaults to [raft's](https://github.com/hashicorp/raft)
|
||||||
|
suggested max size(512KB). **Note that tuning these improperly can cause
|
||||||
|
Consul to fail in unexpected ways**, it may potentially affect
|
||||||
|
leadership stability and prevent timely heartbeat signals by increasing
|
||||||
|
RPC IO duration.
|
||||||
|
This option affects the txn endpoint too, but Consul 1.7.2 introduced
|
||||||
|
`txn_max_req_len` which is the preferred way to set the limit for the
|
||||||
|
txn endpoint. If both limits are set, the higher one takes precedence.
|
||||||
* <a name="txn_max_req_len"></a><a href="#txn_max_req_len">
|
* <a name="txn_max_req_len"></a><a href="#txn_max_req_len">
|
||||||
`txn_max_req_len`</a> - Configures the maximum number of
|
`txn_max_req_len`</a> - **(Advanced)** Configures the maximum number of
|
||||||
bytes for a transaction request body to the [`/v1/txn`](/api/txn.html)
|
bytes for a transaction request body to the [`/v1/txn`](/api/txn.html)
|
||||||
endpoint. This limit defaults to [raft's](https://github.com/hashicorp/raft)
|
endpoint. This limit defaults to [raft's](https://github.com/hashicorp/raft)
|
||||||
suggested max size. **Note that increasing beyond this default can
|
suggested max size(512KB). **Note that tuning these improperly can cause
|
||||||
cause Consul to fail in unexpected ways**, it may potentially affect
|
Consul to fail in unexpected ways**, it may potentially affect
|
||||||
leadership stability and prevent timely heartbeat signals by
|
leadership stability and prevent timely heartbeat signals by
|
||||||
increasing RPC IO duration.
|
increasing RPC IO duration.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue