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 ...@@ -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 tablespace. Only free extents are taken into account and we also subtract
the safety margin required by the above function fsp_reserve_free_extents. */ the safety margin required by the above function fsp_reserve_free_extents. */
ulint ullint
fsp_get_available_space_in_free_extents( fsp_get_available_space_in_free_extents(
/*====================================*/ /*====================================*/
/* out: available space in kB */ /* out: available space in kB */
...@@ -2895,7 +2895,8 @@ fsp_get_available_space_in_free_extents( ...@@ -2895,7 +2895,8 @@ fsp_get_available_space_in_free_extents(
return(0); return(0);
} }
return(((n_free - reserve) * FSP_EXTENT_SIZE) return((ullint)(n_free - reserve)
* FSP_EXTENT_SIZE
* (UNIV_PAGE_SIZE / 1024)); * (UNIV_PAGE_SIZE / 1024));
} }
......
...@@ -5847,9 +5847,9 @@ ha_innobase::update_table_comment( ...@@ -5847,9 +5847,9 @@ ha_innobase::update_table_comment(
mutex_enter_noninline(&srv_dict_tmpfile_mutex); mutex_enter_noninline(&srv_dict_tmpfile_mutex);
rewind(srv_dict_tmpfile); rewind(srv_dict_tmpfile);
fprintf(srv_dict_tmpfile, "InnoDB free: %lu kB", fprintf(srv_dict_tmpfile, "InnoDB free: %llu kB",
(ulong) fsp_get_available_space_in_free_extents( fsp_get_available_space_in_free_extents(
prebuilt->table->space)); prebuilt->table->space));
dict_print_info_on_foreign_keys(FALSE, srv_dict_tmpfile, dict_print_info_on_foreign_keys(FALSE, srv_dict_tmpfile,
prebuilt->trx, prebuilt->table); prebuilt->trx, prebuilt->table);
......
...@@ -245,7 +245,7 @@ will be able to insert new data to the database without running out the ...@@ -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 tablespace. Only free extents are taken into account and we also subtract
the safety margin required by the above function fsp_reserve_free_extents. */ the safety margin required by the above function fsp_reserve_free_extents. */
ulint ullint
fsp_get_available_space_in_free_extents( fsp_get_available_space_in_free_extents(
/*====================================*/ /*====================================*/
/* out: available space in kB */ /* out: available space in kB */
......
...@@ -216,6 +216,8 @@ typedef __int64 ib_longlong; ...@@ -216,6 +216,8 @@ typedef __int64 ib_longlong;
typedef longlong ib_longlong; typedef longlong ib_longlong;
#endif #endif
typedef unsigned long long int ullint;
#ifndef __WIN__ #ifndef __WIN__
#if SIZEOF_LONG != SIZEOF_VOIDP #if SIZEOF_LONG != SIZEOF_VOIDP
#error "Error: InnoDB's ulint must be of the same size as void*" #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