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 large field keys preventing snapshot compactions #8425

Merged
merged 3 commits into from
May 25, 2017
Merged

Conversation

jwilder
Copy link
Contributor

@jwilder jwilder commented May 24, 2017

Required for all non-trivial PRs
  • Rebased/mergable
  • Tests pass
  • CHANGELOG.md updated
  • Sign CLA (if not already signed)

This fixes an issue where a very large field key would be accepted during a write, but would subsequently fail when snapshotting the key to TSM. The issue was that series key validation only looked at the measurement + tagset for the max key length. The actual series key includes the field name and an internal tsm value. If a write with a very large field key was sent, it would pass this validation and be written to a tsm file. When the tsm file was loaded, it would fail to load because the actual key size overflow the 2 bytes allocated for storing the key length.

This fixes the validation to fail the writes early on so the client receives a 400/partial write error. It also fixes the bug in the tsm writer to prevent writing keys that are too large. This was check in WriteValues, but not WriteBlock by mistake.

Fixes #8417

jwilder added 3 commits May 24, 2017 13:41
WriteBlock was missing the check for the max series keys which allowed
series keys to be written that were larger than the 2 bytes allocated
to store their length.  When this occurred, the TSM can fail to load.
The series key stored in TSM files includes the field.  We validated
the series length using only the measurement and tag set which allowed
very large field names to overflow.  This now checks the series key
as the measurement + tagset + field + the tsm field key separator size.
@jwilder jwilder merged commit 6b59435 into master May 25, 2017
@jwilder jwilder deleted the jw-max-key branch May 25, 2017 18:20
@jwilder jwilder removed the review label May 25, 2017
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.

InfluxDB starts consuming all available disk space / compaction errors
2 participants