Commit Graph

51 Commits (73b3a2a0565dbf8b2caa4225ba10ae5777e8ca44)

Author SHA1 Message Date
Jonathan A. Sternberg 0730573e27 Fix running multiple CQs with the same name
Previously, CQs with the same name would be stored in the last run map
the same way. This caused only one of the CQs to run because after the
first one ran it would update the last run time for all CQs with the
same name.

Add the database name to the CQ ID in the last run map to differentiate
between CQs in different databases.

Fixes #5814.
2016-02-24 12:23:52 -05: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
Edd Robinson 7ff67db776 Merge pull request #5613 from influxdata/er-cq-typo
Tidy up README
2016-02-10 23:38:48 +00: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
Edd Robinson 4e1c3d0a56 Tidy up README 2016-02-10 11:50:42 +00:00
Jason Wilder ca06755422 Fix merge breakage 2016-01-24 22:00:51 -07:00
David Norton 58e0eed9cb Merge pull request #5403 from influxdata/meta-service2
refactor meta into separate meta client & service
2016-01-22 20:06:51 -05:00
David Norton c0df09d544 make sure there are CQs before acquiring lease 2016-01-22 17:01:55 -05:00
Jonathan A. Sternberg 1429f4b4ea Teach the CQ runner how to deal with a resample interval higher than the query interval
Previously if you issued a CQ with a resample interval higher than the
query interval, such as the following:

    CREATE CONTINUOUS QUERY cq ON db
        RESAMPLE EVERY 4m
        BEGIN
            SELECT mean(value) INTO cpu_mean FROM cpu GROUP BY time(2m)
        END

This would result in strange behavior because the FOR value defaulted to
the GROUP BY interval and the minimum time passing before a CQ ran was
also the resample interval, so it wouldn't run the appropriate intervals
even if you set the resample duration to a higher value.

This tweaks the CQ runner to set the minimum interval before a bucket
becomes capable of running to the lower of the query interval or the
resample interval instead of always using the resample interval.

It also sets the default resample duration to be the higher value of the
query interval or the resample interval so the above query gets a
default of 4m instead of 2m and will execute 2 queries every 4 minutes.

If you manually set the resample duration to a lower value than the
resample interval, the old behavior will still happen and should be
considered an error.

This also makes trying to create a continuous query with a resample
duration of below the resample interval or query interval (whichever is
higher) as an error returned by the parser.

Fixes #5286.
2016-01-22 09:43:46 -05:00
David Norton 2e8cfce7be convert CQ service to new meta client 2016-01-21 15:32:03 -05:00
Cory LaNou 15314111cb buildable test suite 2016-01-21 15:31:27 -05:00
Jason Wilder ad52d0fbd9 Fix tests 2016-01-21 15:30:09 -05:00
Cory LaNou 8d878fff91 buildable meta -> services/meta 2016-01-21 15:28:32 -05:00
Jonathan A. Sternberg 5d4ecf853c Add continuous query option for customizing resampling
This makes the following syntax possible:

    CREATE CONTINUOUS QUERY mycq ON mydb
        RESAMPLE EVERY 1m FOR 1h
        BEGIN
          SELECT mean(value) INTO cpu_mean FROM cpu GROUP BY time(5m)
        END

The RESAMPLE option customizes how often an interval will be sampled and
the duration. The interval is customized with EVERY. Any intervals
within the resampling duration on a multiple of the resample interval
will be updated with the new results from the query.

The duration is customized with FOR. This determines how long an
interval will participate in resampling.

Both options are optional. If RESAMPLE is in the syntax, at least one of
the two needs to be given. The default for both is the interval of the
continuous query.

The service also improves tracking of the last run time and the logic of
when a query for an interval should be run. When determining the oldest
interval to run for a query, the continuous query service determines
what would have been the optimal time to perform the next query based on
the last run time. It then uses this time to determine the oldest
interval that should be run using the resample duration and will
resample all intervals between this time and the current time as opposed
to potentially forgetting about the last run in an interval if the
continuous query service gets delayed for some reason.

This removes the previous config options for customizing continuous
queries since they are no longer relevant and adds a new option of
customizing the run interval. The run interval determines how often the
continuous query service polls for when it should execute a query. This
option defaults to 1s, but can be set to 1m if the least common factor
of all continuous queries' intervals is a higher value (like 1m).
2015-12-28 16:43:49 -05:00
Cory LaNou 3cd8056664 Merge pull request #4876 from e-dard/lint
Lint
2015-12-02 08:55:47 -06:00
Cory LaNou be488b7d12 implement close notifier and timeout on executors 2015-11-24 21:07:18 -06:00
Edd Robinson ffbd6037e2 Initial lint for all packages under services. Supports #4098 2015-11-22 19:23:56 +00:00
Philip O'Toole de7919240f Migrate internal stats to consistent names
Go style -- and existing runtime stats -- do not use underscores, but
instead use camel case. This change makes the internal stats adhere to
that convention.
2015-10-28 21:07:45 -07:00
Daniel Morsing 822af73f88 implement continuous queries as regular execs of into queries.
Now that we have into queries, we can implement them as regular
queries that are just run on a timer.
2015-10-13 15:51:19 +00:00
Antonio Murdaca 49c0b6ea73 Fix go vet warnings
This patch fixes the following go vet warnings:

```
services/continuous_querier/service.go:326: influxql.Statements
composite literal uses unkeyed fields
exit status 1
services/httpd/handler_test.go:145: models.Rows composite literal uses
unkeyed fields
services/httpd/handler_test.go:146: models.Rows composite literal uses
unkeyed fields
services/httpd/handler_test.go:165: models.Rows composite literal uses
unkeyed fields
services/httpd/handler_test.go:166: models.Rows composite literal uses
unkeyed fields
services/httpd/handler_test.go:187: models.Rows composite literal uses
unkeyed fields
services/httpd/handler_test.go:188: models.Rows composite literal uses
unkeyed fields
exit status 1
```

Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-09-21 15:28:54 +02:00
Cory LaNou ba830be3b9 actually move influxql.Row* -> models.Row* 2015-09-16 16:32:50 -05:00
Cory LaNou d19a510ad2 refactor Points and Rows to dedicated packages 2015-09-16 15:33:08 -05:00
Philip O'Toole 817328d378 Add basic stats to the CQ service 2015-09-08 18:17:20 -07:00
David Norton dce666e757 fix #3979: fix race in CQ service 2015-09-03 19:55:40 -04:00
David Norton 0cb9618d6d fix CQ intoDB() 2015-09-03 09:07:57 -04:00
David Norton d466b19388 update CQ service unit tests 2015-09-03 07:12:15 -04:00
David Norton 66001cfbb5 fix #2555: add integration tests for CQs 2015-09-03 07:12:15 -04:00
David Norton 021a6f5453 rename CQ tests 2015-09-03 07:12:15 -04:00
David Norton 99a22c174b fix #2555: add backreference in CQs
Add new query syntax to allow the following in CQs:

INTO "1hPolicy".:MEASUREMENT
2015-09-03 07:12:15 -04:00
Jason Wilder e5e782d13d Merge pull request #3517 from dim/fix-cq-timeouts
Batch CQ writes to avoid timeouts
2015-08-14 10:52:17 -06:00
Jason Wilder bb6de3b8f3 Merge pull request #3522 from dim/fix-cq-timeout-bug
Consume CQ results on request timeouts
2015-08-14 10:52:04 -06:00
Jason Wilder 668181d275 Make log statements more consistent
* Capitalize first letter of message
* Log all services staring consistently
* Remove some extraneous log statements in meta.Store
* Log data dirs for meta, data and hinted handoff
2015-08-13 10:01:42 -06:00
Dimitrij Denissenko 762a1c69d5 Consume CQ results on request timeouts 2015-07-30 16:59:47 +01:00
Dimitrij Denissenko 642d6eba85 Batch CQ writes to avoid timeouts 2015-07-30 15:24:51 +01:00
Josh Horwitz e722b4b4ad Added additional logging to continuous queries 2015-07-23 19:09:42 -04:00
Sean Beckett 72f52d44c9 making queries syntactically correct 2015-07-08 17:25:56 -06:00
David Norton c76e904aa3 remove commented out code 2015-06-22 15:42:13 -04:00
David Norton 6cbb605930 fix #2944: update unit tests 2015-06-22 15:40:31 -04:00
David Norton 0467aa8fec fix #2944: don't require WHERE time on create CQ 2015-06-22 15:39:22 -04:00
Philip O'Toole e165777509 Move doc on CQs to CQ services component 2015-06-15 13:55:11 -07:00
Cory LaNou 8a5cf394d8 add ability to silence logging for testing 2015-06-10 10:27:57 -05:00
David Norton fcf89c87dd cr #2733: uncomment defer in test 2015-06-05 22:30:57 -04:00
David Norton a235b4998d fix #2733: trying to fix CI race 2015-06-05 20:23:44 -04:00
David Norton e107a681c5 cr #2733: make error message more detailed 2015-06-05 19:56:28 -04:00
David Norton d8f0445940 fix #2733: fix race in tests 2015-06-05 19:56:28 -04:00
David Norton fb514f2302 fix #2733: add endpoint to trigger CQ(s) 2015-06-05 19:56:28 -04:00
David Norton 8699aa8f0b fix #2733: more tests 2015-06-05 19:56:28 -04:00
David Norton e0838cb705 fix #2733: add tests for CQ service 2015-06-05 19:54:23 -04:00
David Norton 092bc3fd2d fix #2733: hook CQs back in 2015-06-05 19:54:23 -04:00