Commit 32a4e783 authored by unknown's avatar unknown

Fix results for mix_innodb_myisam_binlog

Optimize calls to current_thd


mysql-test/r/mix_innodb_myisam_binlog.result:
  updated results
mysql-test/t/mix_innodb_myisam_binlog.test:
  Fix for 4.1
sql/ha_innodb.cc:
  Don't call current_thd in an assert that is not deleted in release version
  (Because current_thd is slow)
parent 3500763b
......@@ -19,7 +19,8 @@ begin;
insert into t1 values(2);
insert into t2 select * from t1;
rollback;
Warning: Some non-transactional changed tables couldn't be rolled back
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 Query 1 79 use `test`; BEGIN
......@@ -35,7 +36,8 @@ savepoint my_savepoint;
insert into t1 values(4);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
Warning: Some non-transactional changed tables couldn't be rolled back
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
commit;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
......@@ -55,7 +57,8 @@ savepoint my_savepoint;
insert into t1 values(6);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
Warning: Some non-transactional changed tables couldn't be rolled back
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
insert into t1 values(7);
commit;
select a from t1 order by a;
......
......@@ -35,7 +35,6 @@ begin;
insert into t1 values(2);
insert into t2 select * from t1;
# should say some changes to non-transact1onal tables couldn't be rolled back
--error 1196
rollback;
show binlog events from 79;
......@@ -49,7 +48,6 @@ insert into t1 values(3);
savepoint my_savepoint;
insert into t1 values(4);
insert into t2 select * from t1;
--error 1196
rollback to savepoint my_savepoint;
commit;
......@@ -64,7 +62,6 @@ insert into t1 values(5);
savepoint my_savepoint;
insert into t1 values(6);
insert into t2 select * from t1;
--error 1196
rollback to savepoint my_savepoint;
insert into t1 values(7);
commit;
......
......@@ -393,7 +393,7 @@ check_trx_exists(
{
trx_t* trx;
ut_a(thd == current_thd);
DBUG_ASSERT(thd == current_thd);
trx = (trx_t*) thd->transaction.all.innobase_tid;
......@@ -1807,7 +1807,7 @@ build_template(
ibool fetch_all_in_key = FALSE;
ulint i;
ut_a(templ_type != ROW_MYSQL_REC_FIELDS || thd == current_thd);
DBUG_ASSERT(templ_type != ROW_MYSQL_REC_FIELDS || thd == current_thd);
clust_index = dict_table_get_first_index_noninline(prebuilt->table);
......@@ -1978,7 +1978,7 @@ ha_innobase::write_row(
DBUG_ENTER("ha_innobase::write_row");
ut_a(prebuilt->trx ==
DBUG_ASSERT(prebuilt->trx ==
(trx_t*) current_thd->transaction.all.innobase_tid);
statistic_increment(ha_write_count, &LOCK_status);
......@@ -2351,7 +2351,7 @@ ha_innobase::update_row(
DBUG_ENTER("ha_innobase::update_row");
ut_a(prebuilt->trx ==
DBUG_ASSERT(prebuilt->trx ==
(trx_t*) current_thd->transaction.all.innobase_tid);
if (table->time_stamp) {
......@@ -2413,7 +2413,7 @@ ha_innobase::delete_row(
DBUG_ENTER("ha_innobase::delete_row");
ut_a(prebuilt->trx ==
DBUG_ASSERT(prebuilt->trx ==
(trx_t*) current_thd->transaction.all.innobase_tid);
if (last_query_id != user_thd->query_id) {
......@@ -2591,7 +2591,7 @@ ha_innobase::index_read(
DBUG_ENTER("index_read");
ut_a(prebuilt->trx ==
DBUG_ASSERT(prebuilt->trx ==
(trx_t*) current_thd->transaction.all.innobase_tid);
statistic_increment(ha_read_key_count, &LOCK_status);
......@@ -2705,12 +2705,9 @@ ha_innobase::change_active_index(
statistic_increment(ha_read_key_count, &LOCK_status);
DBUG_ENTER("change_active_index");
DBUG_ASSERT(user_thd == current_thd);
ut_a(prebuilt->trx ==
(trx_t*) current_thd->transaction.all.innobase_tid);
ut_a(user_thd == current_thd);
ut_a(prebuilt->trx ==
(trx_t*) current_thd->transaction.all.innobase_tid);
(trx_t*) user_thd->transaction.all.innobase_tid);
active_index = keynr;
......@@ -2795,7 +2792,7 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
ut_a(prebuilt->trx ==
DBUG_ASSERT(prebuilt->trx ==
(trx_t*) current_thd->transaction.all.innobase_tid);
innodb_srv_conc_enter_innodb(prebuilt->trx);
......@@ -3029,7 +3026,7 @@ ha_innobase::rnd_pos(
statistic_increment(ha_read_rnd_count, &LOCK_status);
ut_a(prebuilt->trx ==
DBUG_ASSERT(prebuilt->trx ==
(trx_t*) current_thd->transaction.all.innobase_tid);
if (prebuilt->clust_index_was_generated) {
......@@ -3078,7 +3075,7 @@ ha_innobase::position(
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
uint len;
ut_a(prebuilt->trx ==
DBUG_ASSERT(prebuilt->trx ==
(trx_t*) current_thd->transaction.all.innobase_tid);
if (prebuilt->clust_index_was_generated) {
......@@ -3361,7 +3358,7 @@ ha_innobase::create(
/* Get the transaction associated with the current thd, or create one
if not yet created */
parent_trx = check_trx_exists(current_thd);
parent_trx = check_trx_exists(thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
......@@ -3474,10 +3471,10 @@ ha_innobase::create(
}
}
if (current_thd->query != NULL) {
if (thd->query != NULL) {
error = row_table_add_foreign_constraints(trx,
current_thd->query, norm_name);
thd->query, norm_name);
error = convert_error_code_to_mysql(error, NULL);
......@@ -3534,13 +3531,13 @@ ha_innobase::delete_table(
trx_t* parent_trx;
trx_t* trx;
char norm_name[1000];
THD *thd= current_thd;
DBUG_ENTER("ha_innobase::delete_table");
/* Get the transaction associated with the current thd, or create one
if not yet created */
parent_trx = check_trx_exists(current_thd);
parent_trx = check_trx_exists(thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
......@@ -3555,8 +3552,8 @@ ha_innobase::delete_table(
trx = trx_allocate_for_mysql();
trx->mysql_thd = current_thd;
trx->mysql_query_str = &((*current_thd).query);
trx->mysql_thd = thd;
trx->mysql_query_str = &(thd->query);
name_len = strlen(name);
......@@ -3609,11 +3606,12 @@ innobase_drop_database(
char* ptr;
int error;
char namebuf[10000];
THD *thd= current_thd;
/* Get the transaction associated with the current thd, or create one
if not yet created */
parent_trx = check_trx_exists(current_thd);
parent_trx = check_trx_exists(thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
......@@ -3636,8 +3634,8 @@ innobase_drop_database(
my_casedn_str(system_charset_info, namebuf);
#endif
trx = trx_allocate_for_mysql();
trx->mysql_thd = current_thd;
trx->mysql_query_str = &((*current_thd).query);
trx->mysql_thd = thd;
trx->mysql_query_str = &(thd->query);
error = row_drop_database_for_mysql(namebuf, trx);
......@@ -3677,13 +3675,14 @@ ha_innobase::rename_table(
trx_t* trx;
char norm_from[1000];
char norm_to[1000];
THD *thd= current_thd;
DBUG_ENTER("ha_innobase::rename_table");
/* Get the transaction associated with the current thd, or create one
if not yet created */
parent_trx = check_trx_exists(current_thd);
parent_trx = check_trx_exists(thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
......@@ -3697,8 +3696,8 @@ ha_innobase::rename_table(
}
trx = trx_allocate_for_mysql();
trx->mysql_thd = current_thd;
trx->mysql_query_str = &((*current_thd).query);
trx->mysql_thd = thd;
trx->mysql_query_str = &(thd->query);
name_len1 = strlen(from);
name_len2 = strlen(to);
......
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