mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 03:47:17 +02:00
merge
This commit is contained in:
commit
914bbdca50
80 changed files with 1286 additions and 8623 deletions
|
|
@ -29,4 +29,3 @@ 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_finish_scan(MYRG_INFO *info, int inx, enum ha_rkey_function type);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key,
|
|||
MYRG_TABLE *table;
|
||||
MI_INFO *mi;
|
||||
int err;
|
||||
byte *buf=((search_flag == HA_READ_KEY_EXACT) ? record: 0);
|
||||
LINT_INIT(key_buff);
|
||||
LINT_INIT(pack_key_length);
|
||||
|
||||
|
|
@ -57,14 +56,14 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key,
|
|||
|
||||
if (table == info->open_tables)
|
||||
{
|
||||
err=mi_rkey(mi,buf,inx,key,key_len,search_flag);
|
||||
err=mi_rkey(mi,0,inx,key,key_len,search_flag);
|
||||
key_buff=(byte*) mi->lastkey+mi->s->base.max_key_length;
|
||||
pack_key_length=mi->last_rkey_length;
|
||||
}
|
||||
else
|
||||
{
|
||||
mi->use_packed_key=1;
|
||||
err=mi_rkey(mi,buf,inx,key_buff,pack_key_length,search_flag);
|
||||
err=mi_rkey(mi,0,inx,key_buff,pack_key_length,search_flag);
|
||||
mi->use_packed_key=0;
|
||||
}
|
||||
info->last_used_table=table+1;
|
||||
|
|
@ -78,12 +77,6 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key,
|
|||
/* adding to queue */
|
||||
queue_insert(&(info->by_key),(byte *)table);
|
||||
|
||||
/* if looking for KEY_EXACT, return first matched now */
|
||||
if (buf)
|
||||
{
|
||||
info->current_table=table;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!info->by_key.elements)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,11 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx)
|
|||
if ((err=mi_rnext(info->current_table->table,NULL,inx)))
|
||||
{
|
||||
if (err == HA_ERR_END_OF_FILE)
|
||||
{
|
||||
queue_remove(&(info->by_key),0);
|
||||
if (!info->by_key.elements)
|
||||
return HA_ERR_END_OF_FILE;
|
||||
}
|
||||
else
|
||||
return err;
|
||||
}
|
||||
|
|
@ -40,48 +44,7 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx)
|
|||
queue_replaced(&(info->by_key));
|
||||
}
|
||||
|
||||
/* next, let's finish myrg_rkey's initial scan */
|
||||
if ((err=_myrg_finish_scan(info, inx, HA_READ_KEY_OR_NEXT)))
|
||||
return err;
|
||||
|
||||
if (!info->by_key.elements)
|
||||
return HA_ERR_END_OF_FILE;
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
|
||||
/* let's finish myrg_rkey's initial scan */
|
||||
|
||||
int _myrg_finish_scan(MYRG_INFO *info, int inx, enum ha_rkey_function type)
|
||||
{
|
||||
int err;
|
||||
MYRG_TABLE *table=info->last_used_table;
|
||||
if (table < info->end_table)
|
||||
{
|
||||
MI_INFO *mi= table[-1].table;
|
||||
byte *key_buff=(byte*) mi->lastkey+mi->s->base.max_key_length;
|
||||
uint pack_key_length= mi->last_rkey_length;
|
||||
|
||||
for (; table < info->end_table ; table++)
|
||||
{
|
||||
mi=table->table;
|
||||
mi->use_packed_key=1;
|
||||
err=mi_rkey(mi,NULL,inx,key_buff,pack_key_length,type);
|
||||
mi->use_packed_key=0;
|
||||
if (err)
|
||||
{
|
||||
if (err == HA_ERR_KEY_NOT_FOUND) /* If end of file */
|
||||
continue;
|
||||
return err;
|
||||
}
|
||||
/* Found here, adding to queue */
|
||||
queue_insert(&(info->by_key),(byte *) table);
|
||||
}
|
||||
/* All tables are now used */
|
||||
info->last_used_table=table;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,11 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx)
|
|||
if ((err=mi_rprev(info->current_table->table,NULL,inx)))
|
||||
{
|
||||
if (err == HA_ERR_END_OF_FILE)
|
||||
{
|
||||
queue_remove(&(info->by_key),0);
|
||||
if (!info->by_key.elements)
|
||||
return HA_ERR_END_OF_FILE;
|
||||
}
|
||||
else
|
||||
return err;
|
||||
}
|
||||
|
|
@ -40,16 +44,7 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx)
|
|||
queue_replaced(&(info->by_key));
|
||||
}
|
||||
|
||||
/* next, let's finish myrg_rkey's initial scan */
|
||||
if ((err=_myrg_finish_scan(info, inx, HA_READ_KEY_OR_PREV)))
|
||||
return err;
|
||||
|
||||
if (!info->by_key.elements)
|
||||
return HA_ERR_END_OF_FILE;
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
|
|||
isam_info->update&= HA_STATE_CHANGED;
|
||||
DBUG_RETURN((*isam_info->s->read_rnd)
|
||||
(isam_info, (byte*) buf,
|
||||
(ha_rows) (filepos - info->current_table->file_offset),
|
||||
(my_off_t) (filepos - info->current_table->file_offset),
|
||||
0));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue