From ceb1c0f2a491c1154587cb1667f7d2e5f666c461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Sat, 30 Jun 2018 17:18:47 +0300 Subject: [PATCH] MXS-1950: Add missing error messages When a valid target was not found, no error message was logged by the router. This would cause the "Routing the query failed. Session will be closed." message to be logged with no explanation as to why the routing failed. In addition to the above-mentioned case, no message would be logged if the target for a COM_STMT_FETCH was not in use. --- .../routing/readwritesplit/rwsplit_route_stmt.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index 649d76e86..8f517c146 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -278,6 +278,11 @@ bool route_single_stmt(RWSplit *inst, RWSplitSession *rses, GWBUF *querybuf, con MXS_INFO("COM_STMT_EXECUTE on %s", target->uri()); } } + else + { + MXS_ERROR("Could not find valid server for target type %s, closing " + "connection.", STRTARGET(route_target)); + } } if (succp && inst->config().connection_keepalive && @@ -1002,11 +1007,12 @@ SRWBackend handle_slave_is_target(RWSplit *inst, RWSplitSession *rses, if (it->second->in_use()) { target = it->second; - MXS_INFO("COM_STMT_FETCH on %s", target->uri()); + MXS_INFO("COM_STMT_FETCH on %s", target->name()); } else { - MXS_INFO("Old target not in use, cannot proceed"); + MXS_ERROR("Old COM_STMT_EXECUTE target %s not in use, cannot " + "proceed with COM_STMT_FETCH", it->second->name()); } } else @@ -1014,8 +1020,7 @@ SRWBackend handle_slave_is_target(RWSplit *inst, RWSplitSession *rses, MXS_WARNING("Unknown statement ID %u used in COM_STMT_FETCH", stmt_id); } } - - if (!target) + else { target = get_target_backend(rses, BE_SLAVE, NULL, rlag_max); }