Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #3310: Improve error reporting for 'MySQL_Monitor' and 'MySQL_Session' backend connections via counters #3311

Merged
merged 7 commits into from
Mar 2, 2021
20 changes: 20 additions & 0 deletions include/MySQL_Monitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,26 @@ struct cmp_str {
#define AWS_Aurora_Nentries 50

#define N_L_ASE 16

/**
* Enum holding the different connection errors that could be reached for
* the backend connections oppened by 'MySQL_Monitor' module.
*/
enum PROXYSQL_MONITOR_ERR {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why we have PROXYSQL_MONITOR_ERR and not just extend PROXYSQL_MYSQL_ERR ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it could be handy to have a clear separation between general errors and monitoring errors, easier to remember error code ranges that particular values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes the maintenance more difficult.
Especially in cases in which they overlap.
For example, a ping can timeout no matter if in MySQL Session or on Monitor.
On the same topic, I think I don't see a counter for ping timeout in Monitor

ER_PROXYSQL_ASSUME_SRV_READ_ONLY = 10000,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my other comments, I think 7 enums should go away, and 5 should stay

ER_PROXYSQL_GR_HEALTH_CHECK_TIMEOUT,
ER_PROXYSQL_GR_HEALTH_CHECKS_MISSED,
ER_PROXYSQL_READ_ONLY_CHECK_CONN_TIMEOUT,
ER_PROXYSQL_READ_ONLY_CHECK_TIMEOUT,
ER_PROXYSQL_GALERA_HEALTH_CHECK_CONN_TIMEOUT,
ER_PROXYSQL_GALERA_HEALTH_CHECK_TIMEOUT,
ER_PROXYSQL_HEALTH_CHECKS_MISSED,
ER_PROXYSQL_SRV_NULL_REPLICATION_LAG,
ER_PROXYSQL_AWS_NO_PINGABLE_SRV,
ER_PROXYSQL_AWS_HEALTH_CHECK_CONN_TIMEOUT,
ER_PROXYSQL_AWS_HEALTH_CHECK_TIMEOUT,
};

/*

Implementation of monitoring in AWS Aurora will be different than previous modules
Expand Down
11 changes: 11 additions & 0 deletions include/MySQL_Protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@

#define RESULTSET_BUFLEN 16300

/**
* Enum holding the different MySQL connection errors that are used to report
* invalid states in the backend connections.
*/
enum PROXYSQL_MYSQL_ERR {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While here, we could also have added error codes 9001 to 9003

ER_PROXYSQL_OFFLINE_SRV = 9004,
ER_PROXYSQL_LAGGING_SRV,
ER_PROXYSQL_PING_TIMEOUT,
ER_PROXYSQL_CHANGE_USER_TIMEOUT
};

extern MySQL_Variables mysql_variables;

/* The default mariadb-connecter 3.1.4 does not yet implement CLIENT_DEPRECATE_EOF
Expand Down
Loading