Skip to content

Commit 6c3f1f6

Browse files
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
1 parent e928fdb commit 6c3f1f6

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed

client/mysqltest.cc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ static struct property prop_list[] = {
155155
{ &display_session_track_info, 0, 1, 1, "$ENABLED_STATE_CHANGE_INFO" },
156156
{ &display_metadata, 0, 0, 0, "$ENABLED_METADATA" },
157157
{ &ps_protocol_enabled, 0, 0, 0, "$ENABLED_PS_PROTOCOL" },
158+
{ &view_protocol_enabled, 0, 0, 0, "$ENABLED_VIEW_PROTOCOL"},
158159
{ &disable_query_log, 0, 0, 1, "$ENABLED_QUERY_LOG" },
159160
{ &disable_result_log, 0, 0, 1, "$ENABLED_RESULT_LOG" },
160161
{ &disable_warnings, 0, 0, 1, "$ENABLED_WARNINGS" }
@@ -169,6 +170,7 @@ enum enum_prop {
169170
P_SESSION_TRACK,
170171
P_META,
171172
P_PS,
173+
P_VIEW,
172174
P_QUERY,
173175
P_RESULT,
174176
P_WARN,
@@ -374,6 +376,7 @@ enum enum_commands {
374376
Q_LOWERCASE,
375377
Q_START_TIMER, Q_END_TIMER,
376378
Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL,
379+
Q_DISABLE_VIEW_PROTOCOL, Q_ENABLE_VIEW_PROTOCOL,
377380
Q_ENABLE_NON_BLOCKING_API, Q_DISABLE_NON_BLOCKING_API,
378381
Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT,
379382
Q_IF,
@@ -460,6 +463,8 @@ const char *command_names[]=
460463
"character_set",
461464
"disable_ps_protocol",
462465
"enable_ps_protocol",
466+
"disable_view_protocol",
467+
"enable_view_protocol",
463468
"enable_non_blocking_api",
464469
"disable_non_blocking_api",
465470
"disable_reconnect",
@@ -1397,6 +1402,16 @@ void close_connections()
13971402
DBUG_VOID_RETURN;
13981403
}
13991404

1405+
void close_util_connections()
1406+
{
1407+
DBUG_ENTER("close_util_connections");
1408+
if (cur_con->util_mysql)
1409+
{
1410+
mysql_close(cur_con->util_mysql);
1411+
cur_con->util_mysql = 0;
1412+
}
1413+
DBUG_VOID_RETURN;
1414+
}
14001415

14011416
void close_statements()
14021417
{
@@ -9664,6 +9679,14 @@ int main(int argc, char **argv)
96649679
case Q_ENABLE_PS_PROTOCOL:
96659680
set_property(command, P_PS, ps_protocol);
96669681
break;
9682+
case Q_DISABLE_VIEW_PROTOCOL:
9683+
set_property(command, P_VIEW, 0);
9684+
/* Close only util connections */
9685+
close_util_connections();
9686+
break;
9687+
case Q_ENABLE_VIEW_PROTOCOL:
9688+
set_property(command, P_VIEW, view_protocol);
9689+
break;
96679690
case Q_DISABLE_NON_BLOCKING_API:
96689691
non_blocking_api_enabled= 0;
96699692
break;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# The file with expected results fits only to a run with
2+
# view-protocol.
3+
if (`SELECT $VIEW_PROTOCOL = 0`)
4+
{
5+
--skip Test requires view-protocol
6+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
flush status;
2+
create table t1 (a int);
3+
insert into t1 (a) values (1);
4+
create table t2 (b int);
5+
insert into t2 (b) values (2);
6+
select * from t1;
7+
a
8+
1
9+
show status like 'Opened_views';
10+
Variable_name Value
11+
Opened_views 1
12+
flush status;
13+
select * from t2;
14+
b
15+
2
16+
show status like 'Opened_views';
17+
Variable_name Value
18+
Opened_views 0
19+
drop table t1, t2;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- source include/have_view_protocol.inc
2+
3+
flush status;
4+
5+
create table t1 (a int);
6+
insert into t1 (a) values (1);
7+
create table t2 (b int);
8+
insert into t2 (b) values (2);
9+
select * from t1;
10+
show status like 'Opened_views';
11+
12+
flush status;
13+
--disable_view_protocol
14+
select * from t2;
15+
--enable_view_protocol
16+
17+
show status like 'Opened_views';
18+
19+
drop table t1, t2;
20+
21+

0 commit comments

Comments
 (0)