summaryrefslogtreecommitdiff
path: root/storage/xtradb/srv/srv0start.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-02-23 21:35:05 +0100
committerSergei Golubchik <serg@mariadb.org>2016-02-23 21:35:05 +0100
commita5679af1b13bb0c7c4eaa75f27551072dc18fb7d (patch)
tree7d039fb5e83c331daa75f9b9b67625b0469f6a9b /storage/xtradb/srv/srv0start.cc
parent20c4dfd4a9e7c5f2f570488a7ead0b7c74e61817 (diff)
parent5f2f3c4fa81851b45dcee33601f14e05f6407333 (diff)
downloadmariadb-git-a5679af1b13bb0c7c4eaa75f27551072dc18fb7d.tar.gz
Merge branch '10.0' into 10.1
Diffstat (limited to 'storage/xtradb/srv/srv0start.cc')
-rw-r--r--storage/xtradb/srv/srv0start.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc
index e0f9bde63fa..17f9e53e76f 100644
--- a/storage/xtradb/srv/srv0start.cc
+++ b/storage/xtradb/srv/srv0start.cc
@@ -188,6 +188,9 @@ static const ulint SRV_UNDO_TABLESPACE_SIZE_IN_PAGES =
#define SRV_N_PENDING_IOS_PER_THREAD OS_AIO_N_PENDING_IOS_PER_THREAD
#define SRV_MAX_N_PENDING_SYNC_IOS 100
+/** The round off to MB is similar as done in srv_parse_megabytes() */
+#define CALC_NUMBER_OF_PAGES(size) ((size) / (1024 * 1024)) * \
+ ((1024 * 1024) / (UNIV_PAGE_SIZE))
#ifdef UNIV_PFS_THREAD
/* Keys to register InnoDB threads with performance schema */
UNIV_INTERN mysql_pfs_key_t io_handler_thread_key;
@@ -1020,10 +1023,16 @@ open_or_create_data_files(
size_check:
size = os_file_get_size(files[i]);
ut_a(size != (os_offset_t) -1);
- /* Round size downward to megabytes */
- rounded_size_pages = (ulint)
- (size >> UNIV_PAGE_SIZE_SHIFT);
+ /* Under some error conditions like disk full
+ narios or file size reaching filesystem
+ limit the data file could contain an incomplete
+ extent at the end. When we extend a data file
+ and if some failure happens, then also the data
+ file could contain an incomplete extent. So we
+ need to round the size downward to a megabyte.*/
+
+ rounded_size_pages = (ulint) CALC_NUMBER_OF_PAGES(size);
if (i == srv_n_data_files - 1
&& srv_auto_extend_last_data_file) {