row0sel.c:

  If MySQL tries to do SELECT from an InnoDB table, but has set no table locks at all in ::external_lock(), print a descriptive error message and assert; some subquery bugs were of this type
parent 4cbf1e51
......@@ -2758,6 +2758,7 @@ row_search_for_mysql(
ulint cnt = 0;
ulint next_offs;
mtr_t mtr;
char err_buf[1000];
ut_ad(index && pcur && search_tuple);
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
......@@ -2773,6 +2774,17 @@ row_search_for_mysql(
ut_a(0);
}
if (trx->n_mysql_tables_in_use == 0) {
trx_print(err_buf, trx);
fprintf(stderr,
"InnoDB: Error: MySQL is trying to perform a SELECT\n"
"InnoDB: but it has not locked any tables in ::external_lock()!\n%s\n",
err_buf);
ut_a(0);
}
/* printf("Match mode %lu\n search tuple ", match_mode);
dtuple_print(search_tuple);
......@@ -3072,6 +3084,16 @@ row_search_for_mysql(
if (!prebuilt->sql_stat_start) {
/* No need to set an intention lock or assign a read view */
if (trx->read_view == NULL
&& prebuilt->select_lock_type == LOCK_NONE) {
trx_print(err_buf, trx);
fprintf(stderr,
"InnoDB: Error: MySQL is trying to perform a consistent read\n"
"InnoDB: but the read view is not assigned!\n%s\n", err_buf);
ut_a(0);
}
} else if (prebuilt->select_lock_type == LOCK_NONE) {
/* This is a consistent read */
/* Assign a read view for the query */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment