mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03:00
Merge
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
jani@prima.mysql.com
|
jani@prima.mysql.com
|
||||||
|
serg@serg.mysql.com
|
||||||
|
@@ -30,5 +30,3 @@ extern pthread_mutex_t THR_LOCK_open;
|
|||||||
|
|
||||||
int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag);
|
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);
|
int _myrg_finish_scan(MYRG_INFO *info, int inx, enum ha_rkey_function type);
|
||||||
MYRG_TABLE *_myrg_find_table(MYRG_INFO *info, ulonglong pos);
|
|
||||||
|
|
||||||
|
@@ -26,6 +26,8 @@ int myrg_extra(MYRG_INFO *info,enum ha_extra_function function)
|
|||||||
{
|
{
|
||||||
int error,save_error=0;
|
int error,save_error=0;
|
||||||
MYRG_TABLE *file;
|
MYRG_TABLE *file;
|
||||||
|
DBUG_ENTER("myrg_extra");
|
||||||
|
DBUG_PRINT("info",("function: %d",(ulong) function));
|
||||||
|
|
||||||
if (function == HA_EXTRA_CACHE)
|
if (function == HA_EXTRA_CACHE)
|
||||||
info->cache_in_use=1;
|
info->cache_in_use=1;
|
||||||
@@ -38,9 +40,19 @@ int myrg_extra(MYRG_INFO *info,enum ha_extra_function function)
|
|||||||
info->current_table=0;
|
info->current_table=0;
|
||||||
info->last_used_table=info->open_tables;
|
info->last_used_table=info->open_tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info->records=info->del=info->data_file_length=0;
|
||||||
for (file=info->open_tables ; file != info->end_table ; file++)
|
for (file=info->open_tables ; file != info->end_table ; file++)
|
||||||
|
{
|
||||||
if ((error=mi_extra(file->table,function)))
|
if ((error=mi_extra(file->table,function)))
|
||||||
save_error=error;
|
save_error=error;
|
||||||
|
file->file_offset=info->data_file_length;
|
||||||
|
info->data_file_length+=file->table->s->state.state.data_file_length;
|
||||||
|
info->records+=file->table->s->state.state.records;
|
||||||
|
info->del+=file->table->s->state.state.del;
|
||||||
|
DBUG_PRINT("info2",("table: %s, offset: 0x%08lx",
|
||||||
|
file->table->filename,(ulong)file->file_offset));
|
||||||
}
|
}
|
||||||
return save_error;
|
}
|
||||||
|
DBUG_RETURN(save_error);
|
||||||
}
|
}
|
||||||
|
@@ -35,8 +35,6 @@ int myrg_status(MYRG_INFO *info,register MYMERGE_INFO *x,int flag)
|
|||||||
MYRG_TABLE *current_table;
|
MYRG_TABLE *current_table;
|
||||||
DBUG_ENTER("myrg_status");
|
DBUG_ENTER("myrg_status");
|
||||||
|
|
||||||
_myrg_find_table(info, HA_OFFSET_ERROR);
|
|
||||||
|
|
||||||
if (!(current_table = info->current_table) &&
|
if (!(current_table = info->current_table) &&
|
||||||
info->open_tables != info->end_table)
|
info->open_tables != info->end_table)
|
||||||
current_table = info->open_tables;
|
current_table = info->open_tables;
|
||||||
|
@@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
#include "mymrgdef.h"
|
#include "mymrgdef.h"
|
||||||
|
|
||||||
|
static MYRG_TABLE *find_table(MYRG_TABLE *start,MYRG_TABLE *end,ulonglong pos);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If filepos == HA_OFFSET_ERROR, read next
|
If filepos == HA_OFFSET_ERROR, read next
|
||||||
Returns same as mi_rrnd:
|
Returns same as mi_rrnd:
|
||||||
@@ -33,6 +35,8 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
|
|||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
MI_INFO *isam_info;
|
MI_INFO *isam_info;
|
||||||
|
DBUG_ENTER("myrg_rrnd");
|
||||||
|
DBUG_PRINT("info",("offset: 0x%016qx", (ulonglong)filepos));
|
||||||
|
|
||||||
if (filepos == HA_OFFSET_ERROR)
|
if (filepos == HA_OFFSET_ERROR)
|
||||||
{
|
{
|
||||||
@@ -40,7 +44,7 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
|
|||||||
{
|
{
|
||||||
if (info->open_tables == info->end_table)
|
if (info->open_tables == info->end_table)
|
||||||
{ /* No tables */
|
{ /* No tables */
|
||||||
return (my_errno=HA_ERR_END_OF_FILE);
|
DBUG_RETURN(my_errno=HA_ERR_END_OF_FILE);
|
||||||
}
|
}
|
||||||
isam_info=(info->current_table=info->open_tables)->table;
|
isam_info=(info->current_table=info->open_tables)->table;
|
||||||
if (info->cache_in_use)
|
if (info->cache_in_use)
|
||||||
@@ -60,11 +64,11 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
|
|||||||
if ((error=(*isam_info->s->read_rnd)(isam_info,(byte*) buf,
|
if ((error=(*isam_info->s->read_rnd)(isam_info,(byte*) buf,
|
||||||
(my_off_t) filepos,1)) !=
|
(my_off_t) filepos,1)) !=
|
||||||
HA_ERR_END_OF_FILE)
|
HA_ERR_END_OF_FILE)
|
||||||
return (error);
|
DBUG_RETURN(error);
|
||||||
if (info->cache_in_use)
|
if (info->cache_in_use)
|
||||||
mi_extra(info->current_table->table,HA_EXTRA_NO_CACHE);
|
mi_extra(info->current_table->table,HA_EXTRA_NO_CACHE);
|
||||||
if (info->current_table+1 == info->end_table)
|
if (info->current_table+1 == info->end_table)
|
||||||
return(HA_ERR_END_OF_FILE);
|
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||||
info->current_table++;
|
info->current_table++;
|
||||||
info->last_used_table=info->current_table;
|
info->last_used_table=info->current_table;
|
||||||
if (info->cache_in_use)
|
if (info->cache_in_use)
|
||||||
@@ -78,10 +82,11 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
|
|||||||
isam_info->lastinx= (uint) -1;
|
isam_info->lastinx= (uint) -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info->current_table=_myrg_find_table(info,filepos);
|
info->current_table=find_table(info->open_tables,
|
||||||
|
info->end_table-1,filepos);
|
||||||
isam_info=info->current_table->table;
|
isam_info=info->current_table->table;
|
||||||
isam_info->update&= HA_STATE_CHANGED;
|
isam_info->update&= HA_STATE_CHANGED;
|
||||||
return ((*isam_info->s->read_rnd)
|
DBUG_RETURN((*isam_info->s->read_rnd)
|
||||||
(isam_info, (byte*) buf,
|
(isam_info, (byte*) buf,
|
||||||
(ha_rows) (filepos - info->current_table->file_offset),
|
(ha_rows) (filepos - info->current_table->file_offset),
|
||||||
0));
|
0));
|
||||||
@@ -90,19 +95,21 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
|
|||||||
|
|
||||||
/* Find which table to use according to file-pos */
|
/* Find which table to use according to file-pos */
|
||||||
|
|
||||||
MYRG_TABLE *_myrg_find_table(MYRG_INFO *info, ulonglong pos)
|
static MYRG_TABLE *find_table(MYRG_TABLE *start, MYRG_TABLE *end,
|
||||||
|
ulonglong pos)
|
||||||
{
|
{
|
||||||
MYRG_TABLE *t;
|
MYRG_TABLE *mid;
|
||||||
|
DBUG_ENTER("find_table");
|
||||||
|
|
||||||
info->records=info->del=info->data_file_length=0;
|
while (start != end)
|
||||||
|
|
||||||
for (t=info->open_tables ; t < info->end_table ; t++)
|
|
||||||
{
|
{
|
||||||
t->file_offset=info->data_file_length;
|
mid=start+((uint) (end-start)+1)/2;
|
||||||
if (pos < t->file_offset) return t-1;
|
if (mid->file_offset > pos)
|
||||||
info->data_file_length+=t->table->state->data_file_length;
|
end=mid-1;
|
||||||
info->records+=t->table->state->records;
|
else
|
||||||
info->del+=t->table->state->del;
|
start=mid;
|
||||||
}
|
}
|
||||||
return t-1;
|
DBUG_PRINT("info",("offset: 0x%016qx, table: %s",
|
||||||
|
(ulonglong)pos, start->table->filename));
|
||||||
|
DBUG_RETURN(start);
|
||||||
}
|
}
|
||||||
|
@@ -740,6 +740,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
|
|||||||
}
|
}
|
||||||
table->prev->next=table->next; /* Remove from unused list */
|
table->prev->next=table->next; /* Remove from unused list */
|
||||||
table->next->prev=table->prev;
|
table->next->prev=table->prev;
|
||||||
|
table->file->reset();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user