mirror of
https://github.com/MariaDB/server.git
synced 2025-08-15 22:37:22 +00:00
Merge magare.gmz:/home/kgeorge/mysql/work/mysql-5.0-opt
into magare.gmz:/home/kgeorge/mysql/work/merge-5.1-opt mysql-test/r/loaddata.result: Auto merged mysql-test/t/loaddata.test: Auto merged sql/filesort.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_load.cc: Auto merged sql/uniques.cc: Auto merged mysql-test/include/mix1.inc: manual merge 5.0-opt -> 5.1-opt mysql-test/r/innodb_mysql.result: manual merge 5.0-opt -> 5.1-opt sql/log.cc: manual merge 5.0-opt -> 5.1-opt
This commit is contained in:
@ -1128,6 +1128,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
|
||||
BUFFPEK *buffpek;
|
||||
QUEUE queue;
|
||||
qsort2_cmp cmp;
|
||||
void *first_cmp_arg;
|
||||
volatile THD::killed_state *killed= ¤t_thd->killed;
|
||||
THD::killed_state not_killable;
|
||||
DBUG_ENTER("merge_buffers");
|
||||
@ -1152,9 +1153,18 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
|
||||
/* The following will fire if there is not enough space in sort_buffer */
|
||||
DBUG_ASSERT(maxcount!=0);
|
||||
|
||||
if (param->unique_buff)
|
||||
{
|
||||
cmp= param->compare;
|
||||
first_cmp_arg= (void *) ¶m->cmp_context;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmp= get_ptr_compare(sort_length);
|
||||
first_cmp_arg= (void*) &sort_length;
|
||||
}
|
||||
if (init_queue(&queue, (uint) (Tb-Fb)+1, offsetof(BUFFPEK,key), 0,
|
||||
(queue_compare) (cmp= get_ptr_compare(sort_length)),
|
||||
(void*) &sort_length))
|
||||
(queue_compare) cmp, first_cmp_arg))
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
for (buffpek= Fb ; buffpek <= Tb ; buffpek++)
|
||||
{
|
||||
@ -1207,7 +1217,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
|
||||
buffpek= (BUFFPEK*) queue_top(&queue);
|
||||
if (cmp) // Remove duplicates
|
||||
{
|
||||
if (!(*cmp)(&sort_length, &(param->unique_buff),
|
||||
if (!(*cmp)(first_cmp_arg, &(param->unique_buff),
|
||||
(uchar**) &buffpek->key))
|
||||
goto skip_duplicate;
|
||||
memcpy(param->unique_buff, (uchar*) buffpek->key, rec_length);
|
||||
@ -1259,7 +1269,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
|
||||
*/
|
||||
if (cmp)
|
||||
{
|
||||
if (!(*cmp)(&sort_length, &(param->unique_buff), (uchar**) &buffpek->key))
|
||||
if (!(*cmp)(first_cmp_arg, &(param->unique_buff), (uchar**) &buffpek->key))
|
||||
{
|
||||
buffpek->key+= rec_length; // Remove duplicate
|
||||
--buffpek->mem_count;
|
||||
|
Reference in New Issue
Block a user