mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
Merge branch 'master' into microseconds
This commit is contained in:
commit
de061ff21d
4 changed files with 48 additions and 21 deletions
|
|
@ -376,6 +376,27 @@ curl -XGET localhost:10101/status
|
|||
}
|
||||
```
|
||||
|
||||
### Get active queries
|
||||
|
||||
`GET /queries`
|
||||
|
||||
Returns the set of active queries. Supports pretty printing in `text/plain` format or JSON output in `application/json` format.
|
||||
Also includes the amount of time that the query has been running (in nanoseconds when using JSON).
|
||||
|
||||
```request
|
||||
curl -XGET localhost:10101/queries
|
||||
```
|
||||
```response
|
||||
182.412µs All()
|
||||
```
|
||||
|
||||
```request
|
||||
curl -XGET -H "Accept: application/json" localhost:10101/queries
|
||||
```
|
||||
```response
|
||||
[{"query":"All()","age":135123}]
|
||||
```
|
||||
|
||||
### Recalculate Caches
|
||||
|
||||
`POST /recalculate-caches`
|
||||
|
|
|
|||
|
|
@ -78,8 +78,9 @@ func makeHolder() (*Holder, string, error) {
|
|||
return nil, "", err
|
||||
}
|
||||
h := NewHolder(DefaultPartitionN)
|
||||
h.Path = path
|
||||
|
||||
return h, path, nil
|
||||
return h, h.Path, nil
|
||||
}
|
||||
|
||||
func testSetBit(t *testing.T, h *Holder, index, field string, rowID, columnID uint64) {
|
||||
|
|
|
|||
BIN
pilosa
BIN
pilosa
Binary file not shown.
|
|
@ -336,34 +336,39 @@ func TestTranslation_Coordinator(t *testing.T) {
|
|||
}
|
||||
|
||||
// Create a field with keys.
|
||||
if _, err := node0.API.CreateField(ctx, idx, fld,
|
||||
if _, err := node1.API.CreateField(ctx, idx, fld,
|
||||
pilosa.OptFieldKeys(),
|
||||
); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
key := "abc"
|
||||
pql := fmt.Sprintf(`Set(1, %s="%s")`, fld, key)
|
||||
keys := []string{"one", "two", "three"}
|
||||
for i := range keys {
|
||||
pql := fmt.Sprintf(`Set(%d, %s="%s")`, i+1, fld, keys[i])
|
||||
|
||||
// Send a translation request to node1 (non-coordinator).
|
||||
_, err := node1.API.Query(ctx,
|
||||
&pilosa.QueryRequest{Index: idx, Query: pql},
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
// Send a translation request to node1 (non-coordinator).
|
||||
_, err := node1.API.Query(ctx,
|
||||
&pilosa.QueryRequest{Index: idx, Query: pql},
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Read the row and ensure the key was set.
|
||||
qry := fmt.Sprintf(`Row(%s="%s")`, fld, key)
|
||||
resp, err := node0.API.Query(ctx,
|
||||
&pilosa.QueryRequest{Index: idx, Query: qry},
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
row := resp.Results[0].(*pilosa.Row)
|
||||
if cols := row.Columns(); !reflect.DeepEqual(cols, []uint64{1}) {
|
||||
t.Fatalf("unexpected columns: %+v", cols)
|
||||
for i := len(keys) - 1; i >= 0; i-- {
|
||||
// Read the row and ensure the key was set.
|
||||
qry := fmt.Sprintf(`Row(%s="%s")`, fld, keys[i])
|
||||
resp, err := node0.API.Query(ctx,
|
||||
&pilosa.QueryRequest{Index: idx, Query: qry},
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
row := resp.Results[0].(*pilosa.Row)
|
||||
val := uint64(i + 1)
|
||||
if cols := row.Columns(); !reflect.DeepEqual(cols, []uint64{val}) {
|
||||
t.Fatalf("unexpected columns: %+v", cols)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue