diff --git a/maxscale-system-test/sharding.cpp b/maxscale-system-test/sharding.cpp index 7c8138387..1b6cc3812 100644 --- a/maxscale-system-test/sharding.cpp +++ b/maxscale-system-test/sharding.cpp @@ -47,10 +47,7 @@ int main(int argc, char *argv[]) char user_str[256]; char pass_str[256]; - Test->repl->stop_slaves(); - - Test->restart_maxscale(); - + Test->repl->execute_query_all_nodes("STOP SLAVE"); Test->repl->connect(); for (i = 0; i < Test->repl->N; i++) //nodes @@ -68,7 +65,6 @@ int main(int argc, char *argv[]) } Test->stop_timeout(); - sleep(10); for (i = 0; i < Test->repl->N; i++) //nodes { Test->set_timeout(30); @@ -81,8 +77,9 @@ int main(int argc, char *argv[]) Test->repl->close_connections(); Test->stop_timeout(); - sleep(30); - MYSQL * conn; + sleep(10); + + MYSQL *conn; for (i = 0; i < Test->repl->N; i++) { Test->set_timeout(30); @@ -133,6 +130,7 @@ int main(int argc, char *argv[]) Test->check_log_err((char *) "Unable to parse query", false); Test->check_log_err((char *) "query string allocation failed", false); + Test->repl->connect(); /** Cleanup */ for (i = 0; i < Test->repl->N; i++) { @@ -146,6 +144,9 @@ int main(int argc, char *argv[]) execute_query(Test->repl->nodes[i], "DROP DATABASE IF EXISTS shard_db%d", i); } + Test->repl->execute_query_all_nodes("START SLAVE"); + sleep(1); + Test->repl->fix_replication(); int rval = Test->global_result; delete Test; return rval; diff --git a/server/modules/routing/schemarouter/schemaroutersession.cc b/server/modules/routing/schemarouter/schemaroutersession.cc index 174f52b36..e9c2f5993 100644 --- a/server/modules/routing/schemarouter/schemaroutersession.cc +++ b/server/modules/routing/schemarouter/schemaroutersession.cc @@ -473,10 +473,10 @@ void SchemaRouterSession::handle_mapping_reply(SSRBackend& bref, GWBUF** pPacket rc = -1; } } - - if (m_queue.size() && rc != -1) + else if (m_queue.size() && rc != -1) { ss_dassert(m_state == INIT_READY || m_state == INIT_USE_DB); + MXS_INFO("Routing stored query"); route_queued_query(); } } @@ -943,11 +943,13 @@ bool SchemaRouterSession::handle_default_db() data[3] = 0x0; data[4] = 0x2; memcpy(data + 5, m_connect_db.c_str(), qlen); + SSRBackend backend; DCB* dcb = NULL; - if (get_shard_dcb(&dcb, target->unique_name)) + if (get_shard_dcb(&dcb, target->unique_name) && + (backend = get_bref_from_dcb(dcb))) { - dcb->func.write(dcb, buffer); + backend->write(buffer); MXS_DEBUG("USE '%s' sent to %s for session %p", m_connect_db.c_str(), target->unique_name, @@ -1020,6 +1022,7 @@ int SchemaRouterSession::inspect_mapping_states(SSRBackend& bref, if (rc == SHOWDB_FULL_RESPONSE) { (*it)->set_mapped(true); + (*it)->ack_write(); MXS_DEBUG("Received SHOW DATABASES reply from %s for session %p", (*it)->backend()->server->unique_name, m_client->session);