From 975e013deb1260cb319240d0d29462ce17a36b9b Mon Sep 17 00:00:00 2001 From: Cody Soyland Date: Tue, 11 Sep 2018 14:38:04 -0500 Subject: [PATCH 1/6] Increase gometalinter deadline so CI stops failing --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 390a652fc..b403fde23 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ docker-test: # Run gometalinter with custom flags gometalinter: require-gometalinter gometalinter --vendor --disable-all \ - --deadline=120s \ + --deadline=300s \ --enable=deadcode \ --enable=gochecknoinits \ --enable=gofmt \ From 4ea48e1b40b9161e49c73aadc39a11d74ea82a12 Mon Sep 17 00:00:00 2001 From: Matt Jaffee Date: Tue, 21 Aug 2018 12:53:53 -0500 Subject: [PATCH 2/6] remove unused log buffers from test cluster, fixes race the buffers were unused internally and external users had no access to them. Those wishing to read the logs of the cluster in tests may replace stdout/stderr with buffers on the Command struct. The race occurred when a node was stopped and then started again. some memberlist goroutines might not be completely cleaned up by the time the node restarted, and then two loggers were using the same output buffer. --- test/pilosa.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/test/pilosa.go b/test/pilosa.go index e7111ad92..9dbd78057 100644 --- a/test/pilosa.go +++ b/test/pilosa.go @@ -18,7 +18,6 @@ import ( "bytes" "context" "fmt" - "io" "io/ioutil" gohttp "net/http" "os" @@ -40,10 +39,6 @@ type Command struct { *server.Command commandOptions []server.CommandOption - - stdin bytes.Buffer - stdout bytes.Buffer - stderr bytes.Buffer } func OptAllowedOrigins(origins []string) server.CommandOption { @@ -65,17 +60,15 @@ func newCommand(opts ...server.CommandOption) *Command { // beginning of the option slice so that it can be overridden by user-passed // options. opts = append([]server.CommandOption{server.OptCommandCloseTimeout(time.Millisecond * 2)}, opts...) - m := &Command{Command: server.NewCommand(os.Stdin, os.Stdout, os.Stderr, opts...), commandOptions: opts} + m := &Command{commandOptions: opts} + m.Command = server.NewCommand(bytes.NewReader(nil), ioutil.Discard, ioutil.Discard, opts...) m.Config.DataDir = path m.Config.Bind = "http://localhost:0" m.Config.Cluster.Disabled = true - m.Command.Stdin = &m.stdin - m.Command.Stdout = &m.stdout - m.Command.Stderr = &m.stderr if testing.Verbose() { - m.Command.Stdout = io.MultiWriter(os.Stdout, m.Command.Stdout) - m.Command.Stderr = io.MultiWriter(os.Stderr, m.Command.Stderr) + m.Command.Stdout = os.Stdout + m.Command.Stderr = os.Stderr } return m @@ -120,7 +113,7 @@ func (m *Command) Reopen() error { // Create new main with the same config. config := m.Command.Config - m.Command = server.NewCommand(os.Stdin, os.Stdout, os.Stderr, m.commandOptions...) + m.Command = server.NewCommand(bytes.NewReader(nil), ioutil.Discard, ioutil.Discard, m.commandOptions...) m.Command.Config = config // Run new program. From 2dcdd9614cc1c2a6fad03a2917d2bd9deb153b32 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Wed, 12 Sep 2018 00:01:22 +0300 Subject: [PATCH 3/6] Added docs for the Options call --- docs/query-language.md | 66 +++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 13 deletions(-) diff --git a/docs/query-language.md b/docs/query-language.md index a61a9bf09..21722fd80 100644 --- a/docs/query-language.md +++ b/docs/query-language.md @@ -46,8 +46,10 @@ curl localhost:10101/index/repository/query \ * `field` The field specifies on which Pilosa [field](../glossary/#field) the query will operate. Valid field names are lower case strings; they start with an alphanumeric character, and contain only alphanumeric characters and `_-`. They must be 64 characters or less in length. * `TIMESTAMP` This is a timestamp in the following format `YYYY-MM-DDTHH:MM` (e.g. 2006-01-02T15:04) * `UINT` An unsigned integer (e.g. 42839) +* `BOOL` A boolean value, `true` or `false` * `ATTR_NAME` Must be a valid identifier `[A-Za-z][A-Za-z0-9._-]*` * `ATTR_VALUE` Can be a string, float, integer, or bool. +* `CALL` Any query * `ROW_CALL` Any query which returns a row, such as `Row`, `Union`, `Difference`, `Xor`, `Intersect`, `Range` * `[]ATTR_VALUE` Denotes an array of `ATTR_VALUE`s. (e.g. `["a", "b", "c"]`) @@ -112,8 +114,8 @@ Set(10, pullrequests=2) **Spec:** ``` -SetRowAttrs(, , - , +SetRowAttrs(, , + , [ATTR_NAME=ATTR_VALUE ...]) ``` @@ -150,8 +152,8 @@ SetRowAttrs(stargazer, 10, username=null) **Spec:** ``` -SetColumnAttrs(, - , +SetColumnAttrs(, + , [ATTR_NAME=ATTR_VALUE ...]) ``` @@ -262,7 +264,7 @@ Row(stargazer=1) {"attrs":{"username":"mrpi","active":true},"columns":[10, 20]} ``` -* attrs are the attributes for user 1 +* attrs are the attributes for user 1 * columns are the repositories which user 1 has starred. #### Union @@ -497,7 +499,7 @@ Range(=, , ) **Description:** Similar to `Row`, but only returns bits which were set with timestamps -between the given `start` (first) and `end` (second) timestamps. +between the given `start` (first) and `end` (second) timestamps. **Result Type:** object with attrs and bits @@ -548,14 +550,14 @@ Range(commitactivity > 100) BSI range queries support the following operators: - Operator | Name | Value + Operator | Name | Value ----------|-------------------------------|-------------------- - `>` | greater-than, GT | integer - `<` | less-than, LT | integer - `<=` | less-than-or-equal-to, LTE | integer - `>=` | greater-than-or-equal-to, GTE | integer - `==` | equal-to, EQ | integer - `!=` | not-equal-to, NEQ | integer or `null` + `>` | greater-than, GT | integer + `<` | less-than, LT | integer + `<=` | less-than-or-equal-to, LTE | integer + `>=` | greater-than-or-equal-to, GTE | integer + `==` | equal-to, EQ | integer + `!=` | not-equal-to, NEQ | integer or `null` `<`, and `<=` can be chained together to represent a bounded interval. For example: @@ -645,3 +647,41 @@ Sum(field="diskusage") ``` * Result is the sum of all values (total size of all repositories in kilobytes, here), plus the count of columns. + +### Other Operations + +#### Options + +**Spec:** + +``` +Options(, columnAttrs=, excludeColumns=, excludeRowAttrs=, shards=[UINT ...]) +``` + +**Description:** + +Modifies the given query as follows: +* `columnAttrs`: The result includes column attributes (Default: `false`). +* `excludeColumns`: Column IDs are not included in the result (Default: `false`). +* `excludeRowAttrs`: Row attributes are not included in the result (Default: `false`). +* `shards`: Runs the query only for the given shards. By default, the query is executed for all shards. + +**Result Type:** Result type of the given query. + +**Examples:** + +Return column attributes: +```request +Query(Row(f1=10), columnAttrs=true) +``` +```response +{"attrs":{},"columns":[100]}],"columnAttrs":[{"id":100,"attrs":{"foo":"bar"}} +``` + +Run the query against shards 0 and 2 only: +```request +Query(Row(f1=10), shards=[0, 2]) +``` +```response +{"attrs":{},"columns":[100, 2097152]} +``` From ec9371aae4fc48e35576bffeb54c6be6160d3c6b Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Wed, 12 Sep 2018 00:53:40 +0300 Subject: [PATCH 4/6] Updated Options docs --- docs/query-language.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/query-language.md b/docs/query-language.md index 21722fd80..bfb67789c 100644 --- a/docs/query-language.md +++ b/docs/query-language.md @@ -661,18 +661,18 @@ Options(, columnAttrs=, excludeColumns=, excludeRowAttrs=. **Examples:** Return column attributes: ```request -Query(Row(f1=10), columnAttrs=true) +Options(Row(f1=10), columnAttrs=true) ``` ```response {"attrs":{},"columns":[100]}],"columnAttrs":[{"id":100,"attrs":{"foo":"bar"}} @@ -680,7 +680,7 @@ Query(Row(f1=10), columnAttrs=true) Run the query against shards 0 and 2 only: ```request -Query(Row(f1=10), shards=[0, 2]) +Options(Row(f1=10), shards=[0, 2]) ``` ```response {"attrs":{},"columns":[100, 2097152]} From b1af66a427d96fd4da5aa372fdb4c653d629765f Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Wed, 12 Sep 2018 00:57:45 +0300 Subject: [PATCH 5/6] updated Options docs --- docs/query-language.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/query-language.md b/docs/query-language.md index bfb67789c..8af1da587 100644 --- a/docs/query-language.md +++ b/docs/query-language.md @@ -662,8 +662,8 @@ Options(, columnAttrs=, excludeColumns=, excludeRowAttrs=. From 63f1b65c0aa473830bb66895e93648e3364ec14f Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Wed, 12 Sep 2018 00:59:44 +0300 Subject: [PATCH 6/6] updated Options docs --- docs/query-language.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/query-language.md b/docs/query-language.md index 8af1da587..3db96c987 100644 --- a/docs/query-language.md +++ b/docs/query-language.md @@ -662,8 +662,8 @@ Options(, columnAttrs=, excludeColumns=, excludeRowAttrs=.