From 2fb524f43a8d24e9b3f8e5e1f26624780112913f Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Fri, 2 Apr 2021 01:50:11 +0200 Subject: [PATCH] Adds 'hosts' command to server --- go/logic/server.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/go/logic/server.go b/go/logic/server.go index 1606884..aa5b43a 100644 --- a/go/logic/server.go +++ b/go/logic/server.go @@ -1,5 +1,5 @@ /* - Copyright 2016 GitHub Inc. + Copyright 2021 GitHub Inc. See https://github.com/github/gh-ost/blob/master/LICENSE */ @@ -146,7 +146,8 @@ func (this *Server) applyServerCommand(command string, writer *bufio.Writer) (pr fmt.Fprint(writer, `available commands: status # Print a detailed status message sup # Print a short status message -coordinates # Print the currently inspected coordinates +coordinates # Print the currently inspected coordinates +hosts # Print the list of hosts used to perform the migration (hostname, applier and migrator) chunk-size= # Set a new chunk-size dml-batch-size= # Set a new dml-batch-size nice-ratio= # Set a new nice-ratio, immediate sleep after each row-copy operation, float (examples: 0 is aggressive, 0.7 adds 70% runtime, 1.0 doubles runtime, 2.0 triples runtime, ...) @@ -177,6 +178,16 @@ help # This message } return NoPrintStatusRule, fmt.Errorf("coordinates are read-only") } + case "hosts": + fields := map[string]interface{}{ + "Applier": this.migrationContext.GetApplierHostname(), + "Hostname": this.migrationContext.Hostname, + "Inspector": this.migrationContext.GetInspectorHostname(), + } + for key, val := range fields { + fmt.Fprintf(writer, "%s: %v", key, val) + } + return NoPrintStatusRule, nil case "chunk-size": { if argIsQuestion {