Commit 6c3f1f66 authored by Lena Startseva's avatar Lena Startseva

MDEV-27691: make working view-protocol

Added ability to disable/enable (--disable_view_protocol/--enable_view_protocol) view-protocol in tests.
When the  option "--disable_view_protocol" is used  util connections are closed.
Added new test for checking view-protocol
parent e928fdbf
......@@ -155,6 +155,7 @@ static struct property prop_list[] = {
{ &display_session_track_info, 0, 1, 1, "$ENABLED_STATE_CHANGE_INFO" },
{ &display_metadata, 0, 0, 0, "$ENABLED_METADATA" },
{ &ps_protocol_enabled, 0, 0, 0, "$ENABLED_PS_PROTOCOL" },
{ &view_protocol_enabled, 0, 0, 0, "$ENABLED_VIEW_PROTOCOL"},
{ &disable_query_log, 0, 0, 1, "$ENABLED_QUERY_LOG" },
{ &disable_result_log, 0, 0, 1, "$ENABLED_RESULT_LOG" },
{ &disable_warnings, 0, 0, 1, "$ENABLED_WARNINGS" }
......@@ -169,6 +170,7 @@ enum enum_prop {
P_SESSION_TRACK,
P_META,
P_PS,
P_VIEW,
P_QUERY,
P_RESULT,
P_WARN,
......@@ -374,6 +376,7 @@ enum enum_commands {
Q_LOWERCASE,
Q_START_TIMER, Q_END_TIMER,
Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL,
Q_DISABLE_VIEW_PROTOCOL, Q_ENABLE_VIEW_PROTOCOL,
Q_ENABLE_NON_BLOCKING_API, Q_DISABLE_NON_BLOCKING_API,
Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT,
Q_IF,
......@@ -460,6 +463,8 @@ const char *command_names[]=
"character_set",
"disable_ps_protocol",
"enable_ps_protocol",
"disable_view_protocol",
"enable_view_protocol",
"enable_non_blocking_api",
"disable_non_blocking_api",
"disable_reconnect",
......@@ -1397,6 +1402,16 @@ void close_connections()
DBUG_VOID_RETURN;
}
void close_util_connections()
{
DBUG_ENTER("close_util_connections");
if (cur_con->util_mysql)
{
mysql_close(cur_con->util_mysql);
cur_con->util_mysql = 0;
}
DBUG_VOID_RETURN;
}
void close_statements()
{
......@@ -9664,6 +9679,14 @@ int main(int argc, char **argv)
case Q_ENABLE_PS_PROTOCOL:
set_property(command, P_PS, ps_protocol);
break;
case Q_DISABLE_VIEW_PROTOCOL:
set_property(command, P_VIEW, 0);
/* Close only util connections */
close_util_connections();
break;
case Q_ENABLE_VIEW_PROTOCOL:
set_property(command, P_VIEW, view_protocol);
break;
case Q_DISABLE_NON_BLOCKING_API:
non_blocking_api_enabled= 0;
break;
......
# The file with expected results fits only to a run with
# view-protocol.
if (`SELECT $VIEW_PROTOCOL = 0`)
{
--skip Test requires view-protocol
}
\ No newline at end of file
flush status;
create table t1 (a int);
insert into t1 (a) values (1);
create table t2 (b int);
insert into t2 (b) values (2);
select * from t1;
a
1
show status like 'Opened_views';
Variable_name Value
Opened_views 1
flush status;
select * from t2;
b
2
show status like 'Opened_views';
Variable_name Value
Opened_views 0
drop table t1, t2;
-- source include/have_view_protocol.inc
flush status;
create table t1 (a int);
insert into t1 (a) values (1);
create table t2 (b int);
insert into t2 (b) values (2);
select * from t1;
show status like 'Opened_views';
flush status;
--disable_view_protocol
select * from t2;
--enable_view_protocol
show status like 'Opened_views';
drop table t1, t2;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment