Permalink
Browse files
Fix a bug due to which we were unable to retrieve xids.
Showing
with
20 additions
and
4 deletions.
-
+8
−1
query/query.go
-
+3
−0
tools/dlist/main.go
-
+6
−1
worker/task.go
-
+3
−2
worker/worker.go
|
@@ -403,7 +403,6 @@ func sortedUniqueUids(r *task.Result) (sorted []uint64, rerr error) { |
|
|
func ProcessGraph(sg *SubGraph, rch chan error) {
|
|
|
var err error
|
|
|
if len(sg.query) > 0 && sg.Attr != "_root_" {
|
|
|
- // This task execution would go over the wire in later versions.
|
|
|
sg.result, err = worker.ProcessTaskOverNetwork(sg.query)
|
|
|
if err != nil {
|
|
|
x.Err(glog, err).Error("While processing task.")
|
|
@@ -416,6 +415,14 @@ func ProcessGraph(sg *SubGraph, rch chan error) { |
|
|
r := new(task.Result)
|
|
|
r.Init(sg.result, uo)
|
|
|
|
|
|
+ if r.ValuesLength() > 0 {
|
|
|
+ var v task.Value
|
|
|
+ if r.Values(&v, 0) {
|
|
|
+ glog.WithField("attr", sg.Attr).WithField("val", string(v.ValBytes())).
|
|
|
+ Info("Sample value")
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
sorted, err := sortedUniqueUids(r)
|
|
|
if err != nil {
|
|
|
x.Err(glog, err).Error("While processing task.")
|
|
|
|
@@ -101,5 +101,8 @@ func main() { |
|
|
if err != nil {
|
|
|
glog.WithError(err).Fatal("Unable to get key")
|
|
|
}
|
|
|
+ if len(val) == 0 {
|
|
|
+ glog.Fatal("Unable to find posting list")
|
|
|
+ }
|
|
|
output(val)
|
|
|
}
|
|
@@ -51,7 +51,12 @@ func processTask(query []byte) (result []byte, rerr error) { |
|
|
uo := flatbuffers.GetUOffsetT(query)
|
|
|
q := new(task.Query)
|
|
|
q.Init(query, uo)
|
|
|
+
|
|
|
attr := string(q.Attr())
|
|
|
+ store := dataStore
|
|
|
+ if attr == "_xid_" {
|
|
|
+ store = uidStore
|
|
|
+ }
|
|
|
|
|
|
b := flatbuffers.NewBuilder(0)
|
|
|
voffsets := make([]flatbuffers.UOffsetT, q.UidsLength())
|
|
@@ -60,7 +65,7 @@ func processTask(query []byte) (result []byte, rerr error) { |
|
|
for i := 0; i < q.UidsLength(); i++ {
|
|
|
uid := q.Uids(i)
|
|
|
key := posting.Key(uid, attr)
|
|
|
- pl := posting.GetOrCreate(key, dataStore)
|
|
|
+ pl := posting.GetOrCreate(key, store)
|
|
|
|
|
|
var valoffset flatbuffers.UOffsetT
|
|
|
if val, err := pl.Value(); err != nil {
|
|
|
|
@@ -126,9 +126,10 @@ func (w *Worker) ServeTask(query *conn.Query, reply *conn.Reply) (rerr error) { |
|
|
q := new(task.Query)
|
|
|
q.Init(query.Data, uo)
|
|
|
attr := string(q.Attr())
|
|
|
- glog.WithField("attr", attr).WithField("instanceIdx", instanceIdx).Info("ServeTask")
|
|
|
+ glog.WithField("attr", attr).WithField("num_uids", q.UidsLength()).
|
|
|
+ WithField("instanceIdx", instanceIdx).Info("ServeTask")
|
|
|
|
|
|
- if attr == "_xid_" ||
|
|
|
+ if (instanceIdx == 0 && attr == "_xid_") ||
|
|
|
farm.Fingerprint64([]byte(attr))%numInstances == instanceIdx {
|
|
|
|
|
|
reply.Data, rerr = processTask(query.Data)
|
|
|
0 comments on commit
c54bf33