Commit Graph

222 Commits (e5b2f8c11fbef1a99b449edbf65ba1531b950c31)

Author SHA1 Message Date
Jeff Wendling f53f9cd949 storage: detect conflicting types in a single batch of points
When the WAL was moved up, the validation that happened at the cache
was skipped. This moves the field type validation for a batch of
points up ahead of the WAL again.
2019-03-06 10:30:52 -07:00
Stuart Carnie da24fe6c7f feedback(reads): Clear r.buf before read 2019-03-05 11:45:51 -07:00
Stuart Carnie acc94985e3 fix(reads): Add retry when fetching data from StreamReader
It is possible a StreamReader (gRPC) may return an empty response. This
change adds retry and bail-out support. When a bail-out occurs,
reads.ErrStreamNoData is returned.
2019-03-05 11:45:51 -07:00
Stuart Carnie 28976e9b92 feat: Allow StreamReader to provide cursors.CursorStats
StorageReadClient adapts a gRPC Storage_ReadClient to provide
cursors.CursorStats by reading the trailer after receiving the final
message from the stream.
2019-03-05 11:45:51 -07:00
Stuart Carnie 5f241e5e5e fix(reads): Read Statistics before calling Close 2019-03-05 11:45:51 -07:00
Jacob Marble b9c7ec439e
feat(influxd): Tracing refactor (#12318)
* feat(launcher): Tracing to log disabled by default

* remove traceLogger and use opentracing directly

* add Jaeger tracing

* go vet && go fmt
2019-03-04 11:48:11 -08:00
Jeff Wendling 0fae44e219 storage: fix problems with keeping resources alive
This commit adds the pkg/lifecycle.Resource to help manage opening,
closing, and leasing out references to some resource. A resource
cannot be closed until all acquired references have been released.
If the debug_ref tag is enabled, all resource acquisitions keep
track of the stack trace that created them and have a finalizer
associated with them to print on stderr if they are leaked. It also
registers a handler on SIGUSR2 to dump all of the currently live
resources.

Having resources tracked in a uniform way with a data type allows us
to do more sophisticated tracking with the debug_ref tag, as well.
For example, we could panic the process if a resource cannot be
closed within a certain time frame, or attempt to figure out the
DAG of resource ownership dynamically.

This commit also fixes many issues around resources, correctness
during error scenarios, reporting of errors, idempotency of
close, tracking of memory for some data structures, resource leaks
in tests, and out of order dependency closes in tests.
2019-02-28 10:22:01 -07:00
Jonathan A. Sternberg 70507670c3
feat(storage/reads): add scanned values and bytes metadata to the query (#12156)
This updates influxdb to use the new arbitrary metadata that can be
attached by a source and adds metadata entries for the cursor
statistics.
2019-02-25 14:44:18 -06:00
Michael Desa 0d3d0d4d78
chore(influxdb): add context to storage.PointsWriter 2019-02-25 11:11:20 -05:00
Stuart Carnie 662887c679 feedback: Simplify reader; use constants from influxdb package 2019-02-21 11:18:08 -08:00
Stuart Carnie 01b5fccfbe feat(storage): Enforce single org for series key reads 2019-02-21 11:18:08 -08:00
Alirie Gray 5f524eb92d Rename all occurences of Macro to Variable 2019-02-14 13:21:57 -08:00
Jeff Wendling 3bb765279b storage: respond to review comments 2019-02-04 12:26:26 -07:00
Jeff Wendling 3014733b20 chore: fix staticcheck issues 2019-02-04 10:32:52 -07:00
Jeff Wendling 376b347d56 wal: change deletes to be based on DeleteBucket 2019-02-04 10:32:52 -07:00
Jeff Wendling 7f54e816e3 refactor: have retention use DeleteBucketRange 2019-02-04 10:32:52 -07:00
Jeff Wendling aa12144fc7 storage: replay the WAL through the whole engine 2019-02-04 10:32:52 -07:00
Jeff Wendling 6deced1215 refactor: make the WAL part of snapshots again 2019-02-04 10:32:52 -07:00
Jeff Wendling 2989936d5a refactor: write to the WAL again 2019-02-04 10:32:52 -07:00
Jeff Wendling 2f46937527 refactor: move value package up to tsdb 2019-02-04 10:32:52 -07:00
Jeff Wendling 8dbd98ccbe refactor: change the way the engine opens and closes and reload the cache
Open and Close now proceed as best as they are able to in the presence
of errors and clean up appropriately.
2019-02-04 10:32:52 -07:00
Jeff Wendling d2ddd48eea refactor: hook up metrics and wal to storage engine
It turns out that LastModified and DiskSize are unused, and so it
was easy to change to not care about the WAL.

This hooks up metrics and starts the WAL again.
2019-02-04 10:32:52 -07:00
Jeff Wendling 95de3d52b2 refactor: use concrete WAL in tsm1
At the cost of some nil checks, we don't have to have an interface, defend against
subtle bugs with nils in non-nil interfaces, an empty implementation, etc.

Also, the tsm1 engine is losing the WAL anyway.
2019-02-04 10:32:52 -07:00
Jeff Wendling c9bb55b889 refactor: move the tsm1/wal into the storage/wal package
Because the WAL relies on the tsm1.Value type, we move that into its own
tsm1/value package and set up some aliases forwarding them into tsm1. This
also required adding some methods and changing consumers to avoid the
unexported fields. I imagine this step will be useful one day when we make
the write path more efficient with respect to consuming points.

This commit additionally fixes some issues with generation. The iterator.tmpldata
and generation for array_cursor_* were removed accidentally when removing
iterators, making those generated files stale. Restore that and regenerate.

No change in functionality.
2019-02-04 10:32:52 -07:00
Nathaniel Cook 8372859dee Merge branch 'master' into flux-staging 2019-01-15 08:35:59 -07:00
Nathaniel Cook d0603457b7 refactor(flux): make packages mirror Flux namespaces 2019-01-14 18:00:45 -07:00
Edd Robinson b025d9afa9 Improve efficiency of TSI index series drop
This commit improves the performance of a mass delete on the TSI index
by deleting at the measurement level instead of deleting each series
individually.
2019-01-14 12:46:55 +00:00
Edd Robinson 9e11602b6a Add DeleteBucket benchmark 2019-01-14 12:46:55 +00:00
Nathaniel Cook 1708a41fa7 refactor: update query functions for Flux builtins 2019-01-11 13:11:57 -07:00
Jonathan A. Sternberg a59e6b8d25 refactor: rename DoArrow to Do (#2372)
See influxdata/flux#783 for details.
2019-01-10 10:30:25 -07:00
Mark Rushakoff d73d73c0d4 chore: rename imports from platform to influxdb
I did this with a dumb editor macro, so some comments changed too.

Also rename root package from platform to influxdb.

In interest of minimizing risk, anyone importing the root package has
now aliased it to "platform" so that no changes beyond imports were
necessary in those files.

Lastly, replace the old platform module to local path /dev/null so that
nobody can accidentally reintroduce a platform dependency while
migrating platform code to influxdb.
2019-01-09 20:51:47 -08:00
Jeff Wendling 703c3c15ca Hook up DeleteBucket to the tsm1 engine 2019-01-09 15:24:26 -07:00
Edd Robinson 42ff769f1c Wire up storage.Engine to HTTP BucketService 2019-01-09 15:09:56 +00:00
Edd Robinson e3ae256782 Add storage bucket service
The storage bucket service wraps another bucket service, and invokes
actions on a storage engine based upon the actions taken upon buckets.

Currently, the storage bucket service will delete bucket data from the
storage engine when the bucket is deleted via the bucket service.
2019-01-09 13:35:25 +00:00
Edd Robinson 5a12a3a72e Export access to bucket drop in engine 2019-01-09 13:35:07 +00:00
Nathaniel Cook 89f4525841 build(Makefile): fix various bug with makefiles
Fixes subdir ordering.
Works around issue with stringer not working with Go modules.
Fixes issues with generated code being ignored.

Fixes #2044
2018-12-19 17:02:19 -07:00
Nathaniel Cook d6c0a393b0 Merge branch 'master' into flux-staging 2018-12-19 11:30:55 -07:00
Nathaniel Cook 61e36cbee6 chore(Makefile): add target to check generated files are accurate
A standard Makefile is used now in all subdirs that run go generate.
Make will only generate the file if its source files changed.
The checkgenerate target runs clean to ensure all targets a generated
fresh.
2018-12-18 12:54:17 -07:00
Jonathan A. Sternberg cc93531400 fix(storage): convert the storage table interface to use arrow buffers
The table interface was modified to expose the arrow buffers. The
storage table has now been converted to use this interface with the same
fixes so that it exposes arrow buffers.

The influxql package has also been updated to use the `DoArrow` method
from the `flux.Table` interface.
2018-12-18 09:47:53 -07:00
Ben Johnson 0541d568bd
fix(storage): Extend lock during stats fetch to prevent race 2018-12-13 11:13:20 -07:00
Stuart Carnie 8c296dd20a
fix(storage): Add unit tests to verify nil cursor
When matching series have no data, the NewGroupResultSet cursor should
return nil. Added tests to verify these conditions.
2018-12-12 14:27:11 -07:00
Stuart Carnie f2891c3f59
fix(storage): Fix panic when read request results in empty an group
Moves the check to determine if a series has data for the current time
range into the groupBySort function, which is consistent with the
groupNoneSort function.
2018-12-12 13:22:02 -07:00
Stuart Carnie 8f8311a3ae
chore(gen): Add ingen generator data structures to platform for reuse 2018-12-11 17:45:57 -07:00
Edd Robinson c4b42c72be Add option to disable TSI metrics 2018-12-10 15:02:26 +00:00
Edd Robinson b015757c06 Ensure all tsi1 metrics support multiple instances 2018-12-07 14:32:34 +00:00
Edd Robinson bff655786f Ensure tsdb metrics properly registered 2018-12-07 14:32:34 +00:00
Edd Robinson aa936df138 Ensure all tsm1 metrics support multiple instances 2018-12-07 14:32:34 +00:00
Edd Robinson f9a2f7a017 go fmt 2018-12-07 14:32:34 +00:00
Edd Robinson 7960ccc320 Add TSI index metrics 2018-12-07 14:32:34 +00:00
Edd Robinson d1fe2bc188 Add series file metrics 2018-12-07 14:32:34 +00:00
Edd Robinson 4e67e37ca6 Fix bug with engineID 2018-12-07 14:32:34 +00:00
Edd Robinson 8ca637bd80 Refactor default labels and retention metrics 2018-12-07 14:32:34 +00:00
Edd Robinson 44e5fbae0a Convert WAL stats 2018-12-07 14:32:34 +00:00
Edd Robinson f56bc0853f Convert TSM compaction stats to Prom metrics
This commits converts all the 1.x TSM compaction statistics, which
previously were written to an _internal db, to Prometheus metrics.
2018-12-07 14:32:34 +00:00
Jacob Marble b3e5e9fc31 feat(storage): return cost stats with read response via gRPC trailer 2018-12-05 15:32:41 -08:00
Edd Robinson 9403c1ec8e Ensure error strings not capitalised ST1005 2018-11-30 10:54:24 +00:00
Ben Johnson 0084d4d824
Remove influxdb dependency. 2018-11-29 11:44:22 -07:00
Ben Johnson 868fdbbe03
megacheck 2018-11-28 15:52:11 -07:00
Ben Johnson 1862b4421d
Integrate scanned values statistics tracking. 2018-11-28 15:32:06 -07:00
Mark Rushakoff a06d4dea16 refactor(query): explicitly shut down query controller
The flux query controller was updated to include a Shutdown method a
while ago. Explicitly handle query controller creation and shutdown
where applicable.

In influxd, this ensures that outstanding queries are handled before the
process dies. In tests, this ensures that query controller goroutines
aren't leaked, which drastically simplifies reading full stack traces.

This change also registers query controller metrics with the prometheus
registry in influxd.
2018-11-26 16:13:19 -08:00
Christopher M. Wolff a3ad02288b
Remove use of verbose from control.Config (#1573) 2018-11-26 16:02:41 -07:00
jlapacik 2b52224e84 update flux dependency - add missing Statistics() methods 2018-11-26 13:19:14 -08:00
Stuart Carnie f3d15be61b
chore: Add key order sanity check to StreamReaders 2018-11-21 12:01:36 -07:00
Stuart Carnie 8920dab57a
feedback: Changes per PR feedback 2018-11-21 12:01:36 -07:00
Stuart Carnie 831e2ab943
feat(reads): Implement merge operation for []reads.GroupResultSet
Specifically the currently supported GroupNone and GroupBy operations
2018-11-21 12:01:36 -07:00
Stuart Carnie 268a52148a
feat(reads): Implement merge operation for []reads.ResultSet 2018-11-21 12:01:36 -07:00
Stuart Carnie 7fb015cc7f
chore: Add GroupBy benchmark 2018-11-21 12:01:36 -07:00
Stuart Carnie 26408dc1fa
chore(reads): Document ResultSet and GroupResultSet APIs; add func Err
* add option to Group sort to specify precedence of `nil`
* improve unit tests for GroupResultSet implementation
2018-11-21 12:01:35 -07:00
Stuart Carnie 0237059d05
feat(reads): Implement ResultSet and GroupResultSet for protobuf streams 2018-11-21 12:01:35 -07:00
zhulongcheng 36a2818caa fix(storage): missing `continue` 2018-11-13 00:08:43 +08:00
Jeff Wendling 39f4908946 fix(storage): allow disabling the WAL
We were passing a non-nil tsm1.Log containing a nil *tsm1.WAL which
would cause a panic when it was attempted to be used. Instead, always
pass a non-nil WAL.

We change the storage engine code to not pass in a nil WAL, and
additionally add a defensive check to change any nil WALs into a
NopWAL.
2018-11-09 10:45:24 -07:00
Jeff Wendling 4b504b84df respond to review feedback
- Add some documentation.
- Move compaction planner to an option instead of config.

The latter fits with the general theme of having config be things
that can be specified in a toml, and everything else being an
option.
2018-11-08 11:39:36 -07:00
Jeff Wendling a1b5b322bb some more refactoring
- add helpers to get directories out
- change FileStoreObserver to be an option rather than config.
2018-11-08 11:39:36 -07:00
Jeff Wendling 22e23d6e31 final touches
- move default directories to the storage package
- make the directory layout match before
- clean up some dead missed functions
2018-11-08 11:39:36 -07:00
Jeff Wendling 2cbc2ee896 refactor wal out, paths, and options 2018-11-08 11:39:36 -07:00
Jeff Wendling c2a4b1ea7a clean up compat documentation some 2018-11-08 11:39:36 -07:00
Jessica Obermark 932b0bf01a compat: Package to convert old to new config 2018-11-08 11:39:36 -07:00
Jeff Wendling 0d411023f2 config: clean up
- Breaks the weird cycle that existed with the EngineOptions
- Removes a bunch of useless parameters
- Moves around a bunch of defaults
2018-11-08 11:39:36 -07:00
Christopher M. Wolff e95fb9cc9a
Fix error where _start or _stop where redundantly added to group key (#1308) 2018-11-05 14:06:08 -08:00
Stuart Carnie 56510ba0dc
Merge pull request #1262 from influxdata/sgc-fix-race
Fix race condition as `Close` was called by multiple goroutines
2018-11-01 14:22:32 -07:00
Mark Rushakoff 985c260af7 chore(storage,tsdb): fix megacheck errors 2018-11-01 12:54:46 -07:00
Adam 8a1fecd727
to() for influxdb (#1194)
* update to latest flux master incl. values interface refactor, type inference, planner.  

* add measurementColumn parameter, update function params spec
2018-11-01 14:44:56 -04:00
Stuart Carnie b7d9505ac1
fix(reads): Fix race condition when done channel was triggered
tl;dr
Previously, `Close` was being called concurrently by multiple
goroutines, resulting in a race condition. This commit resolves those
issues.

Background

The `Close` method was performing multiple duties, closing resources
and triggering that the table reading by the `Do` method was done.

Additionally, state to track whether more records existed and if the
table was empty, was ported from the more complicated gRPC
implementation. This logic has been simplified.

This new behavior:

* `table#Do` is responsible for triggering it is done, by closing the
  done channel
* The creator of the `table` is responsible for releasing the resources
  by calling the `table#Close` method
* The `table#Do` reading can be cancelled by calling the `Cancel`
  function, which is safe for concurrent use.
* the Do and Close methods are protected by a mutex to protect storage
  resources, such as cursors.
2018-11-01 11:35:36 -07:00
Nathaniel Cook 2a1d76eb2d chore: Update flux dependency for the type-inference changes 2018-10-31 17:11:11 -06:00
Stuart Carnie 869068de69
fix(reads): Ensure storage resources are cleaned
Move variable declarations outside the for loops and use nil
to test for resource ownership. defer function tests for nil and
will close resource.
2018-10-31 11:04:47 -07:00
Chris Goller d8548d41e1 chore(fmt): update formating with make fmt 2018-10-30 07:40:28 -05:00
Edd Robinson 46a7b8155a
Merge pull request #1170 from zhulongcheng/rm-index
refactor(tsdb): remove tsdb.Index and tsdb.IndexSet
2018-10-30 11:10:54 +00:00
Jonathan A. Sternberg 67dc4d8cdd
fix: conform to logging style guide for initial log messages
These are the log messages that get printed immediately when starting
the application for the first time. This fixes the messages to conform
to the logging style guide.
2018-10-29 16:42:55 -05:00
zhulongcheng 9d29874e20 move SeriesFileDirectory constant to defaults package 2018-10-27 02:08:31 +08:00
zhulongcheng c89c79dc02 replace tsdb.Index interface with tsi1.Index instance
This fix is to remove tsdb.Index interface to resolve #886.
2018-10-27 02:08:31 +08:00
zhulongcheng 28fecc1f6f replace tsdb.IndexSet with tsi1.Index
This fix is to remove tsdb.IndexSet to resolve #886.
2018-10-27 02:08:31 +08:00
Stuart Carnie 49c3ea786f
fix(reads): Fix panic when performing filters on value data
Fixes #1188
2018-10-25 13:02:59 -07:00
Adam 98be8bcd32
moved to_http and to_kafka to flux and update to latest flux (#1175) 2018-10-24 12:33:43 -04:00
Jacob Marble f33e13a036 storage: Add MeasurementCardinalityStats and MeasurementStats to Engine 2018-10-18 11:10:21 -07:00
Adam ea4c08b327
(feat/query): implement a buckets() source function that retrieves all buckets and retention policy information for the active organization. (#1045) 2018-10-17 10:21:39 -04:00
Mark Rushakoff d479c330fe fix(storage): avoid data race on table Done channel
Fixes #1021.
2018-10-16 08:21:13 -07:00
Jeff Wendling 30418ca2f5 fix(storage): WithEngineID and WithNodeID no longer panic
Both of these options would dereference a nil pointer when attempting
to apply. Instead, set the field to be the address of an integer
containing the right value.
2018-10-15 12:44:46 -06:00
Jonathan A. Sternberg 5c8318d181
Merge pull request #1080 from influxdata/js-go-generate-with-go-run
refactor: modify tooling to take advantage of go run
2018-10-15 11:27:13 -05:00
Jeff Wendling ce3e1fa90d Remove the fields index
This commit removes the remaining bits of the fields index. In doing
so, the buildCursor method on the engine would need to be updated.
It turns out, that code was statically dead, so delete it and anything
that depended on it. Additionally, delete anything as reported by
the unused tool in the tsdb package.
2018-10-15 10:22:07 -06:00
Jonathan A. Sternberg e9600b1f0b
refactor: modify tooling to take advantage of go run
The generate commands have been modified to take advantage of the new
functionality in Go 1.11 that allows `go run` to execute a package
instead of individual files.

This functionality combined with Go modules allows us to execute a
package directly out of our pinned dependencies rather than accidentally
picking up another binary outside of the build environment.

This also simplifies the Makefile because they no longer have to be
responsible for installing the correct tooling since the Go command
takes care of that logic. It also makes it so that the Makefiles with
file generation can now be invoked from their appropriate subdirectories
so they are contained within the directory itself rather than relying on
values in the top level Makefile.

It is now possible to generate all files within this project by using:

    go generate ./...

Or the Makefile can continue to be used.

This commit also copies over the special copy of `tmpl` that the storage
engine uses within the influxdb repository. It was never copied over so
using `go generate` on these packages did not work.
2018-10-15 11:01:27 -05:00
Stuart Carnie 025241629d fix(reads): Ensure error returned from f is captured 2018-10-11 13:41:54 -07:00
Chris Goller 9298a761de fix(storage/retention): change from string to platform.ID
Co-Authored-by: Jeff Wendling <jeff@influxdata.com>
2018-10-11 09:54:19 -05:00
Chris Goller 919aae41c8 refactor(id): update storage, read, and flux from to use IDs 2018-10-11 09:54:19 -05:00
Jonathan A. Sternberg e7e17d6972
refactor: move the logger package from influxdb to platform
We are moving the necessary code for 2.0 from the influxdb 1.X
repository to the platform 2.0 repository. The logger is an unnecessary
dependency on the old influxdb that is making life more complicated.
2018-10-10 15:49:07 -05:00
Edd Robinson f815dcfeb7 Schedule retention enforcer from within engine 2018-10-10 15:45:26 +01:00
Edd Robinson d5ed17adb2 Rename retention service 2018-10-10 15:40:08 +01:00
Edd Robinson 1f2f03d93b Open/close Retention properly 2018-10-10 15:40:08 +01:00
Edd Robinson 031bb7f502 Add prom metrics 2018-10-10 15:40:08 +01:00
Edd Robinson 4597fdea48 Wire Retention service into engine 2018-10-10 15:40:08 +01:00
Edd Robinson 54d1ac09c1 Integrate Retention metrics 2018-10-10 15:40:08 +01:00
Edd Robinson 116456534a Initial Retention Service 2018-10-10 15:39:27 +01:00
Adam 195eb04350
Chore/move from function to platform (#1013)
* moved execution code for from into query/functions/inputs

* rebase with master, disable buckets accessed test
2018-10-09 20:36:41 -04:00
Jeff Wendling 5fa04a8d56 share some more code with reads 2018-10-09 09:51:13 -06:00
Jeff Wendling 6256926563 fix generation and rerun it with the go.mod gogofaster 2018-10-09 09:51:13 -06:00
Jeff Wendling 810833f33f chore: refactor reads service and make it consumable externally
This pulls in the code that allows doing reads with flux into the
platform repo, and removes extra.go.

The reusable portion is under storage/reads, where the concrete
implementation for one of the platform's engines is in
storage/readservice.

In order to make this more reusable, the cursors had to move into
their own package, decoupling it from all of the other code in the
tsdb package. tsdb/cursors is this new package, and type/function
aliases have been added to the tsdb package to point at it.

The models package already is very light on transitive dependencies
and so it was allowed to be depended on in a concrete way in the
cursors package.

Finally, the protobuf definitions for issuing GRPC reads has been
moved into its own package for two reasons:
    1. It's a clean separation, and helps keep it that way.
    2. Many/most consumers will not be using GRPC. We just
       use the datatypes to express the API which helps making
       a GRPC server easier.
It is left up to future refactorings (specifically ones that involve
GPRC) to determine if these types should remain, or if there is a
cleaner way.

There's still some dependencies on both github.com/influxdata/influxql
and github.com/influxdata/influxdb/logger that we can hopefully remove
in future refactorings.
2018-10-09 09:51:13 -06:00
Jeff Wendling 0360fc418c Remove empty index package for tsi1 2018-10-08 13:18:30 -06:00
Jeff Wendling 260ed3eb13 chore: don't depend on details of what platform.ID is
It may become a uint64 in the future, for example. This does mean
that we have to call Decode on some data that we just Encoded, but
we can fix that later.
2018-10-08 12:31:39 -06:00
Edd Robinson 512a015add Address PR feedback 2018-10-05 18:01:59 +01:00
Edd Robinson 6b23165146 Add Engine tests 2018-10-05 15:04:09 +01:00
Edd Robinson 81e0fbabeb Integrate WAL into engine 2018-10-05 12:44:27 +01:00
Edd Robinson cfb3df203a Working storage engine 2018-10-04 10:24:43 +01:00
Edd Robinson 981b2cdbea Skeleton storage engine 2018-10-04 10:24:43 +01:00