Commit Graph

104 Commits (fcd425c8c62ccce9e549be7705d5a29c668e10f2)

Author SHA1 Message Date
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 dc2527ce86 Merge branch '1.0' 2016-08-31 14:45:57 -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 c05c7f6360 Revert "limit shard concurrency"
This reverts commit 6c7d56d4bc.
2016-08-29 12:39:52 -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
Edd Robinson 90ff713f21 Fix base64 encoding issue in stats
Fixes #7177.
2016-08-22 15:21:31 +01:00
Ben Johnson 8aa224b22d
reduce memory allocations in index
This commit changes the index to point to index data in the shards
instead of keeping it in-memory on the heap.
2016-08-16 14:09:00 -06: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
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
Cory LaNou 1117526873 remove IF EXISTS/IF NOT EXISTS from influxql language 2016-07-29 12:58:05 -05:00
Jonathan A. Sternberg 86bd97f3b9 Switch SHOW MEASUREMENTS and SHOW TAG VALUES to directly access the tsdb.Store
The `SHOW MEASUREMENTS` and `SHOW TAG VALUES` cannot go through the
query engine to get the speed they need. They also only need access to
the database index and do not need access to specific shards. This
removes the query rewriting that was done to turn these two queries into
a select statement and reimplements them inside of the coordinator as an
interface on the TSDBStore.
2016-07-28 17:38:11 -05:00
David Norton b1079c9080 revert previous DefaultRetentionPolicyName change 2016-07-27 11:38:42 -04:00
David Norton 8fbfdc5616 fix #7068: use DefaultRetentionPolicyName from cfg
Use DefaultRetentionPolicyName from the config instead of passing
through meta data.
2016-07-26 18:53:55 -04:00
Jonathan A. Sternberg 4121590b01 Optimize SHOW MEASUREMENTS so it consults the database index directly
SHOW MEASUREMENTS doesn't need to visit every shard in the open source
version since all of them contain the same database index.
2016-07-18 12:53:23 -05:00
Jonathan A. Sternberg 837a9804cf Refactoring the monitor service to avoid expvar
Truncate the time interval output of the monitor service to be on even
time intervals rather than on every minute based on the start time. This
normalizes the output from the monitor service.
2016-07-07 11:13:58 -05:00
Jonathan A. Sternberg 93dda3a65d Drop writes from before the retention policy time window 2016-07-05 12:29:14 -05:00
Jonathan A. Sternberg 497db2a6d3 Removing dead code from every package except influxql
The tsdb package had a substantial amount of dead code related to the
old query engine still in there. It is no longer used, so it was removed
since it was left unmaintained. There is likely still more code that is
the same, but wasn't found as part of this code cleanup.

influxql has dead code show up because of the code generation so it is
not included in this pruning.
2016-06-20 22:41:07 -05:00
Ben Johnson 48f1a6d858 Merge pull request #6820 from benbjohnson/http-query-node-id
Add NodeID to execution options
2016-06-10 13:10:15 -06:00
Jonathan A. Sternberg 9db82e6bf0 Switch ExecutionContext to be passed by value 2016-06-10 12:31:51 -05:00
Jonathan A. Sternberg 55973d2815 Separate the task manager from the query executor
The task manager now acts as its own statement executor so that a custom
statement executor can perform custom actions for KillQueryStatement and
ShowQueriesStatement.
2016-06-10 12:30:51 -05:00
Ben Johnson 7d4bea7153
add node id to execution options
This commit changes the `ExecutionOptions` and `SelectOptions` to
allow a `NodeID` for specifying an exact node to query against.
2016-06-10 09:20:44 -06:00
Jason Wilder f9379eddf2 Drop data before updating meta store
If a drop statement failed to remove state on disk, the meta store
would still be updated and you would not be able to retry the delete
leaving orphaned data around.

This reverses the logic so the data must be removed before the meta
store is updated.
2016-06-07 12:14:04 -06:00
Jonathan A. Sternberg fe3f0d0e3d Remove the DatabaseIndex method from TSDBStore interface
The TSDBStore interface needs to also allow for remote TSDBStore but the
DatabaseIndex is only for a local TSDB instance. Moved the optimized
SHOW TAG VALUES path to do a typecast to the LocalTSDBStore struct
instead of always attempting to use the optimized version.

If the TSDBStore is not local and does not have the DatabaseIndex, it
will default to using the distributed query instead.
2016-06-07 11:34:34 -05:00
Jonathan A. Sternberg b972c220aa Merge pull request #6757 from influxdata/js-refactor-execute-query
Refactor ExecuteQuery to take options as a struct
2016-06-07 10:35:52 -05:00
Ben Johnson 1b94cd2686
optimize SHOW TAG VALUES
This commit optimizes `SHOW TAG VALUES` so that it avoids the
`SELECT` query engine execution and iterator creation. There
are also optimizations to reduce individual memory allocations
and to reduce in-memory heap size by only operating on one
measurement at a time.

Execution time has been reduce to approximately 900ms for
500,000 rows. This is about 2µs per row. Of this time,
approximately 1µs is spent retrieving and sorting the row
and 1µs is spent encoding into JSON and writing to the
response body.
2016-06-06 15:50:53 -06:00
Jason Wilder a74ea4cbf4 Allow creating shards in a disable state
For restoring a shard, we need to be able to have the shard open,
but disabled.  It was racy to open it and then disable it separately
since writes/queries could occur in between that time.
2016-06-01 16:17:18 -06:00
Jonathan A. Sternberg 71c8e9e567 Refactor ExecuteQuery to take options as a struct
This allows us to add additional options to ExecuteQuery without
creating parameter bloat.

Removing the unused Series structs. Their necessity was removed by a
previous commit, but the structs were not removed yet.

Add another type of interrupt iterator that monitors the interrupt
channel and calls `Close()` on the iterator when the interrupt happens.
It will primarily be used for asynchronously closing the ReaderIterator,
but it will only close the read side of the connection properly. More
work needs to be done to allow closing the write side efficiently.
2016-06-01 12:30:52 -05:00
David Norton 62f3b4486a batch SELECT INTO writes 2016-06-01 12:05:23 -04:00
Edd Robinson f4fc905fa9 Reject timestamps too far in future 2016-05-27 11:07:48 +01:00
Edd Robinson bc6e1e84af Change max time for SHOW meta queries
If all points in a series are timestamped in the future, the SHOW
queries will not return anything from these series.

This commit changes the to time used when querying shards for the SHOW
queries to the maximum time, in order to ensure future points are
considered in the results for these queries.

Fixes #6599.
2016-05-26 23:22:23 +01:00
Jonathan A. Sternberg 1518e5eb2c Update IF NOT EXISTS and IF EXISTS deprecated message
Removed the version that it would be removed in as we will not be
removing it for 1.0.
2016-05-24 09:50:23 -04:00
David Norton b32208a850 fix #2048: check that RPs exist before creating CQ 2016-05-20 12:40:36 -04:00
Edd Robinson 19e781fe24 Merge pull request #6639 from influxdata/er-hh-tidy
Remove references to Hinted Handoff
2016-05-17 12:19:08 +01:00
Jonathan A. Sternberg 23f6a706bb Support cast syntax for selecting a specific type
Casting syntax is done with the PostgreSQL syntax `field1::float` to
specify which type should be used when selecting a field. You can also
do `field1::field` or `tag1::tag` to specify that a field or tag should
be selected.

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

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

Fixes #6519.
2016-05-16 12:08:29 -04:00
Edd Robinson 5249bdffd6 Remove references to Hinted Handoff 2016-05-16 16:48:58 +01:00
Jason Wilder a89a4d6b40 Add PointsWriter write timeout back
Was ignored for some reason.
2016-05-11 12:59:51 -06:00
Jason Wilder db7d58c867 Remove old cluster config options 2016-05-11 12:59:30 -06:00
Jason Wilder 6cc1a34704 Rename cluster package to coordinator 2016-05-11 11:41:05 -06:00
Ben Johnson f52c85a8a1 Query engine and parser integration into root pkg. 2014-11-09 19:55:53 -07:00
Ben Johnson b78d4f1329 Add basic query code into the database. 2014-11-06 20:18:36 -05:00
Ben Johnson 9d1464813a Merge branch 'master' of https://github.com/influxdb/influxdb into streaming-raft
Conflicts:
	Makefile.in
	_vendor/raft/server.go
	_vendor/raft/snapshot.go
	_vendor/raft/snapshot_test.go
	admin/http_server.go
	admin/http_server_test.go
	api/graphite/api.go
	api/http/series_writer.go
	cluster/cluster_configuration.go
	cluster/cluster_server.go
	cluster/nil_processor.go
	cluster/shard_space.go
	cmd/influxd/main.go
	common/helpers.go
	configuration/configuration.go
	configuration/configuration_test.go
	coordinator/protobuf_server.go
	coordinator/raft_server.go
	datastore/point_iterator.go
	datastore/shard.go
	datastore/storage_key.go
	engine/aggregator_engine.go
	engine/arithmetic_operators.go
	parser/group_by.go
	parser/query_api.go
	response_channel.go
	server/server.go
2014-11-06 01:20:36 -05:00
John Shahid 1f3570536f Don't try to close the protobuf server if it's not open
Fix #584
2014-11-05 16:46:54 -05:00
John Shahid 1f5f5cb789 Don't write points if they are too old
Background of the bug: Prior to this patch we actually tried writing
points that were older than the retention period of the shard. This
caused race condition when it came to writing points to a shard that's
being dropped, which will happen frequently if the user is loading old
data (by accident). This is demonstrated in the test in this commit.This
bug was previously addressed in #985. It turns the fix for #985 wasn't
enough. A user reported in #1078 that some shards are left behind and
not deleted.

It turns out that while the shard is being dropped more write
requests could come in and end up on line `cluster/shard.go:195` which
will cause the datastore to create a shard on disk that isn't tracked
anywhere in the metadata. This shard will live forever and never get
deleted. This fix address this issue by not writing old points in, but
there are still some edge cases with the current implementation, at
least not as bad as current master.

Close #1078
2014-11-03 17:28:47 -05:00
Ben Johnson 31f981e804 Refactoring common, cluster, and protobuf. 2014-10-31 19:31:19 -06:00
John Shahid 3a857296f4 Support joining multiple series using regex or list 2014-10-31 14:49:48 -04:00
David Norton 4b59ddd113 Don't try to take 2 snapshots at a time
Fix #943. Close #1081
2014-10-31 14:00:56 -04:00
John Shahid bdcaef1ded Set the node's connection string when creating a new raft server 2014-10-31 13:54:20 -04:00
John Shahid f9b3a27345 Make the raft logging configurable 2014-10-30 16:03:13 -04:00