Skip to content
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

fix(upgrade): ensure query config written by influxd upgrade is valid #21321

Merged
merged 5 commits into from
Apr 28, 2021

Conversation

danxmoran
Copy link
Contributor

Closes #21315

  1. Stop rewriting 0 to 10 when upgrading query-concurrency config, now that 0 is a valid value
  2. If writing a value > 0 for query-concurrency, ensure we also write a > 0 value for query-queue-size

I had to refactor a bunch of things to make our upgrade-real-DB regression test actually test loading upgraded config. I confirmed that the 1st commit fails with the error seen in #21315, and the 2nd commit gets things to pass again.

case int32:
concurrency = int64(c)
case int64:
concurrency = c
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these cases are paranoia on my part; I'm not sure when the config-loader would pick each type of int.

}

// When query-concurrency is > 0, query-queue-size must also be > 0.
v2Config["query-queue-size"] = concurrency
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a risk here that:

  • Somebody will pick a huge value for query-concurrency
  • We write the same value into query-queue-size
  • At startup, the server uses the huge value for query-queue-size as the size of a new chan, consuming a lot of memory all at once

I'm assuming the risk is low now that we support 0 for unlimited, so most people who would be writing huge concurrency values can now write 0 instead.

Copy link
Contributor

@davidby-influx davidby-influx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM to me. I hate the type switch, but can't think of any way to improve it....

@danxmoran danxmoran merged commit 91d59d9 into master Apr 28, 2021
@danxmoran danxmoran deleted the dm-influxd-upgrade-invalid-config-21315 branch April 28, 2021 19:41
danxmoran added a commit that referenced this pull request Apr 28, 2021
…id (#21321)

* test: refactor upgrade test to cover the config upgrade
* fix: ensure upgraded query config is valid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

influxd config generates invalid config files
2 participants