summaryrefslogtreecommitdiff
path: root/sql/uniques.cc
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2003-12-02 21:20:51 +0300
committerunknown <sergefp@mysql.com>2003-12-02 21:20:51 +0300
commitd010fd10ef06775250cffaf351e24762ef4fee5b (patch)
tree1ee45c5f2d9499ce6bd3f9e8cffc52873d0fafc4 /sql/uniques.cc
parent6573b851e36de43d4cfa39d5eba0b740c3226521 (diff)
downloadmariadb-git-d010fd10ef06775250cffaf351e24762ef4fee5b.tar.gz
Fix for bug #1980
Diffstat (limited to 'sql/uniques.cc')
-rw-r--r--sql/uniques.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/uniques.cc b/sql/uniques.cc
index f289fd11f5b..02146426782 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -37,14 +37,20 @@
int unique_write_to_file(gptr key, element_count count, Unique *unique)
{
+ /*
+ Use unique->size (size of element stored in the tree) and not
+ unique->tree.size_of_element. The latter is different from unique->size
+ when tree implementation chooses to store pointer to key in TREE_ELEMENT
+ (instead of storing the element itself there)
+ */
return my_b_write(&unique->file, (byte*) key,
- unique->tree.size_of_element) ? 1 : 0;
+ unique->size) ? 1 : 0;
}
int unique_write_to_ptrs(gptr key, element_count count, Unique *unique)
{
- memcpy(unique->record_pointers, key, unique->tree.size_of_element);
- unique->record_pointers+=unique->tree.size_of_element;
+ memcpy(unique->record_pointers, key, unique->size);
+ unique->record_pointers+=unique->size;
return 0;
}
@@ -133,7 +139,7 @@ bool Unique::get(TABLE *table)
sort_param.max_rows= elements;
sort_param.sort_form=table;
sort_param.rec_length= sort_param.sort_length=sort_param.ref_length=
- tree.size_of_element;
+ size;
sort_param.keys= max_in_memory_size / sort_param.sort_length;
sort_param.not_killable=1;