← Back to team overview

maria-developers team mailing list archive

Re: debugging MDEV-5932, wrong result set for tokudb

 

Hi, Rich!

On Mar 28, Rich Prohaska wrote:
> Hello,
> 
> TokuDB generates an empty result set for a select with sub-select, but
> generated a non-empty result set for the same query when creating a new
> table.  The result set should be the same in both cases.  What is going on
> here?  InnoDB computes an empty result set for both cases.
> 
> I traced the problem to the tokudb::index_read function.  The
> tokudb::index_read does not handle the null byte key prefix.
>  Unfortunately, I do not understand how the null byte (byte 0) in the key
> handed to the ::index_read function is supposed to work.   Most of the
> time, the value of this byte is 0.  Sometimes it is set to 1.  How should
> the storage engine work WRT this?
> 
> BTW, this problem exists with TokuDB in MySQL 5.5.36, MySQL 5.6.16.  I have
> not been able to consistently see this on MariaDB 5.5.36 for some reason.
> In any case, I am interested in how the handler's index_read function is
> supposed to process the null byte.

I'm not sure I understood your question...

But anyway, if a key segment can be null, than its value in the key
image starts with a byte that tells whether the key segment value is
null. If this byte's value is 1, it means key segment's value is NULL.

For example,

 CREATE TABLE t1 (a int, key(a), ...);

This key value is 5 bytes long. Valid values are, for example,

  0x00 0x01 0x02 0x03 0x04   -- for 'a' being 0x01020304, that is 16909060
  0x00 0x00 0x00 0x00 0x00   -- for 'a' being 0
  0x01 0x00 0x00 0x00 0x00   -- for 'a' being NULL

Regards,
Sergei



References