diff options
author | unknown <heikki@hundin.mysql.fi> | 2003-11-03 19:11:09 +0200 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2003-11-03 19:11:09 +0200 |
commit | 8b648b03366a0037b178d5c17a728eda9cccb0e3 (patch) | |
tree | 16d8e94df9055bb6ed7e41eb7afbcdebf5b61236 /innobase/fsp | |
parent | 35564d9fbb1a873247f7d85ecfdd7f475139764c (diff) | |
download | mariadb-git-8b648b03366a0037b178d5c17a728eda9cccb0e3.tar.gz |
Many files:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/buf/buf0buf.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/dict/dict0crea.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/dict/dict0dict.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/fil/fil0fil.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/fsp/fsp0fsp.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/include/fil0fil.h:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/include/fsp0fsp.h:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/include/log0recv.h:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/include/mtr0log.h:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/include/mtr0mtr.h:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/include/os0file.h:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/include/ut0dbg.h:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/include/ut0ut.h:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/include/ha0ha.ic:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/include/mtr0log.ic:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/log/log0log.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/log/log0recv.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/mem/mem0pool.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/os/os0file.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/pars/lexyy.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/row/row0mysql.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/row/row0sel.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/srv/srv0srv.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/srv/srv0start.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/ut/ut0rnd.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
innobase/ut/ut0ut.c:
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
Diffstat (limited to 'innobase/fsp')
-rw-r--r-- | innobase/fsp/fsp0fsp.c | 90 |
1 files changed, 61 insertions, 29 deletions
diff --git a/innobase/fsp/fsp0fsp.c b/innobase/fsp/fsp0fsp.c index 7c4d691ea13..8ceea03f34a 100644 --- a/innobase/fsp/fsp0fsp.c +++ b/innobase/fsp/fsp0fsp.c @@ -27,6 +27,10 @@ Created 11/29/1995 Heikki Tuuri #include "dict0mem.h" #include "log0log.h" + +#define FSP_HEADER_OFFSET FIL_PAGE_DATA /* Offset of the space header + within a file page */ + /* The data structures in files are defined just as byte strings in C */ typedef byte fsp_header_t; typedef byte xdes_t; @@ -38,8 +42,6 @@ File space header data structure: this data structure is contained in the first page of a space. The space for this header is reserved in every extent descriptor page, but used only in the first. */ -#define FSP_HEADER_OFFSET FIL_PAGE_DATA /* Offset of the space header - within a file page */ /*-------------------------------------*/ #define FSP_SPACE_ID 0 /* space id */ #define FSP_NOT_USED 4 /* this field contained a value up to @@ -90,7 +92,6 @@ descriptor page, but used only in the first. */ #define FSP_FREE_ADD 4 /* this many free extents are added to the free list from above FSP_FREE_LIMIT at a time */ - /* FILE SEGMENT INODE ================== @@ -298,6 +299,19 @@ fseg_alloc_free_page_low( FSP_UP, FSP_NO_DIR */ mtr_t* mtr); /* in: mtr handle */ + +/************************************************************************** +Reads the file space size stored in the header page. */ + +ulint +fsp_get_size_low( +/*=============*/ + /* out: tablespace size stored in the space header */ + page_t* page) /* in: header page (page 0 in the tablespace) */ +{ + return(mach_read_from_4(page + FSP_HEADER_OFFSET + FSP_SIZE)); +} + /************************************************************************** Gets a pointer to the space header and x-locks its page. */ UNIV_INLINE @@ -1034,8 +1048,9 @@ fsp_try_extend_data_file_with_pages( fsp_header_t* header, /* in: space header */ mtr_t* mtr) /* in: mtr */ { - ulint size; ibool success; + ulint actual_size; + ulint size; ut_a(space != 0); @@ -1043,12 +1058,12 @@ fsp_try_extend_data_file_with_pages( ut_a(page_no >= size); - success = fil_extend_data_file_with_pages(space, size, page_no + 1); - - if (success) { - mlog_write_ulint(header + FSP_SIZE, page_no + 1, MLOG_4BYTES, - mtr); - } + success = fil_extend_space_to_desired_size(&actual_size, space, + page_no + 1); + /* actual_size now has the space size in pages; it may be less than + we wanted if we ran out of disk space */ + + mlog_write_ulint(header + FSP_SIZE, actual_size, MLOG_4BYTES, mtr); return(success); } @@ -1060,13 +1075,20 @@ ibool fsp_try_extend_data_file( /*=====================*/ /* out: FALSE if not auto-extending */ - ulint* actual_increase,/* out: actual increase in pages */ + ulint* actual_increase,/* out: actual increase in pages, where + we measure the tablespace size from + what the header field says; it may be + the actual file size rounded down to + megabyte */ ulint space, /* in: space */ fsp_header_t* header, /* in: space header */ mtr_t* mtr) /* in: mtr */ { ulint size; + ulint new_size; + ulint old_size; ulint size_increase; + ulint actual_size; ibool success; *actual_increase = 0; @@ -1078,6 +1100,8 @@ fsp_try_extend_data_file( size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr); + old_size = size; + if (space == 0 && srv_last_file_size_max != 0) { if (srv_last_file_size_max < srv_data_file_sizes[srv_n_data_files - 1]) { @@ -1107,8 +1131,12 @@ fsp_try_extend_data_file( success = fsp_try_extend_data_file_with_pages( space, FSP_EXTENT_SIZE - 1, header, mtr); - if (!success) { + new_size = mtr_read_ulint( + header + FSP_SIZE, MLOG_4BYTES, mtr); + + *actual_increase = new_size - old_size; + return(FALSE); } @@ -1118,7 +1146,10 @@ fsp_try_extend_data_file( if (size < 32 * FSP_EXTENT_SIZE) { size_increase = FSP_EXTENT_SIZE; } else { - size_increase = 8 * FSP_EXTENT_SIZE; + /* Below in fsp_fill_free_list() we assume + that we add at most FSP_FREE_ADD extents at + a time */ + size_increase = FSP_FREE_ADD * FSP_EXTENT_SIZE; } } } @@ -1128,18 +1159,17 @@ fsp_try_extend_data_file( return(TRUE); } - /* Extend the data file. If we are not able to extend the full - requested length, the function tells how many pages we were able to - extend so that the size of the tablespace would be divisible by 1 MB - (we possibly managed to extend more, but we only take into account - full megabytes). */ - - success = fil_extend_last_data_file(actual_increase, space, size, - size_increase); - if (success) { - mlog_write_ulint(header + FSP_SIZE, size + *actual_increase, + success = fil_extend_space_to_desired_size(&actual_size, space, + size + size_increase); + /* We ignore any fragments of a full megabyte when storing the size + to the space header */ + + mlog_write_ulint(header + FSP_SIZE, + ut_calc_align_down(actual_size, (1024 * 1024) / UNIV_PAGE_SIZE), MLOG_4BYTES, mtr); - } + new_size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr); + + *actual_increase = new_size - old_size; return(TRUE); } @@ -1186,8 +1216,10 @@ fsp_fill_free_list( size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr); } - if (space != 0 && !init_space) { - /* Try to increase the data file size */ + if (space != 0 && !init_space + && size < limit + FSP_EXTENT_SIZE * FSP_FREE_ADD) { + + /* Try to increase the .ibd file size */ fsp_try_extend_data_file(&actual_increase, space, header, mtr); size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr); } @@ -1222,7 +1254,7 @@ fsp_fill_free_list( fsp_init_file_page(descr_page, mtr); } - /* Initialize the ibuf page in a separate + /* Initialize the ibuf bitmap page in a separate mini-transaction because it is low in the latching order, and we must be able to release its latch before returning from the fsp routine */ @@ -1797,7 +1829,7 @@ fsp_free_seg_inode( flst_remove(space_header + FSP_SEG_INODES_FREE, page + FSEG_INODE_PAGE_NODE, mtr); - fsp_free_page(space, buf_frame_get_page_no(page), mtr); + fsp_free_page(space, buf_frame_get_page_no(page), mtr); } } @@ -3157,7 +3189,7 @@ fseg_free_step( freed yet */ ut_a(descr); - ut_anp(xdes_get_bit(descr, XDES_FREE_BIT, buf_frame_get_page_no(header) + ut_a(xdes_get_bit(descr, XDES_FREE_BIT, buf_frame_get_page_no(header) % FSP_EXTENT_SIZE, mtr) == FALSE); inode = fseg_inode_get(header, mtr); |