@@ -126,7 +126,7 @@ func (this *Server) applyServerCommand(command string, writer *bufio.Writer) (pr
126126 if len (tokens ) > 1 {
127127 arg = strings .TrimSpace (tokens [1 ])
128128 }
129-
129+ argIsQuestion := ( arg == "?" )
130130 throttleHint := "# Note: you may only throttle for as long as your binary logs are not purged\n "
131131
132132 if err := this .hooksExecutor .onInteractiveCommand (command ); err != nil {
@@ -152,6 +152,7 @@ no-throttle # End forced throttling (other throttling m
152152unpostpone # Bail out a cut-over postpone; proceed to cut-over
153153panic # panic and quit without cleanup
154154help # This message
155+ - use '?' (question mark) as argument to get info rather than set. e.g. "max-load=?" will just print out current max-load.
155156` )
156157 }
157158 case "sup" :
@@ -160,6 +161,10 @@ help # This message
160161 return ForcePrintStatusAndHintRule , nil
161162 case "chunk-size" :
162163 {
164+ if argIsQuestion {
165+ fmt .Fprintf (writer , "%+v\n " , atomic .LoadInt64 (& this .migrationContext .ChunkSize ))
166+ return NoPrintStatusRule , nil
167+ }
163168 if chunkSize , err := strconv .Atoi (arg ); err != nil {
164169 return NoPrintStatusRule , err
165170 } else {
@@ -169,6 +174,10 @@ help # This message
169174 }
170175 case "max-lag-millis" :
171176 {
177+ if argIsQuestion {
178+ fmt .Fprintf (writer , "%+v\n " , atomic .LoadInt64 (& this .migrationContext .MaxLagMillisecondsThrottleThreshold ))
179+ return NoPrintStatusRule , nil
180+ }
172181 if maxLagMillis , err := strconv .Atoi (arg ); err != nil {
173182 return NoPrintStatusRule , err
174183 } else {
@@ -182,6 +191,10 @@ help # This message
182191 }
183192 case "nice-ratio" :
184193 {
194+ if argIsQuestion {
195+ fmt .Fprintf (writer , "%+v\n " , this .migrationContext .GetNiceRatio ())
196+ return NoPrintStatusRule , nil
197+ }
185198 if niceRatio , err := strconv .ParseFloat (arg , 64 ); err != nil {
186199 return NoPrintStatusRule , err
187200 } else {
@@ -191,26 +204,44 @@ help # This message
191204 }
192205 case "max-load" :
193206 {
207+ if argIsQuestion {
208+ maxLoad := this .migrationContext .GetMaxLoad ()
209+ fmt .Fprintf (writer , "%s\n " , maxLoad .String ())
210+ return NoPrintStatusRule , nil
211+ }
194212 if err := this .migrationContext .ReadMaxLoad (arg ); err != nil {
195213 return NoPrintStatusRule , err
196214 }
197215 return ForcePrintStatusAndHintRule , nil
198216 }
199217 case "critical-load" :
200218 {
219+ if argIsQuestion {
220+ criticalLoad := this .migrationContext .GetCriticalLoad ()
221+ fmt .Fprintf (writer , "%s\n " , criticalLoad .String ())
222+ return NoPrintStatusRule , nil
223+ }
201224 if err := this .migrationContext .ReadCriticalLoad (arg ); err != nil {
202225 return NoPrintStatusRule , err
203226 }
204227 return ForcePrintStatusAndHintRule , nil
205228 }
206229 case "throttle-query" :
207230 {
231+ if argIsQuestion {
232+ fmt .Fprintf (writer , "%+v\n " , this .migrationContext .GetThrottleQuery ())
233+ return NoPrintStatusRule , nil
234+ }
208235 this .migrationContext .SetThrottleQuery (arg )
209236 fmt .Fprintf (writer , throttleHint )
210237 return ForcePrintStatusAndHintRule , nil
211238 }
212239 case "throttle-control-replicas" :
213240 {
241+ if argIsQuestion {
242+ fmt .Fprintf (writer , "%s\n " , this .migrationContext .GetThrottleControlReplicaKeys ().ToCommaDelimitedList ())
243+ return NoPrintStatusRule , nil
244+ }
214245 if err := this .migrationContext .ReadThrottleControlReplicaKeys (arg ); err != nil {
215246 return NoPrintStatusRule , err
216247 }
0 commit comments