Display a warning when rpc.enable_streaming = true is set on a client (#9530)

* Display a warning when rpc.enable_streaming = true is set on a client

This option has no effect when running as an agent

* Added warning when server starts with use_streaming_backend but without rpc.enable_streaming

* Added unit test
This commit is contained in:
Pierre Souchay 2021-01-08 21:23:23 +01:00 committed by GitHub
parent 2eac571276
commit 70d2da7582
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 0 deletions

3
.changelog/9530.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
streaming: display a warning on agent(s) when incompatible streaming parameters are used
```

View File

@ -1426,6 +1426,14 @@ func (b *Builder) Validate(rt RuntimeConfig) error {
b.warn("bootstrap_expect > 0: expecting %d servers", rt.BootstrapExpect)
}
if rt.ServerMode {
if rt.UseStreamingBackend && !rt.RPCConfig.EnableStreaming {
b.warn("use_streaming_backend = true requires rpc.enable_streaming on servers to work properly")
}
} else if rt.RPCConfig.EnableStreaming {
b.warn("rpc.enable_streaming = true has no effect when not running in server mode")
}
if rt.AutoEncryptAllowTLS {
if !rt.VerifyIncoming && !rt.VerifyIncomingRPC {
b.warn("if auto_encrypt.allow_tls is turned on, either verify_incoming or verify_incoming_rpc should be enabled. It is necessary to turn it off during a migration to TLS, but it should definitely be turned on afterwards.")

View File

@ -2898,6 +2898,48 @@ func TestBuilder_BuildAndValidate_ConfigFlagsAndEdgecases(t *testing.T) {
rt.SkipLeaveOnInt = true
},
},
{
desc: "rpc.enable_streaming = true has no effect when not running in server mode",
args: []string{
`-data-dir=` + dataDir,
},
json: []string{`{
"rpc": { "enable_streaming": true }
}`},
hcl: []string{`
rpc { enable_streaming = true }
`},
warns: []string{"rpc.enable_streaming = true has no effect when not running in server mode"},
patch: func(rt *RuntimeConfig) {
rt.DataDir = dataDir
// rpc.enable_streaming make no sense in not-server mode
rt.RPCConfig.EnableStreaming = true
rt.ServerMode = false
},
},
{
desc: "use_streaming_backend = true requires rpc.enable_streaming on servers to work properly",
args: []string{
`-data-dir=` + dataDir,
},
json: []string{`{
"use_streaming_backend": true,
"server": true
}`},
hcl: []string{`
use_streaming_backend = true
server = true
`},
warns: []string{"use_streaming_backend = true requires rpc.enable_streaming on servers to work properly"},
patch: func(rt *RuntimeConfig) {
rt.DataDir = dataDir
rt.UseStreamingBackend = true
// server things
rt.ServerMode = true
rt.LeaveOnTerm = false
rt.SkipLeaveOnInt = true
},
},
{
desc: "auto_encrypt.allow_tls errors in client mode",
args: []string{