Commit 7927e83e authored by unknown's avatar unknown

Merge


BitKeeper/etc/logging_ok:
  auto-union
Docs/manual.texi:
  Auto merged
mysql-test/r/innodb.result:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/mysqld.cc:
  SCCS merged
parents 607c8d8b d02aaab4
heikki@donna.mysql.fi
jani@hynda.mysql.fi
jani@janikt.pp.saunalahti.fi
jcole@abel.spaceapes.com
jcole@main.burghcom.com
jcole@tetra.spaceapes.com
monty@donna.mysql.fi
monty@tik.mysql.fi
monty@work.mysql.com
mwagner@evoq.mwagner.org
paul@central.snake.net
......
This diff is collapsed.
......@@ -48,6 +48,9 @@ extern dulint srv_archive_recovery_limit_lsn;
extern ulint srv_lock_wait_timeout;
extern char* srv_unix_file_flush_method_str;
extern ulint srv_unix_file_flush_method;
extern ibool srv_set_thread_priorities;
extern int srv_query_thread_priority;
......@@ -100,6 +103,13 @@ typedef struct srv_sys_struct srv_sys_t;
/* The server system */
extern srv_sys_t* srv_sys;
/* Alternatives for fiel flush option in Unix; see the InnoDB manual about
what these mean */
#define SRV_UNIX_FDATASYNC 1
#define SRV_UNIX_O_DSYNC 2
#define SRV_UNIX_LITTLESYNC 3
#define SRV_UNIX_NOSYNC 4
/*************************************************************************
Boots Innobase server. */
......
......@@ -838,14 +838,18 @@ log_io_complete(
/* It was a checkpoint write */
group = (log_group_t*)((ulint)group - 1);
fil_flush(group->space_id);
if (srv_unix_file_flush_method == SRV_UNIX_LITTLESYNC) {
fil_flush(group->space_id);
}
log_io_complete_checkpoint(group);
return;
}
fil_flush(group->space_id);
if (srv_unix_file_flush_method == SRV_UNIX_LITTLESYNC) {
fil_flush(group->space_id);
}
mutex_enter(&(log_sys->mutex));
......@@ -1474,7 +1478,9 @@ log_checkpoint(
recv_apply_hashed_log_recs(TRUE);
}
fil_flush_file_spaces(FIL_TABLESPACE);
if (srv_unix_file_flush_method == SRV_UNIX_LITTLESYNC) {
fil_flush_file_spaces(FIL_TABLESPACE);
}
mutex_enter(&(log_sys->mutex));
......
......@@ -9,6 +9,7 @@ Created 10/21/1995 Heikki Tuuri
#include "os0file.h"
#include "os0sync.h"
#include "ut0mem.h"
#include "srv0srv.h"
#ifdef POSIX_ASYNC_IO
......@@ -345,12 +346,11 @@ try_again:
UT_NOT_USED(purpose);
/* On Linux opening a file in the O_SYNC mode seems to be much
more efficient for small writes than calling an explicit fsync or
fdatasync after each write, but on Solaris O_SYNC and O_DSYNC is
extremely slow in large block writes to a big file. Therefore we
do not use these options, but use explicit fdatasync. */
#ifdef O_DSYNC
if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
create_flag = create_flag | O_DSYNC;
}
#endif
if (create_mode == OS_FILE_CREATE) {
file = open(name, create_flag, S_IRUSR | S_IWUSR | S_IRGRP
| S_IWGRP | S_IROTH | S_IWOTH);
......@@ -546,6 +546,12 @@ os_file_flush(
return(FALSE);
#else
int ret;
#ifdef O_DSYNC
if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
return(TRUE);
}
#endif
#ifdef HAVE_FDATASYNC
ret = fdatasync(file);
......@@ -621,10 +627,15 @@ os_file_pwrite(
#ifdef HAVE_PWRITE
ret = pwrite(file, buf, n, offs);
/* Always do fsync to reduce the probability that when the OS crashes,
a database page is only partially physically written to disk. */
if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
&& srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
ut_a(TRUE == os_file_flush(file));
/* Always do fsync to reduce the probability that when
the OS crashes, a database page is only partially
physically written to disk. */
ut_a(TRUE == os_file_flush(file));
}
return(ret);
#else
......@@ -645,10 +656,15 @@ os_file_pwrite(
ret = write(file, buf, n);
/* Always do fsync to reduce the probability that when the OS crashes,
a database page is only partially physically written to disk. */
if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
&& srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
ut_a(TRUE == os_file_flush(file));
/* Always do fsync to reduce the probability that when
the OS crashes, a database page is only partially
physically written to disk. */
ut_a(TRUE == os_file_flush(file));
}
os_mutex_exit(os_file_seek_mutexes[i]);
......
......@@ -88,6 +88,9 @@ dulint srv_archive_recovery_limit_lsn;
ulint srv_lock_wait_timeout = 1024 * 1024 * 1024;
char* srv_unix_file_flush_method_str = NULL;
ulint srv_unix_file_flush_method = 0;
ibool srv_set_thread_priorities = TRUE;
int srv_query_thread_priority = 0;
/*-------------------------------------------*/
......
......@@ -532,6 +532,22 @@ innobase_start_or_create_for_mysql(void)
srv_is_being_started = TRUE;
if (0 == ut_strcmp(srv_unix_file_flush_method_str, "fdatasync")) {
srv_unix_file_flush_method = SRV_UNIX_FDATASYNC;
} else if (0 == ut_strcmp(srv_unix_file_flush_method_str, "O_DSYNC")) {
srv_unix_file_flush_method = SRV_UNIX_O_DSYNC;
} else if (0 == ut_strcmp(srv_unix_file_flush_method_str,
"littlesync")) {
srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
} else if (0 == ut_strcmp(srv_unix_file_flush_method_str, "nosync")) {
srv_unix_file_flush_method = SRV_UNIX_NOSYNC;
} else {
fprintf(stderr,
"InnoDB: Unrecognized value for innodb_unix_file_flush_method\n");
return(DB_ERROR);
}
os_aio_use_native_aio = srv_use_native_aio;
err = srv_boot();
......
encrypt('foo', 'ff')
ffTU0fyIP09Z.
length(encrypt('foo', 'ff')) <> 0
1
......@@ -20,6 +20,8 @@ dayofmonth("1997-01-02") dayofmonth(19970323)
2 23
month("1997-01-02") year("98-02-03") dayofyear("1997-12-31")
1 1998 365
month("2001-02-00") year("2001-00-00")
2 2001
DAYOFYEAR("1997-03-03") WEEK("1998-03-03") QUARTER(980303)
62 9 1
HOUR("1997-03-03 23:03:22") MINUTE("23:03:22") SECOND(230322)
......@@ -184,6 +186,8 @@ extract(MINUTE_SECOND FROM "10:11:12")
1112
extract(SECOND FROM "1999-01-02 10:11:12")
12
extract(MONTH FROM "2001-02-00")
2
ctime hour(ctime)
2001-01-12 12:23:40 12
monthname(date)
......
......@@ -252,7 +252,7 @@ id ggid email passwd
2 test2 yyy
id ggid email passwd
1 this will work
3 test2 this will work
4 test2 this will work
id ggid email passwd
1 this will work
id ggid email passwd
......@@ -474,4 +474,4 @@ t1 CREATE TABLE `t1` (
a
1
2
3
4
select encrypt('foo', 'ff');
select length(encrypt('foo', 'ff')) <> 0;
......@@ -14,6 +14,7 @@ select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w");
select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w"));
select dayofmonth("1997-01-02"),dayofmonth(19970323);
select month("1997-01-02"),year("98-02-03"),dayofyear("1997-12-31");
select month("2001-02-00"),year("2001-00-00");
select DAYOFYEAR("1997-03-03"), WEEK("1998-03-03"), QUARTER(980303);
select HOUR("1997-03-03 23:03:22"), MINUTE("23:03:22"), SECOND(230322);
select week(19980101),week(19970101),week(19980101,1),week(19970101,1);
......@@ -100,6 +101,7 @@ select extract(HOUR_SECOND FROM "10:11:12");
select extract(MINUTE FROM "10:11:12");
select extract(MINUTE_SECOND FROM "10:11:12");
select extract(SECOND FROM "1999-01-02 10:11:12");
select extract(MONTH FROM "2001-02-00");
create table t1 (ctime varchar(20));
insert into t1 values ('2001-01-12 12:23:40');
......
......@@ -449,7 +449,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
check_locks(lock,"read lock with old write lock",0);
if (lock->get_status)
(*lock->get_status)(data->status_param);
++locks_immediate;
statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end;
}
if (lock->write.data->type == TL_WRITE_ONLY)
......@@ -473,7 +473,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
if ((int) lock_type == (int) TL_READ_NO_INSERT)
lock->read_no_write_count++;
check_locks(lock,"read lock with no write locks",0);
++locks_immediate;
statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end;
}
/* Can't get lock yet; Wait for it */
......@@ -505,7 +505,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
data->cond=get_cond();
if (lock->get_status)
(*lock->get_status)(data->status_param);
++locks_immediate;
statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end;
}
}
......@@ -540,7 +540,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
check_locks(lock,"second write lock",0);
if (data->lock->get_status)
(*data->lock->get_status)(data->status_param);
++locks_immediate;
statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end;
}
DBUG_PRINT("lock",("write locked by thread: %ld",
......@@ -566,7 +566,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
if (data->lock->get_status)
(*data->lock->get_status)(data->status_param);
check_locks(lock,"only write lock",0);
++locks_immediate;
statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end;
}
}
......
......@@ -83,6 +83,7 @@ long innobase_mirrored_log_groups, innobase_log_files_in_group,
char *innobase_data_home_dir, *innobase_data_file_path;
char *innobase_log_group_home_dir, *innobase_log_arch_dir;
char *innobase_unix_file_flush_method;
bool innobase_flush_log_at_trx_commit, innobase_log_archive,
innobase_use_native_aio;
......@@ -474,6 +475,10 @@ innobase_init(void)
DBUG_RETURN(TRUE);
}
srv_unix_file_flush_method_str = (innobase_unix_file_flush_method ?
innobase_unix_file_flush_method :
(char*)"fdatasync");
srv_n_log_groups = (ulint) innobase_mirrored_log_groups;
srv_n_log_files = (ulint) innobase_log_files_in_group;
srv_log_file_size = (ulint) innobase_log_file_size;
......
......@@ -161,6 +161,7 @@ extern long innobase_buffer_pool_size, innobase_additional_mem_pool_size;
extern long innobase_file_io_threads, innobase_lock_wait_timeout;
extern char *innobase_data_home_dir, *innobase_data_file_path;
extern char *innobase_log_group_home_dir, *innobase_log_arch_dir;
extern char *innobase_unix_file_flush_method;
extern bool innobase_flush_log_at_trx_commit, innobase_log_archive,
innobase_use_native_aio;
......
......@@ -75,7 +75,7 @@ bool Item::get_date(TIME *ltime,bool fuzzydate)
char buff[40];
String tmp(buff,sizeof(buff)),*res;
if (!(res=val_str(&tmp)) ||
str_to_TIME(res->ptr(),res->length(),ltime,0) == TIMESTAMP_NONE)
str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE)
{
bzero((char*) ltime,sizeof(*ltime));
return 1;
......
......@@ -2473,6 +2473,7 @@ enum options {
OPT_INNODB_LOG_ARCH_DIR,
OPT_INNODB_LOG_ARCHIVE,
OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
OPT_INNODB_UNIX_FILE_FLUSH_METHOD,
OPT_SAFE_SHOW_DB,
OPT_GEMINI_SKIP, OPT_INNODB_SKIP,
OPT_TEMP_POOL, OPT_DO_PSTACK, OPT_TX_ISOLATION,
......@@ -2535,6 +2536,8 @@ static struct option long_options[] = {
OPT_INNODB_LOG_ARCHIVE},
{"innodb_flush_log_at_trx_commit", optional_argument, 0,
OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT},
{"innodb_unix_file_flush_method", required_argument, 0,
OPT_INNODB_UNIX_FILE_FLUSH_METHOD},
#endif
{"help", no_argument, 0, '?'},
{"init-file", required_argument, 0, (int) OPT_INIT_FILE},
......@@ -2821,6 +2824,7 @@ struct show_var_st init_vars[]= {
{"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR},
{"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL},
{"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR},
{"innodb_unix_file_flush_method", (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR},
#endif
{"interactive_timeout", (char*) &net_interactive_timeout, SHOW_LONG},
{"join_buffer_size", (char*) &join_buff_size, SHOW_LONG},
......@@ -3681,6 +3685,9 @@ static void get_options(int argc,char **argv)
case OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT:
innobase_flush_log_at_trx_commit= optarg ? test(atoi(optarg)) : 1;
break;
case OPT_INNODB_UNIX_FILE_FLUSH_METHOD:
innobase_unix_file_flush_method=optarg;
break;
#endif /* HAVE_INNOBASE_DB */
case OPT_DO_PSTACK:
opt_do_pstack = 1;
......
......@@ -1864,15 +1864,6 @@ mysql_execute_command(void)
}
if (check_db_used(thd,tables) || end_active_trans(thd))
goto error;
for (TABLE_LIST *tmp = tables; tmp; tmp = tmp->next)
{
if (!(tmp->lock_type == TL_READ_NO_INSERT ?
!check_table_access(thd, SELECT_ACL, tmp) :
(!check_table_access(thd, INSERT_ACL, tmp) ||
!check_table_access(thd, UPDATE_ACL, tmp) ||
!check_table_access(thd, DELETE_ACL, tmp))))
goto error;
}
thd->in_lock_tables=1;
if (!(res=open_and_lock_tables(thd,tables)))
{
......
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