mirror of
https://github.com/MariaDB/server.git
synced 2025-03-02 17:23:16 +01:00

New multi-key-cache handling. This was needed becasue the old one didn't work reliable with MERGE tables. ALTER TABLE table_name ... CHARACTER SET ... now changes all char/varchar/text columns to the given character set (One must use ALTER TABLE ... DEFAULT CHARACTER SET ... to change the default character set) Fixed that have_compress is detected properly (fixes problems with func_compress.test on platforms without zlib) New syntax for CACHE INDEX ('keys' is optional if no index name is given and one mentions the key cache name only ones) Removed compiler warnings Added mysql_set_server_option() to allow clients like PHP to easaily set/reset the multi-statement flag. BUILD/compile-pentium-valgrind-max: Add test of isam client/mysql.cc: CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS include/my_base.h: Remove HA_EXTRA_SET_KEY_CACHE include/my_no_pthread.h: Add defines to ignore rw-locks when running without threads include/my_sys.h: Added function for multi-key-caches include/myisam.h: Added function to handle multi-key-caches include/mysql.h: Added mysql_set_server_option include/mysql_com.h: CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS Added enum_mysql_set_option include/mysqld_error.h: Added error message for unknown key cache innobase/srv/srv0start.c: Removed warning that is confused for MySQL users libmysql/libmysql.c: Added mysql_set_server_option() libmysql/libmysql.def: Added mysql_set_server_option() myisam/ft_nlq_search.c: Removed compiler warning myisam/ft_static.c: Removed compiler warning and fixed wrong return value myisam/mi_check.c: Clean up multi-key-cache usage myisam/mi_checksum.c: Removed not used variable myisam/mi_close.c: keycache -> key_cache myisam/mi_delete_all.c: keycache -> key_cache myisam/mi_extra.c: keycache -> key_cache Removed HA_EXTRA_SET_KEY_CACHE myisam/mi_keycache.c: Changed logic so that it's MyISAM that is responsible for assign tables to different key caches instead of the upper level myisam/mi_locking.c: Don't change key cache on unlock (must be done before) myisam/mi_open.c: Fetch key cache to use from multi_key_cache_search() myisam/mi_page.c: keycache -> key_cache myisam/mi_panic.c: keycache -> key_cache myisam/mi_preload.c: keycache -> key_cache myisam/mi_test1.c: Use KEY_CACHE_BLOCK_SIZE myisam/mi_test2.c: Always test resize_key_cache() myisam/mi_test3.c: Use KEY_CACHE_BLOCK_SIZE instead of 512 myisam/myisamchk.c: update for multiple key caches myisam/myisamdef.h: Remove reg_keycache Add unique_name_length for storing length of unique_file_name myisam/myisamlog.c: Change how end_key_cache() is called mysql-test/mysql-test-run.sh: Fixed web link Added name of failed test to abort row. mysql-test/r/alter_table.result: Testing of ALTER TABLE ... [DEFAULT] CHARACTER SET mysql-test/r/case.result: Update result for DEFAULT CHARSET... mysql-test/r/cast.result: Update result for DEFAULT CHARSET... mysql-test/r/create.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_collate.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_latin1_de.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_many.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_mb.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_recoding.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_ucs.result: Update result for DEFAULT CHARSET... mysql-test/r/derived.result: Use STRAIGHT_JOIN to make join order predictable mysql-test/r/fulltext.result: Update result for DEFAULT CHARSET... mysql-test/r/func_str.result: Update result for DEFAULT CHARSET... mysql-test/r/func_system.result: Update result for DEFAULT CHARSET... mysql-test/r/gis-rtree.result: Update result for DEFAULT CHARSET... mysql-test/r/innodb.result: Update result for DEFAULT CHARSET... mysql-test/r/key_cache.result: Update test for new key cache syntax. Added more tests mysql-test/r/merge.result: Update result for DEFAULT CHARSET... mysql-test/r/preload.result: New syntax mysql-test/r/show_check.result: Update result for DEFAULT CHARSET... mysql-test/r/sql_mode.result: Update result for DEFAULT CHARSET... mysql-test/r/subselect.result: Update result for DEFAULT CHARSET... mysql-test/r/type_blob.result: Update result for DEFAULT CHARSET... mysql-test/r/type_enum.result: Update result for DEFAULT CHARSET... mysql-test/r/type_nchar.result: Update result for DEFAULT CHARSET... mysql-test/r/type_set.result: Update result for DEFAULT CHARSET... mysql-test/r/union.result: Use STRAIGHT_JOIN to make join order predictable mysql-test/t/alter_table.test: Testing of ALTER TABLE ... [DEFAULT] CHARACTER SET mysql-test/t/ctype_many.test: Update result for DEFAULT CHARSET... mysql-test/t/derived.test: Use STRAIGHT_JOIN to make join order predictable mysql-test/t/isam.test: Use disable warnings for test loop mysql-test/t/join.test: Update test now when we only support 61 tables in join mysql-test/t/key_cache.test: Update test for new key cache syntax. Added more tests mysql-test/t/preload.test: Update for new syntax mysql-test/t/union.test: Use STRAIGHT_JOIN to make join order predictable mysys/Makefile.am: Added mf_keycaches.c mysys/hash.c: TRUE -> 1 mysys/mf_keycache.c: Removed compiler warnings Striped end space Fixed indentation and improved function comments TRUE -> 1 Changed parameters to end_key_cache() to make it easer to use Fixed bug when using key blocks size > 1024 bytes (First part of index file could be overwritten with wrong data) Split function flush_key_blocks into two functions to not get mutex used twice when called from flush_all_key_blocks() mysys/my_bitmap.c: More debugging Safe bitmap_free() Fixed indentation mysys/my_getopt.c: Ensure that we initialize option->value, option->max_value and value from GET_ASK_ADDR mysys/my_thr_init.c: Remove not used mutex THR_LOCK_keycache mysys/typelib.c: Fixed function comments sql-common/client.c: CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS Fixed the multi_result flag is set also on SELECT;s sql/ha_myisam.cc: Fixed multiple key_cache handling (Now done on MyISAM level) sql/ha_myisammrg.cc: Fixed multiple key_cache handling (Now done on MyISAM level) sql/handler.cc: New multi key cache handling sql/handler.h: New multi key cache handling Added support for default character set sql/item.h: Added function cleanup() (Needed for prepared statements / cursors) sql/item_cmpfunc.h: Added cleanup function sql/item_func.cc: Indentation cleanup sql/mysql_priv.h: New multi-key-cache functions Removed LOCK_assign sql/mysqld.cc: New multi-key-cache handling Fixed that variable have_compress is set correctly sql/protocol.cc: SELECT didn't work reliable in multi-statements sql/set_var.cc: Support for new key cache variables sql/set_var.h: Support for new key cache variables sql/share/czech/errmsg.txt: New error messages sql/share/danish/errmsg.txt: New error messages sql/share/dutch/errmsg.txt: New error messages sql/share/english/errmsg.txt: New error messages sql/share/estonian/errmsg.txt: New error messages sql/share/french/errmsg.txt: New error messages sql/share/german/errmsg.txt: New error messages sql/share/greek/errmsg.txt: New error messages sql/share/hungarian/errmsg.txt: New error messages sql/share/italian/errmsg.txt: New error messages sql/share/japanese/errmsg.txt: New error messages sql/share/korean/errmsg.txt: New error messages sql/share/norwegian-ny/errmsg.txt: New error messages sql/share/norwegian/errmsg.txt: New error messages sql/share/polish/errmsg.txt: New error messages sql/share/portuguese/errmsg.txt: New error messages sql/share/romanian/errmsg.txt: New error messages sql/share/russian/errmsg.txt: New error messages sql/share/serbian/errmsg.txt: New error messages sql/share/slovak/errmsg.txt: New error messages sql/share/spanish/errmsg.txt: New error messages sql/share/swedish/errmsg.txt: New error messages sql/share/ukrainian/errmsg.txt: New error messages sql/sql_base.cc: Removed all key_cache handling (this is now done on MyISAM level) Change table_charset -> default_table_charset sql/sql_db.cc: table_charset -> default_table_charset sql/sql_delete.cc: table_charset -> default_table_charset sql/sql_lex.cc: CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS sql/sql_lex.h: New option to store a name and length sql/sql_parse.cc: Support for mysql_set_server_option() Reset "default" keycache status variables in 'FLUSH STATUS' (Need to be improved later) sql/sql_show.cc: Add DEFAULT before CHARSET (for table character sets) Fetch key cache variables from 'sql_key_cache' sql/sql_table.cc: table_charset -> default_table_charset New multi-key-cache handling sql/sql_test.cc: Write information from all key caches sql/sql_yacc.yy: Changed syntax for CACHE INDEX ... Force user to use DEFAULT before database/table level character sets sql/structs.h: Added SHOW_KEY_CACHE_LONG (to get values from sql_key_cache) sql/table.cc: table_charset -> default_table_charset sql/table.h: New key cache handling (this is now done in mysys/mf_keycaches.c) sql/unireg.h: A
250 lines
9.5 KiB
Text
250 lines
9.5 KiB
Text
drop table if exists t1,t2;
|
|
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
|
|
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
|
|
check table t1 fast;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check status Table is already up to date
|
|
check table t1 fast;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check status Table is already up to date
|
|
check table t1 changed;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check status OK
|
|
insert into t1 values (5,5,5);
|
|
check table t1 changed;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check status OK
|
|
check table t1 medium;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check status OK
|
|
check table t1 extended;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check status OK
|
|
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 5 NULL NULL BTREE
|
|
t1 1 b 1 b A 1 NULL NULL BTREE
|
|
t1 1 b 2 c A 5 NULL NULL BTREE
|
|
insert into t1 values (5,5,5);
|
|
ERROR 23000: Duplicate entry '5' for key 1
|
|
optimize table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 optimize status OK
|
|
optimize table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 optimize status Table is already up to date
|
|
drop table t1;
|
|
show variables like "wait_timeout%";
|
|
Variable_name Value
|
|
wait_timeout 28800
|
|
show variables like "WAIT_timeout%";
|
|
Variable_name Value
|
|
wait_timeout 28800
|
|
show variables like "this_doesn't_exists%";
|
|
Variable_name Value
|
|
show table status from test like "this_doesn't_exists%";
|
|
Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
|
show databases;
|
|
Database
|
|
mysql
|
|
test
|
|
show databases like "test%";
|
|
Database (test%)
|
|
test
|
|
create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4));
|
|
insert into t1 values (1,1,1,0),(1,1,2,0),(1,1,3,0),(1,2,1,0),(1,2,2,0),(1,2,3,0),(1,3,1,0),(1,3,2,0),(1,3,3,0),(1,1,1,1),(1,1,2,1),(1,1,3,1),(1,2,1,1),(1,2,2,1),(1,2,3,1),(1,3,1,1),(1,3,2,1),(1,3,3,1);
|
|
analyze table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 analyze status OK
|
|
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 f1 A 1 NULL NULL BTREE
|
|
t1 0 PRIMARY 2 f2 A 3 NULL NULL BTREE
|
|
t1 0 PRIMARY 3 f3 A 9 NULL NULL BTREE
|
|
t1 0 PRIMARY 4 f4 A 18 NULL NULL BTREE
|
|
repair table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 repair status OK
|
|
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 f1 A 1 NULL NULL BTREE
|
|
t1 0 PRIMARY 2 f2 A 3 NULL NULL BTREE
|
|
t1 0 PRIMARY 3 f3 A 9 NULL NULL BTREE
|
|
t1 0 PRIMARY 4 f4 A 18 NULL NULL BTREE
|
|
drop table t1;
|
|
create temporary table t1 (a int not null);
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TEMPORARY TABLE `t1` (
|
|
`a` int(11) NOT NULL default '0'
|
|
) TYPE=MyISAM DEFAULT CHARSET=latin1
|
|
alter table t1 rename t2;
|
|
show create table t2;
|
|
Table Create Table
|
|
t2 CREATE TEMPORARY TABLE `t2` (
|
|
`a` int(11) NOT NULL default '0'
|
|
) TYPE=MyISAM DEFAULT CHARSET=latin1
|
|
drop table t2;
|
|
create table t1 (
|
|
test_set set( 'val1', 'val2', 'val3' ) not null default '',
|
|
name char(20) default 'O''Brien' comment 'O''Brien as default',
|
|
c int not null comment 'int column'
|
|
) comment = 'it\'s a table' ;
|
|
show create table t1 ;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`test_set` set('val1','val2','val3') NOT NULL default '',
|
|
`name` char(20) default 'O''Brien' COMMENT 'O''Brien as default',
|
|
`c` int(11) NOT NULL default '0' COMMENT 'int column'
|
|
) TYPE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
|
|
show full columns from t1;
|
|
Field Type Collation Null Key Default Extra Privileges Comment
|
|
test_set set('val1','val2','val3') latin1_swedish_ci select,insert,update,references
|
|
name char(20) latin1_swedish_ci YES O'Brien select,insert,update,references O'Brien as default
|
|
c int(11) NULL 0 select,insert,update,references int column
|
|
drop table t1;
|
|
create table t1 (a int not null, unique aa (a));
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL default '0',
|
|
UNIQUE KEY `aa` (`a`)
|
|
) TYPE=MyISAM DEFAULT CHARSET=latin1
|
|
drop table t1;
|
|
create table t1 (a int not null, primary key (a));
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL default '0',
|
|
PRIMARY KEY (`a`)
|
|
) TYPE=MyISAM DEFAULT CHARSET=latin1
|
|
drop table t1;
|
|
flush tables;
|
|
show open tables;
|
|
Database Table In_use Name_locked
|
|
create table t1(n int);
|
|
insert into t1 values (1);
|
|
show open tables;
|
|
Database Table In_use Name_locked
|
|
test t1 0 0
|
|
drop table t1;
|
|
create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL default '0',
|
|
`b` char(10) default NULL,
|
|
KEY `b` (`b`)
|
|
) TYPE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
|
|
alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0;
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL default '0',
|
|
`b` varchar(10) default NULL,
|
|
KEY `b` (`b`)
|
|
) TYPE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test'
|
|
ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default;
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL default '0',
|
|
`b` varchar(10) default NULL,
|
|
KEY `b` (`b`)
|
|
) TYPE=MyISAM DEFAULT CHARSET=latin1
|
|
drop table t1;
|
|
create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0));
|
|
show columns from t1;
|
|
Field Type Null Key Default Extra
|
|
a decimal(9,2) YES NULL
|
|
b decimal(9,0) YES NULL
|
|
e double(9,2) YES NULL
|
|
f double(5,0) YES NULL
|
|
h float(3,2) YES NULL
|
|
i float(3,0) YES NULL
|
|
show full columns from t1;
|
|
Field Type Collation Null Key Default Extra Privileges Comment
|
|
a decimal(9,2) NULL YES NULL select,insert,update,references
|
|
b decimal(9,0) NULL YES NULL select,insert,update,references
|
|
e double(9,2) NULL YES NULL select,insert,update,references
|
|
f double(5,0) NULL YES NULL select,insert,update,references
|
|
h float(3,2) NULL YES NULL select,insert,update,references
|
|
i float(3,0) NULL YES NULL select,insert,update,references
|
|
drop table t1;
|
|
create table t1 (
|
|
type_bool bool not null,
|
|
type_tiny tinyint not null auto_increment primary key,
|
|
type_short smallint(3),
|
|
type_mediumint mediumint,
|
|
type_bigint bigint,
|
|
type_decimal decimal(5,2),
|
|
type_numeric numeric(5,2),
|
|
empty_char char(0),
|
|
type_char char(2),
|
|
type_varchar varchar(10),
|
|
type_timestamp timestamp not null,
|
|
type_date date not null,
|
|
type_time time not null,
|
|
type_datetime datetime not null,
|
|
type_year year,
|
|
type_enum enum ('red', 'green', 'blue'),
|
|
type_set enum ('red', 'green', 'blue'),
|
|
type_tinyblob tinyblob,
|
|
type_blob blob,
|
|
type_medium_blob mediumblob,
|
|
type_long_blob longblob,
|
|
index(type_short)
|
|
) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1;
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`type_bool` tinyint(1) NOT NULL default '0',
|
|
`type_tiny` tinyint(4) NOT NULL auto_increment,
|
|
`type_short` smallint(3) default NULL,
|
|
`type_mediumint` mediumint(9) default NULL,
|
|
`type_bigint` bigint(20) default NULL,
|
|
`type_decimal` decimal(5,2) default NULL,
|
|
`type_numeric` decimal(5,2) default NULL,
|
|
`empty_char` char(0) default NULL,
|
|
`type_char` char(2) default NULL,
|
|
`type_varchar` varchar(10) default NULL,
|
|
`type_timestamp` timestamp NOT NULL,
|
|
`type_date` date NOT NULL default '0000-00-00',
|
|
`type_time` time NOT NULL default '00:00:00',
|
|
`type_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
`type_year` year(4) default NULL,
|
|
`type_enum` enum('red','green','blue') default NULL,
|
|
`type_set` enum('red','green','blue') default NULL,
|
|
`type_tinyblob` tinyblob,
|
|
`type_blob` blob,
|
|
`type_medium_blob` mediumblob,
|
|
`type_long_blob` longblob,
|
|
PRIMARY KEY (`type_tiny`),
|
|
KEY `type_short` (`type_short`)
|
|
) TYPE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
|
|
insert into t1 (type_timestamp) values ("2003-02-07 10:00:01");
|
|
select * from t1;
|
|
type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_numeric empty_char type_char type_varchar type_timestamp type_date type_time type_datetime type_year type_enum type_set type_tinyblob type_blob type_medium_blob type_long_blob
|
|
0 1 NULL NULL NULL NULL NULL NULL NULL NULL 2003-02-07 10:00:01 0000-00-00 00:00:00 0000-00-00 00:00:00 NULL NULL NULL NULL NULL NULL NULL
|
|
drop table t1;
|
|
create table t1 (a int not null);
|
|
create table t2 select max(a) from t1;
|
|
show columns from t2;
|
|
Field Type Null Key Default Extra
|
|
max(a) bigint(20) YES NULL
|
|
drop table t1,t2;
|
|
create table t1 (c decimal, d double, f float, r real);
|
|
show columns from t1;
|
|
Field Type Null Key Default Extra
|
|
c decimal(10,0) YES NULL
|
|
d double YES NULL
|
|
f float YES NULL
|
|
r double YES NULL
|
|
drop table t1;
|
|
create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
|
|
show columns from t1;
|
|
Field Type Null Key Default Extra
|
|
c decimal(4,3) YES NULL
|
|
d double(4,3) YES NULL
|
|
f float(4,3) YES NULL
|
|
drop table t1;
|