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
f63aa496
Commit
f63aa496
authored
Mar 31, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/bkroot/mysql-5.1-new
into mysql.com:/home/bk/b18436-mysql-5.1-new
parents
64131287
255adeb7
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1144 additions
and
13 deletions
+1144
-13
mysql-test/extra/rpl_tests/rpl_partition.test
mysql-test/extra/rpl_tests/rpl_partition.test
+262
-0
mysql-test/r/rpl_row_basic_8partition.result
mysql-test/r/rpl_row_basic_8partition.result
+652
-0
mysql-test/t/rpl_row_basic_8partition.test
mysql-test/t/rpl_row_basic_8partition.test
+204
-0
sql/handler.cc
sql/handler.cc
+7
-0
sql/log_event.cc
sql/log_event.cc
+19
-13
No files found.
mysql-test/extra/rpl_tests/rpl_partition.test
0 → 100644
View file @
f63aa496
############################################################
# Author: MATZ #
# Date: 2006-03-22 #
# Purpose: See if replication of partition tables work #
############################################################
connection
master
;
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_query_log
--
echo
---
Start
test
2
partition
RANGE
testing
--
# Create table that is partitioned by range on year i.e. year(t) and
# replicate basice operations such at insert, update delete between 2
# different storage engines Alter table and ensure table is handled
# Correctly on the slave
# Note that the storage engine should not be explicit: the default
# storage engine is used on master and slave.
CREATE
TABLE
t1
(
id
MEDIUMINT
NOT
NULL
,
b1
BIT
(
8
),
vc
VARCHAR
(
255
),
bc
CHAR
(
255
),
d
DECIMAL
(
10
,
4
)
DEFAULT
0
,
f
FLOAT
DEFAULT
0
,
total
BIGINT
UNSIGNED
,
y
YEAR
,
t
DATE
)
PARTITION
BY
RANGE
(
YEAR
(
t
))
(
PARTITION
p0
VALUES
LESS
THAN
(
1901
),
PARTITION
p1
VALUES
LESS
THAN
(
1946
),
PARTITION
p2
VALUES
LESS
THAN
(
1966
),
PARTITION
p3
VALUES
LESS
THAN
(
1986
),
PARTITION
p4
VALUES
LESS
THAN
(
2005
),
PARTITION
p5
VALUES
LESS
THAN
MAXVALUE
);
--
echo
---
On
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
On
slave
--
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
source
include
/
rpl_multi_engine3
.
inc
--
echo
---
Check
that
simple
Alter
statements
are
replicated
correctly
---
ALTER
TABLE
t1
MODIFY
vc
TEXT
;
--
echo
---
On
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
On
slave
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
echo
---
Perform
basic
operation
on
master
---
--
echo
---
and
ensure
replicated
correctly
---
--
enable_query_log
--
source
include
/
rpl_multi_engine3
.
inc
--
echo
---
End
test
2
partition
RANGE
testing
---
DROP
TABLE
IF
EXISTS
t1
;
########################################################
--
echo
---
Start
test
3
partition
LIST
testing
---
--
echo
---
Do
setup
---
#################################################
# Requirment: Create table that is partitioned #
# by list on id i.e. (2,4). Pretend that we #
# missed one and alter to add. Then replicate #
# basice operations such at insert, update #
# delete between 2 different storage engines #
# Alter table and ensure table is handled #
# Correctly on the slave #
#################################################
CREATE
TABLE
t1
(
id
MEDIUMINT
NOT
NULL
,
b1
BIT
(
8
),
vc
VARCHAR
(
255
),
bc
CHAR
(
255
),
d
DECIMAL
(
10
,
4
)
DEFAULT
0
,
f
FLOAT
DEFAULT
0
,
total
BIGINT
UNSIGNED
,
y
YEAR
,
t
DATE
)
PARTITION
BY
LIST
(
id
)
(
PARTITION
p0
VALUES
IN
(
2
,
4
),
PARTITION
p1
VALUES
IN
(
42
,
142
));
--
echo
---
Test
3
Alter
to
add
partition
---
ALTER
TABLE
t1
ADD
PARTITION
(
PARTITION
p2
VALUES
IN
(
412
));
--
echo
---
Show
table
on
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
Show
table
on
slave
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
echo
---
Perform
basic
operation
on
master
---
--
echo
---
and
ensure
replicated
correctly
---
--
source
include
/
rpl_multi_engine3
.
inc
--
echo
---
Check
that
simple
Alter
statements
are
replicated
correctly
---
ALTER
TABLE
t1
MODIFY
vc
TEXT
;
--
echo
---
Show
the
new
improved
table
on
the
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
Make
sure
that
our
tables
on
slave
are
still
same
engine
---
--
echo
---
and
that
the
alter
statements
replicated
correctly
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
echo
---
Perform
basic
operation
on
master
---
--
echo
---
and
ensure
replicated
correctly
---
--
source
include
/
rpl_multi_engine3
.
inc
--
echo
---
End
test
3
partition
LIST
testing
---
--
echo
---
Do
Cleanup
--
DROP
TABLE
IF
EXISTS
t1
;
########################################################
--
echo
---
Start
test
4
partition
HASH
testing
---
--
echo
---
Do
setup
---
#################################################
# Requirment: Create table that is partitioned #
# by hash on year i.e. YEAR(t). Then replicate #
# basice operations such at insert, update #
# delete between 2 different storage engines #
# Alter table and ensure table is handled #
# Correctly on the slave #
#################################################
CREATE
TABLE
t1
(
id
MEDIUMINT
NOT
NULL
,
b1
BIT
(
8
),
vc
VARCHAR
(
255
),
bc
CHAR
(
255
),
d
DECIMAL
(
10
,
4
)
DEFAULT
0
,
f
FLOAT
DEFAULT
0
,
total
BIGINT
UNSIGNED
,
y
YEAR
,
t
DATE
)
PARTITION
BY
HASH
(
YEAR
(
t
)
)
PARTITIONS
4
;
--
echo
---
show
that
tables
have
been
created
correctly
---
SHOW
CREATE
TABLE
t1
;
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
echo
---
Perform
basic
operation
on
master
---
--
echo
---
and
ensure
replicated
correctly
---
--
source
include
/
rpl_multi_engine3
.
inc
--
echo
---
Check
that
simple
Alter
statements
are
replicated
correctly
---
ALTER
TABLE
t1
MODIFY
vc
TEXT
;
--
echo
---
Show
the
new
improved
table
on
the
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
Make
sure
that
our
tables
on
slave
are
still
same
engine
---
--
echo
---
and
that
the
alter
statements
replicated
correctly
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
echo
---
Perform
basic
operation
on
master
---
--
echo
---
and
ensure
replicated
correctly
---
--
source
include
/
rpl_multi_engine3
.
inc
--
echo
---
End
test
4
partition
HASH
testing
---
--
echo
---
Do
Cleanup
--
DROP
TABLE
IF
EXISTS
t1
;
########################################################
--
echo
---
Start
test
5
partition
by
key
testing
---
--
echo
---
Create
Table
Section
---
#################################################
# Requirment: Create table that is partitioned #
# by key on id with 4 parts. Then replicate #
# basice operations such at insert, update #
# delete between 2 different storage engines #
# Alter table and ensure table is handled #
# Correctly on the slave #
#################################################
CREATE
TABLE
t1
(
id
MEDIUMINT
NOT
NULL
,
b1
BIT
(
8
),
vc
VARCHAR
(
255
),
bc
CHAR
(
255
),
d
DECIMAL
(
10
,
4
)
DEFAULT
0
,
f
FLOAT
DEFAULT
0
,
total
BIGINT
UNSIGNED
,
y
YEAR
,
t
DATE
,
PRIMARY
KEY
(
id
))
PARTITION
BY
KEY
()
PARTITIONS
4
;
--
echo
---
Show
that
tables
on
master
are
ndbcluster
tables
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
Show
that
tables
on
slave
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
echo
---
Perform
basic
operation
on
master
---
--
echo
---
and
ensure
replicated
correctly
---
--
source
include
/
rpl_multi_engine3
.
inc
# Okay lets see how it holds up to table changes
--
echo
---
Check
that
simple
Alter
statements
are
replicated
correctly
---
ALTER
TABLE
t1
DROP
PRIMARY
KEY
,
ADD
PRIMARY
KEY
(
id
,
total
);
--
echo
---
Show
the
new
improved
table
on
the
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
Make
sure
that
our
tables
on
slave
are
still
right
type
---
--
echo
---
and
that
the
alter
statements
replicated
correctly
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
echo
---
Perform
basic
operation
on
master
---
--
echo
---
and
ensure
replicated
correctly
---
--
source
include
/
rpl_multi_engine3
.
inc
--
echo
---
Check
that
simple
Alter
statements
are
replicated
correctly
---
ALTER
TABLE
t1
MODIFY
vc
TEXT
;
--
echo
---
Show
the
new
improved
table
on
the
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
Make
sure
that
our
tables
on
slave
are
still
same
engine
---
--
echo
---
and
that
the
alter
statements
replicated
correctly
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
echo
---
Perform
basic
operation
on
master
---
--
echo
---
and
ensure
replicated
correctly
---
--
source
include
/
rpl_multi_engine3
.
inc
--
echo
---
End
test
5
key
partition
testing
---
--
echo
---
Do
Cleanup
---
DROP
TABLE
IF
EXISTS
t1
;
# End of 5.1 test case
mysql-test/r/rpl_row_basic_8partition.result
0 → 100644
View file @
f63aa496
This diff is collapsed.
Click to expand it.
mysql-test/t/rpl_row_basic_8partition.test
0 → 100644
View file @
f63aa496
############################################################
# Author: MATZ #
# Date: 2006-03-22 #
# Purpose: See if replication of partition tables work #
# Most of this test is copied from the rpl_xxx2yyy tests, #
# but here we just test some simple basic replication of #
# partition tables with same engine (MyISAM) in both ends. #
############################################################
--
source
include
/
master
-
slave
.
inc
connection
master
;
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
SET
BINLOG_FORMAT
=
ROW
;
--
echo
****
Partition
RANGE
testing
****
# Create table that is partitioned by range on year i.e. year(t) and
# replicate basice operations such at insert, update delete between 2
# different storage engines Alter table and ensure table is handled
# Correctly on the slave
# Note that the storage engine should not be explicit: the default
# storage engine is used on master and slave.
CREATE
TABLE
t1
(
id
MEDIUMINT
NOT
NULL
,
b1
BIT
(
8
),
vc
VARCHAR
(
255
),
bc
CHAR
(
255
),
d
DECIMAL
(
10
,
4
)
DEFAULT
0
,
f
FLOAT
DEFAULT
0
,
total
BIGINT
UNSIGNED
,
y
YEAR
,
t
DATE
)
PARTITION
BY
RANGE
(
YEAR
(
t
))
(
PARTITION
p0
VALUES
LESS
THAN
(
1901
),
PARTITION
p1
VALUES
LESS
THAN
(
1946
),
PARTITION
p2
VALUES
LESS
THAN
(
1966
),
PARTITION
p3
VALUES
LESS
THAN
(
1986
),
PARTITION
p4
VALUES
LESS
THAN
(
2005
),
PARTITION
p5
VALUES
LESS
THAN
MAXVALUE
);
--
echo
---
On
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
On
slave
--
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
source
include
/
rpl_multi_engine3
.
inc
connection
master
;
# Check that simple Alter statements are replicated correctly
ALTER
TABLE
t1
MODIFY
vc
TEXT
;
--
echo
---
On
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
On
slave
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
# Perform basic operation on master and ensure replicated correctly
--
source
include
/
rpl_multi_engine3
.
inc
connection
master
;
DROP
TABLE
IF
EXISTS
t1
;
########################################################
--
echo
****
Partition
LIST
testing
****
# Create table that is partitioned by list on id i.e. (2,4). Pretend
# that we missed one and alter to add. Then replicate basice
# operations such at insert, update delete between 2 different storage
# engines Alter table and ensure table is handled Correctly on the
# slave.
CREATE
TABLE
t1
(
id
MEDIUMINT
NOT
NULL
,
b1
BIT
(
8
),
vc
VARCHAR
(
255
),
bc
CHAR
(
255
),
d
DECIMAL
(
10
,
4
)
DEFAULT
0
,
f
FLOAT
DEFAULT
0
,
total
BIGINT
UNSIGNED
,
y
YEAR
,
t
DATE
)
PARTITION
BY
LIST
(
id
)
(
PARTITION
p0
VALUES
IN
(
2
,
4
),
PARTITION
p1
VALUES
IN
(
42
,
142
),
PARTITION
p2
VALUES
IN
(
412
));
--
echo
---
On
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
On
slave
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
# Perform basic operation on master and ensure replicated correctly
--
source
include
/
rpl_multi_engine3
.
inc
connection
master
;
# Check that simple Alter statements are replicated correctly ---
ALTER
TABLE
t1
MODIFY
vc
TEXT
;
--
echo
---
On
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
On
slave
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
# Perform basic operation on master and ensure replicated correctly
--
source
include
/
rpl_multi_engine3
.
inc
connection
master
;
DROP
TABLE
IF
EXISTS
t1
;
########################################################
--
echo
****
Partition
HASH
testing
****
# Create table that is partitioned by hash on year i.e. YEAR(t). Then
# replicate basice operations such at insert, update delete between 2
# different storage engines Alter table and ensure table is handled
# Correctly on the slave
CREATE
TABLE
t1
(
id
MEDIUMINT
NOT
NULL
,
b1
BIT
(
8
),
vc
VARCHAR
(
255
),
bc
CHAR
(
255
),
d
DECIMAL
(
10
,
4
)
DEFAULT
0
,
f
FLOAT
DEFAULT
0
,
total
BIGINT
UNSIGNED
,
y
YEAR
,
t
DATE
)
PARTITION
BY
HASH
(
YEAR
(
t
)
)
PARTITIONS
4
;
--
echo
---
On
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
On
slave
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
source
include
/
rpl_multi_engine3
.
inc
# Check that simple Alter statements are replicated correctly
ALTER
TABLE
t1
MODIFY
vc
TEXT
;
--
echo
---
On
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
On
slave
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
source
include
/
rpl_multi_engine3
.
inc
connection
master
;
DROP
TABLE
IF
EXISTS
t1
;
########################################################
# This part does not work
--
echo
****
Partition
by
KEY
****
# Create table that is partitioned by key on id with 4 parts. Then
# replicate basice operations such at insert, update delete between 2
# different storage engines Alter table and ensure table is handled
# Correctly on the slave
CREATE
TABLE
t1
(
id
MEDIUMINT
NOT
NULL
,
b1
BIT
(
8
),
vc
VARCHAR
(
255
),
bc
CHAR
(
255
),
d
DECIMAL
(
10
,
4
)
DEFAULT
0
,
f
FLOAT
DEFAULT
0
,
total
BIGINT
UNSIGNED
,
y
YEAR
,
t
DATE
,
PRIMARY
KEY
(
id
))
PARTITION
BY
KEY
()
PARTITIONS
4
;
--
echo
---
On
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
On
slave
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
source
include
/
rpl_multi_engine3
.
inc
connection
master
;
# Check that simple Alter statements are replicated correctly
ALTER
TABLE
t1
DROP
PRIMARY
KEY
,
ADD
PRIMARY
KEY
(
id
,
total
);
--
echo
---
On
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
On
slave
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
source
include
/
rpl_multi_engine3
.
inc
connection
master
;
# Check that simple Alter statements are replicated correctly
ALTER
TABLE
t1
MODIFY
vc
TEXT
;
--
echo
---
On
master
---
SHOW
CREATE
TABLE
t1
;
--
echo
---
On
slave
---
sync_slave_with_master
;
SHOW
CREATE
TABLE
t1
;
--
source
include
/
rpl_multi_engine3
.
inc
DROP
TABLE
IF
EXISTS
t1
;
# End of 5.1 test case
sql/handler.cc
View file @
f63aa496
...
...
@@ -3309,6 +3309,13 @@ int handler::ha_write_row(byte *buf)
int
handler
::
ha_update_row
(
const
byte
*
old_data
,
byte
*
new_data
)
{
int
error
;
/*
Some storage engines require that the new record is in record[0]
(and the old record is in record[1]).
*/
DBUG_ASSERT
(
new_data
==
table
->
record
[
0
]);
if
(
unlikely
(
error
=
update_row
(
old_data
,
new_data
)))
return
error
;
#ifdef HAVE_ROW_BASED_REPLICATION
...
...
sql/log_event.cc
View file @
f63aa496
...
...
@@ -6402,7 +6402,7 @@ static int find_and_fetch_row(TABLE *table, byte *key)
table->record[0] if the engine allows it. We first compute a
row reference using the position() member function (it will be
stored in table->file->ref) and the use rnd_pos() to position
the "cursor" at the correct row.
the "cursor"
(i.e., record[0] in this case)
at the correct row.
*/
table
->
file
->
position
(
table
->
record
[
0
]);
DBUG_RETURN
(
table
->
file
->
rnd_pos
(
table
->
record
[
0
],
table
->
file
->
ref
));
...
...
@@ -6425,9 +6425,9 @@ static int find_and_fetch_row(TABLE *table, byte *key)
my_ptrdiff_t
const
pos
=
table
->
s
->
null_bytes
>
0
?
table
->
s
->
null_bytes
-
1
:
0
;
table
->
record
[
1
][
pos
]
=
0xFF
;
if
((
error
=
table
->
file
->
index_read
_idx
(
table
->
record
[
1
],
0
,
key
,
table
->
key_info
->
key_length
,
HA_READ_KEY_EXACT
)))
if
((
error
=
table
->
file
->
index_read
(
table
->
record
[
1
]
,
key
,
table
->
key_info
->
key_length
,
HA_READ_KEY_EXACT
)))
{
table
->
file
->
print_error
(
error
,
MYF
(
0
));
DBUG_RETURN
(
error
);
...
...
@@ -6797,19 +6797,25 @@ int Update_rows_log_event::do_exec_row(TABLE *table)
return
error
;
/*
This is only a precaution to make sure that the call to
ha_update_row is using record[1].
If this is not needed/required, then we could use m_after_image in
that call instead.
We have to ensure that the new record (i.e., the after image) is
in record[0] and the old record (i.e., the before image) is in
record[1]. This since some storage engines require this (for
example, the partition engine).
Since find_and_fetch_row() puts the fetched record (i.e., the old
record) in record[0], we have to move it out of the way and into
record[1]. After that, we can put the new record (i.e., the after
image) into record[0].
*/
bmove_align
(
table
->
record
[
1
],
m_after_image
,(
size_t
)
table
->
s
->
reclength
);
bmove_align
(
table
->
record
[
1
],
table
->
record
[
0
],
table
->
s
->
reclength
);
bmove_align
(
table
->
record
[
0
],
m_after_image
,
table
->
s
->
reclength
);
/*
Now we should have the right row to update. The record that has
been fetched is guaranteed to be in record[0], so we use that.
Now we should have the right row to update. The old row (the one
we're looking for) has to be in record[1] and the new row has to
be in record[0] for all storage engines to work correctly.
*/
error
=
table
->
file
->
ha_update_row
(
table
->
record
[
0
],
table
->
record
[
1
]);
error
=
table
->
file
->
ha_update_row
(
table
->
record
[
1
],
table
->
record
[
0
]);
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