Commit 4d6805f2 authored by marko's avatar marko

branches/zip: Merge revisions 1322:1402 from trunk.

parent d753d3e8
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#SET(CMAKE_CXX_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
#SET(CMAKE_C_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
ADD_DEFINITIONS(-DMYSQL_SERVER -D_WIN32 -DWIN32 -D_LIB) ADD_DEFINITIONS(-DMYSQL_SERVER -D_WIN32 -DWIN32 -D_LIB)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
......
...@@ -91,6 +91,8 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr ...@@ -91,6 +91,8 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr
include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic include/ha_prototypes.h \ include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic include/ha_prototypes.h \
include/ut0list.h include/ut0list.ic \ include/ut0list.h include/ut0list.ic \
include/ut0wqueue.h \ include/ut0wqueue.h \
pars/make_bison.sh pars/make_flex.sh \
pars/pars0grm.y pars/pars0lex.l
CMakeLists.txt plug.in CMakeLists.txt plug.in
noinst_LIBRARIES = libinnobase.a noinst_LIBRARIES = libinnobase.a
......
...@@ -261,7 +261,7 @@ dict_build_table_def_step( ...@@ -261,7 +261,7 @@ dict_build_table_def_step(
&space, path_or_name, is_path, &space, path_or_name, is_path,
dict_table_zip_size(table), dict_table_zip_size(table),
FIL_IBD_FILE_INITIAL_SIZE); FIL_IBD_FILE_INITIAL_SIZE);
table->space = space; table->space = (unsigned int) space;
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
...@@ -820,7 +820,7 @@ create: ...@@ -820,7 +820,7 @@ create:
root_page_no = btr_create(type, space, zip_size, index_id, index, mtr); root_page_no = btr_create(type, space, zip_size, index_id, index, mtr);
if (index) { if (index) {
index->page = root_page_no; index->page = (unsigned int) root_page_no;
} else { } else {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
......
...@@ -683,7 +683,8 @@ dict_table_get_on_id( ...@@ -683,7 +683,8 @@ dict_table_get_on_id(
if we are doing a rollback to handle an error in TABLE if we are doing a rollback to handle an error in TABLE
CREATE, for example, we already have the mutex! */ CREATE, for example, we already have the mutex! */
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex))
|| trx->dict_operation_lock_mode == RW_X_LATCH);
return(dict_table_get_on_id_low(table_id)); return(dict_table_get_on_id_low(table_id));
} }
...@@ -1411,7 +1412,7 @@ dict_index_add_to_cache( ...@@ -1411,7 +1412,7 @@ dict_index_add_to_cache(
dict_index_get_nth_field(new_index, i)->col->ord_part = 1; dict_index_get_nth_field(new_index, i)->col->ord_part = 1;
} }
new_index->page = page_no; new_index->page = (unsigned int) page_no;
rw_lock_create(&new_index->lock, SYNC_INDEX_TREE); rw_lock_create(&new_index->lock, SYNC_INDEX_TREE);
if (!UNIV_UNLIKELY(new_index->type & DICT_UNIVERSAL)) { if (!UNIV_UNLIKELY(new_index->type & DICT_UNIVERSAL)) {
...@@ -1522,10 +1523,10 @@ dict_index_add_col( ...@@ -1522,10 +1523,10 @@ dict_index_add_col(
field = dict_index_get_nth_field(index, index->n_def - 1); field = dict_index_get_nth_field(index, index->n_def - 1);
field->col = col; field->col = col;
field->fixed_len = dict_col_get_fixed_size(col); field->fixed_len = (unsigned int) dict_col_get_fixed_size(col);
if (prefix_len && field->fixed_len > prefix_len) { if (prefix_len && field->fixed_len > prefix_len) {
field->fixed_len = prefix_len; field->fixed_len = (unsigned int) prefix_len;
} }
/* Long fixed-length fields that need external storage are treated as /* Long fixed-length fields that need external storage are treated as
...@@ -1726,7 +1727,7 @@ dict_index_build_internal_clust( ...@@ -1726,7 +1727,7 @@ dict_index_build_internal_clust(
break; break;
} }
new_index->trx_id_offset += fixed_size; new_index->trx_id_offset += (unsigned int) fixed_size;
} }
} }
...@@ -3039,7 +3040,7 @@ col_loop1: ...@@ -3039,7 +3040,7 @@ col_loop1:
foreign->foreign_table_name = mem_heap_strdup(foreign->heap, foreign->foreign_table_name = mem_heap_strdup(foreign->heap,
table->name); table->name);
foreign->foreign_index = index; foreign->foreign_index = index;
foreign->n_fields = i; foreign->n_fields = (unsigned int) i;
foreign->foreign_col_names = mem_heap_alloc(foreign->heap, foreign->foreign_col_names = mem_heap_alloc(foreign->heap,
i * sizeof(void*)); i * sizeof(void*));
for (i = 0; i < foreign->n_fields; i++) { for (i = 0; i < foreign->n_fields; i++) {
......
...@@ -882,7 +882,7 @@ err_exit: ...@@ -882,7 +882,7 @@ err_exit:
table = dict_mem_table_create(name, space, n_cols & ~0x80000000UL, table = dict_mem_table_create(name, space, n_cols & ~0x80000000UL,
flags); flags);
table->ibd_file_missing = ibd_file_missing; table->ibd_file_missing = (unsigned int) ibd_file_missing;
ut_a(name_of_col_is(sys_tables, sys_index, 3, "ID")); ut_a(name_of_col_is(sys_tables, sys_index, 3, "ID"));
...@@ -1217,8 +1217,8 @@ dict_load_foreign( ...@@ -1217,8 +1217,8 @@ dict_load_foreign(
/* We store the type in the bits 24..29 of n_fields_and_type. */ /* We store the type in the bits 24..29 of n_fields_and_type. */
foreign->type = n_fields_and_type >> 24; foreign->type = (unsigned int) (n_fields_and_type >> 24);
foreign->n_fields = n_fields_and_type & 0x3FFUL; foreign->n_fields = (unsigned int) (n_fields_and_type & 0x3FFUL);
foreign->id = mem_heap_strdup(foreign->heap, id); foreign->id = mem_heap_strdup(foreign->heap, id);
......
...@@ -49,14 +49,14 @@ dict_mem_table_create( ...@@ -49,14 +49,14 @@ dict_mem_table_create(
table->heap = heap; table->heap = heap;
table->flags = flags; table->flags = (unsigned int) flags;
table->name = mem_heap_strdup(heap, name); table->name = mem_heap_strdup(heap, name);
table->dir_path_of_temp_table = NULL; table->dir_path_of_temp_table = NULL;
table->space = space; table->space = (unsigned int) space;
table->ibd_file_missing = FALSE; table->ibd_file_missing = FALSE;
table->tablespace_discarded = FALSE; table->tablespace_discarded = FALSE;
table->n_def = 0; table->n_def = 0;
table->n_cols = n_cols + DATA_N_SYS_COLS; table->n_cols = (unsigned int) (n_cols + DATA_N_SYS_COLS);
table->n_mysql_handles_opened = 0; table->n_mysql_handles_opened = 0;
table->n_foreign_key_checks_running = 0; table->n_foreign_key_checks_running = 0;
...@@ -202,14 +202,14 @@ dict_mem_table_add_col( ...@@ -202,14 +202,14 @@ dict_mem_table_add_col(
col->ind = i; col->ind = i;
col->ord_part = 0; col->ord_part = 0;
col->mtype = mtype; col->mtype = (unsigned int) mtype;
col->prtype = prtype; col->prtype = (unsigned int) prtype;
col->len = len; col->len = (unsigned int) len;
dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen); dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen);
col->mbminlen = mbminlen; col->mbminlen = (unsigned int) mbminlen;
col->mbmaxlen = mbmaxlen; col->mbmaxlen = (unsigned int) mbmaxlen;
} }
/************************************************************************** /**************************************************************************
...@@ -239,13 +239,13 @@ dict_mem_index_create( ...@@ -239,13 +239,13 @@ dict_mem_index_create(
index->heap = heap; index->heap = heap;
index->type = type; index->type = type;
index->space = space; index->space = (unsigned int) space;
index->page = 0; index->page = 0;
index->name = mem_heap_strdup(heap, index_name); index->name = mem_heap_strdup(heap, index_name);
index->table_name = table_name; index->table_name = table_name;
index->table = NULL; index->table = NULL;
index->n_def = index->n_nullable = 0; index->n_def = index->n_nullable = 0;
index->n_fields = n_fields; index->n_fields = (unsigned int) n_fields;
index->fields = mem_heap_alloc(heap, 1 + n_fields index->fields = mem_heap_alloc(heap, 1 + n_fields
* sizeof(dict_field_t)); * sizeof(dict_field_t));
/* The '1 +' above prevents allocation /* The '1 +' above prevents allocation
...@@ -320,7 +320,7 @@ dict_mem_index_add_field( ...@@ -320,7 +320,7 @@ dict_mem_index_add_field(
field = dict_index_get_nth_field(index, index->n_def - 1); field = dict_index_get_nth_field(index, index->n_def - 1);
field->name = name; field->name = name;
field->prefix_len = prefix_len; field->prefix_len = (unsigned int) prefix_len;
} }
/************************************************************************** /**************************************************************************
......
...@@ -194,7 +194,7 @@ for_step( ...@@ -194,7 +194,7 @@ for_step(
loop_var_value = eval_node_get_int_val(node->loop_start_limit); loop_var_value = eval_node_get_int_val(node->loop_start_limit);
node->loop_end_value node->loop_end_value
= eval_node_get_int_val(node->loop_end_limit); = (int) eval_node_get_int_val(node->loop_end_limit);
} }
/* Check if we should do another loop */ /* Check if we should do another loop */
......
This diff is collapsed.
...@@ -35,10 +35,6 @@ typedef struct st_innobase_share { ...@@ -35,10 +35,6 @@ typedef struct st_innobase_share {
struct row_prebuilt_struct; struct row_prebuilt_struct;
typedef struct row_prebuilt_struct row_prebuilt_t; typedef struct row_prebuilt_struct row_prebuilt_t;
my_bool innobase_query_caching_of_table_permitted(THD* thd, char* full_name,
uint full_name_len,
ulonglong *unused);
/* The class defining a handle to an Innodb table */ /* The class defining a handle to an Innodb table */
class ha_innobase: public handler class ha_innobase: public handler
{ {
...@@ -48,8 +44,6 @@ class ha_innobase: public handler ...@@ -48,8 +44,6 @@ class ha_innobase: public handler
THD* user_thd; /* the thread handle of the user THD* user_thd; /* the thread handle of the user
currently using the handle; this is currently using the handle; this is
set in external_lock function */ set in external_lock function */
query_id_t last_query_id; /* the latest query id where the
handle was used */
THR_LOCK_DATA lock; THR_LOCK_DATA lock;
INNOBASE_SHARE *share; INNOBASE_SHARE *share;
...@@ -186,14 +180,7 @@ class ha_innobase: public handler ...@@ -186,14 +180,7 @@ class ha_innobase: public handler
my_bool register_query_cache_table(THD *thd, char *table_key, my_bool register_query_cache_table(THD *thd, char *table_key,
uint key_length, uint key_length,
qc_engine_callback *call_back, qc_engine_callback *call_back,
ulonglong *engine_data) ulonglong *engine_data);
{
*call_back= innobase_query_caching_of_table_permitted;
*engine_data= 0;
return innobase_query_caching_of_table_permitted(thd, table_key,
key_length,
engine_data);
}
static char *get_mysql_bin_log_name(); static char *get_mysql_bin_log_name();
static ulonglong get_mysql_bin_log_pos(); static ulonglong get_mysql_bin_log_pos();
bool primary_key_is_clustered() { return true; } bool primary_key_is_clustered() { return true; }
...@@ -222,7 +209,8 @@ extern my_bool innobase_log_archive, ...@@ -222,7 +209,8 @@ extern my_bool innobase_log_archive,
innobase_use_native_aio, innobase_use_native_aio,
innobase_file_per_table, innobase_locks_unsafe_for_binlog, innobase_file_per_table, innobase_locks_unsafe_for_binlog,
innobase_rollback_on_timeout, innobase_rollback_on_timeout,
innobase_create_status_file; innobase_create_status_file,
innobase_stats_on_metadata;
extern "C" { extern "C" {
extern ulong srv_buf_pool_curr_size; extern ulong srv_buf_pool_curr_size;
extern ulong srv_buf_pool_size; extern ulong srv_buf_pool_size;
......
...@@ -1103,6 +1103,9 @@ rec_offs_nth_size( ...@@ -1103,6 +1103,9 @@ rec_offs_nth_size(
{ {
ut_ad(rec_offs_validate(NULL, NULL, offsets)); ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets)); ut_ad(n < rec_offs_n_fields(offsets));
if (!n) {
return(rec_offs_base(offsets)[1 + n] & REC_OFFS_MASK);
}
return((rec_offs_base(offsets)[1 + n] - rec_offs_base(offsets)[n]) return((rec_offs_base(offsets)[1 + n] - rec_offs_base(offsets)[n])
& REC_OFFS_MASK); & REC_OFFS_MASK);
} }
......
...@@ -125,6 +125,8 @@ extern ulint srv_fast_shutdown; /* If this is 1, do not do a ...@@ -125,6 +125,8 @@ extern ulint srv_fast_shutdown; /* If this is 1, do not do a
transactions). */ transactions). */
extern ibool srv_innodb_status; extern ibool srv_innodb_status;
extern ibool srv_stats_on_metadata;
extern ibool srv_use_doublewrite_buf; extern ibool srv_use_doublewrite_buf;
extern ibool srv_use_checksums; extern ibool srv_use_checksums;
......
...@@ -375,8 +375,6 @@ trx_is_interrupted( ...@@ -375,8 +375,6 @@ trx_is_interrupted(
/* Signal to a transaction */ /* Signal to a transaction */
struct trx_sig_struct{ struct trx_sig_struct{
ulint type; /* signal type */ ulint type; /* signal type */
ulint state; /* TRX_SIG_WAITING or
TRX_SIG_BEING_HANDLED */
ulint sender; /* TRX_SIG_SELF or ulint sender; /* TRX_SIG_SELF or
TRX_SIG_OTHER_SESS */ TRX_SIG_OTHER_SESS */
que_thr_t* receiver; /* non-NULL if the sender of the signal que_thr_t* receiver; /* non-NULL if the sender of the signal
...@@ -404,7 +402,7 @@ struct trx_struct{ ...@@ -404,7 +402,7 @@ struct trx_struct{
const char* op_info; /* English text describing the const char* op_info; /* English text describing the
current operation, or an empty current operation, or an empty
string */ string */
ulint type; /* TRX_USER, TRX_PURGE */ unsigned is_purge:1; /* 0=user transaction, 1=purge */
ulint conc_state; /* state of the trx from the point ulint conc_state; /* state of the trx from the point
of view of concurrency control: of view of concurrency control:
TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY, TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
...@@ -675,12 +673,6 @@ struct trx_struct{ ...@@ -675,12 +673,6 @@ struct trx_struct{
single operation of a single operation of a
transaction, e.g., a parallel transaction, e.g., a parallel
query */ query */
/* Transaction types */
#define TRX_USER 1 /* normal user transaction */
#define TRX_PURGE 2 /* purge transaction: this is not
inserted to the trx list of trx_sys
and no rollback segment is assigned to
this */
/* Transaction concurrency states */ /* Transaction concurrency states */
#define TRX_NOT_STARTED 1 #define TRX_NOT_STARTED 1
#define TRX_ACTIVE 2 #define TRX_ACTIVE 2
...@@ -742,9 +734,6 @@ struct trx_struct{ ...@@ -742,9 +734,6 @@ struct trx_struct{
session */ session */
#define TRX_SIG_OTHER_SESS 2 /* sent by another session (which #define TRX_SIG_OTHER_SESS 2 /* sent by another session (which
must hold rights to this) */ must hold rights to this) */
/* Signal states */
#define TRX_SIG_WAITING 1
#define TRX_SIG_BEING_HANDLED 2
/* Commit command node in a query graph */ /* Commit command node in a query graph */
struct commit_node_struct{ struct commit_node_struct{
......
...@@ -426,8 +426,8 @@ ut_bit_set_nth( ...@@ -426,8 +426,8 @@ ut_bit_set_nth(
# error "TRUE != 1" # error "TRUE != 1"
#endif #endif
if (val) { if (val) {
return((1 << n) | a); return(((ulint) 1 << n) | a);
} else { } else {
return(~(1 << n) & a); return(~((ulint) 1 << n) & a);
} }
} }
...@@ -182,5 +182,5 @@ ut_2_exp( ...@@ -182,5 +182,5 @@ ut_2_exp(
/* out: 2 to power n */ /* out: 2 to power n */
ulint n) /* in: number */ ulint n) /* in: number */
{ {
return(1 << n); return((ulint) 1 << n);
} }
...@@ -3416,12 +3416,6 @@ lock_deadlock_recursive( ...@@ -3416,12 +3416,6 @@ lock_deadlock_recursive(
*cost = *cost + 1; *cost = *cost + 1;
if ((depth > LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK)
|| (*cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK)) {
return(LOCK_VICTIM_IS_START);
}
lock = wait_lock; lock = wait_lock;
if (lock_get_type(wait_lock) == LOCK_REC) { if (lock_get_type(wait_lock) == LOCK_REC) {
...@@ -3454,11 +3448,18 @@ lock_deadlock_recursive( ...@@ -3454,11 +3448,18 @@ lock_deadlock_recursive(
if (lock_has_to_wait(wait_lock, lock)) { if (lock_has_to_wait(wait_lock, lock)) {
ibool too_far
= depth > LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK
|| *cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK;
lock_trx = lock->trx; lock_trx = lock->trx;
if (lock_trx == start) { if (lock_trx == start || too_far) {
/* We came back to the recursion starting /* We came back to the recursion starting
point: a deadlock detected */ point: a deadlock detected; or we have
searched the waits-for graph too long */
FILE* ef = lock_latest_err_file; FILE* ef = lock_latest_err_file;
rewind(ef); rewind(ef);
...@@ -3500,9 +3501,20 @@ lock_deadlock_recursive( ...@@ -3500,9 +3501,20 @@ lock_deadlock_recursive(
} }
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if (lock_print_waits) { if (lock_print_waits) {
fputs("Deadlock detected\n", stderr); fputs("Deadlock detected"
" or too long search\n",
stderr);
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
if (too_far) {
fputs("TOO DEEP OR LONG SEARCH"
" IN THE LOCK TABLE"
" WAITS-FOR GRAPH\n", ef);
return(LOCK_VICTIM_IS_START);
}
if (ut_dulint_cmp(wait_lock->trx->undo_no, if (ut_dulint_cmp(wait_lock->trx->undo_no,
start->undo_no) >= 0) { start->undo_no) >= 0) {
/* Our recursion starting point /* Our recursion starting point
......
...@@ -547,7 +547,7 @@ mlog_parse_index( ...@@ -547,7 +547,7 @@ mlog_parse_index(
ind = dict_mem_index_create("LOG_DUMMY", "LOG_DUMMY", ind = dict_mem_index_create("LOG_DUMMY", "LOG_DUMMY",
DICT_HDR_SPACE, 0, n); DICT_HDR_SPACE, 0, n);
ind->table = table; ind->table = table;
ind->n_uniq = n_uniq; ind->n_uniq = (unsigned int) n_uniq;
if (n_uniq != n) { if (n_uniq != n) {
ut_a(n_uniq + DATA_ROLL_PTR <= n); ut_a(n_uniq + DATA_ROLL_PTR <= n);
ind->type = DICT_CLUSTERED; ind->type = DICT_CLUSTERED;
......
-- source include/have_innodb.inc -- source include/have_innodb.inc
# Can't test this with embedded server
-- source include/not_embedded.inc
# #
# Check and select innodb lock type # Check and select innodb lock type
......
...@@ -2,11 +2,11 @@ drop table if exists t1; ...@@ -2,11 +2,11 @@ drop table if exists t1;
create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb; create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
select * from t1; select * from t1;
c1 c2 stamp c1 c2 stamp
replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12"); replace delayed into t1 (c1, c2) values ( "text1","11");
ERROR HY000: Table storage engine for 't1' doesn't have this option ERROR HY000: Table storage engine for 't1' doesn't have this option
select * from t1; select * from t1;
c1 c2 stamp c1 c2 stamp
replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text3","14", "a" ),( "text4","15", "b" ); replace delayed into t1 (c1, c2) values ( "text1","12");
ERROR HY000: Table storage engine for 't1' doesn't have this option ERROR HY000: Table storage engine for 't1' doesn't have this option
select * from t1; select * from t1;
c1 c2 stamp c1 c2 stamp
......
...@@ -12,10 +12,10 @@ drop table if exists t1; ...@@ -12,10 +12,10 @@ drop table if exists t1;
create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb; create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
select * from t1; select * from t1;
--error 1031 --error 1031
replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12"); replace delayed into t1 (c1, c2) values ( "text1","11");
select * from t1; select * from t1;
--error 1031 --error 1031
replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text3","14", "a" ),( "text4","15", "b" ); replace delayed into t1 (c1, c2) values ( "text1","12");
select * from t1; select * from t1;
drop table t1; drop table t1;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
--source include/have_innodb.inc
SET storage_engine=innodb;
--source include/gis_generic.inc
#
# Bug #15680 (SPATIAL key in innodb)
#
--error ER_TABLE_CANT_HANDLE_SPKEYS
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
...@@ -318,7 +318,7 @@ os_file_get_last_error( ...@@ -318,7 +318,7 @@ os_file_get_last_error(
fflush(stderr); fflush(stderr);
if (err == ENOSPC ) { if (err == ENOSPC) {
return(OS_FILE_DISK_FULL); return(OS_FILE_DISK_FULL);
#ifdef POSIX_ASYNC_IO #ifdef POSIX_ASYNC_IO
} else if (err == EAGAIN) { } else if (err == EAGAIN) {
...@@ -337,15 +337,20 @@ os_file_get_last_error( ...@@ -337,15 +337,20 @@ os_file_get_last_error(
} }
/******************************************************************** /********************************************************************
Does error handling when a file operation fails. */ Does error handling when a file operation fails.
Conditionally exits (calling exit(3)) based on should_exit value and the
error type */
static static
ibool ibool
os_file_handle_error( os_file_handle_error_cond_exit(
/*=================*/ /*===========================*/
/* out: TRUE if we should retry the /* out: TRUE if we should retry the
operation */ operation */
const char* name, /* in: name of a file or NULL */ const char* name, /* in: name of a file or NULL */
const char* operation)/* in: operation */ const char* operation, /* in: operation */
ibool should_exit) /* in: call exit(3) if unknown error
and this parameter is TRUE */
{ {
ulint err; ulint err;
...@@ -376,11 +381,9 @@ os_file_handle_error( ...@@ -376,11 +381,9 @@ os_file_handle_error(
fflush(stderr); fflush(stderr);
return(FALSE); return(FALSE);
} else if (err == OS_FILE_AIO_RESOURCES_RESERVED) { } else if (err == OS_FILE_AIO_RESOURCES_RESERVED) {
return(TRUE); return(TRUE);
} else if (err == OS_FILE_ALREADY_EXISTS } else if (err == OS_FILE_ALREADY_EXISTS
|| err == OS_FILE_PATH_ERROR) { || err == OS_FILE_PATH_ERROR) {
...@@ -392,16 +395,49 @@ os_file_handle_error( ...@@ -392,16 +395,49 @@ os_file_handle_error(
fprintf(stderr, "InnoDB: File operation call: '%s'.\n", fprintf(stderr, "InnoDB: File operation call: '%s'.\n",
operation); operation);
if (should_exit) {
fprintf(stderr, "InnoDB: Cannot continue operation.\n"); fprintf(stderr, "InnoDB: Cannot continue operation.\n");
fflush(stderr); fflush(stderr);
exit(1); exit(1);
} }
}
return(FALSE); return(FALSE);
} }
/********************************************************************
Does error handling when a file operation fails. */
static
ibool
os_file_handle_error(
/*=================*/
/* out: TRUE if we should retry the
operation */
const char* name, /* in: name of a file or NULL */
const char* operation)/* in: operation */
{
/* exit in case of unknown error */
return(os_file_handle_error_cond_exit(name, operation, TRUE));
}
/********************************************************************
Does error handling when a file operation fails. */
static
ibool
os_file_handle_error_no_exit(
/*=========================*/
/* out: TRUE if we should retry the
operation */
const char* name, /* in: name of a file or NULL */
const char* operation)/* in: operation */
{
/* don't exit in case of unknown error */
return(os_file_handle_error_cond_exit(name, operation, FALSE));
}
#undef USE_FILE_LOCK #undef USE_FILE_LOCK
#define USE_FILE_LOCK #define USE_FILE_LOCK
#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__FreeBSD__) || defined(__NETWARE__) #if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__FreeBSD__) || defined(__NETWARE__)
...@@ -445,68 +481,6 @@ os_file_lock( ...@@ -445,68 +481,6 @@ os_file_lock(
} }
#endif /* USE_FILE_LOCK */ #endif /* USE_FILE_LOCK */
/********************************************************************
Does error handling when a file operation fails. */
static
ibool
os_file_handle_error_no_exit(
/*=========================*/
/* out: TRUE if we should retry the
operation */
const char* name, /* in: name of a file or NULL */
const char* operation)/* in: operation */
{
ulint err;
err = os_file_get_last_error(FALSE);
if (err == OS_FILE_DISK_FULL) {
/* We only print a warning about disk full once */
if (os_has_said_disk_full) {
return(FALSE);
}
if (name) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Encountered a problem with"
" file %s\n", name);
}
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Disk is full. Try to clean the disk"
" to free space.\n");
os_has_said_disk_full = TRUE;
fflush(stderr);
return(FALSE);
} else if (err == OS_FILE_AIO_RESOURCES_RESERVED) {
return(TRUE);
} else if (err == OS_FILE_ALREADY_EXISTS
|| err == OS_FILE_PATH_ERROR) {
return(FALSE);
} else {
if (name) {
fprintf(stderr, "InnoDB: File name %s\n", name);
}
fprintf(stderr, "InnoDB: File operation call: '%s'.\n",
operation);
return (FALSE);
}
return(FALSE); /* not reached */
}
/******************************************************************** /********************************************************************
Creates the seek mutexes used in positioned reads and writes. */ Creates the seek mutexes used in positioned reads and writes. */
...@@ -930,7 +904,7 @@ try_again: ...@@ -930,7 +904,7 @@ try_again:
file = CreateFile((LPCTSTR) name, file = CreateFile((LPCTSTR) name,
access, access,
FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
/* file can be read ansd written also /* file can be read and written also
by other processes */ by other processes */
NULL, /* default security attributes */ NULL, /* default security attributes */
create_flag, create_flag,
...@@ -1124,6 +1098,51 @@ os_file_create_simple_no_error_handling( ...@@ -1124,6 +1098,51 @@ os_file_create_simple_no_error_handling(
#endif /* __WIN__ */ #endif /* __WIN__ */
} }
/********************************************************************
Tries to disable OS caching on an opened file descriptor. */
void
os_file_set_nocache(
/*================*/
int fd, /* in: file descriptor to alter */
const char* file_name, /* in: used in the diagnostic message */
const char* operation_name) /* in: used in the diagnostic message,
we call os_file_set_nocache()
immediately after opening or creating
a file, so this is either "open" or
"create" */
{
/* some versions of Solaris may not have DIRECTIO_ON */
#if defined(UNIV_SOLARIS) && defined(DIRECTIO_ON)
if (directio(fd, DIRECTIO_ON) == -1) {
int errno_save;
errno_save = (int)errno;
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Failed to set DIRECTIO_ON "
"on file %s: %s: %s, continuing anyway\n",
file_name, operation_name, strerror(errno_save));
}
#elif defined(O_DIRECT)
if (fcntl(fd, F_SETFL, O_DIRECT) == -1) {
int errno_save;
errno_save = (int)errno;
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Failed to set O_DIRECT "
"on file %s: %s: %s, continuing anyway\n",
file_name, operation_name, strerror(errno_save));
if (errno_save == EINVAL) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: O_DIRECT is known to result in "
"'Invalid argument' on Linux on tmpfs, "
"see MySQL Bug#26662\n");
}
}
#endif
}
/******************************************************************** /********************************************************************
Opens an existing file or creates a new. */ Opens an existing file or creates a new. */
...@@ -1306,21 +1325,8 @@ try_again: ...@@ -1306,21 +1325,8 @@ try_again:
create_flag = create_flag | O_SYNC; create_flag = create_flag | O_SYNC;
} }
#endif /* O_SYNC */ #endif /* O_SYNC */
#ifdef O_DIRECT
/* We let O_DIRECT only affect data files */
if (type != OS_LOG_FILE
&& srv_unix_file_flush_method == SRV_UNIX_O_DIRECT) {
# if 0
fprintf(stderr, "Using O_DIRECT for file %s\n", name);
# endif
create_flag = create_flag | O_DIRECT;
}
#endif /* O_DIRECT */
if (create_mode == OS_FILE_CREATE) {
file = open(name, create_flag, os_innodb_umask); file = open(name, create_flag, os_innodb_umask);
} else {
file = open(name, create_flag);
}
if (file == -1) { if (file == -1) {
*success = FALSE; *success = FALSE;
...@@ -1330,11 +1336,24 @@ try_again: ...@@ -1330,11 +1336,24 @@ try_again:
"create" : "open"); "create" : "open");
if (retry) { if (retry) {
goto try_again; goto try_again;
} else {
return(file /* -1 */);
}
} }
/* else */
*success = TRUE;
/* We disable OS caching (O_DIRECT) only on data files */
if (type != OS_LOG_FILE
&& srv_unix_file_flush_method == SRV_UNIX_O_DIRECT) {
os_file_set_nocache(file, name, mode_str);
}
#ifdef USE_FILE_LOCK #ifdef USE_FILE_LOCK
} else if (create_mode != OS_FILE_OPEN_RAW if (create_mode != OS_FILE_OPEN_RAW && os_file_lock(file, name)) {
&& os_file_lock(file, name)) {
*success = FALSE;
if (create_mode == OS_FILE_OPEN_RETRY) { if (create_mode == OS_FILE_OPEN_RETRY) {
int i; int i;
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
...@@ -1352,12 +1371,12 @@ try_again: ...@@ -1352,12 +1371,12 @@ try_again:
fputs(" InnoDB: Unable to open the first data file\n", fputs(" InnoDB: Unable to open the first data file\n",
stderr); stderr);
} }
*success = FALSE;
close(file); close(file);
file = -1; file = -1;
#endif
} else {
*success = TRUE;
} }
#endif /* USE_FILE_LOCK */
return(file); return(file);
#endif /* __WIN__ */ #endif /* __WIN__ */
...@@ -1509,7 +1528,7 @@ os_file_rename( ...@@ -1509,7 +1528,7 @@ os_file_rename(
return(TRUE); return(TRUE);
} }
os_file_handle_error(oldpath, "rename"); os_file_handle_error_no_exit(oldpath, "rename");
return(FALSE); return(FALSE);
#else #else
...@@ -1518,7 +1537,7 @@ os_file_rename( ...@@ -1518,7 +1537,7 @@ os_file_rename(
ret = rename((const char*)oldpath, (const char*)newpath); ret = rename((const char*)oldpath, (const char*)newpath);
if (ret != 0) { if (ret != 0) {
os_file_handle_error(oldpath, "rename"); os_file_handle_error_no_exit(oldpath, "rename");
return(FALSE); return(FALSE);
} }
......
...@@ -1017,7 +1017,7 @@ YY_RULE_SETUP ...@@ -1017,7 +1017,7 @@ YY_RULE_SETUP
yylval = sym_tab_add_bound_lit(pars_sym_tab_global, yylval = sym_tab_add_bound_lit(pars_sym_tab_global,
yytext + 1, &type); yytext + 1, &type);
return(type); return((int) type);
} }
YY_BREAK YY_BREAK
case 4: case 4:
......
...@@ -109,7 +109,7 @@ BOUND_ID \$[a-z_A-Z0-9]+ ...@@ -109,7 +109,7 @@ BOUND_ID \$[a-z_A-Z0-9]+
yylval = sym_tab_add_bound_lit(pars_sym_tab_global, yylval = sym_tab_add_bound_lit(pars_sym_tab_global,
yytext + 1, &type); yytext + 1, &type);
return(type); return((int) type);
} }
{BOUND_ID} { {BOUND_ID} {
......
...@@ -30,6 +30,8 @@ MYSQL_PLUGIN_ACTIONS(innobase, [ ...@@ -30,6 +30,8 @@ MYSQL_PLUGIN_ACTIONS(innobase, [
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
osf*) osf*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
*solaris*|*SunOS*)
CFLAGS="$CFLAGS -DUNIV_SOLARIS";;
sysv5uw7*) sysv5uw7*)
# Problem when linking on SCO # Problem when linking on SCO
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
......
...@@ -597,7 +597,7 @@ cmp_dtuple_rec_with_match( ...@@ -597,7 +597,7 @@ cmp_dtuple_rec_with_match(
dtuple_byte = cmp_collate(dtuple_byte); dtuple_byte = cmp_collate(dtuple_byte);
} }
ret = dtuple_byte - rec_byte; ret = (int) (dtuple_byte - rec_byte);
if (UNIV_UNLIKELY(ret)) { if (UNIV_UNLIKELY(ret)) {
if (ret < 0) { if (ret < 0) {
ret = -1; ret = -1;
......
...@@ -3481,7 +3481,7 @@ row_delete_constraint_low( ...@@ -3481,7 +3481,7 @@ row_delete_constraint_low(
pars_info_add_str_literal(info, "id", id); pars_info_add_str_literal(info, "id", id);
return(que_eval_sql(info, return((int) que_eval_sql(info,
"PROCEDURE DELETE_CONSTRAINT () IS\n" "PROCEDURE DELETE_CONSTRAINT () IS\n"
"BEGIN\n" "BEGIN\n"
"DELETE FROM SYS_FOREIGN_COLS WHERE ID = :id;\n" "DELETE FROM SYS_FOREIGN_COLS WHERE ID = :id;\n"
...@@ -3520,7 +3520,7 @@ row_delete_constraint( ...@@ -3520,7 +3520,7 @@ row_delete_constraint(
err = row_delete_constraint_low(id, trx); err = row_delete_constraint_low(id, trx);
} }
return(err); return((int) err);
} }
/************************************************************************* /*************************************************************************
......
...@@ -2172,7 +2172,7 @@ row_fetch_store_uint4( ...@@ -2172,7 +2172,7 @@ row_fetch_store_uint4(
ut_a(len == 4); ut_a(len == 4);
tmp = mach_read_from_4(dfield_get_data(dfield)); tmp = mach_read_from_4(dfield_get_data(dfield));
*val = tmp; *val = (ib_uint32_t) tmp;
return(NULL); return(NULL);
} }
......
...@@ -213,7 +213,7 @@ row_undo( ...@@ -213,7 +213,7 @@ row_undo(
ulint err; ulint err;
trx_t* trx; trx_t* trx;
dulint roll_ptr; dulint roll_ptr;
ibool froze_data_dict = FALSE; ibool locked_data_dict;
ut_ad(node && thr); ut_ad(node && thr);
...@@ -266,13 +266,13 @@ row_undo( ...@@ -266,13 +266,13 @@ row_undo(
/* Prevent DROP TABLE etc. while we are rolling back this row. /* Prevent DROP TABLE etc. while we are rolling back this row.
If we are doing a TABLE CREATE or some other dictionary operation, If we are doing a TABLE CREATE or some other dictionary operation,
then we already have dict_operation_lock locked in x-mode. Do not then we already have dict_operation_lock locked in x-mode. Do not
try to lock again in s-mode, because that would cause a hang. */ try to lock again, because that would cause a hang. */
if (trx->dict_operation_lock_mode == 0) { locked_data_dict = (trx->dict_operation_lock_mode == 0);
row_mysql_freeze_data_dictionary(trx); if (locked_data_dict) {
froze_data_dict = TRUE; row_mysql_lock_data_dictionary(trx);
} }
if (node->state == UNDO_NODE_INSERT) { if (node->state == UNDO_NODE_INSERT) {
...@@ -285,9 +285,9 @@ row_undo( ...@@ -285,9 +285,9 @@ row_undo(
err = row_undo_mod(node, thr); err = row_undo_mod(node, thr);
} }
if (froze_data_dict) { if (locked_data_dict) {
row_mysql_unfreeze_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
} }
/* Do some cleanup */ /* Do some cleanup */
......
...@@ -314,6 +314,8 @@ ulint srv_fast_shutdown = 0; ...@@ -314,6 +314,8 @@ ulint srv_fast_shutdown = 0;
/* Generate a innodb_status.<pid> file */ /* Generate a innodb_status.<pid> file */
ibool srv_innodb_status = FALSE; ibool srv_innodb_status = FALSE;
ibool srv_stats_on_metadata = TRUE;
ibool srv_use_doublewrite_buf = TRUE; ibool srv_use_doublewrite_buf = TRUE;
ibool srv_use_checksums = TRUE; ibool srv_use_checksums = TRUE;
......
...@@ -127,7 +127,7 @@ rw_lock_create_func( ...@@ -127,7 +127,7 @@ rw_lock_create_func(
lock->magic_n = RW_LOCK_MAGIC_N; lock->magic_n = RW_LOCK_MAGIC_N;
lock->cfile_name = cfile_name; lock->cfile_name = cfile_name;
lock->cline = cline; lock->cline = (unsigned int) cline;
lock->last_s_file_name = "not yet reserved"; lock->last_s_file_name = "not yet reserved";
lock->last_x_file_name = "not yet reserved"; lock->last_x_file_name = "not yet reserved";
...@@ -355,7 +355,7 @@ rw_lock_x_lock_low( ...@@ -355,7 +355,7 @@ rw_lock_x_lock_low(
file_name, line); file_name, line);
#endif #endif
lock->last_x_file_name = file_name; lock->last_x_file_name = file_name;
lock->last_x_line = line; lock->last_x_line = (unsigned int) line;
/* Locking succeeded, we may return */ /* Locking succeeded, we may return */
return(RW_LOCK_EX); return(RW_LOCK_EX);
...@@ -392,7 +392,7 @@ rw_lock_x_lock_low( ...@@ -392,7 +392,7 @@ rw_lock_x_lock_low(
#endif #endif
lock->last_x_file_name = file_name; lock->last_x_file_name = file_name;
lock->last_x_line = line; lock->last_x_line = (unsigned int) line;
/* Locking succeeded, we may return */ /* Locking succeeded, we may return */
return(RW_LOCK_EX); return(RW_LOCK_EX);
...@@ -414,7 +414,7 @@ rw_lock_x_lock_low( ...@@ -414,7 +414,7 @@ rw_lock_x_lock_low(
#endif #endif
lock->last_x_file_name = file_name; lock->last_x_file_name = file_name;
lock->last_x_line = line; lock->last_x_line = (unsigned int) line;
/* Locking succeeded, we may return */ /* Locking succeeded, we may return */
return(RW_LOCK_EX); return(RW_LOCK_EX);
......
...@@ -221,7 +221,7 @@ trx_purge_sys_create(void) ...@@ -221,7 +221,7 @@ trx_purge_sys_create(void)
purge_sys->trx = purge_sys->sess->trx; purge_sys->trx = purge_sys->sess->trx;
purge_sys->trx->type = TRX_PURGE; purge_sys->trx->is_purge = 1;
ut_a(trx_start_low(purge_sys->trx, ULINT_UNDEFINED)); ut_a(trx_start_low(purge_sys->trx, ULINT_UNDEFINED));
......
...@@ -109,7 +109,7 @@ trx_create( ...@@ -109,7 +109,7 @@ trx_create(
trx->op_info = ""; trx->op_info = "";
trx->type = TRX_USER; trx->is_purge = 0;
trx->conc_state = TRX_NOT_STARTED; trx->conc_state = TRX_NOT_STARTED;
trx->start_time = time(NULL); trx->start_time = time(NULL);
...@@ -667,7 +667,7 @@ trx_start_low( ...@@ -667,7 +667,7 @@ trx_start_low(
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
ut_ad(trx->rseg == NULL); ut_ad(trx->rseg == NULL);
if (trx->type == TRX_PURGE) { if (trx->is_purge) {
trx->id = ut_dulint_zero; trx->id = ut_dulint_zero;
trx->conc_state = TRX_ACTIVE; trx->conc_state = TRX_ACTIVE;
trx->start_time = time(NULL); trx->start_time = time(NULL);
...@@ -1259,7 +1259,6 @@ trx_sig_send( ...@@ -1259,7 +1259,6 @@ trx_sig_send(
UT_LIST_ADD_LAST(signals, trx->signals, sig); UT_LIST_ADD_LAST(signals, trx->signals, sig);
sig->type = type; sig->type = type;
sig->state = TRX_SIG_WAITING;
sig->sender = sender; sig->sender = sender;
sig->receiver = receiver_thr; sig->receiver = receiver_thr;
...@@ -1706,7 +1705,7 @@ trx_print( ...@@ -1706,7 +1705,7 @@ trx_print(
fputs(trx->op_info, f); fputs(trx->op_info, f);
} }
if (trx->type != TRX_USER) { if (trx->is_purge) {
fputs(" purge trx", f); fputs(" purge trx", f);
} }
...@@ -1979,7 +1978,7 @@ trx_recover_for_mysql( ...@@ -1979,7 +1978,7 @@ trx_recover_for_mysql(
(ulong) count); (ulong) count);
} }
return (count); return ((int) count);
} }
/*********************************************************************** /***********************************************************************
......
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