summaryrefslogtreecommitdiff
path: root/sql/uniques.cc
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2007-07-01 15:33:28 -0700
committerunknown <igor@olga.mysql.com>2007-07-01 15:33:28 -0700
commit07dcc80023674120eb84d41a37dd748da8e00de7 (patch)
tree78aa61d0aab9adf301716e6ce4010ed9bbf79c27 /sql/uniques.cc
parent8dcd5fca6977a8aafb0dd874b348e0078eafda94 (diff)
downloadmariadb-git-07dcc80023674120eb84d41a37dd748da8e00de7.tar.gz
Fixed bug #25798.
This bug may manifest itself not only with the queries for which the index-merge access method is chosen. It also may display itself for queries with DISTINCT. The bug was in how the Unique::get method used the merge_buffers function. To compare elements in the the queue employed by merge_buffers() it must use the buffpek_compare function rather than the function for binary comparison. mysql-test/r/innodb_mysql.result: Added a test case for bug #25798. mysql-test/t/innodb_mysql.test: Added a test case for bug #25798. sql/filesort.cc: Fixed bug #25798. The function merge_buffers() when called from the Uniques::get method must use function buffpek_compare to compare elements in the queue it employs. The pointer to buffpek_compare and the info for the function that compares sorted records are passed to merge_buffers through certain designated fields of the SORTPARAM structure. sql/sql_sort.h: Fixed bug #25798. Added fields to the SORTPARAM structure to be used in the function merge_buffers when called by the Uniques::get method. sql/uniques.cc: Fixed bug 25798. The function merge_buffers() when called from the Uniques::get method must use function buffpek_compare to compare elements in the queue it employes.
Diffstat (limited to 'sql/uniques.cc')
-rw-r--r--sql/uniques.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/sql/uniques.cc b/sql/uniques.cc
index 9eb827f62a3..7c197d2a2e9 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -361,17 +361,12 @@ Unique::reset()
}
/*
- The comparison function, passed to queue_init() in merge_walk() must
+ The comparison function, passed to queue_init() in merge_walk() and in
+ merge_buffers() when the latter is called from Uniques::get() must
use comparison function of Uniques::tree, but compare members of struct
BUFFPEK.
*/
-struct BUFFPEK_COMPARE_CONTEXT
-{
- qsort_cmp2 key_compare;
- void *key_compare_arg;
-};
-
C_MODE_START
static int buffpek_compare(void *arg, byte *key_ptr1, byte *key_ptr2)
@@ -630,6 +625,10 @@ bool Unique::get(TABLE *table)
sort_param.unique_buff= sort_buffer+(sort_param.keys*
sort_param.sort_length);
+ sort_param.compare= (qsort2_cmp) buffpek_compare;
+ sort_param.cmp_context.key_compare= tree.compare;
+ sort_param.cmp_context.key_compare_arg= tree.custom_arg;
+
/* Merge the buffers to one file, removing duplicates */
if (merge_many_buff(&sort_param,sort_buffer,file_ptr,&maxbuffer,&file))
goto err;