Commit 8998e128 authored by unknown's avatar unknown

Merge mysql.com:/home/jonas/src/wl2077

into mysql.com:/home/jonas/src/mysql-4.1


ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  Auto merged
ndb/src/ndbapi/NdbConnection.cpp:
  Auto merged
parents 3d52cdef 343b645b
...@@ -939,3 +939,4 @@ ndbcluster-1186/ndb_3_cluster.log ...@@ -939,3 +939,4 @@ ndbcluster-1186/ndb_3_cluster.log
ndbcluster-1186/ndb_3_out.log ndbcluster-1186/ndb_3_out.log
ndbcluster-1186/ndbcluster.pid ndbcluster-1186/ndbcluster.pid
ndb/tools/ndb_restore ndb/tools/ndb_restore
ac_available_languages_fragment
...@@ -115,7 +115,7 @@ LINK32=xilink6.exe ...@@ -115,7 +115,7 @@ LINK32=xilink6.exe
# Name "mysqladmin - Win32 classic" # Name "mysqladmin - Win32 classic"
# Begin Source File # Begin Source File
SOURCE=.\mysqladmin.c SOURCE=.\mysqladmin.cpp
# End Source File # End Source File
# End Target # End Target
# End Project # End Project
...@@ -69,7 +69,7 @@ static HA_ERRORS ha_errlist[]= ...@@ -69,7 +69,7 @@ static HA_ERRORS ha_errlist[]=
{ {
{ 120,"Didn't find key on read or update" }, { 120,"Didn't find key on read or update" },
{ 121,"Duplicate key on write or update" }, { 121,"Duplicate key on write or update" },
{ 123,"Someone has changed the row since it was read; Update with is recoverable" }, { 123,"Someone has changed the row since it was read (while the table was locked to prevent it)" },
{ 124,"Wrong index given to function" }, { 124,"Wrong index given to function" },
{ 126,"Index file is crashed" }, { 126,"Index file is crashed" },
{ 127,"Record-file is crashed" }, { 127,"Record-file is crashed" },
......
...@@ -52,6 +52,7 @@ int heap_rfirst(HP_INFO *info, byte *record, int inx) ...@@ -52,6 +52,7 @@ int heap_rfirst(HP_INFO *info, byte *record, int inx)
my_errno=HA_ERR_END_OF_FILE; my_errno=HA_ERR_END_OF_FILE;
DBUG_RETURN(my_errno); DBUG_RETURN(my_errno);
} }
DBUG_ASSERT(0); /* TODO fix it */
info->current_record=0; info->current_record=0;
info->current_hash_ptr=0; info->current_hash_ptr=0;
info->update=HA_STATE_PREV_FOUND; info->update=HA_STATE_PREV_FOUND;
......
...@@ -348,7 +348,7 @@ static void _ftb_init_index_search(FT_INFO *ftb) ...@@ -348,7 +348,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
FTB_EXPR *top_ftbe=ftbe->up->up; FTB_EXPR *top_ftbe=ftbe->up->up;
ftbw->docid[0]=HA_OFFSET_ERROR; ftbw->docid[0]=HA_OFFSET_ERROR;
for (ftbe=ftbw->up; ftbe != top_ftbe; ftbe=ftbe->up) for (ftbe=ftbw->up; ftbe != top_ftbe; ftbe=ftbe->up)
if (ftbe->flags & FTB_FLAG_YES) if (!(ftbe->flags & FTB_FLAG_NO))
ftbe->yweaks++; ftbe->yweaks++;
ftbe=0; ftbe=0;
break; break;
...@@ -356,7 +356,7 @@ static void _ftb_init_index_search(FT_INFO *ftb) ...@@ -356,7 +356,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
} }
if (!ftbe) if (!ftbe)
continue; continue;
/* 3 */ /* 4 */
if (!is_tree_inited(& ftb->no_dupes)) if (!is_tree_inited(& ftb->no_dupes))
init_tree(& ftb->no_dupes,0,0,sizeof(my_off_t), init_tree(& ftb->no_dupes,0,0,sizeof(my_off_t),
_ftb_no_dupes_cmp,0,0,0); _ftb_no_dupes_cmp,0,0,0);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* Create a MyISAM table */ /* Create a MyISAM table */
#include "fulltext.h" #include "ftdefs.h"
#include "sp_defs.h" #include "sp_defs.h"
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__)
...@@ -41,7 +41,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -41,7 +41,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
File dfile,file; File dfile,file;
int errpos,save_errno; int errpos,save_errno;
myf create_flag; myf create_flag;
uint fields,length,max_key_length,packed,pointer, uint fields,length,max_key_length,packed,pointer,real_length_diff,
key_length,info_length,key_segs,options,min_key_length_skip, key_length,info_length,key_segs,options,min_key_length_skip,
base_pos,varchar_count,long_varchar_count,varchar_length, base_pos,varchar_count,long_varchar_count,varchar_length,
max_key_block_length,unique_key_parts,fulltext_keys,offset; max_key_block_length,unique_key_parts,fulltext_keys,offset;
...@@ -238,7 +238,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -238,7 +238,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
{ {
share.state.key_root[i]= HA_OFFSET_ERROR; share.state.key_root[i]= HA_OFFSET_ERROR;
min_key_length_skip=length=0; min_key_length_skip=length=real_length_diff=0;
key_length=pointer; key_length=pointer;
if (keydef->flag & HA_SPATIAL) if (keydef->flag & HA_SPATIAL)
{ {
...@@ -297,6 +297,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -297,6 +297,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_length+= HA_FT_MAXBYTELEN+HA_FT_WLEN; key_length+= HA_FT_MAXBYTELEN+HA_FT_WLEN;
length++; /* At least one length byte */ length++; /* At least one length byte */
min_key_length_skip+=HA_FT_MAXBYTELEN; min_key_length_skip+=HA_FT_MAXBYTELEN;
real_length_diff=HA_FT_MAXBYTELEN-FT_MAX_WORD_LEN_FOR_SORT;
} }
else else
{ {
...@@ -397,7 +398,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -397,7 +398,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_segs) key_segs)
share.state.rec_per_key_part[key_segs-1]=1L; share.state.rec_per_key_part[key_segs-1]=1L;
length+=key_length; length+=key_length;
keydef->block_length= MI_BLOCK_SIZE(length,pointer,MI_MAX_KEYPTR_SIZE); keydef->block_length= MI_BLOCK_SIZE(length-real_length_diff,
pointer,MI_MAX_KEYPTR_SIZE);
if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH || if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH ||
length >= MI_MAX_KEY_BUFF) length >= MI_MAX_KEY_BUFF)
{ {
......
This diff is collapsed.
...@@ -16,12 +16,34 @@ SET AUTOCOMMIT=0; ...@@ -16,12 +16,34 @@ SET AUTOCOMMIT=0;
DELETE from t1; DELETE from t1;
SET AUTOCOMMIT=1; SET AUTOCOMMIT=1;
drop table t1; drop table t1;
create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); create table t1 (
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23); a bigint not null,
b bigint not null default 0,
c bigint not null default 0,
d bigint not null default 0,
e bigint not null default 0,
f bigint not null default 0,
g bigint not null default 0,
h bigint not null default 0,
i bigint not null default 0,
j bigint not null default 0,
primary key (a,b,c,d,e,f,g,h,i,j));
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
delete from t1 where a=26; delete from t1 where a=26;
drop table t1; drop table t1;
create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); create table t1 (
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); a bigint not null,
b bigint not null default 0,
c bigint not null default 0,
d bigint not null default 0,
e bigint not null default 0,
f bigint not null default 0,
g bigint not null default 0,
h bigint not null default 0,
i bigint not null default 0,
j bigint not null default 0,
primary key (a,b,c,d,e,f,g,h,i,j));
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27; delete from t1 where a=27;
drop table t1; drop table t1;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
......
...@@ -190,6 +190,14 @@ a ...@@ -190,6 +190,14 @@ a
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode); select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
a a
aaa10 bbb20 aaa10 bbb20
select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode);
a
aaa20 bbb15
aaa30 bbb10
select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode);
a
aaa20 bbb15
aaa30 bbb10
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
id int(11), id int(11),
......
...@@ -233,3 +233,10 @@ SELECT * FROM t1 WHERE B is not null; ...@@ -233,3 +233,10 @@ SELECT * FROM t1 WHERE B is not null;
a B a B
1 1 1 1
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (pseudo char(35) PRIMARY KEY, date int(10) unsigned NOT NULL) ENGINE=HEAP;
INSERT INTO t1 VALUES ('massecot',1101106491),('altec',1101106492),('stitch+',1101106304),('Seb Corgan',1101106305),('beerfilou',1101106263),('flaker',1101106529),('joce8',5),('M4vrick',1101106418),('gabay008',1101106525),('Vamp irX',1101106291),('ZoomZip',1101106546),('rip666',1101106502),('CBP ',1101106397),('guezpard',1101106496);
DELETE FROM t1 WHERE date<1101106546;
SELECT * FROM t1;
pseudo date
ZoomZip 1101106546
DROP TABLE t1;
...@@ -1630,3 +1630,21 @@ show status like "binlog_cache_disk_use"; ...@@ -1630,3 +1630,21 @@ show status like "binlog_cache_disk_use";
Variable_name Value Variable_name Value
Binlog_cache_disk_use 1 Binlog_cache_disk_use 1
drop table t1; drop table t1;
create table t1 (c char(10), index (c,c)) engine=innodb;
ERROR 42S21: Duplicate column name 'c'
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
ERROR 42S21: Duplicate column name 'c1'
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
ERROR 42S21: Duplicate column name 'c1'
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
ERROR 42S21: Duplicate column name 'c1'
create table t1 (c1 char(10), c2 char(10)) engine=innodb;
alter table t1 add key (c1,c1);
ERROR 42S21: Duplicate column name 'c1'
alter table t1 add key (c2,c1,c1);
ERROR 42S21: Duplicate column name 'c1'
alter table t1 add key (c1,c2,c1);
ERROR 42S21: Duplicate column name 'c1'
alter table t1 add key (c1,c1,c2);
ERROR 42S21: Duplicate column name 'c1'
drop table t1;
...@@ -307,3 +307,21 @@ test.t1 check status OK ...@@ -307,3 +307,21 @@ test.t1 check status OK
drop table t1; drop table t1;
create table t1 (c char(10), index (c(0))); create table t1 (c char(10), index (c(0)));
ERROR HY000: Key part 'c' length cannot be 0 ERROR HY000: Key part 'c' length cannot be 0
create table t1 (c char(10), index (c,c));
ERROR 42S21: Duplicate column name 'c'
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1));
ERROR 42S21: Duplicate column name 'c1'
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2));
ERROR 42S21: Duplicate column name 'c1'
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1));
ERROR 42S21: Duplicate column name 'c1'
create table t1 (c1 char(10), c2 char(10));
alter table t1 add key (c1,c1);
ERROR 42S21: Duplicate column name 'c1'
alter table t1 add key (c2,c1,c1);
ERROR 42S21: Duplicate column name 'c1'
alter table t1 add key (c1,c2,c1);
ERROR 42S21: Duplicate column name 'c1'
alter table t1 add key (c1,c1,c2);
ERROR 42S21: Duplicate column name 'c1'
drop table t1;
...@@ -221,7 +221,7 @@ update t1 set y=x; ...@@ -221,7 +221,7 @@ update t1 set y=x;
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0; explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where 1 SIMPLE t1 ref y y 5 const 1 Using where
1 SIMPLE t2 range x x 5 NULL 4 Using where 1 SIMPLE t2 range x x 5 NULL 4 Range checked for each record (index map: 0x1)
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0; explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where 1 SIMPLE t1 ref y y 5 const 1 Using where
...@@ -237,7 +237,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -237,7 +237,7 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y; explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where 1 SIMPLE t1 ref y y 5 const 1 Using where
1 SIMPLE t2 ALL x NULL NULL NULL 9 Using where 1 SIMPLE t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 0x1)
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y; explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where 1 SIMPLE t1 ref y y 5 const 1 Using where
......
...@@ -682,8 +682,8 @@ id txt ...@@ -682,8 +682,8 @@ id txt
3 NULL 3 NULL
1 Chevy 1 Chevy
drop table t1; drop table t1;
CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1))); CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,''); INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
select max(i) from t1 where c = ''; select max(i) from t1 where c = '';
max(i) max(i)
4 4
......
...@@ -29,12 +29,34 @@ drop table t1; ...@@ -29,12 +29,34 @@ drop table t1;
# (This assumes a block size of 1024) # (This assumes a block size of 1024)
# #
create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); create table t1 (
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23); a bigint not null,
b bigint not null default 0,
c bigint not null default 0,
d bigint not null default 0,
e bigint not null default 0,
f bigint not null default 0,
g bigint not null default 0,
h bigint not null default 0,
i bigint not null default 0,
j bigint not null default 0,
primary key (a,b,c,d,e,f,g,h,i,j));
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
delete from t1 where a=26; delete from t1 where a=26;
drop table t1; drop table t1;
create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); create table t1 (
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); a bigint not null,
b bigint not null default 0,
c bigint not null default 0,
d bigint not null default 0,
e bigint not null default 0,
f bigint not null default 0,
g bigint not null default 0,
h bigint not null default 0,
i bigint not null default 0,
j bigint not null default 0,
primary key (a,b,c,d,e,f,g,h,i,j));
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27; delete from t1 where a=27;
drop table t1; drop table t1;
......
...@@ -98,6 +98,8 @@ select * from t1 where match a against ("+aaa* +bbb*" in boolean mode); ...@@ -98,6 +98,8 @@ select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode); select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
select * from t1 where match a against ("+aaa* +ccc*" in boolean mode); select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode); select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode);
select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode);
drop table t1; drop table t1;
# #
......
...@@ -174,3 +174,14 @@ CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP; ...@@ -174,3 +174,14 @@ CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
INSERT INTO t1 VALUES(1,1), (1,NULL); INSERT INTO t1 VALUES(1,1), (1,NULL);
SELECT * FROM t1 WHERE B is not null; SELECT * FROM t1 WHERE B is not null;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #6748
# heap_rfirst() doesn't work (and never did!)
#
CREATE TABLE t1 (pseudo char(35) PRIMARY KEY, date int(10) unsigned NOT NULL) ENGINE=HEAP;
INSERT INTO t1 VALUES ('massecot',1101106491),('altec',1101106492),('stitch+',1101106304),('Seb Corgan',1101106305),('beerfilou',1101106263),('flaker',1101106529),('joce8',5),('M4vrick',1101106418),('gabay008',1101106525),('Vamp irX',1101106291),('ZoomZip',1101106546),('rip666',1101106502),('CBP ',1101106397),('guezpard',1101106496);
DELETE FROM t1 WHERE date<1101106546;
SELECT * FROM t1;
DROP TABLE t1;
...@@ -1158,3 +1158,25 @@ show status like "binlog_cache_use"; ...@@ -1158,3 +1158,25 @@ show status like "binlog_cache_use";
show status like "binlog_cache_disk_use"; show status like "binlog_cache_disk_use";
drop table t1; drop table t1;
#
# Bug #6126: Duplicate columns in keys gives misleading error message
#
--error 1060
create table t1 (c char(10), index (c,c)) engine=innodb;
--error 1060
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
--error 1060
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
--error 1060
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
create table t1 (c1 char(10), c2 char(10)) engine=innodb;
--error 1060
alter table t1 add key (c1,c1);
--error 1060
alter table t1 add key (c2,c1,c1);
--error 1060
alter table t1 add key (c1,c2,c1);
--error 1060
alter table t1 add key (c1,c1,c2);
drop table t1;
...@@ -297,3 +297,26 @@ drop table t1; ...@@ -297,3 +297,26 @@ drop table t1;
--error 1105 --error 1105
create table t1 (c char(10), index (c(0))); create table t1 (c char(10), index (c(0)));
#
# Bug #6126: Duplicate columns in keys should fail
# Bug #6252: (dup)
#
--error 1060
create table t1 (c char(10), index (c,c));
--error 1060
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1));
--error 1060
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2));
--error 1060
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1));
create table t1 (c1 char(10), c2 char(10));
--error 1060
alter table t1 add key (c1,c1);
--error 1060
alter table t1 add key (c2,c1,c1);
--error 1060
alter table t1 add key (c1,c2,c1);
--error 1060
alter table t1 add key (c1,c1,c2);
drop table t1;
...@@ -98,7 +98,7 @@ wait_for_slave_to_stop; ...@@ -98,7 +98,7 @@ wait_for_slave_to_stop;
# The following test can't be done because the result of Pos will differ # The following test can't be done because the result of Pos will differ
# on different computers # on different computers
# --replace_result 9306 9999 3334 9999 3335 9999 # --replace_result $MASTER_MYPORT MASTER_PORT
# show slave status; # show slave status;
set global sql_slave_skip_counter=1; set global sql_slave_skip_counter=1;
......
...@@ -369,8 +369,8 @@ explain select * from t1 where txt='Chevy' or txt is NULL order by txt; ...@@ -369,8 +369,8 @@ explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
select * from t1 where txt='Chevy' or txt is NULL order by txt; select * from t1 where txt='Chevy' or txt is NULL order by txt;
drop table t1; drop table t1;
CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1))); CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,''); INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
select max(i) from t1 where c = ''; select max(i) from t1 where c = '';
drop table t1; drop table t1;
......
...@@ -607,8 +607,8 @@ private: ...@@ -607,8 +607,8 @@ private:
NdbOperation* theLastExecOpInList; // Last executing operation in list. NdbOperation* theLastExecOpInList; // Last executing operation in list.
NdbOperation* theCompletedFirstOp; // First operation in completed NdbOperation* theCompletedFirstOp; // First & last operation in completed
// operation list. NdbOperation* theCompletedLastOp; // operation list.
Uint32 theNoOfOpSent; // How many operations have been sent Uint32 theNoOfOpSent; // How many operations have been sent
Uint32 theNoOfOpCompleted; // How many operations have completed Uint32 theNoOfOpCompleted; // How many operations have completed
......
...@@ -55,6 +55,7 @@ NdbConnection::NdbConnection( Ndb* aNdb ) : ...@@ -55,6 +55,7 @@ NdbConnection::NdbConnection( Ndb* aNdb ) :
theFirstExecOpInList(NULL), theFirstExecOpInList(NULL),
theLastExecOpInList(NULL), theLastExecOpInList(NULL),
theCompletedFirstOp(NULL), theCompletedFirstOp(NULL),
theCompletedLastOp(NULL),
theNoOfOpSent(0), theNoOfOpSent(0),
theNoOfOpCompleted(0), theNoOfOpCompleted(0),
theNoOfOpFetched(0), theNoOfOpFetched(0),
...@@ -124,6 +125,7 @@ NdbConnection::init() ...@@ -124,6 +125,7 @@ NdbConnection::init()
theLastExecOpInList = NULL; theLastExecOpInList = NULL;
theCompletedFirstOp = NULL; theCompletedFirstOp = NULL;
theCompletedLastOp = NULL;
theGlobalCheckpointId = 0; theGlobalCheckpointId = 0;
theCommitStatus = Started; theCommitStatus = Started;
...@@ -256,6 +258,8 @@ NdbConnection::handleExecuteCompletion() ...@@ -256,6 +258,8 @@ NdbConnection::handleExecuteCompletion()
if (tLastExecOp != NULL) { if (tLastExecOp != NULL) {
tLastExecOp->next(theCompletedFirstOp); tLastExecOp->next(theCompletedFirstOp);
theCompletedFirstOp = tFirstExecOp; theCompletedFirstOp = tFirstExecOp;
if (theCompletedLastOp == NULL)
theCompletedLastOp = tLastExecOp;
theFirstExecOpInList = NULL; theFirstExecOpInList = NULL;
theLastExecOpInList = NULL; theLastExecOpInList = NULL;
}//if }//if
...@@ -292,6 +296,8 @@ NdbConnection::execute(ExecType aTypeOfExec, ...@@ -292,6 +296,8 @@ NdbConnection::execute(ExecType aTypeOfExec,
ExecType tExecType; ExecType tExecType;
NdbOperation* tPrepOp; NdbOperation* tPrepOp;
NdbOperation* tCompletedFirstOp = NULL;
NdbOperation* tCompletedLastOp = NULL;
int ret = 0; int ret = 0;
do { do {
...@@ -314,6 +320,7 @@ NdbConnection::execute(ExecType aTypeOfExec, ...@@ -314,6 +320,7 @@ NdbConnection::execute(ExecType aTypeOfExec,
} }
tPrepOp = tPrepOp->next(); tPrepOp = tPrepOp->next();
} }
// save rest of prepared ops if batch // save rest of prepared ops if batch
NdbOperation* tRestOp= 0; NdbOperation* tRestOp= 0;
NdbOperation* tLastOp= 0; NdbOperation* tLastOp= 0;
...@@ -323,6 +330,7 @@ NdbConnection::execute(ExecType aTypeOfExec, ...@@ -323,6 +330,7 @@ NdbConnection::execute(ExecType aTypeOfExec,
tLastOp = theLastOpInList; tLastOp = theLastOpInList;
theLastOpInList = tPrepOp; theLastOpInList = tPrepOp;
} }
if (tExecType == Commit) { if (tExecType == Commit) {
NdbOperation* tOp = theCompletedFirstOp; NdbOperation* tOp = theCompletedFirstOp;
while (tOp != NULL) { while (tOp != NULL) {
...@@ -338,6 +346,19 @@ NdbConnection::execute(ExecType aTypeOfExec, ...@@ -338,6 +346,19 @@ NdbConnection::execute(ExecType aTypeOfExec,
} }
} }
// completed ops are in unspecified order
if (theCompletedFirstOp != NULL) {
if (tCompletedFirstOp == NULL) {
tCompletedFirstOp = theCompletedFirstOp;
tCompletedLastOp = theCompletedLastOp;
} else {
tCompletedLastOp->next(theCompletedFirstOp);
tCompletedLastOp = theCompletedLastOp;
}
theCompletedFirstOp = NULL;
theCompletedLastOp = NULL;
}
if (executeNoBlobs(tExecType, abortOption, forceSend) == -1) if (executeNoBlobs(tExecType, abortOption, forceSend) == -1)
ret = -1; ret = -1;
#ifndef VM_TRACE #ifndef VM_TRACE
...@@ -362,6 +383,7 @@ NdbConnection::execute(ExecType aTypeOfExec, ...@@ -362,6 +383,7 @@ NdbConnection::execute(ExecType aTypeOfExec,
tOp = tOp->next(); tOp = tOp->next();
} }
} }
// add saved prepared ops if batch // add saved prepared ops if batch
if (tPrepOp != NULL && tRestOp != NULL) { if (tPrepOp != NULL && tRestOp != NULL) {
if (theFirstOpInList == NULL) if (theFirstOpInList == NULL)
...@@ -373,6 +395,18 @@ NdbConnection::execute(ExecType aTypeOfExec, ...@@ -373,6 +395,18 @@ NdbConnection::execute(ExecType aTypeOfExec,
assert(theFirstOpInList == NULL || tExecType == NoCommit); assert(theFirstOpInList == NULL || tExecType == NoCommit);
} while (theFirstOpInList != NULL || tExecType != aTypeOfExec); } while (theFirstOpInList != NULL || tExecType != aTypeOfExec);
if (tCompletedFirstOp != NULL) {
tCompletedLastOp->next(theCompletedFirstOp);
theCompletedFirstOp = tCompletedFirstOp;
if (theCompletedLastOp == NULL)
theCompletedLastOp = tCompletedLastOp;
}
#if ndb_api_count_completed_ops_after_blob_execute
{ NdbOperation* tOp; unsigned n = 0;
for (tOp = theCompletedFirstOp; tOp != NULL; tOp = tOp->next()) n++;
ndbout << "completed ops: " << n << endl;
}
#endif
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
...@@ -894,6 +928,7 @@ NdbConnection::releaseOperations() ...@@ -894,6 +928,7 @@ NdbConnection::releaseOperations()
releaseOps(theFirstExecOpInList); releaseOps(theFirstExecOpInList);
theCompletedFirstOp = NULL; theCompletedFirstOp = NULL;
theCompletedLastOp = NULL;
theFirstOpInList = NULL; theFirstOpInList = NULL;
theFirstExecOpInList = NULL; theFirstExecOpInList = NULL;
theLastOpInList = NULL; theLastOpInList = NULL;
...@@ -909,6 +944,7 @@ NdbConnection::releaseCompletedOperations() ...@@ -909,6 +944,7 @@ NdbConnection::releaseCompletedOperations()
{ {
releaseOps(theCompletedFirstOp); releaseOps(theCompletedFirstOp);
theCompletedFirstOp = NULL; theCompletedFirstOp = NULL;
theCompletedLastOp = NULL;
}//NdbConnection::releaseOperations() }//NdbConnection::releaseOperations()
/****************************************************************************** /******************************************************************************
......
This diff is collapsed.
...@@ -953,8 +953,10 @@ int handler::read_first_row(byte * buf, uint primary_key) ...@@ -953,8 +953,10 @@ int handler::read_first_row(byte * buf, uint primary_key)
/* /*
If there is very few deleted rows in the table, find the first row by If there is very few deleted rows in the table, find the first row by
scanning the table. scanning the table.
TODO remove the test for HA_READ_ORDER
*/ */
if (deleted < 10 || primary_key >= MAX_KEY) if (deleted < 10 || primary_key >= MAX_KEY ||
!(index_flags(primary_key, 0, 0) & HA_READ_ORDER))
{ {
(void) ha_rnd_init(1); (void) ha_rnd_init(1);
while ((error= rnd_next(buf)) == HA_ERR_RECORD_DELETED) ; while ((error= rnd_next(buf)) == HA_ERR_RECORD_DELETED) ;
......
...@@ -468,6 +468,7 @@ Query_cache query_cache; ...@@ -468,6 +468,7 @@ Query_cache query_cache;
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
char *shared_memory_base_name= default_shared_memory_base_name; char *shared_memory_base_name= default_shared_memory_base_name;
bool opt_enable_shared_memory; bool opt_enable_shared_memory;
HANDLE smem_event_connect_request= 0;
#endif #endif
#include "sslopt-vars.h" #include "sslopt-vars.h"
...@@ -743,6 +744,15 @@ void kill_mysql(void) ...@@ -743,6 +744,15 @@ void kill_mysql(void)
CloseHandle(hEvent); CloseHandle(hEvent);
*/ */
} }
#ifdef HAVE_SMEM
/*
Send event to smem_event_connect_request for aborting
*/
if (!SetEvent(smem_event_connect_request))
{
DBUG_PRINT("error",("Got error: %ld from SetEvent of smem_event_connect_request",GetLastError()));
}
#endif
#endif #endif
#elif defined(OS2) #elif defined(OS2)
pthread_cond_signal( &eventShutdown); // post semaphore pthread_cond_signal( &eventShutdown); // post semaphore
...@@ -3705,7 +3715,6 @@ pthread_handler_decl(handle_connections_shared_memory,arg) ...@@ -3705,7 +3715,6 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
/* file-mapping object, use for create shared memory */ /* file-mapping object, use for create shared memory */
HANDLE handle_connect_file_map= 0; HANDLE handle_connect_file_map= 0;
char *handle_connect_map= 0; // pointer on shared memory char *handle_connect_map= 0; // pointer on shared memory
HANDLE event_connect_request= 0; // for start connection actions
HANDLE event_connect_answer= 0; HANDLE event_connect_answer= 0;
ulong smem_buffer_length= shared_memory_buffer_length + 4; ulong smem_buffer_length= shared_memory_buffer_length + 4;
ulong connect_number= 1; ulong connect_number= 1;
...@@ -3726,7 +3735,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg) ...@@ -3726,7 +3735,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
*/ */
suffix_pos= strxmov(tmp,shared_memory_base_name,"_",NullS); suffix_pos= strxmov(tmp,shared_memory_base_name,"_",NullS);
strmov(suffix_pos, "CONNECT_REQUEST"); strmov(suffix_pos, "CONNECT_REQUEST");
if ((event_connect_request= CreateEvent(0,FALSE,FALSE,tmp)) == 0) if ((smem_event_connect_request= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
{ {
errmsg= "Could not create request event"; errmsg= "Could not create request event";
goto error; goto error;
...@@ -3757,7 +3766,13 @@ pthread_handler_decl(handle_connections_shared_memory,arg) ...@@ -3757,7 +3766,13 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
while (!abort_loop) while (!abort_loop)
{ {
/* Wait a request from client */ /* Wait a request from client */
WaitForSingleObject(event_connect_request,INFINITE); WaitForSingleObject(smem_event_connect_request,INFINITE);
/*
it can be after shutdown command
*/
if (abort_loop)
goto error;
HANDLE handle_client_file_map= 0; HANDLE handle_client_file_map= 0;
char *handle_client_map= 0; char *handle_client_map= 0;
...@@ -3882,7 +3897,7 @@ error: ...@@ -3882,7 +3897,7 @@ error:
if (handle_connect_map) UnmapViewOfFile(handle_connect_map); if (handle_connect_map) UnmapViewOfFile(handle_connect_map);
if (handle_connect_file_map) CloseHandle(handle_connect_file_map); if (handle_connect_file_map) CloseHandle(handle_connect_file_map);
if (event_connect_answer) CloseHandle(event_connect_answer); if (event_connect_answer) CloseHandle(event_connect_answer);
if (event_connect_request) CloseHandle(event_connect_request); if (smem_event_connect_request) CloseHandle(smem_event_connect_request);
decrement_handler_count(); decrement_handler_count();
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -2154,7 +2154,7 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, COND *cond, ...@@ -2154,7 +2154,7 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, COND *cond,
bool is_const=1; bool is_const=1;
for (uint i=0; i<num_values; i++) for (uint i=0; i<num_values; i++)
is_const&= (*value)->const_item(); is_const&= value[i]->const_item();
if (is_const) if (is_const)
stat[0].const_keys.merge(possible_keys); stat[0].const_keys.merge(possible_keys);
/* /*
......
...@@ -835,7 +835,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -835,7 +835,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
#endif #endif
} }
List_iterator<key_part_spec> cols(key->columns); List_iterator<key_part_spec> cols(key->columns), cols2(key->columns);
CHARSET_INFO *ft_key_charset=0; // for FULLTEXT CHARSET_INFO *ft_key_charset=0; // for FULLTEXT
for (uint column_nr=0 ; (column=cols++) ; column_nr++) for (uint column_nr=0 ; (column=cols++) ; column_nr++)
{ {
...@@ -853,6 +853,19 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -853,6 +853,19 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
column->field_name); column->field_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
for (uint dup_nr= 0; dup_nr < column_nr; dup_nr++)
{
key_part_spec *dup_column= cols2++;
if (!my_strcasecmp(system_charset_info,
column->field_name, dup_column->field_name))
{
my_printf_error(ER_DUP_FIELDNAME,
ER(ER_DUP_FIELDNAME),MYF(0),
column->field_name);
DBUG_RETURN(-1);
}
}
cols2.rewind();
/* for fulltext keys keyseg length is 1 for blobs (it's ignored in /* for fulltext keys keyseg length is 1 for blobs (it's ignored in
ft code anyway, and 0 (set to column width later) for char's. ft code anyway, and 0 (set to column width later) for char's.
it has to be correct col width for char's, as char data are not it has to be correct col width for char's, as char data are not
......
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