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
517d7182
Commit
517d7182
authored
Mar 09, 2018
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-15477: SESSION_SYSVARS_TRACKER does not track last_gtid
register changes of last_gtid
parent
73de63e8
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
92 additions
and
28 deletions
+92
-28
mysql-test/r/mysqltest_tracking_info.result
mysql-test/r/mysqltest_tracking_info.result
+4
-20
mysql-test/r/session_tracker_last_gtid.result
mysql-test/r/session_tracker_last_gtid.result
+34
-0
mysql-test/t/mysqltest_tracking_info.test
mysql-test/t/mysqltest_tracking_info.test
+2
-2
mysql-test/t/session_tracker_last_gtid.test
mysql-test/t/session_tracker_last_gtid.test
+19
-0
sql/log.cc
sql/log.cc
+4
-1
sql/set_var.h
sql/set_var.h
+1
-1
sql/sql_class.cc
sql/sql_class.cc
+16
-1
sql/sql_class.h
sql/sql_class.h
+7
-1
sql/sys_vars.cc
sql/sys_vars.cc
+5
-2
No files found.
mysql-test/r/mysqltest_tracking_info.result
View file @
517d7182
SELECT @@session.character_set_c
lient, @@session.character_set_results, @@session.character_set_c
onnection;
@@session.character_set_c
lient @@session.character_set_results @@session.character_set_c
onnection
latin1
latin1 latin1
SET @@session.session_track_system_variables='character_set_c
lient,character_set_results,character_set_c
onnection';
SELECT @@session.character_set_connection;
@@session.character_set_connection
latin1
SET @@session.session_track_system_variables='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';
...
...
mysql-test/r/session_tracker_last_gtid.result
0 → 100644
View file @
517d7182
#
# MDEV-15477: SESSION_SYSVARS_TRACKER does not track last_gtid
#
SET gtid_seq_no=1000;
SET @@session.session_track_system_variables='last_gtid';
create table t1 (a int) engine=innodb;
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- last_gtid
-- 0-1-1000
select @@last_gtid;
@@last_gtid
0-1-1000
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- last_gtid
-- 0-1-1000
insert into t1 values (1);
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- last_gtid
-- 0-1-1001
select @@last_gtid;
@@last_gtid
0-1-1001
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- last_gtid
-- 0-1-1001
drop table t1;
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- last_gtid
-- 0-1-1002
mysql-test/t/mysqltest_tracking_info.test
View file @
517d7182
...
...
@@ -2,8 +2,8 @@
--
source
include
/
no_protocol
.
inc
--
source
include
/
not_embedded
.
inc
SELECT
@@
session
.
character_set_c
lient
,
@@
session
.
character_set_results
,
@@
session
.
character_set_c
onnection
;
SET
@@
session
.
session_track_system_variables
=
'character_set_c
lient,character_set_results,character_set_c
onnection'
;
SELECT
@@
session
.
character_set_connection
;
SET
@@
session
.
session_track_system_variables
=
'character_set_connection'
;
--
echo
# tracking info on
--
enable_session_track_info
...
...
mysql-test/t/session_tracker_last_gtid.test
0 → 100644
View file @
517d7182
--
source
include
/
not_embedded
.
inc
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_binlog_format_statement
.
inc
--
enable_session_track_info
--
echo
#
--
echo
# MDEV-15477: SESSION_SYSVARS_TRACKER does not track last_gtid
--
echo
#
SET
gtid_seq_no
=
1000
;
SET
@@
session
.
session_track_system_variables
=
'last_gtid'
;
create
table
t1
(
a
int
)
engine
=
innodb
;
select
@@
last_gtid
;
insert
into
t1
values
(
1
);
select
@@
last_gtid
;
drop
table
t1
;
--
disable_session_track_info
sql/log.cc
View file @
517d7182
...
...
@@ -46,6 +46,8 @@
#include <stdarg.h>
#include <m_ctype.h> // For test_if_number
#include <set_var.h> // for Sys_last_gtid_ptr
#ifdef _WIN32
#include "message.h"
#endif
...
...
@@ -5945,7 +5947,8 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone,
}
if
(
err
)
DBUG_RETURN
(
true
);
thd
->
last_commit_gtid
=
gtid
;
thd
->
set_last_commit_gtid
(
gtid
);
Gtid_log_event
gtid_event
(
thd
,
seq_no
,
domain_id
,
standalone
,
LOG_EVENT_SUPPRESS_USE_F
,
is_transactional
,
...
...
sql/set_var.h
View file @
517d7182
...
...
@@ -430,7 +430,7 @@ sql_mode_t expand_sql_mode(sql_mode_t sql_mode);
bool
sql_mode_string_representation
(
THD
*
thd
,
sql_mode_t
sql_mode
,
LEX_STRING
*
ls
);
int
default_regex_flags_pcre
(
const
THD
*
thd
);
extern
sys_var
*
Sys_autocommit_ptr
;
extern
sys_var
*
Sys_autocommit_ptr
,
*
Sys_last_gtid_ptr
;
CHARSET_INFO
*
get_old_charset_by_name
(
const
char
*
old_name
);
...
...
sql/sql_class.cc
View file @
517d7182
...
...
@@ -1190,7 +1190,7 @@ void THD::init(void)
bzero
((
char
*
)
&
org_status_var
,
sizeof
(
org_status_var
));
status_in_global
=
0
;
start_bytes_received
=
0
;
last_commit_gtid
.
seq_no
=
0
;
m_
last_commit_gtid
.
seq_no
=
0
;
last_stmt
=
NULL
;
/* Reset status of last insert id */
arg_of_last_insert_id_function
=
FALSE
;
...
...
@@ -6972,6 +6972,21 @@ THD::signal_wakeup_ready()
mysql_cond_signal
(
&
COND_wakeup_ready
);
}
void
THD
::
set_last_commit_gtid
(
rpl_gtid
&
gtid
)
{
#ifndef EMBEDDED_LIBRARY
bool
changed_gtid
=
(
m_last_commit_gtid
.
seq_no
!=
gtid
.
seq_no
);
#endif
m_last_commit_gtid
=
gtid
;
#ifndef EMBEDDED_LIBRARY
if
(
changed_gtid
&&
session_tracker
.
get_tracker
(
SESSION_SYSVARS_TRACKER
)
->
is_enabled
())
{
session_tracker
.
get_tracker
(
SESSION_SYSVARS_TRACKER
)
->
mark_as_changed
(
this
,
(
LEX_CSTRING
*
)
Sys_last_gtid_ptr
);
}
#endif
}
void
wait_for_commit
::
reinit
()
...
...
sql/sql_class.h
View file @
517d7182
...
...
@@ -4255,7 +4255,13 @@ class THD :public Statement,
The GTID assigned to the last commit. If no GTID was assigned to any commit
so far, this is indicated by last_commit_gtid.seq_no == 0.
*/
rpl_gtid
last_commit_gtid
;
private
:
rpl_gtid
m_last_commit_gtid
;
public
:
rpl_gtid
get_last_commit_gtid
()
{
return
m_last_commit_gtid
;
}
void
set_last_commit_gtid
(
rpl_gtid
&
gtid
);
LF_PINS
*
tdc_hash_pins
;
LF_PINS
*
xid_hash_pins
;
...
...
sql/sys_vars.cc
View file @
517d7182
...
...
@@ -1828,6 +1828,8 @@ static Sys_var_last_gtid Sys_last_gtid(
"or the empty string if none."
,
READ_ONLY
sys_var
::
ONLY_SESSION
,
NO_CMD_LINE
);
export
sys_var
*
Sys_last_gtid_ptr
=
&
Sys_last_gtid
;
// for check changing
uchar
*
Sys_var_last_gtid
::
session_value_ptr
(
THD
*
thd
,
const
LEX_STRING
*
base
)
...
...
@@ -1838,8 +1840,9 @@ Sys_var_last_gtid::session_value_ptr(THD *thd, const LEX_STRING *base)
bool
first
=
true
;
str
.
length
(
0
);
if
((
thd
->
last_commit_gtid
.
seq_no
>
0
&&
rpl_slave_state_tostring_helper
(
&
str
,
&
thd
->
last_commit_gtid
,
&
first
))
||
rpl_gtid
gtid
=
thd
->
get_last_commit_gtid
();
if
((
gtid
.
seq_no
>
0
&&
rpl_slave_state_tostring_helper
(
&
str
,
&
gtid
,
&
first
))
||
!
(
p
=
thd
->
strmake
(
str
.
ptr
(),
str
.
length
())))
{
my_error
(
ER_OUT_OF_RESOURCES
,
MYF
(
0
));
...
...
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