diff options
author | unknown <sergefp@mysql.com> | 2004-11-29 06:51:30 +0300 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2004-11-29 06:51:30 +0300 |
commit | 7ea16212077eb53bdc8161af1d132deae8f030ff (patch) | |
tree | 0212745a88314b9199da4949005a684b4e2167f3 /myisammrg | |
parent | 1b898a22460a369b8ca21f573973a8a0518e85d4 (diff) | |
download | mariadb-git-7ea16212077eb53bdc8161af1d132deae8f030ff.tar.gz |
Fix and testcase for BUG#6699
myisam/mi_rnext_same.c:
Fix for BUG#6699:
MERGE handler now uses mi_rnext_same() with priority queue, so skip record unpacking if buf==NULL
myisammrg/myrg_rnext_same.c:
Fix for BUG#6699:
make myrg_rnext_same sort always sort records and return them in key order.
mysql-test/r/merge.result:
Test for BUG#6699
mysql-test/t/merge.test:
Test for BUG#6699
Diffstat (limited to 'myisammrg')
-rw-r--r-- | myisammrg/myrg_rnext_same.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/myisammrg/myrg_rnext_same.c b/myisammrg/myrg_rnext_same.c index b569459b77d..997e4100acd 100644 --- a/myisammrg/myrg_rnext_same.c +++ b/myisammrg/myrg_rnext_same.c @@ -16,25 +16,36 @@ #include "myrg_def.h" + int myrg_rnext_same(MYRG_INFO *info, byte *buf) { - uint err; + int err; MI_INFO *mi; if (!info->current_table) return (HA_ERR_KEY_NOT_FOUND); - err=mi_rnext_same(info->current_table->table,buf); - if (err == HA_ERR_END_OF_FILE) + /* at first, do rnext for the table found before */ + if ((err=mi_rnext_same(info->current_table->table,NULL))) { - queue_remove(&(info->by_key),0); - if (!info->by_key.elements) - return HA_ERR_END_OF_FILE; - - mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; - mi->once_flags|= RRND_PRESERVE_LASTINX; - return mi_rrnd(mi,buf,mi->lastpos); + 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; } - return err; + else + { + /* Found here, adding to queue */ + queue_top(&(info->by_key))=(byte *)(info->current_table); + queue_replaced(&(info->by_key)); + } + + /* 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 _myrg_mi_read_record(mi,buf); } |