mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into narttu.mysql.fi:/my/mysql-4.0
This commit is contained in:
@@ -327,7 +327,7 @@ static void dump_remote_log_entries(const char* logname)
|
|||||||
len = net_safe_read(mysql);
|
len = net_safe_read(mysql);
|
||||||
if (len == packet_error)
|
if (len == packet_error)
|
||||||
die("Error reading packet from server: %s", mysql_error(mysql));
|
die("Error reading packet from server: %s", mysql_error(mysql));
|
||||||
if (len == 1 && net->read_pos[0] == 254)
|
if (len < 8 && net->read_pos[0] == 254)
|
||||||
break; // end of data
|
break; // end of data
|
||||||
DBUG_PRINT("info",( "len= %u, net->read_pos[5] = %d\n",
|
DBUG_PRINT("info",( "len= %u, net->read_pos[5] = %d\n",
|
||||||
len, net->read_pos[5]));
|
len, net->read_pos[5]));
|
||||||
|
@@ -83,10 +83,6 @@ x-lock also has an explicit non-gap record x-lock. Therefore, as locks are
|
|||||||
released, we can grant locks to waiting lock requests purely by looking at
|
released, we can grant locks to waiting lock requests purely by looking at
|
||||||
the explicit lock requests in the queue.
|
the explicit lock requests in the queue.
|
||||||
|
|
||||||
RULE 2: Granted non-gap locks on a record are always ahead in the queue
|
|
||||||
-------
|
|
||||||
of waiting non-gap locks on a record.
|
|
||||||
|
|
||||||
RULE 3: Different transactions cannot have conflicting granted non-gap locks
|
RULE 3: Different transactions cannot have conflicting granted non-gap locks
|
||||||
-------
|
-------
|
||||||
on a record at the same time. However, they can have conflicting granted gap
|
on a record at the same time. However, they can have conflicting granted gap
|
||||||
@@ -4271,7 +4267,6 @@ lock_rec_queue_validate(
|
|||||||
{
|
{
|
||||||
trx_t* impl_trx;
|
trx_t* impl_trx;
|
||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
ibool is_waiting;
|
|
||||||
|
|
||||||
ut_a(rec);
|
ut_a(rec);
|
||||||
|
|
||||||
@@ -4332,8 +4327,6 @@ lock_rec_queue_validate(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is_waiting = FALSE;
|
|
||||||
|
|
||||||
lock = lock_rec_get_first(rec);
|
lock = lock_rec_get_first(rec);
|
||||||
|
|
||||||
while (lock) {
|
while (lock) {
|
||||||
@@ -4346,8 +4339,6 @@ lock_rec_queue_validate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!lock_rec_get_gap(lock) && !lock_get_wait(lock)) {
|
if (!lock_rec_get_gap(lock) && !lock_get_wait(lock)) {
|
||||||
|
|
||||||
ut_a(!is_waiting);
|
|
||||||
|
|
||||||
if (lock_get_mode(lock) == LOCK_S) {
|
if (lock_get_mode(lock) == LOCK_S) {
|
||||||
ut_a(!lock_rec_other_has_expl_req(LOCK_X,
|
ut_a(!lock_rec_other_has_expl_req(LOCK_X,
|
||||||
@@ -4359,7 +4350,6 @@ lock_rec_queue_validate(
|
|||||||
|
|
||||||
} else if (lock_get_wait(lock) && !lock_rec_get_gap(lock)) {
|
} else if (lock_get_wait(lock) && !lock_rec_get_gap(lock)) {
|
||||||
|
|
||||||
is_waiting = TRUE;
|
|
||||||
ut_a(lock_rec_has_to_wait_in_queue(lock));
|
ut_a(lock_rec_has_to_wait_in_queue(lock));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -159,7 +159,7 @@ struct sync_thread_struct{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Number of slots reserved for each OS thread in the sync level array */
|
/* Number of slots reserved for each OS thread in the sync level array */
|
||||||
#define SYNC_THREAD_N_LEVELS 10000
|
#define SYNC_THREAD_N_LEVELS 250
|
||||||
|
|
||||||
struct sync_level_struct{
|
struct sync_level_struct{
|
||||||
void* latch; /* pointer to a mutex or an rw-lock; NULL means that
|
void* latch; /* pointer to a mutex or an rw-lock; NULL means that
|
||||||
|
@@ -158,11 +158,6 @@ level id parent_id
|
|||||||
optimize table t1;
|
optimize table t1;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.t1 optimize status OK
|
test.t1 optimize status OK
|
||||||
show keys from t1;
|
|
||||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
|
||||||
t1 0 PRIMARY 1 id A 87 NULL NULL BTREE
|
|
||||||
t1 1 parent_id 1 parent_id A 43 NULL NULL BTREE
|
|
||||||
t1 1 level 1 level A 6 NULL NULL BTREE
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
gesuchnr int(11) DEFAULT '0' NOT NULL,
|
gesuchnr int(11) DEFAULT '0' NOT NULL,
|
||||||
@@ -201,9 +196,6 @@ insert into t1 values (3,""), (4,"testing");
|
|||||||
analyze table t1;
|
analyze table t1;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.t1 analyze status OK
|
test.t1 analyze status OK
|
||||||
show keys from t1;
|
|
||||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
|
||||||
t1 1 skr 1 a A 3 NULL NULL YES BTREE
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a int,b varchar(20),key(a)) type=innodb;
|
create table t1 (a int,b varchar(20),key(a)) type=innodb;
|
||||||
insert into t1 values (1,""), (2,"testing");
|
insert into t1 values (1,""), (2,"testing");
|
||||||
@@ -344,14 +336,6 @@ user_id name phone ref_email detail
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE TABLE t1 (a int not null, b int not null,c int not null,
|
CREATE TABLE t1 (a int not null, b int not null,c int not null,
|
||||||
key(a),primary key(a,b), unique(c),key(a),unique(b));
|
key(a),primary key(a,b), unique(c),key(a),unique(b));
|
||||||
show index from t1;
|
|
||||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
|
||||||
t1 0 PRIMARY 1 a A NULL NULL NULL BTREE
|
|
||||||
t1 0 PRIMARY 2 b A 0 NULL NULL BTREE
|
|
||||||
t1 0 c 1 c A 0 NULL NULL BTREE
|
|
||||||
t1 0 b 1 b A 0 NULL NULL BTREE
|
|
||||||
t1 1 a 1 a A NULL NULL NULL BTREE
|
|
||||||
t1 1 a_2 1 a A NULL NULL NULL BTREE
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
|
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
|
||||||
alter table t1 type=innodb;
|
alter table t1 type=innodb;
|
||||||
@@ -714,9 +698,6 @@ hello 1
|
|||||||
optimize table t1;
|
optimize table t1;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.t1 optimize status OK
|
test.t1 optimize status OK
|
||||||
show keys from t1;
|
|
||||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
|
||||||
t1 0 PRIMARY 1 a A 2 NULL NULL BTREE
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (i int, j int ) TYPE=innodb;
|
create table t1 (i int, j int ) TYPE=innodb;
|
||||||
insert into t1 values (1,2);
|
insert into t1 values (1,2);
|
||||||
@@ -746,9 +727,6 @@ a
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) type = innodb;
|
create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) type = innodb;
|
||||||
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
|
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
|
||||||
explain select * from t1 where a > 0 and a < 50;
|
|
||||||
table type possible_keys key key_len ref rows Extra
|
|
||||||
t1 range PRIMARY PRIMARY 4 NULL 1 Using where
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
|
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
|
||||||
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
|
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
|
||||||
@@ -836,8 +814,6 @@ create table mysqltest.t3 (a int not null) type= heap;
|
|||||||
insert into mysqltest.t3 values(1);
|
insert into mysqltest.t3 values(1);
|
||||||
commit;
|
commit;
|
||||||
drop database mysqltest;
|
drop database mysqltest;
|
||||||
show tables from mysqltest;
|
|
||||||
Got one of the listed errors
|
|
||||||
set autocommit=0;
|
set autocommit=0;
|
||||||
create table t1 (a int not null) type= innodb;
|
create table t1 (a int not null) type= innodb;
|
||||||
insert into t1 values(1),(2);
|
insert into t1 values(1),(2);
|
||||||
@@ -870,30 +846,6 @@ a
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=innodb;
|
create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=innodb;
|
||||||
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
|
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
|
||||||
explain select * from t1 order by a;
|
|
||||||
table type possible_keys key key_len ref rows Extra
|
|
||||||
t1 index NULL PRIMARY 4 NULL 4
|
|
||||||
explain select * from t1 order by b;
|
|
||||||
table type possible_keys key key_len ref rows Extra
|
|
||||||
t1 index NULL b 4 NULL 4
|
|
||||||
explain select * from t1 order by c;
|
|
||||||
table type possible_keys key key_len ref rows Extra
|
|
||||||
t1 ALL NULL NULL NULL NULL 4 Using filesort
|
|
||||||
explain select a from t1 order by a;
|
|
||||||
table type possible_keys key key_len ref rows Extra
|
|
||||||
t1 index NULL PRIMARY 4 NULL 4 Using index
|
|
||||||
explain select b from t1 order by b;
|
|
||||||
table type possible_keys key key_len ref rows Extra
|
|
||||||
t1 index NULL b 4 NULL 4 Using index
|
|
||||||
explain select a,b from t1 order by b;
|
|
||||||
table type possible_keys key key_len ref rows Extra
|
|
||||||
t1 index NULL b 4 NULL 4 Using index
|
|
||||||
explain select a,b from t1;
|
|
||||||
table type possible_keys key key_len ref rows Extra
|
|
||||||
t1 index NULL b 4 NULL 4 Using index
|
|
||||||
explain select a,b,c from t1;
|
|
||||||
table type possible_keys key key_len ref rows Extra
|
|
||||||
t1 ALL NULL NULL NULL NULL 4
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (t int not null default 1, key (t)) type=innodb;
|
create table t1 (t int not null default 1, key (t)) type=innodb;
|
||||||
desc t1;
|
desc t1;
|
||||||
@@ -1235,13 +1187,7 @@ insert into t1 (a) select b from t2;
|
|||||||
select count(*) from t1;
|
select count(*) from t1;
|
||||||
count(*)
|
count(*)
|
||||||
29267
|
29267
|
||||||
explain select * from t1 where c between 1 and 10000;
|
|
||||||
table type possible_keys key key_len ref rows Extra
|
|
||||||
t1 range c c 5 NULL 1 Using where
|
|
||||||
update t1 set c=a;
|
update t1 set c=a;
|
||||||
explain select * from t1 where c between 1 and 10000;
|
|
||||||
table type possible_keys key key_len ref rows Extra
|
|
||||||
t1 ALL c NULL NULL NULL 27682 Using where
|
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) type=innodb;
|
create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) type=innodb;
|
||||||
insert into t1 (id) values (null),(null),(null),(null),(null);
|
insert into t1 (id) values (null),(null),(null),(null),(null);
|
||||||
|
@@ -93,6 +93,6 @@ slave-bin.002 62 Query 1 168 use test; insert into t1 values (1)
|
|||||||
slave-bin.002 122 Query 1 228 use test; drop table t1
|
slave-bin.002 122 Query 1 228 use test; drop table t1
|
||||||
show slave status;
|
show slave status;
|
||||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||||
127.0.0.1 root MASTER_PORT 1 master-bin.002 276 slave-relay-bin.002 1563 master-bin.002 Yes Yes 0 0 276 1567
|
127.0.0.1 root MASTER_PORT 1 master-bin.002 276 slave-relay-bin.002 1563 master-bin.002 Yes Yes 0 0 276 1563
|
||||||
show binlog events in 'slave-bin.005' from 4;
|
show binlog events in 'slave-bin.005' from 4;
|
||||||
Error when executing command SHOW BINLOG EVENTS: Could not find target log
|
Error when executing command SHOW BINLOG EVENTS: Could not find target log
|
||||||
|
@@ -9,7 +9,7 @@ File Position Binlog_do_db Binlog_ignore_db
|
|||||||
master-bin.001 79
|
master-bin.001 79
|
||||||
show slave status;
|
show slave status;
|
||||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||||
127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 124
|
127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120
|
||||||
slave stop;
|
slave stop;
|
||||||
change master to master_log_pos=73;
|
change master to master_log_pos=73;
|
||||||
slave start;
|
slave start;
|
||||||
|
@@ -52,10 +52,17 @@ a
|
|||||||
0000-00-00 00:00:00
|
0000-00-00 00:00:00
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (id int, dt datetime);
|
create table t1 (id int, dt datetime);
|
||||||
insert into t1 values (1,"2001-08-14 00:00:00"),(2,"2001-08-15 00:00:00"),(3,"2001-08-16 00:00:00");
|
insert into t1 values (1,"2001-08-14 00:00:00"),(2,"2001-08-15 00:00:00"),(3,"2001-08-16 00:00:00"),(4,"2003-09-15 01:20:30");
|
||||||
select * from t1 where dt='2001-08-14 00:00:00' and dt = if(id=1,'2001-08-14 00:00:00','1999-08-15');
|
select * from t1 where dt='2001-08-14 00:00:00' and dt = if(id=1,'2001-08-14 00:00:00','1999-08-15');
|
||||||
id dt
|
id dt
|
||||||
1 2001-08-14 00:00:00
|
1 2001-08-14 00:00:00
|
||||||
|
create index dt on t1 (dt);
|
||||||
|
select * from t1 where dt > 20021020;
|
||||||
|
id dt
|
||||||
|
4 2003-09-15 01:20:30
|
||||||
|
select * from t1 ignore index (dt) where dt > 20021020;
|
||||||
|
id dt
|
||||||
|
4 2003-09-15 01:20:30
|
||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE TABLE `t1` (
|
CREATE TABLE `t1` (
|
||||||
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
@@ -271,9 +271,9 @@ insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
|
|||||||
CREATE TABLE t2 (a int not null, b char (10) not null);
|
CREATE TABLE t2 (a int not null, b char (10) not null);
|
||||||
insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
|
insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
|
||||||
create table t3 select a,b from t1 union select a,b from t2;
|
create table t3 select a,b from t1 union select a,b from t2;
|
||||||
create table t4 (select a,b from t1) union (select a,b from t2);
|
create table t4 (select a,b from t1) union (select a,b from t2) limit 2;
|
||||||
insert into t4 select a,b from t1 union select a,b from t2;
|
insert into t4 select a,b from t1 union select a,b from t2;
|
||||||
insert into t3 (select a,b from t1) union (select a,b from t2);
|
insert into t3 (select a,b from t1) union (select a,b from t2) limit 2;
|
||||||
select * from t3;
|
select * from t3;
|
||||||
a b
|
a b
|
||||||
1 a
|
1 a
|
||||||
@@ -284,18 +284,10 @@ a b
|
|||||||
6 e
|
6 e
|
||||||
1 a
|
1 a
|
||||||
2 b
|
2 b
|
||||||
3 c
|
|
||||||
4 d
|
|
||||||
5 f
|
|
||||||
6 e
|
|
||||||
select * from t4;
|
select * from t4;
|
||||||
a b
|
a b
|
||||||
1 a
|
1 a
|
||||||
2 b
|
2 b
|
||||||
3 c
|
|
||||||
4 d
|
|
||||||
5 f
|
|
||||||
6 e
|
|
||||||
1 a
|
1 a
|
||||||
2 b
|
2 b
|
||||||
3 c
|
3 c
|
||||||
|
@@ -48,7 +48,6 @@ select * from t1 where parent_id=102;
|
|||||||
select level,id from t1 where level=1;
|
select level,id from t1 where level=1;
|
||||||
select level,id,parent_id from t1 where level=1;
|
select level,id,parent_id from t1 where level=1;
|
||||||
optimize table t1;
|
optimize table t1;
|
||||||
show keys from t1;
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -86,7 +85,6 @@ select * from t1;
|
|||||||
create index skr on t1 (a);
|
create index skr on t1 (a);
|
||||||
insert into t1 values (3,""), (4,"testing");
|
insert into t1 values (3,""), (4,"testing");
|
||||||
analyze table t1;
|
analyze table t1;
|
||||||
show keys from t1;
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
|
||||||
@@ -224,7 +222,6 @@ drop table t1;
|
|||||||
|
|
||||||
CREATE TABLE t1 (a int not null, b int not null,c int not null,
|
CREATE TABLE t1 (a int not null, b int not null,c int not null,
|
||||||
key(a),primary key(a,b), unique(c),key(a),unique(b));
|
key(a),primary key(a,b), unique(c),key(a),unique(b));
|
||||||
show index from t1;
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -398,7 +395,6 @@ create table t1 (a varchar(100) not null, primary key(a), b int not null) type=i
|
|||||||
insert into t1 values("hello",1),("world",2);
|
insert into t1 values("hello",1),("world",2);
|
||||||
select * from t1 order by b desc;
|
select * from t1 order by b desc;
|
||||||
optimize table t1;
|
optimize table t1;
|
||||||
show keys from t1;
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -443,7 +439,6 @@ DROP TABLE t1;
|
|||||||
|
|
||||||
create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) type = innodb;
|
create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) type = innodb;
|
||||||
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
|
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
|
||||||
explain select * from t1 where a > 0 and a < 50;
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -521,8 +516,6 @@ insert into mysqltest.t3 values(1);
|
|||||||
commit;
|
commit;
|
||||||
drop database mysqltest;
|
drop database mysqltest;
|
||||||
# Don't check error message
|
# Don't check error message
|
||||||
--error 12,12
|
|
||||||
show tables from mysqltest;
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test truncate table with and without auto_commit
|
# Test truncate table with and without auto_commit
|
||||||
@@ -560,14 +553,6 @@ drop table t1;
|
|||||||
|
|
||||||
create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=innodb;
|
create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=innodb;
|
||||||
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
|
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
|
||||||
explain select * from t1 order by a;
|
|
||||||
explain select * from t1 order by b;
|
|
||||||
explain select * from t1 order by c;
|
|
||||||
explain select a from t1 order by a;
|
|
||||||
explain select b from t1 order by b;
|
|
||||||
explain select a,b from t1 order by b;
|
|
||||||
explain select a,b from t1;
|
|
||||||
explain select a,b,c from t1;
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -830,9 +815,7 @@ insert into t1 (a) select b from t2;
|
|||||||
insert into t2 (a) select b from t1;
|
insert into t2 (a) select b from t1;
|
||||||
insert into t1 (a) select b from t2;
|
insert into t1 (a) select b from t2;
|
||||||
select count(*) from t1;
|
select count(*) from t1;
|
||||||
explain select * from t1 where c between 1 and 10000;
|
|
||||||
update t1 set c=a;
|
update t1 set c=a;
|
||||||
explain select * from t1 where c between 1 and 10000;
|
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@@ -36,8 +36,11 @@ drop table t1;
|
|||||||
#
|
#
|
||||||
|
|
||||||
create table t1 (id int, dt datetime);
|
create table t1 (id int, dt datetime);
|
||||||
insert into t1 values (1,"2001-08-14 00:00:00"),(2,"2001-08-15 00:00:00"),(3,"2001-08-16 00:00:00");
|
insert into t1 values (1,"2001-08-14 00:00:00"),(2,"2001-08-15 00:00:00"),(3,"2001-08-16 00:00:00"),(4,"2003-09-15 01:20:30");
|
||||||
select * from t1 where dt='2001-08-14 00:00:00' and dt = if(id=1,'2001-08-14 00:00:00','1999-08-15');
|
select * from t1 where dt='2001-08-14 00:00:00' and dt = if(id=1,'2001-08-14 00:00:00','1999-08-15');
|
||||||
|
create index dt on t1 (dt);
|
||||||
|
select * from t1 where dt > 20021020;
|
||||||
|
select * from t1 ignore index (dt) where dt > 20021020;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@@ -164,9 +164,9 @@ insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
|
|||||||
CREATE TABLE t2 (a int not null, b char (10) not null);
|
CREATE TABLE t2 (a int not null, b char (10) not null);
|
||||||
insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
|
insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
|
||||||
create table t3 select a,b from t1 union select a,b from t2;
|
create table t3 select a,b from t1 union select a,b from t2;
|
||||||
create table t4 (select a,b from t1) union (select a,b from t2);
|
create table t4 (select a,b from t1) union (select a,b from t2) limit 2;
|
||||||
insert into t4 select a,b from t1 union select a,b from t2;
|
insert into t4 select a,b from t1 union select a,b from t2;
|
||||||
insert into t3 (select a,b from t1) union (select a,b from t2);
|
insert into t3 (select a,b from t1) union (select a,b from t2) limit 2;
|
||||||
select * from t3;
|
select * from t3;
|
||||||
select * from t4;
|
select * from t4;
|
||||||
drop table t1,t2,t3,t4;
|
drop table t1,t2,t3,t4;
|
||||||
|
@@ -718,7 +718,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
|
my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
|
||||||
{
|
{
|
||||||
(*alrm)= &alarm->alarmed;
|
(*alrm)= &alarm->alarmed;
|
||||||
if (alarm_aborted)
|
if (alarm_aborted)
|
||||||
|
@@ -46,7 +46,7 @@ longlong Item_func_not::val_int()
|
|||||||
|
|
||||||
static bool convert_constant_item(Field *field, Item **item)
|
static bool convert_constant_item(Field *field, Item **item)
|
||||||
{
|
{
|
||||||
if ((*item)->const_item() && (*item)->type() != Item::INT_ITEM)
|
if ((*item)->const_item())
|
||||||
{
|
{
|
||||||
if (!(*item)->save_in_field(field, 1) &&
|
if (!(*item)->save_in_field(field, 1) &&
|
||||||
!((*item)->null_value))
|
!((*item)->null_value))
|
||||||
|
@@ -2293,6 +2293,8 @@ int main(int argc, char **argv)
|
|||||||
if (!opt_noacl)
|
if (!opt_noacl)
|
||||||
udf_init();
|
udf_init();
|
||||||
#endif
|
#endif
|
||||||
|
if (opt_bootstrap) /* If running with bootstrap, do not start replication. */
|
||||||
|
opt_skip_slave_start= 1;
|
||||||
/* init_slave() must be called after the thread keys are created */
|
/* init_slave() must be called after the thread keys are created */
|
||||||
init_slave();
|
init_slave();
|
||||||
|
|
||||||
|
31
sql/slave.cc
31
sql/slave.cc
@@ -1424,6 +1424,12 @@ static int count_relay_log_space(RELAY_LOG_INFO* rli)
|
|||||||
if (add_relay_log(rli,&linfo))
|
if (add_relay_log(rli,&linfo))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
} while (!rli->relay_log.find_next_log(&linfo, 1));
|
} while (!rli->relay_log.find_next_log(&linfo, 1));
|
||||||
|
/*
|
||||||
|
As we have counted everything, including what may have written in a
|
||||||
|
preceding write, we must reset bytes_written, or we may count some space
|
||||||
|
twice.
|
||||||
|
*/
|
||||||
|
rli->relay_log.reset_bytes_written();
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1710,8 +1716,8 @@ st_relay_log_info::st_relay_log_info()
|
|||||||
last_slave_error[0]=0;
|
last_slave_error[0]=0;
|
||||||
|
|
||||||
|
|
||||||
bzero(&info_file,sizeof(info_file));
|
bzero((char *)&info_file,sizeof(info_file));
|
||||||
bzero(&cache_buf, sizeof(cache_buf));
|
bzero((char *)&cache_buf, sizeof(cache_buf));
|
||||||
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
|
||||||
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
|
||||||
pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST);
|
||||||
@@ -3213,8 +3219,25 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
|
|||||||
hot_log=0; // Using old binary log
|
hot_log=0; // Using old binary log
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBUG_ASSERT(my_b_tell(cur_log) >= BIN_LOG_HEADER_SIZE);
|
#ifndef DBUG_OFF
|
||||||
DBUG_ASSERT(my_b_tell(cur_log) == rli->relay_log_pos + rli->pending);
|
{
|
||||||
|
DBUG_ASSERT(my_b_tell(cur_log) >= BIN_LOG_HEADER_SIZE);
|
||||||
|
/* The next assertion sometimes (very rarely) fails, let's try to track it */
|
||||||
|
char llbuf1[22], llbuf2[22];
|
||||||
|
/* Merging man, please be careful with this; in 4.1, the assertion below is
|
||||||
|
replaced by
|
||||||
|
DBUG_ASSERT(my_b_tell(cur_log) == rli->event_relay_log_pos);
|
||||||
|
so you should not merge blindly (fortunately it won't build then), and
|
||||||
|
instead modify the merged code. Thanks. */
|
||||||
|
DBUG_PRINT("info", ("Before assert, my_b_tell(cur_log)=%s \
|
||||||
|
rli->relay_log_pos=%s rli->pending=%lu",
|
||||||
|
llstr(my_b_tell(cur_log),llbuf1),
|
||||||
|
llstr(rli->relay_log_pos,llbuf2),
|
||||||
|
rli->pending));
|
||||||
|
DBUG_ASSERT(my_b_tell(cur_log) == rli->relay_log_pos + rli->pending);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Relay log is always in new format - if the master is 3.23, the
|
Relay log is always in new format - if the master is 3.23, the
|
||||||
I/O thread will convert the format for us
|
I/O thread will convert the format for us
|
||||||
|
@@ -282,7 +282,7 @@ typedef struct st_master_info
|
|||||||
abort_slave(0),slave_running(0), slave_run_id(0)
|
abort_slave(0),slave_running(0), slave_run_id(0)
|
||||||
{
|
{
|
||||||
host[0] = 0; user[0] = 0; password[0] = 0;
|
host[0] = 0; user[0] = 0; password[0] = 0;
|
||||||
bzero(&file, sizeof(file));
|
bzero((char *)&file, sizeof(file));
|
||||||
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
|
||||||
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
|
||||||
pthread_cond_init(&data_cond, NULL);
|
pthread_cond_init(&data_cond, NULL);
|
||||||
|
@@ -275,7 +275,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
user.ssl_type=SSL_TYPE_NONE;
|
user.ssl_type=SSL_TYPE_NONE;
|
||||||
bzero(&(user.user_resource),sizeof(user.user_resource));
|
bzero((char *)&(user.user_resource),sizeof(user.user_resource));
|
||||||
#ifndef TO_BE_REMOVED
|
#ifndef TO_BE_REMOVED
|
||||||
if (table->fields <= 13)
|
if (table->fields <= 13)
|
||||||
{ // Without grant
|
{ // Without grant
|
||||||
@@ -506,7 +506,7 @@ ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user,
|
|||||||
*priv_user=(char*) user;
|
*priv_user=(char*) user;
|
||||||
DBUG_ENTER("acl_getroot");
|
DBUG_ENTER("acl_getroot");
|
||||||
|
|
||||||
bzero(mqh,sizeof(USER_RESOURCES));
|
bzero((char *)mqh,sizeof(USER_RESOURCES));
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
{
|
{
|
||||||
// If no data allow anything
|
// If no data allow anything
|
||||||
@@ -2250,7 +2250,7 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
|
|||||||
if (!initialized)
|
if (!initialized)
|
||||||
{
|
{
|
||||||
send_error(&(thd->net), ER_UNKNOWN_COM_ERROR); /* purecov: tested */
|
send_error(&(thd->net), ER_UNKNOWN_COM_ERROR); /* purecov: tested */
|
||||||
return 1; /* purecov: tested */
|
DBUG_RETURN(1); /* purecov: tested */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lower_case_table_names && db)
|
if (lower_case_table_names && db)
|
||||||
|
@@ -152,7 +152,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
|
|||||||
lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE);
|
lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE);
|
||||||
lex->slave_thd_opt=0;
|
lex->slave_thd_opt=0;
|
||||||
lex->sql_command=SQLCOM_END;
|
lex->sql_command=SQLCOM_END;
|
||||||
bzero(&lex->mi,sizeof(lex->mi));
|
bzero((char *)&lex->mi,sizeof(lex->mi));
|
||||||
return lex;
|
return lex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1160,7 +1160,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
pos = uint4korr(packet);
|
pos = uint4korr(packet);
|
||||||
flags = uint2korr(packet + 4);
|
flags = uint2korr(packet + 4);
|
||||||
thd->server_id=0; /* avoid suicide */
|
thd->server_id=0; /* avoid suicide */
|
||||||
kill_zombie_dump_threads(slave_server_id = uint4korr(packet+6));
|
if ((slave_server_id= uint4korr(packet+6))) // mysqlbinlog.server_id==0
|
||||||
|
kill_zombie_dump_threads(slave_server_id);
|
||||||
thd->server_id = slave_server_id;
|
thd->server_id = slave_server_id;
|
||||||
mysql_binlog_send(thd, thd->strdup(packet + 10), (my_off_t) pos, flags);
|
mysql_binlog_send(thd, thd->strdup(packet + 10), (my_off_t) pos, flags);
|
||||||
unregister_slave(thd,1,1);
|
unregister_slave(thd,1,1);
|
||||||
|
@@ -522,6 +522,11 @@ Increase max_allowed_packet on master";
|
|||||||
|
|
||||||
case LOG_READ_EOF:
|
case LOG_READ_EOF:
|
||||||
DBUG_PRINT("wait",("waiting for data in binary log"));
|
DBUG_PRINT("wait",("waiting for data in binary log"));
|
||||||
|
if (thd->server_id==0) // for mysqlbinlog (mysqlbinlog.server_id==0)
|
||||||
|
{
|
||||||
|
pthread_mutex_unlock(log_lock);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
if (!thd->killed)
|
if (!thd->killed)
|
||||||
{
|
{
|
||||||
/* Note that the following call unlocks lock_log */
|
/* Note that the following call unlocks lock_log */
|
||||||
@@ -611,6 +616,7 @@ Increase max_allowed_packet on master";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
end_io_cache(&log);
|
end_io_cache(&log);
|
||||||
(void)my_close(file, MYF(MY_WME));
|
(void)my_close(file, MYF(MY_WME));
|
||||||
|
|
||||||
@@ -621,7 +627,7 @@ Increase max_allowed_packet on master";
|
|||||||
pthread_mutex_unlock(&LOCK_thread_count);
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
thd->proc_info = "waiting to finalize termination";
|
thd->proc_info = "waiting to finalize termination";
|
||||||
end_io_cache(&log);
|
end_io_cache(&log);
|
||||||
/*
|
/*
|
||||||
@@ -790,6 +796,25 @@ err:
|
|||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Kill all Binlog_dump threads which previously talked to the same slave
|
||||||
|
("same" means with the same server id). Indeed, if the slave stops, if the
|
||||||
|
Binlog_dump thread is waiting (pthread_cond_wait) for binlog update, then it
|
||||||
|
will keep existing until a query is written to the binlog. If the master is
|
||||||
|
idle, then this could last long, and if the slave reconnects, we could have 2
|
||||||
|
Binlog_dump threads in SHOW PROCESSLIST, until a query is written to the
|
||||||
|
binlog. To avoid this, when the slave reconnects and sends COM_BINLOG_DUMP,
|
||||||
|
the master kills any existing thread with the slave's server id (if this id is
|
||||||
|
not zero; it will be true for real slaves, but false for mysqlbinlog when it
|
||||||
|
sends COM_BINLOG_DUMP to get a remote binlog dump).
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
kill_zombie_dump_threads()
|
||||||
|
slave_server_id the slave's server id
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
void kill_zombie_dump_threads(uint32 slave_server_id)
|
void kill_zombie_dump_threads(uint32 slave_server_id)
|
||||||
{
|
{
|
||||||
|
@@ -762,7 +762,7 @@ create:
|
|||||||
lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type;
|
lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type;
|
||||||
}
|
}
|
||||||
create2
|
create2
|
||||||
{}
|
{Lex->select= &Lex->select_lex;}
|
||||||
| CREATE opt_unique_or_fulltext INDEX ident ON table_ident
|
| CREATE opt_unique_or_fulltext INDEX ident ON table_ident
|
||||||
{
|
{
|
||||||
LEX *lex=Lex;
|
LEX *lex=Lex;
|
||||||
@@ -2587,6 +2587,7 @@ insert:
|
|||||||
opt_ignore insert2
|
opt_ignore insert2
|
||||||
{
|
{
|
||||||
set_lock_for_tables($3);
|
set_lock_for_tables($3);
|
||||||
|
Lex->select= &Lex->select_lex;
|
||||||
}
|
}
|
||||||
insert_field_spec
|
insert_field_spec
|
||||||
{}
|
{}
|
||||||
@@ -2602,6 +2603,7 @@ replace:
|
|||||||
replace_lock_option insert2
|
replace_lock_option insert2
|
||||||
{
|
{
|
||||||
set_lock_for_tables($3);
|
set_lock_for_tables($3);
|
||||||
|
Lex->select= &Lex->select_lex;
|
||||||
}
|
}
|
||||||
insert_field_spec
|
insert_field_spec
|
||||||
{}
|
{}
|
||||||
@@ -3685,7 +3687,7 @@ grant:
|
|||||||
lex->select->db= 0;
|
lex->select->db= 0;
|
||||||
lex->ssl_type= SSL_TYPE_NOT_SPECIFIED;
|
lex->ssl_type= SSL_TYPE_NOT_SPECIFIED;
|
||||||
lex->ssl_cipher= lex->x509_subject= lex->x509_issuer= 0;
|
lex->ssl_cipher= lex->x509_subject= lex->x509_issuer= 0;
|
||||||
bzero(&(lex->mqh),sizeof(lex->mqh));
|
bzero((char *)&(lex->mqh),sizeof(lex->mqh));
|
||||||
}
|
}
|
||||||
grant_privileges ON opt_table TO_SYM user_list
|
grant_privileges ON opt_table TO_SYM user_list
|
||||||
require_clause grant_options
|
require_clause grant_options
|
||||||
|
Reference in New Issue
Block a user