Hi Lars-Erik,
ok to push, thanks
> -----Original Message-----
> From: Lars-Erik.Bjork@stripped [mailto:Lars-Erik.Bjork@stripped]
> Sent: Monday, November 24, 2008 9:57 AM
> To: commits@stripped
> Subject: bzr commit into mysql-6.0-falcon-team branch (lars-
> erik.bjork:2916) Bug#40614
>
> #At file:///home/lb200670/devel/mysql/trampoline/ based on
> revid:john.embretsen@stripped
>
> 2916 lars-erik.bjork@stripped 2008-11-24
> This is a patch for bug#40614 Falcon datetime indexes can not
> handle 0000-00-00
>
>
> After we have found a hit in the index, registered in the bitmap,
> we
> check the actual value of the record to see if it really matches
> (the
> index may be dirty). Further down the stack, in Value::compare,
> we
> compare the stored value (0) to the key value (f. ex
> 20061212000000). The stored value is represented as a small int,
> whereas the key value is an int64. The comparison is done by
> subtracting the key value from the stored value, and returning
> this as
> an integer. However, because the special 0 (not NULL) value is
> much
> smaller than the key value, the result will be outside the range
> of an
> int. Therefore, when the int only uses the last 4 bytes of the
> result,
> the sign-bit of the integer will vary depending on the year part
> of
> the datetime value. This fools Value::compare into returning that
> the
> 0 datetime-value is greater than a much greater datetime-value
> for
> some values of year. The solution is to compare the numbers
> without
> calculating any intermediate result, returning 1, 0 or -1. I
> have
> taken the liberty to change this for some other comparisons than
> just
> the one failing in this bug.
>
>
> Modified file 'storage/falcon/Value.cpp'
> ----------------------------------------
> Instead of returning the result of the subtraction as an int, we
> now
> compare the values directly, returning 1, 0 or -1. This way we
> won't
> return the wrong result because we are no longer only taking the
> last
> 4 bytes of the value into consideration
>
> This change was made for the places currently using subtraction
> to
> compare.
>
>
> Added file 'mysql-test/suite/falcon/r/falcon_bug_40614.result'
> --------------------------------------------------------------
> This is the result file for the test.
>
>
> Added file 'mysql-test/suite/falcon/t/falcon_bug_40614.test'
> ------------------------------------------------------------
> This is the test that tests the patch. I have tested for plenty
> of year
> values, since this bug did not show for all values.
> added:
> mysql-test/suite/falcon/r/falcon_bug_40614.result
> mysql-test/suite/falcon/t/falcon_bug_40614.test
> modified:
> storage/falcon/Value.cpp