Commit 919b6dcd authored by marko's avatar marko

Remove ha_innobase::last_query_id and references to thd->query_id.

MySQL calls external_lock at the beginning and end of a statement
when it is not calling start_stmt or commit or rollback.  Thus,
statement boundaries can be (and are already) detected without
monitoring thd->query_id.

The function innobase_commit() seemingly lacks the call to
innobase_release_stat_resources(), which should be called at
the end of every SQL statement.  The call was replaced by
equivalent statements by Vadim Tkachenko when he implemented
innodb_commit_concurrency in MySQL 5.0:

http://mysql.bkbits.net:8080/mysql-5.0/?PAGE=patch&REV=1.1886.70.1
parent 49bc0a57
......@@ -2402,8 +2402,6 @@ ha_innobase::open(
user_thd = NULL;
last_query_id = (ulong)-1;
if (!(share=get_share(name))) {
DBUG_RETURN(1);
......@@ -3446,13 +3444,6 @@ ha_innobase::write_row(
num_write_row++;
if (last_query_id != user_thd->query_id) {
prebuilt->sql_stat_start = TRUE;
last_query_id = user_thd->query_id;
innobase_release_stat_resources(prebuilt->trx);
}
if (table->next_number_field && record == table->record[0]) {
/* This is the case where the table has an
auto-increment column */
......@@ -3607,13 +3598,6 @@ calc_row_difference(
for (i = 0; i < n_fields; i++) {
field = table->field[i];
/* if (thd->query_id != field->query_id) { */
/* TODO: check that these fields cannot have
changed! */
/* goto skip_field;
}*/
o_ptr = (byte*) old_row + get_field_offset(table, field);
n_ptr = (byte*) new_row + get_field_offset(table, field);
......@@ -3745,13 +3729,6 @@ ha_innobase::update_row(
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
if (last_query_id != user_thd->query_id) {
prebuilt->sql_stat_start = TRUE;
last_query_id = user_thd->query_id;
innobase_release_stat_resources(trx);
}
if (prebuilt->upd_node) {
uvect = prebuilt->upd_node->update;
} else {
......@@ -3802,13 +3779,6 @@ ha_innobase::delete_row(
ut_a(prebuilt->trx == trx);
if (last_query_id != user_thd->query_id) {
prebuilt->sql_stat_start = TRUE;
last_query_id = user_thd->query_id;
innobase_release_stat_resources(trx);
}
if (!prebuilt->upd_node) {
row_get_prebuilt_update_vector(prebuilt);
}
......@@ -3844,15 +3814,6 @@ ha_innobase::unlock_row(void)
{
DBUG_ENTER("ha_innobase::unlock_row");
if (UNIV_UNLIKELY(last_query_id != user_thd->query_id)) {
ut_print_timestamp(stderr);
sql_print_error("last_query_id is %lu != user_thd_query_id is "
"%lu", (ulong) last_query_id,
(ulong) user_thd->query_id);
mem_analyze_corruption(prebuilt->trx);
ut_error;
}
/* Consistent read does not take any locks, thus there is
nothing to unlock. */
......@@ -4060,13 +4021,6 @@ ha_innobase::index_read(
ha_statistic_increment(&SSV::ha_read_key_count);
if (last_query_id != user_thd->query_id) {
prebuilt->sql_stat_start = TRUE;
last_query_id = user_thd->query_id;
innobase_release_stat_resources(prebuilt->trx);
}
index = prebuilt->index;
/* Note that if the index for which the search template is built is not
......
......@@ -44,8 +44,6 @@ class ha_innobase: public handler
THD* user_thd; /* the thread handle of the user
currently using the handle; this is
set in external_lock function */
query_id_t last_query_id; /* the latest query id where the
handle was used */
THR_LOCK_DATA lock;
INNOBASE_SHARE *share;
......
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