Commit Graph

1883 Commits (643b2eb30cd4726e58a9052ee6f15ec9bea759cf)

Author SHA1 Message Date
Jason Wilder 33be1e1952 Update changelog 2017-01-12 09:02:59 -07:00
Vladimir Lopes f05df2a263 Fix panic when pruning shard groups
* Fix #7812 - Panic when pruning shard groups

* Update CHANGELOG.md
2017-01-11 14:56:40 +00:00
Jonathan A. Sternberg 73b76d1227 Verbose output for SSL connection errors
When an error that appears to be an SSL error happens without SSL
enabled, the client will attempt to reconnect with SSL just to see if
that works. If it works, it exits with an error message telling the user
to add `-ssl`. It will also do the same if the SSL connection is unsafe
although it will warn that this is insecure.
2017-01-10 11:53:17 -06:00
Jonathan A. Sternberg d7c8c7ca4f Support subquery execution in the query language
This adds query syntax support for subqueries and adds support to the
query engine to execute queries on subqueries.

Subqueries act as a source for another query. It is the equivalent of
writing the results of a query to a temporary database, executing
a query on that temporary database, and then deleting the database
(except this is all performed in-memory).

The syntax is like this:

    SELECT sum(derivative) FROM (SELECT derivative(mean(value)) FROM cpu GROUP BY *)

This will execute derivative and then sum the result of those derivatives.
Another example:

    SELECT max(min) FROM (SELECT min(value) FROM cpu GROUP BY host)

This would let you find the maximum minimum value of each host.

There is complete freedom to mix subqueries with auxiliary fields. The only
caveat is that the following two queries:

    SELECT mean(value) FROM cpu
    SELECT mean(value) FROM (SELECT value FROM cpu)

Have different performance characteristics. The first will calculate
`mean(value)` at the shard level and will be faster, especially when it comes to
clustered setups. The second will process the mean at the top level and will not
include that optimization.
2017-01-07 13:00:48 -06:00
Mark Rushakoff 153277c01d Merge pull request #7786 from influxdata/mr-cache-decrease-size
Use one atomic operation in (*Cache).decreaseSize
2017-01-06 10:17:01 -08:00
Jason Wilder 15915446ff Merge pull request #7323 from miry/env-array-config
Allow add items to array config via ENV
2017-01-04 14:20:03 -07:00
Mark Rushakoff 89a587e865 Use one atomic operation in (*Cache).decreaseSize
The previous implementation was susceptible to a race condition (of
correctness) since c.decreaseSize is called without a lock in
(*Cache).WriteMulti.

There were already tests which asserted the correctness of the result of
decreaseSize, so no tests were added or modified.
2017-01-04 13:13:31 -08:00
Cory LaNou 3c518f8927
panicing is bad -> error returns are good 2017-01-03 14:28:29 -06:00
Mark Rushakoff 959c445a88 Fix broken return statements swallowing errors
There was no comment on either case specifying that the `return nil`
was deliberate instead of `return err`, so I'm assuming these were
typos. I added tests to conserve the error-returning behavior.
2017-01-03 08:50:34 -08:00
Michael Nikitochkin 5ebd4244b1 Merge branch 'master' into env-array-config 2017-01-02 16:35:55 +01:00
Jonathan A. Sternberg 0a04499992 Merge pull request #7688 from harryrose/master
Add bound parameters map to Query object
2016-12-23 17:08:14 -06:00
Michael Nikitochkin 65b08e56f7 [#7323]: Allow add items to array config via ENV
Allow to create a new templates or tags configs, if there are no records
in the default config.

Fixes: #6943
2016-12-23 09:20:46 +01:00
Michael Desa 34bfa52272 Fix changelog typo for fill linear PR
Thanks @inselbuch for noticing the issue
2016-12-22 00:53:10 -05:00
Harry Rose 0cb456bda1 Update CHANGELOG.md 2016-12-20 20:18:43 +00:00
Cory LaNou bc5736f59d Merge pull request #7672 from influxdata/cjl-7563-rp-duration-inf
Enforce minimum shard duration when creating retention policies
2016-12-20 12:16:07 -06:00
Cory LaNou 880c7cdcc8 Merge branch 'master' into cjl-3188-cli-rp-context 2016-12-20 09:55:40 -06:00
Cory LaNou 0cbdea531a add the ability for retention policy context in cli with use command 2016-12-20 09:15:38 -06:00
Cory LaNou fbc9e3cfcc add clear command to cli 2016-12-20 09:14:20 -06:00
Cory LaNou 572da8985c enforce minimum shard duration when creating retention policies 2016-12-20 09:11:43 -06:00
Edd Robinson f55995f9be Merge pull request #7740 from oiooj/pr-fix
fix scan tag value panic
2016-12-20 10:42:42 +00:00
timhallinflux fa80b9c8cf Update CHANGELOG.md
v0.13.0 -- Added PR #6277. 
- [#6277](https://github.com/influxdata/influxdb/pull/6277): Fix deadlock in tsm1/file_store
2016-12-19 20:02:43 -08:00
timhallinflux 6cad2ca408 Update CHANGELOG.md
v0.13.0 -- added #6419: Fix panic in transform iterator on division. @thbourlove
v0.12.2 -- #6419 was backported to 0.12.2 as well as PR #6431: Fix panic in transform iterator on division. @thbourlove.  Added.
2016-12-19 19:46:49 -08:00
timhallinflux fdc0fea1d3 Update CHANGELOG.md
v0.13.0 -- removed duplicate from bugfixes:  - [#6468](https://github.com/influxdata/influxdb/issues/6468): Panic with truncated wal segments
2016-12-19 19:29:24 -08:00
timhallinflux 090e131980 Update CHANGELOG.md
v0.13.0 -- removed duplicate entry for  - [#6477](https://github.com/influxdata/influxdb/pull/6477): Don't catch SIGQUIT or SIGHUP signals.
2016-12-19 19:27:29 -08:00
timhallinflux 3d819abd7f Update CHANGELOG.md
Features reported in v0.13.0:
- [#6593](https://github.com/influxdata/influxdb/pull/6593): Add ability to create snapshots of shards.
- [#6585](https://github.com/influxdata/influxdb/pull/6585): Parallelize iterators

were not released until v1.0.0.  Moved these into the v1.0.0 release notes.
2016-12-19 17:19:34 -08:00
kun de4436e9d9 fix scan tag value panic 2016-12-20 08:39:18 +08:00
timhallinflux 2433660e68 Update CHANGELOG.md
v1.0.0 bug fixes referenced issue #6649...but that issue was addressed by #6648.  Changelog now correctly references #6648...
2016-12-19 16:31:23 -08:00
timhallinflux f42c1e28ba Update CHANGELOG.md
removed duplicate entry in the bugfix section.  #7119 was there 2x.
2016-12-19 16:20:17 -08:00
timhallinflux 247d987eb2 Update CHANGELOG.md
v1.0.1 - fixed issue 7299's URL -- missing an "i" in issues.
2016-12-19 15:24:02 -08:00
timhallinflux d1669c8143 Update CHANGELOG.md
re-ordered features and bugfixes in numerical order, descending for releases 0.13.0 through 0.10.0
2016-12-19 15:10:27 -08:00
timhallinflux aff45aa47c Update CHANGELOG.md
re-ordered all features and bugfixes in numerical order, descending from 1.1.0 through 1.0.0
2016-12-19 15:02:36 -08:00
timhallinflux f667d96500 Update CHANGELOG.md
re-ordered v1.1.1 bugfixes... numerical order, descending
2016-12-19 14:57:26 -08:00
timhallinflux a2f939834a Update CHANGELOG.md
re-ordered Features and Bugfixes in numerical order, descending for v1.2.0
2016-12-19 14:56:01 -08:00
timhallinflux 0fcd0ac3bc Update CHANGELOG.md
Made 1.1.0 Features Section consistent with the other releases.  Github issue # -- followed by summary text.
2016-12-19 14:35:48 -08:00
Jason Wilder 34c06d222a Update changelog 2016-12-19 11:47:00 -07:00
Jason Wilder 4787ed1b94 Update 1.1.1 release date 2016-12-19 11:11:50 -07:00
Edd Robinson 43834d3db8 Update Go version to 1.7.4 2016-12-19 11:11:00 -07:00
Edd Robinson db4e50f34f Fixes #7625 2016-12-19 11:09:10 -07:00
Mark Rushakoff 295a29d4ea Fix quoting on exported string fields
The previous implementation was wrong and double-escaped quotes and
backslashes.
2016-12-18 00:37:48 -08:00
Mark Rushakoff 9effe6f364 Update CHANGELOG 2016-12-17 20:34:04 -08:00
Edd Robinson 66edb32182 Sharded Cache using a hash ring 2016-12-14 18:23:36 +00:00
Jonathan A. Sternberg 74d474594f Remove the override of GOMAXPROCS
This was needed when we were on go 1.4 but hasn't been needed since go
1.5. It was kept because we weren't sure if we were going to have to
rollback to an older version of Go at that time and we kept it so we
wouldn't forget to readd it.

Now that we are on go 1.7 with go 1.4 deprecated, there is no going back
so we might as well remove this so people can set GOMAXPROCS to a custom
value using environment variables.
2016-12-14 12:00:40 -06:00
Jonathan A. Sternberg 21502a39e8 Switch logging to use structured logging everywhere
The logging library has been switched to use uber-go/zap. While the
logging has been changed to use structured logging, this commit does not
change any of the logging statements to take advantage of the new
structured log or new log levels. Those changes will come in future
commits.
2016-12-14 10:45:15 -06:00
Allen Petersen da9941b9a9 Reject invalid subscription urls
The url must have a scheme of udp,http,https and a port number.
CREATE SUBSCRIPTION will fail if there are invalid destinations.

Additionally Service.createSubscription fail invalid destinations are detected.

Fixes #7615
2016-12-07 12:54:41 -08:00
Cory LaNou 6f027ac60e Merge pull request #7702 from influxdata/cjl-6527-cli-precision-case-sensitive
fix precision being case sensitive in cli
2016-12-07 12:15:34 -06:00
Cory LaNou dddc3c6690
fix precision being case sensitive in cli 2016-12-07 12:04:19 -06:00
Cory LaNou 4442615f15 use spaces instead of tabs for CLI column output format 2016-12-07 11:21:04 -06:00
Cory LaNou a90a1f4b7f
cli was caching db/rp for insert into statements 2016-12-07 09:22:48 -06:00
Michael Desa cb3f4de336 Add influx_stress deprecation note to changelog. 2016-12-06 14:00:23 -05:00
Edd Robinson c558f29e54 Merge pull request #7686 from influxdata/er-go.1.7.4
Update Go version to 1.7.4
2016-12-06 16:26:46 +00:00
Edd Robinson 30bea335a4 Update Go version to 1.7.4 2016-12-05 11:23:48 +00:00
Edd Robinson 840fb6af38 Ensure unsafessl option passed to importer 2016-12-02 18:26:47 +00:00
Edd Robinson aff2d7ce64 Ensure user privs dropped along with db (#7677) 2016-12-02 18:23:35 +00:00
Jonathan A. Sternberg cbb689e706 Uncomment section headers from the default configuration file
It would be potentially confusing for someone if they uncommented a line
in the default configuration file, but forgot to also uncomment the
section header. The section headers don't cause any actual change to the
underlying configuration file so I've uncommented them to reduce
potential confusion.
2016-12-02 09:24:31 -06:00
Jonathan A. Sternberg bffc759cf9 Return the time from a percentile call on an integer
`percentile()` is supposed to be a selector and return the time of the
point, but that only got changed when the input was a float. Updating
the integer processor to also return the time of the point rather than
the beginning of the interval.
2016-12-01 12:34:48 -06:00
Cory LaNou d54d32b9d4
prune shards in meta data 2016-12-01 11:22:16 -06:00
Jonathan A. Sternberg 3427c7b356 Update changelog for #7356 (PR #7662) 2016-12-01 10:41:39 -06:00
Allen Petersen 31129ab0e9 Use slash separator for filenames in tar archives
NO-OP on platforms with unix path separator.
On Windows paths get converted to slashes before adding to archive and back to backslashes during restore.
2016-11-29 09:44:08 -08:00
Jonathan A. Sternberg 933702549d Merge pull request #7368 from influxdata/js-partial-in-json-response
Introduce syntax for marking a partial response with chunking
2016-11-29 11:17:24 -06:00
Jonathan A. Sternberg b4db76cee2 Introduce syntax for marking a partial response with chunking
The `partial` tag has been added to the JSON response of a series and
the result so that a client knows when more of the series or result will
be sent in a future JSON chunk.

This helps interactive clients who don't want to wait for all of the
data to know if it is done processing the current series or the current
result. Previously, the client had to guess if the next chunk would
refer to the same result or a new result and it had to match the name
and tags of the two series to know if they were the same series. Now,
the client just needs to check the `partial` field included with the
response to know if it should expect more.

Fixed `max-row-limit` so it counts rows instead of results and it
truncates the response when the `max-row-limit` is reached.
2016-11-22 11:16:22 -06:00
Edd Robinson 28ba8ced74 Fixes #7625 2016-11-17 16:31:36 +00:00
Jason Wilder 63554ce5a3 Update changelog
Add #7616
2016-11-16 17:05:47 -07:00
Jason Wilder 62177826d5 Merge branch '1.1' into jw-merge-11 2016-11-16 11:16:44 -07:00
Jonathan A. Sternberg e885fe5117 Expand string and boolean fields when using a wildcard with sample() 2016-11-15 15:56:47 -06:00
Jason Wilder 800da5732b Update release date 2016-11-11 16:25:22 -07:00
Jason Wilder 77e2c80a4f Merge pull request #7435 from marcv81/feature-7066
Support for collectd signed and encrypted packets
2016-11-11 11:30:24 -07:00
Jonathan A. Sternberg b87116449c Avoid deadlock when max-row-limit is hit
When the `max-row-limit` was hit, the goroutine reading from the results
channel would stop reading from the channel, but it didn't signal to the
sender that it was no longer reading from the results. This caused the
sender to continue trying to send results even though nobody would ever
read it and this created a deadlock.

Include an `AbortCh` on the `ExecutionContext` that will signal when
results are no longer desired so the sender can abort instead of
deadlocking.
2016-11-08 14:48:16 -06:00
Jonathan A. Sternberg 64c2d704da Avoid deadlock when max-row-limit is hit
When the `max-row-limit` was hit, the goroutine reading from the results
channel would stop reading from the channel, but it didn't signal to the
sender that it was no longer reading from the results. This caused the
sender to continue trying to send results even though nobody would ever
read it and this created a deadlock.

Include an `AbortCh` on the `ExecutionContext` that will signal when
results are no longer desired so the sender can abort instead of
deadlocking.
2016-11-08 13:12:28 -06:00
Marc 05d929caa9 Update CHANGELOG.md 2016-11-08 08:42:14 +08:00
Jason Wilder e10776081a Disable/deprecate admin interface 2016-11-07 13:33:36 -07:00
Jason Wilder b6863b04d1 Disable/deprecate admin interface 2016-11-07 12:04:51 -07:00
Cory LaNou e112de2ee0 Merge pull request #7554 from influxdata/cjl-godeps
update latest dependencies with Godeps
2016-11-07 09:10:30 -06:00
Cory LaNou 3774d5e734
update latest dependencies with Godeps 2016-11-07 08:49:29 -06:00
Cory LaNou cd272ce6c3 fix retention policy creation inconsistencies 2016-11-03 09:09:43 -05:00
Jonathan A. Sternberg e7d4a601a6 Fix incorrect grouping when multiple aggregates are used with sparse data
When a query would use a grouping with two different aggregates, it was
possible for one of the aggregates to return a value from a different
series key than the second aggregate. When these series keys didn't
match, the returned grouping would be screwed up because it sorted by
time before checking for name and tags.

This did not happen when the aggregates returned values for the same
series keys because then the iterators were aligned with each other.
2016-11-02 14:29:31 -05:00
Jonathan A. Sternberg 1b2fa645ee Fix incorrect grouping when multiple aggregates are used with sparse data
When a query would use a grouping with two different aggregates, it was
possible for one of the aggregates to return a value from a different
series key than the second aggregate. When these series keys didn't
match, the returned grouping would be screwed up because it sorted by
time before checking for name and tags.

This did not happen when the aggregates returned values for the same
series keys because then the iterators were aligned with each other.
2016-11-02 13:35:22 -05:00
Jason Wilder 7f1f1b002d Highly new query features 2016-10-31 12:47:36 -06:00
Jonathan A. Sternberg ce1831160d Fix output duration units for SHOW QUERIES
The previous version was showing the microseconds unit when it was
outputting nanoseconds. Now we correctly identify which sub-second unit
to use (milliseconds, microseconds, or nanoseconds) and use the correct
unit while dividing the duration unit correctly to produce the correct
output.

Also updated to use the default duration string instead of our own
custom formatters. It turns out that the string method for
`time.Duration` does the correct thing as long as we truncate the value
first.
2016-10-31 12:48:01 -05:00
Jonathan A. Sternberg 3e29d3d9ca Truncate the version string when linking to the documentation
The admin console would dynamically discover the version from the
InfluxDB server, but for patch releases, it included the patch in the
link to the documentation and that wasn't a valid link.

Truncate the version so the documentation url is correct since we only
do documentation for `major.minor`.
2016-10-27 16:40:08 -05:00
Jonathan A. Sternberg f1fbb55909 Change default time boundaries for raw queries
Changes the default time boundaries for raw queries so raw queries will
range until the end of time. Aggregate queries continue to have their
default end time be `now()`.
2016-10-25 15:08:51 -05:00
Jonathan A. Sternberg 17eb8cb476 Merge pull request #7497 from influxdata/js-6704-first-last-optimization
Optimize first/last when no group by interval is present
2016-10-25 14:33:55 -05:00
Cory LaNou cc8e34886c escape fields when exporting tsm/wal files 2016-10-25 13:36:45 -05:00
Jason Wilder af72d9b0e4 Merge pull request #7515 from influxdata/jw-7053
Return parse error from delete/drop when db or rp is specified
2016-10-25 12:05:56 -06:00
Jason Wilder c68b7a192f Return parse error from delete/drop when db or rp is specified
The delete and drop statements apply to the measurement within a db.
The parser allowed a db or rp to be specified and these values were
silently ignored.  This could cause data loss as someone would think
they are only deleting the series within a rp, but they are actually
deleting all their data.

Instead, we return a parse error if a db or rp is specified in the
delete or drop statements.  Ideally, we'd be able to respect the
db and rp, but that requires significant work in the query engine
and tsdb store to make that work.

Fixes #7053
2016-10-25 11:43:15 -06:00
Jonathan A. Sternberg a515aeda39 Optimize first/last when no group by interval is present
The `first()` and `last()` functions response rate would increase linear
to the number of points even though it seems like it shouldn't. This
optimization greatly reduces the amount of time to return a response
when no `GROUP BY time(...)` clause is present in a query.
2016-10-25 09:57:31 -05:00
Edd Robinson 06d1226b9a Rewrite exact match regexes to use tsdb index
This commit adds support for replacing regexes with non-regex conditions
when possible. Currently the following regexes are supported:

 - host =~ /^foo$/ will be converted into host = 'foo'
 - host !~ /^foo$/ will be converted into host != 'foo'

Note: if the regex expression contains character classes, grouping,
repetition or similar, it may not be rewritten.

For example, the condition: name =~ /^foo|bar$/ will not be rewritten.
Support for this may arrive in the future.

Regexes that can be converted into simpler expression will be able to
take advantage of the tsdb index, making them significantly faster.
2016-10-25 11:10:03 +01:00
Jason Wilder 6249c8b9ab Update changelog 2016-10-24 16:13:45 -06:00
Edd Robinson 0ee093f1fb Memoize output of FileStore.Stats 2016-10-24 10:23:20 -06:00
Cory LaNou e35178870e Merge pull request #7493 from influxdata/cjl-7431-remove-cq-endpoint-httpd
Remove ProcessContinousQueries from httpd endpoint
2016-10-21 13:02:19 -05:00
Jonathan A. Sternberg 3681bc8a43 Filter out series within shards that do not have data for that series
Previously, we would return a full tag set for every shard and the tag
set would include all series that existed in the database index
including series that didn't physically exist within that shard. This
led to the tag sets returned being incredibly huge when we had high
cardinality but sparse data. Since the data was sparse, it was
unexpected that it would cause such a large strain on the system by most
people.

Now we filter out the series ids that are not assigned to the current
shard when computing a tag set for that shard. This lowers the memory
usage for high cardinality sparse data drastically and allows queries on
those to complete successfully.

This does not resolve issues for high cardinality data in every shard
that is also spread out over a long series of time. That situation isn't
nearly as common as the above situation though.
2016-10-20 14:15:34 -05:00
Cory LaNou 5b72b874d8
remove ProcessContinousQueries from httpd endpoint 2016-10-20 11:22:36 -05:00
Edd Robinson e88192b282 Fixes issue with point hitting wrong shard
If a point was written that was earlier than any existing shards
it would be written to the earliest existing shard that had an
end time later than the point's time.

This ensures that when a point is written and there are no shards that
the point will fit into exactly, a new shard group will be created.
2016-10-19 21:06:29 +01:00
Jason Wilder 2e473e9518 Fix panic in AppendSeriesKeyByID
Calling this function with a series ID that does not exist in
the measurement causes a panic.

Fixes #7334
2016-10-19 11:07:19 -06:00
Mark Rushakoff 377c40f122 Add stats for active compactions
Unify logic around compaction execution to a single place.

Also report on the error stats that we track. Previously they were not
emitted in the stats output.
2016-10-18 14:12:21 -07:00
Jason Wilder 8f3da43ebb Merge pull request #7165 from influxdata/jw-deletes
Allow snapshot compactions during deletes
2016-10-18 14:27:16 -06:00
Jason Wilder 80cc956fb6 Fix changelog 2016-10-18 14:14:58 -06:00
Jonathan A. Sternberg 19a61dbb44 Align binary math expression streams by time
Also fills in missing values using the fill expression for any binary
aggregation.
2016-10-18 13:31:13 -05:00
Jason Wilder f254b4f3ae Allow snapshot compactions during deletes
If a delete takes a long time to process while writes to the
shard are occuring, it was possible for the cache to fill up
and writes to be rejected.  This occurred because we disabled
all compactions while writing tombstone file to prevent deleted
data from re-appearing after a compaction completed.

Instead, we only disable the level compactions and allow snapshot
compactions to continue.  Snapshots already handle deleted data
with the cache and wal.

Fixes #7161
2016-10-18 12:14:51 -06:00
Edd Robinson ad2d33f859 Ensure input services can be safely opened and closed 2016-10-18 10:35:38 +01:00
Jonathan A. Sternberg 2f5f995782 Correctly read in input from a non-interactive stream for the CLI
If you pipe in a file to the `influx` CLI, it will not try to open the
interactive line reader, but instead just send the contents of the
entire file to the server.
2016-10-17 12:58:44 -05:00
Jonathan A. Sternberg e457cefb24 Support INFLUX_USERNAME and INFLUX_PASSWORD for setting username/password in the CLI 2016-10-17 12:26:39 -05:00
Jonathan A. Sternberg 41e4e73d4e Reduce map allocations when computing the TagSets of a measurement
Instead of assigning a boolean value of true to the filter expressions
when there was no meaningful expression, this drops a boolean expression
of true from the filter expressions so we don't have to perform a map
assignment. This allows us to reduce allocations and assignments when a
`WHERE` clause only contains tag comparisons and no field comparisons.
2016-10-17 12:13:19 -05:00
Jonathan A. Sternberg 3496c5b85f Merge pull request #7442 from influxdata/js-5955-make-regex-work-on-field-keys-in-select
Support using regexes to select fields and dimensions
2016-10-17 11:37:47 -05:00
Jonathan A. Sternberg b60b4b371e Support using regexes to select fields and dimensions
The functionality works the same as wildcards, but this time, you can
specify a regular expression.

One limitation is that you can't specify whether you only want to select
fields or tags. Since the regex can be changed to suit the person's
needs, I don't currently think this is an issue.
2016-10-13 22:17:14 -05:00
Jonathan A. Sternberg 95859b8ab4 Remove accidentally added string support for the stddev call
Strings would always return an empty string and stddev is meaningless
when it comes to strings. This removes that functionality so strings
don't automatically get picked up when using a wildcard.
2016-10-10 14:58:28 -05:00
Jason Wilder bbecb3f03d Drop points that would execeed limits
This changes the behavior of the max-series-per-database and
max-values-per-tag limits to drop points that would exceed the limits
and allow the remaining points to be written.  Previously, the whole
batch would fail and return and 500 error to the client.

This now will write the allow points and return a `partial write`
error indicating some of the points were dropped, how many were
dropped and one of the problem measureent and tags.
2016-10-10 11:42:15 -06:00
Jason Wilder 8fce6bba48 Add tag value cardinality limit 2016-10-10 11:42:15 -06:00
Mark Rushakoff 5ae8cf8312 Speed up shutdown
On my machine with about 20 shards, it would take 10+ seconds to shut
down InfluxDB with SIGINT. After this change, it shuts down in nearly
instantly.

(*tsdb.Store).Close was shutting down each of its shards sequentially.
Each shard's engine would signal to its compaction goroutines to quit,
and because each compaction goroutine has a hardcoded 1-second sleep in
between checks, waiting for the goroutines would often block for up to a
second.

This change closes all of the TSDB store's shards in parallel. This
means it's possible that multiple close values could error at once, but
we're still only returning the first error, consistent with previous
behavior. That being said, the return value of (*tsdb.Store).Close is
ignored in (*cmd/influxd/run.Server).Close anyway.
2016-10-10 09:18:47 -07:00
Jonathan A. Sternberg 6afc2a77a5 Implement cumulative_sum() function
The `cumulative_sum()` function can be used to sum each new point and
output the current total. For the following points:

    cpu value=2 0
    cpu value=4 10
    cpu value=6 20

This would output the following points:

    > SELECT cumulative_sum(value) FROM cpu
    time    value
    ----    -----
    0       2
    10      6
    20      12

As can be seen, each new point adds to the sum of the previous point and
outputs the value with the same timestamp.

The function can also be used with an aggregate like `derivative()`.

    > SELECT cumulative_sum(mean(value) FROM cpu WHERE time >= now() - 10m GROUP BY time(1m)
2016-10-07 10:11:53 -05:00
Michael Desa 616d4d28d3 Merge pull request #7415 from influxdata/md-sample
Add sample function to query language
2016-10-06 10:04:16 -07:00
Michael Desa f9b8129770 Add sample function to query language
First Pass at implementing sample

Add sample iterators for all types

Remove size from sample struct

Fix off by one error when generating random number

Add benchmarks for sample iterator

Add test and associated fixes for off by one error

Add test for sample function

Remove NumericLiteral from sample function call

Make clear that the counter is incr w/ each call

Rename IsRandom to AllSamplesSeen

Add a rng for each reducer that is created

The default rng that comes with math/rand has a global lock. To avoid
having to worry about any contention on the lock, each reducer now has
its own time seeded rng.

Add sample function to changelog
2016-10-06 09:41:42 -07:00
Jason Wilder ebf50d06ca Merge branch '1.0' into jw-merge-102 2016-10-06 09:51:35 -06:00
Jason Wilder ff30704705 Update 1.0.2 release date 2016-10-05 13:19:17 -06:00
Michael Desa fc57c0f7c6 Merge pull request #7403 from influxdata/md-fill-average
Add fill(linear) to query language
2016-10-05 10:40:02 -07:00
Michael Desa 966e5503bf Add fill(linear) to query language
Clean up template for fill average

Change fill(average) to fill(linear)

Update average to linear in infuxql spec

Add Integer Tests and associated fixes

Update CHANGELOG for fill(linear)
2016-10-04 14:27:04 -07:00
Jason Wilder ea21588b9e Fix subscriber service dropping writes under high write load
The subscriber write goroutine would drop points if the write load
was higher than it could process.  This could happen with a just
a few writers to the server.

Instead, process the channel with multiple writers to avoid dropping
writes so easily.  This also adds some config options to control how
large the channel buffer is as well as how many goroutines are started.

Fixes #7330
2016-10-04 14:47:36 -06:00
Nathaniel Cook 91645c05cf Merge pull request #7392 from mglazer/feature/https-subscriber
Fix Kapacitor Issue #942: HTTPS subscriptions don't work
2016-10-04 14:45:05 -06:00
Mike Glazer 1feca0623c CHANGELOG updated 2016-10-04 20:58:37 +02:00
Jason Wilder f727effd7f Merge pull request #7385 from influxdata/jw-query-allocs
Reduce query planning allocations
2016-10-03 09:08:36 -06:00
Jason Wilder ac4ae1a866 Update changelog for backported issue 2016-10-03 08:58:15 -06:00
Jason Wilder 4f37cc6572 Fix backport issues 2016-10-03 08:31:32 -06:00
Jason Wilder 2898f3dacf Fix decoding RLE integer blocks with negative deltas
Integer blocks that were run length encoded could produce the wrong
value when read back out because the deltas were not zig zag decoded
before scaling the final value.  If the deltas were negative, as would
be seen in a counter that decrements by a constant value, the results
would be random with som negative and positive values.

Fixes #7391
2016-10-03 08:25:28 -06:00
Jason Wilder a15a416eaa Fix decoding RLE integer blocks with negative deltas
Integer blocks that were run length encoded could produce the wrong
value when read back out because the deltas were not zig zag decoded
before scaling the final value.  If the deltas were negative, as would
be seen in a counter that decrements by a constant value, the results
would be random with som negative and positive values.

Fixes #7391
2016-10-02 23:51:29 -06:00
Edd Robinson fb5d3c5131 Ensure points map to correct shard groups 2016-09-30 13:58:56 +01:00
Jason Wilder 68dd312bb1 Reduce allocations when calculating tagsets
The TagSets function was creating a lot of intermediate maps and
slices to calculate the sorted tag sets.  It first creates a map
to group tag sets with their series, it then created an equally
sized slice of the tag keys and sorted then.  Finally, it created
a new slice and added the tag sets in the original map by the ordering
of the sorted keys.  It was also recreating the tags map multiple time
creating extra garbage in the loop.

This simplifies the code to create one map for grouping and than adding
the distinct sets to a slice which is then sorted.  It also fixes the
multple tag maps getting created.
2016-09-29 16:02:29 -06:00
Mark Rushakoff 97c2f6f5c1 Add walPath tag to shard stats
Without the WAL path as a tag, the diskBytes field looked like it was
reporting the size of the data directory incorrectly.

Fixes #7382.
2016-09-29 10:19:11 -07:00
Jonathan A. Sternberg ea8a57233f Merge pull request #7372 from influxdata/js-7150-alter-retention-policy-resets-sg-duration
Do not automatically reset the shard duration when using ALTER RETENTION POLICY
2016-09-28 15:45:35 -05:00
Jonathan A. Sternberg bb8c4efa95 Do not automatically reset the shard duration when using ALTER RETENTION POLICY 2016-09-28 12:26:03 -05:00
Jonathan A. Sternberg 3afdf3cd94 Merge tag 'v1.0.1' 2016-09-27 17:53:33 -05:00
Jonathan A. Sternberg 6660bf5cba Removing bad changelog entries added in 39ade11 2016-09-27 15:18:57 -05:00
Jason Wilder 8b354f7295 Update 1.0.1 changelog 2016-09-26 09:15:33 -06:00
Cory LaNou 4f952ad483 export wal files when exporting shard data 2016-09-23 15:09:17 -05:00
Joe LeGasse 2cbd411a9a client: updated README for UDP point splitting 2016-09-23 15:13:40 -04:00
Jonathan A. Sternberg dbc4a9150f Prevent manual use of system queries
Manual use of system queries could result in a user using the query
incorrect. Rather than check to make sure the query was used correctly,
we're just going to prevent users from using those sources so they can't
use them incorrectly.
2016-09-23 10:00:18 -05:00
Jason Wilder 39ade11944 Unload index before closing shard
When deleting a shard, the shard is locked and then removed from the
index.  Removal from the index can be slow if there are a lot of
series.  During this time, the shard is still expected to exist by
the meta store and tsdb store so stats collections, queries and writes
could all be run on this shard while it's locked.  This can cause everything
to lock up until the unindexing completes and the shard can be unlocked.

Fixes #7226
2016-09-22 11:16:45 -06:00
Jason Wilder d06b28992d Unload index before closing shard
When deleting a shard, the shard is locked and then removed from the
index.  Removal from the index can be slow if there are a lot of
series.  During this time, the shard is still expected to exist by
the meta store and tsdb store so stats collections, queries and writes
could all be run on this shard while it's locked.  This can cause everything
to lock up until the unindexing completes and the shard can be unlocked.

Fixes #7226
2016-09-16 12:01:50 -06:00
Jonathan A. Sternberg edd32908fe More man pages for the other tools we package
Updating the package to compress the man pages fully and removes the
filename and timestamp from being stored in the man page. Lintian
complains that the packages aren't compressed using the best compression
method.

https://lintian.debian.org/tags/manpage-not-compressed.html
2016-09-15 08:35:05 -05:00
Cory LaNou 71f0c7e1e9 return appropriate error if overflowing duration when parsing 2016-09-14 09:27:38 -05:00
Todd Persen b8192d079e Regenerate static assets and update CHANGELOG for PR #7286. 2016-09-13 23:38:36 -07:00
Jonathan A. Sternberg 0b94f5dc1a Skip past points at the same time in derivative call within a merged series
The derivative() call would panic if it received two points at the same
time because it tried to divide by zero. The derivative call now skips
past these points. To avoid skipping past these points, use `GROUP BY *`
so that each series is kept separated into their own series.

The difference() call has also been modified to skip past these points.
Even though difference doesn't divide by the time, difference is
supposed to perform the same as derivative, but without dividing by the
time.
2016-09-13 16:57:36 -05:00
Jonathan A. Sternberg dbb8c5570c Duplicate parsing bug in ALTER RETENTION POLICY
Return an error when we encounter the same option twice in ALTER
RETENTION POLICY and remove the `maxNumOptions` number from the parsing
loop. The `maxNumOptions` number would need to be modified if another
option was added to the parsing loop and it didn't correctly prevent
duplicate options from being reported as an error anyway.
2016-09-13 15:56:13 -05:00
Jonathan A. Sternberg 954445efd2 Read an invalid JSON response as an error in the influx client 2016-09-13 15:39:26 -05:00
Jonathan A. Sternberg aae88fc3c3 Support ON and use default database for SHOW commands
Normalize all of the SHOW commands so they allow both using ON to
specify the database and using the default database. Some commands would
require one and some would require the other and it was confusing when
using the query language.

Affected commands:

* SHOW RETENTION POLICIES
* SHOW MEASUREMENTS
* SHOW SERIES
* SHOW TAG KEYS
* SHOW TAG VALUES
* SHOW FIELD KEYS
2016-09-13 15:36:59 -05:00
Jonathan A. Sternberg 35b7460ad3 Use consistent column output from the CLI for column formatted responses
There were three different outputs that could be output with columns
that were rather strange depending on if there was a name and if there
were tags with the response.

Normalized output now has the dashes always under the column names and
no dashes anywhere else for consistency.
2016-09-13 14:20:49 -05:00
Jonathan A. Sternberg 8b07e9dd55 Merge pull request #7257 from influxdata/js-7013-dollar-sign-accepted-as-whitespace
Fix the dollar sign so it properly handles reserved keywords
2016-09-13 14:14:04 -05:00
Edd Robinson 2a99ef751d Emit fieldsCreated stat in shard measurement 2016-09-13 16:41:11 +01:00
sdtsui 6471986eb1 Lint influx_tsm; Relates to #4098
- Single commit, PR follows conventions laid out by @Gouthamve in #5822
* main.go: struct field CpuFile should be CPUFile
* influx_inspect: loop equivalent to `for key := range...`
* adds comments to exported fields and consts
* fixes typo in `CHANGELOG.md`: text for #4702 now matches number
2016-09-12 18:35:14 -07:00
Jonathan A. Sternberg ab4bca8495 Report cmdline and memstats in /debug/vars
When we refactored expvar, the cmdline and memstats sections were not
readded to the output. This adds it back if they can be found inside of
`expvar`.

It also stops trying to sort the output of the statistics so they get
returned faster. JSON doesn't need them to be sorted and it causes
enough latency problems that sorting them hurts performance.
2016-09-09 14:32:43 -05:00
Jonathan A. Sternberg 4326da0820 Implement time math for lazy time literals
When attempting to reduce the WHERE clause, the time literals had not
been converted from string literals yet. This adds the functionality to
have it handle the same time math when the time literal is still a
string literal.
2016-09-09 13:34:56 -05:00
Andy Feller 28f702667e Fixing typo within example configuration file 2016-09-09 09:57:13 -05:00
Jason Wilder 95682faec2 Merge branch '1.0' into jw-merge-10 2016-09-08 09:00:51 -06:00
Paul Dix c02611f68b Update CHANGELOG for 1.0 release! 2016-09-08 10:36:27 -04:00
Jason Wilder df61117848 Update 1.0.0 release date 2016-09-07 11:54:20 -06:00
Jason Wilder 1a35c0a3fc Fix neverending full compactions
The full compaction planner could return a plan that only included
one generation.  If this happened, a full compaction would run on that
generation producing just one generation again.  The planner would then
repeat the plan.

This could happen if there were two generations that were both over
the max TSM file size and the second one happened to be in level 3 or
lower.

When this situation occurs, one cpu is pegged running a full compaction
continuously and the disks become very busy basically rewriting the
same files over and over again.  This can eventually cause disk and CPU
saturation if it occurs with more than one shard.

Fixes #7074
2016-09-03 17:35:14 -06:00
Jonathan A. Sternberg 04c59b8941 Fix the dollar sign so it properly handles reserved keywords
The dollar sign would sometimes be accepted as whitespace if it was
immediately followed by a reserved keyword or an invalid character. It
now reads these properly as a bound parameter rather than ignoring the
dollar sign.
2016-09-02 15:32:46 -05:00
Jonathan A. Sternberg dc2527ce86 Merge branch '1.0' 2016-08-31 14:45:57 -05:00
Jonathan A. Sternberg 964341eb20 Optimize queries that compare a tag value to an empty string
The behavior for querying tag values with an empty string was originally
fixed in #6283, but it also added a performance problem when the
cardinality of the tag was high. Since a call to `Union()` or `Reject()`
would happen for every series key and it would be called N times for N
cardinality, the comparisons against a blank string were unnecessarily
slow with large memory allocations.

This optimizes these queries so it doesn't use those methods anymore.
Those methods are still useful and used when combining AND and OR
clauses, but they aren't useful when finding the series ids for a single
clause. These methods were unnecessary anyway because the series ids for
the tags were unique anyway and didn't have to be merged as a set.
2016-08-31 14:03:23 -05:00
Jonathan A. Sternberg 23f2d50ecb Use defaults from `meta` package for `CREATE DATABASE`
Instead of having the parser set the defaults, the command will set the
defaults so that the constants for that are actually used. This way we
can also identify which things the user provided and which ones we are
filling with default values.

This allows the meta client to be able to make smarter decisions when
determining if the user requested a conflict or if the requested
capabilities match with what is currently available. If you just say
`CREATE DATABASE WITH NAME myrp`, the user doesn't really care what the
duration of the retention policy is and just wants to use the default.
Now, we can use that information to determine if an existing retention
policy would conflict with what the user requested rather than returning
an error if a default value ever gets changed since the meta client
command can communicate intent more easily.
2016-08-30 13:23:49 -05:00
Jonathan A. Sternberg 0d63889847 Allow blank lines in the line protocol input 2016-08-30 09:25:55 -05:00
Jason Wilder 2d16f8b8d1 Fixup changelog 2016-08-29 15:16:45 -06:00
Jason Wilder 3d411371f2 Merge pull request #7233 from influxdata/jw-stats2
Write path stats
2016-08-29 10:15:23 -06:00
Jason Wilder fa8f982686 Update changelog 2016-08-29 09:46:11 -06:00
Jason Wilder b31bf798f1 Fix runtime: goroutine stack exceeds 1000000000-byte limit
Fixes #7225
2016-08-29 09:26:48 -06:00
Jonathan A. Sternberg b8a70105aa Fix alter retention policy when all options are used
We added `SHARD DURATION` as an extra option, but forgot to increase the
maximum number of allowable options from 3 to 4. So if 4 options were
used, the last one was ignored. This was commonly `DEFAULT`, but it
could have been any of the options.
2016-08-26 11:25:18 -05:00
Jonathan A. Sternberg 8b234546a8 Merge pull request #7204 from influxdata/1.0
Merge 1.0 branch to master
2016-08-25 15:20:30 -05:00
Jonathan A. Sternberg 10029caf2f Support negative timestamps in the query engine
Negative timestamps are now supported. We also now refuse two
nanoseconds that are at the edge of the minimum time window. One of the
nanoseconds we do not accept is because we need MinInt64 to be used for
some internal comparisons in the TSM engine and it was causing an
underflow when we subtracted one from the minimum time. The second is so
we can have one minimum time that signifies the default minimum that
nobody can write to (so we can implicitly rewrite the timestamp on
aggregate queries) but still use the explicit timestamp if it is given
to us by the user. We aren't able to tell the difference between if the
user provided it or if it was implicit without those values being
different.

If the default minimum time is used with an aggregate query, we rewrite
the time to be the epoch for backwards compatibility since we believe
that's more important than supporting that extra nanosecond.
2016-08-25 12:52:41 -05:00
Jonathan A. Sternberg 5130cd703b Update changelog 2016-08-24 13:00:58 -05:00
Ben Johnson cc628a1097
Fix mmap dereferencing
Adds a missing dereference call to `Close()` as well as fixes
a tag copy issue.
2016-08-24 10:48:07 -06:00
Edd Robinson a2fcafd5c0 Merge pull request #7187 from influxdata/er-stat-fix
Fix base64 encoding issue in stats
2016-08-23 16:57:41 +01:00
Yaser Alraddadi 0402b3ae22 Update issue link to "Remove IF EXISTS/IF NOT ..." 2016-08-23 15:37:01 +03:00
Jason Wilder a2470c9f94 Update changelog 2016-08-22 14:38:27 -06:00
Edd Robinson 90ff713f21 Fix base64 encoding issue in stats
Fixes #7177.
2016-08-22 15:21:31 +01:00
Jonathan A. Sternberg a0004b6857 Merge pull request #7153 from influxdata/js-7152-delete-series-causes-incorrect-measurement-statistic
Decrement number of measurements only once when deleting the last series from a measurement
2016-08-15 14:21:35 -05:00
Jonathan A. Sternberg 6b5b24a3e3 Decrement number of measurements only once when deleting the last series from a measurement 2016-08-15 13:57:08 -05:00
Edd Robinson cebeda817c Update jwt-go to v3 2016-08-12 17:35:57 +01:00
Jonathan A. Sternberg 87f7c66b8a Merge pull request #7119 from influxdata/js-create-database-use-defaults
Use defaults from `meta` package for `CREATE DATABASE`
2016-08-11 10:34:22 -05:00
Jonathan A. Sternberg 0efed4f6cf Update changelog 2016-08-10 15:36:15 -05:00
Jonathan A. Sternberg a4e49963f5 Implement text/csv content encoding for the response writer
CSV doesn't offer a way to separate different sheets from each other and
it doesn't really have a standard format. We separate sheets with a
newline so they can be imported into something like Excel or LibreOffice
more easily.

The number of columns for each sheet is inferred from the first returned
row in each statement since they should all be the same.
2016-08-10 15:15:33 -05:00
Jonathan A. Sternberg ab049d7f0a Support mixed duration units
It is now possible to use a mixed duration unit like `1h30m`. The
duration units can be in whatever order as long as they are connected to
each other.

There is a change to the scanner. A token such as `10x` will be scanned
as a duration literal, but will then fail to parse as an invalid
duration. This should not be a breaking change as there is no situation
where `10m10` was a valid order of tokens for the parser.

Fixes #3634.
2016-08-10 13:34:19 -05:00
kun 6945655be2 add support for unix socket binding service 2016-08-11 02:20:54 +08:00
Jonathan A. Sternberg 3959656968 Add additional statistics to query executor
The query executor would only store the number of active queries and the
query duration so it was impossible to determine how many queries were
actually executed during that timeframe because quick queries would be
gone before the call to gather statistics was made.

This adds two new statistics so track when queries start and when
queries finish and doesn't decrement the counter so the number of
executed queries can be obtained using `derivative()` and
`difference()`.
2016-08-10 11:35:06 -05:00
Jonathan A. Sternberg 9621bee195 Drop time when used as a tag or field key
The "time" field and tags are unqueryable so we prevent those from being
written so we don't have unreadable data.
2016-08-10 10:02:01 -05:00
Jonathan A. Sternberg 530b00bd76 Use defaults from `meta` package for `CREATE DATABASE`
Instead of having the parser set the defaults, the command will set the
defaults so that the constants for that are actually used. This way we
can also identify which things the user provided and which ones we are
filling with default values.

This allows the meta client to be able to make smarter decisions when
determining if the user requested a conflict or if the requested
capabilities match with what is currently available. If you just say
`CREATE DATABASE WITH NAME myrp`, the user doesn't really care what the
duration of the retention policy is and just wants to use the default.
Now, we can use that information to determine if an existing retention
policy would conflict with what the user requested rather than returning
an error if a default value ever gets changed since the meta client
command can communicate intent more easily.
2016-08-09 12:00:06 -05:00
Ben Johnson 55b3e63ced
concurrent series limit
This commit fixes the `MaxSelectSeriesN` limit which was broken by
the implementation of lazy iterators. The setting previously limited
the total number of series but the new implementation limits the
concurrent number of series being processed.
2016-08-09 08:58:01 -06:00
Mark Rushakoff 7787703ca8 Ensure gzip writer closed in influx_inspect export
Previously, the gzip writer may have had unflushed data when the
underlying writer was closed, and the output stream would have been
truncated early.
2016-08-08 08:52:22 -07:00
David Norton 064db3c5b3 Merge pull request #7095 from influxdata/dgn-cardinality-limits
feat #6679: add series limit config setting
2016-08-05 16:34:25 -04:00
David Norton 43809b0799 update CHANGELOG.md 2016-08-05 15:54:34 -04:00
Jonathan A. Sternberg 4cdfc3280d Move the CQ interval by the group by offset
This will make the period selected by the CQ system work correctly for a
query with an offset.
2016-08-05 14:39:52 -05:00
Jonathan A. Sternberg 0879d43b74 Do not run continuous queries that have no time span 2016-08-05 14:39:52 -05:00
Ben Johnson 6c7d56d4bc
limit shard concurrency
This commit limits queries to only process one shard at a time.
However, within a shard, multiple series can still be processed in
parallel. Shard iterators are lazily instantiated during query
execution to limit the amount of memory a given query uses.
2016-08-05 09:45:57 -06:00
Jonathan A. Sternberg ccd1bd91f4 Copy tags in influx_stress to avoid a concurrent write panic on a map
Removing lock from the same object as that object never does anything
except for having attributes read.
2016-08-01 13:18:21 -05:00
Jonathan A. Sternberg 2c739c0532 Fix parseFill to check for fill ident before attempting to parse an expression
The previous parseFill would try to parse an expression and only unscan
one token when it failed. This caused it to not put back the correct
number of tokens with some expression.

Now it has been modified to check for the fill ident ahead of time and
then use ParseExpr() to parse the call. If the expression fails to parse
into a call, it will send an error instead of trying to continue with an
invalid parser state.

Fixes #6543.
2016-08-01 11:38:44 -05:00
David Norton 0c4559722c feat #6679: add series limit config setting 2016-08-01 08:28:46 -04:00
Cory LaNou 1117526873 remove IF EXISTS/IF NOT EXISTS from influxql language 2016-07-29 12:58:05 -05:00
Jason Wilder c1840be88d Update changelog 2016-07-28 20:25:37 -06:00
Jason Wilder d432aaa84d Fix panic with parsing empty key
Fixes #6990
2016-07-28 18:38:17 -06:00
Jonathan A. Sternberg 23ef9484a4 Support wildcards in aggregate functions 2016-07-28 17:56:32 -05:00
Edd Robinson 9a2efafa13 Ensure CQ id names can't clash 2016-07-28 16:26:05 +01:00
Cameron Sparr d688676266 Update UDP buffer setting doc to 25MB 2016-07-28 12:02:56 +01:00
David Norton e3328117a9 fix #7081: hardcode auto gen RP name 2016-07-27 16:49:46 -04:00