Commit Graph

23 Commits (57336bd6eee6e6a78ee234d1e3d3fdafeaa61fc1)

Author SHA1 Message Date
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
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
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
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
Cory LaNou ba830be3b9 actually move influxql.Row* -> models.Row* 2015-09-16 16:32:50 -05:00
David Norton d466b19388 update CQ service unit tests 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
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 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 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