Commit a6ea34ee authored by unknown's avatar unknown

merge


BitKeeper/etc/ignore:
  auto-union
BitKeeper/deleted/.del-delete.result:
  Auto merged
client/mysqlbinlog.cc:
  Auto merged
libmysql/libmysql.c:
  Auto merged
mysql-test/r/delete.result:
  Auto merged
mysql-test/r/type_datetime.result:
  Auto merged
mysql-test/t/delete.test:
  Auto merged
mysql-test/t/type_datetime.test:
  Auto merged
sql/field.h:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/lock.cc:
  Auto merged
sql/log_event.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/share/polish/errmsg.txt:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_repl.h:
  Auto merged
sql/sql_select.cc:
  Auto merged
parents 3223245d 5c100a69
...@@ -73,6 +73,7 @@ extern int NEAR my_errno; /* Last error in mysys */ ...@@ -73,6 +73,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */
#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
#define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */ #define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */
#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy; Don't overwrite file */
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
#define MY_GIVE_INFO 2 /* Give time info about process*/ #define MY_GIVE_INFO 2 /* Give time info about process*/
......
...@@ -170,9 +170,10 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen, ...@@ -170,9 +170,10 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen,
struct timeval tv; struct timeval tv;
time_t start_time, now_time; time_t start_time, now_time;
/* If they passed us a timeout of zero, we should behave /*
* exactly like the normal connect() call does. If they passed us a timeout of zero, we should behave
*/ exactly like the normal connect() call does.
*/
if (timeout == 0) if (timeout == 0)
return connect(s, (struct sockaddr*) name, namelen); return connect(s, (struct sockaddr*) name, namelen);
...@@ -193,56 +194,57 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen, ...@@ -193,56 +194,57 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen,
if (res == 0) /* Connected quickly! */ if (res == 0) /* Connected quickly! */
return(0); return(0);
/* Otherwise, our connection is "in progress." We can use /*
* the select() call to wait up to a specified period of time Otherwise, our connection is "in progress." We can use
* for the connection to suceed. If select() returns 0 the select() call to wait up to a specified period of time
* (after waiting howevermany seconds), our socket never became for the connection to suceed. If select() returns 0
* writable (host is probably unreachable.) Otherwise, if (after waiting howevermany seconds), our socket never became
* select() returns 1, then one of two conditions exist: writable (host is probably unreachable.) Otherwise, if
* select() returns 1, then one of two conditions exist:
* 1. An error occured. We use getsockopt() to check for this.
* 2. The connection was set up sucessfully: getsockopt() will 1. An error occured. We use getsockopt() to check for this.
* return 0 as an error. 2. The connection was set up sucessfully: getsockopt() will
* return 0 as an error.
* Thanks goes to Andrew Gierth <andrew@erlenstar.demon.co.uk>
* who posted this method of timing out a connect() in Thanks goes to Andrew Gierth <andrew@erlenstar.demon.co.uk>
* comp.unix.programmer on August 15th, 1997. who posted this method of timing out a connect() in
*/ comp.unix.programmer on August 15th, 1997.
*/
FD_ZERO(&sfds); FD_ZERO(&sfds);
FD_SET(s, &sfds); FD_SET(s, &sfds);
/* /*
* select could be interrupted by a signal, and if it is, select could be interrupted by a signal, and if it is,
* the timeout should be adjusted and the select restarted the timeout should be adjusted and the select restarted
* to work around OSes that don't restart select and to work around OSes that don't restart select and
* implementations of select that don't adjust tv upon implementations of select that don't adjust tv upon
* failure to reflect the time remaining failure to reflect the time remaining
*/ */
#ifdef HAVE_POLL
return(0);
#endif
start_time = time(NULL); start_time = time(NULL);
for (;;) for (;;)
{ {
tv.tv_sec = (long) timeout; tv.tv_sec = (long) timeout;
tv.tv_usec = 0; tv.tv_usec = 0;
#if defined(HPUX10) && defined(THREAD) #if defined(HPUX10) && defined(THREAD)
if ((res = select(s+1, NULL, (int*) &sfds, NULL, &tv)) >= 0) if ((res = select(s+1, NULL, (int*) &sfds, NULL, &tv)) > 0)
break; break;
#else #else
if ((res = select(s+1, NULL, &sfds, NULL, &tv)) >= 0) if ((res = select(s+1, NULL, &sfds, NULL, &tv)) > 0)
break; break;
#endif #endif
if (res == 0) /* timeout */
return -1;
now_time=time(NULL); now_time=time(NULL);
timeout-= (uint) (now_time - start_time); timeout-= (uint) (now_time - start_time);
if (errno != EINTR || (int) timeout <= 0) if (errno != EINTR || (int) timeout <= 0)
return -1; return -1;
} }
/* select() returned something more interesting than zero, let's /*
* see if we have any errors. If the next two statements pass, select() returned something more interesting than zero, let's
* we've got an open socket! see if we have any errors. If the next two statements pass,
*/ we've got an open socket!
*/
s_err=0; s_err=0;
if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0) if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0)
...@@ -253,7 +255,8 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen, ...@@ -253,7 +255,8 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen,
errno = s_err; errno = s_err;
return(-1); /* but return an error... */ return(-1); /* but return an error... */
} }
return(0); /* It's all good! */ return (0); /* ok */
#endif #endif
} }
......
...@@ -1160,7 +1160,7 @@ run_testcase () ...@@ -1160,7 +1160,7 @@ run_testcase ()
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
start_master start_master
else else
if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] ; if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || [ -f $master_init_script ]
then then
EXTRA_MASTER_OPT="" EXTRA_MASTER_OPT=""
stop_master stop_master
......
set SQL_LOG_BIN=0; set SQL_LOG_BIN=0;
drop table if exists t1; create table t4(n int);
create table t1(n int); backup table t4 to '../bogus';
backup table t1 to '../bogus';
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 backup error Failed copying .frm file: errno = X test.t4 backup error Failed copying .frm file (errno: X)
test.t1 backup status Operation failed test.t4 backup status Operation failed
backup table t1 to '../tmp'; backup table t4 to '../tmp';
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 backup status OK test.t4 backup status OK
drop table t1; backup table t4 to '../tmp';
restore table t1 from '../tmp';
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 restore status OK test.t4 backup error Failed copying .frm file (errno: X)
select count(*) from t1; test.t4 backup status Operation failed
drop table t4;
restore table t4 from '../tmp';
Table Op Msg_type Msg_text
test.t4 restore status OK
select count(*) from t4;
count(*) count(*)
0 0
create table t1(n int);
insert into t1 values (23),(45),(67); insert into t1 values (23),(45),(67);
backup table t1 to '../tmp'; backup table t1 to '../tmp';
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
...@@ -35,9 +39,8 @@ create table t2(m int not null primary key); ...@@ -35,9 +39,8 @@ create table t2(m int not null primary key);
create table t3(k int not null primary key); create table t3(k int not null primary key);
insert into t2 values (123),(145),(167); insert into t2 values (123),(145),(167);
insert into t3 values (223),(245),(267); insert into t3 values (223),(245),(267);
backup table t1,t2,t3 to '../tmp'; backup table t2,t3 to '../tmp';
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 backup status OK
test.t2 backup status OK test.t2 backup status OK
test.t3 backup status OK test.t3 backup status OK
drop table t1,t2,t3; drop table t1,t2,t3;
...@@ -61,13 +64,14 @@ k ...@@ -61,13 +64,14 @@ k
223 223
245 245
267 267
drop table t1,t2,t3; drop table t1,t2,t3,t4;
restore table t1 from '../tmp'; restore table t1 from '../tmp';
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 restore status OK test.t1 restore status OK
lock tables t1 write; rename table t1 to t5;
backup table t1 to '../tmp'; lock tables t5 write;
backup table t5 to '../tmp';
unlock tables; unlock tables;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 backup status OK test.t5 backup status OK
drop table t1; drop table t5;
...@@ -251,3 +251,26 @@ t1_id t2_id type cost_unit min_value max_value t3_id item_id id name ...@@ -251,3 +251,26 @@ t1_id t2_id type cost_unit min_value max_value t3_id item_id id name
22 1 Percent Cost 100 -1 6 291 1 s1 22 1 Percent Cost 100 -1 6 291 1 s1
23 1 Percent Cost 100 -1 21 291 1 s1 23 1 Percent Cost 100 -1 21 291 1 s1
drop table t1,t2; drop table t1,t2;
CREATE TABLE t1 (
siteid varchar(25) NOT NULL default '',
emp_id varchar(30) NOT NULL default '',
rate_code varchar(10) default NULL,
UNIQUE KEY site_emp (siteid,emp_id),
KEY siteid (siteid)
) TYPE=MyISAM;
INSERT INTO t1 VALUES ('rivercats','psmith','cust'), ('rivercats','KWalker','cust');
CREATE TABLE t2 (
siteid varchar(25) NOT NULL default '',
rate_code varchar(10) NOT NULL default '',
base_rate float NOT NULL default '0',
PRIMARY KEY (siteid,rate_code),
FULLTEXT KEY rate_code (rate_code)
) TYPE=MyISAM;
INSERT INTO t2 VALUES ('rivercats','cust',20);
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats';
rate_code base_rate
cust 20
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith';
rate_code base_rate
cust 20
drop table t1,t2;
#!/bin/sh
if [ "$MYSQL_TEST_DIR" ]
then
rm -f $MYSQL_TEST_DIR/var/tmp/*.frm $MYSQL_TEST_DIR/var/tmp/*.MY?
fi
#
# This test is a bit tricky as we can't use backup table to overwrite an old
# table
#
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
connection con1; connection con1;
set SQL_LOG_BIN=0; set SQL_LOG_BIN=0;
drop table if exists t1; create table t4(n int);
--replace_result "errno: 2" "errno: X" "errno: 22" "errno: X" "errno: 23" "errno: X"
backup table t4 to '../bogus';
backup table t4 to '../tmp';
--replace_result "errno: 17" "errno: X"
backup table t4 to '../tmp';
drop table t4;
restore table t4 from '../tmp';
select count(*) from t4;
create table t1(n int); create table t1(n int);
--replace_result "errno = 1" "errno = X" "errno = 2" "errno = X" "errno = 22" "errno = X" "errno = 23" "errno = X"
backup table t1 to '../bogus';
backup table t1 to '../tmp';
drop table t1;
restore table t1 from '../tmp';
select count(*) from t1;
insert into t1 values (23),(45),(67); insert into t1 values (23),(45),(67);
backup table t1 to '../tmp'; backup table t1 to '../tmp';
drop table t1; drop table t1;
...@@ -20,23 +27,24 @@ create table t2(m int not null primary key); ...@@ -20,23 +27,24 @@ create table t2(m int not null primary key);
create table t3(k int not null primary key); create table t3(k int not null primary key);
insert into t2 values (123),(145),(167); insert into t2 values (123),(145),(167);
insert into t3 values (223),(245),(267); insert into t3 values (223),(245),(267);
backup table t1,t2,t3 to '../tmp'; backup table t2,t3 to '../tmp';
drop table t1,t2,t3; drop table t1,t2,t3;
restore table t1,t2,t3 from '../tmp'; restore table t1,t2,t3 from '../tmp';
select n from t1; select n from t1;
select m from t2; select m from t2;
select k from t3; select k from t3;
drop table t1,t2,t3; drop table t1,t2,t3,t4;
restore table t1 from '../tmp'; restore table t1 from '../tmp';
connection con2; connection con2;
rename table t1 to t5;
--send --send
lock tables t1 write; lock tables t5 write;
connection con1; connection con1;
--send --send
backup table t1 to '../tmp'; backup table t5 to '../tmp';
connection con2; connection con2;
reap; reap;
unlock tables; unlock tables;
connection con1; connection con1;
reap; reap;
drop table t1; drop table t5;
...@@ -247,3 +247,27 @@ CREATE TABLE t2 ( ...@@ -247,3 +247,27 @@ CREATE TABLE t2 (
INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5'); INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5');
select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2; select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2;
drop table t1,t2; drop table t1,t2;
#
# Bug in range optimiser with MAYBE_KEY
#
CREATE TABLE t1 (
siteid varchar(25) NOT NULL default '',
emp_id varchar(30) NOT NULL default '',
rate_code varchar(10) default NULL,
UNIQUE KEY site_emp (siteid,emp_id),
KEY siteid (siteid)
) TYPE=MyISAM;
INSERT INTO t1 VALUES ('rivercats','psmith','cust'), ('rivercats','KWalker','cust');
CREATE TABLE t2 (
siteid varchar(25) NOT NULL default '',
rate_code varchar(10) NOT NULL default '',
base_rate float NOT NULL default '0',
PRIMARY KEY (siteid,rate_code),
FULLTEXT KEY rate_code (rate_code)
) TYPE=MyISAM;
INSERT INTO t2 VALUES ('rivercats','cust',20);
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats';
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith';
drop table t1,t2;
...@@ -31,17 +31,29 @@ struct utimbuf { ...@@ -31,17 +31,29 @@ struct utimbuf {
#endif #endif
/* /*
Ordinary ownership and accesstimes are copied from 'from-file' int my_copy(const char *from, const char *to, myf MyFlags)
if MyFlags & MY_HOLD_ORIGINAL_MODES is set and to-file exists then
the modes of to-file isn't changed NOTES
Dont set MY_FNABP or MY_NABP bits on when calling this function ! Ordinary ownership and accesstimes are copied from 'from-file'
*/ If MyFlags & MY_HOLD_ORIGINAL_MODES is set and to-file exists then
the modes of to-file isn't changed
If MyFlags & MY_DONT_OVERWRITE_FILE is set, we will give an error
if the file existed.
WARNING
Don't set MY_FNABP or MY_NABP bits on when calling this function !
RETURN
0 ok
# Error
*/
int my_copy(const char *from, const char *to, myf MyFlags) int my_copy(const char *from, const char *to, myf MyFlags)
{ {
uint Count; uint Count;
int new_file_stat; int new_file_stat, create_flag;
File from_file,to_file; File from_file,to_file;
char buff[IO_SIZE]; char buff[IO_SIZE];
struct stat stat_buff,new_stat_buff; struct stat stat_buff,new_stat_buff;
...@@ -62,8 +74,10 @@ int my_copy(const char *from, const char *to, myf MyFlags) ...@@ -62,8 +74,10 @@ int my_copy(const char *from, const char *to, myf MyFlags)
} }
if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat) if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
stat_buff=new_stat_buff; stat_buff=new_stat_buff;
create_flag= (MyFlags & MY_DONT_OVERWRITE_FILE) ? O_EXCL : O_TRUNC;
if ((to_file= my_create(to,(int) stat_buff.st_mode, if ((to_file= my_create(to,(int) stat_buff.st_mode,
O_WRONLY | O_TRUNC | O_BINARY | O_SHARE, O_WRONLY | create_flag | O_BINARY | O_SHARE,
MyFlags)) < 0) MyFlags)) < 0)
goto err; goto err;
......
...@@ -431,8 +431,8 @@ int handle_options(int *argc, char ***argv, ...@@ -431,8 +431,8 @@ int handle_options(int *argc, char ***argv,
Will set the option value to given value Will set the option value to given value
*/ */
static int setval (const struct my_option *opts, char *argument, static int setval(const struct my_option *opts, char *argument,
my_bool set_maximum_value) my_bool set_maximum_value)
{ {
int err= 0; int err= 0;
......
...@@ -38,7 +38,12 @@ parse_arguments() { ...@@ -38,7 +38,12 @@ parse_arguments() {
--basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e "s;--basedir=;;"` ;; --basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e "s;--basedir=;;"` ;;
--datadir=*) DATADIR=`echo "$arg" | sed -e "s;--datadir=;;"` ;; --datadir=*) DATADIR=`echo "$arg" | sed -e "s;--datadir=;;"` ;;
--pid-file=*) pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"` ;; --pid-file=*) pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"` ;;
--user=*) user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1 ;; --user=*)
if [ $SET_USER == 0 ]
then
user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1
fi
;;
# these two might have been set in a [mysqld_safe] section of my.cnf # these two might have been set in a [mysqld_safe] section of my.cnf
# they get passed via environment variables to mysqld_safe # they get passed via environment variables to mysqld_safe
......
...@@ -407,7 +407,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt) ...@@ -407,7 +407,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
param.db_name = table->table_cache_key; param.db_name = table->table_cache_key;
param.table_name = table->table_name; param.table_name = table->table_name;
param.testflag = 0; param.testflag = 0;
mi_check_print_error(&param,errmsg, my_errno); mi_check_print_error(&param, errmsg, my_errno);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
} }
...@@ -425,17 +425,17 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt) ...@@ -425,17 +425,17 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
if (fn_format_relative_to_data_home(dst_path, table_name, backup_dir, if (fn_format_relative_to_data_home(dst_path, table_name, backup_dir,
reg_ext)) reg_ext))
{ {
errmsg = "Failed in fn_format() for .frm file: errno = %d"; errmsg = "Failed in fn_format() for .frm file (errno: %d)";
error = HA_ADMIN_INVALID; error = HA_ADMIN_INVALID;
goto err; goto err;
} }
if (my_copy(fn_format(src_path, table->path,"", reg_ext, MY_UNPACK_FILENAME), if (my_copy(fn_format(src_path, table->path,"", reg_ext, MY_UNPACK_FILENAME),
dst_path, dst_path,
MYF(MY_WME | MY_HOLD_ORIGINAL_MODES))) MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
{ {
error = HA_ADMIN_FAILED; error = HA_ADMIN_FAILED;
errmsg = "Failed copying .frm file: errno = %d"; errmsg = "Failed copying .frm file (errno: %d)";
goto err; goto err;
} }
...@@ -443,7 +443,7 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt) ...@@ -443,7 +443,7 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
if (!fn_format(dst_path, dst_path, "", MI_NAME_DEXT, if (!fn_format(dst_path, dst_path, "", MI_NAME_DEXT,
MY_REPLACE_EXT | MY_UNPACK_FILENAME | MY_SAFE_PATH)) MY_REPLACE_EXT | MY_UNPACK_FILENAME | MY_SAFE_PATH))
{ {
errmsg = "Failed in fn_format() for .MYD file: errno = %d"; errmsg = "Failed in fn_format() for .MYD file (errno: %d)";
error = HA_ADMIN_INVALID; error = HA_ADMIN_INVALID;
goto err; goto err;
} }
...@@ -451,9 +451,9 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt) ...@@ -451,9 +451,9 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
if (my_copy(fn_format(src_path, table->path,"", MI_NAME_DEXT, if (my_copy(fn_format(src_path, table->path,"", MI_NAME_DEXT,
MY_UNPACK_FILENAME), MY_UNPACK_FILENAME),
dst_path, dst_path,
MYF(MY_WME | MY_HOLD_ORIGINAL_MODES))) MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
{ {
errmsg = "Failed copying .MYD file: errno = %d"; errmsg = "Failed copying .MYD file (errno: %d)";
error= HA_ADMIN_FAILED; error= HA_ADMIN_FAILED;
goto err; goto err;
} }
......
...@@ -679,20 +679,28 @@ double Item_func_round::val() ...@@ -679,20 +679,28 @@ double Item_func_round::val()
double value=args[0]->val(); double value=args[0]->val();
int dec=(int) args[1]->val_int(); int dec=(int) args[1]->val_int();
uint abs_dec=abs(dec); uint abs_dec=abs(dec);
double tmp;
/*
tmp2 is here to avoid return the value with 80 bit precision
This will fix that the test round(0.1,1) = round(0.1,1) is true
*/
volatile double tmp2;
if ((null_value=args[0]->null_value || args[1]->null_value)) if ((null_value=args[0]->null_value || args[1]->null_value))
return 0.0; return 0.0;
double tmp=(abs_dec < array_elements(log_10) ? tmp=(abs_dec < array_elements(log_10) ?
log_10[abs_dec] : pow(10.0,(double) abs_dec)); log_10[abs_dec] : pow(10.0,(double) abs_dec));
if (truncate) if (truncate)
{ {
if (value >= 0) if (value >= 0)
return dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp; tmp2= dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp;
else else
return dec < 0 ? ceil(value/tmp)*tmp : ceil(value*tmp)/tmp; tmp2= dec < 0 ? ceil(value/tmp)*tmp : ceil(value*tmp)/tmp;
} }
return dec < 0 ? rint(value/tmp)*tmp : rint(value*tmp)/tmp; else
tmp2=dec < 0 ? rint(value/tmp)*tmp : rint(value*tmp)/tmp;
return tmp2;
} }
......
...@@ -3597,8 +3597,8 @@ struct my_option my_long_options[] = ...@@ -3597,8 +3597,8 @@ struct my_option my_long_options[] =
(gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG,
IF_PURIFY(0,1), 0, 0, 0, 0, 0}, IF_PURIFY(0,1), 0, 0, 0, 0, 0},
#endif #endif
{"user", 'u', "Run mysqld daemon as user", (gptr*) &mysqld_user, {"user", 'u', "Run mysqld daemon as user", 0, 0, 0, GET_STR, REQUIRED_ARG,
(gptr*) &mysqld_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit", 0, 0, 0, GET_NO_ARG, {"version", 'V', "Output version information and exit", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'v', "Synonym for option -v", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, {"version", 'v', "Synonym for option -v", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
...@@ -4221,6 +4221,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -4221,6 +4221,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
/* Correct pointer set by my_getopt (for embedded library) */ /* Correct pointer set by my_getopt (for embedded library) */
mysql_data_home= mysql_real_data_home; mysql_data_home= mysql_real_data_home;
break; break;
case 'u':
if (!mysqld_user)
mysqld_user= argument;
else
fprintf(stderr, "Warning: Ignoring user change to '%s' becasue the user is set to '%s' earlier on the command line\n", argument, mysqld_user);
break;
case 'L': case 'L':
strmake(language, argument, sizeof(language)-1); strmake(language, argument, sizeof(language)-1);
break; break;
......
...@@ -1340,7 +1340,8 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag) ...@@ -1340,7 +1340,8 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
} }
if (((clone_flag & CLONE_KEY2_MAYBE) && if (((clone_flag & CLONE_KEY2_MAYBE) &&
!(clone_flag & CLONE_KEY1_MAYBE)) || !(clone_flag & CLONE_KEY1_MAYBE) &&
key2->type != SEL_ARG::MAYBE_KEY) ||
key1->type == SEL_ARG::MAYBE_KEY) key1->type == SEL_ARG::MAYBE_KEY)
{ // Put simple key in key2 { // Put simple key in key2
swap(SEL_ARG *,key1,key2); swap(SEL_ARG *,key1,key2);
...@@ -1368,7 +1369,10 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag) ...@@ -1368,7 +1369,10 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
{ {
key1->maybe_smaller(); key1->maybe_smaller();
if (key2->next_key_part) if (key2->next_key_part)
{
key1->use_count--; // Incremented in and_all_keys
return and_all_keys(key1,key2,clone_flag); return and_all_keys(key1,key2,clone_flag);
}
key2->use_count--; // Key2 doesn't have a tree key2->use_count--; // Key2 doesn't have a tree
} }
return key1; return key1;
...@@ -2067,7 +2071,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root) ...@@ -2067,7 +2071,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
{ {
if (this == root && use_count != 1) if (this == root && use_count != 1)
{ {
sql_print_error("Use_count: Wrong count %lu for root",use_count); sql_print_error("Note: Use_count: Wrong count %lu for root",use_count);
return; return;
} }
if (this->type != SEL_ARG::KEY_RANGE) if (this->type != SEL_ARG::KEY_RANGE)
...@@ -2081,7 +2085,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root) ...@@ -2081,7 +2085,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
ulong count=count_key_part_usage(root,pos->next_key_part); ulong count=count_key_part_usage(root,pos->next_key_part);
if (count > pos->next_key_part->use_count) if (count > pos->next_key_part->use_count)
{ {
sql_print_error("Use_count: Wrong count for key at %lx, %lu should be %lu", sql_print_error("Note: Use_count: Wrong count for key at %lx, %lu should be %lu",
pos,pos->next_key_part->use_count,count); pos,pos->next_key_part->use_count,count);
return; return;
} }
...@@ -2089,7 +2093,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root) ...@@ -2089,7 +2093,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
} }
} }
if (e_count != elements) if (e_count != elements)
sql_print_error("Wrong use count: %u for tree at %lx", e_count, sql_print_error("Warning: Wrong use count: %u for tree at %lx", e_count,
(gptr) this); (gptr) this);
} }
......
...@@ -1815,7 +1815,8 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) ...@@ -1815,7 +1815,8 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
if (init_thr_lock() || thd->store_globals()) if (init_thr_lock() || thd->store_globals())
{ {
end_thread(thd,0); thd->cleanup();
delete thd;
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
...@@ -2096,6 +2097,7 @@ extern "C" pthread_handler_decl(handle_slave_io,arg) ...@@ -2096,6 +2097,7 @@ extern "C" pthread_handler_decl(handle_slave_io,arg)
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff // needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
my_thread_init(); my_thread_init();
DBUG_ENTER("handle_slave_io");
#ifndef DBUG_OFF #ifndef DBUG_OFF
slave_begin: slave_begin:
...@@ -2113,7 +2115,6 @@ extern "C" pthread_handler_decl(handle_slave_io,arg) ...@@ -2113,7 +2115,6 @@ extern "C" pthread_handler_decl(handle_slave_io,arg)
#endif #endif
thd= new THD; // note that contructor of THD uses DBUG_ ! thd= new THD; // note that contructor of THD uses DBUG_ !
DBUG_ENTER("handle_slave_io");
THD_CHECK_SENTRY(thd); THD_CHECK_SENTRY(thd);
pthread_detach_this_thread(); pthread_detach_this_thread();
...@@ -2370,6 +2371,7 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg) ...@@ -2370,6 +2371,7 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg)
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff // needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
my_thread_init(); my_thread_init();
DBUG_ENTER("handle_slave_sql");
#ifndef DBUG_OFF #ifndef DBUG_OFF
slave_begin: slave_begin:
...@@ -2382,7 +2384,6 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg) ...@@ -2382,7 +2384,6 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg)
#ifndef DBUG_OFF #ifndef DBUG_OFF
rli->events_till_abort = abort_slave_event_count; rli->events_till_abort = abort_slave_event_count;
#endif #endif
DBUG_ENTER("handle_slave_sql");
thd = new THD; // note that contructor of THD uses DBUG_ ! thd = new THD; // note that contructor of THD uses DBUG_ !
THD_CHECK_SENTRY(thd); THD_CHECK_SENTRY(thd);
......
...@@ -31,8 +31,8 @@ static TABLE_LIST *rename_tables(THD *thd, TABLE_LIST *table_list, ...@@ -31,8 +31,8 @@ static TABLE_LIST *rename_tables(THD *thd, TABLE_LIST *table_list,
bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list) bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
{ {
bool error=1; bool error= 1;
TABLE_LIST *ren_table=0; TABLE_LIST *ren_table= 0;
DBUG_ENTER("mysql_rename_tables"); DBUG_ENTER("mysql_rename_tables");
/* /*
...@@ -49,8 +49,8 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list) ...@@ -49,8 +49,8 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
VOID(pthread_mutex_lock(&LOCK_open)); VOID(pthread_mutex_lock(&LOCK_open));
if (lock_table_names(thd, table_list)) if (lock_table_names(thd, table_list))
goto err; goto err;
error= 0; error=0;
if ((ren_table=rename_tables(thd,table_list,0))) if ((ren_table=rename_tables(thd,table_list,0)))
{ {
/* Rename didn't succeed; rename back the tables in reverse order */ /* Rename didn't succeed; rename back the tables in reverse order */
...@@ -119,7 +119,7 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error) ...@@ -119,7 +119,7 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
if (!access(name,F_OK)) if (!access(name,F_OK))
{ {
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),name); my_error(ER_TABLE_EXISTS_ERROR,MYF(0),name);
DBUG_RETURN(ren_table); // This can't be skiped DBUG_RETURN(ren_table); // This can't be skipped
} }
sprintf(name,"%s/%s/%s%s",mysql_data_home, sprintf(name,"%s/%s/%s%s",mysql_data_home,
ren_table->db,ren_table->real_name, ren_table->db,ren_table->real_name,
......
...@@ -65,7 +65,7 @@ static int copy_data_between_tables(TABLE *from,TABLE *to, ...@@ -65,7 +65,7 @@ static int copy_data_between_tables(TABLE *from,TABLE *to,
int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
{ {
int error; int error= 0;
DBUG_ENTER("mysql_rm_table"); DBUG_ENTER("mysql_rm_table");
/* mark for close and remove all cached entries */ /* mark for close and remove all cached entries */
...@@ -80,6 +80,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) ...@@ -80,6 +80,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
{ {
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,MYF(0), my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,MYF(0),
tables->real_name); tables->real_name);
error= 1;
goto err; goto err;
} }
while (global_read_lock && ! thd->killed) while (global_read_lock && ! thd->killed)
...@@ -173,7 +174,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, ...@@ -173,7 +174,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
for (table=tables ; table ; table=table->next) for (table=tables ; table ; table=table->next)
{ {
char *db=table->db ? table->db : thd->db; char *db=table->db;
mysql_ha_closeall(thd, table); mysql_ha_closeall(thd, table);
if (!close_temporary_table(thd, db, table->real_name)) if (!close_temporary_table(thd, db, table->real_name))
{ {
......
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