From 6e3e5134251e105a1ff1814a72caef9367984db2 Mon Sep 17 00:00:00 2001 From: Jaden Weiss Date: Tue, 19 May 2020 11:35:30 -0400 Subject: [PATCH 1/6] roaring: fix use-after-free in b-tree bitmap update --- roaring/btree.go | 9 +++++++++ roaring/btree_test.go | 23 +++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/roaring/btree.go b/roaring/btree.go index 1051f8985..bbc429704 100644 --- a/roaring/btree.go +++ b/roaring/btree.go @@ -925,6 +925,15 @@ func (e *enumerator) Every(upd func(key uint64, oldV *Container, exists bool) (n if write { if nv == nil { e.t.Delete(i.k) + f, _ := e.t.Seek(e.k) + *e = *f + f.Close() + // we don't want to e.next() here; we'll + // already be on an item with key >= i.k, + // and since we just deleted the item with + // key i.k, that means key is > i.k, which + // makes it the next item. + continue } else { e.q.d[e.i].v = nv } diff --git a/roaring/btree_test.go b/roaring/btree_test.go index 422a7b767..c3c02af3d 100644 --- a/roaring/btree_test.go +++ b/roaring/btree_test.go @@ -11,6 +11,7 @@ import ( "math" "math/rand" "path" + "reflect" "runtime" "runtime/debug" "strings" @@ -998,6 +999,28 @@ func TestBtreeEnumeratorPrevSanity(t *testing.T) { } } +// TestBtreeEnumeratorEveryRegression is a regression test for a "use-after-free" bug. +// Previously, deleting a container would cause some values to be skipped (and sometimes trigger a race condition). +func TestBtreeEnumeratorEveryRegression(t *testing.T) { + r := treeNew() + + r.Set(uint64(10), getDummyC(100)) + r.Set(uint64(20), getDummyC(200)) + r.Set(uint64(30), getDummyC(300)) + + e, _ := r.Seek(0) + expect := []uint64{10, 20, 30} + var found []uint64 + _ = e.Every(func(key uint64, oldV *Container, exists bool) (*Container, bool) { + found = append(found, key) + return nil, true + }) + + if !reflect.DeepEqual(expect, found) { // Before the fix, this skipped the 20. + t.Errorf("had %v in bitmap; only found %v", expect, found) + } +} + func BenchmarkBtreeSeekSeq1e3(b *testing.B) { benchmarkSeekSeq(b, 1e3) } From 0a94f8393f9970035d9bcc6e730f55a4c48c6296 Mon Sep 17 00:00:00 2001 From: Travis Date: Thu, 21 May 2020 13:26:55 -0500 Subject: [PATCH 2/6] Address TODOs in roaring tests In addition to adding some tests, this commit moves the `GenerateUint64Slice()` helper function into a new `generator` package so that it can be used in both internal and non-internal tests. --- generator/slice.go | 51 ++++++++++++++ roaring/roaring_internal_test.go | 8 ++- roaring/roaring_test.go | 114 +++++++++++++++++++------------ 3 files changed, 127 insertions(+), 46 deletions(-) create mode 100644 generator/slice.go diff --git a/generator/slice.go b/generator/slice.go new file mode 100644 index 000000000..595f5a132 --- /dev/null +++ b/generator/slice.go @@ -0,0 +1,51 @@ +// Copyright 2020 Pilosa Corp. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package generator + +import ( + "math/rand" + "sort" +) + +// Uint64Slice generates between [0, n) random uint64 numbers between min and max. +func Uint64Slice(n int, min, max uint64, sorted bool, rand *rand.Rand) []uint64 { + a := make([]uint64, rand.Intn(n)) + for i := range a { + a[i] = min + uint64(rand.Int63n(int64(max-min))) + } + + if sorted { + sort.Sort(uint64Slice(a)) + } + + return a +} + +// Uint64SetSlice returns the values in a uint64 set. +func Uint64SetSlice(m map[uint64]struct{}) []uint64 { + a := make([]uint64, 0, len(m)) + for v := range m { + a = append(a, v) + } + sort.Sort(uint64Slice(a)) + return a +} + +// uint64Slice represents a sortable slice of uint64 numbers. +type uint64Slice []uint64 + +func (u uint64Slice) Swap(i, j int) { u[i], u[j] = u[j], u[i] } +func (u uint64Slice) Len() int { return len(u) } +func (u uint64Slice) Less(i, j int) bool { return u[i] < u[j] } diff --git a/roaring/roaring_internal_test.go b/roaring/roaring_internal_test.go index 9e7a468fc..7784064ab 100644 --- a/roaring/roaring_internal_test.go +++ b/roaring/roaring_internal_test.go @@ -19,11 +19,13 @@ import ( "encoding/hex" "fmt" "io/ioutil" + "math/rand" "reflect" "runtime" "strings" "testing" + "github.com/pilosa/pilosa/v2/generator" "github.com/pkg/errors" ) @@ -4026,7 +4028,11 @@ func TestDirectAddNVsAdd(t *testing.T) { {9384932, 101000, 2, 1, 0}, {3489, 19230, 394, 0, 893982, 890283, 14, 7}, } - // TODO generate more tests and fuzz + // Add some randomly created tests. + rand := rand.New(rand.NewSource(1)) + for i := 0; i < 100; i++ { + tests = append(tests, generator.Uint64Slice(1+rand.Intn(1000), 0, 10000000, i%2 == 0, rand)) + } testsCopy := make([][]uint64, len(tests)) copy(testsCopy, tests) for i, test := range testsCopy { diff --git a/roaring/roaring_test.go b/roaring/roaring_test.go index a5c4a9a25..4f079102a 100644 --- a/roaring/roaring_test.go +++ b/roaring/roaring_test.go @@ -20,12 +20,12 @@ import ( "math" "math/rand" "reflect" - "sort" "testing" "testing/quick" "time" "github.com/pilosa/pilosa/v2" + "github.com/pilosa/pilosa/v2/generator" "github.com/pilosa/pilosa/v2/roaring" _ "github.com/pilosa/pilosa/v2/test" ) @@ -280,11 +280,36 @@ func TestBitmap_Slice_Empty(t *testing.T) { } // Ensure a bitmap can return a slice of values within a range. -// TODO duplicate for all container types func TestBitmap_SliceRange(t *testing.T) { - if a := roaring.NewFileBitmap(0, 1000001, 1000002, 1000003).SliceRange(1, 1000003); !reflect.DeepEqual(a, []uint64{1000001, 1000002}) { - t.Fatalf("unexpected slice: %+v", a) - } + t.Run("array", func(t *testing.T) { + if a := roaring.NewFileBitmap(0, 1000001, 1000002, 1000003).SliceRange(1, 1000003); !reflect.DeepEqual(a, []uint64{1000001, 1000002}) { + t.Fatalf("unexpected slice: %+v", a) + } + }) + + t.Run("bitmap", func(t *testing.T) { + bm := roaring.NewFileBitmap() + for i := uint64(10); i < 10000; i++ { + _, _ = bm.Add(i * 2) + } + bm.Optimize() + + if a := bm.SliceRange(20, 30); !reflect.DeepEqual(a, []uint64{20, 22, 24, 26, 28}) { + t.Fatalf("unexpected slice: %+v", a) + } + }) + + t.Run("run", func(t *testing.T) { + bm := roaring.NewFileBitmap() + for i := uint64(0); i < 11; i++ { + _, _ = bm.Add(i) + } + bm.Optimize() + + if a := bm.SliceRange(6, 10); !reflect.DeepEqual(a, []uint64{6, 7, 8, 9}) { + t.Fatalf("unexpected slice: %+v", a) + } + }) } // Ensure a bitmap can loop over a set of values. @@ -1442,7 +1467,7 @@ func testBitmapQuick(t *testing.T, n int, min, max uint64) { // If `got` is nil and `exp` has zero length, don't perform the DeepEqual // because when `a` is empty (`a = []uint64{}`) then `got` is a nil slice // while `exp` is an empty slice. Therefore they will not be considered equal. - if got, exp := bm.Slice(), uint64SetSlice(m); !(got == nil && len(exp) == 0) && !reflect.DeepEqual(got, exp) { + if got, exp := bm.Slice(), generator.Uint64SetSlice(m); !(got == nil && len(exp) == 0) && !reflect.DeepEqual(got, exp) { t.Fatalf("unexpected values:\n\ngot=%+v\n\nexp=%+v\n\n", got, exp) } @@ -1467,7 +1492,7 @@ func testBitmapQuick(t *testing.T, n int, min, max uint64) { return true }, &quick.Config{ Values: func(values []reflect.Value, rand *rand.Rand) { - values[0] = reflect.ValueOf(GenerateUint64Slice(n, min, max, false, rand)) + values[0] = reflect.ValueOf(generator.Uint64Slice(n, min, max, false, rand)) }, }) if err != nil { @@ -1478,7 +1503,9 @@ func testBitmapQuick(t *testing.T, n int, min, max uint64) { func TestBitmap_Marshal_Quick_Array1(t *testing.T) { testBitmapMarshalQuick(t, 1000, 1000, 2000, false) } -func TestBitmap_Marshal_Quick_Array2(t *testing.T) { testBitmapMarshalQuick(t, 10000, 0, 1000, false) } +func TestBitmap_Marshal_Quick_Array2(t *testing.T) { + testBitmapMarshalQuick(t, 10000, 0, 1000, false) +} func TestBitmap_Marshal_Quick_Bitmap1(t *testing.T) { testBitmapMarshalQuick(t, 10000, 0, 10000, false) } @@ -1494,6 +1521,12 @@ func TestBitmap_Marshal_Quick_Bitmap_Sorted(t *testing.T) { } // TODO update for RLE +// (travis) - it's not clear to me how to generate a run container +// using `testBitmapMarshalQuick`. Because it's randomly generated, +// even some of the "Bitmap" tests generate array containers. Also, +// I think in order for the container to be a run, we would need +// to call bm.Optimize() on the bitmap, and I'm hesitant to add that +// because it's not clear to me how that would affect the tests. // Ensure a bitmap can be marshaled and unmarshaled. func testBitmapMarshalQuick(t *testing.T, n int, min, max uint64, sorted bool) { @@ -1538,12 +1571,12 @@ func testBitmapMarshalQuick(t *testing.T, n int, min, max uint64, sorted bool) { } // Verify the original bitmap has the correct set of values. - if exp, got := uint64SetSlice(set), bm.Slice(); !reflect.DeepEqual(exp, got) { + if exp, got := generator.Uint64SetSlice(set), bm.Slice(); !reflect.DeepEqual(exp, got) { t.Fatalf("mismatch: %s\n\nexp=%+v\n\ngot=%+v\n\n", diff(exp, got), exp, got) } // Verify the bitmap loaded with the ops log has the correct set of values. - if exp, got := uint64SetSlice(set), bm2.Slice(); !reflect.DeepEqual(exp, got) { + if exp, got := generator.Uint64SetSlice(set), bm2.Slice(); !reflect.DeepEqual(exp, got) { t.Fatalf("mismatch: %s\n\nexp=%+v\n\ngot=%+v\n\n", diff(exp, got), exp, got) } } @@ -1551,8 +1584,8 @@ func testBitmapMarshalQuick(t *testing.T, n int, min, max uint64, sorted bool) { return true }, &quick.Config{ Values: func(values []reflect.Value, rand *rand.Rand) { - values[0] = reflect.ValueOf(GenerateUint64Slice(n, min, max, sorted, rand)) - values[1] = reflect.ValueOf(GenerateUint64Slice(100, min, max, sorted, rand)) + values[0] = reflect.ValueOf(generator.Uint64Slice(n, min, max, sorted, rand)) + values[1] = reflect.ValueOf(generator.Uint64Slice(100, min, max, sorted, rand)) }, }) if err != nil { @@ -1561,9 +1594,8 @@ func testBitmapMarshalQuick(t *testing.T, n int, min, max uint64, sorted bool) { } // Ensure iterator can iterate over all the values on the bitmap. -// TODO duplicate for all container types func TestIterator(t *testing.T) { - t.Run("bitmap", func(t *testing.T) { + t.Run("array", func(t *testing.T) { itr := roaring.NewFileBitmap(1, 2, 3).Iterator() itr.Seek(0) @@ -1577,6 +1609,29 @@ func TestIterator(t *testing.T) { } }) + t.Run("bitmap", func(t *testing.T) { + bm := roaring.NewFileBitmap() + exp := []uint64{} + for i := uint64(0); i < 10000; i++ { + v := i * 2 + _, _ = bm.Add(v) + exp = append(exp, v) + } + bm.Optimize() + + itr := bm.Iterator() + itr.Seek(0) + + var a []uint64 + for v, eof := itr.Next(); !eof; v, eof = itr.Next() { + a = append(a, v) + } + + if !reflect.DeepEqual(a, exp) { + t.Fatalf("unexpected values: %+v", a) + } + }) + t.Run("run", func(t *testing.T) { bm1 := roaring.NewFileBitmap() for i := uint64(0); i < 11; i++ { @@ -1784,37 +1839,6 @@ func getBenchData(tb testing.TB) *benchmarkSampleData { return data } -// GenerateUint64Slice generates between [0, n) random uint64 numbers between min and max. -func GenerateUint64Slice(n int, min, max uint64, sorted bool, rand *rand.Rand) []uint64 { - a := make([]uint64, rand.Intn(n)) - for i := range a { - a[i] = min + uint64(rand.Int63n(int64(max-min))) - } - - if sorted { - sort.Sort(uint64Slice(a)) - } - - return a -} - -// uint64SetSlice returns the values in a uint64 set. -func uint64SetSlice(m map[uint64]struct{}) []uint64 { - a := make([]uint64, 0, len(m)) - for v := range m { - a = append(a, v) - } - sort.Sort(uint64Slice(a)) - return a -} - -// uint64Slice represents a sortable slice of uint64 numbers. -type uint64Slice []uint64 - -func (p uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } -func (p uint64Slice) Len() int { return len(p) } -func (p uint64Slice) Less(i, j int) bool { return p[i] < p[j] } - func diff(a, b []uint64) string { if len(a) != len(b) { return fmt.Sprintf("len: %d != %d", len(a), len(b)) From 041726fbf76868e2ddc0c95c2acea517293b2dc7 Mon Sep 17 00:00:00 2001 From: Travis Date: Fri, 22 May 2020 10:59:54 -0500 Subject: [PATCH 3/6] clean up the TODOs and some comments --- roaring/roaring.go | 2 +- row.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/roaring/roaring.go b/roaring/roaring.go index 9605a6299..5924673ea 100644 --- a/roaring/roaring.go +++ b/roaring/roaring.go @@ -160,7 +160,7 @@ type Containers interface { // replace the given container. UpdateEvery(fn func(uint64, *Container, bool) (*Container, bool)) - // Iterator returns a Contiterator which after a call to Next(), a call to Value() will + // Iterator returns a ContainterIterator which after a call to Next(), a call to Value() will // return the first container at or after key. found will be true if a // container is found at key. Iterator(key uint64) (citer ContainerIterator, found bool) diff --git a/row.go b/row.go index e50c6ab67..f1c67123c 100644 --- a/row.go +++ b/row.go @@ -374,7 +374,7 @@ func (r *Row) Difference(others ...*Row) *Row { return &Row{segments: output} } -// GenericUnary returns the results of a generic op on r. +// GenericUnaryOp returns the results of a generic op on r. func (r *Row) GenericUnaryOp(op ext.GenericBitmapOpBitmap, args map[string]interface{}) *Row { work := r var segments []rowSegment @@ -660,7 +660,8 @@ func (s *rowSegment) Xor(other *rowSegment) *rowSegment { // Shift returns s shifted by 1 bit. func (s *rowSegment) Shift() (*rowSegment, error) { - //TODO deal with overflow + // TODO: deal with overflow + // See issue: https://github.com/molecula/pilosa/issues/403 data, err := s.data.Shift(1) if err != nil { return nil, errors.Wrap(err, "shifting roaring data") @@ -675,9 +676,8 @@ func (s *rowSegment) Shift() (*rowSegment, error) { }, nil } -// GenericUnary returns s subject to op. +// GenericUnaryOp returns s subject to op. func (s *rowSegment) GenericUnaryOp(op ext.GenericBitmapOpBitmap, args map[string]interface{}) *rowSegment { - //TODO deal with overflow data := UnwrapBitmap(op([]ext.Bitmap{WrapBitmap(s.data)}, args)) return &rowSegment{ From e4b9293f26e6b69ec406e1ff25cb1992fa63bf9a Mon Sep 17 00:00:00 2001 From: Travis Date: Sat, 16 May 2020 12:07:56 -0500 Subject: [PATCH 4/6] Add support for `int == null` --- executor.go | 41 +++++++++++++++++++++++++++++++++-------- executor_test.go | 15 ++++++++++++++- pql/parser_test.go | 3 ++- pql/pqlpeg_test.go | 8 ++++++++ 4 files changed, 57 insertions(+), 10 deletions(-) diff --git a/executor.go b/executor.go index 3aa677c44..28f0ea80f 100644 --- a/executor.go +++ b/executor.go @@ -2463,21 +2463,15 @@ func (e *executor) executeRowBSIGroupShard(ctx context.Context, index string, c return nil, ErrFieldNotFound } - // EQ null (not implemented: flip frag.NotNull with max ColumnID) + // EQ null _exists - frag.NotNull() // NEQ null frag.NotNull() // BETWEEN a,b(in) BETWEEN/frag.RowBetween() // BETWEEN a,b(out) BETWEEN/frag.NotNull() // EQ frag.RangeOp // NEQ frag.RangeOp - // Handle `!= null`. + // Handle `!= null` and `== null`. if cond.Op == pql.NEQ && cond.Value == nil { - // Find bsiGroup. - bsig := f.bsiGroup(fieldName) - if bsig == nil { - return nil, ErrBSIGroupNotFound - } - // Retrieve fragment. frag := e.Holder.fragment(index, fieldName, viewBSIGroupPrefix+fieldName, shard) if frag == nil { @@ -2486,6 +2480,37 @@ func (e *executor) executeRowBSIGroupShard(ctx context.Context, index string, c return frag.notNull() + } else if cond.Op == pql.EQ && cond.Value == nil { + // Make sure the index supports existence tracking. + idx := e.Holder.Index(index) + if idx == nil { + return nil, ErrIndexNotFound + } else if idx.existenceField() == nil { + return nil, errors.Errorf("index does not support existence tracking: %s", index) + } + + var existenceRow *Row + existenceFrag := e.Holder.fragment(index, existenceFieldName, viewStandard, shard) + if existenceFrag == nil { + existenceRow = NewRow() + } else { + existenceRow = existenceFrag.row(0) + } + + var notNull *Row + var err error + + // Retrieve notNull from fragment if it exists. + if frag := e.Holder.fragment(index, fieldName, viewBSIGroupPrefix+fieldName, shard); frag != nil { + if notNull, err = frag.notNull(); err != nil { + return nil, errors.Wrap(err, "getting fragment not null") + } + } else { + notNull = NewRow() + } + + return existenceRow.Difference(notNull), nil + } else if cond.Op == pql.BETWEEN || cond.Op == pql.BTWN_LT_LT || cond.Op == pql.BTWN_LTE_LT || cond.Op == pql.BTWN_LT_LTE { predicates, err := getCondIntSlice(f, cond) diff --git a/executor_test.go b/executor_test.go index e29dd6b99..dfb5d3af3 100644 --- a/executor_test.go +++ b/executor_test.go @@ -2371,7 +2371,7 @@ func TestExecutor_Execute_Row_BSIGroup(t *testing.T) { defer c.Close() hldr := test.Holder{Holder: c[0].Server.Holder()} - idx, err := hldr.CreateIndex("i", pilosa.IndexOptions{}) + idx, err := hldr.CreateIndex("i", pilosa.IndexOptions{TrackExistence: true}) if err != nil { t.Fatal(err) } @@ -2414,6 +2414,19 @@ func TestExecutor_Execute_Row_BSIGroup(t *testing.T) { } t.Run("EQ", func(t *testing.T) { + // EQ null + if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(other == null)`}); err != nil { + t.Fatal(err) + } else if !reflect.DeepEqual([]uint64{1, + 50, + ShardWidth, + ShardWidth + 1, + ShardWidth + 2, + (5 * ShardWidth) + 100, + }, result.Results[0].(*pilosa.Row).Columns()) { + t.Fatalf("unexpected result: %#v", result.Results[0].(*pilosa.Row).Columns()) + } + // EQ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(foo == 20)`}); err != nil { t.Fatal(err) } else if got, exp := result.Results[0].(*pilosa.Row).Columns(), []uint64{50, (5 * ShardWidth) + 100}; !reflect.DeepEqual(exp, got) { diff --git a/pql/parser_test.go b/pql/parser_test.go index 29c358865..54bb9e332 100644 --- a/pql/parser_test.go +++ b/pql/parser_test.go @@ -173,7 +173,7 @@ func TestParser_Parse(t *testing.T) { // Parse with condition arguments. t.Run("WithCondition", func(t *testing.T) { - q, err := pql.ParseString(`Row(key=foo, x == 12.25, y >= 100, z >< [4,8], m != null)`) + q, err := pql.ParseString(`Row(key=foo, x == 12.25, y >= 100, z >< [4,8], m != null, n == null)`) if err != nil { t.Fatal(err) } else if !reflect.DeepEqual(q.Calls[0], @@ -185,6 +185,7 @@ func TestParser_Parse(t *testing.T) { "y": &pql.Condition{Op: pql.GTE, Value: int64(100)}, "z": &pql.Condition{Op: pql.BETWEEN, Value: []interface{}{int64(4), int64(8)}}, "m": &pql.Condition{Op: pql.NEQ, Value: nil}, + "n": &pql.Condition{Op: pql.EQ, Value: nil}, }, }, ) { diff --git a/pql/pqlpeg_test.go b/pql/pqlpeg_test.go index 48eaf10c4..4ebf1dcc9 100644 --- a/pql/pqlpeg_test.go +++ b/pql/pqlpeg_test.go @@ -238,8 +238,16 @@ func TestPEGWorking(t *testing.T) { name: "RangeEQ", input: "Row(a == 4)", ncalls: 1}, + { + name: "RangeEQNULL", + input: "Row(a == null)", + ncalls: 1}, { name: "RangeNEQ", + input: "Row(a != 4)", + ncalls: 1}, + { + name: "RangeNEQNull", input: "Row(a != null)", ncalls: 1}, { From 5644fb2275c6feb4edb472089e050cc489d1a5a1 Mon Sep 17 00:00:00 2001 From: Jaden Weiss Date: Wed, 20 May 2020 12:27:27 -0400 Subject: [PATCH 5/6] add metrics for transactions --- api.go | 39 ++++++++++++++++++++++++++++++++++++--- metrics.go | 7 +++++++ 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/api.go b/api.go index 77a3fc34e..e617837c2 100644 --- a/api.go +++ b/api.go @@ -1594,14 +1594,41 @@ func (api *API) StartTransaction(ctx context.Context, id string, timeout time.Du if err := api.validate(apiStartTransaction); err != nil { return nil, errors.Wrap(err, "validating api method") } - return api.server.StartTransaction(ctx, id, timeout, exclusive, remote) + t, err := api.server.StartTransaction(ctx, id, timeout, exclusive, remote) + if exclusive { + switch err { + case nil: + api.holder.Stats.Count(MetricExclusiveTransactionRequest, 1, 1.0) + case ErrTransactionExclusive: + api.holder.Stats.Count(MetricExclusiveTransactionBlocked, 1, 1.0) + } + if t.Active { + api.holder.Stats.Count(MetricExclusiveTransactionActive, 1, 1.0) + } + } else { + switch err { + case nil: + api.holder.Stats.Count(MetricTransactionStart, 1, 1.0) + case ErrTransactionExclusive: + api.holder.Stats.Count(MetricTransactionBlocked, 1, 1.0) + } + } + return t, err } func (api *API) FinishTransaction(ctx context.Context, id string, remote bool) (*Transaction, error) { if err := api.validate(apiFinishTransaction); err != nil { return nil, errors.Wrap(err, "validating api method") } - return api.server.FinishTransaction(ctx, id, remote) + t, err := api.server.FinishTransaction(ctx, id, remote) + if err == nil { + if t.Exclusive { + api.holder.Stats.Count(MetricExclusiveTransactionEnd, 1, 1.0) + } else { + api.holder.Stats.Count(MetricTransactionEnd, 1, 1.0) + } + } + return t, err } func (api *API) Transactions(ctx context.Context) (map[string]*Transaction, error) { @@ -1615,7 +1642,13 @@ func (api *API) GetTransaction(ctx context.Context, id string, remote bool) (*Tr if err := api.validate(apiGetTransaction); err != nil { return nil, errors.Wrap(err, "validating api method") } - return api.server.GetTransaction(ctx, id, remote) + t, err := api.server.GetTransaction(ctx, id, remote) + if err == nil { + if t.Exclusive && t.Active { + api.holder.Stats.Count(MetricExclusiveTransactionActive, 1, 1.0) + } + } + return t, err } type serverInfo struct { diff --git a/metrics.go b/metrics.go index c1888e0f6..8d58f8a73 100644 --- a/metrics.go +++ b/metrics.go @@ -58,4 +58,11 @@ const ( MetricStackInuse = "stack_inuse" MetricMallocs = "mallocs" MetricFrees = "frees" + MetricTransactionStart = "transaction_start" + MetricTransactionEnd = "trasaction_end" + MetricTransactionBlocked = "transaction_blocked" + MetricExclusiveTransactionRequest = "transaction_exclusive_request" + MetricExclusiveTransactionActive = "transaction_exclusive_active" + MetricExclusiveTransactionEnd = "trasaction_exclusive_end" + MetricExclusiveTransactionBlocked = "transaction_exclusive_blocked" ) From 604f3b3373adca80453d22e08fa8a854abf5d3ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Podg=C3=B3rski?= Date: Wed, 27 May 2020 16:41:38 +0200 Subject: [PATCH 6/6] Add grpc uri to status --- cluster.go | 9 +- encoding/proto/proto.go | 2 + internal/private.pb.go | 257 +++++++++++++++++++++++++--------------- internal/private.proto | 1 + 4 files changed, 169 insertions(+), 100 deletions(-) diff --git a/cluster.go b/cluster.go index 6fce679fb..e979710d8 100644 --- a/cluster.go +++ b/cluster.go @@ -659,6 +659,7 @@ func (c *cluster) addNodeBasicSorted(node *Node) bool { n.State = node.State n.IsCoordinator = node.IsCoordinator n.URI = node.URI + n.GRPCURI = node.GRPCURI return true } return false @@ -1745,8 +1746,9 @@ func (j *resizeJob) distributeResizeInstructions() error { // Because the node may not be in the cluster yet, create // a dummy node object to use in the SendTo() method. node := &Node{ - ID: instr.Node.ID, - URI: instr.Node.URI, + ID: instr.Node.ID, + URI: instr.Node.URI, + GRPCURI: instr.Node.GRPCURI, } j.Logger.Printf("send resize instructions: %v", instr) if err := j.Broadcaster.SendTo(node, instr); err != nil { @@ -2046,6 +2048,9 @@ func (c *cluster) nodeJoin(node *Node) error { c.logger.Printf("node: %v changed URI from %s to %s", cnode.ID, cnode.URI, node.URI) cnode.URI = node.URI } + if cnode.GRPCURI != node.GRPCURI { + cnode.GRPCURI = node.GRPCURI + } return c.unprotectedSetStateAndBroadcast(c.determineClusterState()) } diff --git a/encoding/proto/proto.go b/encoding/proto/proto.go index c41d38c53..a4508f652 100644 --- a/encoding/proto/proto.go +++ b/encoding/proto/proto.go @@ -655,6 +655,7 @@ func (s Serializer) encodeNode(n *pilosa.Node) *internal.Node { URI: s.encodeURI(n.URI), IsCoordinator: n.IsCoordinator, State: n.State, + GRPCURI: s.encodeURI(n.GRPCURI), } } @@ -996,6 +997,7 @@ func (s Serializer) decodeClusterStatus(cs *internal.ClusterStatus, m *pilosa.Cl func (s Serializer) decodeNode(node *internal.Node, m *pilosa.Node) { m.ID = node.ID s.decodeURI(node.URI, &m.URI) + s.decodeURI(node.GRPCURI, &m.GRPCURI) m.IsCoordinator = node.IsCoordinator m.State = node.State } diff --git a/internal/private.pb.go b/internal/private.pb.go index a1d0870bd..38eb7af3d 100644 --- a/internal/private.pb.go +++ b/internal/private.pb.go @@ -1090,6 +1090,7 @@ type Node struct { URI *URI `protobuf:"bytes,2,opt,name=URI,proto3" json:"URI,omitempty"` IsCoordinator bool `protobuf:"varint,3,opt,name=IsCoordinator,proto3" json:"IsCoordinator,omitempty"` State string `protobuf:"bytes,4,opt,name=State,proto3" json:"State,omitempty"` + GRPCURI *URI `protobuf:"bytes,5,opt,name=GRPCURI,proto3" json:"GRPCURI,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1156,6 +1157,13 @@ func (m *Node) GetState() string { return "" } +func (m *Node) GetGRPCURI() *URI { + if m != nil { + return m.GRPCURI + } + return nil +} + type NodeStateMessage struct { NodeID string `protobuf:"bytes,1,opt,name=NodeID,proto3" json:"NodeID,omitempty"` State string `protobuf:"bytes,2,opt,name=State,proto3" json:"State,omitempty"` @@ -2413,95 +2421,96 @@ func init() { func init() { proto.RegisterFile("private.proto", fileDescriptor_d2a91b51c7bdc125) } var fileDescriptor_d2a91b51c7bdc125 = []byte{ - // 1395 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x17, 0xcd, 0x72, 0xdb, 0x44, - 0x18, 0x59, 0x8e, 0x63, 0x7f, 0x8e, 0x53, 0x67, 0xdb, 0xa6, 0x6a, 0x60, 0x82, 0x59, 0x3a, 0xd4, - 0x74, 0x86, 0xd0, 0x69, 0x99, 0xe1, 0xb7, 0x33, 0x6d, 0xe2, 0xb4, 0x98, 0x92, 0xb4, 0x5d, 0xa7, - 0xbd, 0x71, 0xd8, 0xc8, 0x3b, 0x8d, 0x26, 0xb2, 0x64, 0xa4, 0x55, 0xea, 0xf4, 0xc0, 0x15, 0x66, - 0x78, 0x01, 0x8e, 0xbc, 0x07, 0x2f, 0xc0, 0x91, 0x47, 0x60, 0xca, 0x53, 0x70, 0x63, 0xf6, 0xdb, - 0x5d, 0x49, 0x76, 0x1c, 0x52, 0x52, 0x6e, 0xfb, 0xfd, 0xff, 0x7f, 0x9f, 0x04, 0xad, 0x71, 0x12, - 0x1c, 0x71, 0x29, 0x36, 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x5b, 0xfb, - 0x35, 0xfc, 0xd7, 0xbe, 0xfd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x76, 0xf5, 0x59, 0x94, - 0x0f, 0x00, 0x00, + // 1418 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x72, 0x1b, 0xc5, + 0x13, 0xff, 0xaf, 0x56, 0xb6, 0xa4, 0x96, 0xe5, 0xc8, 0x93, 0xc4, 0xd9, 0xf8, 0x4f, 0x19, 0x31, + 0xa4, 0x88, 0x48, 0x15, 0x26, 0x95, 0x50, 0xc5, 0x67, 0xaa, 0x12, 0x5b, 0x4e, 0x10, 0xc1, 0x8e, + 0x33, 0x72, 0x72, 0xe3, 0x30, 0x5e, 0x4d, 0xc5, 0x5b, 0x5e, 0xed, 0x8a, 0xdd, 0x59, 0x47, 0xce, + 0x81, 0x2b, 0x54, 0xf1, 0x02, 0x1c, 0x38, 0xf0, 0x1e, 0xbc, 0x00, 0x47, 0x1e, 0x81, 0x0a, 0x4f, + 0xc1, 0x8d, 0x9a, 0x9e, 0x99, 0xdd, 0x95, 0x2c, 0xe3, 0x90, 0x70, 0xdb, 0xfe, 0xf5, 0x77, 0x4f, + 0x77, 0xcf, 0x2c, 0xb4, 0xc6, 0x49, 0x70, 0xcc, 0xa5, 0xd8, 0x18, 0x27, 0xb1, 0x8c, 0x49, 0x3d, + 0x88, 0xa4, 0x48, 0x22, 0x1e, 0xae, 0x2d, 0x8d, 0xb3, 0x83, 0x30, 0xf0, 0x35, 0x4e, 0x1f, 0x40, + 0xa3, 0x1f, 0x0d, 0xc5, 0x64, 0x47, 0x48, 0x4e, 0x08, 0x54, 0x1f, 0x8a, 0x93, 0xd4, 0x73, 0x3b, + 0x4e, 0xb7, 0xce, 0xf0, 0x9b, 0xbc, 0x07, 0xcb, 0xfb, 0x09, 0xf7, 0x8f, 0xb6, 0x27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, 0xcf, 0x4e, 0xce, 0xd9, 0x65, 0x1e, 0xd4, 0xf4, 0xad, 0xa4, 0x97, 0x63, + 0x83, 0x59, 0x92, 0x5e, 0x54, 0x63, 0xea, 0xf3, 0xd0, 0xcf, 0x42, 0x15, 0x86, 0x7a, 0x5e, 0xa7, + 0x54, 0x98, 0x41, 0xe0, 0x58, 0xb8, 0xd2, 0x45, 0x77, 0x0f, 0x01, 0x7b, 0xd1, 0x69, 0x8a, 0x7c, + 0x0c, 0xcd, 0x92, 0xb4, 0x29, 0xe0, 0xe5, 0x99, 0x79, 0xd1, 0x4c, 0x56, 0x96, 0xa4, 0xbf, 0x3a, + 0x53, 0x9a, 0xa7, 0xee, 0x7c, 0xe3, 0xf0, 0x58, 0x1f, 0x4a, 0x9d, 0x19, 0x4a, 0xe5, 0xba, 0x3d, + 0xf1, 0xc3, 0x2c, 0x55, 0x2c, 0x7d, 0xcd, 0x17, 0x80, 0xca, 0x55, 0xfd, 0x43, 0xc6, 0x99, 0x34, + 0x9b, 0xd3, 0x92, 0xea, 0x77, 0xae, 0x27, 0xf8, 0x30, 0x0c, 0x22, 0x81, 0x5d, 0xea, 0xb2, 0x9c, + 0x26, 0x37, 0xf5, 0xb6, 0xb7, 0xa3, 0xb6, 0x36, 0x37, 0x7c, 0x94, 0xd0, 0x37, 0x41, 0x4a, 0x09, + 0xb4, 0x67, 0x59, 0x9b, 0xed, 0xdf, 0x5e, 0xae, 0x3b, 0xbf, 0xbf, 0x5c, 0x77, 0xfe, 0x78, 0xb9, + 0xee, 0xfc, 0xf4, 0xe7, 0xfa, 0xff, 0x0e, 0x16, 0xf1, 0xaf, 0xfc, 0xf6, 0xdf, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x8a, 0x80, 0x2a, 0x36, 0xbe, 0x0f, 0x00, 0x00, } func (m *IndexMeta) Marshal() (dAtA []byte, err error) { @@ -3422,6 +3431,18 @@ func (m *Node) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.GRPCURI != nil { + { + size, err := m.GRPCURI.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPrivate(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } if len(m.State) > 0 { i -= len(m.State) copy(dAtA[i:], m.State) @@ -3684,20 +3705,20 @@ func (m *FieldStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.XXX_unrecognized) } if len(m.AvailableShards) > 0 { - dAtA18 := make([]byte, len(m.AvailableShards)*10) - var j17 int + dAtA19 := make([]byte, len(m.AvailableShards)*10) + var j18 int for _, num := range m.AvailableShards { for num >= 1<<7 { - dAtA18[j17] = uint8(uint64(num)&0x7f | 0x80) + dAtA19[j18] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j17++ + j18++ } - dAtA18[j17] = uint8(num) - j17++ + dAtA19[j18] = uint8(num) + j18++ } - i -= j17 - copy(dAtA[i:], dAtA18[:j17]) - i = encodeVarintPrivate(dAtA, i, uint64(j17)) + i -= j18 + copy(dAtA[i:], dAtA19[:j18]) + i = encodeVarintPrivate(dAtA, i, uint64(j18)) i-- dAtA[i] = 0x12 } @@ -4925,6 +4946,10 @@ func (m *Node) Size() (n int) { if l > 0 { n += 1 + l + sovPrivate(uint64(l)) } + if m.GRPCURI != nil { + l = m.GRPCURI.Size() + n += 1 + l + sovPrivate(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -8114,6 +8139,42 @@ func (m *Node) Unmarshal(dAtA []byte) error { } m.State = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GRPCURI", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPrivate + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPrivate + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPrivate + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.GRPCURI == nil { + m.GRPCURI = &URI{} + } + if err := m.GRPCURI.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPrivate(dAtA[iNdEx:]) diff --git a/internal/private.proto b/internal/private.proto index 804c3f2cd..849fff04a 100644 --- a/internal/private.proto +++ b/internal/private.proto @@ -110,6 +110,7 @@ message Node { URI URI = 2; bool IsCoordinator = 3; string State = 4; + URI GRPCURI = 5; } message NodeStateMessage {