Commit f1635f64 authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Merge with 3.23 to get fixes for --user and BACKUP TABLE

parents e98a4473 c231b747
...@@ -206,6 +206,7 @@ config.h.in ...@@ -206,6 +206,7 @@ config.h.in
config.log config.log
config.status config.status
configure configure
configure.lineno
core core
core.2430 core.2430
db-*.*.* db-*.*.*
...@@ -214,6 +215,7 @@ depcomp ...@@ -214,6 +215,7 @@ depcomp
extra/comp_err extra/comp_err
extra/my_print_defaults extra/my_print_defaults
extra/mysql_install extra/mysql_install
extra/mysql_waitpid
extra/perror extra/perror
extra/replace extra/replace
extra/resolve_stack_dump extra/resolve_stack_dump
...@@ -232,6 +234,7 @@ innobase/autom4te.cache/* ...@@ -232,6 +234,7 @@ innobase/autom4te.cache/*
innobase/autom4te.cache/output.0 innobase/autom4te.cache/output.0
innobase/autom4te.cache/requests innobase/autom4te.cache/requests
innobase/autom4te.cache/traces.0 innobase/autom4te.cache/traces.0
innobase/configure.lineno
innobase/conftest.s1 innobase/conftest.s1
innobase/conftest.subs innobase/conftest.subs
innobase/ib_config.h innobase/ib_config.h
...@@ -499,6 +502,11 @@ stamp-h1 ...@@ -499,6 +502,11 @@ stamp-h1
strings/conf_to_src strings/conf_to_src
strings/ctype_autoconf.c strings/ctype_autoconf.c
strings/ctype_extra_sources.c strings/ctype_extra_sources.c
support-files/MacOSX/Description.plist
support-files/MacOSX/Info.plist
support-files/MacOSX/StartupParameters.plist
support-files/MacOSX/postinstall
support-files/MacOSX/preinstall
support-files/binary-configure support-files/binary-configure
support-files/my-huge.cnf support-files/my-huge.cnf
support-files/my-large.cnf support-files/my-large.cnf
...@@ -522,9 +530,3 @@ vio/test-ssl ...@@ -522,9 +530,3 @@ vio/test-ssl
vio/test-sslclient vio/test-sslclient
vio/test-sslserver vio/test-sslserver
vio/viotest-ssl vio/viotest-ssl
extra/mysql_waitpid
support-files/MacOSX/Description.plist
support-files/MacOSX/Info.plist
support-files/MacOSX/StartupParameters.plist
support-files/MacOSX/postinstall
support-files/MacOSX/preinstall
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES) #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
char server_version[SERVER_VERSION_LENGTH]; char server_version[SERVER_VERSION_LENGTH];
uint32 server_id = 0; ulong server_id = 0;
// needed by net_serv.c // needed by net_serv.c
ulong bytes_sent = 0L, bytes_received = 0L; ulong bytes_sent = 0L, bytes_received = 0L;
......
...@@ -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,8 +170,9 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen, ...@@ -170,8 +170,9 @@ 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)
...@@ -193,30 +194,31 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen, ...@@ -193,30 +194,31 @@ 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
*/ */
start_time = time(NULL); start_time = time(NULL);
for (;;) for (;;)
...@@ -224,21 +226,24 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen, ...@@ -224,21 +226,24 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen,
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;
...@@ -250,7 +255,8 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen, ...@@ -250,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
......
...@@ -251,3 +251,7 @@ t1_id t2_id type cost_unit min_value max_value t3_id item_id id name ...@@ -251,3 +251,7 @@ 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;
rate_code base_rate
cust 20
rate_code base_rate
cust 20
#!/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;
...@@ -35,3 +35,23 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); ...@@ -35,3 +35,23 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27; delete from t1 where a=27;
drop table t1; drop table t1;
#
# CHAR(0) bug - not actually DELETE bug, but anyway...
#
CREATE TABLE t1 (
bool char(0) default NULL,
not_null varchar(20) binary NOT NULL default '',
misc integer not null,
PRIMARY KEY (not_null)
) TYPE=MyISAM;
INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7);
select * from t1 where misc > 5 and bool is null;
delete from t1 where misc > 5 and bool is null;
select * from t1 where misc > 5 and bool is null;
drop table t1;
...@@ -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;
...@@ -59,3 +59,8 @@ INSERT INTO t1 (numfacture,expedition) VALUES ('1212','0001-00-00 00:00:00'); ...@@ -59,3 +59,8 @@ INSERT INTO t1 (numfacture,expedition) VALUES ('1212','0001-00-00 00:00:00');
SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
drop table t1; drop table t1;
create table t1 (a datetime not null, b datetime not null);
insert into t1 values (now(), now());
insert into t1 values (now(), now());
select * from t1 where a is null or b is null;
drop table t1;
...@@ -31,17 +31,29 @@ struct utimbuf { ...@@ -31,17 +31,29 @@ struct utimbuf {
#endif #endif
/* /*
int my_copy(const char *from, const char *to, myf MyFlags)
NOTES
Ordinary ownership and accesstimes are copied from 'from-file' Ordinary ownership and accesstimes are copied from 'from-file'
if MyFlags & MY_HOLD_ORIGINAL_MODES is set and to-file exists then If MyFlags & MY_HOLD_ORIGINAL_MODES is set and to-file exists then
the modes of to-file isn't changed the modes of to-file isn't changed
Dont set MY_FNABP or MY_NABP bits on when calling this function ! 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;
......
...@@ -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
......
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
virtual String *val_str(String*,String *)=0; virtual String *val_str(String*,String *)=0;
virtual Item_result result_type () const=0; virtual Item_result result_type () const=0;
virtual Item_result cmp_type () const { return result_type(); } virtual Item_result cmp_type () const { return result_type(); }
bool eq(Field *field) { return ptr == field->ptr; } bool eq(Field *field) { return ptr == field->ptr && null_ptr == field->null_ptr; }
virtual bool eq_def(Field *field); virtual bool eq_def(Field *field);
virtual uint32 pack_length() const { return (uint32) field_length; } virtual uint32 pack_length() const { return (uint32) field_length; }
virtual void reset(void) { bzero(ptr,pack_length()); } virtual void reset(void) { bzero(ptr,pack_length()); }
......
...@@ -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;
} }
......
...@@ -3596,7 +3596,7 @@ struct my_option my_long_options[] = ...@@ -3596,7 +3596,7 @@ struct my_option my_long_options[] =
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", (gptr*) &mysqld_user,
(gptr*) &mysqld_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &mysqld_user, 0, 0, REQUIRED_ARG, 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,
...@@ -4219,6 +4219,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -4219,6 +4219,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=optarg;
else
fprintf(stderr, "Warning: Ignoring user change to '%s' becasue the user is set to '%s' earlier on the command line\n", optarg, 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);
} }
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
"hashchk", "hashchk",
"isamchk", "isamchk",
"TAK",
"NIE", "NIE",
"TAK",
"Nie mona stworzy pliku '%-.64s' (Kod bdu: %d)", "Nie mona stworzy pliku '%-.64s' (Kod bdu: %d)",
"Nie mona stworzy tabeli '%-.64s' (Kod bdu: %d)", "Nie mona stworzy tabeli '%-.64s' (Kod bdu: %d)",
"Nie mona stworzy bazy danych '%-.64s'. B?d %d", "Nie mona stworzy bazy danych '%-.64s'. B?d %d",
......
...@@ -3330,6 +3330,7 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value) ...@@ -3330,6 +3330,7 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
== Item_func::COND_AND_FUNC; == Item_func::COND_AND_FUNC;
List_iterator<Item> li(*((Item_cond*) cond)->argument_list()); List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
Item::cond_result tmp_cond_value; Item::cond_result tmp_cond_value;
bool should_fix_fields=0;
*cond_value=Item::COND_UNDEF; *cond_value=Item::COND_UNDEF;
Item *item; Item *item;
...@@ -3349,6 +3350,7 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value) ...@@ -3349,6 +3350,7 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
delete item; // This may be shared delete item; // This may be shared
#endif #endif
VOID(li.replace(new_item)); VOID(li.replace(new_item));
should_fix_fields=1;
} }
if (*cond_value == Item::COND_UNDEF) if (*cond_value == Item::COND_UNDEF)
*cond_value=tmp_cond_value; *cond_value=tmp_cond_value;
...@@ -3375,6 +3377,9 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value) ...@@ -3375,6 +3377,9 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
break; /* purecov: deadcode */ break; /* purecov: deadcode */
} }
} }
if (should_fix_fields)
cond->fix_fields(current_thd,0);
if (!((Item_cond*) cond)->argument_list()->elements || if (!((Item_cond*) cond)->argument_list()->elements ||
*cond_value != Item::COND_OK) *cond_value != Item::COND_OK)
return (COND*) 0; return (COND*) 0;
......
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