1
0
Fork 0

CHANGELOG

master
Philip O'Toole 9 months ago
parent 9d329ead4e
commit 701567e765

@ -1,4 +1,7 @@
## 8.14.2 (unreleased) ## 8.15.0 (unreleased)
### New features
- [PR #1550](https://github.com/rqlite/rqlite/pull/1550): CLI command `.nodes` supports showing non-voting nodes.
### Implementation changes and bug fixes ### Implementation changes and bug fixes
- [PR #1548](https://github.com/rqlite/rqlite/pull/1548): Make system-level test failures easier to understand. - [PR #1548](https://github.com/rqlite/rqlite/pull/1548): Make system-level test failures easier to understand.

@ -62,7 +62,7 @@ var cliHelp = []string{
`.ready Show ready status for connected node`, `.ready Show ready status for connected node`,
`.remove NODEID Remove node NODEID from the cluster`, `.remove NODEID Remove node NODEID from the cluster`,
`.restore FILE Load using SQLite file or SQL dump contained in FILE`, `.restore FILE Load using SQLite file or SQL dump contained in FILE`,
`.nodes Show connection status of all nodes in cluster`, `.nodes [all] Show connection status of voting nodes. 'all' to show all nodes`,
`.schema Show CREATE statements for all tables`, `.schema Show CREATE statements for all tables`,
`.status Show status and diagnostic information for connected node`, `.status Show status and diagnostic information for connected node`,
`.sysdump FILE Dump system diagnostics to FILE`, `.sysdump FILE Dump system diagnostics to FILE`,
@ -177,7 +177,11 @@ func main() {
case ".READY": case ".READY":
err = ready(ctx, httpClient, argv) err = ready(ctx, httpClient, argv)
case ".NODES": case ".NODES":
err = nodes(ctx, cmd, line, argv) if index == -1 || index == len(line)-1 {
err = nodes(ctx, cmd, line, argv, false)
break
}
err = nodes(ctx, cmd, line, argv, true)
case ".EXPVAR": case ".EXPVAR":
err = expvar(ctx, cmd, line, argv) err = expvar(ctx, cmd, line, argv)
case ".REMOVE": case ".REMOVE":
@ -314,9 +318,15 @@ func ready(ctx *cli.Context, client *http.Client, argv *argT) error {
return nil return nil
} }
func nodes(ctx *cli.Context, cmd, line string, argv *argT) error { // nodes returns the status of nodes in the cluster. If all is true, then
url := fmt.Sprintf("%s://%s/nodes", argv.Protocol, address6(argv)) // non-voting nodes are included in the response.
return cliJSON(ctx, cmd, line, url, argv) func nodes(ctx *cli.Context, cmd, line string, argv *argT, all bool) error {
path := "nodes"
if all {
path = "nodes?nonvoters"
}
url := fmt.Sprintf("%s://%s/%s", argv.Protocol, address6(argv), path)
return cliJSON(ctx, cmd, "", url, argv)
} }
func expvar(ctx *cli.Context, cmd, line string, argv *argT) error { func expvar(ctx *cli.Context, cmd, line string, argv *argT) error {
@ -516,7 +526,9 @@ func parseResponse(response *[]byte, ret interface{}) error {
return decoder.Decode(ret) return decoder.Decode(ret)
} }
// cliJSON fetches JSON from a URL, and displays it at the CLI. // cliJSON fetches JSON from a URL, and displays it at the CLI. If line contains more
// than one word, then the JSON is filtered to only show the key specified in the
// second word.
func cliJSON(ctx *cli.Context, cmd, line, url string, argv *argT) error { func cliJSON(ctx *cli.Context, cmd, line, url string, argv *argT) error {
// Recursive JSON printer. // Recursive JSON printer.
var pprint func(indent int, m map[string]interface{}) var pprint func(indent int, m map[string]interface{})

Loading…
Cancel
Save