summaryrefslogtreecommitdiff
path: root/innobase/include
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/include')
-rw-r--r--innobase/include/btr0btr.h2
-rw-r--r--innobase/include/buf0buf.h13
-rw-r--r--innobase/include/buf0buf.ic20
-rw-r--r--innobase/include/buf0flu.h2
-rw-r--r--innobase/include/buf0lru.h2
-rw-r--r--innobase/include/data0data.h13
-rw-r--r--innobase/include/data0data.ic4
-rw-r--r--innobase/include/data0type.h2
-rw-r--r--innobase/include/dict0dict.h111
-rw-r--r--innobase/include/dict0dict.ic31
-rw-r--r--innobase/include/dict0mem.h30
-rw-r--r--innobase/include/dict0types.h1
-rw-r--r--innobase/include/fil0fil.h2
-rw-r--r--innobase/include/fsp0fsp.h2
-rw-r--r--innobase/include/fut0lst.h3
-rw-r--r--innobase/include/ha0ha.h3
-rw-r--r--innobase/include/ha0ha.ic29
-rw-r--r--innobase/include/ibuf0ibuf.h3
-rw-r--r--innobase/include/lock0lock.h38
-rw-r--r--innobase/include/log0log.h4
-rw-r--r--innobase/include/mem0dbg.h4
-rw-r--r--innobase/include/mem0dbg.ic3
-rw-r--r--innobase/include/mem0mem.h53
-rw-r--r--innobase/include/mem0mem.ic96
-rw-r--r--innobase/include/mem0pool.h3
-rw-r--r--innobase/include/mtr0log.ic3
-rw-r--r--innobase/include/mtr0mtr.h2
-rw-r--r--innobase/include/os0file.h11
-rw-r--r--innobase/include/pars0opt.h2
-rw-r--r--innobase/include/pars0pars.h19
-rw-r--r--innobase/include/pars0sym.h3
-rw-r--r--innobase/include/pars0types.h1
-rw-r--r--innobase/include/rem0rec.h11
-rw-r--r--innobase/include/rem0rec.ic2
-rw-r--r--innobase/include/row0mysql.h20
-rw-r--r--innobase/include/row0sel.ic5
-rw-r--r--innobase/include/row0uins.h3
-rw-r--r--innobase/include/row0undo.h3
-rw-r--r--innobase/include/row0upd.ic10
-rw-r--r--innobase/include/srv0srv.h27
-rw-r--r--innobase/include/sync0arr.h3
-rw-r--r--innobase/include/sync0rw.h2
-rw-r--r--innobase/include/sync0sync.h26
-rw-r--r--innobase/include/trx0sys.h4
-rw-r--r--innobase/include/trx0trx.h5
-rw-r--r--innobase/include/ut0byte.h16
-rw-r--r--innobase/include/ut0mem.h42
-rw-r--r--innobase/include/ut0mem.ic20
-rw-r--r--innobase/include/ut0ut.h46
49 files changed, 458 insertions, 302 deletions
diff --git a/innobase/include/btr0btr.h b/innobase/include/btr0btr.h
index 8606fcd2a5c..e904db3272f 100644
--- a/innobase/include/btr0btr.h
+++ b/innobase/include/btr0btr.h
@@ -392,6 +392,7 @@ btr_page_free_low(
page_t* page, /* in: page to be freed, x-latched */
ulint level, /* in: page level */
mtr_t* mtr); /* in: mtr */
+#ifdef UNIV_DEBUG
/*****************************************************************
Prints size info of a B-tree. */
@@ -408,6 +409,7 @@ btr_print_tree(
dict_tree_t* tree, /* in: tree */
ulint width); /* in: print this many entries from start
and end */
+#endif /* UNIV_DEBUG */
/****************************************************************
Checks the size and number of fields in a record based on the definition of
the index. */
diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h
index 3cab717546a..6b8da886045 100644
--- a/innobase/include/buf0buf.h
+++ b/innobase/include/buf0buf.h
@@ -54,9 +54,11 @@ Created 11/5/1995 Heikki Tuuri
#define BUF_KEEP_OLD 52
extern buf_pool_t* buf_pool; /* The buffer pool of the database */
+#ifdef UNIV_DEBUG
extern ibool buf_debug_prints;/* If this is set TRUE, the program
prints info whenever read or flush
occurs */
+#endif /* UNIV_DEBUG */
/************************************************************************
Creates the buffer pool. */
@@ -476,12 +478,14 @@ buf_pool_is_block(
/*==============*/
/* out: TRUE if pointer to block */
void* ptr); /* in: pointer to memory */
+#ifdef UNIV_DEBUG
/*************************************************************************
Validates the buffer pool data structure. */
ibool
buf_validate(void);
/*==============*/
+#endif /* UNIV_DEBUG */
/************************************************************************
Prints a page to stderr. */
@@ -507,8 +511,7 @@ Prints info of the buffer i/o. */
void
buf_print_io(
/*=========*/
- char* buf, /* in/out: buffer where to print */
- char* buf_end);/* in: buffer end */
+ FILE* file); /* in: file where to print */
/*************************************************************************
Returns the ratio in percents of modified pages in the buffer pool /
database pages in the buffer pool. */
@@ -894,7 +897,7 @@ struct buf_pool_struct{
ulint n_pend_reads; /* number of pending read operations */
- time_t last_printout_time; /* when buf_print was last time
+ time_t last_printout_time; /* when buf_print_io was last time
called */
ulint n_pages_read; /* number read operations */
ulint n_pages_written;/* number write operations */
@@ -909,10 +912,10 @@ struct buf_pool_struct{
ulint n_pages_awe_remapped; /* if AWE is enabled, the
number of remaps of blocks to
buffer frames */
- ulint n_page_gets_old;/* n_page_gets when buf_print was
+ ulint n_page_gets_old;/* n_page_gets when buf_print_io was
last time called: used to calculate
hit rate */
- ulint n_pages_read_old;/* n_pages_read when buf_print was
+ ulint n_pages_read_old;/* n_pages_read when buf_print_io was
last time called */
ulint n_pages_written_old;/* number write operations */
ulint n_pages_created_old;/* number of pages created in
diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic
index cb54785128f..b644afcbdff 100644
--- a/innobase/include/buf0buf.ic
+++ b/innobase/include/buf0buf.ic
@@ -11,10 +11,6 @@ Created 11/5/1995 Heikki Tuuri
#include "buf0rea.h"
#include "mtr0mtr.h"
-extern ulint buf_dbg_counter; /* This is used to insert validation
- operations in execution in the
- debug version */
-
/************************************************************************
Recommends a move of a block to the start of the LRU list if there is danger
of dropping from the buffer pool. NOTE: does not reserve the buffer pool
@@ -215,14 +211,14 @@ buf_block_align(
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: trying to access a stray pointer %lx\n"
-"InnoDB: buf pool start is at %lx, end at %lx\n"
+"InnoDB: Error: trying to access a stray pointer %p\n"
+"InnoDB: buf pool start is at %p, end at %p\n"
"InnoDB: Probable reason is database corruption or memory\n"
"InnoDB: corruption. If this happens in an InnoDB database recovery,\n"
"InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n"
"InnoDB: how to force recovery.\n",
- (long)ptr, (long)frame_zero,
- (long)(buf_pool->high_end));
+ ptr, frame_zero,
+ buf_pool->high_end);
ut_error;
}
@@ -251,14 +247,14 @@ buf_frame_align(
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: trying to access a stray pointer %lx\n"
-"InnoDB: buf pool start is at %lx, end at %lx\n"
+"InnoDB: Error: trying to access a stray pointer %p\n"
+"InnoDB: buf pool start is at %p, end at %p\n"
"InnoDB: Probable reason is database corruption or memory\n"
"InnoDB: corruption. If this happens in an InnoDB database recovery,\n"
"InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n"
"InnoDB: how to force recovery.\n",
- (long)ptr, (long)(buf_pool->frame_zero),
- (long)(buf_pool->high_end));
+ ptr, buf_pool->frame_zero,
+ buf_pool->high_end);
ut_error;
}
diff --git a/innobase/include/buf0flu.h b/innobase/include/buf0flu.h
index 1b40acaa269..6f39eef7210 100644
--- a/innobase/include/buf0flu.h
+++ b/innobase/include/buf0flu.h
@@ -97,6 +97,7 @@ buf_flush_ready_for_replace(
/* out: TRUE if can replace immediately */
buf_block_t* block); /* in: buffer control block, must be in state
BUF_BLOCK_FILE_PAGE and in the LRU list */
+#ifdef UNIV_DEBUG
/**********************************************************************
Validates the flush list. */
@@ -104,6 +105,7 @@ ibool
buf_flush_validate(void);
/*====================*/
/* out: TRUE if ok */
+#endif /* UNIV_DEBUG */
/* When buf_flush_free_margin is called, it tries to make this many blocks
available to replacement in the free list and at the end of the LRU list (to
diff --git a/innobase/include/buf0lru.h b/innobase/include/buf0lru.h
index 69a376f8cab..98aa0252e12 100644
--- a/innobase/include/buf0lru.h
+++ b/innobase/include/buf0lru.h
@@ -112,6 +112,7 @@ void
buf_LRU_make_block_old(
/*===================*/
buf_block_t* block); /* in: control block */
+#ifdef UNIV_DEBUG
/**************************************************************************
Validates the LRU list. */
@@ -124,6 +125,7 @@ Prints the LRU list. */
void
buf_LRU_print(void);
/*===============*/
+#endif /* UNIV_DEBUG */
#ifndef UNIV_NONINL
#include "buf0lru.ic"
diff --git a/innobase/include/data0data.h b/innobase/include/data0data.h
index c4e93bec738..99d3c297039 100644
--- a/innobase/include/data0data.h
+++ b/innobase/include/data0data.h
@@ -294,6 +294,7 @@ dtuple_check_typed_no_assert(
/*=========================*/
/* out: TRUE if ok */
dtuple_t* tuple); /* in: tuple */
+#ifdef UNIV_DEBUG
/**************************************************************
Validates the consistency of a tuple which must be complete, i.e,
all fields must have been set. */
@@ -303,6 +304,7 @@ dtuple_validate(
/*============*/
/* out: TRUE if ok */
dtuple_t* tuple); /* in: tuple */
+#endif /* UNIV_DEBUG */
/*****************************************************************
Pretty prints a dfield value according to its data type. */
@@ -324,16 +326,7 @@ The following function prints the contents of a tuple. */
void
dtuple_print(
/*=========*/
- dtuple_t* tuple); /* in: tuple */
-/**************************************************************
-The following function prints the contents of a tuple to a buffer. */
-
-ulint
-dtuple_sprintf(
-/*===========*/
- /* out: printed length in bytes */
- char* buf, /* in: print buffer */
- ulint buf_len,/* in: buf length in bytes */
+ FILE* f, /* in: output stream */
dtuple_t* tuple); /* in: tuple */
/******************************************************************
Moves parts of long fields in entry to the big record vector so that
diff --git a/innobase/include/data0data.ic b/innobase/include/data0data.ic
index def80d3f430..697a272ccd6 100644
--- a/innobase/include/data0data.ic
+++ b/innobase/include/data0data.ic
@@ -299,7 +299,7 @@ dtuple_get_data_size(
ut_ad(tuple);
ut_ad(dtuple_check_typed(tuple));
- ut_ad(tuple->magic_n = DATA_TUPLE_MAGIC_N);
+ ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N);
n_fields = tuple->n_fields;
@@ -355,7 +355,7 @@ dtuple_fold(
ulint fold;
ut_ad(tuple);
- ut_ad(tuple->magic_n = DATA_TUPLE_MAGIC_N);
+ ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N);
ut_ad(dtuple_check_typed(tuple));
fold = ut_fold_dulint(tree_id);
diff --git a/innobase/include/data0type.h b/innobase/include/data0type.h
index 2b27ead5fac..2138df97392 100644
--- a/innobase/include/data0type.h
+++ b/innobase/include/data0type.h
@@ -305,6 +305,7 @@ dtype_new_read_for_order_and_null_size(
/*===================================*/
dtype_t* type, /* in: type struct */
byte* buf); /* in: buffer for stored type order info */
+#ifdef UNIV_DEBUG
/*************************************************************************
Validates a data type structure. */
@@ -313,6 +314,7 @@ dtype_validate(
/*===========*/
/* out: TRUE if ok */
dtype_t* type); /* in: type struct to validate */
+#endif /* UNIV_DEBUG */
/*************************************************************************
Prints a data type structure. */
diff --git a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h
index 688685cff8b..98636f6e1cb 100644
--- a/innobase/include/dict0dict.h
+++ b/innobase/include/dict0dict.h
@@ -32,20 +32,21 @@ Get the database name length in a table name. */
ulint
dict_get_db_name_len(
/*=================*/
- /* out: database name length */
- char* name); /* in: table name in the form dbname '/' tablename */
+ /* out: database name length */
+ const char* name); /* in: table name in the form
+ dbname '/' tablename */
/*************************************************************************
Accepts a specified string. Comparisons are case-insensitive. */
-char*
+const char*
dict_accept(
/*========*/
- /* out: if string was accepted, the pointer
- is moved after that, else ptr is returned */
- char* ptr, /* in: scan from this */
- const char* string,/* in: accept only this string as the next
- non-whitespace string */
- ibool* success);/* out: TRUE if accepted */
+ /* out: if string was accepted, the pointer
+ is moved after that, else ptr is returned */
+ const char* ptr, /* in: scan from this */
+ const char* string, /* in: accept only this string as the next
+ non-whitespace string */
+ ibool* success);/* out: TRUE if accepted */
/************************************************************************
Decrements the count of open MySQL handles to a table. */
@@ -69,41 +70,6 @@ database directories. */
void
dict_load_space_id_list(void);
/*=========================*/
-/**************************************************************************
-Returns a stored procedure object and memoryfixes it. */
-UNIV_INLINE
-dict_proc_t*
-dict_procedure_get(
-/*===============*/
- /* out: procedure, NULL if does not exist */
- char* proc_name, /* in: table name */
- trx_t* trx); /* in: transaction handle or NULL */
-/**************************************************************************
-Adds a stored procedure object to the dictionary cache. */
-
-void
-dict_procedure_add_to_cache(
-/*========================*/
- dict_proc_t* proc); /* in: procedure */
-/**************************************************************************
-Reserves a parsed copy of a stored procedure to execute. If there are no
-free parsed copies left at the moment, parses a new copy. Takes the copy off
-the list of copies: the copy must be returned there with
-dict_procedure_release_parsed_copy. */
-
-que_t*
-dict_procedure_reserve_parsed_copy(
-/*===============================*/
- /* out: the query graph */
- dict_proc_t* proc); /* in: dictionary procedure node */
-/**************************************************************************
-Releases a parsed copy of an executed stored procedure. Puts the copy to the
-list of copies. */
-
-void
-dict_procedure_release_parsed_copy(
-/*===============================*/
- que_t* graph); /* in: query graph of a stored procedure */
/*************************************************************************
Gets the column data type. */
UNIV_INLINE
@@ -270,7 +236,7 @@ dict_foreign_parse_drop_constraints(
dict_table_t* table, /* in: table */
ulint* n, /* out: number of constraints
to drop */
- char*** constraints_to_drop); /* out: id's of the
+ const char*** constraints_to_drop); /* out: id's of the
constraints to drop */
/**************************************************************************
Returns a table object and memoryfixes it. NOTE! This is a high-level
@@ -354,18 +320,19 @@ dict_table_get_index_noninline(
dict_table_t* table, /* in: table */
char* name); /* in: index name */
/**************************************************************************
-Prints a table definition. */
+Prints a table data. */
void
-dict_table_print(
-/*=============*/
+dict_table_print_low(
+/*=================*/
dict_table_t* table); /* in: table */
+#ifdef UNIV_DEBUG
/**************************************************************************
-Prints a table data. */
+Prints a table definition. */
void
-dict_table_print_low(
-/*=================*/
+dict_table_print(
+/*=============*/
dict_table_t* table); /* in: table */
/**************************************************************************
Prints a table data when we know the table name. */
@@ -374,8 +341,9 @@ void
dict_table_print_by_name(
/*=====================*/
char* name);
+#endif /* UNIV_DEBUG */
/**************************************************************************
-Sprintfs to a string info on foreign keys of a table. */
+Outputs info on foreign keys of a table. */
void
dict_print_info_on_foreign_keys(
@@ -384,19 +352,23 @@ dict_print_info_on_foreign_keys(
a format suitable to be inserted into
a CREATE TABLE, otherwise in the format
of SHOW TABLE STATUS */
- char* str, /* in/out: pointer to a string */
- ulint len, /* in: space in str available for info */
+ FILE* file, /* in: file where to print */
dict_table_t* table); /* in: table */
/**************************************************************************
-Sprintfs to a string info on a foreign key of a table in a format suitable
-for CREATE TABLE. */
-
-char*
+Outputs info on a foreign key of a table in a format suitable for
+CREATE TABLE. */
+void
dict_print_info_on_foreign_key_in_create_format(
/*============================================*/
- /* out: how far in buf we printed */
- dict_foreign_t* foreign,/* in: foreign key constraint */
- char* buf); /* in: buffer of at least 5000 bytes */
+ FILE* file, /* in: file where to print */
+ dict_foreign_t* foreign);/* in: foreign key constraint */
+/************************************************************************
+Displays the names of the index and the table. */
+void
+dict_index_name_print(
+/*==================*/
+ FILE* file, /* in: output stream */
+ const dict_index_t* index); /* in: index to print */
/************************************************************************
Gets the first index on the table (the clustered index). */
UNIV_INLINE
@@ -899,14 +871,21 @@ Releases the dictionary system mutex for MySQL. */
void
dict_mutex_exit_for_mysql(void);
/*===========================*/
+/************************************************************************
+Checks if the database name in two table names is the same. */
-/* The following len must be at least 10000 bytes! */
-#define DICT_FOREIGN_ERR_BUF_LEN 10000
+ibool
+dict_tables_have_same_db(
+/*=====================*/
+ /* out: TRUE if same db name */
+ const char* name1, /* in: table name in the form
+ dbname '/' tablename */
+ const char* name2); /* in: table name in the form
+ dbname '/' tablename */
/* Buffers for storing detailed information about the latest foreign key
and unique key errors */
-extern char* dict_foreign_err_buf;
-extern char* dict_unique_err_buf;
+extern FILE* dict_foreign_err_file;
extern mutex_t dict_foreign_err_mutex; /* mutex protecting the buffers */
extern dict_sys_t* dict_sys; /* the dictionary system */
@@ -932,8 +911,6 @@ struct dict_sys_struct{
hash_table_t* table_id_hash; /* hash table of the tables, based
on id */
hash_table_t* col_hash; /* hash table of the columns */
- hash_table_t* procedure_hash; /* hash table of the stored
- procedures */
UT_LIST_BASE_NODE_T(dict_table_t)
table_LRU; /* LRU list of tables */
ulint size; /* varying space in bytes occupied
diff --git a/innobase/include/dict0dict.ic b/innobase/include/dict0dict.ic
index b70822e331f..57ef4b896f5 100644
--- a/innobase/include/dict0dict.ic
+++ b/innobase/include/dict0dict.ic
@@ -582,37 +582,6 @@ dict_table_get_low(
}
/**************************************************************************
-Returns a stored procedure object and memoryfixes it. */
-UNIV_INLINE
-dict_proc_t*
-dict_procedure_get(
-/*===============*/
- /* out: procedure, NULL if does not exist */
- char* proc_name, /* in: table name */
- trx_t* trx) /* in: transaction handle or NULL */
-{
- dict_proc_t* proc;
- ulint name_fold;
-
- UT_NOT_USED(trx);
-
- mutex_enter(&(dict_sys->mutex));
-
- /* Look for the table name in the hash table */
- name_fold = ut_fold_string(proc_name);
-
- HASH_SEARCH(name_hash, dict_sys->procedure_hash, name_fold, proc,
- ut_strcmp(proc->name, proc_name) == 0);
- if (proc != NULL) {
- proc->mem_fix++;
- }
-
- mutex_exit(&(dict_sys->mutex));
-
- return(proc);
-}
-
-/**************************************************************************
Returns a table object, based on table id, and memoryfixes it. */
UNIV_INLINE
dict_table_t*
diff --git a/innobase/include/dict0mem.h b/innobase/include/dict0mem.h
index 23753df4079..674868c9fce 100644
--- a/innobase/include/dict0mem.h
+++ b/innobase/include/dict0mem.h
@@ -132,18 +132,6 @@ dict_foreign_t*
dict_mem_foreign_create(void);
/*=========================*/
/* out, own: foreign constraint struct */
-/**************************************************************************
-Creates a procedure memory object. */
-
-dict_proc_t*
-dict_mem_procedure_create(
-/*======================*/
- /* out, own: procedure object */
- char* name, /* in: procedure name */
- char* sql_string, /* in: procedure definition as an SQL
- string */
- que_fork_t* graph); /* in: parsed procedure graph */
-
/* Data structure for a column in a table */
struct dict_col_struct{
@@ -427,24 +415,6 @@ struct dict_table_struct{
#endif /* UNIV_DEBUG */
};
-/* Data structure for a stored procedure */
-struct dict_proc_struct{
- mem_heap_t* heap; /* memory heap */
- char* name; /* procedure name */
- char* sql_string;
- /* procedure definition as an SQL string:
- we can produce more parsed instances of the
- procedure by parsing this string */
- hash_node_t name_hash;
- /* hash chain node */
- UT_LIST_BASE_NODE_T(que_fork_t) graphs;
- /* list of parsed instances of the procedure:
- there may be many of them, and they are
- recycled */
- ulint mem_fix;/* count of how many times this struct
- has been fixed in memory */
-};
-
#ifndef UNIV_NONINL
#include "dict0mem.ic"
#endif
diff --git a/innobase/include/dict0types.h b/innobase/include/dict0types.h
index 498c6f46b7b..bd8a1a996d1 100644
--- a/innobase/include/dict0types.h
+++ b/innobase/include/dict0types.h
@@ -15,7 +15,6 @@ typedef struct dict_field_struct dict_field_t;
typedef struct dict_index_struct dict_index_t;
typedef struct dict_tree_struct dict_tree_t;
typedef struct dict_table_struct dict_table_t;
-typedef struct dict_proc_struct dict_proc_t;
typedef struct dict_foreign_struct dict_foreign_t;
/* A cluster object is a table object with the type field set to
diff --git a/innobase/include/fil0fil.h b/innobase/include/fil0fil.h
index 310336af38e..f7cdeb7f195 100644
--- a/innobase/include/fil0fil.h
+++ b/innobase/include/fil0fil.h
@@ -19,7 +19,7 @@ Created 10/25/1995 Heikki Tuuri
/* When mysqld is run, the default directory "." is the mysqld datadir, but in
ibbackup we must set it explicitly; the patgh must NOT contain the trailing
'/' or '\' */
-extern char* fil_path_to_mysql_datadir;
+extern const char* fil_path_to_mysql_datadir;
/* Initial size of a single-table tablespace in pages */
#define FIL_IBD_FILE_INITIAL_SIZE 4
diff --git a/innobase/include/fsp0fsp.h b/innobase/include/fsp0fsp.h
index 2fcde882df7..20f4f4c2abd 100644
--- a/innobase/include/fsp0fsp.h
+++ b/innobase/include/fsp0fsp.h
@@ -332,6 +332,7 @@ void
fsp_print(
/*======*/
ulint space); /* in: space id */
+#ifdef UNIV_DEBUG
/***********************************************************************
Validates a segment. */
@@ -349,6 +350,7 @@ fseg_print(
/*=======*/
fseg_header_t* header, /* in: segment header */
mtr_t* mtr); /* in: mtr */
+#endif /* UNIV_DEBUG */
/* Flags for fsp_reserve_free_extents */
#define FSP_NORMAL 1000000
diff --git a/innobase/include/fut0lst.h b/innobase/include/fut0lst.h
index 5427e2248da..3f679d61ab5 100644
--- a/innobase/include/fut0lst.h
+++ b/innobase/include/fut0lst.h
@@ -181,6 +181,7 @@ flst_validate(
/* out: TRUE if ok */
flst_base_node_t* base, /* in: pointer to base node of list */
mtr_t* mtr1); /* in: mtr */
+#ifdef UNIV_DEBUG
/************************************************************************
Prints info of a file-based list. */
@@ -189,7 +190,7 @@ flst_print(
/*=======*/
flst_base_node_t* base, /* in: pointer to base node of list */
mtr_t* mtr); /* in: mtr */
-
+#endif /* UNIV_DEBUG */
#ifndef UNIV_NONINL
#include "fut0lst.ic"
diff --git a/innobase/include/ha0ha.h b/innobase/include/ha0ha.h
index c3fc04b47bb..bdaecfcc57a 100644
--- a/innobase/include/ha0ha.h
+++ b/innobase/include/ha0ha.h
@@ -127,8 +127,7 @@ Prints info of a hash table. */
void
ha_print_info(
/*==========*/
- char* buf, /* in/out: buffer where to print */
- char* buf_end,/* in: buffer end */
+ FILE* file, /* in: file where to print */
hash_table_t* table); /* in: hash table */
/* The hash table external chain node */
diff --git a/innobase/include/ha0ha.ic b/innobase/include/ha0ha.ic
index 5369ca7f273..63cd19fafc3 100644
--- a/innobase/include/ha0ha.ic
+++ b/innobase/include/ha0ha.ic
@@ -131,35 +131,6 @@ ha_search_and_get_data(
return(NULL);
}
-/*****************************************************************
-Returns the next matching hash table node in chain. */
-UNIV_INLINE
-ha_node_t*
-ha_next(
-/*====*/
- /* out: pointer to the next hash table node
- in chain with the fold value, NULL if not
- found */
- ha_node_t* node) /* in: hash table node */
-{
- ulint fold;
-
- fold = node->fold;
-
- node = ha_chain_get_next(node);
-
- while (node) {
- if (node->fold == fold) {
-
- return(node);
- }
-
- node = ha_chain_get_next(node);
- }
-
- return(NULL);
-}
-
/*************************************************************
Looks for an element when we know the pointer to the data. */
UNIV_INLINE
diff --git a/innobase/include/ibuf0ibuf.h b/innobase/include/ibuf0ibuf.h
index 8ef67df26f8..4f38ab4f1e9 100644
--- a/innobase/include/ibuf0ibuf.h
+++ b/innobase/include/ibuf0ibuf.h
@@ -290,8 +290,7 @@ Prints info of ibuf. */
void
ibuf_print(
/*=======*/
- char* buf, /* in/out: buffer where to print */
- char* buf_end);/* in: buffer end */
+ FILE* file); /* in: file where to print */
#define IBUF_HEADER_PAGE_NO FSP_IBUF_HEADER_PAGE_NO
#define IBUF_TREE_ROOT_PAGE_NO FSP_IBUF_TREE_ROOT_PAGE_NO
diff --git a/innobase/include/lock0lock.h b/innobase/include/lock0lock.h
index 103d28cd130..b1f9a10ee05 100644
--- a/innobase/include/lock0lock.h
+++ b/innobase/include/lock0lock.h
@@ -19,7 +19,11 @@ Created 5/7/1996 Heikki Tuuri
#include "read0types.h"
#include "hash0hash.h"
+#ifdef UNIV_DEBUG
extern ibool lock_print_waits;
+#endif /* UNIV_DEBUG */
+/* Buffer for storing information about the most recent deadlock error */
+extern FILE* lock_latest_err_file;
/*************************************************************************
Gets the size of a lock struct. */
@@ -377,7 +381,9 @@ lock_table(
/* out: DB_SUCCESS, DB_LOCK_WAIT,
DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set,
- does nothing */
+ does nothing;
+ if LOCK_TABLE_EXP bits are set,
+ creates an explicit table lock */
dict_table_t* table, /* in: database table in dictionary cache */
ulint mode, /* in: lock mode */
que_thr_t* thr); /* in: query thread */
@@ -390,6 +396,14 @@ lock_is_on_table(
/* out: TRUE if there are lock(s) */
dict_table_t* table); /* in: database table in dictionary cache */
/*************************************************************************
+Releases a table lock.
+Releases possible other transactions waiting for this lock. */
+
+void
+lock_table_unlock(
+/*==============*/
+ lock_t* lock); /* in: lock */
+/*************************************************************************
Releases an auto-inc lock a transaction possibly has on a table.
Releases possible other transactions waiting for this lock. */
@@ -406,6 +420,14 @@ lock_release_off_kernel(
/*====================*/
trx_t* trx); /* in: transaction */
/*************************************************************************
+Releases table locks, and releases possible other transactions waiting
+because of these locks. */
+
+void
+lock_release_tables_off_kernel(
+/*===========================*/
+ trx_t* trx); /* in: transaction */
+/*************************************************************************
Cancels a waiting lock request and releases possible other transactions
waiting behind it. */
@@ -453,6 +475,7 @@ lock_check_trx_id_sanity(
dict_index_t* index, /* in: clustered index */
ibool has_kernel_mutex);/* in: TRUE if the caller owns the
kernel mutex */
+#ifdef UNIV_DEBUG
/*************************************************************************
Validates the lock queue on a single record. */
@@ -462,14 +485,14 @@ lock_rec_queue_validate(
/* out: TRUE if ok */
rec_t* rec, /* in: record to look at */
dict_index_t* index); /* in: index, or NULL if not known */
+#endif /* UNIV_DEBUG */
/*************************************************************************
Prints info of a table lock. */
void
lock_table_print(
/*=============*/
- char* buf, /* in/out: buffer where to print, must be at least
- 500 bytes */
+ FILE* file, /* in: file where to print */
lock_t* lock); /* in: table type lock */
/*************************************************************************
Prints info of a record lock. */
@@ -477,8 +500,7 @@ Prints info of a record lock. */
void
lock_rec_print(
/*===========*/
- char* buf, /* in/out: buffer where to print, must be at least
- 500 bytes */
+ FILE* file, /* in: file where to print */
lock_t* lock); /* in: record type lock */
/*************************************************************************
Prints info of locks for all transactions. */
@@ -486,8 +508,8 @@ Prints info of locks for all transactions. */
void
lock_print_info(
/*============*/
- char* buf, /* in/out: buffer where to print */
- char* buf_end);/* in: buffer end */
+ FILE* file); /* in: file where to print */
+#ifdef UNIV_DEBUG
/*************************************************************************
Validates the lock queue on a table. */
@@ -512,6 +534,7 @@ ibool
lock_validate(void);
/*===============*/
/* out: TRUE if ok */
+#endif /* UNIV_DEBUG */
/* The lock system */
extern lock_sys_t* lock_sys;
@@ -531,6 +554,7 @@ extern lock_sys_t* lock_sys;
/* Lock types */
#define LOCK_TABLE 16 /* these type values should be so high that */
#define LOCK_REC 32 /* they can be ORed to the lock mode */
+#define LOCK_TABLE_EXP 80 /* explicit table lock */
#define LOCK_TYPE_MASK 0xF0UL /* mask used to extract lock type from the
type_mode field in a lock */
/* Waiting lock flag */
diff --git a/innobase/include/log0log.h b/innobase/include/log0log.h
index 2bdc158502f..4badd2cd7b3 100644
--- a/innobase/include/log0log.h
+++ b/innobase/include/log0log.h
@@ -366,7 +366,6 @@ Writes a buffer to a log file group. */
void
log_group_write_buf(
/*================*/
- ulint type, /* in: LOG_FLUSH or LOG_RECOVER */
log_group_t* group, /* in: log group */
byte* buf, /* in: buffer */
ulint len, /* in: buffer len; must be divisible
@@ -513,8 +512,7 @@ Prints info of the log. */
void
log_print(
/*======*/
- char* buf, /* in/out: buffer where to print */
- char* buf_end);/* in: buffer end */
+ FILE* file); /* in: file where to print */
/**********************************************************
Peeks the current lsn. */
diff --git a/innobase/include/mem0dbg.h b/innobase/include/mem0dbg.h
index 6c92d669be3..61c66cc218c 100644
--- a/innobase/include/mem0dbg.h
+++ b/innobase/include/mem0dbg.h
@@ -31,6 +31,7 @@ check fields at the both ends of the field. */
#define MEM_SPACE_NEEDED(N) ut_calc_align((N), UNIV_MEM_ALIGNMENT)
#endif
+#ifdef UNIV_DEBUG
/*******************************************************************
Checks a memory heap for consistency and prints the contents if requested.
Outputs the sum of sizes of buffers given to the user (only in
@@ -60,6 +61,7 @@ mem_heap_validate_or_print(
ulint* n_blocks); /* out: number of blocks in the heap,
if a NULL pointer is passed as this
argument, it is ignored */
+#endif /* UNIV_DEBUG */
#ifdef UNIV_MEM_DEBUG
/******************************************************************
Prints the contents of a memory heap. */
@@ -69,6 +71,7 @@ mem_heap_print(
/*===========*/
mem_heap_t* heap); /* in: memory heap */
#endif /* UNIV_MEM_DEBUG */
+#ifdef UNIV_DEBUG
/******************************************************************
Checks that an object is a memory heap (or a block of it) */
@@ -85,6 +88,7 @@ mem_heap_validate(
/*==============*/
/* out: TRUE if ok */
mem_heap_t* heap); /* in: memory heap */
+#endif /* UNIV_DEBUG */
#ifdef UNIV_MEM_DEBUG
/*********************************************************************
TRUE if no memory is currently allocated. */
diff --git a/innobase/include/mem0dbg.ic b/innobase/include/mem0dbg.ic
index 6efac719760..2e79c814529 100644
--- a/innobase/include/mem0dbg.ic
+++ b/innobase/include/mem0dbg.ic
@@ -56,6 +56,7 @@ mem_hash_insert(
mem_heap_t* heap, /* in: the created heap */
char* file_name, /* in: file name of creation */
ulint line); /* in: line where created */
+#ifdef UNIV_MEM_DEBUG
/*******************************************************************
Removes a memory heap (which is going to be freed by the caller)
from the list of live memory heaps. Returns the size of the heap
@@ -71,7 +72,7 @@ mem_hash_remove(
mem_heap_t* heap, /* in: the heap to be freed */
char* file_name, /* in: file name of freeing */
ulint line); /* in: line where freed */
-
+#endif /* UNIV_MEM_DEBUG */
void
mem_field_header_set_len(byte* field, ulint len);
diff --git a/innobase/include/mem0mem.h b/innobase/include/mem0mem.h
index 9ab3b2cd754..89e2a337c99 100644
--- a/innobase/include/mem0mem.h
+++ b/innobase/include/mem0mem.h
@@ -271,6 +271,59 @@ mem_realloc(
ulint n, /* in: desired number of bytes */
char* file_name,/* in: file name where called */
ulint line); /* in: line where called */
+
+/**************************************************************************
+Duplicates a NUL-terminated string. */
+UNIV_INLINE
+char*
+mem_strdup(
+/*=======*/
+ /* out, own: a copy of the string,
+ must be deallocated with mem_free */
+ const char* str); /* in: string to be copied */
+/**************************************************************************
+Makes a NUL-terminated copy of a nonterminated string. */
+UNIV_INLINE
+char*
+mem_strdupl(
+/*========*/
+ /* out, own: a copy of the string,
+ must be deallocated with mem_free */
+ const char* str, /* in: string to be copied */
+ ulint len); /* in: length of str, in bytes */
+
+/**************************************************************************
+Makes a NUL-terminated quoted copy of a NUL-terminated string. */
+UNIV_INLINE
+char*
+mem_strdupq(
+/*========*/
+ /* out, own: a quoted copy of the string,
+ must be deallocated with mem_free */
+ const char* str, /* in: string to be copied */
+ char q); /* in: quote character */
+
+/**************************************************************************
+Duplicates a NUL-terminated string, allocated from a memory heap. */
+UNIV_INLINE
+char*
+mem_heap_strdup(
+/*============*/
+ /* out, own: a copy of the string */
+ mem_heap_t* heap, /* in: memory heap where string is allocated */
+ const char* str); /* in: string to be copied */
+/**************************************************************************
+Makes a NUL-terminated copy of a nonterminated string,
+allocated from a memory heap. */
+UNIV_INLINE
+char*
+mem_heap_strdupl(
+/*=============*/
+ /* out, own: a copy of the string */
+ mem_heap_t* heap, /* in: memory heap where string is allocated */
+ const char* str, /* in: string to be copied */
+ ulint len); /* in: length of str, in bytes */
+
#ifdef MEM_PERIODIC_CHECK
/**********************************************************************
Goes through the list of all allocated mem blocks, checks their magic
diff --git a/innobase/include/mem0mem.ic b/innobase/include/mem0mem.ic
index fb4cef49ec9..c250e6948ec 100644
--- a/innobase/include/mem0mem.ic
+++ b/innobase/include/mem0mem.ic
@@ -579,3 +579,99 @@ mem_realloc(
return(mem_alloc_func(n, file_name, line));
}
+
+/**************************************************************************
+Duplicates a NUL-terminated string. */
+UNIV_INLINE
+char*
+mem_strdup(
+/*=======*/
+ /* out, own: a copy of the string,
+ must be deallocated with mem_free */
+ const char* str) /* in: string to be copied */
+{
+ ulint len = strlen(str) + 1;
+ return(memcpy(mem_alloc(len), str, len));
+}
+
+/**************************************************************************
+Makes a NUL-terminated copy of a nonterminated string. */
+UNIV_INLINE
+char*
+mem_strdupl(
+/*========*/
+ /* out, own: a copy of the string,
+ must be deallocated with mem_free */
+ const char* str, /* in: string to be copied */
+ ulint len) /* in: length of str, in bytes */
+{
+ char* s = mem_alloc(len + 1);
+ s[len] = 0;
+ return(memcpy(s, str, len));
+}
+
+/**************************************************************************
+Makes a NUL-terminated quoted copy of a NUL-terminated string. */
+UNIV_INLINE
+char*
+mem_strdupq(
+/*========*/
+ /* out, own: a quoted copy of the string,
+ must be deallocated with mem_free */
+ const char* str, /* in: string to be copied */
+ char q) /* in: quote character */
+{
+ char* dst;
+ char* d;
+ const char* s = str;
+ int len = strlen(str) + 3;
+ /* calculate the number of quote characters in the string */
+ while((s = strchr(s, q)) != NULL) {
+ s++;
+ len++;
+ }
+ /* allocate the quoted string, and copy it */
+ d = dst = mem_alloc(len);
+ *d++ = q;
+ s = str;
+ while(*s) {
+ if ((*d++ = *s++) == q) {
+ *d++ = q;
+ }
+ }
+ *d++ = q;
+ *d++ = '\0';
+ ut_ad(len == d - dst);
+ return(dst);
+}
+
+/**************************************************************************
+Duplicates a NUL-terminated string, allocated from a memory heap. */
+UNIV_INLINE
+char*
+mem_heap_strdup(
+/*============*/
+ /* out, own: a copy of the string */
+ mem_heap_t* heap, /* in: memory heap where string is allocated */
+ const char* str) /* in: string to be copied */
+{
+ ulint len = strlen(str) + 1;
+ return(memcpy(mem_heap_alloc(heap, len), str, len));
+}
+
+/**************************************************************************
+Makes a NUL-terminated copy of a nonterminated string,
+allocated from a memory heap. */
+UNIV_INLINE
+char*
+mem_heap_strdupl(
+/*=============*/
+ /* out, own: a copy of the string */
+ mem_heap_t* heap, /* in: memory heap where string is allocated */
+ const char* str, /* in: string to be copied */
+ ulint len) /* in: length of str, in bytes */
+{
+ char* s = mem_heap_alloc(heap, len + 1);
+ s[len] = 0;
+ return(memcpy(s, str, len));
+}
diff --git a/innobase/include/mem0pool.h b/innobase/include/mem0pool.h
index 51c53afe788..08327d95d37 100644
--- a/innobase/include/mem0pool.h
+++ b/innobase/include/mem0pool.h
@@ -85,6 +85,7 @@ Releases the mem pool mutex. */
void
mem_pool_mutex_exit(void);
/*=====================*/
+#ifdef UNIV_DEBUG
/************************************************************************
Validates a memory pool. */
@@ -101,7 +102,7 @@ mem_pool_print_info(
/*================*/
FILE* outfile,/* in: output file to write to */
mem_pool_t* pool); /* in: memory pool */
-
+#endif /* UNIV_DEBUG */
#ifndef UNIV_NONINL
#include "mem0pool.ic"
diff --git a/innobase/include/mtr0log.ic b/innobase/include/mtr0log.ic
index 60a5b390be9..c02e0a96a81 100644
--- a/innobase/include/mtr0log.ic
+++ b/innobase/include/mtr0log.ic
@@ -171,7 +171,8 @@ mlog_write_initial_log_record_fast(
mtr->n_log_recs++;
#ifdef UNIV_LOG_DEBUG
-/* printf("Adding to mtr log record type %lu space %lu page no %lu\n",
+/* fprintf(stderr,
+ "Adding to mtr log record type %lu space %lu page no %lu\n",
type, space, offset); */
#endif
diff --git a/innobase/include/mtr0mtr.h b/innobase/include/mtr0mtr.h
index 9cf592f71e1..73338977b9c 100644
--- a/innobase/include/mtr0mtr.h
+++ b/innobase/include/mtr0mtr.h
@@ -256,6 +256,7 @@ mtr_memo_contains(
mtr_t* mtr, /* in: mtr */
void* object, /* in: object to search */
ulint type); /* in: type of object */
+#ifdef UNIV_DEBUG
/*************************************************************
Prints info of an mtr handle. */
@@ -263,6 +264,7 @@ void
mtr_print(
/*======*/
mtr_t* mtr); /* in: mtr */
+#endif /* UNIV_DEBUG */
/*######################################################################*/
#define MTR_BUF_MEMO_SIZE 200 /* number of slots in memo */
diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h
index 813e6e72e65..3eccfcd3be5 100644
--- a/innobase/include/os0file.h
+++ b/innobase/include/os0file.h
@@ -358,6 +358,14 @@ os_file_set_size(
size */
ulint size_high);/* in: most significant 32 bits of size */
/***************************************************************************
+Truncates a file at its current position. */
+
+ibool
+os_file_set_eof(
+/*============*/
+ /* out: TRUE if success */
+ FILE* file); /* in: file to be truncated */
+/***************************************************************************
Flushes the write buffers of a given file to the disk. */
ibool
@@ -647,8 +655,7 @@ Prints info of the aio arrays. */
void
os_aio_print(
/*=========*/
- char* buf, /* in/out: buffer where to print */
- char* buf_end);/* in: buffer end */
+ FILE* file); /* in: file where to print */
/**************************************************************************
Refreshes the statistics used to print per-second averages. */
diff --git a/innobase/include/pars0opt.h b/innobase/include/pars0opt.h
index d091c3ee2d0..ac0e885d05a 100644
--- a/innobase/include/pars0opt.h
+++ b/innobase/include/pars0opt.h
@@ -43,6 +43,7 @@ opt_find_all_cols(
to add new found columns */
plan_t* plan, /* in: plan or NULL */
que_node_t* exp); /* in: expression or condition */
+#ifdef UNIV_SQL_DEBUG
/************************************************************************
Prints info of a query plan. */
@@ -50,6 +51,7 @@ void
opt_print_query_plan(
/*=================*/
sel_node_t* sel_node); /* in: select node */
+#endif /* UNIV_SQL_DEBUG */
#ifndef UNIV_NONINL
#include "pars0opt.ic"
diff --git a/innobase/include/pars0pars.h b/innobase/include/pars0pars.h
index 8ff226ebbd0..2e86a7e5534 100644
--- a/innobase/include/pars0pars.h
+++ b/innobase/include/pars0pars.h
@@ -87,13 +87,6 @@ pars_get_lex_chars(
int max_size); /* in: maximum number of characters which fit
in the buffer */
/*****************************************************************
-Instructs the lexical analyzer to stop when it receives the EOF integer. */
-
-int
-yywrap(void);
-/*========*/
- /* out: returns TRUE */
-/*****************************************************************
Called by yyparse on error. */
void
@@ -456,18 +449,6 @@ struct proc_node_struct{
sym_node_t* param_list; /* input and output parameters */
que_node_t* stat_list; /* statement list */
sym_tab_t* sym_tab; /* symbol table of this procedure */
- dict_proc_t* dict_proc; /* stored procedure node in the
- dictionary cache, if defined */
-};
-
-/* Stored procedure call node */
-struct call_node_struct{
- que_common_t common; /* type: QUE_NODE_CALL */
- sym_node_t* proc_name; /* stored procedure name */
- dict_proc_t* procedure_def; /* pointer to a stored procedure graph
- in the dictionary stored procedure
- cache */
- sym_tab_t* sym_tab; /* symbol table of this query */
};
/* elsif-element node */
diff --git a/innobase/include/pars0sym.h b/innobase/include/pars0sym.h
index 9fdeb1984a9..3060fd06c8f 100644
--- a/innobase/include/pars0sym.h
+++ b/innobase/include/pars0sym.h
@@ -127,9 +127,6 @@ struct sym_node_struct{
dict_table_t* table; /* table definition
if a table id or a
column id */
- dict_proc_t* procedure_def; /* stored procedure
- definition, if a
- stored procedure name */
ulint col_no; /* column number if a
column */
sel_buf_t* prefetch_buf; /* NULL, or a buffer
diff --git a/innobase/include/pars0types.h b/innobase/include/pars0types.h
index e7471260501..9fbfd6efaa1 100644
--- a/innobase/include/pars0types.h
+++ b/innobase/include/pars0types.h
@@ -15,7 +15,6 @@ typedef struct pars_res_word_struct pars_res_word_t;
typedef struct func_node_struct func_node_t;
typedef struct order_node_struct order_node_t;
typedef struct proc_node_struct proc_node_t;
-typedef struct call_node_struct call_node_t;
typedef struct elsif_node_struct elsif_node_t;
typedef struct if_node_struct if_node_t;
typedef struct while_node_struct while_node_t;
diff --git a/innobase/include/rem0rec.h b/innobase/include/rem0rec.h
index ebdd3c1ac81..86bf263170f 100644
--- a/innobase/include/rem0rec.h
+++ b/innobase/include/rem0rec.h
@@ -390,16 +390,7 @@ Prints a physical record. */
void
rec_print(
/*======*/
- rec_t* rec); /* in: physical record */
-/*******************************************************************
-Prints a physical record to a buffer. */
-
-ulint
-rec_sprintf(
-/*========*/
- /* out: printed length in bytes */
- char* buf, /* in: buffer to print to */
- ulint buf_len,/* in: buffer length */
+ FILE* file, /* in: file where to print */
rec_t* rec); /* in: physical record */
#define REC_INFO_BITS 6 /* This is single byte bit-field */
diff --git a/innobase/include/rem0rec.ic b/innobase/include/rem0rec.ic
index f4acd8547db..c36bf8f6d6e 100644
--- a/innobase/include/rem0rec.ic
+++ b/innobase/include/rem0rec.ic
@@ -190,7 +190,7 @@ rec_set_bit_field_2(
+ (REC_N_OWNED_MASK << (8 * (REC_N_OWNED - 3)))
+ (REC_INFO_BITS_MASK << (8 * (REC_INFO_BITS - 3))));
if (m != ut_dbg_zero + 0xFFFFFFFFUL) {
- printf("Sum of masks %lx\n", m);
+ fprintf(stderr, "Sum of masks %lx\n", m);
ut_error;
}
}
diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h
index 32a0c8b5d75..0b9f34dda1e 100644
--- a/innobase/include/row0mysql.h
+++ b/innobase/include/row0mysql.h
@@ -161,6 +161,22 @@ row_lock_table_autoinc_for_mysql(
row_prebuilt_t* prebuilt); /* in: prebuilt struct in the MySQL
table handle */
/*************************************************************************
+Unlocks a table lock possibly reserved by trx. */
+
+void
+row_unlock_table_for_mysql(
+/*=======================*/
+ trx_t* trx); /* in: transaction */
+/*************************************************************************
+Sets a table lock on the table mentioned in prebuilt. */
+
+int
+row_lock_table_for_mysql(
+/*=====================*/
+ /* out: error code or DB_SUCCESS */
+ row_prebuilt_t* prebuilt); /* in: prebuilt struct in the MySQL
+ table handle */
+/*************************************************************************
Does an insert for MySQL. */
int
@@ -337,7 +353,9 @@ row_drop_table_for_mysql(
/*=====================*/
/* out: error code or DB_SUCCESS */
char* name, /* in: table name */
- trx_t* trx); /* in: transaction handle */
+ trx_t* trx, /* in: transaction handle */
+ ibool drop_db);/* in: TRUE=dropping whole database */
+
/*************************************************************************
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
diff --git a/innobase/include/row0sel.ic b/innobase/include/row0sel.ic
index 994638790c0..595cea1138b 100644
--- a/innobase/include/row0sel.ic
+++ b/innobase/include/row0sel.ic
@@ -77,12 +77,9 @@ open_step(
if (err != DB_SUCCESS) {
/* SQL error detected */
- printf("SQL error %lu\n", (unsigned long) err);
+ fprintf(stderr, "SQL error %lu\n", (ulong) err);
ut_error;
- que_thr_handle_error(thr, err, NULL, 0);
-
- return(NULL);
}
thr->run_node = que_node_get_parent(node);
diff --git a/innobase/include/row0uins.h b/innobase/include/row0uins.h
index df5e072487e..fc57881f691 100644
--- a/innobase/include/row0uins.h
+++ b/innobase/include/row0uins.h
@@ -26,8 +26,7 @@ ulint
row_undo_ins(
/*=========*/
/* out: DB_SUCCESS */
- undo_node_t* node, /* in: row undo node */
- que_thr_t* thr); /* in: query thread */
+ undo_node_t* node); /* in: row undo node */
#ifndef UNIV_NONINL
diff --git a/innobase/include/row0undo.h b/innobase/include/row0undo.h
index 5402f1d9236..d64a00dcb8f 100644
--- a/innobase/include/row0undo.h
+++ b/innobase/include/row0undo.h
@@ -41,8 +41,7 @@ row_undo_search_clust_to_pcur(
/* out: TRUE if found; NOTE the node->pcur
must be closed by the caller, regardless of
the return value */
- undo_node_t* node, /* in: row undo node */
- que_thr_t* thr); /* in: query thread */
+ undo_node_t* node); /* in: row undo node */
/***************************************************************
Undoes a row operation in a table. This is a high-level function used
in SQL execution graphs. */
diff --git a/innobase/include/row0upd.ic b/innobase/include/row0upd.ic
index 6b9deeac5e3..d89938d696a 100644
--- a/innobase/include/row0upd.ic
+++ b/innobase/include/row0upd.ic
@@ -84,10 +84,12 @@ upd_field_set_field_no(
if (field_no >= dict_index_get_n_fields(index)) {
fprintf(stderr,
- "InnoDB: Error: trying to access field %lu in table %s\n"
- "InnoDB: index %s, but index has only %lu fields\n",
- (unsigned long) field_no, index->table_name, index->name,
- (unsigned long) dict_index_get_n_fields(index));
+ "InnoDB: Error: trying to access field %lu in ",
+ (ulong) field_no);
+ dict_index_name_print(stderr, index);
+ fprintf(stderr, "\n"
+ "InnoDB: but index only has %lu fields\n",
+ (ulong) dict_index_get_n_fields(index));
}
dtype_copy(dfield_get_type(&(upd_field->new_val)),
diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h
index 8aac71de2a9..7f067c75466 100644
--- a/innobase/include/srv0srv.h
+++ b/innobase/include/srv0srv.h
@@ -32,6 +32,11 @@ at a time */
/* This is set to TRUE if the MySQL user has set it in MySQL */
extern ibool srv_lower_case_table_names;
+/* Mutex for locking srv_monitor_file */
+extern mutex_t srv_monitor_file_mutex;
+/* Temporary file for innodb monitor output */
+extern FILE* srv_monitor_file;
+
/* Server parameters which are read from the initfile */
extern char* srv_data_home;
@@ -162,8 +167,8 @@ extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
/* Array of English strings describing the current state of an
i/o handler thread */
-extern char* srv_io_thread_op_info[];
-extern char* srv_io_thread_function[];
+extern const char* srv_io_thread_op_info[];
+extern const char* srv_io_thread_function[];
typedef struct srv_sys_struct srv_sys_t;
@@ -241,6 +246,15 @@ srv_get_thread_type(void);
/*=====================*/
/* out: SRV_COM, ... */
/*************************************************************************
+Sets the info describing an i/o thread current state. */
+
+void
+srv_set_io_thread_op_info(
+/*======================*/
+ ulint i, /* in: the 'segment' of the i/o thread */
+ const char* str); /* in: constant char string describing the
+ state */
+/*************************************************************************
Releases threads of the type given from suspension in the thread table.
NOTE! The server mutex has to be reserved by the caller! */
@@ -366,13 +380,12 @@ srv_error_monitor_thread(
void* arg); /* in: a dummy parameter required by
os_thread_create */
/**********************************************************************
-Sprintfs to a buffer the output of the InnoDB Monitor. */
+Outputs to a file the output of the InnoDB Monitor. */
void
-srv_sprintf_innodb_monitor(
-/*=======================*/
- char* buf, /* in/out: buffer which must be at least 4 kB */
- ulint len); /* in: length of the buffer */
+srv_printf_innodb_monitor(
+/*======================*/
+ FILE* file); /* in: output stream */
/* Types for the threads existing in the system. Threads of types 4 - 9
diff --git a/innobase/include/sync0arr.h b/innobase/include/sync0arr.h
index 765ad33afea..383d0c69fb2 100644
--- a/innobase/include/sync0arr.h
+++ b/innobase/include/sync0arr.h
@@ -114,8 +114,7 @@ Prints info of the wait array. */
void
sync_array_print_info(
/*==================*/
- char* buf, /* in/out: buffer where to print */
- char* buf_end,/* in: buffer end */
+ FILE* file, /* in: file where to print */
sync_array_t* arr); /* in: wait array */
diff --git a/innobase/include/sync0rw.h b/innobase/include/sync0rw.h
index d71691b4353..82123a529a3 100644
--- a/innobase/include/sync0rw.h
+++ b/innobase/include/sync0rw.h
@@ -85,6 +85,7 @@ void
rw_lock_free(
/*=========*/
rw_lock_t* lock); /* in: rw-lock */
+#ifdef UNIV_DEBUG
/**********************************************************************
Checks that the rw-lock has been initialized and that there are no
simultaneous shared and exclusive locks. */
@@ -93,6 +94,7 @@ ibool
rw_lock_validate(
/*=============*/
rw_lock_t* lock);
+#endif /* UNIV_DEBUG */
/******************************************************************
NOTE! The following macros should be used in rw s-locking, not the
corresponding function. */
diff --git a/innobase/include/sync0sync.h b/innobase/include/sync0sync.h
index 3a7203bbb56..0cc48d5f299 100644
--- a/innobase/include/sync0sync.h
+++ b/innobase/include/sync0sync.h
@@ -65,6 +65,15 @@ NOTE! The following macro should be used in mutex locking, not the
corresponding function. */
#define mutex_enter(M) mutex_enter_func((M), IB__FILE__, __LINE__)
+/**********************************************************************
+A noninlined function that reserves a mutex. In ha_innodb.cc we have disabled
+inlining of InnoDB functions, and no inlined functions should be called from
+there. That is why we need to duplicate the inlined function here. */
+
+void
+mutex_enter_noninline(
+/*==================*/
+ mutex_t* mutex); /* in: mutex */
/******************************************************************
NOTE! The following macro should be used in mutex locking, not the
corresponding function. */
@@ -105,6 +114,13 @@ mutex_exit(
/*=======*/
mutex_t* mutex); /* in: pointer to mutex */
/**********************************************************************
+Releases a mutex. */
+
+void
+mutex_exit_noninline(
+/*=================*/
+ mutex_t* mutex); /* in: mutex */
+/**********************************************************************
Returns TRUE if no mutex or rw-lock is currently locked.
Works only in the debug version. */
@@ -119,16 +135,15 @@ Prints wait info of the sync system. */
void
sync_print_wait_info(
/*=================*/
- char* buf, /* in/out: buffer where to print */
- char* buf_end); /* in: buffer end */
+ FILE* file); /* in: file where to print */
/***********************************************************************
Prints info of the sync system. */
void
sync_print(
/*=======*/
- char* buf, /* in/out: buffer where to print */
- char* buf_end); /* in: buffer end */
+ FILE* file); /* in: file where to print */
+#ifdef UNIV_DEBUG
/**********************************************************************
Checks that the mutex has been initialized. */
@@ -136,6 +151,7 @@ ibool
mutex_validate(
/*===========*/
mutex_t* mutex);
+#endif /* UNIV_DEBUG */
/**********************************************************************
Sets the mutex latching level field. */
@@ -202,7 +218,7 @@ void
mutex_get_debug_info(
/*=================*/
mutex_t* mutex, /* in: mutex */
- char** file_name, /* out: file where requested */
+ const char** file_name, /* out: file where requested */
ulint* line, /* out: line where requested */
os_thread_id_t* thread_id); /* out: id of the thread which owns
the mutex */
diff --git a/innobase/include/trx0sys.h b/innobase/include/trx0sys.h
index 0005c4a1711..9987955ec76 100644
--- a/innobase/include/trx0sys.h
+++ b/innobase/include/trx0sys.h
@@ -270,8 +270,9 @@ the magic number shows it valid. */
void
trx_sys_print_mysql_binlog_offset(void);
/*===================================*/
+#ifdef UNIV_HOTBACKUP
/*********************************************************************
-Prints to stdout the MySQL binlog info in the system header if the
+Prints to stderr the MySQL binlog info in the system header if the
magic number shows it valid. */
void
@@ -279,6 +280,7 @@ trx_sys_print_mysql_binlog_offset_from_page(
/*========================================*/
byte* page); /* in: buffer containing the trx system header page,
i.e., page number TRX_SYS_PAGE_NO in the tablespace */
+#endif /* UNIV_HOTBACKUP */
/*********************************************************************
Prints to stderr the MySQL master log offset info in the trx system header if
the magic number shows it valid. */
diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h
index d9b91ee62dc..71269cb1e4e 100644
--- a/innobase/include/trx0trx.h
+++ b/innobase/include/trx0trx.h
@@ -280,8 +280,7 @@ own the kernel mutex. */
void
trx_print(
/*======*/
- char* buf, /* in/out: buffer where to print, must be at least
- 800 bytes */
+ FILE* f, /* in: output stream */
trx_t* trx); /* in: transaction */
@@ -422,6 +421,8 @@ struct trx_struct{
lock_t* auto_inc_lock; /* possible auto-inc lock reserved by
the transaction; note that it is also
in the lock list trx_locks */
+ ulint n_tables_locked;/* number of table locks reserved by
+ the transaction, stored in trx_locks */
UT_LIST_NODE_T(trx_t)
trx_list; /* list of transactions */
UT_LIST_NODE_T(trx_t)
diff --git a/innobase/include/ut0byte.h b/innobase/include/ut0byte.h
index 4274956421e..fed6a23d144 100644
--- a/innobase/include/ut0byte.h
+++ b/innobase/include/ut0byte.h
@@ -235,21 +235,19 @@ Copies a string to a memory location, setting characters to lower case. */
void
ut_cpy_in_lower_case(
/*=================*/
- char* dest, /* in: destination */
- char* source, /* in: source */
- ulint len); /* in: string length */
+ char* dest, /* in: destination */
+ const char* source, /* in: source */
+ ulint len); /* in: string length */
/****************************************************************
Compares two strings when converted to lower case. */
int
ut_cmp_in_lower_case(
/*=================*/
- /* out: -1, 0, 1 if str1 < str2, str1 == str2,
- str1 > str2, respectively */
- char* str1, /* in: string1 */
- char* str2, /* in: string2 */
- ulint len); /* in: length of both strings */
-
+ /* out: -1, 0, 1 if str1 < str2, str1 == str2,
+ str1 > str2, respectively */
+ const char* str1, /* in: string1 */
+ const char* str2); /* in: string2 */
#ifndef UNIV_NONINL
#include "ut0byte.ic"
diff --git a/innobase/include/ut0mem.h b/innobase/include/ut0mem.h
index b7dfe77a08e..b208fac8691 100644
--- a/innobase/include/ut0mem.h
+++ b/innobase/include/ut0mem.h
@@ -86,6 +86,39 @@ int
ut_strcmp(void* str1, void* str2);
/**************************************************************************
+Determine the length of a string when it is quoted with ut_strcpyq(). */
+UNIV_INLINE
+ulint
+ut_strlenq(
+/*=======*/
+ /* out: length of the string when quoted */
+ const char* str, /* in: null-terminated string */
+ char q); /* in: the quote character */
+
+/**************************************************************************
+Make a quoted copy of a string. */
+
+char*
+ut_strcpyq(
+/*=======*/
+ /* out: pointer to end of dest */
+ char* dest, /* in: output buffer */
+ char q, /* in: the quote character */
+ const char* src); /* in: null-terminated string */
+
+/**************************************************************************
+Make a quoted copy of a fixed-length string. */
+
+char*
+ut_memcpyq(
+/*=======*/
+ /* out: pointer to end of dest */
+ char* dest, /* in: output buffer */
+ char q, /* in: the quote character */
+ const char* src, /* in: string to be quoted */
+ ulint len); /* in: length of src */
+
+/**************************************************************************
Catenates two strings into newly allocated memory. The memory must be freed
using mem_free. */
@@ -95,6 +128,7 @@ ut_str_catenate(
/* out, own: catenated null-terminated string */
char* str1, /* in: null-terminated string */
char* str2); /* in: null-terminated string */
+
/**************************************************************************
Return a copy of the given string. The returned string must be freed
using mem_free. */
@@ -104,14 +138,6 @@ ut_strdup(
/*======*/
/* out, own: cnull-terminated string */
char* str); /* in: null-terminated string */
-/**************************************************************************
-Checks if a null-terminated string contains a certain character. */
-
-ibool
-ut_str_contains(
-/*============*/
- char* str, /* in: null-terminated string */
- char c); /* in: character */
#ifndef UNIV_NONINL
#include "ut0mem.ic"
diff --git a/innobase/include/ut0mem.ic b/innobase/include/ut0mem.ic
index 1049aee8ecc..951d9538424 100644
--- a/innobase/include/ut0mem.ic
+++ b/innobase/include/ut0mem.ic
@@ -48,3 +48,23 @@ ut_strcmp(void* str1, void* str2)
return(strcmp((char*)str1, (char*)str2));
}
+/**************************************************************************
+Determine the length of a string when it is quoted with ut_strcpyq(). */
+UNIV_INLINE
+ulint
+ut_strlenq(
+/*=======*/
+ /* out: length of the string when quoted */
+ const char* str, /* in: null-terminated string */
+ char q) /* in: the quote character */
+{
+ ulint len;
+
+ for (len = 0; *str; len++, str++) {
+ if (*str == q) {
+ len++;
+ }
+ }
+
+ return(len);
+}
diff --git a/innobase/include/ut0ut.h b/innobase/include/ut0ut.h
index 4517b8f8d40..6c173f5cba9 100644
--- a/innobase/include/ut0ut.h
+++ b/innobase/include/ut0ut.h
@@ -61,7 +61,9 @@ ut_fprintf(
negative in case of an error */
FILE* stream, /* in: stream where to print */
const char* format, /* in: format of prints */
- ...); /* in: arguments to be printed */
+ ...) /* in: arguments to be printed */
+ __attribute__((__format__ (__printf__, 2, 3)));
+
/************************************************************
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
but since there seem to be compiler bugs in both gcc and Visual C++,
@@ -200,7 +202,7 @@ ut_print_timestamp(
/*===============*/
FILE* file); /* in: file where to print */
/**************************************************************
-Sprintfs a timestamp to a buffer. */
+Sprintfs a timestamp to a buffer, 13..14 chars plus terminating NUL. */
void
ut_sprintf_timestamp(
@@ -238,19 +240,37 @@ Prints the contents of a memory buffer in hex and ascii. */
void
ut_print_buf(
/*=========*/
- byte* buf, /* in: memory buffer */
- ulint len); /* in: length of the buffer */
-/*****************************************************************
-Prints the contents of a memory buffer in hex and ascii. */
+ FILE* file, /* in: file where to print */
+ const byte* buf, /* in: memory buffer */
+ ulint len); /* in: length of the buffer */
-ulint
-ut_sprintf_buf(
-/*===========*/
- /* out: printed length in bytes */
- char* str, /* in: buffer to print to */
- byte* buf, /* in: memory buffer */
- ulint len); /* in: length of the buffer */
+/**************************************************************************
+Outputs a NUL-terminated string, quoted as an SQL identifier. */
+
+void
+ut_print_name(
+/*==========*/
+ FILE* f, /* in: output stream */
+ const char* name); /* in: name to print */
+/**************************************************************************
+Outputs a fixed-length string, quoted as an SQL identifier. */
+
+void
+ut_print_namel(
+/*==========*/
+ FILE* f, /* in: output stream */
+ const char* name, /* in: name to print */
+ ulint namelen);/* in: length of name */
+
+/**************************************************************************
+Catenate files. */
+
+void
+ut_copy_file(
+/*=========*/
+ FILE* dest, /* in: output file */
+ FILE* src); /* in: input file to be appended to output */
#ifndef UNIV_NONINL
#include "ut0ut.ic"