Skip to content

Commit 565fed6

Browse files
Merge pull request #650 from signal18/proxysql
Log Module Proxysql
2 parents e7a72f5 + 040e005 commit 565fed6

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

cluster/prx_proxysql.go

+16-16
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,9 @@ func (proxy *ProxySQLProxy) Refresh() error {
325325
if cluster.Conf.ProxysqlBootstrap && cluster.IsDiscovered() {
326326
// if ProxySQL and replication-manager states differ, resolve the conflict
327327
if bke.PrxStatus == "OFFLINE_HARD" && s.State == stateSlave && !s.IsIgnored() {
328-
if cluster.Conf.ProxysqlDebug {
329-
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlInfo, "Monitor ProxySQL setting online as reader rejoining server %s", s.URL)
330-
}
328+
// if cluster.Conf.ProxysqlDebug {
329+
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlDbg, "Monitor ProxySQL setting online as reader rejoining server %s", s.URL)
330+
// }
331331
err = psql.SetReader(misc.Unbracket(s.Host), s.Port)
332332
if err != nil {
333333
cluster.StateMachine.AddState("ERR00069", state.State{ErrType: "WARNING", ErrDesc: fmt.Sprintf(clusterError["ERR00069"], s.URL, err), ErrFrom: "PRX", ServerUrl: proxy.Name})
@@ -336,9 +336,9 @@ func (proxy *ProxySQLProxy) Refresh() error {
336336
}
337337

338338
if s.IsSlaveOrSync() && s.IsMaintenance && isFoundBackendRead && bke.PrxStatus == "ONLINE" {
339-
if cluster.Conf.ProxysqlDebug {
340-
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlInfo, "Monitor ProxySQL replicat %s Offline SOFT from reader group cause by maintenance ", s.URL)
341-
}
339+
// if cluster.Conf.ProxysqlDebug {
340+
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlDbg, "Monitor ProxySQL replicat %s Offline SOFT from reader group cause by maintenance ", s.URL)
341+
// }
342342
err = psql.SetOfflineSoft(misc.Unbracket(s.Host), s.Port)
343343
updated = true
344344
}
@@ -383,9 +383,9 @@ func (proxy *ProxySQLProxy) Refresh() error {
383383

384384
} else if s.IsLeader() && !isFoundBackendRead && (cluster.Configurator.HasProxyReadLeader() || (cluster.Configurator.HasProxyReadLeaderNoSlave() && cluster.HasNoValidSlave())) {
385385
// Add leader in reader group if not found and setup
386-
if cluster.Conf.ProxysqlDebug {
387-
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlInfo, "Monitor ProxySQL add leader in reader group in %s", s.URL)
388-
}
386+
// if cluster.Conf.ProxysqlDebug {
387+
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlDbg, "Monitor ProxySQL add leader in reader group in %s", s.URL)
388+
// }
389389
err = psql.AddServerAsReader(misc.Unbracket(s.Host), s.Port, "1", strconv.Itoa(s.ClusterGroup.Conf.PRXServersBackendMaxReplicationLag), strconv.Itoa(s.ClusterGroup.Conf.PRXServersBackendMaxConnections), strconv.Itoa(misc.Bool2Int(s.ClusterGroup.Conf.PRXServersBackendCompression)), proxy.UseSSL())
390390
if err != nil {
391391
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlErr, "ProxySQL could not add reader %s (%s)", s.URL, err)
@@ -395,9 +395,9 @@ func (proxy *ProxySQLProxy) Refresh() error {
395395
// Drop the leader in reader group if not found and setup
396396
// Cancel learder remove because no valid reader
397397
if !cluster.Configurator.HasProxyReadLeaderNoSlave() || (cluster.Configurator.HasProxyReadLeaderNoSlave() && !cluster.HasNoValidSlave()) {
398-
if cluster.Conf.ProxysqlDebug {
399-
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlInfo, "Monitor ProxySQL Drop the leader in reader group from %s", s.URL)
400-
}
398+
// if cluster.Conf.ProxysqlDebug {
399+
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlDbg, "Monitor ProxySQL Drop the leader in reader group from %s", s.URL)
400+
// }
401401
err = psql.DropReader(misc.Unbracket(s.Host), s.Port)
402402
if err != nil {
403403
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlErr, "ProxySQL could not drop reader in %s (%s)", s.URL, err)
@@ -406,9 +406,9 @@ func (proxy *ProxySQLProxy) Refresh() error {
406406
}
407407
} else if s.IsSlaveOrSync() && !s.IsIgnored() && (s.PrevState == stateUnconn || s.PrevState == stateFailed) {
408408
err = psql.SetReader(misc.Unbracket(s.Host), s.Port)
409-
if cluster.Conf.ProxysqlDebug {
410-
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlDbg, "Monitor ProxySQL setting reader standalone server %s", s.URL)
411-
}
409+
// if cluster.Conf.ProxysqlDebug {
410+
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlDbg, "Monitor ProxySQL setting reader standalone server %s", s.URL)
411+
// }
412412
if err != nil {
413413
cluster.StateMachine.AddState("ERR00072", state.State{ErrType: "WARNING", ErrDesc: fmt.Sprintf(clusterError["ERR00072"], proxy.Name, s.URL, err), ErrFrom: "PRX", ServerUrl: proxy.Name})
414414
}
@@ -422,7 +422,7 @@ func (proxy *ProxySQLProxy) Refresh() error {
422422
// //Set the alert if proxysql status is OFFLINE_SOFT
423423
if (bke.PrxStatus == "OFFLINE_SOFT" || bkeread.PrxStatus == "OFFLINE_SOFT") && !s.IsMaintenance {
424424
if !cluster.StateMachine.IsInState("ERR00091") {
425-
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlInfo, clusterError["ERR00091"], proxy.Name, s.URL)
425+
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModProxySQL, config.LvlWarn, clusterError["ERR00091"], proxy.Name, s.URL)
426426
}
427427
cluster.StateMachine.AddState("ERR00091", state.State{ErrType: "WARNING", ErrDesc: fmt.Sprintf(clusterError["ERR00091"], proxy.Name, s.URL), ErrFrom: "PRX", ServerUrl: proxy.Name})
428428
// s.SwitchMaintenance()

0 commit comments

Comments
 (0)