summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
Diffstat (limited to 'innobase')
-rw-r--r--innobase/buf/buf0rea.c4
-rw-r--r--innobase/data/data0type.c7
-rw-r--r--innobase/dict/dict0dict.c23
-rw-r--r--innobase/dict/dict0load.c4
-rw-r--r--innobase/fil/fil0fil.c4
-rw-r--r--innobase/include/data0type.ic7
-rw-r--r--innobase/include/rem0rec.ic10
-rw-r--r--innobase/include/srv0srv.h6
-rw-r--r--innobase/include/srv0start.h10
-rw-r--r--innobase/include/sync0sync.h4
-rw-r--r--innobase/include/sync0sync.ic2
-rw-r--r--innobase/include/trx0roll.h15
-rw-r--r--innobase/include/trx0trx.h4
-rw-r--r--innobase/include/univ.i4
-rw-r--r--innobase/lock/lock0lock.c7
-rw-r--r--innobase/os/os0file.c23
-rw-r--r--innobase/page/page0cur.c6
-rw-r--r--innobase/row/row0ins.c55
-rw-r--r--innobase/row/row0mysql.c47
-rw-r--r--innobase/srv/srv0srv.c20
-rw-r--r--innobase/srv/srv0start.c5
-rw-r--r--innobase/sync/sync0rw.c2
-rw-r--r--innobase/sync/sync0sync.c19
-rw-r--r--innobase/trx/trx0roll.c52
-rw-r--r--innobase/trx/trx0trx.c2
-rw-r--r--innobase/ut/ut0ut.c16
26 files changed, 275 insertions, 83 deletions
diff --git a/innobase/buf/buf0rea.c b/innobase/buf/buf0rea.c
index 1ce52c8ee31..d9dc2ca93f5 100644
--- a/innobase/buf/buf0rea.c
+++ b/innobase/buf/buf0rea.c
@@ -686,7 +686,9 @@ buf_read_recv_pages(
fprintf(stderr,
"InnoDB: Error: InnoDB has waited for 50 seconds for pending\n"
"InnoDB: reads to the buffer pool to be finished.\n"
-"InnoDB: Number of pending reads %lu\n", (ulong) buf_pool->n_pend_reads);
+"InnoDB: Number of pending reads %lu, pending pread calls %lu\n",
+ (ulong) buf_pool->n_pend_reads,
+ (ulong)os_file_n_pending_preads);
os_aio_print_debug = TRUE;
}
diff --git a/innobase/data/data0type.c b/innobase/data/data0type.c
index 00048bf6fbb..b1297fe7a5b 100644
--- a/innobase/data/data0type.c
+++ b/innobase/data/data0type.c
@@ -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 */
}
/*************************************************************************
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index 800d7dcd9e9..6ec4809790e 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -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 */
}
/*************************************************************************
diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c
index 17b53a7a140..7fd1ca08c04 100644
--- a/innobase/dict/dict0load.c
+++ b/innobase/dict/dict0load.c
@@ -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(
diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c
index 9b2f7ffe575..8da6ad08538 100644
--- a/innobase/fil/fil0fil.c
+++ b/innobase/fil/fil0fil.c
@@ -3013,8 +3013,8 @@ fil_load_single_table_tablespaces(void)
/* printf(
" Looking at file %s\n", fileinfo.name); */
- if (fileinfo.type == OS_FILE_TYPE_DIR
- || dbinfo.type == OS_FILE_TYPE_UNKNOWN) {
+ if (fileinfo.type == OS_FILE_TYPE_DIR) {
+
goto next_file_item;
}
diff --git a/innobase/include/data0type.ic b/innobase/include/data0type.ic
index 0b92ffbe7f1..15833905761 100644
--- a/innobase/include/data0type.ic
+++ b/innobase/include/data0type.ic
@@ -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 */
}
/***************************************************************************
diff --git a/innobase/include/rem0rec.ic b/innobase/include/rem0rec.ic
index 366f1c3f77d..2593fb8edeb 100644
--- a/innobase/include/rem0rec.ic
+++ b/innobase/include/rem0rec.ic
@@ -279,7 +279,15 @@ rec_get_next_offs(
/* Note that for 64 KiB pages, field_value can 'wrap around'
and the debug assertion is not valid */
- ut_ad((int16_t)field_value
+ /* In the following assertion, field_value is interpreted
+ as signed 16-bit integer in 2's complement arithmetics.
+ If all platforms defined int16_t in the standard headers,
+ the expression could be written simpler as
+ (int16_t) field_value + ut_align_offset(...) < UNIV_PAGE_SIZE
+ */
+ ut_ad((field_value >= 32768
+ ? field_value - 65536
+ : field_value)
+ ut_align_offset(rec, UNIV_PAGE_SIZE)
< UNIV_PAGE_SIZE);
#endif
diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h
index c5374fd00fa..27cdaf2e505 100644
--- a/innobase/include/srv0srv.h
+++ b/innobase/include/srv0srv.h
@@ -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
diff --git a/innobase/include/srv0start.h b/innobase/include/srv0start.h
index 8df0f97c4ff..d24f119c0b0 100644
--- a/innobase/include/srv0start.h
+++ b/innobase/include/srv0start.h
@@ -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
diff --git a/innobase/include/sync0sync.h b/innobase/include/sync0sync.h
index 5046a960bcf..c798c047fa3 100644
--- a/innobase/include/sync0sync.h
+++ b/innobase/include/sync0sync.h
@@ -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
diff --git a/innobase/include/sync0sync.ic b/innobase/include/sync0sync.ic
index f26f3788dc3..b3fde61db5e 100644
--- a/innobase/include/sync0sync.ic
+++ b/innobase/include/sync0sync.ic
@@ -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))
{
diff --git a/innobase/include/trx0roll.h b/innobase/include/trx0roll.h
index 9d025da4a5f..944142a299d 100644
--- a/innobase/include/trx0roll.h
+++ b/innobase/include/trx0roll.h
@@ -225,6 +225,21 @@ trx_savepoint_for_mysql(
position corresponding to this
connection at the time of the
savepoint */
+
+/***********************************************************************
+Releases a named savepoint. Savepoints which
+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,
+ otherwise DB_SUCCESS */
+ trx_t* trx, /* in: transaction handle */
+ const char* savepoint_name); /* in: savepoint name */
+
/***********************************************************************
Frees savepoint structs. */
diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h
index b63afdd526c..8ac18241e32 100644
--- a/innobase/include/trx0trx.h
+++ b/innobase/include/trx0trx.h
@@ -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
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index 5d1e8e208cd..8158c198e21 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -80,10 +80,6 @@ memory is read outside the allocated blocks. */
/* Make a non-inline debug version */
-#ifdef DBUG_ON
-#define UNIV_DEBUG
-#endif /* DBUG_ON */
-
/*
#define UNIV_DEBUG
#define UNIV_MEM_DEBUG
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index 05466764063..a2560c1faae 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -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 ====================*/
/*************************************************************************
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index a2c5365993c..969f7aee859 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -711,12 +711,12 @@ http://www.mysql.com/doc/en/Windows_symbolic_links.html */
} else if (lpFindFileData->dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY) {
info->type = OS_FILE_TYPE_DIR;
- } else if (lpFindFileData->dwFileAttributes
- & FILE_ATTRIBUTE_NORMAL) {
-/* TODO: are FILE_ATTRIBUTE_NORMAL files really all normal files? */
- info->type = OS_FILE_TYPE_FILE;
} else {
- info->type = OS_FILE_TYPE_UNKNOWN;
+ /* It is probably safest to assume that all other
+ file types are normal. Better to check them rather
+ than blindly skip them. */
+
+ info->type = OS_FILE_TYPE_FILE;
}
}
@@ -834,7 +834,7 @@ os_file_create_directory(
rcode = CreateDirectory(pathname, NULL);
if (!(rcode != 0 ||
- (GetLastError() == ERROR_FILE_EXISTS && !fail_if_exists))) {
+ (GetLastError() == ERROR_ALREADY_EXISTS && !fail_if_exists))) {
/* failure */
os_file_handle_error(pathname, "CreateDirectory");
@@ -918,8 +918,9 @@ try_again:
file = CreateFile(name,
access,
- FILE_SHARE_READ,/* file can be read also by other
- processes */
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ /* file can be read ansd written also
+ by other processes */
NULL, /* default security attributes */
create_flag,
attributes,
@@ -1024,7 +1025,7 @@ os_file_create_simple_no_error_handling(
DWORD create_flag;
DWORD access;
DWORD attributes = 0;
- DWORD share_mode = FILE_SHARE_READ;
+ DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
ut_a(name);
@@ -1347,7 +1348,7 @@ loop:
return(TRUE);
}
- if (GetLastError() == ERROR_PATH_NOT_FOUND) {
+ if (GetLastError() == ERROR_FILE_NOT_FOUND) {
/* the file does not exist, this not an error */
return(TRUE);
@@ -1408,7 +1409,7 @@ loop:
return(TRUE);
}
- if (GetLastError() == ERROR_PATH_NOT_FOUND) {
+ if (GetLastError() == ERROR_FILE_NOT_FOUND) {
/* If the file does not exist, we classify this as a 'mild'
error and return */
diff --git a/innobase/page/page0cur.c b/innobase/page/page0cur.c
index fc94fc4b1e0..488d2757115 100644
--- a/innobase/page/page0cur.c
+++ b/innobase/page/page0cur.c
@@ -311,9 +311,6 @@ page_cur_search_with_match(
low_matched_bytes = cur_matched_bytes;
} else if (cmp == -1) {
- offsets = rec_get_offsets(mid_rec, index, offsets,
- dtuple_get_n_fields_cmp(tuple), &heap);
-
if (mode == PAGE_CUR_LE_OR_EXTENDS
&& page_cur_rec_field_extends(tuple, mid_rec,
offsets, cur_matched_fields)) {
@@ -366,9 +363,6 @@ page_cur_search_with_match(
low_matched_bytes = cur_matched_bytes;
} else if (cmp == -1) {
- offsets = rec_get_offsets(mid_rec, index, offsets,
- dtuple_get_n_fields_cmp(tuple), &heap);
-
if (mode == PAGE_CUR_LE_OR_EXTENDS
&& page_cur_rec_field_extends(tuple, mid_rec,
offsets, cur_matched_fields)) {
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c
index aab0f5affa7..87ed497ba1e 100644
--- a/innobase/row/row0ins.c
+++ b/innobase/row/row0ins.c
@@ -51,14 +51,19 @@ innobase_invalidate_query_cache(
chars count */
/**********************************************************************
-This function returns true if SQL-query in the current thread
+This function returns true if
+
+1) SQL-query in the current thread
is either REPLACE or LOAD DATA INFILE REPLACE.
+
+2) SQL-query in the current thread
+is INSERT ON DUPLICATE KEY UPDATE.
+
NOTE that /mysql/innobase/row/row0ins.c must contain the
prototype for this function ! */
ibool
-innobase_query_is_replace(void);
-/*===========================*/
+innobase_query_is_update(void);
/*************************************************************************
Creates an insert node struct. */
@@ -1541,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;
@@ -1597,12 +1603,12 @@ row_ins_scan_sec_index_for_duplicate(
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
- if (innobase_query_is_replace()) {
+ if (innobase_query_is_update()) {
- /* The manual defines the REPLACE semantics that it
- is either an INSERT or DELETE(s) for duplicate key
- + INSERT. Therefore, we should take X-lock for
- duplicates */
+ /* If the SQL-query will update or replace
+ duplicate key we will take X-lock for
+ duplicates ( REPLACE, LOAD DATAFILE REPLACE,
+ INSERT ON DUPLICATE KEY UPDATE). */
err = row_ins_set_exclusive_rec_lock(LOCK_ORDINARY,
rec, index, offsets, thr);
@@ -1657,6 +1663,12 @@ next_rec:
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 */
}
/*******************************************************************
@@ -1676,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;
@@ -1720,12 +1733,12 @@ row_ins_duplicate_error_in_clust(
sure that in roll-forward we get the same duplicate
errors as in original execution */
- if (innobase_query_is_replace()) {
+ if (innobase_query_is_update()) {
- /* The manual defines the REPLACE semantics
- that it is either an INSERT or DELETE(s)
- for duplicate key + INSERT. Therefore, we
- should take X-lock for duplicates */
+ /* If the SQL-query will update or replace
+ duplicate key we will take X-lock for
+ duplicates ( REPLACE, LOAD DATAFILE REPLACE,
+ INSERT ON DUPLICATE KEY UPDATE). */
err = row_ins_set_exclusive_rec_lock(
LOCK_REC_NOT_GAP,rec,cursor->index,
@@ -1759,12 +1772,12 @@ row_ins_duplicate_error_in_clust(
offsets = rec_get_offsets(rec, cursor->index, offsets,
ULINT_UNDEFINED, &heap);
- /* The manual defines the REPLACE semantics that it
- is either an INSERT or DELETE(s) for duplicate key
- + INSERT. Therefore, we should take X-lock for
- duplicates. */
+ if (innobase_query_is_update()) {
- if (innobase_query_is_replace()) {
+ /* If the SQL-query will update or replace
+ duplicate key we will take X-lock for
+ duplicates ( REPLACE, LOAD DATAFILE REPLACE,
+ INSERT ON DUPLICATE KEY UPDATE). */
err = row_ins_set_exclusive_rec_lock(
LOCK_REC_NOT_GAP, rec,
@@ -1796,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 */
}
/*******************************************************************
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 2c4eebedaf7..f1673aa6fa5 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -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 @@ handle_new_error:
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
@@ -2433,7 +2441,6 @@ row_truncate_table_for_mysql(
{
dict_foreign_t* foreign;
ulint err;
- ibool locked_dictionary = FALSE;
mem_heap_t* heap;
byte* buf;
dtuple_t* tuple;
@@ -2451,13 +2458,15 @@ operations could try to access non-existent pages.
1) SQL queries, INSERT, SELECT, ...: we must get an exclusive MySQL table lock
on the table before we can do TRUNCATE TABLE. Then there are no running
-queries on the table.
+queries on the table. This is guaranteed, because in
+ha_innobase::store_lock(), we do not weaken the TL_WRITE lock requested
+by MySQL when executing SQLCOM_TRUNCATE.
2) Purge and rollback: we assign a new table id for the table. Since purge and
rollback look for the table based on the table id, they see the table as
'dropped' and discard their operations.
3) Insert buffer: TRUNCATE TABLE is analogous to DROP TABLE, so we do not
have to remove insert buffer records, as the insert buffer works at a low
-level. If a freed page is later reallocated, the allocator will remove
+level. If a freed page is later reallocated, the allocator will remove
the ibuf entries for it.
TODO: when we truncate *.ibd files (analogous to DISCARD TABLESPACE), we
@@ -2465,10 +2474,10 @@ will have to remove we remove all entries for the table in the insert
buffer tree!
4) Linear readahead and random readahead: we use the same method as in 3) to
-discard ongoing operations. (This will only be relevant for TRUNCATE TABLE
+discard ongoing operations. (This will only be relevant for TRUNCATE TABLE
by DISCARD TABLESPACE.)
5) FOREIGN KEY operations: if table->n_foreign_key_checks_running > 0, we
-do not allow the TRUNCATE. We also reserve the data dictionary latch. */
+do not allow the TRUNCATE. We also reserve the data dictionary latch. */
static const char renumber_tablespace_proc[] =
"PROCEDURE RENUMBER_TABLESPACE_PROC () IS\n"
@@ -2516,14 +2525,11 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
/* Serialize data dictionary operations with dictionary mutex:
no deadlocks can occur then in these operations */
- if (trx->dict_operation_lock_mode != RW_X_LATCH) {
- /* Prevent foreign key checks etc. while we are truncating the
- table */
-
- row_mysql_lock_data_dictionary(trx);
+ ut_a(trx->dict_operation_lock_mode == 0);
+ /* Prevent foreign key checks etc. while we are truncating the
+ table */
- locked_dictionary = TRUE;
- }
+ row_mysql_lock_data_dictionary(trx);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
@@ -2551,8 +2557,8 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
fputs(" Cannot truncate table ", ef);
ut_print_name(ef, trx, table->name);
- fputs("\n"
- "because it is referenced by ", ef);
+ fputs(" by DROP+CREATE\n"
+ "InnoDB: because it is referenced by ", ef);
ut_print_name(ef, trx, foreign->foreign_table_name);
putc('\n', ef);
mutex_exit(&dict_foreign_err_mutex);
@@ -2569,10 +2575,10 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
if (table->n_foreign_key_checks_running > 0) {
ut_print_timestamp(stderr);
- fputs(" InnoDB: You are trying to truncate table ", stderr);
+ fputs(" InnoDB: Cannot truncate table ", stderr);
ut_print_name(stderr, trx, table->name);
- fputs("\n"
-"InnoDB: though there is a foreign key check running on it.\n",
+ fputs(" by DROP+CREATE\n"
+"InnoDB: because there is a foreign key check running on it.\n",
stderr);
err = DB_ERROR;
@@ -2686,9 +2692,7 @@ fputs(" InnoDB: Unable to assign a new identifier to table ", stderr);
funct_exit:
- if (locked_dictionary) {
- row_mysql_unlock_data_dictionary(trx);
- }
+ row_mysql_unlock_data_dictionary(trx);
trx->op_info = "";
@@ -2696,6 +2700,7 @@ funct_exit:
return((int) err);
}
+#endif /* !UNIV_HOTBACKUP */
/*************************************************************************
Drops a table for MySQL. If the name of the table to be dropped is equal
@@ -3092,7 +3097,9 @@ funct_exit:
trx->op_info = "";
+#ifndef UNIV_HOTBACKUP
srv_wake_master_thread();
+#endif /* !UNIV_HOTBACKUP */
return((int) err);
}
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index 7da2ee10d27..55ce452772d 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -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 @@ suspend_thread:
return(0);
#endif
}
+#endif /* !UNIV_HOTBACKUP */
diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c
index 983a8306773..b2f97492e70 100644
--- a/innobase/srv/srv0start.c
+++ b/innobase/srv/srv0start.c
@@ -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 */
diff --git a/innobase/sync/sync0rw.c b/innobase/sync/sync0rw.c
index 359945594be..973b46fdd50 100644
--- a/innobase/sync/sync0rw.c
+++ b/innobase/sync/sync0rw.c
@@ -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);
diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c
index 788965f82ef..98b91ed5211 100644
--- a/innobase/sync/sync0sync.c
+++ b/innobase/sync/sync0sync.c
@@ -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_loop:
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 @@ spin_loop:
if (i == SYNC_SPIN_ROUNDS)
{
+#ifndef UNIV_HOTBACKUP
mutex->count_os_yield++;
if (timed_mutexes == 1 && timer_started==0)
{
@@ -410,6 +414,7 @@ spin_loop:
lstart_time= (ib_longlong)sec * 1000000 + ms;
timer_started = 1;
}
+#endif /* !UNIV_HOTBACKUP */
os_thread_yield();
}
@@ -422,7 +427,9 @@ spin_loop:
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 @@ finish_timing:
mutex->lmax_spent_time= ltime_diff;
}
}
+#endif /* !UNIV_HOTBACKUP */
return;
}
diff --git a/innobase/trx/trx0roll.c b/innobase/trx/trx0roll.c
index e5cffd2a4f3..e57057de7ff 100644
--- a/innobase/trx/trx0roll.c
+++ b/innobase/trx/trx0roll.c
@@ -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 */
}
/***********************************************************************
@@ -317,6 +324,51 @@ trx_savepoint_for_mysql(
}
/***********************************************************************
+Releases a named savepoint. Savepoints which
+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,
+ otherwise DB_SUCCESS */
+ trx_t* trx, /* in: transaction handle */
+ const char* savepoint_name) /* in: savepoint name */
+{
+ trx_named_savept_t* savep;
+
+ savep = UT_LIST_GET_FIRST(trx->trx_savepoints);
+
+ while (savep != NULL) {
+ if (0 == ut_strcmp(savep->name, savepoint_name)) {
+ /* Found */
+ break;
+ }
+ savep = UT_LIST_GET_NEXT(trx_savepoints, savep);
+ }
+
+ if (savep == NULL) {
+
+ return(DB_NO_SAVEPOINT);
+ }
+
+ /* We can now free all savepoints strictly later than this one */
+
+ trx_roll_savepoints_free(trx, savep);
+
+ /* Now we can free this savepoint too */
+
+ UT_LIST_REMOVE(trx_savepoints, trx->trx_savepoints, savep);
+
+ mem_free(savep->name);
+ mem_free(savep);
+
+ return(DB_SUCCESS);
+}
+
+/***********************************************************************
Returns a transaction savepoint taken at this point in time. */
trx_savept_t
diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c
index 6619286ee71..f254f3ff904 100644
--- a/innobase/trx/trx0trx.c
+++ b/innobase/trx/trx0trx.c
@@ -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;
diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c
index 6f2aa0957d8..1fffd08c718 100644
--- a/innobase/ut/ut0ut.c
+++ b/innobase/ut/ut0ut.c
@@ -44,13 +44,13 @@ ut_get_high32(
/* out: a >> 32 */
ulint a) /* in: ulint */
{
-#if SIZEOF_LONG == 4
- UT_NOT_USED(a);
+ ib_longlong i;
- return 0;
-#else
- return(a >> 32);
-#endif
+ i = (ib_longlong)a;
+
+ i = i >> 32;
+
+ return((ulint)i);
}
/************************************************************
@@ -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;