Commit Graph

14781 Commits (e68b64c57bb0acfe34722b979e628a771cce7aba)

Author SHA1 Message Date
David Norton 78a05d1119
Merge pull request #17596 from foobar/optimize-sorted-merge-iterator
improvement(query): performance improvement for sorted merge iterator
2020-06-23 12:50:10 -04:00
Tristan Su 1e7a2e234a
fix(test): use go 1.13 in test scripts (#18529)
With https://github.com/influxdata/influxdb/pull/17530, go 1.13 is
required.
2020-06-22 15:29:17 -07:00
Tristan Su b31bf6a861
chore: fix missing eol (#18379)
Seems these files were created on non-unix platform so EOL is missing.
This is not an issue but for consistence with other files, it's better
to add eol.
2020-06-22 15:25:12 -07:00
Tristan Su f24f644510
chore: fix code format (#18013) 2020-06-22 15:23:36 -07:00
Tristan Su 17d192e062
chore(dumptsm): clean up dead code (#17381) 2020-06-22 15:02:53 -07:00
Tristan Su 7be913de6e
chore(tsdb): clean up unused ShardID in EngineOptions (#17243) 2020-06-22 15:01:32 -07:00
Ben Johnson 7f08d1f99f
Merge pull request #18456 from influxdata/bj-parallelize-field-iterator-planning
feat(query): Parallelize field iterator planning
2020-06-11 12:54:31 -06:00
Ben Johnson 5263070632 feat(query): Parallelize field iterator planning 2020-06-11 08:01:14 -06:00
Pavel Zavora fe150dc768 chore: update changelog 2020-06-10 19:50:30 +02:00
Pavel Zavora 0c6940d0a3 fix(handler): allow CORS in v2 compatibility endpoints 2020-06-09 09:09:30 +02:00
Pavel Zavora 0e458e7175 fix(handler): add User-Agent to allowed CORS headers 2020-06-09 07:09:27 +02:00
Jakub Bednář 61606289db chore(handler): add 2.0 compatible health endpoint from v1.8 (#17252) 2020-06-09 06:53:32 +02:00
Ben Johnson ab00f36a32
Merge pull request #18203 from influxdata/fix-series-id-set-iterator-merge-retention
fix(tsdb): Defer closing of underlying SeriesIDSetIterators
2020-05-26 08:37:01 -06:00
Ben Johnson 51f647d763 fix(tsdb): Defer closing of underlying SeriesIDSetIterators
This commit changes the SeriesIDSet merge/union/intersect functions
to attach the underlying iterators as closers so that files can be
retained until the data is no longer in use. The roaring operations
can leave containers pointing at mmap data in the resulting bitmap
so we have to track underlying file usage until the data is finished
with.
2020-05-22 10:46:05 -06:00
Ben Johnson ca420c601d
Merge pull request #18158 from influxdata/disable-tag-value-series-id-cache
fix(tsdb): Disable series id set cache size by default.
2020-05-20 07:46:53 -06:00
Ben Johnson 9c41e12ee4 fix(tsdb): Disable series id set cache size by default.
This commit changes `DefaultSeriesIDSetCacheSize` to zero so that the
tag value cache is disabled by default. There is a rare known bug where
the cache can cause a segfault which crasheds the process. The cache
is being disabled instead of removed as some users may still need the
cache for performance reasons.
2020-05-19 10:04:05 -06:00
Ayan George 9dae8c9802
fix(query): address staticcheck warning S1020 (#18136)
Quiet staicccheck warning "should merge variable declaration with
assignment on next line (S1021)" by updating point.gen.go.tmpl and
re-generating point.gen.go.
2020-05-18 20:20:54 -04:00
J. Emrys Landivar 6be2b37e0e
Merge pull request #18014 from foobar/cleanup-unused-functions
chore: clean up unused functions
2020-05-18 18:47:07 -05:00
Ayan George 2529799abb
refactor: Change ToLower comparisons to EqualFold (#18147)
When comparing strings in a case-insensitive way, strings.EqualFold() is
(almost?) always faster than comparing the results of strings.ToLower().

In addition, strings.EqualFold() never causes an allocation.

This patch replaces case-insensitive string comparisons that use
strings.ToLower() with a strings.EqualFold() call.
2020-05-18 19:46:59 -04:00
Ayan George 6808702703
refactor(query): reuse matchAllRegex (#18146)
matchAllRegex is a global variable containing the precompiled regex that
matches ".+".

Prior to this commit, it was used in only one place and we called its
.Copy() method.

According to the docs, .Copy() is no longer needed for safe concurrent
access:

  Deprecated: In earlier releases, when using a Regexp in multiple
  goroutines, giving each goroutine its own copy helped to avoid lock
  contention. As of Go 1.12, using Copy is no longer necessary to avoid
  lock contention. Copy may still be appropriate if the reason for its
  use is to make two copies with different Longest settings.

Since we require Go 1.13 or later now and we're not calling the
Longest() method, this patch removes the .Copy() call.

Now that we have a reusable matchAllRegex value, this patch then
replaces all instances of regexp.MustCompile(`.+`) with matchAllRegex.
This will elminate runtime regex compilations.
2020-05-18 18:45:33 -04:00
Ayan George b7d3d21313
refactor(http): replace string(w.Body.Bytes()) with w.Body.String() (#18143)
Instead of type converting the Body.Bytes() to a string, we can simply
call Body.String().

While we're at it, this patch also uses a simple string comparison
instead of cmp.Equal() for two strings.

According to the docs, they're equivalent.
2020-05-18 17:31:15 -04:00
Ayan George c0fe2c30d6
fix(client/v2): use non-nil context.Context value (#18140)
Prior to this commit, we passed a nil context to the .QueryCtx() and
.createDefaultRequest() methods.

Using any of the context.Context method-set against a nil value will
cause a panic.

This patch passest context.Background() instead of nil.

Closes: 18137
2020-05-18 14:56:30 -04:00
Ayan George 3b9be0145c
fix: address static check warning s1039 (#18135)
This commit quiets staticcheck's warnings about "unnecessary use of
fmt.Sprintf" and "unnecessary use of fmt.Sprint".

Prior to this commit we were wrapping simple constant strings without
any formatting verbs with fmt.Sprintf().
2020-05-18 13:55:05 -04:00
Ayan George c0e391935d
fix(tsdb): address staticcheck warning SA4006 (#18127)
This commit addresses staticcheck warning SA4006 "this value of VAR is
never used" by removing unused variables
2020-05-18 13:11:44 -04:00
Ayan George 1a22af7172
fix(tsdb): address staticcheck warning st1006 (#18126)
* fix(tsdb): address staticcheck ST1006

This patch addresses staticcheck warning "receiver name should not be an
underscore, omit the name if it is unused (ST1006)" for 6 methods.
2020-05-17 22:36:06 -04:00
Ayan George 4cbc6a4269
fix(tsdb): Fix variables masked by a declaration (#18129)
Before this commit, the to and from variables were being re-declared in
a block in such a way that the values were not being used.

This patch uses regular assignment so that the values are visable
outside of the block where they're set.

Closes: 18128
2020-05-17 21:40:12 -04:00
Tristan Su d14acea44d chore: clean up unused functions 2020-05-08 13:45:34 +08:00
Stuart Carnie 0cb09dd09f
Merge pull request #18004 from influxdata/sgc/fix/unique_keys
fix(httpd): Fixes key collisions when serializing /debug/vars
2020-05-07 12:38:56 -07:00
Stuart Carnie 8843a01ebf
fix(httpd): Fixes key collisions when serializing /debug/vars 2020-05-07 11:49:59 -07:00
Ayan George 96bbe2e7af
fix(docs): Update docs to reflect tooling changes (#17798)
Update README.md and CONTRIBUTING.md to reflect our use of go 1.13 (and later) and modules.
2020-04-20 17:49:19 +00:00
Tristan Su af8e66cd25 improvement(query): performance improvement for sorted merge iterator
Sorted merge iterator has cpu-intensive operations to sort the points
from multiple inputs. Typical queries like `SELECT * FROM m GROUP BY *`
do not behave well due to the comparison of points though in many cases
it doesn't necessarily have to use the slow path.

This patch adds a shortcut.  If each input has a single and unique
series we can just return the points input by input.
The detection of the shortcut introduces slight overhead but the gains
are significant in many slow queries.
2020-04-20 21:06:45 +08:00
Ayan George a0f2e0c21a
fix(tsm1): Fix temp directory search bug (#17685)
* fix: verify precision parameter in write requests

This change updates the HTTP endpoints that service v1 and v2 writes to
verify the values passed in the precision parameter.

* fix(tsm1): Fix temp directory search bug

The original code's intention is to scan a directory for the directory
with the higest value when converted to an integer.

So directories may be in the form:

  0.tmp
  1.tmp
  2.tmp
  30.tmp
  ...
  100.tmp

The loop should scan the directory, strip the basename and extension
from the file name to leave just a number, then store the higest number
it finds.

Before this patch, there is a bug that has the code only store the
higest value if there is an error converting the numeric value into an
integer.

This patch primarily fixes that logic.

In addition, this patch will save an indent level by inverting logic in
two places:

Instead if checkig if a file is a directory and has a suffix of ".tmp",
it is probably better to test if a file is NOT a directory OR does NOT
have an extension of ".tmp" then continue.

Also, instead of testig if len(ss) == 2, we can test if len(ss) != 2 and
continue if so.

Both of these save an indent level and keeps our "happy path" to the
left.

Finally, this patch will use string concatination instead of calling
fmt.Sprintf() to add periods to "tmp" and "tsm" extension.

Co-authored-by: David Norton <dgnorton@gmail.com>
2020-04-15 10:29:46 -04:00
Ayan George f51709f09c
refactor(http): Simplify Authorizer (#17704)
Have AuthorizerIsOpen() assert if a given authizer has an
AuthorizeUnrestricted() method and if so, call that to provide the
result of AuthorizerIsOpen().

Otherwise we check if the supplied Authorizer is nil.

This preserves the fast-path for checking tag-level (and other) tsdb
operations.

This simplifies how we handle such authorizers by handling this case in
only one place.
2020-04-15 12:59:52 +00:00
Ben Johnson 5c8b2a9f8e
Merge pull request #17722 from influxdata/1.x-revert-unsafe-roaring-bitmap-marshaling
fix(tsdb): Revert "fix: remove some unsafe marshalling to reduce risk…
2020-04-13 15:25:39 -06:00
Ben Johnson 848ca48225 fix(tsdb): Revert "fix: remove some unsafe marshalling to reduce risk of segfault"
This reverts commit 30dab03310.
2020-04-13 13:22:22 -06:00
David Norton f78b2aa24b
Merge pull request #17638 from influxdata/dn-fix-v2-write-precision
fix: verify precision parameter in write requests
2020-04-07 12:32:57 -04:00
Faith Chikwekwe a02d36d9ae
Merge pull request #17636 from influxdata/fix/sort-key-on-master-1.x
fix(storage/reads): update sortKey sorting method to use null byte as delimiter, not comma
2020-04-07 09:02:11 -07:00
David Norton 129a78ea08 fix: verify precision parameter in write requests
This change updates the HTTP endpoints that service v1 and v2 writes to
verify the values passed in the precision parameter.
2020-04-07 11:29:53 -04:00
Faith Chikwekwe 6e971e5782 fix(storage/reads): update sortKey sorting method to use null byte as delimeter 2020-04-06 17:05:07 -07:00
Jonathan A. Sternberg ac1e55ec37
build(flux): update Flux to v0.65.0 (#17619) 2020-04-06 10:20:24 -05:00
Mustafa d0868f9901
Merge pull request #17532 from influxdata/elbehery-fix#17440
fix(tsdb): Replace panic with error while de/encoding corrupt data
2020-04-02 13:17:27 +02:00
Ben Johnson 3f59d4be8e fix(tsdb): Fix error lists 2020-04-01 14:54:39 -06:00
elbehery 042128b948 fix(tsdb): Replace panic with error while de/encoding corrupt data
fixes #17440

While encoding or decoding corrupt data, the current behaviour is to `panic`.
This commit replaces the `panic` with `error` to be propagated up to the calling `iterator`.
To avoid overwriting other `error`, iterators now wraps a `TSMErrors` which contains ALL the encountered errors.
TSMErrors itself implements `Error()`, the returned string contains all the error msgs, separated by "," delimiter.
2020-04-01 20:51:11 +02:00
Ayan George d3d372fd5d
fix(go.mod): set minimum go version in go.mod file to 1.13 (#17530)
We neglected to update the go version to 1.13 when we converted to
modules.

We plan on using 1.13 features like error wrapping so it is important
that this is correct for 1.8.x.
2020-04-01 14:03:35 -04:00
Ayan George 2f1344ffd7
fix(snapshotter): properly read payload (#17495)
This is a fix and a bit of a refactor of Service.readRequest().

This commit changes the signature so that it accepts an io.Reader
instead of a net.Conn because there's nothing about the function that
relies on it being a Conn; only a Reader.

We also changed the signature so that it returns a *Request instead of
Request -- this way we don't allocate an entire Request value on error.

This commit also attempts to document the few edge cases that the function has to
handle and one quirk where we expect to read a newline which isn't
accounted for by Request.UploadSize.
2020-03-31 12:19:25 -04:00
Hercules Mango Churchill 2e371db2a0 Update changelog 2020-03-16 17:08:16 +00:00
David Norton 137830c0ce
Merge pull request #17274 from influxdata/dn-update-changelog
chore: update CHANGELOG.md
2020-03-16 13:07:54 -04:00
Jonathan A. Sternberg 7cc8eb4986
ci: use go mod vendor instead of dep ensure for constructing vendor (#17278) 2020-03-15 10:56:14 -07:00
David Norton 7ea8fdb566 chore: update CHANGELOG.md 2020-03-13 21:55:04 -04:00
Ayan George cc675adec6
fix: Ensure proper go versions (#17230) 2020-03-13 09:48:36 -04:00