Commit ed4dbd12 authored by unknown's avatar unknown

InnoDB: Exclude code from InnoDB Hot Backup builds

by adding #ifndef UNIV_HOTBACKUP and adjusting some function
declarations.


innobase/data/data0type.c:
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/dict/dict0dict.c:
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/dict/dict0load.c:
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/include/data0type.ic:
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/include/srv0srv.h:
  Introduce srv_init(), so that it can be called in InnoDB Hot Backup
innobase/include/srv0start.h:
  Introduce srv_add_path_separator_if_needed(), so that it can be
  invoked in InnoDB Hot Backup
innobase/include/sync0sync.h:
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/include/sync0sync.ic:
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/include/trx0trx.h:
  trx_recover_for_mysql(): replace uint with ulint, as uint is not
  declared in InnoDB Hot Backup
innobase/lock/lock0lock.c:
  Replace bool with ibool
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/row/row0ins.c:
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/row/row0mysql.c:
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/srv/srv0srv.c:
  Make srv_init() global, so that InnoDB Hot Backup can call it.
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/srv/srv0start.c:
  Make srv_add_path_separator_if_needed() global for InnoDB Hot Backup.
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/sync/sync0rw.c:
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/sync/sync0sync.c:
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/trx/trx0roll.c:
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
innobase/trx/trx0trx.c:
  Replace uint with ulint, as uint is undeclared in InnoDB Hot Backup
innobase/ut/ut0ut.c:
  Exclude code from InnoDB Hot Backup with #ifndef UNIV_HOTBACKUP
parent aee7a9d7
......@@ -81,6 +81,7 @@ dtype_get_at_most_n_mbchars(
ulint data_len,
const char* str)
{
#ifndef UNIV_HOTBACKUP
ut_a(data_len != UNIV_SQL_NULL);
if (dtype_str_needs_mysql_cmp(dtype)) {
......@@ -99,6 +100,12 @@ dtype_get_at_most_n_mbchars(
}
return(data_len);
#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 */
}
/*************************************************************************
......
......@@ -53,6 +53,7 @@ rw_lock_t dict_operation_lock; /* table create, drop, etc. reserve
/* Identifies generated InnoDB foreign key names */
static char dict_ibfk[] = "_ibfk_";
#ifndef UNIV_HOTBACKUP
/**********************************************************************
Compares NUL-terminated UTF-8 strings case insensitively.
......@@ -76,6 +77,7 @@ void
innobase_casedn_str(
/*================*/
char* a); /* in/out: string to put in lower case */
#endif /* !UNIV_HOTBACKUP */
/**************************************************************************
Adds a column to the data dictionary hash table. */
......@@ -2095,6 +2097,7 @@ dict_foreign_find_index(
dict_index_t* types_idx)/* in: NULL or an index to whose types the
column types must match */
{
#ifndef UNIV_HOTBACKUP
dict_index_t* index;
const char* col_name;
ulint i;
......@@ -2139,6 +2142,12 @@ dict_foreign_find_index(
}
return(NULL);
#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 */
}
/**************************************************************************
......@@ -2492,6 +2501,7 @@ dict_scan_col(
const char** name) /* out,own: the column name; NULL if no name
was scannable */
{
#ifndef UNIV_HOTBACKUP
dict_col_t* col;
ulint i;
......@@ -2525,6 +2535,12 @@ dict_scan_col(
}
return(ptr);
#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 */
}
/*************************************************************************
......@@ -2542,6 +2558,7 @@ dict_scan_table_name(
const char** ref_name)/* out,own: the table name;
NULL if no name was scannable */
{
#ifndef UNIV_HOTBACKUP
const char* database_name = NULL;
ulint database_name_len = 0;
const char* table_name = NULL;
......@@ -2623,6 +2640,12 @@ dict_scan_table_name(
*table = dict_table_get_low(ref);
return(ptr);
#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 */
}
/*************************************************************************
......
......@@ -8,7 +8,9 @@ Created 4/24/1996 Heikki Tuuri
*******************************************************/
#include "dict0load.h"
#ifndef UNIV_HOTBACKUP
#include "mysql_version.h"
#endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_NONINL
#include "dict0load.ic"
......@@ -792,6 +794,7 @@ dict_load_table(
name, (ulong)mix_len);
}
#ifndef UNIV_HOTBACKUP
#if MYSQL_VERSION_ID < 50003
/* Starting from MySQL 5.0.3, the high-order bit of MIX_LEN is the
"compact format" flag. */
......@@ -807,6 +810,7 @@ dict_load_table(
return(NULL);
}
#endif /* MYSQL_VERSION_ID < 50300 */
#endif /* !UNIV_HOTBACKUP */
ut_a(0 == ut_strcmp("SPACE",
dict_field_get_col(
......
......@@ -273,6 +273,7 @@ dtype_get_fixed_size(
/* out: fixed size, or 0 */
dtype_t* type) /* in: type */
{
#ifndef UNIV_HOTBACKUP
ulint mtype;
mtype = dtype_get_mtype(type);
......@@ -321,6 +322,12 @@ dtype_get_fixed_size(
}
return(0);
#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 */
}
/***************************************************************************
......
......@@ -294,6 +294,12 @@ srv_boot(void);
/*==========*/
/* out: DB_SUCCESS or error code */
/*************************************************************************
Initializes the server. */
void
srv_init(void);
/*==========*/
/*************************************************************************
Frees the OS fast mutex created in srv_boot(). */
void
......
......@@ -53,6 +53,16 @@ srv_parse_log_group_home_dirs(
error */
char* str, /* in: character string */
char*** log_group_home_dirs); /* out, own: log group home dirs */
/*************************************************************************
Adds a slash or a backslash to the end of a string if it is missing
and the string is not empty. */
char*
srv_add_path_separator_if_needed(
/*=============================*/
/* out: string which has the separator if the
string is not empty */
char* str); /* in: null-terminated character string */
/********************************************************************
Starts Innobase and creates a new database if database files
are not found and the user wants. Server parameters are
......
......@@ -17,7 +17,9 @@ Created 9/5/1995 Heikki Tuuri
#include "os0sync.h"
#include "sync0arr.h"
#ifndef UNIV_HOTBACKUP
extern my_bool timed_mutexes;
#endif /* UNIV_HOTBACKUP */
/**********************************************************************
Initializes the synchronization data structures. */
......@@ -475,6 +477,7 @@ struct mutex_struct {
const char* cfile_name;/* File name where mutex created */
ulint cline; /* Line where created */
ulint magic_n;
#ifndef UNIV_HOTBACKUP
ulong count_using; /* count of times mutex used */
ulong count_spin_loop; /* count of spin loops */
ulong count_spin_rounds; /* count of spin rounds */
......@@ -484,6 +487,7 @@ struct mutex_struct {
ulonglong lmax_spent_time; /* mutex os_wait timer msec */
const char* cmutex_name;/* mutex name */
ulint mutex_type;/* 0 - usual mutex 1 - rw_lock mutex */
#endif /* !UNIV_HOTBACKUP */
};
#define MUTEX_MAGIC_N (ulint)979585
......
......@@ -250,7 +250,9 @@ mutex_enter_func(
/* 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. */
#ifndef UNIV_HOTBACKUP
mutex->count_using++;
#endif /* UNIV_HOTBACKUP */
if (!mutex_test_and_set(mutex))
{
......
......@@ -173,10 +173,10 @@ their transaction objects for a recovery. */
int
trx_recover_for_mysql(
/*=================*/
/*==================*/
/* out: number of prepared transactions */
XID* xid_list, /* in/out: prepared transactions */
uint len); /* in: number of slots in xid_list */
ulint len); /* in: number of slots in xid_list */
/***********************************************************************
This function is used to commit one X/Open XA distributed transaction
......
......@@ -694,7 +694,7 @@ lock_is_table_exclusive(
trx_t* trx) /* in: transaction */
{
lock_t* lock;
bool ok = FALSE;
ibool ok = FALSE;
ut_ad(table && trx);
......@@ -4219,7 +4219,8 @@ lock_get_n_rec_locks(void)
return(n_locks);
}
#ifndef UNIV_HOTBACKUP
/*************************************************************************
Prints info of locks for all transactions. */
......@@ -4743,7 +4744,7 @@ lock_validate(void)
return(TRUE);
}
#endif /* !UNIV_HOTBACKUP */
/*============ RECORD LOCK CHECKS FOR ROW OPERATIONS ====================*/
/*************************************************************************
......
......@@ -1546,6 +1546,7 @@ row_ins_scan_sec_index_for_duplicate(
dtuple_t* entry, /* in: index entry */
que_thr_t* thr) /* in: query thread */
{
#ifndef UNIV_HOTBACKUP
ulint n_unique;
ulint i;
int cmp;
......@@ -1662,6 +1663,12 @@ row_ins_scan_sec_index_for_duplicate(
dtuple_set_n_fields_cmp(entry, n_fields_cmp);
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;
#endif /* UNIV_HOTBACKUP */
}
/*******************************************************************
......@@ -1681,6 +1688,7 @@ row_ins_duplicate_error_in_clust(
que_thr_t* thr, /* in: query thread */
mtr_t* mtr) /* in: mtr */
{
#ifndef UNIV_HOTBACKUP
ulint err;
rec_t* rec;
page_t* page;
......@@ -1801,6 +1809,12 @@ row_ins_duplicate_error_in_clust(
err = DB_SUCCESS;
func_exit:
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;
#endif /* UNIV_HOTBACKUP */
}
/*******************************************************************
......
......@@ -260,6 +260,7 @@ row_mysql_handle_errors(
que_thr_t* thr, /* in: query thread */
trx_savept_t* savept) /* in: savepoint or NULL */
{
#ifndef UNIV_HOTBACKUP
ulint err;
handle_new_error:
......@@ -359,6 +360,12 @@ row_mysql_handle_errors(
trx->error_state = DB_SUCCESS;
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;
#endif /* UNIV_HOTBACKUP */
}
/************************************************************************
......@@ -2072,6 +2079,7 @@ row_add_table_to_background_drop_list(
return(TRUE);
}
#ifndef UNIV_HOTBACKUP
/*************************************************************************
Discards the tablespace of a table which stored in an .ibd file. Discarding
means that this function deletes the .ibd file and assigns a new table id for
......@@ -2692,6 +2700,7 @@ fputs(" InnoDB: Unable to assign a new identifier to table ", stderr);
return((int) err);
}
#endif /* !UNIV_HOTBACKUP */
/*************************************************************************
Drops a table for MySQL. If the name of the table to be dropped is equal
......@@ -3088,7 +3097,9 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
trx->op_info = "";
#ifndef UNIV_HOTBACKUP
srv_wake_master_thread();
#endif /* !UNIV_HOTBACKUP */
return((int) err);
}
......
......@@ -848,7 +848,7 @@ srv_get_thread_type(void)
/*************************************************************************
Initializes the server. */
static
void
srv_init(void)
/*==========*/
......@@ -1310,6 +1310,7 @@ srv_boot(void)
return(DB_SUCCESS);
}
#ifndef UNIV_HOTBACKUP
/*************************************************************************
Reserves a slot in the thread table for the current MySQL OS thread.
NOTE! The kernel mutex has to be reserved by the caller! */
......@@ -1368,6 +1369,7 @@ srv_table_reserve_slot_for_mysql(void)
return(slot);
}
#endif /* !UNIV_HOTBACKUP */
/*******************************************************************
Puts a MySQL OS thread to wait for a lock to be released. If an error
......@@ -1382,6 +1384,7 @@ srv_suspend_mysql_thread(
que_thr_t* thr) /* in: query thread associated with the MySQL
OS thread */
{
#ifndef UNIV_HOTBACKUP
srv_slot_t* slot;
os_event_t event;
double wait_time;
......@@ -1520,6 +1523,12 @@ srv_suspend_mysql_thread(
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 */
}
/************************************************************************
......@@ -1532,6 +1541,7 @@ srv_release_mysql_thread_if_suspended(
que_thr_t* thr) /* in: query thread associated with the
MySQL OS thread */
{
#ifndef UNIV_HOTBACKUP
srv_slot_t* slot;
ulint i;
......@@ -1553,8 +1563,15 @@ srv_release_mysql_thread_if_suspended(
}
/* 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. */
static
......@@ -2576,3 +2593,4 @@ srv_master_thread(
return(0);
#endif
}
#endif /* !UNIV_HOTBACKUP */
......@@ -479,7 +479,6 @@ srv_normalize_path_for_win(
Adds a slash or a backslash to the end of a string if it is missing
and the string is not empty. */
static
char*
srv_add_path_separator_if_needed(
/*=============================*/
......@@ -531,6 +530,7 @@ srv_calc_high32(
return(file_size >> (32 - UNIV_PAGE_SIZE_SHIFT));
}
#ifndef UNIV_HOTBACKUP
/*************************************************************************
Creates or opens the log files and closes them. */
static
......@@ -1834,4 +1834,5 @@ void set_panic_flag_for_netware()
extern ibool panic_shutdown;
panic_shutdown = TRUE;
}
#endif
#endif /* __NETWARE__ */
#endif /* !UNIV_HOTBACKUP */
......@@ -102,8 +102,10 @@ rw_lock_create_func(
lock->mutex.cfile_name = cfile_name;
lock->mutex.cline = cline;
#ifndef UNIV_HOTBACKUP
lock->mutex.cmutex_name = cmutex_name;
lock->mutex.mutex_type = 1;
#endif /* !UNIV_HOTBACKUP */
rw_lock_set_waiters(lock, 0);
rw_lock_set_writer(lock, RW_LOCK_NOT_LOCKED);
......
......@@ -215,6 +215,7 @@ mutex_create_func(
mutex->level = SYNC_LEVEL_NONE;
mutex->cfile_name = cfile_name;
mutex->cline = cline;
#ifndef UNIV_HOTBACKUP
mutex->cmutex_name= cmutex_name;
mutex->count_using= 0;
mutex->mutex_type= 0;
......@@ -224,7 +225,7 @@ mutex_create_func(
mutex->count_spin_rounds= 0;
mutex->count_os_wait= 0;
mutex->count_os_yield= 0;
#endif /* !UNIV_HOTBACKUP */
/* Check that lock_word is aligned; this is important on Intel */
ut_ad(((ulint)(&(mutex->lock_word))) % 4 == 0);
......@@ -372,9 +373,9 @@ mutex_spin_wait(
ulint ltime_diff;
ulint sec;
ulint ms;
#ifndef UNIV_HOTBACKUP
uint timer_started = 0;
#endif /* !UNIV_HOTBACKUP */
ut_ad(mutex);
mutex_loop:
......@@ -388,8 +389,10 @@ mutex_spin_wait(
memory word. */
spin_loop:
#ifndef UNIV_HOTBACKUP
mutex_spin_wait_count++;
mutex->count_spin_loop++;
#endif /* !UNIV_HOTBACKUP */
while (mutex_get_lock_word(mutex) != 0 && i < SYNC_SPIN_ROUNDS)
{
......@@ -403,6 +406,7 @@ mutex_spin_wait(
if (i == SYNC_SPIN_ROUNDS)
{
#ifndef UNIV_HOTBACKUP
mutex->count_os_yield++;
if (timed_mutexes == 1 && timer_started==0)
{
......@@ -410,6 +414,7 @@ mutex_spin_wait(
lstart_time= (ib_longlong)sec * 1000000 + ms;
timer_started = 1;
}
#endif /* !UNIV_HOTBACKUP */
os_thread_yield();
}
......@@ -422,7 +427,9 @@ mutex_spin_wait(
mutex_spin_round_count += i;
#ifndef UNIV_HOTBACKUP
mutex->count_spin_rounds += i;
#endif /* !UNIV_HOTBACKUP */
if (mutex_test_and_set(mutex) == 0)
{
......@@ -504,8 +511,8 @@ Now there is no risk of infinite wait on the event. */
mutex_system_call_count++;
mutex_os_wait_count++;
#ifndef UNIV_HOTBACKUP
mutex->count_os_wait++;
/*
!!!!! Sometimes os_wait can be called without os_thread_yield
*/
......@@ -516,12 +523,13 @@ Now there is no risk of infinite wait on the event. */
lstart_time= (ib_longlong)sec * 1000000 + ms;
timer_started = 1;
}
#endif /* !UNIV_HOTBACKUP */
sync_array_wait_event(sync_primary_wait_array, index);
goto mutex_loop;
finish_timing:
#ifndef UNIV_HOTBACKUP
if (timed_mutexes == 1 && timer_started==1)
{
ut_usectime(&sec, &ms);
......@@ -534,6 +542,7 @@ Now there is no risk of infinite wait on the event. */
mutex->lmax_spent_time= ltime_diff;
}
}
#endif /* !UNIV_HOTBACKUP */
return;
}
......
......@@ -52,6 +52,7 @@ trx_general_rollback_for_mysql(
trx_savept_t* savept) /* in: pointer to savepoint undo number, if
partial rollback requested */
{
#ifndef UNIV_HOTBACKUP
mem_heap_t* heap;
que_thr_t* thr;
roll_node_t* roll_node;
......@@ -103,6 +104,12 @@ trx_general_rollback_for_mysql(
srv_active_wake_master_thread();
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;
#endif /* UNIV_HOTBACKUP */
}
/***********************************************************************
......@@ -322,7 +329,7 @@ were set after this savepoint are deleted. */
ulint
trx_release_savepoint_for_mysql(
/*================================*/
/*============================*/
/* out: if no savepoint
of the name found then
DB_NO_SAVEPOINT,
......
......@@ -1844,7 +1844,7 @@ trx_recover_for_mysql(
/* out: number of prepared transactions
stored in xid_list */
XID* xid_list, /* in/out: prepared transactions */
uint len) /* in: number of slots in xid_list */
ulint len) /* in: number of slots in xid_list */
{
trx_t* trx;
int num_of_transactions = 0;
......
......@@ -416,7 +416,11 @@ ut_print_namel(
{
const char* s = name;
const char* e = s + namelen;
#ifdef UNIV_HOTBACKUP
int q = '"';
#else
int q = mysql_get_identifier_quote_char(trx, name, namelen);
#endif
if (q == EOF) {
fwrite(name, 1, namelen, f);
return;
......
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