summaryrefslogtreecommitdiff
path: root/sql/uniques.cc
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2003-12-02 21:05:40 +0300
committerunknown <sergefp@mysql.com>2003-12-02 21:05:40 +0300
commit8be4234f6162da34e1ecd007b67b3ef0650b16d1 (patch)
tree34b1ee56cd3f161f92600cc2660b0124390843bf /sql/uniques.cc
parent13f525c080c787af562aa1dd7b60d74889e41378 (diff)
downloadmariadb-git-8be4234f6162da34e1ecd007b67b3ef0650b16d1.tar.gz
Fix for bug #1980
BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
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 d00893a8605..967392d12d5 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;
}
@@ -132,7 +138,7 @@ bool Unique::get(TABLE *table)
bzero((char*) &sort_param,sizeof(sort_param));
sort_param.max_rows= elements;
sort_param.sort_form=table;
- sort_param.sort_length=sort_param.ref_length=tree.size_of_element;
+ sort_param.sort_length=sort_param.ref_length=size;
sort_param.keys= max_in_memory_size / sort_param.sort_length;
sort_param.not_killable=1;