Commit 9e78a031 authored by Otto Kekäläinen's avatar Otto Kekäläinen
Browse files

Update upstream source from tag 'upstream/5.5.63'

Update to upstream version '5.5.63'
with Debian dir fc4032dc747eef4e5be3af715bcfbdd82284a3e4
parents 696c5f5d 15f2dedb
...@@ -656,3 +656,25 @@ show create table "a1\""b1"; ...@@ -656,3 +656,25 @@ show create table "a1\""b1";
select * from "a1\""b1"; select * from "a1\""b1";
drop table "a1\""b1"; drop table "a1\""b1";
set sql_mode=default; set sql_mode=default;
#
# mysql --local-infile
#
--let $ldli = load data local infile '$MYSQLTEST_VARDIR/tmp/bug.sql' into table test.t1;
create table t1 (a text);
--exec $MYSQL -e "$ldli"
select count(*) from t1; truncate table t1;
--exec $MYSQL --enable-local-infile -e "$ldli"
select count(*) from t1; truncate table t1;
--error 1
--exec $MYSQL --disable-local-infile -e "$ldli"
select count(*) from t1; truncate table t1;
--error 1
--exec $MYSQL -e "/*q*/$ldli"
select count(*) from t1; truncate table t1;
--exec $MYSQL --enable-local-infile -e "/*q*/$ldli"
select count(*) from t1; truncate table t1;
--error 1
--exec $MYSQL --disable-local-infile -e "/*q*/$ldli"
select count(*) from t1; truncate table t1;
drop table t1;
...@@ -1803,7 +1803,7 @@ show create event ee1; ...@@ -1803,7 +1803,7 @@ show create event ee1;
## prove three works (with spaces and tabs on the end) ## prove three works (with spaces and tabs on the end)
# start with one from the previous restore # start with one from the previous restore
create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5; create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5;
create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
show events; show events;
--exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql --exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql
......
...@@ -310,3 +310,16 @@ set global read_only= @start_read_only; ...@@ -310,3 +310,16 @@ set global read_only= @start_read_only;
# Wait till all disconnects are completed # Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
--echo #
--echo # MDEV-16987 - ALTER DATABASE possible in read-only mode
--echo #
GRANT ALTER ON test1.* TO user1@localhost;
CREATE DATABASE test1;
SET GLOBAL read_only=1;
change_user user1;
--error ER_OPTION_PREVENTS_STATEMENT
ALTER DATABASE test1 CHARACTER SET utf8;
change_user root;
SET GLOBAL read_only=0;
DROP DATABASE test1;
DROP USER user1@localhost;
...@@ -60,3 +60,20 @@ checksum table t1; ...@@ -60,3 +60,20 @@ checksum table t1;
checksum table t1 quick; checksum table t1 quick;
checksum table t1 extended; checksum table t1 extended;
drop table t1; drop table t1;
--echo #
--echo # MDEV-17085: CHECKSUM TABLE EXTENDED does not work correctly
--echo #
CREATE TABLE t1 ( c1 int NOT NULL, c2 int NOT NULL, c4 varchar(20), c5 varchar(20), c6 varchar(20), c7 varchar(20), c8 varchar(20), c9 varchar(20), c10 varchar(20), c11 varchar(20), c12 varchar(20), c13 varchar(20), c14 varchar(20), c15 varchar(20), c16 varchar(20), c19 int NOT NULL, c20 int NOT NULL, c21 varchar(20), c22 VARCHAR(20), c23 varchar(20));
insert into t1 values (5,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,"dog",NULL,NULL);
--echo # Important is that checksum is different from following
CHECKSUM TABLE t1 EXTENDED;
UPDATE t1 SET c21='cat' WHERE c1=5;
--echo # Important is that checksum is different from above
CHECKSUM TABLE t1 EXTENDED;
drop table t1;
--echo # End of 5.5 tests
...@@ -995,7 +995,24 @@ disconnect con2; ...@@ -995,7 +995,24 @@ disconnect con2;
DROP USER user2@localhost; DROP USER user2@localhost;
DROP DATABASE db1; DROP DATABASE db1;
#
# Bug#27407480: AUTOMATIC_SP_PRIVILEGES REQUIRES NEED THE INSERT PRIVILEGES FOR MYSQL.USER TABLE
#
create user foo@local_ost;
create user foo@`local\_ost` identified by 'nevermore';
create database foodb;
grant create routine on foodb.* to foo@local_ost;
connect con1,localhost,foo;
select user(), current_user();
show grants;
create procedure fooproc() select 'i am fooproc';
show grants;
disconnect con1;
connection default;
drop user foo@local_ost;
drop user foo@`local\_ost`;
drop procedure fooproc;
drop database foodb;
# Wait till all disconnects are completed # Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
...@@ -9353,4 +9353,25 @@ where 1=1; ...@@ -9353,4 +9353,25 @@ where 1=1;
drop function if exists f1; drop function if exists f1;
drop table t1,t2; drop table t1,t2;
--echo #
--echo # MDEV-16957: Server crashes in Field_iterator_natural_join::next
--echo # upon 2nd execution of SP
--echo #
CREATE TABLE t1 (a INT, b VARCHAR(32));
CREATE PROCEDURE sp() SELECT * FROM t1 AS t1x JOIN t1 AS t1y USING (c);
--error ER_BAD_FIELD_ERROR
CALL sp;
--error ER_BAD_FIELD_ERROR
CALL sp;
--error ER_BAD_FIELD_ERROR
CALL sp;
alter table t1 add column c int;
CALL sp;
# Cleanup
DROP PROCEDURE sp;
DROP TABLE t1;
--echo # End of 5.5 test --echo # End of 5.5 test
...@@ -411,3 +411,23 @@ insert into t3 select a from t1; ...@@ -411,3 +411,23 @@ insert into t3 select a from t1;
select null in (select a from t1 where a < out3.a union select a from t2 where select null in (select a from t1 where a < out3.a union select a from t2 where
(select a from t3) +1 < out3.a+1) from t3 out3; (select a from t3) +1 < out3.a+1) from t3 out3;
drop table t1, t2, t3; drop table t1, t2, t3;
#
# Bug #28499924: INCORRECT BEHAVIOR WITH UNION IN SUBQUERY
#
CREATE TABLE t1(
q11 int, q12 int, q13 int, q14 int, q15 int, q16 int, q17 int, q18 int, q19 int,
q21 int, q22 int, q23 int, q24 int, q25 int, q26 int, q27 int, q28 int, q29 int,
f1 int
);
CREATE TABLE t2(f2 int, f21 int, f3 timestamp, f4 int, f5 int, f6 int);
INSERT INTO t1 (f1) VALUES (1),(1),(2),(2);
INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11",0,0,0), (2,2,"2004-02-29 11:11:11",0,0,0);
SELECT f1,
(SELECT t.f21 from t2 t where max(
q11+q12+q13+q14+q15+q16+q17+q18+q19+
q21+q22+q23+q24+q25+q26+q27+q28+q29) = t.f2 UNION
SELECT t.f3 FROM t2 AS t WHERE t1.f1=t.f2 AND t.f3=MAX(t1.f1) UNION
SELECT 1 LIMIT 1) AS test
FROM t1 GROUP BY f1;
DROP TABLE t1,t2;
...@@ -331,3 +331,32 @@ eval select concat((truncate((-1.7976931348623157E+307),(0x1e))), ...@@ -331,3 +331,32 @@ eval select concat((truncate((-1.7976931348623157E+307),(0x1e))),
--echo # --echo #
select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo; select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo;
--echo #
--echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result
--echo #
SELECT LEFT('a',EXP(50));
SELECT LEFT('a', COALESCE(1e30));
CREATE TABLE t1 (a FLOAT);
INSERT INTO t1 VALUES (1e30);
SELECT LEFT('a',a), LEFT('a',1e30) FROM t1;
DROP TABLE t1;
PREPARE stmt FROM 'SELECT LEFT(111,?)';
SET @a=1e30;
EXECUTE stmt USING @a;
DEALLOCATE PREPARE stmt;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT LEFT('a',(SELECT 1e30 FROM t1 LIMIT 1));
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (1e30),(0);
SELECT LEFT('a', SUM(a)) FROM t1;
SELECT LEFT('a', AVG(a)) FROM t1;
DROP TABLE t1;
...@@ -1581,3 +1581,47 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1; ...@@ -1581,3 +1581,47 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1;
select 0.0000000001 mod 1; select 0.0000000001 mod 1;
select 0.01 mod 1; select 0.01 mod 1;
#
# MDEV-17256 Decimal field multiplication bug
#
CREATE TABLE t1 (
`FLD1` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD2` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD3` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD4` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD5` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD6` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD7` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD8` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD9` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD10` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD11` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD12` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD13` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD14` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD15` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD16` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD17` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD18` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD19` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD20` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD21` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD22` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000,
`FLD23` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000
);
INSERT INTO t1 VALUES (001.0760,000.9500,001.0000,001.0000,001.0000,
001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.5949,001.0194,
001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.9220,001.1890,001.2130,327.2690);
select FLD1*FLD2*FLD3*FLD4*FLD5*FLD6*FLD7*FLD8*FLD9*FLD10*FLD11*FLD12*FLD13*FLD14*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD23 as calc1 from t1;
select FLD23*FLD2*FLD1*FLD4*FLD5*FLD11*FLD12*FLD13*FLD3*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD14*FLD6*FLD7*FLD8*FLD9*FLD10 as calc2 from t1;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT 1.0 * 2.000;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# Copyright (c) 2006, 2014, Oracle and/or its affiliates # Copyright (c) 2006, 2014, Oracle and/or its affiliates
# Copyright (c) 2009, 2018, MariaDB Corporation
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
......
...@@ -282,6 +282,10 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize, ...@@ -282,6 +282,10 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
} }
info->inited=info->aio_result.pending=0; info->inited=info->aio_result.pending=0;
#endif #endif
if (type == READ_CACHE || type == WRITE_CACHE || type == SEQ_READ_APPEND)
info->myflags|= MY_FULL_IO;
else
info->myflags&= ~MY_FULL_IO;
DBUG_RETURN(0); DBUG_RETURN(0);
} /* init_io_cache */ } /* init_io_cache */
......
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2018, MariaDB Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -102,14 +103,14 @@ my_off_t my_b_append_tell(IO_CACHE* info) ...@@ -102,14 +103,14 @@ my_off_t my_b_append_tell(IO_CACHE* info)
*/ */
{ {
volatile my_off_t save_pos; volatile my_off_t save_pos;
save_pos = my_tell(info->file,MYF(0)); save_pos = mysql_file_tell(info->file,MYF(0));
my_seek(info->file,(my_off_t)0,MY_SEEK_END,MYF(0)); mysql_file_seek(info->file,(my_off_t)0,MY_SEEK_END,MYF(0));
/* /*
Save the value of my_tell in res so we can see it when studying coredump Save the value of my_tell in res so we can see it when studying coredump
*/ */
DBUG_ASSERT(info->end_of_file - (info->append_read_pos-info->write_buffer) DBUG_ASSERT(info->end_of_file - (info->append_read_pos-info->write_buffer)
== (res=my_tell(info->file,MYF(0)))); == (res=mysql_file_tell(info->file,MYF(0))));
my_seek(info->file,save_pos,MY_SEEK_SET,MYF(0)); mysql_file_seek(info->file,save_pos,MY_SEEK_SET,MYF(0));
} }
#endif #endif
res = info->end_of_file + (info->write_pos-info->append_read_pos); res = info->end_of_file + (info->write_pos-info->append_read_pos);
...@@ -203,7 +204,7 @@ size_t my_b_fill(IO_CACHE *info) ...@@ -203,7 +204,7 @@ size_t my_b_fill(IO_CACHE *info)
if (info->seek_not_done) if (info->seek_not_done)
{ /* File touched, do seek */ { /* File touched, do seek */
if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) == if (mysql_file_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) ==
MY_FILEPOS_ERROR) MY_FILEPOS_ERROR)
{ {
info->error= 0; info->error= 0;
...@@ -223,7 +224,7 @@ size_t my_b_fill(IO_CACHE *info) ...@@ -223,7 +224,7 @@ size_t my_b_fill(IO_CACHE *info)
} }
DBUG_EXECUTE_IF ("simulate_my_b_fill_error", DBUG_EXECUTE_IF ("simulate_my_b_fill_error",
{DBUG_SET("+d,simulate_file_read_error");}); {DBUG_SET("+d,simulate_file_read_error");});
if ((length= my_read(info->file,info->buffer,max_length, if ((length= mysql_file_read(info->file,info->buffer,max_length,
info->myflags)) == (size_t) -1) info->myflags)) == (size_t) -1)
{ {
info->error= -1; info->error= -1;
...@@ -287,7 +288,7 @@ my_off_t my_b_filelength(IO_CACHE *info) ...@@ -287,7 +288,7 @@ my_off_t my_b_filelength(IO_CACHE *info)
return my_b_tell(info); return my_b_tell(info);
info->seek_not_done= 1; info->seek_not_done= 1;
return my_seek(info->file, 0L, MY_SEEK_END, MYF(0)); return mysql_file_seek(info->file, 0L, MY_SEEK_END, MYF(0));
} }
......
...@@ -184,6 +184,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) ...@@ -184,6 +184,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
uchar* point; uchar* point;
reg1 USED_MEM *next= 0; reg1 USED_MEM *next= 0;
reg2 USED_MEM **prev; reg2 USED_MEM **prev;
size_t original_length = length;
DBUG_ENTER("alloc_root"); DBUG_ENTER("alloc_root");
DBUG_PRINT("enter",("root: 0x%lx", (long) mem_root)); DBUG_PRINT("enter",("root: 0x%lx", (long) mem_root));
DBUG_ASSERT(alloc_root_inited(mem_root)); DBUG_ASSERT(alloc_root_inited(mem_root));
...@@ -241,7 +242,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) ...@@ -241,7 +242,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
mem_root->used= next; mem_root->used= next;
mem_root->first_block_usage= 0; mem_root->first_block_usage= 0;
} }
TRASH_ALLOC(point, length); TRASH_ALLOC(point, original_length);
DBUG_PRINT("exit",("ptr: 0x%lx", (ulong) point)); DBUG_PRINT("exit",("ptr: 0x%lx", (ulong) point));
DBUG_RETURN((void*) point); DBUG_RETURN((void*) point);
#endif #endif
......
...@@ -52,10 +52,9 @@ static uint set_max_open_files(uint max_file_limit) ...@@ -52,10 +52,9 @@ static uint set_max_open_files(uint max_file_limit)
DBUG_PRINT("info", ("rlim_cur: %u rlim_max: %u", DBUG_PRINT("info", ("rlim_cur: %u rlim_max: %u",
(uint) rlimit.rlim_cur, (uint) rlimit.rlim_cur,
(uint) rlimit.rlim_max)); (uint) rlimit.rlim_max));
if ((ulonglong) rlimit.rlim_cur == (ulonglong) RLIM_INFINITY) if ((ulonglong) rlimit.rlim_cur == (ulonglong) RLIM_INFINITY ||
rlimit.rlim_cur = max_file_limit; rlimit.rlim_cur >= max_file_limit)
if (rlimit.rlim_cur >= max_file_limit) DBUG_RETURN(max_file_limit);
DBUG_RETURN(rlimit.rlim_cur); /* purecov: inspected */
rlimit.rlim_cur= rlimit.rlim_max= max_file_limit; rlimit.rlim_cur= rlimit.rlim_max= max_file_limit;
if (setrlimit(RLIMIT_NOFILE, &rlimit)) if (setrlimit(RLIMIT_NOFILE, &rlimit))
max_file_limit= old_cur; /* Use original value */ max_file_limit= old_cur; /* Use original value */
......
...@@ -47,8 +47,7 @@ ...@@ -47,8 +47,7 @@
size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
myf MyFlags) myf MyFlags)
{ {
size_t readbytes; size_t readbytes, save_count= 0;
int error= 0;
DBUG_ENTER("my_pread"); DBUG_ENTER("my_pread");
...@@ -66,11 +65,10 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, ...@@ -66,11 +65,10 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
#else #else
readbytes= pread(Filedes, Buffer, Count, offset); readbytes= pread(Filedes, Buffer, Count, offset);
#endif #endif
error = (readbytes != Count);
if (error) if (readbytes != Count)
{ {
my_errno= errno ? errno : -1; my_errno= errno;
if (errno == 0 || (readbytes != (size_t) -1 && if (errno == 0 || (readbytes != (size_t) -1 &&
(MyFlags & (MY_NABP | MY_FNABP)))) (MyFlags & (MY_NABP | MY_FNABP))))
my_errno= HA_ERR_FILE_TOO_SHORT; my_errno= HA_ERR_FILE_TOO_SHORT;
...@@ -82,6 +80,18 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, ...@@ -82,6 +80,18 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
(int) readbytes)); (int) readbytes));
continue; /* Interrupted */ continue; /* Interrupted */
} }
/* Do a read retry if we didn't get enough data on first read */
if (readbytes != (size_t) -1 && readbytes != 0 &&
(MyFlags & MY_FULL_IO))
{
Buffer+= readbytes;
Count-= readbytes;
save_count+= readbytes;
offset+= readbytes;
continue;
}
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{ {
if (readbytes == (size_t) -1) if (readbytes == (size_t) -1)
...@@ -97,8 +107,10 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, ...@@ -97,8 +107,10 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
DBUG_RETURN(MY_FILE_ERROR); /* Return with error */ DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
} }
if (MyFlags & (MY_NABP | MY_FNABP)) if (MyFlags & (MY_NABP | MY_FNABP))
DBUG_RETURN(0); /* Read went ok; Return 0 */ readbytes= 0; /* Read went ok; Return 0 */
DBUG_RETURN(readbytes); /* purecov: inspected */ else
readbytes+= save_count;
DBUG_RETURN(readbytes);
} }
} /* my_pread */ } /* my_pread */
......
...@@ -35,11 +35,10 @@ ...@@ -35,11 +35,10 @@
size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags) size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags)
{ {
size_t readbytes, save_count; size_t readbytes, save_count= 0;
DBUG_ENTER("my_read"); DBUG_ENTER("my_read");
DBUG_PRINT("my",("fd: %d Buffer: %p Count: %lu MyFlags: %d", DBUG_PRINT("my",("fd: %d Buffer: %p Count: %lu MyFlags: %lu",
Filedes, Buffer, (ulong) Count, MyFlags)); Filedes, Buffer, (ulong) Count, (ulong) MyFlags));
save_count= Count;
if (!(MyFlags & (MY_WME | MY_FAE | MY_FNABP))) if (!(MyFlags & (MY_WME | MY_FAE | MY_FNABP)))
MyFlags|= my_global_flags; MyFlags|= my_global_flags;
...@@ -61,47 +60,52 @@ size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags) ...@@ -61,47 +60,52 @@ size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags)
if (readbytes != Count) if (readbytes != Count)
{ {
my_errno= errno; int got_errno= my_errno= errno;
if (errno == 0 || (readbytes != (size_t) -1 &&
(MyFlags & (MY_NABP | MY_FNABP))))
my_errno= HA_ERR_FILE_TOO_SHORT;
DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d", DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d",
(int) readbytes, (ulong) Count, Filedes, (int) readbytes, (ulong) Count, Filedes,
my_errno)); got_errno));
if (got_errno == 0 || (readbytes != (size_t) -1 &&
(MyFlags & (MY_NABP | MY_FNABP))))
my_errno= HA_ERR_FILE_TOO_SHORT;
if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR) if ((readbytes == 0 || (int) readbytes == -1) && got_errno == EINTR)
{ {
DBUG_PRINT("debug", ("my_read() was interrupted and returned %ld", DBUG_PRINT("debug", ("my_read() was interrupted and returned %ld",
(long) readbytes)); (long) readbytes));
continue; /* Interrupted */ continue; /* Interrupted */
} }
/* Do a read retry if we didn't get enough data on first read */
if (readbytes != (size_t) -1 && readbytes != 0 &&
(MyFlags & MY_FULL_IO))
{
Buffer+= readbytes;
Count-= readbytes;
save_count+= readbytes;
continue;
}
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{ {
if (readbytes == (size_t) -1) if (readbytes == (size_t) -1)
my_error(EE_READ, my_error(EE_READ,
MYF(ME_BELL | ME_WAITTANG | (MyFlags & (ME_JUST_INFO | ME_NOREFRESH))), MYF(ME_BELL | ME_WAITTANG | (MyFlags & (ME_JUST_INFO | ME_NOREFRESH))),
my_filename(Filedes),my_errno); my_filename(Filedes), got_errno);
else if (MyFlags & (MY_NABP | MY_FNABP)) else if (MyFlags & (MY_NABP | MY_FNABP))
my_error(EE_EOFERR, my_error(EE_EOFERR,
MYF(ME_BELL | ME_WAITTANG | (MyFlags & (ME_JUST_INFO | ME_NOREFRESH))), MYF(ME_BELL | ME_WAITTANG | (MyFlags & (ME_JUST_INFO | ME_NOREFRESH))),
my_filename(Filedes),my_errno); my_filename(Filedes), got_errno);
} }
if (readbytes == (size_t) -1 || if (readbytes == (size_t) -1 ||
((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO))) ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO)))
DBUG_RETURN(MY_FILE_ERROR); /* Return with error */ DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
if (readbytes != (size_t) -1 && (MyFlags & MY_FULL_IO))
{
Buffer+= readbytes;
Count-= readbytes;
continue;
}
} }
if (MyFlags & (MY_NABP | MY_FNABP)) if (MyFlags & (MY_NABP | MY_FNABP))
readbytes= 0; /* Ok on read */ readbytes= 0; /* Ok on read */
else if (MyFlags & MY_FULL_IO) else
readbytes= save_count; readbytes+= save_count;
break; break;
} }
DBUG_RETURN(readbytes); DBUG_RETURN(readbytes);
......
...@@ -36,6 +36,9 @@ in_rpm=0 ...@@ -36,6 +36,9 @@ in_rpm=0
ip_only=0 ip_only=0
cross_bootstrap=0 cross_bootstrap=0
dirname0=`dirname $0 2>/dev/null`
dirname0=`dirname $dirname0 2>/dev/null`
usage() usage()
{ {
cat <<EOF cat <<EOF
...@@ -207,9 +210,6 @@ cannot_find_file() ...@@ -207,9 +210,6 @@ cannot_find_file()
done done
fi fi
echo
echo "If you compiled from source, you need to run 'make install' to"
echo "copy the software into the correct location ready for operation."
echo echo
echo "If you compiled from source, you need to either run 'make install' to" echo "If you compiled from source, you need to either run 'make install' to"
echo "copy the software into the correct location ready for operation." echo "copy the software into the correct location ready for operation."
...@@ -256,6 +256,9 @@ then ...@@ -256,6 +256,9 @@ then
cannot_find_file my_print_defaults $basedir/bin $basedir/extra cannot_find_file my_print_defaults $basedir/bin $basedir/extra
exit 1 exit 1
fi fi
elif test -n "$dirname0" -a -x "$dirname0/@bindir@/my_print_defaults"
then
print_defaults="$dirname0/@bindir@/my_print_defaults"
else else
print_defaults="@bindir@/my_print_defaults" print_defaults="@bindir@/my_print_defaults"
fi fi
...@@ -307,6 +310,14 @@ then ...@@ -307,6 +310,14 @@ then
cannot_find_file fill_help_tables.sql @pkgdata_locations@ cannot_find_file fill_help_tables.sql @pkgdata_locations@
exit 1 exit 1
fi fi
# relative from where the script was run for a relocatable install
elif test -n "$dirname0" -a -x "$dirname0/@INSTALL_SBINDIR@/mysqld"
then
basedir="$dirname0"
bindir="$basedir/@INSTALL_SBINDIR@"
resolveip="$bindir/resolveip"
mysqld="$basedir/@INSTALL_SBINDIR@/mysqld"
pkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
else else
basedir="@prefix@" basedir="@prefix@"
bindir="@bindir@" bindir="@bindir@"
......
...@@ -468,15 +468,15 @@ ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL, ...@@ -468,15 +468,15 @@ ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL,
DEFAULT CHARACTER SET utf8; DEFAULT CHARACTER SET utf8;
# Correct the character set and collation # Correct the character set and collation
ALTER TABLE proc CONVERT TO CHARACTER SET utf8;
# Reset some fields after the conversion # Reset some fields after the conversion
SET @alter_statement = CONCAT(" SET @alter_statement = CONCAT("
ALTER TABLE proc MODIFY db ALTER TABLE proc CONVERT TO CHARACTER SET utf8,
char(64) collate utf8_bin DEFAULT '' NOT NULL, MODIFY db
char(64) binary DEFAULT '' NOT NULL,
MODIFY definer MODIFY definer
char(", @definer_name_length, ") collate utf8_bin DEFAULT '' NOT NULL, char(", @definer_name_length, ") binary DEFAULT '' NOT NULL,
MODIFY comment MODIFY comment
char(64) collate utf8_bin DEFAULT '' NOT NULL char(64) binary DEFAULT '' NOT NULL
"); ");
PREPARE alter_stmt FROM @alter_statement; PREPARE alter_stmt FROM @alter_statement;
EXECUTE alter_stmt; EXECUTE alter_stmt;
......
...@@ -1120,6 +1120,7 @@ sub GetData() ...@@ -1120,6 +1120,7 @@ sub GetData()
} }
} }
print " Replication "; print " Replication ";
print "Master:$data->{Master_Host} ";
print "IO:$data->{Slave_IO_Running} "; print "IO:$data->{Slave_IO_Running} ";
print "SQL:$data->{Slave_SQL_Running} "; print "SQL:$data->{Slave_SQL_Running} ";
print RESET() if ($HAS_COLOR); print RESET() if ($HAS_COLOR);
......
...@@ -115,6 +115,12 @@ my_bool net_flush(NET *net); ...@@ -115,6 +115,12 @@ my_bool net_flush(NET *net);
#include <my_context.h> #include <my_context.h>
#include <mysql_async.h> #include <mysql_async.h>
typedef enum {
ALWAYS_ACCEPT, /* heuristics is disabled, use CLIENT_LOCAL_FILES */
WAIT_FOR_QUERY, /* heuristics is enabled, not sending files */
ACCEPT_FILE_REQUEST /* heuristics is enabled, ready to send a file */
} auto_local_infile_state;
#define native_password_plugin_name "mysql_native_password" #define native_password_plugin_name "mysql_native_password"
#define old_password_plugin_name "mysql_old_password" #define old_password_plugin_name "mysql_old_password"
...@@ -1765,8 +1771,10 @@ mysql_init(MYSQL *mysql) ...@@ -1765,8 +1771,10 @@ mysql_init(MYSQL *mysql)
--enable-local-infile --enable-local-infile
*/ */
#if defined(ENABLED_LOCAL_INFILE) && !defined(MYSQL_SERVER) #if ENABLED_LOCAL_INFILE && !defined(MYSQL_SERVER)
mysql->options.client_flag|= CLIENT_LOCAL_FILES; mysql->options.client_flag|= CLIENT_LOCAL_FILES;
mysql->auto_local_infile= ENABLED_LOCAL_INFILE == LOCAL_INFILE_MODE_AUTO
? WAIT_FOR_QUERY : ALWAYS_ACCEPT;
#endif #endif
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
...@@ -3951,8 +3959,14 @@ static my_bool cli_read_query_result(MYSQL *mysql) ...@@ -3951,8 +3959,14 @@ static my_bool cli_read_query_result(MYSQL *mysql)
ulong field_count; ulong field_count;
MYSQL_DATA *fields; MYSQL_DATA *fields;
ulong length; ulong length;
#ifdef MYSQL_CLIENT
my_bool can_local_infile= mysql->auto_local_infile != WAIT_FOR_QUERY;
#endif
DBUG_ENTER("cli_read_query_result"); DBUG_ENTER("cli_read_query_result");
if (mysql->auto_local_infile == ACCEPT_FILE_REQUEST)
mysql->auto_local_infile= WAIT_FOR_QUERY;
if ((length = cli_safe_read(mysql)) == packet_error) if ((length = cli_safe_read(mysql)) == packet_error)
DBUG_RETURN(1); DBUG_RETURN(1);
free_old_query(mysql); /* Free old result */ free_old_query(mysql); /* Free old result */
...@@ -3989,7 +4003,8 @@ static my_bool cli_read_query_result(MYSQL *mysql) ...@@ -3989,7 +4003,8 @@ static my_bool cli_read_query_result(MYSQL *mysql)
{ {
int error; int error;
if (!(mysql->options.client_flag & CLIENT_LOCAL_FILES)) if (!(mysql->options.client_flag & CLIENT_LOCAL_FILES) ||
!can_local_infile)
{ {
set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate); set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -4027,6 +4042,13 @@ int STDCALL ...@@ -4027,6 +4042,13 @@ int STDCALL
mysql_send_query(MYSQL* mysql, const char* query, ulong length) mysql_send_query(MYSQL* mysql, const char* query, ulong length)
{ {
DBUG_ENTER("mysql_send_query"); DBUG_ENTER("mysql_send_query");
if (mysql->options.client_flag & CLIENT_LOCAL_FILES &&
mysql->auto_local_infile == WAIT_FOR_QUERY &&
(*query == 'l' || *query == 'L'))
{
if (strncasecmp(query, STRING_WITH_LEN("load")) == 0)
mysql->auto_local_infile= ACCEPT_FILE_REQUEST;
}
DBUG_RETURN(simple_command(mysql, COM_QUERY, (uchar*) query, length, 1)); DBUG_RETURN(simple_command(mysql, COM_QUERY, (uchar*) query, length, 1));
} }
...@@ -4241,10 +4263,12 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) ...@@ -4241,10 +4263,12 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
mysql->options.protocol=MYSQL_PROTOCOL_PIPE; /* Force named pipe */ mysql->options.protocol=MYSQL_PROTOCOL_PIPE; /* Force named pipe */
break; break;
case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/ case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/
if (!arg || test(*(uint*) arg)) if (!arg || *(uint*) arg)
mysql->options.client_flag|= CLIENT_LOCAL_FILES; mysql->options.client_flag|= CLIENT_LOCAL_FILES;
else else
mysql->options.client_flag&= ~CLIENT_LOCAL_FILES; mysql->options.client_flag&= ~CLIENT_LOCAL_FILES;
mysql->auto_local_infile= arg && *(uint*)arg == LOCAL_INFILE_MODE_AUTO
? WAIT_FOR_QUERY : ALWAYS_ACCEPT;
break; break;
case MYSQL_INIT_COMMAND: case MYSQL_INIT_COMMAND:
add_init_command(&mysql->options,arg); add_init_command(&mysql->options,arg);
......
Supports Markdown
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