summaryrefslogtreecommitdiff
path: root/innobase/fil
diff options
context:
space:
mode:
authormarko@hundin.mysql.fi <>2005-06-27 17:04:57 +0300
committermarko@hundin.mysql.fi <>2005-06-27 17:04:57 +0300
commit8064ee217f481d3866dbaab62b237bed6b61864b (patch)
treea7a00b4e2ad6dd6e0c65489e27cfac46b4bda0e3 /innobase/fil
parent87d681c7bb0151709f7236c2ebff44fa0d9330c5 (diff)
downloadmariadb-git-8064ee217f481d3866dbaab62b237bed6b61864b.tar.gz
InnoDB: Optimize the extension of files. This will greatly speed
up CREATE TABLE in innodb_file_per_table=1 mode.
Diffstat (limited to 'innobase/fil')
-rw-r--r--innobase/fil/fil0fil.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c
index 9d5def718a6..e83d2fcde32 100644
--- a/innobase/fil/fil0fil.c
+++ b/innobase/fil/fil0fil.c
@@ -3400,9 +3400,9 @@ fil_extend_space_to_desired_size(
fil_space_t* space;
byte* buf2;
byte* buf;
+ ulint buf_size;
ulint start_page_no;
ulint file_start_page_no;
- ulint n_pages;
ulint offset_high;
ulint offset_low;
ibool success = TRUE;
@@ -3427,22 +3427,20 @@ fil_extend_space_to_desired_size(
fil_node_prepare_for_io(node, system, space);
- /* Extend 1 MB at a time */
-
- buf2 = mem_alloc(1024 * 1024 + UNIV_PAGE_SIZE);
- buf = ut_align(buf2, UNIV_PAGE_SIZE);
-
- memset(buf, '\0', 1024 * 1024);
-
start_page_no = space->size;
file_start_page_no = space->size - node->size;
- while (start_page_no < size_after_extend) {
- n_pages = size_after_extend - start_page_no;
+ /* Extend at most 64 pages at a time */
+ buf_size = ut_min(64, size_after_extend - start_page_no)
+ * UNIV_PAGE_SIZE;
+ buf2 = mem_alloc(buf_size + UNIV_PAGE_SIZE);
+ buf = ut_align(buf2, UNIV_PAGE_SIZE);
- if (n_pages > (1024 * 1024) / UNIV_PAGE_SIZE) {
- n_pages = (1024 * 1024) / UNIV_PAGE_SIZE;
- }
+ memset(buf, 0, buf_size);
+
+ while (start_page_no < size_after_extend) {
+ ulint n_pages = ut_min(buf_size / UNIV_PAGE_SIZE,
+ size_after_extend - start_page_no);
offset_high = (start_page_no - file_start_page_no)
/ (4096 * ((1024 * 1024) / UNIV_PAGE_SIZE));