mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
Merge bk-internal:/home/bk/mysql-5.1-new-maint
into neptunus.(none):/home/msvensson/mysql/mysql-5.1-new-maint
This commit is contained in:
commit
4fbdbf1a4c
23 changed files with 117 additions and 148 deletions
|
@ -342,12 +342,6 @@ SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#17530: Incorrect key truncation on table creation caused server crash.
|
|
||||||
#
|
|
||||||
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
|
|
||||||
character set utf8 collate utf8_general_ci;
|
|
||||||
insert into t1 values('aaa');
|
|
||||||
drop table t1;
|
|
||||||
# Test of behaviour with CREATE ... SELECT
|
# Test of behaviour with CREATE ... SELECT
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -300,12 +300,6 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 index NULL fkey 5 NULL 5 Using index
|
1 SIMPLE t2 index NULL fkey 5 NULL 5 Using index
|
||||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where
|
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
|
|
||||||
character set utf8 collate utf8_general_ci;
|
|
||||||
Warnings:
|
|
||||||
Warning 1071 Specified key was too long; max key length is 765 bytes
|
|
||||||
insert into t1 values('aaa');
|
|
||||||
drop table t1;
|
|
||||||
CREATE TABLE t1 (a int, b int);
|
CREATE TABLE t1 (a int, b int);
|
||||||
insert into t1 values (1,1),(1,2);
|
insert into t1 values (1,1),(1,2);
|
||||||
CREATE TABLE t2 (primary key (a)) select * from t1;
|
CREATE TABLE t2 (primary key (a)) select * from t1;
|
||||||
|
|
|
@ -284,7 +284,7 @@ end:
|
||||||
thd->clear_error();
|
thd->clear_error();
|
||||||
|
|
||||||
/* Such a statement can always go directly to binlog, no trans cache. */
|
/* Such a statement can always go directly to binlog, no trans cache. */
|
||||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||||
stmt_query.ptr(), stmt_query.length(), FALSE, FALSE);
|
stmt_query.ptr(), stmt_query.length(), FALSE, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -577,7 +577,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
|
||||||
List_iterator_fast<LEX_STRING> names(lex->view_list);
|
List_iterator_fast<LEX_STRING> names(lex->view_list);
|
||||||
LEX_STRING *name;
|
LEX_STRING *name;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i= 0; name= names++; i++)
|
for (i= 0; name= names++; i++)
|
||||||
{
|
{
|
||||||
buff.append(i ? ", " : "(");
|
buff.append(i ? ", " : "(");
|
||||||
|
@ -1417,6 +1417,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
|
||||||
query_cache_invalidate3(thd, view, 0);
|
query_cache_invalidate3(thd, view, 0);
|
||||||
sp_cache_invalidate();
|
sp_cache_invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mysql_bin_log.is_open())
|
if (mysql_bin_log.is_open())
|
||||||
{
|
{
|
||||||
thd->clear_error();
|
thd->clear_error();
|
||||||
|
@ -1424,24 +1425,34 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
|
||||||
thd->query, thd->query_length, FALSE, FALSE);
|
thd->query, thd->query_length, FALSE, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
|
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
if (wrong_object_name)
|
if (wrong_object_name)
|
||||||
{
|
{
|
||||||
|
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||||
my_error(ER_WRONG_OBJECT, MYF(0), wrong_object_db, wrong_object_name,
|
my_error(ER_WRONG_OBJECT, MYF(0), wrong_object_db, wrong_object_name,
|
||||||
"VIEW");
|
"VIEW");
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
if (non_existant_views.length())
|
if (non_existant_views.length())
|
||||||
{
|
{
|
||||||
|
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||||
my_error(ER_BAD_TABLE_ERROR, MYF(0), non_existant_views.c_ptr());
|
my_error(ER_BAD_TABLE_ERROR, MYF(0), non_existant_views.c_ptr());
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mysql_bin_log.is_open())
|
||||||
|
{
|
||||||
|
thd->clear_error();
|
||||||
|
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||||
|
thd->query, thd->query_length, FALSE, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
|
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ terribly wrong...\n");
|
||||||
|
|
||||||
#if defined(__alpha__) && defined(__GNUC__)
|
#if defined(__alpha__) && defined(__GNUC__)
|
||||||
uchar** new_fp = find_prev_fp(pc, fp);
|
uchar** new_fp = find_prev_fp(pc, fp);
|
||||||
if (frame_count == SIGRETURN_FRAME_COUNT - 1)
|
if (frame_count == sigreturn_frame_count - 1)
|
||||||
{
|
{
|
||||||
new_fp += 90;
|
new_fp += 90;
|
||||||
}
|
}
|
||||||
|
|
|
@ -571,9 +571,6 @@ btr_page_get_father_for_rec(
|
||||||
tuple = dict_index_build_node_ptr(index, user_rec, 0, heap,
|
tuple = dict_index_build_node_ptr(index, user_rec, 0, heap,
|
||||||
btr_page_get_level(page, mtr));
|
btr_page_get_level(page, mtr));
|
||||||
|
|
||||||
/* In the following, we choose just any index from the tree as the
|
|
||||||
first parameter for btr_cur_search_to_nth_level. */
|
|
||||||
|
|
||||||
btr_cur_search_to_nth_level(index,
|
btr_cur_search_to_nth_level(index,
|
||||||
btr_page_get_level(page, mtr) + 1,
|
btr_page_get_level(page, mtr) + 1,
|
||||||
tuple, PAGE_CUR_LE,
|
tuple, PAGE_CUR_LE,
|
||||||
|
|
|
@ -3547,6 +3547,7 @@ syntax_error:
|
||||||
|
|
||||||
/*==================== END OF FOREIGN KEY PROCESSING ====================*/
|
/*==================== END OF FOREIGN KEY PROCESSING ====================*/
|
||||||
|
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Returns an index object if it is found in the dictionary cache. */
|
Returns an index object if it is found in the dictionary cache. */
|
||||||
|
|
||||||
|
@ -3556,7 +3557,6 @@ dict_index_get_if_in_cache(
|
||||||
/* out: index, NULL if not found */
|
/* out: index, NULL if not found */
|
||||||
dulint index_id) /* in: index id */
|
dulint index_id) /* in: index id */
|
||||||
{
|
{
|
||||||
dict_table_t* table;
|
|
||||||
dict_index_t* index;
|
dict_index_t* index;
|
||||||
|
|
||||||
if (dict_sys == NULL) {
|
if (dict_sys == NULL) {
|
||||||
|
@ -3565,29 +3565,13 @@ dict_index_get_if_in_cache(
|
||||||
|
|
||||||
mutex_enter(&(dict_sys->mutex));
|
mutex_enter(&(dict_sys->mutex));
|
||||||
|
|
||||||
table = UT_LIST_GET_FIRST(dict_sys->table_LRU);
|
index = dict_index_find_on_id_low(index_id);
|
||||||
|
|
||||||
while (table) {
|
|
||||||
index = UT_LIST_GET_FIRST(table->indexes);
|
|
||||||
|
|
||||||
while (index) {
|
|
||||||
if (0 == ut_dulint_cmp(index->id, index_id)) {
|
|
||||||
|
|
||||||
goto found;
|
|
||||||
}
|
|
||||||
|
|
||||||
index = UT_LIST_GET_NEXT(indexes, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
table = UT_LIST_GET_NEXT(table_LRU, table);
|
|
||||||
}
|
|
||||||
|
|
||||||
index = NULL;
|
|
||||||
found:
|
|
||||||
mutex_exit(&(dict_sys->mutex));
|
mutex_exit(&(dict_sys->mutex));
|
||||||
|
|
||||||
return(index);
|
return(index);
|
||||||
}
|
}
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
|
||||||
#ifdef UNIV_DEBUG
|
#ifdef UNIV_DEBUG
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -4162,18 +4146,8 @@ dict_print_info_on_foreign_key_in_create_format(
|
||||||
dict_remove_db_name(
|
dict_remove_db_name(
|
||||||
foreign->referenced_table_name));
|
foreign->referenced_table_name));
|
||||||
} else {
|
} else {
|
||||||
/* Look for the '/' in the table name */
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (foreign->referenced_table_name[i] != '/') {
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
ut_print_namel(file, trx, TRUE,
|
|
||||||
foreign->referenced_table_name, i);
|
|
||||||
putc('.', file);
|
|
||||||
ut_print_name(file, trx, TRUE,
|
ut_print_name(file, trx, TRUE,
|
||||||
foreign->referenced_table_name + i + 1);
|
foreign->referenced_table_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
putc(' ', file);
|
putc(' ', file);
|
||||||
|
|
|
@ -6630,7 +6630,7 @@ innodb_mutex_show_status(
|
||||||
mutex->count_spin_rounds,
|
mutex->count_spin_rounds,
|
||||||
mutex->count_os_wait,
|
mutex->count_os_wait,
|
||||||
mutex->count_os_yield,
|
mutex->count_os_yield,
|
||||||
mutex->lspent_time/1000);
|
(ulong) mutex->lspent_time/1000);
|
||||||
|
|
||||||
if (stat_print(thd, innobase_hton_name,
|
if (stat_print(thd, innobase_hton_name,
|
||||||
hton_name_len, buf1, buf1len,
|
hton_name_len, buf1, buf1len,
|
||||||
|
@ -6660,7 +6660,7 @@ innodb_mutex_show_status(
|
||||||
rw_lock_count, rw_lock_count_spin_loop,
|
rw_lock_count, rw_lock_count_spin_loop,
|
||||||
rw_lock_count_spin_rounds,
|
rw_lock_count_spin_rounds,
|
||||||
rw_lock_count_os_wait, rw_lock_count_os_yield,
|
rw_lock_count_os_wait, rw_lock_count_os_yield,
|
||||||
rw_lock_wait_time/1000);
|
(ulong) rw_lock_wait_time/1000);
|
||||||
|
|
||||||
if (stat_print(thd, innobase_hton_name, hton_name_len,
|
if (stat_print(thd, innobase_hton_name, hton_name_len,
|
||||||
STRING_WITH_LEN("rw_lock_mutexes"), buf2, buf2len)) {
|
STRING_WITH_LEN("rw_lock_mutexes"), buf2, buf2len)) {
|
||||||
|
@ -6812,7 +6812,8 @@ ha_innobase::store_lock(
|
||||||
&& lock_type != TL_IGNORE)) {
|
&& lock_type != TL_IGNORE)) {
|
||||||
|
|
||||||
/* The OR cases above are in this order:
|
/* The OR cases above are in this order:
|
||||||
1) MySQL is doing LOCK TABLES ... READ LOCAL, or
|
1) MySQL is doing LOCK TABLES ... READ LOCAL, or we
|
||||||
|
are processing a stored procedure or function, or
|
||||||
2) (we do not know when TL_READ_HIGH_PRIORITY is used), or
|
2) (we do not know when TL_READ_HIGH_PRIORITY is used), or
|
||||||
3) this is a SELECT ... IN SHARE MODE, or
|
3) this is a SELECT ... IN SHARE MODE, or
|
||||||
4) we are doing a complex SQL statement like
|
4) we are doing a complex SQL statement like
|
||||||
|
@ -6880,7 +6881,8 @@ ha_innobase::store_lock(
|
||||||
single transaction stored procedure call deterministic
|
single transaction stored procedure call deterministic
|
||||||
(if it does not use a consistent read). */
|
(if it does not use a consistent read). */
|
||||||
|
|
||||||
if (lock_type == TL_READ && thd->in_lock_tables) {
|
if (lock_type == TL_READ
|
||||||
|
&& thd->lex->sql_command == SQLCOM_LOCK_TABLES) {
|
||||||
/* We come here if MySQL is processing LOCK TABLES
|
/* We come here if MySQL is processing LOCK TABLES
|
||||||
... READ LOCAL. MyISAM under that table lock type
|
... READ LOCAL. MyISAM under that table lock type
|
||||||
reads the table as it was at the time the lock was
|
reads the table as it was at the time the lock was
|
||||||
|
@ -6939,8 +6941,7 @@ ha_innobase::store_lock(
|
||||||
(MySQL does have thd->in_lock_tables TRUE there). */
|
(MySQL does have thd->in_lock_tables TRUE there). */
|
||||||
|
|
||||||
if (lock_type == TL_READ_NO_INSERT
|
if (lock_type == TL_READ_NO_INSERT
|
||||||
&& (!thd->in_lock_tables
|
&& thd->lex->sql_command != SQLCOM_LOCK_TABLES) {
|
||||||
|| thd->lex->sql_command == SQLCOM_CALL)) {
|
|
||||||
|
|
||||||
lock_type = TL_READ;
|
lock_type = TL_READ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -778,9 +778,8 @@ const dict_col_t*
|
||||||
dict_field_get_col(
|
dict_field_get_col(
|
||||||
/*===============*/
|
/*===============*/
|
||||||
const dict_field_t* field);
|
const dict_field_t* field);
|
||||||
/**************************************************************************
|
|
||||||
In an index tree, finds the index corresponding to a record in the tree. */
|
|
||||||
|
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Returns an index object if it is found in the dictionary cache. */
|
Returns an index object if it is found in the dictionary cache. */
|
||||||
|
|
||||||
|
@ -789,7 +788,6 @@ dict_index_get_if_in_cache(
|
||||||
/*=======================*/
|
/*=======================*/
|
||||||
/* out: index, NULL if not found */
|
/* out: index, NULL if not found */
|
||||||
dulint index_id); /* in: index id */
|
dulint index_id); /* in: index id */
|
||||||
#ifdef UNIV_DEBUG
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Checks that a tuple has n_fields_cmp value in a sensible range, so that
|
Checks that a tuple has n_fields_cmp value in a sensible range, so that
|
||||||
no comparison can occur with the page number field in a node pointer. */
|
no comparison can occur with the page number field in a node pointer. */
|
||||||
|
|
|
@ -30,6 +30,7 @@ check fields at the both ends of the field. */
|
||||||
#define MEM_SPACE_NEEDED(N) ut_calc_align((N), UNIV_MEM_ALIGNMENT)
|
#define MEM_SPACE_NEEDED(N) ut_calc_align((N), UNIV_MEM_ALIGNMENT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined UNIV_MEM_DEBUG || defined UNIV_DEBUG
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
Checks a memory heap for consistency and prints the contents if requested.
|
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
|
Outputs the sum of sizes of buffers given to the user (only in
|
||||||
|
@ -59,15 +60,8 @@ mem_heap_validate_or_print(
|
||||||
ulint* n_blocks); /* out: number of blocks in the heap,
|
ulint* n_blocks); /* out: number of blocks in the heap,
|
||||||
if a NULL pointer is passed as this
|
if a NULL pointer is passed as this
|
||||||
argument, it is ignored */
|
argument, it is ignored */
|
||||||
#ifdef UNIV_MEM_DEBUG
|
#endif /* UNIV_MEM_DEBUG || UNIV_DEBUG */
|
||||||
/******************************************************************
|
#ifdef UNIV_DEBUG
|
||||||
Prints the contents of a memory heap. */
|
|
||||||
|
|
||||||
void
|
|
||||||
mem_heap_print(
|
|
||||||
/*===========*/
|
|
||||||
mem_heap_t* heap); /* in: memory heap */
|
|
||||||
#endif /* UNIV_MEM_DEBUG */
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
Checks that an object is a memory heap (or a block of it) */
|
Checks that an object is a memory heap (or a block of it) */
|
||||||
|
|
||||||
|
@ -76,6 +70,7 @@ mem_heap_check(
|
||||||
/*===========*/
|
/*===========*/
|
||||||
/* out: TRUE if ok */
|
/* out: TRUE if ok */
|
||||||
mem_heap_t* heap); /* in: memory heap */
|
mem_heap_t* heap); /* in: memory heap */
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
Validates the contents of a memory heap. */
|
Validates the contents of a memory heap. */
|
||||||
|
|
||||||
|
|
|
@ -265,6 +265,7 @@ mtr_memo_release(
|
||||||
mtr_t* mtr, /* in: mtr */
|
mtr_t* mtr, /* in: mtr */
|
||||||
void* object, /* in: object */
|
void* object, /* in: object */
|
||||||
ulint type); /* in: object type: MTR_MEMO_S_LOCK, ... */
|
ulint type); /* in: object type: MTR_MEMO_S_LOCK, ... */
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
Checks if memo contains the given item. */
|
Checks if memo contains the given item. */
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
|
@ -282,6 +283,7 @@ void
|
||||||
mtr_print(
|
mtr_print(
|
||||||
/*======*/
|
/*======*/
|
||||||
mtr_t* mtr); /* in: mtr */
|
mtr_t* mtr); /* in: mtr */
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
/*######################################################################*/
|
/*######################################################################*/
|
||||||
|
|
||||||
#define MTR_BUF_MEMO_SIZE 200 /* number of slots in memo */
|
#define MTR_BUF_MEMO_SIZE 200 /* number of slots in memo */
|
||||||
|
|
|
@ -113,6 +113,7 @@ mtr_release_s_latch_at_savepoint(
|
||||||
slot->object = NULL;
|
slot->object = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
Checks if memo contains the given item. */
|
Checks if memo contains the given item. */
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
|
@ -148,6 +149,7 @@ mtr_memo_contains(
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
Returns the log object of a mini-transaction buffer. */
|
Returns the log object of a mini-transaction buffer. */
|
||||||
|
|
|
@ -358,8 +358,9 @@ rw_lock_print(
|
||||||
Prints debug info of currently locked rw-locks. */
|
Prints debug info of currently locked rw-locks. */
|
||||||
|
|
||||||
void
|
void
|
||||||
rw_lock_list_print_info(void);
|
rw_lock_list_print_info(
|
||||||
/*=========================*/
|
/*====================*/
|
||||||
|
FILE* file); /* in: file where to print */
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
Returns the number of currently locked rw-locks.
|
Returns the number of currently locked rw-locks.
|
||||||
Works only in the debug version. */
|
Works only in the debug version. */
|
||||||
|
|
|
@ -224,12 +224,6 @@ Counts currently reserved mutexes. Works only in the debug version. */
|
||||||
ulint
|
ulint
|
||||||
mutex_n_reserved(void);
|
mutex_n_reserved(void);
|
||||||
/*==================*/
|
/*==================*/
|
||||||
/**********************************************************************
|
|
||||||
Prints debug info of currently reserved mutexes. */
|
|
||||||
|
|
||||||
void
|
|
||||||
mutex_list_print_info(void);
|
|
||||||
/*========================*/
|
|
||||||
#endif /* UNIV_SYNC_DEBUG */
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
NOT to be used outside this module except in debugging! Gets the value
|
NOT to be used outside this module except in debugging! Gets the value
|
||||||
|
|
|
@ -10,18 +10,18 @@ Created 1/20/1994 Heikki Tuuri
|
||||||
#define univ_i
|
#define univ_i
|
||||||
|
|
||||||
#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__)
|
#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__)
|
||||||
#undef __WIN__
|
# undef __WIN__
|
||||||
#define __WIN__
|
# define __WIN__
|
||||||
|
|
||||||
#include <windows.h>
|
# include <windows.h>
|
||||||
|
|
||||||
#if !defined(WIN64) && !defined(_WIN64)
|
# if !defined(WIN64) && !defined(_WIN64)
|
||||||
#define UNIV_CAN_USE_X86_ASSEMBLER
|
# define UNIV_CAN_USE_X86_ASSEMBLER
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#ifdef _NT_
|
# ifdef _NT_
|
||||||
#define __NT__
|
# define __NT__
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* The defines used with MySQL */
|
/* The defines used with MySQL */
|
||||||
|
@ -30,42 +30,33 @@ Created 1/20/1994 Heikki Tuuri
|
||||||
in compiling more Posix-compatible. These headers also define __WIN__
|
in compiling more Posix-compatible. These headers also define __WIN__
|
||||||
if we are compiling on Windows. */
|
if we are compiling on Windows. */
|
||||||
|
|
||||||
#include <my_global.h>
|
# include <my_global.h>
|
||||||
#include <my_pthread.h>
|
# include <my_pthread.h>
|
||||||
|
|
||||||
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
|
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
|
||||||
#include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
|
|
||||||
#undef PACKAGE
|
# undef PACKAGE
|
||||||
#undef VERSION
|
# undef VERSION
|
||||||
|
|
||||||
/* Include the header file generated by GNU autoconf */
|
/* Include the header file generated by GNU autoconf */
|
||||||
#ifndef __WIN__
|
# include "config.h"
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SCHED_H
|
# ifdef HAVE_SCHED_H
|
||||||
#include <sched.h>
|
# include <sched.h>
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
/* When compiling for Itanium IA64, undefine the flag below to prevent use
|
|
||||||
of the 32-bit x86 assembler in mutex operations. */
|
|
||||||
|
|
||||||
#if defined(__WIN__) && !defined(WIN64) && !defined(_WIN64)
|
|
||||||
#define UNIV_CAN_USE_X86_ASSEMBLER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We only try to do explicit inlining of functions with gcc and
|
/* We only try to do explicit inlining of functions with gcc and
|
||||||
Microsoft Visual C++ */
|
Microsoft Visual C++ */
|
||||||
|
|
||||||
#if !defined(__GNUC__) && !defined(__WIN__)
|
# if !defined(__GNUC__)
|
||||||
#undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */
|
# undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */
|
||||||
#define UNIV_MUST_NOT_INLINE
|
# define UNIV_MUST_NOT_INLINE
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#ifdef HAVE_PREAD
|
# ifdef HAVE_PREAD
|
||||||
#define HAVE_PWRITE
|
# define HAVE_PWRITE
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#endif /* #if (defined(WIN32) || ... */
|
#endif /* #if (defined(WIN32) || ... */
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,10 @@ ut_print_filename(
|
||||||
struct trx_struct;
|
struct trx_struct;
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Outputs a NUL-terminated string, quoted as an SQL identifier. */
|
Outputs a fixed-length string, quoted as an SQL identifier.
|
||||||
|
If the string contains a slash '/', the string will be
|
||||||
|
output as two identifiers separated by a period (.),
|
||||||
|
as in SQL database_name.identifier. */
|
||||||
|
|
||||||
void
|
void
|
||||||
ut_print_name(
|
ut_print_name(
|
||||||
|
@ -230,7 +233,10 @@ ut_print_name(
|
||||||
const char* name); /* in: name to print */
|
const char* name); /* in: name to print */
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Outputs a fixed-length string, quoted as an SQL identifier. */
|
Outputs a fixed-length string, quoted as an SQL identifier.
|
||||||
|
If the string contains a slash '/', the string will be
|
||||||
|
output as two identifiers separated by a period (.),
|
||||||
|
as in SQL database_name.identifier. */
|
||||||
|
|
||||||
void
|
void
|
||||||
ut_print_namel(
|
ut_print_namel(
|
||||||
|
|
|
@ -66,7 +66,6 @@ mem_hash_get_nth_cell(ulint i)
|
||||||
|
|
||||||
return(&(mem_hash_table[i]));
|
return(&(mem_hash_table[i]));
|
||||||
}
|
}
|
||||||
#endif /* UNIV_MEM_DEBUG */
|
|
||||||
|
|
||||||
/* Accessor functions for a memory field in the debug version */
|
/* Accessor functions for a memory field in the debug version */
|
||||||
|
|
||||||
|
@ -106,6 +105,7 @@ mem_field_trailer_get_check(byte* field)
|
||||||
return(mach_read_from_4(field
|
return(mach_read_from_4(field
|
||||||
+ mem_field_header_get_len(field)));
|
+ mem_field_header_get_len(field)));
|
||||||
}
|
}
|
||||||
|
#endif /* UNIV_MEM_DEBUG */
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Initializes the memory system. */
|
Initializes the memory system. */
|
||||||
|
@ -136,6 +136,7 @@ mem_init(
|
||||||
mem_comm_pool = mem_pool_create(size);
|
mem_comm_pool = mem_pool_create(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef UNIV_MEM_DEBUG
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Initializes an allocated memory field in the debug version. */
|
Initializes an allocated memory field in the debug version. */
|
||||||
|
|
||||||
|
@ -163,7 +164,6 @@ mem_field_init(
|
||||||
mem_field_header_set_check(usr_buf, rnd);
|
mem_field_header_set_check(usr_buf, rnd);
|
||||||
mem_field_trailer_set_check(usr_buf, rnd);
|
mem_field_trailer_set_check(usr_buf, rnd);
|
||||||
|
|
||||||
#ifdef UNIV_MEM_DEBUG
|
|
||||||
/* Update the memory allocation information */
|
/* Update the memory allocation information */
|
||||||
|
|
||||||
mutex_enter(&mem_hash_mutex);
|
mutex_enter(&mem_hash_mutex);
|
||||||
|
@ -182,7 +182,6 @@ mem_field_init(
|
||||||
combination of 0xBA and 0xBE */
|
combination of 0xBA and 0xBE */
|
||||||
|
|
||||||
mem_init_buf(usr_buf, n);
|
mem_init_buf(usr_buf, n);
|
||||||
#endif /* UNIV_MEM_DEBUG */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
@ -199,7 +198,6 @@ mem_field_erase(
|
||||||
|
|
||||||
usr_buf = buf + MEM_FIELD_HEADER_SIZE;
|
usr_buf = buf + MEM_FIELD_HEADER_SIZE;
|
||||||
|
|
||||||
#ifdef UNIV_MEM_DEBUG
|
|
||||||
mutex_enter(&mem_hash_mutex);
|
mutex_enter(&mem_hash_mutex);
|
||||||
mem_current_allocated_memory -= n;
|
mem_current_allocated_memory -= n;
|
||||||
mutex_exit(&mem_hash_mutex);
|
mutex_exit(&mem_hash_mutex);
|
||||||
|
@ -211,10 +209,8 @@ mem_field_erase(
|
||||||
combination of 0xDE and 0xAD */
|
combination of 0xDE and 0xAD */
|
||||||
|
|
||||||
mem_erase_buf(buf, MEM_SPACE_NEEDED(n));
|
mem_erase_buf(buf, MEM_SPACE_NEEDED(n));
|
||||||
#endif /* UNIV_MEM_DEBUG */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNIV_MEM_DEBUG
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
Initializes a buffer to a random combination of hex BA and BE.
|
Initializes a buffer to a random combination of hex BA and BE.
|
||||||
Used to initialize allocated memory. */
|
Used to initialize allocated memory. */
|
||||||
|
@ -376,6 +372,7 @@ mem_hash_remove(
|
||||||
}
|
}
|
||||||
#endif /* UNIV_MEM_DEBUG */
|
#endif /* UNIV_MEM_DEBUG */
|
||||||
|
|
||||||
|
#if defined UNIV_MEM_DEBUG || defined UNIV_DEBUG
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
Checks a memory heap for consistency and prints the contents if requested.
|
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
|
Outputs the sum of sizes of buffers given to the user (only in
|
||||||
|
@ -549,10 +546,12 @@ completed:
|
||||||
}
|
}
|
||||||
*error = FALSE;
|
*error = FALSE;
|
||||||
}
|
}
|
||||||
|
#endif /* UNIV_MEM_DEBUG || UNIV_DEBUG */
|
||||||
|
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
Prints the contents of a memory heap. */
|
Prints the contents of a memory heap. */
|
||||||
|
static
|
||||||
void
|
void
|
||||||
mem_heap_print(
|
mem_heap_print(
|
||||||
/*===========*/
|
/*===========*/
|
||||||
|
@ -615,6 +614,7 @@ mem_heap_validate(
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
|
||||||
#ifdef UNIV_MEM_DEBUG
|
#ifdef UNIV_MEM_DEBUG
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
|
|
@ -35,7 +35,7 @@ The main components of the memory consumption are:
|
||||||
8. session for each user, and
|
8. session for each user, and
|
||||||
9. stack for each OS thread.
|
9. stack for each OS thread.
|
||||||
|
|
||||||
Items 1-3 are managed by an LRU algorithm. Items 5 and 6 can potentially
|
Items 1 and 2 are managed by an LRU algorithm. Items 5 and 6 can potentially
|
||||||
consume very much memory. Items 7 and 8 should consume quite little memory,
|
consume very much memory. Items 7 and 8 should consume quite little memory,
|
||||||
and the OS should take care of item 9, which too should consume little memory.
|
and the OS should take care of item 9, which too should consume little memory.
|
||||||
|
|
||||||
|
@ -54,16 +54,15 @@ common pool and the buffers in the buffer pool into a single LRU list and
|
||||||
manage it uniformly, but this approach does not take into account the parsing
|
manage it uniformly, but this approach does not take into account the parsing
|
||||||
and other costs unique to SQL statements.
|
and other costs unique to SQL statements.
|
||||||
|
|
||||||
So, let the SQL statements and the data dictionary entries form one single
|
The locks for a transaction can be seen as a part of the state of the
|
||||||
LRU list, let us call it the dictionary LRU list. The locks for a transaction
|
transaction. Hence, they should be stored in the common pool. We still
|
||||||
can be seen as a part of the state of the transaction. Hence, they should be
|
have the problem of a very big update transaction, for example, which
|
||||||
stored in the common pool. We still have the problem of a very big update
|
will set very many x-locks on rows, and the locks will consume a lot
|
||||||
transaction, for example, which will set very many x-locks on rows, and the
|
of memory, say, half of the buffer pool size.
|
||||||
locks will consume a lot of memory, say, half of the buffer pool size.
|
|
||||||
|
|
||||||
Another problem is what to do if we are not able to malloc a requested
|
Another problem is what to do if we are not able to malloc a requested
|
||||||
block of memory from the common pool. Then we can truncate the LRU list of
|
block of memory from the common pool. Then we can request memory from
|
||||||
the dictionary cache. If it does not help, a system error results.
|
the operating system. If it does not help, a system error results.
|
||||||
|
|
||||||
Because 5 and 6 may potentially consume very much memory, we let them grow
|
Because 5 and 6 may potentially consume very much memory, we let them grow
|
||||||
into the buffer pool. We may let the locks of a transaction take frames
|
into the buffer pool. We may let the locks of a transaction take frames
|
||||||
|
|
|
@ -318,6 +318,7 @@ mtr_read_dulint(
|
||||||
return(mach_read_from_8(ptr));
|
return(mach_read_from_8(ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
Prints info of an mtr handle. */
|
Prints info of an mtr handle. */
|
||||||
|
|
||||||
|
@ -332,3 +333,4 @@ mtr_print(
|
||||||
(ulong) dyn_array_get_data_size(&(mtr->memo)),
|
(ulong) dyn_array_get_data_size(&(mtr->memo)),
|
||||||
(ulong) dyn_array_get_data_size(&(mtr->log)));
|
(ulong) dyn_array_get_data_size(&(mtr->log)));
|
||||||
}
|
}
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
|
|
@ -563,7 +563,7 @@ row_purge_parse_undo_rec(
|
||||||
|
|
||||||
/* Read to the partial row the fields that occur in indexes */
|
/* Read to the partial row the fields that occur in indexes */
|
||||||
|
|
||||||
if (!cmpl_info & UPD_NODE_NO_ORD_CHANGE) {
|
if (!(cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
|
||||||
ptr = trx_undo_rec_get_partial_row(ptr, clust_index,
|
ptr = trx_undo_rec_get_partial_row(ptr, clust_index,
|
||||||
&(node->row), node->heap);
|
&(node->row), node->heap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -758,8 +758,9 @@ rw_lock_is_locked(
|
||||||
Prints debug info of currently locked rw-locks. */
|
Prints debug info of currently locked rw-locks. */
|
||||||
|
|
||||||
void
|
void
|
||||||
rw_lock_list_print_info(void)
|
rw_lock_list_print_info(
|
||||||
/*=========================*/
|
/*====================*/
|
||||||
|
FILE* file) /* in: file where to print */
|
||||||
{
|
{
|
||||||
rw_lock_t* lock;
|
rw_lock_t* lock;
|
||||||
ulint count = 0;
|
ulint count = 0;
|
||||||
|
@ -769,7 +770,7 @@ rw_lock_list_print_info(void)
|
||||||
|
|
||||||
fputs("-------------\n"
|
fputs("-------------\n"
|
||||||
"RW-LATCH INFO\n"
|
"RW-LATCH INFO\n"
|
||||||
"-------------\n", stderr);
|
"-------------\n", file);
|
||||||
|
|
||||||
lock = UT_LIST_GET_FIRST(rw_lock_list);
|
lock = UT_LIST_GET_FIRST(rw_lock_list);
|
||||||
|
|
||||||
|
@ -783,12 +784,12 @@ rw_lock_list_print_info(void)
|
||||||
|| (rw_lock_get_reader_count(lock) != 0)
|
|| (rw_lock_get_reader_count(lock) != 0)
|
||||||
|| (rw_lock_get_waiters(lock) != 0)) {
|
|| (rw_lock_get_waiters(lock) != 0)) {
|
||||||
|
|
||||||
fprintf(stderr, "RW-LOCK: %p ", (void*) lock);
|
fprintf(file, "RW-LOCK: %p ", (void*) lock);
|
||||||
|
|
||||||
if (rw_lock_get_waiters(lock)) {
|
if (rw_lock_get_waiters(lock)) {
|
||||||
fputs(" Waiters for the lock exist\n", stderr);
|
fputs(" Waiters for the lock exist\n", file);
|
||||||
} else {
|
} else {
|
||||||
putc('\n', stderr);
|
putc('\n', file);
|
||||||
}
|
}
|
||||||
|
|
||||||
info = UT_LIST_GET_FIRST(lock->debug_list);
|
info = UT_LIST_GET_FIRST(lock->debug_list);
|
||||||
|
@ -802,7 +803,7 @@ rw_lock_list_print_info(void)
|
||||||
lock = UT_LIST_GET_NEXT(list, lock);
|
lock = UT_LIST_GET_NEXT(list, lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Total number of rw-locks %ld\n", count);
|
fprintf(file, "Total number of rw-locks %ld\n", count);
|
||||||
mutex_exit(&rw_lock_list_mutex);
|
mutex_exit(&rw_lock_list_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -628,10 +628,11 @@ mutex_own(
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Prints debug info of currently reserved mutexes. */
|
Prints debug info of currently reserved mutexes. */
|
||||||
|
static
|
||||||
void
|
void
|
||||||
mutex_list_print_info(void)
|
mutex_list_print_info(
|
||||||
/*=======================*/
|
/*==================*/
|
||||||
|
FILE* file) /* in: file where to print */
|
||||||
{
|
{
|
||||||
mutex_t* mutex;
|
mutex_t* mutex;
|
||||||
const char* file_name;
|
const char* file_name;
|
||||||
|
@ -641,7 +642,7 @@ mutex_list_print_info(void)
|
||||||
|
|
||||||
fputs("----------\n"
|
fputs("----------\n"
|
||||||
"MUTEX INFO\n"
|
"MUTEX INFO\n"
|
||||||
"----------\n", stderr);
|
"----------\n", file);
|
||||||
|
|
||||||
mutex_enter(&mutex_list_mutex);
|
mutex_enter(&mutex_list_mutex);
|
||||||
|
|
||||||
|
@ -653,7 +654,7 @@ mutex_list_print_info(void)
|
||||||
if (mutex_get_lock_word(mutex) != 0) {
|
if (mutex_get_lock_word(mutex) != 0) {
|
||||||
mutex_get_debug_info(mutex, &file_name, &line,
|
mutex_get_debug_info(mutex, &file_name, &line,
|
||||||
&thread_id);
|
&thread_id);
|
||||||
fprintf(stderr,
|
fprintf(file,
|
||||||
"Locked mutex: addr %p thread %ld"
|
"Locked mutex: addr %p thread %ld"
|
||||||
" file %s line %ld\n",
|
" file %s line %ld\n",
|
||||||
(void*) mutex, os_thread_pf(thread_id),
|
(void*) mutex, os_thread_pf(thread_id),
|
||||||
|
@ -663,7 +664,7 @@ mutex_list_print_info(void)
|
||||||
mutex = UT_LIST_GET_NEXT(list, mutex);
|
mutex = UT_LIST_GET_NEXT(list, mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Total number of mutexes %ld\n", count);
|
fprintf(file, "Total number of mutexes %ld\n", count);
|
||||||
|
|
||||||
mutex_exit(&mutex_list_mutex);
|
mutex_exit(&mutex_list_mutex);
|
||||||
}
|
}
|
||||||
|
@ -1343,7 +1344,7 @@ sync_print_wait_info(
|
||||||
FILE* file) /* in: file where to print */
|
FILE* file) /* in: file where to print */
|
||||||
{
|
{
|
||||||
#ifdef UNIV_SYNC_DEBUG
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
fprintf(stderr, "Mutex exits %lu, rws exits %lu, rwx exits %lu\n",
|
fprintf(file, "Mutex exits %lu, rws exits %lu, rwx exits %lu\n",
|
||||||
mutex_exit_count, rw_s_exit_count, rw_x_exit_count);
|
mutex_exit_count, rw_s_exit_count, rw_x_exit_count);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1369,9 +1370,9 @@ sync_print(
|
||||||
FILE* file) /* in: file where to print */
|
FILE* file) /* in: file where to print */
|
||||||
{
|
{
|
||||||
#ifdef UNIV_SYNC_DEBUG
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
mutex_list_print_info();
|
mutex_list_print_info(file);
|
||||||
|
|
||||||
rw_lock_list_print_info();
|
rw_lock_list_print_info(file);
|
||||||
#endif /* UNIV_SYNC_DEBUG */
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
sync_array_print_info(file, sync_primary_wait_array);
|
sync_array_print_info(file, sync_primary_wait_array);
|
||||||
|
|
|
@ -394,7 +394,10 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Outputs a NUL-terminated string, quoted as an SQL identifier. */
|
Outputs a fixed-length string, quoted as an SQL identifier.
|
||||||
|
If the string contains a slash '/', the string will be
|
||||||
|
output as two identifiers separated by a period (.),
|
||||||
|
as in SQL database_name.identifier. */
|
||||||
|
|
||||||
void
|
void
|
||||||
ut_print_name(
|
ut_print_name(
|
||||||
|
@ -409,7 +412,10 @@ ut_print_name(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Outputs a fixed-length string, quoted as an SQL identifier. */
|
Outputs a fixed-length string, quoted as an SQL identifier.
|
||||||
|
If the string contains a slash '/', the string will be
|
||||||
|
output as two identifiers separated by a period (.),
|
||||||
|
as in SQL database_name.identifier. */
|
||||||
|
|
||||||
void
|
void
|
||||||
ut_print_namel(
|
ut_print_namel(
|
||||||
|
@ -424,7 +430,7 @@ ut_print_namel(
|
||||||
#ifdef UNIV_HOTBACKUP
|
#ifdef UNIV_HOTBACKUP
|
||||||
fwrite(name, 1, namelen, f);
|
fwrite(name, 1, namelen, f);
|
||||||
#else
|
#else
|
||||||
char* slash = strchr(name, '/');
|
char* slash = memchr(name, '/', namelen);
|
||||||
|
|
||||||
if (UNIV_LIKELY_NULL(slash)) {
|
if (UNIV_LIKELY_NULL(slash)) {
|
||||||
/* Print the database name and table name separately. */
|
/* Print the database name and table name separately. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue