Skip to content

Commit

Permalink
remove deprecated . syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielc committed May 5, 2016
1 parent 24b0e72 commit 8c10bc8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@
Changes to how and where task data is store have been made.
In order to safely upgrade to version 0.13 you need to follow these steps:

1. Upgrade the Kapacitor binary.
2. Configure new database location. By default the location `/var/lib/kapacitor/kapacitor.db` is chosen for package installs or `./kapacitor.db` for manual installs.
1. Update all TICKscripts to use the new `|` and `@` operators. Once Kapacitor no longer issues any `DEPRECATION` warnings you are ready to begin the upgrade.
The upgrade will work without this step but tasks using the old syntax cannot be enabled, until modified to use the new syntax.
2. Upgrade the Kapacitor binary.
3. Configure new database location. By default the location `/var/lib/kapacitor/kapacitor.db` is chosen for package installs or `./kapacitor.db` for manual installs.
Do **not** remove the configuration for the location of the old task.db database file since it is still needed to do the migration.

```
[storage]
boltdb = "/var/lib/kapacitor/kapacitor.db"
```

3. Restart Kapacitor. At this point Kapacitor will migrate all existing data to the new database file.
4. Restart Kapacitor. At this point Kapacitor will migrate all existing data to the new database file.
If any errors occur Kapacitor will log them and fail to startup. This way if Kapacitor starts up you can be sure the migration was a success and can continue normal operation.
The old database is opened in read only mode so that existing data cannot be corrupted.
Its recommended to start Kapacitor in debug logging mode for the migration so you can follow the details of the migration process.
Expand Down
5 changes: 4 additions & 1 deletion pipeline/pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ func (d deadman) Global() bool { return d.global }

func TestTICK_To_Pipeline_MultiLine(t *testing.T) {
var tickScript = `
var w = stream.from().window()
var w = stream
|from()
|window()
w.period(10s)
w.every(1s)
`
Expand Down
17 changes: 2 additions & 15 deletions tick/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,23 +361,10 @@ func evalFunc(f *FunctionNode, scope *Scope, stck *stack, args []interface{}) er
return o, wrapError(f, err)
}
if describer.HasChainMethod(name) {
getLogger().Printf("W! DEPRECATED Syntax line %d char %d: found use of '.' as chaining method. Please adopt new syntax 'node|%s(..)'.", f.Line(), f.Char(), name)
o, err := describer.CallChainMethod(name, args...)
return o, wrapError(f, err)
return nil, errorf(f, "no property method %q on %T, but chaining method does exist. Use '|' operator instead: 'node|%s(..)'.", name, obj, name)
}
// Uncomment for 0.13 release, to finish deprecation of old syntax
//if describer.HasChainMethod(name) {
// return nil, errorf(f, "no property method %q on %T, but chaining method does exist. Use '|' operator instead: 'node|%s(..)'.", name, obj, name)
//}
if dm := scope.DynamicMethod(name); dm != nil {
// Uncomment for 0.13 release, to finish deprecation of old syntax
//return nil, errorf(f, "no property method %q on %T, but dynamic method does exist. Use '@' operator instead: 'node@%s(..)'.", name, obj, name)
getLogger().Printf("W! DEPRECATED Syntax line %d char %d: found use of '.' as dynamic method. Please adopt new syntax 'node@%s(...)'.", f.Line(), f.Char(), name)
ret, err := dm(obj, args...)
if err != nil {
return nil, err
}
return ret, nil
return nil, errorf(f, "no property method %q on %T, but dynamic method does exist. Use '@' operator instead: 'node@%s(..)'.", name, obj, name)
}
case dynamicFunc:
// Check for dynamic method.
Expand Down
2 changes: 0 additions & 2 deletions tick/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,6 @@ var m = !n

// Test that using the wrong chain operator fails
func TestStrictEvaluate(t *testing.T) {
// Skip test until DEPRECATED syntax is removed
t.Skip()
script := `
var s2 = a.structB()
.field1('f1')
Expand Down

0 comments on commit 8c10bc8

Please sign in to comment.