Merge remote-tracking branch 'upstream/enterprise' into enterprise

This commit is contained in:
Travis 2020-01-14 15:18:09 -06:00
commit f232ec4277
3 changed files with 55 additions and 2 deletions

View file

@ -3576,3 +3576,47 @@ func TestFragmentConcurrentReadWrite(t *testing.T) {
t.Logf("%d", acc)
}
func TestFragment_Bug_Q2DoubleDelete(t *testing.T) {
f := mustOpenFragment("i", "f", viewStandard, 0, "")
b := []byte{60, 48, 0, 0, 1, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 24, 0, 0, 0, 1, 0}
defer f.Clean(t)
err := f.importRoaringT(b, false)
if err != nil {
t.Fatalf("importing roaring: %v", err)
}
//check the bit
res := f.row(1).Columns()
if len(res) < 1 || f.row(1).Columns()[0] != 1 {
t.Fatalf("expecting 1 got: %v", res)
}
//clear the bit
changed, _ := f.clearBit(1, 1)
if !changed {
t.Fatalf("expected change got %v", changed)
}
//check missing
res = f.row(1).Columns()
if len(res) != 0 {
t.Fatalf("expected nothing got %v", res)
}
// import again
err = f.importRoaringT(b, false)
if err != nil {
t.Fatalf("importing roaring: %v", err)
}
//check
res = f.row(1).Columns()
if len(res) < 1 || f.row(1).Columns()[0] != 1 {
t.Fatalf("again expecting 1 got: %v", res)
}
changed, _ = f.clearBit(1, 1)
if !changed {
t.Fatalf("again expected change got %v", changed)
}
//check missing
res = f.row(1).Columns()
if len(res) != 0 {
t.Fatalf("expected nothing got %v", res)
}
}

View file

@ -422,7 +422,11 @@ func (b *Bitmap) remove(v uint64) bool {
c := b.Containers.Get(highbits(v))
newC, changed := c.remove(lowbits(v))
if newC != c {
b.Containers.Put(highbits(v), newC)
if newC != nil {
b.Containers.Put(highbits(v), newC)
} else {
b.Containers.Remove(highbits(v))
}
}
return changed
}

View file

@ -80,11 +80,16 @@ func (h grpcHandler) QueryPQL(req *pb.QueryPQLRequest, stream pb.Pilosa_QueryPQL
// uint64, bool, etc.) based on the Pilosa field type.
func fieldDataType(f *pilosa.Field) string {
switch f.Type() {
case "set", "mutex":
case "set":
if f.Keys() {
return "[]string"
}
return "[]uint64"
case "mutex":
if f.Keys() {
return "string"
}
return "uint64"
case "int":
if f.Keys() {
return "string"