MXS-1625 Remove runtime checks for impossible errors

A readwritesplit session must have a client DCB and the DCB must
have data, otherwise the system is seriously broken. So no point
in checking for that and logging an error. Situations like that
might have been possible in the olden days when a session could
be manipulated by multiple threads at the same time.
This commit is contained in:
Johan Wikman
2018-04-05 12:12:54 +03:00
parent 8c0033ccb2
commit 340c132096

View File

@ -473,46 +473,19 @@ handle_multi_temp_and_load(RWSplitSession *rses, GWBUF *querybuf,
}
}
/*
* Make checks prior to calling temp tables functions
/**
* Check if the query has anything to do with temporary tables.
*/
if (rses == NULL || querybuf == NULL ||
rses->m_client == NULL || rses->m_client->data == NULL)
if (rses->qc().have_tmp_tables() && is_packet_a_query(packet_type))
{
if (rses == NULL || querybuf == NULL)
check_drop_tmp_table(rses, querybuf);
if (is_read_tmp_table(rses, querybuf, *qtype))
{
MXS_ERROR("[%s] Error: NULL variables for temp table checks: %p %p", __FUNCTION__,
rses, querybuf);
}
if (rses->m_client == NULL)
{
MXS_ERROR("[%s] Error: Client DCB is NULL.", __FUNCTION__);
}
if (rses->m_client->data == NULL)
{
MXS_ERROR("[%s] Error: User data in master server DBC is NULL.",
__FUNCTION__);
*qtype |= QUERY_TYPE_MASTER_READ;
}
}
else
{
/**
* Check if the query has anything to do with temporary tables.
*/
if (rses->qc().have_tmp_tables() && is_packet_a_query(packet_type))
{
check_drop_tmp_table(rses, querybuf);
if (is_read_tmp_table(rses, querybuf, *qtype))
{
*qtype |= QUERY_TYPE_MASTER_READ;
}
}
check_create_tmp_table(rses, querybuf, *qtype);
}
check_create_tmp_table(rses, querybuf, *qtype);
/**
* Check if this is a LOAD DATA LOCAL INFILE query. If so, send all queries
@ -639,5 +612,10 @@ RouteInfo::RouteInfo(RWSplitSession* rses, GWBUF* buffer)
, type(QUERY_TYPE_UNKNOWN)
, stmt_id(0)
{
ss_dassert(rses);
ss_dassert(rses->m_client);
ss_dassert(rses->m_client->data);
ss_dassert(buffer);
target = get_target_type(rses, buffer, &command, &type, &stmt_id);
}