Skip to content

Commit 2fb524f

Browse files
Adds 'hosts' command to server
1 parent 8ae02ef commit 2fb524f

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

go/logic/server.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2016 GitHub Inc.
2+
Copyright 2021 GitHub Inc.
33
See https://github.com/github/gh-ost/blob/master/LICENSE
44
*/
55

@@ -146,7 +146,8 @@ func (this *Server) applyServerCommand(command string, writer *bufio.Writer) (pr
146146
fmt.Fprint(writer, `available commands:
147147
status # Print a detailed status message
148148
sup # Print a short status message
149-
coordinates # Print the currently inspected coordinates
149+
coordinates # Print the currently inspected coordinates
150+
hosts # Print the list of hosts used to perform the migration (hostname, applier and migrator)
150151
chunk-size=<newsize> # Set a new chunk-size
151152
dml-batch-size=<newsize> # Set a new dml-batch-size
152153
nice-ratio=<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
177178
}
178179
return NoPrintStatusRule, fmt.Errorf("coordinates are read-only")
179180
}
181+
case "hosts":
182+
fields := map[string]interface{}{
183+
"Applier": this.migrationContext.GetApplierHostname(),
184+
"Hostname": this.migrationContext.Hostname,
185+
"Inspector": this.migrationContext.GetInspectorHostname(),
186+
}
187+
for key, val := range fields {
188+
fmt.Fprintf(writer, "%s: %v", key, val)
189+
}
190+
return NoPrintStatusRule, nil
180191
case "chunk-size":
181192
{
182193
if argIsQuestion {

0 commit comments

Comments
 (0)