Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
57dee2ea
Commit
57dee2ea
authored
Feb 08, 2005
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/jonas/src/mysql-5.0
into mysql.com:/home/jonas/src/mysql-5.0-ndb
parents
925d09be
6e6daf81
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
353 additions
and
136 deletions
+353
-136
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+112
-40
mysql-test/r/group_by.result
mysql-test/r/group_by.result
+36
-9
mysql-test/r/sql_mode.result
mysql-test/r/sql_mode.result
+14
-0
mysql-test/r/user_var.result
mysql-test/r/user_var.result
+2
-2
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+21
-7
mysql-test/t/sql_mode.test
mysql-test/t/sql_mode.test
+10
-0
ndb/src/common/util/NdbSqlUtil.cpp
ndb/src/common/util/NdbSqlUtil.cpp
+3
-0
ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp
ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp
+1
-1
ndb/test/ndbapi/testOIBasic.cpp
ndb/test/ndbapi/testOIBasic.cpp
+8
-4
scripts/mysqld_safe.sh
scripts/mysqld_safe.sh
+26
-0
sql/ha_innodb.cc
sql/ha_innodb.cc
+34
-42
sql/item.cc
sql/item.cc
+4
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+43
-2
sql/item_func.cc
sql/item_func.cc
+6
-2
sql/item_row.cc
sql/item_row.cc
+8
-3
sql/item_strfunc.cc
sql/item_strfunc.cc
+5
-2
sql/mysqld.cc
sql/mysqld.cc
+16
-21
sql/sql_lex.cc
sql/sql_lex.cc
+2
-1
sql/unireg.h
sql/unireg.h
+2
-0
No files found.
mysql-test/mysql-test-run.pl
View file @
57dee2ea
...
...
@@ -284,6 +284,11 @@ our $opt_warnings;
our
$opt_with_ndbcluster
;
our
$opt_with_openssl
;
our
$exe_ndb_mgm
;
our
$path_ndb_tools_dir
;
our
$path_ndb_backup_dir
;
our
$file_ndb_testrun_log
;
our
$flag_ndb_status_ok
=
1
;
######################################################################
#
...
...
@@ -297,6 +302,7 @@ sub command_line_setup ();
sub
executable_setup
();
sub
environment_setup
();
sub
kill_and_cleanup
();
sub
ndbcluster_install
();
sub
ndbcluster_start
();
sub
ndbcluster_stop
();
sub
run_benchmarks
($);
...
...
@@ -346,18 +352,12 @@ sub main () {
kill_and_cleanup
();
mysql_install_db
();
if
(
$opt_with_ndbcluster
and
!
$glob_use_running_ndbcluster
)
{
ndbcluster_start
();
# We start the cluster storage engine
}
# mysql_loadstd(); FIXME copying from "std_data" .frm and
# .MGR but there are none?!
}
if
(
$opt_start_and_exit
)
{
# FIXME what about ndb?
if
(
mysqld_start
('
master
',
0
,
[]
,
[]
)
)
{
mtr_report
("
Servers started, exiting
");
...
...
@@ -551,6 +551,8 @@ sub command_line_setup () {
$master
->
[
0
]
->
{'
path_myport
'}
=
$opt_master_myport
;
$master
->
[
0
]
->
{'
start_timeout
'}
=
400
;
# enough time create innodb tables
$master
->
[
0
]
->
{'
ndbcluster
'}
=
1
;
# ndbcluster not started
$master
->
[
1
]
->
{'
path_myddir
'}
=
"
$glob_mysql_test_dir
/var/master1-data
";
$master
->
[
1
]
->
{'
path_myerr
'}
=
"
$glob_mysql_test_dir
/var/log/master1.err
";
$master
->
[
1
]
->
{'
path_mylog
'}
=
"
$glob_mysql_test_dir
/var/log/master1.log
";
...
...
@@ -681,6 +683,10 @@ sub command_line_setup () {
$glob_use_running_ndbcluster
=
1
;
$opt_with_ndbcluster
=
1
;
}
else
{
$opt_ndbconnectstring
=
"
host=localhost:
$opt_ndbcluster_port
";
}
# FIXME
...
...
@@ -786,6 +792,9 @@ sub executable_setup () {
$exe_mysql_fix_system_tables
=
"
$glob_basedir
/scripts/mysql_fix_privilege_tables
";
$path_language
=
"
$glob_basedir
/sql/share/english/
";
$path_charsetsdir
=
"
$glob_basedir
/sql/share/charsets
";
$path_ndb_tools_dir
=
"
$glob_basedir
/ndb/tools
";
$exe_ndb_mgm
=
"
$glob_basedir
/ndb/src/mgmclient/ndb_mgm
";
}
else
{
...
...
@@ -846,6 +855,9 @@ sub executable_setup () {
$exe_mysqltest
=
"
$path_client_bindir
/mysqltest
";
$exe_mysql_client_test
=
"
$path_client_bindir
/mysql_client_test
";
}
$path_ndb_tools_dir
=
"
$glob_basedir
/bin
";
$exe_ndb_mgm
=
"
$glob_basedir
/bin/ndb_mgm
";
}
# FIXME special $exe_master_mysqld and $exe_slave_mysqld
...
...
@@ -860,6 +872,10 @@ sub executable_setup () {
{
$exe_slave_mysqld
=
$exe_mysqld
;
}
$path_ndb_backup_dir
=
"
$glob_mysql_test_dir
/var/ndbcluster-
$opt_ndbcluster_port
";
$file_ndb_testrun_log
=
"
$glob_mysql_test_dir
/var/log/ndb_testrun.log
";
}
...
...
@@ -949,22 +965,19 @@ sub kill_and_cleanup () {
mtr_report
("
Killing Possible Leftover Processes
");
mkpath
("
$glob_mysql_test_dir
/var/log
");
# Needed for mysqladmin log
mtr_kill_leftovers
();
}
if
(
$opt_with_ndbcluster
and
!
$glob_use_running_ndbcluster
)
{
ndbcluster_stop
();
$master
->
[
0
]
->
{'
ndbcluster
'}
=
1
;
}
mtr_report
("
Removing Stale Files
");
rmtree
("
$glob_mysql_test_dir
/var/log
");
rmtree
("
$glob_mysql_test_dir
/var/ndbcluster
");
rmtree
("
$glob_mysql_test_dir
/var/ndbcluster
-
$opt_ndbcluster_port
");
rmtree
("
$glob_mysql_test_dir
/var/run
");
rmtree
("
$glob_mysql_test_dir
/var/tmp
");
mkpath
("
$glob_mysql_test_dir
/var/log
");
mkpath
("
$glob_mysql_test_dir
/var/ndbcluster
");
mkpath
("
$glob_mysql_test_dir
/var/run
");
mkpath
("
$glob_mysql_test_dir
/var/tmp
");
mkpath
(
$opt_tmpdir
);
...
...
@@ -1002,26 +1015,67 @@ sub kill_and_cleanup () {
# FIXME why is there a different start below?!
sub
ndbcluster_
start
()
{
sub
ndbcluster_
install
()
{
mtr_report
("
Starting ndbcluster
");
if
(
!
$opt_with_ndbcluster
or
$glob_use_running_ndbcluster
)
{
return
0
;
}
mtr_report
("
Install ndbcluster
");
my
$ndbcluster_opts
=
$opt_bench
?
""
:
"
--small
";
# FIXME check result code?!
mtr_run
("
$glob_mysql_test_dir
/ndb/ndbcluster
",
["
--port-base=
$opt_ndbcluster_port
",
$ndbcluster_opts
,
"
--diskless
",
"
--initial
",
"
--data-dir=
$glob_mysql_test_dir
/var
"],
"",
"",
"",
"");
my
$ndbcluster_port_base
=
$opt_ndbcluster_port
+
2
;
if
(
mtr_run
("
$glob_mysql_test_dir
/ndb/ndbcluster
",
["
--port=
$opt_ndbcluster_port
",
"
--port-base=
$ndbcluster_port_base
",
"
--data-dir=
$glob_mysql_test_dir
/var
",
$ndbcluster_opts
,
"
--initial
"],
"",
"",
"",
"")
)
{
mtr_error
("
Error ndbcluster_install
");
return
1
;
}
ndbcluster_stop
();
$master
->
[
0
]
->
{'
ndbcluster
'}
=
1
;
return
0
;
}
sub
ndbcluster_start
()
{
if
(
!
$opt_with_ndbcluster
or
$glob_use_running_ndbcluster
)
{
return
0
;
}
# FIXME, we want to _append_ output to file $file_ndb_testrun_log instead of /dev/null
if
(
mtr_run
("
$glob_mysql_test_dir
/ndb/ndbcluster
",
["
--port=
$opt_ndbcluster_port
",
"
--data-dir=
$glob_mysql_test_dir
/var
"],
"",
"
/dev/null
",
"",
"")
)
{
mtr_error
("
Error ndbcluster_install
");
return
1
;
}
return
0
;
}
sub
ndbcluster_stop
()
{
if
(
!
$opt_with_ndbcluster
or
$glob_use_running_ndbcluster
)
{
return
;
}
my
$ndbcluster_port_base
=
$opt_ndbcluster_port
+
2
;
# FIXME, we want to _append_ output to file $file_ndb_testrun_log instead of /dev/null
mtr_run
("
$glob_mysql_test_dir
/ndb/ndbcluster
",
["
--
data-dir=
$glob_mysql_test_dir
/var
",
"
--
port-base=
$opt_ndbcluster_port
",
["
--
port=
$opt_ndbcluster_port
",
"
--
data-dir=
$glob_mysql_test_dir
/var
",
"
--stop
"],
"",
"",
"",
"");
"",
"
/dev/null
",
"",
"");
return
;
}
...
...
@@ -1129,11 +1183,6 @@ sub run_suite () {
stop_masters_slaves
();
}
if
(
$opt_with_ndbcluster
and
!
$glob_use_running_ndbcluster
)
{
ndbcluster_stop
();
}
if
(
$opt_gcov
)
{
gcov_collect
();
# collect coverage information
...
...
@@ -1162,6 +1211,13 @@ sub mysql_install_db () {
install_db
('
slave
',
$slave
->
[
1
]
->
{'
path_myddir
'});
install_db
('
slave
',
$slave
->
[
2
]
->
{'
path_myddir
'});
if
(
ndbcluster_install
()
)
{
# failed to install, disable usage but flag that its no ok
$opt_with_ndbcluster
=
0
;
$flag_ndb_status_ok
=
0
;
}
return
0
;
}
...
...
@@ -1224,6 +1280,9 @@ sub run_testcase ($) {
mtr_tonewfile
(
$opt_current_test
,"
$tname
\n
");
# Always tell where we are
# output current test to ndbcluster log file to enable diagnostics
mtr_tofile
(
$file_ndb_testrun_log
,"
CURRENT TEST
$tname
\n
");
# ----------------------------------------------------------------------
# If marked to skip, just print out and return.
# Note that a test case not marked as 'skip' can still be
...
...
@@ -1297,6 +1356,15 @@ sub run_testcase ($) {
if
(
!
$opt_local_master
)
{
if
(
$master
->
[
0
]
->
{'
ndbcluster
'}
)
{
$master
->
[
0
]
->
{'
ndbcluster
'}
=
ndbcluster_start
();
if
(
$master
->
[
0
]
->
{'
ndbcluster
'}
)
{
report_failure_and_restart
(
$tinfo
);
return
;
}
}
if
(
!
$master
->
[
0
]
->
{'
pid
'}
)
{
$master
->
[
0
]
->
{'
pid
'}
=
...
...
@@ -1614,17 +1682,8 @@ sub mysqld_arguments ($$$$$) {
if
(
$opt_with_ndbcluster
)
{
mtr_add_arg
(
$args
,
"
%s--ndbcluster
",
$prefix
);
if
(
$glob_use_running_ndbcluster
)
{
mtr_add_arg
(
$args
,"
--ndb-connectstring=%s
",
$prefix
,
$opt_ndbconnectstring
);
}
else
{
mtr_add_arg
(
$args
,"
--ndb-connectstring=host=localhost:%d
",
$prefix
,
$opt_ndbcluster_port
);
}
mtr_add_arg
(
$args
,
"
%s--ndb-connectstring=%s
",
$prefix
,
$opt_ndbconnectstring
);
}
# FIXME always set nowdays??? SMALL_SERVER
...
...
@@ -1828,6 +1887,12 @@ sub stop_masters () {
}
}
if
(
!
$master
->
[
0
]
->
{'
ndbcluster
'}
)
{
ndbcluster_stop
();
$master
->
[
0
]
->
{'
ndbcluster
'}
=
1
;
}
mtr_stop_mysqld_servers
(
\
@args
);
}
...
...
@@ -1903,6 +1968,13 @@ sub run_mysqltest ($$) {
$ENV
{'
MYSQL_CLIENT_TEST
'}
=
$cmdline_mysql_client_test
;
$ENV
{'
CHARSETSDIR
'}
=
$path_charsetsdir
;
$ENV
{'
NDB_STATUS_OK
'}
=
$flag_ndb_status_ok
;
$ENV
{'
NDB_MGM
'}
=
$exe_ndb_mgm
;
$ENV
{'
NDB_BACKUP_DIR
'}
=
$path_ndb_backup_dir
;
$ENV
{'
NDB_TOOLS_DIR
'}
=
$path_ndb_tools_dir
;
$ENV
{'
NDB_TOOLS_OUTPUT
'}
=
$file_ndb_testrun_log
;
$ENV
{'
NDB_CONNECTSTRING
'}
=
$opt_ndbconnectstring
;
my
$exe
=
$exe_mysqltest
;
my
$args
;
...
...
mysql-test/r/group_by.result
View file @
57dee2ea
...
...
@@ -629,15 +629,6 @@ explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
DROP TABLE t1;
create table t1 ( col1 int, col2 int );
insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2);
select group_concat( distinct col1 ) as alias from t1
group by col2 having alias like '%';
alias
1,2
1,2
1
drop table t1;
create table t1 (a int);
insert into t1 values(null);
select min(a) is null from t1;
...
...
@@ -650,3 +641,39 @@ select 1 and min(a) is null from t1;
1 and min(a) is null
1
drop table t1;
create table t1 ( col1 int, col2 int );
insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2);
select group_concat( distinct col1 ) as alias from t1
group by col2 having alias like '%';
alias
1,2
1,2
1
drop table t1;
create table t1 (a integer, b integer, c integer);
insert into t1 (a,b) values (1,2),(1,3),(2,5);
select a, 0.1*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1;
a r2 r1
1 1.0 2
select a, rand()*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1;
a r2 r1
1 1 2
select a,sum(b) from t1 where a=1 group by c;
a sum(b)
1 5
select a*sum(b) from t1 where a=1 group by c;
a*sum(b)
5
select sum(a)*sum(b) from t1 where a=1 group by c;
sum(a)*sum(b)
10
select a,sum(b) from t1 where a=1 group by c having a=1;
a sum(b)
1 5
select a as d,sum(b) from t1 where a=1 group by c having d=1;
d sum(b)
1 5
select sum(a)*sum(b) as d from t1 where a=1 group by c having d > 0;
d
10
drop table t1;
mysql-test/r/sql_mode.result
View file @
57dee2ea
...
...
@@ -386,4 +386,18 @@ p mask example
20 \\\\% \\\\%
20 \\\\% \\\\_
DROP TABLE t1;
SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
a\\b a\\\"b a'\\b a'\\\"b
a\\b a\\\"b a'\\b a'\\\"b
SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
a\\b a\\\'b a"\\b a"\\\'b
a\\b a\\\'b a"\\b a"\\\'b
SET @@SQL_MODE='';
SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
a\b a\"b a'\b a'\"b
a\b a\"b a'\b a'\"b
SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
a\b a\'b a"\b a"\'b
a\b a\'b a"\b a"\'b
SET @@SQL_MODE=@OLD_SQL_MODE;
mysql-test/r/user_var.result
View file @
57dee2ea
...
...
@@ -113,8 +113,8 @@ select @a:=0;
select @a, @a:=@a+count(*), count(*), @a from t1 group by i;
@a @a:=@a+count(*) count(*) @a
0 1 1 0
0
2
2 0
0
3
3 0
0
3
2 0
0
6
3 0
select @a:=0;
@a:=0
0
...
...
mysql-test/t/group_by.test
View file @
57dee2ea
...
...
@@ -457,6 +457,14 @@ SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
explain
SELECT
i
,
COUNT
(
DISTINCT
(
i
))
FROM
t1
GROUP
BY
j
ORDER
BY
NULL
;
DROP
TABLE
t1
;
#Test for BUG#6976: Aggregate functions have incorrect NULL-ness
create
table
t1
(
a
int
);
insert
into
t1
values
(
null
);
select
min
(
a
)
is
null
from
t1
;
select
min
(
a
)
is
null
or
null
from
t1
;
select
1
and
min
(
a
)
is
null
from
t1
;
drop
table
t1
;
# Test for BUG#5400: GROUP_CONCAT returns everything twice.
create
table
t1
(
col1
int
,
col2
int
);
insert
into
t1
values
(
1
,
1
),(
1
,
2
),(
1
,
3
),(
2
,
1
),(
2
,
2
);
...
...
@@ -465,12 +473,18 @@ select group_concat( distinct col1 ) as alias from t1
drop
table
t1
;
#
# Test BUG#8216 when referring in HAVING to n alias which is rand() function
#
#Test for BUG#6976: Aggregate functions have incorrect NULL-ness
create
table
t1
(
a
int
);
insert
into
t1
values
(
null
);
select
min
(
a
)
is
null
from
t1
;
select
min
(
a
)
is
null
or
null
from
t1
;
select
1
and
min
(
a
)
is
null
from
t1
;
create
table
t1
(
a
integer
,
b
integer
,
c
integer
);
insert
into
t1
(
a
,
b
)
values
(
1
,
2
),(
1
,
3
),(
2
,
5
);
select
a
,
0.1
*
0
+
1
r2
,
sum
(
1
)
r1
from
t1
where
a
=
1
group
by
a
having
r1
>
1
and
r2
=
1
;
select
a
,
rand
()
*
0
+
1
r2
,
sum
(
1
)
r1
from
t1
where
a
=
1
group
by
a
having
r1
>
1
and
r2
=
1
;
select
a
,
sum
(
b
)
from
t1
where
a
=
1
group
by
c
;
select
a
*
sum
(
b
)
from
t1
where
a
=
1
group
by
c
;
select
sum
(
a
)
*
sum
(
b
)
from
t1
where
a
=
1
group
by
c
;
select
a
,
sum
(
b
)
from
t1
where
a
=
1
group
by
c
having
a
=
1
;
select
a
as
d
,
sum
(
b
)
from
t1
where
a
=
1
group
by
c
having
d
=
1
;
select
sum
(
a
)
*
sum
(
b
)
as
d
from
t1
where
a
=
1
group
by
c
having
d
>
0
;
drop
table
t1
;
mysql-test/t/sql_mode.test
View file @
57dee2ea
...
...
@@ -174,4 +174,14 @@ order by masks.p, example;
DROP
TABLE
t1
;
# Bug #6368: Make sure backslashes mixed with doubled quotes are handled
# correctly in NO_BACKSLASH_ESCAPES mode
SET
@@
SQL_MODE
=
'NO_BACKSLASH_ESCAPES'
;
SELECT
'a\\b'
,
'a\\\"b'
,
'a''\\b'
,
'a''\\\"b'
;
SELECT
"a
\\
b"
,
"a
\\
\'b"
,
"a""
\\
b"
,
"a""
\\
\'b"
;
SET
@@
SQL_MODE
=
''
;
SELECT
'a\\b'
,
'a\\\"b'
,
'a''\\b'
,
'a''\\\"b'
;
SELECT
"a
\\
b"
,
"a
\\
\'b"
,
"a""
\\
b"
,
"a""
\\
\'b"
;
SET
@@
SQL_MODE
=@
OLD_SQL_MODE
;
ndb/src/common/util/NdbSqlUtil.cpp
View file @
57dee2ea
...
...
@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <NdbSqlUtil.hpp>
#include <NdbOut.hpp>
int
NdbSqlUtil
::
char_compare
(
const
char
*
s1
,
unsigned
n1
,
...
...
@@ -858,6 +859,8 @@ NdbSqlUtil::strnxfrm_bug7284(CHARSET_INFO* cs, unsigned char* dst, unsigned dstL
int
n2
=
(
*
cs
->
coll
->
strnxfrm
)(
cs
,
xsp
,
sizeof
(
xsp
),
nsp
,
n1
);
if
(
n2
<=
0
)
return
-
1
;
// XXX bug workaround - strnxfrm may not write full string
memset
(
dst
,
0x0
,
dstLen
);
// strxfrm argument string - returns no error indication
int
n3
=
(
*
cs
->
coll
->
strnxfrm
)(
cs
,
dst
,
dstLen
,
src
,
srcLen
);
// pad with strxfrm-ed space chars
...
...
ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp
View file @
57dee2ea
...
...
@@ -250,7 +250,7 @@ Dbtux::readKeyAttrs(const Frag& frag, TreeEnt ent, unsigned start, Data keyData)
debugOut
<<
"readKeyAttrs:"
<<
endl
;
ConstData
data
=
keyData
;
Uint32
totalSize
=
0
;
for
(
Uint32
i
=
start
;
i
<
numAttrs
;
i
++
)
{
for
(
Uint32
i
=
start
;
i
<
frag
.
m_
numAttrs
;
i
++
)
{
Uint32
attrId
=
data
.
ah
().
getAttributeId
();
Uint32
dataSize
=
data
.
ah
().
getDataSize
();
debugOut
<<
i
<<
" attrId="
<<
attrId
<<
" size="
<<
dataSize
;
...
...
ndb/test/ndbapi/testOIBasic.cpp
View file @
57dee2ea
...
...
@@ -1812,14 +1812,16 @@ Val::calckeychars(Par par, unsigned i, unsigned& n, unsigned char* buf)
const
Chs
*
chs
=
col
.
m_chs
;
CHARSET_INFO
*
cs
=
chs
->
m_cs
;
n
=
0
;
// our random chars may not fill value exactly
while
(
n
+
cs
->
mbmaxlen
<=
col
.
m_byte
length
)
{
unsigned
len
=
0
;
while
(
len
<
col
.
m_
length
)
{
if
(
i
%
(
1
+
n
)
==
0
)
{
break
;
}
const
Chr
&
chr
=
chs
->
m_chr
[
i
%
maxcharcount
];
assert
(
n
+
chr
.
m_size
<=
col
.
m_bytelength
);
memcpy
(
buf
+
n
,
chr
.
m_bytes
,
chr
.
m_size
);
n
+=
chr
.
m_size
;
len
++
;
}
}
...
...
@@ -1884,8 +1886,8 @@ Val::calcnokeychars(Par par, unsigned& n, unsigned char* buf)
const
Chs
*
chs
=
col
.
m_chs
;
CHARSET_INFO
*
cs
=
chs
->
m_cs
;
n
=
0
;
// our random chars may not fill value exactly
while
(
n
+
cs
->
mbmaxlen
<=
col
.
m_byte
length
)
{
unsigned
len
=
0
;
while
(
len
<
col
.
m_
length
)
{
if
(
urandom
(
1
+
col
.
m_bytelength
)
==
0
)
{
break
;
}
...
...
@@ -1898,8 +1900,10 @@ Val::calcnokeychars(Par par, unsigned& n, unsigned char* buf)
unsigned
i
=
half
+
r
;
assert
(
i
<
maxcharcount
);
const
Chr
&
chr
=
chs
->
m_chr
[
i
];
assert
(
n
+
chr
.
m_size
<=
col
.
m_bytelength
);
memcpy
(
buf
+
n
,
chr
.
m_bytes
,
chr
.
m_size
);
n
+=
chr
.
m_size
;
len
++
;
}
}
...
...
scripts/mysqld_safe.sh
View file @
57dee2ea
...
...
@@ -23,6 +23,29 @@ case "$1" in
;;
esac
usage
()
{
cat
<<
EOF
Usage:
$0
[OPTIONS]
--no-defaults Don't read the system defaults file
--defaults-file=FILE Use the specified defaults file
--defaults-extra-file=FILE Also use defaults from the specified file
--ledir=DIRECTORY Look for mysqld in the specified directory
--log-error=FILE Log errors to the specified log file
--open-files-limit=LIMIT Limit the number of open files
--core-file-size=LIMIT Limit core files to the specified size
--timezone=TZ Set the system timezone
--mysqld=FILE Use the specified file as mysqld
--mysqld-version=VERSION Use "mysqld-VERSION" as mysqld
--nice=NICE Set the scheduling priority of mysqld
--skip-kill-mysqld Don't try to kill stray mysqld processes
All other options are passed to the mysqld program.
EOF
exit
1
}
parse_arguments
()
{
# We only need to pass arguments through to the server if we don't
# handle them here. So, we collect unrecognized options (passed on
...
...
@@ -67,6 +90,9 @@ parse_arguments() {
fi
;;
--nice
=
*
)
niceness
=
`
echo
"
$arg
"
|
sed
-e
"s;--nice=;;"
`
;;
--help
)
usage
;;
*
)
if
test
-n
"
$pick_args
"
then
...
...
sql/ha_innodb.cc
View file @
57dee2ea
...
...
@@ -5771,7 +5771,7 @@ ha_innobase::store_lock(
{
row_prebuilt_t
*
prebuilt
=
(
row_prebuilt_t
*
)
innobase_prebuilt
;
if
((
lock_type
==
TL_READ
&&
thd
->
in_lock_tables
)
||
if
((
lock_type
==
TL_READ
&&
thd
->
in_lock_tables
)
||
(
lock_type
==
TL_READ_HIGH_PRIORITY
&&
thd
->
in_lock_tables
)
||
lock_type
==
TL_READ_WITH_SHARED_LOCKS
||
lock_type
==
TL_READ_NO_INSERT
||
...
...
@@ -5794,8 +5794,27 @@ ha_innobase::store_lock(
unexpected if an obsolete consistent read view would be
used. */
prebuilt
->
select_lock_type
=
LOCK_S
;
prebuilt
->
stored_select_lock_type
=
LOCK_S
;
if
(
srv_locks_unsafe_for_binlog
&&
prebuilt
->
trx
->
isolation_level
!=
TRX_ISO_SERIALIZABLE
&&
(
lock_type
==
TL_READ
||
lock_type
==
TL_READ_NO_INSERT
)
&&
thd
->
lex
->
sql_command
!=
SQLCOM_SELECT
&&
thd
->
lex
->
sql_command
!=
SQLCOM_UPDATE_MULTI
&&
thd
->
lex
->
sql_command
!=
SQLCOM_DELETE_MULTI
)
{
/* In case we have innobase_locks_unsafe_for_binlog
option set and isolation level of the transaction
is not set to serializable and MySQL is doing
INSERT INTO...SELECT without FOR UPDATE or IN
SHARE MODE we use consistent read for select.
Similarly, in case of DELETE...SELECT and
UPDATE...SELECT when these are not multi table.*/
prebuilt
->
select_lock_type
=
LOCK_NONE
;
prebuilt
->
stored_select_lock_type
=
LOCK_NONE
;
}
else
{
prebuilt
->
select_lock_type
=
LOCK_S
;
prebuilt
->
stored_select_lock_type
=
LOCK_S
;
}
}
else
if
(
lock_type
!=
TL_IGNORE
)
{
...
...
@@ -6181,8 +6200,9 @@ innobase_query_is_update(void)
/***********************************************************************
This function is used to prepare X/Open XA distributed transaction */
int
innobase_xa_prepare
(
/*====================*/
int
innobase_xa_prepare
(
/*================*/
/* out: 0 or error number */
THD
*
thd
,
/* in: handle to the MySQL thread of the user
whose XA transaction should be prepared */
...
...
@@ -6245,12 +6265,13 @@ int innobase_xa_prepare(
/***********************************************************************
This function is used to recover X/Open XA distributed transactions */
int
innobase_xa_recover
(
int
innobase_xa_recover
(
/*================*/
/* out: number of prepared transactions
stored in xid_list */
XID
*
xid_list
,
/* in/out: prepared transactions */
uint
len
)
/* in: number of slots in xid_list */
/*====================*/
{
if
(
len
==
0
||
xid_list
==
NULL
)
{
return
0
;
...
...
@@ -6263,8 +6284,9 @@ int innobase_xa_recover(
This function is used to commit one X/Open XA distributed transaction
which is in the prepared state */
int
innobase_commit_by_xid
(
/*=======================*/
int
innobase_commit_by_xid
(
/*===================*/
/* out: 0 or error number */
XID
*
xid
)
/* in: X/Open XA Transaction Identification */
{
...
...
@@ -6285,7 +6307,9 @@ int innobase_commit_by_xid(
This function is used to rollback one X/Open XA distributed transaction
which is in the prepared state */
int
innobase_rollback_by_xid
(
int
innobase_rollback_by_xid
(
/*=====================*/
/* out: 0 or error number */
XID
*
xid
)
/* in : X/Open XA Transaction Idenfification */
{
...
...
@@ -6300,36 +6324,4 @@ int innobase_rollback_by_xid(
}
}
/***********************************************************************
This function is used to test commit/rollback of XA transactions */
int
innobase_xa_end
(
/*================*/
THD
*
thd
)
/* in: MySQL thread handle of the user for whom
transactions should be recovered */
{
DBUG_ENTER
(
"innobase_xa_end"
);
XID
trx_list
[
100
];
int
trx_num
,
trx_num_max
=
100
;
int
i
;
XID
xid
;
while
((
trx_num
=
innobase_xa_recover
(
trx_list
,
trx_num_max
)))
{
for
(
i
=
0
;
i
<
trx_num
;
i
++
)
{
xid
=
trx_list
[
i
];
if
(
i
%
2
)
{
innobase_commit_by_xid
(
&
xid
);
}
else
{
innobase_rollback_by_xid
(
&
xid
);
}
}
}
free
(
trx_list
);
DBUG_RETURN
(
0
);
}
#endif
/* HAVE_INNOBASE_DB */
sql/item.cc
View file @
57dee2ea
...
...
@@ -3069,6 +3069,10 @@ void Item_ref::set_properties()
maybe_null
=
(
*
ref
)
->
maybe_null
;
decimals
=
(
*
ref
)
->
decimals
;
collation
.
set
((
*
ref
)
->
collation
);
/*
We have to remember if we refer to a sum function, to ensure that
split_sum_func() doesn't try to change the reference.
*/
with_sum_func
=
(
*
ref
)
->
with_sum_func
;
if
((
*
ref
)
->
type
()
==
FIELD_ITEM
)
alias_name_used
=
((
Item_ident
*
)
(
*
ref
))
->
alias_name_used
;
...
...
sql/item_cmpfunc.cc
View file @
57dee2ea
...
...
@@ -2029,6 +2029,35 @@ Item *Item_cond::transform(Item_transformer transformer, byte *arg)
}
/*
Move SUM items out from item tree and replace with reference
SYNOPSIS
split_sum_func()
thd Thread handler
ref_pointer_array Pointer to array of reference fields
fields All fields in select
NOTES
This function is run on all expression (SELECT list, WHERE, HAVING etc)
that have or refer (HAVING) to a SUM expression.
The split is done to get an unique item for each SUM function
so that we can easily find and calculate them.
(Calculation done by update_sum_func() and copy_sum_funcs() in
sql_select.cc)
All found SUM items are added FIRST in the fields list and
we replace the item with a reference.
We also replace all functions without side effects (like RAND() or UDF's)
that uses columns as arguments.
For functions with side effects, we just remember any fields referred
by the function to ensure that we get a copy of the field value for the
first accepted row. This ensures that we can do things like
SELECT a*SUM(b) FROM t1 WHERE a=1
*/
void
Item_cond
::
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
{
...
...
@@ -2038,10 +2067,22 @@ void Item_cond::split_sum_func(THD *thd, Item **ref_pointer_array,
const_item_cache
=
1
;
while
((
item
=
li
++
))
{
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
SUM_FUNC_ITEM
)
/* with_sum_func is set for items that contains a SUM expression */
if
(
item
->
type
()
!=
SUM_FUNC_ITEM
&&
(
item
->
with_sum_func
||
(
item
->
used_tables
()
&
PSEUDO_TABLE_BITS
)))
item
->
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
else
if
(
item
->
used_tables
()
||
item
->
type
()
==
SUM_FUNC_ITEM
)
else
if
(
item
->
type
()
==
SUM_FUNC_ITEM
||
(
item
->
used_tables
()
&&
item
->
type
()
!=
REF_ITEM
))
{
/*
Replace item with a reference so that we can easily calculate
it (in case of sum functions) or copy it (in case of fields)
The test above is to ensure we don't do a reference for things
that are constants or are not yet calculated as in:
SELECT RAND() as r1, SUM(a) as r2 FROM t1 HAVING r1 > 1 AND r2 > 0
*/
Item
**
ref
=
li
.
ref
();
uint
el
=
fields
.
elements
;
ref_pointer_array
[
el
]
=
item
;
...
...
sql/item_func.cc
View file @
57dee2ea
...
...
@@ -356,6 +356,7 @@ bool Item_func::walk (Item_processor processor, byte *argument)
}
/*
Transform an Item_func object with a transformer callback function
...
...
@@ -402,9 +403,12 @@ void Item_func::split_sum_func(THD *thd, Item **ref_pointer_array,
for
(
arg
=
args
,
arg_end
=
args
+
arg_count
;
arg
!=
arg_end
;
arg
++
)
{
Item
*
item
=*
arg
;
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
SUM_FUNC_ITEM
)
if
(
item
->
type
()
!=
SUM_FUNC_ITEM
&&
(
item
->
with_sum_func
||
(
item
->
used_tables
()
&
PSEUDO_TABLE_BITS
)))
item
->
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
else
if
(
item
->
used_tables
()
||
item
->
type
()
==
SUM_FUNC_ITEM
)
else
if
(
item
->
type
()
==
SUM_FUNC_ITEM
||
(
item
->
used_tables
()
&&
item
->
type
()
!=
REF_ITEM
))
{
uint
el
=
fields
.
elements
;
ref_pointer_array
[
el
]
=
item
;
...
...
sql/item_row.cc
View file @
57dee2ea
...
...
@@ -84,15 +84,20 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref)
return
FALSE
;
}
void
Item_row
::
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
{
Item
**
arg
,
**
arg_end
;
for
(
arg
=
items
,
arg_end
=
items
+
arg_count
;
arg
!=
arg_end
;
arg
++
)
{
if
((
*
arg
)
->
with_sum_func
&&
(
*
arg
)
->
type
()
!=
SUM_FUNC_ITEM
)
(
*
arg
)
->
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
else
if
((
*
arg
)
->
used_tables
()
||
(
*
arg
)
->
type
()
==
SUM_FUNC_ITEM
)
Item
*
item
=
*
arg
;
if
(
item
->
type
()
!=
SUM_FUNC_ITEM
&&
(
item
->
with_sum_func
||
(
item
->
used_tables
()
&
PSEUDO_TABLE_BITS
)))
item
->
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
else
if
(
item
->
type
()
==
SUM_FUNC_ITEM
||
(
item
->
used_tables
()
&&
item
->
type
()
!=
REF_ITEM
))
{
uint
el
=
fields
.
elements
;
ref_pointer_array
[
el
]
=*
arg
;
...
...
sql/item_strfunc.cc
View file @
57dee2ea
...
...
@@ -1776,9 +1776,12 @@ String *Item_func_elt::val_str(String *str)
void
Item_func_make_set
::
split_sum_func
(
THD
*
thd
,
Item
**
ref_pointer_array
,
List
<
Item
>
&
fields
)
{
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
SUM_FUNC_ITEM
)
if
(
item
->
type
()
!=
SUM_FUNC_ITEM
&&
(
item
->
with_sum_func
||
(
item
->
used_tables
()
&
PSEUDO_TABLE_BITS
)))
item
->
split_sum_func
(
thd
,
ref_pointer_array
,
fields
);
else
if
(
item
->
used_tables
()
||
item
->
type
()
==
SUM_FUNC_ITEM
)
else
if
(
item
->
type
()
==
SUM_FUNC_ITEM
||
(
item
->
used_tables
()
&&
item
->
type
()
!=
REF_ITEM
))
{
uint
el
=
fields
.
elements
;
ref_pointer_array
[
el
]
=
item
;
...
...
sql/mysqld.cc
View file @
57dee2ea
...
...
@@ -3376,39 +3376,34 @@ int main(int argc, char **argv)
return
0
;
}
}
else
if
(
argc
>=
4
)
else
if
(
argc
==
4
||
argc
==
5
)
{
const
char
*
defaults_file
=
"--defaults-file"
;
const
char
*
service
=
"--local-service"
;
char
extra_opt
[
FN_REFLEN
]
=
""
;
/*
This may seem strange, because we handle --local-service while
preserving 4.1's behavior of allowing any one other argument that is
passed to the service on startup. (The assumption is that this is
--defaults-file=file, but that was not enforced in 4.1, so we don't
enforce it here.)
*/
char
*
extra_opt
=
NULL
;
char
*
account_name
=
NULL
;
char
*
option
;
int
index
;
for
(
index
=
3
;
index
<
argc
;
index
++
)
{
option
=
argv
[
index
];
/*
Install an optional service with optional config file
mysqld --install-manual mysqldopt --defaults-file=c:\miguel\my.ini
*/
if
(
strncmp
(
option
,
defaults_file
,
strlen
(
defaults_file
))
==
0
)
if
(
strncmp
(
argv
[
index
],
"--local-service"
,
15
)
==
0
)
{
strmov
(
extra_opt
,
option
);
account_name
=
(
char
*
)
malloc
(
27
);
strmov
(
account_name
,
"NT AUTHORITY
\\
LocalService
\0
"
);
}
else
/*
Install an optional service as local service
mysqld --install-manual mysqldopt --local-service
*/
if
(
strncmp
(
option
,
service
,
strlen
(
service
))
==
0
)
{
account_name
=
(
char
*
)
malloc
(
27
);
strmov
(
account_name
,
"NT AUTHORITY
\\
LocalService
\0
"
);
extra_opt
=
argv
[
index
];
}
}
if
(
!
default_service_handling
(
argv
,
argv
[
2
],
argv
[
2
],
file_path
,
extra_opt
,
account_name
))
return
0
;
if
(
argc
!=
5
||
account_name
)
if
(
!
default_service_handling
(
argv
,
argv
[
2
],
argv
[
2
],
file_path
,
extra_opt
,
account_name
))
return
0
;
}
else
if
(
argc
==
1
&&
Service
.
IsService
(
MYSQL_SERVICENAME
))
{
...
...
sql/sql_lex.cc
View file @
57dee2ea
...
...
@@ -337,7 +337,8 @@ static char *get_text(LEX *lex)
continue
;
}
#endif
if
(
*
str
==
'\\'
&&
str
+
1
!=
end
)
if
(
!
(
lex
->
thd
->
variables
.
sql_mode
&
MODE_NO_BACKSLASH_ESCAPES
)
&&
*
str
==
'\\'
&&
str
+
1
!=
end
)
{
switch
(
*++
str
)
{
case
'n'
:
...
...
sql/unireg.h
View file @
57dee2ea
...
...
@@ -77,6 +77,8 @@
#define PARAM_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-3))
#define OUTER_REF_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-2))
#define RAND_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-1))
#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
RAND_TABLE_BIT)
#define MAX_FIELDS 4096
/* Limit in the .frm file */
#define MAX_SORT_MEMORY (2048*1024-MALLOC_OVERHEAD)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment