Commit 3ddc1f99 authored by monty@mysql.com's avatar monty@mysql.com

Merge mysql.com:/home/my/mysql-5.0

into  mysql.com:/home/my/mysql-5.1
parents 86b2be8d 1809adee
...@@ -364,6 +364,10 @@ SOURCE=..\sql-common\my_time.c ...@@ -364,6 +364,10 @@ SOURCE=..\sql-common\my_time.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\sql-common\my_user.c
# End Source File
# Begin Source File
SOURCE=..\sql\net_serv.cpp SOURCE=..\sql\net_serv.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -338,6 +338,10 @@ SOURCE="..\sql-common\my_time.c" ...@@ -338,6 +338,10 @@ SOURCE="..\sql-common\my_time.c"
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE="..\sql-common\my_user.c"
# End Source File
# Begin Source File
SOURCE=..\sql\net_serv.cpp SOURCE=..\sql\net_serv.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -84,7 +84,7 @@ TREE_ELEMENT *tree_insert(TREE *tree,void *key, uint key_size, ...@@ -84,7 +84,7 @@ TREE_ELEMENT *tree_insert(TREE *tree,void *key, uint key_size,
void *tree_search(TREE *tree, void *key, void *custom_arg); void *tree_search(TREE *tree, void *key, void *custom_arg);
int tree_walk(TREE *tree,tree_walk_action action, int tree_walk(TREE *tree,tree_walk_action action,
void *argument, TREE_WALK visit); void *argument, TREE_WALK visit);
int tree_delete(TREE *tree, void *key, void *custom_arg); int tree_delete(TREE *tree, void *key, uint key_size, void *custom_arg);
void *tree_search_key(TREE *tree, const void *key, void *tree_search_key(TREE *tree, const void *key,
TREE_ELEMENT **parents, TREE_ELEMENT ***last_pos, TREE_ELEMENT **parents, TREE_ELEMENT ***last_pos,
enum ha_rkey_function flag, void *custom_arg); enum ha_rkey_function flag, void *custom_arg);
......
...@@ -46,4 +46,12 @@ Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_ ...@@ -46,4 +46,12 @@ Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_
execute stmt1; execute stmt1;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype 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; deallocate prepare stmt1;
create temporary table t1(a int, index(a));
insert into t1 values('1'),('2'),('3'),('4'),('5');
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 1 a 1 a A 5 NULL NULL YES BTREE
drop table t1; drop table t1;
...@@ -246,3 +246,13 @@ DELETE from t1 where a < 100; ...@@ -246,3 +246,13 @@ DELETE from t1 where a < 100;
SELECT * from t1; SELECT * from t1;
a a
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(val INT, KEY USING BTREE(val)) ENGINE=memory;
INSERT INTO t1 VALUES(0);
SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1';
INDEX_LENGTH
21
UPDATE t1 SET val=1;
SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1';
INDEX_LENGTH
21
DROP TABLE t1;
...@@ -3455,3 +3455,5 @@ SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; ...@@ -3455,3 +3455,5 @@ SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
a a
1 1
drop table t2, t1; drop table t2, t1;
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
ERROR HY000: The used table type doesn't support SPATIAL indexes
...@@ -481,14 +481,22 @@ msg text NOT NULL ...@@ -481,14 +481,22 @@ msg text NOT NULL
insert into t1 (msg) values( insert into t1 (msg) values(
'Tries to validate (8 byte length + inline bytes) as UTF8 :( 'Tries to validate (8 byte length + inline bytes) as UTF8 :(
Fast fix: removed validation for Text. It is not yet indexable Fast fix: removed validation for Text. It is not yet indexable
so bad data will not crash kernel. so bad data will not crash kernel.');
Proper fix: Set inline bytes to multiple of mbmaxlen and
validate it (after the 8 byte length).');
select * from t1; select * from t1;
id msg id msg
1 Tries to validate (8 byte length + inline bytes) as UTF8 :( 1 Tries to validate (8 byte length + inline bytes) as UTF8 :(
Fast fix: removed validation for Text. It is not yet indexable Fast fix: removed validation for Text. It is not yet indexable
so bad data will not crash kernel. so bad data will not crash kernel.
Proper fix: Set inline bytes to multiple of mbmaxlen and drop table t1;
validate it (after the 8 byte length). create table t1 (
a int primary key not null auto_increment,
b text
) engine=ndbcluster;
select count(*) from t1;
count(*)
500
truncate t1;
select count(*) from t1;
count(*)
0
drop table t1; drop table t1;
drop table if exists t1,t3;
drop procedure if exists bug4902| drop procedure if exists bug4902|
create procedure bug4902() create procedure bug4902()
begin begin
......
...@@ -61,6 +61,14 @@ prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()"; ...@@ -61,6 +61,14 @@ prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()";
execute stmt1; execute stmt1;
execute stmt1; execute stmt1;
deallocate prepare stmt1; deallocate prepare stmt1;
#
# bug#15225 (ANALYZE temporary has no effect)
#
create temporary table t1(a int, index(a));
insert into t1 values('1'),('2'),('3'),('4'),('5');
analyze table t1;
show index from t1;
drop table t1; drop table t1;
# End of 4.1 tests # End of 4.1 tests
...@@ -164,4 +164,16 @@ DELETE from t1 where a < 100; ...@@ -164,4 +164,16 @@ DELETE from t1 where a < 100;
SELECT * from t1; SELECT * from t1;
DROP TABLE t1; DROP TABLE t1;
#
# BUG#18160 - Memory-/HEAP Table endless growing indexes
#
CREATE TABLE t1(val INT, KEY USING BTREE(val)) ENGINE=memory;
INSERT INTO t1 VALUES(0);
--replace_result 37 21
SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1';
UPDATE t1 SET val=1;
--replace_result 37 21
SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1';
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
...@@ -2494,3 +2494,9 @@ SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; ...@@ -2494,3 +2494,9 @@ SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
drop table t2, t1; drop table t2, t1;
#
# Bug #15680 (SPATIAL key in innodb)
#
--error ER_TABLE_CANT_HANDLE_SPKEYS
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
...@@ -403,10 +403,29 @@ create table t1 ( ...@@ -403,10 +403,29 @@ create table t1 (
insert into t1 (msg) values( insert into t1 (msg) values(
'Tries to validate (8 byte length + inline bytes) as UTF8 :( 'Tries to validate (8 byte length + inline bytes) as UTF8 :(
Fast fix: removed validation for Text. It is not yet indexable Fast fix: removed validation for Text. It is not yet indexable
so bad data will not crash kernel. so bad data will not crash kernel.');
Proper fix: Set inline bytes to multiple of mbmaxlen and
validate it (after the 8 byte length).');
select * from t1; select * from t1;
drop table t1; drop table t1;
# -- bug #19201
create table t1 (
a int primary key not null auto_increment,
b text
) engine=ndbcluster;
--disable_query_log
set autocommit=1;
# more rows than batch size (64)
# for this bug no blob parts would be necessary
let $1 = 500;
while ($1)
{
insert into t1 (b) values (repeat('x',4000));
dec $1;
}
--enable_query_log
select count(*) from t1;
truncate t1;
select count(*) from t1;
drop table t1;
# End of 4.1 tests # End of 4.1 tests
# Can't test with embedded server # Can't test with embedded server
-- source include/not_embedded.inc -- source include/not_embedded.inc
--sleep 2
--disable_warnings
drop table if exists t1,t3;
--enable_warnings
delimiter |; delimiter |;
# #
......
...@@ -271,7 +271,7 @@ TREE_ELEMENT *tree_insert(TREE *tree, void *key, uint key_size, ...@@ -271,7 +271,7 @@ TREE_ELEMENT *tree_insert(TREE *tree, void *key, uint key_size,
return element; return element;
} }
int tree_delete(TREE *tree, void *key, void *custom_arg) int tree_delete(TREE *tree, void *key, uint key_size, void *custom_arg)
{ {
int cmp,remove_colour; int cmp,remove_colour;
TREE_ELEMENT *element,***parent, ***org_parent, *nod; TREE_ELEMENT *element,***parent, ***org_parent, *nod;
...@@ -326,8 +326,7 @@ int tree_delete(TREE *tree, void *key, void *custom_arg) ...@@ -326,8 +326,7 @@ int tree_delete(TREE *tree, void *key, void *custom_arg)
rb_delete_fixup(tree,parent); rb_delete_fixup(tree,parent);
if (tree->free) if (tree->free)
(*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg); (*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg);
/* This doesn't include key_size, but better than nothing */ tree->allocated-= sizeof(TREE_ELEMENT) + tree->size_of_element + key_size;
tree->allocated-= sizeof(TREE_ELEMENT)+tree->size_of_element;
my_free((gptr) element,MYF(0)); my_free((gptr) element,MYF(0));
tree->elements_in_tree--; tree->elements_in_tree--;
return 0; return 0;
......
...@@ -194,7 +194,7 @@ ha_myisam::ha_myisam(TABLE_SHARE *table_arg) ...@@ -194,7 +194,7 @@ ha_myisam::ha_myisam(TABLE_SHARE *table_arg)
int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
HA_DUPP_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_DUPP_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
HA_FILE_BASED | HA_CAN_GEOMETRY | HA_READ_RND_SAME | HA_FILE_BASED | HA_CAN_GEOMETRY | HA_READ_RND_SAME |
HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD), HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD | HA_CAN_RTREEKEYS),
can_enable_indexes(1) can_enable_indexes(1)
{} {}
......
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
access on the table based on a given record. access on the table based on a given record.
*/ */
#define HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS (1 << 16) #define HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS (1 << 16)
#define HA_CAN_RTREEKEYS (1 << 17)
#define HA_NOT_DELETE_WITH_CACHE (1 << 18) #define HA_NOT_DELETE_WITH_CACHE (1 << 18)
#define HA_NO_PREFIX_CHAR_KEYS (1 << 20) #define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
#define HA_CAN_FULLTEXT (1 << 21) #define HA_CAN_FULLTEXT (1 << 21)
......
...@@ -2978,52 +2978,52 @@ ER_UDF_EXISTS ...@@ -2978,52 +2978,52 @@ ER_UDF_EXISTS
swe "Funktionen '%-.64s' finns redan" swe "Funktionen '%-.64s' finns redan"
ukr "æ '%-.64s' դ" ukr "æ '%-.64s' դ"
ER_CANT_OPEN_LIBRARY ER_CANT_OPEN_LIBRARY
cze "Nemohu otev-Bt sdlenou knihovnu '%-.64s' (errno: %d %s)" cze "Nemohu otev-Bt sdlenou knihovnu '%-.64s' (errno: %d %-.128s)"
dan "Kan ikke bne delt bibliotek '%-.64s' (errno: %d %s)" dan "Kan ikke bne delt bibliotek '%-.64s' (errno: %d %-.128s)"
nla "Kan shared library '%-.64s' niet openen (Errcode: %d %s)" nla "Kan shared library '%-.64s' niet openen (Errcode: %d %-.128s)"
eng "Can't open shared library '%-.64s' (errno: %d %s)" eng "Can't open shared library '%-.64s' (errno: %d %-.128s)"
jps "shared library '%-.64s' Jł܂ (errno: %d %s)", jps "shared library '%-.64s' Jł܂ (errno: %d %-.128s)",
est "Ei suuda avada jagatud teeki '%-.64s' (veakood: %d %s)" est "Ei suuda avada jagatud teeki '%-.64s' (veakood: %d %-.128s)"
fre "Impossible d'ouvrir la bibliothque partage '%-.64s' (errno: %d %s)" fre "Impossible d'ouvrir la bibliothque partage '%-.64s' (errno: %d %-.128s)"
ger "Kann Shared Library '%-.64s' nicht ffnen (Fehler: %d %s)" ger "Kann Shared Library '%-.64s' nicht ffnen (Fehler: %d %-.128s)"
greek " shared library '%-.64s' ( : %d %s)" greek " shared library '%-.64s' ( : %d %-.128s)"
hun "A(z) '%-.64s' megosztott konyvtar nem hasznalhato (hibakod: %d %s)" hun "A(z) '%-.64s' megosztott konyvtar nem hasznalhato (hibakod: %d %-.128s)"
ita "Impossibile aprire la libreria condivisa '%-.64s' (errno: %d %s)" ita "Impossibile aprire la libreria condivisa '%-.64s' (errno: %d %-.128s)"
jpn "shared library '%-.64s' 򳫤Ǥޤ (errno: %d %s)" jpn "shared library '%-.64s' 򳫤Ǥޤ (errno: %d %-.128s)"
kor "'%-.64s' ̹ ϴ.(ȣ: %d %s)" kor "'%-.64s' ̹ ϴ.(ȣ: %d %-.128s)"
nor "Can't open shared library '%-.64s' (errno: %d %s)" nor "Can't open shared library '%-.64s' (errno: %d %-.128s)"
norwegian-ny "Can't open shared library '%-.64s' (errno: %d %s)" norwegian-ny "Can't open shared library '%-.64s' (errno: %d %-.128s)"
pol "Can't open shared library '%-.64s' (errno: %d %s)" pol "Can't open shared library '%-.64s' (errno: %d %-.128s)"
por "No pode abrir biblioteca compartilhada '%-.64s' (erro no. '%d' - '%-.64s')" por "No pode abrir biblioteca compartilhada '%-.64s' (erro no. %d '%-.128s')"
rum "Nu pot deschide libraria shared '%-.64s' (Eroare: %d %s)" rum "Nu pot deschide libraria shared '%-.64s' (Eroare: %d %-.128s)"
rus " '%-.64s' (: %d %s)" rus " '%-.64s' (: %d %-.128s)"
serbian "Ne mogu da otvorim share-ovanu biblioteku '%-.64s' (errno: %d %s)" serbian "Ne mogu da otvorim share-ovanu biblioteku '%-.64s' (errno: %d %-.128s)"
slo "Nemem otvori zdiean kninicu '%-.64s' (chybov kd: %d %s)" slo "Nemem otvori zdiean kninicu '%-.64s' (chybov kd: %d %-.128s)"
spa "No puedo abrir libraria conjugada '%-.64s' (errno: %d %s)" spa "No puedo abrir libraria conjugada '%-.64s' (errno: %d %-.128s)"
swe "Kan inte ppna det dynamiska biblioteket '%-.64s' (Felkod: %d %s)" swe "Kan inte ppna det dynamiska biblioteket '%-.64s' (Felkod: %d %-.128s)"
ukr " צ Ħ ¦̦ '%-.64s' (: %d %s)" ukr " צ Ħ ¦̦ '%-.64s' (: %d %-.128s)"
ER_CANT_FIND_DL_ENTRY ER_CANT_FIND_DL_ENTRY
cze "Nemohu naj-Bt funkci '%-.64s' v knihovn" cze "Nemohu naj-Bt funkci '%-.128s' v knihovn"
dan "Kan ikke finde funktionen '%-.64s' i bibliotek" dan "Kan ikke finde funktionen '%-.128s' i bibliotek"
nla "Kan functie '%-.64s' niet in library vinden" nla "Kan functie '%-.128s' niet in library vinden"
eng "Can't find symbol '%-.64s' in library" eng "Can't find symbol '%-.128s' in library"
jps "function '%-.64s' Cu[Ɍt鎖ł܂", jps "function '%-.128s' Cu[Ɍt鎖ł܂",
est "Ei leia funktsiooni '%-.64s' antud teegis" est "Ei leia funktsiooni '%-.128s' antud teegis"
fre "Impossible de trouver la fonction '%-.64s' dans la bibliothque" fre "Impossible de trouver la fonction '%-.128s' dans la bibliothque"
ger "Kann Funktion '%-.64s' in der Library nicht finden" ger "Kann Funktion '%-.128s' in der Library nicht finden"
greek " '%-.64s' " greek " '%-.128s' "
hun "A(z) '%-.64s' fuggveny nem talalhato a konyvtarban" hun "A(z) '%-.128s' fuggveny nem talalhato a konyvtarban"
ita "Impossibile trovare la funzione '%-.64s' nella libreria" ita "Impossibile trovare la funzione '%-.128s' nella libreria"
jpn "function '%-.64s' 饤֥꡼˸դǤޤ" jpn "function '%-.128s' 饤֥꡼˸դǤޤ"
kor "̹ '%-.64s' Լ ã ϴ." kor "̹ '%-.128s' Լ ã ϴ."
por "No pode encontrar a funo '%-.64s' na biblioteca" por "No pode encontrar a funo '%-.128s' na biblioteca"
rum "Nu pot gasi functia '%-.64s' in libraria" rum "Nu pot gasi functia '%-.128s' in libraria"
rus " '%-.64s' " rus " '%-.128s' "
serbian "Ne mogu da pronadjem funkciju '%-.64s' u biblioteci" serbian "Ne mogu da pronadjem funkciju '%-.128s' u biblioteci"
slo "Nemem njs funkciu '%-.64s' v kninici" slo "Nemem njs funkciu '%-.128s' v kninici"
spa "No puedo encontrar funcin '%-.64s' en libraria" spa "No puedo encontrar funcin '%-.128s' en libraria"
swe "Hittar inte funktionen '%-.64s' in det dynamiska biblioteket" swe "Hittar inte funktionen '%-.128s' in det dynamiska biblioteket"
ukr " æ '%-.64s' ¦̦æ" ukr " æ '%-.128s' ¦̦æ"
ER_FUNCTION_NOT_DEFINED ER_FUNCTION_NOT_DEFINED
cze "Funkce '%-.64s' nen-B definovna" cze "Funkce '%-.64s' nen-B definovna"
dan "Funktionen '%-.64s' er ikke defineret" dan "Funktionen '%-.64s' er ikke defineret"
...@@ -4898,7 +4898,10 @@ ER_WARN_NULL_TO_NOTNULL 22004 ...@@ -4898,7 +4898,10 @@ ER_WARN_NULL_TO_NOTNULL 22004
por "Dado truncado, NULL fornecido para NOT NULL coluna '%s' na linha %ld" por "Dado truncado, NULL fornecido para NOT NULL coluna '%s' na linha %ld"
spa "Datos truncado, NULL suministrado para NOT NULL columna '%s' en la lnea %ld" spa "Datos truncado, NULL suministrado para NOT NULL columna '%s' en la lnea %ld"
ER_WARN_DATA_OUT_OF_RANGE 22003 ER_WARN_DATA_OUT_OF_RANGE 22003
eng "Out of range value for column '%s' at row %ld" eng "Out of range value adjusted for column '%s' at row %ld"
ger "Daten abgeschnitten, auerhalb des Wertebereichs fr Feld '%s' in Zeile %ld"
por "Dado truncado, fora de alcance para coluna '%s' na linha %ld"
spa "Datos truncados, fuera de gama para columna '%s' en la lnea %ld"
WARN_DATA_TRUNCATED 01000 WARN_DATA_TRUNCATED 01000
eng "Data truncated for column '%s' at row %ld" eng "Data truncated for column '%s' at row %ld"
ger "Daten abgeschnitten fr Feld '%s' in Zeile %ld" ger "Daten abgeschnitten fr Feld '%s' in Zeile %ld"
...@@ -5602,6 +5605,25 @@ ER_SP_RECURSION_LIMIT ...@@ -5602,6 +5605,25 @@ ER_SP_RECURSION_LIMIT
ger "Rekursionsgrenze %d (durch Variable max_sp_recursion_depth gegeben) wurde fr Routine %.64s berschritten" ger "Rekursionsgrenze %d (durch Variable max_sp_recursion_depth gegeben) wurde fr Routine %.64s berschritten"
ER_SP_PROC_TABLE_CORRUPT ER_SP_PROC_TABLE_CORRUPT
eng "Failed to load routine %-.64s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)" eng "Failed to load routine %-.64s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)"
ER_SP_WRONG_NAME 42000
eng "Incorrect routine name '%-.64s'"
ER_TABLE_NEEDS_UPGRADE
eng "Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\" to fix it!"
ER_SP_NO_AGGREGATE 42000
eng "AGGREGATE is not supported for stored functions"
ER_MAX_PREPARED_STMT_COUNT_REACHED 42000
eng "Can't create more than max_prepared_stmt_count statements (current value: %lu)"
ER_VIEW_RECURSIVE
eng "`%-.64s`.`%-.64s` contains view recursion"
ER_NON_GROUPING_FIELD_USED 42000
eng "non-grouping field '%-.64s' is used in %-.64s clause"
ER_TABLE_CANT_HANDLE_SPKEYS
eng "The used table type doesn't support SPATIAL indexes"
ER_WARN_DEPRECATED_SYNTAX
eng "The syntax '%s' is deprecated and will be removed in MySQL %s. Please use %s instead."
ger "'%s' ist veraltet. Bitte benutzen Sie '%s'"
por "'%s' desatualizado. Use '%s' em seu lugar"
spa "'%s' est desaprobado, use '%s' en su lugar"
ER_PARTITION_REQUIRES_VALUES_ERROR ER_PARTITION_REQUIRES_VALUES_ERROR
eng "%-.64s PARTITIONING requires definition of VALUES %-.64s for each partition" eng "%-.64s PARTITIONING requires definition of VALUES %-.64s for each partition"
swe "%-.64s PARTITIONering krver definition av VALUES %-.64s fr varje partition" swe "%-.64s PARTITIONering krver definition av VALUES %-.64s fr varje partition"
...@@ -5802,28 +5824,10 @@ ER_CANT_WRITE_LOCK_LOG_TABLE ...@@ -5802,28 +5824,10 @@ ER_CANT_WRITE_LOCK_LOG_TABLE
eng "You can't write-lock a log table. Only read access is possible." eng "You can't write-lock a log table. Only read access is possible."
ER_CANT_READ_LOCK_LOG_TABLE ER_CANT_READ_LOCK_LOG_TABLE
eng "You can't use usual read lock with log tables. Try READ LOCAL instead." eng "You can't use usual read lock with log tables. Try READ LOCAL instead."
ER_SP_WRONG_NAME 42000
eng "Incorrect routine name '%-.64s'"
ER_FOREIGN_DUPLICATE_KEY 23000 S1009 ER_FOREIGN_DUPLICATE_KEY 23000 S1009
eng "Upholding foreign key constraints for table '%.64s', entry '%-.64s', key %d would lead to a duplicate entry" eng "Upholding foreign key constraints for table '%.64s', entry '%-.64s', key %d would lead to a duplicate entry"
ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE
eng "Column count of mysql.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use scripts/mysql_fix_privilege_tables" eng "Column count of mysql.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use scripts/mysql_fix_privilege_tables"
ER_TABLE_NEEDS_UPGRADE
eng "Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\" to fix it!"
ER_ILLEGAL_HA_CREATE_OPTION
eng "Table storage engine '%-.64s' does not support the create option '%.64s'"
ER_CANT_CHANGE_TX_ISOLATION 25001
eng "Transaction isolation level can't be changed while a transaction is in progress"
ER_WARN_DEPRECATED
eng "The syntax '%s' is deprecated and will be removed in MySQL %s. Please use %s instead."
ER_SP_NO_AGGREGATE 42000
eng "AGGREGATE is not supported for stored functions"
ER_MAX_PREPARED_STMT_COUNT_REACHED 42000
eng "Can't create more than max_prepared_stmt_count statements (current value: %lu)"
ER_VIEW_RECURSIVE
eng "`%-.64s`.`%-.64s` contains view recursion"
ER_NON_GROUPING_FIELD_USED 42000
eng "non-grouping field '%-.64s' is used in %-.64s clause"
ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
eng "Cannot switch out of the row-based binary log format when the session has open temporary tables" eng "Cannot switch out of the row-based binary log format when the session has open temporary tables"
ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT
...@@ -5840,3 +5844,7 @@ ER_NULL_IN_VALUES_LESS_THAN ...@@ -5840,3 +5844,7 @@ ER_NULL_IN_VALUES_LESS_THAN
ER_WRONG_PARTITION_NAME ER_WRONG_PARTITION_NAME
eng "Incorrect partition name" eng "Incorrect partition name"
swe "Felaktigt partitionsnamn" swe "Felaktigt partitionsnamn"
ER_ILLEGAL_HA_CREATE_OPTION
eng "Table storage engine '%-.64s' does not support the create option '%.64s'"
ER_CANT_CHANGE_TX_ISOLATION 25001
eng "Transaction isolation level can't be changed while a transaction is in progress"
...@@ -268,7 +268,6 @@ db_find_routine_aux(THD *thd, int type, sp_name *name, TABLE *table) ...@@ -268,7 +268,6 @@ db_find_routine_aux(THD *thd, int type, sp_name *name, TABLE *table)
static int static int
db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp) db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
{ {
extern int MYSQLparse(void *thd);
TABLE *table; TABLE *table;
const char *params, *returns, *body; const char *params, *returns, *body;
int ret; int ret;
...@@ -477,6 +476,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, ...@@ -477,6 +476,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
(*sphp)->optimize(); (*sphp)->optimize();
} }
end: end:
lex_end(thd->lex);
thd->spcont= old_spcont; thd->spcont= old_spcont;
thd->variables.sql_mode= old_sql_mode; thd->variables.sql_mode= old_sql_mode;
thd->variables.select_limit= old_select_limit; thd->variables.select_limit= old_select_limit;
......
...@@ -680,6 +680,7 @@ sp_head::destroy() ...@@ -680,6 +680,7 @@ sp_head::destroy()
DBUG_ASSERT(m_lex.is_empty() || m_thd); DBUG_ASSERT(m_lex.is_empty() || m_thd);
while ((lex= (LEX *)m_lex.pop())) while ((lex= (LEX *)m_lex.pop()))
{ {
lex_end(m_thd->lex);
delete m_thd->lex; delete m_thd->lex;
m_thd->lex= lex; m_thd->lex= lex;
} }
...@@ -1682,7 +1683,10 @@ sp_head::restore_lex(THD *thd) ...@@ -1682,7 +1683,10 @@ sp_head::restore_lex(THD *thd)
*/ */
merge_table_list(thd, sublex->query_tables, sublex); merge_table_list(thd, sublex->query_tables, sublex);
if (! sublex->sp_lex_in_use) if (! sublex->sp_lex_in_use)
{
lex_end(sublex);
delete sublex; delete sublex;
}
thd->lex= oldlex; thd->lex= oldlex;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -521,8 +521,11 @@ public: ...@@ -521,8 +521,11 @@ public:
virtual ~sp_lex_keeper() virtual ~sp_lex_keeper()
{ {
if (m_lex_resp) if (m_lex_resp)
{
lex_end(m_lex);
delete m_lex; delete m_lex;
} }
}
/* /*
Prepare execution of instruction using LEX, if requested check whenever Prepare execution of instruction using LEX, if requested check whenever
......
...@@ -2563,6 +2563,12 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -2563,6 +2563,12 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
/* TODO: Add proper checks if handler supports key_type and algorithm */ /* TODO: Add proper checks if handler supports key_type and algorithm */
if (key_info->flags & HA_SPATIAL) if (key_info->flags & HA_SPATIAL)
{ {
if (!(file->table_flags() & HA_CAN_RTREEKEYS))
{
my_message(ER_TABLE_CANT_HANDLE_SPKEYS, ER(ER_TABLE_CANT_HANDLE_SPKEYS),
MYF(0));
DBUG_RETURN(-1);
}
if (key_info->key_parts != 1) if (key_info->key_parts != 1)
{ {
my_error(ER_WRONG_ARGUMENTS, MYF(0), "SPATIAL INDEX"); my_error(ER_WRONG_ARGUMENTS, MYF(0), "SPATIAL INDEX");
...@@ -3572,7 +3578,9 @@ mysql_rename_table(handlerton *base, ...@@ -3572,7 +3578,9 @@ mysql_rename_table(handlerton *base,
} }
} }
delete file; delete file;
if (error) if (error == HA_ERR_WRONG_COMMAND)
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "ALTER TABLE");
else if (error)
my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error); my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error);
DBUG_RETURN(error != 0); DBUG_RETURN(error != 0);
} }
...@@ -4216,12 +4224,17 @@ send_result_message: ...@@ -4216,12 +4224,17 @@ send_result_message:
if (fatal_error) if (fatal_error)
table->table->s->version=0; // Force close of table table->table->s->version=0; // Force close of table
else if (open_for_modify && !table->table->s->log_table) else if (open_for_modify && !table->table->s->log_table)
{
if (table->table->s->tmp_table)
table->table->file->info(HA_STATUS_CONST);
else
{ {
pthread_mutex_lock(&LOCK_open); pthread_mutex_lock(&LOCK_open);
remove_table_from_cache(thd, table->table->s->db.str, remove_table_from_cache(thd, table->table->s->db.str,
table->table->s->table_name.str, RTFC_NO_FLAG); table->table->s->table_name.str, RTFC_NO_FLAG);
pthread_mutex_unlock(&LOCK_open); pthread_mutex_unlock(&LOCK_open);
/* Something may be modified, that's why we have to invalidate cache */ }
/* May be something modified consequently we have to invalidate cache */
query_cache_invalidate3(thd, table->table, 0); query_cache_invalidate3(thd, table->table, 0);
} }
} }
......
...@@ -79,7 +79,8 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, ...@@ -79,7 +79,8 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
custom_arg.key_length= hp_rb_make_key(keyinfo, info->recbuf, record, recpos); custom_arg.key_length= hp_rb_make_key(keyinfo, info->recbuf, record, recpos);
custom_arg.search_flag= SEARCH_SAME; custom_arg.search_flag= SEARCH_SAME;
old_allocated= keyinfo->rb_tree.allocated; old_allocated= keyinfo->rb_tree.allocated;
res= tree_delete(&keyinfo->rb_tree, info->recbuf, &custom_arg); res= tree_delete(&keyinfo->rb_tree, info->recbuf, custom_arg.key_length,
&custom_arg);
info->s->index_length-= (old_allocated - keyinfo->rb_tree.allocated); info->s->index_length-= (old_allocated - keyinfo->rb_tree.allocated);
return res; return res;
} }
......
...@@ -127,7 +127,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, ...@@ -127,7 +127,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
} }
if (keyseg->flag & HA_VAR_LENGTH_PART) if (keyseg->flag & HA_VAR_LENGTH_PART)
{ {
uint pack_length= keyseg->bit_start; uint pack_length= (keyseg->bit_start == 1 ? 1 : 2);
uint tmp_length= (pack_length == 1 ? (uint) *(uchar*) pos : uint tmp_length= (pack_length == 1 ? (uint) *(uchar*) pos :
uint2korr(pos)); uint2korr(pos));
pos+= pack_length; /* Skip VARCHAR length */ pos+= pack_length; /* Skip VARCHAR length */
......
...@@ -475,7 +475,7 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -475,7 +475,7 @@ static int examine_log(my_string file_name, char **table_names)
{ {
if (!curr_file_info->closed) if (!curr_file_info->closed)
files_open--; files_open--;
VOID(tree_delete(&tree, (gptr) curr_file_info, tree.custom_arg)); VOID(tree_delete(&tree, (gptr) curr_file_info, 0, tree.custom_arg));
} }
break; break;
case MI_LOG_EXTRA: case MI_LOG_EXTRA:
......
...@@ -39,6 +39,7 @@ class TcKeyReq { ...@@ -39,6 +39,7 @@ class TcKeyReq {
friend class NdbOperation; friend class NdbOperation;
friend class NdbIndexOperation; friend class NdbIndexOperation;
friend class NdbScanOperation; friend class NdbScanOperation;
friend class NdbBlob;
friend class DbUtil; friend class DbUtil;
/** /**
......
...@@ -326,6 +326,7 @@ private: ...@@ -326,6 +326,7 @@ private:
bool isWriteOp(); bool isWriteOp();
bool isDeleteOp(); bool isDeleteOp();
bool isScanOp(); bool isScanOp();
bool isTakeOverOp();
// computations // computations
Uint32 getPartNumber(Uint64 pos); Uint32 getPartNumber(Uint64 pos);
Uint32 getPartCount(); Uint32 getPartCount();
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <NdbBlob.hpp> #include <NdbBlob.hpp>
#include "NdbBlobImpl.hpp" #include "NdbBlobImpl.hpp"
#include <NdbScanOperation.hpp> #include <NdbScanOperation.hpp>
#include <signaldata/TcKeyReq.hpp>
#include <NdbEventOperationImpl.hpp> #include <NdbEventOperationImpl.hpp>
/* /*
...@@ -392,6 +393,13 @@ NdbBlob::isScanOp() ...@@ -392,6 +393,13 @@ NdbBlob::isScanOp()
theNdbOp->theOperationType == NdbOperation::OpenRangeScanRequest; theNdbOp->theOperationType == NdbOperation::OpenRangeScanRequest;
} }
inline bool
NdbBlob::isTakeOverOp()
{
return
TcKeyReq::getTakeOverScanFlag(theNdbOp->theScanInfo);
}
// computations (inline) // computations (inline)
inline Uint32 inline Uint32
...@@ -1527,8 +1535,22 @@ NdbBlob::preExecute(NdbTransaction::ExecType anExecType, bool& batch) ...@@ -1527,8 +1535,22 @@ NdbBlob::preExecute(NdbTransaction::ExecType anExecType, bool& batch)
if (isUpdateOp() || isWriteOp() || isDeleteOp()) { if (isUpdateOp() || isWriteOp() || isDeleteOp()) {
// add operation before this one to read head+inline // add operation before this one to read head+inline
NdbOperation* tOp = theNdbCon->getNdbOperation(theTable, theNdbOp); NdbOperation* tOp = theNdbCon->getNdbOperation(theTable, theNdbOp);
/*
* If main op is from take over scan lock, the added read is done
* as committed read:
*
* In normal transactional case, the row is locked by us and
* committed read returns same as normal read.
*
* In current TRUNCATE TABLE, the deleting trans is committed in
* batches and then restarted with new trans id. A normal read
* would hang on the scan delete lock and then fail.
*/
NdbOperation::LockMode lockMode =
! isTakeOverOp() ?
NdbOperation::LM_Read : NdbOperation::LM_CommittedRead;
if (tOp == NULL || if (tOp == NULL ||
tOp->readTuple() == -1 || tOp->readTuple(lockMode) == -1 ||
setTableKeyValue(tOp) == -1 || setTableKeyValue(tOp) == -1 ||
getHeadInlineValue(tOp) == -1) { getHeadInlineValue(tOp) == -1) {
setErrorCode(tOp); setErrorCode(tOp);
......
...@@ -44,6 +44,7 @@ struct Opt { ...@@ -44,6 +44,7 @@ struct Opt {
bool m_dbg; bool m_dbg;
bool m_dbgall; bool m_dbgall;
const char* m_dbug; const char* m_dbug;
bool m_fac;
bool m_full; bool m_full;
unsigned m_loop; unsigned m_loop;
unsigned m_parts; unsigned m_parts;
...@@ -72,6 +73,7 @@ struct Opt { ...@@ -72,6 +73,7 @@ struct Opt {
m_dbg(false), m_dbg(false),
m_dbgall(false), m_dbgall(false),
m_dbug(0), m_dbug(0),
m_fac(false),
m_full(false), m_full(false),
m_loop(1), m_loop(1),
m_parts(10), m_parts(10),
...@@ -110,6 +112,7 @@ printusage() ...@@ -110,6 +112,7 @@ printusage()
<< " -dbg print debug" << endl << " -dbg print debug" << endl
<< " -dbgall print also NDB API debug (if compiled in)" << endl << " -dbgall print also NDB API debug (if compiled in)" << endl
<< " -dbug opt dbug options" << endl << " -dbug opt dbug options" << endl
<< " -fac fetch across commit in scan delete [" << d.m_fac << "]" << endl
<< " -full read/write only full blob values" << endl << " -full read/write only full blob values" << endl
<< " -loop N loop N times 0=forever [" << d.m_loop << "]" << endl << " -loop N loop N times 0=forever [" << d.m_loop << "]" << endl
<< " -parts N max parts in blob value [" << d.m_parts << "]" << endl << " -parts N max parts in blob value [" << d.m_parts << "]" << endl
...@@ -1255,23 +1258,11 @@ deleteScan(bool idx) ...@@ -1255,23 +1258,11 @@ deleteScan(bool idx)
CHK((ret = g_ops->nextResult(false)) == 0 || ret == 1 || ret == 2); CHK((ret = g_ops->nextResult(false)) == 0 || ret == 1 || ret == 2);
if (++n == g_opt.m_batch || ret == 2) { if (++n == g_opt.m_batch || ret == 2) {
DBG("execute batch: n=" << n << " ret=" << ret); DBG("execute batch: n=" << n << " ret=" << ret);
switch (0) { if (! g_opt.m_fac) {
case 0: // works normally
CHK(g_con->execute(NoCommit) == 0); CHK(g_con->execute(NoCommit) == 0);
CHK(true || g_con->restart() == 0); } else {
break;
case 1: // nonsense - g_con is invalid for 2nd batch
CHK(g_con->execute(Commit) == 0);
CHK(true || g_con->restart() == 0);
break;
case 2: // DBTC sendSignalErrorRefuseLab
CHK(g_con->execute(NoCommit) == 0);
CHK(g_con->restart() == 0);
break;
case 3: // 266 time-out
CHK(g_con->execute(Commit) == 0); CHK(g_con->execute(Commit) == 0);
CHK(g_con->restart() == 0); CHK(g_con->restart() == 0);
break;
} }
n = 0; n = 0;
} }
...@@ -1817,6 +1808,10 @@ NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535) ...@@ -1817,6 +1808,10 @@ NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
continue; continue;
} }
} }
if (strcmp(arg, "-fac") == 0) {
g_opt.m_fac = true;
continue;
}
if (strcmp(arg, "-full") == 0) { if (strcmp(arg, "-full") == 0) {
g_opt.m_full = true; g_opt.m_full = true;
continue; continue;
......
...@@ -23,17 +23,21 @@ ...@@ -23,17 +23,21 @@
#include <NDBT.hpp> #include <NDBT.hpp>
static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab,
bool commit_across_open_cursor, int parallelism=240); bool fetch_across_commit, int parallelism=240);
NDB_STD_OPTS_VARS; NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB"; static const char* _dbname = "TEST_DB";
static my_bool _transactional = false;
static struct my_option my_long_options[] = static struct my_option my_long_options[] =
{ {
NDB_STD_OPTS("ndb_desc"), NDB_STD_OPTS("ndb_desc"),
{ "database", 'd', "Name of database table is in", { "database", 'd', "Name of database table is in",
(gptr*) &_dbname, (gptr*) &_dbname, 0, (gptr*) &_dbname, (gptr*) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "transactional", 't', "Single transaction (may run out of operations)",
(gptr*) &_transactional, (gptr*) &_transactional, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };
static void usage() static void usage()
...@@ -84,18 +88,11 @@ int main(int argc, char** argv){ ...@@ -84,18 +88,11 @@ int main(int argc, char** argv){
ndbout << " Table " << argv[i] << " does not exist!" << endl; ndbout << " Table " << argv[i] << " does not exist!" << endl;
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
} }
// Check if we have any blobs ndbout << "Deleting all from " << argv[i];
bool commit_across_open_cursor = true; if (! _transactional)
for (int j = 0; j < pTab->getNoOfColumns(); j++) { ndbout << " (non-transactional)";
NdbDictionary::Column::Type t = pTab->getColumn(j)->getType(); ndbout << " ...";
if (t == NdbDictionary::Column::Blob || if(clear_table(&MyNdb, pTab, ! _transactional) == NDBT_FAILED){
t == NdbDictionary::Column::Text) {
commit_across_open_cursor = false;
break;
}
}
ndbout << "Deleting all from " << argv[i] << "...";
if(clear_table(&MyNdb, pTab, commit_across_open_cursor) == NDBT_FAILED){
res = NDBT_FAILED; res = NDBT_FAILED;
ndbout << "FAILED" << endl; ndbout << "FAILED" << endl;
} }
...@@ -105,7 +102,7 @@ int main(int argc, char** argv){ ...@@ -105,7 +102,7 @@ int main(int argc, char** argv){
int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab,
bool commit_across_open_cursor, int parallelism) bool fetch_across_commit, int parallelism)
{ {
// Scan all records exclusive and delete // Scan all records exclusive and delete
// them one by one // them one by one
...@@ -167,7 +164,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, ...@@ -167,7 +164,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab,
} while((check = pOp->nextResult(false)) == 0); } while((check = pOp->nextResult(false)) == 0);
if(check != -1){ if(check != -1){
if (commit_across_open_cursor) { if (fetch_across_commit) {
check = pTrans->execute(NdbTransaction::Commit); check = pTrans->execute(NdbTransaction::Commit);
pTrans->restart(); // new tx id pTrans->restart(); // new tx id
} else { } else {
...@@ -198,7 +195,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, ...@@ -198,7 +195,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab,
} }
goto failed; goto failed;
} }
if (! commit_across_open_cursor && if (! fetch_across_commit &&
pTrans->execute(NdbTransaction::Commit) != 0) { pTrans->execute(NdbTransaction::Commit) != 0) {
err = pTrans->getNdbError(); err = pTrans->getNdbError();
goto failed; goto failed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment