← Back to team overview

maria-developers team mailing list archive

Re: Rev 3177: Fixed bug mdev-4063 (bug #56927)


Hi, Igor!

On Jan 21, Igor Babaev wrote:
> revno: 3177
> revision-id: igor@xxxxxxxxxxxx-20130121084657-hvcval7hykojxpmg
> parent: sergii@xxxxxxxxx-20130109225151-z9e7gh8z5nl38dxl
> committer: Igor Babaev <igor@xxxxxxxxxxxx>
> branch nick: maria-5.1-bug56927
> timestamp: Mon 2013-01-21 00:46:57 -0800
> message:
>   Fixed bug mdev-4063 (bug #56927).
>   This bug could result in returning 0 for the expressions of the form 
>   <aggregate_function>(distinct field) when the system variable  
>   max_heap_table_size was set to a small enough number.
>   It happened because the method Unique::walk() did not support
>   the case when more than one pass was needed to merge the trees
>   of distinct values saved in an external file.

Looks ok. Just one thought.

You use merge_many_buff() if the memory is not enough for the
number_of_buffpeks*size. But merge_many_buff() only reduces the number
of buffpeks down to 15. What if max_heap_table_size < 15*size ?

I'd suggest to either 1) issue an error or 2) merge completely, like in

Actually, 2) should be easy, you just pass the last argument to your new
Unique::merge() instead of TRUE, like in your patch, change to

  merge( ..., max_in_memory_size > MERGEBUFF2*size);