Commit Graph

1119 Commits (aa53a85774a39b2f60a322628060bc8812b7fcde)

Author SHA1 Message Date
Gunnar e9f0dc48ca
Merge pull request #10051 from influxdata/ga-config
Update example config with UDP precision option
2018-07-10 08:16:28 -07:00
Gunnar Aasen 8870512e6b Update example config with UDP precision option
Also add a test for precision in the UDP configuration.
2018-07-09 10:07:05 -07:00
Jeff Wendling 07e5465cb8 httpd: fix flaky test in timeout handler
there were two problems with this code:

1. the send on pending did not imply that the handler was running
2. there was a race starting the handler with timing out

1 is fixed by sending to a begin channel inside the handler. it is
then guaranteed that the timeout handler code has been entered.

2 is fixed by attempting to acquire the semaphore channel once before
checking the timeout channel. in this way, if there is capacity, which
in this test there is known to be, it is guaranteed to be taken. if
we check with the timer at the same time and the timer has already
fired, there is a pseudorandom chance the timer will be taken even
if there is capacity.
2018-07-05 12:09:09 -06:00
Jonathan A. Sternberg 88b81941ac Modify the storage service to expose a grpc interface instead of yarpc 2018-06-28 14:03:09 -05:00
Edd Robinson 8fd00853e7 Ensure read service regexes get optimised 2018-06-22 19:32:17 +01:00
Jonathan A. Sternberg 87d2469877
Merge pull request #9964 from influxdata/js-enable-storage-service
Enable the storage service by default
2018-06-13 16:28:27 -05:00
Edd Robinson 3cb9e13d58 Address PR feedback 2018-06-13 17:41:50 +01:00
Jonathan A. Sternberg 17ca220f33 Enable the storage service by default 2018-06-13 10:56:50 -05:00
Edd Robinson 8a78e64868 Make zero results work properly 2018-06-12 23:49:04 +01:00
Edd Robinson 28b6df7afb Ensure remote read can handle no data in time 2018-06-12 23:10:18 +01:00
Edd Robinson 522e509709 Add further tests 2018-06-12 15:54:18 +01:00
Edd Robinson 524f400836 Make testing of handler easier 2018-06-12 15:54:18 +01:00
Edd Robinson 806464d9e7 Add storage package mocks 2018-06-12 15:54:18 +01:00
Edd Robinson 40fa4eddc0 Fix overflow 2018-06-12 15:54:18 +01:00
Paul Dix 4f7b93342c Update Prometheus read/write to use new storage query layer.
* Update Prometheus remote write to use metric name as measurement name and value as the field name.
* Update Prometheus remote read to use the storage.Read method to bypass the InfluxQL query engine.
2018-06-12 15:54:18 +01:00
Jeff Wendling 5ec7b901bb
Merge pull request #9847 from influxdata/jmw-docker-on-windows
fix(tsdb): attempt to work on docker on windows
2018-06-01 15:16:51 -06:00
Jeff Wendling e6aec771b0 fix(tsdb): attempt to work on docker on windows
multiple users have attempted to run influxdb in a docker container
with a windows host and a volume mounted from windows. that causes
problems because it apparently uses samba/cifs which does not
support fsync on directories. this patchset will, if it receives an EINVAL
on directory fsync, as is what appears to happen on samba/cifs, then it
will ignore it. this should help.

fixes #9833.
fixes #9630.
2018-06-01 14:57:18 -06:00
Stuart Carnie e4b3204328 fix(services/storage): Don't serialize empty group frames 2018-06-01 13:28:34 -07:00
Stuart Carnie 4b7a4868a9 fix(services/storage): Add nil checks to prevent panics
Fixes #9925
2018-05-31 14:22:19 -07:00
Stuart Carnie d42abde836 refactor(services/storage): Enhanced group support for Read RPC 2018-05-30 11:32:20 -07:00
Ben Johnson 8b44e3142c
Add optional pprof http endpoint immediately on startup.
This commit adds `debug-pprof-enabled` which will start the default
`net/http/pprof` endpoint and bind against `localhost:6060`. This
will help to debug startup performance issues.
2018-05-23 14:32:15 -06:00
Ben Johnson 8a74c6759f
Add http write throttling.
This commit adds throttling to the HTTP write endpoints based on
queue depth and, optionally, timeout. Two queues exist: `enqueued`
and `current`. The `current` queue is the number of concurrent
requests that can be processed. The `enqueued` queue limits the
maximum number of requests that can be waiting to be processed.

If the timeout is exceeded or the `enqueued` queue is full then
a `"503 Service unavailable"` code is returned and the error is
logged.

By default these options are turned off.
2018-05-21 13:08:24 -06:00
Jeff Wendling e89438f7c2 fix flaky subscriber tests
Fixes #9554.
2018-04-24 12:34:45 -06:00
Jonathan A. Sternberg a7e1da5f86 Add suppress-write-log option to disable the write log when the log is enabled 2018-04-23 12:45:48 -05:00
Stuart Carnie a8692a9e24 services/meta: improve readability of Contains function, add unit tests 2018-04-19 18:05:55 -07:00
Jacob Marble 232be14aef respect rp parameter in /query 2018-04-19 08:31:43 -07:00
Jacob Marble 321ae4ff04
update CircleCI config to 2.0 syntax (#9711)
* enable flaky test, see if CircleCI fails

* Use CircleCI 2.0 with docker layer caching

* update CONTRIBUTING
2018-04-16 12:00:44 -07:00
Jonathan A. Sternberg 8334693b47 Properly track the response bytes written for queries in all format types
The number of bytes written for CSV responses and probably MessagePack
responses was incorrect.
2018-04-09 12:42:58 -05:00
Jonathan A. Sternberg 243ed2ea5e Avoid a panic when using show diagnostics with text/csv
If the columns change between series, it will now act as if it was a new
statement id and reprint the headers. This only happens with show
diagnostics at the moment and we shouldn't add this functionality
anywhere else anyway.
2018-04-09 09:09:42 -05:00
Jonathan A. Sternberg 1b738d3991 Allow customizing the unix socket group and permissions created by the server 2018-04-05 14:40:12 -05:00
Ben Johnson 1fe9abd66f
Delete deleted shards in retention service. 2018-03-28 10:44:14 -06:00
Stuart Carnie ef2ba80ce2 don't overwrite `_measurement` for multi-tenant reads 2018-03-23 13:59:42 -07:00
Stuart Carnie 813cb1a2f6 to var () or not to var (), that is the question 2018-03-23 12:26:55 -07:00
Stuart Carnie ee3e2ad67f rename Tenant -> OrgID 2018-03-23 12:26:55 -07:00
Stuart Carnie 2cc1f5137e support for tenant+bucket
NOTE: to match storage service, values for database and rp are
hard-coded to `db` and `rp` respectively
2018-03-23 12:26:55 -07:00
Stuart Carnie aa61359cc7 Storage RPC API improvements. See PR for details
* reduce # allocations (115M -> 22M)
* reduce size allocations (53GB -> 1.3GB)
* reduce RPC query time (45s -> 12.9s)
2018-03-21 13:46:09 -07:00
Edd Robinson bdd61298ea Skip flaky test 2018-03-12 16:18:35 +00:00
Jonathan A. Sternberg 733d842812 Turn the ExecutionContext into a context.Context
Along with modifying ExecutionContext to be a context and have the
TaskManager return the context itself, this also creates a Monitor
interface and exposes the Monitor through the Context. This way, we can
access the monitor from within the query.Select method and keep all of
the limits inside of the query package instead of leaking them into the
statement executor.

An eventual goal is to remove the InterruptCh from the IteratorOptions
and use the Context instead, but for now, we'll just assign the done
channel from the Context to the IteratorOptions so at least they refer
to the same channel.
2018-03-08 14:03:20 -06:00
Jonathan A. Sternberg de4390ae83 Rename some of the structs and interfaces in the query package
Remove the `Query` prefix from some structs and interfaces. They were
there so when the query engine was in the same package as influxql,
these would be differentiated. Now that the package name is query, the
extra prefix seems redundant.
2018-03-02 09:44:12 -06:00
Stuart Carnie a74d296200 use underscore vs period, fix doc comment, add database name to CQ 2018-02-26 10:08:43 -07:00
Stuart Carnie 0a5a07dc3a series keys are produced in ascending order 2018-02-22 13:08:36 -07:00
Stuart Carnie d135aecf02 Generate trace logs for a number of significant influx operations
* tsdb Store.Open traces all events related to opening files
    * op.name : tsdb.open
* retention policy shard deletions
    * op.name : retention.delete_check
* all TSM compaction strategies
    * op.name : tsm1.compact_group
* series file compactions
    * op.name : series_partition.compaction
* continuous query execution (if logging enabled)
    * op.name : continuous_querier.execute
* TSI log file compaction
    * op_name: index.tsi.compact_log_file
* TSI level compaction
    * op.name: index.tsi.compact_to_level
2018-02-21 15:08:49 -07:00
Jonathan A. Sternberg d38413a849
Merge pull request #9454 from influxdata/js-structured-logging
Update logging calls to take advantage of structured logging
2018-02-21 09:14:40 -06:00
Jonathan A. Sternberg 2bbd96768d Update logging calls to take advantage of structured logging
Includes a style guide that details the basics of how to log.
2018-02-20 10:04:19 -06:00
Stuart Carnie 584e7ac09a Added option to write HTTP request logs to separate file. 2018-02-14 23:11:01 -07:00
Mark Rushakoff f7fc6a6501 Remove IsAdmin() method from meta.User interface
The method was only called in tests.
2018-02-13 16:59:22 -08:00
Stuart Carnie 8f978068f9
Merge pull request #9415 from influxdata/sgc-storage
restore `MetaClient`, which is needed by store
2018-02-09 07:51:36 -07:00
Andrew Hare d21ebfe531 Do not report an error when dropping a CQ on a non-existent DB/RP
This makes the behvior similar to other places in the DB where we
don't return an error when we try to drop an object from a non-
existent database.
2018-02-08 13:28:47 -06:00
Stuart Carnie 41dc96ca91 restore `MetaClient`, which is needed by store
* Switch from an anonymous type to avoid false positives with
  `megacheck`
2018-02-08 12:13:13 -07:00
Edd Robinson f19588360e
Merge pull request #9349 from influxdata/er-the-purge
Cleanup of codebase using static analysis tools
2018-01-25 17:11:53 -08:00
Patrick Hemmer 2dc2c53093 fix nil err panic in msgpack httpd WriteResponse 2018-01-23 19:54:00 -05:00
Edd Robinson 6a66b5faf0 Cleanup services package 2018-01-21 10:52:37 -08:00
Adam 938db68198
Update restore functionality to run in online mode, consume Enterprise backup files. (#9207)
* Live Restore + Enterprise data format compatability

* Extended ImportData to import all DB's if no db name given

* Added a new enterprise data test, and backup command now prints the backup file paths at conclusion

* Added whole-system backup test

* Update to use protobuf in all enterprise data cases

* Update to test to do cross-testing with enterprise version

* incremental enterprise backup format support
2018-01-10 13:59:18 -05:00
Edd Robinson 1f3352efbd
Merge pull request #9153 from influxdata/er-prom-parsing
Fix Prometheus regex parsing
2018-01-02 18:39:46 +00:00
Stuart Carnie 5dfe3b2645 inmem startup improvments
* only call ParseTags when necessary
* remove dependency on inmem.Series in tsdb test package
* Measurement and Series are no longer exported. Their use is restricted
  to the inmem package
* improve Measurement and Series types by exporting immutable
  fields and removing unnecessary APIs and locks

Reduced startup time from 28s to 17s. Overall improvement including
#9162 reduces startup from 46s to 17s for 1MM series across 14 shards.
2017-12-29 07:58:52 -07:00
Ben Johnson d8b1d208c0
rebase 2017-12-20 15:13:34 -07:00
Edd Robinson c476a0b4a1 Merge branch 'master' into er-tsi-index-part 2017-12-15 18:31:24 +00:00
Jonathan A. Sternberg 5fcf57a764 Remove extraneous newlines from the log
The newlines were accidentally kept when changing the logger. They are
not necessary and mess up the log output.
2017-12-14 16:41:42 -06:00
Stuart Carnie 0d29dc1121 add Prometheus metrics HTTP endpoint 2017-12-11 08:51:40 -07:00
Edd Robinson 7d13bf3262 merge master 2017-12-08 17:21:58 +00:00
Edd Robinson f6835632e7 Merge master into branch 2017-12-08 17:11:07 +00:00
Adam a0b2195d6b
Pulled in backup-relevant code for review (#9193)
for issue #8879
2017-12-07 11:35:20 -05:00
Jonathan A. Sternberg 95e1e3b332
Merge pull request #8015 from influxdata/js-code-coverage
Expand code coverage for undercovered packages
2017-11-29 19:30:47 -06:00
Andrew Hare d7e328050c
Merge branch 'master' into ah-truncate-shards 2017-11-28 17:25:31 -07:00
Jonathan A. Sternberg b775ad3d5d Expand unit test code coverage in services that were undercovered
This expands code coverage for the following packages:
* monitor (3.5% -> 86.9%)
* services/precreator (31.6% -> 83.8%)
* services/retention (83.0% -> 84.9%)
* services/snapshotter (0.0% -> 82.1%)
* tcp (48.7% -> 60.0%)
2017-11-28 15:44:35 -06:00
Edd Robinson 8e3d29ec7a Fixes #9134.
This converts Prometheus' regex syntax for a condition value into InfluxDB's.
2017-11-27 11:19:01 +00:00
Stuart Carnie 7cdfd95966 initial opentrace implementation for ifql interface
NOTE: does not include a default tracer until configuration across
projects is standardized
2017-11-22 14:42:26 -07:00
Ben Johnson fc966a1b67
Add series file backup/restore. 2017-11-22 08:55:54 -07:00
Stuart Carnie 89877d7764 ifql: writer tracks estimated size (bytes) to limit memory between Send 2017-11-20 11:33:37 -07:00
Edd Robinson c098081c7d Don't initialise a new Authorizer each query 2017-11-17 11:06:43 +00:00
Jonathan A. Sternberg 97ab61addb
Merge pull request #9092 from influxdata/jenkinsfile
Initial jenkinsfile
2017-11-14 11:12:32 -06:00
Stuart Carnie 2e04e871c9 fix descending queries
* did not handle cached values correctly
* sort shards by time in either ascending or descending
  order depending on the RPC request ordering to ensure they
  are traversed in the correct order.
2017-11-13 17:14:36 -08:00
Jonathan A. Sternberg ca5a773c34 Initial jenkinsfile 2017-11-13 14:02:23 -06:00
Jonathan A. Sternberg 0b7c56bcd8 Update the zap logger dependency
The previous sha was taken from a revision on a devel branch that I
thought would continue staying in the tree after it was merged. That
revision was rebased away and the API was changed for the logger.

This updates the usage of the logger and adds a simple package for
constructing the base logger.

The 1.0 version of zap changed the format of the default console logger
so this change moves over to this new logger instead of attempting to
retain backwards compatibility with the old format.
2017-11-10 16:27:16 -06:00
Stuart Carnie 57677be010 don't panic here; nil cursor is handled for now. fixes #9090 2017-11-10 11:21:31 -07:00
Edd Robinson 126db1b5f9
Merge pull request #9068 from influxdata/er-show-query-perf
Add time support to some meta queries
2017-11-07 15:48:58 +00:00
Stuart Carnie 6ee0c6ee0c check and flush frames while streaming points for a series
TODO(sgc): implement `writer` type that handles all the details
of writing frames to the RPC stream. Additional responsibilities
of writer include

* point frame recycling to reduce memory pressure
* skip empty point frames
* skip series frames with no points
2017-11-06 13:00:57 -07:00
Edd Robinson 98d584b63f Use index for SHOW X meta queries
When a meta query does not include a time component then it can be
answered exclusively by the index. This should result in a much faster
query execution that if the TSM engine was engaged.

This commit rewrites the following queries such that they make use
of the index where no time component is present:

  - SHOW MEASUREMENTS
  - SHOW SERIES
  - SHOW TAG KEYS
  - SHOW FIELD KEYS
2017-11-06 19:15:00 +00:00
Stuart Carnie cf2227def1 add expected data type to series frame 2017-11-06 11:12:27 -07:00
Stuart Carnie 728f5cc6ac strip series frame if no points returned 2017-11-03 17:04:33 -07:00
Stuart Carnie 10a0bb8f73 don't send empty response 2017-11-02 16:27:05 -07:00
Stuart Carnie f3d45ba301 influxdata/influxdb/influxql -> influxdata/influxql 2017-10-30 14:40:26 -07:00
Stuart Carnie d99cabb5d2 handle nil *indexSeriesCursor 2017-10-26 13:32:05 -07:00
Stuart Carnie ab17e15caf check nil iterator; check nil cursor when no data 2017-10-26 12:54:59 -07:00
Edd Robinson 2ea2abb001 Remove possibility of race when dropping shards
Fixes #8819.

Previously, the process of dropping expired shards according to the
retention policy duration, was managed by two independent goroutines in
the retention policy service. This behaviour was introduced in #2776,
at a time when there were both data and meta nodes in the OSS codebase.
The idea was that only the leader meta node would run the meta data
deletions in the first goroutine, and all other nodes would run the
local deletions in the second goroutine.

InfluxDB no longer operates in that way and so we ended up with two
independent goroutines that were carrying out an action that was really
dependent on each other.

If the second goroutine runs before the first then it may not see the
meta data changes indicating shards should be deleted and it won't
delete any shards locally. Shortly after this the first goroutine will
run and remove the meta data for the shard groups.

This results in a situation where it looks like the shards have gone,
but in fact they remain on disk (and importantly, their series within
the index) until the next time the second goroutine runs. By default
that's 30 minutes.

In the case where the shards to be removed would have removed the last
occurences of some series, then it's possible that if the database was already at its
maximum series limit (or tag limit for that matter), no further new series
can be inserted.
2017-10-26 16:15:13 +01:00
Edd Robinson 77977af685 Add repro test for #8819 2017-10-26 14:47:30 +01:00
Edd Robinson 1629ec7f5f Add tests to Retention service 2017-10-26 14:47:30 +01:00
Stuart Carnie dc04eaa8f3 Amendments based on feedback
* Fprint* functions
* No nakedness
* clarify panic messages
* spacing between case statements
* remove break in favor of return
* remove goto in favor of for { continue }
2017-10-25 13:38:07 -07:00
Stuart Carnie 415ed14c53 storage service
* storage service is disabled by default
* default port 8082
* RPC interface generated using yarpc via service.proto
2017-10-25 13:38:07 -07:00
Andrew Hare 13c3808aff Add test 2017-10-19 15:57:16 -06:00
Jonathan A. Sternberg 83ecab6299 Prevent deadlock during collectd, graphite, opentsdb, and udp shutdown
All of these services start up goroutines and then wait for the
goroutines to finish. Each of them has a `tsdb.PointBatcher` that may
return a point during the shutdown sequence. During the shutdown
sequence, a lock was held. This lock may get accessed when attempting to
write the point that came back from the `tsdb.PointBatcher`. This caused
the read lock attempt to wait forever for the write lock to be unlocked
during `Close()`.

This modifies these methods so that the write lock is released while
waiting for goroutines to finish in these three services.
2017-10-19 15:57:05 -05:00
Edd Robinson 9b55ee2b90 Merge pull request #8935 from posquit0/patch-1
Fix mis-typing in README.md of UDP Service
2017-10-18 15:57:50 +01:00
Byungjin Park f7d8ad50e2 Update README.md 2017-10-18 22:46:44 +09:00
Andrew Hare e6aa5023eb Create a command to truncated shard groups 2017-10-16 20:34:26 -06:00
Mark Rushakoff 4ed2e6f21e Minor cleanup 2017-10-13 17:28:24 -07:00
Mark Rushakoff f3f1cc1064 Initial integration tests for config settings 2017-10-11 17:16:42 -07:00
Byungjin Park f8dd2423fe Fix mis-typing in README.md of UDP Service 2017-10-08 03:09:01 +09:00
Jonathan A. Sternberg a0df2fe504 Add message pack formatter 2017-09-29 14:58:38 -05:00
Jonathan A. Sternberg b1e1a30c16 uint64 support in the csv handler 2017-09-14 10:38:30 -05:00
Paul Dix f30eba380e Add support for Prometheus remote read and write API. (#8784)
Adds a new package prometheus for converting from remote reads and writes to Influx queries and points. Adds two new endpoints to the httpd handler to support prometheus remote read at /api/v1/prom/read and remote write at /api/v1/prom/write.

The only thing used from Prometheus is the storage/remote files that are generated from the remote.proto file. Copied that file into promtheus/remote package to avoid an extra dependency.
2017-09-07 13:52:37 -04:00
Joe LeGasse a95647b720 cleanup: remove poor usage of ',ok' with maps
There are several places in the code where comma-ok map retrieval was
being used poorly. Some were benign, like checking existence before
issuing an unconditional delete with no cleanup. Others were potentially
far more serious: assuming that if 'ok' was true, then the resulting
pointer retrieved from the map would be non-nil. `nil` is a perfectly
valid value to store in a map of pointers, and the comma-ok syntax is
meant for when membership is distinct from having a non-zero value.
There was only one or two cases that I saw that being used correctly for
maps of pointers.
2017-08-30 09:49:31 -04:00
Edd Robinson 64933fea17 Support pre-existing request ID headers
Other applications or services sometimes expose a header containing a
unique ID, which can then be included in logging or response information
to allow an operator to link inter-service requests. The most common
header name used by services in the wild appears to be `X-Request-ID`,
but `Request-Id` is also used.

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

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

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

If neither header is specified, then in line with previous behaviour, we
generate a v1 UUID.
2017-08-23 13:42:33 +01:00
Edd Robinson 6b749f459e Merge pull request #8572 from influxdata/er-log-response
Log server error response messages
2017-08-16 23:17:57 +01:00
Jonathan A. Sternberg 8bd04ebe39 Remove TimeRange function and replace with a more accurate ConditionExpr function
The ConditionExpr function is more accurate because it parses the
condition and ensures that time conditions are actually used correctly.
That means that attempting to combine conditions with OR will not result
in the query silently pretending it's an AND and nested conditions work
correctly so there is only one way to read the query.

It also extracts the non-time conditions into a separate condition so we
can stop attempting to parse around the time conditions in lower layers
of the storage engine. This change does not remove those hacks, but a
following commit should be able to sanitize the condition and remove
them.
2017-08-16 16:45:35 -05:00
Edd Robinson a1d5913329 Log server error response messages
This commit provides more insight into server errors by both setting
the error on a response header, and, in the case of server errors (5xx),
logging those error messages to the HTTPD log, if [http] log_enabled =
true.
2017-08-16 21:32:58 +01:00
Jonathan A. Sternberg 9a2357c2c0 Separate the query engine into a separate package
This change provides a clear separation between the query engine
mechanics and the query language so that the language can be parsed and
dealt with separate from the query engine itself.
2017-08-16 13:38:43 -05:00
Edd Robinson 8934aacebb Adds mutex profile
Mutex profiles are now available via the:

  - /debug/pprof/mutex
  - /debug/pprof/all

endpoints.
2017-08-04 14:36:39 +01:00
Jonathan A. Sternberg 950753d036 Parse time literals using the time zone in the select statement 2017-07-27 13:05:51 -05:00
Jonathan Heusser c38d0de99d Update udp port to be in valid range
`80891` is not a valid port, changed to `8189`.
2017-07-27 13:26:37 +01:00
Connor Peet 4459e1e8d8 Return errors in CSV responses 2017-07-25 09:44:02 -05:00
Jonathan A. Sternberg 8bb80321d9 Merge pull request #8561 from influxdata/js-8525-query-http-pipelining
Support http pipelining for /query endpoint
2017-07-21 11:15:28 -05:00
Jonathan A. Sternberg 506c06241b Fixed time boundaries for continuous queries with time zones
This calculates the start and end time along with any time zones shifts
so that continuous queries are run at the correct time when a time zone
is included in the query.
2017-07-20 14:30:52 -05:00
Jonathan A. Sternberg 39591e5375 Support http pipelining for /query endpoint
Removing the forced `Connection: close` header from the `/query`
endpoint. This was originally added because of golang/go#13165, but it
seems like it's possible to use pipelining with go 1.8 and http 1.1,
just not recommended.

After some testing, it appears that the channel returned by
`ResponseWriter.CloseNotify()` will not send a value if the connection
was not interrupted. We already account for this in /query by exiting
from the goroutine if the request has finished by signaling another
channel.

Since the handler already accounts for the possibility that the channel
will not signal and since `CloseNotify()` doesn't interfere with a
pipelined request, we can remove the forced `Connection: close` that was
added to force clients to establish a new connection.
2017-07-20 09:38:01 -05:00
Jonathan A. Sternberg f7d07910aa Fix the cq start and end times to use unix timestamps
The Go timestamp leads Truncate to start a week on Monday, but the query
engine uses unix timestamps which has the week start on a Thursday.

Updating the service so it uses a custom truncate method that uses the
unix timestamp instead of `time.Time`.

Fixes #8569.
2017-07-17 14:59:45 -05:00
Adam 2259ada8c3 adds a new header key/value X-Influxdb-Build that has value OSS if called from open-source build, and ENT if called from enterprise. This commit sets the value for the OSS case, and also creates the proper flag 2017-07-07 10:59:26 -04:00
Edd Robinson 12248b7233 Allow panic recovery to be disabled
This commit adds a new environment variable INFLUXDB_PANIC_CRASH, which
when set to a truthy value, e.g., true, TRUE, 1, will prevent the server
from recovering from a panic.

Recover currently occurs in two places: the HTTP handler and the
QueryExecutor. INFLUXDB_PANIC_CRASH will control both.

Further, this commit adds _internal stats that will monitor the
occurrence of panics all the time (regardless of if INFLUXDB_PANIC_CRASH
has been set to true or not).

The recovered panic frequency can be inspected with the following
queries:

SELECT "recoveredPanics" FROM "_internal"."monitor"."httpd";
SELECT "recoveredPanics" FROM "_internal"."monitor"."queryExecutor";
2017-06-29 19:44:25 +01:00
Edd Robinson e1a5ee4ede Ensure privileges can't be set on non-existent DB 2017-06-26 14:15:52 +01:00
Adam b12ee4e6ee 8426: updated code based on pull-request feedback 2017-06-23 14:59:01 -04:00
Adam 5352b5865c 8426 Updated README to describe the new configuration option 2017-06-23 09:16:39 -04:00
Adam 3ca8b90f6c 8426: Refactored config to a string to make it more intuitive to the user, and to make setting a default easier 2017-06-23 09:12:52 -04:00
Adam 766702f9bd CORE-8426: finished feature update, tests demonstrate behavior. If config is set, it will group collectd stats into a single measurement as they appear in types.db 2017-06-22 18:54:16 -04:00
Stuart Carnie aa762b96df update field keys 2017-06-13 13:32:18 +10:00
Stuart Carnie 2de52834f0 CQ statistics written to monitor database, addresses #8188
* off by default, enabled by `query-stats-enabled`
* writes to cq_query measurement of configured monitor database
* see CHANGELOG for schema of individual points
2017-06-10 09:20:38 +08:00
Stuart Carnie 099371f2e7 Add config test; add negative value test 2017-06-06 08:42:45 +08:00
Stuart Carnie cac5dbfa5a NEW max-body-size config; HTTP 413 if body exceeds max size; fixes #8299 2017-06-05 21:38:33 +08:00
Stuart Carnie 55d1ba6d79 rework gzip compressor so it is lazily created for 200 OK requests only
* fix issue when panicking (before Write) gzip writer is closed, causing
header to be written and default status of 200 OK being written.
* update recovery middleware to set 500 Internal Server Error
2017-06-05 21:38:32 +08:00
Ryan Betts 19ef39d947 Merge pull request #8437 from influxdata/jl-points-auth
Fine Grained Authorization
2017-05-31 10:23:49 -04:00
Jonathan A. Sternberg 6a78f1cf4a URL query parameter credentials take priority over Authentication header 2017-05-30 09:26:24 -05:00
Stuart Carnie 8d8a7a0bfe pass meta.User to avoid future search requests 2017-05-26 15:05:38 -07:00
Stuart Carnie 47f97ea134 use parsed measurement and models.Tags 2017-05-26 13:21:59 -07:00
Stuart Carnie cec0712141 Add authorization error behavior API 2017-05-26 13:21:59 -07:00
Joe LeGasse 815f740f4c initial fga work
wip

wip

fix tests / build
2017-05-26 13:16:27 -07:00
David Norton c345f5d700 remove unused NewShardOwner func 2017-05-25 11:37:08 -04:00
Edd Robinson b4a427f9a2 Address PR feedback 2017-05-15 14:41:51 +01:00
Edd Robinson 1cbbaa9317 Add support for shards, stats and diagnostics 2017-05-15 14:12:00 +01:00
Edd Robinson 8f8ff0ec61 Adds handler for returning a profile archive
Currently, when debugging issues with InfluxDB we often ask for the
following profiles:

  curl -o block.txt "http://localhost:8086/debug/pprof/block?debug=1"
  curl -o goroutine.txt
"http://localhost:8086/debug/pprof/goroutine?debug=1"
  curl -o heap.txt "http://localhost:8086/debug/pprof/heap?debug=1"
  curl -o cpu.txt "http://localhost:8086/debug/pprof/profile

This can be bothersome for users, or even difficult if they're
unfamiliar with cURL (or it's not on their system).

This commit adds a new endpoint: /debug/pprof/all which will return a
single compressed archive of all of the above profiles. The CPU profile
is optional, and not returned by default. To include a CPU profile the
URL to request should be: /debug/pprof/all?cpu=true. It's also possible
to vary the length of the CPU profile by adding a `seconds=x` parameter,
where x defaults to 30, if absent.

The new command for gathering profiles from users should now be:

  curl -o profiles.tar.gz "http://localhost:8086/debug/pprof/all"

Or, if we need to see a CPU profile:

  curl -o profiles.tar.gz
"http://localhost:8086/debug/pprof/all?cpu=true"

It's important to remember that a CPU profile is a blocking operation
and by default it will take 30 seconds for the response to be returned
to the user.

Finally, if the user is unfamiliar with cURL, they will now be able to
visit http://localhost:8086/debug/pprof/all in a web browser, and the
archive will be downloaded to their machine.
2017-05-15 14:11:38 +01:00
Jason Wilder 2cac46ebbc Convert usage of strings to []byte
Measurement name and field were converted between []byte and string
repetively causing lots of garbage.  This switches the code to use
[]byte in the write path.
2017-05-12 14:05:19 -06:00
Jonathan A. Sternberg 2780630a5f Track HTTP client requests for /write and /query with /debug/requests
After using `/debug/requests`, the client will wait for 30 seconds
(configurable by specifying `seconds=` in the query parameters) and the
HTTP handler will track every incoming query and write to the system.
After that time period has passed, it will output a JSON blob that looks
very similar to `/debug/vars` that shows every IP address and user
account (if authentication is used) that connected to the host during
that time.

In the future, we can add more metrics to track. This is an initial
start to aid with debugging machines that connect too often by looking
at a sample of time (like `/debug/pprof`).
2017-05-09 10:18:33 -05:00
Jonathan A. Sternberg 260bdef3d4 Set the CSV output to an empty string for null values 2017-05-04 20:51:58 -05:00
Stuart Carnie 8097e817f6 prefix partial write errors with `partial write:`
NOTE: parser errors (via http API) are also transformed into
PartialWriteError
2017-04-28 11:00:14 -07:00
Jonathan A. Sternberg 1300f4cc6c Remove the admin UI 2017-04-25 16:58:24 -05:00
Jonathan A. Sternberg 45895862b7 Merge pull request #8058 from karlding/service-golinting
Make services/{admin, httpd, subscriber, udp} golintable
2017-04-05 12:30:11 -05:00
Karl 10b7f86368 Make services/subscriber golintable 2017-04-03 18:32:36 -04:00
Karl 08b3dbcbc7 Make services/udp golintable 2017-04-03 18:32:36 -04:00
Karl 616224695a Make services/httpd golintable 2017-04-03 18:32:36 -04:00
Karl 4171d6a843 Make services/admin golintable 2017-04-03 18:32:36 -04:00
Edd Robinson fddaff2cc8 Merge master in 2017-03-29 18:00:28 +01:00
Jason Wilder 8f7b251afd Merge branch 'master' into jw-tsi 2017-03-20 17:17:26 -06:00
Edd Robinson 255992f5ec Reduce cost of admin user check
This commits adds a caching mechanism to the Data object, such that
when large numbers of users exist in the system, the cost of determining
if there is at least one admin user will be low.

To ensure that previously marshalled Data objects contain the correct
cached admin user value, we exhaustively determine if there is an admin
user present whenever we unmarshal a Data object.
2017-03-20 12:04:03 +00:00
Jonathan A. Sternberg 9cdfdd04e9 Do not increment the continuous query statistic if no query is run
Instead of incrementing the `queryOk` statistic with or without the
continuous query running, it will only increment when the query is
actually executed.
2017-03-16 10:36:00 -05:00
Ben Johnson 358b1e0b05
Merge remote-tracking branch 'upstream/master' into tsi 2017-03-15 10:13:32 -06:00
Jason Wilder e62c72d1f9 Merge branch '1.2' into jw-merge-12 2017-03-14 15:15:50 -06:00
Jason Wilder c9740f753b Disable max-row-limit by default
max-row-limit was set at 10000 since 1.0, but due to a bug it was
effectively 0 (disabled).  1.2 fixed this bug via #7368, but this
caused a breaking change w/ Grafana and any users upgrading from <1.2
who had not disabled the config manually.
2017-03-14 12:47:32 -06:00
Mark Rushakoff 535cf597f1 Report subset of config values in SHOW DIAGNOSTICS
This includes hand-selected config settings that are safe to expose and
not expected to include any kind of secrets.

Fixes #7821
2017-03-14 11:34:19 -07:00
Jason Wilder 675d7c9d65 Merge branch '1.2' into jw-merge12 2017-03-06 11:09:05 -07:00
David Norton c7fa58473f fix #8028: call api.NewTypesDB() instead of new
The code was calling new(api.TypesDB) which didn't initialize an
unexported map inside of the type. Call api.NewTypesDB() instead.
2017-02-23 18:04:21 -05:00
Mark Rushakoff 601cbcd084 Merge branch '1.2' into mr-merge-12 2017-02-17 16:14:22 -08:00
Jonathan A. Sternberg 2fe48d6781 Rename zap import back to github.com/uber-go/zap
They rebased a revision we were previously relying upon that allowed us
to use the vanity name so we are reverting back to an older version with
the old import path.
2017-02-17 17:17:22 -06:00
Mark Rushakoff 53699aa24f Allow non-admin users to execute SHOW DATABASES
This commit introduces a new interface type, influxql.Authorizer, that
is passed as part of a statement's execution context and determines
whether the context is permitted to access a given database. In the
future, the Authorizer interface may be expanded to other resources
besides databases. In this commit, the Authorizer interface is
specifically used to determine which databases are returned when
executing SHOW DATABASES.

When HTTP authentication is enabled, the existing meta.UserInfo struct
implements Authorizer, meaning admin users can SHOW every database, and
non-admin users can SHOW only databases for which they have read and/or
write permission.

When HTTP authentication is disabled, all databases are visible through
SHOW DATABASES.

This addresses a long-standing issue where Chronograf or Grafana would
be unable to list databases if the logged-in user did not have admin
privileges.

Fixes #4785.
2017-02-13 08:59:16 -08:00
Carlo Alberto Ferraris 005e480b55 [influxd] add utility functions to make it harder to misuse gzipWriterPool 2017-02-09 09:31:11 +09:00
Carlo Alberto Ferraris a6a7782e04 [influxd] Use a sync.Pool to reuse gzip.Writer across requests
This brings alloc_space down from ~20200M to ~10700M in a run of
go test ./cmd/influxd/run -bench=Server -memprofile=mem.out -run='^$'
2017-02-07 05:23:58 +09:00
Edd Robinson 366223140d Add system information to /debug/vars 2017-01-30 18:23:21 +00:00
Edd Robinson 91ee34b111 Merge pull request #7837 from influxdata/er-tidy
General tidy up and subtle bug fixes
2017-01-26 13:43:07 +00:00
Ben Johnson 047c21f4d9
Merge remote-tracking branch 'upstream/master' into tsi 2017-01-24 09:28:58 -07:00
Edd Robinson 63562d9fd5 Fixes #7860.
Fix a regression introduced in #7449.

This commit ensures that create database with retention policy will work
correctly.
2017-01-23 19:01:13 +00:00
Edd Robinson 4442cd7efa Fixes #7860.
Fix a regression introduced in #7449.

This commit ensures that create database with retention policy will work
correctly.
2017-01-23 17:57:32 +00:00
Edd Robinson feb7a2842c Use unbuffered error channels in tests 2017-01-17 10:53:15 -08:00
Edd Robinson 9d30ee0a6b Fix subtle bugs and remove dead code from services 2017-01-17 09:47:34 -08:00
Edd Robinson c47be5bb56 Ensure subscriber service respects config 2017-01-13 22:15:01 +00:00
Edd Robinson aa6b85a2dc Ensure subscriber service respects config 2017-01-13 20:09:40 +00:00
Joe LeGasse 2db0250b22 Add db/rp name validation
This change adds some very basic name validation with the following
plain-english description: names must be non-zero sequence of printable
characters that do not contain slashes ('/' or '\') and are not equal to
either "." or "..".

The intent is that, since we currently just use database and retention
policy names directly as path elements, these rules will hopefully leave
us with names that should be at least close to valid directory names.

Ideally, we would restrict names even further or not use them as path
elements directly, but this should be a step towards the former without
restricting names "too much"
2017-01-12 17:38:10 -05:00
Jason Wilder ccdb68841b Merge pull request #7820 from influxdata/cjl-7689-sgi-unix-epoch-zero-time
fix marshaling of zero time
2017-01-12 12:34:48 -07:00
Cory LaNou c6dc164537
fix marshaling of zero time 2017-01-11 12:00:18 -06:00
Mark Rushakoff ede3f3337d Merge pull request #7818 from influxdata/mr-config-validation
Add more config validation
2017-01-11 07:41:32 -08: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
Mark Rushakoff bbb43faad2 Add more config validation 2017-01-10 10:28:49 -08:00
Mark Rushakoff a135906b43 Merge pull request #7747 from influxdata/mr-lint-cleanup
Miscellaneous lint cleanup
2017-01-10 08:22:00 -08: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
Ben Johnson 2b3cd415e2
Fixing rebase. 2017-01-06 09:52:16 -07:00
Edd Robinson 33623c1fa9
Revert back to original approach 2017-01-05 09:58:39 -07:00
Edd Robinson 05bc4dec00
Refactor 2017-01-05 09:50:23 -07:00
Mark Rushakoff 6a94d200c8 Merge remote-tracking branch 'influx/master' into mr-godoc 2017-01-04 13:27:36 -08:00
Cory LaNou 3c518f8927
panicing is bad -> error returns are good 2017-01-03 14:28:29 -06:00
Mark Rushakoff 07b87f2630 Miscellaneous lint cleanup 2017-01-03 09:47:32 -08: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
Mark Rushakoff 218fc3890d Update godoc for services
The admin service was deliberately skipped due to it being deprecated.
2016-12-30 18:03:01 -08:00
Gustav Westling 13efbc6ce0
Removed empty line 2016-12-30 12:22:09 +01:00
Gustav Westling a8343dee99
Fix broken test. Change Fatalf to Fatal. 2016-12-29 20:41:00 +01:00
Gustav Westling 56d98325da
Removed ineffective assignments, and added checks for errors that previsouly was not checked 2016-12-29 20:26:15 +01:00
Cory LaNou 572da8985c enforce minimum shard duration when creating retention policies 2016-12-20 09:11:43 -06:00
Jonathan A. Sternberg ec57108520 Use proper uber-go/zap import path
It looks like the real import path to the project is go.uber.org/zap
instead of github.com/uber-go/zap since the example in the project
references that path.
2016-12-15 08:54:14 -06:00
Mark Rushakoff eceecf4cfa Merge pull request #7721 from influxdata/mr-fix-flaky-port-tests
Bind to random port in service open/close tests
2016-12-14 10:03:26 -08: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
Mark Rushakoff ede3144300 Bind to random port in service open/close tests
These tests have been flaky on Circle in the past due to those specific
ports being in use. Binding to port 0 will pick a random, available
port.
2016-12-14 08:29:29 -08:00
Allen Petersen 5b25a93b45 Clean error and log messages 2016-12-07 12:54:41 -08: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
Edd Robinson aff2d7ce64 Ensure user privs dropped along with db (#7677) 2016-12-02 18:23:35 +00:00
Cory LaNou d54d32b9d4
prune shards in meta data 2016-12-01 11:22:16 -06:00
Jonathan A. Sternberg 825aa07877 Use X-Forwarded-For IP address in HTTP logger if present 2016-12-01 09:16:36 -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