Commit e183b27d authored by unknown's avatar unknown

myisammrg/myrg_rnext.c bug with incomlete queue fixed

myisammrg/myrg_rprev.c    bug with incomlete queue fixed


myisammrg/myrg_rnext.c:
  bug with incomlete queue fixed
myisammrg/myrg_rprev.c:
  bug with incomlete queue fixed
parent 1c4c6b8a
...@@ -29,11 +29,7 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx) ...@@ -29,11 +29,7 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx)
if ((err=mi_rnext(info->current_table->table,NULL,inx))) if ((err=mi_rnext(info->current_table->table,NULL,inx)))
{ {
if (err == HA_ERR_END_OF_FILE) if (err == HA_ERR_END_OF_FILE)
{
queue_remove(&(info->by_key),0); queue_remove(&(info->by_key),0);
if (!info->by_key.elements)
return HA_ERR_END_OF_FILE;
}
else else
return err; return err;
} }
...@@ -48,6 +44,9 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx) ...@@ -48,6 +44,9 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx)
if ((err=_myrg_finish_scan(info, inx, HA_READ_KEY_OR_NEXT))) if ((err=_myrg_finish_scan(info, inx, HA_READ_KEY_OR_NEXT)))
return err; 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 */ /* now, mymerge's read_next is as simple as one queue_top */
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
return mi_rrnd(mi,buf,mi->lastpos); return mi_rrnd(mi,buf,mi->lastpos);
......
...@@ -29,11 +29,7 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx) ...@@ -29,11 +29,7 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx)
if ((err=mi_rprev(info->current_table->table,NULL,inx))) if ((err=mi_rprev(info->current_table->table,NULL,inx)))
{ {
if (err == HA_ERR_END_OF_FILE) if (err == HA_ERR_END_OF_FILE)
{
queue_remove(&(info->by_key),0); queue_remove(&(info->by_key),0);
if (!info->by_key.elements)
return HA_ERR_END_OF_FILE;
}
else else
return err; return err;
} }
...@@ -48,6 +44,9 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx) ...@@ -48,6 +44,9 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx)
if ((err=_myrg_finish_scan(info, inx, HA_READ_KEY_OR_PREV))) if ((err=_myrg_finish_scan(info, inx, HA_READ_KEY_OR_PREV)))
return err; 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 */ /* now, mymerge's read_prev is as simple as one queue_top */
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
return mi_rrnd(mi,buf,mi->lastpos); return mi_rrnd(mi,buf,mi->lastpos);
......
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