FeatureBaseDB / tools

Tools for development and ops
BSD 3-Clause "New" or "Revised" License
20 stars 14 forks source link

WIP: Range benchmark #61

Closed linhvo closed 7 years ago

linhvo commented 7 years ago

Steps to reproduce a range query bug:

To import range data, run

pi bench import-range

data will be import to default index ibench, default range frame range-frame, default field range-frame. Make sure range-frame doesn't exist since I'm waiting for Yuce update go-pilosa for adding new fields to existing frame, so fields now need to be an options when creating frame. This imports data randomly from with max-value = 1000, max-column-id=1000 and about 1000 fields.

To generate random query and run:

pi bench range-query --max-depth=4 --max-args 2

Last query from queries list is an error one and benchmark returns error as following:

Difference(Range(frame="range-frame", range-field >= 86), Range(frame="range-frame", range-field > 60))
{
  "stats": {
    "min": 160306,
    "max": 888329,
    "mean": 465223,
    "total-time": 13956581,
    "num": 30,
    "all": []
  },
  "responses": [],
  "extra": {},
  "duration": 17313172,
  "agentnum": 0,
  "pilosa-version": "v0.4.0-538-g576e26c",
  "configuration": {
    "client-type": "single",
    "content-type": "protobuf",
    "name": "range-query",
    "max-depth": 4,
    "max-args": 2,
    "max-n": 0,
    "min-range": 0,
    "max-range": 100,
    "iterations": 100,
    "seed": 1,
    "frame": "range-frame",
    "index": "ibench",
    "field": [
      "range-field"
    ],
    "type": "sum"
  },
  "error": "Executing 'Difference(Range(frame=\"range-frame\", range-field \u003e= 86), Range(frame=\"range-frame\", range-field \u003e 60))', err: proto: can't skip unknown wire type 6 for internal.QueryResponse"
}

And pilosa server log error as following:

PANIC: runtime error: index out of range
goroutine 843 [running]:
runtime/debug.Stack(0xc4201a80e0, 0x1f4, 0x1afe9e0)
    /usr/local/Cellar/go/1.8.1/libexec/src/runtime/debug/stack.go:24 +0x79
github.com/pilosa/pilosa.(*Handler).ServeHTTP.func1(0x1acb260, 0xc4201a80e0, 0xc420251030)
    /Users/lvo/dev/go/src/github.com/pilosa/pilosa/handler.go:155 +0x91
panic(0x16e11c0, 0x1afe9e0)
    /usr/local/Cellar/go/1.8.1/libexec/src/runtime/panic.go:489 +0x2cf
encoding/json.(*encodeState).marshal.func1(0xc420531768)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:288 +0x159
panic(0x16e11c0, 0x1afe9e0)
    /usr/local/Cellar/go/1.8.1/libexec/src/runtime/panic.go:489 +0x2cf
encoding/json.(*encodeState).marshal.func1(0xc420531578)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:288 +0x159
panic(0x16e11c0, 0x1afe9e0)
    /usr/local/Cellar/go/1.8.1/libexec/src/runtime/panic.go:489 +0x2cf
github.com/pilosa/pilosa/roaring.(*Iterator).Next(0xc4204f7ea0, 0xc4204f7ea0, 0x0)
    /Users/lvo/dev/go/src/github.com/pilosa/pilosa/roaring/roaring.go:896 +0x24f
github.com/pilosa/pilosa.(*BitmapSegment).Bits(0xc4206bdec0, 0x0, 0x0, 0x1b2ab58)
    /Users/lvo/dev/go/src/github.com/pilosa/pilosa/bitmap.go:406 +0x8b
github.com/pilosa/pilosa.(*Bitmap).Bits(0xc4204f7e60, 0xc4204f7e80, 0xc420531138, 0x100f623)
    /Users/lvo/dev/go/src/github.com/pilosa/pilosa/bitmap.go:259 +0xc6
github.com/pilosa/pilosa.(*Bitmap).MarshalJSON(0xc4204f7e60, 0x176d5e0, 0xc4204f7e60, 0x2f3c118, 0xc4204f7e60, 0xc420531101)
    /Users/lvo/dev/go/src/github.com/pilosa/pilosa/bitmap.go:245 +0x68
encoding/json.marshalerEncoder(0xc420258790, 0x176d5e0, 0xc4204f7e60, 0x16, 0xc4204f0100)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:451 +0x9f
encoding/json.(*encodeState).reflectValue(0xc420258790, 0x176d5e0, 0xc4204f7e60, 0x16, 0xc4204f0100)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:323 +0x82
encoding/json.interfaceEncoder(0xc420258790, 0x16cbf80, 0xc42024e3b0, 0x194, 0x16c0100)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:617 +0xdb
encoding/json.(*arrayEncoder).encode(0xc42000e958, 0xc420258790, 0x169d920, 0xc420120c40, 0x97, 0x100)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:767 +0xf5
encoding/json.(*arrayEncoder).(encoding/json.encode)-fm(0xc420258790, 0x169d920, 0xc420120c40, 0x97, 0x100)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:774 +0x64
encoding/json.(*sliceEncoder).encode(0xc42000e978, 0xc420258790, 0x169d920, 0xc420120c40, 0x97, 0x100)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:741 +0xc1
encoding/json.(*sliceEncoder).(encoding/json.encode)-fm(0xc420258790, 0x169d920, 0xc420120c40, 0x97, 0x100)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:753 +0x64
encoding/json.(*structEncoder).encode(0xc4203283f0, 0xc420258790, 0x171a340, 0xc420120c40, 0x99, 0x1710100)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:645 +0x253
encoding/json.(*structEncoder).(encoding/json.encode)-fm(0xc420258790, 0x171a340, 0xc420120c40, 0x99, 0xc420120100)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:659 +0x64
encoding/json.(*encodeState).reflectValue(0xc420258790, 0x171a340, 0xc420120c40, 0x99, 0x100)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:323 +0x82
encoding/json.(*encodeState).marshal(0xc420258790, 0x171a340, 0xc420120c40, 0x1710100, 0x0, 0x0)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:296 +0xb8
encoding/json.Marshal(0x171a340, 0xc420120c40, 0x171a340, 0xc420120c40, 0x16ce9e0, 0x2bfc00ee9e4, 0x0)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:161 +0x6e
github.com/pilosa/pilosa.(*QueryResponse).MarshalJSON(0xc420120bc0, 0x16ce9e0, 0xc420120bc0, 0x2f3c0f0, 0xc420120bc0, 0xc420531601)
    /Users/lvo/dev/go/src/github.com/pilosa/pilosa/handler.go:1644 +0xe7
encoding/json.marshalerEncoder(0xc4202586e0, 0x16ce9e0, 0xc420120bc0, 0x16, 0xc420120100)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:451 +0x9f
encoding/json.(*encodeState).reflectValue(0xc4202586e0, 0x16ce9e0, 0xc420120bc0, 0x16, 0x100)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:323 +0x82
encoding/json.(*encodeState).marshal(0xc4202586e0, 0x16ce9e0, 0xc420120bc0, 0xc420000100, 0x0, 0x0)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/encode.go:296 +0xb8
encoding/json.(*Encoder).Encode(0xc420531800, 0x16ce9e0, 0xc420120bc0, 0x1ac4420, 0xc4201a80e0)
    /usr/local/Cellar/go/1.8.1/libexec/src/encoding/json/stream.go:193 +0x8e
github.com/pilosa/pilosa.(*Handler).writeJSONQueryResponse(0xc420251030, 0x1acb260, 0xc4201a80e0, 0xc420120bc0, 0x0, 0xc420120bc0)
    /Users/lvo/dev/go/src/github.com/pilosa/pilosa/handler.go:1094 +0xad
github.com/pilosa/pilosa.(*Handler).writeQueryResponse(0xc420251030, 0x1acb260, 0xc4201a80e0, 0xc4204bc300, 0xc420120bc0, 0xc4204f6d80, 0xc42024e388)
    /Users/lvo/dev/go/src/github.com/pilosa/pilosa/handler.go:1079 +0xf4
github.com/pilosa/pilosa.(*Handler).handlePostQuery(0xc420251030, 0x1acb260, 0xc4201a80e0, 0xc4204bc300)
    /Users/lvo/dev/go/src/github.com/pilosa/pilosa/handler.go:300 +0x744
github.com/pilosa/pilosa.(*Handler).(github.com/pilosa/pilosa.handlePostQuery)-fm(0x1acb260, 0xc4201a80e0, 0xc4204bc300)
    /Users/lvo/dev/go/src/github.com/pilosa/pilosa/handler.go:129 +0x48
net/http.HandlerFunc.ServeHTTP(0xc4202b7b20, 0x1acb260, 0xc4201a80e0, 0xc4204bc300)
    /usr/local/Cellar/go/1.8.1/libexec/src/net/http/server.go:1942 +0x44
github.com/pilosa/pilosa/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0xc42021aaa0, 0x1acb260, 0xc4201a80e0, 0xc4204bc300)
    /Users/lvo/dev/go/src/github.com/pilosa/pilosa/vendor/github.com/gorilla/mux/mux.go:114 +0x10c
github.com/pilosa/pilosa.(*Handler).ServeHTTP(0xc420251030, 0x1acb260, 0xc4201a80e0, 0xc4204bc100)
    /Users/lvo/dev/go/src/github.com/pilosa/pilosa/handler.go:163 +0xd8
net/http.serverHandler.ServeHTTP(0xc4200ac790, 0x1acb260, 0xc4201a80e0, 0xc4204bc100)
    /usr/local/Cellar/go/1.8.1/libexec/src/net/http/server.go:2568 +0x92
net/http.(*conn).serve(0xc4201ae000, 0x1acbfa0, 0xc42017f3c0)
    /usr/local/Cellar/go/1.8.1/libexec/src/net/http/server.go:1825 +0x612
created by net/http.(*Server).Serve
    /usr/local/Cellar/go/1.8.1/libexec/src/net/http/server.go:2668 +0x2ce
yuce commented 7 years ago

@linhvo I've pushed a PR to the go client yesterday which implements adding/deleting fields: https://github.com/pilosa/go-pilosa/pull/61

linhvo commented 7 years ago

thanks @travisturner, I fixed your review and added BETWEEN condition.