Commit Graph

828 Commits (903d30d65894cd282eae91c4026e39fe57a7b538)

Author SHA1 Message Date
jlapacik a19604c0ea refactor: windowed read operation should include aggregate name 2020-06-16 18:05:21 -07:00
Christopher M. Wolff 8fa5d3f591
feat(query): add test and feature flag for pushing down sum (#18484) 2020-06-12 13:28:03 -07:00
Johnny Steenbergen b1c7800bbe chore(query): skip flakey test
references: #18463
2020-06-11 11:26:38 -07:00
Yiqun (Ethan) Zhang 82185dd434
feat: add feature flag for fill() (#18445) 2020-06-10 16:00:43 -05:00
Yiqun (Ethan) Zhang 07c01cf79d
chore: update flux to v0.69.2 (#18441) 2020-06-10 15:36:17 -05:00
Jonathan A. Sternberg db686349e7
feat(storage/flux): support full aggregate window push down (#18399)
This enables a new rule that will push down the full `aggregateWindow`
query including the `duplicate` and `window(every: inf)` that recombines
the tables. When the full rule is used, the table is not split into
tables for each window and instead retains itself as a single table. The
start or stop column is renamed to `_time` and `_start` and `_stop` will
be the boundaries of the query.
2020-06-10 13:21:41 -05:00
Faith Chikwekwe 1bf2ce1a32 feat(query): register bare aggregate 2020-06-09 14:24:41 -07:00
Jonathan A. Sternberg 077949cd96
chore(flux): downgrade flux to v0.68.0 (#18413)
* revert: "feat: add feature flag for fill() (#18386)"

This reverts commit 8f9e73af27.

* chore(flux): downgrade flux to v0.68.0
2020-06-09 11:38:55 -05:00
Yiqun (Ethan) Zhang 8f9e73af27
feat: add feature flag for fill() (#18386) 2020-06-08 21:57:19 -05:00
Yiqun (Ethan) Zhang 78526a2210
chore: update flux to v0.69.1 (#18403) 2020-06-08 20:57:56 -05:00
jlapacik eba496d1bd
feat: grouped aggregate rewrite rules (#18342)
* feat: flags for pushing down new aggregates

* refactor: grouped aggregate rewrite rules

The storage operation ReadGroup aggregates per series on the storage
side. The planner will rewrite grouped aggregate queries to call
ReadGroup, which will perform a partial aggregation, followed by
another operation that will perform the rest of the aggregation on
the compute side.

* feat: storage capabilities for grouped aggregates

* fix: changes from review

* feat: group read operation name should include aggregate
2020-06-04 14:36:15 -07:00
Jonathan A. Sternberg efbc4ae7c1
feat(storage/flux): implement create empty for the window table reader (#18288)
This implements create empty for the window table reader and allows this
table read function to be used when it is specified. It will pass down
the create empty flag from the original window call into the storage
read function.

This also fixes the window table reader so it properly creates
individual tables for each window. Previously, it was constructing one
table for an entire series instead of one table per window.

Tests have been added to verify three edge case behaviors. The first is
the normal read operation where all values are present. The second is
when create empty is specified so null values may be created. The third
is with truncated boundaries to ensure that storage is read from and the
start and stop timestamps get correctly truncated.
2020-06-01 17:57:50 -05:00
jlapacik baf400c4d4 chore: update flux to v0.68.0 2020-05-28 14:18:54 -07:00
Yiqun (Ethan) Zhang 41156ca646
feat(query): implement window count aggregate pushdown (#18043) 2020-05-28 13:42:38 -05:00
Christopher M. Wolff 53165bfb7f
feat(query): add a planner rule to push down bare aggregates (#18144) 2020-05-21 23:03:09 -07:00
Jonathan A. Sternberg 0bb847b7e7
Merge branch 'master' into feat/use-algo-w 2020-05-21 10:33:13 -05:00
Christopher M. Wolff 49df5e51eb
feat(query): add conditional option to LoggingProxyQueryService (#18170) 2020-05-20 10:22:21 -07:00
Adrian Thurston b776cf46f5
feat: added PushDownGroupAggregate planner rewrite rule (#18085)
Added a (disabled) planner rule that matches:
   ReadGroupPhys -> { count }

It uses the same physical spec node for group to implement the aggregate. The
rule requires:
 * the pushDownGroupAggregateCount feature flag enabled
 * no existing aggregate present in the ReadGroup
 * use of the "_value" column only
2020-05-20 16:57:16 +03:00
Jonathan A. Sternberg 342c3c2630
fix(query): do not free the column reader in the no content encoders (#18116)
The column reader passed to `flux.Table.Do` is automatically released.
The function passed to the column reader should never release it
manually. This causes a double release which causes the table to be
erroneously freed when it might be referenced by another transformation.

In particular, this affected the following:

    tables
    |> yield()
    |> to()

This is because this would produce a buffered table with two references
and pass it to both `yield()` and `to()` because `yield()` is a
pseudo-node that doesn't really exist. The real graph looks more like:

    tables |> yield()
    tables |> to()

The `yield()` would double release which would release the `to()`
transformation's copy of the column readers. The `to()` method would
then be invoked with an invalid column reader.
2020-05-15 13:55:37 -05:00
Adrian Thurston b43f79b980
fix: need to rebuild the query request before the second e2e test run (#18112)
The e2e test driver in influxdb runs the tests twice to get past the fact that there
is no way to force order between the write to storage and the read back. When
the json.Marshal call became mandatory it was added to the first run, but not
the second.
2020-05-15 18:50:33 +03:00
Jonathan A. Sternberg 09b8e40933
fix(query/stdlib): update to function to use the refactored row functions (#18086)
The row functions were refactored to remove state from the dynamic
function. This updates the code that invoked row functions.
2020-05-13 14:11:14 -05:00
jlapacik 20a583dbcf chore: update flux to latest revision 2020-05-12 11:22:37 -07:00
jlapacik 9a1e31a12f chore: update flux to latest revision 2020-05-07 10:46:29 -07:00
jlapacik 6dd385d3b4 chore: update flux to latest revision 2020-05-06 10:00:00 -07:00
Adrian Thurston e51a2b81e9
feat: added PushDownWindowAggregate planner rewrite rule (#17898)
Added a (disabled and feature-flagged) planner rule that matches:

ReadRange -> window -> { min, max, mean, count, sum }

The rule requires:
 * the pushDownWindowAggregate{Count,Rest} feature flags enabled
 * having WindowAggregateCapability
   (which StorageReader does not currently have)
 * use of "_value" columns only
 * window.period == window.every
 * window.every.months == 0
 * window.every is positive
 * window.offset == 0
 * standard time columns
 * createEmpty is false
2020-05-06 10:27:17 +03:00
jlapacik 02c8e02c58 chore: update flux to latest revision 2020-05-05 09:46:19 -07:00
Yiqun Zhang e341a51ff0 fix: fmt 2020-05-05 01:43:22 -05:00
Yiqun (Ethan) Zhang 8bb5065769 refactor: unify WindowAggregateCapability (#17901) 2020-05-05 01:35:02 -05:00
jlapacik f2478a1d9a chore: update flux to latest revision 2020-04-29 10:11:29 -07:00
jlapacik 6d885c7112 Merge branch 'master' into chore/update-flux 2020-04-29 10:02:19 -07:00
Yiqun (Ethan) Zhang 3c2ab1b681
feat(query): Reader implementation for WindowAggregate (#17885) 2020-04-29 10:42:16 -05:00
jlapacik 457637ed22 Merge branch 'master' into chore/merge-master 2020-04-28 13:13:36 -07:00
jlapacik f5cf024c1a chore: update flux to latest algo-w revision 2020-04-28 13:06:14 -07:00
jlapacik 19ba69b783 fix: planner methods take a context 2020-04-28 12:23:38 -07:00
jlapacik f52391ef3e chore: update flux to v0.67.0 2020-04-28 12:23:38 -07:00
Yiqun (Ethan) Zhang e29eeabcec
feat: complete ReadWindowAggregateRequest (#17871) 2020-04-27 10:51:43 -05:00
jlapacik 3f4368ddd9 chore: update flux to latest algo-w revision 2020-04-24 14:40:37 -07:00
jlapacik 3079d2a8aa Merge branch 'master' into chore/merge-master-into-algo-w 2020-04-24 14:21:26 -07:00
Johnny Steenbergen 46f69bfc8c fix(flux): skip flakey test
references: #17847
2020-04-23 11:47:32 -07:00
jlapacik ff2a2cc66b chore: update flux to latest algo-w revision 2020-04-23 11:32:55 -07:00
Jonathan A. Sternberg d764ca3798
refactor(query): return detailed capabilities for the read window aggregate interfaces (#17836)
This modifies the read window aggregate interfaces to future-proof it
if and when we add additional capabilities to the method. Previously,
the interface was all or nothing. If we modified the RPC call itself, we
would have to make a new interface to denote the change to the Go code.

This changes the interface so now a `WindowAggregateCapability` exists.
This way, we can modify the struct to include things like:

```
type WindowAggregateCapability struct {
    WindowPeriodCapability bool
    MeanAggregateCapability bool
}
```

This way we can learn if the RPC call itself supports some specific
option. If the first iteration doesn't support a mean aggregate or the
mean aggregate is only supported by single server implementations, the
window aggregate can tell the caller that it won't be able to compute
the mean aggregate.

Since it fills in a struct with these capabilities, the struct can
safely introduce new values. If a downstream consumer wants to take
advantage of that functionality, then all interfaces in the chain have
to be updated to consume the upstream capabilities.
2020-04-23 10:22:33 -05:00
jlapacik c6ffeac22b test: skip flux end to end test for writing null values 2020-04-22 14:58:58 -07:00
jlapacik 54ac783475 refactor(query): move ReadWindowAggregateSpec to query package 2020-04-22 14:54:09 -07:00
jlapacik 63fd3655be Merge branch 'master' into chore/merge-master-into-algo-w 2020-04-22 14:52:59 -07:00
Jonathan A. Sternberg 58522d1190
feat(query): implement the ReadWindowAggregateSource (#17839)
The `ReadWindowAggregateSource` will invoke the `ReadWindowAggregate`
method on the `influxdb.Reader` and return the table. It is implemented
using the same common methods that are used for the other sources.
2020-04-22 16:07:45 -05:00
Yiqun (Ethan) Zhang 52dc494edb
feat(query): add ReadWindowAggregatePhysSpec (#17824) 2020-04-22 13:53:59 -05:00
Jonathan A. Sternberg 60c58ad805
feat(query): add interface for the window aggregate capability (#17801)
Added an interface for an additional storage capability. This interface
will allow for checking if the reader supports the window aggregate call
and another method for invoking the call if it does.

This is implemented using a single interface. If the reader implements
the interface, it indicates that the client is capable of reading the
response. The `HasXXX` method is intended to check if the store supports
the operation. This method also takes a context because it could require
a remote call or to wait for one.
2020-04-21 14:15:38 -05:00
jlapacik e076b61d5c fix: planner rewrite rules take a context 2020-04-20 14:09:02 -07:00
Paul Hummer 724e624970 chore: update flux 0.66.1 2020-04-20 12:36:53 -06:00
jlapacik 7541af8414 chore: merge master into algow 2020-04-15 14:42:03 -07:00
Alirie Gray 8975fd2365
refactor(tenant): move bucket and urm auth layers to tenant service (#17474)
Co-authored-by: Lyon Hill <lyondhill@gmail.com>
2020-04-07 11:13:27 -07:00
Jonathan A. Sternberg 687ab7001b
refactor(query): update semantic graph usage for function expression refactor (#17653)
This updates the semantic graph usage to accomodate the change to the
semantic graph that removed the ambiguity of the body so now it is
always a block instead of being a block or an expression.
2020-04-07 12:36:24 -05:00
Jonathan A. Sternberg 1bb08ceaf8
refactor(query/stdlib): modify storage filters to use the predicate directly (#17650)
The storage filters are modified to use the predicates directly so we do
not have to pass `semantic.FunctionExpression` around. Instead, since
simple expressions are all that are supported anyway, we transform
suitable function expressions into predicates as part of the push down
rule and this simplifies the influxdb reader code.

This also moves the storage predicate conversion code into the standard
library package as it is the only location that uses this code now that
the predicate conversion is done as part of the push down rule.

This refactor was prompted by another refactor of the
`semantic.FunctionExpression` that would cause it to always contain a
`semantic.Block`. Since the push down filter needs the expressions and
to combine them, this refactor allows us not do construct a combined
filter inside of blocks which allows us to have better type safety.
2020-04-07 10:45:08 -05:00
Jonathan A. Sternberg 17c244d1a7
chore: fix the promqltests go module file (#17631)
The replace directive in the promqltests pointed to the wrong module
path. This is now fixed.
2020-04-06 17:19:27 -05:00
Jonathan A. Sternberg 84386b884a
chore: fix the promqltests go module file (#17628)
The replace directive in the promqltests pointed to the wrong module
path. This is now fixed.
2020-04-06 16:28:29 -05:00
Jonathan A. Sternberg d3fa60991f
Merge branch 'master' into chore/merge-master 2020-04-06 12:17:47 -05:00
Jonathan A. Sternberg f09ee881fb
Merge pull request #17607 from influxdata/refactor/rewrite-imports
refactor: rewrite imports to include the /v2 suffix for version 2
2020-04-03 15:12:10 -05:00
Yiqun (Ethan) Zhang ace02b1b35
fix: nil timestamp panic in to() (#17591) 2020-04-03 15:03:39 -04:00
Jonathan A. Sternberg 0ae8bebd75
refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
Jonathan A. Sternberg 9895657dc0
ci: run go mod tidy for the promqltests (#17580) 2020-04-03 11:05:49 -05:00
Jonathan A. Sternberg 469c5849c4
Merge branch 'master' into feat/use-algo-w 2020-04-03 09:30:04 -05:00
Gianluca Arbezzano 47959b7436
Merge pull request #17499 from influxdata/feature/move-prometheus-span
chore(tracing): Span with Prometheus Metrics moved to kit/tracing
2020-04-03 10:07:49 +02:00
Lorenzo Affetti 13fc4f335d
test(launcher): e2e test memory limits 2020-04-02 11:20:42 +02:00
Jonathan A. Sternberg eda8d44c74
ci(promqltests): update promqltests go.mod file to be compatible with go 1.13 (#17510)
The prometheus project doesn't adhere to the module suffix so any
attempt to use it as a library fails with go 1.13 or greater. The
workaround is to `go get` a specific commit revision that corresponds to
a tag and let go figure out a pseudo-version for it.

In this case, I updated the revision to the one pointed at by `v2.9.2`
since that is what the current `go.mod` file pointed at. I also updated
the go version to 1.13 inside of `go.mod` to be the same as influxdb.

See https://github.com/prometheus/prometheus/issues/6048 for details.
2020-04-01 10:00:43 -05:00
Gianluca Arbezzano 8e5bd1a2dd chore(tracing): embed the opentracing.Span
Signed-off-by: Gianluca Arbezzano <gianarb92@gmail.com>
2020-03-31 16:01:31 +02:00
Gianluca Arbezzano af06897014 chore(tracing): Span with Prometheus Metrics moved to kit/tracing
I think it is a nice utility function that I would like to use
elsewhere.

So I decided to move it out to the tracing package.

Signed-off-by: Gianluca Arbezzano <gianarb92@gmail.com>
2020-03-31 14:17:50 +02:00
Yiqun (Ethan) Zhang 48efdb52ea
build(flux): update Flux to v0.65.0 (#17484) 2020-03-27 18:42:19 -04:00
Alirie Gray ad7a4a05bb
refactor: change log level back for query controller panics (#17450) 2020-03-26 15:19:07 -07:00
jlapacik 7d885fb2c6 chore: update flux
Closes https://github.com/influxdata/influxdb/issues/17065.
2020-03-26 10:07:17 -07:00
Christopher M. Wolff e57c28d4b7
chore: update to latest algo-w flux (#17422) 2020-03-25 14:53:46 -07:00
Lorenzo Affetti 7f70353b18
feat(query): add unused memory bytes prom metric to controller 2020-03-25 18:03:38 +01:00
Christopher M. Wolff e9689b7269
chore: update to latest flux algo-w (#17408) 2020-03-24 15:45:10 -07:00
Alirie Gray bdd6dc644a
refactor(query): change log level to record panic stack traces (#17406) 2020-03-24 14:13:11 -07:00
Alirie Gray 9c3c0b9592
refactor(query): add stack trace to query controller execution (#17392) 2020-03-23 15:01:43 -07:00
Christopher M. Wolff 20c2439230
refactor(http): change *ast.Package to json.RawMessage in query requests (#17316) 2020-03-23 12:39:24 -07:00
Alirie Gray e51412f6db
refactor(query): add stack trace to executeQuery in controller (#17377) 2020-03-20 16:01:15 -07:00
jlapacik 6c8125b1e8 chore: update flux dependency 2020-03-20 09:24:39 -07:00
Jonathan A. Sternberg 5f30466b5d
feat(query): update buckets and v1.databases calls (#17294)
The `buckets()` and `v1.databases()` functions have been updated to
support their remote counterparts that were added to flux. These
functions now do the same thing as the `from()` call where they will
default to the current organization when run against the server and will
use the remote versions from the repl.
2020-03-17 10:41:53 -05:00
Christopher M. Wolff 790661c196
test(query/stdlib/influxdata/influxdb): update rules_test to use algo-w (#17295)
Algorithm W will return a semantic graph where every function block
always uses a block and a return statement. This is in contrast to the
Go code which would have the semantic graph be an expression or a block.

The push down code would not introspect blocks which meant that any
function expression produced by algorithm w would never be pushed down.
This fixes it so the code will now extract the semantic expression from
inside of a block if there is exactly one statement and the statement is
a return statement.

Co-authored-by: Jonathan A. Sternberg <jonathan@influxdata.com>
2020-03-16 16:46:51 -07:00
jlapacik 07c9a7c921 fix(stdlib): unskip stateChanges end to end test
Closes https://github.com/influxdata/influxdb/issues/17064.
2020-03-12 15:44:56 -07:00
Jonathan A. Sternberg 45c51128ae build(flux): update Flux to v0.64.0 2020-03-12 10:08:45 -07:00
Jonathan A. Sternberg 8d2ba699a0
refactor(http): remove the spec and update lang usage (#17148)
This removes the spec and updates the lang package usage to make use of
passing in the runtime as a parameter.

It removes all direct dependendencies on the flux runtime from the http
package.
2020-03-09 13:30:43 -05:00
Jonathan A. Sternberg 400d710bc0
refactor(storage/reads): remove the storage dependency on libflux (#17109)
This removes the storage dependency on libflux by moving the interfaces
it implements to the `query` package so it can reference the definitions
rather than the package with the implementation and the registration
with the runtime. This breaks the dependency where a storage package
depends on a flux runtime package.
2020-03-06 19:59:16 -06:00
Jonathan A. Sternberg 0d6e4e310b
Merge branch 'master' into feat/use-algo-w 2020-03-06 16:46:49 -06:00
Yiqun (Ethan) Zhang 5333ff4d1b
feat(transpiler): support difference(), group by wildcard, and correc… (#17021)
* feat(transpiler): support difference(), stddev(), spread(), group by wildcard, and correct _time column
2020-03-06 11:19:46 -05:00
Jonathan A. Sternberg bcbb9df72e
refactor(task): tasks will now use the flux language service (#17104)
The tasks subsystem will now use the flux language service to parse and
evaluate flux instead of directly interacting with the parser or
runtime. This helps break the dependency on the libflux parser for the
base influxdb package.

This includes the task notification packages which were changed at the
same time.
2020-03-05 14:36:58 -06:00
Jonathan A. Sternberg a907e05426
refactor(http): modify query handler to use a language service (#17074)
The language service abstracts away the parse source which breaks the
dependency without moving any of the code.
2020-03-05 10:32:17 -06:00
jlapacik 3250fb1453 fix(stdlib): update flux dependency and unskip test 2020-03-05 08:24:51 -08:00
Christopher M. Wolff 027d29dd30
chore: update to Flux version v0.63.0 (#17083) 2020-03-03 13:17:37 -08:00
Jonathan A. Sternberg a84df749cc
feat(stdlib): add influxdb source (#17047)
This updates the repl to support the new influxdb source and use it by
default in the repl. It will automatically set some default variables
for the influxdb source to make it easier to use the cli. In particular,
it will set the default organization, token, and the host. The
organization gets set to the one specified in the repl command and the
token gets filled in with the user installed one. The host defaults to
localhost but will change to whichever one was specified on the cli.

In addition, this will replace the http client with one that sets
insecure skip verify if the `--skip-verify` flag is used.
2020-03-02 20:08:19 -06:00
jlapacik 03cfdba832 fix(stdlib): unskip flux end to end tests
Closes https://github.com/influxdata/influxdb/issues/16812.
2020-03-02 13:47:03 -08:00
Jonathan A. Sternberg 0872af8553
refactor: update semantic builtin lookups to use runtime now (#17066) 2020-03-02 14:51:49 -06:00
Christopher M. Wolff 7547ab8fc2
chore: update to Flux v0.62.0 (#17048) 2020-02-28 10:53:10 -08:00
Jonathan A. Sternberg 25b0e37522
feat: add support for pkg-config (#17036)
This adds support for using pkg-config to build libflux inside of the
flux dependency. The build can occur by either installing `pkg-config`
into your path or the `env` script can be used to invoke it from the go
modules.
2020-02-28 11:08:21 -06:00
Jonathan A. Sternberg ff848bcd55
refactor(repl): remove the querier from the repl (#17031)
The repl no longer takes in a querier and it will run everything
locally. The spec interface will now not be used and will be removed
from the http endpoint at some point.
2020-02-27 15:06:38 -06:00
Jonathan A. Sternberg 935180e9bd
refactor: update flux for the runtime package (#17002) 2020-02-27 11:31:45 -06:00
docmerlin (j. Emrys Landivar) cbbb5db71a fix(tasks): update to newer github.com/influxdb/cron 2020-02-24 09:20:05 -06:00
jlapacik 2c184ead7f chore: update flux dependency and unskip notification tests
Fixes https://github.com/influxdata/influxdb/issues/16809.
2020-02-21 14:58:41 -08:00
jlapacik b01e194613 chore: update flux dependency in promqltests 2020-02-21 14:03:02 -08:00
Jonathan A. Sternberg 7c88946eab
build(flux): update flux for promqltests (#16968) 2020-02-21 14:23:16 -06:00
Christopher M. Wolff 2535d54087
chore: update to Flux v0.60.0 (#16936) 2020-02-19 15:02:21 -08:00
Christopher M. Wolff 16fc8dfecd
build: remove -tags libflux and FLUX_PARSER_TYPE from build and circleci config (#16883)
Also, update to latest algo-w flux
2020-02-19 07:59:05 -08:00
Christopher M. Wolff d6766962d1
test(query): skip tests that are not passing in feat/use-algo-w (#16813) 2020-02-11 15:02:26 -08:00
Christopher Wolff 2e073fd955 chore: update to latest flux@feat/use-algo-w 2020-02-11 10:18:44 -08:00
Christopher Wolff 337595c3d2 chore: update to latest flux@feat/use-algo-w 2020-02-10 09:49:01 -08:00
Nathaniel Cook 9f7d4f9be0
feat(query): adds support for influxql as language type for queries (#16712)
This change allows for the InfluxQL language type to be used with the
/v2/query API endpoint.

This change also introduces a way to give the transpiler an explicit
bucket name instead of using the DBRPMapping service.
Requests to the endpoint will know the bucket name directly but will
likely not have run the migration step to populate the DBRP mappings.
2020-02-07 15:20:50 -07:00
Nathaniel Cook c46045e673
fix(influxql): update all links to transpiler issues to new github urls (#16728)
The platform repo was removed and the issues migrated. For ease in tracking progress the issues have been
updated with their new influxdb repo links.
2020-02-06 15:59:46 -07:00
Christopher Wolff 2bc8d49bcb chore(go.mod): update go.mod to point at latest flux@feat/use-algo-w 2020-01-31 10:44:08 -08:00
Christopher M. Wolff 0f3aabc954
refactor(query): let influxdb build against algo-w branch (#16673) 2020-01-24 14:36:09 -08:00
Jonathan A. Sternberg 0ec9a8b6b8
build(flux): update Flux to v0.59.4 2020-01-21 11:27:06 -06:00
Faith Chikwekwe 2f6c6791b9
build(flux): update Flux to v0.59.3 2020-01-21 11:26:46 -06:00
Lorenzo Affetti 0e0b36be0c feat(task): make task query without returning content 2020-01-17 16:51:01 +01:00
Lorenzo Affetti 1d0ea8ab64 feat(query): add 'Prefer: return-no-content-with-error' behavior 2020-01-15 16:42:29 +01:00
Lorenzo Affetti 48e130a28f
Merge pull request #16356 from influxdata/feat/discard-output
feat(query): add dialect to discard output
2020-01-08 17:28:32 +01:00
Yiqun Zhang 74ba877cb9
feat: opentracing in query execution runtime 2020-01-08 11:16:13 -05:00
Lorenzo Affetti dc4900e252 feat(query): add dialect to discard output 2020-01-08 16:46:52 +01:00
Gavin Cabbage 6fe69549d4 feat(query): add source to query request via user agent header 2020-01-07 09:28:49 -05:00
Jonathan A. Sternberg 6d22f81904
build(flux): update Flux to v0.58.0 2020-01-06 14:09:16 -06:00
Jonathan A. Sternberg 9194d89bbc
feat(query/stdlib): prevent a filter push down if the filter needs to keep empty tables (#16295)
The storage engine isn't capable of sending back empty tables when a
series is empty. Because of this, we disable the push down and let flux
do the filtering in the case where there is a filter and it is specified
to keep the empty tables.
2020-01-06 12:23:31 -06:00
Jacob Marble a2b2d828ee
fix(query): revert promqltests/go.sum (#16307)
Looks like #13370 mistakenly included a bad go.sum change
2019-12-20 11:22:31 -08:00
timhallinflux ef5f1bb0af docs: create CONTRIBUTING.md
Update CONTRIBUTING.md

Added Security Vulnerability Reporting

Updated the text to include the simple changes.  This branch still needs updating to reflect 2.0 API etc.
~

fix(contribution): updated the text for V2.
fixes #13370

Update the 'Getting the source' section'

Remove the 'Cloning a fork' seciton

* If they have forked the repo, it should be clear how to clone the fork.

refactor

last refactor

Use # for section headings

Minor grammar edit.

Update CONTRIBUTING.md

Fix tripple backticks

Backticks weren't being picked up by Github's md renderer properly.

Fixed formatting

Made tabs and spaces consistent (went for tabs, since that's what go uses).  Made cli commands consistent by including $ at the start of the line.  Fixed copy a little bit.

Softened the language

Fixes: https://github.com/influxdata/influxdb/pull/13370#discussion_r359393716
Softened the language a bit.

Update CONTRIBUTING.md

Co-Authored-By: Stuart Carnie <stuart.carnie@gmail.com>

chore: improve CONTRIBUTING.md
2019-12-20 10:36:40 +00:00
George ff38420558
feat(tasks): remove flux stats from run log and replace with trace id (#16263)
* feat(tasks): trace id in task run logs

* refactor(tracing): move trace info utility into kit/tracing package
2019-12-18 16:30:38 +01:00
Jonathan A. Sternberg 791cf15cd3
build(flux): update Flux to v0.57.0 2019-12-10 13:26:10 -06:00
Gavin Cabbage f1975bb268 refactor(logger): use TraceInfo in TraceFields 2019-12-10 09:06:33 -05:00
Gavin Cabbage b7c2c997d2 feat(query): annotate logger with trace id 2019-12-10 09:06:33 -05:00
Johnny Steenbergen ad841608ca chore(http): refactor bucket|dashboard|label|umr|var http clients to use reusable HTTP client
this is a step towards providing a shared http client that manages  pooling connections,
timeouts, and reducing GC for by not creating/GCing a client each req. Bring on the red!
2019-12-09 09:44:41 -08:00
Lorenzo Affetti f765612ec1 feat(query): add trace_id and sampled to the query log 2019-12-05 16:06:15 +01:00
Jacob Marble 5f19c6cace
chore: Remove several instances of WithLogger (#15996)
* chore: Remove several instances of WithLogger

* chore: unexport Logger fields

* chore: unexport some more Logger fields

* chore: go fmt

chore: fix test

chore: s/logger/log

chore: fix test

chore: revert http.Handler.Handler constructor initialization

* refactor: integrate review feedback, fix all test nop loggers

* refactor: capitalize all log messages

* refactor: rename two logger to log
2019-12-04 15:10:23 -08:00
Nathaniel Cook fd63ff17f3
feat(cmd/influx): add command to manually transpile InfluxQL to Flux (#16119) 2019-12-04 13:31:20 -07:00
Christopher M. Wolff ec288a6434
fix(query): update version of Flux in promqltests (#16091) 2019-12-03 11:07:12 -08:00
Jonathan A. Sternberg d7ddcf5abc
feat(query): enable optimized pivot push down rule (#16073)
Use the optimized pivot when the influxdb source is being used.
2019-12-03 09:16:19 -06:00
Christopher M. Wolff 291f7b3e19
build(flux): update Flux to v0.54.0 (#15851) 2019-11-12 08:38:57 -08:00
Christopher M. Wolff 360a3d9d53
build(query): update promqltests to latest Flux version (#15786) 2019-11-06 12:22:42 -08:00
Christopher Wolff 51c92fd0ed test(query): reskip flakey test
https://github.com/influxdata/influxdb/issues/15667
2019-10-30 14:22:59 -07:00
Christopher Wolff 7aa1fccee0 test(query): unskip skipped PromQL transpiler end-to-end .flux tests 2019-10-30 10:40:03 -07:00
Julius Volz e4558257e3 test(query): add PromQL end-to-end tests in go submodule
Signed-off-by: Lorenzo Affetti <lorenzo.affetti@gmail.com>
Signed-off-by: Julius Volz <julius.volz@gmail.com>

move to internal

update flux to v0.50

Revert "move to internal"

This reverts commit bcd4caffbd44135f1dbeac4163cb2a22a751f45a.

promtests/internal --> internal/promtests
2019-10-28 18:59:50 +01:00
Jonathan A. Sternberg 33c3f92329
fix(query/stdlib): fix rewritten pushable expressions when a logical expression is present (#15557)
When `exists` was used in conjunction with any other pushed down
expression, the `exists` was not rewritten properly because the rewrite
did not descend into logical expressions.

This is now fixed so those expressions will be rewritten correctly. This
affected the following form:

    filter(fn: (r) => r._measurement == "cpu" and exists r.host)

It did not affect the following:

    filter(fn: (r) => r._measurement == "cpu")
    |> filter(fn: (r) => exists r.host)
2019-10-23 15:59:20 -07:00
Jonathan A. Sternberg f82e6b2626
chore(query/stdlib): skip flaky tests regarding storage meta queries (#15451) 2019-10-17 09:54:44 -07:00
Jonathan A. Sternberg 74829b025c
refactor(query/stdlib): update flux end to end tests for package subtests (#15392) 2019-10-15 09:18:21 -05:00
Jonathan A. Sternberg 8ac8ecdb31
feat(query/control): include variable memory limits for the controller (#15300)
The controller now supports setting an initial memory limit and setting
a maximum amount of memory that the controller may use separately from
the memory quota per query and the concurrency quota.

This allows the controller to increase the concurrency quota to a larger
number while setting the maximum amount of memory to a lower amount than
would be required for all queries to use 100% of their allowable memory.

Functionally, this means that a query will have a soft limit for an
initial memory byte quota that a query is guaranteed to have, a shared
pool that it is allowed access to in the case it uses more, and a hard
limit that no query may exceed to prevent runaway queries from taking
over the entire pool.

This change is completely backwards compatible with older configurations
as the new options will default to values that mimic the old behavior
where a query is allocated the full amount of its memory quota and the
maximum amount of memory is based on the concurrency quota and this
maximum memory quota.

In addition to the above, this also fixes a bug in the controller that
allowed it to run more than its concurrency as executing queries. This
happened when the results had finished being sent by the executor, but
the query had not yet been read and/or serialized. The executor would be
freed up and would take the next query even though the previous query
hadn't yet been finalized with `Done()`.
2019-10-15 09:18:00 -05:00
Jonathan A. Sternberg eacc1b0d9c
fix(query): update the QueryServiceProxyBridge to check for an error properly (#15353)
The QueryServiceProxyBridge would not check for errors properly because
it would return any error encountered when running the query as a read
error on the `io.Reader`. This made it so that the csv decoder could not
identify if the error was related to the query or if it was related to
reading. The csv decoder needed to tell the difference because an error
with reading from the `io.Reader` needs to be returned as a decoder
error while an error from the query needs to be returned as-is.

Instead of adapting the csv decoder to do that, we instead lazily
initialize the result iterator when `More()` is called and call `Peek()`
on the reader. If no bytes can be read, we assume this was an error
while executing the query and return it as such. If we are able to read
at least one byte, we decode it through the csv decoder.
2019-10-09 11:06:32 -07:00
Lyon Hill 5e1d7f6c69
feat(task): remove preauth (#15286)
* feat(task): remove preauth

* fix(task): remove e2e test that verified preauth
2019-09-26 10:52:24 -06:00
Christopher Wolff 26dbd9225c feat(query/stdlib/experimental): add experimental.to() implementation to OSS 2019-09-20 14:31:58 -07:00
Lorenzo Affetti 9532c9d170 fix(testing): skip unbounded e2e test 2019-09-19 17:51:45 +02:00
Lorenzo Affetti 2a6cfe3c78 fix(query): inject dependencies in context for BucketAccessed 2019-09-19 17:31:13 +02:00
Lorenzo Affetti 3f50cd2af9 Merge branch 'master' into flux-staging-v0.48.x 2019-09-19 17:20:40 +02:00
Jonathan A. Sternberg cbd04f2884
refactor: http error serialization matches the new error schema (#15196)
The http error schema has been changed to simplify the outward facing
API. The `op` and `error` attributes have been dropped because they
confused people. The `error` attribute will likely be readded in some
form in the future, but only as additional context and will not be
required or even suggested for the UI to use.

Errors are now output differently both when they are serialized to JSON
and when they are output as strings. The `op` is no longer used if it is
present. It will only appear as an optional attribute if at all. The
`message` attribute for an error is always output and it will be the
prefix for any nested error. When this is serialized to JSON, the
message is automatically flattened so a nested error such as:

    influxdb.Error{
        Msg: errors.New("something bad happened"),
        Err: io.EOF,
    }

This would be written to the message as:

    something bad happened: EOF

This matches a developers expectations much more easily as most
programmers assume that wrapping an error will act as a prefix for the
inner error.

This is flattened when written out to HTTP in order to make this logic
immaterial to a frontend developer.

The code is still present and plays an important role in categorizing
the error type. On the other hand, the code will not be output as part
of the message as it commonly plays a redundant and confusing role when
humans read it. The human readable message usually gives more context
and a message like with the code acting as a prefix is generally not
desired. But, the code plays a very important role in helping to
identify categories of errors and so it is very important as part of the
return response.
2019-09-19 10:06:47 -05:00
Lorenzo Affetti ab835c8e0e
refactor(dependencies): use new dependency injection framework (#15174)
refactor(dependencies): use new dependency injection framework
2019-09-19 17:01:17 +02:00
Christopher Wolff eb15b346cc chore: update to Flux v0.47.1 2019-09-18 11:51:46 -07:00
Lorenzo Affetti 95ba072f92
Merge pull request #15137 from influxdata/flux-staging-v0.47.x
build(flux): update Flux to v0.47.0
2019-09-13 19:05:42 +02:00
Jonathan A. Sternberg e99456d9d3
refactor(query/control): update a test to use the arrow allocator interface (#15138)
We are planning to change the allocator interface within flux to use the
arrow allocator. To make the release easier, this updates the test in
advance to use the arrow allocator instead of the to be changed memory
allocator interface from flux.
2019-09-13 11:51:15 -05:00
Lorenzo Affetti 7102febafd fix(testing): skip promql e2e tests 2019-09-13 18:49:00 +02:00
Stuart Carnie d56af6eb29
fix(query): Ensure tags are sorted before passing to PointsWriter
Writes directly to a PointsWriter require the tag key, value pairs
are sorted in lexicographically ascending order. This commit uses
new API from the `models` package to ensure this invariant is
maintained.
2019-09-11 16:37:57 -07:00
Jonathan A. Sternberg bea3a18330
fix(query/stdlib): use auth correctly in the v1.databases() call (#14927)
The `v1.databases()` call did not correctly filter buckets based on
auth. Fortunately, it did not cause any improper permissions such as
allowing a person to see buckets that they had no read access to.

The error instead was that if a user did not have read access to one of
the buckets that was returned, the entire command would fail rather than
filter out the bucket that didn't have permissions.

This changes it so that if the user doesn't gets an unauthorized error
when accessing a bucket, it will filter it from the list instead of
failing. It also changes it so the error message is marked as
`ENotFound` instead of as an internal error.
2019-09-05 10:35:23 -05:00
Nathaniel Cook 454003841a build(flux): upgrade to Flux v0.42.0
Skips a test that requires special dependencies to pass.
2019-08-30 13:02:30 -06:00
Jonathan A. Sternberg ae780ff468
tests(cmd/influxd/launcher): add a launcher test for the secret service (#14813)
The secret service is tested by creating a secret and then attempting to
use it in a flux query. There is one test where accessing the secret
should work and one where it should return that the action is forbidden.
2019-08-27 10:44:46 -05:00
Adam fcfdd2b1ef build(flux): update to latest flux master 2019-08-26 16:46:17 -06:00
Adam f97929614c test(query): roll back some changes to end_to_end_test.go 2019-08-26 16:46:17 -06:00
Adam 945b68b8fd fix(query): finish refactoring the repl and inject the secret service as a dependency 2019-08-26 16:46:17 -06:00
Adam 808ebb9590 fix(query): update usage of interpreter dependencies 2019-08-26 16:46:17 -06:00
Nathaniel Cook 6303e2dcc5 test(query): skip holt_winters_panic test
added executor dependencies where needed
2019-08-26 16:46:17 -06:00
Nathaniel Cook 4b339dd0cf fix(query/to): make orgID default to the context org
This change makes it so that if an org or orgID are missing on calls to the `to` function
that the orgID is retrieved from the request context.

This is consistent with how `from` works.
2019-08-23 11:03:26 -06:00
Nathaniel Cook 6b54abb51e test(query): skip holt_winters_panic test 2019-08-22 13:11:13 -06:00
docmerlin (j. Emrys Landivar) 19fe098888 chore(ci): update go-tools 2019-08-22 10:55:05 -05:00
Jonathan A. Sternberg 11aae144b2
feat(query): wrap the secret service for flux (#14732)
The secret service is wrapped to be compatible with the flux interface
to the secret service.

The organization id is not part of the flux interface so this code
extracts the organization id from the query context so that it can lookup
a secret within the organization.
2019-08-22 10:47:02 -05:00
Nathaniel Cook 7498c06d3f test(query): skip check and http_endpoint Flux tests 2019-08-21 09:59:01 -06:00
Nathaniel Cook 6a0fa44093 fix(query): update code for changes to scoped compiler 2019-08-21 09:59:01 -06:00
Nathaniel Cook 1b8ab3c2f2 fix(query): remove http.to and update test cases that used it 2019-08-21 09:59:01 -06:00
Christopher M. Wolff c61646d0f4 feat(query/stdlib): add an experimental "to" function (#14664) 2019-08-21 09:59:01 -06:00
Nathaniel Cook cd2bfb9b22 refactor(query/stdlib): update tests for new Flux test name conventions (#14669) 2019-08-21 09:59:01 -06:00
Jonathan A. Sternberg b35552721c
fix(query/control): handle flux errors from the table iterator in the controller (#14715) 2019-08-20 12:20:40 -05:00
Stuart Carnie 9d94b7500d
fix(flux): Fix hanging test by ensuring results are read
Closes #14574
2019-08-12 16:47:03 -07:00
Lorenzo Affetti ef238ae064 skipping failing e2e tests 2019-08-06 12:48:32 +02:00
j. Emrys Landivar (docmerlin) b303d54584 perf(query): hoist bucket lookups so we do not look up per table
perf(query): hoist bucket lookups so we do not look up per table
2019-08-05 16:02:33 -05:00
j. Emrys Landivar (docmerlin) 24c1f21e4e WIP 2019-08-05 13:16:51 -05:00
Christopher M. Wolff 42bb664aaf
feat(query): add storage request duration metric (#14534)
influxdata/idpe#4126
2019-08-02 08:53:14 -07:00
Jonathan A. Sternberg e4c89cbe0c
feat(query/stdlib): push down exists operator to storage (#14538)
The `exists` operator now gets pushed down to storage correctly. If
`exists` is used on a tag, then it will be rewritten to `tag != ""`
which is how storage defines if a tag exists. If `not exists` is used,
then it will use `tag == ""` which is how you would query storage for
only if a tag doesn't exist.

The `tag == ""` and `tag != ""` are different. For `tag == ""`, the
predicate is impossible for the storage layer to return true with.
Ideally, we would just rewrite this to return nothing and we wouldn't
bother with even querying storage. Instead, we just do not rewrite this
predicate because it cannot be rewritten to make sense with storage. If
we see `tag != ""`, it is the only one that can be passed through as-is
because `tag != ""` returns the same values as `exists tag`. It will
return true for every non-null value.
2019-08-02 09:31:10 -05:00
Christopher M. Wolff e142f6ca7c
fix(query): add LookupName method to dependency interfaces (needed by flux to()) (#14498) 2019-08-01 10:10:43 -07:00
George b2fe0d1d63
fix(tasks): surface flux errors on pre-auth check (#14492) 2019-07-31 11:46:28 +02:00
Christopher Wolff 3855ad9f33 chore: update Flux to v0.37.2 2019-07-24 12:57:37 -07:00
Christopher Wolff 63c0f40548 fix(query): use auth-wrapped org and bucket services for query 2019-07-19 20:02:53 -06:00
Jonathan A. Sternberg 47b032464f
refactor(query): handle flux errors in the query controller instead of http (#14368)
If we handle the flux errors in the query controller, it makes it so we
are handling the errors in the location where the happen rather than at
a layer further up the stack.

This should simplify it so the errors are handled in this single
location instead.
2019-07-18 11:43:15 -05:00
Jonathan A. Sternberg ee7ff84d8b
feat(query/stdlib): update influxdb sources to use flux error codes (#14346)
Update the influxdb sources to be annotated with flux error codes. This
will enable us to identify different response codes for these
operations.
2019-07-16 09:15:46 -05:00
Nathaniel Cook e59c72b245 fix(tests): update e2e tests for new flux executetest methods 2019-07-12 11:15:58 -06:00
Nathaniel Cook 92a4ee53cf fix(query): skip tests 2019-07-12 11:15:58 -06:00
Jonathan A. Sternberg a0f585bd56
fix(query/stdlib): remove skip from the flux e2e tests (#14253)
The underlying bug that caused them to be flaky has been fixed.
2019-07-03 12:03:22 -05:00
Nathaniel Cook 11a4b911b0 fix(query/influxql): use explicit mergeKey parameter 2019-07-03 09:48:31 -06:00
Jonathan A. Sternberg 3d9b9fe36f
chore(query): disable flaky end to end tests for flux (#14231) 2019-06-28 10:15:47 -05:00
Adam d85ef69e19 Merge remote-tracking branch 'origin/master' into flux-staging 2019-06-19 13:38:49 -04:00
Adam 1d84bf6516 fix(stdlib/testing): skip flaky test regexp_replaceAllString 2019-06-18 16:25:59 -04:00
roshie548 15f66d1b98 moved field declaration line 2019-06-18 08:51:34 -07:00
roshie548 f45d616eaa added test case 2019-06-18 08:51:34 -07:00
roshie548 13b397bb3c fix(stdlib): Fixed to() creating too many rows for multiple fields
If a table has multiple field values, to() no longer writes rows multiple times.
2019-06-18 08:51:34 -07:00
Christopher Wolff e495ca3e27 fix(query): recover from panics during compiler and start steps
Fixes influxdata/idpe#3409.
2019-06-11 08:41:13 -07:00
Jonathan A. Sternberg 65dabb0774
Merge branch 'master' into flux-staging 2019-06-06 11:22:04 -05:00
Lorenzo Affetti 5f8796aca6
Merge pull request #14044 from influxdata/fix/gen-promql
fix(promql): synch generated code
2019-06-05 17:53:51 +02:00
Jonathan A. Sternberg 42c8ce3481
fix(query/stdlib): remove skips for tests that were flaky from table.Do (#14048) 2019-06-03 11:56:25 -05:00
Lorenzo Affetti 6e4c66e21f fix(promql): synch generated code 2019-06-03 17:47:59 +02:00
Jonathan A. Sternberg c6bb1ef4e2
fix(query/control): queue size test was flaky (#14030)
In the QueueSize test, it was possible that after the `done` channel was
closed, one of the queries from the queue would begin executing. If all
three began executing before the shutdown was done, the third would
block on attempting to send a value to the `executing` channel and it
would never finish so the controller would report that shutdown failed.

This increases the queue size to a combination of the concurrency quota
and the queue size so all of the started queries will never block when
sending a signal to the executing channel.
2019-05-31 08:59:45 -05:00
Christopher Wolff 6d3cf4b71e test(query): update typo in Flux in test
This test started failing as a result of influxdata/flux/#1312.
2019-05-30 16:29:31 -07:00