Fix Bug#29097 "fsp_get_available_space_in_free_extents() is capped at 4TB"

by typecasting the variables before multiplying them, so that the result of
the multiplication is of type "unsigned long long".

I verified this fix by creating a sparse file of 6TB and forcing InnoDB to
use it without overwriting it with zeroes (by commenting the code that
overwrites :newraw files).

New type ullint is introduced with the sole purpose of shortening
"unsigned long long", please do not define it to something else than
"unsigned long long".

Approved by:	Heikki
This commit is contained in:
vasil 2007-06-26 13:08:11 +00:00
parent 962c2feb94
commit 4b325712b3
4 changed files with 9 additions and 6 deletions

View file

@ -2829,7 +2829,7 @@ will be able to insert new data to the database without running out the
tablespace. Only free extents are taken into account and we also subtract
the safety margin required by the above function fsp_reserve_free_extents. */
ulint
ullint
fsp_get_available_space_in_free_extents(
/*====================================*/
/* out: available space in kB */
@ -2895,7 +2895,8 @@ fsp_get_available_space_in_free_extents(
return(0);
}
return(((n_free - reserve) * FSP_EXTENT_SIZE)
return((ullint)(n_free - reserve)
* FSP_EXTENT_SIZE
* (UNIV_PAGE_SIZE / 1024));
}

View file

@ -5847,8 +5847,8 @@ ha_innobase::update_table_comment(
mutex_enter_noninline(&srv_dict_tmpfile_mutex);
rewind(srv_dict_tmpfile);
fprintf(srv_dict_tmpfile, "InnoDB free: %lu kB",
(ulong) fsp_get_available_space_in_free_extents(
fprintf(srv_dict_tmpfile, "InnoDB free: %llu kB",
fsp_get_available_space_in_free_extents(
prebuilt->table->space));
dict_print_info_on_foreign_keys(FALSE, srv_dict_tmpfile,

View file

@ -245,7 +245,7 @@ will be able to insert new data to the database without running out the
tablespace. Only free extents are taken into account and we also subtract
the safety margin required by the above function fsp_reserve_free_extents. */
ulint
ullint
fsp_get_available_space_in_free_extents(
/*====================================*/
/* out: available space in kB */

View file

@ -216,6 +216,8 @@ typedef __int64 ib_longlong;
typedef longlong ib_longlong;
#endif
typedef unsigned long long int ullint;
#ifndef __WIN__
#if SIZEOF_LONG != SIZEOF_VOIDP
#error "Error: InnoDB's ulint must be of the same size as void*"