added logging on import;crashing bug on sync on empty fragment

This commit is contained in:
Todd Gruben 2016-06-07 15:25:37 -05:00
parent 849b10c2f5
commit dab399e328
4 changed files with 6 additions and 2 deletions

View file

@ -71,7 +71,6 @@ func (e *Executor) Execute(db string, q *pql.Query, slices []uint64, opt *ExecOp
}
results = append(results, v)
}
return results, nil
}

View file

@ -854,8 +854,8 @@ func (f *Fragment) Import(bitmapIDs, profileIDs []uint64) error {
if bitmap.SetBit(profileID) {
bmCounter += 1
}
// Update the cache.
}
f.cache.Invalidate()
return nil
}(); err != nil {
_ = f.closeStorage()

View file

@ -398,12 +398,14 @@ func (h *Handler) handlePostImport(w http.ResponseWriter, r *http.Request) {
}
// Find the correct fragment.
h.logger().Println("Go Import:", db, frame, slice)
f, err := h.Index.CreateFragmentIfNotExists(db, frame, slice)
if err != nil {
h.logger().Printf("fragment error: db=%s, frame=%s, slice=%d, err=%s", db, frame, slice, err)
http.Error(w, "fragment error", http.StatusInternalServerError)
return
}
h.logger().Println("Import into Fragment:", db, frame, slice, len(reg.GetProfileIDs()))
// Import into fragment.
err = f.Import(req.GetBitmapIDs(), req.GetProfileIDs())

View file

@ -638,6 +638,9 @@ func (c *container) max() uint16 {
}
func (c *container) arrayMax() uint16 {
if len(c.array) == 0 {
return 0 //probably hiding some ugly bug but it prevents a crash
}
return c.array[len(c.array)-1]
}