1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

BUG#830993: Crash in end_read_record with derived table

- Let join buffering code correctly take into account rowids needed 
  by DuplicateElimination when it is calculating minimum record sizes.
- In JOIN_CACHE::write_record_data, added asserts that prevent us from 
  writing beyond the end of the buffer.
This commit is contained in:
Sergey Petrunya
2011-09-08 19:48:14 +04:00
parent 528598c478
commit 5673aa41c3
6 changed files with 268 additions and 19 deletions

View File

@ -6572,6 +6572,16 @@ void JOIN_TAB::calc_used_field_length(bool max_fl)
rec_length+=(table->s->null_fields+7)/8;
if (table->maybe_null)
rec_length+=sizeof(my_bool);
/* Take into account that DuplicateElimination may need to store rowid */
uint rowid_add_size= 0;
if (keep_current_rowid)
{
rowid_add_size= table->file->ref_length;
rec_length += rowid_add_size;
fields++;
}
if (max_fl)
{
// TODO: to improve this estimate for max expected length
@ -6585,13 +6595,9 @@ void JOIN_TAB::calc_used_field_length(bool max_fl)
}
max_used_fieldlength= rec_length;
}
else if (table->file->stats.mean_rec_length)
set_if_smaller(rec_length, table->file->stats.mean_rec_length);
else if (table->file->stats.mean_rec_length)
set_if_smaller(rec_length, table->file->stats.mean_rec_length + rowid_add_size);
/*
TODO: why we don't count here rowid that we might need to store when
using DuplicateElimination?
*/
used_fields=fields;
used_fieldlength=rec_length;
used_blobs=blobs;