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
4743fb69
Commit
4743fb69
authored
Oct 25, 2006
by
lars/lthalmann@mysql.com/dl145h.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/users/lthalmann/bkroot/mysql-5.0-rpl
into mysql.com:/users/lthalmann/bk/MERGE/mysql-5.0-merge
parents
4eff5ab2
4b134f74
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
97 additions
and
34 deletions
+97
-34
myisam/mi_key.c
myisam/mi_key.c
+8
-7
myisam/mi_open.c
myisam/mi_open.c
+2
-0
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_ucs.result
+22
-0
mysql-test/r/rpl_deadlock.result
mysql-test/r/rpl_deadlock.result
+23
-15
mysql-test/t/ctype_ucs.test
mysql-test/t/ctype_ucs.test
+17
-0
mysql-test/t/rpl_deadlock.test
mysql-test/t/rpl_deadlock.test
+10
-6
sql/slave.cc
sql/slave.cc
+15
-6
No files found.
myisam/mi_key.c
View file @
4743fb69
...
@@ -52,7 +52,7 @@ static int _mi_put_key_in_record(MI_INFO *info,uint keynr,byte *record);
...
@@ -52,7 +52,7 @@ static int _mi_put_key_in_record(MI_INFO *info,uint keynr,byte *record);
uint
_mi_make_key
(
register
MI_INFO
*
info
,
uint
keynr
,
uchar
*
key
,
uint
_mi_make_key
(
register
MI_INFO
*
info
,
uint
keynr
,
uchar
*
key
,
const
byte
*
record
,
my_off_t
filepos
)
const
byte
*
record
,
my_off_t
filepos
)
{
{
byte
*
pos
,
*
end
;
byte
*
pos
;
uchar
*
start
;
uchar
*
start
;
reg1
HA_KEYSEG
*
keyseg
;
reg1
HA_KEYSEG
*
keyseg
;
my_bool
is_ft
=
info
->
s
->
keyinfo
[
keynr
].
flag
&
HA_FULLTEXT
;
my_bool
is_ft
=
info
->
s
->
keyinfo
[
keynr
].
flag
&
HA_FULLTEXT
;
...
@@ -107,18 +107,17 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
...
@@ -107,18 +107,17 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
}
}
if
(
keyseg
->
flag
&
HA_SPACE_PACK
)
if
(
keyseg
->
flag
&
HA_SPACE_PACK
)
{
{
end
=
pos
+
length
;
if
(
type
!=
HA_KEYTYPE_NUM
)
if
(
type
!=
HA_KEYTYPE_NUM
)
{
{
while
(
end
>
pos
&&
end
[
-
1
]
==
' '
)
length
=
cs
->
cset
->
lengthsp
(
cs
,
pos
,
length
);
end
--
;
}
}
else
else
{
{
byte
*
end
=
pos
+
length
;
while
(
pos
<
end
&&
pos
[
0
]
==
' '
)
while
(
pos
<
end
&&
pos
[
0
]
==
' '
)
pos
++
;
pos
++
;
length
=
(
uint
)
(
end
-
pos
);
}
}
length
=
(
uint
)
(
end
-
pos
);
FIX_LENGTH
(
cs
,
pos
,
length
,
char_length
);
FIX_LENGTH
(
cs
,
pos
,
length
,
char_length
);
store_key_length_inc
(
key
,
char_length
);
store_key_length_inc
(
key
,
char_length
);
memcpy
((
byte
*
)
key
,(
byte
*
)
pos
,(
size_t
)
char_length
);
memcpy
((
byte
*
)
key
,(
byte
*
)
pos
,(
size_t
)
char_length
);
...
@@ -403,8 +402,10 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
...
@@ -403,8 +402,10 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
pos
=
record
+
keyseg
->
start
;
pos
=
record
+
keyseg
->
start
;
if
(
keyseg
->
type
!=
(
int
)
HA_KEYTYPE_NUM
)
if
(
keyseg
->
type
!=
(
int
)
HA_KEYTYPE_NUM
)
{
{
memcpy
(
pos
,
key
,(
size_t
)
length
);
memcpy
(
pos
,
key
,(
size_t
)
length
);
bfill
(
pos
+
length
,
keyseg
->
length
-
length
,
' '
);
keyseg
->
charset
->
cset
->
fill
(
keyseg
->
charset
,
pos
+
length
,
keyseg
->
length
-
length
,
' '
);
}
}
else
else
{
{
...
...
myisam/mi_open.c
View file @
4743fb69
...
@@ -336,6 +336,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
...
@@ -336,6 +336,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
goto
err
;
goto
err
;
}
}
}
}
else
if
(
pos
->
type
==
HA_KEYTYPE_BINARY
)
pos
->
charset
=
&
my_charset_bin
;
}
}
if
(
share
->
keyinfo
[
i
].
flag
&
HA_SPATIAL
)
if
(
share
->
keyinfo
[
i
].
flag
&
HA_SPATIAL
)
{
{
...
...
mysql-test/r/ctype_ucs.result
View file @
4743fb69
...
@@ -723,6 +723,28 @@ lily
...
@@ -723,6 +723,28 @@ lily
river
river
drop table t1;
drop table t1;
deallocate prepare stmt;
deallocate prepare stmt;
create table t1 (
a char(10) unicode not null,
index a (a)
) engine=myisam;
insert into t1 values (repeat(0x201f, 10));
insert into t1 values (repeat(0x2020, 10));
insert into t1 values (repeat(0x2021, 10));
explain select hex(a) from t1 order by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 20 NULL 3 Using index
select hex(a) from t1 order by a;
hex(a)
201F201F201F201F201F201F201F201F201F201F
2020202020202020202020202020202020202020
2021202120212021202120212021202120212021
alter table t1 drop index a;
select hex(a) from t1 order by a;
hex(a)
201F201F201F201F201F201F201F201F201F201F
2020202020202020202020202020202020202020
2021202120212021202120212021202120212021
drop table t1;
CREATE TABLE t1 (id int, s char(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci);
CREATE TABLE t1 (id int, s char(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci);
INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
SELECT id, MIN(s) FROM t1 GROUP BY id;
SELECT id, MIN(s) FROM t1 GROUP BY id;
...
...
mysql-test/r/rpl_deadlock.result
View file @
4743fb69
...
@@ -6,7 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
...
@@ -6,7 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
start slave;
create table t1 (a int not null, key(a)) engine=innodb;
create table t1 (a int not null, key(a)) engine=innodb;
create table t2 (a int not null, key(a)) engine=innodb;
create table t2 (a int not null, key(a)) engine=innodb;
create table t3 (a int) engine=innodb;
create table t3 (a int
unique
) engine=innodb;
create table t4 (a int) engine=innodb;
create table t4 (a int) engine=innodb;
show variables like 'slave_transaction_retries';
show variables like 'slave_transaction_retries';
Variable_name Value
Variable_name Value
...
@@ -35,14 +35,14 @@ begin;
...
@@ -35,14 +35,14 @@ begin;
select * from t1 for update;
select * from t1 for update;
a
a
start slave;
start slave;
insert into t2 values(2
2
);
insert into t2 values(2
01
);
commit;
commit;
select * from t1;
select * from t1;
a
a
1
1
select * from t2;
select * from t2;
a
a
2
2
2
01
show slave status;
show slave status;
Slave_IO_State #
Slave_IO_State #
Master_Host 127.0.0.1
Master_Host 127.0.0.1
...
@@ -50,7 +50,7 @@ Master_User root
...
@@ -50,7 +50,7 @@ Master_User root
Master_Port MASTER_MYPORT
Master_Port MASTER_MYPORT
Connect_Retry 1
Connect_Retry 1
Master_Log_File master-bin.000001
Master_Log_File master-bin.000001
Read_Master_Log_Pos 1891
1
Read_Master_Log_Pos 1891
8
Relay_Log_File #
Relay_Log_File #
Relay_Log_Pos #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Relay_Master_Log_File master-bin.000001
...
@@ -65,7 +65,7 @@ Replicate_Wild_Ignore_Table
...
@@ -65,7 +65,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Errno 0
Last_Error
Last_Error
Skip_Counter 0
Skip_Counter 0
Exec_Master_Log_Pos 1891
1
Exec_Master_Log_Pos 1891
8
Relay_Log_Space #
Relay_Log_Space #
Until_Condition None
Until_Condition None
Until_Log_File
Until_Log_File
...
@@ -78,12 +78,16 @@ Master_SSL_Cipher
...
@@ -78,12 +78,16 @@ Master_SSL_Cipher
Master_SSL_Key
Master_SSL_Key
Seconds_Behind_Master #
Seconds_Behind_Master #
stop slave;
stop slave;
change master to master_log_pos=532;
delete from t3;
change master to master_log_pos=539;
begin;
begin;
select * from t2 for update;
select * from t2 for update;
a
a
2
2
2
01
start slave;
start slave;
select count(*) from t3 /* must be zero */;
count(*)
0
commit;
commit;
select * from t1;
select * from t1;
a
a
...
@@ -91,7 +95,7 @@ a
...
@@ -91,7 +95,7 @@ a
1
1
select * from t2;
select * from t2;
a
a
2
2
2
01
show slave status;
show slave status;
Slave_IO_State #
Slave_IO_State #
Master_Host 127.0.0.1
Master_Host 127.0.0.1
...
@@ -99,7 +103,7 @@ Master_User root
...
@@ -99,7 +103,7 @@ Master_User root
Master_Port MASTER_MYPORT
Master_Port MASTER_MYPORT
Connect_Retry 1
Connect_Retry 1
Master_Log_File master-bin.000001
Master_Log_File master-bin.000001
Read_Master_Log_Pos 1891
1
Read_Master_Log_Pos 1891
8
Relay_Log_File #
Relay_Log_File #
Relay_Log_Pos #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Relay_Master_Log_File master-bin.000001
...
@@ -114,7 +118,7 @@ Replicate_Wild_Ignore_Table
...
@@ -114,7 +118,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Errno 0
Last_Error
Last_Error
Skip_Counter 0
Skip_Counter 0
Exec_Master_Log_Pos 1891
1
Exec_Master_Log_Pos 1891
8
Relay_Log_Space #
Relay_Log_Space #
Until_Condition None
Until_Condition None
Until_Log_File
Until_Log_File
...
@@ -128,12 +132,16 @@ Master_SSL_Key
...
@@ -128,12 +132,16 @@ Master_SSL_Key
Seconds_Behind_Master #
Seconds_Behind_Master #
set global max_relay_log_size=0;
set global max_relay_log_size=0;
stop slave;
stop slave;
change master to master_log_pos=532;
delete from t3;
change master to master_log_pos=539;
begin;
begin;
select * from t2 for update;
select * from t2 for update;
a
a
2
2
2
01
start slave;
start slave;
select count(*) from t3 /* must be zero */;
count(*)
0
commit;
commit;
select * from t1;
select * from t1;
a
a
...
@@ -142,7 +150,7 @@ a
...
@@ -142,7 +150,7 @@ a
1
1
select * from t2;
select * from t2;
a
a
2
2
2
01
show slave status;
show slave status;
Slave_IO_State #
Slave_IO_State #
Master_Host 127.0.0.1
Master_Host 127.0.0.1
...
@@ -150,7 +158,7 @@ Master_User root
...
@@ -150,7 +158,7 @@ Master_User root
Master_Port MASTER_MYPORT
Master_Port MASTER_MYPORT
Connect_Retry 1
Connect_Retry 1
Master_Log_File master-bin.000001
Master_Log_File master-bin.000001
Read_Master_Log_Pos 1891
1
Read_Master_Log_Pos 1891
8
Relay_Log_File #
Relay_Log_File #
Relay_Log_Pos #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Relay_Master_Log_File master-bin.000001
...
@@ -165,7 +173,7 @@ Replicate_Wild_Ignore_Table
...
@@ -165,7 +173,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Errno 0
Last_Error
Last_Error
Skip_Counter 0
Skip_Counter 0
Exec_Master_Log_Pos 1891
1
Exec_Master_Log_Pos 1891
8
Relay_Log_Space #
Relay_Log_Space #
Until_Condition None
Until_Condition None
Until_Log_File
Until_Log_File
...
...
mysql-test/t/ctype_ucs.test
View file @
4743fb69
...
@@ -454,6 +454,23 @@ select utext from t1 where utext like '%%';
...
@@ -454,6 +454,23 @@ select utext from t1 where utext like '%%';
drop
table
t1
;
drop
table
t1
;
deallocate
prepare
stmt
;
deallocate
prepare
stmt
;
#
# Bug#22052 Trailing spaces are not removed from UNICODE fields in an index
#
create
table
t1
(
a
char
(
10
)
unicode
not
null
,
index
a
(
a
)
)
engine
=
myisam
;
insert
into
t1
values
(
repeat
(
0x201f
,
10
));
insert
into
t1
values
(
repeat
(
0x2020
,
10
));
insert
into
t1
values
(
repeat
(
0x2021
,
10
));
# make sure "index read" is used
explain
select
hex
(
a
)
from
t1
order
by
a
;
select
hex
(
a
)
from
t1
order
by
a
;
alter
table
t1
drop
index
a
;
select
hex
(
a
)
from
t1
order
by
a
;
drop
table
t1
;
#
#
# Bug #20076: server crashes for a query with GROUP BY if MIN/MAX aggregation
# Bug #20076: server crashes for a query with GROUP BY if MIN/MAX aggregation
# over a 'ucs2' field uses a temporary table
# over a 'ucs2' field uses a temporary table
...
...
mysql-test/t/rpl_deadlock.test
View file @
4743fb69
...
@@ -16,7 +16,8 @@ source include/master-slave.inc;
...
@@ -16,7 +16,8 @@ source include/master-slave.inc;
connection
master
;
connection
master
;
create
table
t1
(
a
int
not
null
,
key
(
a
))
engine
=
innodb
;
create
table
t1
(
a
int
not
null
,
key
(
a
))
engine
=
innodb
;
create
table
t2
(
a
int
not
null
,
key
(
a
))
engine
=
innodb
;
create
table
t2
(
a
int
not
null
,
key
(
a
))
engine
=
innodb
;
create
table
t3
(
a
int
)
engine
=
innodb
;
# requiring 'unique' for the timeout part of the test
create
table
t3
(
a
int
unique
)
engine
=
innodb
;
create
table
t4
(
a
int
)
engine
=
innodb
;
create
table
t4
(
a
int
)
engine
=
innodb
;
show
variables
like
'slave_transaction_retries'
;
show
variables
like
'slave_transaction_retries'
;
sync_slave_with_master
;
sync_slave_with_master
;
...
@@ -31,8 +32,7 @@ stop slave;
...
@@ -31,8 +32,7 @@ stop slave;
connection
master
;
connection
master
;
begin
;
begin
;
# Let's keep BEGIN and the locked statement in two different relay logs.
# Let's keep BEGIN and the locked statement in two different relay logs.
let
$
1
=
200
;
let
$
1
=
200
;
disable_query_log
;
disable_query_log
;
while
(
$
1
)
while
(
$
1
)
{
{
eval
insert
into
t3
values
(
$
1
);
eval
insert
into
t3
values
(
$
1
);
...
@@ -59,7 +59,7 @@ enable_query_log;
...
@@ -59,7 +59,7 @@ enable_query_log;
select
*
from
t1
for
update
;
select
*
from
t1
for
update
;
start
slave
;
start
slave
;
--
real_sleep
3
# hope that slave is blocked now
--
real_sleep
3
# hope that slave is blocked now
insert
into
t2
values
(
2
2
);
# provoke deadlock, slave should be victim
insert
into
t2
values
(
2
01
);
# provoke deadlock, slave should be victim
commit
;
commit
;
sync_with_master
;
sync_with_master
;
select
*
from
t1
;
# check that slave succeeded finally
select
*
from
t1
;
# check that slave succeeded finally
...
@@ -74,11 +74,13 @@ show slave status;
...
@@ -74,11 +74,13 @@ show slave status;
# 2) Test lock wait timeout
# 2) Test lock wait timeout
stop
slave
;
stop
slave
;
change
master
to
master_log_pos
=
532
;
# the BEGIN log event
delete
from
t3
;
change
master
to
master_log_pos
=
539
;
# the BEGIN log event
begin
;
begin
;
select
*
from
t2
for
update
;
# hold lock
select
*
from
t2
for
update
;
# hold lock
start
slave
;
start
slave
;
--
real_sleep
10
# slave should have blocked, and be retrying
--
real_sleep
10
# slave should have blocked, and be retrying
select
count
(
*
)
from
t3
/* must be zero */
;
# replaying begins after rollback
commit
;
commit
;
sync_with_master
;
sync_with_master
;
select
*
from
t1
;
# check that slave succeeded finally
select
*
from
t1
;
# check that slave succeeded finally
...
@@ -97,11 +99,13 @@ set global max_relay_log_size=0;
...
@@ -97,11 +99,13 @@ set global max_relay_log_size=0;
# This is really copy-paste of 2) of above
# This is really copy-paste of 2) of above
stop
slave
;
stop
slave
;
change
master
to
master_log_pos
=
532
;
delete
from
t3
;
change
master
to
master_log_pos
=
539
;
begin
;
begin
;
select
*
from
t2
for
update
;
select
*
from
t2
for
update
;
start
slave
;
start
slave
;
--
real_sleep
10
--
real_sleep
10
select
count
(
*
)
from
t3
/* must be zero */
;
# replaying begins after rollback
commit
;
commit
;
sync_with_master
;
sync_with_master
;
select
*
from
t1
;
select
*
from
t1
;
...
...
sql/slave.cc
View file @
4743fb69
...
@@ -3345,9 +3345,9 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
...
@@ -3345,9 +3345,9 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
const
char
*
errmsg
;
const
char
*
errmsg
;
/*
/*
We were in a transaction which has been rolled back because of a
We were in a transaction which has been rolled back because of a
deadlock (currently, InnoDB deadlock detected by InnoDB) or lock
Sonera deadlock. if lock wait timeout (innodb_lock_wait_timeout exceeded)
wait timeout (innodb_lock_wait_timeout exceeded); let's seek back to
there is no rollback since 5.0.13 (ref: manual).
BEGIN log event and retry it all again.
let's seek back to
BEGIN log event and retry it all again.
We have to not only seek but also
We have to not only seek but also
a) init_master_info(), to seek back to hot relay log's start for later
a) init_master_info(), to seek back to hot relay log's start for later
(for when we will come back to this hot log after re-processing the
(for when we will come back to this hot log after re-processing the
...
@@ -3369,6 +3369,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
...
@@ -3369,6 +3369,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
else
else
{
{
exec_res
=
0
;
exec_res
=
0
;
end_trans
(
thd
,
ROLLBACK
);
/* chance for concurrent connection to get more locks */
/* chance for concurrent connection to get more locks */
safe_sleep
(
thd
,
min
(
rli
->
trans_retries
,
MAX_SLAVE_RETRY_PAUSE
),
safe_sleep
(
thd
,
min
(
rli
->
trans_retries
,
MAX_SLAVE_RETRY_PAUSE
),
(
CHECK_KILLED_FUNC
)
sql_slave_killed
,
(
void
*
)
rli
);
(
CHECK_KILLED_FUNC
)
sql_slave_killed
,
(
void
*
)
rli
);
...
@@ -3386,9 +3387,17 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
...
@@ -3386,9 +3387,17 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
"the slave_transaction_retries variable."
,
"the slave_transaction_retries variable."
,
slave_trans_retries
);
slave_trans_retries
);
}
}
if
(
!
((
thd
->
options
&
OPTION_BEGIN
)
&&
opt_using_transactions
))
else
if
(
!
((
thd
->
options
&
OPTION_BEGIN
)
&&
opt_using_transactions
))
rli
->
trans_retries
=
0
;
// restart from fresh
{
}
/*
Only reset the retry counter if the event succeeded or
failed with a non-transient error. On a successful event,
the execution will proceed as usual; in the case of a
non-transient error, the slave will stop with an error.
*/
rli
->
trans_retries
=
0
;
// restart from fresh
}
}
return
exec_res
;
return
exec_res
;
}
}
else
else
...
...
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