Skip to content

Commit a70b896

Browse files
author
Jan Lindström
committed
MDEV-9424: Server crashes when slave works with partitioned tables copied from Windows to Linux
Add check to avoid NULL-pointer access and added warning if share->ib_table is not what expected.
1 parent c0b6c27 commit a70b896

File tree

1 file changed

+63
-9
lines changed

1 file changed

+63
-9
lines changed

storage/xtradb/handler/ha_innodb.cc

Lines changed: 63 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7563,7 +7563,13 @@ ha_innobase::write_row(
75637563

75647564
ha_statistic_increment(&SSV::ha_write_count);
75657565

7566-
if (UNIV_UNLIKELY(share->ib_table->is_corrupt)) {
7566+
if (share->ib_table != prebuilt->table) {
7567+
fprintf(stderr,
7568+
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
7569+
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
7570+
}
7571+
7572+
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
75677573
DBUG_RETURN(HA_ERR_CRASHED);
75687574
}
75697575

@@ -7799,7 +7805,13 @@ ha_innobase::write_row(
77997805
func_exit:
78007806
innobase_active_small();
78017807

7802-
if (UNIV_UNLIKELY(share->ib_table->is_corrupt)) {
7808+
if (share->ib_table != prebuilt->table) {
7809+
fprintf(stderr,
7810+
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
7811+
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
7812+
}
7813+
7814+
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
78037815
DBUG_RETURN(HA_ERR_CRASHED);
78047816
}
78057817

@@ -8131,7 +8143,13 @@ ha_innobase::update_row(
81318143

81328144
ha_statistic_increment(&SSV::ha_update_count);
81338145

8134-
if (UNIV_UNLIKELY(share->ib_table->is_corrupt)) {
8146+
if (share->ib_table != prebuilt->table) {
8147+
fprintf(stderr,
8148+
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
8149+
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
8150+
}
8151+
8152+
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
81358153
DBUG_RETURN(HA_ERR_CRASHED);
81368154
}
81378155

@@ -8228,7 +8246,13 @@ ha_innobase::update_row(
82288246

82298247
innobase_active_small();
82308248

8231-
if (UNIV_UNLIKELY(share->ib_table->is_corrupt)) {
8249+
if (share->ib_table != prebuilt->table) {
8250+
fprintf(stderr,
8251+
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
8252+
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
8253+
}
8254+
8255+
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
82328256
DBUG_RETURN(HA_ERR_CRASHED);
82338257
}
82348258

@@ -11097,7 +11121,13 @@ ha_innobase::truncate()
1109711121

1109811122
update_thd(ha_thd());
1109911123

11100-
if (UNIV_UNLIKELY(share->ib_table->is_corrupt)) {
11124+
if (share->ib_table != prebuilt->table) {
11125+
fprintf(stderr,
11126+
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
11127+
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
11128+
}
11129+
11130+
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
1110111131
DBUG_RETURN(HA_ERR_CRASHED);
1110211132
}
1110311133

@@ -11112,7 +11142,13 @@ ha_innobase::truncate()
1111211142

1111311143
err = row_truncate_table_for_mysql(prebuilt->table, prebuilt->trx);
1111411144

11115-
if (UNIV_UNLIKELY(share->ib_table->is_corrupt)) {
11145+
if (share->ib_table != prebuilt->table) {
11146+
fprintf(stderr,
11147+
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
11148+
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
11149+
}
11150+
11151+
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
1111611152
DBUG_RETURN(HA_ERR_CRASHED);
1111711153
}
1111811154

@@ -12407,7 +12443,13 @@ ha_innobase::analyze(
1240712443
{
1240812444
int ret;
1240912445

12410-
if (UNIV_UNLIKELY(share->ib_table->is_corrupt)) {
12446+
if (share->ib_table != prebuilt->table) {
12447+
fprintf(stderr,
12448+
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
12449+
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
12450+
}
12451+
12452+
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
1241112453
return(HA_ADMIN_CORRUPT);
1241212454
}
1241312455

@@ -12417,7 +12459,13 @@ ha_innobase::analyze(
1241712459
HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE,
1241812460
true /* this is ANALYZE */);
1241912461

12420-
if (UNIV_UNLIKELY(share->ib_table->is_corrupt)) {
12462+
if (share->ib_table != prebuilt->table) {
12463+
fprintf(stderr,
12464+
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
12465+
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
12466+
}
12467+
12468+
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
1242112469
return(HA_ADMIN_CORRUPT);
1242212470
}
1242312471

@@ -13585,7 +13633,13 @@ ha_innobase::transactional_table_lock(
1358513633

1358613634
update_thd(thd);
1358713635

13588-
if (UNIV_UNLIKELY(share->ib_table->is_corrupt)) {
13636+
if (share->ib_table != prebuilt->table) {
13637+
fprintf(stderr,
13638+
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
13639+
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
13640+
}
13641+
13642+
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
1358913643
DBUG_RETURN(HA_ERR_CRASHED);
1359013644
}
1359113645

0 commit comments

Comments
 (0)