mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/Users/kent/mysql/bk/mysql-4.1-distcheck configure.in: Auto merged
This commit is contained in:
@ -1813,9 +1813,13 @@ com_help(String *buffer __attribute__((unused)),
|
|||||||
if (help_arg)
|
if (help_arg)
|
||||||
return com_server_help(buffer,line,help_arg+1);
|
return com_server_help(buffer,line,help_arg+1);
|
||||||
|
|
||||||
put_info("\nFor the complete MySQL Manual online, visit:\n http://www.mysql.com/documentation\n", INFO_INFO);
|
put_info("\nFor information about MySQL products and services, visit:\n"
|
||||||
put_info("For info on technical support from MySQL developers, visit:\n http://www.mysql.com/support\n", INFO_INFO);
|
" http://www.mysql.com/\n"
|
||||||
put_info("For info on MySQL books, utilities, consultants, etc., visit:\n http://www.mysql.com/portal\n", INFO_INFO);
|
"For developer information, including the MySQL Reference Manual, "
|
||||||
|
"visit:\n"
|
||||||
|
" http://dev.mysql.com/\n"
|
||||||
|
"To buy MySQL Network Support, training, or other products, visit:\n"
|
||||||
|
" https://shop.mysql.com/\n", INFO_INFO);
|
||||||
put_info("List of all MySQL commands:", INFO_INFO);
|
put_info("List of all MySQL commands:", INFO_INFO);
|
||||||
if (!named_cmds)
|
if (!named_cmds)
|
||||||
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
|
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
|
||||||
|
13
configure.in
13
configure.in
@ -1672,6 +1672,19 @@ if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
|
|||||||
OPTIMIZE_CXXFLAGS="$OPTIMIZE_CXXFLAGS -DNDEBUG"
|
OPTIMIZE_CXXFLAGS="$OPTIMIZE_CXXFLAGS -DNDEBUG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If the user specified CFLAGS, we won't add any optimizations
|
||||||
|
if test -n "$SAVE_CFLAGS"
|
||||||
|
then
|
||||||
|
OPTIMIZE_CFLAGS=""
|
||||||
|
DEBUG_OPTIMIZE_CC=""
|
||||||
|
fi
|
||||||
|
# Ditto for CXXFLAGS
|
||||||
|
if test -n "$SAVE_CXXFLAGS"
|
||||||
|
then
|
||||||
|
OPTIMIZE_CXXFLAGS=""
|
||||||
|
DEBUG_OPTIMIZE_CXX=""
|
||||||
|
fi
|
||||||
|
|
||||||
AC_ARG_WITH(debug,
|
AC_ARG_WITH(debug,
|
||||||
[ --without-debug Build a production version without debugging code],
|
[ --without-debug Build a production version without debugging code],
|
||||||
[with_debug=$withval],
|
[with_debug=$withval],
|
||||||
|
@ -188,8 +188,10 @@ byte ft_simple_get_word(CHARSET_INFO *cs, byte **start, byte *end,
|
|||||||
for (word->pos=doc; doc<end; length++, mbl=my_mbcharlen(cs, *(uchar *)doc), doc+=(mbl ? mbl : 1))
|
for (word->pos=doc; doc<end; length++, mbl=my_mbcharlen(cs, *(uchar *)doc), doc+=(mbl ? mbl : 1))
|
||||||
if (true_word_char(cs,*doc))
|
if (true_word_char(cs,*doc))
|
||||||
mwc= 0;
|
mwc= 0;
|
||||||
else if (!misc_word_char(*doc) || mwc++)
|
else if (!misc_word_char(*doc) || mwc)
|
||||||
break;
|
break;
|
||||||
|
else
|
||||||
|
mwc++;
|
||||||
|
|
||||||
word->len= (uint)(doc-word->pos) - mwc;
|
word->len= (uint)(doc-word->pos) - mwc;
|
||||||
|
|
||||||
|
@ -217,7 +217,10 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
|
|||||||
{
|
{
|
||||||
k_length-=length;
|
k_length-=length;
|
||||||
if (keyseg->flag & (HA_VAR_LENGTH | HA_BLOB_PART))
|
if (keyseg->flag & (HA_VAR_LENGTH | HA_BLOB_PART))
|
||||||
|
{
|
||||||
|
old+= 2;
|
||||||
k_length-=2; /* Skip length */
|
k_length-=2; /* Skip length */
|
||||||
|
}
|
||||||
continue; /* Found NULL */
|
continue; /* Found NULL */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,3 +30,10 @@ check table t1;
|
|||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.t1 check status OK
|
test.t1 check status OK
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()";
|
||||||
|
execute stmt1;
|
||||||
|
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||||
|
execute stmt1;
|
||||||
|
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||||
|
deallocate prepare stmt1;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
drop table if exists t1,t2,t3;
|
drop table if exists t1,t2,t3,t4,t5;
|
||||||
drop database if exists mysqltest;
|
drop database if exists mysqltest;
|
||||||
create table t1 (b char(0));
|
create table t1 (b char(0));
|
||||||
insert into t1 values (""),(null);
|
insert into t1 values (""),(null);
|
||||||
@ -632,3 +632,80 @@ t1 CREATE TABLE `t1` (
|
|||||||
PRIMARY KEY (`a`)
|
PRIMARY KEY (`a`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
a int(11) default NULL
|
||||||
|
);
|
||||||
|
insert into t2 values(111);
|
||||||
|
create table t1 (
|
||||||
|
a varchar(12) charset utf8 collate utf8_bin not null,
|
||||||
|
b int not null, primary key (a)
|
||||||
|
) select a, 1 as b from t2 ;
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '',
|
||||||
|
`b` int(11) NOT NULL default '0',
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (
|
||||||
|
a varchar(12) charset utf8 collate utf8_bin not null,
|
||||||
|
b int not null, primary key (a)
|
||||||
|
) select 'a' as a , 1 as b from t2 ;
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '',
|
||||||
|
`b` int(11) NOT NULL default '0',
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (
|
||||||
|
a varchar(12) charset utf8 collate utf8_bin,
|
||||||
|
b int not null, primary key (a)
|
||||||
|
) select 'a' as a , 1 as b from t2 ;
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '',
|
||||||
|
`b` int(11) NOT NULL default '0',
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
drop table t1, t2;
|
||||||
|
create table t1 (
|
||||||
|
a1 int not null,
|
||||||
|
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
|
||||||
|
);
|
||||||
|
insert into t1 values (1,1,1, 1,1,1, 1,1,1);
|
||||||
|
create table t2 (
|
||||||
|
a1 varchar(12) charset utf8 collate utf8_bin not null,
|
||||||
|
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
|
||||||
|
primary key (a1)
|
||||||
|
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
|
||||||
|
drop table t2;
|
||||||
|
create table t2 (
|
||||||
|
a1 varchar(12) charset utf8 collate utf8_bin,
|
||||||
|
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
|
||||||
|
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1;
|
||||||
|
drop table t1, t2;
|
||||||
|
create table t1 (
|
||||||
|
a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
|
||||||
|
);
|
||||||
|
insert into t1 values (1,1,1, 1,1,1, 1,1,1);
|
||||||
|
create table t2 (
|
||||||
|
a1 varchar(12) charset utf8 collate utf8_bin not null,
|
||||||
|
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
|
||||||
|
primary key (a1)
|
||||||
|
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
|
||||||
|
drop table t2;
|
||||||
|
create table t2 ( a int default 3, b int default 3)
|
||||||
|
select a1,a2 from t1;
|
||||||
|
show create table t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TABLE `t2` (
|
||||||
|
`a` int(11) default '3',
|
||||||
|
`b` int(11) default '3',
|
||||||
|
`a1` int(11) default NULL,
|
||||||
|
`a2` int(11) default NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
drop table t1, t2;
|
||||||
|
@ -4929,3 +4929,50 @@ Warnings:
|
|||||||
Note 1051 Unknown table 't2'
|
Note 1051 Unknown table 't2'
|
||||||
Note 1051 Unknown table 't3'
|
Note 1051 Unknown table 't3'
|
||||||
Note 1051 Unknown table 't4'
|
Note 1051 Unknown table 't4'
|
||||||
|
DROP TABLE IF EXISTS bug13894;
|
||||||
|
CREATE TABLE bug13894 ( val integer ) ENGINE = CSV;
|
||||||
|
INSERT INTO bug13894 VALUES (5);
|
||||||
|
INSERT INTO bug13894 VALUES (10);
|
||||||
|
INSERT INTO bug13894 VALUES (11);
|
||||||
|
INSERT INTO bug13894 VALUES (10);
|
||||||
|
SELECT * FROM bug13894;
|
||||||
|
val
|
||||||
|
5
|
||||||
|
10
|
||||||
|
11
|
||||||
|
10
|
||||||
|
UPDATE bug13894 SET val=6 WHERE val=10;
|
||||||
|
SELECT * FROM bug13894;
|
||||||
|
val
|
||||||
|
5
|
||||||
|
11
|
||||||
|
6
|
||||||
|
6
|
||||||
|
DROP TABLE bug13894;
|
||||||
|
DROP TABLE IF EXISTS bug14672;
|
||||||
|
CREATE TABLE bug14672 (c1 integer) engine = CSV;
|
||||||
|
INSERT INTO bug14672 VALUES (1), (2), (3);
|
||||||
|
SELECT * FROM bug14672;
|
||||||
|
c1
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
DELETE FROM bug14672 WHERE c1 = 2;
|
||||||
|
SELECT * FROM bug14672;
|
||||||
|
c1
|
||||||
|
1
|
||||||
|
3
|
||||||
|
INSERT INTO bug14672 VALUES (4);
|
||||||
|
SELECT * FROM bug14672;
|
||||||
|
c1
|
||||||
|
1
|
||||||
|
3
|
||||||
|
4
|
||||||
|
INSERT INTO bug14672 VALUES (5);
|
||||||
|
SELECT * FROM bug14672;
|
||||||
|
c1
|
||||||
|
1
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
DROP TABLE bug14672;
|
||||||
|
@ -428,4 +428,8 @@ REPAIR TABLE t1;
|
|||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.t1 repair status OK
|
test.t1 repair status OK
|
||||||
SET myisam_repair_threads=@@global.myisam_repair_threads;
|
SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||||
|
INSERT INTO t1 VALUES('testword\'\'');
|
||||||
|
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
|
||||||
|
a
|
||||||
|
testword''
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
@ -445,3 +445,21 @@ drop table t2;
|
|||||||
drop table t3;
|
drop table t3;
|
||||||
drop table t4;
|
drop table t4;
|
||||||
drop table t5;
|
drop table t5;
|
||||||
|
create table t1 (c1 int);
|
||||||
|
insert into t1 values (1);
|
||||||
|
handler t1 open;
|
||||||
|
handler t1 read first;
|
||||||
|
c1
|
||||||
|
1
|
||||||
|
send the below to another connection, do not wait for the result
|
||||||
|
optimize table t1;
|
||||||
|
proceed with the normal connection
|
||||||
|
handler t1 read next;
|
||||||
|
c1
|
||||||
|
1
|
||||||
|
handler t1 close;
|
||||||
|
read the result from the other connection
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 optimize status OK
|
||||||
|
proceed with the normal connection
|
||||||
|
drop table t1;
|
||||||
|
@ -93,6 +93,7 @@ master-bin.000001 79 Query 1 79 use `test`; BEGIN
|
|||||||
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(8)
|
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(8)
|
||||||
master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1
|
master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1
|
||||||
master-bin.000001 244 Query 1 244 use `test`; ROLLBACK
|
master-bin.000001 244 Query 1 244 use `test`; ROLLBACK
|
||||||
|
master-bin.000001 287 Query 1 287 use `test`; DO RELEASE_LOCK("a")
|
||||||
delete from t1;
|
delete from t1;
|
||||||
delete from t2;
|
delete from t2;
|
||||||
reset master;
|
reset master;
|
||||||
@ -202,3 +203,53 @@ select (@after-@before) >= 2;
|
|||||||
(@after-@before) >= 2
|
(@after-@before) >= 2
|
||||||
1
|
1
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
commit;
|
||||||
|
begin;
|
||||||
|
create temporary table ti (a int) engine=innodb;
|
||||||
|
rollback;
|
||||||
|
Warnings:
|
||||||
|
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||||
|
insert into ti values(1);
|
||||||
|
set autocommit=0;
|
||||||
|
create temporary table t1 (a int) engine=myisam;
|
||||||
|
commit;
|
||||||
|
insert t1 values (1);
|
||||||
|
rollback;
|
||||||
|
create table t0 (n int);
|
||||||
|
insert t0 select * from t1;
|
||||||
|
set autocommit=1;
|
||||||
|
insert into t0 select GET_LOCK("lock1",null);
|
||||||
|
set autocommit=0;
|
||||||
|
create table t2 (n int) engine=innodb;
|
||||||
|
insert into t2 values (3);
|
||||||
|
select get_lock("lock1",60);
|
||||||
|
get_lock("lock1",60)
|
||||||
|
1
|
||||||
|
show binlog events from 79;
|
||||||
|
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||||
|
master-bin.000001 79 Query 1 79 use `test`; BEGIN
|
||||||
|
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(16)
|
||||||
|
master-bin.000001 179 Query 1 79 use `test`; insert into t1 values(18)
|
||||||
|
master-bin.000001 239 Query 1 239 use `test`; COMMIT
|
||||||
|
master-bin.000001 280 Query 1 280 use `test`; delete from t1
|
||||||
|
master-bin.000001 329 Query 1 329 use `test`; delete from t2
|
||||||
|
master-bin.000001 378 Query 1 378 use `test`; alter table t2 type=MyISAM
|
||||||
|
master-bin.000001 439 Query 1 439 use `test`; insert into t1 values (1)
|
||||||
|
master-bin.000001 499 Query 1 499 use `test`; insert into t2 values (20)
|
||||||
|
master-bin.000001 560 Query 1 560 use `test`; drop table t1,t2
|
||||||
|
master-bin.000001 611 Query 1 611 use `test`; BEGIN
|
||||||
|
master-bin.000001 651 Query 1 611 use `test`; create temporary table ti (a int) engine=innodb
|
||||||
|
master-bin.000001 733 Query 1 733 use `test`; ROLLBACK
|
||||||
|
master-bin.000001 776 Query 1 776 use `test`; insert into ti values(1)
|
||||||
|
master-bin.000001 835 Query 1 835 use `test`; BEGIN
|
||||||
|
master-bin.000001 875 Query 1 835 use `test`; create temporary table t1 (a int) engine=myisam
|
||||||
|
master-bin.000001 957 Query 1 957 use `test`; COMMIT
|
||||||
|
master-bin.000001 998 Query 1 998 use `test`; create table t0 (n int)
|
||||||
|
master-bin.000001 1056 Query 1 1056 use `test`; insert t0 select * from t1
|
||||||
|
master-bin.000001 1117 Query 1 1117 use `test`; DO RELEASE_LOCK("a")
|
||||||
|
master-bin.000001 1172 Query 1 1172 use `test`; insert into t0 select GET_LOCK("lock1",null)
|
||||||
|
master-bin.000001 1251 Query 1 1251 use `test`; create table t2 (n int) engine=innodb
|
||||||
|
master-bin.000001 1323 Query 1 1323 use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
|
||||||
|
master-bin.000001 1424 Query 1 1424 use `test`; DO RELEASE_LOCK("lock1")
|
||||||
|
do release_lock("lock1");
|
||||||
|
drop table t0,t2;
|
||||||
|
@ -498,6 +498,16 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary
|
1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary
|
||||||
1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct
|
1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
create table t1 (
|
||||||
|
c1 varchar(32),
|
||||||
|
key (c1)
|
||||||
|
) engine=myisam;
|
||||||
|
alter table t1 disable keys;
|
||||||
|
insert into t1 values ('a'), ('b');
|
||||||
|
select c1 from t1 order by c1 limit 1;
|
||||||
|
c1
|
||||||
|
a
|
||||||
|
drop table t1;
|
||||||
CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM;
|
CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM;
|
||||||
Got one of the listed errors
|
Got one of the listed errors
|
||||||
create table t1 (a int, b varchar(200), c text not null) checksum=1;
|
create table t1 (a int, b varchar(200), c text not null) checksum=1;
|
||||||
@ -702,3 +712,21 @@ t1 1 a 2 b A 0 NULL NULL YES BTREE
|
|||||||
t1 1 a 3 c A 0 NULL NULL YES BTREE
|
t1 1 a 3 c A 0 NULL NULL YES BTREE
|
||||||
t1 1 a 4 d A 0 NULL NULL YES BTREE
|
t1 1 a 4 d A 0 NULL NULL YES BTREE
|
||||||
set myisam_stats_method=DEFAULT;
|
set myisam_stats_method=DEFAULT;
|
||||||
|
drop table t1;
|
||||||
|
create table t1(
|
||||||
|
cip INT NOT NULL,
|
||||||
|
time TIME NOT NULL,
|
||||||
|
score INT NOT NULL DEFAULT 0,
|
||||||
|
bob TINYBLOB
|
||||||
|
);
|
||||||
|
insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03');
|
||||||
|
insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'),
|
||||||
|
(6, 'c', '00:06');
|
||||||
|
select * from t1 where bob is null and cip=1;
|
||||||
|
cip time score bob
|
||||||
|
1 00:01:00 0 NULL
|
||||||
|
create index bug on t1 (bob(22), cip, time);
|
||||||
|
select * from t1 where bob is null and cip=1;
|
||||||
|
cip time score bob
|
||||||
|
1 00:01:00 0 NULL
|
||||||
|
drop table t1;
|
||||||
|
@ -190,12 +190,22 @@ p a
|
|||||||
6 AAA
|
6 AAA
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
a varchar(10) primary key
|
a char(10) primary key
|
||||||
) engine=ndb;
|
) engine=ndbcluster default charset=latin1;
|
||||||
insert into t1 values ('jonas % ');
|
insert into t1 values ('aaabb');
|
||||||
replace into t1 values ('jonas % ');
|
|
||||||
replace into t1 values ('jonas % ');
|
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a
|
a
|
||||||
jonas %
|
aaabb
|
||||||
|
replace into t1 set a = 'AAABB';
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
AAABB
|
||||||
|
replace into t1 set a = 'aAaBb';
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
aAaBb
|
||||||
|
replace into t1 set a = 'aaabb';
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
aaabb
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -39,4 +39,13 @@ check table t1;
|
|||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# procedure in PS BUG#13673
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()";
|
||||||
|
execute stmt1;
|
||||||
|
execute stmt1;
|
||||||
|
deallocate prepare stmt1;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop table if exists t1,t2,t3;
|
drop table if exists t1,t2,t3,t4,t5;
|
||||||
drop database if exists mysqltest;
|
drop database if exists mysqltest;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
@ -534,4 +534,73 @@ create table t1 (
|
|||||||
show create table t1;
|
show create table t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#14480: assert failure in CREATE ... SELECT because of wrong
|
||||||
|
# calculation of number of NULLs.
|
||||||
|
#
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
a int(11) default NULL
|
||||||
|
);
|
||||||
|
insert into t2 values(111);
|
||||||
|
|
||||||
|
create table t1 (
|
||||||
|
a varchar(12) charset utf8 collate utf8_bin not null,
|
||||||
|
b int not null, primary key (a)
|
||||||
|
) select a, 1 as b from t2 ;
|
||||||
|
show create table t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
create table t1 (
|
||||||
|
a varchar(12) charset utf8 collate utf8_bin not null,
|
||||||
|
b int not null, primary key (a)
|
||||||
|
) select 'a' as a , 1 as b from t2 ;
|
||||||
|
show create table t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
create table t1 (
|
||||||
|
a varchar(12) charset utf8 collate utf8_bin,
|
||||||
|
b int not null, primary key (a)
|
||||||
|
) select 'a' as a , 1 as b from t2 ;
|
||||||
|
show create table t1;
|
||||||
|
drop table t1, t2;
|
||||||
|
|
||||||
|
create table t1 (
|
||||||
|
a1 int not null,
|
||||||
|
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
|
||||||
|
);
|
||||||
|
insert into t1 values (1,1,1, 1,1,1, 1,1,1);
|
||||||
|
|
||||||
|
create table t2 (
|
||||||
|
a1 varchar(12) charset utf8 collate utf8_bin not null,
|
||||||
|
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
|
||||||
|
primary key (a1)
|
||||||
|
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
|
||||||
|
drop table t2;
|
||||||
|
|
||||||
|
create table t2 (
|
||||||
|
a1 varchar(12) charset utf8 collate utf8_bin,
|
||||||
|
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
|
||||||
|
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1;
|
||||||
|
|
||||||
|
drop table t1, t2;
|
||||||
|
create table t1 (
|
||||||
|
a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
|
||||||
|
);
|
||||||
|
insert into t1 values (1,1,1, 1,1,1, 1,1,1);
|
||||||
|
|
||||||
|
create table t2 (
|
||||||
|
a1 varchar(12) charset utf8 collate utf8_bin not null,
|
||||||
|
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
|
||||||
|
primary key (a1)
|
||||||
|
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
|
||||||
|
|
||||||
|
# Test the default value
|
||||||
|
drop table t2;
|
||||||
|
|
||||||
|
create table t2 ( a int default 3, b int default 3)
|
||||||
|
select a1,a2 from t1;
|
||||||
|
show create table t2;
|
||||||
|
|
||||||
|
drop table t1, t2;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
@ -1314,4 +1314,41 @@ select period from t1;
|
|||||||
|
|
||||||
drop table if exists t1,t2,t3,t4;
|
drop table if exists t1,t2,t3,t4;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #13894 Server crashes on update of CSV table
|
||||||
|
#
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS bug13894;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE TABLE bug13894 ( val integer ) ENGINE = CSV;
|
||||||
|
INSERT INTO bug13894 VALUES (5);
|
||||||
|
INSERT INTO bug13894 VALUES (10);
|
||||||
|
INSERT INTO bug13894 VALUES (11);
|
||||||
|
INSERT INTO bug13894 VALUES (10);
|
||||||
|
SELECT * FROM bug13894;
|
||||||
|
UPDATE bug13894 SET val=6 WHERE val=10;
|
||||||
|
SELECT * FROM bug13894;
|
||||||
|
DROP TABLE bug13894;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #14672 Bug in deletion
|
||||||
|
#
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS bug14672;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE TABLE bug14672 (c1 integer) engine = CSV;
|
||||||
|
INSERT INTO bug14672 VALUES (1), (2), (3);
|
||||||
|
SELECT * FROM bug14672;
|
||||||
|
DELETE FROM bug14672 WHERE c1 = 2;
|
||||||
|
SELECT * FROM bug14672;
|
||||||
|
INSERT INTO bug14672 VALUES (4);
|
||||||
|
SELECT * FROM bug14672;
|
||||||
|
INSERT INTO bug14672 VALUES (5);
|
||||||
|
SELECT * FROM bug14672;
|
||||||
|
DROP TABLE bug14672;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
@ -348,6 +348,12 @@ INSERT INTO t1 VALUES('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
|
|||||||
SET myisam_repair_threads=2;
|
SET myisam_repair_threads=2;
|
||||||
REPAIR TABLE t1;
|
REPAIR TABLE t1;
|
||||||
SET myisam_repair_threads=@@global.myisam_repair_threads;
|
SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#5686 - #1034 - Incorrect key file for table - only utf8
|
||||||
|
#
|
||||||
|
INSERT INTO t1 VALUES('testword\'\'');
|
||||||
|
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
@ -347,4 +347,32 @@ drop table t3;
|
|||||||
drop table t4;
|
drop table t4;
|
||||||
drop table t5;
|
drop table t5;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
|
||||||
|
#
|
||||||
|
create table t1 (c1 int);
|
||||||
|
insert into t1 values (1);
|
||||||
|
# client 1
|
||||||
|
handler t1 open;
|
||||||
|
handler t1 read first;
|
||||||
|
# client 2
|
||||||
|
connect (con2,localhost,root,,);
|
||||||
|
connection con2;
|
||||||
|
--exec echo send the below to another connection, do not wait for the result
|
||||||
|
send optimize table t1;
|
||||||
|
--sleep 1
|
||||||
|
# client 1
|
||||||
|
--exec echo proceed with the normal connection
|
||||||
|
connection default;
|
||||||
|
handler t1 read next;
|
||||||
|
handler t1 close;
|
||||||
|
# client 2
|
||||||
|
--exec echo read the result from the other connection
|
||||||
|
connection con2;
|
||||||
|
reap;
|
||||||
|
# client 1
|
||||||
|
--exec echo proceed with the normal connection
|
||||||
|
connection default;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
@ -206,7 +206,35 @@ select (@after:=unix_timestamp())*0; # always give repeatable output
|
|||||||
# the bug, the reap would return immediately after the insert into t2.
|
# the bug, the reap would return immediately after the insert into t2.
|
||||||
select (@after-@before) >= 2;
|
select (@after-@before) >= 2;
|
||||||
|
|
||||||
# cleanup
|
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
commit;
|
||||||
|
|
||||||
|
# test for BUG#7947 - DO RELEASE_LOCK() not written to binlog on rollback in the middle
|
||||||
|
# of a transaction
|
||||||
|
|
||||||
|
connection con2;
|
||||||
|
begin;
|
||||||
|
create temporary table ti (a int) engine=innodb;
|
||||||
|
rollback;
|
||||||
|
insert into ti values(1);
|
||||||
|
set autocommit=0;
|
||||||
|
create temporary table t1 (a int) engine=myisam;
|
||||||
|
commit;
|
||||||
|
insert t1 values (1);
|
||||||
|
rollback;
|
||||||
|
create table t0 (n int);
|
||||||
|
insert t0 select * from t1;
|
||||||
|
set autocommit=1;
|
||||||
|
insert into t0 select GET_LOCK("lock1",null);
|
||||||
|
set autocommit=0;
|
||||||
|
create table t2 (n int) engine=innodb;
|
||||||
|
insert into t2 values (3);
|
||||||
|
disconnect con2;
|
||||||
|
connection con3;
|
||||||
|
select get_lock("lock1",60);
|
||||||
|
show binlog events from 79;
|
||||||
|
do release_lock("lock1");
|
||||||
|
drop table t0,t2;
|
||||||
|
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
@ -473,6 +473,18 @@ explain select sql_big_result distinct t1.a from t1,t2 order by t2.a;
|
|||||||
explain select distinct t1.a from t1,t2 order by t2.a;
|
explain select distinct t1.a from t1,t2 order by t2.a;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#14616 - Freshly imported table returns error 124 when using LIMIT
|
||||||
|
#
|
||||||
|
create table t1 (
|
||||||
|
c1 varchar(32),
|
||||||
|
key (c1)
|
||||||
|
) engine=myisam;
|
||||||
|
alter table t1 disable keys;
|
||||||
|
insert into t1 values ('a'), ('b');
|
||||||
|
select c1 from t1 order by c1 limit 1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test RTREE index
|
# Test RTREE index
|
||||||
#
|
#
|
||||||
@ -656,4 +668,22 @@ analyze table t1;
|
|||||||
show index from t1;
|
show index from t1;
|
||||||
|
|
||||||
set myisam_stats_method=DEFAULT;
|
set myisam_stats_method=DEFAULT;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
# BUG#13814 - key value packed incorrectly for TINYBLOBs
|
||||||
|
|
||||||
|
create table t1(
|
||||||
|
cip INT NOT NULL,
|
||||||
|
time TIME NOT NULL,
|
||||||
|
score INT NOT NULL DEFAULT 0,
|
||||||
|
bob TINYBLOB
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03');
|
||||||
|
insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'),
|
||||||
|
(6, 'c', '00:06');
|
||||||
|
select * from t1 where bob is null and cip=1;
|
||||||
|
create index bug on t1 (bob(22), cip, time);
|
||||||
|
select * from t1 where bob is null and cip=1;
|
||||||
|
drop table t1;
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
@ -159,14 +159,17 @@ select * from t1 where a = 'AaA' order by p;
|
|||||||
select * from t1 where a = 'AAA' order by p;
|
select * from t1 where a = 'AAA' order by p;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
# bug
|
# bug#14007
|
||||||
create table t1 (
|
create table t1 (
|
||||||
a varchar(10) primary key
|
a char(10) primary key
|
||||||
) engine=ndb;
|
) engine=ndbcluster default charset=latin1;
|
||||||
insert into t1 values ('jonas % ');
|
|
||||||
replace into t1 values ('jonas % ');
|
insert into t1 values ('aaabb');
|
||||||
replace into t1 values ('jonas % ');
|
select * from t1;
|
||||||
|
replace into t1 set a = 'AAABB';
|
||||||
|
select * from t1;
|
||||||
|
replace into t1 set a = 'aAaBb';
|
||||||
|
select * from t1;
|
||||||
|
replace into t1 set a = 'aaabb';
|
||||||
select * from t1;
|
select * from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
# End of 4.1 tests
|
|
||||||
|
@ -36,6 +36,7 @@ private:
|
|||||||
|
|
||||||
static Uint32 getType(const Uint32 &);
|
static Uint32 getType(const Uint32 &);
|
||||||
static Uint32 getSize(const Uint32 &);
|
static Uint32 getSize(const Uint32 &);
|
||||||
|
static Uint32 getSizeInBytes(const Uint32 &);
|
||||||
static Uint32 getSizeInWords(const Uint32 &);
|
static Uint32 getSizeInWords(const Uint32 &);
|
||||||
static Uint32 getArrayType(const Uint32 &);
|
static Uint32 getArrayType(const Uint32 &);
|
||||||
static Uint32 getArraySize(const Uint32 &);
|
static Uint32 getArraySize(const Uint32 &);
|
||||||
@ -79,6 +80,7 @@ private:
|
|||||||
#define AD_SIZE_SHIFT (4)
|
#define AD_SIZE_SHIFT (4)
|
||||||
#define AD_SIZE_MASK (7)
|
#define AD_SIZE_MASK (7)
|
||||||
|
|
||||||
|
#define AD_SIZE_IN_BYTES_SHIFT (3)
|
||||||
#define AD_SIZE_IN_WORDS_OFFSET (31)
|
#define AD_SIZE_IN_WORDS_OFFSET (31)
|
||||||
#define AD_SIZE_IN_WORDS_SHIFT (5)
|
#define AD_SIZE_IN_WORDS_SHIFT (5)
|
||||||
|
|
||||||
@ -185,6 +187,13 @@ AttributeDescriptor::getSize(const Uint32 & desc){
|
|||||||
return (desc >> AD_SIZE_SHIFT) & AD_SIZE_MASK;
|
return (desc >> AD_SIZE_SHIFT) & AD_SIZE_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
Uint32
|
||||||
|
AttributeDescriptor::getSizeInBytes(const Uint32 & desc){
|
||||||
|
return (getArraySize(desc) << getSize(desc))
|
||||||
|
>> AD_SIZE_IN_BYTES_SHIFT;
|
||||||
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
Uint32
|
Uint32
|
||||||
AttributeDescriptor::getSizeInWords(const Uint32 & desc){
|
AttributeDescriptor::getSizeInWords(const Uint32 & desc){
|
||||||
|
@ -700,6 +700,27 @@ Dbtup::checkUpdateOfPrimaryKey(Uint32* updateBuffer, Tablerec* const regTabPtr)
|
|||||||
Uint32 attrDescriptorIndex = regTabPtr->tabDescriptor + (attributeId << ZAD_LOG_SIZE);
|
Uint32 attrDescriptorIndex = regTabPtr->tabDescriptor + (attributeId << ZAD_LOG_SIZE);
|
||||||
Uint32 attrDescriptor = tableDescriptor[attrDescriptorIndex].tabDescr;
|
Uint32 attrDescriptor = tableDescriptor[attrDescriptorIndex].tabDescr;
|
||||||
Uint32 attributeOffset = tableDescriptor[attrDescriptorIndex + 1].tabDescr;
|
Uint32 attributeOffset = tableDescriptor[attrDescriptorIndex + 1].tabDescr;
|
||||||
|
|
||||||
|
Uint32 xfrmBuffer[1 + MAX_KEY_SIZE_IN_WORDS * 1]; // strxfrm_multiply == 1
|
||||||
|
Uint32 charsetFlag = AttributeOffset::getCharsetFlag(attributeOffset);
|
||||||
|
if (charsetFlag) {
|
||||||
|
Uint32 csPos = AttributeOffset::getCharsetPos(attributeOffset);
|
||||||
|
CHARSET_INFO* cs = regTabPtr->charsetArray[csPos];
|
||||||
|
Uint32 sizeInBytes = AttributeDescriptor::getSizeInBytes(attrDescriptor);
|
||||||
|
Uint32 sizeInWords = AttributeDescriptor::getSizeInWords(attrDescriptor);
|
||||||
|
const uchar* srcPtr = (uchar*)&updateBuffer[1];
|
||||||
|
uchar* dstPtr = (uchar*)&xfrmBuffer[1];
|
||||||
|
Uint32 n =
|
||||||
|
(*cs->coll->strnxfrm)(cs, dstPtr, sizeInBytes, srcPtr, sizeInBytes);
|
||||||
|
// pad with blanks (unlikely) and zeroes to match NDB API behaviour
|
||||||
|
while (n < sizeInBytes)
|
||||||
|
dstPtr[n++] = 0x20;
|
||||||
|
while (n < 4 * sizeInWords)
|
||||||
|
dstPtr[n++] = 0;
|
||||||
|
xfrmBuffer[0] = ahIn.m_value;
|
||||||
|
updateBuffer = xfrmBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
ReadFunction f = regTabPtr->readFunctionArray[attributeId];
|
ReadFunction f = regTabPtr->readFunctionArray[attributeId];
|
||||||
|
|
||||||
AttributeHeader::init(&attributeHeader, attributeId, 0);
|
AttributeHeader::init(&attributeHeader, attributeId, 0);
|
||||||
@ -707,7 +728,7 @@ Dbtup::checkUpdateOfPrimaryKey(Uint32* updateBuffer, Tablerec* const regTabPtr)
|
|||||||
tMaxRead = MAX_KEY_SIZE_IN_WORDS;
|
tMaxRead = MAX_KEY_SIZE_IN_WORDS;
|
||||||
|
|
||||||
bool tmp = tXfrmFlag;
|
bool tmp = tXfrmFlag;
|
||||||
tXfrmFlag = false;
|
tXfrmFlag = true;
|
||||||
ndbrequire((this->*f)(&keyReadBuffer[0], ahOut, attrDescriptor, attributeOffset));
|
ndbrequire((this->*f)(&keyReadBuffer[0], ahOut, attrDescriptor, attributeOffset));
|
||||||
tXfrmFlag = tmp;
|
tXfrmFlag = tmp;
|
||||||
ndbrequire(tOutBufIndex == ahOut->getDataSize());
|
ndbrequire(tOutBufIndex == ahOut->getDataSize());
|
||||||
|
@ -26,24 +26,33 @@ use HTML::Template;
|
|||||||
# BUGS
|
# BUGS
|
||||||
# ----
|
# ----
|
||||||
# - enum/set is 0 byte storage! Woah - efficient!
|
# - enum/set is 0 byte storage! Woah - efficient!
|
||||||
|
# - DECIMAL is 0 byte storage. A bit too efficient.
|
||||||
# - some float stores come out weird (when there's a comma e.g. 'float(4,1)')
|
# - some float stores come out weird (when there's a comma e.g. 'float(4,1)')
|
||||||
# - no disk data values
|
# - no disk data values
|
||||||
# - computes the storage requirements of views (and probably MERGE)
|
# - computes the storage requirements of views (and probably MERGE)
|
||||||
# - ignores character sets.
|
# - ignores character sets.
|
||||||
|
|
||||||
my $template = HTML::Template->new(filename => 'ndb_size.tmpl',
|
my $template = HTML::Template->new(filename => 'ndb_size.tmpl',
|
||||||
die_on_bad_params => 0);
|
die_on_bad_params => 0)
|
||||||
|
or die "Could not open ndb_size.tmpl.";
|
||||||
|
|
||||||
my $dbh;
|
my $dbh;
|
||||||
|
|
||||||
|
if(@ARGV < 3 || $ARGV[0] eq '--usage' || $ARGV[0] eq '--help')
|
||||||
|
{
|
||||||
|
print STDERR "Usage:\n";
|
||||||
|
print STDERR "\tndb_size.pl database hostname user password\n\n";
|
||||||
|
print STDERR "If you need to specify a port number, use host:port\n\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
my $database= $ARGV[0];
|
my $database= $ARGV[0];
|
||||||
my $hostname= $ARGV[1];
|
my $hostname= $ARGV[1];
|
||||||
my $port= $ARGV[2];
|
my $user= $ARGV[2];
|
||||||
my $user= $ARGV[3];
|
my $password= $ARGV[3];
|
||||||
my $password= $ARGV[4];
|
my $dsn = "DBI:mysql:database=$database;host=$hostname";
|
||||||
my $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
|
$dbh= DBI->connect($dsn, $user, $password) or exit(1);
|
||||||
$dbh= DBI->connect($dsn, $user, $password);
|
|
||||||
$template->param(db => $database);
|
$template->param(db => $database);
|
||||||
$template->param(dsn => $dsn);
|
$template->param(dsn => $dsn);
|
||||||
}
|
}
|
||||||
@ -55,6 +64,14 @@ my $tables = $dbh->selectall_arrayref("show tables");
|
|||||||
|
|
||||||
my @table_size;
|
my @table_size;
|
||||||
|
|
||||||
|
my @dbDataMemory;
|
||||||
|
my @dbIndexMemory;
|
||||||
|
my @NoOfAttributes;
|
||||||
|
my @NoOfIndexes;
|
||||||
|
my @NoOfTables;
|
||||||
|
$NoOfTables[$_]{val} = @{$tables} foreach 0..$#releases;
|
||||||
|
|
||||||
|
|
||||||
sub align {
|
sub align {
|
||||||
my($to,@unaligned) = @_;
|
my($to,@unaligned) = @_;
|
||||||
my @aligned;
|
my @aligned;
|
||||||
@ -68,9 +85,8 @@ foreach(@{$tables})
|
|||||||
{
|
{
|
||||||
my $table= @{$_}[0];
|
my $table= @{$_}[0];
|
||||||
my @columns;
|
my @columns;
|
||||||
my $info= $dbh->selectall_hashref("describe ".$dbh->quote($table),"Field");
|
my $info= $dbh->selectall_hashref('describe `'.$table.'`',"Field");
|
||||||
my @count = $dbh->selectrow_array("select count(*) from "
|
my @count = $dbh->selectrow_array('select count(*) from `'.$table.'`');
|
||||||
.$dbh->quote($table));
|
|
||||||
my %columnsize; # used for index calculations
|
my %columnsize; # used for index calculations
|
||||||
|
|
||||||
# We now work out the DataMemory usage
|
# We now work out the DataMemory usage
|
||||||
@ -132,14 +148,17 @@ foreach(@{$tables})
|
|||||||
my $fixed= 1+$size;
|
my $fixed= 1+$size;
|
||||||
my @dynamic=$dbh->selectrow_array("select avg(length("
|
my @dynamic=$dbh->selectrow_array("select avg(length("
|
||||||
.$dbh->quote($name)
|
.$dbh->quote($name)
|
||||||
.")) from ".$dbh->quote($table));
|
.")) from `".$table.'`');
|
||||||
$dynamic[0]=0 if !$dynamic[0];
|
$dynamic[0]=0 if !$dynamic[0];
|
||||||
@realsize= ($fixed,$fixed,ceil($dynamic[0]));
|
@realsize= ($fixed,$fixed,ceil($dynamic[0]));
|
||||||
}
|
}
|
||||||
elsif($type =~ /binary/ || $type =~ /char/)
|
elsif($type =~ /binary/ || $type =~ /char/)
|
||||||
{@realsize=($size,$size,$size)}
|
{@realsize=($size,$size,$size)}
|
||||||
elsif($type =~ /text/ || $type =~ /blob/)
|
elsif($type =~ /text/ || $type =~ /blob/)
|
||||||
{@realsize=(256,256,1)} # FIXME check if 5.1 is correct
|
{
|
||||||
|
@realsize=(256,256,1);
|
||||||
|
$NoOfTables[$_]{val} += 1 foreach 0..$#releases; # blob uses table
|
||||||
|
} # FIXME check if 5.1 is correct
|
||||||
|
|
||||||
@realsize= align(4,@realsize);
|
@realsize= align(4,@realsize);
|
||||||
|
|
||||||
@ -166,7 +185,7 @@ foreach(@{$tables})
|
|||||||
# we can still connect to pre-5.0 mysqlds.
|
# we can still connect to pre-5.0 mysqlds.
|
||||||
my %indexes;
|
my %indexes;
|
||||||
{
|
{
|
||||||
my $sth= $dbh->prepare("show index from "$dbh->quote($table));
|
my $sth= $dbh->prepare("show index from `".$table.'`');
|
||||||
$sth->execute;
|
$sth->execute;
|
||||||
while(my $i = $sth->fetchrow_hashref)
|
while(my $i = $sth->fetchrow_hashref)
|
||||||
{
|
{
|
||||||
@ -257,7 +276,51 @@ foreach(@{$tables})
|
|||||||
IndexMemory=>\@IndexMemory,
|
IndexMemory=>\@IndexMemory,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$dbDataMemory[$_]{val} += $DataMemory[$_]{val} foreach 0..$#releases;
|
||||||
|
$dbIndexMemory[$_]{val} += $IndexMemory[$_]{val} foreach 0..$#releases;
|
||||||
|
$NoOfAttributes[$_]{val} += @columns foreach 0..$#releases;
|
||||||
|
$NoOfIndexes[$_]{val} += @indexes foreach 0..$#releases;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @NoOfTriggers;
|
||||||
|
# for unique hash indexes
|
||||||
|
$NoOfTriggers[$_]{val} += $NoOfIndexes[$_]{val}*3 foreach 0..$#releases;
|
||||||
|
# for ordered index
|
||||||
|
$NoOfTriggers[$_]{val} += $NoOfIndexes[$_]{val} foreach 0..$#releases;
|
||||||
|
|
||||||
|
my @ParamMemory;
|
||||||
|
foreach (0..$#releases) {
|
||||||
|
$ParamMemory[0]{releases}[$_]{val}= POSIX::ceil(200*$NoOfAttributes[$_]{val}/1024);
|
||||||
|
$ParamMemory[0]{name}= 'Attributes';
|
||||||
|
|
||||||
|
$ParamMemory[1]{releases}[$_]{val}= 20*$NoOfTables[$_]{val};
|
||||||
|
$ParamMemory[1]{name}= 'Tables';
|
||||||
|
|
||||||
|
$ParamMemory[2]{releases}[$_]{val}= 10*$NoOfIndexes[$_]{val};
|
||||||
|
$ParamMemory[2]{name}= 'OrderedIndexes';
|
||||||
|
|
||||||
|
$ParamMemory[3]{releases}[$_]{val}= 15*$NoOfIndexes[$_]{val};
|
||||||
|
$ParamMemory[3]{name}= 'UniqueHashIndexes';
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->param(tables => \@table_size);
|
$template->param(tables => \@table_size);
|
||||||
|
$template->param(Parameters => [{name=>'DataMemory (kb)',
|
||||||
|
releases=>\@dbDataMemory},
|
||||||
|
{name=>'IndexMemory (kb)',
|
||||||
|
releases=>\@dbIndexMemory},
|
||||||
|
{name=>'MaxNoOfTables',
|
||||||
|
releases=>\@NoOfTables},
|
||||||
|
{name=>'MaxNoOfAttributes',
|
||||||
|
releases=>\@NoOfAttributes},
|
||||||
|
{name=>'MaxNoOfOrderedIndexes',
|
||||||
|
releases=>\@NoOfIndexes},
|
||||||
|
{name=>'MaxNoOfUniqueHashIndexes',
|
||||||
|
releases=>\@NoOfIndexes},
|
||||||
|
{name=>'MaxNoOfTriggers',
|
||||||
|
releases=>\@NoOfTriggers}
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$template->param(ParamMemory => \@ParamMemory);
|
||||||
|
|
||||||
print $template->output;
|
print $template->output;
|
||||||
|
@ -13,18 +13,58 @@ td,th { border: 1px solid black }
|
|||||||
<h1>MySQL Cluster analysis for <TMPL_VAR NAME="db" escape="html"></h1>
|
<h1>MySQL Cluster analysis for <TMPL_VAR NAME="db" escape="html"></h1>
|
||||||
<p>This is an automated analysis of the <TMPL_VAR NAME="DSN" escape="html"> database for migration into <a href="http://www.mysql.com/">MySQL</a> Cluster. No warranty is made to the accuracy of the information.</p>
|
<p>This is an automated analysis of the <TMPL_VAR NAME="DSN" escape="html"> database for migration into <a href="http://www.mysql.com/">MySQL</a> Cluster. No warranty is made to the accuracy of the information.</p>
|
||||||
|
|
||||||
<p>This information should be valid for MySQL 4.1</p>
|
<p>This information should be valid for MySQL 4.1 and 5.0. Since 5.1 is not a final release yet, the numbers should be used as a guide only.</p>
|
||||||
|
|
||||||
|
<h2>Parameter Settings</h2>
|
||||||
|
<p><b>NOTE</b> the configuration parameters below do not take into account system tables and other requirements.</p>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Parameter</th>
|
||||||
|
<TMPL_LOOP NAME=releases>
|
||||||
|
<th><TMPL_VAR NAME=rel></th>
|
||||||
|
</TMPL_LOOP>
|
||||||
|
</tr>
|
||||||
|
<TMPL_LOOP NAME=Parameters>
|
||||||
|
<tr>
|
||||||
|
<td><TMPL_VAR NAME=name></td>
|
||||||
|
<TMPL_LOOP NAME=releases>
|
||||||
|
<td><TMPL_VAR NAME=val></td>
|
||||||
|
</TMPL_LOOP>
|
||||||
|
</tr>
|
||||||
|
</TMPL_LOOP>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h2>Memory usage because of parameters</h2>
|
||||||
|
|
||||||
|
<p>Usage is in kilobytes. Actual usage will vary as you should set the parameters larger than those listed in the table above.</p>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Parameter</th>
|
||||||
|
<TMPL_LOOP NAME=releases>
|
||||||
|
<th><TMPL_VAR NAME=rel></th>
|
||||||
|
</TMPL_LOOP>
|
||||||
|
</tr>
|
||||||
|
<TMPL_LOOP NAME=ParamMemory>
|
||||||
|
<tr>
|
||||||
|
<td><TMPL_VAR NAME=name></td>
|
||||||
|
<TMPL_LOOP NAME=releases>
|
||||||
|
<td><TMPL_VAR NAME=val></td>
|
||||||
|
</TMPL_LOOP>
|
||||||
|
</tr>
|
||||||
|
</TMPL_LOOP>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h2>Table List</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<TMPL_LOOP NAME="tables">
|
<TMPL_LOOP NAME="tables">
|
||||||
<li><TMPL_VAR NAME="table"></li>
|
<li><a href="#<TMPL_VAR NAME="table">"><TMPL_VAR NAME="table"></a></li>
|
||||||
</TMPL_LOOP>
|
</TMPL_LOOP>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
<TMPL_LOOP NAME="tables">
|
<TMPL_LOOP NAME="tables">
|
||||||
<h2><TMPL_VAR NAME="table"></h2>
|
<h2><a name="<TMPL_VAR NAME="table">"><TMPL_VAR NAME="table"></a></h2>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Column</th>
|
<th>Column</th>
|
||||||
|
@ -29,7 +29,7 @@ ALTER TABLE user add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,a
|
|||||||
ALTER TABLE host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
|
ALTER TABLE host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
|
||||||
ALTER TABLE db add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
|
ALTER TABLE db add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
|
||||||
|
|
||||||
--- Fix privileges for old tables
|
-- Fix privileges for old tables
|
||||||
UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
|
UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
|
||||||
UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
|
UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
|
||||||
UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
|
UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
|
||||||
|
@ -58,12 +58,16 @@ static int tina_init= 0;
|
|||||||
** TINA tables
|
** TINA tables
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Used for sorting chains.
|
Used for sorting chains with qsort().
|
||||||
*/
|
*/
|
||||||
int sort_set (tina_set *a, tina_set *b)
|
int sort_set (tina_set *a, tina_set *b)
|
||||||
{
|
{
|
||||||
return ( a->begin > b->begin ? 1 : ( a->begin < b->begin ? -1 : 0 ) );
|
/*
|
||||||
|
We assume that intervals do not intersect. So, it is enought to compare
|
||||||
|
any two points. Here we take start of intervals for comparison.
|
||||||
|
*/
|
||||||
|
return ( a->begin > b->begin ? -1 : ( a->begin < b->begin ? 1 : 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static byte* tina_get_key(TINA_SHARE *share,uint *length,
|
static byte* tina_get_key(TINA_SHARE *share,uint *length,
|
||||||
@ -162,7 +166,8 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
|
|||||||
thr_lock_init(&share->lock);
|
thr_lock_init(&share->lock);
|
||||||
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
|
||||||
|
|
||||||
if ((share->data_file= my_open(data_file_name, O_RDWR, MYF(0))) == -1)
|
if ((share->data_file= my_open(data_file_name, O_RDWR|O_APPEND,
|
||||||
|
MYF(0))) == -1)
|
||||||
goto error2;
|
goto error2;
|
||||||
|
|
||||||
/* We only use share->data_file for writing, so we scan to the end to append */
|
/* We only use share->data_file for writing, so we scan to the end to append */
|
||||||
@ -739,13 +744,8 @@ int ha_tina::rnd_end()
|
|||||||
qsort(chain, (size_t)(chain_ptr - chain), sizeof(tina_set), (qsort_cmp)sort_set);
|
qsort(chain, (size_t)(chain_ptr - chain), sizeof(tina_set), (qsort_cmp)sort_set);
|
||||||
for (ptr= chain; ptr < chain_ptr; ptr++)
|
for (ptr= chain; ptr < chain_ptr; ptr++)
|
||||||
{
|
{
|
||||||
/* We peek a head to see if this is the last chain */
|
memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end,
|
||||||
if (ptr+1 == chain_ptr)
|
length - (size_t)ptr->end);
|
||||||
memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end,
|
|
||||||
length - (size_t)ptr->end);
|
|
||||||
else
|
|
||||||
memmove((caddr_t)share->mapped_file + ptr->begin, (caddr_t)share->mapped_file + ptr->end,
|
|
||||||
(size_t)((ptr++)->begin - ptr->end));
|
|
||||||
length= length - (size_t)(ptr->end - ptr->begin);
|
length= length - (size_t)(ptr->end - ptr->begin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1974,7 +1974,7 @@ void item_user_lock_release(User_level_lock *ull)
|
|||||||
tmp.copy(command, strlen(command), tmp.charset());
|
tmp.copy(command, strlen(command), tmp.charset());
|
||||||
tmp.append(ull->key,ull->key_length);
|
tmp.append(ull->key,ull->key_length);
|
||||||
tmp.append("\")", 2);
|
tmp.append("\")", 2);
|
||||||
Query_log_event qev(current_thd, tmp.ptr(), tmp.length(),1, FALSE);
|
Query_log_event qev(current_thd, tmp.ptr(), tmp.length(),0, FALSE);
|
||||||
qev.error_code=0; // this query is always safe to run on slave
|
qev.error_code=0; // this query is always safe to run on slave
|
||||||
mysql_bin_log.write(&qev);
|
mysql_bin_log.write(&qev);
|
||||||
}
|
}
|
||||||
|
@ -938,7 +938,6 @@ class user_var_entry;
|
|||||||
class Item_func_set_user_var :public Item_func
|
class Item_func_set_user_var :public Item_func
|
||||||
{
|
{
|
||||||
enum Item_result cached_result_type;
|
enum Item_result cached_result_type;
|
||||||
LEX_STRING name;
|
|
||||||
user_var_entry *entry;
|
user_var_entry *entry;
|
||||||
char buffer[MAX_FIELD_WIDTH];
|
char buffer[MAX_FIELD_WIDTH];
|
||||||
String value;
|
String value;
|
||||||
@ -952,6 +951,7 @@ class Item_func_set_user_var :public Item_func
|
|||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
LEX_STRING name; // keep it public
|
||||||
Item_func_set_user_var(LEX_STRING a,Item *b)
|
Item_func_set_user_var(LEX_STRING a,Item *b)
|
||||||
:Item_func(b), cached_result_type(INT_RESULT), name(a)
|
:Item_func(b), cached_result_type(INT_RESULT), name(a)
|
||||||
{}
|
{}
|
||||||
@ -972,10 +972,10 @@ public:
|
|||||||
|
|
||||||
class Item_func_get_user_var :public Item_func
|
class Item_func_get_user_var :public Item_func
|
||||||
{
|
{
|
||||||
LEX_STRING name;
|
|
||||||
user_var_entry *var_entry;
|
user_var_entry *var_entry;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
LEX_STRING name; // keep it public
|
||||||
Item_func_get_user_var(LEX_STRING a):
|
Item_func_get_user_var(LEX_STRING a):
|
||||||
Item_func(), name(a) {}
|
Item_func(), name(a) {}
|
||||||
double val();
|
double val();
|
||||||
|
@ -614,8 +614,8 @@ public:
|
|||||||
|
|
||||||
class Item_func_conv_charset :public Item_str_func
|
class Item_func_conv_charset :public Item_str_func
|
||||||
{
|
{
|
||||||
CHARSET_INFO *conv_charset;
|
|
||||||
public:
|
public:
|
||||||
|
CHARSET_INFO *conv_charset; // keep it public
|
||||||
Item_func_conv_charset(Item *a, CHARSET_INFO *cs) :Item_str_func(a)
|
Item_func_conv_charset(Item *a, CHARSET_INFO *cs) :Item_str_func(a)
|
||||||
{ conv_charset=cs; }
|
{ conv_charset=cs; }
|
||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
|
@ -607,12 +607,12 @@ enum interval_type
|
|||||||
|
|
||||||
class Item_date_add_interval :public Item_date_func
|
class Item_date_add_interval :public Item_date_func
|
||||||
{
|
{
|
||||||
const interval_type int_type;
|
|
||||||
String value;
|
String value;
|
||||||
const bool date_sub_interval;
|
|
||||||
enum_field_types cached_field_type;
|
enum_field_types cached_field_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
const interval_type int_type; // keep it public
|
||||||
|
const bool date_sub_interval; // keep it public
|
||||||
Item_date_add_interval(Item *a,Item *b,interval_type type_arg,bool neg_arg)
|
Item_date_add_interval(Item *a,Item *b,interval_type type_arg,bool neg_arg)
|
||||||
:Item_date_func(a,b),int_type(type_arg), date_sub_interval(neg_arg) {}
|
:Item_date_func(a,b),int_type(type_arg), date_sub_interval(neg_arg) {}
|
||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
@ -628,10 +628,10 @@ public:
|
|||||||
|
|
||||||
class Item_extract :public Item_int_func
|
class Item_extract :public Item_int_func
|
||||||
{
|
{
|
||||||
const interval_type int_type;
|
|
||||||
String value;
|
String value;
|
||||||
bool date_value;
|
bool date_value;
|
||||||
public:
|
public:
|
||||||
|
const interval_type int_type; // keep it public
|
||||||
Item_extract(interval_type type_arg, Item *a)
|
Item_extract(interval_type type_arg, Item *a)
|
||||||
:Item_int_func(a), int_type(type_arg) {}
|
:Item_int_func(a), int_type(type_arg) {}
|
||||||
longlong val_int();
|
longlong val_int();
|
||||||
@ -856,8 +856,8 @@ enum date_time_format
|
|||||||
|
|
||||||
class Item_func_get_format :public Item_str_func
|
class Item_func_get_format :public Item_str_func
|
||||||
{
|
{
|
||||||
const timestamp_type type;
|
|
||||||
public:
|
public:
|
||||||
|
const timestamp_type type; // keep it public
|
||||||
Item_func_get_format(timestamp_type type_arg, Item *a)
|
Item_func_get_format(timestamp_type type_arg, Item *a)
|
||||||
:Item_str_func(a), type(type_arg)
|
:Item_str_func(a), type(type_arg)
|
||||||
{}
|
{}
|
||||||
|
@ -701,7 +701,8 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen= 0);
|
|||||||
int mysql_ha_close(THD *thd, TABLE_LIST *tables);
|
int mysql_ha_close(THD *thd, TABLE_LIST *tables);
|
||||||
int mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
|
int mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
|
||||||
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
|
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
|
||||||
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags);
|
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags,
|
||||||
|
bool is_locked);
|
||||||
/* mysql_ha_flush mode_flags bits */
|
/* mysql_ha_flush mode_flags bits */
|
||||||
#define MYSQL_HA_CLOSE_FINAL 0x00
|
#define MYSQL_HA_CLOSE_FINAL 0x00
|
||||||
#define MYSQL_HA_REOPEN_ON_USAGE 0x01
|
#define MYSQL_HA_REOPEN_ON_USAGE 0x01
|
||||||
|
@ -306,7 +306,8 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
|
|||||||
thd->proc_info="Flushing tables";
|
thd->proc_info="Flushing tables";
|
||||||
|
|
||||||
close_old_data_files(thd,thd->open_tables,1,1);
|
close_old_data_files(thd,thd->open_tables,1,1);
|
||||||
mysql_ha_flush(thd, tables, MYSQL_HA_REOPEN_ON_USAGE | MYSQL_HA_FLUSH_ALL);
|
mysql_ha_flush(thd, tables, MYSQL_HA_REOPEN_ON_USAGE | MYSQL_HA_FLUSH_ALL,
|
||||||
|
TRUE);
|
||||||
bool found=1;
|
bool found=1;
|
||||||
/* Wait until all threads has closed all the tables we had locked */
|
/* Wait until all threads has closed all the tables we had locked */
|
||||||
DBUG_PRINT("info",
|
DBUG_PRINT("info",
|
||||||
@ -860,7 +861,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* close handler tables which are marked for flush */
|
/* close handler tables which are marked for flush */
|
||||||
mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE);
|
mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE, TRUE);
|
||||||
|
|
||||||
for (table=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ;
|
for (table=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ;
|
||||||
table && table->in_use ;
|
table && table->in_use ;
|
||||||
@ -1265,7 +1266,7 @@ bool wait_for_tables(THD *thd)
|
|||||||
{
|
{
|
||||||
thd->some_tables_deleted=0;
|
thd->some_tables_deleted=0;
|
||||||
close_old_data_files(thd,thd->open_tables,0,dropping_tables != 0);
|
close_old_data_files(thd,thd->open_tables,0,dropping_tables != 0);
|
||||||
mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE);
|
mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE, TRUE);
|
||||||
if (!table_is_used(thd->open_tables,1))
|
if (!table_is_used(thd->open_tables,1))
|
||||||
break;
|
break;
|
||||||
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
|
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
|
||||||
|
@ -353,7 +353,7 @@ void THD::cleanup(void)
|
|||||||
close_thread_tables(this);
|
close_thread_tables(this);
|
||||||
}
|
}
|
||||||
mysql_ha_flush(this, (TABLE_LIST*) 0,
|
mysql_ha_flush(this, (TABLE_LIST*) 0,
|
||||||
MYSQL_HA_CLOSE_FINAL | MYSQL_HA_FLUSH_ALL);
|
MYSQL_HA_CLOSE_FINAL | MYSQL_HA_FLUSH_ALL, FALSE);
|
||||||
hash_free(&handler_tables_hash);
|
hash_free(&handler_tables_hash);
|
||||||
delete_dynamic(&user_var_events);
|
delete_dynamic(&user_var_events);
|
||||||
hash_free(&user_vars);
|
hash_free(&user_vars);
|
||||||
|
@ -354,6 +354,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
|||||||
ha_rows select_limit,ha_rows offset_limit)
|
ha_rows select_limit,ha_rows offset_limit)
|
||||||
{
|
{
|
||||||
TABLE_LIST *hash_tables;
|
TABLE_LIST *hash_tables;
|
||||||
|
TABLE **table_ptr;
|
||||||
TABLE *table;
|
TABLE *table;
|
||||||
MYSQL_LOCK *lock;
|
MYSQL_LOCK *lock;
|
||||||
List<Item> list;
|
List<Item> list;
|
||||||
@ -383,6 +384,27 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
|||||||
DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' tab %p",
|
DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' tab %p",
|
||||||
hash_tables->db, hash_tables->real_name,
|
hash_tables->db, hash_tables->real_name,
|
||||||
hash_tables->alias, table));
|
hash_tables->alias, table));
|
||||||
|
/* Table might have been flushed. */
|
||||||
|
if (table && (table->version != refresh_version))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
We must follow the thd->handler_tables chain, as we need the
|
||||||
|
address of the 'next' pointer referencing this table
|
||||||
|
for close_thread_table().
|
||||||
|
*/
|
||||||
|
for (table_ptr= &(thd->handler_tables);
|
||||||
|
*table_ptr && (*table_ptr != table);
|
||||||
|
table_ptr= &(*table_ptr)->next)
|
||||||
|
{}
|
||||||
|
VOID(pthread_mutex_lock(&LOCK_open));
|
||||||
|
if (close_thread_table(thd, table_ptr))
|
||||||
|
{
|
||||||
|
/* Tell threads waiting for refresh that something has happened */
|
||||||
|
VOID(pthread_cond_broadcast(&COND_refresh));
|
||||||
|
}
|
||||||
|
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||||
|
table= hash_tables->table= NULL;
|
||||||
|
}
|
||||||
if (!table)
|
if (!table)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -616,6 +638,7 @@ err0:
|
|||||||
MYSQL_HA_REOPEN_ON_USAGE mark for reopen.
|
MYSQL_HA_REOPEN_ON_USAGE mark for reopen.
|
||||||
MYSQL_HA_FLUSH_ALL flush all tables, not only
|
MYSQL_HA_FLUSH_ALL flush all tables, not only
|
||||||
those marked for flush.
|
those marked for flush.
|
||||||
|
is_locked If LOCK_open is locked.
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
The list of HANDLER tables may be NULL, in which case all HANDLER
|
The list of HANDLER tables may be NULL, in which case all HANDLER
|
||||||
@ -623,7 +646,6 @@ err0:
|
|||||||
If 'tables' is NULL and MYSQL_HA_FLUSH_ALL is not set,
|
If 'tables' is NULL and MYSQL_HA_FLUSH_ALL is not set,
|
||||||
all HANDLER tables marked for flush are closed.
|
all HANDLER tables marked for flush are closed.
|
||||||
Broadcasts a COND_refresh condition, for every table closed.
|
Broadcasts a COND_refresh condition, for every table closed.
|
||||||
The caller must lock LOCK_open.
|
|
||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
Since mysql_ha_flush() is called when the base table has to be closed,
|
Since mysql_ha_flush() is called when the base table has to be closed,
|
||||||
@ -633,10 +655,12 @@ err0:
|
|||||||
0 ok
|
0 ok
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags)
|
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags,
|
||||||
|
bool is_locked)
|
||||||
{
|
{
|
||||||
TABLE_LIST *tmp_tables;
|
TABLE_LIST *tmp_tables;
|
||||||
TABLE **table_ptr;
|
TABLE **table_ptr;
|
||||||
|
bool did_lock= FALSE;
|
||||||
DBUG_ENTER("mysql_ha_flush");
|
DBUG_ENTER("mysql_ha_flush");
|
||||||
DBUG_PRINT("enter", ("tables: %p mode_flags: 0x%02x", tables, mode_flags));
|
DBUG_PRINT("enter", ("tables: %p mode_flags: 0x%02x", tables, mode_flags));
|
||||||
|
|
||||||
@ -662,6 +686,12 @@ int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags)
|
|||||||
(*table_ptr)->table_cache_key,
|
(*table_ptr)->table_cache_key,
|
||||||
(*table_ptr)->real_name,
|
(*table_ptr)->real_name,
|
||||||
(*table_ptr)->table_name));
|
(*table_ptr)->table_name));
|
||||||
|
/* The first time it is required, lock for close_thread_table(). */
|
||||||
|
if (! did_lock && ! is_locked)
|
||||||
|
{
|
||||||
|
VOID(pthread_mutex_lock(&LOCK_open));
|
||||||
|
did_lock= TRUE;
|
||||||
|
}
|
||||||
mysql_ha_flush_table(thd, table_ptr, mode_flags);
|
mysql_ha_flush_table(thd, table_ptr, mode_flags);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -680,6 +710,12 @@ int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags)
|
|||||||
if ((mode_flags & MYSQL_HA_FLUSH_ALL) ||
|
if ((mode_flags & MYSQL_HA_FLUSH_ALL) ||
|
||||||
((*table_ptr)->version != refresh_version))
|
((*table_ptr)->version != refresh_version))
|
||||||
{
|
{
|
||||||
|
/* The first time it is required, lock for close_thread_table(). */
|
||||||
|
if (! did_lock && ! is_locked)
|
||||||
|
{
|
||||||
|
VOID(pthread_mutex_lock(&LOCK_open));
|
||||||
|
did_lock= TRUE;
|
||||||
|
}
|
||||||
mysql_ha_flush_table(thd, table_ptr, mode_flags);
|
mysql_ha_flush_table(thd, table_ptr, mode_flags);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -687,6 +723,10 @@ int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Release the lock if it was taken by this function. */
|
||||||
|
if (did_lock)
|
||||||
|
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||||
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -718,8 +758,8 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags)
|
|||||||
table->table_name, mode_flags));
|
table->table_name, mode_flags));
|
||||||
|
|
||||||
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
|
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
|
||||||
(byte*) (*table_ptr)->table_name,
|
(byte*) table->table_name,
|
||||||
strlen((*table_ptr)->table_name) + 1)))
|
strlen(table->table_name) + 1)))
|
||||||
{
|
{
|
||||||
if (! (mode_flags & MYSQL_HA_REOPEN_ON_USAGE))
|
if (! (mode_flags & MYSQL_HA_REOPEN_ON_USAGE))
|
||||||
{
|
{
|
||||||
@ -733,6 +773,7 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
safe_mutex_assert_owner(&LOCK_open);
|
||||||
(*table_ptr)->file->ha_index_or_rnd_end();
|
(*table_ptr)->file->ha_index_or_rnd_end();
|
||||||
if (close_thread_table(thd, table_ptr))
|
if (close_thread_table(thd, table_ptr))
|
||||||
{
|
{
|
||||||
|
@ -7354,8 +7354,12 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
|
|||||||
DBUG_ENTER("test_if_skip_sort_order");
|
DBUG_ENTER("test_if_skip_sort_order");
|
||||||
LINT_INIT(ref_key_parts);
|
LINT_INIT(ref_key_parts);
|
||||||
|
|
||||||
/* Check which keys can be used to resolve ORDER BY */
|
/*
|
||||||
usable_keys.set_all();
|
Check which keys can be used to resolve ORDER BY.
|
||||||
|
We must not try to use disabled keys.
|
||||||
|
*/
|
||||||
|
usable_keys= table->keys_in_use;
|
||||||
|
|
||||||
for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next)
|
for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next)
|
||||||
{
|
{
|
||||||
if ((*tmp_order->item)->type() != Item::FIELD_ITEM)
|
if ((*tmp_order->item)->type() != Item::FIELD_ITEM)
|
||||||
|
@ -1890,7 +1890,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
|
|||||||
case SHOW_SLAVE_RUNNING:
|
case SHOW_SLAVE_RUNNING:
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&LOCK_active_mi);
|
pthread_mutex_lock(&LOCK_active_mi);
|
||||||
end= strmov(buff, (active_mi->slave_running &&
|
end= strmov(buff, (active_mi && active_mi->slave_running &&
|
||||||
active_mi->rli.slave_running) ? "ON" : "OFF");
|
active_mi->rli.slave_running) ? "ON" : "OFF");
|
||||||
pthread_mutex_unlock(&LOCK_active_mi);
|
pthread_mutex_unlock(&LOCK_active_mi);
|
||||||
break;
|
break;
|
||||||
@ -1902,9 +1902,12 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
|
|||||||
SLAVE STATUS, and have the sum over all lines here.
|
SLAVE STATUS, and have the sum over all lines here.
|
||||||
*/
|
*/
|
||||||
pthread_mutex_lock(&LOCK_active_mi);
|
pthread_mutex_lock(&LOCK_active_mi);
|
||||||
pthread_mutex_lock(&active_mi->rli.data_lock);
|
if (active_mi)
|
||||||
end= int10_to_str(active_mi->rli.retried_trans, buff, 10);
|
{
|
||||||
pthread_mutex_unlock(&active_mi->rli.data_lock);
|
pthread_mutex_lock(&active_mi->rli.data_lock);
|
||||||
|
end= int10_to_str(active_mi->rli.retried_trans, buff, 10);
|
||||||
|
pthread_mutex_unlock(&active_mi->rli.data_lock);
|
||||||
|
}
|
||||||
pthread_mutex_unlock(&LOCK_active_mi);
|
pthread_mutex_unlock(&LOCK_active_mi);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
|||||||
for (table=tables ; table ; table=table->next)
|
for (table=tables ; table ; table=table->next)
|
||||||
{
|
{
|
||||||
char *db=table->db;
|
char *db=table->db;
|
||||||
mysql_ha_flush(thd, table, MYSQL_HA_CLOSE_FINAL);
|
mysql_ha_flush(thd, table, MYSQL_HA_CLOSE_FINAL, TRUE);
|
||||||
if (!close_temporary_table(thd, db, table->real_name))
|
if (!close_temporary_table(thd, db, table->real_name))
|
||||||
{
|
{
|
||||||
tmp_table_deleted=1;
|
tmp_table_deleted=1;
|
||||||
@ -639,6 +639,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Field redefined */
|
/* Field redefined */
|
||||||
|
sql_field->def= dup_field->def;
|
||||||
sql_field->sql_type= dup_field->sql_type;
|
sql_field->sql_type= dup_field->sql_type;
|
||||||
sql_field->charset= (dup_field->charset ?
|
sql_field->charset= (dup_field->charset ?
|
||||||
dup_field->charset :
|
dup_field->charset :
|
||||||
@ -647,8 +648,15 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
sql_field->pack_length= dup_field->pack_length;
|
sql_field->pack_length= dup_field->pack_length;
|
||||||
sql_field->create_length_to_internal_length();
|
sql_field->create_length_to_internal_length();
|
||||||
sql_field->decimals= dup_field->decimals;
|
sql_field->decimals= dup_field->decimals;
|
||||||
sql_field->flags= dup_field->flags;
|
|
||||||
sql_field->unireg_check= dup_field->unireg_check;
|
sql_field->unireg_check= dup_field->unireg_check;
|
||||||
|
/*
|
||||||
|
We're making one field from two, the result field will have
|
||||||
|
dup_field->flags as flags. If we've incremented null_fields
|
||||||
|
because of sql_field->flags, decrement it back.
|
||||||
|
*/
|
||||||
|
if (!(sql_field->flags & NOT_NULL_FLAG))
|
||||||
|
null_fields--;
|
||||||
|
sql_field->flags= dup_field->flags;
|
||||||
it2.remove(); // Remove first (create) definition
|
it2.remove(); // Remove first (create) definition
|
||||||
select_field_pos--;
|
select_field_pos--;
|
||||||
break;
|
break;
|
||||||
@ -1920,7 +1928,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||||||
if (protocol->send_fields(&field_list, 1))
|
if (protocol->send_fields(&field_list, 1))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
|
||||||
mysql_ha_flush(thd, tables, MYSQL_HA_CLOSE_FINAL);
|
mysql_ha_flush(thd, tables, MYSQL_HA_CLOSE_FINAL, FALSE);
|
||||||
for (table = tables; table; table = table->next)
|
for (table = tables; table; table = table->next)
|
||||||
{
|
{
|
||||||
char table_name[NAME_LEN*2+2];
|
char table_name[NAME_LEN*2+2];
|
||||||
@ -2772,8 +2780,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||||||
if (!new_db || !my_strcasecmp(table_alias_charset, new_db, db))
|
if (!new_db || !my_strcasecmp(table_alias_charset, new_db, db))
|
||||||
new_db= db;
|
new_db= db;
|
||||||
used_fields=create_info->used_fields;
|
used_fields=create_info->used_fields;
|
||||||
|
|
||||||
|
mysql_ha_flush(thd, table_list, MYSQL_HA_CLOSE_FINAL, FALSE);
|
||||||
|
|
||||||
mysql_ha_flush(thd, table_list, MYSQL_HA_CLOSE_FINAL);
|
|
||||||
/* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */
|
/* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */
|
||||||
if (alter_info->tablespace_op != NO_TABLESPACE_OP)
|
if (alter_info->tablespace_op != NO_TABLESPACE_OP)
|
||||||
DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list,
|
DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list,
|
||||||
|
Reference in New Issue
Block a user