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
ef10ef98
Commit
ef10ef98
authored
Dec 16, 2016
by
kevg
Committed by
Aleksey Midenkov
May 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL: UPDATE on row-based replication [closes: #94]
parent
41d98408
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
148 additions
and
19 deletions
+148
-19
mysql-test/suite/versioning/r/rpl_row.result
mysql-test/suite/versioning/r/rpl_row.result
+41
-0
mysql-test/suite/versioning/r/rpl_stmt.result
mysql-test/suite/versioning/r/rpl_stmt.result
+41
-0
mysql-test/suite/versioning/t/rpl_row.test
mysql-test/suite/versioning/t/rpl_row.test
+7
-0
mysql-test/suite/versioning/t/rpl_stmt.test
mysql-test/suite/versioning/t/rpl_stmt.test
+7
-0
mysql-test/suite/versioning/t/rpl_test.inc
mysql-test/suite/versioning/t/rpl_test.inc
+33
-0
sql/ha_sequence.cc
sql/ha_sequence.cc
+4
-2
sql/handler.cc
sql/handler.cc
+15
-17
No files found.
mysql-test/suite/versioning/r/rpl_row.result
0 → 100644
View file @
ef10ef98
include/master-slave.inc
[connection master]
connection slave;
connection master;
CREATE TABLE t1 (x int) with system versioning ENGINE = innodb;
insert into t1 values (1);
SELECT * FROM t1;
x
1
delete from t1;
select * from t1;
x
select * from t1 for system_time all;
x
1
connection slave;
select * from t1;
x
select * from t1 for system_time all;
x
1
connection master;
insert into t1 values (2);
connection slave;
select * from t1;
x
2
connection master;
update t1 set x = 3;
connection slave;
select * from t1;
x
3
select * from t1 for system_time all;
x
1
3
2
connection master;
drop table t1;
include/rpl_end.inc
mysql-test/suite/versioning/r/rpl_stmt.result
0 → 100644
View file @
ef10ef98
include/master-slave.inc
[connection master]
connection slave;
connection master;
CREATE TABLE t1 (x int) with system versioning ENGINE = innodb;
insert into t1 values (1);
SELECT * FROM t1;
x
1
delete from t1;
select * from t1;
x
select * from t1 for system_time all;
x
1
connection slave;
select * from t1;
x
select * from t1 for system_time all;
x
1
connection master;
insert into t1 values (2);
connection slave;
select * from t1;
x
2
connection master;
update t1 set x = 3;
connection slave;
select * from t1;
x
3
select * from t1 for system_time all;
x
1
3
2
connection master;
drop table t1;
include/rpl_end.inc
mysql-test/suite/versioning/t/rpl_row.test
0 → 100644
View file @
ef10ef98
--
source
include
/
have_binlog_format_row
.
inc
--
source
include
/
master
-
slave
.
inc
--
source
include
/
have_innodb
.
inc
--
source
rpl_test
.
inc
--
source
include
/
rpl_end
.
inc
mysql-test/suite/versioning/t/rpl_stmt.test
0 → 100644
View file @
ef10ef98
--
source
include
/
have_binlog_format_statement
.
inc
--
source
include
/
master
-
slave
.
inc
--
source
include
/
have_innodb
.
inc
--
source
rpl_test
.
inc
--
source
include
/
rpl_end
.
inc
mysql-test/suite/versioning/t/rpl_test.inc
0 → 100644
View file @
ef10ef98
#BUG#12662190 - COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS
#Testing command counters -BEFORE.
#Storing the before counts of Slave
connection
slave
;
let
$slave_com_commit_before
=
query_get_value
(
SHOW
GLOBAL
STATUS
LIKE
'com_commit'
,
Value
,
1
);
let
$slave_com_insert_before
=
query_get_value
(
SHOW
GLOBAL
STATUS
LIKE
'com_insert'
,
Value
,
1
);
let
$slave_com_delete_before
=
query_get_value
(
SHOW
GLOBAL
STATUS
LIKE
'com_delete'
,
Value
,
1
);
let
$slave_com_update_before
=
query_get_value
(
SHOW
GLOBAL
STATUS
LIKE
'com_update'
,
Value
,
1
);
connection
master
;
CREATE
TABLE
t1
(
x
int
)
with
system
versioning
ENGINE
=
innodb
;
insert
into
t1
values
(
1
);
SELECT
*
FROM
t1
;
delete
from
t1
;
select
*
from
t1
;
select
*
from
t1
for
system_time
all
;
sync_slave_with_master
;
select
*
from
t1
;
select
*
from
t1
for
system_time
all
;
connection
master
;
insert
into
t1
values
(
2
);
sync_slave_with_master
;
select
*
from
t1
;
connection
master
;
update
t1
set
x
=
3
;
sync_slave_with_master
;
select
*
from
t1
;
select
*
from
t1
for
system_time
all
;
connection
master
;
drop
table
t1
;
sql/ha_sequence.cc
View file @
ef10ef98
...
@@ -220,6 +220,7 @@ int ha_sequence::write_row(uchar *buf)
...
@@ -220,6 +220,7 @@ int ha_sequence::write_row(uchar *buf)
sequence
->
copy
(
&
tmp_seq
);
sequence
->
copy
(
&
tmp_seq
);
rows_changed
++
;
rows_changed
++
;
/* We have to do the logging while we hold the sequence mutex */
/* We have to do the logging while we hold the sequence mutex */
if
(
table
->
file
->
check_table_binlog_row_based
(
1
))
error
=
binlog_log_row
(
table
,
0
,
buf
,
log_func
);
error
=
binlog_log_row
(
table
,
0
,
buf
,
log_func
);
row_already_logged
=
1
;
row_already_logged
=
1
;
}
}
...
@@ -254,6 +255,7 @@ int ha_sequence::update_row(const uchar *old_data, uchar *new_data)
...
@@ -254,6 +255,7 @@ int ha_sequence::update_row(const uchar *old_data, uchar *new_data)
sequence
->
copy
(
&
tmp_seq
);
sequence
->
copy
(
&
tmp_seq
);
rows_changed
++
;
rows_changed
++
;
/* We have to do the logging while we hold the sequence mutex */
/* We have to do the logging while we hold the sequence mutex */
if
(
table
->
file
->
check_table_binlog_row_based
(
1
))
error
=
binlog_log_row
(
table
,
old_data
,
new_data
,
error
=
binlog_log_row
(
table
,
old_data
,
new_data
,
Update_rows_log_event
::
binlog_row_logging_function
);
Update_rows_log_event
::
binlog_row_logging_function
);
row_already_logged
=
1
;
row_already_logged
=
1
;
...
...
sql/handler.cc
View file @
ef10ef98
...
@@ -5795,7 +5795,7 @@ static int write_locked_table_maps(THD *thd)
...
@@ -5795,7 +5795,7 @@ static int write_locked_table_maps(THD *thd)
static
int
check_wsrep_max_ws_rows
();
static
int
check_wsrep_max_ws_rows
();
static
int
binlog_log_row_internal
(
TABLE
*
table
,
int
binlog_log_row
(
TABLE
*
table
,
const
uchar
*
before_record
,
const
uchar
*
before_record
,
const
uchar
*
after_record
,
const
uchar
*
after_record
,
Log_func
*
log_func
)
Log_func
*
log_func
)
...
@@ -5833,16 +5833,6 @@ static int binlog_log_row_internal(TABLE* table,
...
@@ -5833,16 +5833,6 @@ static int binlog_log_row_internal(TABLE* table,
return
error
?
HA_ERR_RBR_LOGGING_FAILED
:
0
;
return
error
?
HA_ERR_RBR_LOGGING_FAILED
:
0
;
}
}
int
binlog_log_row
(
TABLE
*
table
,
const
uchar
*
before_record
,
const
uchar
*
after_record
,
Log_func
*
log_func
)
{
if
(
!
table
->
file
->
check_table_binlog_row_based
(
1
))
return
0
;
return
binlog_log_row_internal
(
table
,
before_record
,
after_record
,
log_func
);
}
int
handler
::
ha_external_lock
(
THD
*
thd
,
int
lock_type
)
int
handler
::
ha_external_lock
(
THD
*
thd
,
int
lock_type
)
{
{
...
@@ -5991,6 +5981,7 @@ int handler::ha_write_row(uchar *buf)
...
@@ -5991,6 +5981,7 @@ int handler::ha_write_row(uchar *buf)
if
(
likely
(
!
error
)
&&
!
row_already_logged
)
if
(
likely
(
!
error
)
&&
!
row_already_logged
)
{
{
rows_changed
++
;
rows_changed
++
;
if
(
table
->
file
->
check_table_binlog_row_based
(
1
))
error
=
binlog_log_row
(
table
,
0
,
buf
,
log_func
);
error
=
binlog_log_row
(
table
,
0
,
buf
,
log_func
);
}
}
DEBUG_SYNC_C
(
"ha_write_row_end"
);
DEBUG_SYNC_C
(
"ha_write_row_end"
);
...
@@ -6012,6 +6003,9 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data)
...
@@ -6012,6 +6003,9 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data)
DBUG_ASSERT
(
new_data
==
table
->
record
[
0
]);
DBUG_ASSERT
(
new_data
==
table
->
record
[
0
]);
DBUG_ASSERT
(
old_data
==
table
->
record
[
1
]);
DBUG_ASSERT
(
old_data
==
table
->
record
[
1
]);
// InnoDB changes sys_trx_end to curr_trx_id and we need to restore MAX_TRX
if
(
table
->
file
->
check_table_binlog_row_based
(
1
))
memcpy
(
table
->
record
[
2
],
table
->
record
[
1
],
table
->
s
->
reclength
);
MYSQL_UPDATE_ROW_START
(
table_share
->
db
.
str
,
table_share
->
table_name
.
str
);
MYSQL_UPDATE_ROW_START
(
table_share
->
db
.
str
,
table_share
->
table_name
.
str
);
mark_trx_read_write
();
mark_trx_read_write
();
increment_statistics
(
&
SSV
::
ha_update_count
);
increment_statistics
(
&
SSV
::
ha_update_count
);
...
@@ -6023,8 +6017,11 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data)
...
@@ -6023,8 +6017,11 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data)
if
(
likely
(
!
error
)
&&
!
row_already_logged
)
if
(
likely
(
!
error
)
&&
!
row_already_logged
)
{
{
rows_changed
++
;
rows_changed
++
;
if
(
table
->
file
->
check_table_binlog_row_based
(
1
))
{
memcpy
(
table
->
record
[
1
],
table
->
record
[
2
],
table
->
s
->
reclength
);
error
=
binlog_log_row
(
table
,
old_data
,
new_data
,
log_func
);
error
=
binlog_log_row
(
table
,
old_data
,
new_data
,
log_func
);
}
}
}
return
error
;
return
error
;
}
}
...
@@ -6072,6 +6069,7 @@ int handler::ha_delete_row(const uchar *buf)
...
@@ -6072,6 +6069,7 @@ int handler::ha_delete_row(const uchar *buf)
if
(
likely
(
!
error
))
if
(
likely
(
!
error
))
{
{
rows_changed
++
;
rows_changed
++
;
if
(
table
->
file
->
check_table_binlog_row_based
(
1
))
error
=
binlog_log_row
(
table
,
buf
,
0
,
log_func
);
error
=
binlog_log_row
(
table
,
buf
,
0
,
log_func
);
}
}
return
error
;
return
error
;
...
...
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