@@ -345,7 +345,7 @@ func (proxy *ProxySQLProxy) Refresh() error {
345
345
346
346
// if server is Standalone, and writer set offline in ProxySQL
347
347
if s .State == stateUnconn && bke .PrxStatus == "ONLINE" {
348
- cluster .LogModulePrintf (cluster .Conf .Verbose , config .ConstLogModProxySQL , config .LvlInfo , "Monitor ProxySQL setting writer offline standalone server %s" , s .URL )
348
+ cluster .LogModulePrintf (cluster .Conf .Verbose , config .ConstLogModProxySQL , config .LvlDbg , "Monitor ProxySQL setting writer offline standalone server %s" , s .URL )
349
349
err = psql .SetOffline (misc .Unbracket (s .Host ), s .Port )
350
350
if err != nil {
351
351
cluster .StateMachine .AddState ("ERR00070" , state.State {ErrType : "WARNING" , ErrDesc : fmt .Sprintf (clusterError ["ERR00070" ], err , s .URL ), ErrFrom : "PRX" , ServerUrl : proxy .Name })
@@ -365,19 +365,18 @@ func (proxy *ProxySQLProxy) Refresh() error {
365
365
} else if s .IsLeader () && (s .PrevState == stateUnconn || s .PrevState == stateFailed || (len (proxy .BackendsWrite ) == 0 || ! isFoundBackendWrite )) {
366
366
// if the master comes back from a previously failed or standalone state, reintroduce it in
367
367
// the appropriate HostGroup
368
- errstr := ""
369
- if err != nil {
370
- errstr = err .Error ()
371
- }
372
- cluster .StateMachine .AddState ("ERR00071" , state.State {ErrType : "WARNING" , ErrDesc : fmt .Sprintf (clusterError ["ERR00071" ], proxy .Name , s .URL , errstr ), ErrFrom : "PRX" , ServerUrl : proxy .Name })
368
+
373
369
if psql .ExistAsWriterOrOffline (misc .Unbracket (s .Host ), s .Port ) {
374
370
err = psql .SetOnline (misc .Unbracket (s .Host ), s .Port )
375
371
if err != nil {
376
- cluster .LogModulePrintf (cluster .Conf .Verbose , config .ConstLogModProxySQL , config .LvlErr , "Monitor ProxySQL setting online failed server %s" , s .URL )
372
+ cluster .LogModulePrintf (cluster .Conf .Verbose , config .ConstLogModProxySQL , config .LvlErr , "Monitor ProxySQL setting online failed server %s: %s " , s .URL , err . Error () )
377
373
}
378
374
} else {
379
375
//scenario restart with failed leader
380
376
err = psql .AddServerAsWriter (misc .Unbracket (s .Host ), s .Port , proxy .UseSSL ())
377
+ if err != nil {
378
+ cluster .StateMachine .AddState ("ERR00071" , state.State {ErrType : "WARNING" , ErrDesc : fmt .Sprintf (clusterError ["ERR00071" ], proxy .Name , s .URL ), ErrFrom : "PRX" , ServerUrl : proxy .Name })
379
+ }
381
380
}
382
381
updated = true
383
382
0 commit comments