Commit Graph

1624 Commits (616d4d28d3699e6210bbce8782d980c632d8fa1c)

Author SHA1 Message Date
Jonathan A. Sternberg 5c7bcda82c Set X-Influxdb-Version header on every request (even 404 requests)
Fixes #6756.
2016-06-03 10:29:50 -05:00
David Norton 62f3b4486a batch SELECT INTO writes 2016-06-01 12:05:23 -04:00
Edd Robinson 003c30989a Check for no values 2016-05-31 16:28:17 +01:00
Jason Wilder ca13cb9932 Update changelog 2016-05-27 10:43:37 -06:00
Joe LeGasse f2fd988ab9 Delay parsing of date/time strings until needed
The current code would compare every string literal it crossed and tried
to coerce them to time literals if the _looked_ like date/time strings.

The only time the TimeLiteral was used is when comparing to the the
'time' value in a where clause. This change moves the string parsing
code until we attempt to compare 'time' to a string, at which point we
know we need/want a TimeLiteral, and not just an ordinary string.

Fixes #6727
2016-05-27 09:43:45 -04:00
Alex Russell-Saw 7edb14bffd assign engine to shard after engine is initialized 2016-05-27 13:45:16 +01:00
Edd Robinson f4fc905fa9 Reject timestamps too far in future 2016-05-27 11:07:48 +01:00
Edd Robinson 39f3480f28 Ensure points with trailing whitespace are accepted 2016-05-26 19:00:24 +01:00
Jonathan A. Sternberg 907c88d4b5 Truncate the shard group end time if it exceeds MaxNanoTime
Related to #6599.
2016-05-25 21:25:10 -04:00
Jason Wilder 7d50970631 Fix continous compaction edge case
The level planner would keep including the same TSM files to be
recompacted even if they were already quite compacted and split
across several TSM files.

Fixes #6683
2016-05-25 10:36:24 -06:00
Jonathan A. Sternberg cebe256773 Merge pull request #6706 from influxdata/js-remove-deprecated-features
Remove features that were deprecated for 1.0
2016-05-25 11:56:18 -04:00
Jonathan A. Sternberg baaa782c95 Modify the default retention policy name and make it configurable
The default retention policy name is changed to "autogen" instead of
"default" since it ends up being ambiguous when we tell a user to check
the default retention policy, it is uncertain if we are referring to the
default retention policy (which can be changed) or the retention policy
with the name "default".

Now the automatically generated retention policy name is "autogen".

The default retention policy is now also configurable through the
configuration file so an administrator can customize what they think
should be the default.

Fixes #3733.
2016-05-24 09:51:23 -04:00
Jonathan A. Sternberg 6a3f7f5ded Remove support for fixing [[collectd]] and [[opentsdb]] sections 2016-05-24 09:50:15 -04:00
Jonathan A. Sternberg 32e42b93ae Merge pull request #6705 from influxdata/js-6701-duplicate-points-with-select
Filter out sources that do not match the shard database/retention policy
2016-05-24 09:48:31 -04:00
Edd Robinson 853a95e0b3 Reduce allocations on Query's io.Stringer implementation
A query's String method is called multiple times per query. This commit
ensures all calls to query.String share use of a strings.NewReplacer.

This approximately halves the number of allocations for the benchmarked
query.
2016-05-24 14:27:38 +01:00
Jason Wilder 0752ca8d29 Merge pull request #6686 from influxdata/jw-timestamp
Optimize timestamp run-length decoding
2016-05-23 15:24:30 -06:00
Jonathan A. Sternberg 5e7e0bd19b Filter out sources that do not match the shard database/retention policy
If you use a statement like this:

    SELECT value FROM one..cpu, two..cpu

It will access both the `one` and `two` databases as if you had selected
the `cpu` measurement twice for both of them. Updated the `tsdb.Shard`
create iterator function to filter out any sources that do not apply to
that shard so this duplication doesn't happen.

Fixes #6701.
2016-05-23 17:05:33 -04:00
David Norton 9d5c4a0f41 fix #6702: return correct required privileges
Change SelectStatement to return required privileges for all Sources.
2016-05-23 16:44:23 -04:00
Jason Wilder eafe6caf5c Update changelog 2016-05-23 14:05:25 -06:00
Jonathan A. Sternberg 7d64779e1d Merge pull request #6688 from influxdata/js-5906-dynamic-documentation-link
Dynamically update the documentation link in the admin UI
2016-05-21 16:41:11 -04:00
David Norton cc9ef840ae update CHANGELOG.md 2016-05-20 12:40:36 -04:00
Jonathan A. Sternberg 26b0b4a104 Dynamically update the documentation link in the admin UI
Use the latest documentation by default if the server version can't be
found. If it can be found, update the documentation link to that
specific version so it always points at the exact documentation relevant
for the server version.

Fixes #5906.
2016-05-20 09:22:40 -04:00
Edd Robinson afb56c33c1 Merge pull request #6678 from influxdata/er-client-fix
Ensure client sends correct precision
2016-05-20 11:13:03 +01:00
Nathaniel Cook 663373c4e1 changelog 2016-05-19 10:53:29 -06:00
Edd Robinson 1b5c6b75c2 Ensure client sends correct precision 2016-05-19 17:27:32 +01:00
Nathaniel Cook 6ed0d94343 Add Holt-Winters forecasting method. 2016-05-19 09:24:56 -06:00
Jonathan A. Sternberg 5621ccc2ce Remove limit optimization when using an aggregate
The limit optimization was put into the wrong place and caused only part
of the shard to be read when a limit was used. The optimization is
possible, but requires a bit of refactoring to the code here so the call
iterator is created per series before handed to the limit iterator.

Fixes #6661.
2016-05-19 10:29:38 -04:00
Jason Wilder 4c089a56f4 Fix read tombstones: EOF
Due to an bug in TSM tombstone files, it was possible to create
empty tombstone files.  At startup, the TSM file would error out
and not load the TSM file.

Instead, treat it as an empty v1 file so the TSM file can load
correctly.

Fixes #6641
2016-05-18 23:29:25 -06:00
Jonathan A. Sternberg 5d9eae61b0 Add https-private-key option to httpd config
The HTTPS configuration for the httpd service only had an option to
specify the certificate file and the same file would be used for both
the certificate and private key file (they could be concatenated
together).

This adds an additional option to specify the files differently from
each other while still allowing the previous behavior. If only
`https-certificate` is specified, the httpd service will try to load the
private key from the `https-certificate` file. If a separate
`https-private-key` file is specified, the private key will be loaded
from there instead.

Fixes #1310.
2016-05-18 21:05:57 -04:00
Jonathan A. Sternberg 451a5205ef Support bound parameters in the parser
The parser can be passed a map of keys to literal values to be replaced
into the query. Parameters are preceded by a dollar sign (`$`). If a
parameter key is missing, an error is thrown by the parser.

Fixes #2926.
2016-05-18 20:10:15 -04:00
Jason Wilder 7fb7faaaca Fix points already read from being returned more than once
If there were duplicate points in multiple blocks, we would correctly
dedup the points and mark the regions of the blocks we've read.
Unfortunately, we were not excluding the already points as the cursor
moved to points in the later blocks which could cause points to be
return twice incorrectly.

Fixes #6611
2016-05-18 17:21:10 -06:00
Jason Wilder 9f89420b4c Merge pull request #6653 from influxdata/jw-compact-fix
Compaction fixes
2016-05-18 16:10:10 -06:00
Edd Robinson 09dc48b847 Merge pull request #6664 from influxdata/jw-shard-size
Store shard size on disk statistic
2016-05-18 22:39:12 +01:00
Jason Wilder 37e0dc9368 Update changelog 2016-05-18 15:25:56 -06:00
Edd Robinson 81dd13eb1d Don't return empty response bodies when gzip encoding requested (#6633)
* golint clean up

* Verb not possible for endpoint

* Don't specify Content-Encoding header for 204s
2016-05-18 22:24:09 +01:00
Edd Robinson 28ad7c687b Add const for interval 2016-05-18 22:14:59 +01:00
Jonathan A. Sternberg 946968ba23 Fixing panic in SHOW FIELD KEYS caused by 733a17d
The list of field keys in the index may have differed from the field
keys in the actual shard. Fixing `SHOW FIELD KEYS` so it relies only on
the shard rather than the index.

Fixes #6659.
2016-05-18 14:43:50 -04:00
Edd Robinson bac08b7661 Merge pull request #6647 from influxdata/er-fix-map
Fix concurrent map access panic
2016-05-18 18:15:02 +01:00
Edd Robinson f78e67d09c Fix concurrent map access panic 2016-05-18 17:56:50 +01:00
Edd Robinson ce0064cd88 Add stat for currently active write requests 2016-05-17 22:14:19 +01:00
Joe LeGasse af432e7d12 Fix loop variable reuse in database close
Fixes #6650
2016-05-17 11:25:39 -04:00
Jonathan A. Sternberg c01cda58e8 Print the query executor's stack trace on a panic to the log
Fixes #6644.
2016-05-17 09:23:55 -04:00
David Norton 7ed188185d check admin exists instead of user count
When authenticating a request, check that an admin user exists instead
of checking for len(users) > 0. This prevents getting stuck with no
admin user and being unable to create one.
2016-05-17 08:07:37 -04:00
Jonathan A. Sternberg 23f6a706bb Support cast syntax for selecting a specific type
Casting syntax is done with the PostgreSQL syntax `field1::float` to
specify which type should be used when selecting a field. You can also
do `field1::field` or `tag1::tag` to specify that a field or tag should
be selected.

This makes it possible to select a tag when a field key and a tag key
conflict with each other in a measurement. It also means it's possible
to choose a field with a specific type if multiple shards disagree. If
no types are given, the same ordering for how a type is chosen is used
to determine which type to return.

The FieldDimensions method has been updated to return the data type for
the fields that get returned. The SeriesKeys function has also been
removed since it is no longer needed. SeriesKeys was originally used for
the fill iterator, but then expanded to be used by auxiliary iterators
for determining the channel iterator types. The fill iterator doesn't
need it anymore and the auxiliary types are better served by
FieldDimensions implementing that functionality, so SeriesKeys is no
longer needed.

Fixes #6519.
2016-05-16 12:08:29 -04:00
Jonathan A. Sternberg a17f3d960a SHOW TAG VALUES accepts != and !~ in WHERE clause
Fixes #6607.
2016-05-16 08:51:09 -04:00
Jonathan A. Sternberg ecacdb7d21 query-log-enabled not ignored in config anymore
Fixes #6629.
2016-05-15 22:36:18 -04:00
Jason Wilder 11871958c6 Merge pull request #6618 from influxdata/jw-shard-load
Optimize shard index loading
2016-05-13 14:16:17 -06:00
Jason Wilder 9e54adc719 Speed up drop database
Drop database was closing and deleting each shard dir individually and
serially.  It would then delete the empty database dirs.

This changes drop database to close all shards in parallel and run
one os.RemoveAll to remove everything under the db dir which is more
efficient.

This also reworked the locking to avoid locking the tsdb.Store for
long periods of time.  That can cause queries and writes for other
databases to block as well.
2016-05-13 10:26:28 -06:00
Jonathan A. Sternberg 4fab68b53b Teach the http service how to enforce connection limits
The http connection limit is for any HTTP operation and is independent
of the other connection limits. It should be set to a higher value than
the query limit. The difference between this and the query limit is it
will close out the connection immediately without any further
processing.

This is the equivalent of the `max_connections` option in PostgreSQL.

Also removes some unused config options from the cluster config.

Fixes #6559.
2016-05-12 16:25:16 -04:00
Jason Wilder 0dbd4893da Optimize shard index loading
On data sets with many series and potentially large series keys,
the cost of parsing the key and re-indexing can be high.

Loading the TSM keys into the index was being done repeatedly for
series that were already index by an earlier TSM file.  This was
wasted worked and slows down shard loading.

Parsing the key was also innefficient and allocated a new string
slice.  This was simplified to remove that allocation.
2016-05-12 14:02:42 -06:00
Jonathan A. Sternberg f1a5ebe9c9 Merge tag 'v0.13.0' 2016-05-12 11:54:56 -04:00
David Norton c0a772c068 update CHANGELOG.md 2016-05-12 08:20:07 -04:00
Jason Wilder e57fb88a05 Update 0.13.0 release date 2016-05-11 13:37:42 -06:00
Jason Wilder 9e590fc6a2 Update changelog 2016-05-11 13:06:05 -06:00
Jonathan A. Sternberg 89346bb618 Merge pull request #6600 from influxdata/0.13
Merge 0.13 release candidate back to master
2016-05-11 13:04:26 -04:00
Cory LaNou c32906a366 Merge pull request #6593 from influxdata/cjl-copyshard
create shard snapshot
2016-05-10 20:01:59 -05:00
Jonathan A. Sternberg 733a17d9e9 Update SHOW FIELD KEYS to return the field type with the field key
Fixes #3451.
2016-05-10 13:16:57 -04:00
Cory LaNou f415cf89ad wip 2016-05-10 11:01:03 -05:00
Cory LaNou f9ec3c9591 update changelog 2016-05-10 08:14:51 -05:00
Ben Johnson 078e561820
parallelize iterators 2016-05-09 10:25:30 -06:00
Mike Schroll 6ddb7ed62f Updating CHANGELOG with #6261
#6261 Added distinct improvement as a bugfix
is a fix that I'm looking for in 0.13 -- so wanted to add it to the CHANGELOG, in the event others are interested.
2016-05-07 11:37:28 -04:00
Jason Wilder f2bb9db1c5 Update changelog 2016-05-03 10:45:44 -06:00
Ross McDonald 448c0c116e Merge pull request #6534 from influxdata/ross-gh6511
Move to Go 1.6.2
2016-05-03 11:40:44 -05:00
Ross McDonald 96ad9c57d9 Move to Go 1.6.2. 2016-05-03 11:33:49 -05:00
Jason Wilder 4196554f51 Fix overwriting points returning wrong value
The cursors were returning the wrong value in the case when points
existed in both the cache and tsm files with the same timestamp. The
cache value should have been returned, but the tsm value was returned
incorrectly.

Fixes #6439
2016-05-03 09:21:31 -06:00
Ben Johnson 417df18396 Merge pull request #6533 from benbjohnson/optimize-show-series
Optimize SHOW SERIES
2016-05-03 09:15:21 -06:00
Jonathan A. Sternberg a2a5c32770 Merge pull request #6539 from influxdata/js-6495-fix-aggregates-with-empty-shards
Fix aggregate returns when data is missing from some shards
2016-05-03 10:56:21 -04:00
Ben Johnson 49eb3b8d04
optimize show series iterator
This commit changes the `SeriesIterator` to process one measurement
at a time and uses a `floatFastDedupeIterator` to avoid point
encoding during deduplication.
2016-05-03 08:52:44 -06:00
Jonathan A. Sternberg d6d0addcec Fix aggregate returns when data is missing from some shards
If a shard is empty for a specific field and the field type is something
other than a float, a nil iterator would get returned from one of the
empty shards and cause the combined iterators to be cast to the float
type and all other iterator types to be discarded (or for integers, to
be cast).

This is rare since most aggregates don't accept strings or booleans, but
for queries like:

    SELECT distinct(string) FROM mydata

It would result in nothing getting returned if one of the shards didn't
have a value for `string`.

This change modifies the query engine to return nil for the shards
instead of a fake iterator and then to only use the fake iterator if the
final aggregate iterator is nil (meaning that no iterators could be
constructed for the field from any shard).

Fixes #6495.
2016-05-03 10:41:22 -04:00
Jonathan A. Sternberg 64556e4f8e Support offset argument in the GROUP BY time(...) call
An offset of `time(1m, now())` will anchor the offset to the current
time of the query. The default offset is `0s` which is the current
default anyway.

This fixes #2074 by making time zone offset support unnecessary. Time
comparisons can use timezones inside of the time clause and the offset
needed for non-hour timezone differences can be used as part of the
offset argument.
2016-05-02 14:02:35 -04:00
Jason Wilder 8082fc61ba Fix parsing keys when loading database index
The code for parsing a key our of the WAL or TSM files in the engine
was naive and didn't account for measurements with escape chars. This
uses the correct parsing code to parse and load them correctly.

Fixes #6496
2016-04-30 14:47:19 -06:00
Jonathan A. Sternberg 8f876d0f3c Merge pull request #6510 from influxdata/js-5890-return-time-with-selector
Return the time with a selector when there is no group by interval
2016-04-29 17:39:20 -04:00
Jonathan A. Sternberg a05e2b164e Support booleans for min() and max()
Fixes #6494.
2016-04-29 14:56:22 -04:00
Jonathan A. Sternberg 043bd6031e Return the time with a selector when there is no group by interval
The time of the point will be returned with a selector when there is no
group by interval and when there is only one selector. Any other
conditions will return the start time of the interval.

Fixes #5890.
2016-04-29 11:27:26 -04:00
Jonathan A. Sternberg 6f61c0ea4a Add POST /query endpoint and warning messages for using GET with write operations
In order to follow REST a bit more carefully, all write operations
should go through a POST in the future. We still allow read operations
through either GET or POST (similar to the Graphite /render endpoint),
but write operations will trigger a returned warning as part of the JSON
response and will eventually return an error.

Also updates the Golang client libraries to always use POST instead of
GET.

Fixes #6290.
2016-04-29 09:00:23 -04:00
David Norton 4df6483db9 update CHANGELOG.md 2016-04-28 23:00:31 -04:00
lvheyang 751a81f414 fix show statement's rewriting bug 2016-04-29 08:23:50 +08:00
Jason Wilder 2bd5880d7a Remove series from index when shard is closed
When a shard is closed and removed due to retention policy enforcement,
the series contained in the shard would still exists in the index causing
a memory leak.  Restarting the server would cause them not to be loaded.

Fixes #6457
2016-04-28 12:34:46 -06:00
Todd Persen 337d49bea3 Merge pull request #5720 from Vidhuran/bug4987-query-permalinks
added a button to generate URL for queries created in admin UI.
2016-04-28 10:34:06 -07:00
Jonathan A. Sternberg 2ccbe26447 Fix the CLI not to enter an infinite loop when the liner has an error
This also removes the dependency on `os/user` and uses the `HOME`
environment variable which is more common on Linux and Mac OS X for
customizing the history file location.

Removing this import also lets the `influx` binary be cross-compiled as
`os/user` relies on cgo.
2016-04-28 08:35:54 -04:00
Ben Johnson f7af787aef
add DELETE query support
This commit adds query language support for deleting series with a
`DELETE` query.
2016-04-27 15:16:23 -06:00
Jason Wilder e7891cbe4a Update changelog 2016-04-27 13:09:53 -06:00
Edd Robinson 289fe5bfcb Don't catch SIGQUIT; safer close of Quit channel 2016-04-27 14:38:48 +01:00
Vidhuran Harichandra Babu fedb7bfdbf added a button in admin ui to genearate URL for the query 2016-04-27 11:30:47 +03:00
Ben Johnson 291dd08cd4
remove SHOW SERVERS & DROP SERVER
This commit removes support for `SHOW SERVERS` and `DROP SERVER`
from the `influxql` package. It also removes extraneous cluster
testing code from `cmd/influxd/run`.

Fixes #6465
2016-04-26 10:28:42 -06:00
Pierre Fersing 9f9a3fc98e Fix cluster/pool release of connection 2016-04-25 20:06:51 +02:00
Ben Johnson f608e4cdb0 Merge pull request #6462 from oldmantaiter/measurement-fields-deadlock
Add safer locking to CreateFieldIfNotExists
2016-04-25 11:07:33 -06:00
Tait Clarridge df0e16a92f Add safer unlock to CreateFieldIfNotExists
A deadlock can occur if the field was created while we were waiting for the lock.
2016-04-25 12:44:58 -04:00
Kostas Botsas c39ff515ca Merge pull request #6450 from influxdata/changelog-update-0122
Changelog update for 0.12.2
2016-04-25 19:18:36 +03:00
Kostas Botsas f8885a49ee removed duplicates from v0.13
removed duplicate GH PR's from v0.13 which were merged in v0.12
2016-04-25 15:48:05 +03:00
Philip O Toole ed7229fa2d Make it clear when CLI version is unknown
This mimics the behavior of the database binary.
2016-04-22 21:35:42 -07:00
Jonathan A. Sternberg 9b6d5dfd78 Allow derivative() function to be used with ORDER BY desc
The derivative function had an arbitrary limitation that would cause it
to set the value to zero if the previous value was after the next value.
This caused all `ORDER BY desc` queries with `derivative()` to always
return zero values.

Fixes #4675.
2016-04-22 12:20:32 -04:00
Jonathan A. Sternberg e28d16cfcf Log slow queries if they pass a configurable threshold
Fixes #6429.
2016-04-22 12:04:15 -04:00
Jonathan A. Sternberg b6beec4f57 Merge pull request #6411 from influxdata/js-3558-allow-math-in-where-clause
Pass binary expressions to the underlying query
2016-04-22 12:03:27 -04:00
Jonathan A. Sternberg d55fb1b16f Merge pull request #6421 from influxdata/js-3883-sanitize-query
Improve query sanitization to prevent a password leak in the logs
2016-04-22 11:40:17 -04:00
Jonathan A. Sternberg d26e4e3650 Pass binary expressions to the underlying query
Binary math inside of a where condition was previously disallowed. Now,
these types of queries are just passed verbatim down to the underlying
query engine which can handle it.

We may want to revisit this when it comes to tags at some point as it
prevents the more efficient filtering of tags that a simple expression
allows, but it allows a query like this to be done:

    SELECT * FROM cpu WHERE value + 2 < 5

So while it can be better, this is a good initial implementation to
provide this functionality. There are very rare situations where a tag
may be used appropriately in one of these circumstances.

Fixes #3558.
2016-04-22 11:30:36 -04:00
Jonathan A. Sternberg 5070f69bb2 Merge pull request #6444 from influxdata/js-config-from-env-var
Allow setting the config path through an environment variable
2016-04-22 11:28:57 -04:00
Jonathan A. Sternberg 62c66b788c Improve query sanitization to prevent a password leak in the logs
Sanitizing is now done through pattern matching rather than parsing the
query and replacing the password in the query. This prevents
accidentally redacting the wrong part of a query and revealing what the
password is through association.

Fixes #3883.
2016-04-22 11:27:09 -04:00
Jonathan A. Sternberg 9c09023508 Allow setting the config path through an environment variable
The config path previously could only be specified through the command
line options. This made it very difficult to set a default config path
without using any option.

Now the environment variable can be set so the default configuration
path is set to a specific place, but can be overwritten using the
command line option.

The primary purpose of this is so the Docker container can have a
default configuration file, but not have to parse the command line
options to figure out if a different configuration file has been
specified while still allowing the user to only type `influxd` and have
the program start correctly.

This might also help #6392 as it would allow a default configuration
location to be included with the package by setting an environment
variable.

A default search path is also provided now with checking the following
paths for a config file when none is specified:

* `~/.influxdb/influxdb.conf`
* `/etc/influxdb/influxdb.conf`

The config command has also been modified to read this config file
before outputting a sample config.
2016-04-22 09:33:53 -04:00
Kostas Botsas d56ec7ef8a Changelog for 0.12.2
Updated Changelog with details for 0.12.2
2016-04-22 14:21:00 +03:00
Jason Wilder caa9592163 Fix setting uint config options via env vars 2016-04-20 14:38:08 -06:00
Jason Wilder bfa225f149 Merge pull request #6430 from influxdata/jw-cache-load-size
Disable cache max memory size when reloading the cache
2016-04-20 14:35:23 -06:00
Stephen Gutekanst 9dc09c5257 Make logging output location more programmatically configurable (#6213)
This has various benefits:

- Users embedding InfluxDB within other Go programs can specify a different logger / prefix easily.
- More consistent with code used elsewhere in InfluxDB (e.g. services, other `run.Server.*` fields, etc).
- This is also more efficient, because it means `executeQuery` no longer allocates a single `*log.Logger` each time it is called.
2016-04-20 21:07:08 +01:00
Jason Wilder f679787080 Disable cache max memory size when reloading the cache
The cache max memory size is an approximate size and can prevent a
shard from loading at startup.  This change disable the max size
at startup to prevent this problem and sets the limt back after
reloading.

Fixes #6109
2016-04-20 10:41:30 -06:00
thbourlove 0e3964d8c2 fix panic in transform iterator on division
if left point is nil in division expr, the influxd server would panic. Now check left point before use it.
2016-04-21 00:07:20 +08:00
Seif Lotfy c6e3c87e00 Add Block checksum validation and "influx_inspect verify" tool
Fixes #5502
2016-04-19 22:33:03 +02:00
Nathaniel Cook 7def8bc0c9 Merge pull request #6423 from influxdata/nc-elapsed
Add elapsed function
2016-04-19 13:43:30 -06:00
Cameron Sparr 21db76b337 Prevent InfluxDB client from leaking TCP connections
If users properly call client.Close(), then this will make sure that
established tcp connections dont continually grow when creating new http
clients.

This fixes the case where users are creating new http clients on top of
existing _valid_ connections.

This was encountered in Telegraf when we were recreating our http
clients after getting write failures that were unrelated to the actual
connection being severed (such as typos in the retention policy, see
https://github.com/influxdata/telegraf/issues/1058)
2016-04-19 13:18:33 -06:00
Nathaniel Cook 465f5a375f add elapsed function 2016-04-19 12:54:54 -06:00
Jonathan A. Sternberg 132b9e5496 Merge pull request #6414 from influxdata/js-prevent-query-pipelining
Send the "Connection: close" header for queries
2016-04-19 14:54:07 -04:00
Jonathan A. Sternberg 09c46a451a Sort the series keys inside of a tag set so the output is deterministic
The series keys within a tag set were previously not sorted which would
cause the output to be non-deterministic. This sorts the output series
by their keys so it has a consistent output especially when using
limits.

Fixes #3166.
2016-04-18 17:45:31 -04:00
Jonathan A. Sternberg 8bdd44107f Send the "Connection: close" header for queries
CloseNotify() is not compatible with pipelining. Adding this header
prevents the client from attempting to pipeline requests.
2016-04-18 15:38:50 -04:00
Aaron Knister 77db7ad618 Prevent goroutine leak in http service for persistent query connections 2016-04-18 15:11:04 -04:00
Jonathan A. Sternberg 34544d2c4b Fix CREATE RETENTION POLICY parsing so it doesn't consume tokens it shouldn't
The optional sections of the command consumed the semicolon token and
didn't put it back for the outer loop. The code shouldn't explicitly
check for a semicolon or EOF anyway, so these checks were removed and
the token gets unscanned if it doesn't match the optional token that the
parser is looking for.

Fixes #6398.
2016-04-17 02:41:17 -04:00
Jonathan A. Sternberg 86046bb2d0 Implement derivatives across intervals for aggregate queries
For aggregate queries, derivatives will now alter the start time to one
interval behind and will use that interval to find the derivative of the
first point instead of giving no value for that interval. Null values
will still be discarded so if the interval before the one you are
querying is null, then it will be discarded like if it were in the
middle of the query. You can use `fill(0)` to fill in these values.

This does not apply to raw queries yet.

Also modified the derivative and difference aggregates to use the stream
iterator instead of the reduce slice iterator for space efficiency.

Fixes #3247. Contributes to #5943.
2016-04-15 18:16:08 -04:00
Jonathan A. Sternberg f4ce20c92a Merge pull request #6394 from influxdata/js-integer-literal-duration-math
Allow time math with integer timestamps
2016-04-15 18:15:43 -04:00
Jonathan A. Sternberg 0144903686 Merge pull request #6272 from influxdata/js-3369-query-time-range-overflow
Detect when a time literal will overflow or underflow the query engine
2016-04-15 18:15:13 -04:00
Jonathan A. Sternberg a85188bd61 Allow time math with integer timestamps 2016-04-15 17:36:37 -04:00
Jonathan A. Sternberg 425e315f45 Detect when a time literal will overflow or underflow the query engine
Fixes #3369.
2016-04-15 17:35:54 -04:00
Jonathan A. Sternberg 6dbfe81e6b Update the changelog in master from v0.12.1
Removed bugfixes from 0.13.0 that were included in 0.12.1.
2016-04-15 17:34:56 -04:00
Jonathan A. Sternberg 1160b52a3a Merge pull request #6383 from influxdata/js-query-executor-panic-recovery
Recover from a panic during query execution
2016-04-15 17:30:56 -04:00
gunnaraasen d983a8c0d3 Support env overrides for all inputs of the same type 2016-04-15 09:39:22 -07:00
Jonathan A. Sternberg 207a4b9d07 Recover from a panic during query execution 2016-04-15 11:13:54 -04:00
Jonathan A. Sternberg 9c2e430a72 Removing no longer used code in the query engine 2016-04-15 10:22:34 -04:00
Jonathan A. Sternberg 42b68d915f Return a deprecated message when IF NOT EXISTS is used
The deprecated message is now attached to a new attribute returned with
the results. This message can then be read by clients to warn a user
about upcoming changes to the query engine.

The `influx` client has already been modified to read this message and
print it out for every format except CSV.

The first warning message is a deprecated message about removing `IF NOT
EXISTS` from `CREATE DATABASE`.

The message will also be printed to the server log.

Fixes #5707.
2016-04-15 09:17:59 -04:00
Seif Lotfy 64a4808dcb
Merge branch 'fix6294' of https://github.com/seiflotfy/influxdb into seiflotfy-fix6294
Conflicts:
	CHANGELOG.md
2016-04-14 14:08:38 -06:00
Jonathan A. Sternberg 03bbff1a65 Merge pull request #6380 from influxdata/js-6379-validate-percentile-args
Added checking for the first argument in percentile()
2016-04-14 15:57:07 -04:00
Seif Lotfy 7a2dcd3131 Check FieldCodec f before calling FieldCoded.Fields()
If FieldCodec f == nil don't call FieldCoded.Fields().

Fixes #6294
2016-04-14 20:30:30 +02:00
Jonathan A. Sternberg 1b6ffa1d2d Merge pull request #6363 from influxdata/js-6292-percentile-as-selector
Allow percentile to be used as a selector
2016-04-14 12:28:16 -04:00
Jonathan A. Sternberg d36698ebd0 Added checking for the first argument in percentile()
The `percentile()` call previously did not validate that the first
argument was a variable reference and that would let an invalid query
slip by that would panic the query engine.

Added checking for this case and also included test cases for the other
calls that require a variable reference as the first argument.

Fixes #6379.
2016-04-14 12:12:31 -04:00
Jonathan A. Sternberg 9d01f3aa56 Allow the implicit time field to be renamed
Fixes #6296.
2016-04-14 11:04:06 -04:00
Chris Ramón 93aa287d0a updates CHANGELOG 2016-04-13 13:10:40 -05:00
Jonathan A. Sternberg 66a599825b Allow percentile to be used as a selector
Fixes #6292.
2016-04-13 13:29:14 -04:00
Todd Persen 00ed9ebaf3 Remove TSDB listener accept message 2016-04-12 16:09:31 -07:00
Gunnar cfa50bbd3d Merge pull request #6228 from influxdata/ga-multiple-inputs
Support multiple listeners per input
2016-04-12 15:31:38 -07:00
Edd Robinson 592d668e1b Ensure Client is safe for concurrent use
Fixes #6287.
2016-04-12 14:23:32 +01:00
Pierre Fersing d4668af4d7 Updated changelog 2016-04-12 09:39:27 +02:00
Valeriy Simonov 1e6b76e0a6 Changelog update 2016-04-12 09:11:55 +05:00
Ben Johnson 525e22c92b
tsm1 query engine alloc reduction
This commit makes a number of performance improvements to
reduce allocations during query execution. Several objects
and buffers are now reused across the components to avoid
allocations.

Previously a simple `count(value)` query across 1M points
would require 26,000+ allocations. After the changes in
this commit that number has been reduced to 88.
2016-04-11 14:50:59 -06:00
Jonathan A. Sternberg 5bdd61bde7 Support empty tags for all WHERE equality operations
A missing tag on a point was sometimes treated as `""` and sometimes
treated as a separate `null` entity. This change modifies the equality
operations to always treat a missing tag as an empty string.

Empty tags are *not* indexed and do not have the same performance as a
tag that exists.

Fixes #3773.
2016-04-11 12:01:35 -04:00
Jonathan A. Sternberg ca534bf09f Fix the subset method on tags
If a point had no tags at all and was asked for the subset of tags with
at least one key, it would return a new set of tags that was completely
empty. In contrast, if the point had any tags at all, it would return a
set of tags with the tag value being an empty string. This lead to
a point with no tags being treated differently than a point with at
least one tag.

Fixing this so the tag value will always be an empty string for
consistency. A missing tag should always be empty.
2016-04-11 12:00:55 -04:00
gunnaraasen 915fc10591 Update CHANGELOG.md 2016-04-11 08:48:27 -07:00
Cameron Sparr 23e2c40923 Reduce UDP service per-packet allocation size
This will reduce memory pressure and number of GC cycles, my results
sending 100,000 UDP points were:

- udp-payload-size=0: 242 GC cycles
- udp-payload-size=1500: 142 GC cycles
- udp-payload-size=0 (with change): 114 GC cycles
- udp-payload-size=1500 (with change): 112 GC cycles
2016-04-08 13:29:47 -06:00
Jonathan A. Sternberg fa5a38dcd4 Fixing aggregate queries with no GROUP BY to include the end time
Queries with a time constraint but no group by would not include the
final point from the underlying iterator.

Fixes #6229.
2016-04-07 14:11:28 -04:00
Jonathan A. Sternberg e2eb93f6d4 Move changelog lines erroneously added to 0.12.0 to 0.13.0 2016-04-07 13:47:20 -04:00
Cory LaNou 7eaf7f8855 CreateShardGroup was incrementing meta data index even when it was idempotent 2016-04-07 11:39:45 -05:00
Jonathan A. Sternberg 61aa2980ce Merge pull request #6255 from influxdata/js-6248-strings-in-select-panic
Throw an error when an invalid expression is used with aux iterators
2016-04-07 12:32:52 -04:00
Jonathan A. Sternberg d176c8babb Throw an error when an invalid expression is used with aux iterators
The following query was fixed previously:

    SELECT 'value' FROM cpu

This ended up hitting the `buildExprIterator()` code path and was
handled properly. But this query:

    SELECT 'value', value FROM cpu

This took a different code path that would trigger a panic because it
triggered a panic instead of an error condition. This code path has now
been modified to trigger an error instead of a panic.

Fixes #6248.
2016-04-07 11:01:45 -04:00
Edd Robinson 09e08e8f55 Merge pull request #6249 from mvadu/Add_AppVeyor_ci_windows
Add AppVeyor ci config to enable continuous integration tests on Windows
2016-04-07 15:52:43 +01:00
mvadu b670ca1936 Add AppVeyor ci config to enable ci tests on Windows
Influxdb uses gdm for the dependency management. For gdm to work on Windows, it needs go 1.6. Influx still uses go 1.4.3. So go 1.6 will be sed for the pre-build stages, and go 1.4.3 to run the tests.
This arrangements is working in AppVeyor now.
2016-04-07 19:47:01 +05:30
Jonathan A. Sternberg ccac9858f1 Update changelog for issue #6206 2016-04-06 11:53:38 -04:00
mvadu 94524a7699 Fix failure on Windows
Windows does not allow a file to be renamed while its in use. f.Sync does not close the handle. It needs to be explicitly closed before renaming.
2016-04-06 07:32:37 +05:30
Paul Dix 092cf4ee4a Update CHANGELOG.md with release notes for 0.12.0 2016-04-04 17:54:19 -04:00
Todd Persen ffa0ece3ac Update CHANGELOG.md 2016-04-04 11:12:35 -07:00
Edd Robinson 712cc3f290 ShardGroup Duration is checked when recreating rp
Fixes #6178.
2016-04-01 11:59:41 +01:00
Cory LaNou 7bda8102ac update changelog 2016-03-31 17:15:58 -05:00
Jonathan A. Sternberg 8752d1b1e3 Support chunked queries in the Go InfluxDB client
Modify the CLI to always use chunked queries.
2016-03-31 15:30:43 -04:00
Jonathan A. Sternberg c193bde61c Throw an error when time is compared to an invalid literal
A bigger refactor of these functions is needed to support #3290, but
this will work for the more common case that someone uses double quotes
instead of single quotes when surrounding a time literal.

Fixes #3932.
2016-03-31 11:29:20 -06:00
Edd Robinson f68637205c Check ShardGroup Duration when recreating database
Fixes #6153
2016-03-31 18:11:50 +01:00
Edd Robinson 105bcd3bb3 Merge pull request #6174 from influxdata/er-fix-shard-duration
Let SHARD DURATION be specified in isolation
2016-03-31 17:54:42 +01:00
Jason Wilder 328b39ae9b Add v0.11.1 changelog entries
[ci skip]
2016-03-31 10:50:32 -06:00
Edd Robinson 9cd0bc65f5 Let SHARD DURATION be specified in isolation
Fixed #6152.
2016-03-31 17:42:50 +01:00
Jason Wilder 34f1f4a1fb Update changelog 2016-03-31 10:19:46 -06:00
Ross McDonald 630996e2a1 Re-add RPM upgrade logic for 0.9 branch. 2016-03-31 11:07:02 -05:00
Edd Robinson 63b89b9215 Merge pull request #6151 from influxdata/er-iterator-panic
Ensure safe access to Shard engine
2016-03-31 16:36:50 +01:00
Jonathan A. Sternberg d8807ffaff Merge pull request #6167 from influxdata/js-6078-max-group-by-buckets
Limit bucket count in selection
2016-03-31 11:16:24 -04:00
Edd Robinson 8e2d1e48c7 Check if engine closed. Fixes #6140 2016-03-31 15:59:04 +01:00
Jason Wilder 3f34ae69c1 Update changelog 2016-03-31 00:06:12 -06:00
Jonathan A. Sternberg ad7480e64b Limit bucket count in selection
Fixes #6078.
2016-03-30 22:57:09 -04:00
Jonathan A. Sternberg eb467d8d7f Merge pull request #6126 from influxdata/js-6115-chunked-query-support-mid-series
Support chunking in the middle of a series in the emitter
2016-03-30 20:59:24 -04:00
Jonathan A. Sternberg 178a6e2f0a Merge pull request #6113 from influxdata/js-6112-simple-moving-average
Implement simple moving average
2016-03-30 20:57:55 -04:00
joelegasse de94acc79d Merge pull request #6163 from influxdata/jl-content-type
Don't use Request.FormValue() in HTTP handler
2016-03-30 17:34:59 -04:00
Joe LeGasse c149906cbf Use r.URL.Query().Get() rather than r.FormValue()
FormValue() would attempt to parse the body of a request when the
content-type is set to `application/x-www-form-urlencoded`. The write
handler never wants url-encoded forms, and should only ever check the
URL for query parameters.

Fixes #6061
2016-03-30 17:16:10 -04:00
Jonathan A. Sternberg 4702460854 Update the changelog for #6077 2016-03-30 16:53:02 -04:00
Jonathan A. Sternberg 364dce36ab Support chunking in the middle of a series in the emitter
Limit the maximum size of the return value when chunking is not used to
prevent the server from going out of memory.

Fixes #6115.
2016-03-30 14:36:35 -04:00
Joe LeGasse 59b9768655 updated CHANGELOG 2016-03-30 13:34:48 -04:00
Ross McDonald e15f9e8bc7 Updated changelog. 2016-03-29 17:03:34 -05:00
Jason Wilder cc60b6c1d9 Update changelog 2016-03-29 12:59:26 -06:00
Jonathan A. Sternberg 6453dbc249 Implement simple moving average
The simple moving average will gradually emit points instead of waiting
until the end. This should apply to derivative and difference in the
future too.

Fixes #6112.
2016-03-29 14:36:43 -04:00
Jonathan A. Sternberg 819e7a819f Merge pull request #6142 from diamondo25/patch-2
Fix typo in url of issue referenced in CHANGELOG.md
2016-03-29 12:33:58 -04:00
Jonathan A. Sternberg c1643e69c1 Have the server kill all queries on shutdown
Related to #6140, but won't actually fix that problem. It will correctly
stop new queries from being started during shutdown and will send the
interrupt signal to queries during shutdown.

Since the interrupt signal is asynchronous, there isn't currently a way
to wait for the queries to complete themselves before shutting down the
engine.
2016-03-29 11:48:21 -04:00
Jonathan A. Sternberg 9ddc59aab5 Merge pull request #6105 from influxdata/js-1825-difference-function
Implement the difference function
2016-03-29 09:37:59 -04:00
Jonathan A. Sternberg a9720f926e Implement the difference function
The difference function is implemented very similar to how derivative is
implemented. It is an aggregate function that acts over the entire
aggregate. This function will also have the same problems that
derivative has with getting values from the previous interval or point.
This will be fixed separately as part of #5943.

Fixes #1825.
2016-03-29 09:27:12 -04:00
Edd Robinson dcb6e318e9 Creating CQ with identical query does not error
Partially fixes #6094.

Prior to this when passing the same query and CQ name in a CREATE
CONTINUOUS QUERY command an error would be returned. This means the
command was not behaving in a similar way to other commands.a

Now when running the command with the same CQ name and query string no
error will be returned. Note, this change does not parse the query, it
simply compares a normalised query string to the existing one on the CQ.
2016-03-29 11:35:04 +01:00
Erwin Oegema bda8e0267e Fix typo in url of issue referenced in CHANGELOG.md 2016-03-29 11:41:42 +02:00
Ross McDonald eb172ba678 Three improvements to the `build.py` script:
- Improved handling of tar and zip package outputs
- Added support for statically-compiled binary outputs
- Modifyed the nightly version format to be more human-readable
2016-03-24 16:28:39 -05:00
Cory LaNou a8e7e681d2 Update CHANGELOG.md 2016-03-24 13:04:07 -05:00
Tait Clarridge 45b3e61ac7 Add configurable shard duration to retention policies
Allows configuration of shard group duration at database creation, and retention
policy create/alter time.

Query examples:

```
CREATE DATABASE testdb WITH DURATION 90d SHARD DURATION 30m NAME rp_testdb
CREATE RETENTION POLICY rp_testdb2 ON testdb DURATION INF REPLICATION 1 SHARD DURATION 30m
ALTER RETENTION POLICY rp_testdb2 ON testdb SHARD DURATION 1h
```

This can be useful with long duration retention policies with lots of data, where
you can split into smaller shards to relieve memory pressure.
2016-03-24 00:25:49 -04:00
Ben Johnson a6d9930b6f limit series count in selection
This commit adds a configurable limit to the number of series that
can be returned from a `SELECT` statement. The limit is checked
immediately after planning and is determined by the use of iterator
stats.

Fixes #6076
2016-03-23 12:48:48 -06:00
Jason Wilder f233a8bac8 Update v0.11.0 release date 2016-03-23 09:35:52 -06:00
Jonathan A. Sternberg d85b7334cd Merge pull request #6081 from influxdata/js-6075-query-time-limit
Support a timeout for running queries in the query manager
2016-03-23 11:32:08 -04:00
Valeriy Simonov 938453b0dc Changelog update 2016-03-23 10:41:52 +05:00
Jonathan A. Sternberg b89edfd71c Fix the code that handles semicolons
This allows multiple semicolons in a row now and also requires that a
semicolon separate commands. The query specification says this is
required, but a boolean error in `ParseQuery` makes one semicolon
optional and multiple semicolons an error.

Fixes #5728.
2016-03-22 15:32:54 -04:00
Jonathan A. Sternberg 79fe4490c2 Support a timeout for running queries in the query manager
Include an interrupt iterator at the top level to interrupt the fill
iterator if it is producing too many points.

Fixes #6075.
2016-03-22 13:30:40 -04:00
Jonathan A. Sternberg a35d9602cd Fix where filters when a OR is used and when a tag does not exist
If an OR was used, merging filters between different expressions would
not work correctly. If one of the sides had a set of series ids with a
condition and the other side had no series ids associated with the
expression, all of the series from the side with a condition would have
the condition ignored. Instead of defaulting a non-existant series
filter to true, it should just be false and the evaluation of the one
side that does exist should take care of determining if the series id
should be included or not. The AND condition used false correctly so did
not have to be changed.

If a tag did not exist and `!=` or `!~` were used, it would return false
even though the neither a field or a tag equaled those values. This has
now been modified to correctly return the correct series ids and the
correct condition.

Also fixed a panic that would occur when a tag caused a field access to
become unnecessary. The filter using the field access still got created
and used even though it was unnecessary, resulting in an attempted
access to a non-initialized map.

Fixes #5152 and a bunch of other miscellaneous issues.
2016-03-22 12:19:06 -04:00
Jonathan A. Sternberg abae1cfed0 Limit the maximum number of concurrent queries
Fixes #6079.
2016-03-21 22:34:27 -04:00
Ben Johnson 7156c1f9bd add IteratorStats
This commit adds an `IteratorStats` that holds aggregate
iterator processing information. A method is also added to
`Iterator` to return the stats:

	Stats() influxql.IteratorStats

The remote iterators will also emit their stats in the point
stream upon first connection, on a given interval, and then
finally once the last point has been sent.
2016-03-21 16:25:19 -06:00
Jason Wilder ee2f21e76f Merge pull request #6082 from influxdata/jw-tsm
Fix partially written TSM files
2016-03-21 15:42:27 -06:00
Jason Wilder 7567453c9a Ensure TSM files are fsync'd
Make sure TSM files are fsync'd when closed and also that the parent
dir is fsync'd when they are renamed.
2016-03-21 15:03:52 -06:00
Jonathan A. Sternberg 504bac53a9 Update changelog for the query management feature 2016-03-21 12:40:56 -04:00