wal: don't use path.Base to get changegroup value
If a changegroup contains a slash then it'll be cut the the last string after the slash
This commit is contained in:
parent
0f9a5f9c4b
commit
805099b693
|
@ -344,12 +344,12 @@ func (w *WalManager) watcher(ctx context.Context) error {
|
||||||
switch ev.Type {
|
switch ev.Type {
|
||||||
case mvccpb.PUT:
|
case mvccpb.PUT:
|
||||||
w.changes.Lock()
|
w.changes.Lock()
|
||||||
changeGroup := path.Base(string(ev.Kv.Key))
|
changeGroup := strings.TrimPrefix(string(ev.Kv.Key), etcdChangeGroupsDir+"/")
|
||||||
w.changes.putChangeGroup(changeGroup, ev.Kv.ModRevision)
|
w.changes.putChangeGroup(changeGroup, ev.Kv.ModRevision)
|
||||||
w.changes.Unlock()
|
w.changes.Unlock()
|
||||||
case mvccpb.DELETE:
|
case mvccpb.DELETE:
|
||||||
w.changes.Lock()
|
w.changes.Lock()
|
||||||
changeGroup := path.Base(string(ev.Kv.Key))
|
changeGroup := strings.TrimPrefix(string(ev.Kv.Key), etcdChangeGroupsDir+"/")
|
||||||
w.changes.removeChangeGroup(changeGroup)
|
w.changes.removeChangeGroup(changeGroup)
|
||||||
w.changes.Unlock()
|
w.changes.Unlock()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue