Merge bk-internal:/home/bk/mysql-4.0/
into serg.mylan:/usr/home/serg/Abk/mysql-4.0
This commit is contained in:
commit
5ac7f31b57
@ -299,7 +299,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
|
||||
default_charset_info :
|
||||
info->s->keyinfo[keynr].seg->charset);
|
||||
ftb->with_scan=0;
|
||||
ftb->lastpos=0;
|
||||
ftb->lastpos=HA_POS_ERROR;
|
||||
bzero(& ftb->no_dupes, sizeof(TREE));
|
||||
|
||||
init_alloc_root(&ftb->mem_root, 1024, 1024);
|
||||
@ -543,7 +543,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
|
||||
if (!ftb->queue.elements)
|
||||
return 0;
|
||||
|
||||
if (ftb->state != INDEX_SEARCH && docid < ftb->lastpos)
|
||||
if (ftb->state != INDEX_SEARCH && docid <= ftb->lastpos)
|
||||
{
|
||||
FTB_EXPR *x;
|
||||
uint i;
|
||||
|
@ -3562,11 +3562,12 @@ int update_state_info(MI_CHECK *param, MI_INFO *info,uint update)
|
||||
uint i, key_parts= mi_uint2korr(share->state.header.key_parts);
|
||||
share->state.rec_per_key_rows=info->state->records;
|
||||
share->state.changed&= ~STATE_NOT_ANALYZED;
|
||||
for (i=0; i<key_parts; i++)
|
||||
{
|
||||
if (!(share->state.rec_per_key_part[i]=param->rec_per_key_part[i]))
|
||||
share->state.changed|= STATE_NOT_ANALYZED;
|
||||
}
|
||||
if (info->state->records)
|
||||
for (i=0; i<key_parts; i++)
|
||||
{
|
||||
if (!(share->state.rec_per_key_part[i]=param->rec_per_key_part[i]))
|
||||
share->state.changed|= STATE_NOT_ANALYZED;
|
||||
}
|
||||
}
|
||||
if (update & (UPDATE_STAT | UPDATE_SORT | UPDATE_TIME | UPDATE_AUTO_INC))
|
||||
{
|
||||
|
@ -357,11 +357,15 @@ static void usage(void)
|
||||
-e, --extend-check Check the table VERY throughly. Only use this in\n\
|
||||
extreme cases as myisamchk should normally be able to\n\
|
||||
find out if the table is ok even without this switch\n\
|
||||
-F, --fast Check only tables that haven't been closed properly\n\
|
||||
-C, --check-only-changed\n\
|
||||
Check only tables that have changed since last check\n\
|
||||
-F, --fast Check only tables that haven't been closed properly.\n\
|
||||
It also applies to other requested actions (e.g. --analyze\n\
|
||||
will be ignored if the table is already analyzed).\n\
|
||||
-f, --force Restart with '-r' if there are any errors in the table.\n\
|
||||
States will be updated as with '--update-state'\n\
|
||||
-C, --check-only-changed\n\
|
||||
Check only tables that have changed since last check.\n\
|
||||
It also applies to other requested actions (e.g. --analyze\n\
|
||||
will be ignored if the table is already analyzed).\n\
|
||||
-i, --information Print statistics information about table that is checked\n\
|
||||
-m, --medium-check Faster than extend-check, but only finds 99.99% of\n\
|
||||
all errors. Should be good enough for most cases\n\
|
||||
|
@ -29,3 +29,5 @@ extern pthread_mutex_t THR_LOCK_open;
|
||||
#endif
|
||||
|
||||
int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag);
|
||||
int _myrg_mi_read_record(MI_INFO *info, byte *buf);
|
||||
|
||||
|
@ -14,8 +14,6 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/* Read record based on a key */
|
||||
|
||||
#include "myrg_def.h"
|
||||
|
||||
static int queue_key_cmp(void *keyseg, byte *a, byte *b)
|
||||
@ -55,3 +53,13 @@ int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag)
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int _myrg_mi_read_record(MI_INFO *info, byte *buf)
|
||||
{
|
||||
if (!(*info->read_record)(info,info->lastpos,buf))
|
||||
{
|
||||
info->update|= HA_STATE_AKTIV; /* Record is read */
|
||||
return 0;
|
||||
}
|
||||
return my_errno;
|
||||
}
|
||||
|
@ -45,5 +45,5 @@ int myrg_rfirst(MYRG_INFO *info, byte *buf, int inx)
|
||||
return HA_ERR_END_OF_FILE;
|
||||
|
||||
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
|
||||
return mi_rrnd(mi,buf,mi->lastpos);
|
||||
return _myrg_mi_read_record(mi,buf);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
SerG
|
||||
*/
|
||||
|
||||
int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key,
|
||||
int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
|
||||
uint key_len, enum ha_rkey_function search_flag)
|
||||
{
|
||||
byte *key_buff;
|
||||
@ -83,5 +83,5 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key,
|
||||
return HA_ERR_KEY_NOT_FOUND;
|
||||
|
||||
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
|
||||
return mi_rrnd(mi,record,mi->lastpos);
|
||||
return _myrg_mi_read_record(mi,buf);
|
||||
}
|
||||
|
@ -45,6 +45,6 @@ int myrg_rlast(MYRG_INFO *info, byte *buf, int inx)
|
||||
return HA_ERR_END_OF_FILE;
|
||||
|
||||
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
|
||||
return mi_rrnd(mi,buf,mi->lastpos);
|
||||
return _myrg_mi_read_record(mi,buf);
|
||||
}
|
||||
|
||||
|
@ -49,5 +49,5 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx)
|
||||
|
||||
/* now, mymerge's read_next is as simple as one queue_top */
|
||||
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
|
||||
return mi_rrnd(mi,buf,mi->lastpos);
|
||||
return _myrg_mi_read_record(mi,buf);
|
||||
}
|
||||
|
@ -49,5 +49,5 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx)
|
||||
|
||||
/* now, mymerge's read_prev is as simple as one queue_top */
|
||||
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
|
||||
return mi_rrnd(mi,buf,mi->lastpos);
|
||||
return _myrg_mi_read_record(mi,buf);
|
||||
}
|
||||
|
@ -256,3 +256,14 @@ select ref_mag from t1 where match ref_mag against ('+test' in boolean mode);
|
||||
ref_mag
|
||||
test
|
||||
drop table t1;
|
||||
create table t1 (t1_id int(11) primary key, name varchar(32));
|
||||
insert into t1 values (1, 'data1');
|
||||
insert into t1 values (2, 'data2');
|
||||
create table t2 (t2_id int(11) primary key, t1_id int(11), name varchar(32));
|
||||
insert into t2 values (1, 1, 'xxfoo');
|
||||
insert into t2 values (2, 1, 'xxbar');
|
||||
insert into t2 values (3, 1, 'xxbuz');
|
||||
select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode);
|
||||
t1_id name t2_id t1_id name
|
||||
1 data1 1 1 xxfoo
|
||||
drop table t1,t2;
|
||||
|
@ -3508,3 +3508,23 @@ aa id t2_id id
|
||||
5 8303 2520 2520
|
||||
6 8304 2521 2521
|
||||
drop table t1,t2;
|
||||
create table t1 (id1 int NOT NULL);
|
||||
create table t2 (id2 int NOT NULL);
|
||||
create table t3 (id3 int NOT NULL);
|
||||
create table t4 (id4 int NOT NULL, id44 int NOT NULL, KEY (id4));
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2);
|
||||
insert into t2 values (1);
|
||||
insert into t4 values (1,1);
|
||||
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
|
||||
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t3 system NULL NULL NULL NULL 0 const row not found
|
||||
t1 ALL NULL NULL NULL NULL 2
|
||||
t2 ALL NULL NULL NULL NULL 1
|
||||
t4 ALL id4 NULL NULL NULL 1 Using where
|
||||
select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
|
||||
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
|
||||
id1 id2 id3 id4 id44
|
||||
1 1 NULL NULL NULL
|
||||
drop table t1,t2,t3,t4;
|
||||
|
@ -189,7 +189,7 @@ select * from t1 where match (a) against ('aaaa');
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# bug 283 by jocelyn fournier <joc@presence-pc.com>
|
||||
# bug #283 by jocelyn fournier <joc@presence-pc.com>
|
||||
# FULLTEXT index on a TEXT filed converted to a CHAR field doesn't work anymore
|
||||
#
|
||||
|
||||
@ -201,3 +201,17 @@ alter table t1 change ref_mag ref_mag char (255) not null;
|
||||
select ref_mag from t1 where match ref_mag against ('+test' in boolean mode);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# bug #942: JOIN
|
||||
#
|
||||
|
||||
create table t1 (t1_id int(11) primary key, name varchar(32));
|
||||
insert into t1 values (1, 'data1');
|
||||
insert into t1 values (2, 'data2');
|
||||
create table t2 (t2_id int(11) primary key, t1_id int(11), name varchar(32));
|
||||
insert into t2 values (1, 1, 'xxfoo');
|
||||
insert into t2 values (2, 1, 'xxbar');
|
||||
insert into t2 values (3, 1, 'xxbuz');
|
||||
select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode);
|
||||
drop table t1,t2;
|
||||
|
||||
|
@ -1832,3 +1832,23 @@ INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522);
|
||||
select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# outer join, impossible on condition, where, and usable key for range
|
||||
#
|
||||
create table t1 (id1 int NOT NULL);
|
||||
create table t2 (id2 int NOT NULL);
|
||||
create table t3 (id3 int NOT NULL);
|
||||
create table t4 (id4 int NOT NULL, id44 int NOT NULL, KEY (id4));
|
||||
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2);
|
||||
insert into t2 values (1);
|
||||
insert into t4 values (1,1);
|
||||
|
||||
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
|
||||
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
|
||||
select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
|
||||
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
|
||||
|
||||
drop table t1,t2,t3,t4;
|
||||
|
||||
|
@ -2641,9 +2641,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
||||
join->thd->select_limit < join->best_positions[i].records_read &&
|
||||
!(join->select_options & OPTION_FOUND_ROWS)))
|
||||
{
|
||||
/* Join with outer join condition */
|
||||
COND *orig_cond=sel->cond;
|
||||
sel->cond=and_conds(sel->cond,tab->on_expr);
|
||||
if (sel->test_quick_select(tab->keys,
|
||||
used_tables & ~ current_map,
|
||||
(join->select_options &
|
||||
@ -2651,7 +2648,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
||||
HA_POS_ERROR :
|
||||
join->thd->select_limit)) < 0)
|
||||
DBUG_RETURN(1); // Impossible range
|
||||
sel->cond=orig_cond;
|
||||
/* Fix for EXPLAIN */
|
||||
if (sel->quick)
|
||||
join->best_positions[i].records_read= sel->quick->records;
|
||||
|
Loading…
x
Reference in New Issue
Block a user