Commit 5fda3c2c authored by unknown's avatar unknown

Merge siva.hindu.god:/usr/home/tim/m/bk/inno/51

into  siva.hindu.god:/usr/home/tim/m/bk/51

parents 4ab87172 f1bc98c8
......@@ -571,9 +571,6 @@ btr_page_get_father_for_rec(
tuple = dict_index_build_node_ptr(index, user_rec, 0, heap,
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_page_get_level(page, mtr) + 1,
tuple, PAGE_CUR_LE,
......
......@@ -3547,6 +3547,7 @@ syntax_error:
/*==================== END OF FOREIGN KEY PROCESSING ====================*/
#ifdef UNIV_DEBUG
/**************************************************************************
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 */
dulint index_id) /* in: index id */
{
dict_table_t* table;
dict_index_t* index;
if (dict_sys == NULL) {
......@@ -3565,29 +3565,13 @@ dict_index_get_if_in_cache(
mutex_enter(&(dict_sys->mutex));
table = UT_LIST_GET_FIRST(dict_sys->table_LRU);
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);
}
index = dict_index_find_on_id_low(index_id);
table = UT_LIST_GET_NEXT(table_LRU, table);
}
index = NULL;
found:
mutex_exit(&(dict_sys->mutex));
return(index);
}
#endif /* UNIV_DEBUG */
#ifdef UNIV_DEBUG
/**************************************************************************
......
......@@ -6630,7 +6630,7 @@ innodb_mutex_show_status(
mutex->count_spin_rounds,
mutex->count_os_wait,
mutex->count_os_yield,
mutex->lspent_time/1000);
(ulong) mutex->lspent_time/1000);
if (stat_print(thd, innobase_hton_name,
hton_name_len, buf1, buf1len,
......@@ -6660,7 +6660,7 @@ innodb_mutex_show_status(
rw_lock_count, rw_lock_count_spin_loop,
rw_lock_count_spin_rounds,
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,
STRING_WITH_LEN("rw_lock_mutexes"), buf2, buf2len)) {
......@@ -6812,7 +6812,8 @@ ha_innobase::store_lock(
&& lock_type != TL_IGNORE)) {
/* 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
3) this is a SELECT ... IN SHARE MODE, or
4) we are doing a complex SQL statement like
......@@ -6880,7 +6881,8 @@ ha_innobase::store_lock(
single transaction stored procedure call deterministic
(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
... READ LOCAL. MyISAM under that table lock type
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). */
if (lock_type == TL_READ_NO_INSERT
&& (!thd->in_lock_tables
|| thd->lex->sql_command == SQLCOM_CALL)) {
&& thd->lex->sql_command != SQLCOM_LOCK_TABLES) {
lock_type = TL_READ;
}
......
......@@ -778,9 +778,8 @@ const dict_col_t*
dict_field_get_col(
/*===============*/
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. */
......@@ -789,7 +788,6 @@ dict_index_get_if_in_cache(
/*=======================*/
/* out: index, NULL if not found */
dulint index_id); /* in: index id */
#ifdef UNIV_DEBUG
/**************************************************************************
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. */
......
......@@ -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)
#endif
#if defined UNIV_MEM_DEBUG || defined 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
......@@ -59,15 +60,8 @@ 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 */
#ifdef UNIV_MEM_DEBUG
/******************************************************************
Prints the contents of a memory heap. */
void
mem_heap_print(
/*===========*/
mem_heap_t* heap); /* in: memory heap */
#endif /* UNIV_MEM_DEBUG */
#endif /* UNIV_MEM_DEBUG || UNIV_DEBUG */
#ifdef UNIV_DEBUG
/******************************************************************
Checks that an object is a memory heap (or a block of it) */
......@@ -76,6 +70,7 @@ mem_heap_check(
/*===========*/
/* out: TRUE if ok */
mem_heap_t* heap); /* in: memory heap */
#endif /* UNIV_DEBUG */
/******************************************************************
Validates the contents of a memory heap. */
......
......@@ -265,6 +265,7 @@ mtr_memo_release(
mtr_t* mtr, /* in: mtr */
void* object, /* in: object */
ulint type); /* in: object type: MTR_MEMO_S_LOCK, ... */
#ifdef UNIV_DEBUG
/**************************************************************
Checks if memo contains the given item. */
UNIV_INLINE
......@@ -282,6 +283,7 @@ void
mtr_print(
/*======*/
mtr_t* mtr); /* in: mtr */
#endif /* UNIV_DEBUG */
/*######################################################################*/
#define MTR_BUF_MEMO_SIZE 200 /* number of slots in memo */
......
......@@ -113,6 +113,7 @@ mtr_release_s_latch_at_savepoint(
slot->object = NULL;
}
#ifdef UNIV_DEBUG
/**************************************************************
Checks if memo contains the given item. */
UNIV_INLINE
......@@ -148,6 +149,7 @@ mtr_memo_contains(
return(FALSE);
}
#endif /* UNIV_DEBUG */
/*******************************************************************
Returns the log object of a mini-transaction buffer. */
......
......@@ -358,8 +358,9 @@ rw_lock_print(
Prints debug info of currently locked rw-locks. */
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.
Works only in the debug version. */
......
......@@ -224,12 +224,6 @@ Counts currently reserved mutexes. Works only in the debug version. */
ulint
mutex_n_reserved(void);
/*==================*/
/**********************************************************************
Prints debug info of currently reserved mutexes. */
void
mutex_list_print_info(void);
/*========================*/
#endif /* UNIV_SYNC_DEBUG */
/**********************************************************************
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
#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__)
#undef __WIN__
#define __WIN__
# undef __WIN__
# define __WIN__
#include <windows.h>
# include <windows.h>
#if !defined(WIN64) && !defined(_WIN64)
#define UNIV_CAN_USE_X86_ASSEMBLER
#endif
# if !defined(WIN64) && !defined(_WIN64)
# define UNIV_CAN_USE_X86_ASSEMBLER
# endif
#ifdef _NT_
#define __NT__
#endif
# ifdef _NT_
# define __NT__
# endif
#else
/* 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__
if we are compiling on Windows. */
#include <my_global.h>
#include <my_pthread.h>
# include <my_global.h>
# include <my_pthread.h>
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
#include <sys/stat.h>
# include <sys/stat.h>
#undef PACKAGE
#undef VERSION
# undef PACKAGE
# undef VERSION
/* Include the header file generated by GNU autoconf */
#ifndef __WIN__
#include "config.h"
#endif
#ifdef HAVE_SCHED_H
#include <sched.h>
#endif
/* When compiling for Itanium IA64, undefine the flag below to prevent use
of the 32-bit x86 assembler in mutex operations. */
# include "config.h"
#if defined(__WIN__) && !defined(WIN64) && !defined(_WIN64)
#define UNIV_CAN_USE_X86_ASSEMBLER
#endif
# ifdef HAVE_SCHED_H
# include <sched.h>
# endif
/* We only try to do explicit inlining of functions with gcc and
Microsoft Visual C++ */
#if !defined(__GNUC__) && !defined(__WIN__)
#undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */
#define UNIV_MUST_NOT_INLINE
#endif
# if !defined(__GNUC__)
# undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */
# define UNIV_MUST_NOT_INLINE
# endif
#ifdef HAVE_PREAD
#define HAVE_PWRITE
#endif
# ifdef HAVE_PREAD
# define HAVE_PWRITE
# endif
#endif /* #if (defined(WIN32) || ... */
......
......@@ -66,7 +66,6 @@ mem_hash_get_nth_cell(ulint i)
return(&(mem_hash_table[i]));
}
#endif /* UNIV_MEM_DEBUG */
/* 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
+ mem_field_header_get_len(field)));
}
#endif /* UNIV_MEM_DEBUG */
/**********************************************************************
Initializes the memory system. */
......@@ -136,6 +136,7 @@ mem_init(
mem_comm_pool = mem_pool_create(size);
}
#ifdef UNIV_MEM_DEBUG
/**********************************************************************
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_trailer_set_check(usr_buf, rnd);
#ifdef UNIV_MEM_DEBUG
/* Update the memory allocation information */
mutex_enter(&mem_hash_mutex);
......@@ -182,7 +182,6 @@ mem_field_init(
combination of 0xBA and 0xBE */
mem_init_buf(usr_buf, n);
#endif /* UNIV_MEM_DEBUG */
}
/**********************************************************************
......@@ -199,7 +198,6 @@ mem_field_erase(
usr_buf = buf + MEM_FIELD_HEADER_SIZE;
#ifdef UNIV_MEM_DEBUG
mutex_enter(&mem_hash_mutex);
mem_current_allocated_memory -= n;
mutex_exit(&mem_hash_mutex);
......@@ -211,10 +209,8 @@ mem_field_erase(
combination of 0xDE and 0xAD */
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.
Used to initialize allocated memory. */
......@@ -376,6 +372,7 @@ mem_hash_remove(
}
#endif /* UNIV_MEM_DEBUG */
#if defined UNIV_MEM_DEBUG || defined 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
......@@ -549,10 +546,12 @@ completed:
}
*error = FALSE;
}
#endif /* UNIV_MEM_DEBUG || UNIV_DEBUG */
#ifdef UNIV_DEBUG
/******************************************************************
Prints the contents of a memory heap. */
static
void
mem_heap_print(
/*===========*/
......@@ -615,6 +614,7 @@ mem_heap_validate(
return(TRUE);
}
#endif /* UNIV_DEBUG */
#ifdef UNIV_MEM_DEBUG
/*********************************************************************
......
......@@ -35,7 +35,7 @@ The main components of the memory consumption are:
8. session for each user, and
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,
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
and other costs unique to SQL statements.
So, let the SQL statements and the data dictionary entries form one single
LRU list, let us call it the dictionary LRU list. The locks for a transaction
can be seen as a part of the state of the transaction. Hence, they should be
stored in the common pool. We still have the problem of a very big update
transaction, for example, which will set very many x-locks on rows, and the
locks will consume a lot of memory, say, half of the buffer pool size.
The locks for a transaction can be seen as a part of the state of the
transaction. Hence, they should be stored in the common pool. We still
have the problem of a very big update transaction, for example, which
will set very many x-locks on rows, and the 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
block of memory from the common pool. Then we can truncate the LRU list of
the dictionary cache. If it does not help, a system error results.
block of memory from the common pool. Then we can request memory from
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
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));
}
#ifdef UNIV_DEBUG
/*************************************************************
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->log)));
}
#endif /* UNIV_DEBUG */
......@@ -563,7 +563,7 @@ row_purge_parse_undo_rec(
/* 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,
&(node->row), node->heap);
}
......
......@@ -758,8 +758,9 @@ rw_lock_is_locked(
Prints debug info of currently locked rw-locks. */
void
rw_lock_list_print_info(void)
/*=========================*/
rw_lock_list_print_info(
/*====================*/
FILE* file) /* in: file where to print */
{
rw_lock_t* lock;
ulint count = 0;
......@@ -769,7 +770,7 @@ rw_lock_list_print_info(void)
fputs("-------------\n"
"RW-LATCH INFO\n"
"-------------\n", stderr);
"-------------\n", file);
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_waiters(lock) != 0)) {
fprintf(stderr, "RW-LOCK: %p ", (void*) lock);
fprintf(file, "RW-LOCK: %p ", (void*) lock);
if (rw_lock_get_waiters(lock)) {
fputs(" Waiters for the lock exist\n", stderr);
fputs(" Waiters for the lock exist\n", file);
} else {
putc('\n', stderr);
putc('\n', file);
}
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);
}
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);
}
......
......@@ -628,10 +628,11 @@ mutex_own(
/**********************************************************************
Prints debug info of currently reserved mutexes. */
static
void
mutex_list_print_info(void)
/*=======================*/
mutex_list_print_info(
/*==================*/
FILE* file) /* in: file where to print */
{
mutex_t* mutex;
const char* file_name;
......@@ -641,7 +642,7 @@ mutex_list_print_info(void)
fputs("----------\n"
"MUTEX INFO\n"
"----------\n", stderr);
"----------\n", file);
mutex_enter(&mutex_list_mutex);
......@@ -653,7 +654,7 @@ mutex_list_print_info(void)
if (mutex_get_lock_word(mutex) != 0) {
mutex_get_debug_info(mutex, &file_name, &line,
&thread_id);
fprintf(stderr,
fprintf(file,
"Locked mutex: addr %p thread %ld"
" file %s line %ld\n",
(void*) mutex, os_thread_pf(thread_id),
......@@ -663,7 +664,7 @@ mutex_list_print_info(void)
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);
}
......@@ -1343,7 +1344,7 @@ sync_print_wait_info(
FILE* file) /* in: file where to print */
{
#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);
#endif
......@@ -1369,9 +1370,9 @@ sync_print(
FILE* file) /* in: file where to print */
{
#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 */
sync_array_print_info(file, sync_primary_wait_array);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment