MXS-2020 Replace ss[_info]_dassert with mxb_assert[_message]

This commit is contained in:
Johan Wikman
2018-08-22 09:59:02 +03:00
parent b1e405442f
commit 3f53eddbde
161 changed files with 1640 additions and 1643 deletions

View File

@ -285,7 +285,7 @@ int MySQLSendHandshake(DCB* dcb)
// allocate memory for packet header + payload
if ((buf = gwbuf_alloc(sizeof(mysql_packet_header) + mysql_payload_size)) == NULL)
{
ss_dassert(buf != NULL);
mxb_assert(buf != NULL);
return 0;
}
outbuf = GWBUF_DATA(buf);
@ -356,7 +356,7 @@ int MySQLSendHandshake(DCB* dcb)
mysql_server_capabilities_two[1] = (uint8_t)(GW_MYSQL_CAPABILITIES_SERVER >> 24);
// Check that we match the old values
ss_dassert(mysql_server_capabilities_two[0] == 15);
mxb_assert(mysql_server_capabilities_two[0] == 15);
/** NOTE: pre-2.1 versions sent the fourth byte of the capabilities as
the value 128 even though there's no such capability. */
@ -565,7 +565,7 @@ static void store_client_information(DCB *dcb, GWBUF *buffer)
MYSQL_session *ses = (MYSQL_session*)dcb->data;
gwbuf_copy_data(buffer, 0, len, data);
ss_dassert(MYSQL_GET_PAYLOAD_LEN(data) + MYSQL_HEADER_LEN == len ||
mxb_assert(MYSQL_GET_PAYLOAD_LEN(data) + MYSQL_HEADER_LEN == len ||
len == MYSQL_AUTH_PACKET_BASE_SIZE); // For SSL request packet
proto->client_capabilities = gw_mysql_get_byte4(data + MYSQL_CLIENT_CAP_OFFSET);
@ -626,7 +626,7 @@ static void store_client_information(DCB *dcb, GWBUF *buffer)
static void check_packet(DCB *dcb, GWBUF *buf, int bytes)
{
uint8_t hdr[MYSQL_HEADER_LEN];
ss_dassert(gwbuf_copy_data(buf, 0, MYSQL_HEADER_LEN, hdr) == MYSQL_HEADER_LEN);
mxb_assert(gwbuf_copy_data(buf, 0, MYSQL_HEADER_LEN, hdr) == MYSQL_HEADER_LEN);
int buflen = gwbuf_length(buf);
int pktlen = MYSQL_GET_PAYLOAD_LEN(hdr) + MYSQL_HEADER_LEN;
@ -634,13 +634,13 @@ static void check_packet(DCB *dcb, GWBUF *buf, int bytes)
if (bytes == MYSQL_AUTH_PACKET_BASE_SIZE)
{
/** This is an SSL request packet */
ss_dassert(dcb->listener->ssl);
ss_dassert(buflen == bytes && pktlen >= buflen);
mxb_assert(dcb->listener->ssl);
mxb_assert(buflen == bytes && pktlen >= buflen);
}
else
{
/** Normal packet */
ss_dassert(buflen == pktlen);
mxb_assert(buflen == pktlen);
}
}
@ -738,13 +738,13 @@ gw_read_do_authentication(DCB *dcb, GWBUF *read_buffer, int nbytes_read)
if (session != NULL)
{
ss_dassert(session->state != SESSION_STATE_ALLOC &&
mxb_assert(session->state != SESSION_STATE_ALLOC &&
session->state != SESSION_STATE_DUMMY);
// For the time being only the sql_mode is stored in MXS_SESSION::client_protocol_data.
session->client_protocol_data = QC_SQL_MODE_DEFAULT;
protocol->protocol_auth_state = MXS_AUTH_STATE_COMPLETE;
MXB_AT_DEBUG(bool check = ) mxs_rworker_register_session(session);
ss_dassert(check);
mxb_assert(check);
mxs_mysql_send_ok(dcb, next_sequence, 0, NULL);
if (dcb->readq)
@ -853,7 +853,7 @@ static bool process_client_commands(DCB* dcb, int bytes_available, GWBUF** buffe
if (gwbuf_copy_data(queue, offset, MYSQL_HEADER_LEN, packet_header) != MYSQL_HEADER_LEN)
{
ss_dassert(offset > 0);
mxb_assert(offset > 0);
queue = split_and_store(dcb, queue, offset);
break;
}
@ -869,10 +869,10 @@ static bool process_client_commands(DCB* dcb, int bytes_available, GWBUF** buffe
{
if ((queue = split_and_store(dcb, queue, offset)) == NULL)
{
ss_dassert(bytes_available - offset == MYSQL_HEADER_LEN);
mxb_assert(bytes_available - offset == MYSQL_HEADER_LEN);
return false;
}
ss_dassert(offset > 0);
mxb_assert(offset > 0);
break;
}
@ -893,11 +893,11 @@ static bool process_client_commands(DCB* dcb, int bytes_available, GWBUF** buffe
bytes_available -= packet_bytes;
dcb->protocol_bytes_processed += packet_bytes;
offset += packet_bytes;
ss_dassert(dcb->protocol_bytes_processed <= dcb->protocol_packet_length);
mxb_assert(dcb->protocol_bytes_processed <= dcb->protocol_packet_length);
}
ss_dassert(bytes_available >= 0);
ss_dassert(queue);
mxb_assert(bytes_available >= 0);
mxb_assert(queue);
*buffer = queue;
return true;
}
@ -950,7 +950,7 @@ char* handle_variables(MXS_SESSION* session, GWBUF** read_buffer)
break;
default:
ss_dassert(!true);
mxb_assert(!true);
}
}
}
@ -983,7 +983,7 @@ char* handle_variables(MXS_SESSION* session, GWBUF** read_buffer)
break;
default:
ss_dassert(!true);
mxb_assert(!true);
}
return message;
@ -1109,7 +1109,7 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read)
break;
default:
ss_dassert(!true);
mxb_assert(!true);
}
return rval;
}
@ -1194,7 +1194,7 @@ gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint64_t capabilities)
else if (proto->current_command == MXS_COM_QUIT)
{
/** Close router session which causes closing of backends */
ss_info_dassert(session_valid_for_pool(dcb->session), "Session should qualify for pooling");
mxb_assert_message(session_valid_for_pool(dcb->session), "Session should qualify for pooling");
dcb_close(dcb);
}
@ -1304,7 +1304,7 @@ int gw_write_client_event(DCB *dcb)
{
MySQLProtocol *protocol = NULL;
ss_dassert(dcb->state != DCB_STATE_DISCONNECTED);
mxb_assert(dcb->state != DCB_STATE_DISCONNECTED);
if (dcb == NULL)
{
@ -1448,7 +1448,7 @@ retblock:
static int gw_client_close(DCB *dcb)
{
ss_dassert(dcb->protocol);
mxb_assert(dcb->protocol);
if (mysql_protocol_done(dcb))
{
@ -1457,10 +1457,10 @@ static int gw_client_close(DCB *dcb)
if (target->state != SESSION_STATE_TO_BE_FREED &&
target->state != SESSION_STATE_DUMMY)
{
ss_dassert(target->state == SESSION_STATE_ROUTER_READY ||
mxb_assert(target->state == SESSION_STATE_ROUTER_READY ||
target->state == SESSION_STATE_STOPPING);
MXB_AT_DEBUG(bool removed = ) mxs_rworker_deregister_session(target->ses_id);
ss_dassert(removed);
mxb_assert(removed);
session_close(target);
}
}
@ -1626,7 +1626,7 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF
if (rcap_type_required(capabilities, RCAP_TYPE_CONTIGUOUS_INPUT))
{
ss_dassert(GWBUF_IS_CONTIGUOUS(packetbuf));
mxb_assert(GWBUF_IS_CONTIGUOUS(packetbuf));
SERVICE *service = session->client_dcb->service;
if (rcap_type_required(capabilities, RCAP_TYPE_TRANSACTION_TRACKING) && !service->session_track_trx_state)
@ -1695,7 +1695,7 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF
}
else if (proto->changing_user)
{
ss_dassert(proto->current_command == MXS_COM_CHANGE_USER);
mxb_assert(proto->current_command == MXS_COM_CHANGE_USER);
proto->changing_user = false;
bool ok = reauthenticate_client(session, packetbuf);
gwbuf_free(packetbuf);
@ -2002,7 +2002,7 @@ static bool parse_kill_query(char *query, uint64_t *thread_id_out, kill_type_t *
}
else
{
ss_dassert(*endptr_id == '\0' || *endptr_id == ';');
mxb_assert(*endptr_id == '\0' || *endptr_id == ';');
state = SEMICOLON; // In case we have space before ;
get_next = true;
thread_id = l;

View File

@ -97,7 +97,7 @@ public:
GWBUF* pBuffer = *ppBuffer;
ss_dassert(gwbuf_length(pBuffer) >= MYSQL_HEADER_LEN);
mxb_assert(gwbuf_length(pBuffer) >= MYSQL_HEADER_LEN);
size_t buf_len = GWBUF_LENGTH(pBuffer);
size_t payload_len;
@ -218,7 +218,7 @@ public:
return "NOT_RELEVANT";
default:
ss_dassert(!true);
mxb_assert(!true);
return "UNKNOWN";
}
}
@ -244,7 +244,7 @@ private:
status_t initialize(GWBUF* pBuffer)
{
ss_dassert(GWBUF_IS_CONTIGUOUS(pBuffer));
mxb_assert(GWBUF_IS_CONTIGUOUS(pBuffer));
status_t rv = ERROR;

View File

@ -76,7 +76,7 @@ public:
GWBUF* pBuffer = *ppBuffer;
ss_dassert(gwbuf_length(pBuffer) >= MYSQL_HEADER_LEN);
mxb_assert(gwbuf_length(pBuffer) >= MYSQL_HEADER_LEN);
size_t buf_len = GWBUF_LENGTH(pBuffer);
size_t payload_len;
@ -196,7 +196,7 @@ public:
return "SOMETHING";
default:
ss_dassert(!true);
mxb_assert(!true);
return "UNKNOWN";
}
}
@ -222,7 +222,7 @@ public:
return "NOT_SET_SQL_MODE";
default:
ss_dassert(!true);
mxb_assert(!true);
return "UNKNOWN";
}
}
@ -248,7 +248,7 @@ private:
result_t initialize(GWBUF* pBuffer)
{
ss_dassert(GWBUF_IS_CONTIGUOUS(pBuffer));
mxb_assert(GWBUF_IS_CONTIGUOUS(pBuffer));
result_t rv = ERROR;

View File

@ -81,7 +81,7 @@ public:
return "SOMETHING";
default:
ss_dassert(!true);
mxb_assert(!true);
return "UNKNOWN";
}
}

View File

@ -388,7 +388,7 @@ int test(GWBUF** ppStmt, SetParser::status_t expected_status, const TEST_CASE::E
{
const SetParser::Result::Items& variables = result.variables();
const SetParser::Result::Items& values = result.values();
ss_dassert(variables.size() == values.size());
mxb_assert(variables.size() == values.size());
SetParser::Result::Items::const_iterator i = variables.begin();
SetParser::Result::Items::const_iterator j = values.begin();
@ -482,7 +482,7 @@ int test(const TEST_CASE& test_case)
cout << test_case.zStmt << ": ";
GWBUF* pStmt = gwbuf_create_com_query(test_case.zStmt);
ss_dassert(pStmt);
mxb_assert(pStmt);
rv = test(&pStmt, test_case.status, test_case.expectations);
@ -525,7 +525,7 @@ int test_non_contiguous()
cout << test_case.zStmt << "(" << strlen(test_case.zStmt) << ": ";
GWBUF* pTail = gwbuf_create_com_query(test_case.zStmt);
ss_dassert(pTail);
mxb_assert(pTail);
GWBUF* pStmt = NULL;
while (pTail)

View File

@ -242,7 +242,7 @@ int test(const TEST_CASE& test_case)
cout << test_case.zStmt << ": ";
GWBUF* pStmt = gwbuf_create_com_query(test_case.zStmt);
ss_dassert(pStmt);
mxb_assert(pStmt);
rv = test(&pStmt, test_case.sql_mode, test_case.status);
@ -285,7 +285,7 @@ int test_non_contiguous()
cout << test_case.zStmt << "(" << strlen(test_case.zStmt) << ": ";
GWBUF* pTail = gwbuf_create_com_query(test_case.zStmt);
ss_dassert(pTail);
mxb_assert(pTail);
GWBUF* pStmt = NULL;
while (pTail)