mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
Fixed LP bug #801536.
Ensured valid calculations of the estimates stored in JOIN_TAB::used_fieldlength.
This commit is contained in:
parent
77f8874c8b
commit
cb164640be
1 changed files with 7 additions and 4 deletions
|
@ -6492,7 +6492,8 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
|
|||
|
||||
void JOIN_TAB::calc_used_field_length(bool max_fl)
|
||||
{
|
||||
uint null_fields,blobs,fields,rec_length;
|
||||
uint null_fields,blobs,fields;
|
||||
ulong rec_length;
|
||||
Field **f_ptr,*field;
|
||||
uint uneven_bit_fields;
|
||||
MY_BITMAP *read_set= table->read_set;
|
||||
|
@ -6523,9 +6524,11 @@ void JOIN_TAB::calc_used_field_length(bool max_fl)
|
|||
// TODO: to improve this estimate for max expected length
|
||||
if (blobs)
|
||||
{
|
||||
uint blob_length=(uint) (table->file->stats.mean_rec_length-
|
||||
(table->s->reclength-rec_length));
|
||||
rec_length+=(uint) max(sizeof(void*) * blobs, blob_length);
|
||||
ulong blob_length= table->file->stats.mean_rec_length;
|
||||
if (ULONG_MAX - rec_length > blob_length)
|
||||
rec_length+= blob_length;
|
||||
else
|
||||
rec_length= ULONG_MAX;
|
||||
}
|
||||
max_used_fieldlength= rec_length;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue