diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2023-01-03 17:16:53 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2023-01-03 17:17:04 +0530 |
commit | 6fc48d1cfaaba5650d7b5588d962814f87fe9c3c (patch) | |
tree | 47ef27119c327adc2682cc391ceccd9587dd178f | |
parent | 6d6e721b60443ee3216011a97ca0712897bce860 (diff) | |
download | mariadb-git-bb-10.7-MDEV-30321.tar.gz |
MDEV-30321 blob data corrupted by row_merge_write_blob_to_tmp_file()bb-10.7-MDEV-30321
- This is caused by commit 03ed2e9d97e61104f4c1c863afd1cc5e6909a8ff
(MDEV-27318). InnoDB stores the blob data in wrong offset in temporary
file and writes the correct offset.
-rw-r--r-- | mysql-test/suite/innodb/r/insert_into_empty.result | 15 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/insert_into_empty.test | 17 | ||||
-rw-r--r-- | storage/innobase/row/row0merge.cc | 2 |
3 files changed, 33 insertions, 1 deletions
diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result index dd4451deaa2..ece55b7b07e 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty.result +++ b/mysql-test/suite/innodb/r/insert_into_empty.result @@ -387,4 +387,19 @@ Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= @format; +# +# MDEV-30321 blob data corrupted by row_merge_write_blob_to_tmp_file() +# +CREATE TABLE t1 ( +`id` int(11) NOT NULL, +`data` LONGBLOB NOT NULL, +PRIMARY KEY (`id`) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1, REPEAT('X', @@innodb_sort_buffer_size)), +(2, REPEAT('X', @@innodb_sort_buffer_size)); +SELECT COUNT(*) AS nb_corrupted_rows FROM t1 WHERE data != REPEAT('X', @@innodb_sort_buffer_size); +nb_corrupted_rows +0 +DROP TABLE t1; # End of 10.7 tests diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test index fab1b882868..468b150aae0 100644 --- a/mysql-test/suite/innodb/t/insert_into_empty.test +++ b/mysql-test/suite/innodb/t/insert_into_empty.test @@ -405,4 +405,21 @@ CHECK TABLE t1; DROP TABLE t1; SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= @format; +--echo # +--echo # MDEV-30321 blob data corrupted by row_merge_write_blob_to_tmp_file() +--echo # + +CREATE TABLE t1 ( + `id` int(11) NOT NULL, + `data` LONGBLOB NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES + (1, REPEAT('X', @@innodb_sort_buffer_size)), + (2, REPEAT('X', @@innodb_sort_buffer_size)); + +SELECT COUNT(*) AS nb_corrupted_rows FROM t1 WHERE data != REPEAT('X', @@innodb_sort_buffer_size); +DROP TABLE t1; + --echo # End of 10.7 tests diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 7683c4dbedc..9b521f6d476 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -1066,7 +1066,7 @@ static dberr_t row_merge_write_blob_to_tmp_file( uint32_t len= field->len; dberr_t err= os_file_write( IORequestWrite, "(bulk insert)", blob_file->fd, - field->data, blob_file->offset * srv_page_size, len); + field->data, blob_file->offset, len); if (err != DB_SUCCESS) return err; |