Skip to content

Commit d95dda3

Browse files
Merge pull request #951 from timvaillancourt/add-server-cmd-hosts
Add 'applier' and 'inspector' commands to server
2 parents 08085b7 + 157dba9 commit d95dda3

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

doc/interactive-commands.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Both interfaces may serve at the same time. Both respond to simple text command,
1818
- `status`: returns a detailed status summary of migration progress and configuration
1919
- `sup`: returns a brief status summary of migration progress
2020
- `coordinates`: returns recent (though not exactly up to date) binary log coordinates of the inspected server
21+
- `applier`: returns the hostname of the applier
22+
- `inspector`: returns the hostname of the inspector
2123
- `chunk-size=<newsize>`: modify the `chunk-size`; applies on next running copy-iteration
2224
- `dml-batch-size=<newsize>`: modify the `dml-batch-size`; applies on next applying of binary log events
2325
- `max-lag-millis=<max-lag>`: modify the maximum replication lag threshold (milliseconds, minimum value is `100`, i.e. `0.1` second)

go/logic/server.go

Lines changed: 20 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,9 @@ 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+
applier # Print the hostname of the applier
151+
inspector # Print the hostname of the inspector
150152
chunk-size=<newsize> # Set a new chunk-size
151153
dml-batch-size=<newsize> # Set a new dml-batch-size
152154
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 +179,22 @@ help # This message
177179
}
178180
return NoPrintStatusRule, fmt.Errorf("coordinates are read-only")
179181
}
182+
case "applier":
183+
if this.migrationContext.ApplierConnectionConfig != nil && this.migrationContext.ApplierConnectionConfig.ImpliedKey != nil {
184+
fmt.Fprintf(writer, "Host: %s, Version: %s\n",
185+
this.migrationContext.ApplierConnectionConfig.ImpliedKey.String(),
186+
this.migrationContext.ApplierMySQLVersion,
187+
)
188+
}
189+
return NoPrintStatusRule, nil
190+
case "inspector":
191+
if this.migrationContext.InspectorConnectionConfig != nil && this.migrationContext.InspectorConnectionConfig.ImpliedKey != nil {
192+
fmt.Fprintf(writer, "Host: %s, Version: %s\n",
193+
this.migrationContext.InspectorConnectionConfig.ImpliedKey.String(),
194+
this.migrationContext.InspectorMySQLVersion,
195+
)
196+
}
197+
return NoPrintStatusRule, nil
180198
case "chunk-size":
181199
{
182200
if argIsQuestion {

0 commit comments

Comments
 (0)