Commit 1865d59b authored by marko's avatar marko

branches/innodb+: Merge revisions 4528:4657 from branches/zip:

  ------------------------------------------------------------------------
  r4530 | marko | 2009-03-24 14:02:29 +0200 (Tue, 24 Mar 2009) | 3 lines

  branches/zip: Remove references to UNIV_HOTBACKUP from files that are
  not used when building InnoDB Hot Backup.  Declare
  innobase_invalidate_query_cache() in ha_prototypes.h.
  ------------------------------------------------------------------------
  r4531 | marko | 2009-03-24 15:46:12 +0200 (Tue, 24 Mar 2009) | 7 lines

  branches/zip: Note that buf_page_t::list and buf_page_t::in_flush_list
  are only protected by buf_pool_mutex, not by the block mutex.

  buf_page_release(): Remove the assertion on in_flush_list.
  The function is only holding block->mutex, not buf_pool_mutex.
  This was reported by Sunny.  This was the only piece of code
  that accessed in_flush_list while not holding buf_pool_mutex.
  ------------------------------------------------------------------------
  r4532 | calvin | 2009-03-24 17:59:45 +0200 (Tue, 24 Mar 2009) | 13 lines

  branches/zip: Mantis issue #201 - remove innodb_plugin_init() due to
  new option --ignore_builtin_innodb

  Starting 5.1.33, MySQL has a new option --ignore_builtin_innodb
  for using the dynamic plugin. It is required to remove
  innodb_plugin_init() in the plugin.

  This patch removes innodb_plugin_init() as well as functions,
  variables used by innodb_plugin_init().

  rb://98

  Approved by: Marko
  ------------------------------------------------------------------------
  r4543 | inaam | 2009-03-25 19:18:33 +0200 (Wed, 25 Mar 2009) | 17 lines

  branches/zip

  SHOW ENGINE INNODB MUTEX shows all mutexes and rw_locks. This can
  be overwhelming particularly when the buffer pool is very large
  (note that each block in buffer pool has at least one mutex, one
  rw_lock and an additional mutex if rw_lock does not use atomics).
  With this patch status of following mutexes and rw-locks is not shown:

  1) block->mutex
  2) block->lock
  3) block->lock->mutex (if applicable)
  4) All other mutexes and rw-locks for which number of os-waits are zero

  Addresses issue# 179 rb://99

  Approved by: Marko
  ------------------------------------------------------------------------
  r4579 | marko | 2009-03-31 10:40:58 +0300 (Tue, 31 Mar 2009) | 3 lines

  branches/zip: struct read_view_struct: Add clarifying comments about
  low_limit_id and up_limit_id.
  ------------------------------------------------------------------------
  r4630 | calvin | 2009-04-02 15:46:47 +0300 (Thu, 02 Apr 2009) | 6 lines

  branches/zip: Mantis issue #197 - Make srv_spin_wait_delay configurable

  New parameter innodb_spin_wait_delay to set the maximum delay between
  polling for a spin lock. 5 is the default.

  Approved by: Marko (on IM)
  ------------------------------------------------------------------------
  r4631 | marko | 2009-04-02 16:23:12 +0300 (Thu, 02 Apr 2009) | 24 lines

  branches/zip: Refuse to use newly created indexes that may lack
  history.  This addresses Mantis issue #116.

  dict_index_t: Enable the storage of trx_id.

  row_prebuilt_t: Make many fields bit-fields to reduce the memory
  footprint. Add index_usable.

  ha_innobase::change_active_index(): Check if the index is usable and
  set prebuilt->index_usable accordingly. Unfortunately, the return
  status of this function is ignored by MySQL, and the actual refusal to
  use the index must be made in row_search_for_mysql().

  row_search_for_mysql(): Return DB_MISSING_HISTORY if
  !prebuilt->index_usable.

  convert_error_code_to_mysql(): Map DB_MISSING_HISTORY to
  HA_ERR_TABLE_DEF_CHANGED.

  innodb-index.test: Add a test case where access to a newly created
  secondary index must be blocked for old transactions.

  rb://100 approved by Heikki Tuuri
  ------------------------------------------------------------------------
  r4647 | vasil | 2009-04-06 10:05:25 +0300 (Mon, 06 Apr 2009) | 4 lines

  branches/zip:

  Add changelog entry for c4630.
  ------------------------------------------------------------------------
  r4648 | vasil | 2009-04-06 10:07:26 +0300 (Mon, 06 Apr 2009) | 4 lines

  branches/zip:

  Fix formatting in ChangeLog to be consistent.
  ------------------------------------------------------------------------
  r4657 | marko | 2009-04-06 15:13:45 +0300 (Mon, 06 Apr 2009) | 1 line

  branches/zip: Remove the bogus failure reported in Issue #219.
  ------------------------------------------------------------------------
parent 4f1d0440
2009-04-06 The InnoDB Team
* sync/sync0rw.c:
Avoid a bogus failure in UNIV_SYNC_DEBUG diagnostics.
2009-04-02 The InnoDB Team
* handler/ha_innodb.cc, include/srv0srv.h, srv/srv0srv.c:
Add new parameter innodb_spin_wait_delay to set the maximum delay
between polling for a spin lock.
2009-04-02 The InnoDB Team
* dict/dict0crea.c, handler/ha_innodb.cc, handler/ha_innodb.h,
include/dict0mem.h, include/row0merge.h, include/row0mysql.h,
mysql-test/innodb-index.result, mysql-test/innodb-index.test,
row/row0merge.c, row/row0sel.c:
In consistent reads, refuse to use newly created indexes that may
lack history.
2009-03-20 The InnoDB Team 2009-03-20 The InnoDB Team
* buf/buf0buf.c, include/log0recv.h, log/log0recv.c: * buf/buf0buf.c, include/log0recv.h, log/log0recv.c:
......
...@@ -1994,6 +1994,36 @@ buf_block_align( ...@@ -1994,6 +1994,36 @@ buf_block_align(
return(NULL); return(NULL);
} }
/************************************************************************
Find out if a pointer belongs to a buf_block_t. It can be a pointer to
the buf_block_t itself or a member of it */
UNIV_INTERN
ibool
buf_pointer_is_block_field(
/*=======================*/
/* out: TRUE if ptr belongs
to a buf_block_t struct */
const void* ptr) /* in: pointer not
dereferenced */
{
const buf_chunk_t* chunk = buf_pool->chunks;
const buf_chunk_t* const echunk = chunk + buf_pool->n_chunks;
/* TODO: protect buf_pool->chunks with a mutex (it will
currently remain constant after buf_pool_init()) */
while (chunk < echunk) {
if (ptr >= (void *)chunk->blocks
&& ptr < (void *)(chunk->blocks + chunk->size)) {
return(TRUE);
}
chunk++;
}
return(FALSE);
}
/************************************************************************ /************************************************************************
Find out if a buffer block was created by buf_chunk_init(). */ Find out if a buffer block was created by buf_chunk_init(). */
static static
...@@ -2006,9 +2036,6 @@ buf_block_is_uncompressed( ...@@ -2006,9 +2036,6 @@ buf_block_is_uncompressed(
const buf_block_t* block) /* in: pointer to block, const buf_block_t* block) /* in: pointer to block,
not dereferenced */ not dereferenced */
{ {
const buf_chunk_t* chunk = buf_pool->chunks;
const buf_chunk_t* const echunk = chunk + buf_pool->n_chunks;
ut_ad(buf_pool_mutex_own()); ut_ad(buf_pool_mutex_own());
if (UNIV_UNLIKELY((((ulint) block) % sizeof *block) != 0)) { if (UNIV_UNLIKELY((((ulint) block) % sizeof *block) != 0)) {
...@@ -2016,17 +2043,7 @@ buf_block_is_uncompressed( ...@@ -2016,17 +2043,7 @@ buf_block_is_uncompressed(
return(FALSE); return(FALSE);
} }
while (chunk < echunk) { return(buf_pointer_is_block_field((void *)block));
if (block >= chunk->blocks
&& block < chunk->blocks + chunk->size) {
return(TRUE);
}
chunk++;
}
return(FALSE);
} }
/************************************************************************ /************************************************************************
......
...@@ -561,10 +561,8 @@ dict_build_index_def_step( ...@@ -561,10 +561,8 @@ dict_build_index_def_step(
ins_node_set_new_row(node->ind_def, row); ins_node_set_new_row(node->ind_def, row);
#ifdef ROW_MERGE_IS_INDEX_USABLE
/* Note that the index was created by this transaction. */ /* Note that the index was created by this transaction. */
index->trx_id = trx->id; index->trx_id = (ib_uint64_t) ut_conv_dulint_to_longlong(trx->id);
#endif /* ROW_MERGE_IS_INDEX_USABLE */
return(DB_SUCCESS); return(DB_SUCCESS);
} }
...@@ -1156,7 +1154,6 @@ function_exit: ...@@ -1156,7 +1154,6 @@ function_exit:
return(thr); return(thr);
} }
#ifndef UNIV_HOTBACKUP
/******************************************************************** /********************************************************************
Creates the foreign key constraints system tables inside InnoDB Creates the foreign key constraints system tables inside InnoDB
at database creation or database start if they are not found or are at database creation or database start if they are not found or are
...@@ -1500,4 +1497,3 @@ dict_create_add_foreigns_to_dictionary( ...@@ -1500,4 +1497,3 @@ dict_create_add_foreigns_to_dictionary(
return(DB_SUCCESS); return(DB_SUCCESS);
} }
#endif /* !UNIV_HOTBACKUP */
...@@ -24,9 +24,7 @@ Created 4/24/1996 Heikki Tuuri ...@@ -24,9 +24,7 @@ Created 4/24/1996 Heikki Tuuri
*******************************************************/ *******************************************************/
#include "dict0load.h" #include "dict0load.h"
#ifndef UNIV_HOTBACKUP
#include "mysql_version.h" #include "mysql_version.h"
#endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_NONINL #ifdef UNIV_NONINL
#include "dict0load.ic" #include "dict0load.ic"
...@@ -960,7 +958,7 @@ err_exit: ...@@ -960,7 +958,7 @@ err_exit:
mem_heap_empty(heap); mem_heap_empty(heap);
err = dict_load_indexes(table, heap); err = dict_load_indexes(table, heap);
#ifndef UNIV_HOTBACKUP
/* If the force recovery flag is set, we open the table irrespective /* If the force recovery flag is set, we open the table irrespective
of the error condition, since the user may want to dump data from the of the error condition, since the user may want to dump data from the
clustered index. However we load the foreign key information only if clustered index. However we load the foreign key information only if
...@@ -971,7 +969,7 @@ err_exit: ...@@ -971,7 +969,7 @@ err_exit:
dict_table_remove_from_cache(table); dict_table_remove_from_cache(table);
table = NULL; table = NULL;
} }
# if 0 #if 0
if (err != DB_SUCCESS && table != NULL) { if (err != DB_SUCCESS && table != NULL) {
mutex_enter(&dict_foreign_err_mutex); mutex_enter(&dict_foreign_err_mutex);
...@@ -994,8 +992,7 @@ err_exit: ...@@ -994,8 +992,7 @@ err_exit:
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
} }
# endif /* 0 */ #endif /* 0 */
#endif /* !UNIV_HOTBACKUP */
mem_heap_free(heap); mem_heap_free(heap);
return(table); return(table);
...@@ -1113,7 +1110,6 @@ dict_load_sys_table( ...@@ -1113,7 +1110,6 @@ dict_load_sys_table(
mem_heap_free(heap); mem_heap_free(heap);
} }
#ifndef UNIV_HOTBACKUP
/************************************************************************ /************************************************************************
Loads foreign key constraint col names (also for the referenced table). */ Loads foreign key constraint col names (also for the referenced table). */
static static
...@@ -1457,4 +1453,3 @@ load_next_index: ...@@ -1457,4 +1453,3 @@ load_next_index:
return(DB_SUCCESS); return(DB_SUCCESS);
} }
#endif /* !UNIV_HOTBACKUP */
...@@ -115,19 +115,6 @@ undefined. Map it to NULL. */ ...@@ -115,19 +115,6 @@ undefined. Map it to NULL. */
#ifdef MYSQL_DYNAMIC_PLUGIN #ifdef MYSQL_DYNAMIC_PLUGIN
/* These must be weak global variables in the dynamic plugin. */ /* These must be weak global variables in the dynamic plugin. */
struct handlerton* innodb_hton_ptr; struct handlerton* innodb_hton_ptr;
#ifdef __WIN__
struct st_mysql_plugin* builtin_innobase_plugin_ptr;
#else
int builtin_innobase_plugin;
#endif /* __WIN__ */
/********************************************************************
Copy InnoDB system variables from the static InnoDB to the dynamic
plugin. */
static
bool
innodb_plugin_init(void);
/*====================*/
/* out: TRUE if the dynamic InnoDB plugin should start */
#else /* MYSQL_DYNAMIC_PLUGIN */ #else /* MYSQL_DYNAMIC_PLUGIN */
/* This must be a global variable in the statically linked InnoDB. */ /* This must be a global variable in the statically linked InnoDB. */
struct handlerton* innodb_hton_ptr = NULL; struct handlerton* innodb_hton_ptr = NULL;
...@@ -737,6 +724,9 @@ convert_error_code_to_mysql( ...@@ -737,6 +724,9 @@ convert_error_code_to_mysql(
case DB_FOREIGN_DUPLICATE_KEY: case DB_FOREIGN_DUPLICATE_KEY:
return(HA_ERR_FOREIGN_DUPLICATE_KEY); return(HA_ERR_FOREIGN_DUPLICATE_KEY);
case DB_MISSING_HISTORY:
return(HA_ERR_TABLE_DEF_CHANGED);
case DB_RECORD_NOT_FOUND: case DB_RECORD_NOT_FOUND:
return(HA_ERR_NO_ACTIVE_RECORD); return(HA_ERR_NO_ACTIVE_RECORD);
...@@ -1587,20 +1577,20 @@ innobase_query_caching_of_table_permitted( ...@@ -1587,20 +1577,20 @@ innobase_query_caching_of_table_permitted(
} }
/********************************************************************* /*********************************************************************
Invalidates the MySQL query cache for the table. Invalidates the MySQL query cache for the table. */
NOTE that the exact prototype of this function has to be in
/innobase/row/row0ins.c! */
extern "C" UNIV_INTERN extern "C" UNIV_INTERN
void void
innobase_invalidate_query_cache( innobase_invalidate_query_cache(
/*============================*/ /*============================*/
trx_t* trx, /* in: transaction which modifies the table */ trx_t* trx, /* in: transaction which
char* full_name, /* in: concatenation of database name, null modifies the table */
char '\0', table name, null char'\0'; const char* full_name, /* in: concatenation of
NOTE that in Windows this is always database name, null char '\0',
in LOWER CASE! */ table name, null char '\0';
ulint full_name_len) /* in: full name length where also the null NOTE that in Windows this is
chars count */ always in LOWER CASE! */
ulint full_name_len) /* in: full name length where
also the null chars count */
{ {
/* Note that the sync0sync.h rank of the query cache mutex is just /* Note that the sync0sync.h rank of the query cache mutex is just
above the InnoDB kernel mutex. The caller of this function must not above the InnoDB kernel mutex. The caller of this function must not
...@@ -1609,7 +1599,7 @@ innobase_invalidate_query_cache( ...@@ -1609,7 +1599,7 @@ innobase_invalidate_query_cache(
/* Argument TRUE below means we are using transactions */ /* Argument TRUE below means we are using transactions */
#ifdef HAVE_QUERY_CACHE #ifdef HAVE_QUERY_CACHE
mysql_query_cache_invalidate4((THD*) trx->mysql_thd, mysql_query_cache_invalidate4((THD*) trx->mysql_thd,
(const char*) full_name, full_name,
(uint32) full_name_len, (uint32) full_name_len,
TRUE); TRUE);
#endif #endif
...@@ -1861,19 +1851,6 @@ innobase_init( ...@@ -1861,19 +1851,6 @@ innobase_init(
DBUG_ENTER("innobase_init"); DBUG_ENTER("innobase_init");
handlerton *innobase_hton= (handlerton *)p; handlerton *innobase_hton= (handlerton *)p;
#ifdef MYSQL_DYNAMIC_PLUGIN
if (!innodb_plugin_init()) {
sql_print_error("InnoDB plugin init failed.");
DBUG_RETURN(-1);
}
if (innodb_hton_ptr) {
/* Patch the statically linked handlerton and variables */
innobase_hton = innodb_hton_ptr;
}
#endif /* MYSQL_DYNAMIC_PLUGIN */
innodb_hton_ptr = innobase_hton; innodb_hton_ptr = innobase_hton;
innobase_hton->state = SHOW_OPTION_YES; innobase_hton->state = SHOW_OPTION_YES;
...@@ -4726,38 +4703,6 @@ ha_innobase::try_semi_consistent_read(bool yes) ...@@ -4726,38 +4703,6 @@ ha_innobase::try_semi_consistent_read(bool yes)
} }
} }
#ifdef ROW_MERGE_IS_INDEX_USABLE
/**********************************************************************
Check if an index can be used by the optimizer. */
UNIV_INTERN
bool
ha_innobase::is_index_available(
/*============================*/
/* out: true if available else false*/
uint keynr) /* in: index number to check */
{
DBUG_ENTER("ha_innobase::is_index_available");
if (table && keynr != MAX_KEY && table->s->keys > 0) {
const dict_index_t* index;
const KEY* key = table->key_info + keynr;
ut_ad(user_thd == ha_thd());
ut_a(prebuilt->trx == thd_to_trx(user_thd));
index = dict_table_get_index_on_name(
prebuilt->table, key->name);
if (!row_merge_is_index_usable(prebuilt->trx, index)) {
DBUG_RETURN(false);
}
}
DBUG_RETURN(true);
}
#endif /* ROW_MERGE_IS_INDEX_USABLE */
/********************************************************************** /**********************************************************************
Initializes a handle to use an index. */ Initializes a handle to use an index. */
UNIV_INTERN UNIV_INTERN
...@@ -5092,6 +5037,17 @@ ha_innobase::change_active_index( ...@@ -5092,6 +5037,17 @@ ha_innobase::change_active_index(
DBUG_RETURN(1); DBUG_RETURN(1);
} }
prebuilt->index_usable = row_merge_is_index_usable(prebuilt->trx,
prebuilt->index);
if (UNIV_UNLIKELY(!prebuilt->index_usable)) {
sql_print_warning("InnoDB: insufficient history for index %u",
keynr);
/* The caller seems to ignore this. Thus, we must check
this again in row_search_for_mysql(). */
DBUG_RETURN(2);
}
ut_a(prebuilt->search_tuple != 0); ut_a(prebuilt->search_tuple != 0);
dtuple_set_n_fields(prebuilt->search_tuple, prebuilt->index->n_fields); dtuple_set_n_fields(prebuilt->search_tuple, prebuilt->index->n_fields);
...@@ -8080,6 +8036,10 @@ innodb_mutex_show_status( ...@@ -8080,6 +8036,10 @@ innodb_mutex_show_status(
mutex = UT_LIST_GET_FIRST(mutex_list); mutex = UT_LIST_GET_FIRST(mutex_list);
while (mutex != NULL) { while (mutex != NULL) {
if (mutex->count_os_wait == 0
|| buf_pool_is_block_mutex(mutex)) {
goto next_mutex;
}
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if (mutex->mutex_type != 1) { if (mutex->mutex_type != 1) {
if (mutex->count_using > 0) { if (mutex->count_using > 0) {
...@@ -8128,6 +8088,7 @@ innodb_mutex_show_status( ...@@ -8128,6 +8088,7 @@ innodb_mutex_show_status(
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
next_mutex:
mutex = UT_LIST_GET_NEXT(list, mutex); mutex = UT_LIST_GET_NEXT(list, mutex);
} }
...@@ -8138,7 +8099,8 @@ innodb_mutex_show_status( ...@@ -8138,7 +8099,8 @@ innodb_mutex_show_status(
lock = UT_LIST_GET_FIRST(rw_lock_list); lock = UT_LIST_GET_FIRST(rw_lock_list);
while (lock != NULL) { while (lock != NULL) {
if (lock->count_os_wait) { if (lock->count_os_wait
&& !buf_pool_is_block_lock(lock)) {
buf1len= my_snprintf(buf1, sizeof(buf1), "%s:%lu", buf1len= my_snprintf(buf1, sizeof(buf1), "%s:%lu",
lock->cfile_name, (ulong) lock->cline); lock->cfile_name, (ulong) lock->cline);
buf2len= my_snprintf(buf2, sizeof(buf2), buf2len= my_snprintf(buf2, sizeof(buf2),
...@@ -9671,6 +9633,11 @@ static MYSQL_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds, ...@@ -9671,6 +9633,11 @@ static MYSQL_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
"Count of spin-loop rounds in InnoDB mutexes", "Count of spin-loop rounds in InnoDB mutexes",
NULL, NULL, 20L, 0L, ~0L, 0); NULL, NULL, 20L, 0L, ~0L, 0);
static MYSQL_SYSVAR_ULONG(spin_wait_delay, srv_spin_wait_delay,
PLUGIN_VAR_OPCMDARG,
"Maximum delay between polling for a spin lock (5 by default)",
NULL, NULL, 5L, 0L, ~0L, 0);
static MYSQL_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency, static MYSQL_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency,
PLUGIN_VAR_RQCMDARG, PLUGIN_VAR_RQCMDARG,
"Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.", "Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.",
...@@ -9760,6 +9727,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { ...@@ -9760,6 +9727,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(strict_mode), MYSQL_SYSVAR(strict_mode),
MYSQL_SYSVAR(support_xa), MYSQL_SYSVAR(support_xa),
MYSQL_SYSVAR(sync_spin_loops), MYSQL_SYSVAR(sync_spin_loops),
MYSQL_SYSVAR(spin_wait_delay),
MYSQL_SYSVAR(table_locks), MYSQL_SYSVAR(table_locks),
MYSQL_SYSVAR(thread_concurrency), MYSQL_SYSVAR(thread_concurrency),
MYSQL_SYSVAR(thread_sleep_delay), MYSQL_SYSVAR(thread_sleep_delay),
...@@ -9771,168 +9739,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { ...@@ -9771,168 +9739,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
NULL NULL
}; };
#ifdef MYSQL_DYNAMIC_PLUGIN
struct st_mysql_sys_var
{
MYSQL_PLUGIN_VAR_HEADER;
void* value;
};
struct param_mapping
{
const char* server; /* Parameter name in the server. */
const char* plugin; /* Paramater name in the plugin. */
};
/********************************************************************
Match the parameters from the static and dynamic versions. */
static
bool
innobase_match_parameter(
/*=====================*/
/* out: true if names match */
const char* from_server, /* in: variable name from server */
const char* from_plugin) /* in: variable name from plugin */
{
static const param_mapping param_map[] = {
{"use_adaptive_hash_indexes", "adaptive_hash_index"}
};
if (strcmp(from_server, from_plugin) == 0) {
return(true);
}
const param_mapping* param = param_map;
int n_elems = sizeof(param_map) / sizeof(param_map[0]);
for (int i = 0; i < n_elems; ++i, ++param) {
if (strcmp(param->server, from_server) == 0
&& strcmp(param->plugin, from_plugin) == 0) {
return(true);
}
}
return(false);
}
/********************************************************************
Copy InnoDB system variables from the static InnoDB to the dynamic
plugin. */
static
bool
innodb_plugin_init(void)
/*====================*/
/* out: TRUE if the dynamic InnoDB plugin should start */
{
#if !MYSQL_STORAGE_ENGINE_PLUGIN
#error "MYSQL_STORAGE_ENGINE_PLUGIN must be nonzero."
#endif
/* Copy the system variables. */
struct st_mysql_plugin* builtin;
struct st_mysql_sys_var** sta; /* static parameters */
struct st_mysql_sys_var** dyn; /* dynamic parameters */
#ifdef __WIN__
if (!builtin_innobase_plugin_ptr) {
return(true);
}
builtin = builtin_innobase_plugin_ptr;
#else
switch (builtin_innobase_plugin) {
case 0:
return(true);
case MYSQL_STORAGE_ENGINE_PLUGIN:
break;
default:
return(false);
}
builtin = (struct st_mysql_plugin*) &builtin_innobase_plugin;
#endif
for (sta = builtin->system_vars; *sta != NULL; sta++) {
for (dyn = innobase_system_variables; *dyn != NULL; dyn++) {
/* do not copy session variables */
if (((*sta)->flags | (*dyn)->flags)
& PLUGIN_VAR_THDLOCAL) {
continue;
}
if (innobase_match_parameter((*sta)->name,
(*dyn)->name)) {
/* found the corresponding parameter */
/* check if the flags are the same,
ignoring differences in the READONLY or
NOSYSVAR flags;
e.g. we are not copying string variable to
an integer one, but we do not care if it is
readonly in the static and not in the
dynamic */
if (((*sta)->flags ^ (*dyn)->flags)
& ~(PLUGIN_VAR_READONLY
| PLUGIN_VAR_NOSYSVAR)) {
fprintf(stderr,
"InnoDB: %s in static InnoDB "
"(flags=0x%x) differs from "
"%s in dynamic InnoDB "
"(flags=0x%x)\n",
(*sta)->name, (*sta)->flags,
(*dyn)->name, (*dyn)->flags);
/* we could break; here leaving this
parameter uncopied */
return(false);
}
/* assign the value of the static parameter
to the dynamic one, according to their type */
#define COPY_VAR(label, type) \
case label: \
*(type*)(*dyn)->value = *(type*)(*sta)->value; \
break;
switch ((*sta)->flags
& ~(PLUGIN_VAR_MASK
| PLUGIN_VAR_UNSIGNED)) {
COPY_VAR(PLUGIN_VAR_BOOL, char);
COPY_VAR(PLUGIN_VAR_INT, int);
COPY_VAR(PLUGIN_VAR_LONG, long);
COPY_VAR(PLUGIN_VAR_LONGLONG, long long);
COPY_VAR(PLUGIN_VAR_STR, char*);
default:
fprintf(stderr,
"InnoDB: unknown flags "
"0x%x for %s\n",
(*sta)->flags, (*sta)->name);
}
/* Make the static InnoDB variable point to
the dynamic one */
(*sta)->value = (*dyn)->value;
break;
}
}
}
return(true);
}
#endif /* MYSQL_DYNAMIC_PLUGIN */
mysql_declare_plugin(innobase) mysql_declare_plugin(innobase)
{ {
MYSQL_STORAGE_ENGINE_PLUGIN, MYSQL_STORAGE_ENGINE_PLUGIN,
......
...@@ -119,14 +119,6 @@ class ha_innobase: public handler ...@@ -119,14 +119,6 @@ class ha_innobase: public handler
void try_semi_consistent_read(bool yes); void try_semi_consistent_read(bool yes);
void unlock_row(); void unlock_row();
#ifdef ROW_MERGE_IS_INDEX_USABLE
/** Check if an index can be used by this transaction.
* @param keynr key number to check
* @return true if available, false if the index
* does not contain old records that exist
* in the read view of this transaction */
bool is_index_available(uint keynr);
#endif /* ROW_MERGE_IS_INDEX_USABLE */
int index_init(uint index, bool sorted); int index_init(uint index, bool sorted);
int index_end(); int index_end();
int index_read(uchar * buf, const uchar * key, int index_read(uchar * buf, const uchar * key,
......
...@@ -72,12 +72,6 @@ uint* wdl_lower_case_table_names; ...@@ -72,12 +72,6 @@ uint* wdl_lower_case_table_names;
ulong* wdl_specialflag; ulong* wdl_specialflag;
int* wdl_my_umask; int* wdl_my_umask;
/***********************************************************************
The following is defined in ha_innodb.cc. It is used for copying the
system variables from the builtin innodb plugin to the dynamic plugin.
*/
extern struct st_mysql_plugin* builtin_innobase_plugin_ptr;
/*********************************************************************** /***********************************************************************
The preffered load-address defined in PE (portable executable format).*/ The preffered load-address defined in PE (portable executable format).*/
#if defined(_M_IA64) #if defined(_M_IA64)
...@@ -643,12 +637,6 @@ wdl_get_external_variables(void) ...@@ -643,12 +637,6 @@ wdl_get_external_variables(void)
"?binlog_format_names@@3PAPBDA", "?binlog_format_names@@3PAPBDA",
wdl_binlog_format_names, char*); wdl_binlog_format_names, char*);
/* It is fine if builtin_innobase_plugin is not available. */
builtin_innobase_plugin_ptr = (struct st_mysql_plugin*)
wdl_get_varaddr_from_map(
hmod,
"?builtin_innobase_plugin@@3PAUst_mysql_plugin@@A");
#ifndef DBUG_OFF #ifndef DBUG_OFF
GET_PROC_ADDR(_db_enter_); GET_PROC_ADDR(_db_enter_);
GET_PROC_ADDR(_db_return_); GET_PROC_ADDR(_db_return_);
......
...@@ -912,6 +912,22 @@ buf_block_align( ...@@ -912,6 +912,22 @@ buf_block_align(
/*============*/ /*============*/
/* out: pointer to block, never NULL */ /* out: pointer to block, never NULL */
const byte* ptr); /* in: pointer to a frame */ const byte* ptr); /* in: pointer to a frame */
/************************************************************************
Find out if a pointer belongs to a buf_block_t. It can be a pointer to
the buf_block_t itself or a member of it */
UNIV_INTERN
ibool
buf_pointer_is_block_field(
/*=======================*/
/* out: TRUE if ptr belongs
to a buf_block_t struct */
const void* ptr); /* in: pointer not
dereferenced */
#define buf_pool_is_block_mutex(m) \
buf_pointer_is_block_field((void *)(m))
#define buf_pool_is_block_lock(l) \
buf_pointer_is_block_field((void *)(l))
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG #if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/************************************************************************* /*************************************************************************
Gets the compressed page descriptor corresponding to an uncompressed page Gets the compressed page descriptor corresponding to an uncompressed page
...@@ -1086,9 +1102,10 @@ struct buf_page_struct{ ...@@ -1086,9 +1102,10 @@ struct buf_page_struct{
/* 2. Page flushing fields; protected by buf_pool_mutex */ /* 2. Page flushing fields; protected by buf_pool_mutex */
UT_LIST_NODE_T(buf_page_t) list; UT_LIST_NODE_T(buf_page_t) list;
/* based on state, this is a list /* based on state, this is a
node in one of the following lists list node, protected only by
in buf_pool: buf_pool_mutex, in one of the
following lists in buf_pool:
BUF_BLOCK_NOT_USED: free BUF_BLOCK_NOT_USED: free
BUF_BLOCK_FILE_PAGE: flush_list BUF_BLOCK_FILE_PAGE: flush_list
......
...@@ -1056,10 +1056,6 @@ buf_page_release( ...@@ -1056,10 +1056,6 @@ buf_page_release(
#endif #endif
block->page.buf_fix_count--; block->page.buf_fix_count--;
/* Dirty blocks should be in the flush list. */
ut_ad(!block->page.oldest_modification
|| block->page.in_flush_list);
mutex_exit(&block->mutex); mutex_exit(&block->mutex);
if (rw_latch == RW_S_LATCH) { if (rw_latch == RW_S_LATCH) {
......
...@@ -97,7 +97,6 @@ dict_drop_index_tree( ...@@ -97,7 +97,6 @@ dict_drop_index_tree(
rec_t* rec, /* in/out: record in the clustered index rec_t* rec, /* in/out: record in the clustered index
of SYS_INDEXES table */ of SYS_INDEXES table */
mtr_t* mtr); /* in: mtr having the latch on the record page */ mtr_t* mtr); /* in: mtr having the latch on the record page */
#ifndef UNIV_HOTBACKUP
/******************************************************************** /********************************************************************
Creates the foreign key constraints system tables inside InnoDB Creates the foreign key constraints system tables inside InnoDB
at database creation or database start if they are not found or are at database creation or database start if they are not found or are
...@@ -129,7 +128,6 @@ dict_create_add_foreigns_to_dictionary( ...@@ -129,7 +128,6 @@ dict_create_add_foreigns_to_dictionary(
was generated here */ was generated here */
dict_table_t* table, /* in: table */ dict_table_t* table, /* in: table */
trx_t* trx); /* in: transaction */ trx_t* trx); /* in: transaction */
#endif /* !UNIV_HOTBACKUP */
/* Table create node structure */ /* Table create node structure */
......
...@@ -87,7 +87,6 @@ void ...@@ -87,7 +87,6 @@ void
dict_load_sys_table( dict_load_sys_table(
/*================*/ /*================*/
dict_table_t* table); /* in: system table */ dict_table_t* table); /* in: system table */
#ifndef UNIV_HOTBACKUP
/*************************************************************************** /***************************************************************************
Loads foreign key constraints where the table is either the foreign key Loads foreign key constraints where the table is either the foreign key
holder or where the table is referenced by a foreign key. Adds these holder or where the table is referenced by a foreign key. Adds these
...@@ -102,7 +101,6 @@ dict_load_foreigns( ...@@ -102,7 +101,6 @@ dict_load_foreigns(
const char* table_name, /* in: table name */ const char* table_name, /* in: table name */
ibool check_charsets);/* in: TRUE=check charsets ibool check_charsets);/* in: TRUE=check charsets
compatibility */ compatibility */
#endif /* !UNIV_HOTBACKUP */
/************************************************************************ /************************************************************************
Prints to the standard output information on all tables found in the data Prints to the standard output information on all tables found in the data
dictionary system table. */ dictionary system table. */
......
...@@ -279,11 +279,9 @@ struct dict_index_struct{ ...@@ -279,11 +279,9 @@ struct dict_index_struct{
index tree */ index tree */
rw_lock_t lock; /* read-write lock protecting the upper levels rw_lock_t lock; /* read-write lock protecting the upper levels
of the index tree */ of the index tree */
#ifdef ROW_MERGE_IS_INDEX_USABLE ib_uint64_t trx_id; /* id of the transaction that created this
dulint trx_id; /* id of the transaction that created this index, or 0 if the index existed
index, or ut_dulint_zero if the index existed
when InnoDB was started up */ when InnoDB was started up */
#endif /* ROW_MERGE_IS_INDEX_USABLE */
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
ulint magic_n;/* magic number */ ulint magic_n;/* magic number */
......
...@@ -19,9 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA ...@@ -19,9 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef HA_INNODB_PROTOTYPES_H #ifndef HA_INNODB_PROTOTYPES_H
#define HA_INNODB_PROTOTYPES_H #define HA_INNODB_PROTOTYPES_H
#ifndef UNIV_HOTBACKUP #include "trx0types.h"
#include "univ.i" /* ulint, uint */
#include "m_ctype.h" /* CHARSET_INFO */ #include "m_ctype.h" /* CHARSET_INFO */
/* Prototypes for global functions in ha_innodb.cc that are called by /* Prototypes for global functions in ha_innodb.cc that are called by
...@@ -64,6 +62,22 @@ innobase_raw_format( ...@@ -64,6 +62,22 @@ innobase_raw_format(
ulint buf_size); /* in: output buffer size ulint buf_size); /* in: output buffer size
in bytes */ in bytes */
/*********************************************************************
Invalidates the MySQL query cache for the table. */
UNIV_INTERN
void
innobase_invalidate_query_cache(
/*============================*/
trx_t* trx, /* in: transaction which
modifies the table */
const char* full_name, /* in: concatenation of
database name, null char '\0',
table name, null char '\0';
NOTE that in Windows this is
always in LOWER CASE! */
ulint full_name_len); /* in: full name length where
also the null chars count */
/********************************************************************* /*********************************************************************
Convert a table or index name to the MySQL system_charset_info (UTF-8) Convert a table or index name to the MySQL system_charset_info (UTF-8)
and quote it if needed. */ and quote it if needed. */
...@@ -264,4 +278,3 @@ thd_lock_wait_timeout( ...@@ -264,4 +278,3 @@ thd_lock_wait_timeout(
the global innodb_lock_wait_timeout */ the global innodb_lock_wait_timeout */
#endif #endif
#endif
...@@ -42,13 +42,6 @@ os_fast_mutex_trylock( ...@@ -42,13 +42,6 @@ os_fast_mutex_trylock(
EnterCriticalSection(fast_mutex); EnterCriticalSection(fast_mutex);
return(0); return(0);
#else
#if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10)
/* Since the hot backup version is standalone, MySQL does not redefine
pthread_mutex_trylock for HP-UX-10.20, and consequently we must invert
the return value here */
return((ulint) (1 - pthread_mutex_trylock(fast_mutex)));
#else #else
/* NOTE that the MySQL my_pthread.h redefines pthread_mutex_trylock /* NOTE that the MySQL my_pthread.h redefines pthread_mutex_trylock
so that it returns 0 on success. In the operating system so that it returns 0 on success. In the operating system
...@@ -58,5 +51,4 @@ os_fast_mutex_trylock( ...@@ -58,5 +51,4 @@ os_fast_mutex_trylock(
return((ulint) pthread_mutex_trylock(fast_mutex)); return((ulint) pthread_mutex_trylock(fast_mutex));
#endif #endif
#endif
} }
...@@ -133,16 +133,21 @@ struct read_view_struct{ ...@@ -133,16 +133,21 @@ struct read_view_struct{
can be removed in purge if not needed by other can be removed in purge if not needed by other
views */ views */
dulint low_limit_id; /* The read should not see any transaction dulint low_limit_id; /* The read should not see any transaction
with trx id >= this value */ with trx id >= this value. In other words,
this is the "high water mark". */
dulint up_limit_id; /* The read should see all trx ids which dulint up_limit_id; /* The read should see all trx ids which
are strictly smaller (<) than this value */ are strictly smaller (<) than this value.
In other words,
this is the "low water mark". */
ulint n_trx_ids; /* Number of cells in the trx_ids array */ ulint n_trx_ids; /* Number of cells in the trx_ids array */
dulint* trx_ids; /* Additional trx ids which the read should dulint* trx_ids; /* Additional trx ids which the read should
not see: typically, these are the active not see: typically, these are the active
transactions at the time when the read is transactions at the time when the read is
serialized, except the reading transaction serialized, except the reading transaction
itself; the trx ids in this array are in a itself; the trx ids in this array are in a
descending order */ descending order. These trx_ids should be
between the "low" and "high" water marks,
that is, up_limit_id and low_limit_id. */
dulint creator_trx_id; /* trx id of creating transaction, or dulint creator_trx_id; /* trx id of creating transaction, or
(0, 0) used in purge */ (0, 0) used in purge */
UT_LIST_NODE_T(read_view_t) view_list; UT_LIST_NODE_T(read_view_t) view_list;
......
...@@ -141,7 +141,6 @@ cmp_dtuple_is_prefix_of_rec( ...@@ -141,7 +141,6 @@ cmp_dtuple_is_prefix_of_rec(
const dtuple_t* dtuple, /* in: data tuple */ const dtuple_t* dtuple, /* in: data tuple */
const rec_t* rec, /* in: physical record */ const rec_t* rec, /* in: physical record */
const ulint* offsets);/* in: array returned by rec_get_offsets() */ const ulint* offsets);/* in: array returned by rec_get_offsets() */
#ifndef UNIV_HOTBACKUP
/***************************************************************** /*****************************************************************
Compare two physical records that contain the same number of columns, Compare two physical records that contain the same number of columns,
none of which are stored externally. */ none of which are stored externally. */
...@@ -156,7 +155,6 @@ cmp_rec_rec_simple( ...@@ -156,7 +155,6 @@ cmp_rec_rec_simple(
const ulint* offsets1,/* in: rec_get_offsets(rec1, index) */ const ulint* offsets1,/* in: rec_get_offsets(rec1, index) */
const ulint* offsets2,/* in: rec_get_offsets(rec2, index) */ const ulint* offsets2,/* in: rec_get_offsets(rec2, index) */
const dict_index_t* index); /* in: data dictionary index */ const dict_index_t* index); /* in: data dictionary index */
#endif /* !UNIV_HOTBACKUP */
/***************************************************************** /*****************************************************************
This function is used to compare two physical records. Only the common This function is used to compare two physical records. Only the common
first fields are compared, and if an externally stored field is first fields are compared, and if an externally stored field is
......
...@@ -152,7 +152,6 @@ row_merge_create_index( ...@@ -152,7 +152,6 @@ row_merge_create_index(
dict_table_t* table, /* in: the index is on this table */ dict_table_t* table, /* in: the index is on this table */
const merge_index_def_t* /* in: the index definition */ const merge_index_def_t* /* in: the index definition */
index_def); index_def);
#ifdef ROW_MERGE_IS_INDEX_USABLE
/************************************************************************* /*************************************************************************
Check if a transaction can use an index. */ Check if a transaction can use an index. */
UNIV_INTERN UNIV_INTERN
...@@ -163,7 +162,6 @@ row_merge_is_index_usable( ...@@ -163,7 +162,6 @@ row_merge_is_index_usable(
the transaction else FALSE*/ the transaction else FALSE*/
const trx_t* trx, /* in: transaction */ const trx_t* trx, /* in: transaction */
const dict_index_t* index); /* in: index to check */ const dict_index_t* index); /* in: index to check */
#endif /* ROW_MERGE_IS_INDEX_USABLE */
/************************************************************************* /*************************************************************************
If there are views that refer to the old table name then we "attach" to If there are views that refer to the old table name then we "attach" to
the new instance of the table else we drop it immediately. */ the new instance of the table else we drop it immediately. */
......
...@@ -351,7 +351,6 @@ void ...@@ -351,7 +351,6 @@ void
row_mysql_unfreeze_data_dictionary( row_mysql_unfreeze_data_dictionary(
/*===============================*/ /*===============================*/
trx_t* trx); /* in/out: transaction */ trx_t* trx); /* in/out: transaction */
#ifndef UNIV_HOTBACKUP
/************************************************************************* /*************************************************************************
Creates a table for MySQL. If the name of the table ends in Creates a table for MySQL. If the name of the table ends in
one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor", one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor",
...@@ -502,7 +501,6 @@ row_check_table_for_mysql( ...@@ -502,7 +501,6 @@ row_check_table_for_mysql(
/* out: DB_ERROR or DB_SUCCESS */ /* out: DB_ERROR or DB_SUCCESS */
row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL
handle */ handle */
#endif /* !UNIV_HOTBACKUP */
/************************************************************************* /*************************************************************************
Determines if a table is a magic monitor table. */ Determines if a table is a magic monitor table. */
...@@ -573,52 +571,54 @@ struct row_prebuilt_struct { ...@@ -573,52 +571,54 @@ struct row_prebuilt_struct {
or ROW_PREBUILT_FREED when the or ROW_PREBUILT_FREED when the
struct has been freed */ struct has been freed */
dict_table_t* table; /* Innobase table handle */ dict_table_t* table; /* Innobase table handle */
dict_index_t* index; /* current index for a search, if
any */
trx_t* trx; /* current transaction handle */ trx_t* trx; /* current transaction handle */
ibool sql_stat_start; /* TRUE when we start processing of unsigned sql_stat_start:1;/* TRUE when we start processing of
an SQL statement: we may have to set an SQL statement: we may have to set
an intention lock on the table, an intention lock on the table,
create a consistent read view etc. */ create a consistent read view etc. */
ibool mysql_has_locked; /* this is set TRUE when MySQL unsigned mysql_has_locked:1; /* this is set TRUE when MySQL
calls external_lock on this handle calls external_lock on this handle
with a lock flag, and set FALSE when with a lock flag, and set FALSE when
with the F_UNLOCK flag */ with the F_UNLOCK flag */
ibool clust_index_was_generated; unsigned clust_index_was_generated:1;
/* if the user did not define a /* if the user did not define a
primary key in MySQL, then Innobase primary key in MySQL, then Innobase
automatically generated a clustered automatically generated a clustered
index where the ordering column is index where the ordering column is
the row id: in this case this flag the row id: in this case this flag
is set to TRUE */ is set to TRUE */
dict_index_t* index; /* current index for a search, if unsigned index_usable:1; /* caches the value of
any */ row_merge_is_index_usable(trx,index) */
ulint read_just_key; /* set to 1 when MySQL calls unsigned read_just_key:1;/* set to 1 when MySQL calls
ha_innobase::extra with the ha_innobase::extra with the
argument HA_EXTRA_KEYREAD; it is enough argument HA_EXTRA_KEYREAD; it is enough
to read just columns defined in to read just columns defined in
the index (i.e., no read of the the index (i.e., no read of the
clustered index record necessary) */ clustered index record necessary) */
ibool used_in_HANDLER;/* TRUE if we have been using this unsigned used_in_HANDLER:1;/* TRUE if we have been using this
handle in a MySQL HANDLER low level handle in a MySQL HANDLER low level
index cursor command: then we must index cursor command: then we must
store the pcur position even in a store the pcur position even in a
unique search from a clustered index, unique search from a clustered index,
because HANDLER allows NEXT and PREV because HANDLER allows NEXT and PREV
in such a situation */ in such a situation */
ulint template_type; /* ROW_MYSQL_WHOLE_ROW, unsigned template_type:2;/* ROW_MYSQL_WHOLE_ROW,
ROW_MYSQL_REC_FIELDS, ROW_MYSQL_REC_FIELDS,
ROW_MYSQL_DUMMY_TEMPLATE, or ROW_MYSQL_DUMMY_TEMPLATE, or
ROW_MYSQL_NO_TEMPLATE */ ROW_MYSQL_NO_TEMPLATE */
ulint n_template; /* number of elements in the unsigned n_template:10; /* number of elements in the
template */ template */
ulint null_bitmap_len;/* number of bytes in the SQL NULL unsigned null_bitmap_len:10;/* number of bytes in the SQL NULL
bitmap at the start of a row in the bitmap at the start of a row in the
MySQL format */ MySQL format */
ibool need_to_access_clustered; /* if we are fetching unsigned need_to_access_clustered:1; /* if we are fetching
columns through a secondary index columns through a secondary index
and at least one column is not in and at least one column is not in
the secondary index, then this is the secondary index, then this is
set to TRUE */ set to TRUE */
ibool templ_contains_blob;/* TRUE if the template contains unsigned templ_contains_blob:1;/* TRUE if the template contains
BLOB column(s) */ BLOB column(s) */
mysql_row_templ_t* mysql_template;/* template used to transform mysql_row_templ_t* mysql_template;/* template used to transform
rows fast between MySQL and Innobase rows fast between MySQL and Innobase
......
...@@ -190,7 +190,7 @@ extern ibool srv_error_monitor_active; ...@@ -190,7 +190,7 @@ extern ibool srv_error_monitor_active;
extern ulong srv_n_spin_wait_rounds; extern ulong srv_n_spin_wait_rounds;
extern ulong srv_n_free_tickets_to_enter; extern ulong srv_n_free_tickets_to_enter;
extern ulong srv_thread_sleep_delay; extern ulong srv_thread_sleep_delay;
extern ulint srv_spin_wait_delay; extern ulong srv_spin_wait_delay;
extern ibool srv_priority_boost; extern ibool srv_priority_boost;
extern ulint srv_mem_pool_size; extern ulint srv_mem_pool_size;
......
...@@ -40,9 +40,7 @@ Created 9/5/1995 Heikki Tuuri ...@@ -40,9 +40,7 @@ Created 9/5/1995 Heikki Tuuri
#include "os0sync.h" #include "os0sync.h"
#include "sync0arr.h" #include "sync0arr.h"
#ifndef UNIV_HOTBACKUP
extern my_bool timed_mutexes; extern my_bool timed_mutexes;
#endif /* UNIV_HOTBACKUP */
/********************************************************************** /**********************************************************************
Initializes the synchronization data structures. */ Initializes the synchronization data structures. */
...@@ -515,9 +513,8 @@ struct mutex_struct { ...@@ -515,9 +513,8 @@ struct mutex_struct {
ulint magic_n; ulint magic_n;
# define MUTEX_MAGIC_N (ulint)979585 # define MUTEX_MAGIC_N (ulint)979585
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
#ifndef UNIV_HOTBACKUP
ulong count_os_wait; /* count of os_wait */ ulong count_os_wait; /* count of os_wait */
# ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
ulong count_using; /* count of times mutex used */ ulong count_using; /* count of times mutex used */
ulong count_spin_loop; /* count of spin loops */ ulong count_spin_loop; /* count of spin loops */
ulong count_spin_rounds; /* count of spin rounds */ ulong count_spin_rounds; /* count of spin rounds */
...@@ -526,8 +523,7 @@ struct mutex_struct { ...@@ -526,8 +523,7 @@ struct mutex_struct {
ulonglong lmax_spent_time; /* mutex os_wait timer msec */ ulonglong lmax_spent_time; /* mutex os_wait timer msec */
const char* cmutex_name;/* mutex name */ const char* cmutex_name;/* mutex name */
ulint mutex_type;/* 0 - usual mutex 1 - rw_lock mutex */ ulint mutex_type;/* 0 - usual mutex 1 - rw_lock mutex */
# endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */
}; };
/* The global array of wait cells for implementation of the databases own /* The global array of wait cells for implementation of the databases own
......
...@@ -254,9 +254,7 @@ mutex_enter_func( ...@@ -254,9 +254,7 @@ mutex_enter_func(
/* Note that we do not peek at the value of lock_word before trying /* Note that we do not peek at the value of lock_word before trying
the atomic test_and_set; we could peek, and possibly save time. */ the atomic test_and_set; we could peek, and possibly save time. */
#if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP ut_d(mutex->count_using++);
mutex->count_using++;
#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
if (!mutex_test_and_set(mutex)) { if (!mutex_test_and_set(mutex)) {
ut_d(mutex->thread_id = os_thread_get_curr_id()); ut_d(mutex->thread_id = os_thread_get_curr_id());
......
...@@ -1438,7 +1438,6 @@ lock_rec_has_expl( ...@@ -1438,7 +1438,6 @@ lock_rec_has_expl(
} }
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
# ifndef UNIV_HOTBACKUP
/************************************************************************* /*************************************************************************
Checks if some other transaction has a lock request in the queue. */ Checks if some other transaction has a lock request in the queue. */
static static
...@@ -1485,7 +1484,6 @@ lock_rec_other_has_expl_req( ...@@ -1485,7 +1484,6 @@ lock_rec_other_has_expl_req(
return(NULL); return(NULL);
} }
# endif /* !UNIV_HOTBACKUP */
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/************************************************************************* /*************************************************************************
...@@ -4330,8 +4328,6 @@ lock_rec_print( ...@@ -4330,8 +4328,6 @@ lock_rec_print(
} }
} }
#ifndef UNIV_HOTBACKUP
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/* Print the number of lock structs from lock_print_info_summary() only /* Print the number of lock structs from lock_print_info_summary() only
in non-production builds for performance reasons, see in non-production builds for performance reasons, see
...@@ -4575,7 +4571,7 @@ loop: ...@@ -4575,7 +4571,7 @@ loop:
goto loop; goto loop;
} }
# ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/************************************************************************* /*************************************************************************
Validates the lock queue on a table. */ Validates the lock queue on a table. */
static static
...@@ -4910,8 +4906,7 @@ lock_validate(void) ...@@ -4910,8 +4906,7 @@ lock_validate(void)
return(TRUE); return(TRUE);
} }
# endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */
/*============ RECORD LOCK CHECKS FOR ROW OPERATIONS ====================*/ /*============ RECORD LOCK CHECKS FOR ROW OPERATIONS ====================*/
/************************************************************************* /*************************************************************************
......
...@@ -1132,3 +1132,39 @@ t2 CREATE TABLE `t2` ( ...@@ -1132,3 +1132,39 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e');
BEGIN;
SELECT * FROM t1;
a b
3 a
3 b
1 c
0 d
1 e
CREATE INDEX t1a ON t1(a);
SELECT * FROM t1;
a b
3 a
3 b
1 c
0 d
1 e
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
ERROR HY000: Table definition has changed, please retry transaction
SELECT * FROM t1;
a b
3 a
3 b
1 c
0 d
1 e
COMMIT;
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
a b
0 d
1 c
1 e
3 a
3 b
DROP TABLE t1;
...@@ -509,3 +509,26 @@ SHOW CREATE TABLE t2; ...@@ -509,3 +509,26 @@ SHOW CREATE TABLE t2;
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t1; DROP TABLE t1;
connect (a,localhost,root,,);
connect (b,localhost,root,,);
connection a;
CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e');
connection b;
BEGIN;
SELECT * FROM t1;
connection a;
CREATE INDEX t1a ON t1(a);
connection b;
SELECT * FROM t1;
--error ER_TABLE_DEF_CHANGED
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
SELECT * FROM t1;
COMMIT;
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
connection default;
disconnect a;
disconnect b;
DROP TABLE t1;
...@@ -161,12 +161,8 @@ os_event_create( ...@@ -161,12 +161,8 @@ os_event_create(
os_fast_mutex_init(&(event->os_mutex)); os_fast_mutex_init(&(event->os_mutex));
#if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10)
ut_a(0 == pthread_cond_init(&(event->cond_var),
pthread_condattr_default));
#else
ut_a(0 == pthread_cond_init(&(event->cond_var), NULL)); ut_a(0 == pthread_cond_init(&(event->cond_var), NULL));
#endif
event->is_set = FALSE; event->is_set = FALSE;
/* We return this value in os_event_reset(), which can then be /* We return this value in os_event_reset(), which can then be
...@@ -674,12 +670,8 @@ os_fast_mutex_init( ...@@ -674,12 +670,8 @@ os_fast_mutex_init(
ut_a(fast_mutex); ut_a(fast_mutex);
InitializeCriticalSection((LPCRITICAL_SECTION) fast_mutex); InitializeCriticalSection((LPCRITICAL_SECTION) fast_mutex);
#else
#if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10)
ut_a(0 == pthread_mutex_init(fast_mutex, pthread_mutexattr_default));
#else #else
ut_a(0 == pthread_mutex_init(fast_mutex, MY_MUTEX_INIT_FAST)); ut_a(0 == pthread_mutex_init(fast_mutex, MY_MUTEX_INIT_FAST));
#endif
#endif #endif
if (UNIV_LIKELY(os_sync_mutex_inited)) { if (UNIV_LIKELY(os_sync_mutex_inited)) {
/* When creating os_sync_mutex itself (in Unix) we cannot /* When creating os_sync_mutex itself (in Unix) we cannot
......
...@@ -73,7 +73,6 @@ cmp_debug_dtuple_rec_with_match( ...@@ -73,7 +73,6 @@ cmp_debug_dtuple_rec_with_match(
returns, contains the value for current returns, contains the value for current
comparison */ comparison */
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
#ifndef UNIV_HOTBACKUP
/***************************************************************** /*****************************************************************
This function is used to compare two data fields for which the data type This function is used to compare two data fields for which the data type
is such that we must use MySQL code to compare them. The prototype here is such that we must use MySQL code to compare them. The prototype here
...@@ -92,7 +91,6 @@ innobase_mysql_cmp( ...@@ -92,7 +91,6 @@ innobase_mysql_cmp(
const unsigned char* b, /* in: data field */ const unsigned char* b, /* in: data field */
unsigned int b_length); /* in: data field length, unsigned int b_length); /* in: data field length,
not UNIV_SQL_NULL */ not UNIV_SQL_NULL */
#endif /* !UNIV_HOTBACKUP */
/************************************************************************* /*************************************************************************
Transforms the character code so that it is ordered appropriately for the Transforms the character code so that it is ordered appropriately for the
language. This is only used for the latin1 char set. MySQL does the language. This is only used for the latin1 char set. MySQL does the
...@@ -161,7 +159,6 @@ cmp_cols_are_equal( ...@@ -161,7 +159,6 @@ cmp_cols_are_equal(
return(col1->mtype != DATA_INT || col1->len == col2->len); return(col1->mtype != DATA_INT || col1->len == col2->len);
} }
#ifndef UNIV_HOTBACKUP
/***************************************************************** /*****************************************************************
Innobase uses this function to compare two data fields for which the data type Innobase uses this function to compare two data fields for which the data type
is such that we must compare whole fields or call MySQL to do the comparison */ is such that we must compare whole fields or call MySQL to do the comparison */
...@@ -288,7 +285,6 @@ cmp_whole_field( ...@@ -288,7 +285,6 @@ cmp_whole_field(
return(0); return(0);
} }
#endif /* !UNIV_HOTBACKUP */
/***************************************************************** /*****************************************************************
This function is used to compare two data fields for which we know the This function is used to compare two data fields for which we know the
...@@ -308,7 +304,6 @@ cmp_data_data_slow( ...@@ -308,7 +304,6 @@ cmp_data_data_slow(
buffer) */ buffer) */
ulint len2) /* in: data field length or UNIV_SQL_NULL */ ulint len2) /* in: data field length or UNIV_SQL_NULL */
{ {
#ifndef UNIV_HOTBACKUP
ulint data1_byte; ulint data1_byte;
ulint data2_byte; ulint data2_byte;
ulint cur_bytes; ulint cur_bytes;
...@@ -401,12 +396,6 @@ next_byte: ...@@ -401,12 +396,6 @@ next_byte:
data1++; data1++;
data2++; data2++;
} }
#else /* !UNIV_HOTBACKUP */
/* This function depends on MySQL code that is not included in
InnoDB Hot Backup builds. Besides, this function should never
be called in InnoDB Hot Backup. */
ut_error;
#endif /* !UNIV_HOTBACKUP */
return(0); /* Not reached */ return(0); /* Not reached */
} }
...@@ -442,7 +431,6 @@ cmp_dtuple_rec_with_match( ...@@ -442,7 +431,6 @@ cmp_dtuple_rec_with_match(
matched; when function returns, contains the matched; when function returns, contains the
value for current comparison */ value for current comparison */
{ {
#ifndef UNIV_HOTBACKUP
const dfield_t* dtuple_field; /* current field in logical record */ const dfield_t* dtuple_field; /* current field in logical record */
ulint dtuple_f_len; /* the length of the current field ulint dtuple_f_len; /* the length of the current field
in the logical record */ in the logical record */
...@@ -650,13 +638,6 @@ order_resolved: ...@@ -650,13 +638,6 @@ order_resolved:
*matched_bytes = cur_bytes; *matched_bytes = cur_bytes;
return(ret); return(ret);
#else /* !UNIV_HOTBACKUP */
/* This function depends on MySQL code that is not included in
InnoDB Hot Backup builds. Besides, this function should never
be called in InnoDB Hot Backup. */
ut_error;
return(0);
#endif /* !UNIV_HOTBACKUP */
} }
/****************************************************************** /******************************************************************
...@@ -720,7 +701,6 @@ cmp_dtuple_is_prefix_of_rec( ...@@ -720,7 +701,6 @@ cmp_dtuple_is_prefix_of_rec(
return(FALSE); return(FALSE);
} }
#ifndef UNIV_HOTBACKUP
/***************************************************************** /*****************************************************************
Compare two physical records that contain the same number of columns, Compare two physical records that contain the same number of columns,
none of which are stored externally. */ none of which are stored externally. */
...@@ -870,7 +850,6 @@ next_field: ...@@ -870,7 +850,6 @@ next_field:
/* If we ran out of fields, rec1 was equal to rec2. */ /* If we ran out of fields, rec1 was equal to rec2. */
return(0); return(0);
} }
#endif /* !UNIV_HOTBACKUP */
/***************************************************************** /*****************************************************************
This function is used to compare two physical records. Only the common This function is used to compare two physical records. Only the common
...@@ -897,7 +876,6 @@ cmp_rec_rec_with_match( ...@@ -897,7 +876,6 @@ cmp_rec_rec_with_match(
matched; when the function returns, contains matched; when the function returns, contains
the value for the current comparison */ the value for the current comparison */
{ {
#ifndef UNIV_HOTBACKUP
ulint rec1_n_fields; /* the number of fields in rec */ ulint rec1_n_fields; /* the number of fields in rec */
ulint rec1_f_len; /* length of current field in rec */ ulint rec1_f_len; /* length of current field in rec */
const byte* rec1_b_ptr; /* pointer to the current byte const byte* rec1_b_ptr; /* pointer to the current byte
...@@ -1111,13 +1089,6 @@ order_resolved: ...@@ -1111,13 +1089,6 @@ order_resolved:
*matched_bytes = cur_bytes; *matched_bytes = cur_bytes;
return(ret); return(ret);
#else /* !UNIV_HOTBACKUP */
/* This function depends on MySQL code that is not included in
InnoDB Hot Backup builds. Besides, this function should never
be called in InnoDB Hot Backup. */
ut_error;
return(0);
#endif /* !UNIV_HOTBACKUP */
} }
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
......
...@@ -28,6 +28,7 @@ Created 4/20/1996 Heikki Tuuri ...@@ -28,6 +28,7 @@ Created 4/20/1996 Heikki Tuuri
#include "row0ins.ic" #include "row0ins.ic"
#endif #endif
#include "ha_prototypes.h"
#include "dict0dict.h" #include "dict0dict.h"
#include "dict0boot.h" #include "dict0boot.h"
#include "trx0undo.h" #include "trx0undo.h"
...@@ -50,23 +51,6 @@ Created 4/20/1996 Heikki Tuuri ...@@ -50,23 +51,6 @@ Created 4/20/1996 Heikki Tuuri
#define ROW_INS_NEXT 2 #define ROW_INS_NEXT 2
/*********************************************************************
This prototype is copied from /mysql/sql/ha_innodb.cc.
Invalidates the MySQL query cache for the table.
NOTE that the exact prototype of this function has to be in
/innobase/row/row0ins.c! */
extern
void
innobase_invalidate_query_cache(
/*============================*/
trx_t* trx, /* in: transaction which modifies the table */
char* full_name, /* in: concatenation of database name, null
char '\0', table name, null char'\0';
NOTE that in Windows this is always
in LOWER CASE! */
ulint full_name_len); /* in: full name length where also the null
chars count */
/************************************************************************* /*************************************************************************
Creates an insert node struct. */ Creates an insert node struct. */
UNIV_INTERN UNIV_INTERN
...@@ -767,10 +751,7 @@ row_ins_invalidate_query_cache( ...@@ -767,10 +751,7 @@ row_ins_invalidate_query_cache(
ut_a(ptr); ut_a(ptr);
*ptr = '\0'; *ptr = '\0';
/* We call a function in ha_innodb.cc */
#ifndef UNIV_HOTBACKUP
innobase_invalidate_query_cache(thr_get_trx(thr), buf, len); innobase_invalidate_query_cache(thr_get_trx(thr), buf, len);
#endif
mem_free(buf); mem_free(buf);
} }
...@@ -1172,7 +1153,6 @@ row_ins_set_shared_rec_lock( ...@@ -1172,7 +1153,6 @@ row_ins_set_shared_rec_lock(
return(err); return(err);
} }
#ifndef UNIV_HOTBACKUP
/************************************************************************* /*************************************************************************
Sets a exclusive lock on a record. Used in locking possible duplicate key Sets a exclusive lock on a record. Used in locking possible duplicate key
records */ records */
...@@ -1203,7 +1183,6 @@ row_ins_set_exclusive_rec_lock( ...@@ -1203,7 +1183,6 @@ row_ins_set_exclusive_rec_lock(
return(err); return(err);
} }
#endif /* !UNIV_HOTBACKUP */
/******************************************************************* /*******************************************************************
Checks if foreign key constraint fails for an index entry. Sets shared locks Checks if foreign key constraint fails for an index entry. Sets shared locks
...@@ -1611,7 +1590,6 @@ row_ins_check_foreign_constraints( ...@@ -1611,7 +1590,6 @@ row_ins_check_foreign_constraints(
return(DB_SUCCESS); return(DB_SUCCESS);
} }
#ifndef UNIV_HOTBACKUP
/******************************************************************* /*******************************************************************
Checks if a unique key violation to rec would occur at the index entry Checks if a unique key violation to rec would occur at the index entry
insert. */ insert. */
...@@ -1663,7 +1641,6 @@ row_ins_dupl_error_with_rec( ...@@ -1663,7 +1641,6 @@ row_ins_dupl_error_with_rec(
return(!rec_get_deleted_flag(rec, rec_offs_comp(offsets))); return(!rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
} }
#endif /* !UNIV_HOTBACKUP */
/******************************************************************* /*******************************************************************
Scans a unique non-clustered index at a given index entry to determine Scans a unique non-clustered index at a given index entry to determine
...@@ -1679,7 +1656,6 @@ row_ins_scan_sec_index_for_duplicate( ...@@ -1679,7 +1656,6 @@ row_ins_scan_sec_index_for_duplicate(
dtuple_t* entry, /* in: index entry */ dtuple_t* entry, /* in: index entry */
que_thr_t* thr) /* in: query thread */ que_thr_t* thr) /* in: query thread */
{ {
#ifndef UNIV_HOTBACKUP
ulint n_unique; ulint n_unique;
ulint i; ulint i;
int cmp; int cmp;
...@@ -1789,13 +1765,6 @@ row_ins_scan_sec_index_for_duplicate( ...@@ -1789,13 +1765,6 @@ row_ins_scan_sec_index_for_duplicate(
dtuple_set_n_fields_cmp(entry, n_fields_cmp); dtuple_set_n_fields_cmp(entry, n_fields_cmp);
return(err); return(err);
#else /* UNIV_HOTBACKUP */
/* This function depends on MySQL code that is not included in
InnoDB Hot Backup builds. Besides, this function should never
be called in InnoDB Hot Backup. */
ut_error;
return(DB_FAIL);
#endif /* UNIV_HOTBACKUP */
} }
/******************************************************************* /*******************************************************************
...@@ -1815,7 +1784,6 @@ row_ins_duplicate_error_in_clust( ...@@ -1815,7 +1784,6 @@ row_ins_duplicate_error_in_clust(
que_thr_t* thr, /* in: query thread */ que_thr_t* thr, /* in: query thread */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
#ifndef UNIV_HOTBACKUP
ulint err; ulint err;
rec_t* rec; rec_t* rec;
ulint n_unique; ulint n_unique;
...@@ -1939,13 +1907,6 @@ func_exit: ...@@ -1939,13 +1907,6 @@ func_exit:
mem_heap_free(heap); mem_heap_free(heap);
} }
return(err); return(err);
#else /* UNIV_HOTBACKUP */
/* This function depends on MySQL code that is not included in
InnoDB Hot Backup builds. Besides, this function should never
be called in InnoDB Hot Backup. */
ut_error;
return(DB_FAIL);
#endif /* UNIV_HOTBACKUP */
} }
/******************************************************************* /*******************************************************************
......
...@@ -2229,12 +2229,11 @@ row_merge_create_index( ...@@ -2229,12 +2229,11 @@ row_merge_create_index(
ut_a(index); ut_a(index);
#ifdef ROW_MERGE_IS_INDEX_USABLE
/* Note the id of the transaction that created this /* Note the id of the transaction that created this
index, we use it to restrict readers from accessing index, we use it to restrict readers from accessing
this index, to ensure read consistency. */ this index, to ensure read consistency. */
index->trx_id = trx->id; index->trx_id = (ib_uint64_t)
#endif /* ROW_MERGE_IS_INDEX_USABLE */ ut_conv_dulint_to_longlong(trx->id);
} else { } else {
index = NULL; index = NULL;
} }
...@@ -2242,7 +2241,6 @@ row_merge_create_index( ...@@ -2242,7 +2241,6 @@ row_merge_create_index(
return(index); return(index);
} }
#ifdef ROW_MERGE_IS_INDEX_USABLE
/************************************************************************* /*************************************************************************
Check if a transaction can use an index. */ Check if a transaction can use an index. */
UNIV_INTERN UNIV_INTERN
...@@ -2252,13 +2250,11 @@ row_merge_is_index_usable( ...@@ -2252,13 +2250,11 @@ row_merge_is_index_usable(
const trx_t* trx, /* in: transaction */ const trx_t* trx, /* in: transaction */
const dict_index_t* index) /* in: index to check */ const dict_index_t* index) /* in: index to check */
{ {
if (!trx->read_view) { return(!trx->read_view || read_view_sees_trx_id(
return(TRUE); trx->read_view,
} ut_dulint_create((ulint) (index->trx_id >> 32),
(ulint) index->trx_id & 0xFFFFFFFF)));
return(ut_dulint_cmp(index->trx_id, trx->read_view->low_limit_id) < 0);
} }
#endif /* ROW_MERGE_IS_INDEX_USABLE */
/************************************************************************* /*************************************************************************
Drop the old table. */ Drop the old table. */
......
...@@ -78,7 +78,6 @@ the above strings. */ ...@@ -78,7 +78,6 @@ the above strings. */
((str1_len) == sizeof(str2_onstack) \ ((str1_len) == sizeof(str2_onstack) \
&& memcmp(str1, str2_onstack, sizeof(str2_onstack)) == 0) && memcmp(str1, str2_onstack, sizeof(str2_onstack)) == 0)
#ifndef UNIV_HOTBACKUP
/*********************************************************************** /***********************************************************************
Determine if the given name is a name reserved for MySQL system tables. */ Determine if the given name is a name reserved for MySQL system tables. */
static static
...@@ -98,7 +97,6 @@ row_mysql_is_system_table( ...@@ -98,7 +97,6 @@ row_mysql_is_system_table(
|| 0 == strcmp(name + 6, "user") || 0 == strcmp(name + 6, "user")
|| 0 == strcmp(name + 6, "db")); || 0 == strcmp(name + 6, "db"));
} }
#endif /* !UNIV_HOTBACKUP */
/************************************************************************* /*************************************************************************
If a table is not yet in the drop list, adds the table to the list of tables If a table is not yet in the drop list, adds the table to the list of tables
...@@ -489,7 +487,6 @@ row_mysql_handle_errors( ...@@ -489,7 +487,6 @@ row_mysql_handle_errors(
que_thr_t* thr, /* in: query thread */ que_thr_t* thr, /* in: query thread */
trx_savept_t* savept) /* in: savepoint or NULL */ trx_savept_t* savept) /* in: savepoint or NULL */
{ {
#ifndef UNIV_HOTBACKUP
ulint err; ulint err;
handle_new_error: handle_new_error:
...@@ -583,13 +580,6 @@ handle_new_error: ...@@ -583,13 +580,6 @@ handle_new_error:
trx->error_state = DB_SUCCESS; trx->error_state = DB_SUCCESS;
return(FALSE); return(FALSE);
#else /* UNIV_HOTBACKUP */
/* This function depends on MySQL code that is not included in
InnoDB Hot Backup builds. Besides, this function should never
be called in InnoDB Hot Backup. */
ut_error;
return(FALSE);
#endif /* UNIV_HOTBACKUP */
} }
/************************************************************************ /************************************************************************
...@@ -1743,7 +1733,6 @@ row_mysql_unlock_data_dictionary( ...@@ -1743,7 +1733,6 @@ row_mysql_unlock_data_dictionary(
trx->dict_operation_lock_mode = 0; trx->dict_operation_lock_mode = 0;
} }
#ifndef UNIV_HOTBACKUP
/************************************************************************* /*************************************************************************
Creates a table for MySQL. If the name of the table ends in Creates a table for MySQL. If the name of the table ends in
one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor", one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor",
...@@ -2110,12 +2099,11 @@ row_table_add_foreign_constraints( ...@@ -2110,12 +2099,11 @@ row_table_add_foreign_constraints(
err = dict_create_foreign_constraints(trx, sql_string, name, err = dict_create_foreign_constraints(trx, sql_string, name,
reject_fks); reject_fks);
#ifndef UNIV_HOTBACKUP
if (err == DB_SUCCESS) { if (err == DB_SUCCESS) {
/* Check that also referencing constraints are ok */ /* Check that also referencing constraints are ok */
err = dict_load_foreigns(name, TRUE); err = dict_load_foreigns(name, TRUE);
} }
#endif /* !UNIV_HOTBACKUP */
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
/* We have special error handling here */ /* We have special error handling here */
...@@ -3375,9 +3363,7 @@ funct_exit: ...@@ -3375,9 +3363,7 @@ funct_exit:
trx->op_info = ""; trx->op_info = "";
#ifndef UNIV_HOTBACKUP
srv_wake_master_thread(); srv_wake_master_thread();
#endif /* !UNIV_HOTBACKUP */
return((int) err); return((int) err);
} }
...@@ -4198,7 +4184,6 @@ row_check_table_for_mysql( ...@@ -4198,7 +4184,6 @@ row_check_table_for_mysql(
return(ret); return(ret);
} }
#endif /* !UNIV_HOTBACKUP */
/************************************************************************* /*************************************************************************
Determines if a table is a magic monitor table. */ Determines if a table is a magic monitor table. */
......
...@@ -849,8 +849,6 @@ row_search_index_entry( ...@@ -849,8 +849,6 @@ row_search_index_entry(
return(ROW_FOUND); return(ROW_FOUND);
} }
#ifndef UNIV_HOTBACKUP
#include <my_sys.h> #include <my_sys.h>
/*********************************************************************** /***********************************************************************
...@@ -1045,8 +1043,6 @@ row_raw_format( ...@@ -1045,8 +1043,6 @@ row_raw_format(
return(ret); return(ret);
} }
#endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_COMPILE_TEST_FUNCS #ifdef UNIV_COMPILE_TEST_FUNCS
#include "ut0dbg.h" #include "ut0dbg.h"
......
...@@ -3343,6 +3343,11 @@ row_search_for_mysql( ...@@ -3343,6 +3343,11 @@ row_search_for_mysql(
return(DB_ERROR); return(DB_ERROR);
} }
if (UNIV_UNLIKELY(!prebuilt->index_usable)) {
return(DB_MISSING_HISTORY);
}
if (UNIV_UNLIKELY(prebuilt->magic_n != ROW_PREBUILT_ALLOCATED)) { if (UNIV_UNLIKELY(prebuilt->magic_n != ROW_PREBUILT_ALLOCATED)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to free a corrupt\n" "InnoDB: Error: trying to free a corrupt\n"
......
...@@ -347,7 +347,7 @@ UNIV_INTERN ulong srv_replication_delay = 0; ...@@ -347,7 +347,7 @@ UNIV_INTERN ulong srv_replication_delay = 0;
UNIV_INTERN ulong srv_n_spin_wait_rounds = 20; UNIV_INTERN ulong srv_n_spin_wait_rounds = 20;
UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
UNIV_INTERN ulong srv_thread_sleep_delay = 10000; UNIV_INTERN ulong srv_thread_sleep_delay = 10000;
UNIV_INTERN ulint srv_spin_wait_delay = 5; UNIV_INTERN ulong srv_spin_wait_delay = 5;
UNIV_INTERN ibool srv_priority_boost = TRUE; UNIV_INTERN ibool srv_priority_boost = TRUE;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
...@@ -362,12 +362,11 @@ UNIV_INTERN ulint srv_n_rows_inserted = 0; ...@@ -362,12 +362,11 @@ UNIV_INTERN ulint srv_n_rows_inserted = 0;
UNIV_INTERN ulint srv_n_rows_updated = 0; UNIV_INTERN ulint srv_n_rows_updated = 0;
UNIV_INTERN ulint srv_n_rows_deleted = 0; UNIV_INTERN ulint srv_n_rows_deleted = 0;
UNIV_INTERN ulint srv_n_rows_read = 0; UNIV_INTERN ulint srv_n_rows_read = 0;
#ifndef UNIV_HOTBACKUP
static ulint srv_n_rows_inserted_old = 0; static ulint srv_n_rows_inserted_old = 0;
static ulint srv_n_rows_updated_old = 0; static ulint srv_n_rows_updated_old = 0;
static ulint srv_n_rows_deleted_old = 0; static ulint srv_n_rows_deleted_old = 0;
static ulint srv_n_rows_read_old = 0; static ulint srv_n_rows_read_old = 0;
#endif /* !UNIV_HOTBACKUP */
UNIV_INTERN ulint srv_n_lock_wait_count = 0; UNIV_INTERN ulint srv_n_lock_wait_count = 0;
UNIV_INTERN ulint srv_n_lock_wait_current_count = 0; UNIV_INTERN ulint srv_n_lock_wait_current_count = 0;
...@@ -666,7 +665,6 @@ srv_table_get_nth_slot( ...@@ -666,7 +665,6 @@ srv_table_get_nth_slot(
return(srv_sys->threads + index); return(srv_sys->threads + index);
} }
#ifndef UNIV_HOTBACKUP
/************************************************************************* /*************************************************************************
Gets the number of threads in the system. */ Gets the number of threads in the system. */
UNIV_INTERN UNIV_INTERN
...@@ -772,7 +770,6 @@ srv_suspend_thread(void) ...@@ -772,7 +770,6 @@ srv_suspend_thread(void)
return(event); return(event);
} }
#endif /* !UNIV_HOTBACKUP */
/************************************************************************* /*************************************************************************
Releases threads of the type given from suspension in the thread table. Releases threads of the type given from suspension in the thread table.
...@@ -1292,7 +1289,6 @@ srv_boot(void) ...@@ -1292,7 +1289,6 @@ srv_boot(void)
return(DB_SUCCESS); return(DB_SUCCESS);
} }
#ifndef UNIV_HOTBACKUP
/************************************************************************* /*************************************************************************
Reserves a slot in the thread table for the current MySQL OS thread. Reserves a slot in the thread table for the current MySQL OS thread.
NOTE! The kernel mutex has to be reserved by the caller! */ NOTE! The kernel mutex has to be reserved by the caller! */
...@@ -1357,7 +1353,6 @@ srv_table_reserve_slot_for_mysql(void) ...@@ -1357,7 +1353,6 @@ srv_table_reserve_slot_for_mysql(void)
return(slot); return(slot);
} }
#endif /* !UNIV_HOTBACKUP */
/******************************************************************* /*******************************************************************
Puts a MySQL OS thread to wait for a lock to be released. If an error Puts a MySQL OS thread to wait for a lock to be released. If an error
...@@ -1372,7 +1367,6 @@ srv_suspend_mysql_thread( ...@@ -1372,7 +1367,6 @@ srv_suspend_mysql_thread(
que_thr_t* thr) /* in: query thread associated with the MySQL que_thr_t* thr) /* in: query thread associated with the MySQL
OS thread */ OS thread */
{ {
#ifndef UNIV_HOTBACKUP
srv_slot_t* slot; srv_slot_t* slot;
os_event_t event; os_event_t event;
double wait_time; double wait_time;
...@@ -1537,12 +1531,6 @@ srv_suspend_mysql_thread( ...@@ -1537,12 +1531,6 @@ srv_suspend_mysql_thread(
trx->error_state = DB_LOCK_WAIT_TIMEOUT; trx->error_state = DB_LOCK_WAIT_TIMEOUT;
} }
#else /* UNIV_HOTBACKUP */
/* This function depends on MySQL code that is not included in
InnoDB Hot Backup builds. Besides, this function should never
be called in InnoDB Hot Backup. */
ut_error;
#endif /* UNIV_HOTBACKUP */
} }
/************************************************************************ /************************************************************************
...@@ -1555,7 +1543,6 @@ srv_release_mysql_thread_if_suspended( ...@@ -1555,7 +1543,6 @@ srv_release_mysql_thread_if_suspended(
que_thr_t* thr) /* in: query thread associated with the que_thr_t* thr) /* in: query thread associated with the
MySQL OS thread */ MySQL OS thread */
{ {
#ifndef UNIV_HOTBACKUP
srv_slot_t* slot; srv_slot_t* slot;
ulint i; ulint i;
...@@ -1575,15 +1562,8 @@ srv_release_mysql_thread_if_suspended( ...@@ -1575,15 +1562,8 @@ srv_release_mysql_thread_if_suspended(
} }
/* not found */ /* not found */
#else /* UNIV_HOTBACKUP */
/* This function depends on MySQL code that is not included in
InnoDB Hot Backup builds. Besides, this function should never
be called in InnoDB Hot Backup. */
ut_error;
#endif /* UNIV_HOTBACKUP */
} }
#ifndef UNIV_HOTBACKUP
/********************************************************************** /**********************************************************************
Refreshes the values used to calculate per-second averages. */ Refreshes the values used to calculate per-second averages. */
static static
...@@ -2640,4 +2620,3 @@ suspend_thread: ...@@ -2640,4 +2620,3 @@ suspend_thread:
OS_THREAD_DUMMY_RETURN; /* Not reached, avoid compiler warning */ OS_THREAD_DUMMY_RETURN; /* Not reached, avoid compiler warning */
} }
#endif /* !UNIV_HOTBACKUP */
...@@ -238,11 +238,8 @@ rw_lock_create_func( ...@@ -238,11 +238,8 @@ rw_lock_create_func(
lock->mutex.cfile_name = cfile_name; lock->mutex.cfile_name = cfile_name;
lock->mutex.cline = cline; lock->mutex.cline = cline;
# if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP ut_d(lock->mutex.cmutex_name = cmutex_name);
lock->mutex.cmutex_name = cmutex_name; ut_d(lock->mutex.mutex_type = 1);
lock->mutex.mutex_type = 1;
# endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
#else /* INNODB_RW_LOCKS_USE_ATOMICS */ #else /* INNODB_RW_LOCKS_USE_ATOMICS */
# ifdef UNIV_DEBUG # ifdef UNIV_DEBUG
UT_NOT_USED(cmutex_name); UT_NOT_USED(cmutex_name);
...@@ -953,7 +950,12 @@ rw_lock_print( ...@@ -953,7 +950,12 @@ rw_lock_print(
"RW-LATCH: %p ", (void*) lock); "RW-LATCH: %p ", (void*) lock);
#ifndef INNODB_RW_LOCKS_USE_ATOMICS #ifndef INNODB_RW_LOCKS_USE_ATOMICS
mutex_enter(&(lock->mutex)); /* We used to acquire lock->mutex here, but it would cause a
recursive call to sync_thread_add_level() if UNIV_SYNC_DEBUG
is defined. Since this function is only invoked from
sync_thread_levels_g(), let us choose the smaller evil:
performing dirty reads instead of causing bogus deadlocks or
assertion failures. */
#endif #endif
if (lock->lock_word != X_LOCK_DECR) { if (lock->lock_word != X_LOCK_DECR) {
...@@ -969,9 +971,6 @@ rw_lock_print( ...@@ -969,9 +971,6 @@ rw_lock_print(
info = UT_LIST_GET_NEXT(list, info); info = UT_LIST_GET_NEXT(list, info);
} }
} }
#ifndef INNODB_RW_LOCKS_USE_ATOMICS
mutex_exit(&(lock->mutex));
#endif
} }
/************************************************************************* /*************************************************************************
......
...@@ -255,9 +255,8 @@ mutex_create_func( ...@@ -255,9 +255,8 @@ mutex_create_func(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
mutex->cfile_name = cfile_name; mutex->cfile_name = cfile_name;
mutex->cline = cline; mutex->cline = cline;
#ifndef UNIV_HOTBACKUP
mutex->count_os_wait = 0; mutex->count_os_wait = 0;
# ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
mutex->cmutex_name= cmutex_name; mutex->cmutex_name= cmutex_name;
mutex->count_using= 0; mutex->count_using= 0;
mutex->mutex_type= 0; mutex->mutex_type= 0;
...@@ -266,8 +265,7 @@ mutex_create_func( ...@@ -266,8 +265,7 @@ mutex_create_func(
mutex->count_spin_loop= 0; mutex->count_spin_loop= 0;
mutex->count_spin_rounds= 0; mutex->count_spin_rounds= 0;
mutex->count_os_yield= 0; mutex->count_os_yield= 0;
# endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */
/* Check that lock_word is aligned; this is important on Intel */ /* Check that lock_word is aligned; this is important on Intel */
ut_ad(((ulint)(&(mutex->lock_word))) % 4 == 0); ut_ad(((ulint)(&(mutex->lock_word))) % 4 == 0);
...@@ -439,13 +437,13 @@ mutex_spin_wait( ...@@ -439,13 +437,13 @@ mutex_spin_wait(
{ {
ulint index; /* index of the reserved wait cell */ ulint index; /* index of the reserved wait cell */
ulint i; /* spin round count */ ulint i; /* spin round count */
#if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP #ifdef UNIV_DEBUG
ib_int64_t lstart_time = 0, lfinish_time; /* for timing os_wait */ ib_int64_t lstart_time = 0, lfinish_time; /* for timing os_wait */
ulint ltime_diff; ulint ltime_diff;
ulint sec; ulint sec;
ulint ms; ulint ms;
uint timer_started = 0; uint timer_started = 0;
#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG */
ut_ad(mutex); ut_ad(mutex);
/* This update is not thread safe, but we don't mind if the count /* This update is not thread safe, but we don't mind if the count
...@@ -465,9 +463,7 @@ mutex_loop: ...@@ -465,9 +463,7 @@ mutex_loop:
a memory word. */ a memory word. */
spin_loop: spin_loop:
#if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP ut_d(mutex->count_spin_loop++);
mutex->count_spin_loop++;
#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
while (mutex_get_lock_word(mutex) != 0 && i < SYNC_SPIN_ROUNDS) { while (mutex_get_lock_word(mutex) != 0 && i < SYNC_SPIN_ROUNDS) {
if (srv_spin_wait_delay) { if (srv_spin_wait_delay) {
...@@ -478,14 +474,14 @@ spin_loop: ...@@ -478,14 +474,14 @@ spin_loop:
} }
if (i == SYNC_SPIN_ROUNDS) { if (i == SYNC_SPIN_ROUNDS) {
#if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP #ifdef UNIV_DEBUG
mutex->count_os_yield++; mutex->count_os_yield++;
if (timed_mutexes == 1 && timer_started==0) { if (timed_mutexes == 1 && timer_started==0) {
ut_usectime(&sec, &ms); ut_usectime(&sec, &ms);
lstart_time= (ib_int64_t)sec * 1000000 + ms; lstart_time= (ib_int64_t)sec * 1000000 + ms;
timer_started = 1; timer_started = 1;
} }
#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG */
os_thread_yield(); os_thread_yield();
} }
...@@ -499,9 +495,7 @@ spin_loop: ...@@ -499,9 +495,7 @@ spin_loop:
mutex_spin_round_count += i; mutex_spin_round_count += i;
#if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP ut_d(mutex->count_spin_rounds += i);
mutex->count_spin_rounds += i;
#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
if (mutex_test_and_set(mutex) == 0) { if (mutex_test_and_set(mutex) == 0) {
/* Succeeded! */ /* Succeeded! */
...@@ -578,9 +572,8 @@ spin_loop: ...@@ -578,9 +572,8 @@ spin_loop:
mutex_os_wait_count++; mutex_os_wait_count++;
#ifndef UNIV_HOTBACKUP
mutex->count_os_wait++; mutex->count_os_wait++;
# ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/* !!!!! Sometimes os_wait can be called without os_thread_yield */ /* !!!!! Sometimes os_wait can be called without os_thread_yield */
if (timed_mutexes == 1 && timer_started==0) { if (timed_mutexes == 1 && timer_started==0) {
...@@ -588,14 +581,13 @@ spin_loop: ...@@ -588,14 +581,13 @@ spin_loop:
lstart_time= (ib_int64_t)sec * 1000000 + ms; lstart_time= (ib_int64_t)sec * 1000000 + ms;
timer_started = 1; timer_started = 1;
} }
# endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */
sync_array_wait_event(sync_primary_wait_array, index); sync_array_wait_event(sync_primary_wait_array, index);
goto mutex_loop; goto mutex_loop;
finish_timing: finish_timing:
#if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP #ifdef UNIV_DEBUG
if (timed_mutexes == 1 && timer_started==1) { if (timed_mutexes == 1 && timer_started==1) {
ut_usectime(&sec, &ms); ut_usectime(&sec, &ms);
lfinish_time= (ib_int64_t)sec * 1000000 + ms; lfinish_time= (ib_int64_t)sec * 1000000 + ms;
...@@ -607,7 +599,7 @@ finish_timing: ...@@ -607,7 +599,7 @@ finish_timing:
mutex->lmax_spent_time= ltime_diff; mutex->lmax_spent_time= ltime_diff;
} }
} }
#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG */
return; return;
} }
......
...@@ -68,7 +68,6 @@ trx_general_rollback_for_mysql( ...@@ -68,7 +68,6 @@ trx_general_rollback_for_mysql(
trx_savept_t* savept) /* in: pointer to savepoint undo number, if trx_savept_t* savept) /* in: pointer to savepoint undo number, if
partial rollback requested */ partial rollback requested */
{ {
#ifndef UNIV_HOTBACKUP
mem_heap_t* heap; mem_heap_t* heap;
que_thr_t* thr; que_thr_t* thr;
roll_node_t* roll_node; roll_node_t* roll_node;
...@@ -120,13 +119,6 @@ trx_general_rollback_for_mysql( ...@@ -120,13 +119,6 @@ trx_general_rollback_for_mysql(
srv_active_wake_master_thread(); srv_active_wake_master_thread();
return((int) trx->error_state); return((int) trx->error_state);
#else /* UNIV_HOTBACKUP */
/* This function depends on MySQL code that is not included in
InnoDB Hot Backup builds. Besides, this function should never
be called in InnoDB Hot Backup. */
ut_error;
return(DB_FAIL);
#endif /* UNIV_HOTBACKUP */
} }
/*********************************************************************** /***********************************************************************
......
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