]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: checks: Make post-41 the default mode for mysql checks
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 18 May 2020 16:13:03 +0000 (18:13 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 18 May 2020 16:32:09 +0000 (18:32 +0200)
MySQL 4.1 is old enough to be the default mode for mysql checks. So now, once a
username is defined, post-41 mode is automatically used. To do mysql checks on
previous MySQL version, the argument "pre-41" must be used.

Note, it is a compatibility breakage for everyone using an antique and
unsupported MySQL version.

doc/configuration.txt
reg-tests/checks/mysql-check.vtc
src/checks.c

index a8ba58a902ae180c516c0e3327422dd753ba3180..e434a4750d5eb1c99358cbc44b1e7cb3d1943c6a 100644 (file)
@@ -7745,14 +7745,15 @@ no option logasap
              logging.
 
 
-option mysql-check [ user <username> [ post-41 ] ]
+option mysql-check [ user <username> [ { post-41 | pre-41 } ] ]
   Use MySQL health checks for server testing
   May be used in sections :   defaults | frontend | listen | backend
                                  yes   |    no    |   yes  |   yes
   Arguments :
     <username> This is the username which will be used when connecting to MySQL
                server.
-    post-41    Send post v4.1 client compatible checks
+    post-41    Send post v4.1 client compatible checks (the default)
+    pre-41     Send pre v4.1 client compatible checks
 
   If you specify a username, the check consists of sending two MySQL packet,
   one Client Authentication packet, and one QUIT packet, to correctly close
index 061f2c1bba7549251a43198582bb78f46e52a619..5344d95fcc95cc9a72d06b23ba06eb3f7b90b16e 100644 (file)
@@ -89,13 +89,13 @@ haproxy h1 -conf {
     backend be2
         log ${S2_addr}:${S2_port} daemon
         option log-health-checks
-        option mysql-check user user
+        option mysql-check user user pre-41
         server srv ${h1_mysql1_addr}:${h1_mysql1_port} check inter 1s rise 1 fall 1
 
     backend be3
         log ${S3_addr}:${S3_port} daemon
         option log-health-checks
-        option mysql-check user user post-41
+        option mysql-check user user
         server srv ${h1_mysql2_addr}:${h1_mysql2_port} check inter 1s rise 1 fall 1
 
     backend be4
index d22c113100badd259a2008452428d561f425649e..74b0fc85f8205a213719e0c465e4ee659fe2bcf5 100644 (file)
@@ -6852,21 +6852,21 @@ int proxy_parse_mysql_check_opt(char **args, int cur_arg, struct proxy *curpx, s
                        goto error;
                }
 
-               if (*args[cur_arg+2]) {
-                       if (strcmp(args[cur_arg+2], "post-41") != 0) {
-                               ha_alert("parsing [%s:%d] : keyword '%s' only supports option 'post-41' (got '%s').\n",
-                                        file, line, args[cur_arg], args[cur_arg+2]);
-                               goto error;
-                       }
+               if (!*args[cur_arg+2] || strcmp(args[cur_arg+2], "post-41") == 0) {
                        packetlen = userlen + 7 + 27;
                        mysql_req = mysql41_req;
                        mysql_rsname  = mysql41_rsname;
                }
-               else {
+               else if (strcmp(args[cur_arg+2], "pre-41") == 0) {
                        packetlen = userlen + 7;
                        mysql_req = mysql40_req;
                        mysql_rsname  = mysql40_rsname;
                }
+               else  {
+                       ha_alert("parsing [%s:%d] : keyword '%s' only supports 'post-41' and 'pre-41' (got '%s').\n",
+                                file, line, args[cur_arg], args[cur_arg+2]);
+                       goto error;
+               }
 
                hdr[0] = (unsigned char)(packetlen & 0xff);
                hdr[1] = (unsigned char)((packetlen >> 8) & 0xff);