Skip to content
This repository has been archived by the owner on Oct 7, 2023. It is now read-only.

Commit

Permalink
zketcd: don't read data key's value on root directory Get
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Romano committed Nov 3, 2017
1 parent 5e56a11 commit 7fd93fe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion zketcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,11 @@ func (z *zkEtcd) GetData(xid Xid, op *GetDataRequest) ZKResponse {
}
z.s.Watch(zxid, xid, p, EventNodeDataChanged, f)
}
datResp.Data = []byte(txnresp.Responses[2].GetResponseRange().Kvs[0].Value)

// Root directory has no data.
if p != rootPath {
datResp.Data = []byte(txnresp.Responses[2].GetResponseRange().Kvs[0].Value)
}

glog.V(7).Infof("GetData(%v) = (zxid=%v, resp=%+v)", xid, zxid, *datResp)
return mkZKResp(xid, zxid, datResp)
Expand Down

0 comments on commit 7fd93fe

Please sign in to comment.