Commit 88662a2d authored by vasil's avatar vasil

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
parent 19ffb74a
......@@ -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));
}
......
......@@ -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,
......
......@@ -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 */
......
......@@ -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*"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment