diff --git a/src/factory/MySQLTaskImpl.cc b/src/factory/MySQLTaskImpl.cc index bfc8a34f..4b3f86e1 100644 --- a/src/factory/MySQLTaskImpl.cc +++ b/src/factory/MySQLTaskImpl.cc @@ -250,12 +250,11 @@ CommMessageOut *ComplexMySQLTask::message_out() auto *target = (RouteManager::RouteTarget *)this->get_target(); /* If it's a transaction task, generate a ECONNRESET error when - * the target is reconnected. */ + * the target was reconnected. */ if (seqid <= 3 && (seqid == 2 || res_charset_.size() != 0)) { if (target->state) { - target->state = 0; errno = ECONNRESET; return NULL; } @@ -604,6 +603,13 @@ bool ComplexMySQLTask::finish_once() return false; } + if (this->is_fixed_addr() && this->state != WFT_STATE_SUCCESS) + { + auto *target = (RouteManager::RouteTarget *)this->get_target(); + if (target) + target->state = 0; + } + return true; }