diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bee09ceeb..adb19ce4d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,18 @@ +# Release v1.5.2 (2018-07-23) + +## Compatibility +- VPP 18.07-rc0~358-ga5ee900 +- cn-infra v1.4.1 (minor version fixes bug in Consul) + +## Bugfix +- [Telemetry](plugins/telemetry) + * Fixed bug where lack of config file could cause continuous polling. The interval now also + cannot be changed to value less than 5 seconds. + * Telemetry plugin is now closed properly + # Release v1.5.1 (2018-07-20) + +## Compatibility - VPP 18.07-rc0~358-ga5ee900 - cn-infra v1.4 diff --git a/Gopkg.lock b/Gopkg.lock index e0eb231745..cedeba4a73 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -357,8 +357,8 @@ "utils/safeclose", "utils/structs" ] - revision = "99b1f3ef1874097c64653096589cd5c166e37d81" - version = "v1.4.0" + revision = "22c14be88d97b2b8c38cce0a7141ea18bd042143" + version = "v1.4.1" [[projects]] branch = "master" @@ -656,6 +656,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "52dc7c071cf89d7cbda30b6904f92c012092f798f1f6ce60586f65c535da162a" + inputs-digest = "8d88cea9e950184c84919c5a1e32a620023704ffca5326cfc681225ed2c6c19b" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index f07e669969..b4dc198baf 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -36,7 +36,7 @@ required = [ [[constraint]] name = "github.com/ligato/cn-infra" - version = "1.4" + version = "1.4.1" [[constraint]] branch = "master" diff --git a/vendor/github.com/ligato/cn-infra/db/keyval/consul/consul.go b/vendor/github.com/ligato/cn-infra/db/keyval/consul/consul.go index 6c46213572..b3d01b543a 100644 --- a/vendor/github.com/ligato/cn-infra/db/keyval/consul/consul.go +++ b/vendor/github.com/ligato/cn-infra/db/keyval/consul/consul.go @@ -67,7 +67,7 @@ func NewClient(cfg *api.Config) (store *Client, err error) { // Put stores given data for the key. func (c *Client) Put(key string, data []byte, opts ...datasync.PutOption) error { - consulLogger.Debugf("put: %q\n", key) + consulLogger.Debugf("Put: %q", key) p := &api.KVPair{Key: transformKey(key), Value: data} _, err := c.client.KV().Put(p, nil) if err != nil { @@ -86,7 +86,7 @@ func (c *Client) NewTxn() keyval.BytesTxn { // GetValue returns data for the given key. func (c *Client) GetValue(key string) (data []byte, found bool, revision int64, err error) { - consulLogger.Debugf("get value: %q\n", key) + consulLogger.Debugf("GetValue: %q", key) pair, _, err := c.client.KV().Get(transformKey(key), nil) if err != nil { return nil, false, 0, err @@ -119,7 +119,7 @@ func (c *Client) ListKeys(prefix string) (keyval.BytesKeyIterator, error) { // Delete deletes given key. func (c *Client) Delete(key string, opts ...datasync.DelOption) (existed bool, err error) { - consulLogger.Debugf("delete: %q\n", key) + consulLogger.Debugf("Delete: %q", key) if _, err := c.client.KV().Delete(transformKey(key), nil); err != nil { return false, err } @@ -171,18 +171,20 @@ func (resp *watchResp) GetRevision() int64 { } func (c *Client) watch(resp func(watchResp keyval.BytesWatchResp), closeCh chan string, prefix string) error { - consulLogger.Debug("WATCH:", prefix) + consulLogger.Debug("watch:", prefix) ctx, cancel := context.WithCancel(context.Background()) recvChan := c.watchPrefix(ctx, prefix) go func(regPrefix string) { + defer cancel() for { select { case wr, ok := <-recvChan: if !ok { - consulLogger.WithField("prefix", prefix).Debug("Watch recv chan was closed") + consulLogger.WithField("prefix", prefix). + Debug("Watch recv chan was closed") return } for _, ev := range wr.Events { @@ -211,8 +213,8 @@ func (c *Client) watch(resp func(watchResp keyval.BytesWatchResp), closeCh chan } case closeVal, ok := <-closeCh: if !ok || closeVal == regPrefix { - consulLogger.WithField("prefix", prefix).Debug("Watch ended") - cancel() + consulLogger.WithField("prefix", prefix). + Debug("Watch ended") return } } @@ -252,9 +254,9 @@ func (c *Client) watchPrefix(ctx context.Context, prefix string) <-chan watchRes oldIndex := qm.LastIndex oldPairsMap := make(map[string]*api.KVPair) - consulLogger.Debugf("..retrieved: %v old pairs (old index: %v)", len(oldPairs), oldIndex) + consulLogger.Debugf("prefix %v listing %v pairs (last index: %v)", prefix, len(oldPairs), oldIndex) for _, pair := range oldPairs { - consulLogger.Debugf(" - key: %q create: %v modify: %v", pair.Key, pair.CreateIndex, pair.ModifyIndex) + consulLogger.Debugf(" - key: %q create: %v modify: %v value: %v", pair.Key, pair.CreateIndex, pair.ModifyIndex, len(pair.Value)) oldPairsMap[pair.Key] = pair } @@ -279,9 +281,9 @@ func (c *Client) watchPrefix(ctx context.Context, prefix string) <-chan watchRes continue } - consulLogger.Debugf("prefix %q: %v new pairs (new index: %v) %+v", prefix, len(newPairs), newIndex, qm) + consulLogger.Debugf("prefix %q: listing %v new pairs, new index: %v (old index: %v)", prefix, len(newPairs), newIndex, oldIndex) for _, pair := range newPairs { - consulLogger.Debugf(" + key: %q create: %v modify: %v", pair.Key, pair.CreateIndex, pair.ModifyIndex) + consulLogger.Debugf(" + key: %q create: %v modify: %v value: %v", pair.Key, pair.CreateIndex, pair.ModifyIndex, len(pair.Value)) } var evs []*watchEvent @@ -293,6 +295,7 @@ func (c *Client) watchPrefix(ctx context.Context, prefix string) <-chan watchRes if oldPair, ok := oldPairsMap[pair.Key]; ok { prevVal = oldPair.Value } + consulLogger.Debugf(" * modified key: %v prevValue: %v prevModify: %v", pair.Key, len(pair.Value), len(prevVal)) evs = append(evs, &watchEvent{ Type: datasync.Put, Key: pair.Key, @@ -392,7 +395,7 @@ func (pdb *BrokerWatcher) GetValue(key string) (data []byte, found bool, revisio // KeyPrefix defined in constructor is prepended to the key argument. // The prefix is removed from the keys of the returned values. func (pdb *BrokerWatcher) ListValues(key string) (keyval.BytesKeyValIterator, error) { - pairs, _, err := pdb.client.KV().List(pdb.prefixKey(transformKey(key)), nil) + pairs, _, err := pdb.client.KV().List(pdb.prefixKey(key), nil) if err != nil { return nil, err } @@ -403,7 +406,7 @@ func (pdb *BrokerWatcher) ListValues(key string) (keyval.BytesKeyValIterator, er // ListKeys calls 'ListKeys' function of the underlying BytesConnectionEtcd. // KeyPrefix defined in constructor is prepended to the argument. func (pdb *BrokerWatcher) ListKeys(prefix string) (keyval.BytesKeyIterator, error) { - keys, qm, err := pdb.client.KV().Keys(pdb.prefixKey(transformKey(prefix)), "", nil) + keys, qm, err := pdb.client.KV().Keys(pdb.prefixKey(prefix), "", nil) if err != nil { return nil, err } @@ -451,6 +454,9 @@ func (it *bytesKeyIterator) GetNext() (key string, rev int64, stop bool) { } key = string(it.keys[it.index]) + if !strings.HasPrefix(key, "/") && strings.HasPrefix(it.prefix, "/") { + key = "/" + key + } if it.prefix != "" { key = strings.TrimPrefix(key, it.prefix) } @@ -483,6 +489,9 @@ func (it *bytesKeyValIterator) GetNext() (val keyval.BytesKeyVal, stop bool) { } key := string(it.pairs[it.index].Key) + if !strings.HasPrefix(key, "/") && strings.HasPrefix(it.prefix, "/") { + key = "/" + key + } if it.prefix != "" { key = strings.TrimPrefix(key, it.prefix) }