This commit is contained in:
Linh Vo 2017-01-27 15:39:17 -06:00
parent da6c5d238c
commit db5b4059ca
3 changed files with 7 additions and 11 deletions

View file

@ -1,10 +1,10 @@
package bench
import (
"fmt"
"github.com/pilosa/pilosa"
"context"
"errors"
"fmt"
"github.com/pilosa/pilosa"
)
func firstHostClient(hosts []string) (*pilosa.Client, error) {
@ -20,12 +20,11 @@ func roundRobinClient(hosts []string, agentNum int) (*pilosa.Client, error) {
return firstHostClient(hosts[clientNum:])
}
// HasClient provides a reusable component for Benchmark implementations which
// provides the Init method, a ClientType argument and a cli internal variable.
type HasClient struct {
client *pilosa.Client
ClientType string `json:"client-type"`
ClientType string `json:"client-type"`
ContentType string `json:"content-type"`
}
@ -66,5 +65,3 @@ func (h *HasClient) ExecuteQuery(contentType, db, query string, ctx context.Cont
return nil, errors.New("unsupport content type")
}
}

View file

@ -111,10 +111,9 @@ func (b *RandomQuery) Run(ctx context.Context) map[string]interface{} {
for n := 0; n < b.Iterations; n++ {
call := qm.Random(b.MaxN, b.MaxDepth, b.MaxArgs, uint64(b.BaseBitmapID), uint64(b.BitmapIDRange))
start = time.Now()
b.ExecuteQuery(b.ContentType, b.DBs[n % len(b.DBs)], call.String(), ctx)
b.ExecuteQuery(b.ContentType, b.DBs[n%len(b.DBs)], call.String(), ctx)
s.Add(time.Now().Sub(start))
}
AddToResults(s, results)
return results
}

View file

@ -198,10 +198,10 @@ func (c *Client) ExecuteQuery(ctx context.Context, db, query string, allowRedire
func (c *Client) ExecutePQL(ctx context.Context, db, query string) (interface{}, error) {
u := url.URL{
Scheme: "http",
Host: c.host,
Path: "/query",
Host: c.host,
Path: "/query",
RawQuery: url.Values{
"db": {db},
"db": {db},
}.Encode(),
}