Merge remote-tracking branch 'mysql/5.5' into 5.5

This commit is contained in:
Sergei Golubchik 2015-10-08 22:54:24 +02:00
commit 82e9f6d948
73 changed files with 890 additions and 253 deletions

View file

@ -1,4 +1,4 @@
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
#
# 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
@ -47,6 +47,7 @@ MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c)
TARGET_LINK_LIBRARIES(mysqldump mysqlclient)
MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c)
SET_SOURCE_FILES_PROPERTIES(mysqlimport.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient)
MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c COMPONENT Server)

View file

@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2011, 2015, MariaDB
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
@ -30,19 +31,14 @@
#include "client_priv.h"
#include "mysql_version.h"
#ifdef HAVE_LIBPTHREAD
#include <my_pthread.h>
#endif
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
/* Global Thread counter */
uint counter;
#ifdef HAVE_LIBPTHREAD
pthread_mutex_t counter_mutex;
pthread_cond_t count_threshhold;
#endif
static void db_error_with_table(MYSQL *mysql, char *table);
static void db_error(MYSQL *mysql);
@ -568,7 +564,6 @@ static char *field_escape(char *to,const char *from,uint length)
int exitcode= 0;
#ifdef HAVE_LIBPTHREAD
pthread_handler_t worker_thread(void *arg)
{
int error;
@ -608,7 +603,6 @@ error:
return 0;
}
#endif
int main(int argc, char **argv)
@ -628,7 +622,6 @@ int main(int argc, char **argv)
}
sf_leaking_memory=0; /* from now on we cleanup properly */
#ifdef HAVE_LIBPTHREAD
if (opt_use_threads && !lock_tables)
{
pthread_t mainthread; /* Thread descriptor */
@ -682,7 +675,6 @@ int main(int argc, char **argv)
pthread_attr_destroy(&attr);
}
else
#endif
{
MYSQL *mysql= 0;
if (!(mysql= db_connect(current_host,current_db,current_user,opt_password)))

View file

@ -1,4 +1,4 @@
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
#
# 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
@ -50,10 +50,12 @@ IF(CMAKE_C_COMPILER MATCHES "icl")
SET(MSVC TRUE)
ENDIF()
ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE")
ADD_DEFINITIONS("-D_WIN32_WINNT=0x0501")
ADD_DEFINITIONS(-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE)
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501)
# We do not want the windows.h macros min/max
ADD_DEFINITIONS(-DNOMINMAX)
# Speed up build process excluding unused header files
ADD_DEFINITIONS("-DWIN32_LEAN_AND_MEAN")
ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN)
# Adjust compiler and linker flags
IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4)

View file

@ -12,6 +12,35 @@ before calling SSL_new();
*** end Note ***
yaSSL Release notes, version 2.3.8 (9/17/2015)
This release of yaSSL fixes a high security vulnerability. All users
SHOULD update. If using yaSSL for TLS on the server side with private
RSA keys allowing ephemeral key exchange you MUST update and regenerate
the RSA private keys. This report is detailed in:
https://people.redhat.com/~fweimer/rsa-crt-leaks.pdf
yaSSL now detects RSA signature faults and returns an error.
yaSSL Patch notes, version 2.3.7e (6/26/2015)
This release of yaSSL includes a fix for Date less than comparison.
Previously yaSSL would return true on less than comparisons if the Dates
were equal. Reported by Oracle. No security problem, but if a cert was
generated right now, a server started using it in the same second, and a
client tried to verify it in the same second it would report not yet valid.
yaSSL Patch notes, version 2.3.7d (6/22/2015)
This release of yaSSL includes a fix for input_buffer set_current with
index 0. SSL_peek() at front of waiting data could trigger. Robert
Golebiowski of Oracle identified and suggested a fix, thanks!
yaSSL Patch notes, version 2.3.7c (6/12/2015)
This release of yaSSL does certificate DATE comparisons to the second
instead of to the minute, helpful when using freshly generated certs.
Though keep in mind that time sync differences could still show up.
yaSSL Patch notes, version 2.3.7b (3/18/2015)
This release of yaSSL fixes a potential crash with corrupted private keys.
Also detects bad keys earlier for user.
yaSSL Release notes, version 2.3.7 (12/10/2014)
This release of yaSSL fixes the potential to process duplicate handshake
messages by explicitly marking/checking received handshake messages.

View file

@ -35,7 +35,7 @@
#include "rsa.h"
#define YASSL_VERSION "2.3.7"
#define YASSL_VERSION "2.3.8"
#if defined(__cplusplus)

View file

@ -53,7 +53,8 @@ enum YasslError {
compress_error = 118,
decompress_error = 119,
pms_version_error = 120,
sanityCipher_error = 121
sanityCipher_error = 121,
rsaSignFault_error = 122
// !!!! add error message to .cpp !!!!

View file

@ -165,7 +165,7 @@ void input_buffer::set_error()
void input_buffer::set_current(uint i)
{
if (error_ == 0 && (i == 0 || check(i - 1, size_) == 0))
if (error_ == 0 && check(i ? i - 1 : 0, size_) == 0)
current_ = i;
else
error_ = -1;

View file

@ -1172,6 +1172,8 @@ void sendCertificateVerify(SSL& ssl, BufferOutput buffer)
CertificateVerify verify;
verify.Build(ssl);
if (ssl.GetError()) return;
RecordLayerHeader rlHeader;
HandShakeHeader hsHeader;
mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer);

View file

@ -37,6 +37,8 @@
#include "file.hpp" // for TaoCrypt Source
#include "coding.hpp" // HexDecoder
#include "helpers.hpp" // for placement new hack
#include "rsa.hpp" // for TaoCrypt RSA key decode
#include "dsa.hpp" // for TaoCrypt DSA key decode
#include <stdio.h>
#ifdef _WIN32
@ -54,6 +56,8 @@ namespace yaSSL {
int read_file(SSL_CTX* ctx, const char* file, int format, CertType type)
{
int ret = SSL_SUCCESS;
if (format != SSL_FILETYPE_ASN1 && format != SSL_FILETYPE_PEM)
return SSL_BAD_FILETYPE;
@ -141,8 +145,31 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type)
}
}
}
if (type == PrivateKey && ctx->privateKey_) {
// see if key is valid early
TaoCrypt::Source rsaSource(ctx->privateKey_->get_buffer(),
ctx->privateKey_->get_length());
TaoCrypt::RSA_PrivateKey rsaKey;
rsaKey.Initialize(rsaSource);
if (rsaSource.GetError().What()) {
// rsa failed see if DSA works
TaoCrypt::Source dsaSource(ctx->privateKey_->get_buffer(),
ctx->privateKey_->get_length());
TaoCrypt::DSA_PrivateKey dsaKey;
dsaKey.Initialize(dsaSource);
if (rsaSource.GetError().What()) {
// neither worked
ret = SSL_FAILURE;
}
}
}
fclose(input);
return SSL_SUCCESS;
return ret;
}

View file

@ -148,6 +148,10 @@ void SetErrorString(YasslError error, char* buffer)
strncpy(buffer, "sanity check on cipher text size error", max);
break;
case rsaSignFault_error:
strncpy(buffer, "rsa signature fault error", max);
break;
// openssl errors
case SSL_ERROR_WANT_READ :
strncpy(buffer, "the read operation would block", max);

View file

@ -196,9 +196,16 @@ void DH_Server::build(SSL& ssl)
sha.update(tmp.get_buffer(), tmp.get_size());
sha.get_digest(&hash[MD5_LEN]);
if (ssl.getSecurity().get_parms().sig_algo_ == rsa_sa_algo)
if (ssl.getSecurity().get_parms().sig_algo_ == rsa_sa_algo) {
auth->sign(signature_, hash, sizeof(hash),
ssl.getCrypto().get_random());
// check for rsa signautre fault
if (!auth->verify(hash, sizeof(hash), signature_,
auth->get_signatureLength())) {
ssl.SetError(rsaSignFault_error);
return;
}
}
else {
auth->sign(signature_, &hash[MD5_LEN], SHA_LEN,
ssl.getCrypto().get_random());
@ -2159,6 +2166,12 @@ void CertificateVerify::Build(SSL& ssl)
memcpy(sig.get(), len, VERIFY_HEADER);
rsa.sign(sig.get() + VERIFY_HEADER, hashes_.md5_, sizeof(Hashes),
ssl.getCrypto().get_random());
// check for rsa signautre fault
if (!rsa.verify(hashes_.md5_, sizeof(Hashes), sig.get() + VERIFY_HEADER,
rsa.get_cipherLength())) {
ssl.SetError(rsaSignFault_error);
return;
}
}
else { // DSA
DSS dss(cert.get_privateKey(), cert.get_privateKeyLength(), false);

View file

@ -39,7 +39,7 @@ namespace TaoCrypt {
namespace { // locals
// to the minute
// to the second
bool operator>(tm& a, tm& b)
{
if (a.tm_year > b.tm_year)
@ -60,13 +60,18 @@ bool operator>(tm& a, tm& b)
a.tm_min > b.tm_min)
return true;
if (a.tm_year == b.tm_year && a.tm_mon == b.tm_mon &&
a.tm_mday == b.tm_mday && a.tm_hour == b.tm_hour &&
a.tm_min == b.tm_min && a.tm_sec > b.tm_sec)
return true;
return false;
}
bool operator<(tm& a, tm&b)
{
return !(a>b);
return (b>a);
}

View file

@ -140,6 +140,10 @@ word32 RSA_BlockType2::UnPad(const byte *pkcsBlock, unsigned int pkcsBlockLen,
void RSA_BlockType1::Pad(const byte* input, word32 inputLen, byte* pkcsBlock,
word32 pkcsBlockLen, RandomNumberGenerator&) const
{
// sanity checks
if (input == NULL || pkcsBlock == NULL)
return;
// convert from bit length to byte length
if (pkcsBlockLen % 8 != 0)
{

View file

@ -4,6 +4,7 @@
#
no_pid=-1
server_pid=$no_pid

View file

@ -93,3 +93,30 @@ a b
216 !&bb b;
3 !b3
DROP TABLE t1;
#
# Bug#16171518 LOAD XML DOES NOT HANDLE EMPTY ELEMENTS
#
CREATE TABLE t1 (col1 VARCHAR(3), col2 VARCHAR(3), col3 VARCHAR(3), col4 VARCHAR(4));
LOAD XML INFILE '../../std_data/bug16171518_1.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY col1, col2, col3, col4;
col1 col2 col3 col4
0bc def ghi jkl
1no NULL pqr stu
2BC DEF GHI JKL
3NO NULL PQR STU
4bc def ghi jkl
5no pqr stu vwx
6BC DEF NULL JKL
7NO PQR STU VWX
8bc def ghi NULL
9kl NULL mno pqr
ABC DEF NULL JKL
MNO NULL STU VWX
DROP TABLE t1;
CREATE TABLE t1 (col1 VARCHAR(3), col2 VARCHAR(3), col3 INTEGER);
LOAD XML INFILE '../../std_data/bug16171518_2.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY col1, col2, col3;
col1 col2 col3
ABC DEF NULL
GHI NULL 123
DROP TABLE t1;

View file

@ -0,0 +1,3 @@
#
# Bug#20198490 : LOWER_CASE_TABLE_NAMES=0 ON WINDOWS LEADS TO PROBLEMS
#

View file

@ -1,11 +0,0 @@
call mtr.add_suppression("Cannot find or open table test/BUG29839 from");
DROP TABLE IF EXISTS t1,T1;
CREATE TABLE t1 (a INT);
SELECT * FROM T1;
a
FLUSH TABLES;
DROP TABLE t1;
CREATE TABLE bug29839 (a INT) ENGINE=INNODB;
SELECT * FROM BUG29839;
ERROR 42S02: Table 'test.BUG29839' doesn't exist
DROP TABLE bug29839;

View file

@ -4292,7 +4292,6 @@ Abernathy
aberrant
aberration
drop table words;
mysqlimport: Error: 1146, Table 'test.words' doesn't exist, when using table: words
drop table t1;
drop table t2;
drop table words2;
@ -5281,6 +5280,34 @@ drop table t1, t2;
#
# End of 5.1 tests
#
#
# Bug #20772273 : MYSQLIMPORT --USE-THREADS DOESN'T USE MULTIPLE THREADS
#
CREATE DATABASE db_20772273;
USE db_20772273;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1), (2);
CREATE TABLE t2(a INT);
INSERT INTO t2 VALUES (3), (4);
SELECT * FROM t1;
a
1
2
SELECT * FROM t2;
a
3
4
SELECT * FROM t1;
a
1
2
SELECT * FROM t2;
a
3
4
DROP TABLE t1;
DROP TABLE t2;
DROP DATABASE db_20772273;
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]

View file

@ -1089,7 +1089,7 @@ partition by key (a)
subpartition by hash (sin(a+b))
(partition x1 (subpartition x11, subpartition x12),
partition x2 (subpartition x21, subpartition x22));
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
ERROR HY000: This partition function is not allowed
select load_file('$MYSQLD_DATADIR/test/t1.par');
load_file('$MYSQLD_DATADIR/test/t1.par')
NULL

View file

@ -81,7 +81,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;

View file

@ -88,7 +88,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;

View file

@ -84,7 +84,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;

View file

@ -87,7 +87,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;

View file

@ -84,7 +84,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;

View file

@ -561,6 +561,21 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function
DROP VIEW v1;
DROP FUNCTION f1;
DROP TABLE t1;
# Bug #21143080: UPDATE ON VARCHAR AND TEXT COLUMNS PRODUCE INCORRECT
# RESULTS
CREATE TABLE t1 (a VARCHAR(50), b TEXT, c CHAR(50)) ENGINE=INNODB;
INSERT INTO t1 (a, b, c) VALUES ('start trail', '', 'even longer string');
UPDATE t1 SET b = a, a = 'inject';
SELECT a, b FROM t1;
a b
inject start trail
UPDATE t1 SET b = c, c = 'inject';
SELECT c, b FROM t1;
c b
inject even longer string
DROP TABLE t1;
#
# MDEV-3948 Assertion `records_are_comparable(table)' fails in compare_record(const TABLE*) on UPDATE with simple AND condition, index_merge+index_merge_intersection, InnoDB
#
# Verify that UPDATE does the same number of handler_update
# operations, no matter if there is ORDER BY or not.

View file

@ -4830,6 +4830,41 @@ View Create View character_set_client collation_connection
v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS (select 'BUG#14117018' AS `col1`) union all (select '' AS `col2`) union all (select '' AS `Name_exp_1`) latin1 latin1_swedish_ci
DROP VIEW v1, v2, v3, v4, v5;
#
# BUG#19886430: VIEW CREATION WITH NAMED COLUMNS, OVER UNION,
# IS REJECTED
# Without the patch, reports an error.
CREATE VIEW v1 (fld1, fld2) AS
SELECT 1 AS a, 2 AS b
UNION ALL
SELECT 1 AS a, 1 AS a;
# The column names are explicitly specified and not duplicates, hence
# succeeds.
CREATE VIEW v2 (fld1, fld2) AS
SELECT 1 AS a, 2 AS a
UNION ALL
SELECT 1 AS a, 1 AS a;
# The column name in the first SELECT are not duplicates, hence succeeds.
CREATE VIEW v3 AS
SELECT 1 AS a, 2 AS b
UNION ALL
SELECT 1 AS a, 1 AS a;
# Should report an error, since the explicitly specified column names are
# duplicates.
CREATE VIEW v4 (fld1, fld1) AS
SELECT 1 AS a, 2 AS b
UNION ALL
SELECT 1 AS a, 1 AS a;
ERROR 42S21: Duplicate column name 'fld1'
# Should report an error, since duplicate column name is specified in the
# First SELECT.
CREATE VIEW v4 AS
SELECT 1 AS a, 2 AS a
UNION ALL
SELECT 1 AS a, 1 AS a;
ERROR 42S21: Duplicate column name 'a'
# Cleanup
DROP VIEW v1, v2, v3;
#
# lp:833600 Wrong result with view + outer join + uncorrelated subquery (non-semijoin)
#
CREATE TABLE t1 ( a int, b int );

View file

@ -0,0 +1,59 @@
<test_rows>
<row>
<col1>0bc</col1>
<col2>def</col2>
<col3>ghi</col3>
<col4>jkl</col4>
</row>
<row>
<col1>1no</col1>
<col2/>
<col3>pqr</col3>
<col4>stu</col4>
</row>
<row>
<col1>2BC</col1>
<col2>DEF</col2>
<col3>GHI</col3>
<col4>JKL</col4>
</row>
<row>
<col1>3NO</col1>
<col2 />
<col3>PQR</col3>
<col4>STU</col4>
</row>
<row col1="4bc" col2="def" col3="ghi" col4="jkl"/>
<row col1="5no" col2="pqr" col3="stu" col4="vwx" />
<row>
<field name='col1'>6BC</field>
<field name='col2'>DEF</field>
<field name='col3'></field>
<field name='col4'>JKL</field>
</row>
<row>
<field name='col1'>7NO</field>
<field name='col2'>PQR</field>
<field name='col3'>STU</field>
<field name='col4'>VWX</field>
</row>
<row>
<col1>8bc</col1>
<col2>def</col2>
<col3>ghi</col3>
<col4 />
</row>
<row>
<col1>9kl</col1>
<col2/>
<col3>mno</col3>
<col4>pqr</col4>
</row>
<row col1="ABC" col2="DEF" col3="" col4="JKL"/>
<row col1="MNO" col2="" col3="STU" col4="VWX"/>
</test_rows>

View file

@ -0,0 +1,12 @@
<test_rows>
<row>
<col1>ABC</col1>
<col2>DEF</col2>
<col3 />
</row>
<row>
<col1>GHI</col1>
<col2 />
<col3>123</col3>
</row>
</test_rows>

View file

@ -1 +0,0 @@
--lower_case_table_names=0

View file

@ -2,6 +2,10 @@
# Bug #13083023 - 60229: BROKEN COMPATIBILITY: ERROR WHILE CREATE TABLE
# WITH FOREIGN KEY CONSTRAINT.
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
-- source include/have_innodb.inc
CREATE TABLE PERSON (

View file

@ -1 +0,0 @@
--lower_case_table_names=0

View file

@ -1,3 +1,7 @@
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
--source include/have_sjis.inc
--source include/have_innodb.inc
--character_set sjis

View file

@ -1 +0,0 @@
--lower_case_table_names=0

View file

@ -1,3 +1,7 @@
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
--source include/have_ucs2.inc
--source include/have_innodb.inc

View file

@ -1 +0,0 @@
--lower_case_table_names=0

View file

@ -1,3 +1,7 @@
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
--source include/have_ujis.inc
--source include/have_innodb.inc

View file

@ -1 +0,0 @@
--lower_case_table_names=0

View file

@ -1,3 +1,7 @@
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
--source include/have_utf8.inc
--source include/have_innodb.inc
--disable_warnings

View file

@ -38,7 +38,7 @@ spins
NULL
select * from performance_schema.setup_timers where name='wait';
NAME TIMER_NAME
wait CYCLE
wait {CYCLE_OR_NANOSECOND}
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
@ -53,7 +53,7 @@ spins
NULL
select * from performance_schema.setup_timers where name='wait';
NAME TIMER_NAME
wait CYCLE
wait {CYCLE_OR_NANOSECOND}
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1

View file

@ -34,6 +34,7 @@ show status like "Qcache_hits";
select spins from performance_schema.events_waits_current order by event_name limit 1;
--replace_result CYCLE {CYCLE_OR_NANOSECOND} NANOSECOND {CYCLE_OR_NANOSECOND}
select * from performance_schema.setup_timers where name='wait';
show status like "Qcache_queries_in_cache";
@ -42,6 +43,7 @@ show status like "Qcache_hits";
select spins from performance_schema.events_waits_current order by event_name limit 1;
--replace_result CYCLE {CYCLE_OR_NANOSECOND} NANOSECOND {CYCLE_OR_NANOSECOND}
select * from performance_schema.setup_timers where name='wait';
show status like "Qcache_queries_in_cache";

View file

@ -116,3 +116,17 @@ LOAD XML INFILE '../../std_data/loadxml.dat' INTO TABLE t1
ROWS IDENTIFIED BY '<row>' (a,@b) SET b=concat('!',@b);
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
--echo #
--echo # Bug#16171518 LOAD XML DOES NOT HANDLE EMPTY ELEMENTS
--echo #
CREATE TABLE t1 (col1 VARCHAR(3), col2 VARCHAR(3), col3 VARCHAR(3), col4 VARCHAR(4));
LOAD XML INFILE '../../std_data/bug16171518_1.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY col1, col2, col3, col4;
DROP TABLE t1;
CREATE TABLE t1 (col1 VARCHAR(3), col2 VARCHAR(3), col3 INTEGER);
LOAD XML INFILE '../../std_data/bug16171518_2.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY col1, col2, col3;
DROP TABLE t1;

View file

@ -0,0 +1,38 @@
#
# Specific tests for case-insensitive file systems
# i.e. lower_case_filesystem=ON
#
-- source include/have_case_insensitive_file_system.inc
# Embedded server does not support restarting.
--source include/not_embedded.inc
--echo #
--echo # Bug#20198490 : LOWER_CASE_TABLE_NAMES=0 ON WINDOWS LEADS TO PROBLEMS
--echo #
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
--error 0,1
--remove_file $SEARCH_FILE
#Shutdown the server
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
#Start the server with --lower_case_table_names=0 in Windows.
--enable_reconnect
--error 1
--exec $MYSQLD_CMD --lower_case_table_names=0 > $SEARCH_FILE 2>&1
#Search for the error messege in the server error log.
let SEARCH_PATTERN= \[ERROR\] The server option \'lower_case_table_names\' is configured to use case sensitive table names but the data directory is on a case-insensitive file system which is an unsupported combination\. Please consider either using a case sensitive file system for your data directory or switching to a case-insensitive table name mode\.;
--source include/search_pattern_in_file.inc
#Restart the server
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
#Cleanup
--error 0,1
--remove_file $SEARCH_FILE

View file

@ -1 +0,0 @@
--lower_case_table_names=0

View file

@ -1,37 +0,0 @@
#
# Test of force of lower-case-table-names=0
# (User has case insensitive file system and wants to preserve case of
# table names)
#
--source include/have_innodb.inc
--source include/have_lowercase0.inc
--source include/have_case_insensitive_file_system.inc
--source include/not_windows.inc
call mtr.add_suppression("Cannot find or open table test/BUG29839 from");
--disable_warnings
DROP TABLE IF EXISTS t1,T1;
--enable_warnings
#
# This is actually an error, but ok as the user has forced this
# by using --lower-case-table-names=0
CREATE TABLE t1 (a INT);
SELECT * FROM T1;
FLUSH TABLES;
DROP TABLE t1;
#
# InnoDB should in this case be case sensitive
# Note that this is not true on windows as no this OS, InnoDB is always
# storing things in lower case.
#
CREATE TABLE bug29839 (a INT) ENGINE=INNODB;
--error ER_NO_SUCH_TABLE
SELECT * FROM BUG29839;
DROP TABLE bug29839;
# End of 4.1 tests

View file

@ -901,13 +901,8 @@ select * from t1;
create view v1 as
select * from v3 where b in (1, 2, 3, 4, 5, 6, 7);
# Disable warnings since LIMIT warning for unsafe statement if
# binlog_format = STATEMENT. Note: after BUG#45832, the warning should
# not be issued.
--disable_warnings
create view v2 as
select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
--enable_warnings
--exec $MYSQL_DUMP --skip-comments test
@ -1777,7 +1772,7 @@ drop table words;
--replace_regex /.*mysqlimport(\.exe)*/mysqlimport/
--replace_result mysqldump.exe mysqldump
--error 1
--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat 2>&1
--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat
drop table t1;
drop table t2;
@ -2456,6 +2451,35 @@ drop table t1, t2;
--echo # End of 5.1 tests
--echo #
--echo #
--echo # Bug #20772273 : MYSQLIMPORT --USE-THREADS DOESN'T USE MULTIPLE THREADS
--echo #
CREATE DATABASE db_20772273;
USE db_20772273;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1), (2);
CREATE TABLE t2(a INT);
INSERT INTO t2 VALUES (3), (4);
SELECT * FROM t1;
SELECT * FROM t2;
--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ db_20772273
--exec $MYSQL db_20772273 < $MYSQLTEST_VARDIR/tmp/t1.sql
--exec $MYSQL db_20772273 < $MYSQLTEST_VARDIR/tmp/t2.sql
# Test mysqlimport with multiple threads
--exec $MYSQL_IMPORT --silent --use-threads=2 db_20772273 $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt
SELECT * FROM t1;
SELECT * FROM t2;
#Cleanup
DROP TABLE t1;
DROP TABLE t2;
DROP DATABASE db_20772273;
#
# MDEV-6091 mysqldump goes in a loop and segfaults if --dump-slave is specified and it cannot connect to the server
#

View file

@ -1146,7 +1146,7 @@ subpartition by hash (rand(a+b));
#
# Subpartition by hash, wrong subpartition function
#
--error ER_SUBPARTITION_ERROR
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (
a int not null,
b int not null,

View file

@ -53,7 +53,7 @@ SELECT 1 IN (SELECT 1);
SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
-- error ER_WRONG_USAGE
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
-- error ER_WRONG_PARAMETERS_TO_PROCEDURE
-- error ER_PARSE_ERROR
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-- error ER_BAD_FIELD_ERROR
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;

View file

@ -506,6 +506,21 @@ DROP VIEW v1;
DROP FUNCTION f1;
DROP TABLE t1;
--echo # Bug #21143080: UPDATE ON VARCHAR AND TEXT COLUMNS PRODUCE INCORRECT
--echo # RESULTS
CREATE TABLE t1 (a VARCHAR(50), b TEXT, c CHAR(50)) ENGINE=INNODB;
INSERT INTO t1 (a, b, c) VALUES ('start trail', '', 'even longer string');
UPDATE t1 SET b = a, a = 'inject';
SELECT a, b FROM t1;
UPDATE t1 SET b = c, c = 'inject';
SELECT c, b FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-3948 Assertion `records_are_comparable(table)' fails in compare_record(const TABLE*) on UPDATE with simple AND condition, index_merge+index_merge_intersection, InnoDB
--echo #
--echo # Verify that UPDATE does the same number of handler_update
--echo # operations, no matter if there is ORDER BY or not.

View file

@ -4741,6 +4741,50 @@ SHOW CREATE VIEW v4;
DROP VIEW v1, v2, v3, v4, v5;
--echo #
--echo # BUG#19886430: VIEW CREATION WITH NAMED COLUMNS, OVER UNION,
--echo # IS REJECTED
--echo # Without the patch, reports an error.
CREATE VIEW v1 (fld1, fld2) AS
SELECT 1 AS a, 2 AS b
UNION ALL
SELECT 1 AS a, 1 AS a;
--echo # The column names are explicitly specified and not duplicates, hence
--echo # succeeds.
CREATE VIEW v2 (fld1, fld2) AS
SELECT 1 AS a, 2 AS a
UNION ALL
SELECT 1 AS a, 1 AS a;
--echo # The column name in the first SELECT are not duplicates, hence succeeds.
CREATE VIEW v3 AS
SELECT 1 AS a, 2 AS b
UNION ALL
SELECT 1 AS a, 1 AS a;
--echo # Should report an error, since the explicitly specified column names are
--echo # duplicates.
--error ER_DUP_FIELDNAME
CREATE VIEW v4 (fld1, fld1) AS
SELECT 1 AS a, 2 AS b
UNION ALL
SELECT 1 AS a, 1 AS a;
--echo # Should report an error, since duplicate column name is specified in the
--echo # First SELECT.
--error ER_DUP_FIELDNAME
CREATE VIEW v4 AS
SELECT 1 AS a, 2 AS a
UNION ALL
SELECT 1 AS a, 1 AS a;
--echo # Cleanup
DROP VIEW v1, v2, v3;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc

View file

@ -1,7 +1,7 @@
#ifndef FIELD_INCLUDED
#define FIELD_INCLUDED
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2008, 2014, SkySQL Ab.
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB
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
@ -638,6 +638,16 @@ public:
/* Hash value */
virtual void hash(ulong *nr, ulong *nr2);
/**
Checks whether a string field is part of write_set.
@return
FALSE - If field is not char/varchar/....
- If field is char/varchar/.. and is not part of write set.
TRUE - If field is char/varchar/.. and is part of write set.
*/
virtual bool is_updatable() const { return FALSE; }
/* Check whether the field can be used as a join attribute in hash join */
virtual bool hash_join_is_possible() { return TRUE; }
virtual bool eq_cmp_as_binary() { return TRUE; }
@ -824,6 +834,11 @@ public:
int store_decimal(const my_decimal *d);
uint32 max_data_length() const;
bool is_updatable() const
{
DBUG_ASSERT(table && table->write_set);
return bitmap_is_set(table->write_set, field_index);
}
};
/* base class for float and double and decimal (old one) */

View file

@ -1,7 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, Monty Program Ab
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
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
@ -863,15 +862,10 @@ int field_conv(Field *to,Field *from)
{ // Be sure the value is stored
Field_blob *blob=(Field_blob*) to;
from->val_str(&blob->value);
/*
Copy value if copy_blobs is set, or source is not a string and
we have a pointer to its internal string conversion buffer.
*/
if (to->table->copy_blobs ||
(!blob->value.is_alloced() &&
from->real_type() != MYSQL_TYPE_STRING &&
from->real_type() != MYSQL_TYPE_VARCHAR))
if (!blob->value.is_alloced() && from->is_updatable())
blob->value.copy();
return blob->store(blob->value.ptr(),blob->value.length(),from->charset());
}
if (from->real_type() == MYSQL_TYPE_ENUM &&

View file

@ -3884,13 +3884,24 @@ static int init_common_variables()
{
if (lower_case_table_names_used)
{
#if MYSQL_VERSION_ID < 100100
if (global_system_variables.log_warnings)
sql_print_warning("\
You have forced lower_case_table_names to 0 through a command-line \
option, even though your file system '%s' is case insensitive. This means \
that you can corrupt a MyISAM table by accessing it with different cases. \
You should consider changing lower_case_table_names to 1 or 2",
mysql_real_data_home);
sql_print_warning("You have forced lower_case_table_names to 0 through "
"a command-line option, even though your file system "
"'%s' is case insensitive. This means that you can "
"corrupt your tables if you access them using names "
"with different letter case. You should consider "
"changing lower_case_table_names to 1 or 2",
mysql_real_data_home);
#else
sql_print_error("The server option 'lower_case_table_names' is "
"configured to use case sensitive table names but the "
"data directory resides on a case-insensitive file system. "
"Please use a case sensitive file system for your data "
"directory or switch to a case-insensitive table name "
"mode.");
#endif
return 1;
}
else
{

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2008, 2014, Monty Program Ab.
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB
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
@ -4081,10 +4081,19 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
key_tree->min_flag |
key_tree->max_flag,
&subpart_iter);
DBUG_ASSERT(res); /* We can't get "no satisfying subpartitions" */
if (res == 0)
{
/*
The only case where we can get "no satisfying subpartitions"
returned from the above call is when an error has occurred.
*/
DBUG_ASSERT(range_par->thd->is_error());
return 0;
}
if (res == -1)
goto pop_and_go_right; /* all subpartitions satisfy */
uint32 subpart_id;
bitmap_clear_all(&ppar->subparts_bitmap);
while ((subpart_id= subpart_iter.get_next(&subpart_iter)) !=

View file

@ -1,4 +1,5 @@
/* Copyright (c) 2006, 2013, Oracle and/or its affiliates.
/* Copyright (c) 2006, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
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
@ -1109,15 +1110,22 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
{
int err= 0;
/* Check for partition expression. */
if (!list_of_part_fields)
{
DBUG_ASSERT(part_expr);
err= part_expr->walk(&Item::check_partition_func_processor, 0,
NULL);
if (!err && is_sub_partitioned() && !list_of_subpart_fields)
err= subpart_expr->walk(&Item::check_partition_func_processor, 0,
NULL);
}
/* Check for sub partition expression. */
if (!err && is_sub_partitioned() && !list_of_subpart_fields)
{
DBUG_ASSERT(subpart_expr);
err= subpart_expr->walk(&Item::check_partition_func_processor, 0,
NULL);
}
if (err)
{
my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));

View file

@ -4652,16 +4652,19 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
tl && number-- && tl != first_not_own_table;
tl= tl->next_global)
{
sctx = test(tl->security_ctx) ? tl->security_ctx : thd->security_ctx;
TABLE_LIST *const t_ref=
tl->correspondent_table ? tl->correspondent_table : tl;
sctx = test(t_ref->security_ctx) ? t_ref->security_ctx :
thd->security_ctx;
const ACL_internal_table_access *access=
get_cached_table_access(&tl->grant.m_internal,
tl->get_db_name(),
tl->get_table_name());
get_cached_table_access(&t_ref->grant.m_internal,
t_ref->get_db_name(),
t_ref->get_table_name());
if (access)
{
switch(access->check(orig_want_access, &tl->grant.privilege))
switch(access->check(orig_want_access, &t_ref->grant.privilege))
{
case ACL_INTERNAL_ACCESS_GRANTED:
/*
@ -4685,33 +4688,33 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
if (!want_access)
continue; // ok
if (!(~tl->grant.privilege & want_access) ||
tl->is_anonymous_derived_table() || tl->schema_table)
if (!(~t_ref->grant.privilege & want_access) ||
t_ref->is_anonymous_derived_table() || t_ref->schema_table)
{
/*
It is subquery in the FROM clause. VIEW set tl->derived after
It is subquery in the FROM clause. VIEW set t_ref->derived after
table opening, but this function always called before table opening.
*/
if (!tl->referencing_view)
if (!t_ref->referencing_view)
{
/*
If it's a temporary table created for a subquery in the FROM
clause, or an INFORMATION_SCHEMA table, drop the request for
a privilege.
*/
tl->grant.want_privilege= 0;
t_ref->grant.want_privilege= 0;
}
continue;
}
GRANT_TABLE *grant_table= table_hash_search(sctx->host, sctx->ip,
tl->get_db_name(),
t_ref->get_db_name(),
sctx->priv_user,
tl->get_table_name(),
t_ref->get_table_name(),
FALSE);
if (!grant_table)
{
want_access &= ~tl->grant.privilege;
want_access &= ~t_ref->grant.privilege;
goto err; // No grants
}
@ -4722,17 +4725,17 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
if (any_combination_will_do)
continue;
tl->grant.grant_table= grant_table; // Remember for column test
tl->grant.version= grant_version;
tl->grant.privilege|= grant_table->privs;
tl->grant.want_privilege= ((want_access & COL_ACLS) & ~tl->grant.privilege);
t_ref->grant.grant_table= grant_table; // Remember for column test
t_ref->grant.version= grant_version;
t_ref->grant.privilege|= grant_table->privs;
t_ref->grant.want_privilege= ((want_access & COL_ACLS) & ~t_ref->grant.privilege);
if (!(~tl->grant.privilege & want_access))
if (!(~t_ref->grant.privilege & want_access))
continue;
if (want_access & ~(grant_table->cols | tl->grant.privilege))
if (want_access & ~(grant_table->cols | t_ref->grant.privilege))
{
want_access &= ~(grant_table->cols | tl->grant.privilege);
want_access &= ~(grant_table->cols | t_ref->grant.privilege);
goto err; // impossible
}
}

View file

@ -1682,13 +1682,20 @@ bool close_temporary_tables(THD *thd)
if (!thd->temporary_tables)
DBUG_RETURN(FALSE);
/*
Ensure we don't have open HANDLERs for tables we are about to close.
This is necessary when close_temporary_tables() is called as part
of execution of BINLOG statement (e.g. for format description event).
*/
mysql_ha_rm_temporary_tables(thd);
if (!mysql_bin_log.is_open())
{
TABLE *tmp_next;
for (table= thd->temporary_tables; table; table= tmp_next)
for (TABLE *t= thd->temporary_tables; t; t= tmp_next)
{
tmp_next= table->next;
close_temporary(table, 1, 1);
tmp_next= t->next;
mysql_lock_remove(thd, thd->lock, t);
close_temporary(t, 1, 1);
}
thd->temporary_tables= 0;
DBUG_RETURN(FALSE);
@ -1783,6 +1790,7 @@ bool close_temporary_tables(THD *thd)
strlen(table->s->table_name.str));
s_query.append(',');
next= table->next;
mysql_lock_remove(thd, thd->lock, table);
close_temporary(table, 1, 1);
}
thd->clear_error();

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2001, 2013, Oracle and/or its affiliates.
Copyright (c) 2011, 2013, Monty Program Ab.
/* Copyright (c) 2001, 2015, Oracle and/or its affiliates.
Copyright (c) 2011, 2015, MariaDB
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
@ -1187,3 +1187,36 @@ void mysql_ha_set_explicit_lock_duration(THD *thd)
DBUG_VOID_RETURN;
}
/**
Remove temporary tables from the HANDLER's hash table. The reason
for having a separate function, rather than calling
mysql_ha_rm_tables() is that it is not always feasible (e.g. in
close_temporary_tables) to obtain a TABLE_LIST containing the
temporary tables.
@See close_temporary_tables
@param thd Thread identifier.
*/
void mysql_ha_rm_temporary_tables(THD *thd)
{
DBUG_ENTER("mysql_ha_rm_temporary_tables");
TABLE_LIST *tmp_handler_tables= NULL;
for (uint i= 0; i < thd->handler_tables_hash.records; i++)
{
TABLE_LIST *handler_table= reinterpret_cast<TABLE_LIST*>
(my_hash_element(&thd->handler_tables_hash, i));
if (handler_table->table && handler_table->table->s->tmp_table)
{
handler_table->next_local= tmp_handler_tables;
tmp_handler_tables= handler_table;
}
}
if (tmp_handler_tables)
mysql_ha_rm_tables(thd, tmp_handler_tables);
DBUG_VOID_RETURN;
}

View file

@ -1,6 +1,8 @@
#ifndef SQL_HANDLER_INCLUDED
#define SQL_HANDLER_INCLUDED
/* Copyright (C) 2010 Monty Program Ab
/* Copyright (c) 2006, 2015, Oracle and/or its affiliates.
Copyright (C) 2010, 2015, MariaDB
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
the Free Software Foundation; version 2 of the License.
@ -73,6 +75,7 @@ void mysql_ha_flush_tables(THD *thd, TABLE_LIST *all_tables);
void mysql_ha_rm_tables(THD *thd, TABLE_LIST *tables);
void mysql_ha_cleanup(THD *thd);
void mysql_ha_set_explicit_lock_duration(THD *thd);
void mysql_ha_rm_temporary_tables(THD *thd);
SQL_HANDLER *mysql_ha_read_prepare(THD *thd, TABLE_LIST *tables,
enum enum_ha_read_modes mode, char *keyname,

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2014, SkySQL Ab.
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
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
@ -3842,7 +3842,6 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
/* Add selected items to field list */
List_iterator_fast<Item> it(*items);
Item *item;
Field *tmp_field;
DBUG_ENTER("create_table_from_items");
tmp_table.alias= 0;
@ -3857,24 +3856,49 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
while ((item=it++))
{
Create_field *cr_field;
Field *field, *def_field;
Field *tmp_table_field;
if (item->type() == Item::FUNC_ITEM)
{
if (item->result_type() != STRING_RESULT)
field= item->tmp_table_field(&tmp_table);
tmp_table_field= item->tmp_table_field(&tmp_table);
else
field= item->tmp_table_field_from_field_type(&tmp_table, 0);
tmp_table_field= item->tmp_table_field_from_field_type(&tmp_table,
false);
}
else
field= create_tmp_field(thd, &tmp_table, item, item->type(),
(Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0,
0);
if (!field ||
!(cr_field=new Create_field(field,(item->type() == Item::FIELD_ITEM ?
((Item_field *)item)->field :
(Field*) 0))))
DBUG_RETURN(0);
{
Field *from_field, * default_field;
tmp_table_field= create_tmp_field(thd, &tmp_table, item, item->type(),
(Item ***) NULL, &from_field, &default_field,
0, 0, 0, 0, 0);
}
if (!tmp_table_field)
DBUG_RETURN(NULL);
Field *table_field;
switch (item->type())
{
/*
We have to take into account both the real table's fields and
pseudo-fields used in trigger's body. These fields are used
to copy defaults values later inside constructor of
the class Create_field.
*/
case Item::FIELD_ITEM:
case Item::TRIGGER_FIELD_ITEM:
table_field= ((Item_field *) item)->field;
break;
default:
table_field= NULL;
}
Create_field *cr_field= new Create_field(tmp_table_field, table_field);
if (!cr_field)
DBUG_RETURN(NULL);
if (item->maybe_null)
cr_field->flags &= ~NOT_NULL_FLAG;
alter_info->create_list.push_back(cr_field);
@ -3942,7 +3966,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
{
if (!thd->is_error()) // CREATE ... IF NOT EXISTS
my_ok(thd); // succeed, but did nothing
DBUG_RETURN(0);
DBUG_RETURN(NULL);
}
}

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2010, 2014, Monty Progrm Ab
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
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
@ -2012,8 +2012,15 @@ int READ_INFO::read_xml()
break;
case '/': /* close tag */
level--;
chr= my_tospace(GET);
/* Decrease the 'level' only when (i) It's not an */
/* (without space) empty tag i.e. <tag/> or, (ii) */
/* It is of format <row col="val" .../> */
if(chr != '>' || in_tag)
{
level--;
in_tag= false;
}
if(chr != '>') /* if this is an empty tag <tag /> */
tag.length(0); /* we should keep tag value */
while(chr != '>' && chr != my_b_EOF)

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2008, 2014, SkySQL Ab.
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB
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
@ -5197,9 +5197,12 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
for (; i < number && tables != first_not_own_table && tables;
tables= tables->next_global, i++)
{
TABLE_LIST *const table_ref= tables->correspondent_table ?
tables->correspondent_table : tables;
ulong want_access= requirements;
if (tables->security_ctx)
sctx= tables->security_ctx;
if (table_ref->security_ctx)
sctx= table_ref->security_ctx;
else
sctx= backup_ctx;
@ -5207,26 +5210,26 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
Register access for view underlying table.
Remove SHOW_VIEW_ACL, because it will be checked during making view
*/
tables->grant.orig_want_privilege= (want_access & ~SHOW_VIEW_ACL);
table_ref->grant.orig_want_privilege= (want_access & ~SHOW_VIEW_ACL);
if (tables->schema_table_reformed)
if (table_ref->schema_table_reformed)
{
if (check_show_access(thd, tables))
if (check_show_access(thd, table_ref))
goto deny;
continue;
}
DBUG_PRINT("info", ("derived: %d view: %d", tables->derived != 0,
tables->view != 0));
if (tables->is_anonymous_derived_table() ||
(tables->table && tables->table->s &&
(int)tables->table->s->tmp_table))
DBUG_PRINT("info", ("derived: %d view: %d", table_ref->derived != 0,
table_ref->view != 0));
if (table_ref->is_anonymous_derived_table() ||
(table_ref->table && table_ref->table->s &&
(int)table_ref->table->s->tmp_table))
continue;
thd->security_ctx= sctx;
if (check_access(thd, want_access, tables->get_db_name(),
&tables->grant.privilege,
&tables->grant.m_internal,
if (check_access(thd, want_access, table_ref->get_db_name(),
&table_ref->grant.privilege,
&table_ref->grant.m_internal,
0, no_errors))
goto deny;
}

View file

@ -14702,6 +14702,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
case Item::FIELD_ITEM:
case Item::DEFAULT_VALUE_ITEM:
case Item::INSERT_VALUE_ITEM:
case Item::TRIGGER_FIELD_ITEM:
{
Item_field *field= (Item_field*) item;
bool orig_modify= modify_item;
@ -17150,6 +17151,10 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
if (return_tab < join->return_tab)
join->return_tab= return_tab;
/* check for errors evaluating the condition */
if (join->thd->is_error())
DBUG_RETURN(NESTED_LOOP_ERROR);
if (join->return_tab < join_tab)
DBUG_RETURN(NESTED_LOOP_OK);
/*

View file

@ -4010,6 +4010,12 @@ static bool check_if_created_table_can_be_opened(THD *thd,
result= (open_table_def(thd, &share, 0) ||
open_table_from_share(thd, &share, "", 0, (uint) READ_ALL,
0, &table, TRUE));
/*
Assert that the change list is empty as no partition function currently
needs to modify item tree. May need call THD::rollback_item_tree_changes
later before calling closefrm if the change list is not empty.
*/
DBUG_ASSERT(thd->change_list.is_empty());
if (! result)
(void) closefrm(&table, 0);

View file

@ -10612,8 +10612,20 @@ procedure_clause:
if (add_proc_to_list(lex->thd, item))
MYSQL_YYABORT;
Lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
/*
PROCEDURE CLAUSE cannot handle subquery as one of its parameter,
so set expr_allows_subselect as false to disallow any subqueries
further. Reset expr_allows_subselect back to true once the
parameters are reduced.
*/
Lex->expr_allows_subselect= false;
}
'(' procedure_list ')'
{
/* Subqueries are allowed from now.*/
Lex->expr_allows_subselect= true;
}
;
procedure_list:

View file

@ -1,4 +1,4 @@
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
#
# 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
@ -88,6 +88,18 @@ IF(NOT CMAKE_CROSSCOMPILING)
CHECK_C_SOURCE_RUNS(
"#include<stdint.h>
int main()
{
unsigned char c;
__atomic_test_and_set(&c, __ATOMIC_ACQUIRE);
__atomic_clear(&c, __ATOMIC_RELEASE);
return(0);
}"
HAVE_IB_GCC_ATOMIC_TEST_AND_SET
)
CHECK_C_SOURCE_RUNS(
"#include<stdint.h>
int main()
{
__sync_synchronize();
return(0);
@ -110,6 +122,10 @@ IF(HAVE_IB_GCC_ATOMIC_BUILTINS)
ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS=1)
ENDIF()
IF(HAVE_IB_GCC_ATOMIC_TEST_AND_SET)
ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_TEST_AND_SET=1)
ENDIF()
IF(HAVE_IB_GCC_SYNC_SYNCHRONISE)
ADD_DEFINITIONS(-DHAVE_IB_GCC_SYNC_SYNCHRONISE=1)
ENDIF()

View file

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@ -2085,6 +2085,7 @@ btr_cur_optimistic_update(
ulint max_size;
ulint new_rec_size;
ulint old_rec_size;
ulint max_ins_size = 0;
dtuple_t* new_entry;
roll_ptr_t roll_ptr;
trx_t* trx;
@ -2195,6 +2196,11 @@ any_extern:
: (old_rec_size
+ page_get_max_insert_size_after_reorganize(page, 1));
if (!page_zip) {
max_ins_size = page_get_max_insert_size_after_reorganize(
page, 1);
}
if (!(((max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT)
&& (max_size >= new_rec_size))
|| (page_get_n_recs(page) <= 1))) {
@ -2246,10 +2252,14 @@ any_extern:
rec = btr_cur_insert_if_possible(cursor, new_entry, 0/*n_ext*/, mtr);
ut_a(rec); /* <- We calculated above the insert would fit */
if (page_zip && !dict_index_is_clust(index)
if (!dict_index_is_clust(index)
&& page_is_leaf(page)) {
/* Update the free bits in the insert buffer. */
ibuf_update_free_bits_zip(block, mtr);
if (page_zip) {
ibuf_update_free_bits_zip(block, mtr);
} else {
ibuf_update_free_bits_low(block, max_ins_size, mtr);
}
}
/* Restore the old explicit lock state on the record */
@ -2358,6 +2368,7 @@ btr_cur_pessimistic_update(
ulint n_reserved;
ulint n_ext;
ulint* offsets = NULL;
ulint max_ins_size = 0;
*big_rec = NULL;
@ -2495,6 +2506,11 @@ make_external:
ut_ad(flags & BTR_KEEP_POS_FLAG);
}
if (!page_zip) {
max_ins_size = page_get_max_insert_size_after_reorganize(
page, 1);
}
/* Store state of explicit locks on rec on the page infimum record,
before deleting rec. The page infimum acts as a dummy carrier of the
locks, taking care also of lock releases, before we can move the locks
@ -2540,10 +2556,15 @@ make_external:
big_rec_vec != NULL && (flags & BTR_KEEP_POS_FLAG),
mtr);
if (page_zip && !dict_index_is_clust(index)
if (!dict_index_is_clust(index)
&& page_is_leaf(page)) {
/* Update the free bits in the insert buffer. */
ibuf_update_free_bits_zip(block, mtr);
if (page_zip) {
ibuf_update_free_bits_zip(block, mtr);
} else {
ibuf_update_free_bits_low(block, max_ins_size,
mtr);
}
}
err = DB_SUCCESS;

View file

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@ -37,6 +37,20 @@ Created 9/6/1995 Heikki Tuuri
#include "univ.i"
#include "ut0lst.h"
#if defined __i386__ || defined __x86_64__ || defined _M_IX86 \
|| defined _M_X64 || defined __WIN__
#define IB_STRONG_MEMORY_MODEL
#endif /* __i386__ || __x86_64__ || _M_IX86 || M_X64 || __WIN__ */
#ifdef HAVE_WINDOWS_ATOMICS
typedef LONG lock_word_t; /*!< On Windows, InterlockedExchange operates
on LONG variable */
#else
typedef byte lock_word_t;
#endif
#ifdef __WIN__
/** Native event (slow)*/
typedef HANDLE os_native_event_t;
@ -321,31 +335,61 @@ amount of increment. */
# define os_atomic_increment_ulint(ptr, amount) \
os_atomic_increment(ptr, amount)
/**********************************************************//**
Returns the old value of *ptr, atomically sets *ptr to new_val */
# if defined(HAVE_IB_GCC_ATOMIC_TEST_AND_SET)
#if defined(__powerpc__) || defined(__aarch64__)
/*
os_atomic_test_and_set_byte_release() should imply a release barrier before
setting, and a full barrier after. But __sync_lock_test_and_set() is only
documented as an aquire barrier. So on PowerPC we need to add the full
barrier explicitly. */
# define os_atomic_test_and_set_byte_release(ptr, new_val) \
do { __sync_lock_release(ptr); \
__sync_synchronize(); } while (0)
#else
/*
On x86, __sync_lock_test_and_set() happens to be full barrier, due to
LOCK prefix.
*/
# define os_atomic_test_and_set_byte_release(ptr, new_val) \
__sync_lock_test_and_set(ptr, (byte) new_val)
#endif
/*
os_atomic_test_and_set_byte_acquire() is a full memory barrier on x86. But
in general, just an aquire barrier should be sufficient. */
# define os_atomic_test_and_set_byte_acquire(ptr, new_val) \
__sync_lock_test_and_set(ptr, (byte) new_val)
/** Do an atomic test-and-set.
@param[in,out] ptr Memory location to set to non-zero
@return the previous value */
static inline
lock_word_t
os_atomic_test_and_set(volatile lock_word_t* ptr)
{
return(__atomic_test_and_set(ptr, __ATOMIC_ACQUIRE));
}
/** Do an atomic clear.
@param[in,out] ptr Memory location to set to zero */
static inline
void
os_atomic_clear(volatile lock_word_t* ptr)
{
__atomic_clear(ptr, __ATOMIC_RELEASE);
}
# elif defined(IB_STRONG_MEMORY_MODEL)
/** Do an atomic test and set.
@param[in,out] ptr Memory location to set to non-zero
@return the previous value */
static inline
lock_word_t
os_atomic_test_and_set(volatile lock_word_t* ptr)
{
return(__sync_lock_test_and_set(ptr, 1));
}
/** Do an atomic release.
In theory __sync_lock_release should be used to release the lock.
Unfortunately, it does not work properly alone. The workaround is
that more conservative __sync_lock_test_and_set is used instead.
Performance regression was observed at some conditions for Intel
architecture. Disable release barrier on Intel architecture for now.
@param[in,out] ptr Memory location to write to
@return the previous value */
static inline
lock_word_t
os_atomic_clear(volatile lock_word_t* ptr)
{
return(__sync_lock_test_and_set(ptr, 0));
}
# else
# error "Unsupported platform"
# endif /* HAVE_IB_GCC_ATOMIC_TEST_AND_SET */
#elif defined(HAVE_IB_SOLARIS_ATOMICS)
@ -394,13 +438,25 @@ amount of increment. */
# define os_atomic_increment_ulint(ptr, amount) \
atomic_add_long_nv(ptr, amount)
/**********************************************************//**
Returns the old value of *ptr, atomically sets *ptr to new_val */
/** Do an atomic xchg and set to non-zero.
@param[in,out] ptr Memory location to set to non-zero
@return the previous value */
static inline
lock_word_t
os_atomic_test_and_set(volatile lock_word_t* ptr)
{
return(atomic_swap_uchar(ptr, 1));
}
# define os_atomic_test_and_set_byte_acquire(ptr, new_val) \
atomic_swap_uchar(ptr, new_val)
# define os_atomic_test_and_set_byte_release(ptr, new_val) \
atomic_swap_uchar(ptr, new_val)
/** Do an atomic xchg and set to zero.
@param[in,out] ptr Memory location to set to zero
@return the previous value */
static inline
lock_word_t
os_atomic_clear(volatile lock_word_t* ptr)
{
return(atomic_swap_uchar(ptr, 0));
}
#elif defined(HAVE_WINDOWS_ATOMICS)
@ -442,15 +498,27 @@ amount of increment. */
# define os_atomic_increment_ulint(ptr, amount) \
((ulint) (win_xchg_and_add(ptr, amount) + amount))
/**********************************************************//**
Returns the old value of *ptr, atomically sets *ptr to new_val.
InterlockedExchange() operates on LONG, and the LONG will be
clobbered */
/** Do an atomic test and set.
InterlockedExchange() operates on LONG, and the LONG will be clobbered
@param[in,out] ptr Memory location to set to non-zero
@return the previous value */
static inline
lock_word_t
os_atomic_test_and_set(volatile lock_word_t* ptr)
{
return(InterlockedExchange(ptr, 1));
}
# define os_atomic_test_and_set_byte_acquire(ptr, new_val) \
((byte) InterlockedExchange(ptr, new_val))
# define os_atomic_test_and_set_byte_release(ptr, new_val) \
((byte) InterlockedExchange(ptr, new_val))
/** Do an atomic release.
InterlockedExchange() operates on LONG, and the LONG will be clobbered
@param[in,out] ptr Memory location to set to zero
@return the previous value */
static inline
lock_word_t
os_atomic_clear(volatile lock_word_t* ptr)
{
return(InterlockedExchange(ptr, 0));
}
#else
# define IB_ATOMICS_STARTUP_MSG \

View file

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@ -45,13 +45,6 @@ Created 9/5/1995 Heikki Tuuri
extern my_bool timed_mutexes;
#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
#ifdef HAVE_WINDOWS_ATOMICS
typedef LONG lock_word_t; /*!< On Windows, InterlockedExchange operates
on LONG variable */
#else
typedef byte lock_word_t;
#endif
#if defined UNIV_PFS_MUTEX || defined UNIV_PFS_RWLOCK
/* There are mutexes/rwlocks that we want to exclude from
instrumentation even if their corresponding performance schema

View file

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@ -80,7 +80,7 @@ mutex_test_and_set(
mutex_t* mutex) /*!< in: mutex */
{
#if defined(HAVE_ATOMIC_BUILTINS)
return(os_atomic_test_and_set_byte_acquire(&mutex->lock_word, 1));
return(os_atomic_test_and_set(&mutex->lock_word));
#else
ibool ret;
@ -108,10 +108,7 @@ mutex_reset_lock_word(
mutex_t* mutex) /*!< in: mutex */
{
#if defined(HAVE_ATOMIC_BUILTINS)
/* In theory __sync_lock_release should be used to release the lock.
Unfortunately, it does not work properly alone. The workaround is
that more conservative __sync_lock_test_and_set is used instead. */
os_atomic_test_and_set_byte_release(&mutex->lock_word, 0);
os_atomic_clear(&mutex->lock_word);
#else
mutex->lock_word = 0;

View file

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
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 the Free Software
@ -2457,16 +2457,16 @@ lock_rec_inherit_to_gap(
/* If srv_locks_unsafe_for_binlog is TRUE or session is using
READ COMMITTED isolation level, we do not want locks set
by an UPDATE or a DELETE to be inherited as gap type locks. But we
DO want S-locks set by a consistency constraint to be inherited also
then. */
DO want S-locks/X-locks (taken for replace) set by a consistency
constraint to be inherited also then. */
while (lock != NULL) {
if (!lock_rec_get_insert_intention(lock)
&& !((srv_locks_unsafe_for_binlog
|| lock->trx->isolation_level
<= TRX_ISO_READ_COMMITTED)
&& lock_get_mode(lock) == LOCK_X)) {
&& lock_get_mode(lock) ==
(lock->trx->duplicates ? LOCK_S : LOCK_X))) {
lock_rec_add_to_queue(LOCK_REC | LOCK_GAP
| lock_get_mode(lock),
heir_block, heir_heap_no,

View file

@ -1,5 +1,4 @@
/* Copyright (c) 2008 MySQL AB, 2010 Sun Microsystems, Inc.
Use is subject to license terms.
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
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
@ -89,6 +88,46 @@ void init_timers(void)
(double)pfs_timer_info.ticks.frequency);
else
tick_to_pico= 0;
/*
Depending on the platform and build options, some timers may not be
available. Pick best replacements.
*/
/*
For WAIT, the cycle timer is used by default. However, it is not available
on all architectures. Fall back to the nanosecond timer in this case. It is
unlikely that neither cycle nor nanosecond are available, but we continue
probing less resolution timers anyway for consistency with other events.
*/
if (cycle_to_pico != 0)
{
/* Normal case. */
wait_timer= TIMER_NAME_CYCLE;
}
else if (nanosec_to_pico != 0)
{
/* Robustness, no known cases. */
wait_timer= TIMER_NAME_NANOSEC;
}
else if (microsec_to_pico != 0)
{
/* Robustness, no known cases. */
wait_timer= TIMER_NAME_MICROSEC;
}
else if (millisec_to_pico != 0)
{
/* Robustness, no known cases. */
wait_timer= TIMER_NAME_MILLISEC;
}
else
{
/*
Will never be reached on any architecture, but must provide a default if
no other timers are available.
*/
wait_timer= TIMER_NAME_TICK;
}
}
ulonglong get_timer_value(enum_timer_name timer_name)

View file

@ -635,7 +635,7 @@ install -m 644 "%{malloc_lib_source}" \
# Check local settings to support them.
if [ -x %{_bindir}/my_print_defaults ]
then
mysql_datadir=`%{_bindir}/my_print_defaults server mysqld | grep '^--datadir=' | sed -n 's/--datadir=//p'`
mysql_datadir=`%{_bindir}/my_print_defaults server mysqld | grep '^--datadir=' | tail -1 | sed -n 's/--datadir=//p'`
PID_FILE_PATT=`%{_bindir}/my_print_defaults server mysqld | grep '^--pid-file=' | sed -n 's/--pid-file=//p'`
fi
if [ -z "$mysql_datadir" ]
@ -740,7 +740,7 @@ esac
STATUS_FILE=$mysql_datadir/RPM_UPGRADE_MARKER
if [ -f $STATUS_FILE ]; then
if [ -f "$STATUS_FILE" ]; then
echo "Some previous upgrade was not finished:"
ls -ld $STATUS_FILE
echo "Please check its status, then do"
@ -811,7 +811,7 @@ fi
# Check local settings to support them.
if [ -x %{_bindir}/my_print_defaults ]
then
mysql_datadir=`%{_bindir}/my_print_defaults server mysqld | grep '^--datadir=' | sed -n 's/--datadir=//p'`
mysql_datadir=`%{_bindir}/my_print_defaults server mysqld | grep '^--datadir=' | tail -1 | sed -n 's/--datadir=//p'`
fi
if [ -z "$mysql_datadir" ]
then
@ -824,8 +824,8 @@ STATUS_FILE=$mysql_datadir/RPM_UPGRADE_MARKER
# ----------------------------------------------------------------------
# Create data directory if needed, check whether upgrade or install
# ----------------------------------------------------------------------
if [ ! -d $mysql_datadir ] ; then mkdir -m 755 $mysql_datadir; fi
if [ -f $STATUS_FILE ] ; then
if [ ! -d "$mysql_datadir" ] ; then mkdir -m 755 "$mysql_datadir" ; fi
if [ -f "$STATUS_FILE" ] ; then
SERVER_TO_START=`grep '^SERVER_TO_START=' $STATUS_FILE | cut -c17-`
else
SERVER_TO_START=''
@ -1003,7 +1003,7 @@ fi
# Check local settings to support them.
if [ -x %{_bindir}/my_print_defaults ]
then
mysql_datadir=`%{_bindir}/my_print_defaults server mysqld | grep '^--datadir=' | sed -n 's/--datadir=//p'`
mysql_datadir=`%{_bindir}/my_print_defaults server mysqld | grep '^--datadir=' | tail -1 | sed -n 's/--datadir=//p'`
fi
if [ -z "$mysql_datadir" ]
then
@ -1014,7 +1014,7 @@ NEW_VERSION=%{mysql_version}-%{release}
STATUS_FILE=$mysql_datadir/RPM_UPGRADE_MARKER-LAST # Note the difference!
STATUS_HISTORY=$mysql_datadir/RPM_UPGRADE_HISTORY
if [ -f $STATUS_FILE ] ; then
if [ -f "$STATUS_FILE" ] ; then
SERVER_TO_START=`grep '^SERVER_TO_START=' $STATUS_FILE | cut -c17-`
else
# This should never happen, but let's be prepared