From d41fe5b9c733f4fcf18b240779ce62cbf7831fd3 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Fri, 15 Jan 2016 14:10:06 +0200 Subject: [PATCH] Added extra checks to readwritesplit Added a check that the master server reference is actually in use before doing anything with it. Also removed a false assertion. --- server/modules/routing/readwritesplit/readwritesplit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index 5c7f10aa5..0aeb149a7 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -1675,6 +1675,8 @@ static qc_query_type_t is_read_tmp_table( return type; } + if (BREF_IS_IN_USE(router_cli_ses->rses_master_ref)) + { rses_prop_tmp = router_cli_ses->rses_properties[RSES_PROP_TYPE_TMPTABLES]; master_dcb = router_cli_ses->rses_master_ref->bref_dcb; @@ -1736,7 +1738,8 @@ static qc_query_type_t is_read_tmp_table( } free(tbl); } - + } + return qtype; } @@ -2488,8 +2491,7 @@ static bool route_single_stmt( #if defined(SS_EXTRA_DEBUG) MXS_INFO("Found DCB for slave."); #endif - ss_dassert(get_root_master_bref(rses) == - rses->rses_master_ref); + atomic_add(&inst->stats.n_slave, 1); } else