Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rahim-kanji committed Nov 15, 2023
1 parent d6d1b97 commit d67abde
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
1 change: 0 additions & 1 deletion lib/MySQL_Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6043,7 +6043,6 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
if (warning_in_hg > -1) {
proxy_debug(PROXY_DEBUG_MYSQL_COM, 5, "Changing current_hostgroup to '%d'\n", warning_in_hg);
current_hostgroup = warning_in_hg;
//warning_in_hg = -1;
return false;
} else {
proxy_debug(PROXY_DEBUG_MYSQL_COM, 5, "No warnings were detected in the previous query. Sending an empty response.\n");
Expand Down
1 change: 0 additions & 1 deletion lib/mysql_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2615,7 +2615,6 @@ void MySQL_Connection::ProcessQueryAndSetStatusFlags(char *query_digest_text) {
// 'warning_in_hg' will be used if the next query is 'SHOW WARNINGS' or
// 'SHOW COUNT(*) WARNINGS'
myds->sess->warning_in_hg = myds->sess->current_hostgroup;
//warning_count = mysql_warning_count(this->mysql);
// enabling multiplexing
set_status(true, STATUS_MYSQL_CONNECTION_HAS_WARNINGS);
}
Expand Down
21 changes: 6 additions & 15 deletions test/tap/tests/test_warnings-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,8 @@ int prepare_and_execute_stmt(MYSQL* mysql, const QueryInfo& query_info, MYSQL_ST
return EXIT_FAILURE;
}
if (query_info.is_select) {
//MYSQL_CLEAR_STMT_RESULT(stmt);
mysql_stmt_store_result(stmt);
mysql_stmt_free_result(stmt);
/*int status;
while(1) {
status = mysql_stmt_fetch(stmt);
if (status == 1 || status == MYSQL_NO_DATA)
break;
}*/
MYSQL_CLEAR_STMT_RESULT(stmt);
}
//mysql_stmt_close(stmt);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
*stmt_out = stmt;
return EXIT_SUCCESS;
Expand Down Expand Up @@ -269,7 +260,7 @@ const std::vector<TestInfo> hostgroup_attributes_test = {
{ ConnectionType::kMySQL, INIT_QUERY_PREPARE_STMT("SELECT 1", true), {WarningCheckType::kAll, 0}, (MultiplexStatus::kMultiplexingDisabled) }
};

const std::vector<TestInfo> select_test = {
const std::vector<TestInfo> random_test = {
{ ConnectionType::kMySQL, INIT_QUERY_TEXT("SELECT 1/0", true), {WarningCheckType::kAll, 1, {1365}}, (MultiplexStatus::kMultiplexingEnabled | MultiplexStatus::kHasWarnings) },
{ ConnectionType::kMySQL, INIT_QUERY_TEXT("SELECT 1" , true), {WarningCheckType::kAll, 0}, (MultiplexStatus::kMultiplexingDisabled) },
{ ConnectionType::kMySQL, INIT_QUERY_TEXT("DO 1/0", false), {WarningCheckType::kAll, 1, {1365}}, (MultiplexStatus::kMultiplexingEnabled | MultiplexStatus::kHasWarnings) },
Expand Down Expand Up @@ -387,7 +378,7 @@ constexpr size_t test_size(Args&&... args) {
return sizeof...(args);
}

#define TESTS_COMBINED mysql_variable_test, hostgroup_attributes_test, select_test, insert_test, query_digest_test, \
#define TESTS_COMBINED mysql_variable_test, hostgroup_attributes_test, random_test, insert_test, query_digest_test, \
query_cache_test, warning_log_test, multiplexing_test

int main(int argc, char** argv) {
Expand All @@ -403,7 +394,7 @@ int main(int argc, char** argv) {

/*plan((20 + 6) + // mysql variable test: 20 warning checks, 6 multiplex status checks
(20 + 6) + // hostgroup attributes test: 20 warning checks, 6 multiplex status checks
(14 + 4) + // select test: 14 warning checks, 4 multiplex status checks
(14 + 4) + // random test: 14 warning checks, 4 multiplex status checks
(9 + 4) + // insert test: 9 warning checks, 4 multiplex status checks
(3 + 1) + // query digest test: 3 warning checks, 1 multiplex status checks
(18 + 5) + // query cache test: 18 warning checks, 5 multiplex status checks
Expand Down Expand Up @@ -444,8 +435,8 @@ int main(int argc, char** argv) {
all_tests[1].first = "HOSTGROUP ATTRIBUTES (handle_warnings)";
all_tests[1].second.insert(all_tests[1].second.end(), hostgroup_attributes_test.begin(), hostgroup_attributes_test.end());

all_tests[2].first = "SELECT";
all_tests[2].second.insert(all_tests[2].second.end(), select_test.begin(), select_test.end());
all_tests[2].first = "RANDOM";
all_tests[2].second.insert(all_tests[2].second.end(), random_test.begin(), random_test.end());

all_tests[3].first = "INSERT";
all_tests[3].second.insert(all_tests[3].second.end(), insert_test.begin(), insert_test.end());
Expand Down

0 comments on commit d67abde

Please sign in to comment.