Commit 661c40fb authored by unknown's avatar unknown

Merge marko@build.mysql.com:/home/bk/mysql-4.0

into hundin.mysql.fi:/home/marko/m/mysql-4.0


innobase/que/que0que.c:
  Auto merged
parents 89945d1d 0eacf58f
......@@ -1497,75 +1497,6 @@ btr_search_update_hash_on_insert(
}
}
/************************************************************************
Prints info of the search system. */
void
btr_search_print_info(void)
/*=======================*/
{
printf("SEARCH SYSTEM INFO\n");
rw_lock_x_lock(&btr_search_latch);
/* ha_print_info(btr_search_sys->hash_index); */
rw_lock_x_unlock(&btr_search_latch);
}
/************************************************************************
Prints info of searches on an index. */
void
btr_search_index_print_info(
/*========================*/
dict_index_t* index) /* in: index */
{
btr_search_t* info;
printf("INDEX SEARCH INFO\n");
rw_lock_x_lock(&btr_search_latch);
info = btr_search_get_info(index);
printf("Searches %lu, hash succ %lu, fail %lu, patt succ %lu\n",
info->n_searches, info->n_hash_succ, info->n_hash_fail,
info->n_patt_succ);
printf("Total of page cur short succ for all indexes %lu\n",
page_cur_short_succ);
rw_lock_x_unlock(&btr_search_latch);
}
/************************************************************************
Prints info of searches on a table. */
void
btr_search_table_print_info(
/*========================*/
char* name) /* in: table name */
{
dict_table_t* table;
dict_index_t* index;
mutex_enter(&(dict_sys->mutex));
table = dict_table_get_low(name);
ut_a(table);
mutex_exit(&(dict_sys->mutex));
index = dict_table_get_first_index(table);
while (index) {
btr_search_index_print_info(index);
index = dict_table_get_next_index(index);
}
}
/************************************************************************
Validates the search system. */
......
......@@ -1540,21 +1540,6 @@ buf_page_io_complete(
"InnoDB: Error: page n:o stored in the page read in is %lu, should be %lu!\n",
read_page_no, block->offset);
}
#ifdef notdefined
if (block->offset != 0 && read_page_no == 0) {
/* Check that the page is really uninited */
for (i = 0; i < UNIV_PAGE_SIZE; i++) {
if (*((block->frame) + i) != '\0') {
fprintf(stderr,
"InnoDB: Error: page n:o in the page read in is 0, but page %lu is inited!\n",
block->offset);
break;
}
}
}
#endif
/* From version 3.23.38 up we store the page checksum
to the 4 first bytes of the page end lsn field */
......
......@@ -964,19 +964,6 @@ com_shm_recvfrom(
ut_ad(loop_count < 2);
#ifdef notdefined
if (!com_shm_get_not_empty(map)) {
/* There was no datagram, give up the time slice
for some writer thread to insert a datagram */
com_shm_exit(ep);
os_thread_yield();
com_shm_enter(ep);
}
#endif
com_shm_enter(ep);
if (!com_shm_get_not_empty(map)) {
......@@ -1130,33 +1117,13 @@ com_shm_sendto(
ut_memcpy(com_shm_get_addr(map), com_shm_endpoint_get_addr(ep),
sender_len);
com_shm_set_not_empty(map, TRUE);
#ifdef notdefined
com_shm_exit(ep2);
/* Now we give up our time slice voluntarily to give some reader
thread chance to fetch the datagram */
os_thread_yield();
com_shm_enter(ep2);
if (com_shm_get_not_empty(map)) {
#endif
com_shm_system_call_count++;
com_shm_exit(ep2);
/* Signal the event */
com_shm_system_call_count++;
os_event_set(com_shm_endpoint_get_not_empty(ep2));
com_shm_exit(ep2);
return(0);
/* Signal the event */
#ifdef notdefined
}
os_event_set(com_shm_endpoint_get_not_empty(ep2));
com_shm_exit(ep2);
return(0);
#endif
}
This diff is collapsed.
......@@ -25,6 +25,11 @@ Created 1/8/1996 Heikki Tuuri
#include "trx0roll.h"
#include "usr0sess.h"
/* Maximum lengths of identifiers in MySQL, in bytes */
#define MAX_TABLE_NAME_LEN 64
#define MAX_COLUMN_NAME_LEN 64
#define MAX_IDENTIFIER_LEN 255
/*********************************************************************
Based on a table object, this function builds the entry to be inserted
in the SYS_TABLES system table. */
......@@ -316,34 +321,6 @@ dict_build_col_def_step(
return(DB_SUCCESS);
}
#ifdef notdefined
/*************************************************************************
Creates the single index for a cluster: it contains all the columns of
the cluster definition in the order they were defined. */
static
void
dict_create_index_for_cluster_step(
/*===============================*/
tab_node_t* node) /* in: table create node */
{
dict_index_t* index;
ulint i;
dict_col_t* col;
index = dict_mem_index_create(table->name, "IND_DEFAULT_CLUSTERED",
table->space, DICT_CLUSTERED,
table->n_cols);
for (i = 0; i < table->n_cols; i++) {
col = dict_table_get_nth_col(table, i);
dict_mem_index_add_field(index, col->name, 0, 0);
}
(node->cluster)->index = index;
}
#endif
/*********************************************************************
Based on an index object, this function builds the entry to be inserted
in the SYS_INDEXES system table. */
......@@ -727,27 +704,6 @@ dict_drop_index_tree(
page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
FIL_NULL, mtr);
}
#ifdef notdefined
/*************************************************************************
Creates the default clustered index for a table: the records are ordered
by row id. */
void
dict_create_default_index(
/*======================*/
dict_table_t* table, /* in: table */
trx_t* trx) /* in: transaction handle */
{
dict_index_t* index;
index = dict_mem_index_create(table->name, "IND_DEFAULT_CLUSTERED",
table->space, DICT_CLUSTERED, 0);
dict_create_index(index, trx);
}
#endif
/*************************************************************************
Creates a table create graph. */
......@@ -1198,6 +1154,7 @@ dict_create_add_foreigns_to_dictionary(
que_t* graph;
ulint number = start_id + 1;
ulint len;
ulint namelen;
ulint error;
char* ebuf = dict_foreign_err_buf;
ulint i;
......@@ -1228,15 +1185,21 @@ dict_create_add_foreigns_to_dictionary(
"PROCEDURE ADD_FOREIGN_DEFS_PROC () IS\n"
"BEGIN\n");
namelen = strlen(table->name);
ut_a(namelen < MAX_TABLE_NAME_LEN);
if (foreign->id == NULL) {
/* Generate a new constraint id */
foreign->id = mem_heap_alloc(foreign->heap,
ut_strlen(table->name)
+ 20);
foreign->id = mem_heap_alloc(foreign->heap, namelen + 20);
/* no overflow if number < 1e13 */
sprintf(foreign->id, "%s_ibfk_%lu", table->name, number);
number++;
}
ut_a(strlen(foreign->id) < MAX_IDENTIFIER_LEN);
ut_a(len < (sizeof buf)
- 46 - 2 * MAX_TABLE_NAME_LEN - MAX_IDENTIFIER_LEN - 20);
len += sprintf(buf + len,
"INSERT INTO SYS_FOREIGN VALUES('%s', '%s', '%s', %lu);\n",
foreign->id,
......@@ -1246,6 +1209,9 @@ dict_create_add_foreigns_to_dictionary(
+ (foreign->type << 24));
for (i = 0; i < foreign->n_fields; i++) {
ut_a(len < (sizeof buf)
- 51 - 2 * MAX_COLUMN_NAME_LEN
- MAX_IDENTIFIER_LEN - 20);
len += sprintf(buf + len,
"INSERT INTO SYS_FOREIGN_COLS VALUES('%s', %lu, '%s', '%s');\n",
......@@ -1255,6 +1221,7 @@ dict_create_add_foreigns_to_dictionary(
foreign->referenced_col_names[i]);
}
ut_a(len < (sizeof buf) - 19)
len += sprintf(buf + len,"COMMIT WORK;\nEND;\n");
graph = pars_sql(buf);
......@@ -1276,15 +1243,15 @@ dict_create_add_foreigns_to_dictionary(
if (error == DB_DUPLICATE_KEY) {
mutex_enter(&dict_foreign_err_mutex);
ut_sprintf_timestamp(dict_foreign_err_buf);
ut_sprintf_timestamp(ebuf);
ut_a(strlen(ebuf) < DICT_FOREIGN_ERR_BUF_LEN
- MAX_TABLE_NAME_LEN - MAX_IDENTIFIER_LEN - 201);
sprintf(ebuf + strlen(ebuf),
" Error in foreign key constraint creation for table %.500s.\n"
"A foreign key constraint of name %.500s\n"
" Error in foreign key constraint creation for table %s.\n"
"A foreign key constraint of name %s\n"
"already exists (note that internally InnoDB adds 'databasename/'\n"
"in front of the user-defined constraint name).\n", table->name, foreign->id);
ut_a(strlen(ebuf) < DICT_FOREIGN_ERR_BUF_LEN);
mutex_exit(&dict_foreign_err_mutex);
return(error);
......@@ -1297,8 +1264,10 @@ dict_create_add_foreigns_to_dictionary(
mutex_enter(&dict_foreign_err_mutex);
ut_sprintf_timestamp(ebuf);
ut_a(strlen(ebuf) < DICT_FOREIGN_ERR_BUF_LEN
- MAX_TABLE_NAME_LEN - 124);
sprintf(ebuf + strlen(ebuf),
" Internal error in foreign key constraint creation for table %.500s.\n"
" Internal error in foreign key constraint creation for table %s.\n"
"See the MySQL .err log in the datadir for more information.\n", table->name);
mutex_exit(&dict_foreign_err_mutex);
......
......@@ -764,19 +764,12 @@ fsp_init_file_page_low(
byte* ptr) /* in: pointer to a page */
{
page_t* page;
#ifdef UNIV_BASIC_LOG_DEBUG
ulint i;
#endif
page = buf_frame_align(ptr);
buf_block_align(page)->check_index_page_at_flush = FALSE;
#ifdef UNIV_BASIC_LOG_DEBUG
/* printf("In log debug version: Erase the contents of the file page\n");
*/
for (i = 0; i < UNIV_PAGE_SIZE; i++) {
page[i] = 0xFF;
}
#ifdef UNIV_BASIC_LOG_DEBUG
memset(page, 0xff, UNIV_PAGE_SIZE);
#endif
mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
ut_dulint_zero);
......@@ -786,6 +779,7 @@ fsp_init_file_page_low(
/***************************************************************
Inits a file page whose prior contents should be ignored. */
static
void
fsp_init_file_page(
/*===============*/
......
......@@ -59,33 +59,6 @@ ha_create(
return(table);
}
/*****************************************************************
Checks that a hash table node is in the chain. */
ibool
ha_node_in_chain(
/*=============*/
/* out: TRUE if in chain */
hash_cell_t* cell, /* in: hash table cell */
ha_node_t* node) /* in: external chain node */
{
ha_node_t* node2;
node2 = cell->node;
while (node2 != NULL) {
if (node2 == node) {
return(TRUE);
}
node2 = node2->next;
}
return(FALSE);
}
/*****************************************************************
Inserts an entry into a hash table. If an entry with the same fold number
is found, its node is updated to point to the new data, and no new node
......
......@@ -365,17 +365,6 @@ btr_cur_parse_update_in_place(
byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */
page_t* page); /* in: page or NULL */
/***************************************************************
Parses a redo log record of updating a record, but not in-place. */
byte*
btr_cur_parse_opt_update(
/*=====================*/
/* out: end of log record or NULL */
byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */
page_t* page, /* in: page or NULL */
mtr_t* mtr); /* in: mtr or NULL */
/********************************************************************
Parses the redo log record for delete marking or unmarking of a clustered
index record. */
......
......@@ -49,21 +49,6 @@ btr_search_info_update(
dict_index_t* index, /* in: index of the cursor */
btr_cur_t* cursor);/* in: cursor which was just positioned */
/**********************************************************************
Tries to guess the right search position based on the search pattern info
of the index. */
ibool
btr_search_guess_on_pattern(
/*========================*/
/* out: TRUE if succeeded */
dict_index_t* index, /* in: index */
btr_search_t* info, /* in: index search info */
dtuple_t* tuple, /* in: logical record */
ulint mode, /* in: PAGE_CUR_L, ... */
ulint latch_mode, /* in: BTR_SEARCH_LEAF, ... */
btr_cur_t* cursor, /* out: tree cursor */
mtr_t* mtr); /* in: mtr */
/**********************************************************************
Tries to guess the right search position based on the hash search info
of the index. Note that if mode is PAGE_CUR_LE, which is used in inserts,
and the function returns TRUE, then cursor->up_match and cursor->low_match
......@@ -140,26 +125,6 @@ btr_search_update_hash_on_delete(
record to delete using btr_cur_search_...,
the record is not yet deleted */
/************************************************************************
Prints info of the search system. */
void
btr_search_print_info(void);
/*=======================*/
/************************************************************************
Prints info of searches on an index. */
void
btr_search_index_print_info(
/*========================*/
dict_index_t* index); /* in: index */
/************************************************************************
Prints info of searches on a table. */
void
btr_search_table_print_info(
/*========================*/
char* name); /* in: table name */
/************************************************************************
Validates the search system. */
ibool
......
......@@ -501,6 +501,7 @@ buf_frame_get_modify_clock(
return(block->modify_clock);
}
#ifdef UNIV_SYNC_DEBUG
/***********************************************************************
Increments the bufferfix count. */
UNIV_INLINE
......@@ -519,7 +520,7 @@ buf_block_buf_fix_inc_debug(
block->buf_fix_count++;
}
#else /* UNIV_SYNC_DEBUG */
/***********************************************************************
Increments the bufferfix count. */
UNIV_INLINE
......@@ -530,7 +531,7 @@ buf_block_buf_fix_inc(
{
block->buf_fix_count++;
}
#endif /* UNIV_SYNC_DEBUG */
/**********************************************************************
Returns the control block of a file page, NULL if not found. */
UNIV_INLINE
......
......@@ -375,84 +375,6 @@ dtuple_big_rec_free(
/*================*/
big_rec_t* vector); /* in, own: big rec vector; it is
freed in this function */
/***************************************************************
Generates a random tuple. */
dtuple_t*
dtuple_gen_rnd_tuple(
/*=================*/
/* out: pointer to the tuple */
mem_heap_t* heap); /* in: memory heap where generated */
/*******************************************************************
Generates a test tuple for sort and comparison tests. */
void
dtuple_gen_test_tuple(
/*==================*/
dtuple_t* tuple, /* in/out: a tuple with 3 fields */
ulint i); /* in: a number, 0 <= i < 512 */
/*******************************************************************
Generates a test tuple for B-tree speed tests. */
void
dtuple_gen_test_tuple3(
/*===================*/
dtuple_t* tuple, /* in/out: a tuple with 3 fields */
ulint i, /* in: a number < 1000000 */
ulint type, /* in: DTUPLE_TEST_FIXED30, ... */
byte* buf); /* in: a buffer of size >= 8 bytes */
/*******************************************************************
Generates a test tuple for B-tree speed tests. */
void
dtuple_gen_search_tuple3(
/*=====================*/
dtuple_t* tuple, /* in/out: a tuple with 1 or 2 fields */
ulint i, /* in: a number < 1000000 */
byte* buf); /* in: a buffer of size >= 8 bytes */
/*******************************************************************
Generates a test tuple for TPC-A speed test. */
void
dtuple_gen_test_tuple_TPC_A(
/*========================*/
dtuple_t* tuple, /* in/out: a tuple with >= 3 fields */
ulint i, /* in: a number < 10000 */
byte* buf); /* in: a buffer of size >= 16 bytes */
/*******************************************************************
Generates a test tuple for B-tree speed tests. */
void
dtuple_gen_search_tuple_TPC_A(
/*==========================*/
dtuple_t* tuple, /* in/out: a tuple with 1 field */
ulint i, /* in: a number < 10000 */
byte* buf); /* in: a buffer of size >= 16 bytes */
/*******************************************************************
Generates a test tuple for TPC-C speed test. */
void
dtuple_gen_test_tuple_TPC_C(
/*========================*/
dtuple_t* tuple, /* in/out: a tuple with >= 12 fields */
ulint i, /* in: a number < 100000 */
byte* buf); /* in: a buffer of size >= 16 bytes */
/*******************************************************************
Generates a test tuple for B-tree speed tests. */
void
dtuple_gen_search_tuple_TPC_C(
/*==========================*/
dtuple_t* tuple, /* in/out: a tuple with 1 field */
ulint i, /* in: a number < 100000 */
byte* buf); /* in: a buffer of size >= 16 bytes */
/* Types of the third field in dtuple_gen_test_tuple3 */
#define DTUPLE_TEST_FIXED30 1
#define DTUPLE_TEST_RND30 2
#define DTUPLE_TEST_RND3500 3
#define DTUPLE_TEST_FIXED2000 4
#define DTUPLE_TEST_FIXED3 5
/*######################################################################*/
......
......@@ -16,15 +16,6 @@ Created 1/8/1996 Heikki Tuuri
#include "row0types.h"
#include "mtr0mtr.h"
/*************************************************************************
Creates the default clustered index for a table: the records are ordered
by row id. */
void
dict_create_default_index(
/*======================*/
dict_table_t* table, /* in: table */
trx_t* trx); /* in: transaction handle */
/*************************************************************************
Creates a table create graph. */
......
......@@ -658,13 +658,6 @@ dict_index_get_tree(
/* out: index tree */
dict_index_t* index); /* in: index */
/*************************************************************************
Gets the column data type. */
UNIV_INLINE
dtype_t*
dict_col_get_type(
/*==============*/
dict_col_t* col);
/*************************************************************************
Gets the field order criterion. */
UNIV_INLINE
ulint
......
......@@ -170,15 +170,6 @@ ibuf_page_low(
mtr_t* mtr); /* in: mtr which will contain an x-latch to the
bitmap page if the page is not one of the fixed
address ibuf pages */
/*************************************************************************
Checks if an index page has so much free space that the free bit should
be set TRUE in the ibuf bitmap. */
ibool
ibuf_index_page_has_free(
/*=====================*/
/* out: TRUE if there is enough free space */
page_t* page); /* in: non-unique secondary index page */
/***************************************************************************
Frees excess pages from the ibuf free list. This function is called when an OS
thread calls fsp services to allocate a new file segment, or a new page to a
......
......@@ -442,14 +442,6 @@ lock_rec_hash(
ulint space, /* in: space */
ulint page_no);/* in: page number */
/*************************************************************************
Gets the mutex protecting record locks on a given page address. */
mutex_t*
lock_rec_get_mutex_for_addr(
/*========================*/
ulint space, /* in: space id */
ulint page_no);/* in: page number */
/*************************************************************************
Checks that a transaction id is sensible, i.e., not in the future. */
ibool
......
......@@ -60,6 +60,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 */
#ifdef UNIV_MEM_DEBUG
/******************************************************************
Prints the contents of a memory heap. */
......@@ -67,6 +68,7 @@ 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) */
......@@ -83,20 +85,7 @@ mem_heap_validate(
/*==============*/
/* out: TRUE if ok */
mem_heap_t* heap); /* in: memory heap */
/*********************************************************************
Prints information of dynamic memory usage and currently live
memory heaps or buffers. Can only be used in the debug version. */
void
mem_print_info(void);
/*=================*/
/*********************************************************************
Prints information of dynamic memory usage and currently allocated memory
heaps or buffers since the last ..._print_info or..._print_new_info. */
void
mem_print_new_info(void);
/*====================*/
#ifdef UNIV_MEM_DEBUG
/*********************************************************************
TRUE if no memory is currently allocated. */
......@@ -118,6 +107,7 @@ ibool
mem_validate(void);
/*===============*/
/* out: TRUE if ok */
#endif /* UNIV_MEM_DEBUG */
/****************************************************************
Tries to find neigboring memory allocation blocks and dumps to stderr
the neighborhood of a given pointer. */
......
......@@ -493,18 +493,6 @@ mem_alloc_func(
ulint line /* in: line where created */
)
{
#ifdef notdefined
void* buf;
buf = mem_area_alloc(n, mem_comm_pool);
#ifdef UNIV_SET_MEM_TO_ZERO
memset(buf, '\0', n);
#endif
return(buf);
#else
mem_heap_t* heap;
void* buf;
......@@ -525,8 +513,6 @@ mem_alloc_func(
ut_a((byte*)heap == (byte*)buf - MEM_BLOCK_HEADER_SIZE
- MEM_FIELD_HEADER_SIZE);
return(buf);
#endif
}
/*******************************************************************
......@@ -542,17 +528,11 @@ mem_free_func(
ulint line /* in: line where created */
)
{
#ifdef notdefined
mem_area_free(ptr, mem_comm_pool);
#else
mem_heap_t* heap;
heap = (mem_heap_t*)((byte*)ptr - MEM_BLOCK_HEADER_SIZE
- MEM_FIELD_HEADER_SIZE);
mem_heap_free_func(heap, file_name, line);
#endif
}
/*********************************************************************
......
......@@ -120,15 +120,6 @@ mlog_write_initial_log_record_fast(
byte type, /* in: log item type: MLOG_1BYTE, ... */
byte* log_ptr,/* in: pointer to mtr log which has been opened */
mtr_t* mtr); /* in: mtr */
/****************************************************************
Writes the contents of a mini-transaction log, if any, to the database log. */
dulint
mlog_write(
/*=======*/
dyn_array_t* mlog, /* in: mlog */
ibool* modifications); /* out: TRUE if there were
log items to write */
/************************************************************
Parses an initial log record written by mlog_write_initial_log_record. */
......
......@@ -126,16 +126,6 @@ void
mtr_commit(
/*=======*/
mtr_t* mtr); /* in: mini-transaction */
/****************************************************************
Writes to the database log the full contents of the pages that this mtr is
the first to modify in the buffer pool. This function is called when the
database is in the online backup state. */
void
mtr_log_write_backup_entries(
/*=========================*/
mtr_t* mtr, /* in: mini-transaction */
dulint backup_lsn); /* in: online backup lsn */
/**************************************************************
Sets and returns a savepoint in mtr. */
UNIV_INLINE
......
......@@ -32,37 +32,6 @@ os_mem_alloc_nocache(
/*=================*/
/* out: allocated memory */
ulint n); /* in: number of bytes */
#ifdef notdefined
/********************************************************************
Creates a new process. */
ibool
os_process_create(
/*==============*/
char* name, /* in: name of the executable to start
or its full path name */
char* cmd, /* in: command line for the starting
process, or NULL if no command line
specified */
os_process_t* proc, /* out: handle to the process */
os_process_id_t* id); /* out: process id */
/**************************************************************************
Exits a process. */
void
os_process_exit(
/*============*/
ulint code); /* in: exit code */
/**************************************************************************
Gets process exit code. */
ibool
os_process_get_exit_code(
/*=====================*/
/* out: TRUE if succeed, FALSE if fail */
os_process_t proc, /* in: handle to the process */
ulint* code); /* out: exit code */
#endif
/********************************************************************
Sets the priority boost for threads released from waiting within the current
process. */
......
......@@ -99,13 +99,6 @@ os_thread_t
os_thread_get_curr(void);
/*====================*/
/*********************************************************************
Waits for a thread to terminate. */
void
os_thread_wait(
/*===========*/
os_thread_t thread); /* in: thread to wait */
/*********************************************************************
Advises the os to give up remainder of the thread's time slice. */
void
......
......@@ -6,24 +6,6 @@ Comparison services for records
Created 7/1/1994 Heikki Tuuri
************************************************************************/
/*****************************************************************
This function is used to compare two data fields for which we know the
data type. */
int
cmp_data_data_slow(
/*===============*/
/* out: 1, 0, -1, if data1 is greater, equal,
less than data2, respectively */
dtype_t* cur_type,/* in: data type of the fields */
byte* data1, /* in: data field (== a pointer to a memory
buffer) */
ulint len1, /* in: data field length or UNIV_SQL_NULL */
byte* data2, /* in: data field (== a pointer to a memory
buffer) */
ulint len2); /* in: data field length or UNIV_SQL_NULL */
/*****************************************************************
This function is used to compare two data fields for which we know the
data type. */
......
......@@ -68,16 +68,6 @@ row_build_index_entry(
dict_index_t* index, /* in: index on the table */
mem_heap_t* heap); /* in: memory heap from which the memory for
the index entry is allocated */
/*********************************************************************
Builds an index entry from a row. */
void
row_build_index_entry_to_tuple(
/*===========================*/
dtuple_t* entry, /* in/out: index entry; the dtuple must have
enough fields for the index! */
dtuple_t* row, /* in: row */
dict_index_t* index); /* in: index on the table */
/***********************************************************************
An inverse function to dict_row_build_index_entry. Builds a row from a
record in a clustered index. */
......@@ -103,21 +93,6 @@ row_build(
mem_heap_t* heap); /* in: memory heap from which the memory
needed is allocated */
/***********************************************************************
An inverse function to dict_row_build_index_entry. Builds a row from a
record in a clustered index. */
void
row_build_to_tuple(
/*===============*/
dtuple_t* row, /* in/out: row built; see the NOTE below! */
dict_index_t* index, /* in: clustered index */
rec_t* rec); /* in: record in the clustered index;
NOTE: the data fields in the row will point
directly into this record, therefore,
the buffer page of this record must be
at least s-latched and the latch held
as long as the row dtuple is used! */
/***********************************************************************
Converts an index record to a typed data tuple. */
dtuple_t*
......
......@@ -209,13 +209,7 @@ srv_boot(void);
/*==========*/
/* out: DB_SUCCESS or error code */
/*************************************************************************
Initializes the server. */
void
srv_init(void);
/*==========*/
/*************************************************************************
Frees the OS fast mutex created in srv_init(). */
Frees the OS fast mutex created in srv_boot(). */
void
srv_free(void);
......@@ -265,23 +259,6 @@ srv_master_thread(
/* out: a dummy parameter */
void* arg); /* in: a dummy parameter required by
os_thread_create */
/*************************************************************************
Reads a keyword and a value from a file. */
ulint
srv_read_init_val(
/*==============*/
/* out: DB_SUCCESS or error code */
FILE* initfile, /* in: file pointer */
char* keyword, /* in: keyword before value(s), or NULL if
no keyword read */
char* str_buf, /* in/out: buffer for a string value to read,
buffer size must be 10000 bytes, if NULL
then not read */
ulint* num_val, /* out: numerical value to read, if NULL
then not read */
ibool print_not_err); /* in: if TRUE, then we will not print
error messages to console */
/***********************************************************************
Tells the Innobase server that there has been activity in the database
and wakes up the master thread if it is suspended (not sleeping). Used
......
......@@ -234,15 +234,6 @@ mutex_get_waiters(
/*==============*/
/* out: value to set */
mutex_t* mutex); /* in: mutex */
/**********************************************************************
Implements the memory barrier operation which makes a serialization point to
the instruction flow. This is needed because the Pentium may speculatively
execute reads before preceding writes are committed. We could also use here
any LOCKed instruction (see Intel Software Dev. Manual, Vol. 3). */
void
mutex_fence(void);
/*=============*/
/*
LATCHING ORDER WITHIN THE DATABASE
......
......@@ -343,179 +343,6 @@ lock_deadlock_recursive(
#define lock_mutex_enter_kernel() mutex_enter(&kernel_mutex)
#define lock_mutex_exit_kernel() mutex_exit(&kernel_mutex)
#ifdef notdefined
/*************************************************************************
Reserves the kernel mutex. This function is used in this module to allow
monitoring the contention degree on the kernel mutex caused by the lock
operations. */
UNIV_INLINE
void
lock_mutex_enter_kernel(void)
/*=========================*/
{
mutex_enter(&kernel_mutex);
}
/*************************************************************************
Releases the kernel mutex. This function is used in this module to allow
monitoring the contention degree on the kernel mutex caused by the lock
operations. */
UNIV_INLINE
void
lock_mutex_exit_kernel(void)
/*=========================*/
{
mutex_exit(&kernel_mutex);
}
#endif
#ifdef notdefined
/*************************************************************************
Gets the mutex protecting record locks for a page in the buffer pool. */
UNIV_INLINE
mutex_t*
lock_rec_get_mutex(
/*===============*/
byte* ptr) /* in: pointer to somewhere within a buffer frame */
{
return(buf_frame_get_lock_mutex(ptr));
}
/*************************************************************************
Reserves the mutex protecting record locks for a page in the buffer pool. */
UNIV_INLINE
void
lock_rec_mutex_enter(
/*=================*/
byte* ptr) /* in: pointer to somewhere within a buffer frame */
{
mutex_enter(lock_rec_get_mutex(ptr));
}
/*************************************************************************
Releases the mutex protecting record locks for a page in the buffer pool. */
UNIV_INLINE
void
lock_rec_mutex_exit(
/*================*/
byte* ptr) /* in: pointer to somewhere within a buffer frame */
{
mutex_exit(lock_rec_get_mutex(ptr));
}
/*************************************************************************
Checks if the caller owns the mutex to record locks of a page. Works only in
the debug version. */
UNIV_INLINE
ibool
lock_rec_mutex_own(
/*===============*/
/* out: TRUE if the current OS thread has reserved the
mutex */
byte* ptr) /* in: pointer to somewhere within a buffer frame */
{
return(mutex_own(lock_rec_get_mutex(ptr)));
}
/*************************************************************************
Gets the mutex protecting record locks on a given page address. */
mutex_t*
lock_rec_get_mutex_for_addr(
/*========================*/
ulint space, /* in: space id */
ulint page_no)/* in: page number */
{
return(hash_get_mutex(lock_sys->rec_hash,
lock_rec_fold(space, page_no)));
}
/*************************************************************************
Checks if the caller owns the mutex to record locks of a page. Works only in
the debug version. */
UNIV_INLINE
ibool
lock_rec_mutex_own_addr(
/*====================*/
ulint space, /* in: space id */
ulint page_no)/* in: page number */
{
return(mutex_own(lock_rec_get_mutex_for_addr(space, page_no)));
}
/*************************************************************************
Reserves all the mutexes protecting record locks. */
UNIV_INLINE
void
lock_rec_mutex_enter_all(void)
/*==========================*/
{
hash_table_t* table;
ulint n_mutexes;
ulint i;
table = lock_sys->rec_hash;
n_mutexes = table->n_mutexes;
for (i = 0; i < n_mutexes; i++) {
mutex_enter(hash_get_nth_mutex(table, i));
}
}
/*************************************************************************
Releases all the mutexes protecting record locks. */
UNIV_INLINE
void
lock_rec_mutex_exit_all(void)
/*=========================*/
{
hash_table_t* table;
ulint n_mutexes;
ulint i;
table = lock_sys->rec_hash;
n_mutexes = table->n_mutexes;
for (i = 0; i < n_mutexes; i++) {
mutex_exit(hash_get_nth_mutex(table, i));
}
}
/*************************************************************************
Checks that the current OS thread owns all the mutexes protecting record
locks. */
UNIV_INLINE
ibool
lock_rec_mutex_own_all(void)
/*========================*/
/* out: TRUE if owns all */
{
hash_table_t* table;
ulint n_mutexes;
ibool owns_yes = TRUE;
ulint i;
table = lock_sys->rec_hash;
n_mutexes = table->n_mutexes;
for (i = 0; i < n_mutexes; i++) {
if (!mutex_own(hash_get_nth_mutex(table, i))) {
owns_yes = FALSE;
}
}
return(owns_yes);
}
#endif
/*************************************************************************
Checks that a transaction id is sensible, i.e., not in the future. */
......@@ -2022,7 +1849,7 @@ possible, enqueues a waiting lock request. This is a low-level function
which does NOT look at implicit locks! Checks lock compatibility within
explicit locks. This function sets a normal next-key lock, or in the case
of a page supremum record, a gap type lock. */
static
ulint
lock_rec_lock(
/*==========*/
......@@ -2104,7 +1931,7 @@ lock_rec_has_to_wait_in_queue(
/*****************************************************************
Grants a lock to a waiting lock request and releases the waiting
transaction. */
static
void
lock_grant(
/*=======*/
......@@ -2171,7 +1998,7 @@ lock_rec_cancel(
Removes a record lock request, waiting or granted, from the queue and
grants locks to other transactions in the queue if they now are entitled
to a lock. NOTE: all record locks contained in in_lock are removed. */
static
void
lock_rec_dequeue_from_page(
/*=======================*/
......@@ -2342,7 +2169,7 @@ lock_rec_inherit_to_gap(
Makes a record to inherit the gap locks (except LOCK_INSERT_INTENTION type)
of another record as gap type locks, but does not reset the lock bits of the
other record. Also waiting lock requests are inherited as GRANTED gap locks. */
static
void
lock_rec_inherit_to_gap_if_gap_lock(
/*================================*/
......@@ -3582,7 +3409,7 @@ lock_table_has_to_wait_in_queue(
Removes a table lock request, waiting or granted, from the queue and grants
locks to other transactions in the queue, if they now are entitled to a
lock. */
static
void
lock_table_dequeue(
/*===============*/
......
......@@ -167,9 +167,10 @@ recv_sys_empty_hash(void)
recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 256);
}
#ifndef UNIV_LOG_DEBUG
/************************************************************
Frees the recovery system. */
static
void
recv_sys_free(void)
/*===============*/
......@@ -186,6 +187,7 @@ recv_sys_free(void)
mutex_exit(&(recv_sys->mutex));
}
#endif /* !UNIV_LOG_DEBUG */
/************************************************************
Truncates possible corrupted or extra records from a log group. */
......@@ -343,7 +345,7 @@ Copies a log segment from the most up-to-date log group to the other log
groups, so that they all contain the latest log data. Also writes the info
about the latest checkpoint to the groups, and inits the fields in the group
memory structs to up-to-date values. */
static
void
recv_synchronize_groups(
/*====================*/
......@@ -1767,10 +1769,11 @@ recv_calc_lsn_on_data_add(
return(ut_dulint_add(lsn, lsn_len));
}
#ifdef UNIV_LOG_DEBUG
/***********************************************************
Checks that the parser recognizes incomplete initial segments of a log
record as incomplete. */
static
void
recv_check_incomplete_log_recs(
/*===========================*/
......@@ -1788,6 +1791,7 @@ recv_check_incomplete_log_recs(
&page_no, &body));
}
}
#endif /* UNIV_LOG_DEBUG */
/***********************************************************
Prints diagnostic info of corrupt log. */
......
......@@ -582,130 +582,7 @@ mem_heap_validate(
return(TRUE);
}
/*********************************************************************
Prints information of dynamic memory usage and currently allocated
memory heaps or buffers. Can only be used in the debug version. */
static
void
mem_print_info_low(
/*===============*/
ibool print_all __attribute__((unused)))
/* in: if TRUE, all heaps are printed,
else only the heaps allocated after the
previous call of this function */
{
#ifdef UNIV_MEM_DEBUG
mem_hash_node_t* node;
ulint n_heaps = 0;
ulint allocated_mem;
ulint ph_size;
ulint total_allocated_mem = 0;
ibool error;
ulint n_blocks;
#endif
FILE* outfile;
/* outfile = fopen("ibdebug", "a"); */
outfile = stdout;
fprintf(outfile, "\n");
fprintf(outfile,
"________________________________________________________\n");
fprintf(outfile, "MEMORY ALLOCATION INFORMATION\n\n");
#ifndef UNIV_MEM_DEBUG
mem_pool_print_info(outfile, mem_comm_pool);
fprintf(outfile,
"Sorry, non-debug version cannot give more memory info\n");
/* fclose(outfile); */
return;
#else
mutex_enter(&mem_hash_mutex);
fprintf(outfile, "LIST OF CREATED HEAPS AND ALLOCATED BUFFERS: \n\n");
if (!print_all) {
fprintf(outfile, "AFTER THE LAST PRINT INFO\n");
}
node = UT_LIST_GET_FIRST(mem_all_list_base);
while (node != NULL) {
n_heaps++;
if (!print_all && node->nth_heap < mem_last_print_info) {
goto next_heap;
}
mem_heap_validate_or_print(node->heap, NULL,
FALSE, &error, &allocated_mem,
&ph_size, &n_blocks);
total_allocated_mem += allocated_mem;
fprintf(outfile,
"%lu: file %s line %lu of size %lu phys.size %lu with %lu blocks, type %lu\n",
node->nth_heap, node->file_name, node->line,
allocated_mem, ph_size, n_blocks,
(node->heap)->type);
next_heap:
node = UT_LIST_GET_NEXT(all_list, node);
}
fprintf(outfile, "\n");
fprintf(outfile, "Current allocated memory : %lu\n",
mem_current_allocated_memory);
fprintf(outfile, "Current allocated heaps and buffers : %lu\n",
n_heaps);
fprintf(outfile, "Cumulative allocated memory : %lu\n",
mem_total_allocated_memory);
fprintf(outfile, "Maximum allocated memory : %lu\n",
mem_max_allocated_memory);
fprintf(outfile, "Cumulative created heaps and buffers : %lu\n",
mem_n_created_heaps);
fprintf(outfile, "Cumulative number of allocations : %lu\n",
mem_n_allocations);
mem_last_print_info = mem_n_created_heaps;
mutex_exit(&mem_hash_mutex);
mem_pool_print_info(outfile, mem_comm_pool);
/* mem_validate(); */
/* fclose(outfile); */
#endif
}
/*********************************************************************
Prints information of dynamic memory usage and currently allocated memory
heaps or buffers. Can only be used in the debug version. */
void
mem_print_info(void)
/*================*/
{
mem_print_info_low(TRUE);
}
/*********************************************************************
Prints information of dynamic memory usage and currently allocated memory
heaps or buffers since the last ..._print_info or..._print_new_info. */
void
mem_print_new_info(void)
/*====================*/
{
mem_print_info_low(FALSE);
}
/*********************************************************************
TRUE if no memory is currently allocated. */
......@@ -714,8 +591,6 @@ mem_all_freed(void)
/*===============*/
/* out: TRUE if no heaps exist */
{
#ifdef UNIV_MEM_DEBUG
mem_hash_node_t* node;
ulint heap_count = 0;
ulint i;
......@@ -743,15 +618,6 @@ mem_all_freed(void)
} else {
return(FALSE);
}
#else
printf(
"Sorry, non-debug version cannot check if all memory is freed.\n");
return(FALSE);
#endif
}
/*********************************************************************
......@@ -762,8 +628,6 @@ mem_validate_no_assert(void)
/*========================*/
/* out: TRUE if error */
{
#ifdef UNIV_MEM_DEBUG
mem_hash_node_t* node;
ulint n_heaps = 0;
ulint allocated_mem;
......@@ -822,14 +686,6 @@ mem_validate_no_assert(void)
mutex_exit(&mem_hash_mutex);
return(error);
#else
printf("Sorry, non-debug version cannot validate dynamic memory\n");
return(FALSE);
#endif
}
/****************************************************************
......@@ -844,6 +700,7 @@ mem_validate(void)
return(TRUE);
}
#endif /* UNIV_MEM_DEBUG */
/****************************************************************
Tries to find neigboring memory allocation blocks and dumps to stderr
......
......@@ -171,7 +171,7 @@ mtr_log_parse_full_page(
/****************************************************************
Writes to the database log the full contents of the pages that this mtr has
modified. */
static
void
mtr_log_write_backup_full_pages(
/*============================*/
......
......@@ -57,83 +57,6 @@ os_mem_alloc_nocache(
#endif
}
#ifdef notdefined
/********************************************************************
Creates a new process. */
ibool
os_process_create(
/*==============*/
char* name, /* in: name of the executable to start
or its full path name */
char* cmd, /* in: command line for the starting
process, or NULL if no command line
specified */
os_process_t* proc, /* out: handle to the process */
os_process_id_t* id) /* out: process id */
{
BOOL ret;
PROCESS_INFORMATION pinfo;
STARTUPINFO sinfo;
/* The following assignments are default for the startupinfo
structure */
sinfo.cb = sizeof(STARTUPINFO);
sinfo.lpReserved = NULL;
sinfo.lpDesktop = NULL;
sinfo.cbReserved2 = 0;
sinfo.lpReserved = NULL;
ret = CreateProcess(name,
cmd,
NULL, /* No security attributes */
NULL, /* No thread security attrs */
FALSE, /* Do not inherit handles */
0, /* No creation flags */
NULL, /* No environment */
NULL, /* Same current directory */
&sinfo,
&pinfo);
*proc = pinfo.hProcess;
*id = pinfo.dwProcessId;
return(ret);
}
/**************************************************************************
Exits a process. */
void
os_process_exit(
/*============*/
ulint code) /* in: exit code */
{
ExitProcess((UINT)code);
}
/**************************************************************************
Gets a process exit code. */
ibool
os_process_get_exit_code(
/*=====================*/
/* out: TRUE if succeed, FALSE if fail */
os_process_t proc, /* in: handle to the process */
ulint* code) /* out: exit code */
{
DWORD ex_code;
BOOL ret;
ret = GetExitCodeProcess(proc, &ex_code);
*code = (ulint)ex_code;
return(ret);
}
#endif /* notdedfined */
/********************************************************************
Sets the priority boost for threads released from waiting within the current
process. */
......
/* Stores the old console mode when echo is turned off */
ulint os_old_console_mode;
/********************************************************************
Turns off echo from console input. */
void
os_console_echo_off(void)
/*=====================*/
{
GetConsoleMode(stdio, &os_old_console_mode);
SetConsoleMode(stdio, ENABLE_PROCESSED_INPUT);
}
/********************************************************************
Turns on echo in console input. */
void
os_console_echo_on(void)
/*====================*/
{
SetConsoleMode(stdio, &os_old_console_mode);
}
/********************************************************************
Reads a character from the console. */
char
os_read_console(void)
/*=================*/
{
char input_char;
ulint n_chars;
n_chars = 0;
while (n_chars == 0) {
ReadConsole(stdio, &input_char, 1, &n_chars, NULL);
}
return(input_char);
}
......@@ -19,9 +19,6 @@ Created 2/2/1994 Heikki Tuuri
#include "btr0sea.h"
#include "buf0buf.h"
/* A cached template page used in page_create */
page_t* page_template = NULL;
/* THE INDEX PAGE
==============
......@@ -321,20 +318,6 @@ page_create(
fil_page_set_type(page, FIL_PAGE_INDEX);
/* If we have a page template, copy the page structure from there */
if (page_template) {
ut_memcpy(page + PAGE_HEADER,
page_template + PAGE_HEADER, PAGE_HEADER_PRIV_END);
ut_memcpy(page + PAGE_DATA,
page_template + PAGE_DATA,
PAGE_SUPREMUM_END - PAGE_DATA);
ut_memcpy(page + UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START,
page_template + UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START,
PAGE_EMPTY_DIR_START - PAGE_DIR);
return(frame);
}
heap = mem_heap_create(200);
/* 3. CREATE THE INFIMUM AND SUPREMUM RECORDS */
......@@ -409,17 +392,6 @@ page_create(
rec_set_next_offs(infimum_rec, (ulint)(supremum_rec - page));
rec_set_next_offs(supremum_rec, 0);
#ifdef notdefined
/* Disable the use of page_template: there is a race condition here:
while one thread is creating page_template, another one can start
using it before the memcpy completes! */
if (page_template == NULL) {
page_template = mem_alloc(UNIV_PAGE_SIZE);
ut_memcpy(page_template, page, UNIV_PAGE_SIZE);
}
#endif
return(page);
}
......
......@@ -73,37 +73,6 @@ void
que_thr_move_to_run_state(
/*======================*/
que_thr_t* thr); /* in: an query thread */
/**************************************************************************
Tries to parallelize query if it is not parallel enough yet. */
static
que_thr_t*
que_try_parallelize(
/*================*/
/* out: next thread to execute */
que_thr_t* thr); /* in: query thread */
#ifdef notdefined
/********************************************************************
Adds info about the number of inserted rows etc. to the message to the
client. */
static
void
que_thr_add_update_info(
/*====================*/
que_thr_t* thr) /* in: query thread */
{
que_fork_t* graph;
graph = thr->graph;
mach_write_to_8(thr->msg_buf + SESS_SRV_MSG_N_INSERTS,
graph->n_inserts);
mach_write_to_8(thr->msg_buf + SESS_SRV_MSG_N_UPDATES,
graph->n_updates);
mach_write_to_8(thr->msg_buf + SESS_SRV_MSG_N_DELETES,
graph->n_deletes);
}
#endif
/***************************************************************************
Adds a query graph to the session's list of graphs. */
......@@ -711,22 +680,6 @@ que_thr_handle_error(
/* Does nothing */
}
/**************************************************************************
Tries to parallelize query if it is not parallel enough yet. */
static
que_thr_t*
que_try_parallelize(
/*================*/
/* out: next thread to execute */
que_thr_t* thr) /* in: query thread */
{
ut_ad(thr);
/* Does nothing yet */
return(thr);
}
/********************************************************************
Builds a command completed-message to the client. */
static
......@@ -1328,85 +1281,6 @@ que_thr_step(
return(thr);
}
/***********************************************************************
Checks if there is a need for a query thread switch or stopping the current
thread. */
que_thr_t*
que_thr_check_if_switch(
/*====================*/
que_thr_t* thr, /* in: current query thread */
ulint* cumul_resource) /* in: amount of resources used
by the current call of que_run_threads
(resources used by the OS thread!) */
{
que_thr_t* next_thr;
ibool stopped;
if (que_thr_peek_stop(thr)) {
mutex_enter(&kernel_mutex);
stopped = que_thr_stop(thr);
mutex_exit(&kernel_mutex);
if (stopped) {
/* If a signal is processed, we may get a new query
thread next_thr to run */
next_thr = NULL;
que_thr_dec_refer_count(thr, &next_thr);
if (next_thr == NULL) {
return(NULL);
}
thr = next_thr;
}
}
if (thr->resource > QUE_PARALLELIZE_LIMIT) {
/* Try parallelization of the query thread */
thr = que_try_parallelize(thr);
thr->resource = 0;
}
(*cumul_resource)++;
if (*cumul_resource > QUE_ROUND_ROBIN_LIMIT) {
/* It is time to round-robin query threads in the
server task queue */
if (srv_get_thread_type() == SRV_COM) {
/* This OS thread is a SRV_COM thread: we put
the query thread to the task queue and return
to allow the OS thread to receive more
messages from clients */
ut_ad(thr->is_active);
srv_que_task_enqueue(thr);
return(NULL);
} else {
/* Change the query thread if there is another
in the server task queue */
thr = srv_que_round_robin(thr);
}
*cumul_resource = 0;
}
return(thr);
}
/**************************************************************************
Runs query threads. Note that the individual query thread which is run
within this function may change if, e.g., the OS thread executing this
......@@ -1430,27 +1304,6 @@ que_run_threads(
loop_count = QUE_MAX_LOOPS_WITHOUT_CHECK;
cumul_resource = 0;
loop:
if (loop_count >= QUE_MAX_LOOPS_WITHOUT_CHECK) {
/* In MySQL this thread switch is never needed!
loop_count = 0;
next_thr = que_thr_check_if_switch(thr, &cumul_resource);
if (next_thr != thr) {
if (next_thr == NULL) {
return;
}
loop_count = QUE_MAX_LOOPS_WITHOUT_CHECK;
}
thr = next_thr;
*/
}
/* Check that there is enough space in the log to accommodate
possible log entries by this query step; if the operation can touch
more than about 4 pages, checks must be made also within the query
......
......@@ -58,7 +58,7 @@ cmp_debug_dtuple_rec_with_match(
This function is used to compare two data fields for which the data type
is such that we must use MySQL code to compare them. The prototype here
must be a copy of the the one in ha_innobase.cc! */
extern
int
innobase_mysql_cmp(
/*===============*/
......
......@@ -38,7 +38,7 @@ This prototype is copied from /mysql/sql/ha_innodb.cc.
Invalidates the MySQL query cache for the table.
NOTE that the exact prototype of this function has to be in
/innobase/row/row0ins.c! */
extern
void
innobase_invalidate_query_cache(
/*============================*/
......@@ -1349,58 +1349,6 @@ row_ins_check_foreign_constraints(
return(DB_SUCCESS);
}
/*************************************************************************
Reports a UNIQUE key error to dict_unique_err_buf so that SHOW INNODB
STATUS can print it. */
static
void
row_ins_unique_report_err(
/*======================*/
que_thr_t* thr, /* in: query thread */
rec_t* rec, /* in: a record in the index */
dtuple_t* entry, /* in: index entry to insert in the index */
dict_index_t* index) /* in: index */
{
UT_NOT_USED(thr);
UT_NOT_USED(rec);
UT_NOT_USED(entry);
UT_NOT_USED(index);
#ifdef notdefined
/* Disable reporting to test if the slowdown of REPLACE in 4.0.13 was
caused by this! */
char* buf = dict_unique_err_buf;
/* The foreign err mutex protects also dict_unique_err_buf */
mutex_enter(&dict_foreign_err_mutex);
ut_sprintf_timestamp(buf);
sprintf(buf + strlen(buf), " Transaction:\n");
trx_print(buf + strlen(buf), thr_get_trx(thr));
sprintf(buf + strlen(buf),
"Unique key constraint fails for table %.500s.\n", index->table_name);
sprintf(buf + strlen(buf),
"Trying to add in index %.500s (%lu fields unique) tuple:\n", index->name,
dict_index_get_n_unique(index));
dtuple_sprintf(buf + strlen(buf), 1000, entry);
sprintf(buf + strlen(buf),
"\nBut there is already a record:\n");
rec_sprintf(buf + strlen(buf), 1000, rec);
sprintf(buf + strlen(buf), "\n");
ut_a(strlen(buf) < DICT_FOREIGN_ERR_BUF_LEN);
mutex_exit(&dict_foreign_err_mutex);
#endif
}
/*******************************************************************
Checks if a unique key violation to rec would occur at the index entry
insert. */
......@@ -1531,8 +1479,6 @@ row_ins_scan_sec_index_for_duplicate(
if (cmp == 0) {
if (row_ins_dupl_error_with_rec(rec, entry, index)) {
row_ins_unique_report_err(thr, rec, entry,
index);
err = DB_DUPLICATE_KEY;
thr_get_trx(thr)->error_info = index;
......@@ -1627,8 +1573,6 @@ row_ins_duplicate_error_in_clust(
if (row_ins_dupl_error_with_rec(rec, entry,
cursor->index)) {
trx->error_info = cursor->index;
row_ins_unique_report_err(thr, rec, entry,
cursor->index);
return(DB_DUPLICATE_KEY);
}
}
......@@ -1651,9 +1595,6 @@ row_ins_duplicate_error_in_clust(
if (row_ins_dupl_error_with_rec(rec, entry,
cursor->index)) {
trx->error_info = cursor->index;
row_ins_unique_report_err(thr, rec, entry,
cursor->index);
return(DB_DUPLICATE_KEY);
}
}
......
......@@ -1386,10 +1386,12 @@ row_create_table_for_mysql(
"UNIV_MEM_DEBUG defined in univ.i and the server must be\n"
"quiet because allocation from a mem heap is not protected\n"
"by any semaphore.\n");
#ifdef UNIV_MEM_DEBUG
ut_a(mem_validate());
printf("Memory validated\n");
#else /* UNIV_MEM_DEBUG */
puts("Memory NOT validated (recompile with UNIV_MEM_DEBUG)");
#endif /* UNIV_MEM_DEBUG */
}
heap = mem_heap_create(512);
......
......@@ -236,61 +236,6 @@ row_build(
return(row);
}
#ifdef notdefined
/***********************************************************************
An inverse function to dict_row_build_index_entry. Builds a row from a
record in a clustered index. */
void
row_build_to_tuple(
/*===============*/
dtuple_t* row, /* in/out: row built; see the NOTE below! */
dict_index_t* index, /* in: clustered index */
rec_t* rec) /* in: record in the clustered index;
NOTE: the data fields in the row will point
directly into this record, therefore,
the buffer page of this record must be
at least s-latched and the latch held
as long as the row dtuple is used!
NOTE 2: does not work with externally
stored fields! */
{
dict_table_t* table;
ulint n_fields;
ulint i;
dfield_t* dfield;
byte* field;
ulint len;
ulint row_len;
dict_col_t* col;
ut_ad(index && rec);
ut_ad(index->type & DICT_CLUSTERED);
table = index->table;
row_len = dict_table_get_n_cols(table);
dtuple_set_info_bits(row, rec_get_info_bits(rec));
n_fields = dict_index_get_n_fields(index);
ut_ad(n_fields == rec_get_n_fields(rec));
dict_table_copy_types(row, table);
for (i = 0; i < n_fields; i++) {
col = dict_field_get_col(dict_index_get_nth_field(index, i));
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
field = rec_get_nth_field(rec, i, &len);
dfield_set_data(dfield, field, len);
}
ut_ad(dtuple_check_typed(row));
}
#endif
/***********************************************************************
Converts an index record to a typed data tuple. NOTE that externally
stored (often big) fields are NOT copied to heap. */
......
......@@ -721,247 +721,9 @@ srv_get_thread_type(void)
return(type);
}
/***********************************************************************
Increments by 1 the count of active threads of the type given
and releases master thread if necessary. */
static
void
srv_inc_thread_count(
/*=================*/
ulint type) /* in: type of the thread */
{
mutex_enter(&kernel_mutex);
srv_activity_count++;
srv_n_threads_active[type]++;
if (srv_n_threads_active[SRV_MASTER] == 0) {
srv_release_threads(SRV_MASTER, 1);
}
mutex_exit(&kernel_mutex);
}
/***********************************************************************
Decrements by 1 the count of active threads of the type given. */
static
void
srv_dec_thread_count(
/*=================*/
ulint type) /* in: type of the thread */
{
mutex_enter(&kernel_mutex);
/* FIXME: the following assertion sometimes fails: */
if (srv_n_threads_active[type] == 0) {
printf("Error: thread type %lu\n", type);
ut_ad(0);
}
srv_n_threads_active[type]--;
mutex_exit(&kernel_mutex);
}
/***********************************************************************
Calculates the number of allowed utility threads for a thread to decide if
it has to suspend itself in the thread table. */
static
ulint
srv_max_n_utilities(
/*================*/
/* out: maximum number of allowed utilities
of the type given */
ulint type) /* in: utility type */
{
ulint ret;
if (srv_n_threads_active[SRV_COM] == 0) {
if (srv_meter[type] > srv_meter_low_water[type]) {
return(srv_n_threads[type] / 2);
} else {
return(0);
}
} else {
if (srv_meter[type] < srv_meter_foreground[type]) {
return(0);
}
ret = 1 + ((srv_n_threads[type]
* (ulint)(srv_meter[type] - srv_meter_foreground[type]))
/ (ulint)(1000 - srv_meter_foreground[type]));
if (ret > srv_n_threads[type]) {
return(srv_n_threads[type]);
} else {
return(ret);
}
}
}
/***********************************************************************
Increments the utility meter by the value given and releases utility
threads if necessary. */
void
srv_increment_meter(
/*================*/
ulint type, /* in: utility type */
ulint n) /* in: value to add to meter */
{
ulint m;
mutex_enter(&kernel_mutex);
srv_meter[type] += n;
m = srv_max_n_utilities(type);
if (m > srv_n_threads_active[type]) {
srv_release_threads(type, m - srv_n_threads_active[type]);
}
mutex_exit(&kernel_mutex);
}
/***********************************************************************
Releases max number of utility threads if no queries are active and
the high-water mark for the utility is exceeded. */
void
srv_release_max_if_no_queries(void)
/*===============================*/
{
ulint m;
ulint type;
mutex_enter(&kernel_mutex);
if (srv_n_threads_active[SRV_COM] > 0) {
mutex_exit(&kernel_mutex);
return;
}
type = SRV_RECOVERY;
m = srv_n_threads[type] / 2;
if ((srv_meter[type] > srv_meter_high_water[type])
&& (srv_n_threads_active[type] < m)) {
srv_release_threads(type, m - srv_n_threads_active[type]);
printf("Releasing max background\n");
}
mutex_exit(&kernel_mutex);
}
/*************************************************************************
Creates the first communication endpoint for the server. This
first call also initializes the com0com.* module. */
void
srv_communication_init(
/*===================*/
char* endpoint) /* in: server address */
{
ulint ret;
ulint len;
srv_sys->endpoint = com_endpoint_create(COM_SHM);
ut_a(srv_sys->endpoint);
len = ODBC_DATAGRAM_SIZE;
ret = com_endpoint_set_option(srv_sys->endpoint,
COM_OPT_MAX_DGRAM_SIZE,
(byte*)&len, sizeof(ulint));
ut_a(ret == 0);
ret = com_bind(srv_sys->endpoint, endpoint, ut_strlen(endpoint));
ut_a(ret == 0);
}
/*************************************************************************
Creates the utility threads. */
void
srv_create_utility_threads(void)
/*============================*/
{
/* os_thread_t thread;
os_thread_id_t thr_id; */
ulint i;
mutex_enter(&kernel_mutex);
srv_n_threads[SRV_RECOVERY] = 1;
srv_n_threads_active[SRV_RECOVERY] = 1;
mutex_exit(&kernel_mutex);
for (i = 0; i < 1; i++) {
/* thread = os_thread_create(srv_recovery_thread, NULL, &thr_id); */
/* ut_a(thread); */
}
/* thread = os_thread_create(srv_purge_thread, NULL, &thr_id);
ut_a(thread); */
}
/*************************************************************************
Creates the communication threads. */
void
srv_create_com_threads(void)
/*========================*/
{
/* os_thread_t thread;
os_thread_id_t thr_id; */
ulint i;
srv_n_threads[SRV_COM] = srv_n_com_threads;
for (i = 0; i < srv_n_com_threads; i++) {
/* thread = os_thread_create(srv_com_thread, NULL, &thr_id); */
/* ut_a(thread); */
}
}
/*************************************************************************
Creates the worker threads. */
void
srv_create_worker_threads(void)
/*===========================*/
{
/* os_thread_t thread;
os_thread_id_t thr_id; */
ulint i;
srv_n_threads[SRV_WORKER] = srv_n_worker_threads;
srv_n_threads_active[SRV_WORKER] = srv_n_worker_threads;
for (i = 0; i < srv_n_worker_threads; i++) {
/* thread = os_thread_create(srv_worker_thread, NULL, &thr_id); */
/* ut_a(thread); */
}
}
/*************************************************************************
Initializes the server. */
static
void
srv_init(void)
/*==========*/
......@@ -1762,13 +1524,13 @@ srv_sprintf_innodb_monitor(
#ifdef UNIV_LINUX
buf += sprintf(buf,
"Main thread process no. %lu, id %lu, state: %s\n",
"Main thread process no. %lu, id %lu, state: %.29s\n",
srv_main_thread_process_no,
srv_main_thread_id,
srv_main_thread_op_info);
#else
buf += sprintf(buf,
"Main thread id %lu, state: %s\n",
"Main thread id %lu, state: %.29s\n",
srv_main_thread_id,
srv_main_thread_op_info);
#endif
......@@ -2018,13 +1780,6 @@ srv_error_monitor_thread(
srv_refresh_innodb_monitor_stats();
}
/* mem_print_new_info();
if (cnt % 10 == 0) {
mem_print_info();
}
*/
sync_array_print_long_waits();
/* Flush stdout and stderr so that a database user gets their output
......@@ -2490,12 +2245,6 @@ srv_master_thread(
goto background_loop;
}
/* mem_print_new_info();
*/
#ifdef UNIV_SEARCH_PERF_STAT
/* btr_search_print_info(); */
#endif
/* There is no work for background operations either: suspend
master thread to wait for more server activity */
......
......@@ -868,80 +868,6 @@ open_or_create_data_files(
return(DB_SUCCESS);
}
#ifdef notdefined
/*********************************************************************
This thread is used to measure contention of latches. */
static
ulint
test_measure_cont(
/*==============*/
void* arg)
{
ulint i, j;
ulint pcount, kcount, s_scount, s_xcount, s_mcount, lcount;
UT_NOT_USED(arg);
fprintf(stderr, "Starting contention measurement\n");
for (i = 0; i < 1000; i++) {
pcount = 0;
kcount = 0;
s_scount = 0;
s_xcount = 0;
s_mcount = 0;
lcount = 0;
for (j = 0; j < 100; j++) {
if (srv_measure_by_spin) {
ut_delay(ut_rnd_interval(0, 20000));
} else {
os_thread_sleep(20000);
}
if (kernel_mutex.lock_word) {
kcount++;
}
if (buf_pool->mutex.lock_word) {
pcount++;
}
if (log_sys->mutex.lock_word) {
lcount++;
}
if (btr_search_latch.reader_count) {
s_scount++;
}
if (btr_search_latch.writer != RW_LOCK_NOT_LOCKED) {
s_xcount++;
}
if (btr_search_latch.mutex.lock_word) {
s_mcount++;
}
}
fprintf(stderr,
"Mutex res. l %lu, p %lu, k %lu s x %lu s s %lu s mut %lu of %lu\n",
lcount, pcount, kcount, s_xcount, s_scount, s_mcount, j);
/* sync_print_wait_info(); */
fprintf(stderr,
"log i/o %lu n non sea %lu n succ %lu n h fail %lu\n",
log_sys->n_log_ios, btr_cur_n_non_sea,
btr_search_n_succ, btr_search_n_hash_fail);
}
return(0);
}
#endif
/********************************************************************
Starts InnoDB and creates a new database if database files
are not found and the user wants. Server parameters are
......
......@@ -167,46 +167,6 @@ struct sync_level_struct{
ulint level; /* level of the latch in the latching order */
};
#if defined(notdefined) && defined(__GNUC__) && defined(UNIV_INTEL_X86)
ulint
sync_gnuc_intelx86_test_and_set(
/* out: old value of the lock word */
ulint* lw) /* in: pointer to the lock word */
{
ulint res;
/* In assembly we use the so-called AT & T syntax where
the order of operands is inverted compared to the ordinary Intel
syntax. The 'l' after the mnemonics denotes a 32-bit operation.
The line after the code tells which values come out of the asm
code, and the second line tells the input to the asm code. */
asm volatile("movl $1, %%eax; xchgl (%%ecx), %%eax" :
"=eax" (res), "=m" (*lw) :
"ecx" (lw));
return(res);
}
void
sync_gnuc_intelx86_reset(
ulint* lw) /* in: pointer to the lock word */
{
/* In assembly we use the so-called AT & T syntax where
the order of operands is inverted compared to the ordinary Intel
syntax. The 'l' after the mnemonics denotes a 32-bit operation. */
asm volatile("movl $0, %%eax; xchgl (%%ecx), %%eax" :
"=m" (*lw) :
"ecx" (lw) :
"eax"); /* gcc does not seem to understand
that our asm code resets eax: tell it
explicitly that after the third ':' */
}
#endif
/**********************************************************************
Creates, or rather, initializes a mutex object in a specified memory
location (which must be appropriately aligned). The mutex is initialized
......
......@@ -41,47 +41,6 @@ trx_undof_page_add_undo_rec_log(
byte* log_ptr;
ulint len;
#ifdef notdefined
ulint i;
byte* prev_rec_ptr;
byte* ptr;
ulint min_len;
ut_ad(new_free >= old_free + 4);
i = 0;
ptr = undo_page + old_free + 2;
if (old_free > mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
+ TRX_UNDO_PAGE_START)) {
prev_rec_ptr = undo_page + mach_read_from_2(ptr - 4) + 2;
min_len = ut_min(new_free - old_free - 4,
(undo_page + old_free - 2) - prev_rec_ptr);
for (;;) {
if (i >= min_len) {
break;
} else if ((*ptr == *prev_rec_ptr)
|| ((*ptr == *prev_rec_ptr + 1)
&& (ptr + 1 == suffix))) {
i++;
ptr++;
prev_rec_ptr++;
} else {
break;
}
}
}
mlog_write_initial_log_record(undo_page, MLOG_UNDO_INSERT, mtr);
mlog_catenate_ulint(mtr, old_free, MLOG_2BYTES);
mlog_catenate_ulint_compressed(mtr, i);
mlog_catenate_string(mtr, ptr, new_free - old_free - 2 - i);
#endif
log_ptr = mlog_open(mtr, 30 + MLOG_BUF_MARGIN);
if (log_ptr == NULL) {
......
......@@ -650,29 +650,6 @@ trx_commit_off_kernel(
if (undo) {
mutex_enter(&kernel_mutex);
#ifdef notdefined
/* !!!!!!!!! There is a bug here: purge and rollback
need the whole stack of old record versions even if no
consistent read would need them!! This is because they
decide on the basis of the old versions when we can
remove delete marked secondary index records! */
if (!undo->del_marks && (undo->size == 1)
&& (UT_LIST_GET_LEN(trx_sys->view_list) == 1)) {
/* There is no need to save the update undo
log: discard it; note that &mtr gets committed
while we must hold the kernel mutex and
therefore this optimization may add to the
contention of the kernel mutex. */
lsn = trx_undo_update_cleanup_by_discard(trx,
&mtr);
mutex_exit(&(rseg->mutex));
goto shortcut;
}
#endif
trx->no = trx_sys_get_new_trx_no();
mutex_exit(&kernel_mutex);
......
......@@ -18,10 +18,3 @@ ibool ut_dbg_stop_threads = FALSE;
/* Null pointer used to generate memory trap */
ulint* ut_dbg_null_ptr = NULL;
/* Dummy function to prevent gcc from ignoring this file */
void
ut_dummy(void)
{
printf("Hello world\n");
}
......@@ -244,4 +244,4 @@ ut_str_contains(
}
return(FALSE);
}
\ No newline at end of file
}
......@@ -13,6 +13,7 @@ Created 5/11/1994 Heikki Tuuri
#endif
#include <stdarg.h>
#include <string.h>
#include "ut0sort.h"
......
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