Skip to content

Commit 1ffded4

Browse files
gurusamidahlerlend
authored andcommitted
Bug #28825617 ASSERTION FAILURE: LOB0LOB.CC.*TRX == NULLPTR || TRX->IS_READ_UNCOMMITTED()
Post push fix. Adding a test case. Also fixing doxygen errors.
1 parent 0ca968f commit 1ffded4

File tree

5 files changed

+134
-2
lines changed

5 files changed

+134
-2
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#
2+
# Bug #28825617 ASSERTION FAILURE: LOB0LOB.CC.*TRX == NULLPTR
3+
# || TRX->IS_READ_UNCOMMITTED()
4+
#
5+
CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT, c TEXT, INDEX (b(1)));
6+
SHOW CREATE TABLE t1;
7+
Table Create Table
8+
t1 CREATE TABLE `t1` (
9+
`a` int(11) NOT NULL,
10+
`b` text,
11+
`c` text,
12+
PRIMARY KEY (`a`),
13+
KEY `b` (`b`(1))
14+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
15+
# Connection con1:
16+
INSERT INTO t1 (a, b, c) VALUES (1, 'hello', repeat('blob ', 12345));
17+
BEGIN;
18+
UPDATE t1 SET b=repeat('blob', 12345), c = 'world' where a = 1;
19+
# Connection default:
20+
set debug = '+d, innodb_cached_old_vers_offsets';
21+
CHECK TABLE t1;
22+
ERROR HY000: Lost connection to MySQL server during query
23+
# restart
24+
DROP TABLE t1;
25+
#
26+
# Repeat the scenario without the debug point.
27+
#
28+
CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT, c TEXT, INDEX (b(1)));
29+
SHOW CREATE TABLE t1;
30+
Table Create Table
31+
t1 CREATE TABLE `t1` (
32+
`a` int(11) NOT NULL,
33+
`b` text,
34+
`c` text,
35+
PRIMARY KEY (`a`),
36+
KEY `b` (`b`(1))
37+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
38+
# Connection con1:
39+
INSERT INTO t1 (a, b, c) VALUES (1, 'hello', repeat('blob ', 12345));
40+
BEGIN;
41+
UPDATE t1 SET b=repeat('blob', 12345), c = 'world' where a = 1;
42+
# Connection default:
43+
CHECK TABLE t1;
44+
Table Op Msg_type Msg_text
45+
test.t1 check status OK
46+
# Connection con1:
47+
commit;
48+
# Connection default:
49+
DROP TABLE t1;
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
--source include/have_debug.inc
2+
--source include/count_sessions.inc
3+
4+
# Valgrind can hang or return spurious messages on DBUG_SUICIDE
5+
--source include/not_valgrind.inc
6+
7+
--echo #
8+
--echo # Bug #28825617 ASSERTION FAILURE: LOB0LOB.CC.*TRX == NULLPTR
9+
--echo # || TRX->IS_READ_UNCOMMITTED()
10+
--echo #
11+
12+
CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT, c TEXT, INDEX (b(1)));
13+
SHOW CREATE TABLE t1;
14+
15+
--echo # Connection con1:
16+
connect (con1,localhost,root,,);
17+
INSERT INTO t1 (a, b, c) VALUES (1, 'hello', repeat('blob ', 12345));
18+
BEGIN;
19+
UPDATE t1 SET b=repeat('blob', 12345), c = 'world' where a = 1;
20+
21+
--echo # Connection default:
22+
connection default;
23+
set debug = '+d, innodb_cached_old_vers_offsets';
24+
25+
--source include/expect_crash.inc
26+
27+
--error 2013
28+
CHECK TABLE t1;
29+
30+
--source include/start_mysqld.inc
31+
disconnect con1;
32+
DROP TABLE t1;
33+
34+
--echo #
35+
--echo # Repeat the scenario without the debug point.
36+
--echo #
37+
38+
CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT, c TEXT, INDEX (b(1)));
39+
SHOW CREATE TABLE t1;
40+
41+
--echo # Connection con1:
42+
connect (con1,localhost,root,,);
43+
INSERT INTO t1 (a, b, c) VALUES (1, 'hello', repeat('blob ', 12345));
44+
BEGIN;
45+
UPDATE t1 SET b=repeat('blob', 12345), c = 'world' where a = 1;
46+
47+
--echo # Connection default:
48+
connection default;
49+
50+
CHECK TABLE t1;
51+
52+
--echo # Connection con1:
53+
connection con1;
54+
commit;
55+
56+
--echo # Connection default:
57+
connection default;
58+
disconnect con1;
59+
60+
DROP TABLE t1;
61+
62+
--source include/wait_until_count_sessions.inc

storage/innobase/lob/lob0lob.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,6 @@ bool ref_t::check_space_id(dict_index_t *index) const {
13031303
space_id_t ref_space_id = space_id();
13041304

13051305
bool lob_ref_valid = (ref_space_id == 0 || idx_space_id == ref_space_id);
1306-
ut_ad(lob_ref_valid);
13071306
return (lob_ref_valid);
13081307
}
13091308
#endif /* UNIV_DEBUG */
@@ -1362,7 +1361,9 @@ bool rec_check_lobref_space_id(dict_index_t *index, const rec_t *rec,
13621361

13631362
byte *field_ref = data + local_len;
13641363
ref_t ref(field_ref);
1365-
ut_ad(ref.check_space_id(index));
1364+
if (!ref.check_space_id(index)) {
1365+
return (false);
1366+
}
13661367
}
13671368
}
13681369
return (true);

storage/innobase/rem/rec.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ void rec_get_offsets_reverse(
414414
}
415415

416416
#ifdef UNIV_DEBUG
417+
/** Check if the given two record offsets are identical.
418+
@param[in] offsets1 field offsets of a record
419+
@param[in] offsets2 field offsets of a record
420+
@return true if they are identical, false otherwise. */
417421
bool rec_offs_cmp(ulint *offsets1, ulint *offsets2) {
418422
ulint n1 = rec_offs_n_fields(offsets1);
419423
ulint n2 = rec_offs_n_fields(offsets2);
@@ -432,10 +436,18 @@ bool rec_offs_cmp(ulint *offsets1, ulint *offsets2) {
432436
if (field_offset_1 != field_offset_2) {
433437
return (false);
434438
}
439+
440+
if (len_1 != len_2) {
441+
return (false);
442+
}
435443
}
436444
return (true);
437445
}
438446

447+
/** Print the record offsets.
448+
@param[in] out the output stream to which offsets are printed.
449+
@param[in] offsets the field offsets of the record.
450+
@return the output stream. */
439451
std::ostream &rec_offs_print(std::ostream &out, const ulint *offsets) {
440452
ulint n = rec_offs_n_fields(offsets);
441453

storage/innobase/row/row0sel.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3328,6 +3328,14 @@ dberr_t Row_sel_get_clust_rec_for_mysql::operator()(
33283328
old_vers = cached_old_vers;
33293329

33303330
if (old_vers != nullptr) {
3331+
DBUG_EXECUTE_IF("innodb_cached_old_vers_offsets", {
3332+
rec_offs_make_valid(old_vers, clust_index, *offsets);
3333+
if (!lob::rec_check_lobref_space_id(clust_index, old_vers,
3334+
*offsets)) {
3335+
DBUG_SUICIDE();
3336+
}
3337+
});
3338+
33313339
/* The offsets need not be same for the latest version of
33323340
clust_rec and its old version old_vers. Re-calculate the offsets
33333341
for old_vers. */

0 commit comments

Comments
 (0)