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
8ca5935a
Commit
8ca5935a
authored
5 months ago
by
Yuchen Pei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-34915 [debug] Sort output of session track info in mysqltest
The new test is for debugging only and should be removed
parent
fe3432b3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
10 deletions
+98
-10
client/mysqltest.cc
client/mysqltest.cc
+64
-8
mysql-test/suite/sys_vars/r/mdev_31609.result
mysql-test/suite/sys_vars/r/mdev_31609.result
+18
-0
mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result
...te/sys_vars/r/session_track_system_variables_basic.result
+2
-2
mysql-test/suite/sys_vars/t/mdev_31609.test
mysql-test/suite/sys_vars/t/mdev_31609.test
+14
-0
No files found.
client/mysqltest.cc
View file @
8ca5935a
...
...
@@ -8022,6 +8022,22 @@ static const char *trking_info_desc[SESSION_TRACK_END + 1]=
/**
@brief Append state change information (received through Ok packet) to the output.
@details The appended string is lines prefixed with "-- ". Only
tracking types with info sent from the server are displayed. For
each tracking type, the first line is the type name e.g.
"-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES".
The subsequent lines are the actual tracking info. When type is
SESSION_TRACK_SYSTEM_VARIABLES, the actual tracking info is a list
of name-value pairs of lines, sorted by name, e.g. if the info
received from the server is "autocommit=ON;time_zone=SYSTEM", the
corresponding string is
-- autocommit
-- ON
-- time_zone
-- SYSTEM
@param [in,out] ds Dynamic string to hold the content to be printed.
@param [in] mysql Connection handle.
*/
...
...
@@ -8031,11 +8047,16 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
if
(
!
(
mysql
->
server_status
&
SERVER_SESSION_STATE_CHANGED
))
return
;
#ifndef EMBEDDED_LIBRARY
DYNAMIC_STRING
ds_sort
,
*
ds_type
=
NULL
;
for
(
unsigned
int
type
=
SESSION_TRACK_BEGIN
;
type
<=
SESSION_TRACK_END
;
type
++
)
{
const
char
*
data
;
size_t
data_length
;
/*
Append the tracking type line, if any corresponding tracking
info is received.
*/
if
(
!
mysql_session_track_get_first
(
mysql
,
(
enum_session_state_type
)
type
,
&
data
,
&
data_length
))
...
...
@@ -8051,25 +8072,59 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
DBUG_ASSERT
(
0
);
dynstr_append_mem
(
ds
,
STRING_WITH_LEN
(
"Tracker???
\n
"
));
}
dynstr_append_mem
(
ds
,
STRING_WITH_LEN
(
"-- "
));
dynstr_append_mem
(
ds
,
data
,
data_length
);
}
else
continue
;
/*
The remaining of this function: format and append the actual
tracking info.
*/
if
(
type
==
SESSION_TRACK_SYSTEM_VARIABLES
)
{
/* Prepare a string to be sorted before being appended. */
if
(
init_dynamic_string
(
&
ds_sort
,
""
,
1024
,
1024
))
die
(
"Out of memory"
);
ds_type
=
&
ds_sort
;
}
else
ds_type
=
ds
;
/* Append the first piece of info */
dynstr_append_mem
(
ds_type
,
STRING_WITH_LEN
(
"-- "
));
dynstr_append_mem
(
ds_type
,
data
,
data_length
);
/* Whether we are appending the value of a variable */
bool
appending_value
=
type
==
SESSION_TRACK_SYSTEM_VARIABLES
;
/* Append remaining pieces */
while
(
!
mysql_session_track_get_next
(
mysql
,
(
enum_session_state_type
)
type
,
&
data
,
&
data_length
))
{
dynstr_append_mem
(
ds
,
STRING_WITH_LEN
(
"
\n
-- "
));
if
(
appending_value
)
dynstr_append_mem
(
ds_type
,
STRING_WITH_LEN
(
" -- "
));
else
dynstr_append_mem
(
ds_type
,
STRING_WITH_LEN
(
"
\n
-- "
));
appending_value
=
!
appending_value
&&
type
==
SESSION_TRACK_SYSTEM_VARIABLES
;
if
(
data
==
NULL
)
{
DBUG_ASSERT
(
data_length
==
0
);
dynstr_append_mem
(
ds
,
STRING_WITH_LEN
(
"<NULL>"
));
dynstr_append_mem
(
ds
_type
,
STRING_WITH_LEN
(
"<NULL>"
));
}
else
dynstr_append_mem
(
ds
,
data
,
data_length
);
dynstr_append_mem
(
ds
_type
,
data
,
data_length
);
}
DBUG_ASSERT
(
!
appending_value
);
if
(
type
==
SESSION_TRACK_SYSTEM_VARIABLES
)
{
dynstr_append_mem
(
ds_type
,
STRING_WITH_LEN
(
"
\n
"
));
dynstr_append_sorted
(
ds
,
ds_type
,
false
);
dynstr_append_mem
(
ds
,
STRING_WITH_LEN
(
"
\n
"
));
char
*
find_replace
=
ds
->
str
;
while
((
find_replace
=
strstr
(
find_replace
,
" -- "
))
&&
find_replace
<
ds
->
str
+
ds
->
length
)
*
find_replace
=
'\n'
;
dynstr_free
(
&
ds_sort
);
}
else
dynstr_append_mem
(
ds
,
STRING_WITH_LEN
(
"
\n\n
"
));
}
#endif
/* EMBEDDED_LIBRARY */
...
...
@@ -12173,7 +12228,8 @@ void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val)
/*
Build a list of pointer to each line in ds_input, sort
the list and use the sorted list to append the strings
sorted to the output ds
sorted to the output ds. The string ds_input needs to
end with a newline.
SYNOPSIS
dynstr_append_sorted()
...
...
This diff is collapsed.
Click to expand it.
mysql-test/suite/sys_vars/r/mdev_31609.result
0 → 100644
View file @
8ca5935a
set @old_session_track_system_variables=@@global.session_track_system_variables;
set global session_track_system_variables="autocommit,character_set_client,character_set_connection,redirect_url,time_zone";
connect foo,localhost,root;
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- autocommit
-- ON
-- character_set_client
-- latin1
-- character_set_connection
-- latin1
-- redirect_url
--
-- time_zone
-- SYSTEM
connection default;
disconnect foo;
set global session_track_system_variables=@old_session_track_system_variables;
This diff is collapsed.
Click to expand it.
mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result
View file @
8ca5935a
...
...
@@ -160,14 +160,14 @@ connect foo,localhost,root;
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- autocommit
-- ON
-- time_zone
-- SYSTEM
-- character_set_client
-- latin1
-- character_set_connection
-- latin1
-- redirect_url
--
-- time_zone
-- SYSTEM
connection default;
disconnect foo;
...
...
This diff is collapsed.
Click to expand it.
mysql-test/suite/sys_vars/t/mdev_31609.test
0 → 100644
View file @
8ca5935a
--
source
include
/
not_embedded
.
inc
set
@
old_session_track_system_variables
=@@
global
.
session_track_system_variables
;
# We set the session_track_system_variables to exclude
# character_set_results as it can appear out of order in the CI
# builder x86-debian-sid.
set
global
session_track_system_variables
=
"autocommit,character_set_client,character_set_connection,redirect_url,time_zone"
;
enable_session_track_info
;
connect
foo
,
localhost
,
root
;
disable_session_track_info
;
connection
default
;
disconnect
foo
;
set
global
session_track_system_variables
=@
old_session_track_system_variables
;
This diff is collapsed.
Click to expand it.
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