Commit Graph

209 Commits (fba7c9fc5e3e3dec2a78c61cf1e43d8ef6666b45)

Author SHA1 Message Date
Jonathan A. Sternberg 22173acb70 Update help and remove unused config options from the configuration file
Normalize the output for the various help options so they all follow the
same format and display all relevant options.

Removing some of the unused config options from the configuration file
and updating the help documentation. Removing some remaining references
to clustering within the open source version.
2016-06-21 14:06:05 -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
Jonathan A. Sternberg 8e1b036b0a Modify the max nanosecond time to be one nanosecond less
The highest time represented by a nanosecond needs to be used for an
exclusive range, so the maximum time needs to be one less than the
possible maximum number of nanoseconds representable by an int64 so that
we don't lose a point at that one time.

Previously worked in the open source version because the timestamp used
for finding a shard would be truncated by the retention policy so the
lookup time didn't run into this edge case because it didn't rest on the
truncation boundary. Since that point didn't really belong in that shard
group and was placed there by mistake, it's best to fix this bug since
the timestamp used to create the shard group should be capable of
retrieving it.
2016-06-16 12:15:41 -05:00
Joe LeGasse 647210c57a Add TruncatedAt field to meta.ShardGroupInfo 2016-06-07 18:24:24 -04:00
Jonathan A. Sternberg b8e22d9d79 Merge pull request #6586 from influxdata/js-3733-rename-default-retention-policy
Modify the default retention policy name and make it configurable
2016-06-06 15:05:29 -05:00
Rubycut a849f42cc2 Lock auth properly, code suggested by @jwilder 2016-06-04 09:05:10 +02:00
Edd Robinson f4fc905fa9 Reject timestamps too far in future 2016-05-27 11:07:48 +01:00
Jonathan A. Sternberg 907c88d4b5 Truncate the shard group end time if it exceeds MaxNanoTime
Related to #6599.
2016-05-25 21:25:10 -04:00
Jonathan A. Sternberg baaa782c95 Modify the default retention policy name and make it configurable
The default retention policy name is changed to "autogen" instead of
"default" since it ends up being ambiguous when we tell a user to check
the default retention policy, it is uncertain if we are referring to the
default retention policy (which can be changed) or the retention policy
with the name "default".

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

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

Fixes #3733.
2016-05-24 09:51:23 -04:00
David Norton 9d5c4a0f41 fix #6702: return correct required privileges
Change SelectStatement to return required privileges for all Sources.
2016-05-23 16:44:23 -04:00
David Norton b32208a850 fix #2048: check that RPs exist before creating CQ 2016-05-20 12:40:36 -04:00
Jason Wilder adddb0e6b8 Reduce lock contention when creating shard group 2016-05-09 16:10:38 -06:00
Edd Robinson d35fa1ec97 Remove redundant windows build tags 2016-05-03 14:22:02 +01:00
Seif Lotfy ced79acac5 Remove redundant error return from (Client) Database(name string) and (Client) Databases() 2016-04-30 17:04:38 -05:00
Stephen Gutekanst 9dc09c5257 Make logging output location more programmatically configurable (#6213)
This has various benefits:

- Users embedding InfluxDB within other Go programs can specify a different logger / prefix easily.
- More consistent with code used elsewhere in InfluxDB (e.g. services, other `run.Server.*` fields, etc).
- This is also more efficient, because it means `executeQuery` no longer allocates a single `*log.Logger` each time it is called.
2016-04-20 21:07:08 +01:00
David Norton 5e9ff7bc93 add WriteAuthorizer interface 2016-04-19 00:03:57 -04:00
Chris Ramón a4dd61a2c7 adds shard duration normalization before comparing retention policies 2016-04-13 13:09:20 -05:00
Cory LaNou 7eaf7f8855 CreateShardGroup was incrementing meta data index even when it was idempotent 2016-04-07 11:39:45 -05:00
Edd Robinson 5327a75a6f Merge pull request #6216 from influxdata/er-scope-proto
Change protobuf package names to avoid clashes
2016-04-07 16:38:21 +01:00
mvadu 94524a7699 Fix failure on Windows
Windows does not allow a file to be renamed while its in use. f.Sync does not close the handle. It needs to be explicitly closed before renaming.
2016-04-06 07:32:37 +05:30
Edd Robinson 184257a10d Scope all internal protobuf packages 2016-04-05 13:54:21 +01:00
Edd Robinson 712cc3f290 ShardGroup Duration is checked when recreating rp
Fixes #6178.
2016-04-01 11:59:41 +01:00
Cory LaNou 9bd60c3e07 remove node.json as well, change where we check for raft.db in startup 2016-03-31 17:15:58 -05:00
Cory LaNou 6c6fe87a40 add error message if detecting raft.db file 2016-03-31 17:15:42 -05:00
Cory LaNou a961ff9ebf minor restore fixes; fsync meta snapshots 2016-03-31 17:15:42 -05:00
Edd Robinson f68637205c Check ShardGroup Duration when recreating database
Fixes #6153
2016-03-31 18:11:50 +01:00
Edd Robinson dcb6e318e9 Creating CQ with identical query does not error
Partially fixes #6094.

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

Now when running the command with the same CQ name and query string no
error will be returned. Note, this change does not parse the query, it
simply compares a normalised query string to the existing one on the CQ.
2016-03-29 11:35:04 +01:00
Edd Robinson 828de361c6 Correct the CREATE RETENTION POLICY error behaviour
Partially addresses #6094.

Previously, when creating a retention policy only the name was
considered when deciding if the policy already existed. This meant that
adding a second policy with the same name but different duration or
replica factor returned the original policy and no error.

This commit fixes that and ensures that name, duration and replica
factor are all considered.
2016-03-29 11:07:26 +01:00
Tait Clarridge 45b3e61ac7 Add configurable shard duration to retention policies
Allows configuration of shard group duration at database creation, and retention
policy create/alter time.

Query examples:

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

This can be useful with long duration retention policies with lots of data, where
you can split into smaller shards to relieve memory pressure.
2016-03-24 00:25:49 -04:00
David Norton 8afff49e2b Merge pull request #6072 from influxdata/dn-rename-func
rename CloneUserInfos to CloneUsers
2016-03-21 12:54:19 -04:00
David Norton b2d30e4593 rename CloneUserInfos to CloneUsers 2016-03-21 12:16:53 -04:00
mvadu 8af9170c1d Add platform specific override for file rename.
In windows, it first deletes the target file (if it already exists).
2016-03-18 21:45:29 +05:30
Edd Robinson e5a41f7796 DROP SHARD 2016-03-14 22:59:55 +00:00
David Norton 96327f3863 remove unnecessary change 2016-03-14 18:43:49 -04:00
David Norton a2125bee24 check existing user with bcrypt 2016-03-14 18:40:25 -04:00
David Norton aede1b7478 make CREATE USER default to IF NOT EXISTS 2016-03-14 17:44:48 -04:00
Cory LaNou 1d2c1faa94 address PR feedback 2016-03-14 16:55:54 +00:00
Cory LaNou e2e231310e make work with p-meta 2016-03-14 16:55:54 +00:00
Cory LaNou 27cfaa4b7a in memory meta, single node configs, etc. 2016-03-14 16:55:54 +00:00
Jason Wilder 31a964e890 Move leases to meta.Data 2016-03-11 12:27:08 -07:00
Cory LaNou c972c717b6 remove `client.NodeID` 2016-03-11 12:27:08 -07:00
Ben Johnson b1582ce1c9 add RetentionPolicyInfo marshaling 2016-03-11 12:27:08 -07:00
Jason Wilder cd4ef1856b Use TCPHost when checking for existence of data node
Host is the http endpoint and is not really needed.
2016-03-01 21:23:03 -07:00
Edd Robinson 5eba0ea1b4 Merge pull request #5736 from influxdata/er-shard-owners
Cleanup shards and shard groups when dropping data node
2016-03-01 14:14:27 +00:00
Ben Johnson 0dda9f6608 add remote execution
This commit adds remote execution to the query engine.
2016-02-25 08:41:20 -07:00
Edd Robinson 8add49fd96 Ensures meta queries work in clusters.
Fixes #5612, #5573 and #5518.

Using the MetaExecuter, queries that need to run on both data nodes
and optionally the meta store will be executed across all data nodes
in the cluster.
2016-02-24 11:24:45 -05:00
Edd Robinson 6f1c02fdbe Reconfigure shards and shard groups on node deletion
Fixes #5680.

When dropping a data node, the following will now happen on the
Meta Store.

  1) If any shards no longer have any owners (because the data node
     being dropped is the only owner), they will be reassigned a
     new owner from within their respective shard group.
  2) If a shard group no longer has any shards/data nodes, they will
     be marked as deleted.

When a shard is being assigned a new owner a data node with the fewest
number of shards in the shard group will be selected as the new owner.

Finally, checking the validity of a data node's ID now happens in the
Meta store, rather than in the state machine.
2016-02-23 15:35:43 +00:00
Chris Ramón e52accaf90 adds missing srv.Handler.QueryAuthorizer 2016-02-23 00:02:48 -05:00
Jason Wilder 6f39b355bc Code cleanups 2016-02-22 15:06:05 -07:00
Jason Wilder a2d3d44505 Fix creating meta only nodes
This fixes a couple of issues with starting meta-only nodes.

1. We were always calling CreateDataNode regardless of whether the the
node is running data services.  We only call that now when node is
data enabled.
2. The node.json was created along-side creating the data node. Since
we are not creatinga a data node, this didn't happen anymore.  There
wasn't a simple way to do this in one place so it's actually handle
for when creating a meta or a data node now.  Since the ID assigned
to the node is the same regardless of role this works in all combinations
of roles.
3. The JoinMetaServer didn't return the ID of the joining node which
created some races when multiple nodes were joining.  The join call now
returns that information to the caller.

Fixes #5754
2016-02-22 15:06:05 -07:00
Jason Wilder a437002969 Fix join option in config file
The join option was incorrectly exposed on the meta config.  It should
be at the top-level as a string and propogate down to the meta config
as a slice.
2016-02-22 15:05:46 -07:00
Edd Robinson 99a7341701 Wire up DROP retention policy to TSDB store.
Fixes #5653 and #5394.

Previously dropping retention policies did not propogate to local TSDB
shards. Instead, the retention policiess would just be removed from the
Meta Store.

This PR adds ensures that data associated with retention policies is
removed, when the retention policy is dropped.

Also, it cleans up a couple of other methods in `tsdb`, including the
requirement to provide (redundant) shardIDs when deleting databases.
2016-02-19 11:15:00 +00:00
Jason Wilder 04ba79407a Add join config option back 2016-02-18 14:45:35 -07:00
Jason Wilder 886a62008e Fix dropping nodes
Dropping a meta node that had already been removed from the config
would fail because the raft.RemovePeers call would return an error
that the address was unknown.  This change skips calling RemovePeer
if it doesn't exist.

Dropping a non-existing ID would hang for 10 seconds becuase the
meta.Client retryUntilExec didn't differentiate before command errors
and redirect errors.  In this case, the command would return an error
but we'd try 10 more times and ultimately give up and return the error.
We now return immediately if the command returned and error because
retrying it will not succeed.

Finally, the join loop had no delay and would immediately try to join
the other nodes hundreds of times a second.  We now pause a second if we've
tried every node at least once.
2016-02-18 14:45:34 -07:00
Jason Wilder dedd6f2e9e Fix hostname/bind addresses
This fixes several issues related to the bind address and hostname:
* Allows bind addresses where a hostname or IP is not specified to
work correct and bind to all interfaces by default.
* Fixes the top-level "hostname" config option to allow overridding
all bind address hostnames.  This allows a node to advertise a different
hostname than what is defined in the bind address setting.
* Adds the -hostname command-line option back to allow specifing
both -join and -hostname as command-line flags.
* Enforces a configuration precedence and overriding ability defined
as config file is overridden by env vars which are overriden by command-line
flags.

Fixes #5670 #5671
2016-02-18 14:45:34 -07:00
Jason Wilder a90114aa4d Use same node ID for meta and data nodes
Fixes #5669
2016-02-18 14:45:34 -07:00
Mark Rushakoff c295db0a49 Fix Content-Type headers in meta httpd 2016-02-18 12:34:29 -08:00
Mark Rushakoff 57dd54250f Correctly set X-Influxdb-Version in meta httpd 2016-02-18 12:34:03 -08:00
Ben Johnson e3b4b71c13 refactor query executor
This commit moves the `QueryExecutor` to the `cluster` package
and provides an interface to it inside the `influxql` package.
2016-02-17 15:13:56 -07:00
Jonathan A. Sternberg 23da067593 Fix meta.Client CreateDatabaseWithRetentionPolicy RPC command
Previously, meta.Client would drop the default retention policy when
trying to create a database with a retention policy. The RPC has now
been modified to include the desired retention policy in the
CreateDatabase command and have it use that retention policy information
instead of the default configuration when provided.

This also lowers the number of RPC calls for
CreateDatabaseWithRetentionPolicy to only a single RPC call instead of
two.

Protections have also been included so creating a retention policy with
different parameters will return an error similar to if you tried to
modify the retention policy separately.

Fixes #5696.
2016-02-16 16:21:26 -05:00
Jason Wilder 6fb00c1a9b Remove MetaServers from node.json
This removes the MetaServers property from node.json to eliminate one
of the four places those addresses are stored on disk.  We always use
the values that come through the config (via file, env var or -join arg).
2016-02-15 22:42:51 -07:00
Jason Wilder b45b2c99d1 Use ClusterTracing config to control meta handler logging
Meta HTTP commands are cluster level requests and were showing up in
the main log creating a lot of noise.  Switch them to use the ClusterTracing
config option which is disabled by default.
2016-02-12 16:40:10 -07:00
Jason Wilder 24dd5ef0ee Fix go vet 2016-02-12 13:55:41 -07:00
Jason Wilder cd568548fd Fix race in peerStore 2016-02-12 12:06:23 -07:00
Cory LaNou 7ad31fa6ab address pr feedback 2016-02-12 11:35:20 -07:00
Jason Wilder ddcfac7e8e Remove peers.json
No longer needed now that peers are pull from the meta nodes.
2016-02-12 11:35:20 -07:00
Cory LaNou 1b25c0cb80 ask for a free port immediatly before using to prevent it being returned to the available pool 2016-02-12 11:35:19 -07:00
Cory LaNou 52077b2dfc fix race condition 2016-02-12 11:35:19 -07:00
Cory LaNou e9a2c33556 give less time to lose lease on random port for test 2016-02-12 11:35:19 -07:00
Cory LaNou df5d587105 make meta test suite less racy 2016-02-12 11:35:19 -07:00
Cory LaNou 360f40561e misc fixes and changelog 2016-02-12 11:35:19 -07:00
Cory LaNou 92e8516660 specify raft bind address with real random ports 2016-02-12 11:35:19 -07:00
Cory LaNou 7e62201793 specify bind address meta test 2016-02-12 11:35:19 -07:00
Cory LaNou b17293f75c fix data race 2016-02-12 11:35:19 -07:00
Cory LaNou f861d5811e fix adhoc joining of cluster 2016-02-12 11:35:19 -07:00
Cory LaNou 807354f195 passing test suite... hopefully 2016-02-12 11:32:53 -07:00
Cory LaNou d9f1df0ecf sane cluster starting with join args 2016-02-12 11:32:53 -07:00
Jason Wilder e1effa6601 fix build after rebase on master 2016-02-12 11:32:53 -07:00
Joe LeGasse 1852814612 Update authentication cache to work for clusters
Also removed unused code and duplicated test code
2016-02-12 07:16:57 -05:00
Ben Johnson d9a6a7340f add canonical paths 2016-02-10 11:30:52 -07:00
Ben Johnson 5a0d1ab7c1 rename influxdb/influxdb to influxdata/influxdb
This commit changes all the import and URL references from:

    github.com/influxdb/influxdb

to:

    github.com/influxdata/influxdb
2016-02-10 10:26:18 -07:00
Ben Johnson 627cd9d486 add dedupe iterator 2016-02-10 09:40:29 -07:00
Ben Johnson 607750ab1b add SHOW MEASUREMENTS iterator 2016-02-10 09:40:28 -07:00
Ben Johnson cde973f409 refactor query engine 2016-02-10 09:40:24 -07:00
Edd Robinson bcc46171cf Address some lint issues 2016-02-10 08:52:08 +00:00
Edd Robinson cfbb219e49 Fixes #5545 2016-02-09 18:41:26 +00:00
Tait Clarridge 63ff0ca488 Fix for lease redirect
Previously, the lease redirect was invalid causing anything relying
on a lease for execution (eg. continuous queries) to cease functioning.

The name/nodeid URL param parsing has been moved up to the top of the
handler so the options can be forwarded on to the real leader.

X-Github-Closes: #5592
2016-02-09 09:48:19 -05:00
runner.mei 7c58bf1970 don't panic while addr is invalid 2016-02-05 11:44:16 +08:00
runner.mei 978305a6dd fix unit test of influxd in the windows
fix unit test of influxd in the windows
2016-02-05 11:44:14 +08:00
Jason Wilder 6ff0da39aa Merge pull request #5487 from runner-mei/patch-8
fix cross platform error
2016-02-04 13:46:58 -07:00
David Norton efbac5fce2 fix #5505: clear authCache when pwd changes 2016-02-02 17:51:21 -05:00
Jason Wilder 1c19320e79 Merge pull request #5515 from influxdata/jw-config
Remove top-level dir config option
2016-02-02 13:26:11 -07:00
Jason Wilder 51da6e3d56 Remove top-level dir config option
This breaks backup/restore if it's not "meta" as well as breaks
upgrades from prior releases for some users.
2016-02-02 13:03:44 -07:00
Seif Lotfy 052f8d2a63 Return error if database is not found for setting the retention policy
Instead of returning nil, nil in case of no DB being found return
ErrDatabaseNotExists.
Fixes #5504
2016-02-02 21:02:40 +01:00
Seif Lotfy 343749e02d Add new ErrDatabaseNotExists error 2016-02-02 21:02:40 +01:00
runner 217095ad08 fix cross platform error
fix cross platform error
2016-01-31 11:02:49 +08:00
Cory LaNou 0f6c75ab7d make tests pass 2016-01-28 11:03:44 -06:00
Cory LaNou 51f6c64134 ake new and upgrade behavior the same for meta/data node numbering 2016-01-28 10:05:56 -06:00
Cory LaNou d70b694d7d fix misc meta statup bugs 2016-01-28 10:05:53 -06:00
Cory LaNou 31c2e7012a allow for node upgrade 2016-01-28 10:05:53 -06:00