Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
73de63e8
Commit
73de63e8
authored
Mar 09, 2018
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Session tracking info support in mysqltest (port from mysql)
parent
a8e1eef8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
163 additions
and
1 deletion
+163
-1
client/mysqltest.cc
client/mysqltest.cc
+89
-1
mysql-test/r/mysqltest_tracking_info.result
mysql-test/r/mysqltest_tracking_info.result
+47
-0
mysql-test/t/mysqltest_tracking_info.test
mysql-test/t/mysqltest_tracking_info.test
+25
-0
mysql-test/t/reset_connection.test
mysql-test/t/reset_connection.test
+2
-0
No files found.
client/mysqltest.cc
View file @
73de63e8
...
@@ -125,7 +125,8 @@ static my_bool view_protocol= 0, view_protocol_enabled= 0;
...
@@ -125,7 +125,8 @@ static my_bool view_protocol= 0, view_protocol_enabled= 0;
static
my_bool
cursor_protocol
=
0
,
cursor_protocol_enabled
=
0
;
static
my_bool
cursor_protocol
=
0
,
cursor_protocol_enabled
=
0
;
static
my_bool
parsing_disabled
=
0
;
static
my_bool
parsing_disabled
=
0
;
static
my_bool
display_result_vertically
=
FALSE
,
display_result_lower
=
FALSE
,
static
my_bool
display_result_vertically
=
FALSE
,
display_result_lower
=
FALSE
,
display_metadata
=
FALSE
,
display_result_sorted
=
FALSE
;
display_metadata
=
FALSE
,
display_result_sorted
=
FALSE
,
display_session_track_info
=
FALSE
;
static
my_bool
disable_query_log
=
0
,
disable_result_log
=
0
;
static
my_bool
disable_query_log
=
0
,
disable_result_log
=
0
;
static
my_bool
disable_connect_log
=
0
;
static
my_bool
disable_connect_log
=
0
;
static
my_bool
disable_warnings
=
0
,
disable_column_names
=
0
;
static
my_bool
disable_warnings
=
0
,
disable_column_names
=
0
;
...
@@ -153,6 +154,7 @@ static struct property prop_list[] = {
...
@@ -153,6 +154,7 @@ static struct property prop_list[] = {
{
&
abort_on_error
,
0
,
1
,
0
,
"$ENABLED_ABORT_ON_ERROR"
},
{
&
abort_on_error
,
0
,
1
,
0
,
"$ENABLED_ABORT_ON_ERROR"
},
{
&
disable_connect_log
,
0
,
1
,
1
,
"$ENABLED_CONNECT_LOG"
},
{
&
disable_connect_log
,
0
,
1
,
1
,
"$ENABLED_CONNECT_LOG"
},
{
&
disable_info
,
0
,
1
,
1
,
"$ENABLED_INFO"
},
{
&
disable_info
,
0
,
1
,
1
,
"$ENABLED_INFO"
},
{
&
display_session_track_info
,
0
,
1
,
1
,
"$ENABLED_STATE_CHANGE_INFO"
},
{
&
display_metadata
,
0
,
0
,
0
,
"$ENABLED_METADATA"
},
{
&
display_metadata
,
0
,
0
,
0
,
"$ENABLED_METADATA"
},
{
&
ps_protocol_enabled
,
0
,
0
,
0
,
"$ENABLED_PS_PROTOCOL"
},
{
&
ps_protocol_enabled
,
0
,
0
,
0
,
"$ENABLED_PS_PROTOCOL"
},
{
&
disable_query_log
,
0
,
0
,
1
,
"$ENABLED_QUERY_LOG"
},
{
&
disable_query_log
,
0
,
0
,
1
,
"$ENABLED_QUERY_LOG"
},
...
@@ -166,6 +168,7 @@ enum enum_prop {
...
@@ -166,6 +168,7 @@ enum enum_prop {
P_ABORT
=
0
,
P_ABORT
=
0
,
P_CONNECT
,
P_CONNECT
,
P_INFO
,
P_INFO
,
P_SESSION_TRACK
,
P_META
,
P_META
,
P_PS
,
P_PS
,
P_QUERY
,
P_QUERY
,
...
@@ -362,6 +365,7 @@ enum enum_commands {
...
@@ -362,6 +365,7 @@ enum enum_commands {
Q_WAIT_FOR_SLAVE_TO_STOP
,
Q_WAIT_FOR_SLAVE_TO_STOP
,
Q_ENABLE_WARNINGS
,
Q_DISABLE_WARNINGS
,
Q_ENABLE_WARNINGS
,
Q_DISABLE_WARNINGS
,
Q_ENABLE_INFO
,
Q_DISABLE_INFO
,
Q_ENABLE_INFO
,
Q_DISABLE_INFO
,
Q_ENABLE_SESSION_TRACK_INFO
,
Q_DISABLE_SESSION_TRACK_INFO
,
Q_ENABLE_METADATA
,
Q_DISABLE_METADATA
,
Q_ENABLE_METADATA
,
Q_DISABLE_METADATA
,
Q_ENABLE_COLUMN_NAMES
,
Q_DISABLE_COLUMN_NAMES
,
Q_ENABLE_COLUMN_NAMES
,
Q_DISABLE_COLUMN_NAMES
,
Q_EXEC
,
Q_DELIMITER
,
Q_EXEC
,
Q_DELIMITER
,
...
@@ -436,6 +440,8 @@ const char *command_names[]=
...
@@ -436,6 +440,8 @@ const char *command_names[]=
"disable_warnings"
,
"disable_warnings"
,
"enable_info"
,
"enable_info"
,
"disable_info"
,
"disable_info"
,
"enable_session_track_info"
,
"disable_session_track_info"
,
"enable_metadata"
,
"enable_metadata"
,
"disable_metadata"
,
"disable_metadata"
,
"enable_column_names"
,
"enable_column_names"
,
...
@@ -6514,6 +6520,7 @@ void do_delimiter(struct st_command* command)
...
@@ -6514,6 +6520,7 @@ void do_delimiter(struct st_command* command)
static
void
do_reset_connection
()
static
void
do_reset_connection
()
{
{
#ifndef EMBEDDED_LIBRARY
MYSQL
*
mysql
=
cur_con
->
mysql
;
MYSQL
*
mysql
=
cur_con
->
mysql
;
DBUG_ENTER
(
"do_reset_connection"
);
DBUG_ENTER
(
"do_reset_connection"
);
...
@@ -6525,6 +6532,10 @@ static void do_reset_connection()
...
@@ -6525,6 +6532,10 @@ static void do_reset_connection()
cur_con
->
stmt
=
NULL
;
cur_con
->
stmt
=
NULL
;
}
}
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
#else
die
(
"reset connection failed: unsupported by embedded server client library"
);
return
;
#endif
}
}
...
@@ -7782,6 +7793,70 @@ void append_info(DYNAMIC_STRING *ds, ulonglong affected_rows,
...
@@ -7782,6 +7793,70 @@ void append_info(DYNAMIC_STRING *ds, ulonglong affected_rows,
}
}
/**
@brief Append state change information (received through Ok packet) to the output.
@param [in,out] ds Dynamic string to hold the content to be printed.
@param [in] mysql Connection handle.
*/
static
void
append_session_track_info
(
DYNAMIC_STRING
*
ds
,
MYSQL
*
mysql
)
{
#ifndef EMBEDDED_LIBRARY
for
(
unsigned
int
type
=
SESSION_TRACK_BEGIN
;
type
<=
SESSION_TRACK_END
;
type
++
)
{
const
char
*
data
;
size_t
data_length
;
if
(
!
mysql_session_track_get_first
(
mysql
,
(
enum_session_state_type
)
type
,
&
data
,
&
data_length
))
{
dynstr_append
(
ds
,
"-- "
);
switch
(
type
)
{
case
SESSION_TRACK_SYSTEM_VARIABLES
:
dynstr_append
(
ds
,
"Tracker : SESSION_TRACK_SYSTEM_VARIABLES
\n
"
);
break
;
case
SESSION_TRACK_SCHEMA
:
dynstr_append
(
ds
,
"Tracker : SESSION_TRACK_SCHEMA
\n
"
);
break
;
case
SESSION_TRACK_STATE_CHANGE
:
dynstr_append
(
ds
,
"Tracker : SESSION_TRACK_STATE_CHANGE
\n
"
);
break
;
case
SESSION_TRACK_GTIDS
:
dynstr_append
(
ds
,
"Tracker : SESSION_TRACK_GTIDS
\n
"
);
break
;
case
SESSION_TRACK_TRANSACTION_CHARACTERISTICS
:
dynstr_append
(
ds
,
"Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS
\n
"
);
break
;
case
SESSION_TRACK_TRANSACTION_TYPE
:
dynstr_append
(
ds
,
"Tracker : SESSION_TRACK_TRANSACTION_TYPE
\n
"
);
break
;
default:
DBUG_ASSERT
(
0
);
dynstr_append
(
ds
,
"
\n
"
);
}
dynstr_append
(
ds
,
"-- "
);
dynstr_append_mem
(
ds
,
data
,
data_length
);
}
else
continue
;
while
(
!
mysql_session_track_get_next
(
mysql
,
(
enum_session_state_type
)
type
,
&
data
,
&
data_length
))
{
dynstr_append
(
ds
,
"
\n
-- "
);
dynstr_append_mem
(
ds
,
data
,
data_length
);
}
dynstr_append
(
ds
,
"
\n\n
"
);
}
#endif
/* EMBEDDED_LIBRARY */
}
/*
/*
Display the table headings with the names tab separated
Display the table headings with the names tab separated
*/
*/
...
@@ -7962,6 +8037,9 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
...
@@ -7962,6 +8037,9 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
if
(
!
disable_info
)
if
(
!
disable_info
)
append_info
(
ds
,
mysql_affected_rows
(
mysql
),
mysql_info
(
mysql
));
append_info
(
ds
,
mysql_affected_rows
(
mysql
),
mysql_info
(
mysql
));
if
(
display_session_track_info
)
append_session_track_info
(
ds
,
mysql
);
/*
/*
Add all warnings to the result. We can't do this if we are in
Add all warnings to the result. We can't do this if we are in
the middle of processing results from multi-statement, because
the middle of processing results from multi-statement, because
...
@@ -8377,6 +8455,10 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
...
@@ -8377,6 +8455,10 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
if
(
!
disable_info
)
if
(
!
disable_info
)
append_info
(
ds
,
mysql_stmt_affected_rows
(
stmt
),
mysql_info
(
mysql
));
append_info
(
ds
,
mysql_stmt_affected_rows
(
stmt
),
mysql_info
(
mysql
));
if
(
display_session_track_info
)
append_session_track_info
(
ds
,
mysql
);
if
(
!
disable_warnings
)
if
(
!
disable_warnings
)
{
{
/* Get the warnings from execute */
/* Get the warnings from execute */
...
@@ -9358,6 +9440,12 @@ int main(int argc, char **argv)
...
@@ -9358,6 +9440,12 @@ int main(int argc, char **argv)
case
Q_DISABLE_INFO
:
case
Q_DISABLE_INFO
:
set_property
(
command
,
P_INFO
,
1
);
set_property
(
command
,
P_INFO
,
1
);
break
;
break
;
case
Q_ENABLE_SESSION_TRACK_INFO
:
set_property
(
command
,
P_SESSION_TRACK
,
1
);
break
;
case
Q_DISABLE_SESSION_TRACK_INFO
:
set_property
(
command
,
P_SESSION_TRACK
,
0
);
break
;
case
Q_ENABLE_METADATA
:
case
Q_ENABLE_METADATA
:
set_property
(
command
,
P_META
,
1
);
set_property
(
command
,
P_META
,
1
);
break
;
break
;
...
...
mysql-test/r/mysqltest_tracking_info.result
0 → 100644
View file @
73de63e8
SELECT @@session.character_set_client, @@session.character_set_results, @@session.character_set_connection;
@@session.character_set_client @@session.character_set_results @@session.character_set_connection
latin1 latin1 latin1
SET @@session.session_track_system_variables='character_set_client,character_set_results,character_set_connection';
# tracking info on
SET NAMES 'utf8';
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- character_set_client
-- utf8
-- character_set_connection
-- utf8
-- character_set_results
-- utf8
SET NAMES 'big5';
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- character_set_client
-- big5
-- character_set_connection
-- big5
-- character_set_results
-- big5
# tracking info on once
SET NAMES 'utf8';
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- character_set_client
-- utf8
-- character_set_connection
-- utf8
-- character_set_results
-- utf8
SET NAMES 'big5';
# tracking info on
SET NAMES 'utf8';
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- character_set_client
-- utf8
-- character_set_connection
-- utf8
-- character_set_results
-- utf8
# tracking info off once
SET NAMES 'big5';
SET @@session.session_track_system_variables= default;
mysql-test/t/mysqltest_tracking_info.test
0 → 100644
View file @
73de63e8
--
source
include
/
no_protocol
.
inc
--
source
include
/
not_embedded
.
inc
SELECT
@@
session
.
character_set_client
,
@@
session
.
character_set_results
,
@@
session
.
character_set_connection
;
SET
@@
session
.
session_track_system_variables
=
'character_set_client,character_set_results,character_set_connection'
;
--
echo
# tracking info on
--
enable_session_track_info
SET
NAMES
'utf8'
;
SET
NAMES
'big5'
;
--
disable_session_track_info
--
echo
# tracking info on once
--
enable_session_track_info
ONCE
SET
NAMES
'utf8'
;
SET
NAMES
'big5'
;
--
echo
# tracking info on
--
enable_session_track_info
SET
NAMES
'utf8'
;
--
echo
# tracking info off once
--
disable_session_track_info
ONCE
SET
NAMES
'big5'
;
--
disable_session_track_info
SET
@@
session
.
session_track_system_variables
=
default
;
mysql-test/t/reset_connection.test
View file @
73de63e8
--
source
include
/
not_embedded
.
inc
FLUSH
STATUS
;
FLUSH
STATUS
;
--
disable_result_log
--
disable_result_log
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment