Bug #34877 Invalid Values are showing in variable on assigning valid values.
Submitted: 27 Feb 2008 10:48 Modified: 2 Oct 2008 15:16
Reporter: Salman Rawala Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: Out Of Memory error

[27 Feb 2008 10:48] Salman Rawala
Description:
On assigning valid values to variable, some variables change the value assigned and some throw Out Of Memory warnings in result file. This behavior is seen in the following variables

key_buffer_size
key_cache_age_threshold
key_cache_block_size

How to repeat:
Sample Code: 
SET @@global.key_buffer_size = 4294967295;
SELECT @@global.key_buffer_size;

Output:
SET @@global.key_buffer_size = 4294967295;
Warnings:
Error	5	Out of memory (Needed 3775142912 bytes)
Error	5	Out of memory (Needed 2831354880 bytes)
Error	5	Out of memory (Needed 2123513856 bytes)
SELECT @@global.key_buffer_size;
@@global.key_buffer_size
4294963200
[27 Feb 2008 23:13] Sveta Smirnova
Thank you for the report.

Verified as described.
[2 Oct 2008 15:16] Konstantin Osipov
Assignment to a variable carries certain semantics. If the server attempts to pre-allocate memory and fails, assignment fails.
[2 Oct 2008 15:17] Konstantin Osipov
A complain that even after an error the variable gets the new value, rather than 0 or old value, may be valid. Please open a separate bug report for it if necessary.