summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
Diffstat (limited to 'innobase')
-rw-r--r--innobase/btr/btr0btr.c3
-rw-r--r--innobase/btr/btr0cur.c7
-rw-r--r--innobase/btr/btr0sea.c6
-rw-r--r--innobase/buf/buf0buf.c2
-rw-r--r--innobase/buf/buf0flu.c2
-rw-r--r--innobase/com/com0shm.c10
-rw-r--r--innobase/data/data0data.c14
-rw-r--r--innobase/data/data0type.c2
-rw-r--r--innobase/dict/dict0crea.c14
-rw-r--r--innobase/dict/dict0dict.c10
-rw-r--r--innobase/fil/fil0fil.c2
-rw-r--r--innobase/fsp/fsp0fsp.c12
-rw-r--r--innobase/fut/fut0lst.c2
-rw-r--r--innobase/ibuf/ibuf0ibuf.c4
-rw-r--r--innobase/include/buf0buf.h8
-rw-r--r--innobase/include/buf0buf.ic2
-rw-r--r--innobase/include/hash0hash.ic1
-rw-r--r--innobase/include/mach0data.ic2
-rw-r--r--innobase/include/mem0mem.h16
-rw-r--r--innobase/include/mem0pool.h14
-rw-r--r--innobase/include/mtr0mtr.h4
-rw-r--r--innobase/include/os0file.h12
-rw-r--r--innobase/include/os0sync.h7
-rw-r--r--innobase/include/os0sync.ic2
-rw-r--r--innobase/include/os0thread.h8
-rw-r--r--innobase/include/row0mysql.ic4
-rw-r--r--innobase/include/srv0srv.h8
-rw-r--r--innobase/include/sync0rw.h14
-rw-r--r--innobase/include/sync0sync.h6
-rw-r--r--innobase/include/univ.i19
-rw-r--r--innobase/include/ut0dbg.h6
-rw-r--r--innobase/lock/lock0lock.c2
-rw-r--r--innobase/log/log0log.c15
-rw-r--r--innobase/log/log0recv.c40
-rw-r--r--innobase/mem/mem0pool.c13
-rw-r--r--innobase/os/os0file.c28
-rw-r--r--innobase/os/os0shm.c6
-rw-r--r--innobase/os/os0sync.c26
-rw-r--r--innobase/os/os0thread.c13
-rw-r--r--innobase/page/page0page.c10
-rw-r--r--innobase/que/que0que.c2
-rw-r--r--innobase/row/row0ins.c2
-rw-r--r--innobase/row/row0mysql.c12
-rw-r--r--innobase/row/row0sel.c4
-rw-r--r--innobase/row/row0upd.c6
-rw-r--r--innobase/row/row0vers.c3
-rw-r--r--innobase/srv/srv0srv.c20
-rw-r--r--innobase/srv/srv0start.c15
-rw-r--r--innobase/sync/sync0arr.c10
-rw-r--r--innobase/sync/sync0rw.c1
-rw-r--r--innobase/sync/sync0sync.c2
-rw-r--r--innobase/trx/trx0rec.c2
-rw-r--r--innobase/trx/trx0trx.c8
-rw-r--r--innobase/ut/ut0ut.c4
54 files changed, 252 insertions, 215 deletions
diff --git a/innobase/btr/btr0btr.c b/innobase/btr/btr0btr.c
index 50f54dcad70..63e70eb1b83 100644
--- a/innobase/btr/btr0btr.c
+++ b/innobase/btr/btr0btr.c
@@ -6,9 +6,6 @@ The B-tree
Created 6/2/1994 Heikki Tuuri
*******************************************************/
-/* Test a change in bitkeeper */
-
-
#include "btr0btr.h"
#ifdef UNIV_NONINL
diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c
index c5ea8232a37..e0e59152895 100644
--- a/innobase/btr/btr0cur.c
+++ b/innobase/btr/btr0cur.c
@@ -25,6 +25,7 @@ Created 10/16/1994 Heikki Tuuri
#include "page0page.h"
#include "rem0rec.h"
+#include "rem0cmp.h"
#include "btr0btr.h"
#include "btr0sea.h"
#include "row0upd.h"
@@ -314,7 +315,7 @@ retry_page_get:
page = buf_page_get_gen(space, page_no, rw_latch, guess,
buf_mode,
#ifdef UNIV_SYNC_DEBUG
- __FILE__, __LINE__,
+ IB__FILE__, __LINE__,
#endif
mtr);
@@ -485,7 +486,7 @@ btr_cur_open_at_index_side(
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET,
#ifdef UNIV_SYNC_DEBUG
- __FILE__, __LINE__,
+ IB__FILE__, __LINE__,
#endif
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
@@ -574,7 +575,7 @@ btr_cur_open_at_rnd_pos(
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET,
#ifdef UNIV_SYNC_DEBUG
- __FILE__, __LINE__,
+ IB__FILE__, __LINE__,
#endif
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c
index 89e396013fa..318bf97e7d2 100644
--- a/innobase/btr/btr0sea.c
+++ b/innobase/btr/btr0sea.c
@@ -187,13 +187,13 @@ btr_search_info_update_hash(
return;
}
+ n_unique = dict_index_get_n_unique_in_tree(index);
+
if (info->n_hash_potential == 0) {
goto set_new_recomm;
}
- n_unique = dict_index_get_n_unique_in_tree(index);
-
/* Test if the search would have succeeded using the recommended
hash prefix */
@@ -676,7 +676,7 @@ btr_search_guess_on_hash(
success = buf_page_get_known_nowait(latch_mode, page,
BUF_MAKE_YOUNG,
#ifdef UNIV_SYNC_DEBUG
- __FILE__, __LINE__,
+ IB__FILE__, __LINE__,
#endif
mtr);
diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c
index 4ffda8772f3..16662b6c51c 100644
--- a/innobase/buf/buf0buf.c
+++ b/innobase/buf/buf0buf.c
@@ -1117,7 +1117,7 @@ buf_page_create(
buf_LRU_add_block(block, FALSE);
#ifdef UNIV_SYNC_DEBUG
- buf_block_buf_fix_inc_debug(block, __FILE__, __LINE__);
+ buf_block_buf_fix_inc_debug(block, IB__FILE__, __LINE__);
#else
buf_block_buf_fix_inc(block);
#endif
diff --git a/innobase/buf/buf0flu.c b/innobase/buf/buf0flu.c
index d3a86b0c18d..443256cca34 100644
--- a/innobase/buf/buf0flu.c
+++ b/innobase/buf/buf0flu.c
@@ -560,7 +560,7 @@ buf_flush_batch(
if (buf_debug_prints && (page_count > 0)) {
if (flush_type == BUF_FLUSH_LRU) {
printf("To flush %lu pages in LRU flush\n",
- page_count, flush_type);
+ page_count);
} else if (flush_type == BUF_FLUSH_LIST) {
printf("To flush %lu pages in flush list flush\n",
page_count, flush_type);
diff --git a/innobase/com/com0shm.c b/innobase/com/com0shm.c
index 630241ff2f1..72ab23b9be8 100644
--- a/innobase/com/com0shm.c
+++ b/innobase/com/com0shm.c
@@ -774,7 +774,7 @@ com_shm_create_or_open(
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 +
com_shm_endpoint_get_size(ep), buf);
@@ -791,13 +791,13 @@ com_shm_create_or_open(
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);
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);
@@ -843,7 +843,7 @@ com_shm_open(
/* Open the interprocess mutex to protect the shared memory area */
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);
@@ -890,7 +890,7 @@ com_shm_bind(
/* Create the interprocess mutex to protect the shared memory area */
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);
diff --git a/innobase/data/data0data.c b/innobase/data/data0data.c
index df811503b8a..0f237f80d69 100644
--- a/innobase/data/data0data.c
+++ b/innobase/data/data0data.c
@@ -155,9 +155,7 @@ dtuple_validate(
ulint len;
ulint i;
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);
n_fields = dtuple_get_n_fields(tuple);
@@ -227,7 +225,7 @@ dfield_print(
}
} else if (mtype == DATA_INT) {
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 {
ut_error;
}
@@ -285,13 +283,13 @@ dfield_print_also_hex(
data = dfield_get_data(dfield);
for (i = 0; i < len; i++) {
- printf("%02x", (ulint)*data);
+ printf("%02lx", (ulint)*data);
data++;
}
} else if (mtype == DATA_INT) {
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 {
ut_error;
}
@@ -380,6 +378,8 @@ dtuple_sprintf(
return(len);
}
+#ifdef notdefined
+
/******************************************************************
Generates random numbers, where 10/16 is uniformly
distributed between 0 and n1, 5/16 between 0 and n2,
@@ -788,3 +788,5 @@ dtuple_gen_search_tuple_TPC_C(
ut_ad(dtuple_validate(tuple));
}
+
+#endif /* notdefined */
diff --git a/innobase/data/data0type.c b/innobase/data/data0type.c
index 313194eb788..be65dd5b1b4 100644
--- a/innobase/data/data0type.c
+++ b/innobase/data/data0type.c
@@ -89,5 +89,3 @@ dtype_print(
printf("; len %lu prec %lu\n", type->len, type->prec);
}
-
-
diff --git a/innobase/dict/dict0crea.c b/innobase/dict/dict0crea.c
index 37967361570..478364fba8a 100644
--- a/innobase/dict/dict0crea.c
+++ b/innobase/dict/dict0crea.c
@@ -80,16 +80,6 @@ dict_create_search_tuple(
table */
mem_heap_t* heap); /* in: memory heap from which the memory for
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
@@ -814,7 +804,7 @@ dict_create_table_step(
que_thr_t* thr) /* in: query thread */
{
tab_node_t* node;
- ulint err;
+ ulint err = DB_ERROR;
trx_t* trx;
ut_ad(thr);
@@ -922,7 +912,7 @@ dict_create_index_step(
{
ind_node_t* node;
ibool success;
- ulint err;
+ ulint err = DB_ERROR;
trx_t* trx;
ut_ad(thr);
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index 098d34c70e3..27c5c0d3edd 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -19,6 +19,7 @@ Created 1/8/1996 Heikki Tuuri
#include "dict0mem.h"
#include "trx0undo.h"
#include "btr0btr.h"
+#include "btr0cur.h"
#include "btr0sea.h"
#include "pars0pars.h"
#include "pars0sym.h"
@@ -40,13 +41,6 @@ dict_sys_t* dict_sys = NULL; /* the dictionary system */
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. */
static
void
@@ -586,7 +580,7 @@ dict_table_remove_from_cache(
/**************************************************************************
Frees tables from the end of table_LRU if the dictionary cache occupies
too much space. Currently not used! */
-static
+
void
dict_table_LRU_trim(void)
/*=====================*/
diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c
index dcb9698aa27..6f201c7bce4 100644
--- a/innobase/fil/fil0fil.c
+++ b/innobase/fil/fil0fil.c
@@ -544,6 +544,8 @@ fil_write_flushed_lsn_to_data_files(
}
mutex_exit(&(fil_system->mutex));
+
+ return(DB_SUCCESS);
}
/***********************************************************************
diff --git a/innobase/fsp/fsp0fsp.c b/innobase/fsp/fsp0fsp.c
index 27b5798cbcc..f856dfbf1fa 100644
--- a/innobase/fsp/fsp0fsp.c
+++ b/innobase/fsp/fsp0fsp.c
@@ -2626,11 +2626,11 @@ fseg_free_step(
fseg_inode_t* inode;
ulint space;
+ 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));
- space = buf_frame_get_space_id(header);
-
mtr_x_lock(fil_space_get_latch(space), mtr);
inode = fseg_inode_get(header, mtr);
@@ -2682,11 +2682,11 @@ fseg_free_step_not_header(
ulint space;
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);
-
+
+ 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);
inode = fseg_inode_get(header, mtr);
diff --git a/innobase/fut/fut0lst.c b/innobase/fut/fut0lst.c
index 5aa1975e558..4328fc97b33 100644
--- a/innobase/fut/fut0lst.c
+++ b/innobase/fut/fut0lst.c
@@ -512,5 +512,5 @@ flst_print(
printf("FILE-BASED LIST:\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),
- base - frame, len);
+ (ulint) (base - frame), len);
}
diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c
index aea322ee675..960ceb666f1 100644
--- a/innobase/ibuf/ibuf0ibuf.c
+++ b/innobase/ibuf/ibuf0ibuf.c
@@ -1292,6 +1292,8 @@ ibuf_add_free_page(
mutex_exit(&ibuf_mutex);
ibuf_exit();
+
+ return(DB_SUCCESS);
}
/*************************************************************************
@@ -2424,7 +2426,7 @@ loop:
success = buf_page_get_known_nowait(RW_X_LATCH, page,
BUF_KEEP_OLD,
#ifdef UNIV_SYNC_DEBUG
- __FILE__, __LINE__,
+ IB__FILE__, __LINE__,
#endif
&mtr);
diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h
index 08c59d60c91..09883fbb037 100644
--- a/innobase/include/buf0buf.h
+++ b/innobase/include/buf0buf.h
@@ -119,7 +119,7 @@ in LA! */
#ifdef UNIV_SYNC_DEBUG
#define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
- BUF_GET, __FILE__, __LINE__, MTR)
+ BUF_GET, IB__FILE__, __LINE__, MTR)
#else
#define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
@@ -134,7 +134,7 @@ with care. */
#ifdef UNIV_SYNC_DEBUG
#define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\
SP, OF, RW_NO_LATCH, NULL,\
- BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR)
+ BUF_GET_NO_LATCH, IB__FILE__, __LINE__, MTR)
#else
#define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\
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! */
#ifdef UNIV_SYNC_DEBUG
#define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
- BUF_GET_NOWAIT, __FILE__, __LINE__, MTR)
+ BUF_GET_NOWAIT, IB__FILE__, __LINE__, MTR)
#else
#define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
@@ -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! */
#ifdef UNIV_SYNC_DEBUG
#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
#define buf_page_optimistic_get(LA, G, MC, MTR) buf_page_optimistic_get_func(\
LA, G, MC, MTR)
diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic
index 24ada36bca2..1ecc6f34a78 100644
--- a/innobase/include/buf0buf.ic
+++ b/innobase/include/buf0buf.ic
@@ -558,7 +558,7 @@ buf_page_get_release_on_io(
frame = buf_page_get_gen(space, offset, rw_latch, guess,
BUF_GET_IF_IN_POOL,
#ifdef UNIV_SYNC_DEBUG
- __FILE__, __LINE__,
+ IB__FILE__, __LINE__,
#endif
mtr);
if (frame != NULL) {
diff --git a/innobase/include/hash0hash.ic b/innobase/include/hash0hash.ic
index 3ed2f9088dd..0d713140c13 100644
--- a/innobase/include/hash0hash.ic
+++ b/innobase/include/hash0hash.ic
@@ -18,7 +18,6 @@ hash_get_nth_cell(
hash_table_t* table, /* in: hash table */
ulint n) /* in: cell index */
{
- ut_ad(n >= 0);
ut_ad(n < table->n_cells);
return(table->array + n);
diff --git a/innobase/include/mach0data.ic b/innobase/include/mach0data.ic
index 6c93cb687a5..176f3415281 100644
--- a/innobase/include/mach0data.ic
+++ b/innobase/include/mach0data.ic
@@ -17,7 +17,7 @@ mach_write_to_1(
ulint n) /* in: ulint integer to be stored, >= 0, < 256 */
{
ut_ad(b);
- ut_ad((n >= 0) && (n <= 0xFF));
+ ut_ad(n <= 0xFF);
b[0] = (byte)n;
}
diff --git a/innobase/include/mem0mem.h b/innobase/include/mem0mem.h
index a2259a97503..95024cf8011 100644
--- a/innobase/include/mem0mem.h
+++ b/innobase/include/mem0mem.h
@@ -64,7 +64,7 @@ heap creation. */
#ifdef UNIV_MEM_DEBUG
#define mem_heap_create(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_DYNAMIC,\
- __FILE__, __LINE__)
+ IB__FILE__, __LINE__)
#else
#define mem_heap_create(N) mem_heap_create_func(N, NULL, MEM_HEAP_DYNAMIC)
#endif
@@ -74,7 +74,7 @@ heap creation. */
#ifdef UNIV_MEM_DEBUG
#define mem_heap_create_in_buffer(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BUFFER,\
- __FILE__, __LINE__)
+ IB__FILE__, __LINE__)
#else
#define mem_heap_create_in_buffer(N) mem_heap_create_func(N, NULL,\
MEM_HEAP_BUFFER)
@@ -86,7 +86,7 @@ heap creation. */
#define mem_heap_create_in_btr_search(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BTR_SEARCH |\
MEM_HEAP_BUFFER,\
- __FILE__, __LINE__)
+ IB__FILE__, __LINE__)
#else
#define mem_heap_create_in_btr_search(N) mem_heap_create_func(N, NULL,\
MEM_HEAP_BTR_SEARCH | MEM_HEAP_BUFFER)
@@ -99,7 +99,7 @@ mem_heap_free. See the parameter comment in mem_heap_create_func below. */
#ifdef UNIV_MEM_DEBUG
#define mem_heap_fast_create(N, B) mem_heap_create_func(\
(N), (B), MEM_HEAP_DYNAMIC,\
- __FILE__, __LINE__)
+ IB__FILE__, __LINE__)
#else
#define mem_heap_fast_create(N, B) mem_heap_create_func(N, (B),\
MEM_HEAP_DYNAMIC)
@@ -109,7 +109,7 @@ Use this macro instead of the corresponding function! Macro for memory
heap freeing. */
#ifdef UNIV_MEM_DEBUG
#define mem_heap_free(heap) mem_heap_free_func(\
- (heap), __FILE__, __LINE__)
+ (heap), IB__FILE__, __LINE__)
#else
#define mem_heap_free(heap) mem_heap_free_func(heap)
#endif
@@ -226,7 +226,7 @@ Use this macro instead of the corresponding function!
Macro for memory buffer allocation */
#ifdef UNIV_MEM_DEBUG
#define mem_alloc(N) mem_alloc_func(\
- (N), __FILE__, __LINE__)
+ (N), IB__FILE__, __LINE__)
#else
#define mem_alloc(N) mem_alloc_func(N)
#endif
@@ -235,7 +235,7 @@ Use this macro instead of the corresponding function!
Macro for memory buffer allocation */
#ifdef UNIV_MEM_DEBUG
#define mem_alloc_noninline(N) mem_alloc_func_noninline(\
- (N), __FILE__, __LINE__)
+ (N), IB__FILE__, __LINE__)
#else
#define mem_alloc_noninline(N) mem_alloc_func_noninline(N)
#endif
@@ -278,7 +278,7 @@ Use this macro instead of the corresponding function!
Macro for memory buffer freeing */
#ifdef UNIV_MEM_DEBUG
#define mem_free(PTR) mem_free_func(\
- (PTR), __FILE__, __LINE__)
+ (PTR), IB__FILE__, __LINE__)
#else
#define mem_free(PTR) mem_free_func(PTR)
#endif
diff --git a/innobase/include/mem0pool.h b/innobase/include/mem0pool.h
index b6906894c53..14198920bca 100644
--- a/innobase/include/mem0pool.h
+++ b/innobase/include/mem0pool.h
@@ -11,6 +11,7 @@ Created 6/9/1994 Heikki Tuuri
#include "univ.i"
#include "os0file.h"
+#include "ut0lst.h"
typedef struct mem_area_struct mem_area_t;
typedef struct mem_pool_struct mem_pool_t;
@@ -18,8 +19,19 @@ typedef struct mem_pool_struct mem_pool_t;
/* The common memory 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 */
-#define MEM_AREA_EXTRA_SIZE UNIV_MEM_ALIGNMENT
+#define MEM_AREA_EXTRA_SIZE (sizeof(struct mem_area_struct))
/************************************************************************
Creates a memory pool. */
diff --git a/innobase/include/mtr0mtr.h b/innobase/include/mtr0mtr.h
index 9f9401cd1a5..dec8eeb1e15 100644
--- a/innobase/include/mtr0mtr.h
+++ b/innobase/include/mtr0mtr.h
@@ -204,7 +204,7 @@ mtr_read_dulint(
/*************************************************************************
This macro locks an rw-lock in s-mode. */
#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))
#else
#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. */
/*************************************************************************
This macro locks an rw-lock in x-mode. */
#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))
#else
#define mtr_x_lock(B, MTR) mtr_x_lock_func((B), (MTR))
diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h
index 0960cf32105..98e892f16b2 100644
--- a/innobase/include/os0file.h
+++ b/innobase/include/os0file.h
@@ -13,7 +13,6 @@ Created 10/21/1995 Heikki Tuuri
#ifdef __WIN__
-#include <windows.h>
#if (defined(__NT__) || defined(__WIN2000__))
#define WIN_ASYNC_IO
@@ -28,19 +27,10 @@ Created 10/21/1995 Heikki Tuuri
#define POSIX_ASYNC_IO
#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
#ifdef __WIN__
-typedef HANDLE os_file_t;
+#define os_file_t HANDLE
#else
typedef int os_file_t;
#endif
diff --git a/innobase/include/os0sync.h b/innobase/include/os0sync.h
index 3201a12b0a7..89e3f953b50 100644
--- a/innobase/include/os0sync.h
+++ b/innobase/include/os0sync.h
@@ -13,8 +13,7 @@ Created 9/6/1995 Heikki Tuuri
#ifdef __WIN__
-#include <windows.h>
-typedef CRITICAL_SECTION os_fast_mutex_t;
+#define os_fast_mutex_t CRITICAL_SECTION
typedef void* os_event_t;
#else
@@ -190,9 +189,9 @@ os_fast_mutex_free(
/*===============*/
os_fast_mutex_t* fast_mutex); /* in: mutex to free */
#endif
-
+
#ifndef UNIV_NONINL
#include "os0sync.ic"
#endif
-#endif
+#endif
diff --git a/innobase/include/os0sync.ic b/innobase/include/os0sync.ic
index d82f38483e3..8be9a783593 100644
--- a/innobase/include/os0sync.ic
+++ b/innobase/include/os0sync.ic
@@ -25,7 +25,7 @@ os_fast_mutex_trylock(
#ifdef __WIN__
int ret;
- /* TryEnterCriticalSection is probably not found from
+ /* TODO: TryEnterCriticalSection is probably not found from
NT versions < 4! */
ret = TryEnterCriticalSection(fast_mutex);
diff --git a/innobase/include/os0thread.h b/innobase/include/os0thread.h
index 2b2d9fb4bd6..2e4b6f0f6ee 100644
--- a/innobase/include/os0thread.h
+++ b/innobase/include/os0thread.h
@@ -28,6 +28,10 @@ typedef pthread_t os_thread_t;
#endif
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
the function given. The start function takes a void* parameter
@@ -37,8 +41,12 @@ os_thread_t
os_thread_create(
/*=============*/
/* out: handle to the thread */
+#ifndef __WIN__
+ os_posix_f_t start_f,
+#else
ulint (*start_f)(void*), /* in: pointer to function
from which to start */
+#endif
void* arg, /* in: argument to start
function */
os_thread_id_t* thread_id); /* out: id of created
diff --git a/innobase/include/row0mysql.ic b/innobase/include/row0mysql.ic
index 773e25a87ef..957a143008d 100644
--- a/innobase/include/row0mysql.ic
+++ b/innobase/include/row0mysql.ic
@@ -43,6 +43,8 @@ row_mysql_read_var_ref(
return(field + 2);
*/
+ UT_NOT_USED(len);
+
return(field); /* No real var implemented in MySQL yet! */
}
@@ -83,7 +85,7 @@ row_mysql_store_col_in_innobase_format(
}
if (!is_unsigned) {
- *ptr = *ptr ^ 128;
+ *ptr = (byte) (*ptr ^ 128);
}
} else if (type == DATA_VARCHAR || type == DATA_VARMYSQL
|| type == DATA_BINARY) {
diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h
index 6418b903eeb..a6750e3b277 100644
--- a/innobase/include/srv0srv.h
+++ b/innobase/include/srv0srv.h
@@ -132,7 +132,11 @@ srv_release_threads(
/*************************************************************************
The master thread controlling the server. */
+#ifndef __WIN__
+void*
+#else
ulint
+#endif
srv_master_thread(
/*==============*/
/* out: a dummy parameter */
@@ -187,7 +191,11 @@ srv_release_mysql_thread_if_suspended(
/*************************************************************************
A thread which wakes up threads whose lock wait may have lasted too long. */
+#ifndef __WIN__
+void*
+#else
ulint
+#endif
srv_lock_timeout_monitor_thread(
/*============================*/
/* out: a dummy parameter */
diff --git a/innobase/include/sync0rw.h b/innobase/include/sync0rw.h
index 20afdfb025f..4e055da3810 100644
--- a/innobase/include/sync0rw.h
+++ b/innobase/include/sync0rw.h
@@ -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
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
@@ -94,7 +94,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG
#define rw_lock_s_lock(M) rw_lock_s_lock_func(\
- (M), 0, __FILE__, __LINE__)
+ (M), 0, IB__FILE__, __LINE__)
#else
#define rw_lock_s_lock(M) rw_lock_s_lock_func(M)
#endif
@@ -104,7 +104,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG
#define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(\
- (M), (P), __FILE__, __LINE__)
+ (M), (P), IB__FILE__, __LINE__)
#else
#define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(M)
#endif
@@ -114,7 +114,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG
#define rw_lock_s_lock_nowait(M) rw_lock_s_lock_func_nowait(\
- (M), __FILE__, __LINE__)
+ (M), IB__FILE__, __LINE__)
#else
#define rw_lock_s_lock_nowait(M) rw_lock_s_lock_func_nowait(M)
#endif
@@ -201,7 +201,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG
#define rw_lock_x_lock(M) rw_lock_x_lock_func(\
- (M), 0, __FILE__, __LINE__)
+ (M), 0, IB__FILE__, __LINE__)
#else
#define rw_lock_x_lock(M) rw_lock_x_lock_func(M, 0)
#endif
@@ -211,7 +211,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG
#define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(\
- (M), (P), __FILE__, __LINE__)
+ (M), (P), IB__FILE__, __LINE__)
#else
#define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(M, P)
#endif
@@ -221,7 +221,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG
#define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(\
- (M), __FILE__, __LINE__)
+ (M), IB__FILE__, __LINE__)
#else
#define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(M)
#endif
diff --git a/innobase/include/sync0sync.h b/innobase/include/sync0sync.h
index 87c4628d2e4..f22cce17a1a 100644
--- a/innobase/include/sync0sync.h
+++ b/innobase/include/sync0sync.h
@@ -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. */
-#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
@@ -64,7 +64,7 @@ NOTE! The following macro should be used in mutex locking, not the
corresponding function. */
#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
#define mutex_enter(M) mutex_enter_func(M)
#endif
@@ -75,7 +75,7 @@ corresponding function. */
/* NOTE! currently same as mutex_enter! */
#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
#define mutex_enter_fast(M) mutex_enter_func(M)
#endif
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index d60c297f3c4..3b8e9be5888 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -13,6 +13,12 @@ Created 1/20/1994 Heikki Tuuri
#define __WIN__
#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
/* The Unix version */
@@ -38,7 +44,7 @@ subdirectory of 'mysql'. */
/* DEBUG VERSION CONTROL
===================== */
/* Make a non-inline debug version */
-/*
+
#define UNIV_DEBUG
#define UNIV_MEM_DEBUG
#define UNIV_SYNC_DEBUG
@@ -48,7 +54,7 @@ subdirectory of 'mysql'. */
#define UNIV_SYNC_PERF_STAT
#define UNIV_SEARCH_PERF_STAT
-*/
+
#define UNIV_LIGHT_MEM_DEBUG
#define YYDEBUG 1
@@ -91,8 +97,8 @@ definitions: */
#elif defined(_WIN64)
#define UNIV_WORD_SIZE 8
#else
-/* config.h generated by GNU autoconf will define SIZEOF_INT in Posix */
-#define UNIV_WORD_SIZE SIZEOF_INT
+/* MySQL config.h generated by GNU autoconf will define SIZEOF_LONG in Posix */
+#define UNIV_WORD_SIZE SIZEOF_LONG
#endif
/* 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! */
has the SQL NULL as its value. */
#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 "ut0dbg.h"
#include "ut0ut.h"
diff --git a/innobase/include/ut0dbg.h b/innobase/include/ut0dbg.h
index cf49f4f993f..a61f80f01c6 100644
--- a/innobase/include/ut0dbg.h
+++ b/innobase/include/ut0dbg.h
@@ -28,7 +28,7 @@ extern ulint* ut_dbg_null_ptr;
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
/* printf(\
"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(\
"we generate a memory trap on purpose to start the debugger\n");*/\
ut_dbg_stop_threads = TRUE;\
@@ -39,7 +39,7 @@ extern ulint* ut_dbg_null_ptr;
}\
if (ut_dbg_stop_threads) {\
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);\
}\
}
@@ -48,7 +48,7 @@ extern ulint* ut_dbg_null_ptr;
ulint dbg_i;\
printf(\
"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");\
ut_dbg_stop_threads = TRUE;\
dbg_i = *(ut_dbg_null_ptr);\
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index efea160fac1..d5005d2dffd 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -3177,7 +3177,7 @@ lock_rec_print(
page = buf_page_get_gen(space, page_no, RW_NO_LATCH,
NULL, BUF_GET_IF_IN_POOL,
#ifdef UNIV_SYNC_DEBUG
- __FILE__, __LINE__,
+ IB__FILE__, __LINE__,
#endif
&mtr);
if (page) {
diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c
index c6fec44d128..ee3135cf33d 100644
--- a/innobase/log/log0log.c
+++ b/innobase/log/log0log.c
@@ -73,16 +73,6 @@ the previous */
#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. */
static
void
@@ -520,6 +510,8 @@ log_calc_max_ages(void)
+ LOG_CHECKPOINT_EXTRA_FREE;
if (free >= smallest_capacity / 2) {
success = FALSE;
+
+ goto failure;
} else {
margin = smallest_capacity - free;
}
@@ -540,10 +532,11 @@ log_calc_max_ages(void)
log_sys->max_archived_lsn_age_async = smallest_archive_margin
- smallest_archive_margin /
LOG_ARCHIVE_RATIO_ASYNC;
+failure:
mutex_exit(&(log_sys->mutex));
if (!success) {
- printf(
+ fprintf(stderr,
"Error: log file group too small for the number of threads\n");
}
diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c
index 1d0b556f1b6..27431b30dcf 100644
--- a/innobase/log/log0recv.c
+++ b/innobase/log/log0recv.c
@@ -407,12 +407,17 @@ recv_find_max_checkpoint(
/* Check the consistency of the checkpoint info */
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)) {
if (log_debug_writes) {
fprintf(stderr,
- "Innobase: Checkpoint in group %lu at %lu invalid\n",
- group->id, field);
+ "Innobase: Checkpoint in group %lu at %lu invalid, %lu, %lu\n",
+ group->id, field,
+ fold & 0xFFFFFFFF,
+ mach_read_from_4(buf
+ + LOG_CHECKPOINT_CHECKSUM_1));
+
}
goto not_consistent;
@@ -421,12 +426,16 @@ recv_find_max_checkpoint(
fold = ut_fold_binary(buf + LOG_CHECKPOINT_LSN,
LOG_CHECKPOINT_CHECKSUM_2
- LOG_CHECKPOINT_LSN);
- if (fold != mach_read_from_4(buf
+ if ((fold & 0xFFFFFFFF)
+ != mach_read_from_4(buf
+ LOG_CHECKPOINT_CHECKSUM_2)) {
if (log_debug_writes) {
fprintf(stderr,
- "Innobase: Checkpoint in group %lu at %lu invalid\n",
- group->id, field);
+ "Innobase: Checkpoint in group %lu at %lu invalid, %lu, %lu\n",
+ group->id, field,
+ fold & 0xFFFFFFFF,
+ mach_read_from_4(buf
+ + LOG_CHECKPOINT_CHECKSUM_2));
}
goto not_consistent;
}
@@ -461,10 +470,7 @@ recv_find_max_checkpoint(
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);
}
@@ -796,7 +802,7 @@ recv_recover_page(
success = buf_page_get_known_nowait(RW_X_LATCH, page, BUF_KEEP_OLD,
#ifdef UNIV_SYNC_DEBUG
- __FILE__, __LINE__,
+ IB__FILE__, __LINE__,
#endif
&mtr);
ut_a(success);
@@ -860,8 +866,8 @@ recv_recover_page(
if (log_debug_writes) {
fprintf(stderr,
- "Innobase: Applying log rec type %lu len %lu to space %lu page no %lu\n",
- recv->type, recv->len, recv_addr->space,
+ "Innobase: Applying log rec type %lu len %lu to space %lu page no %lu\n",
+ (ulint)recv->type, recv->len, recv_addr->space,
recv_addr->page_no);
}
@@ -1213,7 +1219,7 @@ recv_compare_spaces(
frame = buf_page_get_gen(space1, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL,
#ifdef UNIV_SYNC_DEBUG
- __FILE__, __LINE__,
+ IB__FILE__, __LINE__,
#endif
&mtr);
if (frame) {
@@ -1228,7 +1234,7 @@ recv_compare_spaces(
frame = buf_page_get_gen(space2, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL,
#ifdef UNIV_SYNC_DEBUG
- __FILE__, __LINE__,
+ IB__FILE__, __LINE__,
#endif
&mtr);
if (frame) {
@@ -1449,7 +1455,7 @@ loop:
if (log_debug_writes) {
fprintf(stderr,
"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) {
@@ -1498,7 +1504,7 @@ loop:
if (log_debug_writes) {
fprintf(stderr,
"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;
diff --git a/innobase/mem/mem0pool.c b/innobase/mem/mem0pool.c
index 7418ee36dbc..2a871b00373 100644
--- a/innobase/mem/mem0pool.c
+++ b/innobase/mem/mem0pool.c
@@ -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
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 */
#define MEM_AREA_FREE 1
/* 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
algorithm, where free list i contains areas of size 2 to power i. */
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index 9e45c2981de..1da95c8ba9c 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -166,6 +166,8 @@ os_file_handle_error(
int input_char;
ulint err;
+ UT_NOT_USED(file);
+
err = os_file_get_last_error();
if (err == OS_FILE_DISK_FULL) {
@@ -316,8 +318,11 @@ try_again:
UT_NOT_USED(purpose);
if (create_mode == OS_FILE_CREATE) {
- file = open(name, create_flag, S_IRUSR | S_IRGRP | S_IROTH
- | S_IWUSR | S_IWGRP | S_IWOTH);
+#ifndef S_IRWXU
+ file = open(name, create_flag);
+#else
+ file = open(name, create_flag, S_IRWXU | S_IRWXG | S_IRWXO);
+#endif
} else {
file = open(name, create_flag);
}
@@ -445,6 +450,8 @@ try_again:
low = size;
#if (UNIV_WORD_SIZE == 8)
low = low + (size_high << 32);
+#else
+ UT_NOT_USED(size_high);
#endif
while (offset < low) {
if (low - offset < UNIV_PAGE_SIZE * 64) {
@@ -478,6 +485,8 @@ error_handling:
}
ut_error;
+
+ return(FALSE);
}
/***************************************************************************
@@ -660,6 +669,8 @@ try_again:
#if (UNIV_WORD_SIZE == 8)
offset = offset + (offset_high << 32);
+#else
+ UT_NOT_USED(offset_high);
#endif
try_again:
/* Protect the seek / read operation with a mutex */
@@ -669,7 +680,7 @@ try_again:
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]);
return(TRUE);
@@ -751,16 +762,17 @@ try_again:
#if (UNIV_WORD_SIZE == 8)
offset = offset + (offset_high << 32);
+#else
+ UT_NOT_USED(offset_high);
#endif
try_again:
ret = pwrite(file, buf, n, (off_t) offset);
- if (ret == n) {
+ if ((ulint)ret == n) {
return(TRUE);
}
#endif
-
-error_handling:
+error_handling:
retry = os_file_handle_error(file, name);
if (retry) {
@@ -1411,7 +1423,6 @@ try_again:
return(TRUE);
}
-error_handling:
os_aio_array_free_slot(array, slot);
retry = os_file_handle_error(file, name);
@@ -1908,7 +1919,8 @@ loop:
if (slot->reserved) {
n_reserved++;
printf("Reserved slot, messages %lx %lx\n",
- slot->message1, slot->message2);
+ (ulint)slot->message1,
+ (ulint)slot->message2);
ut_a(slot->len > 0);
}
}
diff --git a/innobase/os/os0shm.c b/innobase/os/os0shm.c
index e03440cd4f4..f49aa2922b0 100644
--- a/innobase/os/os0shm.c
+++ b/innobase/os/os0shm.c
@@ -90,6 +90,8 @@ os_shm_free(
}
#else
UT_NOT_USED(shm);
+
+ return(FALSE);
#endif
}
@@ -116,6 +118,8 @@ os_shm_map(
return(mem);
#else
UT_NOT_USED(shm);
+
+ return(NULL);
#endif
}
@@ -142,5 +146,7 @@ os_shm_unmap(
}
#else
UT_NOT_USED(addr);
+
+ return(FALSE);
#endif
}
diff --git a/innobase/os/os0sync.c b/innobase/os/os0sync.c
index 9f9b2605884..4c283431575 100644
--- a/innobase/os/os0sync.c
+++ b/innobase/os/os0sync.c
@@ -19,14 +19,14 @@ Created 9/6/1995 Heikki Tuuri
#include "ut0mem.h"
/* Type definition for an operating system mutex struct */
-struct os_mutex_struct{
+struct os_mutex_struct{
void* handle; /* OS handle to mutex */
ulint count; /* we use this counter to check
that the same thread does not
recursively lock the mutex: we
do not assume that the OS mutex
supports recursive locking, though
- NT seems to do that */
+ NT seems to do that */
};
/*************************************************************
@@ -44,7 +44,7 @@ os_event_create(
{
#ifdef __WIN__
HANDLE event;
-
+
event = CreateEvent(NULL, /* No security attributes */
TRUE, /* Manual reset */
FALSE, /* Initial state nonsignaled */
@@ -108,7 +108,7 @@ os_event_set(
/*=========*/
os_event_t event) /* in: event to set */
{
-#ifdef __WIN__
+#ifdef __WIN__
ut_a(event);
ut_a(SetEvent(event));
#else
@@ -124,7 +124,7 @@ os_event_set(
}
os_fast_mutex_unlock(&(event->os_mutex));
-#endif
+#endif
}
/**************************************************************
@@ -162,7 +162,7 @@ void
os_event_free(
/*==========*/
os_event_t event) /* in: event to free */
-
+
{
#ifdef __WIN__
ut_a(event);
@@ -238,7 +238,7 @@ os_event_wait_time(
} else {
err = WaitForSingleObject(event, INFINITE);
}
-
+
if (err == WAIT_OBJECT_0) {
return(0);
@@ -250,7 +250,7 @@ os_event_wait_time(
}
#else
UT_NOT_USED(time);
-
+
/* In Posix this is just an ordinary, infinite wait */
os_event_wait(event);
@@ -290,7 +290,7 @@ os_event_wait_multiple(
return(index - WAIT_OBJECT_0);
#else
ut_a(n == 0);
-
+
/* In Posix we can only wait for a single event */
os_event_wait(*event_array);
@@ -331,7 +331,7 @@ os_mutex_create(
os_mutex_t mutex_str;
UT_NOT_USED(name);
-
+
os_mutex = ut_malloc(sizeof(os_fast_mutex_t));
os_fast_mutex_init(os_mutex);
@@ -342,7 +342,7 @@ os_mutex_create(
mutex_str->count = 0;
return(mutex_str);
-#endif
+#endif
}
/**************************************************************
@@ -398,7 +398,7 @@ os_mutex_exit(
(mutex->count)--;
os_fast_mutex_unlock(mutex->handle);
-#endif
+#endif
}
/**************************************************************
@@ -432,7 +432,7 @@ os_fast_mutex_init(
{
#ifdef __WIN__
ut_a(fast_mutex);
-
+
InitializeCriticalSection((LPCRITICAL_SECTION) fast_mutex);
#else
pthread_mutex_init(fast_mutex, NULL);
diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c
index a33613267ac..8fea31ecf8e 100644
--- a/innobase/os/os0thread.c
+++ b/innobase/os/os0thread.c
@@ -30,9 +30,6 @@ os_thread_get_curr_id(void)
#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
the function given. The start function takes a void* parameter
@@ -42,8 +39,12 @@ os_thread_t
os_thread_create(
/*=============*/
/* out: handle to the thread */
+#ifndef __WIN__
+ os_posix_f_t start_f,
+#else
ulint (*start_f)(void*), /* in: pointer to function
from which to start */
+#endif
void* arg, /* in: argument to start
function */
os_thread_id_t* thread_id) /* out: id of created
@@ -65,11 +66,7 @@ os_thread_create(
int ret;
os_thread_t pthread;
- /* Note that below we cast the start function returning an integer
- 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);
+ ret = pthread_create(&pthread, NULL, start_f, arg);
return(pthread);
#endif
diff --git a/innobase/page/page0page.c b/innobase/page/page0page.c
index 7df23775db2..7986684fd07 100644
--- a/innobase/page/page0page.c
+++ b/innobase/page/page0page.c
@@ -1055,9 +1055,9 @@ page_dir_print(
printf("--------------------------------\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",
- 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++) {
slot = page_dir_get_nth_slot(page, i);
if ((i == pr_n) && (i < n - pr_n)) {
@@ -1067,7 +1067,7 @@ page_dir_print(
printf(
"Contents of slot: %lu: n_owned: %lu, rec offs: %lu\n",
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));
@@ -1091,7 +1091,7 @@ page_print_list(
printf("--------------------------------\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);
@@ -1142,7 +1142,7 @@ page_header_print(
{
printf("--------------------------------\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));
printf("n dir slots %lu, heap top %lu\n",
diff --git a/innobase/que/que0que.c b/innobase/que/que0que.c
index 0a6ce86d176..b2c7e3ceea8 100644
--- a/innobase/que/que0que.c
+++ b/innobase/que/que0que.c
@@ -1243,7 +1243,7 @@ que_thr_step(
/***********************************************************************
Checks if there is a need for a query thread switch or stopping the current
thread. */
-static
+
que_thr_t*
que_thr_check_if_switch(
/*====================*/
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c
index 4502cb8235f..89a85a39a55 100644
--- a/innobase/row/row0ins.c
+++ b/innobase/row/row0ins.c
@@ -439,6 +439,8 @@ row_ins_duplicate_error(
page_t* page;
ulint n_unique;
+ UT_NOT_USED(mtr);
+
ut_ad(cursor->index->type & DICT_UNIQUE);
/* NOTE: For unique non-clustered indexes there may be any number
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 13d84ffd358..3fa9066674e 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -93,9 +93,6 @@ row_mysql_convert_row_to_innobase(
field type information is already
copied there, or will be copied
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
must be of type ROW_MYSQL_WHOLE_ROW */
byte* mysql_rec) /* in: row in the MySQL format;
@@ -474,9 +471,8 @@ row_insert_for_mysql(
node = prebuilt->ins_node;
}
- row_mysql_convert_row_to_innobase(node->row,
- prebuilt->ins_upd_rec_buff,
- prebuilt, mysql_rec);
+ row_mysql_convert_row_to_innobase(node->row, prebuilt, mysql_rec);
+
savept = trx_savept_take(trx);
thr = que_fork_get_first_thr(prebuilt->ins_graph);
@@ -666,9 +662,7 @@ row_update_for_mysql(
prebuilt->mysql_row_len);
}
- row_mysql_convert_row_to_innobase(row_tuple,
- prebuilt->ins_upd_rec_buff,
- prebuilt, mysql_rec);
+ row_mysql_convert_row_to_innobase(row_tuple, prebuilt, mysql_rec);
search_tuple = dtuple_create(heap, ref_len);
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index bd7af5743d8..1045c39248e 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -1791,6 +1791,8 @@ row_sel_convert_mysql_key_to_innobase(
byte* key_end;
ulint n_fields = 0;
+ UT_NOT_USED(index);
+
key_end = key_ptr + key_len;
/* Permit us to access any field in the tuple (ULINT_MAX): */
@@ -1919,7 +1921,7 @@ row_sel_field_store_in_mysql_format(
}
if (!is_unsigned) {
- dest[len - 1] = dest[len - 1] ^ 128;
+ dest[len - 1] = (byte) (dest[len - 1] ^ 128);
}
ut_ad(col_len == len);
diff --git a/innobase/row/row0upd.c b/innobase/row/row0upd.c
index 44843494247..c0f1035046b 100644
--- a/innobase/row/row0upd.c
+++ b/innobase/row/row0upd.c
@@ -750,7 +750,7 @@ row_upd_sec_index_entry(
btr_cur_t* btr_cur;
mem_heap_t* heap;
rec_t* rec;
- ulint err;
+ ulint err = DB_SUCCESS;
index = node->index;
@@ -781,7 +781,7 @@ row_upd_sec_index_entry(
btr_pcur_close(&pcur);
mtr_commit(&mtr);
- if (node->is_delete || (err != DB_SUCCESS)) {
+ if (node->is_delete || err != DB_SUCCESS) {
mem_heap_free(heap);
@@ -1169,7 +1169,7 @@ row_upd(
upd_node_t* node, /* in: row update node */
que_thr_t* thr) /* in: query thread */
{
- ulint err;
+ ulint err = DB_SUCCESS;
ut_ad(node && thr);
diff --git a/innobase/row/row0vers.c b/innobase/row/row0vers.c
index 80acc7225df..4dc65669247 100644
--- a/innobase/row/row0vers.c
+++ b/innobase/row/row0vers.c
@@ -51,7 +51,8 @@ row_vers_impl_x_locked_off_kernel(
mem_heap_t* heap;
mem_heap_t* heap2;
dtuple_t* row;
- dtuple_t* entry;
+ dtuple_t* entry = NULL; /* assignment to eliminate compiler
+ warning */
trx_t* trx;
ibool vers_del;
ibool rec_del;
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index 2218d23f6d9..84488761d0e 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -807,7 +807,7 @@ srv_console(
/*************************************************************************
Creates the first communication endpoint for the server. This
first call also initializes the com0com.* module. */
-static
+
void
srv_communication_init(
/*===================*/
@@ -1037,7 +1037,7 @@ srv_worker_thread(
/*************************************************************************
Creates the worker threads. */
-static
+
void
srv_create_worker_threads(void)
/*===========================*/
@@ -1717,7 +1717,11 @@ srv_release_mysql_thread_if_suspended(
/*************************************************************************
A thread which wakes up threads whose lock wait may have lasted too long. */
+#ifndef __WIN__
+void*
+#else
ulint
+#endif
srv_lock_timeout_monitor_thread(
/*============================*/
/* out: a dummy parameter */
@@ -1782,7 +1786,11 @@ loop:
goto loop;
+#ifndef __WIN__
+ return(NULL);
+#else
return(0);
+#endif
}
/***********************************************************************
@@ -1811,7 +1819,11 @@ srv_active_wake_master_thread(void)
/*************************************************************************
The master thread controlling the server. */
+#ifndef __WIN__
+void*
+#else
ulint
+#endif
srv_master_thread(
/*==============*/
/* out: a dummy parameter */
@@ -1951,5 +1963,9 @@ background_loop:
goto loop;
+#ifndef __WIN__
+ return(NULL);
+#else
return(0);
+#endif
}
diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c
index a3e94b63e37..a051e2b62b5 100644
--- a/innobase/srv/srv0start.c
+++ b/innobase/srv/srv0start.c
@@ -81,7 +81,12 @@ os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 5];
/************************************************************************
I/o-handler thread function. */
static
+
+#ifndef __WIN__
+void*
+#else
ulint
+#endif
io_handler_thread(
/*==============*/
void* arg)
@@ -101,7 +106,11 @@ io_handler_thread(
mutex_exit(&ios_mutex);
}
+#ifndef __WIN__
+ return(NULL);
+#else
return(0);
+#endif
}
/*************************************************************************
@@ -124,6 +133,8 @@ open_or_create_log_file(
ulint size_high;
char name[10000];
+ UT_NOT_USED(create_new_db);
+
*log_file_created = FALSE;
sprintf(name, "%s%s%lu", srv_log_group_home_dirs[k], "ib_logfile", i);
@@ -506,7 +517,7 @@ innobase_start_or_create_for_mysql(void)
n[i] = i;
os_thread_create(io_handler_thread, n + i, thread_ids + i);
- }
+ }
err = open_or_create_data_files(&create_new_db,
&min_flushed_lsn, &min_arch_log_no,
@@ -514,6 +525,8 @@ innobase_start_or_create_for_mysql(void)
&sum_of_new_sizes);
if (err != DB_SUCCESS) {
+ fprintf(stderr, "Innobase: Could not open data files\n");
+
return((int) err);
}
diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c
index 193a60e36b6..48d043e1e04 100644
--- a/innobase/sync/sync0arr.c
+++ b/innobase/sync/sync0arr.c
@@ -119,7 +119,6 @@ sync_array_get_nth_cell(
ulint n) /* in: index */
{
ut_a(arr);
- ut_a(n >= 0);
ut_a(n < arr->n_cells);
return(arr->array + n);
@@ -455,8 +454,9 @@ sync_array_cell_print(
}
printf("%lx waited for by thread %lu op. %s file %s line %lu ",
- cell->wait_object, cell->thread,
- str, cell->file,cell->line);
+ (ulint)cell->wait_object,
+ (ulint)cell->thread,
+ str, cell->file, cell->line);
if (!cell->waiting) {
printf("WAIT ENDED ");
}
@@ -633,7 +633,7 @@ sync_array_detect_deadlock(
debug->pass,
depth);
if (ret) {
- printf("rw-lock %lx ", lock);
+ printf("rw-lock %lx ", (ulint) lock);
rw_lock_debug_print(debug);
sync_array_cell_print(cell);
@@ -666,7 +666,7 @@ sync_array_detect_deadlock(
debug->pass,
depth);
if (ret) {
- printf("rw-lock %lx ", lock);
+ printf("rw-lock %lx ", (ulint) lock);
rw_lock_debug_print(debug);
sync_array_cell_print(cell);
diff --git a/innobase/sync/sync0rw.c b/innobase/sync/sync0rw.c
index 77589587065..a77cc76ed37 100644
--- a/innobase/sync/sync0rw.c
+++ b/innobase/sync/sync0rw.c
@@ -165,7 +165,6 @@ rw_lock_validate(
ut_a(lock->magic_n == RW_LOCK_MAGIC_N);
ut_a((rw_lock_get_reader_count(lock) == 0)
|| (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)
|| (rw_lock_get_writer(lock) == RW_LOCK_WAIT_EX)
|| (rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED));
diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c
index f4ba472f6bf..b98b22dd90b 100644
--- a/innobase/sync/sync0sync.c
+++ b/innobase/sync/sync0sync.c
@@ -259,7 +259,7 @@ mutex_enter_nowait(
if (!mutex_test_and_set(mutex)) {
#ifdef UNIV_SYNC_DEBUG
- mutex_set_debug_info(mutex, __FILE__, __LINE__);
+ mutex_set_debug_info(mutex, IB__FILE__, __LINE__);
#endif
return(0); /* Succeeded! */
diff --git a/innobase/trx/trx0rec.c b/innobase/trx/trx0rec.c
index fa2e480ece0..c31d786011d 100644
--- a/innobase/trx/trx0rec.c
+++ b/innobase/trx/trx0rec.c
@@ -1040,7 +1040,7 @@ trx_undo_report_row_operation(
RW_X_LATCH, undo->guess_page,
BUF_GET,
#ifdef UNIV_SYNC_DEBUG
- __FILE__, __LINE__,
+ IB__FILE__, __LINE__,
#endif
&mtr);
diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c
index 0c1c3aff8d6..4676606d4de 100644
--- a/innobase/trx/trx0trx.c
+++ b/innobase/trx/trx0trx.c
@@ -30,14 +30,6 @@ sess_t* trx_dummy_sess = NULL;
the kernel mutex */
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. */
diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c
index 8af1f7487f4..cfd714fc275 100644
--- a/innobase/ut/ut0ut.c
+++ b/innobase/ut/ut0ut.c
@@ -91,7 +91,7 @@ ut_print_buf(
data = buf;
for (i = 0; i < len; i++) {
- printf("%02x", (ulint)*data);
+ printf("%02lx", (ulint)*data);
data++;
}
@@ -131,7 +131,7 @@ ut_sprintf_buf(
data = buf;
for (i = 0; i < len; i++) {
- n += sprintf(str + n, "%02x", (ulint)*data);
+ n += sprintf(str + n, "%02lx", (ulint)*data);
data++;
}