Commit af445f4b authored by marko's avatar marko

branches/zip: fsp_try_extend_data_file(): Extend the data file by

one megabyte at a time, no matter what the compressed page size is.
parent 2117ec5a
...@@ -1156,10 +1156,14 @@ fsp_try_extend_data_file( ...@@ -1156,10 +1156,14 @@ fsp_try_extend_data_file(
} }
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr); size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
zip_size = mach_read_from_4(header + FSP_PAGE_ZIP_SIZE);
old_size = size; old_size = size;
if (space == 0 && srv_last_file_size_max != 0) { if (space == 0) {
if (!srv_last_file_size_max) {
size_increase = SRV_AUTO_EXTEND_INCREMENT;
} else {
if (srv_last_file_size_max if (srv_last_file_size_max
< srv_data_file_sizes[srv_n_data_files - 1]) { < srv_data_file_sizes[srv_n_data_files - 1]) {
...@@ -1174,19 +1178,25 @@ fsp_try_extend_data_file( ...@@ -1174,19 +1178,25 @@ fsp_try_extend_data_file(
if (size_increase > SRV_AUTO_EXTEND_INCREMENT) { if (size_increase > SRV_AUTO_EXTEND_INCREMENT) {
size_increase = SRV_AUTO_EXTEND_INCREMENT; size_increase = SRV_AUTO_EXTEND_INCREMENT;
} }
} else { }
if (space == 0) {
size_increase = SRV_AUTO_EXTEND_INCREMENT;
} else { } else {
/* We extend single-table tablespaces first one extent /* We extend single-table tablespaces first one extent
at a time, but for bigger tablespaces more. It is not at a time, but for bigger tablespaces more. It is not
enough to extend always by one extent, because some enough to extend always by one extent, because some
extents are frag page extents. */ extents are frag page extents. */
ulint extent_size; /* one megabyte, in pages */
if (size < FSP_EXTENT_SIZE) { if (!zip_size) {
/* Let us first extend the file to 64 pages */ extent_size = FSP_EXTENT_SIZE;
} else {
extent_size = FSP_EXTENT_SIZE
* UNIV_PAGE_SIZE / zip_size;
}
if (size < extent_size) {
/* Let us first extend the file to extent_size */
success = fsp_try_extend_data_file_with_pages( success = fsp_try_extend_data_file_with_pages(
space, FSP_EXTENT_SIZE - 1, space, extent_size - 1,
header, mtr); header, mtr);
if (!success) { if (!success) {
new_size = mtr_read_ulint( new_size = mtr_read_ulint(
...@@ -1197,17 +1207,16 @@ fsp_try_extend_data_file( ...@@ -1197,17 +1207,16 @@ fsp_try_extend_data_file(
return(FALSE); return(FALSE);
} }
size = FSP_EXTENT_SIZE; size = extent_size;
} }
if (size < 32 * FSP_EXTENT_SIZE) { if (size < 32 * extent_size) {
size_increase = FSP_EXTENT_SIZE; size_increase = extent_size;
} else { } else {
/* Below in fsp_fill_free_list() we assume /* Below in fsp_fill_free_list() we assume
that we add at most FSP_FREE_ADD extents at that we add at most FSP_FREE_ADD extents at
a time */ a time */
size_increase = FSP_FREE_ADD * FSP_EXTENT_SIZE; size_increase = FSP_FREE_ADD * extent_size;
}
} }
} }
...@@ -1221,8 +1230,6 @@ fsp_try_extend_data_file( ...@@ -1221,8 +1230,6 @@ fsp_try_extend_data_file(
/* We ignore any fragments of a full megabyte when storing the size /* We ignore any fragments of a full megabyte when storing the size
to the space header */ to the space header */
zip_size = mach_read_from_4(header + FSP_PAGE_ZIP_SIZE);
if (!zip_size) { if (!zip_size) {
new_size = ut_calc_align_down(actual_size, new_size = ut_calc_align_down(actual_size,
(1024 * 1024) / UNIV_PAGE_SIZE); (1024 * 1024) / UNIV_PAGE_SIZE);
......
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