-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add chunked/chunk size as setting/options in cli #8119
Conversation
f625e8e
to
a322571
Compare
cmd/influx/cli/cli.go
Outdated
@@ -31,6 +31,10 @@ import ( | |||
// ErrBlankCommand is returned when a parsed command is empty. | |||
var ErrBlankCommand = errors.New("empty input") | |||
|
|||
// DefaultChunkSize is the default number of results to return | |||
// per response if chunked responses are turned on | |||
const DefaultChunkSize = 10000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default chunk size should just be set to the zero value. We don't want to duplicate the value from the server in the client. If the chunk size is set to zero, don't include it in the client request and that will cause the server to use the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, that makes sense. I see that the handler already sets to the default if we pass zero.
cmd/influx/cli/cli.go
Outdated
cmd = strings.ToLower(cmd) | ||
|
||
// Remove the "chunk size" keyword if it exists | ||
cmd = strings.TrimSpace(strings.Replace(cmd, "chunk size", "", -1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this check for chunk size
at the beginning and trim it from the beginning? It seems to me like replace is unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you are suggesting. Can you elaborate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm saying just use strings.HasPrefix
instead and then trimming the prefix instead of replacing anywhere within the line. The current implementation allows chunk size 4 chunk size
.
2a0d8d3
to
83c3a8a
Compare
@jsternberg issues addressed. Please review again when you have a change. Thanks. |
83c3a8a
to
e07d845
Compare
@jsternberg ping |
While working on another PR, I noticed that
chunking
was hard coded in the CLI. This adds options to turn chunking on/off as well setting the chunk size.This is very useful when doing any type of scripted querying or testing.
Required for all non-trivial PRs
Required only if applicable