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