Commit Graph

12342 Commits (091ea5f9a5ed0109620068fde7204bca38218406)

Author SHA1 Message Date
Jonathan A. Sternberg 091ea5f9a5 Merge pull request #8776 from influxdata/js-explain-plan
Initial implementation of explain plan
2017-09-01 16:19:37 -05:00
Edd Robinson 51e886ba66 Merge pull request #8757 from oiooj/pr-cl
Fix panic when the engine already closed in a shard
2017-09-01 16:59:12 +01:00
Jonathan A. Sternberg 50d404e690 Initial implementation of explain plan
It prints the statistics of each iterator that will access the storage
engine. For each access of the storage engine, it will print the number
of shards that will potentially be accessed, the number of files that
may be accessed, the number of series that will be created, the number
of blocks, and the size of those blocks.
2017-09-01 09:01:10 -05:00
Jonathan A. Sternberg 006c8193a9 Merge pull request #8595 from emluque/6563-CancelQuery
#6563 Support Ctrl+C to cancel a running query in the Influx CLI
2017-09-01 08:14:48 -05:00
emluque fa681edcb9 6563 Support Ctrl+C to cancel a running query in the Influx CLI
Solved the issue by using context on the http request on the client.
2017-09-01 08:02:27 -05:00
Jonathan A. Sternberg 0ef033f5dd Merge pull request #8770 from influxdata/js-reduce-walk-refs-memory-usage
Reduce how long it takes to walk the varrefs in an expression
2017-08-31 10:15:03 -05:00
Jonathan A. Sternberg 466fc9026e Reduce how long it takes to walk the varrefs in an expression
This is used quite a bit to determine which fields are needed in a
condition. When the condition gets large, the memory usage begins to
slow it down considerably and it doesn't take care of duplicates.
2017-08-31 09:33:45 -05:00
Joe LeGasse 732a0c2eaa Merge pull request #8769 from influxdata/jl-map-cleanup
cleanup: remove poor usage of ',ok' with maps
2017-08-31 09:18:42 -04:00
Ben Johnson 57d42ac4af Merge pull request #8752 from benbjohnson/1479-meta-queries
Use system cursors for measurement, series, and tag key meta queries.
2017-08-30 08:35:35 -06:00
Ben Johnson 1dbe0662d8
Use system cursors for measurement, series, and tag key meta queries. 2017-08-30 08:35:20 -06:00
David Norton 0da711675f Merge pull request #8764 from influxdata/dn-8638-influx_inspect
fix #8638: inspect shouldn't err on missing file
2017-08-30 10:21:22 -04:00
David Norton 2aa446bf24 fix #8638: inspect shouldn't err on missing file
influx_inspect walks the data and wal directories building a list of
files to export. It then opens, reads, and exports each. If the file was
deleted between the time it was added to the list and the time the
inspect tool attempts to read it, the file is now skipped without
emitting an error.
2017-08-30 09:59:03 -04:00
Joe LeGasse a95647b720 cleanup: remove poor usage of ',ok' with maps
There are several places in the code where comma-ok map retrieval was
being used poorly. Some were benign, like checking existence before
issuing an unconditional delete with no cleanup. Others were potentially
far more serious: assuming that if 'ok' was true, then the resulting
pointer retrieved from the map would be non-nil. `nil` is a perfectly
valid value to store in a map of pointers, and the comma-ok syntax is
meant for when membership is distinct from having a non-zero value.
There was only one or two cases that I saw that being used correctly for
maps of pointers.
2017-08-30 09:49:31 -04:00
Stuart Carnie dd01132937 Merge pull request #8766 from influxdata/sgc-inmem-deadlock
Fix deadlock when calling `SeriesIDsAllOrByExpr`
2017-08-29 16:38:43 -07:00
Stuart Carnie 9f7f225c10 update CHANGELOG 2017-08-29 16:16:10 -07:00
Stuart Carnie 51eb85193c release lock to avoid dead lock when calling WalkWhereForSeriesIDs
* WalkWhereForSeriesIDs may call SeriesIDs, which may attempt to
  upgrade from a `RLock` to a `Lock`, causing the dead lock
2017-08-29 16:12:51 -07:00
Stuart Carnie 1b69928054 Merge pull request #8755 from influxdata/sgc-inmem-race
fix race condition reading seriesByID map
2017-08-29 07:41:46 -07:00
kun 5d5225e77d Fix panic when engine closed in a shard 2017-08-29 17:22:45 +08:00
Stuart Carnie 4129c2a606 Merge branch 'master' into sgc-inmem-race 2017-08-28 15:49:10 -07:00
Jonathan A. Sternberg 10ad7ae6a0 Merge pull request #8754 from influxdata/js-8699-force-subqueries-to-match-ordering
Force subqueries to match the parent queries ordering
2017-08-28 16:12:58 -05:00
Jonathan A. Sternberg 1c7bafcd3e Force subqueries to match the parent queries ordering
Previously, subqueries would honor their own ordering. We never really
supported that and I have no idea if it would work since most parts in
the query engine assume that points are being delivered in only one
ordering.

Subqueries have now been modified so if a person tries to do different
ordering, they get an error when running the query. If they specify an
ordering in the top most query, that ordering gets propagated to all
subqueries.

Fixes #8699.
2017-08-28 15:57:40 -05:00
Stuart Carnie 7a1a3ebe04 update CHANGELOG 2017-08-28 13:39:18 -07:00
Stuart Carnie 0ced270197 fix race condition reading map 2017-08-28 13:36:49 -07:00
Jonathan A. Sternberg dad6d95bf8 Merge pull request #8753 from influxdata/js-explain-walk
Walk through the explain statement
2017-08-28 14:24:57 -05:00
Jonathan A. Sternberg 47fd076b1d Walk through the explain statement 2017-08-28 12:45:39 -05:00
Jonathan A. Sternberg 37f4a7b19b Merge pull request #8751 from influxdata/js-explain-ast
Update parser and AST for explain statement
2017-08-28 12:02:30 -05:00
Jonathan A. Sternberg 5593eecda6 Update parser and AST for explain statement 2017-08-28 11:36:06 -05:00
Jonathan A. Sternberg 5dbcd1b06f Merge pull request #8745 from influxdata/js-refactor-validation
Refactor validation code and move it to the compiler
2017-08-28 11:35:24 -05:00
Jonathan A. Sternberg 285bdf3542 Merge pull request #8750 from influxdata/js-close-shard-group-after-creating-iterators
Close the query shard group after the iterators are created
2017-08-28 11:35:07 -05:00
Jonathan A. Sternberg d2fcb893e1 Close the query shard group after the iterators are created
Now, the prepared statement keeps the open resource and closing the open
resource created from `Prepare` is the responsibility of the prepared
statement.

This also nils out the local shard mapping after it is closed to prevent
it from being used after it is closed.
2017-08-28 09:46:11 -05:00
Jonathan A. Sternberg 5cdd1b1489 Fix the panic message for the new interval iterator 2017-08-26 17:36:32 -05:00
Jonathan A. Sternberg ef0ad3292d Remove unused functions in influxql/ast.go 2017-08-26 17:36:32 -05:00
Jonathan A. Sternberg 905e7fe05e Refactor validation code and move it to the compiler
This refactors the validation code so it is more flexible and performs a
small bit of work to make preparing and executing the query easier.

The general idea is that compilation will eventually do more heavy
lifting in creating the initial plan and prepare will construct an
actual plan rather than just doing some basic field rewriting.

This change at least sets us up for that change in the future and moves
the validation code to the query execution instead of in the parser.

This also frees up the parser to parse the complete AST without worrying
if the query itself is valid. That could be useful for client code that
wants to compile a partial query to an AST and then perform
modifications on the AST for some reason.
2017-08-26 17:36:32 -05:00
Jonathan A. Sternberg b61b030b8c Merge pull request #8744 from influxdata/js-refactor-select
Refactor the select call into three separate phases
2017-08-26 17:33:48 -05:00
Jonathan A. Sternberg 8738e72cf1 Refactor the select call into three separate phases
The first call is to compile the query. This performs some initial
processing that can be done before having any access to the shards. At
the moment, it does very little, but it's intended to be changed to
eventually perform initial validations of the query and create an
internal graph structure for the execution of the query.

The second call is to prepare the query. This step has access to the
shard mapper. Right now, it just maps the shards and rewrites the fields
of the query for any wildcards. In the future, it is intended to do the
above, but also to prepare the final directed acyclical graph that will
execute the query.

The third call is to select the query. This step is intended to create
all of the iterators for processing the query. At the moment, much of
the work intended for the second step is performed in the third step.
2017-08-25 07:50:13 -05:00
Jonathan A. Sternberg f7724b780a Add benchmark tests back 2017-08-25 07:50:02 -05:00
Jonathan A. Sternberg d46e8ffdae Merge pull request #8740 from influxdata/js-map-shards-interface
Pass the select options to the shard mapper again
2017-08-24 12:26:15 -05:00
Jonathan A. Sternberg 421a91d480 Pass the select options to the shard mapper again 2017-08-24 09:55:02 -05:00
Ben Johnson bd2963dc05 Merge pull request #8735 from influxdata/er-8695-iterators
Ensure that sorted heaps are merged correctly
2017-08-24 08:45:16 -06:00
Jonathan A. Sternberg 0eabef6c5d Merge pull request #8737 from influxdata/js-influxql-protobuf
Add back the protobuf marshaling inside of influxql
2017-08-24 09:40:48 -05:00
Edd Robinson 49d9077a61 Merge pull request #8734 from influxdata/er-8668-toml
Bump toml parser to relicensed MIT version
2017-08-24 11:03:14 +01:00
Jonathan A. Sternberg 9cba52b675 Add back the protobuf marshaling inside of influxql 2017-08-23 15:37:46 -05:00
Edd Robinson 8c4686fb1b Ensure that sorted heaps are merged correctly
When merging streams of system iterators we don't use tags or time.
Instead we add series keys (in the case of, for example, `SHOW SERIES`)
to the `Aux` field of the iterators' elements. This is because we only
emit merged and sorted sets of series key to the client.

We currently use `SortedMergeHeap`s to merge together multiple
iterators, and the comparitor function did not consider `Aux` fields
when determining which heap to pop the next item off during a merge. As
such, `SHOW SERIES` and `SHOW TAG KEYS` (any meta query that gets
converted into a special type of `SELECT`) were returning results in
arbitrary order.

This issue was never noticed on the `inmem` index because the streams
are always duplicates of each other, and of course it doesn't matter if
you arbitrarily merge together two idential, sorted streams...

The issue first manifested itself on the `tsi1` index, but this fix will
apply to both indexes.
2017-08-23 17:21:24 +01:00
Edd Robinson 6e3b8d4684 Merge branch 'master' into er-8668-toml 2017-08-23 17:16:31 +01:00
Jonathan A. Sternberg ae66d327a7 Merge pull request #8736 from influxdata/js-refactor-select
Move query engine code from the statement executor to the query engine
2017-08-23 10:50:40 -05:00
Jonathan A. Sternberg 96689e661e Move query engine code from the statement executor to the query engine
The statement rewriting logic should be in the query engine as part of
preparing a query. This creates a shard mapper interface that the query
engine expects and then passes it to the query engine instead of
requiring the query to be preprocessed before being input into the query
engine. This interface is (mostly) the same as the old interface, just
moved to a different package.
2017-08-23 10:07:30 -05:00
Jonathan A. Sternberg e91d38b117 Merge pull request #8730 from influxdata/js-refactor-select-tests
Refactor the select tests to use subtests and fewer functions
2017-08-23 10:02:36 -05:00
Edd Robinson e24ff1d13c Merge pull request #8619 from influxdata/er-8611-request-id
Support pre-existing request ID headers
2017-08-23 14:46:05 +01:00
Jonathan A. Sternberg 966e845c03 Refactor the select tests to use subtests and fewer functions
This will allow refactoring the query engine and the select statement
more easily since fewer code locations will need to be changed. It also
reduces the amount of code while still keeping individual tests that are
filterable.
2017-08-23 08:21:49 -05:00
Edd Robinson 64933fea17 Support pre-existing request ID headers
Other applications or services sometimes expose a header containing a
unique ID, which can then be included in logging or response information
to allow an operator to link inter-service requests. The most common
header name used by services in the wild appears to be `X-Request-ID`,
but `Request-Id` is also used.

This commit adds support for specifying either `X-Request-ID` or
`Request-Id` headers, which will then be used by InfluxDB when logging
request information, and also in the `X-Request-ID` and `Request-Id`
response headers.

We populate both `X-Request-ID` and `Request-Id` to maintain backwards
compatibility with previous version, and to support the more common
`X-Request-ID` header name.

If both `X-Request-ID` and `Request-Id` are specified, then
`X-Request-ID` is used.

If neither header is specified, then in line with previous behaviour, we
generate a v1 UUID.
2017-08-23 13:42:33 +01:00