summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-09-11 11:49:12 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-09-11 11:49:12 +0300
commit2d0847818de8a6551da9689a184a5b1d4e9c78ac (patch)
treee808b565c256b0297957c786dce26ba616dfe865 /storage/innobase
parentf99cc0d2fc53614b8e25d076d4e6e9eb18e0bffa (diff)
parent101d10b88362b5087197c10ff09b96bf1d570ebd (diff)
downloadmariadb-git-2d0847818de8a6551da9689a184a5b1d4e9c78ac.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/dict/dict0load.cc2
-rw-r--r--storage/innobase/fil/fil0fil.cc11
-rw-r--r--storage/innobase/os/os0file.cc7
3 files changed, 14 insertions, 6 deletions
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index 8112339ebe2..a9b810b9aca 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -2571,6 +2571,7 @@ corrupted:
goto func_exit;
}
+#ifdef UNIV_DEBUG
// The following assertion doesn't hold for FTS indexes
// as it may have prefix_len=1 with any charset
if (index->type != DICT_FTS) {
@@ -2581,6 +2582,7 @@ corrupted:
% f.col->mbmaxlen == 0);
}
}
+#endif /* UNIV_DEBUG */
}
next_rec:
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 6af8b729d78..b9421df3ffb 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -578,10 +578,15 @@ fil_space_extend_must_retry(
const unsigned page_size = space->physical_size();
- /* Datafile::read_first_page() expects srv_page_size bytes.
- fil_node_t::read_page0() expects at least 4 * srv_page_size bytes.*/
+ /* Datafile::read_first_page() expects innodb_page_size bytes.
+ fil_node_t::read_page0() expects at least 4 * innodb_page_size bytes.
+ os_file_set_size() expects multiples of 4096 bytes.
+ For ROW_FORMAT=COMPRESSED tables using 1024-byte or 2048-byte
+ pages, we will preallocate up to an integer multiple of 4096 bytes,
+ and let normal writes append 1024, 2048, or 3072 bytes to the file. */
os_offset_t new_size = std::max(
- os_offset_t(size - file_start_page_no) * page_size,
+ (os_offset_t(size - file_start_page_no) * page_size)
+ & ~os_offset_t(4095),
os_offset_t(FIL_IBD_FILE_INITIAL_SIZE << srv_page_size_shift));
*success = os_file_set_size(node->name, node->handle, new_size,
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index dde1975ea08..9e1eeff202d 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -3303,6 +3303,8 @@ os_file_set_size(
os_offset_t size,
bool is_sparse)
{
+ ut_ad(!(size & 4095));
+
#ifdef _WIN32
/* On Windows, changing file size works well and as expected for both
sparse and normal files.
@@ -3344,7 +3346,7 @@ fallback:
if (current_size >= size) {
return true;
}
- current_size &= ~os_offset_t(statbuf.st_blksize - 1);
+ current_size &= ~4095ULL;
err = posix_fallocate(file, current_size,
size - current_size);
}
@@ -3384,8 +3386,7 @@ fallback:
if (fstat(file, &statbuf)) {
return false;
}
- os_offset_t current_size = statbuf.st_size
- & ~os_offset_t(statbuf.st_blksize - 1);
+ os_offset_t current_size = statbuf.st_size & ~4095ULL;
#endif
if (current_size >= size) {
return true;