Commit f3009f3f authored by unknown's avatar unknown

Applied innodb-5.1-ss1381 snapshot

Bug #27381: InnoDB exits when attempting to rename table to non-existant database
  Fix Bug#27381 by calling os_file_handle_error_no_exit() instead of
  os_file_handle_error().


mysql-test/t/innodb.test:
  Applied innodb-5.1-ss1381 snapshot
  
  Revision r1373:
  Port r1372 from branches/5.0: Merge a change from MySQL AB, and remove
  the innodb_gis test case.
  
  ChangeSet
    2007/02/19 13:57:06+03:00 kaa@polly.local
    Bug#18743: Several test cases fails if "classic" configuration in 5.0
    The problem happened because those tests were using "cp932" and "ucs2"
    without checking whether these character sets are available.
    This fix moves test parts to make character set specific parts be
    tested only if they are:
    - some parts were moved to "ctype_ucs.test" and "ctype_cp932.test"
    - some parts were moved to the newly added tests "innodb-ucs2.test",
    "mysqlbinglog-cp932.test" and "sp-ucs2.test"
  
  mysql-test/t/innodb.test
    2007/02/19 13:57:02+03:00 kaa@polly.local +0 -222
    Moved ucs2-specific test cases to innodb-ucs2.test
storage/innobase/Makefile.am:
  Applied innodb-5.1-ss1381 snapshot
  
  Revision r1353:
  Makefile.am: EXTRA_DIST: Add the grammar source files to the
  source distribution of MySQL.
storage/innobase/dict/dict0dict.c:
  Applied innodb-5.1-ss1381 snapshot
  
  Revision r1350:
  Lock the data dictionary during rollback.  This removes the rare
  debug assertion failure ut_ad(mutex_own(&(dict_sys->mutex))) in
  dict_table_get_on_id() after the rollback following crash recovery.
storage/innobase/handler/ha_innodb.cc:
  Applied innodb-5.1-ss1381 snapshot
  
  Revision r1377:
  Add static qualifiers to some symbols in ha_innodb.cc that are not
  referenced from other modules.
  
  
  Revision r1380:
  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
  
  
  Revision r1355:
  class ha_innobase: Replace statistic_increment() with ha_statistic_increment().
  
  ha_innobase::change_active_index(): Do not call current_thd unless
  UNIV_DEBUG is defined.
  
  
  Revision r1369:
  Merge a change from MySQL AB:
  
  ChangeSet@1.2409.1.83  2007-03-06 10:36:15-07:00  tsmith@hindu.god
  Bug #26598: Create variable to allow turning off of statistic gathering
  on metadata commands
  
  Add innodb_stats_on_metadata option, which enables gathering
  index statistics when processing metadata commands such as
  SHOW TABLE STATUS.  Default behavior of the server does not
  change (this option is enabled by default).
  
  
  Revision r1342:
  Minor cleanup in ha_innodb.cc.
  
  Remove the unused constants HA_INNOBASE_ROWS_IN_TABLE and
  HA_INNOBASE_RANGE_COUNT.  Declare innobase_active_counter static.
  
  
  Revision r1381:
  innobase_commit(): Correct the comments and formatting that were broken when
  innodb_commit_concurrency was implemented.
  
  
  Revision r1360:
  Minor cleanup.
  
  innobase_query_caching_of_table_permitted(): Make static.
  
  ha_innobase::register_query_cache_table(): Move the function
  definition from ha_innodb.h to ha_innodb.cc.  Add comments.
storage/innobase/handler/ha_innodb.h:
  Applied innodb-5.1-ss1381 snapshot
  
  Revision r1377:
  Add static qualifiers to some symbols in ha_innodb.cc that are not
  referenced from other modules.
  
  
  Revision r1380:
  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
  
  
  Revision r1369:
  Merge a change from MySQL AB:
  
  ChangeSet@1.2409.1.83  2007-03-06 10:36:15-07:00  tsmith@hindu.god
  Bug #26598: Create variable to allow turning off of statistic gathering
  on metadata commands
  
  Add innodb_stats_on_metadata option, which enables gathering
  index statistics when processing metadata commands such as
  SHOW TABLE STATUS.  Default behavior of the server does not
  change (this option is enabled by default).
  
  
  Revision r1360:
  Minor cleanup.
  
  innobase_query_caching_of_table_permitted(): Make static.
  
  ha_innobase::register_query_cache_table(): Move the function
  definition from ha_innodb.h to ha_innodb.cc.  Add comments.
storage/innobase/include/trx0trx.h:
  Applied innodb-5.1-ss1381 snapshot
  
  Revision r1344:
  Rename the Boolean field trx->type to trx->is_purge
  and remove the constants TRX_USER and TRX_PURGE.
  
  
  Revision r1343:
  trx_sig_struct: Remove state.  It is always assigned to TRX_SIG_WAITING
  and never tested.
storage/innobase/os/os0file.c:
  Applied innodb-5.1-ss1381 snapshot
  
  Revision r1352:
  Fix typo in comment in os/os0file.c
  
  Approved by:	heikki
  
  
  
  Revision r1366:
  Fix Bug#27381 by calling os_file_handle_error_no_exit() instead of
  os_file_handle_error().
  
  Approved by:	Heikki
storage/innobase/row/row0undo.c:
  Applied innodb-5.1-ss1381 snapshot
  
  Revision r1350:
  Lock the data dictionary during rollback.  This removes the rare
  debug assertion failure ut_ad(mutex_own(&(dict_sys->mutex))) in
  dict_table_get_on_id() after the rollback following crash recovery.
storage/innobase/trx/trx0purge.c:
  Applied innodb-5.1-ss1381 snapshot
  
  Revision r1344:
  Rename the Boolean field trx->type to trx->is_purge
  and remove the constants TRX_USER and TRX_PURGE.
storage/innobase/trx/trx0trx.c:
  Applied innodb-5.1-ss1381 snapshot
  
  Revision r1344:
  Rename the Boolean field trx->type to trx->is_purge
  and remove the constants TRX_USER and TRX_PURGE.
  
  
  Revision r1343:
  trx_sig_struct: Remove state.  It is always assigned to TRX_SIG_WAITING
  and never tested.
parent c8fde97f
...@@ -1810,7 +1810,6 @@ select a,hex(s1) from t1; ...@@ -1810,7 +1810,6 @@ select a,hex(s1) from t1;
select hex(s1) from t2; select hex(s1) from t2;
drop table t2,t1; drop table t2,t1;
# Ensure that <tablename>_ibfk_0 is not mistreated as a # Ensure that <tablename>_ibfk_0 is not mistreated as a
# generated foreign key identifier. (Bug #16387) # generated foreign key identifier. (Bug #16387)
......
...@@ -89,6 +89,8 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr ...@@ -89,6 +89,8 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr
include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic include/ha_prototypes.h \ include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic include/ha_prototypes.h \
include/ut0list.h include/ut0list.ic \ include/ut0list.h include/ut0list.ic \
include/ut0wqueue.h \ include/ut0wqueue.h \
pars/make_bison.sh pars/make_flex.sh \
pars/pars0grm.y pars/pars0lex.l
CMakeLists.txt plug.in CMakeLists.txt plug.in
noinst_LIBRARIES = libinnobase.a noinst_LIBRARIES = libinnobase.a
......
...@@ -689,7 +689,8 @@ dict_table_get_on_id( ...@@ -689,7 +689,8 @@ dict_table_get_on_id(
if we are doing a rollback to handle an error in TABLE if we are doing a rollback to handle an error in TABLE
CREATE, for example, we already have the mutex! */ CREATE, for example, we already have the mutex! */
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex))
|| trx->dict_operation_lock_mode == RW_X_LATCH);
return(dict_table_get_on_id_low(table_id)); return(dict_table_get_on_id_low(table_id));
} }
......
...@@ -92,9 +92,6 @@ extern "C" { ...@@ -92,9 +92,6 @@ extern "C" {
#include "../storage/innobase/include/ha_prototypes.h" #include "../storage/innobase/include/ha_prototypes.h"
} }
#define HA_INNOBASE_ROWS_IN_TABLE 10000 /* to get optimization right */
#define HA_INNOBASE_RANGE_COUNT 100
ulong innobase_large_page_size = 0; ulong innobase_large_page_size = 0;
/* The default values for the following, type long or longlong, start-up /* The default values for the following, type long or longlong, start-up
...@@ -142,7 +139,7 @@ srv_active_wake_master_thread after each fetch or search, we only do ...@@ -142,7 +139,7 @@ srv_active_wake_master_thread after each fetch or search, we only do
it every INNOBASE_WAKE_INTERVAL'th step. */ it every INNOBASE_WAKE_INTERVAL'th step. */
#define INNOBASE_WAKE_INTERVAL 32 #define INNOBASE_WAKE_INTERVAL 32
ulong innobase_active_counter = 0; static ulong innobase_active_counter = 0;
static HASH innobase_open_tables; static HASH innobase_open_tables;
...@@ -311,13 +308,13 @@ bool innobase_show_status(handlerton *hton, THD* thd, ...@@ -311,13 +308,13 @@ bool innobase_show_status(handlerton *hton, THD* thd,
/********************************************************************* /*********************************************************************
Commits a transaction in an InnoDB database. */ Commits a transaction in an InnoDB database. */
static
void void
innobase_commit_low( innobase_commit_low(
/*================*/ /*================*/
trx_t* trx); /* in: transaction handle */ trx_t* trx); /* in: transaction handle */
SHOW_VAR innodb_status_variables[]= { static SHOW_VAR innodb_status_variables[]= {
{"buffer_pool_pages_data", {"buffer_pool_pages_data",
(char*) &export_vars.innodb_buffer_pool_pages_data, SHOW_LONG}, (char*) &export_vars.innodb_buffer_pool_pages_data, SHOW_LONG},
{"buffer_pool_pages_dirty", {"buffer_pool_pages_dirty",
...@@ -1140,7 +1137,7 @@ holding any InnoDB semaphores. The calling thread is holding the ...@@ -1140,7 +1137,7 @@ holding any InnoDB semaphores. The calling thread is holding the
query cache mutex, and this function will reserver the InnoDB kernel mutex. query cache mutex, and this function will reserver the InnoDB kernel mutex.
Thus, the 'rank' in sync0sync.h of the MySQL query cache mutex is above Thus, the 'rank' in sync0sync.h of the MySQL query cache mutex is above
the InnoDB kernel mutex. */ the InnoDB kernel mutex. */
static
my_bool my_bool
innobase_query_caching_of_table_permitted( innobase_query_caching_of_table_permitted(
/*======================================*/ /*======================================*/
...@@ -1765,7 +1762,7 @@ innobase_flush_logs(handlerton *hton) ...@@ -1765,7 +1762,7 @@ innobase_flush_logs(handlerton *hton)
/********************************************************************* /*********************************************************************
Commits a transaction in an InnoDB database. */ Commits a transaction in an InnoDB database. */
static
void void
innobase_commit_low( innobase_commit_low(
/*================*/ /*================*/
...@@ -1849,9 +1846,8 @@ innobase_commit( ...@@ -1849,9 +1846,8 @@ innobase_commit(
/* Update the info whether we should skip XA steps that eat CPU time */ /* Update the info whether we should skip XA steps that eat CPU time */
trx->support_xa = (ibool)(thd->variables.innodb_support_xa); trx->support_xa = (ibool)(thd->variables.innodb_support_xa);
/* Release a possible FIFO ticket and search latch. Since we will /* Since we will reserve the kernel mutex, we have to release
reserve the kernel mutex, we have to release the search system latch the search system latch first to obey the latching order. */
first to obey the latching order. */
if (trx->has_search_latch) { if (trx->has_search_latch) {
trx_search_latch_release_if_reserved(trx); trx_search_latch_release_if_reserved(trx);
...@@ -1941,18 +1937,20 @@ retry: ...@@ -1941,18 +1937,20 @@ retry:
trx_mark_sql_stat_end(trx); trx_mark_sql_stat_end(trx);
} }
/* Tell the InnoDB server that there might be work for utility
threads: */
if (trx->declared_to_be_inside_innodb) { if (trx->declared_to_be_inside_innodb) {
/* Release our possible ticket in the FIFO */ /* Release our possible ticket in the FIFO */
srv_conc_force_exit_innodb(trx); srv_conc_force_exit_innodb(trx);
} }
/* Tell the InnoDB server that there might be work for utility
threads: */
srv_active_wake_master_thread(); srv_active_wake_master_thread();
DBUG_RETURN(0); DBUG_RETURN(0);
} }
#if 0
/* TODO: put the /* TODO: put the
MySQL-4.1 functionality back to 5.0. This is needed to get InnoDB Hot Backup MySQL-4.1 functionality back to 5.0. This is needed to get InnoDB Hot Backup
to work. */ to work. */
...@@ -1965,7 +1963,7 @@ transaction inside InnoDB but does NOT flush InnoDB log files to disk. ...@@ -1965,7 +1963,7 @@ transaction inside InnoDB but does NOT flush InnoDB log files to disk.
To flush you have to call innobase_commit_complete(). We have separated To flush you have to call innobase_commit_complete(). We have separated
flushing to eliminate the bottleneck of LOCK_log in log.cc which disabled flushing to eliminate the bottleneck of LOCK_log in log.cc which disabled
InnoDB's group commit capability. */ InnoDB's group commit capability. */
static
int int
innobase_report_binlog_offset_and_commit( innobase_report_binlog_offset_and_commit(
/*=====================================*/ /*=====================================*/
...@@ -1995,7 +1993,6 @@ innobase_report_binlog_offset_and_commit( ...@@ -1995,7 +1993,6 @@ innobase_report_binlog_offset_and_commit(
return(0); return(0);
} }
#if 0
/*********************************************************************** /***********************************************************************
This function stores the binlog offset and flushes logs. */ This function stores the binlog offset and flushes logs. */
static static
...@@ -2026,12 +2023,11 @@ innobase_store_binlog_offset_and_flush_log( ...@@ -2026,12 +2023,11 @@ innobase_store_binlog_offset_and_flush_log(
/* Synchronous flush of the log buffer to disk */ /* Synchronous flush of the log buffer to disk */
log_buffer_flush_to_disk(); log_buffer_flush_to_disk();
} }
#endif
/********************************************************************* /*********************************************************************
This is called after MySQL has written the binlog entry for the current This is called after MySQL has written the binlog entry for the current
transaction. Flushes the InnoDB log files to disk if required. */ transaction. Flushes the InnoDB log files to disk if required. */
static
int int
innobase_commit_complete( innobase_commit_complete(
/*=====================*/ /*=====================*/
...@@ -2057,6 +2053,7 @@ innobase_commit_complete( ...@@ -2057,6 +2053,7 @@ innobase_commit_complete(
return(0); return(0);
} }
#endif
/********************************************************************* /*********************************************************************
Rolls back a transaction or the latest SQL statement. */ Rolls back a transaction or the latest SQL statement. */
...@@ -2110,7 +2107,7 @@ innobase_rollback( ...@@ -2110,7 +2107,7 @@ innobase_rollback(
/********************************************************************* /*********************************************************************
Rolls back a transaction */ Rolls back a transaction */
static
int int
innobase_rollback_trx( innobase_rollback_trx(
/*==================*/ /*==================*/
...@@ -2405,8 +2402,6 @@ ha_innobase::open( ...@@ -2405,8 +2402,6 @@ ha_innobase::open(
user_thd = NULL; user_thd = NULL;
last_query_id = (ulong)-1;
if (!(share=get_share(name))) { if (!(share=get_share(name))) {
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -3374,8 +3369,7 @@ ha_innobase::write_row( ...@@ -3374,8 +3369,7 @@ ha_innobase::write_row(
ut_error; ut_error;
} }
statistic_increment(thd->status_var.ha_write_count, ha_statistic_increment(&SSV::ha_write_count);
&LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT) if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time(); table->timestamp_field->set_time();
...@@ -3450,13 +3444,6 @@ no_commit: ...@@ -3450,13 +3444,6 @@ no_commit:
num_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]) { if (table->next_number_field && record == table->record[0]) {
/* This is the case where the table has an /* This is the case where the table has an
auto-increment column */ auto-increment column */
...@@ -3611,13 +3598,6 @@ calc_row_difference( ...@@ -3611,13 +3598,6 @@ calc_row_difference(
for (i = 0; i < n_fields; i++) { for (i = 0; i < n_fields; i++) {
field = table->field[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); o_ptr = (byte*) old_row + get_field_offset(table, field);
n_ptr = (byte*) new_row + get_field_offset(table, field); n_ptr = (byte*) new_row + get_field_offset(table, field);
...@@ -3749,13 +3729,6 @@ ha_innobase::update_row( ...@@ -3749,13 +3729,6 @@ ha_innobase::update_row(
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time(); 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) { if (prebuilt->upd_node) {
uvect = prebuilt->upd_node->update; uvect = prebuilt->upd_node->update;
} else { } else {
...@@ -3806,13 +3779,6 @@ ha_innobase::delete_row( ...@@ -3806,13 +3779,6 @@ ha_innobase::delete_row(
ut_a(prebuilt->trx == trx); 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) { if (!prebuilt->upd_node) {
row_get_prebuilt_update_vector(prebuilt); row_get_prebuilt_update_vector(prebuilt);
} }
...@@ -3848,15 +3814,6 @@ ha_innobase::unlock_row(void) ...@@ -3848,15 +3814,6 @@ ha_innobase::unlock_row(void)
{ {
DBUG_ENTER("ha_innobase::unlock_row"); 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 /* Consistent read does not take any locks, thus there is
nothing to unlock. */ nothing to unlock. */
...@@ -4062,15 +4019,7 @@ ha_innobase::index_read( ...@@ -4062,15 +4019,7 @@ ha_innobase::index_read(
ut_a(prebuilt->trx == thd_to_trx(current_thd, ht)); ut_a(prebuilt->trx == thd_to_trx(current_thd, ht));
statistic_increment(current_thd->status_var.ha_read_key_count, ha_statistic_increment(&SSV::ha_read_key_count);
&LOCK_status);
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; index = prebuilt->index;
...@@ -4168,12 +4117,11 @@ ha_innobase::change_active_index( ...@@ -4168,12 +4117,11 @@ ha_innobase::change_active_index(
InnoDB */ InnoDB */
{ {
KEY* key=0; KEY* key=0;
THD* thd = current_thd; ha_statistic_increment(&SSV::ha_read_key_count);
statistic_increment(thd->status_var.ha_read_key_count, &LOCK_status);
DBUG_ENTER("change_active_index"); DBUG_ENTER("change_active_index");
ut_ad(user_thd == thd); ut_ad(user_thd == current_thd);
ut_a(prebuilt->trx == thd_to_trx(thd, ht)); ut_a(prebuilt->trx == thd_to_trx(user_thd, ht));
active_index = keynr; active_index = keynr;
...@@ -4300,8 +4248,7 @@ ha_innobase::index_next( ...@@ -4300,8 +4248,7 @@ ha_innobase::index_next(
mysql_byte* buf) /* in/out: buffer for next row in MySQL mysql_byte* buf) /* in/out: buffer for next row in MySQL
format */ format */
{ {
statistic_increment(current_thd->status_var.ha_read_next_count, ha_statistic_increment(&SSV::ha_read_next_count);
&LOCK_status);
return(general_fetch(buf, ROW_SEL_NEXT, 0)); return(general_fetch(buf, ROW_SEL_NEXT, 0));
} }
...@@ -4318,8 +4265,7 @@ ha_innobase::index_next_same( ...@@ -4318,8 +4265,7 @@ ha_innobase::index_next_same(
const mysql_byte* key, /* in: key value */ const mysql_byte* key, /* in: key value */
uint keylen) /* in: key value length */ uint keylen) /* in: key value length */
{ {
statistic_increment(current_thd->status_var.ha_read_next_count, ha_statistic_increment(&SSV::ha_read_next_count);
&LOCK_status);
return(general_fetch(buf, ROW_SEL_NEXT, last_match_mode)); return(general_fetch(buf, ROW_SEL_NEXT, last_match_mode));
} }
...@@ -4336,8 +4282,7 @@ ha_innobase::index_prev( ...@@ -4336,8 +4282,7 @@ ha_innobase::index_prev(
mysql_byte* buf) /* in/out: buffer for previous row in MySQL mysql_byte* buf) /* in/out: buffer for previous row in MySQL
format */ format */
{ {
statistic_increment(current_thd->status_var.ha_read_prev_count, ha_statistic_increment(&SSV::ha_read_prev_count);
&LOCK_status);
return(general_fetch(buf, ROW_SEL_PREV, 0)); return(general_fetch(buf, ROW_SEL_PREV, 0));
} }
...@@ -4356,8 +4301,7 @@ ha_innobase::index_first( ...@@ -4356,8 +4301,7 @@ ha_innobase::index_first(
int error; int error;
DBUG_ENTER("index_first"); DBUG_ENTER("index_first");
statistic_increment(current_thd->status_var.ha_read_first_count, ha_statistic_increment(&SSV::ha_read_first_count);
&LOCK_status);
error = index_read(buf, NULL, 0, HA_READ_AFTER_KEY); error = index_read(buf, NULL, 0, HA_READ_AFTER_KEY);
...@@ -4383,8 +4327,7 @@ ha_innobase::index_last( ...@@ -4383,8 +4327,7 @@ ha_innobase::index_last(
int error; int error;
DBUG_ENTER("index_last"); DBUG_ENTER("index_last");
statistic_increment(current_thd->status_var.ha_read_last_count, ha_statistic_increment(&SSV::ha_read_last_count);
&LOCK_status);
error = index_read(buf, NULL, 0, HA_READ_BEFORE_KEY); error = index_read(buf, NULL, 0, HA_READ_BEFORE_KEY);
...@@ -4454,8 +4397,7 @@ ha_innobase::rnd_next( ...@@ -4454,8 +4397,7 @@ ha_innobase::rnd_next(
int error; int error;
DBUG_ENTER("rnd_next"); DBUG_ENTER("rnd_next");
statistic_increment(current_thd->status_var.ha_read_rnd_next_count, ha_statistic_increment(&SSV::ha_read_rnd_next_count);
&LOCK_status);
if (start_of_scan) { if (start_of_scan) {
error = index_first(buf); error = index_first(buf);
...@@ -4490,8 +4432,7 @@ ha_innobase::rnd_pos( ...@@ -4490,8 +4432,7 @@ ha_innobase::rnd_pos(
DBUG_ENTER("rnd_pos"); DBUG_ENTER("rnd_pos");
DBUG_DUMP("key", (char*) pos, ref_length); DBUG_DUMP("key", (char*) pos, ref_length);
statistic_increment(current_thd->status_var.ha_read_rnd_count, ha_statistic_increment(&SSV::ha_read_rnd_count);
&LOCK_status);
ut_a(prebuilt->trx == thd_to_trx(current_thd, ht)); ut_a(prebuilt->trx == thd_to_trx(current_thd, ht));
...@@ -6534,7 +6475,7 @@ ha_innobase::transactional_table_lock( ...@@ -6534,7 +6475,7 @@ ha_innobase::transactional_table_lock(
/**************************************************************************** /****************************************************************************
Here we export InnoDB status variables to MySQL. */ Here we export InnoDB status variables to MySQL. */
static
int int
innodb_export_status() innodb_export_status()
/*==================*/ /*==================*/
...@@ -6640,7 +6581,7 @@ innodb_show_status( ...@@ -6640,7 +6581,7 @@ innodb_show_status(
/**************************************************************************** /****************************************************************************
Implements the SHOW MUTEX STATUS command. . */ Implements the SHOW MUTEX STATUS command. . */
static
bool bool
innodb_mutex_show_status( innodb_mutex_show_status(
/*=====================*/ /*=====================*/
...@@ -7325,6 +7266,33 @@ ha_innobase::cmp_ref( ...@@ -7325,6 +7266,33 @@ ha_innobase::cmp_ref(
return(0); return(0);
} }
/***********************************************************************
Ask InnoDB if a query to a table can be cached. */
my_bool
ha_innobase::register_query_cache_table(
/*====================================*/
/* out: TRUE if query caching
of the table is permitted */
THD* thd, /* in: user thread handle */
char* table_key, /* in: concatenation of database name,
the null character '\0',
and the table name */
uint key_length, /* in: length of the full name, i.e.
len(dbname) + len(tablename) + 1 */
qc_engine_callback*
call_back, /* out: pointer to function for
checking if query caching
is permitted */
ulonglong *engine_data) /* in/out: data to call_back */
{
*call_back = innobase_query_caching_of_table_permitted;
*engine_data = 0;
return(innobase_query_caching_of_table_permitted(thd, table_key,
key_length,
engine_data));
}
char* char*
ha_innobase::get_mysql_bin_log_name() ha_innobase::get_mysql_bin_log_name()
{ {
...@@ -7702,12 +7670,12 @@ static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff) ...@@ -7702,12 +7670,12 @@ static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff)
return 0; return 0;
} }
SHOW_VAR innodb_status_variables_export[]= { static SHOW_VAR innodb_status_variables_export[]= {
{"Innodb", (char*) &show_innodb_vars, SHOW_FUNC}, {"Innodb", (char*) &show_innodb_vars, SHOW_FUNC},
{NullS, NullS, SHOW_LONG} {NullS, NullS, SHOW_LONG}
}; };
struct st_mysql_storage_engine innobase_storage_engine= static struct st_mysql_storage_engine innobase_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION }; { MYSQL_HANDLERTON_INTERFACE_VERSION };
mysql_declare_plugin(innobase) mysql_declare_plugin(innobase)
......
...@@ -35,10 +35,6 @@ typedef struct st_innobase_share { ...@@ -35,10 +35,6 @@ typedef struct st_innobase_share {
struct row_prebuilt_struct; struct row_prebuilt_struct;
typedef struct row_prebuilt_struct row_prebuilt_t; typedef struct row_prebuilt_struct row_prebuilt_t;
my_bool innobase_query_caching_of_table_permitted(THD* thd, char* full_name,
uint full_name_len,
ulonglong *unused);
/* The class defining a handle to an Innodb table */ /* The class defining a handle to an Innodb table */
class ha_innobase: public handler class ha_innobase: public handler
{ {
...@@ -48,8 +44,6 @@ class ha_innobase: public handler ...@@ -48,8 +44,6 @@ class ha_innobase: public handler
THD* user_thd; /* the thread handle of the user THD* user_thd; /* the thread handle of the user
currently using the handle; this is currently using the handle; this is
set in external_lock function */ set in external_lock function */
query_id_t last_query_id; /* the latest query id where the
handle was used */
THR_LOCK_DATA lock; THR_LOCK_DATA lock;
INNOBASE_SHARE *share; INNOBASE_SHARE *share;
...@@ -186,14 +180,7 @@ class ha_innobase: public handler ...@@ -186,14 +180,7 @@ class ha_innobase: public handler
my_bool register_query_cache_table(THD *thd, char *table_key, my_bool register_query_cache_table(THD *thd, char *table_key,
uint key_length, uint key_length,
qc_engine_callback *call_back, qc_engine_callback *call_back,
ulonglong *engine_data) ulonglong *engine_data);
{
*call_back= innobase_query_caching_of_table_permitted;
*engine_data= 0;
return innobase_query_caching_of_table_permitted(thd, table_key,
key_length,
engine_data);
}
static char *get_mysql_bin_log_name(); static char *get_mysql_bin_log_name();
static ulonglong get_mysql_bin_log_pos(); static ulonglong get_mysql_bin_log_pos();
bool primary_key_is_clustered() { return true; } bool primary_key_is_clustered() { return true; }
...@@ -202,7 +189,6 @@ class ha_innobase: public handler ...@@ -202,7 +189,6 @@ class ha_innobase: public handler
uint table_changes); uint table_changes);
}; };
extern SHOW_VAR innodb_status_variables[];
extern ulong innobase_fast_shutdown; extern ulong innobase_fast_shutdown;
extern ulong innobase_large_page_size; extern ulong innobase_large_page_size;
extern long innobase_mirrored_log_groups, innobase_log_files_in_group; extern long innobase_mirrored_log_groups, innobase_log_files_in_group;
......
...@@ -375,8 +375,6 @@ trx_is_interrupted( ...@@ -375,8 +375,6 @@ trx_is_interrupted(
/* Signal to a transaction */ /* Signal to a transaction */
struct trx_sig_struct{ struct trx_sig_struct{
ulint type; /* signal type */ ulint type; /* signal type */
ulint state; /* TRX_SIG_WAITING or
TRX_SIG_BEING_HANDLED */
ulint sender; /* TRX_SIG_SELF or ulint sender; /* TRX_SIG_SELF or
TRX_SIG_OTHER_SESS */ TRX_SIG_OTHER_SESS */
que_thr_t* receiver; /* non-NULL if the sender of the signal que_thr_t* receiver; /* non-NULL if the sender of the signal
...@@ -404,7 +402,7 @@ struct trx_struct{ ...@@ -404,7 +402,7 @@ struct trx_struct{
const char* op_info; /* English text describing the const char* op_info; /* English text describing the
current operation, or an empty current operation, or an empty
string */ string */
ulint type; /* TRX_USER, TRX_PURGE */ unsigned is_purge:1; /* 0=user transaction, 1=purge */
ulint conc_state; /* state of the trx from the point ulint conc_state; /* state of the trx from the point
of view of concurrency control: of view of concurrency control:
TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY, TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
...@@ -675,12 +673,6 @@ struct trx_struct{ ...@@ -675,12 +673,6 @@ struct trx_struct{
single operation of a single operation of a
transaction, e.g., a parallel transaction, e.g., a parallel
query */ query */
/* Transaction types */
#define TRX_USER 1 /* normal user transaction */
#define TRX_PURGE 2 /* purge transaction: this is not
inserted to the trx list of trx_sys
and no rollback segment is assigned to
this */
/* Transaction concurrency states */ /* Transaction concurrency states */
#define TRX_NOT_STARTED 1 #define TRX_NOT_STARTED 1
#define TRX_ACTIVE 2 #define TRX_ACTIVE 2
...@@ -742,9 +734,6 @@ struct trx_struct{ ...@@ -742,9 +734,6 @@ struct trx_struct{
session */ session */
#define TRX_SIG_OTHER_SESS 2 /* sent by another session (which #define TRX_SIG_OTHER_SESS 2 /* sent by another session (which
must hold rights to this) */ must hold rights to this) */
/* Signal states */
#define TRX_SIG_WAITING 1
#define TRX_SIG_BEING_HANDLED 2
/* Commit command node in a query graph */ /* Commit command node in a query graph */
struct commit_node_struct{ struct commit_node_struct{
......
...@@ -930,7 +930,7 @@ try_again: ...@@ -930,7 +930,7 @@ try_again:
file = CreateFile((LPCTSTR) name, file = CreateFile((LPCTSTR) name,
access, access,
FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
/* file can be read ansd written also /* file can be read and written also
by other processes */ by other processes */
NULL, /* default security attributes */ NULL, /* default security attributes */
create_flag, create_flag,
...@@ -1509,7 +1509,7 @@ os_file_rename( ...@@ -1509,7 +1509,7 @@ os_file_rename(
return(TRUE); return(TRUE);
} }
os_file_handle_error(oldpath, "rename"); os_file_handle_error_no_exit(oldpath, "rename");
return(FALSE); return(FALSE);
#else #else
...@@ -1518,7 +1518,7 @@ os_file_rename( ...@@ -1518,7 +1518,7 @@ os_file_rename(
ret = rename((const char*)oldpath, (const char*)newpath); ret = rename((const char*)oldpath, (const char*)newpath);
if (ret != 0) { if (ret != 0) {
os_file_handle_error(oldpath, "rename"); os_file_handle_error_no_exit(oldpath, "rename");
return(FALSE); return(FALSE);
} }
......
...@@ -213,7 +213,7 @@ row_undo( ...@@ -213,7 +213,7 @@ row_undo(
ulint err; ulint err;
trx_t* trx; trx_t* trx;
dulint roll_ptr; dulint roll_ptr;
ibool froze_data_dict = FALSE; ibool locked_data_dict;
ut_ad(node && thr); ut_ad(node && thr);
...@@ -266,13 +266,13 @@ row_undo( ...@@ -266,13 +266,13 @@ row_undo(
/* Prevent DROP TABLE etc. while we are rolling back this row. /* Prevent DROP TABLE etc. while we are rolling back this row.
If we are doing a TABLE CREATE or some other dictionary operation, If we are doing a TABLE CREATE or some other dictionary operation,
then we already have dict_operation_lock locked in x-mode. Do not then we already have dict_operation_lock locked in x-mode. Do not
try to lock again in s-mode, because that would cause a hang. */ try to lock again, because that would cause a hang. */
if (trx->dict_operation_lock_mode == 0) { locked_data_dict = (trx->dict_operation_lock_mode == 0);
row_mysql_freeze_data_dictionary(trx); if (locked_data_dict) {
froze_data_dict = TRUE; row_mysql_lock_data_dictionary(trx);
} }
if (node->state == UNDO_NODE_INSERT) { if (node->state == UNDO_NODE_INSERT) {
...@@ -285,9 +285,9 @@ row_undo( ...@@ -285,9 +285,9 @@ row_undo(
err = row_undo_mod(node, thr); err = row_undo_mod(node, thr);
} }
if (froze_data_dict) { if (locked_data_dict) {
row_mysql_unfreeze_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
} }
/* Do some cleanup */ /* Do some cleanup */
......
...@@ -221,7 +221,7 @@ trx_purge_sys_create(void) ...@@ -221,7 +221,7 @@ trx_purge_sys_create(void)
purge_sys->trx = purge_sys->sess->trx; purge_sys->trx = purge_sys->sess->trx;
purge_sys->trx->type = TRX_PURGE; purge_sys->trx->is_purge = 1;
ut_a(trx_start_low(purge_sys->trx, ULINT_UNDEFINED)); ut_a(trx_start_low(purge_sys->trx, ULINT_UNDEFINED));
......
...@@ -109,7 +109,7 @@ trx_create( ...@@ -109,7 +109,7 @@ trx_create(
trx->op_info = ""; trx->op_info = "";
trx->type = TRX_USER; trx->is_purge = 0;
trx->conc_state = TRX_NOT_STARTED; trx->conc_state = TRX_NOT_STARTED;
trx->start_time = time(NULL); trx->start_time = time(NULL);
...@@ -667,7 +667,7 @@ trx_start_low( ...@@ -667,7 +667,7 @@ trx_start_low(
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
ut_ad(trx->rseg == NULL); ut_ad(trx->rseg == NULL);
if (trx->type == TRX_PURGE) { if (trx->is_purge) {
trx->id = ut_dulint_zero; trx->id = ut_dulint_zero;
trx->conc_state = TRX_ACTIVE; trx->conc_state = TRX_ACTIVE;
trx->start_time = time(NULL); trx->start_time = time(NULL);
...@@ -1262,7 +1262,6 @@ trx_sig_send( ...@@ -1262,7 +1262,6 @@ trx_sig_send(
UT_LIST_ADD_LAST(signals, trx->signals, sig); UT_LIST_ADD_LAST(signals, trx->signals, sig);
sig->type = type; sig->type = type;
sig->state = TRX_SIG_WAITING;
sig->sender = sender; sig->sender = sender;
sig->receiver = receiver_thr; sig->receiver = receiver_thr;
...@@ -1709,7 +1708,7 @@ trx_print( ...@@ -1709,7 +1708,7 @@ trx_print(
fputs(trx->op_info, f); fputs(trx->op_info, f);
} }
if (trx->type != TRX_USER) { if (trx->is_purge) {
fputs(" purge trx", f); fputs(" purge trx", f);
} }
......
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