Commit d325a2c9 authored by monty@donna.mysql.fi's avatar monty@donna.mysql.fi

Merge work:/my/mysql into donna.mysql.fi:/home/my/bk/mysql

parents 5ccbbd83 3abaff79
...@@ -6,9 +6,6 @@ The B-tree ...@@ -6,9 +6,6 @@ The B-tree
Created 6/2/1994 Heikki Tuuri Created 6/2/1994 Heikki Tuuri
*******************************************************/ *******************************************************/
/* Test a change in bitkeeper */
#include "btr0btr.h" #include "btr0btr.h"
#ifdef UNIV_NONINL #ifdef UNIV_NONINL
......
...@@ -25,6 +25,7 @@ Created 10/16/1994 Heikki Tuuri ...@@ -25,6 +25,7 @@ Created 10/16/1994 Heikki Tuuri
#include "page0page.h" #include "page0page.h"
#include "rem0rec.h" #include "rem0rec.h"
#include "rem0cmp.h"
#include "btr0btr.h" #include "btr0btr.h"
#include "btr0sea.h" #include "btr0sea.h"
#include "row0upd.h" #include "row0upd.h"
...@@ -314,7 +315,7 @@ retry_page_get: ...@@ -314,7 +315,7 @@ retry_page_get:
page = buf_page_get_gen(space, page_no, rw_latch, guess, page = buf_page_get_gen(space, page_no, rw_latch, guess,
buf_mode, buf_mode,
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__, IB__FILE__, __LINE__,
#endif #endif
mtr); mtr);
...@@ -485,7 +486,7 @@ btr_cur_open_at_index_side( ...@@ -485,7 +486,7 @@ btr_cur_open_at_index_side(
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL, page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET, BUF_GET,
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__, IB__FILE__, __LINE__,
#endif #endif
mtr); mtr);
ut_ad(0 == ut_dulint_cmp(tree->id, ut_ad(0 == ut_dulint_cmp(tree->id,
...@@ -574,7 +575,7 @@ btr_cur_open_at_rnd_pos( ...@@ -574,7 +575,7 @@ btr_cur_open_at_rnd_pos(
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL, page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET, BUF_GET,
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__, IB__FILE__, __LINE__,
#endif #endif
mtr); mtr);
ut_ad(0 == ut_dulint_cmp(tree->id, ut_ad(0 == ut_dulint_cmp(tree->id,
......
...@@ -187,13 +187,13 @@ btr_search_info_update_hash( ...@@ -187,13 +187,13 @@ btr_search_info_update_hash(
return; return;
} }
n_unique = dict_index_get_n_unique_in_tree(index);
if (info->n_hash_potential == 0) { if (info->n_hash_potential == 0) {
goto set_new_recomm; goto set_new_recomm;
} }
n_unique = dict_index_get_n_unique_in_tree(index);
/* Test if the search would have succeeded using the recommended /* Test if the search would have succeeded using the recommended
hash prefix */ hash prefix */
...@@ -676,7 +676,7 @@ btr_search_guess_on_hash( ...@@ -676,7 +676,7 @@ btr_search_guess_on_hash(
success = buf_page_get_known_nowait(latch_mode, page, success = buf_page_get_known_nowait(latch_mode, page,
BUF_MAKE_YOUNG, BUF_MAKE_YOUNG,
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__, IB__FILE__, __LINE__,
#endif #endif
mtr); mtr);
......
...@@ -1117,7 +1117,7 @@ buf_page_create( ...@@ -1117,7 +1117,7 @@ buf_page_create(
buf_LRU_add_block(block, FALSE); buf_LRU_add_block(block, FALSE);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_buf_fix_inc_debug(block, __FILE__, __LINE__); buf_block_buf_fix_inc_debug(block, IB__FILE__, __LINE__);
#else #else
buf_block_buf_fix_inc(block); buf_block_buf_fix_inc(block);
#endif #endif
......
...@@ -560,7 +560,7 @@ buf_flush_batch( ...@@ -560,7 +560,7 @@ buf_flush_batch(
if (buf_debug_prints && (page_count > 0)) { if (buf_debug_prints && (page_count > 0)) {
if (flush_type == BUF_FLUSH_LRU) { if (flush_type == BUF_FLUSH_LRU) {
printf("To flush %lu pages in LRU flush\n", printf("To flush %lu pages in LRU flush\n",
page_count, flush_type); page_count);
} else if (flush_type == BUF_FLUSH_LIST) { } else if (flush_type == BUF_FLUSH_LIST) {
printf("To flush %lu pages in flush list flush\n", printf("To flush %lu pages in flush list flush\n",
page_count, flush_type); page_count, flush_type);
......
...@@ -774,7 +774,7 @@ com_shm_create_or_open( ...@@ -774,7 +774,7 @@ com_shm_create_or_open(
ut_memcpy(buf, name, len); ut_memcpy(buf, name, len);
ut_strcpy(buf + len, "_IBSHM"); ut_strcpy(buf + len, (char*)"_IBSHM");
shm = os_shm_create(sizeof(com_shm_info_t) + COM_MAX_ADDR_LEN + shm = os_shm_create(sizeof(com_shm_info_t) + COM_MAX_ADDR_LEN +
com_shm_endpoint_get_size(ep), buf); com_shm_endpoint_get_size(ep), buf);
...@@ -791,13 +791,13 @@ com_shm_create_or_open( ...@@ -791,13 +791,13 @@ com_shm_create_or_open(
return(COM_ERR_NOT_SPECIFIED); return(COM_ERR_NOT_SPECIFIED);
} }
ut_strcpy(buf + len, "_IBSHM_EV_NE"), ut_strcpy(buf + len, (char*)"_IBSHM_EV_NE"),
event_ne = os_event_create_auto(buf); event_ne = os_event_create_auto(buf);
ut_ad(event_ne); ut_ad(event_ne);
ut_strcpy(buf + len, "_IBSHM_EV_EM"), ut_strcpy(buf + len, (char*)"_IBSHM_EV_EM"),
event_em = os_event_create_auto(buf); event_em = os_event_create_auto(buf);
...@@ -843,7 +843,7 @@ com_shm_open( ...@@ -843,7 +843,7 @@ com_shm_open(
/* Open the interprocess mutex to protect the shared memory area */ /* Open the interprocess mutex to protect the shared memory area */
ut_memcpy(buf, name, len); ut_memcpy(buf, name, len);
ut_strcpy(buf + len, "_IBSHM_MTX"); ut_strcpy(buf + len, (char*)"_IBSHM_MTX");
ret = ip_mutex_open(com_shm_get_ip_mutex(map), buf, &ip_hdl); ret = ip_mutex_open(com_shm_get_ip_mutex(map), buf, &ip_hdl);
...@@ -890,7 +890,7 @@ com_shm_bind( ...@@ -890,7 +890,7 @@ com_shm_bind(
/* Create the interprocess mutex to protect the shared memory area */ /* Create the interprocess mutex to protect the shared memory area */
ut_memcpy(buf, name, len); ut_memcpy(buf, name, len);
ut_strcpy(buf + len, "_IBSHM_MTX"); ut_strcpy(buf + len, (char*)"_IBSHM_MTX");
ret = ip_mutex_create(com_shm_get_ip_mutex(map), buf, &ip_hdl); ret = ip_mutex_create(com_shm_get_ip_mutex(map), buf, &ip_hdl);
......
...@@ -155,9 +155,7 @@ dtuple_validate( ...@@ -155,9 +155,7 @@ dtuple_validate(
ulint len; ulint len;
ulint i; ulint i;
ulint j; ulint j;
ulint sum = 0; /* A dummy variable used
to prevent the compiler
from erasing the loop below */
ut_a(tuple->magic_n = DATA_TUPLE_MAGIC_N); ut_a(tuple->magic_n = DATA_TUPLE_MAGIC_N);
n_fields = dtuple_get_n_fields(tuple); n_fields = dtuple_get_n_fields(tuple);
...@@ -227,7 +225,7 @@ dfield_print( ...@@ -227,7 +225,7 @@ dfield_print(
} }
} else if (mtype == DATA_INT) { } else if (mtype == DATA_INT) {
ut_a(len == 4); /* only works for 32-bit integers */ ut_a(len == 4); /* only works for 32-bit integers */
printf("%li", (int)mach_read_from_4(data)); printf("%i", (int)mach_read_from_4(data));
} else { } else {
ut_error; ut_error;
} }
...@@ -285,13 +283,13 @@ dfield_print_also_hex( ...@@ -285,13 +283,13 @@ dfield_print_also_hex(
data = dfield_get_data(dfield); data = dfield_get_data(dfield);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
printf("%02x", (ulint)*data); printf("%02lx", (ulint)*data);
data++; data++;
} }
} else if (mtype == DATA_INT) { } else if (mtype == DATA_INT) {
ut_a(len == 4); /* inly works for 32-bit integers */ ut_a(len == 4); /* inly works for 32-bit integers */
printf("%li", (int)mach_read_from_4(data)); printf("%i", (int)mach_read_from_4(data));
} else { } else {
ut_error; ut_error;
} }
...@@ -380,6 +378,8 @@ dtuple_sprintf( ...@@ -380,6 +378,8 @@ dtuple_sprintf(
return(len); return(len);
} }
#ifdef notdefined
/****************************************************************** /******************************************************************
Generates random numbers, where 10/16 is uniformly Generates random numbers, where 10/16 is uniformly
distributed between 0 and n1, 5/16 between 0 and n2, distributed between 0 and n1, 5/16 between 0 and n2,
...@@ -788,3 +788,5 @@ dtuple_gen_search_tuple_TPC_C( ...@@ -788,3 +788,5 @@ dtuple_gen_search_tuple_TPC_C(
ut_ad(dtuple_validate(tuple)); ut_ad(dtuple_validate(tuple));
} }
#endif /* notdefined */
...@@ -89,5 +89,3 @@ dtype_print( ...@@ -89,5 +89,3 @@ dtype_print(
printf("; len %lu prec %lu\n", type->len, type->prec); printf("; len %lu prec %lu\n", type->len, type->prec);
} }
...@@ -80,16 +80,6 @@ dict_create_search_tuple( ...@@ -80,16 +80,6 @@ dict_create_search_tuple(
table */ table */
mem_heap_t* heap); /* in: memory heap from which the memory for mem_heap_t* heap); /* in: memory heap from which the memory for
the built tuple is allocated */ the built tuple is allocated */
/*************************************************************************
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_cluster_index(
/*======================*/
dict_table_t* table, /* in: cluster */
trx_t* trx); /* in: transaction handle */
/********************************************************************* /*********************************************************************
Based on a table object, this function builds the entry to be inserted Based on a table object, this function builds the entry to be inserted
...@@ -814,7 +804,7 @@ dict_create_table_step( ...@@ -814,7 +804,7 @@ dict_create_table_step(
que_thr_t* thr) /* in: query thread */ que_thr_t* thr) /* in: query thread */
{ {
tab_node_t* node; tab_node_t* node;
ulint err; ulint err = DB_ERROR;
trx_t* trx; trx_t* trx;
ut_ad(thr); ut_ad(thr);
...@@ -922,7 +912,7 @@ dict_create_index_step( ...@@ -922,7 +912,7 @@ dict_create_index_step(
{ {
ind_node_t* node; ind_node_t* node;
ibool success; ibool success;
ulint err; ulint err = DB_ERROR;
trx_t* trx; trx_t* trx;
ut_ad(thr); ut_ad(thr);
......
...@@ -19,6 +19,7 @@ Created 1/8/1996 Heikki Tuuri ...@@ -19,6 +19,7 @@ Created 1/8/1996 Heikki Tuuri
#include "dict0mem.h" #include "dict0mem.h"
#include "trx0undo.h" #include "trx0undo.h"
#include "btr0btr.h" #include "btr0btr.h"
#include "btr0cur.h"
#include "btr0sea.h" #include "btr0sea.h"
#include "pars0pars.h" #include "pars0pars.h"
#include "pars0sym.h" #include "pars0sym.h"
...@@ -39,13 +40,6 @@ dict_sys_t* dict_sys = NULL; /* the dictionary system */ ...@@ -39,13 +40,6 @@ dict_sys_t* dict_sys = NULL; /* the dictionary system */
#define DICT_POOL_PER_VARYING 4 /* buffer pool max size per data #define DICT_POOL_PER_VARYING 4 /* buffer pool max size per data
dictionary varying size in bytes */ dictionary varying size in bytes */
/**************************************************************************
Frees tables from the end of table_LRU if the dictionary cache occupies
too much space. */
static
void
dict_table_LRU_trim(void);
/*=====================*/
/************************************************************************** /**************************************************************************
Adds a column to the data dictionary hash table. */ Adds a column to the data dictionary hash table. */
static static
...@@ -586,7 +580,7 @@ dict_table_remove_from_cache( ...@@ -586,7 +580,7 @@ dict_table_remove_from_cache(
/************************************************************************** /**************************************************************************
Frees tables from the end of table_LRU if the dictionary cache occupies Frees tables from the end of table_LRU if the dictionary cache occupies
too much space. Currently not used! */ too much space. Currently not used! */
static
void void
dict_table_LRU_trim(void) dict_table_LRU_trim(void)
/*=====================*/ /*=====================*/
......
...@@ -544,6 +544,8 @@ fil_write_flushed_lsn_to_data_files( ...@@ -544,6 +544,8 @@ fil_write_flushed_lsn_to_data_files(
} }
mutex_exit(&(fil_system->mutex)); mutex_exit(&(fil_system->mutex));
return(DB_SUCCESS);
} }
/*********************************************************************** /***********************************************************************
......
...@@ -2626,11 +2626,11 @@ fseg_free_step( ...@@ -2626,11 +2626,11 @@ fseg_free_step(
fseg_inode_t* inode; fseg_inode_t* inode;
ulint space; ulint space;
space = buf_frame_get_space_id(header);
ut_ad(!mutex_own(&kernel_mutex) ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space), || mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK)); MTR_MEMO_X_LOCK));
space = buf_frame_get_space_id(header);
mtr_x_lock(fil_space_get_latch(space), mtr); mtr_x_lock(fil_space_get_latch(space), mtr);
inode = fseg_inode_get(header, mtr); inode = fseg_inode_get(header, mtr);
...@@ -2682,11 +2682,11 @@ fseg_free_step_not_header( ...@@ -2682,11 +2682,11 @@ fseg_free_step_not_header(
ulint space; ulint space;
ulint page_no; ulint page_no;
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space), MTR_MEMO_X_LOCK));
space = buf_frame_get_space_id(header); space = buf_frame_get_space_id(header);
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK));
mtr_x_lock(fil_space_get_latch(space), mtr); mtr_x_lock(fil_space_get_latch(space), mtr);
inode = fseg_inode_get(header, mtr); inode = fseg_inode_get(header, mtr);
......
...@@ -512,5 +512,5 @@ flst_print( ...@@ -512,5 +512,5 @@ flst_print(
printf("FILE-BASED LIST:\n"); printf("FILE-BASED LIST:\n");
printf("Base node in space %lu page %lu byte offset %lu; len %lu\n", printf("Base node in space %lu page %lu byte offset %lu; len %lu\n",
buf_frame_get_space_id(frame), buf_frame_get_page_no(frame), buf_frame_get_space_id(frame), buf_frame_get_page_no(frame),
base - frame, len); (ulint) (base - frame), len);
} }
...@@ -1292,6 +1292,8 @@ ibuf_add_free_page( ...@@ -1292,6 +1292,8 @@ ibuf_add_free_page(
mutex_exit(&ibuf_mutex); mutex_exit(&ibuf_mutex);
ibuf_exit(); ibuf_exit();
return(DB_SUCCESS);
} }
/************************************************************************* /*************************************************************************
...@@ -2424,7 +2426,7 @@ loop: ...@@ -2424,7 +2426,7 @@ loop:
success = buf_page_get_known_nowait(RW_X_LATCH, page, success = buf_page_get_known_nowait(RW_X_LATCH, page,
BUF_KEEP_OLD, BUF_KEEP_OLD,
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__, IB__FILE__, __LINE__,
#endif #endif
&mtr); &mtr);
......
...@@ -119,7 +119,7 @@ in LA! */ ...@@ -119,7 +119,7 @@ in LA! */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\ #define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\ SP, OF, LA, NULL,\
BUF_GET, __FILE__, __LINE__, MTR) BUF_GET, IB__FILE__, __LINE__, MTR)
#else #else
#define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\ #define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\ SP, OF, LA, NULL,\
...@@ -134,7 +134,7 @@ with care. */ ...@@ -134,7 +134,7 @@ with care. */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\ #define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\
SP, OF, RW_NO_LATCH, NULL,\ SP, OF, RW_NO_LATCH, NULL,\
BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR) BUF_GET_NO_LATCH, IB__FILE__, __LINE__, MTR)
#else #else
#define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\ #define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\
SP, OF, RW_NO_LATCH, NULL,\ SP, OF, RW_NO_LATCH, NULL,\
...@@ -146,7 +146,7 @@ improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */ ...@@ -146,7 +146,7 @@ improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\ #define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\ SP, OF, LA, NULL,\
BUF_GET_NOWAIT, __FILE__, __LINE__, MTR) BUF_GET_NOWAIT, IB__FILE__, __LINE__, MTR)
#else #else
#define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\ #define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\ SP, OF, LA, NULL,\
...@@ -158,7 +158,7 @@ buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and ...@@ -158,7 +158,7 @@ buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and
RW_X_LATCH are allowed as LA! */ RW_X_LATCH are allowed as LA! */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define buf_page_optimistic_get(LA, G, MC, MTR) buf_page_optimistic_get_func(\ #define buf_page_optimistic_get(LA, G, MC, MTR) buf_page_optimistic_get_func(\
LA, G, MC, __FILE__, __LINE__, MTR) LA, G, MC, IB__FILE__, __LINE__, MTR)
#else #else
#define buf_page_optimistic_get(LA, G, MC, MTR) buf_page_optimistic_get_func(\ #define buf_page_optimistic_get(LA, G, MC, MTR) buf_page_optimistic_get_func(\
LA, G, MC, MTR) LA, G, MC, MTR)
......
...@@ -558,7 +558,7 @@ buf_page_get_release_on_io( ...@@ -558,7 +558,7 @@ buf_page_get_release_on_io(
frame = buf_page_get_gen(space, offset, rw_latch, guess, frame = buf_page_get_gen(space, offset, rw_latch, guess,
BUF_GET_IF_IN_POOL, BUF_GET_IF_IN_POOL,
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__, IB__FILE__, __LINE__,
#endif #endif
mtr); mtr);
if (frame != NULL) { if (frame != NULL) {
......
...@@ -18,7 +18,6 @@ hash_get_nth_cell( ...@@ -18,7 +18,6 @@ hash_get_nth_cell(
hash_table_t* table, /* in: hash table */ hash_table_t* table, /* in: hash table */
ulint n) /* in: cell index */ ulint n) /* in: cell index */
{ {
ut_ad(n >= 0);
ut_ad(n < table->n_cells); ut_ad(n < table->n_cells);
return(table->array + n); return(table->array + n);
......
...@@ -17,7 +17,7 @@ mach_write_to_1( ...@@ -17,7 +17,7 @@ mach_write_to_1(
ulint n) /* in: ulint integer to be stored, >= 0, < 256 */ ulint n) /* in: ulint integer to be stored, >= 0, < 256 */
{ {
ut_ad(b); ut_ad(b);
ut_ad((n >= 0) && (n <= 0xFF)); ut_ad(n <= 0xFF);
b[0] = (byte)n; b[0] = (byte)n;
} }
......
...@@ -64,7 +64,7 @@ heap creation. */ ...@@ -64,7 +64,7 @@ heap creation. */
#ifdef UNIV_MEM_DEBUG #ifdef UNIV_MEM_DEBUG
#define mem_heap_create(N) mem_heap_create_func(\ #define mem_heap_create(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_DYNAMIC,\ (N), NULL, MEM_HEAP_DYNAMIC,\
__FILE__, __LINE__) IB__FILE__, __LINE__)
#else #else
#define mem_heap_create(N) mem_heap_create_func(N, NULL, MEM_HEAP_DYNAMIC) #define mem_heap_create(N) mem_heap_create_func(N, NULL, MEM_HEAP_DYNAMIC)
#endif #endif
...@@ -74,7 +74,7 @@ heap creation. */ ...@@ -74,7 +74,7 @@ heap creation. */
#ifdef UNIV_MEM_DEBUG #ifdef UNIV_MEM_DEBUG
#define mem_heap_create_in_buffer(N) mem_heap_create_func(\ #define mem_heap_create_in_buffer(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BUFFER,\ (N), NULL, MEM_HEAP_BUFFER,\
__FILE__, __LINE__) IB__FILE__, __LINE__)
#else #else
#define mem_heap_create_in_buffer(N) mem_heap_create_func(N, NULL,\ #define mem_heap_create_in_buffer(N) mem_heap_create_func(N, NULL,\
MEM_HEAP_BUFFER) MEM_HEAP_BUFFER)
...@@ -86,7 +86,7 @@ heap creation. */ ...@@ -86,7 +86,7 @@ heap creation. */
#define mem_heap_create_in_btr_search(N) mem_heap_create_func(\ #define mem_heap_create_in_btr_search(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BTR_SEARCH |\ (N), NULL, MEM_HEAP_BTR_SEARCH |\
MEM_HEAP_BUFFER,\ MEM_HEAP_BUFFER,\
__FILE__, __LINE__) IB__FILE__, __LINE__)
#else #else
#define mem_heap_create_in_btr_search(N) mem_heap_create_func(N, NULL,\ #define mem_heap_create_in_btr_search(N) mem_heap_create_func(N, NULL,\
MEM_HEAP_BTR_SEARCH | MEM_HEAP_BUFFER) MEM_HEAP_BTR_SEARCH | MEM_HEAP_BUFFER)
...@@ -99,7 +99,7 @@ mem_heap_free. See the parameter comment in mem_heap_create_func below. */ ...@@ -99,7 +99,7 @@ mem_heap_free. See the parameter comment in mem_heap_create_func below. */
#ifdef UNIV_MEM_DEBUG #ifdef UNIV_MEM_DEBUG
#define mem_heap_fast_create(N, B) mem_heap_create_func(\ #define mem_heap_fast_create(N, B) mem_heap_create_func(\
(N), (B), MEM_HEAP_DYNAMIC,\ (N), (B), MEM_HEAP_DYNAMIC,\
__FILE__, __LINE__) IB__FILE__, __LINE__)
#else #else
#define mem_heap_fast_create(N, B) mem_heap_create_func(N, (B),\ #define mem_heap_fast_create(N, B) mem_heap_create_func(N, (B),\
MEM_HEAP_DYNAMIC) MEM_HEAP_DYNAMIC)
...@@ -109,7 +109,7 @@ Use this macro instead of the corresponding function! Macro for memory ...@@ -109,7 +109,7 @@ Use this macro instead of the corresponding function! Macro for memory
heap freeing. */ heap freeing. */
#ifdef UNIV_MEM_DEBUG #ifdef UNIV_MEM_DEBUG
#define mem_heap_free(heap) mem_heap_free_func(\ #define mem_heap_free(heap) mem_heap_free_func(\
(heap), __FILE__, __LINE__) (heap), IB__FILE__, __LINE__)
#else #else
#define mem_heap_free(heap) mem_heap_free_func(heap) #define mem_heap_free(heap) mem_heap_free_func(heap)
#endif #endif
...@@ -226,7 +226,7 @@ Use this macro instead of the corresponding function! ...@@ -226,7 +226,7 @@ Use this macro instead of the corresponding function!
Macro for memory buffer allocation */ Macro for memory buffer allocation */
#ifdef UNIV_MEM_DEBUG #ifdef UNIV_MEM_DEBUG
#define mem_alloc(N) mem_alloc_func(\ #define mem_alloc(N) mem_alloc_func(\
(N), __FILE__, __LINE__) (N), IB__FILE__, __LINE__)
#else #else
#define mem_alloc(N) mem_alloc_func(N) #define mem_alloc(N) mem_alloc_func(N)
#endif #endif
...@@ -235,7 +235,7 @@ Use this macro instead of the corresponding function! ...@@ -235,7 +235,7 @@ Use this macro instead of the corresponding function!
Macro for memory buffer allocation */ Macro for memory buffer allocation */
#ifdef UNIV_MEM_DEBUG #ifdef UNIV_MEM_DEBUG
#define mem_alloc_noninline(N) mem_alloc_func_noninline(\ #define mem_alloc_noninline(N) mem_alloc_func_noninline(\
(N), __FILE__, __LINE__) (N), IB__FILE__, __LINE__)
#else #else
#define mem_alloc_noninline(N) mem_alloc_func_noninline(N) #define mem_alloc_noninline(N) mem_alloc_func_noninline(N)
#endif #endif
...@@ -278,7 +278,7 @@ Use this macro instead of the corresponding function! ...@@ -278,7 +278,7 @@ Use this macro instead of the corresponding function!
Macro for memory buffer freeing */ Macro for memory buffer freeing */
#ifdef UNIV_MEM_DEBUG #ifdef UNIV_MEM_DEBUG
#define mem_free(PTR) mem_free_func(\ #define mem_free(PTR) mem_free_func(\
(PTR), __FILE__, __LINE__) (PTR), IB__FILE__, __LINE__)
#else #else
#define mem_free(PTR) mem_free_func(PTR) #define mem_free(PTR) mem_free_func(PTR)
#endif #endif
......
...@@ -11,6 +11,7 @@ Created 6/9/1994 Heikki Tuuri ...@@ -11,6 +11,7 @@ Created 6/9/1994 Heikki Tuuri
#include "univ.i" #include "univ.i"
#include "os0file.h" #include "os0file.h"
#include "ut0lst.h"
typedef struct mem_area_struct mem_area_t; typedef struct mem_area_struct mem_area_t;
typedef struct mem_pool_struct mem_pool_t; typedef struct mem_pool_struct mem_pool_t;
...@@ -18,8 +19,19 @@ typedef struct mem_pool_struct mem_pool_t; ...@@ -18,8 +19,19 @@ typedef struct mem_pool_struct mem_pool_t;
/* The common memory pool */ /* The common memory pool */
extern mem_pool_t* mem_comm_pool; extern mem_pool_t* mem_comm_pool;
/* Memory area header */
struct mem_area_struct{
ulint size_and_free; /* memory area size is obtained by
anding with ~MEM_AREA_FREE; area in
a free list if ANDing with
MEM_AREA_FREE results in nonzero */
UT_LIST_NODE_T(mem_area_t)
free_list; /* free list node */
};
/* Each memory area takes this many extra bytes for control information */ /* Each memory area takes this many extra bytes for control information */
#define MEM_AREA_EXTRA_SIZE UNIV_MEM_ALIGNMENT #define MEM_AREA_EXTRA_SIZE (sizeof(struct mem_area_struct))
/************************************************************************ /************************************************************************
Creates a memory pool. */ Creates a memory pool. */
......
...@@ -204,7 +204,7 @@ mtr_read_dulint( ...@@ -204,7 +204,7 @@ mtr_read_dulint(
/************************************************************************* /*************************************************************************
This macro locks an rw-lock in s-mode. */ This macro locks an rw-lock in s-mode. */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define mtr_s_lock(B, MTR) mtr_s_lock_func((B), __FILE__, __LINE__,\ #define mtr_s_lock(B, MTR) mtr_s_lock_func((B), IB__FILE__, __LINE__,\
(MTR)) (MTR))
#else #else
#define mtr_s_lock(B, MTR) mtr_s_lock_func((B), (MTR)) #define mtr_s_lock(B, MTR) mtr_s_lock_func((B), (MTR))
...@@ -212,7 +212,7 @@ This macro locks an rw-lock in s-mode. */ ...@@ -212,7 +212,7 @@ This macro locks an rw-lock in s-mode. */
/************************************************************************* /*************************************************************************
This macro locks an rw-lock in x-mode. */ This macro locks an rw-lock in x-mode. */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define mtr_x_lock(B, MTR) mtr_x_lock_func((B), __FILE__, __LINE__,\ #define mtr_x_lock(B, MTR) mtr_x_lock_func((B), IB__FILE__, __LINE__,\
(MTR)) (MTR))
#else #else
#define mtr_x_lock(B, MTR) mtr_x_lock_func((B), (MTR)) #define mtr_x_lock(B, MTR) mtr_x_lock_func((B), (MTR))
......
...@@ -13,7 +13,6 @@ Created 10/21/1995 Heikki Tuuri ...@@ -13,7 +13,6 @@ Created 10/21/1995 Heikki Tuuri
#ifdef __WIN__ #ifdef __WIN__
#include <windows.h>
#if (defined(__NT__) || defined(__WIN2000__)) #if (defined(__NT__) || defined(__WIN2000__))
#define WIN_ASYNC_IO #define WIN_ASYNC_IO
...@@ -28,19 +27,10 @@ Created 10/21/1995 Heikki Tuuri ...@@ -28,19 +27,10 @@ Created 10/21/1995 Heikki Tuuri
#define POSIX_ASYNC_IO #define POSIX_ASYNC_IO
#endif #endif
#ifndef S_IRUSR
#define S_IRUSR 00400
#define S_IWUSR 00200
#define S_IRGRP 00040
#define S_IWGRP 00020
#define S_IROTH 00004
#define S_IWOTH 00002
#endif
#endif #endif
#ifdef __WIN__ #ifdef __WIN__
typedef HANDLE os_file_t; #define os_file_t HANDLE
#else #else
typedef int os_file_t; typedef int os_file_t;
#endif #endif
......
...@@ -13,8 +13,7 @@ Created 9/6/1995 Heikki Tuuri ...@@ -13,8 +13,7 @@ Created 9/6/1995 Heikki Tuuri
#ifdef __WIN__ #ifdef __WIN__
#include <windows.h> #define os_fast_mutex_t CRITICAL_SECTION
typedef CRITICAL_SECTION os_fast_mutex_t;
typedef void* os_event_t; typedef void* os_event_t;
#else #else
......
...@@ -25,7 +25,7 @@ os_fast_mutex_trylock( ...@@ -25,7 +25,7 @@ os_fast_mutex_trylock(
#ifdef __WIN__ #ifdef __WIN__
int ret; int ret;
/* TryEnterCriticalSection is probably not found from /* TODO: TryEnterCriticalSection is probably not found from
NT versions < 4! */ NT versions < 4! */
ret = TryEnterCriticalSection(fast_mutex); ret = TryEnterCriticalSection(fast_mutex);
......
...@@ -28,6 +28,10 @@ typedef pthread_t os_thread_t; ...@@ -28,6 +28,10 @@ typedef pthread_t os_thread_t;
#endif #endif
typedef unsigned long int os_thread_id_t; typedef unsigned long int os_thread_id_t;
/* Define a function pointer type to use in a typecast */
typedef void* (*os_posix_f_t) (void*);
/******************************************************************** /********************************************************************
Creates a new thread of execution. The execution starts from Creates a new thread of execution. The execution starts from
the function given. The start function takes a void* parameter the function given. The start function takes a void* parameter
...@@ -37,8 +41,12 @@ os_thread_t ...@@ -37,8 +41,12 @@ os_thread_t
os_thread_create( os_thread_create(
/*=============*/ /*=============*/
/* out: handle to the thread */ /* out: handle to the thread */
#ifndef __WIN__
os_posix_f_t start_f,
#else
ulint (*start_f)(void*), /* in: pointer to function ulint (*start_f)(void*), /* in: pointer to function
from which to start */ from which to start */
#endif
void* arg, /* in: argument to start void* arg, /* in: argument to start
function */ function */
os_thread_id_t* thread_id); /* out: id of created os_thread_id_t* thread_id); /* out: id of created
......
...@@ -43,6 +43,8 @@ row_mysql_read_var_ref( ...@@ -43,6 +43,8 @@ row_mysql_read_var_ref(
return(field + 2); return(field + 2);
*/ */
UT_NOT_USED(len);
return(field); /* No real var implemented in MySQL yet! */ return(field); /* No real var implemented in MySQL yet! */
} }
...@@ -83,12 +85,17 @@ row_mysql_store_col_in_innobase_format( ...@@ -83,12 +85,17 @@ row_mysql_store_col_in_innobase_format(
} }
if (!is_unsigned) { if (!is_unsigned) {
*ptr = *ptr ^ 128; *ptr = (byte) (*ptr ^ 128);
} }
} else if (type == DATA_VARCHAR || type == DATA_VARMYSQL } else if (type == DATA_VARCHAR || type == DATA_VARMYSQL
|| type == DATA_BINARY) { || type == DATA_BINARY) {
ptr = row_mysql_read_var_ref(&col_len, mysql_data); ptr = row_mysql_read_var_ref(&col_len, mysql_data);
/* Remove trailing spaces */
while (col_len > 0 && ptr[col_len - 1] == ' ') {
col_len--;
}
} else if (type == DATA_BLOB) { } else if (type == DATA_BLOB) {
ptr = row_mysql_read_blob_ref(&col_len, mysql_data, col_len); ptr = row_mysql_read_blob_ref(&col_len, mysql_data, col_len);
} }
......
...@@ -132,7 +132,11 @@ srv_release_threads( ...@@ -132,7 +132,11 @@ srv_release_threads(
/************************************************************************* /*************************************************************************
The master thread controlling the server. */ The master thread controlling the server. */
#ifndef __WIN__
void*
#else
ulint ulint
#endif
srv_master_thread( srv_master_thread(
/*==============*/ /*==============*/
/* out: a dummy parameter */ /* out: a dummy parameter */
...@@ -187,7 +191,11 @@ srv_release_mysql_thread_if_suspended( ...@@ -187,7 +191,11 @@ srv_release_mysql_thread_if_suspended(
/************************************************************************* /*************************************************************************
A thread which wakes up threads whose lock wait may have lasted too long. */ A thread which wakes up threads whose lock wait may have lasted too long. */
#ifndef __WIN__
void*
#else
ulint ulint
#endif
srv_lock_timeout_monitor_thread( srv_lock_timeout_monitor_thread(
/*============================*/ /*============================*/
/* out: a dummy parameter */ /* out: a dummy parameter */
......
...@@ -57,7 +57,7 @@ location (which must be appropriately aligned). The rw-lock is initialized ...@@ -57,7 +57,7 @@ location (which must be appropriately aligned). The rw-lock is initialized
to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free
is necessary only if the memory block containing it is freed. */ is necessary only if the memory block containing it is freed. */
#define rw_lock_create(L) rw_lock_create_func((L), __FILE__, __LINE__) #define rw_lock_create(L) rw_lock_create_func((L), IB__FILE__, __LINE__)
/*=====================*/ /*=====================*/
/********************************************************************** /**********************************************************************
Creates, or rather, initializes an rw-lock object in a specified memory Creates, or rather, initializes an rw-lock object in a specified memory
...@@ -94,7 +94,7 @@ corresponding function. */ ...@@ -94,7 +94,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define rw_lock_s_lock(M) rw_lock_s_lock_func(\ #define rw_lock_s_lock(M) rw_lock_s_lock_func(\
(M), 0, __FILE__, __LINE__) (M), 0, IB__FILE__, __LINE__)
#else #else
#define rw_lock_s_lock(M) rw_lock_s_lock_func(M) #define rw_lock_s_lock(M) rw_lock_s_lock_func(M)
#endif #endif
...@@ -104,7 +104,7 @@ corresponding function. */ ...@@ -104,7 +104,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(\ #define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(\
(M), (P), __FILE__, __LINE__) (M), (P), IB__FILE__, __LINE__)
#else #else
#define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(M) #define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(M)
#endif #endif
...@@ -114,7 +114,7 @@ corresponding function. */ ...@@ -114,7 +114,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define rw_lock_s_lock_nowait(M) rw_lock_s_lock_func_nowait(\ #define rw_lock_s_lock_nowait(M) rw_lock_s_lock_func_nowait(\
(M), __FILE__, __LINE__) (M), IB__FILE__, __LINE__)
#else #else
#define rw_lock_s_lock_nowait(M) rw_lock_s_lock_func_nowait(M) #define rw_lock_s_lock_nowait(M) rw_lock_s_lock_func_nowait(M)
#endif #endif
...@@ -201,7 +201,7 @@ corresponding function. */ ...@@ -201,7 +201,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define rw_lock_x_lock(M) rw_lock_x_lock_func(\ #define rw_lock_x_lock(M) rw_lock_x_lock_func(\
(M), 0, __FILE__, __LINE__) (M), 0, IB__FILE__, __LINE__)
#else #else
#define rw_lock_x_lock(M) rw_lock_x_lock_func(M, 0) #define rw_lock_x_lock(M) rw_lock_x_lock_func(M, 0)
#endif #endif
...@@ -211,7 +211,7 @@ corresponding function. */ ...@@ -211,7 +211,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(\ #define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(\
(M), (P), __FILE__, __LINE__) (M), (P), IB__FILE__, __LINE__)
#else #else
#define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(M, P) #define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(M, P)
#endif #endif
...@@ -221,7 +221,7 @@ corresponding function. */ ...@@ -221,7 +221,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(\ #define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(\
(M), __FILE__, __LINE__) (M), IB__FILE__, __LINE__)
#else #else
#define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(M) #define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(M)
#endif #endif
......
...@@ -36,7 +36,7 @@ in the reset state. Explicit freeing of the mutex with mutex_free is ...@@ -36,7 +36,7 @@ in the reset state. Explicit freeing of the mutex with mutex_free is
necessary only if the memory block containing it is freed. */ necessary only if the memory block containing it is freed. */
#define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__) #define mutex_create(M) mutex_create_func((M), IB__FILE__, __LINE__)
/*===================*/ /*===================*/
/********************************************************************** /**********************************************************************
Creates, or rather, initializes a mutex object in a specified memory Creates, or rather, initializes a mutex object in a specified memory
...@@ -64,7 +64,7 @@ NOTE! The following macro should be used in mutex locking, not the ...@@ -64,7 +64,7 @@ NOTE! The following macro should be used in mutex locking, not the
corresponding function. */ corresponding function. */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__) #define mutex_enter(M) mutex_enter_func((M), IB__FILE__, __LINE__)
#else #else
#define mutex_enter(M) mutex_enter_func(M) #define mutex_enter(M) mutex_enter_func(M)
#endif #endif
...@@ -75,7 +75,7 @@ corresponding function. */ ...@@ -75,7 +75,7 @@ corresponding function. */
/* NOTE! currently same as mutex_enter! */ /* NOTE! currently same as mutex_enter! */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
#define mutex_enter_fast(M) mutex_enter_func((M), __FILE__, __LINE__) #define mutex_enter_fast(M) mutex_enter_func((M), IB__FILE__, __LINE__)
#else #else
#define mutex_enter_fast(M) mutex_enter_func(M) #define mutex_enter_fast(M) mutex_enter_func(M)
#endif #endif
......
...@@ -13,6 +13,12 @@ Created 1/20/1994 Heikki Tuuri ...@@ -13,6 +13,12 @@ Created 1/20/1994 Heikki Tuuri
#define __WIN__ #define __WIN__
#include <windows.h> #include <windows.h>
/* If you want to check for errors with compiler level -W4,
comment out the above include of windows.h and let the following defines
be defined:
#define HANDLE void*
#define CRITICAL_SECTION ulint
*/
#else #else
/* The Unix version */ /* The Unix version */
...@@ -91,8 +97,8 @@ definitions: */ ...@@ -91,8 +97,8 @@ definitions: */
#elif defined(_WIN64) #elif defined(_WIN64)
#define UNIV_WORD_SIZE 8 #define UNIV_WORD_SIZE 8
#else #else
/* config.h generated by GNU autoconf will define SIZEOF_INT in Posix */ /* MySQL config.h generated by GNU autoconf will define SIZEOF_LONG in Posix */
#define UNIV_WORD_SIZE SIZEOF_INT #define UNIV_WORD_SIZE SIZEOF_LONG
#endif #endif
/* The following alignment is used in memory allocations in memory heap /* The following alignment is used in memory allocations in memory heap
...@@ -158,6 +164,11 @@ headers may define 'bool' differently. Do not assume that 'bool' is a ulint! */ ...@@ -158,6 +164,11 @@ headers may define 'bool' differently. Do not assume that 'bool' is a ulint! */
has the SQL NULL as its value. */ has the SQL NULL as its value. */
#define UNIV_SQL_NULL ULINT_UNDEFINED #define UNIV_SQL_NULL ULINT_UNDEFINED
/* The following definition of __FILE__ removes compiler warnings
associated with const char* / char* mismatches with __FILE__ */
#define IB__FILE__ ((char*)__FILE__)
#include <stdio.h> #include <stdio.h>
#include "ut0dbg.h" #include "ut0dbg.h"
#include "ut0ut.h" #include "ut0ut.h"
......
...@@ -28,7 +28,7 @@ extern ulint* ut_dbg_null_ptr; ...@@ -28,7 +28,7 @@ extern ulint* ut_dbg_null_ptr;
if (!((ulint)(EXPR) + ut_dbg_zero)) {\ if (!((ulint)(EXPR) + ut_dbg_zero)) {\
/* printf(\ /* printf(\
"Assertion failure in thread %lu in file %s line %lu\n",\ "Assertion failure in thread %lu in file %s line %lu\n",\
os_thread_get_curr_id(), __FILE__, (ulint)__LINE__);\ os_thread_get_curr_id(), IB__FILE__, (ulint)__LINE__);\
printf(\ printf(\
"we generate a memory trap on purpose to start the debugger\n");*/\ "we generate a memory trap on purpose to start the debugger\n");*/\
ut_dbg_stop_threads = TRUE;\ ut_dbg_stop_threads = TRUE;\
...@@ -39,7 +39,7 @@ extern ulint* ut_dbg_null_ptr; ...@@ -39,7 +39,7 @@ extern ulint* ut_dbg_null_ptr;
}\ }\
if (ut_dbg_stop_threads) {\ if (ut_dbg_stop_threads) {\
printf("Thread %lu stopped in file %s line %lu\n",\ printf("Thread %lu stopped in file %s line %lu\n",\
os_thread_get_curr_id(), __FILE__, (ulint)__LINE__);\ os_thread_get_curr_id(), IB__FILE__, (ulint)__LINE__);\
os_thread_sleep(1000000000);\ os_thread_sleep(1000000000);\
}\ }\
} }
...@@ -48,7 +48,7 @@ extern ulint* ut_dbg_null_ptr; ...@@ -48,7 +48,7 @@ extern ulint* ut_dbg_null_ptr;
ulint dbg_i;\ ulint dbg_i;\
printf(\ printf(\
"Assertion failure in thread %lu in file %s line %lu\n",\ "Assertion failure in thread %lu in file %s line %lu\n",\
os_thread_get_curr_id(), __FILE__, (ulint)__LINE__);\ os_thread_get_curr_id(), IB__FILE__, (ulint)__LINE__);\
printf("Generates memory trap on purpose for stack debugging\n");\ printf("Generates memory trap on purpose for stack debugging\n");\
ut_dbg_stop_threads = TRUE;\ ut_dbg_stop_threads = TRUE;\
dbg_i = *(ut_dbg_null_ptr);\ dbg_i = *(ut_dbg_null_ptr);\
......
...@@ -3177,7 +3177,7 @@ lock_rec_print( ...@@ -3177,7 +3177,7 @@ lock_rec_print(
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, page = buf_page_get_gen(space, page_no, RW_NO_LATCH,
NULL, BUF_GET_IF_IN_POOL, NULL, BUF_GET_IF_IN_POOL,
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__, IB__FILE__, __LINE__,
#endif #endif
&mtr); &mtr);
if (page) { if (page) {
......
...@@ -72,16 +72,6 @@ the previous */ ...@@ -72,16 +72,6 @@ the previous */
#define LOG_ARCHIVE_READ 1 #define LOG_ARCHIVE_READ 1
#define LOG_ARCHIVE_WRITE 2 #define LOG_ARCHIVE_WRITE 2
/**********************************************************
Calculates the file count of an lsn within a log group. */
static
ulint
log_group_calc_lsn_file_count(
/*==========================*/
/* out: file count within the log group */
dulint lsn, /* in: lsn, must be within 4 GB of
group->next_block_lsn */
log_group_t* group); /* in: log group */
/********************************************************** /**********************************************************
Completes a checkpoint write i/o to a log file. */ Completes a checkpoint write i/o to a log file. */
static static
...@@ -520,6 +510,8 @@ log_calc_max_ages(void) ...@@ -520,6 +510,8 @@ log_calc_max_ages(void)
+ LOG_CHECKPOINT_EXTRA_FREE; + LOG_CHECKPOINT_EXTRA_FREE;
if (free >= smallest_capacity / 2) { if (free >= smallest_capacity / 2) {
success = FALSE; success = FALSE;
goto failure;
} else { } else {
margin = smallest_capacity - free; margin = smallest_capacity - free;
} }
...@@ -540,10 +532,11 @@ log_calc_max_ages(void) ...@@ -540,10 +532,11 @@ log_calc_max_ages(void)
log_sys->max_archived_lsn_age_async = smallest_archive_margin log_sys->max_archived_lsn_age_async = smallest_archive_margin
- smallest_archive_margin / - smallest_archive_margin /
LOG_ARCHIVE_RATIO_ASYNC; LOG_ARCHIVE_RATIO_ASYNC;
failure:
mutex_exit(&(log_sys->mutex)); mutex_exit(&(log_sys->mutex));
if (!success) { if (!success) {
printf( fprintf(stderr,
"Error: log file group too small for the number of threads\n"); "Error: log file group too small for the number of threads\n");
} }
......
...@@ -407,12 +407,17 @@ recv_find_max_checkpoint( ...@@ -407,12 +407,17 @@ recv_find_max_checkpoint(
/* Check the consistency of the checkpoint info */ /* Check the consistency of the checkpoint info */
fold = ut_fold_binary(buf, LOG_CHECKPOINT_CHECKSUM_1); fold = ut_fold_binary(buf, LOG_CHECKPOINT_CHECKSUM_1);
if (fold != mach_read_from_4(buf if ((fold & 0xFFFFFFFF)
!= mach_read_from_4(buf
+ LOG_CHECKPOINT_CHECKSUM_1)) { + LOG_CHECKPOINT_CHECKSUM_1)) {
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"Innobase: Checkpoint in group %lu at %lu invalid\n", "Innobase: Checkpoint in group %lu at %lu invalid, %lu, %lu\n",
group->id, field); group->id, field,
fold & 0xFFFFFFFF,
mach_read_from_4(buf
+ LOG_CHECKPOINT_CHECKSUM_1));
} }
goto not_consistent; goto not_consistent;
...@@ -421,12 +426,16 @@ recv_find_max_checkpoint( ...@@ -421,12 +426,16 @@ recv_find_max_checkpoint(
fold = ut_fold_binary(buf + LOG_CHECKPOINT_LSN, fold = ut_fold_binary(buf + LOG_CHECKPOINT_LSN,
LOG_CHECKPOINT_CHECKSUM_2 LOG_CHECKPOINT_CHECKSUM_2
- LOG_CHECKPOINT_LSN); - LOG_CHECKPOINT_LSN);
if (fold != mach_read_from_4(buf if ((fold & 0xFFFFFFFF)
!= mach_read_from_4(buf
+ LOG_CHECKPOINT_CHECKSUM_2)) { + LOG_CHECKPOINT_CHECKSUM_2)) {
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"Innobase: Checkpoint in group %lu at %lu invalid\n", "Innobase: Checkpoint in group %lu at %lu invalid, %lu, %lu\n",
group->id, field); group->id, field,
fold & 0xFFFFFFFF,
mach_read_from_4(buf
+ LOG_CHECKPOINT_CHECKSUM_2));
} }
goto not_consistent; goto not_consistent;
} }
...@@ -461,10 +470,7 @@ recv_find_max_checkpoint( ...@@ -461,10 +470,7 @@ recv_find_max_checkpoint(
if (*max_group == NULL) { if (*max_group == NULL) {
if (log_debug_writes) { fprintf(stderr, "Innobase: No valid checkpoint found\n");
fprintf(stderr,
"Innobase: No valid checkpoint found\n");
}
return(DB_ERROR); return(DB_ERROR);
} }
...@@ -796,7 +802,7 @@ recv_recover_page( ...@@ -796,7 +802,7 @@ recv_recover_page(
success = buf_page_get_known_nowait(RW_X_LATCH, page, BUF_KEEP_OLD, success = buf_page_get_known_nowait(RW_X_LATCH, page, BUF_KEEP_OLD,
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__, IB__FILE__, __LINE__,
#endif #endif
&mtr); &mtr);
ut_a(success); ut_a(success);
...@@ -861,7 +867,7 @@ recv_recover_page( ...@@ -861,7 +867,7 @@ recv_recover_page(
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"Innobase: Applying log rec type %lu len %lu to space %lu page no %lu\n", "Innobase: Applying log rec type %lu len %lu to space %lu page no %lu\n",
recv->type, recv->len, recv_addr->space, (ulint)recv->type, recv->len, recv_addr->space,
recv_addr->page_no); recv_addr->page_no);
} }
...@@ -1213,7 +1219,7 @@ recv_compare_spaces( ...@@ -1213,7 +1219,7 @@ recv_compare_spaces(
frame = buf_page_get_gen(space1, page_no, RW_S_LATCH, NULL, frame = buf_page_get_gen(space1, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL, BUF_GET_IF_IN_POOL,
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__, IB__FILE__, __LINE__,
#endif #endif
&mtr); &mtr);
if (frame) { if (frame) {
...@@ -1228,7 +1234,7 @@ recv_compare_spaces( ...@@ -1228,7 +1234,7 @@ recv_compare_spaces(
frame = buf_page_get_gen(space2, page_no, RW_S_LATCH, NULL, frame = buf_page_get_gen(space2, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL, BUF_GET_IF_IN_POOL,
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__, IB__FILE__, __LINE__,
#endif #endif
&mtr); &mtr);
if (frame) { if (frame) {
...@@ -1449,7 +1455,7 @@ loop: ...@@ -1449,7 +1455,7 @@ loop:
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"Innobase: Parsed a single log rec type %lu len %lu space %lu page no %lu\n", "Innobase: Parsed a single log rec type %lu len %lu space %lu page no %lu\n",
type, len, space, page_no); (ulint)type, len, space, page_no);
} }
if (type == MLOG_DUMMY_RECORD) { if (type == MLOG_DUMMY_RECORD) {
...@@ -1498,7 +1504,7 @@ loop: ...@@ -1498,7 +1504,7 @@ loop:
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"Innobase: Parsed a multi log rec type %lu len %lu space %lu page no %lu\n", "Innobase: Parsed a multi log rec type %lu len %lu space %lu page no %lu\n",
type, len, space, page_no); (ulint)type, len, space, page_no);
} }
total_len += len; total_len += len;
......
...@@ -72,22 +72,11 @@ and for the adaptive index. Thus, for each individual transaction, its locks ...@@ -72,22 +72,11 @@ and for the adaptive index. Thus, for each individual transaction, its locks
can occupy at most about the size of the buffer frame of memory in the common can occupy at most about the size of the buffer frame of memory in the common
pool, and after that its locks will grow into the buffer pool. */ pool, and after that its locks will grow into the buffer pool. */
/* Memory area header */
struct mem_area_struct{
ulint size_and_free; /* memory area size is obtained by
anding with ~MEM_AREA_FREE; area in
a free list if ANDing with
MEM_AREA_FREE results in nonzero */
UT_LIST_NODE_T(mem_area_t)
free_list; /* free list node */
};
/* Mask used to extract the free bit from area->size */ /* Mask used to extract the free bit from area->size */
#define MEM_AREA_FREE 1 #define MEM_AREA_FREE 1
/* The smallest memory area total size */ /* The smallest memory area total size */
#define MEM_AREA_MIN_SIZE (2 * UNIV_MEM_ALIGNMENT) #define MEM_AREA_MIN_SIZE (2 * sizeof(struct mem_area_struct))
/* Data structure for a memory pool. The space is allocated using the buddy /* Data structure for a memory pool. The space is allocated using the buddy
algorithm, where free list i contains areas of size 2 to power i. */ algorithm, where free list i contains areas of size 2 to power i. */
......
...@@ -166,6 +166,8 @@ os_file_handle_error( ...@@ -166,6 +166,8 @@ os_file_handle_error(
int input_char; int input_char;
ulint err; ulint err;
UT_NOT_USED(file);
err = os_file_get_last_error(); err = os_file_get_last_error();
if (err == OS_FILE_DISK_FULL) { if (err == OS_FILE_DISK_FULL) {
...@@ -316,8 +318,11 @@ try_again: ...@@ -316,8 +318,11 @@ try_again:
UT_NOT_USED(purpose); UT_NOT_USED(purpose);
if (create_mode == OS_FILE_CREATE) { if (create_mode == OS_FILE_CREATE) {
file = open(name, create_flag, S_IRUSR | S_IRGRP | S_IROTH #ifndef S_IRWXU
| S_IWUSR | S_IWGRP | S_IWOTH); file = open(name, create_flag);
#else
file = open(name, create_flag, S_IRWXU | S_IRWXG | S_IRWXO);
#endif
} else { } else {
file = open(name, create_flag); file = open(name, create_flag);
} }
...@@ -445,6 +450,8 @@ try_again: ...@@ -445,6 +450,8 @@ try_again:
low = size; low = size;
#if (UNIV_WORD_SIZE == 8) #if (UNIV_WORD_SIZE == 8)
low = low + (size_high << 32); low = low + (size_high << 32);
#else
UT_NOT_USED(size_high);
#endif #endif
while (offset < low) { while (offset < low) {
if (low - offset < UNIV_PAGE_SIZE * 64) { if (low - offset < UNIV_PAGE_SIZE * 64) {
...@@ -478,6 +485,8 @@ error_handling: ...@@ -478,6 +485,8 @@ error_handling:
} }
ut_error; ut_error;
return(FALSE);
} }
/*************************************************************************** /***************************************************************************
...@@ -660,6 +669,8 @@ try_again: ...@@ -660,6 +669,8 @@ try_again:
#if (UNIV_WORD_SIZE == 8) #if (UNIV_WORD_SIZE == 8)
offset = offset + (offset_high << 32); offset = offset + (offset_high << 32);
#else
UT_NOT_USED(offset_high);
#endif #endif
try_again: try_again:
/* Protect the seek / read operation with a mutex */ /* Protect the seek / read operation with a mutex */
...@@ -669,7 +680,7 @@ try_again: ...@@ -669,7 +680,7 @@ try_again:
ret = os_file_pread(file, buf, n, (off_t) offset); ret = os_file_pread(file, buf, n, (off_t) offset);
if (ret == n) { if ((ulint)ret == n) {
os_mutex_exit(os_file_seek_mutexes[i]); os_mutex_exit(os_file_seek_mutexes[i]);
return(TRUE); return(TRUE);
...@@ -751,15 +762,16 @@ try_again: ...@@ -751,15 +762,16 @@ try_again:
#if (UNIV_WORD_SIZE == 8) #if (UNIV_WORD_SIZE == 8)
offset = offset + (offset_high << 32); offset = offset + (offset_high << 32);
#else
UT_NOT_USED(offset_high);
#endif #endif
try_again: try_again:
ret = pwrite(file, buf, n, (off_t) offset); ret = pwrite(file, buf, n, (off_t) offset);
if (ret == n) { if ((ulint)ret == n) {
return(TRUE); return(TRUE);
} }
#endif #endif
error_handling: error_handling:
retry = os_file_handle_error(file, name); retry = os_file_handle_error(file, name);
...@@ -1411,7 +1423,6 @@ try_again: ...@@ -1411,7 +1423,6 @@ try_again:
return(TRUE); return(TRUE);
} }
error_handling:
os_aio_array_free_slot(array, slot); os_aio_array_free_slot(array, slot);
retry = os_file_handle_error(file, name); retry = os_file_handle_error(file, name);
...@@ -1908,7 +1919,8 @@ loop: ...@@ -1908,7 +1919,8 @@ loop:
if (slot->reserved) { if (slot->reserved) {
n_reserved++; n_reserved++;
printf("Reserved slot, messages %lx %lx\n", printf("Reserved slot, messages %lx %lx\n",
slot->message1, slot->message2); (ulint)slot->message1,
(ulint)slot->message2);
ut_a(slot->len > 0); ut_a(slot->len > 0);
} }
} }
......
...@@ -90,6 +90,8 @@ os_shm_free( ...@@ -90,6 +90,8 @@ os_shm_free(
} }
#else #else
UT_NOT_USED(shm); UT_NOT_USED(shm);
return(FALSE);
#endif #endif
} }
...@@ -116,6 +118,8 @@ os_shm_map( ...@@ -116,6 +118,8 @@ os_shm_map(
return(mem); return(mem);
#else #else
UT_NOT_USED(shm); UT_NOT_USED(shm);
return(NULL);
#endif #endif
} }
...@@ -142,5 +146,7 @@ os_shm_unmap( ...@@ -142,5 +146,7 @@ os_shm_unmap(
} }
#else #else
UT_NOT_USED(addr); UT_NOT_USED(addr);
return(FALSE);
#endif #endif
} }
...@@ -30,9 +30,6 @@ os_thread_get_curr_id(void) ...@@ -30,9 +30,6 @@ os_thread_get_curr_id(void)
#endif #endif
} }
/* Define a function pointer type to use in a typecast */
typedef void* (*os_posix_f_t) (void*);
/******************************************************************** /********************************************************************
Creates a new thread of execution. The execution starts from Creates a new thread of execution. The execution starts from
the function given. The start function takes a void* parameter the function given. The start function takes a void* parameter
...@@ -42,8 +39,12 @@ os_thread_t ...@@ -42,8 +39,12 @@ os_thread_t
os_thread_create( os_thread_create(
/*=============*/ /*=============*/
/* out: handle to the thread */ /* out: handle to the thread */
#ifndef __WIN__
os_posix_f_t start_f,
#else
ulint (*start_f)(void*), /* in: pointer to function ulint (*start_f)(void*), /* in: pointer to function
from which to start */ from which to start */
#endif
void* arg, /* in: argument to start void* arg, /* in: argument to start
function */ function */
os_thread_id_t* thread_id) /* out: id of created os_thread_id_t* thread_id) /* out: id of created
...@@ -65,11 +66,7 @@ os_thread_create( ...@@ -65,11 +66,7 @@ os_thread_create(
int ret; int ret;
os_thread_t pthread; os_thread_t pthread;
/* Note that below we cast the start function returning an integer ret = pthread_create(&pthread, NULL, start_f, arg);
to a function returning a pointer: this may cause error
if the return value is used somewhere! */
ret = pthread_create(&pthread, NULL, (os_posix_f_t) start_f, arg);
return(pthread); return(pthread);
#endif #endif
......
...@@ -1055,9 +1055,9 @@ page_dir_print( ...@@ -1055,9 +1055,9 @@ page_dir_print(
printf("--------------------------------\n"); printf("--------------------------------\n");
printf("PAGE DIRECTORY\n"); printf("PAGE DIRECTORY\n");
printf("Page address %lx\n", page); printf("Page address %lx\n", (ulint)page);
printf("Directory stack top at offs: %lu; number of slots: %lu\n", printf("Directory stack top at offs: %lu; number of slots: %lu\n",
page_dir_get_nth_slot(page, n - 1) - page, n); (ulint)(page_dir_get_nth_slot(page, n - 1) - page), n);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
slot = page_dir_get_nth_slot(page, i); slot = page_dir_get_nth_slot(page, i);
if ((i == pr_n) && (i < n - pr_n)) { if ((i == pr_n) && (i < n - pr_n)) {
...@@ -1067,7 +1067,7 @@ page_dir_print( ...@@ -1067,7 +1067,7 @@ page_dir_print(
printf( printf(
"Contents of slot: %lu: n_owned: %lu, rec offs: %lu\n", "Contents of slot: %lu: n_owned: %lu, rec offs: %lu\n",
i, page_dir_slot_get_n_owned(slot), i, page_dir_slot_get_n_owned(slot),
page_dir_slot_get_rec(slot) - page); (ulint)(page_dir_slot_get_rec(slot) - page));
} }
} }
printf("Total of %lu records\n", 2 + page_get_n_recs(page)); printf("Total of %lu records\n", 2 + page_get_n_recs(page));
...@@ -1091,7 +1091,7 @@ page_print_list( ...@@ -1091,7 +1091,7 @@ page_print_list(
printf("--------------------------------\n"); printf("--------------------------------\n");
printf("PAGE RECORD LIST\n"); printf("PAGE RECORD LIST\n");
printf("Page address %lu\n", page); printf("Page address %lu\n", (ulint)page);
n_recs = page_get_n_recs(page); n_recs = page_get_n_recs(page);
...@@ -1142,7 +1142,7 @@ page_header_print( ...@@ -1142,7 +1142,7 @@ page_header_print(
{ {
printf("--------------------------------\n"); printf("--------------------------------\n");
printf("PAGE HEADER INFO\n"); printf("PAGE HEADER INFO\n");
printf("Page address %lx, n records %lu\n", page, printf("Page address %lx, n records %lu\n", (ulint)page,
page_header_get_field(page, PAGE_N_RECS)); page_header_get_field(page, PAGE_N_RECS));
printf("n dir slots %lu, heap top %lu\n", printf("n dir slots %lu, heap top %lu\n",
......
...@@ -1243,7 +1243,7 @@ que_thr_step( ...@@ -1243,7 +1243,7 @@ que_thr_step(
/*********************************************************************** /***********************************************************************
Checks if there is a need for a query thread switch or stopping the current Checks if there is a need for a query thread switch or stopping the current
thread. */ thread. */
static
que_thr_t* que_thr_t*
que_thr_check_if_switch( que_thr_check_if_switch(
/*====================*/ /*====================*/
......
...@@ -439,6 +439,8 @@ row_ins_duplicate_error( ...@@ -439,6 +439,8 @@ row_ins_duplicate_error(
page_t* page; page_t* page;
ulint n_unique; ulint n_unique;
UT_NOT_USED(mtr);
ut_ad(cursor->index->type & DICT_UNIQUE); ut_ad(cursor->index->type & DICT_UNIQUE);
/* NOTE: For unique non-clustered indexes there may be any number /* NOTE: For unique non-clustered indexes there may be any number
......
...@@ -93,9 +93,6 @@ row_mysql_convert_row_to_innobase( ...@@ -93,9 +93,6 @@ row_mysql_convert_row_to_innobase(
field type information is already field type information is already
copied there, or will be copied copied there, or will be copied
later */ later */
byte* buf, /* in/out: buffer to use in converting
data in columns; this must be at least
the size of mysql_rec! */
row_prebuilt_t* prebuilt, /* in: prebuilt struct where template row_prebuilt_t* prebuilt, /* in: prebuilt struct where template
must be of type ROW_MYSQL_WHOLE_ROW */ must be of type ROW_MYSQL_WHOLE_ROW */
byte* mysql_rec) /* in: row in the MySQL format; byte* mysql_rec) /* in: row in the MySQL format;
...@@ -474,9 +471,8 @@ row_insert_for_mysql( ...@@ -474,9 +471,8 @@ row_insert_for_mysql(
node = prebuilt->ins_node; node = prebuilt->ins_node;
} }
row_mysql_convert_row_to_innobase(node->row, row_mysql_convert_row_to_innobase(node->row, prebuilt, mysql_rec);
prebuilt->ins_upd_rec_buff,
prebuilt, mysql_rec);
savept = trx_savept_take(trx); savept = trx_savept_take(trx);
thr = que_fork_get_first_thr(prebuilt->ins_graph); thr = que_fork_get_first_thr(prebuilt->ins_graph);
...@@ -666,9 +662,7 @@ row_update_for_mysql( ...@@ -666,9 +662,7 @@ row_update_for_mysql(
prebuilt->mysql_row_len); prebuilt->mysql_row_len);
} }
row_mysql_convert_row_to_innobase(row_tuple, row_mysql_convert_row_to_innobase(row_tuple, prebuilt, mysql_rec);
prebuilt->ins_upd_rec_buff,
prebuilt, mysql_rec);
search_tuple = dtuple_create(heap, ref_len); search_tuple = dtuple_create(heap, ref_len);
......
...@@ -1791,6 +1791,8 @@ row_sel_convert_mysql_key_to_innobase( ...@@ -1791,6 +1791,8 @@ row_sel_convert_mysql_key_to_innobase(
byte* key_end; byte* key_end;
ulint n_fields = 0; ulint n_fields = 0;
UT_NOT_USED(index);
key_end = key_ptr + key_len; key_end = key_ptr + key_len;
/* Permit us to access any field in the tuple (ULINT_MAX): */ /* Permit us to access any field in the tuple (ULINT_MAX): */
...@@ -1919,7 +1921,7 @@ row_sel_field_store_in_mysql_format( ...@@ -1919,7 +1921,7 @@ row_sel_field_store_in_mysql_format(
} }
if (!is_unsigned) { if (!is_unsigned) {
dest[len - 1] = dest[len - 1] ^ 128; dest[len - 1] = (byte) (dest[len - 1] ^ 128);
} }
ut_ad(col_len == len); ut_ad(col_len == len);
...@@ -1932,6 +1934,9 @@ row_sel_field_store_in_mysql_format( ...@@ -1932,6 +1934,9 @@ row_sel_field_store_in_mysql_format(
dest = row_mysql_store_var_len(dest, len); dest = row_mysql_store_var_len(dest, len);
ut_memcpy(dest, data, len); ut_memcpy(dest, data, len);
/* Pad with trailing spaces */
memset(dest + len, ' ', col_len - len);
/* ut_ad(col_len >= len + 2); No real var implemented in /* ut_ad(col_len >= len + 2); No real var implemented in
MySQL yet! */ MySQL yet! */
......
...@@ -750,7 +750,7 @@ row_upd_sec_index_entry( ...@@ -750,7 +750,7 @@ row_upd_sec_index_entry(
btr_cur_t* btr_cur; btr_cur_t* btr_cur;
mem_heap_t* heap; mem_heap_t* heap;
rec_t* rec; rec_t* rec;
ulint err; ulint err = DB_SUCCESS;
index = node->index; index = node->index;
...@@ -781,7 +781,7 @@ row_upd_sec_index_entry( ...@@ -781,7 +781,7 @@ row_upd_sec_index_entry(
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
if (node->is_delete || (err != DB_SUCCESS)) { if (node->is_delete || err != DB_SUCCESS) {
mem_heap_free(heap); mem_heap_free(heap);
...@@ -1169,7 +1169,7 @@ row_upd( ...@@ -1169,7 +1169,7 @@ row_upd(
upd_node_t* node, /* in: row update node */ upd_node_t* node, /* in: row update node */
que_thr_t* thr) /* in: query thread */ que_thr_t* thr) /* in: query thread */
{ {
ulint err; ulint err = DB_SUCCESS;
ut_ad(node && thr); ut_ad(node && thr);
......
...@@ -51,7 +51,8 @@ row_vers_impl_x_locked_off_kernel( ...@@ -51,7 +51,8 @@ row_vers_impl_x_locked_off_kernel(
mem_heap_t* heap; mem_heap_t* heap;
mem_heap_t* heap2; mem_heap_t* heap2;
dtuple_t* row; dtuple_t* row;
dtuple_t* entry; dtuple_t* entry = NULL; /* assignment to eliminate compiler
warning */
trx_t* trx; trx_t* trx;
ibool vers_del; ibool vers_del;
ibool rec_del; ibool rec_del;
......
...@@ -807,7 +807,7 @@ srv_console( ...@@ -807,7 +807,7 @@ srv_console(
/************************************************************************* /*************************************************************************
Creates the first communication endpoint for the server. This Creates the first communication endpoint for the server. This
first call also initializes the com0com.* module. */ first call also initializes the com0com.* module. */
static
void void
srv_communication_init( srv_communication_init(
/*===================*/ /*===================*/
...@@ -1037,7 +1037,7 @@ srv_worker_thread( ...@@ -1037,7 +1037,7 @@ srv_worker_thread(
/************************************************************************* /*************************************************************************
Creates the worker threads. */ Creates the worker threads. */
static
void void
srv_create_worker_threads(void) srv_create_worker_threads(void)
/*===========================*/ /*===========================*/
...@@ -1717,7 +1717,11 @@ srv_release_mysql_thread_if_suspended( ...@@ -1717,7 +1717,11 @@ srv_release_mysql_thread_if_suspended(
/************************************************************************* /*************************************************************************
A thread which wakes up threads whose lock wait may have lasted too long. */ A thread which wakes up threads whose lock wait may have lasted too long. */
#ifndef __WIN__
void*
#else
ulint ulint
#endif
srv_lock_timeout_monitor_thread( srv_lock_timeout_monitor_thread(
/*============================*/ /*============================*/
/* out: a dummy parameter */ /* out: a dummy parameter */
...@@ -1782,7 +1786,11 @@ loop: ...@@ -1782,7 +1786,11 @@ loop:
goto loop; goto loop;
#ifndef __WIN__
return(NULL);
#else
return(0); return(0);
#endif
} }
/*********************************************************************** /***********************************************************************
...@@ -1811,7 +1819,11 @@ srv_active_wake_master_thread(void) ...@@ -1811,7 +1819,11 @@ srv_active_wake_master_thread(void)
/************************************************************************* /*************************************************************************
The master thread controlling the server. */ The master thread controlling the server. */
#ifndef __WIN__
void*
#else
ulint ulint
#endif
srv_master_thread( srv_master_thread(
/*==============*/ /*==============*/
/* out: a dummy parameter */ /* out: a dummy parameter */
...@@ -1951,5 +1963,9 @@ background_loop: ...@@ -1951,5 +1963,9 @@ background_loop:
goto loop; goto loop;
#ifndef __WIN__
return(NULL);
#else
return(0); return(0);
#endif
} }
...@@ -81,7 +81,12 @@ os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 5]; ...@@ -81,7 +81,12 @@ os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 5];
/************************************************************************ /************************************************************************
I/o-handler thread function. */ I/o-handler thread function. */
static static
#ifndef __WIN__
void*
#else
ulint ulint
#endif
io_handler_thread( io_handler_thread(
/*==============*/ /*==============*/
void* arg) void* arg)
...@@ -101,7 +106,11 @@ io_handler_thread( ...@@ -101,7 +106,11 @@ io_handler_thread(
mutex_exit(&ios_mutex); mutex_exit(&ios_mutex);
} }
#ifndef __WIN__
return(NULL);
#else
return(0); return(0);
#endif
} }
/************************************************************************* /*************************************************************************
...@@ -124,6 +133,8 @@ open_or_create_log_file( ...@@ -124,6 +133,8 @@ open_or_create_log_file(
ulint size_high; ulint size_high;
char name[10000]; char name[10000];
UT_NOT_USED(create_new_db);
*log_file_created = FALSE; *log_file_created = FALSE;
sprintf(name, "%s%s%lu", srv_log_group_home_dirs[k], "ib_logfile", i); sprintf(name, "%s%s%lu", srv_log_group_home_dirs[k], "ib_logfile", i);
...@@ -164,6 +175,9 @@ open_or_create_log_file( ...@@ -164,6 +175,9 @@ open_or_create_log_file(
fprintf(stderr, fprintf(stderr,
"Innobase: Log file %s did not exist: new to be created\n", "Innobase: Log file %s did not exist: new to be created\n",
name); name);
printf("Innobase: Setting log file %s size to %lu\n",
name, UNIV_PAGE_SIZE * srv_log_file_size);
ret = os_file_set_size(name, files[i], ret = os_file_set_size(name, files[i],
UNIV_PAGE_SIZE * srv_log_file_size, 0); UNIV_PAGE_SIZE * srv_log_file_size, 0);
if (!ret) { if (!ret) {
...@@ -312,6 +326,9 @@ open_or_create_data_files( ...@@ -312,6 +326,9 @@ open_or_create_data_files(
printf("Innobase: Setting file %s size to %lu\n", printf("Innobase: Setting file %s size to %lu\n",
name, UNIV_PAGE_SIZE * srv_data_file_sizes[i]); name, UNIV_PAGE_SIZE * srv_data_file_sizes[i]);
printf(
"Innobase: Database physically writes the file full: wait...\n");
ret = os_file_set_size(name, files[i], ret = os_file_set_size(name, files[i],
UNIV_PAGE_SIZE * srv_data_file_sizes[i], 0); UNIV_PAGE_SIZE * srv_data_file_sizes[i], 0);
...@@ -514,6 +531,8 @@ innobase_start_or_create_for_mysql(void) ...@@ -514,6 +531,8 @@ innobase_start_or_create_for_mysql(void)
&sum_of_new_sizes); &sum_of_new_sizes);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
fprintf(stderr, "Innobase: Could not open data files\n");
return((int) err); return((int) err);
} }
......
...@@ -119,7 +119,6 @@ sync_array_get_nth_cell( ...@@ -119,7 +119,6 @@ sync_array_get_nth_cell(
ulint n) /* in: index */ ulint n) /* in: index */
{ {
ut_a(arr); ut_a(arr);
ut_a(n >= 0);
ut_a(n < arr->n_cells); ut_a(n < arr->n_cells);
return(arr->array + n); return(arr->array + n);
...@@ -455,8 +454,9 @@ sync_array_cell_print( ...@@ -455,8 +454,9 @@ sync_array_cell_print(
} }
printf("%lx waited for by thread %lu op. %s file %s line %lu ", printf("%lx waited for by thread %lu op. %s file %s line %lu ",
cell->wait_object, cell->thread, (ulint)cell->wait_object,
str, cell->file,cell->line); (ulint)cell->thread,
str, cell->file, cell->line);
if (!cell->waiting) { if (!cell->waiting) {
printf("WAIT ENDED "); printf("WAIT ENDED ");
} }
...@@ -633,7 +633,7 @@ sync_array_detect_deadlock( ...@@ -633,7 +633,7 @@ sync_array_detect_deadlock(
debug->pass, debug->pass,
depth); depth);
if (ret) { if (ret) {
printf("rw-lock %lx ", lock); printf("rw-lock %lx ", (ulint) lock);
rw_lock_debug_print(debug); rw_lock_debug_print(debug);
sync_array_cell_print(cell); sync_array_cell_print(cell);
...@@ -666,7 +666,7 @@ sync_array_detect_deadlock( ...@@ -666,7 +666,7 @@ sync_array_detect_deadlock(
debug->pass, debug->pass,
depth); depth);
if (ret) { if (ret) {
printf("rw-lock %lx ", lock); printf("rw-lock %lx ", (ulint) lock);
rw_lock_debug_print(debug); rw_lock_debug_print(debug);
sync_array_cell_print(cell); sync_array_cell_print(cell);
......
...@@ -165,7 +165,6 @@ rw_lock_validate( ...@@ -165,7 +165,6 @@ rw_lock_validate(
ut_a(lock->magic_n == RW_LOCK_MAGIC_N); ut_a(lock->magic_n == RW_LOCK_MAGIC_N);
ut_a((rw_lock_get_reader_count(lock) == 0) ut_a((rw_lock_get_reader_count(lock) == 0)
|| (rw_lock_get_writer(lock) != RW_LOCK_EX)); || (rw_lock_get_writer(lock) != RW_LOCK_EX));
ut_a(rw_lock_get_reader_count(lock) >= 0);
ut_a((rw_lock_get_writer(lock) == RW_LOCK_EX) ut_a((rw_lock_get_writer(lock) == RW_LOCK_EX)
|| (rw_lock_get_writer(lock) == RW_LOCK_WAIT_EX) || (rw_lock_get_writer(lock) == RW_LOCK_WAIT_EX)
|| (rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED)); || (rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED));
......
...@@ -259,7 +259,7 @@ mutex_enter_nowait( ...@@ -259,7 +259,7 @@ mutex_enter_nowait(
if (!mutex_test_and_set(mutex)) { if (!mutex_test_and_set(mutex)) {
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, __FILE__, __LINE__); mutex_set_debug_info(mutex, IB__FILE__, __LINE__);
#endif #endif
return(0); /* Succeeded! */ return(0); /* Succeeded! */
......
...@@ -1040,7 +1040,7 @@ trx_undo_report_row_operation( ...@@ -1040,7 +1040,7 @@ trx_undo_report_row_operation(
RW_X_LATCH, undo->guess_page, RW_X_LATCH, undo->guess_page,
BUF_GET, BUF_GET,
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__, IB__FILE__, __LINE__,
#endif #endif
&mtr); &mtr);
......
...@@ -30,14 +30,6 @@ sess_t* trx_dummy_sess = NULL; ...@@ -30,14 +30,6 @@ sess_t* trx_dummy_sess = NULL;
the kernel mutex */ the kernel mutex */
ulint trx_n_mysql_transactions = 0; ulint trx_n_mysql_transactions = 0;
/********************************************************************
Takes care of the error handling when an SQL error or other error has
occurred. */
static
void
trx_error_handle(
/*=============*/
trx_t* trx); /* in: trx handle */
/******************************************************************** /********************************************************************
Creates and initializes a transaction object. */ Creates and initializes a transaction object. */
......
...@@ -91,7 +91,7 @@ ut_print_buf( ...@@ -91,7 +91,7 @@ ut_print_buf(
data = buf; data = buf;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
printf("%02x", (ulint)*data); printf("%02lx", (ulint)*data);
data++; data++;
} }
...@@ -131,7 +131,7 @@ ut_sprintf_buf( ...@@ -131,7 +131,7 @@ ut_sprintf_buf(
data = buf; data = buf;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
n += sprintf(str + n, "%02x", (ulint)*data); n += sprintf(str + n, "%02lx", (ulint)*data);
data++; data++;
} }
......
...@@ -431,7 +431,8 @@ innobase_init(void) ...@@ -431,7 +431,8 @@ innobase_init(void)
if (!innobase_data_file_path) if (!innobase_data_file_path)
{ {
fprintf(stderr,"Can't initialize Innobase as 'innobase_data_file_path' is not set\n"); fprintf(stderr,
"Can't initialize Innobase as 'innobase_data_file_path' is not set\n");
innobase_skip=1; innobase_skip=1;
DBUG_RETURN(FALSE); // Continue without innobase DBUG_RETURN(FALSE); // Continue without innobase
} }
...@@ -1278,6 +1279,12 @@ innobase_convert_and_store_changed_col( ...@@ -1278,6 +1279,12 @@ innobase_convert_and_store_changed_col(
if (len == UNIV_SQL_NULL) { if (len == UNIV_SQL_NULL) {
data = NULL; data = NULL;
} else if (col_type == DATA_VARCHAR) {
/* Remove trailing spaces */
while (len > 0 && data[len - 1] == ' ') {
len--;
}
} else if (col_type == DATA_INT) { } else if (col_type == DATA_INT) {
/* Store integer data in Innobase in a big-endian /* Store integer data in Innobase in a big-endian
format, sign bit negated, if signed */ format, sign bit negated, if signed */
...@@ -2581,13 +2588,14 @@ ha_innobase::update_table_comment( ...@@ -2581,13 +2588,14 @@ ha_innobase::update_table_comment(
{ {
uint length=strlen(comment); uint length=strlen(comment);
char *str=my_malloc(length + 50,MYF(0)); char *str=my_malloc(length + 100,MYF(0));
if (!str) if (!str)
return (char*)comment; return (char*)comment;
sprintf(str,"%s Innobase free: %lu kB", comment, sprintf(str,
(ulong) innobase_get_free_space()); "%s; (See manual about Innobase stats); Innobase free: %lu kB",
comment, (ulong) innobase_get_free_space());
return((char*) str); return((char*) str);
} }
......
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