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

feat(cmd/influx): support reading GZIP data in influx write #20763

Merged
merged 15 commits into from
Feb 19, 2021

Conversation

danxmoran
Copy link
Contributor

@danxmoran danxmoran commented Feb 16, 2021

Closes #20659

This is meant to mirror the implementation of the existing CSV support.

  • A new CLI option allows for explicitly specifying compression of all inputs
  • If the flag isn't set, the line-reader checks the names of input files & URLs to detect GZIP
    • Files or URLs ending in .gz enable decompression
    • URLs that respond with Content-Encoding: gzip enable decompression

Unlike the existing CSV impl, gzip-or-not is handled on an input-by-input basis when the CLI option isn't set.

cmd/influx/write.go Outdated Show resolved Hide resolved
@danxmoran
Copy link
Contributor Author

danxmoran commented Feb 16, 2021

Closing this for now to do a bit more cleanup / refactoring Done

@danxmoran danxmoran closed this Feb 16, 2021
@danxmoran danxmoran reopened this Feb 16, 2021
@danxmoran danxmoran force-pushed the dm-influx-write-gzip-20659 branch from a479caa to 20bc5f7 Compare February 18, 2021 14:59
cmd/influx/write.go Outdated Show resolved Hide resolved
@danxmoran danxmoran requested a review from lesam February 18, 2021 16:23
@danxmoran danxmoran force-pushed the dm-influx-write-gzip-20659 branch from d859fd6 to 9cabd54 Compare February 19, 2021 01:26

compressed := b.Compression == "gzip" || (len(b.Compression) == 0 && strings.HasSuffix(file, ".gz"))
if compressed {
file = strings.TrimSuffix(file, ".gz")
Copy link
Contributor

Choose a reason for hiding this comment

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

As a user I would prefer to see the .gz suffix in the error message. Not blocking.

Copy link
Contributor

@lesam lesam left a comment

Choose a reason for hiding this comment

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

lgtm

@danxmoran danxmoran force-pushed the dm-influx-write-gzip-20659 branch from 9cabd54 to bbcd966 Compare February 19, 2021 17:09
@danxmoran danxmoran merged commit 58ae51d into master Feb 19, 2021
@danxmoran danxmoran deleted the dm-influx-write-gzip-20659 branch February 19, 2021 17:31
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.

Suppport for ingesting compressed files via influx write
3 participants