Commit f0a01456 authored by anozdrin@mysql.com's avatar anozdrin@mysql.com

Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  mysql.com:/mnt/raid/MySQL/devel/5.1-rt-wl3158-merged
parents e3d0c1a7 147df8bf
...@@ -1770,3 +1770,4 @@ vio/viotest-sslconnect.cpp ...@@ -1770,3 +1770,4 @@ vio/viotest-sslconnect.cpp
vio/viotest.cpp vio/viotest.cpp
zlib/*.ds? zlib/*.ds?
zlib/*.vcproj zlib/*.vcproj
libmysqld/event_scheduler.cc
...@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) ...@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb # remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.1.11-beta) AM_INIT_AUTOMAKE(mysql, 5.1.12-beta)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
......
...@@ -65,7 +65,8 @@ THREAD_RETURN YASSL_API echoserver_test(void* args) ...@@ -65,7 +65,8 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
while (!shutdown) { while (!shutdown) {
sockaddr_in client; sockaddr_in client;
socklen_t client_len = sizeof(client); socklen_t client_len = sizeof(client);
int clientfd = accept(sockfd, (sockaddr*)&client, &client_len); int clientfd = accept(sockfd, (sockaddr*)&client,
(ACCEPT_THIRD_T)&client_len);
if (clientfd == -1) err_sys("tcp accept failed"); if (clientfd == -1) err_sys("tcp accept failed");
SSL* ssl = SSL_new(ctx); SSL* ssl = SSL_new(ctx);
......
...@@ -273,6 +273,7 @@ int SSL_pending(SSL*); ...@@ -273,6 +273,7 @@ int SSL_pending(SSL*);
enum { /* ssl Constants */ enum { /* ssl Constants */
SSL_WOULD_BLOCK = -8,
SSL_BAD_STAT = -7, SSL_BAD_STAT = -7,
SSL_BAD_PATH = -6, SSL_BAD_PATH = -6,
SSL_BAD_FILETYPE = -5, SSL_BAD_FILETYPE = -5,
...@@ -494,7 +495,7 @@ ASN1_TIME* X509_get_notAfter(X509* x); ...@@ -494,7 +495,7 @@ ASN1_TIME* X509_get_notAfter(X509* x);
typedef struct MD4_CTX { typedef struct MD4_CTX {
void* ptr; int buffer[32]; /* big enough to hold, check size in Init */
} MD4_CTX; } MD4_CTX;
void MD4_Init(MD4_CTX*); void MD4_Init(MD4_CTX*);
......
...@@ -66,6 +66,7 @@ typedef unsigned char byte; ...@@ -66,6 +66,7 @@ typedef unsigned char byte;
// Wraps Windows Sockets and BSD Sockets // Wraps Windows Sockets and BSD Sockets
class Socket { class Socket {
socket_t socket_; // underlying socket descriptor socket_t socket_; // underlying socket descriptor
bool wouldBlock_; // for non-blocking data
public: public:
explicit Socket(socket_t s = INVALID_SOCKET); explicit Socket(socket_t s = INVALID_SOCKET);
~Socket(); ~Socket();
...@@ -75,9 +76,10 @@ public: ...@@ -75,9 +76,10 @@ public:
socket_t get_fd() const; socket_t get_fd() const;
uint send(const byte* buf, unsigned int len, int flags = 0) const; uint send(const byte* buf, unsigned int len, int flags = 0) const;
uint receive(byte* buf, unsigned int len, int flags = 0) const; uint receive(byte* buf, unsigned int len, int flags = 0);
bool wait() const; bool wait();
bool WouldBlock() const;
void closeSocket(); void closeSocket();
void shutDown(int how = SD_SEND); void shutDown(int how = SD_SEND);
......
...@@ -46,8 +46,10 @@ public: ...@@ -46,8 +46,10 @@ public:
// for compiler generated call, never used // for compiler generated call, never used
static void operator delete(void*) { assert(0); } static void operator delete(void*) { assert(0); }
private: private:
#if defined(__hpux)
// don't allow dynamic creation of exceptions // don't allow dynamic creation of exceptions
static void* operator new(size_t); static void* operator new(size_t);
#endif
}; };
......
...@@ -656,7 +656,7 @@ mySTL::auto_ptr<input_buffer> ...@@ -656,7 +656,7 @@ mySTL::auto_ptr<input_buffer>
DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered) DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
{ {
// wait for input if blocking // wait for input if blocking
if (!ssl.getSocket().wait()) { if (!ssl.useSocket().wait()) {
ssl.SetError(receive_error); ssl.SetError(receive_error);
buffered.reset(0); buffered.reset(0);
return buffered; return buffered;
...@@ -673,7 +673,7 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered) ...@@ -673,7 +673,7 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
} }
// add new data // add new data
uint read = ssl.getSocket().receive(buffer.get_buffer() + buffSz, ready); uint read = ssl.useSocket().receive(buffer.get_buffer() + buffSz, ready);
buffer.add_size(read); buffer.add_size(read);
uint offset = 0; uint offset = 0;
const MessageFactory& mf = ssl.getFactory().getMessage(); const MessageFactory& mf = ssl.getFactory().getMessage();
...@@ -858,6 +858,9 @@ void sendFinished(SSL& ssl, ConnectionEnd side, BufferOutput buffer) ...@@ -858,6 +858,9 @@ void sendFinished(SSL& ssl, ConnectionEnd side, BufferOutput buffer)
// send data // send data
int sendData(SSL& ssl, const void* buffer, int sz) int sendData(SSL& ssl, const void* buffer, int sz)
{ {
if (ssl.GetError() == YasslError(SSL_ERROR_WANT_READ))
ssl.SetError(no_error);
ssl.verfiyHandShakeComplete(); ssl.verfiyHandShakeComplete();
if (ssl.GetError()) return 0; if (ssl.GetError()) return 0;
int sent = 0; int sent = 0;
...@@ -893,6 +896,9 @@ int sendAlert(SSL& ssl, const Alert& alert) ...@@ -893,6 +896,9 @@ int sendAlert(SSL& ssl, const Alert& alert)
// process input data // process input data
int receiveData(SSL& ssl, Data& data) int receiveData(SSL& ssl, Data& data)
{ {
if (ssl.GetError() == YasslError(SSL_ERROR_WANT_READ))
ssl.SetError(no_error);
ssl.verfiyHandShakeComplete(); ssl.verfiyHandShakeComplete();
if (ssl.GetError()) return 0; if (ssl.GetError()) return 0;
...@@ -902,6 +908,11 @@ int receiveData(SSL& ssl, Data& data) ...@@ -902,6 +908,11 @@ int receiveData(SSL& ssl, Data& data)
ssl.useLog().ShowData(data.get_length()); ssl.useLog().ShowData(data.get_length());
if (ssl.GetError()) return 0; if (ssl.GetError()) return 0;
if (data.get_length() == 0 && ssl.getSocket().WouldBlock()) {
ssl.SetError(YasslError(SSL_ERROR_WANT_READ));
return SSL_WOULD_BLOCK;
}
return data.get_length(); return data.get_length();
} }
......
...@@ -58,7 +58,7 @@ namespace yaSSL { ...@@ -58,7 +58,7 @@ namespace yaSSL {
Socket::Socket(socket_t s) Socket::Socket(socket_t s)
: socket_(s) : socket_(s), wouldBlock_(false)
{} {}
...@@ -123,17 +123,21 @@ uint Socket::send(const byte* buf, unsigned int sz, int flags) const ...@@ -123,17 +123,21 @@ uint Socket::send(const byte* buf, unsigned int sz, int flags) const
} }
uint Socket::receive(byte* buf, unsigned int sz, int flags) const uint Socket::receive(byte* buf, unsigned int sz, int flags)
{ {
assert(socket_ != INVALID_SOCKET); assert(socket_ != INVALID_SOCKET);
wouldBlock_ = false;
int recvd = ::recv(socket_, reinterpret_cast<char *>(buf), sz, flags); int recvd = ::recv(socket_, reinterpret_cast<char *>(buf), sz, flags);
// idea to seperate error from would block by arnetheduck@gmail.com // idea to seperate error from would block by arnetheduck@gmail.com
if (recvd == -1) { if (recvd == -1) {
if (get_lastError() == SOCKET_EWOULDBLOCK || if (get_lastError() == SOCKET_EWOULDBLOCK ||
get_lastError() == SOCKET_EAGAIN) get_lastError() == SOCKET_EAGAIN) {
wouldBlock_ = true;
return 0; return 0;
} }
}
else if (recvd == 0) else if (recvd == 0)
return static_cast<uint>(-1); return static_cast<uint>(-1);
...@@ -142,7 +146,7 @@ uint Socket::receive(byte* buf, unsigned int sz, int flags) const ...@@ -142,7 +146,7 @@ uint Socket::receive(byte* buf, unsigned int sz, int flags) const
// wait if blocking for input, return false for error // wait if blocking for input, return false for error
bool Socket::wait() const bool Socket::wait()
{ {
byte b; byte b;
return receive(&b, 1, MSG_PEEK) != static_cast<uint>(-1); return receive(&b, 1, MSG_PEEK) != static_cast<uint>(-1);
...@@ -166,6 +170,12 @@ int Socket::get_lastError() ...@@ -166,6 +170,12 @@ int Socket::get_lastError()
} }
bool Socket::WouldBlock() const
{
return wouldBlock_;
}
void Socket::set_lastError(int errorCode) void Socket::set_lastError(int errorCode)
{ {
#ifdef _WIN32 #ifdef _WIN32
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "handshake.hpp" #include "handshake.hpp"
#include "yassl_int.hpp" #include "yassl_int.hpp"
#include "md5.hpp" // for TaoCrypt MD5 size assert #include "md5.hpp" // for TaoCrypt MD5 size assert
#include "md4.hpp" // for TaoCrypt MD4 size assert
#include <stdio.h> #include <stdio.h>
#ifdef _WIN32 #ifdef _WIN32
...@@ -1131,17 +1132,26 @@ void* X509_get_ext_d2i(X509* x, int nid, int* crit, int* idx) ...@@ -1131,17 +1132,26 @@ void* X509_get_ext_d2i(X509* x, int nid, int* crit, int* idx)
void MD4_Init(MD4_CTX* md4) void MD4_Init(MD4_CTX* md4)
{ {
assert(0); // not yet supported, build compat. only // make sure we have a big enough buffer
typedef char ok[sizeof(md4->buffer) >= sizeof(TaoCrypt::MD4) ? 1 : -1];
(void) sizeof(ok);
// using TaoCrypt since no dynamic memory allocated
// and no destructor will be called
new (reinterpret_cast<yassl_pointer>(md4->buffer)) TaoCrypt::MD4();
} }
void MD4_Update(MD4_CTX* md4, const void* data, unsigned long sz) void MD4_Update(MD4_CTX* md4, const void* data, unsigned long sz)
{ {
reinterpret_cast<TaoCrypt::MD4*>(md4->buffer)->Update(
static_cast<const byte*>(data), static_cast<unsigned int>(sz));
} }
void MD4_Final(unsigned char* hash, MD4_CTX* md4) void MD4_Final(unsigned char* hash, MD4_CTX* md4)
{ {
reinterpret_cast<TaoCrypt::MD4*>(md4->buffer)->Final(hash);
} }
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "hmac.hpp" #include "hmac.hpp"
#include "md5.hpp" #include "md5.hpp"
#include "sha.hpp" #include "sha.hpp"
#include "ripemd.hpp"
#include "openssl/ssl.h" #include "openssl/ssl.h"
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
......
...@@ -26,13 +26,17 @@ ...@@ -26,13 +26,17 @@
#include "runtime.hpp" #include "runtime.hpp"
#include "timer.hpp" #include "timer.hpp"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#include <sys/time.h>
#endif
namespace yaSSL { namespace yaSSL {
#ifdef _WIN32 #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
timer_d timer() timer_d timer()
{ {
static bool init(false); static bool init(false);
...@@ -57,8 +61,6 @@ namespace yaSSL { ...@@ -57,8 +61,6 @@ namespace yaSSL {
#else // _WIN32 #else // _WIN32
#include <sys/time.h>
timer_d timer() timer_d timer()
{ {
struct timeval tv; struct timeval tv;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "runtime.hpp" #include "runtime.hpp"
#include "yassl_error.hpp" #include "yassl_error.hpp"
#include "error.hpp" // TaoCrypt error numbers #include "error.hpp" // TaoCrypt error numbers
#include "openssl/ssl.h" // SSL_ERROR_WANT_READ
namespace yaSSL { namespace yaSSL {
...@@ -117,6 +118,11 @@ void SetErrorString(YasslError error, char* buffer) ...@@ -117,6 +118,11 @@ void SetErrorString(YasslError error, char* buffer)
strncpy(buffer, "unable to proccess cerificate", max); strncpy(buffer, "unable to proccess cerificate", max);
break; break;
// openssl errors
case SSL_ERROR_WANT_READ :
strncpy(buffer, "the read operation would block", max);
break;
// TaoCrypt errors // TaoCrypt errors
case NO_ERROR : case NO_ERROR :
strncpy(buffer, "not in error state", max); strncpy(buffer, "not in error state", max);
......
...@@ -1415,15 +1415,6 @@ BulkCipher* CryptProvider::NewDesEde() ...@@ -1415,15 +1415,6 @@ BulkCipher* CryptProvider::NewDesEde()
} }
extern "C" void yaSSL_CleanUp()
{
TaoCrypt::CleanUp();
ysDelete(cryptProviderInstance);
ysDelete(sslFactoryInstance);
ysDelete(sessionsInstance);
}
typedef Mutex::Lock Lock; typedef Mutex::Lock Lock;
...@@ -2109,9 +2100,18 @@ ASN1_STRING* StringHolder::GetString() ...@@ -2109,9 +2100,18 @@ ASN1_STRING* StringHolder::GetString()
} }
} // namespace } // namespace
extern "C" void yaSSL_CleanUp()
{
TaoCrypt::CleanUp();
ysDelete(yaSSL::cryptProviderInstance);
ysDelete(yaSSL::sslFactoryInstance);
ysDelete(yaSSL::sessionsInstance);
}
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
namespace mySTL { namespace mySTL {
template yaSSL::yassl_int_cpp_local1::SumData for_each<mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumData>(mySTL::list<yaSSL::input_buffer*>::iterator, mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumData); template yaSSL::yassl_int_cpp_local1::SumData for_each<mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumData>(mySTL::list<yaSSL::input_buffer*>::iterator, mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumData);
......
...@@ -2,7 +2,7 @@ INCLUDE_DIRECTORIES(../mySTL include) ...@@ -2,7 +2,7 @@ INCLUDE_DIRECTORIES(../mySTL include)
ADD_LIBRARY(taocrypt src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp ADD_LIBRARY(taocrypt src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp
src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp
src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp
include/aes.hpp include/algebra.hpp include/arc4.hpp include/asn.hpp include/block.hpp include/aes.hpp include/algebra.hpp include/arc4.hpp include/asn.hpp include/block.hpp
include/coding.hpp include/des.hpp include/dh.hpp include/dsa.hpp include/dsa.hpp include/coding.hpp include/des.hpp include/dh.hpp include/dsa.hpp include/dsa.hpp
include/error.hpp include/file.hpp include/hash.hpp include/hmac.hpp include/integer.hpp include/error.hpp include/file.hpp include/hash.hpp include/hmac.hpp include/integer.hpp
......
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
pointer allocate(size_type n, const void* = 0) pointer allocate(size_type n, const void* = 0)
{ {
CheckSize(n); this->CheckSize(n);
if (n == 0) if (n == 0)
return 0; return 0;
return NEW_TC T[n]; return NEW_TC T[n];
......
/* md4.hpp
*
* Copyright (C) 2003 Sawtooth Consulting Ltd.
*
* This file is part of yaSSL.
*
* yaSSL 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; either version 2 of the License, or
* (at your option) any later version.
*
* yaSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
/* md4.hpp provides MD4 digest support
* WANRING: MD4 is considered insecure, only use if you have to, e.g., yaSSL
* libcurl supports needs this for NTLM authentication
*/
#ifndef TAO_CRYPT_MD4_HPP
#define TAO_CRYPT_MD4_HPP
#include "hash.hpp"
namespace TaoCrypt {
// MD4 digest
class MD4 : public HASHwithTransform {
public:
enum { BLOCK_SIZE = 64, DIGEST_SIZE = 16, PAD_SIZE = 56,
TAO_BYTE_ORDER = LittleEndianOrder }; // in Bytes
MD4() : HASHwithTransform(DIGEST_SIZE / sizeof(word32), BLOCK_SIZE)
{ Init(); }
ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); }
word32 getBlockSize() const { return BLOCK_SIZE; }
word32 getDigestSize() const { return DIGEST_SIZE; }
word32 getPadSize() const { return PAD_SIZE; }
MD4(const MD4&);
MD4& operator= (const MD4&);
void Init();
void Swap(MD4&);
private:
void Transform();
};
inline void swap(MD4& a, MD4& b)
{
a.Swap(b);
}
} // namespace
#endif // TAO_CRYPT_MD4_HPP
...@@ -28,10 +28,6 @@ ...@@ -28,10 +28,6 @@
#ifndef yaSSL_NEW_HPP #ifndef yaSSL_NEW_HPP
#define yaSSL_NEW_HPP #define yaSSL_NEW_HPP
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef __sun #ifdef __sun
......
...@@ -4,7 +4,7 @@ noinst_LTLIBRARIES = libtaocrypt.la ...@@ -4,7 +4,7 @@ noinst_LTLIBRARIES = libtaocrypt.la
libtaocrypt_la_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp \ libtaocrypt_la_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp \
asn.cpp bftables.cpp blowfish.cpp coding.cpp des.cpp dh.cpp \ asn.cpp bftables.cpp blowfish.cpp coding.cpp des.cpp dh.cpp \
dsa.cpp file.cpp hash.cpp integer.cpp md2.cpp md5.cpp misc.cpp \ dsa.cpp file.cpp hash.cpp integer.cpp md2.cpp md4.cpp md5.cpp misc.cpp \
random.cpp ripemd.cpp rsa.cpp sha.cpp template_instnt.cpp \ random.cpp ripemd.cpp rsa.cpp sha.cpp template_instnt.cpp \
tftables.cpp twofish.cpp tftables.cpp twofish.cpp
......
/* md4.cpp
*
* Copyright (C) 2003 Sawtooth Consulting Ltd.
*
* This file is part of yaSSL.
*
* yaSSL 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; either version 2 of the License, or
* (at your option) any later version.
*
* yaSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
/* based on Wei Dai's md4.cpp from CryptoPP */
#include "runtime.hpp"
#include "md4.hpp"
#include "algorithm.hpp" // mySTL::swap
namespace TaoCrypt {
void MD4::Init()
{
digest_[0] = 0x67452301L;
digest_[1] = 0xefcdab89L;
digest_[2] = 0x98badcfeL;
digest_[3] = 0x10325476L;
buffLen_ = 0;
loLen_ = 0;
hiLen_ = 0;
}
MD4::MD4(const MD4& that) : HASHwithTransform(DIGEST_SIZE / sizeof(word32),
BLOCK_SIZE)
{
buffLen_ = that.buffLen_;
loLen_ = that.loLen_;
hiLen_ = that.hiLen_;
memcpy(digest_, that.digest_, DIGEST_SIZE);
memcpy(buffer_, that.buffer_, BLOCK_SIZE);
}
MD4& MD4::operator= (const MD4& that)
{
MD4 tmp(that);
Swap(tmp);
return *this;
}
void MD4::Swap(MD4& other)
{
mySTL::swap(loLen_, other.loLen_);
mySTL::swap(hiLen_, other.hiLen_);
mySTL::swap(buffLen_, other.buffLen_);
memcpy(digest_, other.digest_, DIGEST_SIZE);
memcpy(buffer_, other.buffer_, BLOCK_SIZE);
}
void MD4::Transform()
{
#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
word32 A, B, C, D;
A = digest_[0];
B = digest_[1];
C = digest_[2];
D = digest_[3];
#define function(a,b,c,d,k,s) a=rotlFixed(a+F(b,c,d)+buffer_[k],s);
function(A,B,C,D, 0, 3);
function(D,A,B,C, 1, 7);
function(C,D,A,B, 2,11);
function(B,C,D,A, 3,19);
function(A,B,C,D, 4, 3);
function(D,A,B,C, 5, 7);
function(C,D,A,B, 6,11);
function(B,C,D,A, 7,19);
function(A,B,C,D, 8, 3);
function(D,A,B,C, 9, 7);
function(C,D,A,B,10,11);
function(B,C,D,A,11,19);
function(A,B,C,D,12, 3);
function(D,A,B,C,13, 7);
function(C,D,A,B,14,11);
function(B,C,D,A,15,19);
#undef function
#define function(a,b,c,d,k,s) a=rotlFixed(a+G(b,c,d)+buffer_[k]+0x5a827999,s);
function(A,B,C,D, 0, 3);
function(D,A,B,C, 4, 5);
function(C,D,A,B, 8, 9);
function(B,C,D,A,12,13);
function(A,B,C,D, 1, 3);
function(D,A,B,C, 5, 5);
function(C,D,A,B, 9, 9);
function(B,C,D,A,13,13);
function(A,B,C,D, 2, 3);
function(D,A,B,C, 6, 5);
function(C,D,A,B,10, 9);
function(B,C,D,A,14,13);
function(A,B,C,D, 3, 3);
function(D,A,B,C, 7, 5);
function(C,D,A,B,11, 9);
function(B,C,D,A,15,13);
#undef function
#define function(a,b,c,d,k,s) a=rotlFixed(a+H(b,c,d)+buffer_[k]+0x6ed9eba1,s);
function(A,B,C,D, 0, 3);
function(D,A,B,C, 8, 9);
function(C,D,A,B, 4,11);
function(B,C,D,A,12,15);
function(A,B,C,D, 2, 3);
function(D,A,B,C,10, 9);
function(C,D,A,B, 6,11);
function(B,C,D,A,14,15);
function(A,B,C,D, 1, 3);
function(D,A,B,C, 9, 9);
function(C,D,A,B, 5,11);
function(B,C,D,A,13,15);
function(A,B,C,D, 3, 3);
function(D,A,B,C,11, 9);
function(C,D,A,B, 7,11);
function(B,C,D,A,15,15);
digest_[0] += A;
digest_[1] += B;
digest_[2] += C;
digest_[3] += D;
}
} // namespace
...@@ -30,11 +30,11 @@ ...@@ -30,11 +30,11 @@
#include "sha.hpp" #include "sha.hpp"
#include "md5.hpp" #include "md5.hpp"
#include "hmac.hpp" #include "hmac.hpp"
#include "ripemd.hpp"
#include "pwdbased.hpp" #include "pwdbased.hpp"
#include "algebra.hpp" #include "algebra.hpp"
#include "vector.hpp" #include "vector.hpp"
#include "hash.hpp" #include "hash.hpp"
#include "ripemd.hpp"
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
namespace TaoCrypt { namespace TaoCrypt {
......
...@@ -146,6 +146,10 @@ SOURCE=.\src\md2.cpp ...@@ -146,6 +146,10 @@ SOURCE=.\src\md2.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\md4.cpp
# End Source File
# Begin Source File
SOURCE=.\src\md5.cpp SOURCE=.\src\md5.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
...@@ -246,6 +250,10 @@ SOURCE=.\include\md2.hpp ...@@ -246,6 +250,10 @@ SOURCE=.\include\md2.hpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\include\md4.hpp
# End Source File
# Begin Source File
SOURCE=.\include\md5.hpp SOURCE=.\include\md5.hpp
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "sha.hpp" #include "sha.hpp"
#include "md5.hpp" #include "md5.hpp"
#include "md2.hpp" #include "md2.hpp"
#include "md4.hpp"
#include "ripemd.hpp" #include "ripemd.hpp"
#include "hmac.hpp" #include "hmac.hpp"
#include "arc4.hpp" #include "arc4.hpp"
...@@ -30,6 +31,7 @@ using TaoCrypt::word32; ...@@ -30,6 +31,7 @@ using TaoCrypt::word32;
using TaoCrypt::SHA; using TaoCrypt::SHA;
using TaoCrypt::MD5; using TaoCrypt::MD5;
using TaoCrypt::MD2; using TaoCrypt::MD2;
using TaoCrypt::MD4;
using TaoCrypt::RIPEMD160; using TaoCrypt::RIPEMD160;
using TaoCrypt::HMAC; using TaoCrypt::HMAC;
using TaoCrypt::ARC4; using TaoCrypt::ARC4;
...@@ -89,6 +91,7 @@ void file_test(int, char**); ...@@ -89,6 +91,7 @@ void file_test(int, char**);
int sha_test(); int sha_test();
int md5_test(); int md5_test();
int md2_test(); int md2_test();
int md4_test();
int ripemd_test(); int ripemd_test();
int hmac_test(); int hmac_test();
int arc4_test(); int arc4_test();
...@@ -165,6 +168,11 @@ void taocrypt_test(void* args) ...@@ -165,6 +168,11 @@ void taocrypt_test(void* args)
else else
printf( "MD2 test passed!\n"); printf( "MD2 test passed!\n");
if ( (ret = md4_test()) )
err_sys("MD4 test failed!\n", ret);
else
printf( "MD4 test passed!\n");
if ( (ret = ripemd_test()) ) if ( (ret = ripemd_test()) )
err_sys("RIPEMD test failed!\n", ret); err_sys("RIPEMD test failed!\n", ret);
else else
...@@ -348,6 +356,51 @@ int md5_test() ...@@ -348,6 +356,51 @@ int md5_test()
} }
int md4_test()
{
MD4 md4;
byte hash[MD4::DIGEST_SIZE];
testVector test_md4[] =
{
testVector("",
"\x31\xd6\xcf\xe0\xd1\x6a\xe9\x31\xb7\x3c\x59\xd7\xe0\xc0\x89"
"\xc0"),
testVector("a",
"\xbd\xe5\x2c\xb3\x1d\xe3\x3e\x46\x24\x5e\x05\xfb\xdb\xd6\xfb"
"\x24"),
testVector("abc",
"\xa4\x48\x01\x7a\xaf\x21\xd8\x52\x5f\xc1\x0a\xe8\x7a\xa6\x72"
"\x9d"),
testVector("message digest",
"\xd9\x13\x0a\x81\x64\x54\x9f\xe8\x18\x87\x48\x06\xe1\xc7\x01"
"\x4b"),
testVector("abcdefghijklmnopqrstuvwxyz",
"\xd7\x9e\x1c\x30\x8a\xa5\xbb\xcd\xee\xa8\xed\x63\xdf\x41\x2d"
"\xa9"),
testVector("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345"
"6789",
"\x04\x3f\x85\x82\xf2\x41\xdb\x35\x1c\xe6\x27\xe1\x53\xe7\xf0"
"\xe4"),
testVector("1234567890123456789012345678901234567890123456789012345678"
"9012345678901234567890",
"\xe3\x3b\x4d\xdc\x9c\x38\xf2\x19\x9c\x3e\x7b\x16\x4f\xcc\x05"
"\x36")
};
int times( sizeof(test_md4) / sizeof(testVector) );
for (int i = 0; i < times; ++i) {
md4.Update(test_md4[i].input_, test_md4[i].inLen_);
md4.Final(hash);
if (memcmp(hash, test_md4[i].output_, MD4::DIGEST_SIZE) != 0)
return -5 - i;
}
return 0;
}
int md2_test() int md2_test()
{ {
MD2 md5; MD2 md5;
......
...@@ -33,10 +33,16 @@ ...@@ -33,10 +33,16 @@
// HPUX doesn't use socklent_t for third parameter to accept // HPUX doesn't use socklent_t for third parameter to accept
#if !defined(__hpux__) #if !defined(__hpux)
typedef socklen_t* ACCEPT_THIRD_T; typedef socklen_t* ACCEPT_THIRD_T;
#else #else
typedef int* ACCEPT_THIRD_T; typedef int* ACCEPT_THIRD_T;
// HPUX does not define _POSIX_THREADS as it's not _fully_ implemented
#ifndef _POSIX_THREADS
#define _POSIX_THREADS
#endif
#endif #endif
......
...@@ -68,7 +68,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ ...@@ -68,7 +68,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \ spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \ sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \ parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
event_executor.cc event.cc event_timed.cc \ event_scheduler.cc event.cc event_timed.cc \
rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \ rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
sql_tablespace.cc \ sql_tablespace.cc \
rpl_injector.cc my_user.c partition_info.cc rpl_injector.cc my_user.c partition_info.cc
......
...@@ -17,13 +17,13 @@ db_x ...@@ -17,13 +17,13 @@ db_x
SHOW TABLES FROM db_x; SHOW TABLES FROM db_x;
Tables_in_db_x Tables_in_db_x
x_table x_table
SET GLOBAL event_scheduler=0; SET GLOBAL event_scheduler=2;
DROP EVENT e_x1; DROP EVENT e_x1;
DROP EVENT e_x2; DROP EVENT e_x2;
DROP DATABASE db_x; DROP DATABASE db_x;
DROP USER pauline@localhost; DROP USER pauline@localhost;
USE events_test; USE events_test;
SET GLOBAL event_scheduler=0; SET GLOBAL event_scheduler=2;
drop event if exists event1; drop event if exists event1;
Warnings: Warnings:
Note 1305 Event event1 does not exist Note 1305 Event event1 does not exist
...@@ -100,7 +100,7 @@ a ...@@ -100,7 +100,7 @@ a
800219 800219
drop event non_qualif_ev; drop event non_qualif_ev;
drop table non_qualif; drop table non_qualif;
set global event_scheduler = 0; set global event_scheduler = 2;
create table t_event3 (a int, b float); create table t_event3 (a int, b float);
drop event if exists event3; drop event if exists event3;
Warnings: Warnings:
...@@ -324,18 +324,18 @@ events_test one_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED ...@@ -324,18 +324,18 @@ events_test one_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
"This should show us only 3 events:"; "This should show us only 3 events:";
SHOW FULL EVENTS; SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED events_test one_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
"This should show us only 2 events:"; "This should show us only 2 events:";
SHOW FULL EVENTS LIKE 't%event'; SHOW EVENTS LIKE 't%event';
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
"This should show us no events:"; "This should show us no events:";
SHOW FULL EVENTS FROM test LIKE '%'; SHOW EVENTS FROM test LIKE '%';
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
DROP DATABASE events_test2; DROP DATABASE events_test2;
"should see 1 event:"; "should see 1 event:";
...@@ -343,11 +343,8 @@ SHOW EVENTS; ...@@ -343,11 +343,8 @@ SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED
"we should see 4 events now:"; "we should see 4 events now:";
SHOW FULL EVENTS; SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events; SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
...@@ -373,12 +370,12 @@ ERROR HY000: Incorrect AT value: 'definitely not a datetime' ...@@ -373,12 +370,12 @@ ERROR HY000: Incorrect AT value: 'definitely not a datetime'
set names utf8; set names utf8;
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1; create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
drop event задачка; drop event задачка;
set event_scheduler=0; set event_scheduler=2;
ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL
set global event_scheduler=2; set global event_scheduler=3;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2' ERROR 42000: Variable 'event_scheduler' can't be set to the value of '3'
"DISABLE the scheduler. Testing that it does not work when the variable is 0" "DISABLE the scheduler. Testing that it does not work when the variable is 0"
set global event_scheduler=0; set global event_scheduler=2;
select definer, name, db from mysql.event; select definer, name, db from mysql.event;
definer name db definer name db
select get_lock("test_lock1", 20); select get_lock("test_lock1", 20);
...@@ -389,9 +386,10 @@ create event закачка on schedule every 10 hour do select get_lock("test_l ...@@ -389,9 +386,10 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
select definer, name, db from mysql.event; select definer, name, db from mysql.event;
definer name db definer name db
root@localhost закачка events_test root@localhost закачка events_test
"Should be 0 processes" "Should be only 1 process"
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info user host db command state info
event_scheduler localhost NULL Connect Suspended NULL
select release_lock("test_lock1"); select release_lock("test_lock1");
release_lock("test_lock1") release_lock("test_lock1")
1 1
...@@ -409,11 +407,12 @@ get_lock("test_lock2", 20) ...@@ -409,11 +407,12 @@ get_lock("test_lock2", 20)
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20); create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
"Let some time pass to the event starts" "Let some time pass to the event starts"
"Should have only 2 processes: the scheduler and the locked event" "Should have only 2 processes: the scheduler and the locked event"
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info user host db command state info
event_scheduler localhost NULL Connect Sleeping NULL event_scheduler localhost NULL Connect Sleeping NULL
root localhost events_test Connect User lock select get_lock("test_lock2", 20) root localhost events_test Connect User lock select get_lock("test_lock2", 20)
"Release the mutex, the event worker should finish." "Release the mutex, the event worker should finish."
"Release the mutex, the event worker should finish."
select release_lock("test_lock2"); select release_lock("test_lock2");
release_lock("test_lock2") release_lock("test_lock2")
1 1
...@@ -423,21 +422,17 @@ select get_lock("test_lock2_1", 20); ...@@ -423,21 +422,17 @@ select get_lock("test_lock2_1", 20);
get_lock("test_lock2_1", 20) get_lock("test_lock2_1", 20)
1 1
create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20); create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
"Should see 1 process, locked on get_lock(" "Should have only 3 processes: the scheduler, our conn and the locked event"
"Shutting down the scheduler, it should wait for the running event" select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
set global event_scheduler=0;
"Should have only 2 processes: the scheduler and the locked event"
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info user host db command state info
event_scheduler localhost NULL Connect Sleeping NULL event_scheduler localhost NULL Connect Sleeping NULL
root localhost events_test Connect User lock select get_lock("test_lock2_1", 20) root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
"Release the lock so the child process should finish. Hence the scheduler also" set global event_scheduler=2;
select release_lock("test_lock2_1"); "Should have only our process now:"
release_lock("test_lock2_1") select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
1
"Should see 0 processes now:"
select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info user host db command state info
event_scheduler localhost NULL Connect Suspended NULL
root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
drop event закачка21; drop event закачка21;
create table t_16 (s1 int); create table t_16 (s1 int);
create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5; create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
...@@ -457,6 +452,9 @@ select 2; ...@@ -457,6 +452,9 @@ select 2;
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space'; select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
event_schema event_name definer event_body event_schema event_name definer event_body
events_test white_space root@localhost select 2 events_test white_space root@localhost select 2
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
event_schema event_name definer event_body
events_test white_space root@localhost select 2
drop event white_space; drop event white_space;
create event white_space on schedule every 10 hour disable do select 3; create event white_space on schedule every 10 hour disable do select 3;
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space'; select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
......
...@@ -35,7 +35,7 @@ create event e_55 on schedule every 10 hour starts 99990101000000 do drop table ...@@ -35,7 +35,7 @@ create event e_55 on schedule every 10 hour starts 99990101000000 do drop table
ERROR HY000: Incorrect STARTS value: '99990101000000' ERROR HY000: Incorrect STARTS value: '99990101000000'
create event e_55 on schedule every 10 minute ends 99990101000000 do drop table t; create event e_55 on schedule every 10 minute ends 99990101000000 do drop table t;
ERROR HY000: ENDS is either invalid or before STARTS ERROR HY000: ENDS is either invalid or before STARTS
set global event_scheduler=0; set global event_scheduler=2;
"Wait a bit to settle down" "Wait a bit to settle down"
delete from mysql.event; delete from mysql.event;
set global event_scheduler= 1; set global event_scheduler= 1;
...@@ -57,7 +57,7 @@ root localhost events_test Connect User lock select get_lock('test_bug16407', 60 ...@@ -57,7 +57,7 @@ root localhost events_test Connect User lock select get_lock('test_bug16407', 60
select release_lock('test_bug16407'); select release_lock('test_bug16407');
release_lock('test_bug16407') release_lock('test_bug16407')
1 1
set global event_scheduler= 0; set global event_scheduler= 2;
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
event_schema event_name sql_mode event_schema event_name sql_mode
events_test e_16407 REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI events_test e_16407 REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
...@@ -115,7 +115,7 @@ release_lock('ee_16407_2') ...@@ -115,7 +115,7 @@ release_lock('ee_16407_2')
select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info user host db command state info
event_scheduler localhost NULL Connect Sleeping NULL event_scheduler localhost NULL Connect Sleeping NULL
set global event_scheduler= 0; set global event_scheduler= 2;
select * from events_smode_test order by ev_name, a; select * from events_smode_test order by ev_name, a;
ev_name a ev_name a
ee_16407_3 1980-02-19 ee_16407_3 1980-02-19
...@@ -175,7 +175,7 @@ drop event ee_16407_5; ...@@ -175,7 +175,7 @@ drop event ee_16407_5;
drop event ee_16407_6; drop event ee_16407_6;
drop procedure ee_16407_5_pendant; drop procedure ee_16407_5_pendant;
drop procedure ee_16407_6_pendant; drop procedure ee_16407_6_pendant;
set global event_scheduler= 0; set global event_scheduler= 2;
drop table events_smode_test; drop table events_smode_test;
set sql_mode=@old_sql_mode; set sql_mode=@old_sql_mode;
drop database events_test; drop database events_test;
...@@ -8,7 +8,7 @@ BEGIN ...@@ -8,7 +8,7 @@ BEGIN
SELECT user_host, argument FROM mysql.general_log WHERE argument LIKE '%alabala%'; SELECT user_host, argument FROM mysql.general_log WHERE argument LIKE '%alabala%';
END| END|
"Check General Query Log" "Check General Query Log"
SET GLOBAL event_scheduler=0; SET GLOBAL event_scheduler=2;
create event log_general on schedule every 1 minute do SELect 'alabala', sleep(3) from dual; create event log_general on schedule every 1 minute do SELect 'alabala', sleep(3) from dual;
TRUNCATE mysql.general_log; TRUNCATE mysql.general_log;
"1 row, the current statement!" "1 row, the current statement!"
...@@ -22,7 +22,7 @@ user_host argument ...@@ -22,7 +22,7 @@ user_host argument
root[root] @ localhost [localhost] SELect 'alabala', sleep(3) from dual root[root] @ localhost [localhost] SELect 'alabala', sleep(3) from dual
DROP PROCEDURE select_general_log; DROP PROCEDURE select_general_log;
DROP EVENT log_general; DROP EVENT log_general;
SET GLOBAL event_scheduler=0; SET GLOBAL event_scheduler=2;
"Check slow query log" "Check slow query log"
"Save the values" "Save the values"
SET @old_global_long_query_time:=(select get_value()); SET @old_global_long_query_time:=(select get_value());
...@@ -36,14 +36,14 @@ SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; ...@@ -36,14 +36,14 @@ SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host query_time db sql_text user_host query_time db sql_text
"Set new values" "Set new values"
SET GLOBAL long_query_time=4; SET GLOBAL long_query_time=4;
SET SESSION long_query_time=2; SET SESSION long_query_time=1;
"Check that logging is working" "Check that logging is working"
SELECT SLEEP(3); SELECT SLEEP(2);
SLEEP(3) SLEEP(2)
0 0
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host query_time db sql_text user_host query_time db sql_text
root[root] @ localhost [] SLEEPVAL events_test SELECT SLEEP(3) root[root] @ localhost [] SLEEPVAL events_test SELECT SLEEP(2)
TRUNCATE mysql.slow_log; TRUNCATE mysql.slow_log;
CREATE TABLE slow_event_test (slo_val tinyint, val tinyint); CREATE TABLE slow_event_test (slo_val tinyint, val tinyint);
"This won't go to the slow log" "This won't go to the slow log"
...@@ -54,7 +54,7 @@ SET GLOBAL event_scheduler=1; ...@@ -54,7 +54,7 @@ SET GLOBAL event_scheduler=1;
"Sleep some more time than the actual event run will take" "Sleep some more time than the actual event run will take"
SHOW VARIABLES LIKE 'event_scheduler'; SHOW VARIABLES LIKE 'event_scheduler';
Variable_name Value Variable_name Value
event_scheduler ON event_scheduler 1
"Check our table. Should see 1 row" "Check our table. Should see 1 row"
SELECT * FROM slow_event_test; SELECT * FROM slow_event_test;
slo_val val slo_val val
...@@ -64,18 +64,19 @@ SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; ...@@ -64,18 +64,19 @@ SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host query_time db sql_text user_host query_time db sql_text
"This should go to the slow log" "This should go to the slow log"
SET SESSION long_query_time=10; SET SESSION long_query_time=10;
SET GLOBAL long_query_time=1;
DROP EVENT long_event; DROP EVENT long_event;
CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(5); CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2);
"Sleep some more time than the actual event run will take" "Sleep some more time than the actual event run will take"
"Check our table. Should see 2 rows" "Check our table. Should see 2 rows"
SELECT * FROM slow_event_test; SELECT * FROM slow_event_test;
slo_val val slo_val val
4 0 4 0
4 0 1 0
"Check slow log. Should see 1 row because 5 is over the threshold of 4 for GLOBAL, though under SESSION which is 10" "Check slow log. Should see 1 row because 4 is over the threshold of 3 for GLOBAL, though under SESSION which is 10"
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host query_time db sql_text user_host query_time db sql_text
root[root] @ localhost [localhost] SLEEPVAL events_test INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(5) root[root] @ localhost [localhost] SLEEPVAL events_test INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2)
DROP EVENT long_event2; DROP EVENT long_event2;
SET GLOBAL long_query_time =@old_global_long_query_time; SET GLOBAL long_query_time =@old_global_long_query_time;
SET SESSION long_query_time =@old_session_long_query_time; SET SESSION long_query_time =@old_session_long_query_time;
......
...@@ -10,50 +10,4 @@ CREATE EVENT micro_test ON SCHEDULE EVERY 100 MINUTE_MICROSECOND DO SELECT 1; ...@@ -10,50 +10,4 @@ CREATE EVENT micro_test ON SCHEDULE EVERY 100 MINUTE_MICROSECOND DO SELECT 1;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND' ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
CREATE EVENT micro_test ON SCHEDULE EVERY 100 SECOND_MICROSECOND DO SELECT 1; CREATE EVENT micro_test ON SCHEDULE EVERY 100 SECOND_MICROSECOND DO SELECT 1;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND' ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
"Now create normal event and change it on SQL level"
CREATE EVENT micro_test2 ON SCHEDULE EVERY 1 MONTH DO SELECT 1;
UPDATE mysql.event SET interval_field='MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
SHOW CREATE EVENT micro_test2;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
SET GLOBAL event_scheduler=0;
"Should not be running:"
SHOW VARIABLES like 'event_scheduler';
Variable_name Value
event_scheduler OFF
UPDATE mysql.event SET interval_field='DAY_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
SHOW CREATE EVENT micro_test2;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
SET GLOBAL event_scheduler=0;
"Should not be running:"
SHOW VARIABLES like 'event_scheduler';
Variable_name Value
event_scheduler OFF
UPDATE mysql.event SET interval_field='SECOND_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
SHOW CREATE EVENT micro_test2;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
SET GLOBAL event_scheduler=0;
"Should not be running:"
SHOW VARIABLES like 'event_scheduler';
Variable_name Value
event_scheduler OFF
UPDATE mysql.event SET interval_field='HOUR_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
SHOW CREATE EVENT micro_test2;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
SET GLOBAL event_scheduler=0;
"Should not be running:"
SHOW VARIABLES like 'event_scheduler';
Variable_name Value
event_scheduler OFF
UPDATE mysql.event SET interval_field='MINUTE_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
SHOW CREATE EVENT micro_test2;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
SET GLOBAL event_scheduler=0;
"Should not be running:"
SHOW VARIABLES like 'event_scheduler';
Variable_name Value
event_scheduler OFF
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER='event_scheduler';
COUNT(*)
0
DROP EVENT micro_test2;
drop database events_test; drop database events_test;
...@@ -14,7 +14,7 @@ ENDS NOW() + INTERVAL 6 SECOND ...@@ -14,7 +14,7 @@ ENDS NOW() + INTERVAL 6 SECOND
ON COMPLETION PRESERVE ON COMPLETION PRESERVE
DO INSERT INTO table_2 VALUES(1); DO INSERT INTO table_2 VALUES(1);
CREATE EVENT only_one_time ON SCHEDULE EVERY 2 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_3 VALUES(1); CREATE EVENT only_one_time ON SCHEDULE EVERY 2 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_3 VALUES(1);
CREATE EVENT two_time ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_4 VALUES(1); CREATE EVENT two_time ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND ON COMPLETION PRESERVE DO INSERT INTO table_4 VALUES(1);
SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1; SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
IF(SUM(a) >= 4, 'OK', 'ERROR') IF(SUM(a) >= 4, 'OK', 'ERROR')
OK OK
...@@ -38,9 +38,12 @@ DROP EVENT start_n_end; ...@@ -38,9 +38,12 @@ DROP EVENT start_n_end;
"Already dropped because ended. Therefore an error." "Already dropped because ended. Therefore an error."
DROP EVENT only_one_time; DROP EVENT only_one_time;
ERROR HY000: Unknown event 'only_one_time' ERROR HY000: Unknown event 'only_one_time'
"Already dropped because ended. Therefore an error." "Should be preserved"
SELECT EVENT_NAME, STATUS FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME STATUS
E19170 ENABLED
two_time DISABLED
DROP EVENT two_time; DROP EVENT two_time;
ERROR HY000: Unknown event 'two_time'
DROP TABLE table_1; DROP TABLE table_1;
DROP TABLE table_2; DROP TABLE table_2;
DROP TABLE table_3; DROP TABLE table_3;
......
CREATE DATABASE IF NOT EXISTS events_test; CREATE DATABASE IF NOT EXISTS events_test;
CREATE DATABASE events_test2; CREATE DATABASE events_conn1_test2;
USE events_test2; CREATE TABLE events_test.fill_it(test_name varchar(20), occur datetime);
CREATE USER event_user2@localhost;
CREATE DATABASE events_conn2_db;
GRANT ALL ON *.* TO event_user2@localhost;
CREATE USER event_user3@localhost;
CREATE DATABASE events_conn3_db;
GRANT ALL ON *.* TO event_user3@localhost;
"In the second connection we create some events which won't be dropped till the end"
"In the second connection we create some events which won't be dropped till the end"
USE events_conn1_test2;
CREATE EVENT ev_drop1 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1; CREATE EVENT ev_drop1 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
CREATE EVENT ev_drop2 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1; CREATE EVENT ev_drop2 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
CREATE EVENT ev_drop3 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1; CREATE EVENT ev_drop3 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
USE events_test; USE events_test;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_test2'; SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS;
COUNT(*)
203
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
COUNT(*) COUNT(*)
3 3
DROP DATABASE events_test2; DROP DATABASE events_conn1_test2;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_test2'; SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
COUNT(*) COUNT(*)
0 0
"Now testing stability - dropping db -> events while they are running" "Now testing stability - dropping db -> events while they are running"
CREATE DATABASE events_test2; CREATE DATABASE events_conn1_test2;
USE events_test2; USE events_conn1_test2;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_test2'; SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
COUNT(*) COUNT(*)
1000 100
SET GLOBAL event_scheduler=1; SET GLOBAL event_scheduler=1;
DROP DATABASE events_test2; DROP DATABASE events_conn1_test2;
SET GLOBAL event_scheduler=0; SET GLOBAL event_scheduler=2;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_test2'; SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
COUNT(*) COUNT(*)
0 0
CREATE DATABASE events_test3; CREATE DATABASE events_conn1_test3;
USE events_test3; USE events_conn1_test3;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_test3'; SET GLOBAL event_scheduler=1;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test3';
COUNT(*) COUNT(*)
950 100
CREATE DATABASE events_test4; CREATE DATABASE events_conn1_test4;
USE events_test4; USE events_conn1_test4;
CREATE DATABASE events_test2; CREATE DATABASE events_conn1_test2;
USE events_test2; USE events_conn1_test2;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_test2'; SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
COUNT(*) COUNT(*)
1050 100
DROP DATABASE events_test2; DROP DATABASE events_conn2_db;
SET GLOBAL event_scheduler=0; DROP DATABASE events_conn3_db;
DROP DATABASE events_test3; DROP DATABASE events_conn1_test2;
SET GLOBAL event_scheduler=1; DROP DATABASE events_conn1_test3;
DROP DATABASE events_test4; SET GLOBAL event_scheduler=2;
DROP DATABASE events_conn1_test4;
SET GLOBAL event_scheduler=1; SET GLOBAL event_scheduler=1;
USE events_test; USE events_test;
DROP TABLE fill_it;
DROP DATABASE events_test; DROP DATABASE events_test;
...@@ -821,144 +821,6 @@ SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6; ...@@ -821,144 +821,6 @@ SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
MAX(id) MAX(id)
NULL NULL
DROP TABLE t1; DROP TABLE t1;
create table t1m (a int) engine=myisam;
create table t1i (a int) engine=innodb;
create table t2m (a int) engine=myisam;
create table t2i (a int) engine=innodb;
insert into t2m values (5);
insert into t2i values (5);
select min(a) from t1m;
min(a)
NULL
select min(7) from t1m;
min(7)
NULL
select min(7) from DUAL;
min(7)
NULL
explain select min(7) from t2m join t1m;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
select min(7) from t2m join t1m;
min(7)
NULL
select max(a) from t1m;
max(a)
NULL
select max(7) from t1m;
max(7)
NULL
select max(7) from DUAL;
max(7)
NULL
explain select max(7) from t2m join t1m;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
select max(7) from t2m join t1m;
max(7)
NULL
select 1, min(a) from t1m where a=99;
1 min(a)
1 NULL
select 1, min(a) from t1m where 1=99;
1 min(a)
1 NULL
select 1, min(1) from t1m where a=99;
1 min(1)
1 NULL
select 1, min(1) from t1m where 1=99;
1 min(1)
1 NULL
select 1, max(a) from t1m where a=99;
1 max(a)
1 NULL
select 1, max(a) from t1m where 1=99;
1 max(a)
1 NULL
select 1, max(1) from t1m where a=99;
1 max(1)
1 NULL
select 1, max(1) from t1m where 1=99;
1 max(1)
1 NULL
select min(a) from t1i;
min(a)
NULL
select min(7) from t1i;
min(7)
NULL
select min(7) from DUAL;
min(7)
NULL
explain select min(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select min(7) from t2i join t1i;
min(7)
NULL
select max(a) from t1i;
max(a)
NULL
select max(7) from t1i;
max(7)
NULL
select max(7) from DUAL;
max(7)
NULL
explain select max(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select max(7) from t2i join t1i;
max(7)
NULL
select 1, min(a) from t1i where a=99;
1 min(a)
1 NULL
select 1, min(a) from t1i where 1=99;
1 min(a)
1 NULL
select 1, min(1) from t1i where a=99;
1 min(1)
1 NULL
select 1, min(1) from t1i where 1=99;
1 min(1)
1 NULL
select 1, max(a) from t1i where a=99;
1 max(a)
1 NULL
select 1, max(a) from t1i where 1=99;
1 max(a)
1 NULL
select 1, max(1) from t1i where a=99;
1 max(1)
1 NULL
select 1, max(1) from t1i where 1=99;
1 max(1)
1 NULL
explain select count(*), min(7), max(7) from t1m, t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select count(*), min(7), max(7) from t1m, t1i;
count(*) min(7) max(7)
0 NULL NULL
explain select count(*), min(7), max(7) from t1m, t2i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
select count(*), min(7), max(7) from t1m, t2i;
count(*) min(7) max(7)
0 NULL NULL
explain select count(*), min(7), max(7) from t2m, t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2m system NULL NULL NULL NULL 1
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select count(*), min(7), max(7) from t2m, t1i;
count(*) min(7) max(7)
0 NULL NULL
drop table t1m, t1i, t2m, t2i;
create table t2 (ff double); create table t2 (ff double);
insert into t2 values (2.2); insert into t2 values (2.2);
select cast(sum(distinct ff) as decimal(5,2)) from t2; select cast(sum(distinct ff) as decimal(5,2)) from t2;
......
...@@ -54,3 +54,141 @@ c.c_id = 218 and expiredate is null; ...@@ -54,3 +54,141 @@ c.c_id = 218 and expiredate is null;
slai_id slai_id
12 12
drop table t1, t2; drop table t1, t2;
create table t1m (a int) engine=myisam;
create table t1i (a int) engine=innodb;
create table t2m (a int) engine=myisam;
create table t2i (a int) engine=innodb;
insert into t2m values (5);
insert into t2i values (5);
select min(a) from t1m;
min(a)
NULL
select min(7) from t1m;
min(7)
NULL
select min(7) from DUAL;
min(7)
NULL
explain select min(7) from t2m join t1m;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
select min(7) from t2m join t1m;
min(7)
NULL
select max(a) from t1m;
max(a)
NULL
select max(7) from t1m;
max(7)
NULL
select max(7) from DUAL;
max(7)
NULL
explain select max(7) from t2m join t1m;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
select max(7) from t2m join t1m;
max(7)
NULL
select 1, min(a) from t1m where a=99;
1 min(a)
1 NULL
select 1, min(a) from t1m where 1=99;
1 min(a)
1 NULL
select 1, min(1) from t1m where a=99;
1 min(1)
1 NULL
select 1, min(1) from t1m where 1=99;
1 min(1)
1 NULL
select 1, max(a) from t1m where a=99;
1 max(a)
1 NULL
select 1, max(a) from t1m where 1=99;
1 max(a)
1 NULL
select 1, max(1) from t1m where a=99;
1 max(1)
1 NULL
select 1, max(1) from t1m where 1=99;
1 max(1)
1 NULL
select min(a) from t1i;
min(a)
NULL
select min(7) from t1i;
min(7)
NULL
select min(7) from DUAL;
min(7)
NULL
explain select min(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select min(7) from t2i join t1i;
min(7)
NULL
select max(a) from t1i;
max(a)
NULL
select max(7) from t1i;
max(7)
NULL
select max(7) from DUAL;
max(7)
NULL
explain select max(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select max(7) from t2i join t1i;
max(7)
NULL
select 1, min(a) from t1i where a=99;
1 min(a)
1 NULL
select 1, min(a) from t1i where 1=99;
1 min(a)
1 NULL
select 1, min(1) from t1i where a=99;
1 min(1)
1 NULL
select 1, min(1) from t1i where 1=99;
1 min(1)
1 NULL
select 1, max(a) from t1i where a=99;
1 max(a)
1 NULL
select 1, max(a) from t1i where 1=99;
1 max(a)
1 NULL
select 1, max(1) from t1i where a=99;
1 max(1)
1 NULL
select 1, max(1) from t1i where 1=99;
1 max(1)
1 NULL
explain select count(*), min(7), max(7) from t1m, t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select count(*), min(7), max(7) from t1m, t1i;
count(*) min(7) max(7)
0 NULL NULL
explain select count(*), min(7), max(7) from t1m, t2i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
select count(*), min(7), max(7) from t1m, t2i;
count(*) min(7) max(7)
0 NULL NULL
explain select count(*), min(7), max(7) from t2m, t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2m system NULL NULL NULL NULL 1
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select count(*), min(7), max(7) from t2m, t1i;
count(*) min(7) max(7)
0 NULL NULL
drop table t1m, t1i, t2m, t2i;
...@@ -9,11 +9,10 @@ ...@@ -9,11 +9,10 @@
# Do not use any TAB characters for whitespace. # Do not use any TAB characters for whitespace.
# #
############################################################################## ##############################################################################
events_bugs : BUG#17619 2006-02-21 andrey Race conditions #events_bugs : BUG#17619 2006-02-21 andrey Race conditions
events_stress : BUG#17619 2006-02-21 andrey Race conditions #events_stress : BUG#17619 2006-02-21 andrey Race conditions
events : BUG#17619 2006-02-21 andrey Race conditions #events : BUG#17619 2006-02-21 andrey Race conditions
events_scheduling : BUG#19170 2006-04-26 andrey Test case of 19170 fails on some platforms. Has to be checked. #events_scheduling : BUG#19170 2006-04-26 andrey Test case of 19170 fails on some platforms. Has to be checked.
events_logs_tests : BUG#17619 2006-05-16 andrey Test case problems
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
#ndb_binlog_discover : BUG#19395 2006-04-28 tomas/knielsen mysqld does not always detect cluster shutdown #ndb_binlog_discover : BUG#19395 2006-04-28 tomas/knielsen mysqld does not always detect cluster shutdown
......
...@@ -15,11 +15,10 @@ CREATE EVENT e_x2 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE x_table; ...@@ -15,11 +15,10 @@ CREATE EVENT e_x2 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE x_table;
connection default; connection default;
SHOW DATABASES LIKE 'db_x'; SHOW DATABASES LIKE 'db_x';
SET GLOBAL event_scheduler=1; SET GLOBAL event_scheduler=1;
--sleep 2 --sleep 1.5
SHOW DATABASES LIKE 'db_x'; SHOW DATABASES LIKE 'db_x';
SHOW TABLES FROM db_x; SHOW TABLES FROM db_x;
SET GLOBAL event_scheduler=0; SET GLOBAL event_scheduler=2;
--sleep 1
connection priv_conn; connection priv_conn;
DROP EVENT e_x1; DROP EVENT e_x1;
DROP EVENT e_x2; DROP EVENT e_x2;
...@@ -31,8 +30,7 @@ USE events_test; ...@@ -31,8 +30,7 @@ USE events_test;
# #
# END: BUG #17289 Events: missing privilege check for drop database # END: BUG #17289 Events: missing privilege check for drop database
# #
SET GLOBAL event_scheduler=0; SET GLOBAL event_scheduler=2;
--sleep 1
drop event if exists event1; drop event if exists event1;
create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end; create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end;
alter event event1 rename to event2 enable; alter event event1 rename to event2 enable;
...@@ -92,11 +90,11 @@ drop event e_43; ...@@ -92,11 +90,11 @@ drop event e_43;
--echo "Let's check whether we can use non-qualified names" --echo "Let's check whether we can use non-qualified names"
create table non_qualif(a int); create table non_qualif(a int);
create event non_qualif_ev on schedule every 10 minute do insert into non_qualif values (800219); create event non_qualif_ev on schedule every 10 minute do insert into non_qualif values (800219);
--sleep 2 --sleep 1
select * from non_qualif; select * from non_qualif;
drop event non_qualif_ev; drop event non_qualif_ev;
drop table non_qualif; drop table non_qualif;
set global event_scheduler = 0; set global event_scheduler = 2;
create table t_event3 (a int, b float); create table t_event3 (a int, b float);
drop event if exists event3; drop event if exists event3;
...@@ -281,15 +279,15 @@ SHOW EVENTS; ...@@ -281,15 +279,15 @@ SHOW EVENTS;
--echo "This should show us only 3 events:"; --echo "This should show us only 3 events:";
--replace_column 8 # 9 # --replace_column 8 # 9 #
SHOW FULL EVENTS; SHOW EVENTS;
--echo "This should show us only 2 events:"; --echo "This should show us only 2 events:";
--replace_column 8 # 9 # --replace_column 8 # 9 #
SHOW FULL EVENTS LIKE 't%event'; SHOW EVENTS LIKE 't%event';
--echo "This should show us no events:"; --echo "This should show us no events:";
--replace_column 8 # 9 # --replace_column 8 # 9 #
SHOW FULL EVENTS FROM test LIKE '%'; SHOW EVENTS FROM test LIKE '%';
#ok, we are back #ok, we are back
connection default; connection default;
DROP DATABASE events_test2; DROP DATABASE events_test2;
...@@ -300,7 +298,7 @@ SHOW EVENTS; ...@@ -300,7 +298,7 @@ SHOW EVENTS;
--echo "we should see 4 events now:"; --echo "we should see 4 events now:";
--replace_column 8 # 9 # --replace_column 8 # 9 #
SHOW FULL EVENTS; SHOW EVENTS;
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events; SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
connection ev_con1; connection ev_con1;
...@@ -330,21 +328,21 @@ create event задачка on schedule every 123 minute starts now() ends now() ...@@ -330,21 +328,21 @@ create event задачка on schedule every 123 minute starts now() ends now()
drop event задаÑка; drop event задаÑка;
# event_scheduler is a global var # event_scheduler is a global var
--error 1229 --error ER_GLOBAL_VARIABLE
set event_scheduler=0; set event_scheduler=2;
# event_scheduler could be only either 0 or 1 # event_scheduler could be only either 1 or 2
--error 1231 --error ER_WRONG_VALUE_FOR_VAR
set global event_scheduler=2; set global event_scheduler=3;
--echo "DISABLE the scheduler. Testing that it does not work when the variable is 0" --echo "DISABLE the scheduler. Testing that it does not work when the variable is 0"
set global event_scheduler=0; set global event_scheduler=2;
select definer, name, db from mysql.event; select definer, name, db from mysql.event;
select get_lock("test_lock1", 20); select get_lock("test_lock1", 20);
create event закаÑка on schedule every 10 hour do select get_lock("test_lock1", 20); create event закаÑка on schedule every 10 hour do select get_lock("test_lock1", 20);
--echo "Should return 1 row" --echo "Should return 1 row"
select definer, name, db from mysql.event; select definer, name, db from mysql.event;
--echo "Should be 0 processes" --echo "Should be only 1 process"
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select release_lock("test_lock1"); select release_lock("test_lock1");
drop event закаÑка; drop event закаÑка;
...@@ -362,7 +360,7 @@ create event закачка on schedule every 10 hour do select get_lock("test_l ...@@ -362,7 +360,7 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
--echo "Let some time pass to the event starts" --echo "Let some time pass to the event starts"
--sleep 2 --sleep 2
--echo "Should have only 2 processes: the scheduler and the locked event" --echo "Should have only 2 processes: the scheduler and the locked event"
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;--echo "Release the mutex, the event worker should finish."
--echo "Release the mutex, the event worker should finish." --echo "Release the mutex, the event worker should finish."
select release_lock("test_lock2"); select release_lock("test_lock2");
drop event закаÑка; drop event закаÑка;
...@@ -379,18 +377,11 @@ set global event_scheduler=1; ...@@ -379,18 +377,11 @@ set global event_scheduler=1;
select get_lock("test_lock2_1", 20); select get_lock("test_lock2_1", 20);
create event закаÑка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20); create event закаÑка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
--sleep 1 --sleep 1
--echo "Should see 1 process, locked on get_lock(" --echo "Should have only 3 processes: the scheduler, our conn and the locked event"
#select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
--echo "Shutting down the scheduler, it should wait for the running event" set global event_scheduler=2;
set global event_scheduler=0; --echo "Should have only our process now:"
--sleep 1
--echo "Should have only 2 processes: the scheduler and the locked event"
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
--echo "Release the lock so the child process should finish. Hence the scheduler also"
select release_lock("test_lock2_1");
--sleep 1
--echo "Should see 0 processes now:"
select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
drop event закаÑка21; drop event закаÑка21;
#### ####
...@@ -418,6 +409,7 @@ create event white_space on schedule every 10 hour disable do ...@@ -418,6 +409,7 @@ create event white_space on schedule every 10 hour disable do
select 2; select 2;
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space'; select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
drop event white_space; drop event white_space;
create event white_space on schedule every 10 hour disable do select 3; create event white_space on schedule every 10 hour disable do select 3;
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space'; select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
...@@ -426,7 +418,7 @@ drop event white_space; ...@@ -426,7 +418,7 @@ drop event white_space;
# END: BUG #17453: Creating Event crash the server # END: BUG #17453: Creating Event crash the server
# #
##set global event_scheduler=1; #
# Bug#17403 "Events: packets out of order with show create event" # Bug#17403 "Events: packets out of order with show create event"
# #
create event e1 on schedule every 1 year do set @a = 5; create event e1 on schedule every 1 year do set @a = 5;
...@@ -440,7 +432,7 @@ drop event e1; ...@@ -440,7 +432,7 @@ drop event e1;
##select get_lock("test_lock3", 20); ##select get_lock("test_lock3", 20);
##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20); ##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
##select sleep(2); ##select sleep(2);
##show processlist; ##select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
##drop event закачка; ##drop event закачка;
##select release_lock("test_lock3"); ##select release_lock("test_lock3");
...@@ -450,14 +442,14 @@ drop event e1; ...@@ -450,14 +442,14 @@ drop event e1;
##select get_lock("test_lock4", 20); ##select get_lock("test_lock4", 20);
##create event закачка4 on schedule every 1 second do select get_lock("test_lock4", 20); ##create event закачка4 on schedule every 1 second do select get_lock("test_lock4", 20);
##select sleep(3); ##select sleep(3);
##--replace_column 1 # 6 # ##select /*6*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
##drop event закачка4; ##drop event закачка4;
##select release_lock("test_lock4"); ##select release_lock("test_lock4");
##set global event_scheduler=0; ##set global event_scheduler=2;
##select sleep(2); ##select sleep(2);
##--replace_column 1 # 6 # ##--replace_column 1 # 6 #
##show processlist;
##select count(*) from mysql.event; ##select count(*) from mysql.event;
drop database events_test; drop database events_test;
...@@ -30,13 +30,13 @@ set @a=3; ...@@ -30,13 +30,13 @@ set @a=3;
CREATE PROCEDURE p_16 () CREATE EVENT e_16 ON SCHEDULE EVERY @a SECOND DO SET @a=5; CREATE PROCEDURE p_16 () CREATE EVENT e_16 ON SCHEDULE EVERY @a SECOND DO SET @a=5;
call p_16(); call p_16();
--echo "Here we used to crash!" --echo "Here we used to crash!"
--error 1516 --error ER_EVENT_ALREADY_EXISTS
call p_16(); call p_16();
--error 1516 --error ER_EVENT_ALREADY_EXISTS
call p_16(); call p_16();
DROP EVENT e_16; DROP EVENT e_16;
CALL p_16(); CALL p_16();
--error 1516 --error ER_EVENT_ALREADY_EXISTS
CALL p_16(); CALL p_16();
DROP PROCEDURE p_16; DROP PROCEDURE p_16;
DROP EVENT e_16; DROP EVENT e_16;
...@@ -47,9 +47,9 @@ DROP EVENT e_16; ...@@ -47,9 +47,9 @@ DROP EVENT e_16;
# #
# Start - 16396: Events: Distant-future dates become past dates # Start - 16396: Events: Distant-future dates become past dates
# #
--error 1504 --error ER_WRONG_VALUE
create event e_55 on schedule at 99990101000000 do drop table t; create event e_55 on schedule at 99990101000000 do drop table t;
--error 1504 --error ER_WRONG_VALUE
create event e_55 on schedule every 10 hour starts 99990101000000 do drop table t; create event e_55 on schedule every 10 hour starts 99990101000000 do drop table t;
--error ER_EVENT_ENDS_BEFORE_STARTS --error ER_EVENT_ENDS_BEFORE_STARTS
create event e_55 on schedule every 10 minute ends 99990101000000 do drop table t; create event e_55 on schedule every 10 minute ends 99990101000000 do drop table t;
...@@ -60,7 +60,7 @@ create event e_55 on schedule every 10 minute ends 99990101000000 do drop table ...@@ -60,7 +60,7 @@ create event e_55 on schedule every 10 minute ends 99990101000000 do drop table
# #
# Start - 16407: Events: Changes in sql_mode won't be taken into account # Start - 16407: Events: Changes in sql_mode won't be taken into account
# #
set global event_scheduler=0; set global event_scheduler=2;
--echo "Wait a bit to settle down" --echo "Wait a bit to settle down"
--sleep 1 --sleep 1
delete from mysql.event; delete from mysql.event;
...@@ -79,7 +79,7 @@ delimiter ;| ...@@ -79,7 +79,7 @@ delimiter ;|
--echo "Now if everything is fine the event has compiled and is locked --echo "Now if everything is fine the event has compiled and is locked
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select release_lock('test_bug16407'); select release_lock('test_bug16407');
set global event_scheduler= 0; set global event_scheduler= 2;
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
--echo "Let's check whether we change the sql_mode on ALTER EVENT" --echo "Let's check whether we change the sql_mode on ALTER EVENT"
set sql_mode='traditional'; set sql_mode='traditional';
...@@ -121,9 +121,9 @@ set global event_scheduler= 1; ...@@ -121,9 +121,9 @@ set global event_scheduler= 1;
--sleep 1 --sleep 1
select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select release_lock('ee_16407_2'); select release_lock('ee_16407_2');
--sleep 3 --sleep 2
select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
set global event_scheduler= 0; set global event_scheduler= 2;
select * from events_smode_test order by ev_name, a; select * from events_smode_test order by ev_name, a;
--echo "OK, last check before we drop them" --echo "OK, last check before we drop them"
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
...@@ -156,7 +156,7 @@ set global event_scheduler= 1; ...@@ -156,7 +156,7 @@ set global event_scheduler= 1;
--echo "Should have 2 locked processes" --echo "Should have 2 locked processes"
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select release_lock('ee_16407_5'); select release_lock('ee_16407_5');
--sleep 3 --sleep 2
--echo "Should have 0 processes locked" --echo "Should have 0 processes locked"
select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select * from events_smode_test order by ev_name, a; select * from events_smode_test order by ev_name, a;
...@@ -166,7 +166,7 @@ drop event ee_16407_5; ...@@ -166,7 +166,7 @@ drop event ee_16407_5;
drop event ee_16407_6; drop event ee_16407_6;
drop procedure ee_16407_5_pendant; drop procedure ee_16407_5_pendant;
drop procedure ee_16407_6_pendant; drop procedure ee_16407_6_pendant;
set global event_scheduler= 0; set global event_scheduler= 2;
drop table events_smode_test; drop table events_smode_test;
set sql_mode=@old_sql_mode; set sql_mode=@old_sql_mode;
# #
......
...@@ -10,7 +10,7 @@ BEGIN ...@@ -10,7 +10,7 @@ BEGIN
END| END|
delimiter ;| delimiter ;|
--echo "Check General Query Log" --echo "Check General Query Log"
SET GLOBAL event_scheduler=0; SET GLOBAL event_scheduler=2;
create event log_general on schedule every 1 minute do SELect 'alabala', sleep(3) from dual; create event log_general on schedule every 1 minute do SELect 'alabala', sleep(3) from dual;
TRUNCATE mysql.general_log; TRUNCATE mysql.general_log;
--echo "1 row, the current statement!" --echo "1 row, the current statement!"
...@@ -22,7 +22,7 @@ SET GLOBAL event_scheduler=1; ...@@ -22,7 +22,7 @@ SET GLOBAL event_scheduler=1;
call select_general_log(); call select_general_log();
DROP PROCEDURE select_general_log; DROP PROCEDURE select_general_log;
DROP EVENT log_general; DROP EVENT log_general;
SET GLOBAL event_scheduler=0; SET GLOBAL event_scheduler=2;
--sleep 1 --sleep 1
--echo "Check slow query log" --echo "Check slow query log"
...@@ -53,10 +53,10 @@ TRUNCATE mysql.slow_log; ...@@ -53,10 +53,10 @@ TRUNCATE mysql.slow_log;
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
--echo "Set new values" --echo "Set new values"
SET GLOBAL long_query_time=4; SET GLOBAL long_query_time=4;
SET SESSION long_query_time=2; SET SESSION long_query_time=1;
--echo "Check that logging is working" --echo "Check that logging is working"
SELECT SLEEP(3); SELECT SLEEP(2);
--replace_regex /00:00:0[3-5]/SLEEPVAL/ --replace_regex /00:00:0[2-4]/SLEEPVAL/
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
TRUNCATE mysql.slow_log; TRUNCATE mysql.slow_log;
CREATE TABLE slow_event_test (slo_val tinyint, val tinyint); CREATE TABLE slow_event_test (slo_val tinyint, val tinyint);
...@@ -73,14 +73,15 @@ SELECT * FROM slow_event_test; ...@@ -73,14 +73,15 @@ SELECT * FROM slow_event_test;
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
--echo "This should go to the slow log" --echo "This should go to the slow log"
SET SESSION long_query_time=10; SET SESSION long_query_time=10;
SET GLOBAL long_query_time=1;
DROP EVENT long_event; DROP EVENT long_event;
CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(5); CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2);
--echo "Sleep some more time than the actual event run will take" --echo "Sleep some more time than the actual event run will take"
--sleep 7 --sleep 3
--echo "Check our table. Should see 2 rows" --echo "Check our table. Should see 2 rows"
SELECT * FROM slow_event_test; SELECT * FROM slow_event_test;
--echo "Check slow log. Should see 1 row because 5 is over the threshold of 4 for GLOBAL, though under SESSION which is 10" --echo "Check slow log. Should see 1 row because 4 is over the threshold of 3 for GLOBAL, though under SESSION which is 10"
--replace_regex /00:00:0[5-7]/SLEEPVAL/ --replace_regex /00:00:0[2-4]/SLEEPVAL/
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
DROP EVENT long_event2; DROP EVENT long_event2;
SET GLOBAL long_query_time =@old_global_long_query_time; SET GLOBAL long_query_time =@old_global_long_query_time;
......
create database if not exists events_test; create database if not exists events_test;
use events_test; use events_test;
--error 1235 --error ER_NOT_SUPPORTED_YET
CREATE EVENT micro_test ON SCHEDULE EVERY 100 MICROSECOND DO SELECT 1; CREATE EVENT micro_test ON SCHEDULE EVERY 100 MICROSECOND DO SELECT 1;
--error 1235 --error ER_NOT_SUPPORTED_YET
CREATE EVENT micro_test ON SCHEDULE EVERY 100 DAY_MICROSECOND DO SELECT 1; CREATE EVENT micro_test ON SCHEDULE EVERY 100 DAY_MICROSECOND DO SELECT 1;
--error 1235 --error ER_NOT_SUPPORTED_YET
CREATE EVENT micro_test ON SCHEDULE EVERY 100 HOUR_MICROSECOND DO SELECT 1; CREATE EVENT micro_test ON SCHEDULE EVERY 100 HOUR_MICROSECOND DO SELECT 1;
--error 1235 --error ER_NOT_SUPPORTED_YET
CREATE EVENT micro_test ON SCHEDULE EVERY 100 MINUTE_MICROSECOND DO SELECT 1; CREATE EVENT micro_test ON SCHEDULE EVERY 100 MINUTE_MICROSECOND DO SELECT 1;
--error 1235 --error ER_NOT_SUPPORTED_YET
CREATE EVENT micro_test ON SCHEDULE EVERY 100 SECOND_MICROSECOND DO SELECT 1; CREATE EVENT micro_test ON SCHEDULE EVERY 100 SECOND_MICROSECOND DO SELECT 1;
--echo "Now create normal event and change it on SQL level"
CREATE EVENT micro_test2 ON SCHEDULE EVERY 1 MONTH DO SELECT 1;
UPDATE mysql.event SET interval_field='MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
--error 1235
SHOW CREATE EVENT micro_test2;
SET GLOBAL event_scheduler=0;
--sleep 1
--echo "Should not be running:"
SHOW VARIABLES like 'event_scheduler';
UPDATE mysql.event SET interval_field='DAY_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
--error 1235
SHOW CREATE EVENT micro_test2;
SET GLOBAL event_scheduler=0;
--sleep 1
--echo "Should not be running:"
SHOW VARIABLES like 'event_scheduler';
UPDATE mysql.event SET interval_field='SECOND_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
--error 1235
SHOW CREATE EVENT micro_test2;
SET GLOBAL event_scheduler=0;
--sleep 1
--echo "Should not be running:"
SHOW VARIABLES like 'event_scheduler';
UPDATE mysql.event SET interval_field='HOUR_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
--error 1235
SHOW CREATE EVENT micro_test2;
SET GLOBAL event_scheduler=0;
--sleep 1
--echo "Should not be running:"
SHOW VARIABLES like 'event_scheduler';
UPDATE mysql.event SET interval_field='MINUTE_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
--error 1235
SHOW CREATE EVENT micro_test2;
SET GLOBAL event_scheduler=0;
--sleep 1
--echo "Should not be running:"
SHOW VARIABLES like 'event_scheduler';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER='event_scheduler';
DROP EVENT micro_test2;
drop database events_test; drop database events_test;
...@@ -15,7 +15,7 @@ CREATE EVENT start_n_end ...@@ -15,7 +15,7 @@ CREATE EVENT start_n_end
DO INSERT INTO table_2 VALUES(1); DO INSERT INTO table_2 VALUES(1);
--sleep 5 --sleep 5
CREATE EVENT only_one_time ON SCHEDULE EVERY 2 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_3 VALUES(1); CREATE EVENT only_one_time ON SCHEDULE EVERY 2 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_3 VALUES(1);
CREATE EVENT two_time ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_4 VALUES(1); CREATE EVENT two_time ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND ON COMPLETION PRESERVE DO INSERT INTO table_4 VALUES(1);
--sleep 5 --sleep 5
SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1; SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
SELECT IF(SUM(a) >= 5, 'OK', 'ERROR') FROM table_2; SELECT IF(SUM(a) >= 5, 'OK', 'ERROR') FROM table_2;
...@@ -28,8 +28,8 @@ DROP EVENT start_n_end; ...@@ -28,8 +28,8 @@ DROP EVENT start_n_end;
--echo "Already dropped because ended. Therefore an error." --echo "Already dropped because ended. Therefore an error."
--error ER_EVENT_DOES_NOT_EXIST --error ER_EVENT_DOES_NOT_EXIST
DROP EVENT only_one_time; DROP EVENT only_one_time;
--echo "Already dropped because ended. Therefore an error." --echo "Should be preserved"
--error ER_EVENT_DOES_NOT_EXIST SELECT EVENT_NAME, STATUS FROM INFORMATION_SCHEMA.EVENTS;
DROP EVENT two_time; DROP EVENT two_time;
DROP TABLE table_1; DROP TABLE table_1;
DROP TABLE table_2; DROP TABLE table_2;
......
...@@ -2,78 +2,120 @@ CREATE DATABASE IF NOT EXISTS events_test; ...@@ -2,78 +2,120 @@ CREATE DATABASE IF NOT EXISTS events_test;
# #
# DROP DATABASE test start (bug #16406) # DROP DATABASE test start (bug #16406)
# #
CREATE DATABASE events_test2; CREATE DATABASE events_conn1_test2;
USE events_test2; CREATE TABLE events_test.fill_it(test_name varchar(20), occur datetime);
CREATE USER event_user2@localhost;
CREATE DATABASE events_conn2_db;
GRANT ALL ON *.* TO event_user2@localhost;
CREATE USER event_user3@localhost;
CREATE DATABASE events_conn3_db;
GRANT ALL ON *.* TO event_user3@localhost;
connect (conn2,localhost,event_user2,,events_conn2_db);
--echo "In the second connection we create some events which won't be dropped till the end"
--disable_query_log
let $1= 100;
while ($1)
{
eval CREATE EVENT conn2_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it VALUES("conn2_ev$1", NOW());
dec $1;
}
--enable_query_log
connect (conn3,localhost,event_user3,,events_conn3_db);
--echo "In the second connection we create some events which won't be dropped till the end"
--disable_query_log
let $1= 100;
while ($1)
{
eval CREATE EVENT conn3_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it VALUES("conn3_ev$1", NOW());
dec $1;
}
--enable_query_log
connection default;
USE events_conn1_test2;
CREATE EVENT ev_drop1 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1; CREATE EVENT ev_drop1 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
CREATE EVENT ev_drop2 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1; CREATE EVENT ev_drop2 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
CREATE EVENT ev_drop3 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1; CREATE EVENT ev_drop3 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
USE events_test; USE events_test;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_test2'; SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS;
DROP DATABASE events_test2; SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_test2'; DROP DATABASE events_conn1_test2;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
--echo "Now testing stability - dropping db -> events while they are running" --echo "Now testing stability - dropping db -> events while they are running"
CREATE DATABASE events_test2; CREATE DATABASE events_conn1_test2;
USE events_test2; USE events_conn1_test2;
--disable_query_log --disable_query_log
let $1= 1000; let $1= 100;
while ($1) while ($1)
{ {
eval CREATE EVENT ev_drop$1 ON SCHEDULE EVERY 1 SECOND DO SELECT $1; eval CREATE EVENT conn1_round1_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it VALUES("conn1_round1_ev$1", NOW());
dec $1; dec $1;
} }
--enable_query_log --enable_query_log
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_test2'; SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
SET GLOBAL event_scheduler=1; SET GLOBAL event_scheduler=1;
--sleep 4 --sleep 6
DROP DATABASE events_test2; DROP DATABASE events_conn1_test2;
SET GLOBAL event_scheduler=0; SET GLOBAL event_scheduler=2;
--sleep 2 SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_test2'; CREATE DATABASE events_conn1_test3;
CREATE DATABASE events_test3; USE events_conn1_test3;
USE events_test3;
--disable_query_log --disable_query_log
let $1= 950; let $1= 100;
while ($1) while ($1)
{ {
eval CREATE EVENT ev_drop$1 ON SCHEDULE EVERY 1 SECOND DO SELECT $1; eval CREATE EVENT conn1_round2_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it VALUES("conn1_round2_ev$1", NOW());
dec $1; dec $1;
} }
--enable_query_log --enable_query_log
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_test3'; SET GLOBAL event_scheduler=1;
--sleep 3 SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test3';
CREATE DATABASE events_test4; CREATE DATABASE events_conn1_test4;
USE events_test4; USE events_conn1_test4;
--disable_query_log --disable_query_log
let $1= 860; let $1= 100;
while ($1) while ($1)
{ {
eval CREATE EVENT ev_drop$1 ON SCHEDULE EVERY 1 SECOND DO SELECT $1; eval CREATE EVENT conn1_round3_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it VALUES("conn1_round3_ev$1", NOW());
dec $1; dec $1;
} }
--enable_query_log --enable_query_log
CREATE DATABASE events_conn1_test2;
CREATE DATABASE events_test2; USE events_conn1_test2;
USE events_test2;
--disable_query_log --disable_query_log
let $1= 1050; let $1= 100;
while ($1) while ($1)
{ {
eval CREATE EVENT ev_drop$1 ON SCHEDULE EVERY 1 SECOND DO SELECT $1; eval CREATE EVENT ev_round4_drop$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it VALUES("conn1_round4_ev$1", NOW());
dec $1; dec $1;
} }
--enable_query_log --enable_query_log
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_test2'; SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
--sleep 6 --sleep 6
DROP DATABASE events_test2; connection conn2;
SET GLOBAL event_scheduler=0; --send
DROP DATABASE events_test3; DROP DATABASE events_conn2_db;
SET GLOBAL event_scheduler=1; connection conn3;
DROP DATABASE events_test4; --send
DROP DATABASE events_conn3_db;
connection default;
--send
DROP DATABASE events_conn1_test2;
DROP DATABASE events_conn1_test3;
SET GLOBAL event_scheduler=2;
DROP DATABASE events_conn1_test4;
SET GLOBAL event_scheduler=1; SET GLOBAL event_scheduler=1;
connection conn2;
reap;
disconnect conn2;
connection conn3;
reap;
disconnect conn3;
connection default;
USE events_test; USE events_test;
DROP TABLE fill_it;
# #
# DROP DATABASE test end (bug #16406) # DROP DATABASE test end (bug #16406)
# #
......
...@@ -539,77 +539,6 @@ INSERT INTO t1 VALUES ...@@ -539,77 +539,6 @@ INSERT INTO t1 VALUES
SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6; SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #12882 min/max inconsistent on empty table
#
--disable_warnings
create table t1m (a int) engine=myisam;
create table t1i (a int) engine=innodb;
create table t2m (a int) engine=myisam;
create table t2i (a int) engine=innodb;
--enable_warnings
insert into t2m values (5);
insert into t2i values (5);
# test with MyISAM
select min(a) from t1m;
select min(7) from t1m;
select min(7) from DUAL;
explain select min(7) from t2m join t1m;
select min(7) from t2m join t1m;
select max(a) from t1m;
select max(7) from t1m;
select max(7) from DUAL;
explain select max(7) from t2m join t1m;
select max(7) from t2m join t1m;
select 1, min(a) from t1m where a=99;
select 1, min(a) from t1m where 1=99;
select 1, min(1) from t1m where a=99;
select 1, min(1) from t1m where 1=99;
select 1, max(a) from t1m where a=99;
select 1, max(a) from t1m where 1=99;
select 1, max(1) from t1m where a=99;
select 1, max(1) from t1m where 1=99;
# test with InnoDB
select min(a) from t1i;
select min(7) from t1i;
select min(7) from DUAL;
explain select min(7) from t2i join t1i;
select min(7) from t2i join t1i;
select max(a) from t1i;
select max(7) from t1i;
select max(7) from DUAL;
explain select max(7) from t2i join t1i;
select max(7) from t2i join t1i;
select 1, min(a) from t1i where a=99;
select 1, min(a) from t1i where 1=99;
select 1, min(1) from t1i where a=99;
select 1, min(1) from t1i where 1=99;
select 1, max(a) from t1i where a=99;
select 1, max(a) from t1i where 1=99;
select 1, max(1) from t1i where a=99;
select 1, max(1) from t1i where 1=99;
# mixed MyISAM/InnoDB test
explain select count(*), min(7), max(7) from t1m, t1i;
select count(*), min(7), max(7) from t1m, t1i;
explain select count(*), min(7), max(7) from t1m, t2i;
select count(*), min(7), max(7) from t1m, t2i;
explain select count(*), min(7), max(7) from t2m, t1i;
select count(*), min(7), max(7) from t2m, t1i;
drop table t1m, t1i, t2m, t2i;
# End of 4.1 tests # End of 4.1 tests
# #
......
...@@ -57,3 +57,75 @@ where ...@@ -57,3 +57,75 @@ where
c.c_id = 218 and expiredate is null; c.c_id = 218 and expiredate is null;
drop table t1, t2; drop table t1, t2;
#
# Bug #12882 min/max inconsistent on empty table
#
--disable_warnings
create table t1m (a int) engine=myisam;
create table t1i (a int) engine=innodb;
create table t2m (a int) engine=myisam;
create table t2i (a int) engine=innodb;
--enable_warnings
insert into t2m values (5);
insert into t2i values (5);
# test with MyISAM
select min(a) from t1m;
select min(7) from t1m;
select min(7) from DUAL;
explain select min(7) from t2m join t1m;
select min(7) from t2m join t1m;
select max(a) from t1m;
select max(7) from t1m;
select max(7) from DUAL;
explain select max(7) from t2m join t1m;
select max(7) from t2m join t1m;
select 1, min(a) from t1m where a=99;
select 1, min(a) from t1m where 1=99;
select 1, min(1) from t1m where a=99;
select 1, min(1) from t1m where 1=99;
select 1, max(a) from t1m where a=99;
select 1, max(a) from t1m where 1=99;
select 1, max(1) from t1m where a=99;
select 1, max(1) from t1m where 1=99;
# test with InnoDB
select min(a) from t1i;
select min(7) from t1i;
select min(7) from DUAL;
explain select min(7) from t2i join t1i;
select min(7) from t2i join t1i;
select max(a) from t1i;
select max(7) from t1i;
select max(7) from DUAL;
explain select max(7) from t2i join t1i;
select max(7) from t2i join t1i;
select 1, min(a) from t1i where a=99;
select 1, min(a) from t1i where 1=99;
select 1, min(1) from t1i where a=99;
select 1, min(1) from t1i where 1=99;
select 1, max(a) from t1i where a=99;
select 1, max(a) from t1i where 1=99;
select 1, max(1) from t1i where a=99;
select 1, max(1) from t1i where 1=99;
# mixed MyISAM/InnoDB test
explain select count(*), min(7), max(7) from t1m, t1i;
select count(*), min(7), max(7) from t1m, t1i;
explain select count(*), min(7), max(7) from t1m, t2i;
select count(*), min(7), max(7) from t1m, t2i;
explain select count(*), min(7), max(7) from t2m, t1i;
select count(*), min(7), max(7) from t2m, t1i;
drop table t1m, t1i, t2m, t2i;
...@@ -51,7 +51,7 @@ ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc ...@@ -51,7 +51,7 @@ ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc
sql_table.cc sql_test.cc sql_trigger.cc sql_udf.cc sql_union.cc sql_table.cc sql_test.cc sql_trigger.cc sql_udf.cc sql_union.cc
sql_update.cc sql_view.cc strfunc.cc table.cc thr_malloc.cc sql_update.cc sql_view.cc strfunc.cc table.cc thr_malloc.cc
time.cc tztime.cc uniques.cc unireg.cc item_xmlfunc.cc time.cc tztime.cc uniques.cc unireg.cc item_xmlfunc.cc
rpl_tblmap.cc sql_binlog.cc event_executor.cc event_timed.cc rpl_tblmap.cc sql_binlog.cc event_scheduler.cc event_timed.cc
sql_tablespace.cc event.cc ../sql-common/my_user.c sql_tablespace.cc event.cc ../sql-common/my_user.c
partition_info.cc partition_info.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
......
...@@ -66,7 +66,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ ...@@ -66,7 +66,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
parse_file.h sql_view.h sql_trigger.h \ parse_file.h sql_view.h sql_trigger.h \
sql_array.h sql_cursor.h event.h event_priv.h \ sql_array.h sql_cursor.h event.h event_priv.h \
sql_plugin.h authors.h sql_partition.h \ sql_plugin.h authors.h sql_partition.h \
partition_info.h partition_element.h partition_info.h partition_element.h event_scheduler.h
mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
item.cc item_sum.cc item_buff.cc item_func.cc \ item.cc item_sum.cc item_buff.cc item_func.cc \
item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \ item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
...@@ -103,7 +103,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ ...@@ -103,7 +103,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
tztime.cc my_time.c my_user.c my_decimal.cc\ tztime.cc my_time.c my_user.c my_decimal.cc\
sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc \ sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc \
sp_cache.cc parse_file.cc sql_trigger.cc \ sp_cache.cc parse_file.cc sql_trigger.cc \
event_executor.cc event.cc event_timed.cc \ event_scheduler.cc event.cc event_timed.cc \
sql_plugin.cc sql_binlog.cc \ sql_plugin.cc sql_binlog.cc \
sql_builtin.cc sql_tablespace.cc partition_info.cc sql_builtin.cc sql_tablespace.cc partition_info.cc
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* Copyright (C) 2004-2005 MySQL AB #ifndef _EVENT_PRIV_H_
#define _EVENT_PRIV_H_
/* Copyright (C) 2004-2006 MySQL AB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -14,8 +16,6 @@ ...@@ -14,8 +16,6 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _EVENT_PRIV_H_
#define _EVENT_PRIV_H_
#include "mysql_priv.h" #include "mysql_priv.h"
...@@ -23,11 +23,6 @@ ...@@ -23,11 +23,6 @@
#define EVENT_EXEC_ALREADY_EXEC 1 #define EVENT_EXEC_ALREADY_EXEC 1
#define EVENT_EXEC_CANT_FORK 2 #define EVENT_EXEC_CANT_FORK 2
#define EVEX_USE_QUEUE
#define UNLOCK_MUTEX_AND_BAIL_OUT(__mutex, __label) \
{ VOID(pthread_mutex_unlock(&__mutex)); goto __label; }
#define EVEX_DB_FIELD_LEN 64 #define EVEX_DB_FIELD_LEN 64
#define EVEX_NAME_FIELD_LEN 64 #define EVEX_NAME_FIELD_LEN 64
#define EVEX_MAX_INTERVAL_VALUE 2147483647L #define EVEX_MAX_INTERVAL_VALUE 2147483647L
...@@ -44,39 +39,49 @@ evex_db_find_event_by_name(THD *thd, const LEX_STRING dbname, ...@@ -44,39 +39,49 @@ evex_db_find_event_by_name(THD *thd, const LEX_STRING dbname,
int int
event_timed_compare_q(void *vptr, byte* a, byte *b); event_timed_compare_q(void *vptr, byte* a, byte *b);
int db_drop_event(THD *thd, Event_timed *et, bool drop_if_exists, int
db_drop_event(THD *thd, Event_timed *et, bool drop_if_exists,
uint *rows_affected); uint *rows_affected);
int
db_find_event(THD *thd, sp_name *name, LEX_STRING *definer, Event_timed **ett,
TABLE *tbl, MEM_ROOT *root);
int
db_create_event(THD *thd, Event_timed *et, my_bool create_if_not,
uint *rows_affected);
#define EXEC_QUEUE_QUEUE_NAME executing_queue int
#define EXEC_QUEUE_DARR_NAME evex_executing_queue db_drop_events_from_table(THD *thd, LEX_STRING *db);
#define EVEX_QUEUE_TYPE QUEUE int
#define EVEX_PTOQEL byte * sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs);
#define EVEX_EQ_NAME executing_queue /* Compares only the name part of the identifier */
#define evex_queue_first_element(queue, __cast) ((__cast)queue_top(queue)) bool
#define evex_queue_element(queue, idx, __cast) ((__cast)queue_element(queue, idx)) event_timed_name_equal(Event_timed *et, LEX_STRING *name);
#define evex_queue_delete_element(queue, idx) queue_remove(queue, idx)
#define evex_queue_destroy(queue) delete_queue(queue)
#define evex_queue_first_updated(queue) queue_replaced(queue)
#define evex_queue_insert(queue, element) queue_insert_safe(queue, element);
/* Compares only the schema part of the identifier */
bool
event_timed_db_equal(Event_timed *et, LEX_STRING *db);
/*
Compares only the definer part of the identifier. Use during DROP USER
to drop user's events. (Still not implemented)
*/
bool
event_timed_definer_equal(Event_timed *et, LEX_STRING *definer);
void /* Compares the whole identifier*/
evex_queue_init(EVEX_QUEUE_TYPE *queue); bool
event_timed_identifier_equal(Event_timed *a, Event_timed *b);
#define evex_queue_num_elements(queue) queue.elements
bool
change_security_context(THD *thd, LEX_STRING user, LEX_STRING host,
LEX_STRING db, Security_context *s_ctx,
Security_context **backup);
extern bool evex_is_running; void
extern MEM_ROOT evex_mem_root; restore_security_context(THD *thd, Security_context *backup);
extern pthread_mutex_t LOCK_event_arrays,
LOCK_workers_count,
LOCK_evex_running;
extern ulonglong evex_main_thread_id;
extern QUEUE EVEX_EQ_NAME;
#endif /* _EVENT_PRIV_H_ */ #endif /* _EVENT_PRIV_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -453,6 +453,7 @@ static SYMBOL symbols[] = { ...@@ -453,6 +453,7 @@ static SYMBOL symbols[] = {
{ "RTREE", SYM(RTREE_SYM)}, { "RTREE", SYM(RTREE_SYM)},
{ "SAVEPOINT", SYM(SAVEPOINT_SYM)}, { "SAVEPOINT", SYM(SAVEPOINT_SYM)},
{ "SCHEDULE", SYM(SCHEDULE_SYM)}, { "SCHEDULE", SYM(SCHEDULE_SYM)},
{ "SCHEDULER", SYM(SCHEDULER_SYM)},
{ "SCHEMA", SYM(DATABASE)}, { "SCHEMA", SYM(DATABASE)},
{ "SCHEMAS", SYM(DATABASES)}, { "SCHEMAS", SYM(DATABASES)},
{ "SECOND", SYM(SECOND_SYM)}, { "SECOND", SYM(SECOND_SYM)},
......
...@@ -55,6 +55,14 @@ static int binlog_commit(THD *thd, bool all); ...@@ -55,6 +55,14 @@ static int binlog_commit(THD *thd, bool all);
static int binlog_rollback(THD *thd, bool all); static int binlog_rollback(THD *thd, bool all);
static int binlog_prepare(THD *thd, bool all); static int binlog_prepare(THD *thd, bool all);
sql_print_message_func sql_print_message_handlers[3] =
{
sql_print_information,
sql_print_warning,
sql_print_error
};
/* /*
This is a POD. Please keep it that way! This is a POD. Please keep it that way!
......
...@@ -79,7 +79,8 @@ char *sql_strmake_with_convert(const char *str, uint32 arg_length, ...@@ -79,7 +79,8 @@ char *sql_strmake_with_convert(const char *str, uint32 arg_length,
CHARSET_INFO *from_cs, CHARSET_INFO *from_cs,
uint32 max_res_length, uint32 max_res_length,
CHARSET_INFO *to_cs, uint32 *result_length); CHARSET_INFO *to_cs, uint32 *result_length);
void kill_one_thread(THD *thd, ulong id, bool only_kill_query); uint kill_one_thread(THD *thd, ulong id, bool only_kill_query);
void sql_kill(THD *thd, ulong id, bool only_kill_query);
bool net_request_file(NET* net, const char* fname); bool net_request_file(NET* net, const char* fname);
char* query_table_status(THD *thd,const char *db,const char *table_name); char* query_table_status(THD *thd,const char *db,const char *table_name);
...@@ -1378,10 +1379,13 @@ bool init_errmessage(void); ...@@ -1378,10 +1379,13 @@ bool init_errmessage(void);
#endif /* MYSQL_SERVER */ #endif /* MYSQL_SERVER */
void sql_perror(const char *message); void sql_perror(const char *message);
int vprint_msg_to_log(enum loglevel level, const char *format, va_list args); int vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
void sql_print_error(const char *format, ...); void sql_print_error(const char *format, ...);
void sql_print_warning(const char *format, ...); void sql_print_warning(const char *format, ...);
void sql_print_information(const char *format, ...); void sql_print_information(const char *format, ...);
typedef void (*sql_print_message_func)(const char *format, ...);
extern sql_print_message_func sql_print_message_handlers[];
/* type of the log table */ /* type of the log table */
#define QUERY_LOG_SLOW 1 #define QUERY_LOG_SLOW 1
......
This diff is collapsed.
...@@ -61,12 +61,13 @@ static Slave_log_event* find_slave_event(IO_CACHE* log, ...@@ -61,12 +61,13 @@ static Slave_log_event* find_slave_event(IO_CACHE* log,
static int init_failsafe_rpl_thread(THD* thd) static int init_failsafe_rpl_thread(THD* thd)
{ {
DBUG_ENTER("init_failsafe_rpl_thread"); DBUG_ENTER("init_failsafe_rpl_thread");
thd->system_thread = SYSTEM_THREAD_DELAYED_INSERT;
/* /*
thd->bootstrap is to report errors barely to stderr; if this code is thd->bootstrap is to report errors barely to stderr; if this code is
enable again one day, one should check if bootstrap is still needed (maybe enable again one day, one should check if bootstrap is still needed (maybe
this thread has no other error reporting method). this thread has no other error reporting method).
*/ */
thd->system_thread = thd->bootstrap = 1; thd->bootstrap = 1;
thd->security_ctx->skip_grants(); thd->security_ctx->skip_grants();
my_net_init(&thd->net, 0); my_net_init(&thd->net, 0);
thd->net.read_timeout = slave_net_timeout; thd->net.read_timeout = slave_net_timeout;
......
This diff is collapsed.
...@@ -871,13 +871,14 @@ class sys_var_trust_routine_creators :public sys_var_bool_ptr ...@@ -871,13 +871,14 @@ class sys_var_trust_routine_creators :public sys_var_bool_ptr
}; };
class sys_var_event_executor :public sys_var_bool_ptr class sys_var_event_scheduler :public sys_var_long_ptr
{ {
/* We need a derived class only to have a warn_deprecated() */ /* We need a derived class only to have a warn_deprecated() */
public: public:
sys_var_event_executor(const char *name_arg, my_bool *value_arg) : sys_var_event_scheduler(const char *name_arg) :
sys_var_bool_ptr(name_arg, value_arg) {}; sys_var_long_ptr(name_arg, NULL, NULL) {};
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
}; };
extern void fix_binlog_format_after_update(THD *thd, enum_var_type type); extern void fix_binlog_format_after_update(THD *thd, enum_var_type type);
......
...@@ -5042,7 +5042,7 @@ ER_OPTION_PREVENTS_STATEMENT ...@@ -5042,7 +5042,7 @@ ER_OPTION_PREVENTS_STATEMENT
ger "Der MySQL-Server luft mit der Option %s und kann diese Anweisung deswegen nicht ausfhren" ger "Der MySQL-Server luft mit der Option %s und kann diese Anweisung deswegen nicht ausfhren"
por "O servidor MySQL est rodando com a opo %s razo pela qual no pode executar esse commando" por "O servidor MySQL est rodando com a opo %s razo pela qual no pode executar esse commando"
spa "El servidor MySQL est rodando con la opcin %s tal que no puede ejecutar este comando" spa "El servidor MySQL est rodando con la opcin %s tal que no puede ejecutar este comando"
swe "MySQL r startad med --skip-grant-tables. Pga av detta kan du inte anvnda detta kommando" swe "MySQL r startad med %s. Pga av detta kan du inte anvnda detta kommando"
ER_DUPLICATED_VALUE_IN_TYPE ER_DUPLICATED_VALUE_IN_TYPE
eng "Column '%-.100s' has duplicated value '%-.64s' in %s" eng "Column '%-.100s' has duplicated value '%-.64s' in %s"
ger "Feld '%-.100s' hat doppelten Wert '%-.64s' in %s" ger "Feld '%-.100s' hat doppelten Wert '%-.64s' in %s"
...@@ -5842,3 +5842,7 @@ ER_WRONG_PARTITION_NAME ...@@ -5842,3 +5842,7 @@ ER_WRONG_PARTITION_NAME
swe "Felaktigt partitionsnamn" swe "Felaktigt partitionsnamn"
ER_CANT_CHANGE_TX_ISOLATION 25001 ER_CANT_CHANGE_TX_ISOLATION 25001
eng "Transaction isolation level can't be changed while a transaction is in progress" eng "Transaction isolation level can't be changed while a transaction is in progress"
ER_EVENT_MODIFY_QUEUE_ERROR
eng "Internal scheduler error %d"
ER_EVENT_SET_VAR_ERROR
eng "Error during starting/stopping of the scheduler. Error code %u"
...@@ -253,7 +253,8 @@ THD::THD() ...@@ -253,7 +253,8 @@ THD::THD()
net.last_error[0]=0; // If error on boot net.last_error[0]=0; // If error on boot
net.query_cache_query=0; // If error on boot net.query_cache_query=0; // If error on boot
ull=0; ull=0;
system_thread= cleanup_done= abort_on_warning= no_warnings_for_error= 0; system_thread= NON_SYSTEM_THREAD;
cleanup_done= abort_on_warning= no_warnings_for_error= 0;
peer_port= 0; // For SHOW PROCESSLIST peer_port= 0; // For SHOW PROCESSLIST
#ifdef HAVE_ROW_BASED_REPLICATION #ifdef HAVE_ROW_BASED_REPLICATION
transaction.m_pending_rows_event= 0; transaction.m_pending_rows_event= 0;
...@@ -512,6 +513,8 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var) ...@@ -512,6 +513,8 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var)
void THD::awake(THD::killed_state state_to_set) void THD::awake(THD::killed_state state_to_set)
{ {
DBUG_ENTER("THD::awake");
DBUG_PRINT("enter", ("this=0x%lx", this));
THD_CHECK_SENTRY(this); THD_CHECK_SENTRY(this);
safe_mutex_assert_owner(&LOCK_delete); safe_mutex_assert_owner(&LOCK_delete);
...@@ -555,6 +558,7 @@ void THD::awake(THD::killed_state state_to_set) ...@@ -555,6 +558,7 @@ void THD::awake(THD::killed_state state_to_set)
} }
pthread_mutex_unlock(&mysys_var->mutex); pthread_mutex_unlock(&mysys_var->mutex);
} }
DBUG_VOID_RETURN;
} }
/* /*
...@@ -2031,6 +2035,13 @@ void Security_context::skip_grants() ...@@ -2031,6 +2035,13 @@ void Security_context::skip_grants()
} }
bool Security_context::set_user(char *user_arg)
{
safeFree(user);
user= my_strdup(user_arg, MYF(0));
return user == 0;
}
/**************************************************************************** /****************************************************************************
Handling of open and locked tables states. Handling of open and locked tables states.
......
This diff is collapsed.
...@@ -871,7 +871,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) ...@@ -871,7 +871,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
exit: exit:
(void)sp_drop_db_routines(thd, db); /* QQ Ignore errors for now */ (void)sp_drop_db_routines(thd, db); /* QQ Ignore errors for now */
(void)evex_drop_db_events(thd, db); /* QQ Ignore errors for now */ error= Events::drop_schema_events(thd, db);
start_waiting_global_read_lock(thd); start_waiting_global_read_lock(thd);
/* /*
If this database was the client's selected database, we silently change the If this database was the client's selected database, we silently change the
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment