summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-02-14 08:49:11 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-02-14 08:49:11 +0200
commite928fdbff1369036694320ee13b99d13fe6a3b60 (patch)
tree8f372ae14fae3862f701e2485ab5df0ccedc2985
parenta6ef239b9e3f49002617413d59262dccbb99ed87 (diff)
parente777645d483420fb65e26bb20fde4f0f9ebcd05c (diff)
downloadmariadb-git-e928fdbff1369036694320ee13b99d13fe6a3b60.tar.gz
Merge 10.2 into 10.3
-rw-r--r--mysql-test/suite/innodb/r/blob_cmp_empty.result19
-rw-r--r--mysql-test/suite/innodb/t/blob_cmp_empty.test26
-rw-r--r--mysql-test/suite/innodb_gis/disabled.def1
-rw-r--r--storage/innobase/row/row0sel.cc8
4 files changed, 53 insertions, 1 deletions
diff --git a/mysql-test/suite/innodb/r/blob_cmp_empty.result b/mysql-test/suite/innodb/r/blob_cmp_empty.result
new file mode 100644
index 00000000000..24ae8e1c01e
--- /dev/null
+++ b/mysql-test/suite/innodb/r/blob_cmp_empty.result
@@ -0,0 +1,19 @@
+connect prevent_purge,localhost,root,,;
+start transaction with consistent snapshot;
+connection default;
+SET @fill_amount = (@@innodb_page_size / 2 ) + 1;
+CREATE TABLE t1 (col_text TEXT NOT NULL, KEY (col_text(9))) ENGINE=InnoDB;
+INSERT INTO t1 (col_text) VALUES (REPEAT('x', @fill_amount));
+UPDATE t1 SET col_text='';
+UPDATE t1 SET col_text=REPEAT('y', @fill_amount);
+connect con1,localhost,root,,;
+SET @fill_amount = (@@innodb_page_size / 2 ) + 1;
+BEGIN;
+INSERT INTO t1 (col_text) VALUES (REPEAT('z', @fill_amount));
+connection default;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+disconnect con1;
+disconnect prevent_purge;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/blob_cmp_empty.test b/mysql-test/suite/innodb/t/blob_cmp_empty.test
new file mode 100644
index 00000000000..f41ac79b16f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/blob_cmp_empty.test
@@ -0,0 +1,26 @@
+--source include/innodb_row_format.inc
+--source include/count_sessions.inc
+--connect(prevent_purge,localhost,root,,)
+start transaction with consistent snapshot;
+
+--connection default
+SET @fill_amount = (@@innodb_page_size / 2 ) + 1;
+CREATE TABLE t1 (col_text TEXT NOT NULL, KEY (col_text(9))) ENGINE=InnoDB;
+
+INSERT INTO t1 (col_text) VALUES (REPEAT('x', @fill_amount));
+UPDATE t1 SET col_text='';
+UPDATE t1 SET col_text=REPEAT('y', @fill_amount);
+
+--connect(con1,localhost,root,,)
+SET @fill_amount = (@@innodb_page_size / 2 ) + 1;
+BEGIN;
+INSERT INTO t1 (col_text) VALUES (REPEAT('z', @fill_amount));
+
+--connection default
+# If the bug is not fixed, CHECK TABLE will complain about wrong secondary index
+# rows count
+CHECK TABLE t1;
+--disconnect con1
+--disconnect prevent_purge
+DROP TABLE t1;
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb_gis/disabled.def b/mysql-test/suite/innodb_gis/disabled.def
index bf500c1cb93..2d4d3686dd1 100644
--- a/mysql-test/suite/innodb_gis/disabled.def
+++ b/mysql-test/suite/innodb_gis/disabled.def
@@ -12,3 +12,4 @@
rtree_concurrent_srch : MDEV-15284 COUNT(*) mismatch
rtree_recovery : MDEV-15284 COUNT(*) mismatch
+rtree_compress2 : MDEV-16269 CHECK TABLE reports wrong count
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index fbdb03e19b4..ed5b48b59e0 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -354,11 +354,16 @@ row_sel_sec_rec_is_for_clust_rec(
}
len = clust_len;
+ ulint prefix_len = ifield->prefix_len;
if (rec_offs_nth_extern(clust_offs, clust_pos)) {
+ /* BLOB can contain prefix. */
len -= BTR_EXTERN_FIELD_REF_SIZE;
+ if (!len) {
+ goto compare_blobs;
+ }
}
- if (ulint prefix_len = ifield->prefix_len) {
+ if (prefix_len) {
len = dtype_get_at_most_n_mbchars(
col->prtype, col->mbminlen,
col->mbmaxlen, prefix_len, len,
@@ -371,6 +376,7 @@ row_sel_sec_rec_is_for_clust_rec(
check_for_blob:
if (rec_offs_nth_extern(clust_offs,
clust_pos)) {
+compare_blobs:
if (!row_sel_sec_rec_is_for_blob(
col->mtype, col->prtype,
col->mbminlen,