mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
merge
This commit is contained in:
commit
b0bbc00899
102 changed files with 2136 additions and 4982 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,9 +17,7 @@
|
|||
|
||||
#include "client_priv.h"
|
||||
#include <signal.h>
|
||||
#ifdef THREAD
|
||||
#include <my_pthread.h> /* because of signal() */
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#include <mysql.h>
|
||||
#include <sql_common.h>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/cmd-line-utils)
|
||||
|
||||
ADD_DEFINITIONS(-DHAVE_CONFIG_H -DNO_KILL_INTR -DMYSQL_CLIENT_NO_THREADS)
|
||||
ADD_DEFINITIONS(-DHAVE_CONFIG_H -DNO_KILL_INTR)
|
||||
|
||||
INCLUDE_DIRECTORIES(${CURSES_INCLUDE_PATH})
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Copyright (C) 2009 Sun Microsystems, Inc
|
||||
|
||||
/* Copyright (C) 2009, 2011, Oracle and/or its affiliates. All rights
|
||||
reserved
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
@ -470,9 +471,6 @@
|
|||
|
||||
#cmakedefine STACK_DIRECTION @STACK_DIRECTION@
|
||||
|
||||
#define THREAD 1
|
||||
#define THREAD_SAFE_CLIENT 1
|
||||
|
||||
#define SYSTEM_TYPE "@SYSTEM_TYPE@"
|
||||
#define MACHINE_TYPE "@CMAKE_SYSTEM_PROCESSOR@"
|
||||
#cmakedefine HAVE_DTRACE 1
|
||||
|
|
231
dbug/dbug.c
231
dbug/dbug.c
|
@ -319,15 +319,6 @@ static void DbugExit(const char *why);
|
|||
static const char *DbugStrTok(const char *s);
|
||||
static void DbugVfprintf(FILE *stream, const char* format, va_list args);
|
||||
|
||||
#ifndef THREAD
|
||||
/* Open profile output stream */
|
||||
static FILE *OpenProfile(CODE_STATE *cs, const char *name);
|
||||
/* Profile if asked for it */
|
||||
static BOOLEAN DoProfile(CODE_STATE *);
|
||||
/* Return current user time (ms) */
|
||||
static unsigned long Clock(void);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Miscellaneous printf format strings.
|
||||
*/
|
||||
|
@ -355,7 +346,6 @@ static unsigned long Clock(void);
|
|||
** Macros to allow dbugging with threads
|
||||
*/
|
||||
|
||||
#ifdef THREAD
|
||||
#include <my_pthread.h>
|
||||
static pthread_mutex_t THR_LOCK_dbug;
|
||||
|
||||
|
@ -394,30 +384,6 @@ static CODE_STATE *code_state(void)
|
|||
return cs;
|
||||
}
|
||||
|
||||
#else /* !THREAD */
|
||||
|
||||
static CODE_STATE static_code_state=
|
||||
{
|
||||
"dbug", "?func", "?file", NULL, &init_settings,
|
||||
NullS, NullS, 0,0,0,0,0,NullS
|
||||
};
|
||||
|
||||
static CODE_STATE *code_state(void)
|
||||
{
|
||||
if (!init_done)
|
||||
{
|
||||
bzero(&init_settings, sizeof(init_settings));
|
||||
init_settings.out_file=stderr;
|
||||
init_settings.flags=OPEN_APPEND;
|
||||
init_done=TRUE;
|
||||
}
|
||||
return &static_code_state;
|
||||
}
|
||||
|
||||
#define pthread_mutex_lock(A) {}
|
||||
#define pthread_mutex_unlock(A) {}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Translate some calls among different systems.
|
||||
*/
|
||||
|
@ -601,15 +567,6 @@ int DbugParse(CODE_STATE *cs, const char *control)
|
|||
else
|
||||
stack->flags |= PID_ON;
|
||||
break;
|
||||
#ifndef THREAD
|
||||
case 'g':
|
||||
if (OpenProfile(cs, PROF_FILE))
|
||||
{
|
||||
stack->flags |= PROFILE_ON;
|
||||
stack->p_functions= ListAdd(stack->p_functions, control, end);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case 'L':
|
||||
if (sign < 0)
|
||||
stack->flags &= ~LINE_ON;
|
||||
|
@ -1154,23 +1111,7 @@ void _db_enter_(const char *_func_, const char *_file_,
|
|||
_stack_frame_->prev= cs->framep;
|
||||
_stack_frame_->level= ++cs->level | framep_trace_flag(cs, cs->framep);
|
||||
cs->framep= _stack_frame_;
|
||||
#ifndef THREAD
|
||||
if (DoProfile(cs))
|
||||
{
|
||||
long stackused;
|
||||
if (cs->framep->prev == NULL)
|
||||
stackused= 0;
|
||||
else
|
||||
{
|
||||
stackused= (char*)(cs->framep->prev) - (char*)(cs->framep);
|
||||
stackused= stackused > 0 ? stackused : -stackused;
|
||||
}
|
||||
(void) fprintf(cs->stack->prof_file, PROF_EFMT , Clock(), cs->func);
|
||||
(void) fprintf(cs->stack->prof_file, PROF_SFMT, (ulong) cs->framep, stackused,
|
||||
AUTOS_REVERSE ? _stack_frame_->func : cs->func);
|
||||
(void) fflush(cs->stack->prof_file);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (DoTrace(cs)) {
|
||||
case ENABLE_TRACE:
|
||||
cs->framep->level|= TRACE_ON;
|
||||
|
@ -1229,10 +1170,7 @@ void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_)
|
|||
my_snprintf(buf, sizeof(buf), ERR_MISSING_RETURN, cs->func);
|
||||
DbugExit(buf);
|
||||
}
|
||||
#ifndef THREAD
|
||||
if (DoProfile(cs))
|
||||
(void) fprintf(cs->stack->prof_file, PROF_XFMT, Clock(), cs->func);
|
||||
#endif
|
||||
|
||||
if (DoTrace(cs) & DO_TRACE)
|
||||
{
|
||||
if (TRACING)
|
||||
|
@ -1744,36 +1682,6 @@ static int DoTrace(CODE_STATE *cs)
|
|||
return DONT_TRACE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION
|
||||
*
|
||||
* DoProfile check to see if profiling is current enabled
|
||||
*
|
||||
* SYNOPSIS
|
||||
*
|
||||
* static BOOLEAN DoProfile()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Checks to see if profiling is enabled based on whether the
|
||||
* user has specified profiling, the maximum trace depth has
|
||||
* not yet been reached, the current function is selected,
|
||||
* and the current process is selected. Returns TRUE if
|
||||
* profiling is enabled, FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef THREAD
|
||||
static BOOLEAN DoProfile(CODE_STATE *cs)
|
||||
{
|
||||
return PROFILING &&
|
||||
cs->level <= cs->stack->maxdepth &&
|
||||
InList(cs->stack->p_functions, cs->func) & (INCLUDE|MATCHED) &&
|
||||
InList(cs->stack->processes, cs->process) & (INCLUDE|MATCHED);
|
||||
}
|
||||
#endif
|
||||
|
||||
FILE *_db_fp_(void)
|
||||
{
|
||||
CODE_STATE *cs;
|
||||
|
@ -1900,11 +1808,7 @@ static void DoPrefix(CODE_STATE *cs, uint _line_)
|
|||
cs->lineno++;
|
||||
if (cs->stack->flags & PID_ON)
|
||||
{
|
||||
#ifdef THREAD
|
||||
(void) fprintf(cs->stack->out_file, "%-7s: ", my_thread_name());
|
||||
#else
|
||||
(void) fprintf(cs->stack->out_file, "%5d: ", (int) getpid());
|
||||
#endif
|
||||
}
|
||||
if (cs->stack->flags & NUMBER_ON)
|
||||
(void) fprintf(cs->stack->out_file, "%5d: ", cs->lineno);
|
||||
|
@ -2014,63 +1918,6 @@ static void DBUGOpenFile(CODE_STATE *cs,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION
|
||||
*
|
||||
* OpenProfile open new output stream for profiler output
|
||||
*
|
||||
* SYNOPSIS
|
||||
*
|
||||
* static FILE *OpenProfile(name)
|
||||
* char *name;
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Given name of a new file, opens the file
|
||||
* and sets the profiler output stream to the new file.
|
||||
*
|
||||
* It is currently unclear whether the prefered behavior is
|
||||
* to truncate any existing file, or simply append to it.
|
||||
* The latter behavior would be desirable for collecting
|
||||
* accumulated runtime history over a number of separate
|
||||
* runs. It might take some changes to the analyzer program
|
||||
* though, and the notes that Binayak sent with the profiling
|
||||
* diffs indicated that append was the normal mode, but this
|
||||
* does not appear to agree with the actual code. I haven't
|
||||
* investigated at this time [fnf; 24-Jul-87].
|
||||
*/
|
||||
|
||||
#ifndef THREAD
|
||||
static FILE *OpenProfile(CODE_STATE *cs, const char *name)
|
||||
{
|
||||
REGISTER FILE *fp;
|
||||
REGISTER BOOLEAN newfile;
|
||||
|
||||
fp=0;
|
||||
if (!Writable(name))
|
||||
{
|
||||
(void) fprintf(cs->stack->out_file, ERR_OPEN, cs->process, name);
|
||||
perror("");
|
||||
(void) Delay(cs->stack->delay);
|
||||
}
|
||||
else
|
||||
{
|
||||
newfile= !EXISTS(name);
|
||||
if (!(fp= fopen(name, "w")))
|
||||
{
|
||||
(void) fprintf(cs->stack->out_file, ERR_OPEN, cs->process, name);
|
||||
perror("");
|
||||
}
|
||||
else
|
||||
{
|
||||
cs->stack->prof_file= fp;
|
||||
}
|
||||
}
|
||||
return fp;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FUNCTION
|
||||
*
|
||||
|
@ -2419,80 +2266,6 @@ const char* _db_get_func_(void)
|
|||
return cs->func;
|
||||
}
|
||||
|
||||
/*
|
||||
* Here we need the definitions of the clock routine. Add your
|
||||
* own for whatever system that you have.
|
||||
*/
|
||||
|
||||
#ifndef THREAD
|
||||
#if defined(HAVE_GETRUSAGE)
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
/* extern int getrusage(int, struct rusage *); */
|
||||
|
||||
/*
|
||||
* Returns the user time in milliseconds used by this process so
|
||||
* far.
|
||||
*/
|
||||
|
||||
static unsigned long Clock()
|
||||
{
|
||||
struct rusage ru;
|
||||
|
||||
(void) getrusage(RUSAGE_SELF, &ru);
|
||||
return ru.ru_utime.tv_sec*1000 + ru.ru_utime.tv_usec/1000;
|
||||
}
|
||||
|
||||
#elif defined(__WIN__)
|
||||
|
||||
static ulong Clock()
|
||||
{
|
||||
return clock()*(1000/CLOCKS_PER_SEC);
|
||||
}
|
||||
#elif defined(amiga)
|
||||
|
||||
struct DateStamp { /* Yes, this is a hack, but doing it right */
|
||||
long ds_Days; /* is incredibly ugly without splitting this */
|
||||
long ds_Minute; /* off into a separate file */
|
||||
long ds_Tick;
|
||||
};
|
||||
|
||||
static int first_clock= TRUE;
|
||||
static struct DateStamp begin;
|
||||
static struct DateStamp elapsed;
|
||||
|
||||
static unsigned long Clock()
|
||||
{
|
||||
register struct DateStamp *now;
|
||||
register unsigned long millisec= 0;
|
||||
extern VOID *AllocMem();
|
||||
|
||||
now= (struct DateStamp *) AllocMem((long) sizeof(struct DateStamp), 0L);
|
||||
if (now != NULL)
|
||||
{
|
||||
if (first_clock == TRUE)
|
||||
{
|
||||
first_clock= FALSE;
|
||||
(void) DateStamp(now);
|
||||
begin= *now;
|
||||
}
|
||||
(void) DateStamp(now);
|
||||
millisec= 24 * 3600 * (1000 / HZ) * (now->ds_Days - begin.ds_Days);
|
||||
millisec += 60 * (1000 / HZ) * (now->ds_Minute - begin.ds_Minute);
|
||||
millisec += (1000 / HZ) * (now->ds_Tick - begin.ds_Tick);
|
||||
(void) FreeMem(now, (long) sizeof(struct DateStamp));
|
||||
}
|
||||
return millisec;
|
||||
}
|
||||
#else
|
||||
static unsigned long Clock()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* RUSAGE */
|
||||
#endif /* THREADS */
|
||||
|
||||
#else
|
||||
|
||||
|
|
|
@ -571,12 +571,10 @@ int main (int argc, char **argv)
|
|||
FILE *infile;
|
||||
FILE *outfile = {stdout};
|
||||
|
||||
#ifdef THREAD
|
||||
#if defined(HAVE_PTHREAD_INIT)
|
||||
pthread_init(); /* Must be called before DBUG_ENTER */
|
||||
#endif
|
||||
my_thread_global_init();
|
||||
#endif /* THREAD */
|
||||
my_thread_global_init();
|
||||
{
|
||||
DBUG_ENTER ("main");
|
||||
DBUG_PROCESS (argv[0]);
|
||||
|
|
|
@ -16,12 +16,11 @@ char *argv[];
|
|||
{
|
||||
register int result, ix;
|
||||
extern int factorial(int);
|
||||
#if defined(HAVE_PTHREAD_INIT) && defined(THREAD)
|
||||
#if defined(HAVE_PTHREAD_INIT)
|
||||
pthread_init(); /* Must be called before DBUG_ENTER */
|
||||
#endif
|
||||
#ifdef THREAD
|
||||
my_thread_global_init();
|
||||
#endif
|
||||
|
||||
{
|
||||
DBUG_ENTER ("main");
|
||||
DBUG_PROCESS (argv[0]);
|
||||
|
|
|
@ -44,12 +44,11 @@ int main (int argc, char *argv[])
|
|||
if (argc == 1)
|
||||
return 0;
|
||||
|
||||
#if defined(HAVE_PTHREAD_INIT) && defined(THREAD)
|
||||
#if defined(HAVE_PTHREAD_INIT)
|
||||
pthread_init(); /* Must be called before DBUG_ENTER */
|
||||
#endif
|
||||
#ifdef THREAD
|
||||
my_thread_global_init();
|
||||
#endif
|
||||
|
||||
dup2(1, 2);
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,6 @@ SET(HEADERS
|
|||
my_xml.h
|
||||
mysql_embed.h
|
||||
my_pthread.h
|
||||
my_no_pthread.h
|
||||
decimal.h
|
||||
errmsg.h
|
||||
my_global.h
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2000-2004 MySQL AB, 2009 Sun Microsystems, Inc
|
||||
/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights
|
||||
reserved
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -25,10 +26,9 @@ extern "C" {
|
|||
#ifndef _my_base_h
|
||||
#include <my_base.h>
|
||||
#endif
|
||||
#ifdef THREAD
|
||||
|
||||
#include <my_pthread.h>
|
||||
#include <thr_lock.h>
|
||||
#endif
|
||||
|
||||
#include "my_handler.h"
|
||||
#include "my_tree.h"
|
||||
|
@ -146,10 +146,8 @@ typedef struct st_heap_share
|
|||
uint open_count;
|
||||
uchar *del_link; /* Link to next block with del. rec */
|
||||
char * name; /* Name of "memory-file" */
|
||||
#ifdef THREAD
|
||||
THR_LOCK lock;
|
||||
mysql_mutex_t intern_lock; /* Locking for use with _locking */
|
||||
#endif
|
||||
my_bool delete_on_close;
|
||||
LIST open_list;
|
||||
uint auto_key;
|
||||
|
@ -175,9 +173,7 @@ typedef struct st_heap_info
|
|||
TREE_ELEMENT **last_pos;
|
||||
uint lastkey_len;
|
||||
my_bool implicit_emptied;
|
||||
#ifdef THREAD
|
||||
THR_LOCK_DATA lock;
|
||||
#endif
|
||||
LIST open_list;
|
||||
} HP_INFO;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2000 MySQL AB
|
||||
/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights
|
||||
reserved
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,9 +31,6 @@
|
|||
#define EOVERFLOW 84
|
||||
#endif
|
||||
|
||||
#if !defined(USE_MY_FUNC) && !defined(THREAD)
|
||||
#include <my_nosys.h> /* For faster code, after test */
|
||||
#endif /* USE_MY_FUNC */
|
||||
#endif /* stdin */
|
||||
#include <my_list.h>
|
||||
|
||||
|
|
|
@ -33,9 +33,7 @@ typedef struct st_bitmap
|
|||
thread_safe flag in bitmap_init was set. Otherwise, we optimize by not
|
||||
acquiring the mutex
|
||||
*/
|
||||
#ifdef THREAD
|
||||
mysql_mutex_t *mutex;
|
||||
#endif
|
||||
} MY_BITMAP;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -212,13 +212,6 @@
|
|||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* The client defines this to avoid all thread code */
|
||||
#if defined(MYSQL_CLIENT_NO_THREADS) || defined(UNDEF_THREADS_HACK)
|
||||
#undef THREAD
|
||||
#undef HAVE_LINUXTHREADS
|
||||
#undef HAVE_NPTL
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_THREADS_WITHOUT_SOCKETS
|
||||
/* MIT pthreads does not work with unix sockets */
|
||||
#undef HAVE_SYS_UN_H
|
||||
|
@ -261,7 +254,7 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(THREAD) && !defined(__WIN__)
|
||||
#if !defined(__WIN__)
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
|
||||
#endif
|
||||
|
@ -282,7 +275,7 @@ C_MODE_END
|
|||
#if !defined(SCO) && !defined(_REENTRANT)
|
||||
#define _REENTRANT 1 /* Threads requires reentrant code */
|
||||
#endif
|
||||
#endif /* THREAD */
|
||||
#endif /* !defined(__WIN__) */
|
||||
|
||||
/* Go around some bugs in different OS and compilers */
|
||||
#ifdef _AIX /* By soren@t.dk */
|
||||
|
@ -415,7 +408,7 @@ C_MODE_END
|
|||
#include <sys/stream.h> /* HPUX 10.20 defines ulong here. UGLY !!! */
|
||||
#define HAVE_ULONG
|
||||
#endif
|
||||
#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD)
|
||||
#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE)
|
||||
/* Fix bug in setrlimit */
|
||||
#undef setrlimit
|
||||
#define setrlimit cma_setrlimit64
|
||||
|
@ -1342,17 +1335,6 @@ do { doubleget_union _tmp; \
|
|||
|
||||
#endif /* WORDS_BIGENDIAN */
|
||||
|
||||
#ifndef THREAD
|
||||
#define thread_safe_increment(V,L) (V)++
|
||||
#define thread_safe_decrement(V,L) (V)--
|
||||
#define thread_safe_add(V,C,L) (V)+=(C)
|
||||
#define thread_safe_sub(V,C,L) (V)-=(C)
|
||||
#define statistic_increment(V,L) (V)++
|
||||
#define statistic_decrement(V,L) (V)--
|
||||
#define statistic_add(V,C,L) (V)+=(C)
|
||||
#define statistic_sub(V,C,L) (V)-=(C)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CHARSET_utf8
|
||||
#define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8"
|
||||
#else
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
#ifndef MY_NO_PTHREAD_INCLUDED
|
||||
#define MY_NO_PTHREAD_INCLUDED
|
||||
|
||||
/* Copyright (C) 2000 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program 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 */
|
||||
|
||||
|
||||
#ifndef THREAD
|
||||
|
||||
/*
|
||||
This block is to access some thread-related type definitions
|
||||
even in builds which do not need thread functions,
|
||||
as some variables (based on these types) are declared
|
||||
even in non-threaded builds.
|
||||
Case in point: 'mf_keycache.c'
|
||||
*/
|
||||
#if defined(__WIN__)
|
||||
#else /* Normal threads */
|
||||
#include <pthread.h>
|
||||
|
||||
#endif /* defined(__WIN__) */
|
||||
|
||||
|
||||
/*
|
||||
This undefs some pthread mutex locks when one isn't using threads
|
||||
to make thread safe code, that should also work in single thread
|
||||
environment, easier to use.
|
||||
*/
|
||||
#define pthread_mutex_init(A,B)
|
||||
#define pthread_mutex_lock(A)
|
||||
#define pthread_mutex_unlock(A)
|
||||
#define pthread_mutex_destroy(A)
|
||||
#define my_rwlock_init(A,B)
|
||||
#define rw_rdlock(A)
|
||||
#define rw_wrlock(A)
|
||||
#define rw_unlock(A)
|
||||
#define rwlock_destroy(A)
|
||||
#define safe_mutex_assert_owner(mp)
|
||||
|
||||
#define mysql_mutex_init(A, B, C) do {} while (0)
|
||||
#define mysql_mutex_lock(A) do {} while (0)
|
||||
#define mysql_mutex_unlock(A) do {} while (0)
|
||||
#define mysql_mutex_destroy(A) do {} while (0)
|
||||
|
||||
#define mysql_rwlock_init(A, B, C) do {} while (0)
|
||||
#define mysql_rwlock_rdlock(A) do {} while (0)
|
||||
#define mysql_rwlock_wrlock(A) do {} while (0)
|
||||
#define mysql_rwlock_unlock(A) do {} while (0)
|
||||
#define mysql_rwlock_destroy(A) do {} while (0)
|
||||
|
||||
typedef int my_pthread_once_t;
|
||||
#define MY_PTHREAD_ONCE_INIT 0
|
||||
#define MY_PTHREAD_ONCE_DONE 1
|
||||
|
||||
#define my_pthread_once(C,F) do { \
|
||||
if (*(C) != MY_PTHREAD_ONCE_DONE) { F(); *(C)= MY_PTHREAD_ONCE_DONE; } \
|
||||
} while(0)
|
||||
|
||||
#endif
|
||||
#endif /* MY_NO_PTHREAD_INCLUDED */
|
|
@ -881,12 +881,6 @@ extern uint thd_lib_detected;
|
|||
to use my_atomic operations instead.
|
||||
*/
|
||||
|
||||
/*
|
||||
Warning:
|
||||
When compiling without threads, this file is not included.
|
||||
See the *other* declarations of thread_safe_xxx in include/my_global.h
|
||||
*/
|
||||
#ifdef THREAD
|
||||
#ifndef thread_safe_increment
|
||||
#ifdef _WIN32
|
||||
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
|
||||
|
@ -910,7 +904,7 @@ extern uint thd_lib_detected;
|
|||
(mysql_mutex_lock((L)), (V)-=(C), mysql_mutex_unlock((L)))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
statistics_xxx functions are for non critical statistic,
|
||||
|
|
|
@ -41,11 +41,7 @@ typedef struct my_aio_result {
|
|||
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
|
||||
#endif /* HAVE_VALGRIND */
|
||||
|
||||
#ifndef THREAD
|
||||
extern int my_errno; /* Last error in mysys */
|
||||
#else
|
||||
#include <my_pthread.h>
|
||||
#endif
|
||||
|
||||
#include <m_ctype.h> /* for CHARSET_INFO */
|
||||
#include <stdarg.h>
|
||||
|
@ -314,7 +310,7 @@ struct st_my_file_info
|
|||
int oflag; /* open flags, e.g O_APPEND */
|
||||
#endif
|
||||
enum file_type type;
|
||||
#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32)
|
||||
#if !defined(HAVE_PREAD) && !defined(_WIN32)
|
||||
mysql_mutex_t mutex;
|
||||
#endif
|
||||
};
|
||||
|
@ -334,9 +330,7 @@ typedef struct st_my_tmpdir
|
|||
DYNAMIC_ARRAY full_list;
|
||||
char **list;
|
||||
uint cur, max;
|
||||
#ifdef THREAD
|
||||
mysql_mutex_t mutex;
|
||||
#endif
|
||||
} MY_TMPDIR;
|
||||
|
||||
typedef struct st_dynamic_string
|
||||
|
@ -348,7 +342,6 @@ typedef struct st_dynamic_string
|
|||
struct st_io_cache;
|
||||
typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*);
|
||||
|
||||
#ifdef THREAD
|
||||
typedef struct st_io_cache_share
|
||||
{
|
||||
mysql_mutex_t mutex; /* To sync on reads into buffer. */
|
||||
|
@ -368,7 +361,6 @@ typedef struct st_io_cache_share
|
|||
my_bool alloced;
|
||||
#endif
|
||||
} IO_CACHE_SHARE;
|
||||
#endif
|
||||
|
||||
typedef struct st_io_cache /* Used when cacheing files */
|
||||
{
|
||||
|
@ -409,7 +401,7 @@ typedef struct st_io_cache /* Used when cacheing files */
|
|||
WRITE_CACHE, and &read_pos and &read_end respectively otherwise
|
||||
*/
|
||||
uchar **current_pos, **current_end;
|
||||
#ifdef THREAD
|
||||
|
||||
/*
|
||||
The lock is for append buffer used in SEQ_READ_APPEND cache
|
||||
need mutex copying from append buffer to read buffer.
|
||||
|
@ -423,7 +415,7 @@ typedef struct st_io_cache /* Used when cacheing files */
|
|||
READ_CACHE mode is supported.
|
||||
*/
|
||||
IO_CACHE_SHARE *share;
|
||||
#endif
|
||||
|
||||
/*
|
||||
A caller will use my_b_read() macro to read from the cache
|
||||
if the data is already in cache, it will be simply copied with
|
||||
|
@ -656,14 +648,6 @@ extern int my_redel(const char *from, const char *to, int MyFlags);
|
|||
extern int my_copystat(const char *from, const char *to, int MyFlags);
|
||||
extern char * my_filename(File fd);
|
||||
|
||||
#ifndef THREAD
|
||||
extern void dont_break(void);
|
||||
extern void allow_break(void);
|
||||
#else
|
||||
#define dont_break()
|
||||
#define allow_break()
|
||||
#endif
|
||||
|
||||
#ifdef EXTRA_DEBUG
|
||||
void my_print_open_files(void);
|
||||
#else
|
||||
|
@ -736,12 +720,10 @@ extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
|
|||
pbool clear_cache);
|
||||
extern void setup_io_cache(IO_CACHE* info);
|
||||
extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count);
|
||||
#ifdef THREAD
|
||||
extern int _my_b_read_r(IO_CACHE *info,uchar *Buffer,size_t Count);
|
||||
extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare,
|
||||
IO_CACHE *write_cache, uint num_threads);
|
||||
extern void remove_io_thread(IO_CACHE *info);
|
||||
#endif
|
||||
extern int _my_b_seq_read(IO_CACHE *info,uchar *Buffer,size_t Count);
|
||||
extern int _my_b_net_read(IO_CACHE *info,uchar *Buffer,size_t Count);
|
||||
extern int _my_b_get(IO_CACHE *info);
|
||||
|
|
|
@ -433,10 +433,8 @@ typedef struct st_mi_check_param
|
|||
const char *db_name, *table_name;
|
||||
const char *op_name;
|
||||
enum_mi_stats_method stats_method;
|
||||
#ifdef THREAD
|
||||
mysql_mutex_t print_msg_mutex;
|
||||
my_bool need_print_msg_lock;
|
||||
#endif
|
||||
} MI_CHECK;
|
||||
|
||||
typedef struct st_sort_ft_buf
|
||||
|
@ -460,10 +458,8 @@ typedef struct st_sort_info
|
|||
SORT_FT_BUF *ft_buf;
|
||||
/* sync things */
|
||||
uint got_error, threads_running;
|
||||
#ifdef THREAD
|
||||
mysql_mutex_t mutex;
|
||||
mysql_cond_t cond;
|
||||
#endif
|
||||
} SORT_INFO;
|
||||
|
||||
/* functions in mi_check */
|
||||
|
|
|
@ -41,7 +41,7 @@ typedef struct st_alarm_info
|
|||
|
||||
void thr_alarm_info(ALARM_INFO *info);
|
||||
|
||||
#if defined(DONT_USE_THR_ALARM) || !defined(THREAD)
|
||||
#if defined(DONT_USE_THR_ALARM)
|
||||
|
||||
#define USE_ALARM_THREAD
|
||||
#undef USE_ONE_SIGNAL_HAND
|
||||
|
|
|
@ -35,21 +35,6 @@ sig_handler my_pipe_sig_handler(int sig);
|
|||
void read_user_name(char *name);
|
||||
my_bool handle_local_infile(MYSQL *mysql, const char *net_filename);
|
||||
|
||||
/*
|
||||
Let the user specify that we don't want SIGPIPE; This doesn't however work
|
||||
with threaded applications as we can have multiple read in progress.
|
||||
*/
|
||||
|
||||
#if !defined(__WIN__) && defined(SIGPIPE) && !defined(THREAD)
|
||||
#define init_sigpipe_variables sig_return old_signal_handler=(sig_return) 0;
|
||||
#define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE, my_pipe_sig_handler)
|
||||
#define reset_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) signal(SIGPIPE,old_signal_handler);
|
||||
#else
|
||||
#define init_sigpipe_variables
|
||||
#define set_sigpipe(mysql)
|
||||
#define reset_sigpipe(mysql)
|
||||
#endif
|
||||
|
||||
void mysql_read_default_options(struct st_mysql_options *options,
|
||||
const char *filename,const char *group);
|
||||
void mysql_detach_stmt_list(LIST **stmt_list, const char *func_name);
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#ifdef HAVE_SYS_UN_H
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
#if defined(THREAD) && !defined(__WIN__)
|
||||
#if !defined(__WIN__)
|
||||
#include <my_pthread.h> /* because of signal() */
|
||||
#endif
|
||||
#ifndef INADDR_NONE
|
||||
|
@ -172,10 +172,8 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
|
|||
result= init_embedded_server(argc, argv, groups);
|
||||
#endif
|
||||
}
|
||||
#ifdef THREAD
|
||||
else
|
||||
result= (int)my_thread_init(); /* Init if new thread */
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -229,18 +227,12 @@ MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void)
|
|||
|
||||
my_bool STDCALL mysql_thread_init()
|
||||
{
|
||||
#ifdef THREAD
|
||||
return my_thread_init();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void STDCALL mysql_thread_end()
|
||||
{
|
||||
#ifdef THREAD
|
||||
my_thread_end();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1092,11 +1084,7 @@ void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *csinfo)
|
|||
|
||||
uint STDCALL mysql_thread_safe(void)
|
||||
{
|
||||
#ifdef THREAD
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,10 +12,8 @@ main.gis # Bug#52208 2010-11-24 alik gis fails o
|
|||
main.gis-rtree @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
|
||||
main.information_schema # Bug#47449 2009-09-19 alik main.information_schema and innodb.innodb_information_schema fail sporadically
|
||||
main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically
|
||||
main.lock_multi_bug38691 @solaris # Bug#47792 2009-10-02 alik main.lock_multi_bug38691 times out sporadically on Solaris 10
|
||||
main.lowercase_table2 @darwin # Bug#55509 2010-07-26 alik main.lowercase_table2 fails on Mac OSX (again)
|
||||
main.outfile_loaddata @solaris # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible)
|
||||
main.show_check # Bug#58414 2010-11-24 alik Race condition in show_check.test
|
||||
main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
|
||||
main.sp @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
|
||||
main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
|
||||
|
|
|
@ -1014,6 +1014,14 @@ SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000
|
|||
SET @a=POLYFROMWKB(@a);
|
||||
SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
|
||||
SET @a=POLYFROMWKB(@a);
|
||||
create table t1(a polygon NOT NULL)engine=myisam;
|
||||
insert into t1 values (geomfromtext("point(0 1)"));
|
||||
insert into t1 values (geomfromtext("point(1 0)"));
|
||||
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
|
||||
p
|
||||
NULL
|
||||
NULL
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
CREATE TABLE t1(
|
||||
col0 BINARY NOT NULL,
|
||||
|
|
|
@ -66,3 +66,27 @@ SELECT ((@id := id) - id) FROM t2;
|
|||
KILL @id;
|
||||
SET DEBUG_SYNC= "now SIGNAL killed";
|
||||
DROP TABLE t1, t2;
|
||||
SET DEBUG_SYNC= "RESET";
|
||||
#
|
||||
# Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
|
||||
# OPTIMIZE TABLE
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
# Connection con1
|
||||
SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed';
|
||||
# Sending:
|
||||
OPTIMIZE TABLE t1;
|
||||
# Connection default
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR waiting';
|
||||
KILL QUERY ID;
|
||||
SET DEBUG_SYNC= 'now SIGNAL killed';
|
||||
# Connection con1
|
||||
# Reaping: OPTIMIZE TABLE t1
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status Operation failed
|
||||
# Connection default
|
||||
DROP TABLE t1;
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
|
|
|
@ -1901,7 +1901,7 @@ c1 bigint,
|
|||
c2 set('sweet'),
|
||||
key (c2,c1,c0),
|
||||
key(c0)
|
||||
) engine=myisam partition by hash (month(c0)) partitions 5;
|
||||
) engine=myisam partition by hash (c0) partitions 5;
|
||||
insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019;
|
||||
insert ignore into t1 set c0 = 241221, c1 = -6862346, c2 = 56644;
|
||||
select c1 from t1 group by (select c0 from t1 limit 1);
|
||||
|
|
|
@ -1,5 +1,655 @@
|
|||
drop table if exists t1, t2;
|
||||
#
|
||||
# Bug#54483: valgrind errors when making warnings for multiline inserts
|
||||
# into partition
|
||||
#
|
||||
CREATE TABLE t1 (a VARBINARY(10))
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a CHAR(10))
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIMESTAMP)
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
INSERT INTO t1 VALUES ('test'),('a'),('5');
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
Warning 1265 Data truncated for column 'a' at row 2
|
||||
Warning 1265 Data truncated for column 'a' at row 3
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
Warning 1265 Data truncated for column 'a' at row 2
|
||||
Warning 1265 Data truncated for column 'a' at row 3
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
INSERT INTO t1 VALUES ('test'),('a'),('5');
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
Warning 1264 Out of range value for column 'a' at row 2
|
||||
Warning 1264 Out of range value for column 'a' at row 3
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
Warning 1264 Out of range value for column 'a' at row 2
|
||||
Warning 1264 Out of range value for column 'a' at row 3
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (TO_DAYS(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (TO_DAYS(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (TO_DAYS(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (TO_DAYS(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (TO_DAYS(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (DAYOFMONTH(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (DAYOFMONTH(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (DAYOFMONTH(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (DAYOFMONTH(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (DAYOFMONTH(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (MONTH(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (MONTH(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (MONTH(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (MONTH(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (MONTH(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (DAYOFYEAR(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (DAYOFYEAR(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (DAYOFYEAR(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (DAYOFYEAR(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (DAYOFYEAR(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (HOUR(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (HOUR(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (HOUR(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (HOUR(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (HOUR(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (MINUTE(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (MINUTE(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (MINUTE(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (MINUTE(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (MINUTE(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (QUARTER(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (QUARTER(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (QUARTER(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (QUARTER(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (QUARTER(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (SECOND(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (SECOND(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (SECOND(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (SECOND(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (SECOND(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (YEARWEEK(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (YEARWEEK(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (YEARWEEK(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (YEARWEEK(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (YEARWEEK(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (WEEKDAY(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (WEEKDAY(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (WEEKDAY(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (WEEKDAY(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (WEEKDAY(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
# TO_SECONDS() is added in 5.5.
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (TO_SECONDS(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (TO_SECONDS(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (TO_SECONDS(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (TO_SECONDS(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (TO_SECONDS(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (FROM_DAYS(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (FROM_DAYS(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (FROM_DAYS(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (TO_DAYS(FROM_DAYS(a)));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (FROM_DAYS(a));
|
||||
ERROR HY000: The PARTITION function returns the wrong type
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (TO_DAYS(FROM_DAYS(a)));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (FROM_DAYS(a));
|
||||
ERROR HY000: The PARTITION function returns the wrong type
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (MICROSECOND(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (MICROSECOND(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (MICROSECOND(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (MICROSECOND(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (MICROSECOND(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
# Bug#57071
|
||||
CREATE TABLE t1
|
||||
(`date` date,
|
||||
`extracted_week` int,
|
||||
`yearweek` int,
|
||||
`week` int,
|
||||
`default_week_format` int)
|
||||
PARTITION BY LIST (EXTRACT(WEEK FROM date) % 3)
|
||||
(PARTITION p0 VALUES IN (0),
|
||||
PARTITION p1 VALUES IN (1),
|
||||
PARTITION p2 VALUES IN (2));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1
|
||||
(`date` date,
|
||||
`extracted_week` int,
|
||||
`yearweek` int,
|
||||
`week` int,
|
||||
`default_week_format` int);
|
||||
SET @old_default_week_format := @@default_week_format;
|
||||
SET default_week_format = 0;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 1;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 2;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 3;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 4;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 5;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 6;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 7;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SELECT * FROM t1;
|
||||
date extracted_week yearweek week default_week_format
|
||||
2000-01-01 0 199952 0 0
|
||||
2000-01-01 0 199952 0 1
|
||||
2000-01-01 52 199952 52 2
|
||||
2000-01-01 52 199952 52 3
|
||||
2000-01-01 0 199952 0 4
|
||||
2000-01-01 0 199952 0 5
|
||||
2000-01-01 52 199952 52 6
|
||||
2000-01-01 52 199952 52 7
|
||||
SET default_week_format = @old_default_week_format;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(YEAR FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(YEAR FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(YEAR FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(YEAR FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(YEAR FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(MONTH FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(MONTH FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(MONTH FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(MONTH FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(MONTH FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
# EXTRACT(WEEK...) is disallowed, see bug#57071.
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(WEEK FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(WEEK FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(WEEK FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(WEEK FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(WEEK FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(DAY FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(DAY FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(DAY FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(HOUR FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(HOUR FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(HOUR FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(SECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(SECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(SECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME, b DATE)
|
||||
PARTITION BY HASH (DATEDIFF(a, b));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATE, b DATETIME)
|
||||
PARTITION BY HASH (DATEDIFF(a, b));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME, b DATE)
|
||||
PARTITION BY HASH (DATEDIFF(a, b));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE, b VARCHAR(10))
|
||||
PARTITION BY HASH (DATEDIFF(a, b));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT, b DATETIME)
|
||||
PARTITION BY HASH (DATEDIFF(a, b));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
|
||||
#
|
||||
# Bug#50036: Inconsistent errors when using TIMESTAMP
|
||||
# columns/expressions
|
||||
# 1. correct and appropriate errors in light of
|
||||
|
|
|
@ -13,16 +13,16 @@ EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100, 3) GROUP BY a;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int)
|
||||
partition by range (a)
|
||||
create table t1 (a DATETIME)
|
||||
partition by range (TO_DAYS(a))
|
||||
subpartition by hash(to_seconds(a))
|
||||
(partition p0 values less than (1));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
`a` datetime DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
/*!50500 PARTITION BY RANGE (a)
|
||||
/*!50500 PARTITION BY RANGE (TO_DAYS(a))
|
||||
SUBPARTITION BY HASH (to_seconds(a))
|
||||
(PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM) */
|
||||
drop table t1;
|
||||
|
|
|
@ -5004,6 +5004,58 @@ ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
|
|||
SELECT * FROM t2 UNION SELECT * FROM t2
|
||||
ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# Bug #58818: Incorrect result for IN/ANY subquery
|
||||
# with HAVING condition
|
||||
#
|
||||
CREATE TABLE t1(i INT);
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
CREATE TABLE t1s(i INT);
|
||||
INSERT INTO t1s VALUES (10), (20), (30);
|
||||
CREATE TABLE t2s(i INT);
|
||||
INSERT INTO t2s VALUES (100), (200), (300);
|
||||
SELECT * FROM t1
|
||||
WHERE t1.i NOT IN
|
||||
(
|
||||
SELECT STRAIGHT_JOIN t2s.i
|
||||
FROM
|
||||
t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
|
||||
HAVING t2s.i = 999
|
||||
);
|
||||
i
|
||||
1
|
||||
2
|
||||
3
|
||||
SELECT * FROM t1
|
||||
WHERE t1.I IN
|
||||
(
|
||||
SELECT STRAIGHT_JOIN t2s.i
|
||||
FROM
|
||||
t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
|
||||
HAVING t2s.i = 999
|
||||
) IS UNKNOWN;
|
||||
i
|
||||
SELECT * FROM t1
|
||||
WHERE NOT t1.I = ANY
|
||||
(
|
||||
SELECT STRAIGHT_JOIN t2s.i
|
||||
FROM
|
||||
t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
|
||||
HAVING t2s.i = 999
|
||||
);
|
||||
i
|
||||
1
|
||||
2
|
||||
3
|
||||
SELECT * FROM t1
|
||||
WHERE t1.i = ANY (
|
||||
SELECT STRAIGHT_JOIN t2s.i
|
||||
FROM
|
||||
t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
|
||||
HAVING t2s.i = 999
|
||||
) IS UNKNOWN;
|
||||
i
|
||||
DROP TABLE t1,t1s,t2s;
|
||||
End of 5.1 tests
|
||||
#
|
||||
# Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool):
|
||||
|
|
|
@ -164,6 +164,17 @@ a b
|
|||
2 NULL
|
||||
DROP TABLE t1, t2, t3, t4, t5;
|
||||
#
|
||||
# Bug#58207: invalid memory reads when using default column value and
|
||||
# tmptable needed
|
||||
#
|
||||
CREATE TABLE t(a VARCHAR(245) DEFAULT
|
||||
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
|
||||
INSERT INTO t VALUES (''),(''),(''),(''),(''),(''),(''),(''),(''),(''),('');
|
||||
SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d;
|
||||
default(a)
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
DROP TABLE t;
|
||||
#
|
||||
# End of 5.1 tests.
|
||||
#
|
||||
#
|
||||
|
|
|
@ -1248,3 +1248,129 @@ Note 1449 The user specified as a definer ('unknown'@'unknown') does not exist
|
|||
LOCK TABLES v1 READ;
|
||||
ERROR HY000: The user specified as a definer ('unknown'@'unknown') does not exist
|
||||
DROP VIEW v1;
|
||||
#
|
||||
# Bug #58499 "DEFINER-security view selecting from INVOKER-security view
|
||||
# access check wrong".
|
||||
#
|
||||
# Check that we correctly handle privileges for various combinations
|
||||
# of INVOKER and DEFINER-security views using each other.
|
||||
DROP DATABASE IF EXISTS mysqltest1;
|
||||
CREATE DATABASE mysqltest1;
|
||||
USE mysqltest1;
|
||||
CREATE TABLE t1 (i INT);
|
||||
CREATE TABLE t2 (j INT);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (2);
|
||||
#
|
||||
# 1) DEFINER-security view uses INVOKER-security view (covers
|
||||
# scenario originally described in the bug report).
|
||||
CREATE SQL SECURITY INVOKER VIEW v1_uses_t1 AS SELECT * FROM t1;
|
||||
CREATE SQL SECURITY INVOKER VIEW v1_uses_t2 AS SELECT * FROM t2;
|
||||
CREATE USER 'mysqluser1'@'%';
|
||||
GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser1'@'%';
|
||||
GRANT SELECT ON t1 TO 'mysqluser1'@'%';
|
||||
# To be able create 'v2_uses_t2' we also need select on t2.
|
||||
GRANT SELECT ON t2 TO 'mysqluser1'@'%';
|
||||
GRANT SELECT ON v1_uses_t1 TO 'mysqluser1'@'%';
|
||||
GRANT SELECT ON v1_uses_t2 TO 'mysqluser1'@'%';
|
||||
#
|
||||
# Connection 'mysqluser1'.
|
||||
CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1;
|
||||
CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2;
|
||||
#
|
||||
# Connection 'default'.
|
||||
CREATE USER 'mysqluser2'@'%';
|
||||
GRANT SELECT ON v2_uses_t1 TO 'mysqluser2'@'%';
|
||||
GRANT SELECT ON v2_uses_t2 TO 'mysqluser2'@'%';
|
||||
GRANT SELECT ON t2 TO 'mysqluser2'@'%';
|
||||
GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser2'@'%';
|
||||
# Make 'mysqluser1' unable to access t2.
|
||||
REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
|
||||
#
|
||||
# Connection 'mysqluser2'.
|
||||
# The below statement should succeed thanks to suid nature of v2_uses_t1.
|
||||
SELECT * FROM v2_uses_t1;
|
||||
i
|
||||
1
|
||||
# The below statement should fail due to suid nature of v2_uses_t2.
|
||||
SELECT * FROM v2_uses_t2;
|
||||
ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
#
|
||||
# 2) INVOKER-security view uses INVOKER-security view.
|
||||
#
|
||||
# Connection 'default'.
|
||||
DROP VIEW v2_uses_t1, v2_uses_t2;
|
||||
CREATE SQL SECURITY INVOKER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1;
|
||||
CREATE SQL SECURITY INVOKER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2;
|
||||
GRANT SELECT ON v2_uses_t1 TO 'mysqluser1'@'%';
|
||||
GRANT SELECT ON v2_uses_t2 TO 'mysqluser1'@'%';
|
||||
GRANT SELECT ON v1_uses_t1 TO 'mysqluser2'@'%';
|
||||
GRANT SELECT ON v1_uses_t2 TO 'mysqluser2'@'%';
|
||||
#
|
||||
# Connection 'mysqluser1'.
|
||||
# For both versions of 'v2' 'mysqluser1' privileges should be used.
|
||||
SELECT * FROM v2_uses_t1;
|
||||
i
|
||||
1
|
||||
SELECT * FROM v2_uses_t2;
|
||||
ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
#
|
||||
# Connection 'mysqluser2'.
|
||||
# And now for both versions of 'v2' 'mysqluser2' privileges should
|
||||
# be used.
|
||||
SELECT * FROM v2_uses_t1;
|
||||
ERROR HY000: View 'mysqltest1.v2_uses_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
SELECT * FROM v2_uses_t2;
|
||||
j
|
||||
2
|
||||
#
|
||||
# 3) INVOKER-security view uses DEFINER-security view.
|
||||
#
|
||||
# Connection 'default'.
|
||||
DROP VIEW v1_uses_t1, v1_uses_t2;
|
||||
# To be able create 'v1_uses_t2' we also need select on t2.
|
||||
GRANT SELECT ON t2 TO 'mysqluser1'@'%';
|
||||
#
|
||||
# Connection 'mysqluser1'.
|
||||
CREATE SQL SECURITY DEFINER VIEW v1_uses_t1 AS SELECT * FROM t1;
|
||||
CREATE SQL SECURITY DEFINER VIEW v1_uses_t2 AS SELECT * FROM t2;
|
||||
#
|
||||
# Connection 'default'.
|
||||
# Make 'mysqluser1' unable to access t2.
|
||||
REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
|
||||
#
|
||||
# Connection 'mysqluser2'.
|
||||
# Due to suid nature of v1_uses_t1 and v1_uses_t2 the first
|
||||
# select should succeed and the second select should fail.
|
||||
SELECT * FROM v2_uses_t1;
|
||||
i
|
||||
1
|
||||
SELECT * FROM v2_uses_t2;
|
||||
ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
#
|
||||
# 4) DEFINER-security view uses DEFINER-security view.
|
||||
#
|
||||
# Connection 'default'.
|
||||
DROP VIEW v2_uses_t1, v2_uses_t2;
|
||||
# To be able create 'v2_uses_t2' we also need select on t2.
|
||||
GRANT SELECT ON t2 TO 'mysqluser1'@'%';
|
||||
#
|
||||
# Connection 'mysqluser2'.
|
||||
CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1;
|
||||
CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2;
|
||||
#
|
||||
# Connection 'default'.
|
||||
# Make 'mysqluser1' unable to access t2.
|
||||
REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
|
||||
#
|
||||
# Connection 'mysqluser2'.
|
||||
# Again privileges of creator of innermost views should apply.
|
||||
SELECT * FROM v2_uses_t1;
|
||||
i
|
||||
1
|
||||
SELECT * FROM v2_uses_t2;
|
||||
ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
USE test;
|
||||
DROP DATABASE mysqltest1;
|
||||
DROP USER 'mysqluser1'@'%';
|
||||
DROP USER 'mysqluser2'@'%';
|
||||
|
|
|
@ -88,8 +88,9 @@ let $val2 = '2006-01-17';
|
|||
let $val3 = '2006-02-25';
|
||||
let $val4 = '2006-02-05';
|
||||
--source suite/parts/inc/partition_supported_sql_funcs.inc
|
||||
let $coltype = char(30);
|
||||
--source suite/parts/inc/partition_supported_sql_funcs.inc
|
||||
# Disabled after fixing bug#54483.
|
||||
#let $coltype = char(30);
|
||||
#--source suite/parts/inc/partition_supported_sql_funcs.inc
|
||||
|
||||
let $sqlfunc = extract(month from col1);
|
||||
let $valsqlfunc = extract(year from '1998-11-23');
|
||||
|
@ -139,8 +140,9 @@ let $val2 = '14:30:20';
|
|||
let $val3 = '21:59:22';
|
||||
let $val4 = '10:22:33';
|
||||
--source suite/parts/inc/partition_supported_sql_funcs.inc
|
||||
let $coltype = char(30);
|
||||
--source suite/parts/inc/partition_supported_sql_funcs.inc
|
||||
# second(non_time_col) is disabled after bug#54483.
|
||||
#let $coltype = char(30);
|
||||
#--source suite/parts/inc/partition_supported_sql_funcs.inc
|
||||
|
||||
let $sqlfunc = month(col1);
|
||||
let $valsqlfunc = month('2006-10-14');
|
||||
|
@ -172,26 +174,28 @@ let $val3 = '21:59:22';
|
|||
let $val4 = '10:33:11';
|
||||
--source suite/parts/inc/partition_supported_sql_funcs.inc
|
||||
|
||||
let $sqlfunc = to_days(col1)-to_days('2006-01-01');
|
||||
let $valsqlfunc = to_days('2006-02-02')-to_days('2006-01-01');
|
||||
let $coltype = date;
|
||||
let $infile = part_supported_sql_funcs_int_date.inc;
|
||||
let $val1 = '2006-02-03';
|
||||
let $val2 = '2006-01-17';
|
||||
let $val3 = '2006-01-25';
|
||||
let $val4 = '2006-02-06';
|
||||
--source suite/parts/inc/partition_supported_sql_funcs.inc
|
||||
# to_days(non_date_col) is disabled after bug#54483.
|
||||
#let $sqlfunc = to_days(col1)-to_days('2006-01-01');
|
||||
#let $valsqlfunc = to_days('2006-02-02')-to_days('2006-01-01');
|
||||
#let $coltype = date;
|
||||
#let $infile = part_supported_sql_funcs_int_date.inc;
|
||||
#let $val1 = '2006-02-03';
|
||||
#let $val2 = '2006-01-17';
|
||||
#let $val3 = '2006-01-25';
|
||||
#let $val4 = '2006-02-06';
|
||||
#--source suite/parts/inc/partition_supported_sql_funcs.inc
|
||||
|
||||
# to_days(non_date_col) is disabled after bug#54483.
|
||||
# DATEDIFF() is implemented as (TO_DAYS(d1) - TO_DAYS(d2))
|
||||
let $sqlfunc = datediff(col1, '2006-01-01');
|
||||
let $valsqlfunc = datediff('2006-02-02', '2006-01-01');
|
||||
let $coltype = date;
|
||||
let $infile = part_supported_sql_funcs_int_date.inc;
|
||||
let $val1 = '2006-02-03';
|
||||
let $val2 = '2006-01-17';
|
||||
let $val3 = '2006-01-25';
|
||||
let $val4 = '2006-02-06';
|
||||
--source suite/parts/inc/partition_supported_sql_funcs.inc
|
||||
#let $sqlfunc = datediff(col1, '2006-01-01');
|
||||
#let $valsqlfunc = datediff('2006-02-02', '2006-01-01');
|
||||
#let $coltype = date;
|
||||
#let $infile = part_supported_sql_funcs_int_date.inc;
|
||||
#let $val1 = '2006-02-03';
|
||||
#let $val2 = '2006-01-17';
|
||||
#let $val3 = '2006-01-25';
|
||||
#let $val4 = '2006-02-06';
|
||||
#--source suite/parts/inc/partition_supported_sql_funcs.inc
|
||||
|
||||
let $sqlfunc = weekday(col1);
|
||||
let $valsqlfunc = weekday('2006-10-14');
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -747,6 +747,16 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000
|
|||
SET @a=POLYFROMWKB(@a);
|
||||
|
||||
|
||||
#
|
||||
# Bug #57321 crashes and valgrind errors from spatial types
|
||||
#
|
||||
|
||||
create table t1(a polygon NOT NULL)engine=myisam;
|
||||
insert into t1 values (geomfromtext("point(0 1)"));
|
||||
insert into t1 values (geomfromtext("point(1 0)"));
|
||||
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
#
|
||||
|
|
|
@ -104,6 +104,47 @@ SELECT ((@id := id) - id) FROM t2;
|
|||
KILL @id;
|
||||
SET DEBUG_SYNC= "now SIGNAL killed";
|
||||
DROP TABLE t1, t2;
|
||||
disconnect con1;
|
||||
--source include/wait_until_count_sessions.inc
|
||||
SET DEBUG_SYNC= "RESET";
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
|
||||
--echo # OPTIMIZE TABLE
|
||||
--echo #
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
|
||||
--echo # Connection con1
|
||||
connect (con1,localhost,root);
|
||||
let $ID= `SELECT connection_id()`;
|
||||
SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed';
|
||||
--echo # Sending:
|
||||
--send OPTIMIZE TABLE t1
|
||||
|
||||
--echo # Connection default
|
||||
connection default;
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR waiting';
|
||||
--replace_result $ID ID
|
||||
eval KILL QUERY $ID;
|
||||
SET DEBUG_SYNC= 'now SIGNAL killed';
|
||||
|
||||
--echo # Connection con1
|
||||
connection con1;
|
||||
--echo # Reaping: OPTIMIZE TABLE t1
|
||||
--reap
|
||||
|
||||
--echo # Connection default
|
||||
connection default;
|
||||
DROP TABLE t1;
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
disconnect con1;
|
||||
|
||||
|
||||
# Check that all connections opened by test cases in this file are really
|
||||
|
|
|
@ -1898,15 +1898,16 @@ while ($cnt)
|
|||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#32272: partition crash 1: enum column
|
||||
# BUG#32772: partition crash 1: enum column
|
||||
#
|
||||
# Note that month(int_col) is disallowed after bug#54483.
|
||||
create table t1 (
|
||||
c0 int,
|
||||
c1 bigint,
|
||||
c2 set('sweet'),
|
||||
key (c2,c1,c0),
|
||||
key(c0)
|
||||
) engine=myisam partition by hash (month(c0)) partitions 5;
|
||||
) engine=myisam partition by hash (c0) partitions 5;
|
||||
|
||||
--disable_warnings
|
||||
insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019;
|
||||
|
|
|
@ -10,6 +10,667 @@ drop table if exists t1, t2;
|
|||
|
||||
let $MYSQLD_DATADIR= `SELECT @@datadir`;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#54483: valgrind errors when making warnings for multiline inserts
|
||||
--echo # into partition
|
||||
--echo #
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARBINARY(10))
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a CHAR(10))
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIMESTAMP)
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
INSERT INTO t1 VALUES ('test'),('a'),('5');
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
INSERT INTO t1 VALUES ('test'),('a'),('5');
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY RANGE (DAYOFWEEK(a))
|
||||
(PARTITION a1 VALUES LESS THAN (60));
|
||||
SHOW WARNINGS;
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (TO_DAYS(a));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (TO_DAYS(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (TO_DAYS(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (TO_DAYS(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (TO_DAYS(a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (DAYOFMONTH(a));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (DAYOFMONTH(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (DAYOFMONTH(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (DAYOFMONTH(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (DAYOFMONTH(a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (MONTH(a));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (MONTH(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (MONTH(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (MONTH(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (MONTH(a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (DAYOFYEAR(a));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (DAYOFYEAR(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (DAYOFYEAR(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (DAYOFYEAR(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (DAYOFYEAR(a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (HOUR(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (HOUR(a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (HOUR(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (HOUR(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (HOUR(a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (MINUTE(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (MINUTE(a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (MINUTE(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (MINUTE(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (MINUTE(a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (QUARTER(a));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (QUARTER(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (QUARTER(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (QUARTER(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (QUARTER(a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (SECOND(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (SECOND(a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (SECOND(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (SECOND(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (SECOND(a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (YEARWEEK(a));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (YEARWEEK(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (YEARWEEK(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (YEARWEEK(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (YEARWEEK(a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (WEEKDAY(a));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (WEEKDAY(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (WEEKDAY(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (WEEKDAY(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (WEEKDAY(a));
|
||||
|
||||
--echo # TO_SECONDS() is added in 5.5.
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (TO_SECONDS(a));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (TO_SECONDS(a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (TO_SECONDS(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (TO_SECONDS(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (TO_SECONDS(a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (FROM_DAYS(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (FROM_DAYS(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (FROM_DAYS(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (TO_DAYS(FROM_DAYS(a)));
|
||||
--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (FROM_DAYS(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (TO_DAYS(FROM_DAYS(a)));
|
||||
--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (FROM_DAYS(a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (MICROSECOND(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (MICROSECOND(a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (MICROSECOND(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (MICROSECOND(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (MICROSECOND(a));
|
||||
--echo # Bug#57071
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1
|
||||
(`date` date,
|
||||
`extracted_week` int,
|
||||
`yearweek` int,
|
||||
`week` int,
|
||||
`default_week_format` int)
|
||||
PARTITION BY LIST (EXTRACT(WEEK FROM date) % 3)
|
||||
(PARTITION p0 VALUES IN (0),
|
||||
PARTITION p1 VALUES IN (1),
|
||||
PARTITION p2 VALUES IN (2));
|
||||
CREATE TABLE t1
|
||||
(`date` date,
|
||||
`extracted_week` int,
|
||||
`yearweek` int,
|
||||
`week` int,
|
||||
`default_week_format` int);
|
||||
SET @old_default_week_format := @@default_week_format;
|
||||
SET default_week_format = 0;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 1;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 2;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 3;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 4;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 5;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 6;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SET default_week_format = 7;
|
||||
INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
|
||||
SELECT * FROM t1;
|
||||
SET default_week_format = @old_default_week_format;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(YEAR FROM a));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(YEAR FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(YEAR FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(YEAR FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(YEAR FROM a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(QUARTER FROM a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(MONTH FROM a));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(MONTH FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(MONTH FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(MONTH FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(MONTH FROM a));
|
||||
|
||||
--echo # EXTRACT(WEEK...) is disallowed, see bug#57071.
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(WEEK FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(WEEK FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(WEEK FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(WEEK FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(WEEK FROM a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY FROM a));
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(DAY FROM a));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(DAY FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(DAY FROM a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(HOUR FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(HOUR FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(HOUR FROM a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE FROM a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(SECOND FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(SECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(SECOND FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(SECOND FROM a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
|
||||
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TIME, b DATE)
|
||||
PARTITION BY HASH (DATEDIFF(a, b));
|
||||
CREATE TABLE t1 (a DATE, b DATETIME)
|
||||
PARTITION BY HASH (DATEDIFF(a, b));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DATETIME, b DATE)
|
||||
PARTITION BY HASH (DATEDIFF(a, b));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE, b VARCHAR(10))
|
||||
PARTITION BY HASH (DATEDIFF(a, b));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT, b DATETIME)
|
||||
PARTITION BY HASH (DATEDIFF(a, b));
|
||||
|
||||
CREATE TABLE t1 (a TIME)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a DATE)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
CREATE TABLE t1 (a DATETIME)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
DROP TABLE t1;
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a VARCHAR(10))
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY HASH (TIME_TO_SEC(a));
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug#50036: Inconsistent errors when using TIMESTAMP
|
||||
--echo # columns/expressions
|
||||
|
|
|
@ -30,8 +30,8 @@ DROP TABLE t1;
|
|||
#
|
||||
#BUG#49591, Add proper version number to SHOW CREATE TABLE
|
||||
#
|
||||
create table t1 (a int)
|
||||
partition by range (a)
|
||||
create table t1 (a DATETIME)
|
||||
partition by range (TO_DAYS(a))
|
||||
subpartition by hash(to_seconds(a))
|
||||
(partition p0 values less than (1));
|
||||
show create table t1;
|
||||
|
|
|
@ -3945,6 +3945,55 @@ SELECT * FROM t2 UNION SELECT * FROM t2
|
|||
DROP TABLE t1,t2;
|
||||
--enable_result_log
|
||||
|
||||
--echo #
|
||||
--echo # Bug #58818: Incorrect result for IN/ANY subquery
|
||||
--echo # with HAVING condition
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1(i INT);
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
CREATE TABLE t1s(i INT);
|
||||
INSERT INTO t1s VALUES (10), (20), (30);
|
||||
CREATE TABLE t2s(i INT);
|
||||
INSERT INTO t2s VALUES (100), (200), (300);
|
||||
|
||||
SELECT * FROM t1
|
||||
WHERE t1.i NOT IN
|
||||
(
|
||||
SELECT STRAIGHT_JOIN t2s.i
|
||||
FROM
|
||||
t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
|
||||
HAVING t2s.i = 999
|
||||
);
|
||||
|
||||
SELECT * FROM t1
|
||||
WHERE t1.I IN
|
||||
(
|
||||
SELECT STRAIGHT_JOIN t2s.i
|
||||
FROM
|
||||
t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
|
||||
HAVING t2s.i = 999
|
||||
) IS UNKNOWN;
|
||||
|
||||
SELECT * FROM t1
|
||||
WHERE NOT t1.I = ANY
|
||||
(
|
||||
SELECT STRAIGHT_JOIN t2s.i
|
||||
FROM
|
||||
t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
|
||||
HAVING t2s.i = 999
|
||||
);
|
||||
|
||||
SELECT * FROM t1
|
||||
WHERE t1.i = ANY (
|
||||
SELECT STRAIGHT_JOIN t2s.i
|
||||
FROM
|
||||
t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
|
||||
HAVING t2s.i = 999
|
||||
) IS UNKNOWN;
|
||||
|
||||
DROP TABLE t1,t1s,t2s;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
--echo #
|
||||
|
|
|
@ -136,6 +136,16 @@ SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 );
|
|||
|
||||
DROP TABLE t1, t2, t3, t4, t5;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#58207: invalid memory reads when using default column value and
|
||||
--echo # tmptable needed
|
||||
--echo #
|
||||
CREATE TABLE t(a VARCHAR(245) DEFAULT
|
||||
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
|
||||
INSERT INTO t VALUES (''),(''),(''),(''),(''),(''),(''),(''),(''),(''),('');
|
||||
SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d;
|
||||
DROP TABLE t;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.1 tests.
|
||||
|
|
|
@ -1503,8 +1503,6 @@ SHOW CREATE VIEW v1;
|
|||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
|
||||
# Wait till we reached the initial number of concurrent sessions
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug #46019: ERROR 1356 When selecting from within another
|
||||
|
@ -1546,3 +1544,145 @@ CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1;
|
|||
--error ER_NO_SUCH_USER
|
||||
LOCK TABLES v1 READ;
|
||||
DROP VIEW v1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug #58499 "DEFINER-security view selecting from INVOKER-security view
|
||||
--echo # access check wrong".
|
||||
--echo #
|
||||
--echo # Check that we correctly handle privileges for various combinations
|
||||
--echo # of INVOKER and DEFINER-security views using each other.
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqltest1;
|
||||
--enable_warnings
|
||||
CREATE DATABASE mysqltest1;
|
||||
USE mysqltest1;
|
||||
CREATE TABLE t1 (i INT);
|
||||
CREATE TABLE t2 (j INT);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (2);
|
||||
--echo #
|
||||
--echo # 1) DEFINER-security view uses INVOKER-security view (covers
|
||||
--echo # scenario originally described in the bug report).
|
||||
CREATE SQL SECURITY INVOKER VIEW v1_uses_t1 AS SELECT * FROM t1;
|
||||
CREATE SQL SECURITY INVOKER VIEW v1_uses_t2 AS SELECT * FROM t2;
|
||||
CREATE USER 'mysqluser1'@'%';
|
||||
GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser1'@'%';
|
||||
GRANT SELECT ON t1 TO 'mysqluser1'@'%';
|
||||
--echo # To be able create 'v2_uses_t2' we also need select on t2.
|
||||
GRANT SELECT ON t2 TO 'mysqluser1'@'%';
|
||||
GRANT SELECT ON v1_uses_t1 TO 'mysqluser1'@'%';
|
||||
GRANT SELECT ON v1_uses_t2 TO 'mysqluser1'@'%';
|
||||
--echo #
|
||||
--echo # Connection 'mysqluser1'.
|
||||
--connect (mysqluser1, localhost, mysqluser1,,mysqltest1)
|
||||
CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1;
|
||||
CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2;
|
||||
--echo #
|
||||
--echo # Connection 'default'.
|
||||
--connection default
|
||||
CREATE USER 'mysqluser2'@'%';
|
||||
GRANT SELECT ON v2_uses_t1 TO 'mysqluser2'@'%';
|
||||
GRANT SELECT ON v2_uses_t2 TO 'mysqluser2'@'%';
|
||||
GRANT SELECT ON t2 TO 'mysqluser2'@'%';
|
||||
GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser2'@'%';
|
||||
--echo # Make 'mysqluser1' unable to access t2.
|
||||
REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
|
||||
--echo #
|
||||
--echo # Connection 'mysqluser2'.
|
||||
--connect (mysqluser2, localhost, mysqluser2,,mysqltest1)
|
||||
--echo # The below statement should succeed thanks to suid nature of v2_uses_t1.
|
||||
SELECT * FROM v2_uses_t1;
|
||||
--echo # The below statement should fail due to suid nature of v2_uses_t2.
|
||||
--error ER_VIEW_INVALID
|
||||
SELECT * FROM v2_uses_t2;
|
||||
--echo #
|
||||
--echo # 2) INVOKER-security view uses INVOKER-security view.
|
||||
--echo #
|
||||
--echo # Connection 'default'.
|
||||
--connection default
|
||||
DROP VIEW v2_uses_t1, v2_uses_t2;
|
||||
CREATE SQL SECURITY INVOKER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1;
|
||||
CREATE SQL SECURITY INVOKER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2;
|
||||
GRANT SELECT ON v2_uses_t1 TO 'mysqluser1'@'%';
|
||||
GRANT SELECT ON v2_uses_t2 TO 'mysqluser1'@'%';
|
||||
GRANT SELECT ON v1_uses_t1 TO 'mysqluser2'@'%';
|
||||
GRANT SELECT ON v1_uses_t2 TO 'mysqluser2'@'%';
|
||||
--echo #
|
||||
--echo # Connection 'mysqluser1'.
|
||||
--connection mysqluser1
|
||||
--echo # For both versions of 'v2' 'mysqluser1' privileges should be used.
|
||||
SELECT * FROM v2_uses_t1;
|
||||
--error ER_VIEW_INVALID
|
||||
SELECT * FROM v2_uses_t2;
|
||||
--echo #
|
||||
--echo # Connection 'mysqluser2'.
|
||||
--connection mysqluser2
|
||||
--echo # And now for both versions of 'v2' 'mysqluser2' privileges should
|
||||
--echo # be used.
|
||||
--error ER_VIEW_INVALID
|
||||
SELECT * FROM v2_uses_t1;
|
||||
SELECT * FROM v2_uses_t2;
|
||||
--echo #
|
||||
--echo # 3) INVOKER-security view uses DEFINER-security view.
|
||||
--echo #
|
||||
--echo # Connection 'default'.
|
||||
--connection default
|
||||
DROP VIEW v1_uses_t1, v1_uses_t2;
|
||||
--echo # To be able create 'v1_uses_t2' we also need select on t2.
|
||||
GRANT SELECT ON t2 TO 'mysqluser1'@'%';
|
||||
--echo #
|
||||
--echo # Connection 'mysqluser1'.
|
||||
--connection mysqluser1
|
||||
CREATE SQL SECURITY DEFINER VIEW v1_uses_t1 AS SELECT * FROM t1;
|
||||
CREATE SQL SECURITY DEFINER VIEW v1_uses_t2 AS SELECT * FROM t2;
|
||||
--echo #
|
||||
--echo # Connection 'default'.
|
||||
--connection default
|
||||
--echo # Make 'mysqluser1' unable to access t2.
|
||||
REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
|
||||
--echo #
|
||||
--echo # Connection 'mysqluser2'.
|
||||
--connection mysqluser2
|
||||
--echo # Due to suid nature of v1_uses_t1 and v1_uses_t2 the first
|
||||
--echo # select should succeed and the second select should fail.
|
||||
SELECT * FROM v2_uses_t1;
|
||||
--error ER_VIEW_INVALID
|
||||
SELECT * FROM v2_uses_t2;
|
||||
--echo #
|
||||
--echo # 4) DEFINER-security view uses DEFINER-security view.
|
||||
--echo #
|
||||
--echo # Connection 'default'.
|
||||
--connection default
|
||||
DROP VIEW v2_uses_t1, v2_uses_t2;
|
||||
--echo # To be able create 'v2_uses_t2' we also need select on t2.
|
||||
GRANT SELECT ON t2 TO 'mysqluser1'@'%';
|
||||
--echo #
|
||||
--echo # Connection 'mysqluser2'.
|
||||
--connection mysqluser2
|
||||
CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1;
|
||||
CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2;
|
||||
--echo #
|
||||
--echo # Connection 'default'.
|
||||
--connection default
|
||||
--echo # Make 'mysqluser1' unable to access t2.
|
||||
REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
|
||||
--echo #
|
||||
--echo # Connection 'mysqluser2'.
|
||||
--connection mysqluser2
|
||||
--echo # Again privileges of creator of innermost views should apply.
|
||||
SELECT * FROM v2_uses_t1;
|
||||
--error ER_VIEW_INVALID
|
||||
SELECT * FROM v2_uses_t2;
|
||||
|
||||
--disconnect mysqluser1
|
||||
--disconnect mysqluser2
|
||||
--connection default
|
||||
USE test;
|
||||
DROP DATABASE mysqltest1;
|
||||
DROP USER 'mysqluser1'@'%';
|
||||
DROP USER 'mysqluser2'@'%';
|
||||
|
||||
|
||||
# Wait till we reached the initial number of concurrent sessions
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
/* Copyright (C) 2000 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program 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 */
|
||||
|
||||
/* Dont let the user break when you are doing something important */
|
||||
/* Remembers if it got 'SIGINT' and executes it on allow_break */
|
||||
/* A static buffer is used; don't call dont_break() twice in a row */
|
||||
|
||||
#include "mysys_priv.h"
|
||||
#include "my_static.h"
|
||||
|
||||
/* Set variable that we can't break */
|
||||
|
||||
#if !defined(THREAD)
|
||||
void dont_break(void)
|
||||
{
|
||||
my_dont_interrupt=1;
|
||||
return;
|
||||
} /* dont_break */
|
||||
|
||||
void allow_break(void)
|
||||
{
|
||||
{
|
||||
reg1 int index;
|
||||
|
||||
my_dont_interrupt=0;
|
||||
if (_my_signals)
|
||||
{
|
||||
if (_my_signals > MAX_SIGNALS)
|
||||
_my_signals=MAX_SIGNALS;
|
||||
for (index=0 ; index < _my_signals ; index++)
|
||||
{
|
||||
if (_my_sig_remember[index].func) /* Safequard */
|
||||
{
|
||||
(*_my_sig_remember[index].func)(_my_sig_remember[index].number);
|
||||
_my_sig_remember[index].func=0;
|
||||
}
|
||||
}
|
||||
_my_signals=0;
|
||||
}
|
||||
}
|
||||
} /* dont_break */
|
||||
#endif
|
||||
|
||||
/* Set old status */
|
||||
|
||||
#if !defined(THREAD)
|
||||
void my_remember_signal(int signal_number, sig_handler (*func) (int))
|
||||
{
|
||||
#ifndef __WIN__
|
||||
reg1 int index;
|
||||
|
||||
index=_my_signals++; /* Nobody can break a ++ ? */
|
||||
if (index < MAX_SIGNALS)
|
||||
{
|
||||
_my_sig_remember[index].number=signal_number;
|
||||
_my_sig_remember[index].func=func;
|
||||
}
|
||||
#endif /* __WIN__ */
|
||||
} /* my_remember_signal */
|
||||
#endif /* THREAD */
|
|
@ -55,15 +55,10 @@ static void my_aiowait(my_aio_result *result);
|
|||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef THREAD
|
||||
#define lock_append_buffer(info) \
|
||||
mysql_mutex_lock(&(info)->append_buffer_lock)
|
||||
#define unlock_append_buffer(info) \
|
||||
mysql_mutex_unlock(&(info)->append_buffer_lock)
|
||||
#else
|
||||
#define lock_append_buffer(info)
|
||||
#define unlock_append_buffer(info)
|
||||
#endif
|
||||
|
||||
#define IO_ROUND_UP(X) (((X)+IO_SIZE-1) & ~(IO_SIZE-1))
|
||||
#define IO_ROUND_DN(X) ( (X) & ~(IO_SIZE-1))
|
||||
|
@ -116,11 +111,7 @@ init_functions(IO_CACHE* info)
|
|||
info->write_function = 0; /* Force a core if used */
|
||||
break;
|
||||
default:
|
||||
info->read_function =
|
||||
#ifdef THREAD
|
||||
info->share ? _my_b_read_r :
|
||||
#endif
|
||||
_my_b_read;
|
||||
info->read_function = info->share ? _my_b_read_r : _my_b_read;
|
||||
info->write_function = _my_b_write;
|
||||
}
|
||||
|
||||
|
@ -193,9 +184,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
|
|||
}
|
||||
|
||||
info->disk_writes= 0;
|
||||
#ifdef THREAD
|
||||
info->share=0;
|
||||
#endif
|
||||
|
||||
if (!cachesize && !(cachesize= my_default_record_cache_size))
|
||||
DBUG_RETURN(1); /* No cache requested */
|
||||
|
@ -263,12 +252,10 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
|
|||
{
|
||||
info->append_read_pos = info->write_pos = info->write_buffer;
|
||||
info->write_end = info->write_buffer + info->buffer_length;
|
||||
#ifdef THREAD
|
||||
mysql_mutex_init(key_IO_CACHE_append_buffer_lock,
|
||||
&info->append_buffer_lock, MY_MUTEX_INIT_FAST);
|
||||
#endif
|
||||
}
|
||||
#if defined(SAFE_MUTEX) && defined(THREAD)
|
||||
#if defined(SAFE_MUTEX)
|
||||
else
|
||||
{
|
||||
/* Clear mutex so that safe_mutex will notice that it's not initialized */
|
||||
|
@ -601,7 +588,6 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
|
|||
}
|
||||
|
||||
|
||||
#ifdef THREAD
|
||||
/*
|
||||
Prepare IO_CACHE for shared use.
|
||||
|
||||
|
@ -1162,7 +1148,6 @@ static void copy_to_read_buffer(IO_CACHE *write_cache,
|
|||
write_length-= copy_length;
|
||||
}
|
||||
}
|
||||
#endif /*THREAD*/
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1579,7 +1564,6 @@ int _my_b_write(register IO_CACHE *info, const uchar *Buffer, size_t Count)
|
|||
if (mysql_file_write(info->file, Buffer, length, info->myflags | MY_NABP))
|
||||
return info->error= -1;
|
||||
|
||||
#ifdef THREAD
|
||||
/*
|
||||
In case of a shared I/O cache with a writer we normally do direct
|
||||
write cache to read cache copy. Simulate this here by direct
|
||||
|
@ -1593,7 +1577,6 @@ int _my_b_write(register IO_CACHE *info, const uchar *Buffer, size_t Count)
|
|||
*/
|
||||
if (info->share)
|
||||
copy_to_read_buffer(info, Buffer, length);
|
||||
#endif
|
||||
|
||||
Count-=length;
|
||||
Buffer+=length;
|
||||
|
@ -1615,13 +1598,11 @@ int my_b_append(register IO_CACHE *info, const uchar *Buffer, size_t Count)
|
|||
{
|
||||
size_t rest_length,length;
|
||||
|
||||
#ifdef THREAD
|
||||
/*
|
||||
Assert that we cannot come here with a shared cache. If we do one
|
||||
day, we might need to add a call to copy_to_read_buffer().
|
||||
*/
|
||||
DBUG_ASSERT(!info->share);
|
||||
#endif
|
||||
|
||||
lock_append_buffer(info);
|
||||
rest_length= (size_t) (info->write_end - info->write_pos);
|
||||
|
@ -1683,13 +1664,11 @@ int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count,
|
|||
size_t length;
|
||||
int error=0;
|
||||
|
||||
#ifdef THREAD
|
||||
/*
|
||||
Assert that we cannot come here with a shared cache. If we do one
|
||||
day, we might need to add a call to copy_to_read_buffer().
|
||||
*/
|
||||
DBUG_ASSERT(!info->share);
|
||||
#endif
|
||||
|
||||
if (pos < info->pos_in_file)
|
||||
{
|
||||
|
@ -1735,16 +1714,10 @@ int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count,
|
|||
|
||||
/* Flush write cache */
|
||||
|
||||
#ifdef THREAD
|
||||
#define LOCK_APPEND_BUFFER if (need_append_buffer_lock) \
|
||||
lock_append_buffer(info);
|
||||
#define UNLOCK_APPEND_BUFFER if (need_append_buffer_lock) \
|
||||
unlock_append_buffer(info);
|
||||
#else
|
||||
#define LOCK_APPEND_BUFFER
|
||||
#define UNLOCK_APPEND_BUFFER
|
||||
#endif
|
||||
|
||||
|
||||
int my_b_flush_io_cache(IO_CACHE *info,
|
||||
int need_append_buffer_lock __attribute__((unused)))
|
||||
|
@ -1755,10 +1728,8 @@ int my_b_flush_io_cache(IO_CACHE *info,
|
|||
DBUG_ENTER("my_b_flush_io_cache");
|
||||
DBUG_PRINT("enter", ("cache: 0x%lx", (long) info));
|
||||
|
||||
#ifdef THREAD
|
||||
if (!append_cache)
|
||||
need_append_buffer_lock= 0;
|
||||
#endif
|
||||
|
||||
if (info->type == WRITE_CACHE || append_cache)
|
||||
{
|
||||
|
@ -1771,7 +1742,6 @@ int my_b_flush_io_cache(IO_CACHE *info,
|
|||
|
||||
if ((length=(size_t) (info->write_pos - info->write_buffer)))
|
||||
{
|
||||
#ifdef THREAD
|
||||
/*
|
||||
In case of a shared I/O cache with a writer we do direct write
|
||||
cache to read cache copy. Do it before the write here so that
|
||||
|
@ -1780,7 +1750,6 @@ int my_b_flush_io_cache(IO_CACHE *info,
|
|||
*/
|
||||
if (info->share)
|
||||
copy_to_read_buffer(info, info->write_buffer, length);
|
||||
#endif
|
||||
|
||||
pos_in_file=info->pos_in_file;
|
||||
/*
|
||||
|
@ -1859,13 +1828,11 @@ int end_io_cache(IO_CACHE *info)
|
|||
DBUG_ENTER("end_io_cache");
|
||||
DBUG_PRINT("enter",("cache: 0x%lx", (ulong) info));
|
||||
|
||||
#ifdef THREAD
|
||||
/*
|
||||
Every thread must call remove_io_thread(). The last one destroys
|
||||
the share elements.
|
||||
*/
|
||||
DBUG_ASSERT(!info->share || !info->share->total_threads);
|
||||
#endif
|
||||
|
||||
if ((pre_close=info->pre_close))
|
||||
{
|
||||
|
@ -1884,9 +1851,7 @@ int end_io_cache(IO_CACHE *info)
|
|||
{
|
||||
/* Destroy allocated mutex */
|
||||
info->type= TYPE_NOT_SET;
|
||||
#ifdef THREAD
|
||||
mysql_mutex_destroy(&info->append_buffer_lock);
|
||||
#endif
|
||||
}
|
||||
DBUG_RETURN(error);
|
||||
} /* end_io_cache */
|
||||
|
|
|
@ -90,9 +90,8 @@ my_off_t my_b_append_tell(IO_CACHE* info)
|
|||
from messing with the variables that we need in order to provide the
|
||||
answer to the question.
|
||||
*/
|
||||
#ifdef THREAD
|
||||
mysql_mutex_lock(&info->append_buffer_lock);
|
||||
#endif
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
/*
|
||||
Make sure EOF is where we think it is. Note that we cannot just use
|
||||
|
@ -112,9 +111,7 @@ my_off_t my_b_append_tell(IO_CACHE* info)
|
|||
}
|
||||
#endif
|
||||
res = info->end_of_file + (info->write_pos-info->append_read_pos);
|
||||
#ifdef THREAD
|
||||
mysql_mutex_unlock(&info->append_buffer_lock);
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -225,14 +225,11 @@ KEY_CACHE *dflt_key_cache= &dflt_key_cache_var;
|
|||
#define FLUSH_CACHE 2000 /* sort this many blocks at once */
|
||||
|
||||
static int flush_all_key_blocks(KEY_CACHE *keycache);
|
||||
#ifdef THREAD
|
||||
|
||||
static void wait_on_queue(KEYCACHE_WQUEUE *wqueue,
|
||||
mysql_mutex_t *mutex);
|
||||
static void release_whole_queue(KEYCACHE_WQUEUE *wqueue);
|
||||
#else
|
||||
#define wait_on_queue(wqueue, mutex) do {} while (0)
|
||||
#define release_whole_queue(wqueue) do {} while (0)
|
||||
#endif
|
||||
|
||||
static void free_block(KEY_CACHE *keycache, BLOCK_LINK *block);
|
||||
#if !defined(DBUG_OFF)
|
||||
static void test_key_cache(KEY_CACHE *keycache,
|
||||
|
@ -285,7 +282,7 @@ static void keycache_debug_print(const char *fmt,...);
|
|||
#endif /* defined(KEYCACHE_DEBUG_LOG) && defined(KEYCACHE_DEBUG) */
|
||||
|
||||
#if defined(KEYCACHE_DEBUG) || !defined(DBUG_OFF)
|
||||
#ifdef THREAD
|
||||
|
||||
static long keycache_thread_id;
|
||||
#define KEYCACHE_THREAD_TRACE(l) \
|
||||
KEYCACHE_DBUG_PRINT(l,("|thread %ld",keycache_thread_id))
|
||||
|
@ -297,11 +294,6 @@ static long keycache_thread_id;
|
|||
|
||||
#define KEYCACHE_THREAD_TRACE_END(l) \
|
||||
KEYCACHE_DBUG_PRINT(l,("]thread %ld",keycache_thread_id))
|
||||
#else /* THREAD */
|
||||
#define KEYCACHE_THREAD_TRACE(l) KEYCACHE_DBUG_PRINT(l,(""))
|
||||
#define KEYCACHE_THREAD_TRACE_BEGIN(l) KEYCACHE_DBUG_PRINT(l,(""))
|
||||
#define KEYCACHE_THREAD_TRACE_END(l) KEYCACHE_DBUG_PRINT(l,(""))
|
||||
#endif /* THREAD */
|
||||
#else
|
||||
#define KEYCACHE_THREAD_TRACE_BEGIN(l)
|
||||
#define KEYCACHE_THREAD_TRACE_END(l)
|
||||
|
@ -583,7 +575,6 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
|
|||
|
||||
keycache_pthread_mutex_lock(&keycache->cache_lock);
|
||||
|
||||
#ifdef THREAD
|
||||
/*
|
||||
We may need to wait for another thread which is doing a resize
|
||||
already. This cannot happen in the MySQL server though. It allows
|
||||
|
@ -596,7 +587,6 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
|
|||
wait_on_queue(&keycache->resize_queue, &keycache->cache_lock);
|
||||
/* purecov: end */
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Mark the operation in progress. This blocks other threads from doing
|
||||
|
@ -625,7 +615,6 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
|
|||
keycache->resize_in_flush= 0;
|
||||
}
|
||||
|
||||
#ifdef THREAD
|
||||
/*
|
||||
Some direct read/write operations (bypassing the cache) may still be
|
||||
unfinished. Wait until they are done. If the key cache can be used,
|
||||
|
@ -639,9 +628,6 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
|
|||
*/
|
||||
while (keycache->cnt_for_resize_op)
|
||||
wait_on_queue(&keycache->waiting_for_resize_cnt, &keycache->cache_lock);
|
||||
#else
|
||||
KEYCACHE_DBUG_ASSERT(keycache->cnt_for_resize_op == 0);
|
||||
#endif
|
||||
|
||||
/*
|
||||
Free old cache structures, allocate new structures, and initialize
|
||||
|
@ -782,8 +768,6 @@ void end_key_cache(KEY_CACHE *keycache, my_bool cleanup)
|
|||
} /* end_key_cache */
|
||||
|
||||
|
||||
#ifdef THREAD
|
||||
|
||||
/*
|
||||
Link a thread into double-linked queue of waiting threads.
|
||||
|
||||
|
@ -963,8 +947,6 @@ static void release_whole_queue(KEYCACHE_WQUEUE *wqueue)
|
|||
wqueue->last_thread= NULL;
|
||||
}
|
||||
|
||||
#endif /* THREAD */
|
||||
|
||||
|
||||
/*
|
||||
Unlink a block from the chain of dirty/clean blocks
|
||||
|
@ -1136,7 +1118,7 @@ static void link_block(KEY_CACHE *keycache, BLOCK_LINK *block, my_bool hot,
|
|||
DBUG_ASSERT(block->prev_changed && *block->prev_changed == block);
|
||||
DBUG_ASSERT(!block->next_used);
|
||||
DBUG_ASSERT(!block->prev_used);
|
||||
#ifdef THREAD
|
||||
|
||||
if (!hot && keycache->waiting_for_block.last_thread)
|
||||
{
|
||||
/* Signal that in the LRU warm sub-chain an available block has appeared */
|
||||
|
@ -1196,10 +1178,7 @@ static void link_block(KEY_CACHE *keycache, BLOCK_LINK *block, my_bool hot,
|
|||
#endif
|
||||
return;
|
||||
}
|
||||
#else /* THREAD */
|
||||
KEYCACHE_DBUG_ASSERT(! (!hot && keycache->waiting_for_block.last_thread));
|
||||
/* Condition not transformed using DeMorgan, to keep the text identical */
|
||||
#endif /* THREAD */
|
||||
|
||||
pins= hot ? &keycache->used_ins : &keycache->used_last;
|
||||
ins= *pins;
|
||||
if (ins)
|
||||
|
@ -1421,12 +1400,9 @@ static void remove_reader(BLOCK_LINK *block)
|
|||
DBUG_ASSERT(!block->next_used);
|
||||
DBUG_ASSERT(!block->prev_used);
|
||||
DBUG_ASSERT(block->hash_link->requests);
|
||||
#ifdef THREAD
|
||||
|
||||
if (! --block->hash_link->requests && block->condvar)
|
||||
keycache_pthread_cond_signal(block->condvar);
|
||||
#else
|
||||
--block->hash_link->requests;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1438,7 +1414,6 @@ static void remove_reader(BLOCK_LINK *block)
|
|||
static void wait_for_readers(KEY_CACHE *keycache,
|
||||
BLOCK_LINK *block)
|
||||
{
|
||||
#ifdef THREAD
|
||||
struct st_my_thread_var *thread= my_thread_var;
|
||||
DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE));
|
||||
DBUG_ASSERT(!(block->status & (BLOCK_IN_FLUSH | BLOCK_CHANGED)));
|
||||
|
@ -1460,9 +1435,6 @@ static void wait_for_readers(KEY_CACHE *keycache,
|
|||
keycache_pthread_cond_wait(&thread->suspend, &keycache->cache_lock);
|
||||
block->condvar= NULL;
|
||||
}
|
||||
#else
|
||||
KEYCACHE_DBUG_ASSERT(block->hash_link->requests == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1492,7 +1464,7 @@ static void unlink_hash(KEY_CACHE *keycache, HASH_LINK *hash_link)
|
|||
if ((*hash_link->prev= hash_link->next))
|
||||
hash_link->next->prev= hash_link->prev;
|
||||
hash_link->block= NULL;
|
||||
#ifdef THREAD
|
||||
|
||||
if (keycache->waiting_for_hash_link.last_thread)
|
||||
{
|
||||
/* Signal that a free hash link has appeared */
|
||||
|
@ -1528,9 +1500,6 @@ static void unlink_hash(KEY_CACHE *keycache, HASH_LINK *hash_link)
|
|||
hash_link);
|
||||
return;
|
||||
}
|
||||
#else /* THREAD */
|
||||
KEYCACHE_DBUG_ASSERT(! (keycache->waiting_for_hash_link.last_thread));
|
||||
#endif /* THREAD */
|
||||
hash_link->next= keycache->free_hash_list;
|
||||
keycache->free_hash_list= hash_link;
|
||||
}
|
||||
|
@ -1595,7 +1564,6 @@ restart:
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef THREAD
|
||||
/* Wait for a free hash link */
|
||||
struct st_my_thread_var *thread= my_thread_var;
|
||||
KEYCACHE_PAGE page;
|
||||
|
@ -1609,9 +1577,6 @@ restart:
|
|||
keycache_pthread_cond_wait(&thread->suspend,
|
||||
&keycache->cache_lock);
|
||||
thread->opt_info= NULL;
|
||||
#else
|
||||
KEYCACHE_DBUG_ASSERT(0);
|
||||
#endif
|
||||
goto restart;
|
||||
}
|
||||
hash_link->file= file;
|
||||
|
@ -1731,7 +1696,6 @@ restart:
|
|||
- block assigned but not yet read from file (invalid data).
|
||||
*/
|
||||
|
||||
#ifdef THREAD
|
||||
if (keycache->in_resize)
|
||||
{
|
||||
/* This is a request during a resize operation */
|
||||
|
@ -1973,9 +1937,6 @@ restart:
|
|||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#else /* THREAD */
|
||||
DBUG_ASSERT(!keycache->in_resize);
|
||||
#endif
|
||||
|
||||
if (page_status == PAGE_READ &&
|
||||
(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH |
|
||||
|
@ -2105,7 +2066,6 @@ restart:
|
|||
from the LRU ring.
|
||||
*/
|
||||
|
||||
#ifdef THREAD
|
||||
if (! keycache->used_last)
|
||||
{
|
||||
/*
|
||||
|
@ -2138,9 +2098,7 @@ restart:
|
|||
DBUG_ASSERT(!hash_link->block->next_used);
|
||||
DBUG_ASSERT(!hash_link->block->prev_used);
|
||||
}
|
||||
#else
|
||||
KEYCACHE_DBUG_ASSERT(keycache->used_last);
|
||||
#endif
|
||||
|
||||
/*
|
||||
If we waited above, hash_link->block has been assigned by
|
||||
link_block(). Otherwise it is still NULL. In the latter case
|
||||
|
@ -2610,10 +2568,8 @@ uchar *key_cache_read(KEY_CACHE *keycache,
|
|||
set_if_smaller(read_length, keycache->key_cache_block_size-offset);
|
||||
KEYCACHE_DBUG_ASSERT(read_length > 0);
|
||||
|
||||
#ifndef THREAD
|
||||
if (block_length > keycache->key_cache_block_size || offset)
|
||||
return_buffer=0;
|
||||
#endif
|
||||
|
||||
/* Request the cache block that matches file/pos. */
|
||||
keycache->global_cache_r_requests++;
|
||||
|
@ -2673,9 +2629,6 @@ uchar *key_cache_read(KEY_CACHE *keycache,
|
|||
/* block status may have added BLOCK_ERROR in the above 'if'. */
|
||||
if (!(block->status & BLOCK_ERROR))
|
||||
{
|
||||
#ifndef THREAD
|
||||
if (! return_buffer)
|
||||
#endif
|
||||
{
|
||||
DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE));
|
||||
#if !defined(SERIALIZED_READ_FROM_CACHE)
|
||||
|
@ -2714,20 +2667,6 @@ uchar *key_cache_read(KEY_CACHE *keycache,
|
|||
break;
|
||||
}
|
||||
|
||||
#ifndef THREAD
|
||||
/* This is only true if we where able to read everything in one block */
|
||||
if (return_buffer)
|
||||
{
|
||||
if (MYSQL_KEYCACHE_READ_DONE_ENABLED())
|
||||
{
|
||||
MYSQL_KEYCACHE_READ_DONE((ulong) (keycache->blocks_used *
|
||||
keycache->key_cache_block_size),
|
||||
(ulong) (keycache->blocks_unused *
|
||||
keycache->key_cache_block_size));
|
||||
}
|
||||
DBUG_RETURN(block->buffer);
|
||||
}
|
||||
#endif
|
||||
next_block:
|
||||
buff+= read_length;
|
||||
filepos+= read_length+offset;
|
||||
|
|
|
@ -53,9 +53,7 @@ typedef struct st_safe_hash_entry
|
|||
|
||||
typedef struct st_safe_hash_with_default
|
||||
{
|
||||
#ifdef THREAD
|
||||
rw_lock_t mutex;
|
||||
#endif
|
||||
HASH hash;
|
||||
uchar *default_value;
|
||||
SAFE_HASH_ENTRY *root;
|
||||
|
|
|
@ -22,9 +22,6 @@
|
|||
* the internal size is a set of 32 bit words
|
||||
* the number of bits specified in creation can be any number > 0
|
||||
* there are THREAD safe versions of most calls called bitmap_lock_*
|
||||
many of those are not used and not compiled normally but the code
|
||||
already exist for them in an #ifdef:ed part. These can only be used
|
||||
if THREAD was specified in bitmap_init
|
||||
|
||||
TODO:
|
||||
Make assembler THREAD safe versions of these using test-and-set instructions
|
||||
|
@ -85,18 +82,14 @@ void create_last_word_mask(MY_BITMAP *map)
|
|||
|
||||
static inline void bitmap_lock(MY_BITMAP *map __attribute__((unused)))
|
||||
{
|
||||
#ifdef THREAD
|
||||
if (map->mutex)
|
||||
mysql_mutex_lock(map->mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void bitmap_unlock(MY_BITMAP *map __attribute__((unused)))
|
||||
{
|
||||
#ifdef THREAD
|
||||
if (map->mutex)
|
||||
mysql_mutex_unlock(map->mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,30 +101,30 @@ my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
|
|||
{
|
||||
uint size_in_bytes= bitmap_buffer_size(n_bits);
|
||||
uint extra= 0;
|
||||
#ifdef THREAD
|
||||
|
||||
if (thread_safe)
|
||||
{
|
||||
size_in_bytes= ALIGN_SIZE(size_in_bytes);
|
||||
extra= sizeof(mysql_mutex_t);
|
||||
}
|
||||
map->mutex= 0;
|
||||
#endif
|
||||
|
||||
if (!(buf= (my_bitmap_map*) my_malloc(size_in_bytes+extra, MYF(MY_WME))))
|
||||
DBUG_RETURN(1);
|
||||
#ifdef THREAD
|
||||
|
||||
if (thread_safe)
|
||||
{
|
||||
map->mutex= (mysql_mutex_t *) ((char*) buf + size_in_bytes);
|
||||
mysql_mutex_init(key_BITMAP_mutex, map->mutex, MY_MUTEX_INIT_FAST);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
#ifdef THREAD
|
||||
|
||||
else
|
||||
{
|
||||
DBUG_ASSERT(thread_safe == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
map->bitmap= buf;
|
||||
map->n_bits= n_bits;
|
||||
|
@ -146,10 +139,9 @@ void bitmap_free(MY_BITMAP *map)
|
|||
DBUG_ENTER("bitmap_free");
|
||||
if (map->bitmap)
|
||||
{
|
||||
#ifdef THREAD
|
||||
if (map->mutex)
|
||||
mysql_mutex_destroy(map->mutex);
|
||||
#endif
|
||||
|
||||
my_free(map->bitmap);
|
||||
map->bitmap=0;
|
||||
}
|
||||
|
|
|
@ -124,10 +124,9 @@ size_t my_fwrite(FILE *stream, const uchar *Buffer, size_t Count, myf MyFlags)
|
|||
}
|
||||
#endif
|
||||
#if !defined(NO_BACKGROUND) && defined(USE_MY_STREAM)
|
||||
#ifdef THREAD
|
||||
if (my_thread_var->abort)
|
||||
MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */
|
||||
#endif
|
||||
|
||||
if ((errno == ENOSPC || errno == EDQUOT) &&
|
||||
(MyFlags & MY_WAIT_IF_FULL))
|
||||
{
|
||||
|
|
|
@ -78,9 +78,7 @@ struct hostent *my_gethostbyname_r(const char *name,
|
|||
|
||||
#else /* !HAVE_GETHOSTBYNAME_R */
|
||||
|
||||
#ifdef THREAD
|
||||
extern mysql_mutex_t LOCK_gethostbyname_r;
|
||||
#endif
|
||||
|
||||
/*
|
||||
No gethostbyname_r() function exists.
|
||||
|
|
|
@ -602,6 +602,24 @@ static char *check_struct_option(char *cur_arg, char *key_name)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Parse a boolean command line argument
|
||||
|
||||
"ON", "TRUE" and "1" will return true,
|
||||
other values will return false.
|
||||
|
||||
@param[in] argument The value argument
|
||||
@return boolean value
|
||||
*/
|
||||
static my_bool get_bool_argument(const char *argument)
|
||||
{
|
||||
if (!my_strcasecmp(&my_charset_latin1, argument, "true") ||
|
||||
!my_strcasecmp(&my_charset_latin1, argument, "on"))
|
||||
return 1;
|
||||
else
|
||||
return (my_bool) atoi(argument);
|
||||
}
|
||||
|
||||
/*
|
||||
function: setval
|
||||
|
||||
|
@ -629,7 +647,7 @@ static int setval(const struct my_option *opts, void *value, char *argument,
|
|||
|
||||
switch ((opts->var_type & GET_TYPE_MASK)) {
|
||||
case GET_BOOL: /* If argument differs from 0, enable option, else disable */
|
||||
*((my_bool*) value)= (my_bool) atoi(argument) != 0;
|
||||
*((my_bool*) value)= get_bool_argument(argument);
|
||||
break;
|
||||
case GET_INT:
|
||||
*((int*) value)= (int) getopt_ll(argument, opts, &err);
|
||||
|
|
|
@ -165,7 +165,13 @@ ulonglong my_micro_time_and_time(time_t *time_arg)
|
|||
|
||||
mysql_mutex_lock(&THR_LOCK_time);
|
||||
cur_gethrtime= gethrtime();
|
||||
if ((cur_gethrtime - prev_gethrtime) > DELTA_FOR_SECONDS)
|
||||
/*
|
||||
Due to bugs in the Solaris (x86) implementation of gethrtime(),
|
||||
the time returned by it might not be monotonic. Don't use the
|
||||
cached time(2) value if this is a case.
|
||||
*/
|
||||
if ((prev_gethrtime > cur_gethrtime) ||
|
||||
((cur_gethrtime - prev_gethrtime) > DELTA_FOR_SECONDS))
|
||||
{
|
||||
cur_time= time(0);
|
||||
prev_gethrtime= cur_gethrtime;
|
||||
|
|
|
@ -91,23 +91,22 @@ my_bool my_basic_init(void)
|
|||
instrumented_stdin.m_psi= NULL; /* not yet instrumented */
|
||||
mysql_stdin= & instrumented_stdin;
|
||||
|
||||
#if defined(THREAD)
|
||||
if (my_thread_global_init())
|
||||
return 1;
|
||||
# if defined(SAFE_MUTEX)
|
||||
|
||||
#if defined(SAFE_MUTEX)
|
||||
safe_mutex_global_init(); /* Must be called early */
|
||||
# endif
|
||||
#endif
|
||||
#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
|
||||
|
||||
#if defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
|
||||
fastmutex_global_init(); /* Must be called early */
|
||||
#endif
|
||||
#ifdef THREAD
|
||||
|
||||
#if defined(HAVE_PTHREAD_INIT)
|
||||
pthread_init(); /* Must be called before DBUG_ENTER */
|
||||
#endif
|
||||
if (my_thread_basic_global_init())
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
/* $HOME is needed early to parse configuration files located in ~/ */
|
||||
if ((home_dir= getenv("HOME")) != 0)
|
||||
|
@ -138,10 +137,9 @@ my_bool my_init(void)
|
|||
if (my_basic_init())
|
||||
return 1;
|
||||
|
||||
#ifdef THREAD
|
||||
if (my_thread_global_init())
|
||||
return 1;
|
||||
#endif /* THREAD */
|
||||
|
||||
{
|
||||
DBUG_ENTER("my_init");
|
||||
DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown"));
|
||||
|
@ -240,7 +238,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
|
|||
{
|
||||
DBUG_END(); /* Must be done before my_thread_end */
|
||||
}
|
||||
#ifdef THREAD
|
||||
|
||||
my_thread_end();
|
||||
my_thread_global_end();
|
||||
#if defined(SAFE_MUTEX)
|
||||
|
@ -251,7 +249,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
|
|||
safe_mutex_end((infoflag & (MY_GIVE_INFO | MY_CHECK_ERROR)) ? stderr :
|
||||
(FILE *) 0);
|
||||
#endif /* defined(SAFE_MUTEX) */
|
||||
#endif /* THREAD */
|
||||
|
||||
#ifdef __WIN__
|
||||
if (have_tcpip)
|
||||
|
@ -518,7 +515,7 @@ PSI_mutex_key key_BITMAP_mutex, key_IO_CACHE_append_buffer_lock,
|
|||
|
||||
static PSI_mutex_info all_mysys_mutexes[]=
|
||||
{
|
||||
#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32)
|
||||
#if !defined(HAVE_PREAD) && !defined(_WIN32)
|
||||
{ &key_my_file_info_mutex, "st_my_file_info:mutex", 0},
|
||||
#endif /* !defined(HAVE_PREAD) && !defined(_WIN32) */
|
||||
#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(THREAD) && defined(HAVE_READDIR_R)
|
||||
#if defined(HAVE_READDIR_R)
|
||||
#define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C)
|
||||
#else
|
||||
#define READDIR(A,B,C) (!(C=readdir(A)))
|
||||
|
@ -97,13 +97,12 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
|
|||
DIR *dirp;
|
||||
struct dirent *dp;
|
||||
char tmp_path[FN_REFLEN+1],*tmp_file;
|
||||
#ifdef THREAD
|
||||
char dirent_tmp[sizeof(struct dirent)+_POSIX_PATH_MAX+1];
|
||||
#endif
|
||||
|
||||
DBUG_ENTER("my_dir");
|
||||
DBUG_PRINT("my",("path: '%s' MyFlags: %d",path,MyFlags));
|
||||
|
||||
#if defined(THREAD) && !defined(HAVE_READDIR_R)
|
||||
#if !defined(HAVE_READDIR_R)
|
||||
mysql_mutex_lock(&THR_LOCK_open);
|
||||
#endif
|
||||
|
||||
|
@ -135,11 +134,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
|
|||
|
||||
tmp_file=strend(tmp_path);
|
||||
|
||||
#ifdef THREAD
|
||||
dp= (struct dirent*) dirent_tmp;
|
||||
#else
|
||||
dp=0;
|
||||
#endif
|
||||
|
||||
while (!(READDIR(dirp,(struct dirent*) dirent_tmp,dp)))
|
||||
{
|
||||
|
@ -166,7 +161,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
|
|||
}
|
||||
|
||||
(void) closedir(dirp);
|
||||
#if defined(THREAD) && !defined(HAVE_READDIR_R)
|
||||
#if !defined(HAVE_READDIR_R)
|
||||
mysql_mutex_unlock(&THR_LOCK_open);
|
||||
#endif
|
||||
result->dir_entry= (FILEINFO *)dir_entries_storage->buffer;
|
||||
|
@ -178,7 +173,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
|
|||
DBUG_RETURN(result);
|
||||
|
||||
error:
|
||||
#if defined(THREAD) && !defined(HAVE_READDIR_R)
|
||||
#if !defined(HAVE_READDIR_R)
|
||||
mysql_mutex_unlock(&THR_LOCK_open);
|
||||
#endif
|
||||
my_errno=errno;
|
||||
|
|
|
@ -89,7 +89,7 @@ int my_close(File fd, myf MyFlags)
|
|||
if ((uint) fd < my_file_limit && my_file_info[fd].type != UNOPEN)
|
||||
{
|
||||
my_free(my_file_info[fd].name);
|
||||
#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32)
|
||||
#if !defined(HAVE_PREAD) && !defined(_WIN32)
|
||||
mysql_mutex_destroy(&my_file_info[fd].mutex);
|
||||
#endif
|
||||
my_file_info[fd].type = UNOPEN;
|
||||
|
@ -125,7 +125,7 @@ File my_register_filename(File fd, const char *FileName, enum file_type
|
|||
{
|
||||
if ((uint) fd >= my_file_limit)
|
||||
{
|
||||
#if defined(THREAD) && !defined(HAVE_PREAD)
|
||||
#if !defined(HAVE_PREAD)
|
||||
my_errno= EMFILE;
|
||||
#else
|
||||
thread_safe_increment(my_file_opened,&THR_LOCK_open);
|
||||
|
@ -140,7 +140,7 @@ File my_register_filename(File fd, const char *FileName, enum file_type
|
|||
my_file_opened++;
|
||||
my_file_total_opened++;
|
||||
my_file_info[fd].type = type_of_file;
|
||||
#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32)
|
||||
#if !defined(HAVE_PREAD) && !defined(_WIN32)
|
||||
mysql_mutex_init(key_my_file_info_mutex, &my_file_info[fd].mutex,
|
||||
MY_MUTEX_INIT_FAST);
|
||||
#endif
|
||||
|
|
|
@ -85,14 +85,14 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
|
|||
|
||||
DBUG_PRINT("warning",("Read only %d bytes off %u from %d, errno: %d",
|
||||
(int) readbytes, (uint) Count,Filedes,my_errno));
|
||||
#ifdef THREAD
|
||||
|
||||
if ((readbytes == 0 || readbytes == (size_t) -1) && errno == EINTR)
|
||||
{
|
||||
DBUG_PRINT("debug", ("my_pread() was interrupted and returned %d",
|
||||
(int) readbytes));
|
||||
continue; /* Interrupted */
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
|
||||
{
|
||||
if (readbytes == (size_t) -1)
|
||||
|
@ -173,10 +173,10 @@ size_t my_pwrite(File Filedes, const uchar *Buffer, size_t Count,
|
|||
}
|
||||
DBUG_PRINT("error",("Write only %u bytes", (uint) writtenbytes));
|
||||
#ifndef NO_BACKGROUND
|
||||
#ifdef THREAD
|
||||
|
||||
if (my_thread_var->abort)
|
||||
MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */
|
||||
#endif
|
||||
|
||||
if ((my_errno == ENOSPC || my_errno == EDQUOT) &&
|
||||
(MyFlags & MY_WAIT_IF_FULL))
|
||||
{
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#define DONT_REMAP_PTHREAD_FUNCTIONS
|
||||
|
||||
#include "mysys_priv.h"
|
||||
#ifdef THREAD
|
||||
#include <signal.h>
|
||||
#include <m_string.h>
|
||||
#include <thr_alarm.h>
|
||||
|
@ -468,4 +467,3 @@ int pthread_dummy(int ret)
|
|||
{
|
||||
return ret;
|
||||
}
|
||||
#endif /* THREAD */
|
||||
|
|
|
@ -59,14 +59,14 @@ size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags)
|
|||
DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d",
|
||||
(int) readbytes, (ulong) Count, Filedes,
|
||||
my_errno));
|
||||
#ifdef THREAD
|
||||
|
||||
if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
|
||||
{
|
||||
DBUG_PRINT("debug", ("my_read() was interrupted and returned %ld",
|
||||
(long) readbytes));
|
||||
continue; /* Interrupted */
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
|
||||
{
|
||||
if (readbytes == (size_t) -1)
|
||||
|
|
|
@ -32,9 +32,7 @@ char curr_dir[FN_REFLEN]= {0},
|
|||
ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0;
|
||||
ulong my_file_total_opened= 0;
|
||||
int my_umask=0664, my_umask_dir=0777;
|
||||
#ifndef THREAD
|
||||
int my_errno=0;
|
||||
#endif
|
||||
|
||||
struct st_my_file_info my_file_info_default[MY_NFILE];
|
||||
uint my_file_limit= MY_NFILE;
|
||||
struct st_my_file_info *my_file_info= my_file_info_default;
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <m_string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef THREAD
|
||||
pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
|
||||
mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open,
|
||||
THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_myisam, THR_LOCK_heap,
|
||||
|
@ -532,4 +531,3 @@ static void install_sigabrt_handler(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* THREAD */
|
||||
|
|
|
@ -52,10 +52,9 @@ size_t my_write(File Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
|
|||
DBUG_PRINT("error",("Write only %ld bytes, error: %d",
|
||||
(long) writtenbytes, my_errno));
|
||||
#ifndef NO_BACKGROUND
|
||||
#ifdef THREAD
|
||||
if (my_thread_var->abort)
|
||||
MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */
|
||||
#endif
|
||||
|
||||
if ((my_errno == ENOSPC || my_errno == EDQUOT) &&
|
||||
(MyFlags & MY_WAIT_IF_FULL))
|
||||
{
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#ifdef THREAD
|
||||
#include <my_pthread.h>
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
|
@ -62,9 +61,6 @@ extern PSI_thread_key key_thread_alarm;
|
|||
extern mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_keycache;
|
||||
extern mysql_mutex_t THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_net;
|
||||
extern mysql_mutex_t THR_LOCK_charset, THR_LOCK_time;
|
||||
#else /* THREAD */
|
||||
#include <my_no_pthread.h>
|
||||
#endif /* THREAD */
|
||||
|
||||
#include <mysql/psi/mysql_file.h>
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "mysys_priv.h"
|
||||
#include <my_global.h>
|
||||
|
||||
#if defined(THREAD) && !defined(DONT_USE_THR_ALARM)
|
||||
#if !defined(DONT_USE_THR_ALARM)
|
||||
#include <errno.h>
|
||||
#include <my_pthread.h>
|
||||
#include <signal.h>
|
||||
|
@ -686,15 +686,14 @@ void resize_thr_alarm(uint max_alarms)
|
|||
|
||||
#endif /* __WIN__ */
|
||||
|
||||
#endif /* THREAD */
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
Handling of test case (when compiled with -DMAIN)
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef MAIN
|
||||
#if defined(THREAD) && !defined(DONT_USE_THR_ALARM)
|
||||
#if !defined(DONT_USE_THR_ALARM)
|
||||
|
||||
static mysql_cond_t COND_thread_count;
|
||||
static mysql_mutex_t LOCK_thread_count;
|
||||
|
@ -961,17 +960,13 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
|
|||
return 0;
|
||||
}
|
||||
|
||||
#else /* THREAD */
|
||||
#else /* !defined(DONT_USE_ALARM_THREAD) */
|
||||
|
||||
int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
|
||||
{
|
||||
#ifndef THREAD
|
||||
printf("thr_alarm disabled because we are not using threads\n");
|
||||
#else
|
||||
printf("thr_alarm disabled with DONT_USE_THR_ALARM\n");
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#endif /* THREAD */
|
||||
#endif /* !defined(DONT_USE_ALARM_THREAD) */
|
||||
#endif /* MAIN */
|
||||
|
|
|
@ -74,7 +74,6 @@ one TL_WRITE_DELAYED lock at the same time as multiple read locks.
|
|||
|
||||
#include "mysys_priv.h"
|
||||
|
||||
#ifdef THREAD
|
||||
#include "thr_lock.h"
|
||||
#include <m_string.h>
|
||||
#include <errno.h>
|
||||
|
@ -1451,7 +1450,6 @@ void thr_print_locks(void)
|
|||
mysql_mutex_unlock(&THR_LOCK_lock);
|
||||
}
|
||||
|
||||
#endif /* THREAD */
|
||||
|
||||
/*****************************************************************************
|
||||
** Test of thread locks
|
||||
|
@ -1459,8 +1457,6 @@ void thr_print_locks(void)
|
|||
|
||||
#ifdef MAIN
|
||||
|
||||
#ifdef THREAD
|
||||
|
||||
struct st_test {
|
||||
uint lock_nr;
|
||||
enum thr_lock_type lock_type;
|
||||
|
@ -1689,13 +1685,4 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
|
|||
return 0;
|
||||
}
|
||||
|
||||
#else /* THREAD */
|
||||
|
||||
int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
|
||||
{
|
||||
printf("thr_lock disabled because we are not using threads\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#endif /* THREAD */
|
||||
#endif /* MAIN */
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#if defined(TARGET_OS_LINUX) && !defined (__USE_UNIX98)
|
||||
#define __USE_UNIX98 /* To get rw locks under Linux */
|
||||
#endif
|
||||
#if defined(THREAD) && defined(SAFE_MUTEX)
|
||||
#if defined(SAFE_MUTEX)
|
||||
#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
|
||||
#include "mysys_priv.h"
|
||||
#include "my_static.h"
|
||||
|
@ -395,9 +395,9 @@ void safe_mutex_end(FILE *file __attribute__((unused)))
|
|||
#endif /* SAFE_MUTEX_DETECT_DESTROY */
|
||||
}
|
||||
|
||||
#endif /* THREAD && SAFE_MUTEX */
|
||||
#endif /* SAFE_MUTEX */
|
||||
|
||||
#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
|
||||
#if defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
|
||||
|
||||
#include "mysys_priv.h"
|
||||
#include "my_static.h"
|
||||
|
@ -500,4 +500,4 @@ void fastmutex_global_init(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif /* defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */
|
||||
#endif /* defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
/* Synchronization - readers / writer thread locks */
|
||||
|
||||
#include "mysys_priv.h"
|
||||
#if defined(THREAD)
|
||||
#if defined(NEED_MY_RW_LOCK)
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -471,4 +470,3 @@ int rw_pr_unlock(rw_pr_lock_t *rwlock)
|
|||
}
|
||||
|
||||
|
||||
#endif /* defined(THREAD) */
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
mysql_real_connect()
|
||||
- Support for reading local file with LOAD DATA LOCAL
|
||||
- SHARED memory handling
|
||||
- Protection against sigpipe
|
||||
- Prepared statements
|
||||
|
||||
- Things that only works for the server
|
||||
|
@ -70,9 +69,9 @@ my_bool net_flush(NET *net);
|
|||
#include "mysqld_error.h"
|
||||
#include "errmsg.h"
|
||||
#include <violite.h>
|
||||
#if defined(THREAD) && !defined(__WIN__)
|
||||
#if !defined(__WIN__)
|
||||
#include <my_pthread.h> /* because of signal() */
|
||||
#endif /* defined(THREAD) && !defined(__WIN__) */
|
||||
#endif /* !defined(__WIN__) */
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <signal.h>
|
||||
|
@ -287,7 +286,7 @@ static int wait_for_data(my_socket fd, uint timeout)
|
|||
{
|
||||
tv.tv_sec = (long) timeout;
|
||||
tv.tv_usec = 0;
|
||||
#if defined(HPUX10) && defined(THREAD)
|
||||
#if defined(HPUX10)
|
||||
if ((res = select(fd+1, NULL, (int*) &sfds, NULL, &tv)) > 0)
|
||||
break;
|
||||
#else
|
||||
|
@ -731,13 +730,9 @@ cli_safe_read(MYSQL *mysql)
|
|||
{
|
||||
NET *net= &mysql->net;
|
||||
ulong len=0;
|
||||
init_sigpipe_variables
|
||||
|
||||
/* Don't give sigpipe errors if the client doesn't want them */
|
||||
set_sigpipe(mysql);
|
||||
if (net->vio != 0)
|
||||
len=my_net_read(net);
|
||||
reset_sigpipe(mysql);
|
||||
|
||||
if (len == packet_error || len == 0)
|
||||
{
|
||||
|
@ -817,13 +812,9 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
|
|||
{
|
||||
NET *net= &mysql->net;
|
||||
my_bool result= 1;
|
||||
init_sigpipe_variables
|
||||
my_bool stmt_skip= stmt ? stmt->state != MYSQL_STMT_INIT_DONE : FALSE;
|
||||
DBUG_ENTER("cli_advanced_command");
|
||||
|
||||
/* Don't give sigpipe errors if the client doesn't want them */
|
||||
set_sigpipe(mysql);
|
||||
|
||||
if (mysql->net.vio == 0)
|
||||
{ /* Do reconnect if possible */
|
||||
if (mysql_reconnect(mysql) || stmt_skip)
|
||||
|
@ -872,7 +863,6 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
|
|||
result= ((mysql->packet_length=cli_safe_read(mysql)) == packet_error ?
|
||||
1 : 0);
|
||||
end:
|
||||
reset_sigpipe(mysql);
|
||||
DBUG_PRINT("exit",("result: %d", result));
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
@ -1089,14 +1079,11 @@ void end_server(MYSQL *mysql)
|
|||
DBUG_ENTER("end_server");
|
||||
if (mysql->net.vio != 0)
|
||||
{
|
||||
init_sigpipe_variables
|
||||
DBUG_PRINT("info",("Net: %s", vio_description(mysql->net.vio)));
|
||||
#ifdef MYSQL_SERVER
|
||||
slave_io_thread_detach_vio();
|
||||
#endif
|
||||
set_sigpipe(mysql);
|
||||
vio_delete(mysql->net.vio);
|
||||
reset_sigpipe(mysql);
|
||||
mysql->net.vio= 0; /* Marker */
|
||||
mysql_prune_stmt_list(mysql);
|
||||
}
|
||||
|
@ -2939,7 +2926,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
|||
#ifdef HAVE_SYS_UN_H
|
||||
struct sockaddr_un UNIXaddr;
|
||||
#endif
|
||||
init_sigpipe_variables
|
||||
DBUG_ENTER("mysql_real_connect");
|
||||
|
||||
DBUG_PRINT("enter",("host: %s db: %s user: %s (client)",
|
||||
|
@ -2954,8 +2940,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/* Don't give sigpipe errors if the client doesn't want them */
|
||||
set_sigpipe(mysql);
|
||||
mysql->methods= &client_methods;
|
||||
net->vio = 0; /* If something goes wrong */
|
||||
mysql->client_flag=0; /* For handshake */
|
||||
|
@ -3465,11 +3449,9 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
|||
#endif
|
||||
|
||||
DBUG_PRINT("exit", ("Mysql handler: 0x%lx", (long) mysql));
|
||||
reset_sigpipe(mysql);
|
||||
DBUG_RETURN(mysql);
|
||||
|
||||
error:
|
||||
reset_sigpipe(mysql);
|
||||
DBUG_PRINT("error",("message: %u/%s (%s)",
|
||||
net->last_errno,
|
||||
net->sqlstate,
|
||||
|
|
|
@ -31,11 +31,7 @@
|
|||
#include "mysql.h"
|
||||
#include <my_sys.h>
|
||||
#include <m_string.h>
|
||||
#ifdef THREAD
|
||||
#include <my_pthread.h>
|
||||
#else
|
||||
#include <my_no_pthread.h>
|
||||
#endif
|
||||
|
||||
#include <sql_common.h>
|
||||
#include "errmsg.h"
|
||||
|
@ -67,9 +63,7 @@ static uint plugin_version[MYSQL_CLIENT_MAX_PLUGINS]=
|
|||
loading the same plugin twice in parallel.
|
||||
*/
|
||||
struct st_client_plugin_int *plugin_list[MYSQL_CLIENT_MAX_PLUGINS];
|
||||
#ifdef THREAD
|
||||
static pthread_mutex_t LOCK_load_client_plugin;
|
||||
#endif
|
||||
|
||||
static int is_not_initialized(MYSQL *mysql, const char *name)
|
||||
{
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
CLIENT_SECURE_CONNECTION | CLIENT_TRANSACTIONS | \
|
||||
CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION)
|
||||
|
||||
#define init_sigpipe_variables
|
||||
#define set_sigpipe(mysql)
|
||||
#define reset_sigpipe(mysql)
|
||||
#define read_user_name(A) {}
|
||||
#undef HAVE_SMEM
|
||||
#undef _CUSTOMCONFIG_
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -33,10 +33,6 @@
|
|||
#include "sql_test.h" // TEST_filesort
|
||||
#include "opt_range.h" // SQL_SELECT
|
||||
|
||||
#ifndef THREAD
|
||||
#define SKIP_DBUG_IN_FILESORT
|
||||
#endif
|
||||
|
||||
/// How to write record_ref.
|
||||
#define WRITE_REF(file,from) \
|
||||
if (my_b_write((file),(uchar*) (from),param->ref_length)) \
|
||||
|
|
|
@ -4759,6 +4759,7 @@ int handler::ha_reset()
|
|||
free_io_cache(table);
|
||||
/* reset the bitmaps to point to defaults */
|
||||
table->default_column_bitmaps();
|
||||
pushed_cond= NULL;
|
||||
DBUG_RETURN(reset());
|
||||
}
|
||||
|
||||
|
|
|
@ -1092,11 +1092,11 @@ public:
|
|||
virtual bool set_no_const_sub(uchar *arg) { return FALSE; }
|
||||
virtual Item *replace_equal_field(uchar * arg) { return this; }
|
||||
/*
|
||||
Check if an expression value depends on the current timezone. Used by
|
||||
partitioning code to reject timezone-dependent expressions in a
|
||||
(sub)partitioning function.
|
||||
Check if an expression value has allowed arguments, like DATE/DATETIME
|
||||
for date functions. Also used by partitioning code to reject
|
||||
timezone-dependent expressions in a (sub)partitioning function.
|
||||
*/
|
||||
virtual bool is_timezone_dependent_processor(uchar *bool_arg)
|
||||
virtual bool check_valid_arguments_processor(uchar *bool_arg)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -237,6 +237,7 @@ public:
|
|||
{
|
||||
return (error == E_DEC_OVERFLOW) ? raise_decimal_overflow() : error;
|
||||
}
|
||||
|
||||
bool has_timestamp_args()
|
||||
{
|
||||
DBUG_ASSERT(fixed == TRUE);
|
||||
|
@ -248,6 +249,45 @@ public:
|
|||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool has_date_args()
|
||||
{
|
||||
DBUG_ASSERT(fixed == TRUE);
|
||||
for (uint i= 0; i < arg_count; i++)
|
||||
{
|
||||
if (args[i]->type() == Item::FIELD_ITEM &&
|
||||
(args[i]->field_type() == MYSQL_TYPE_DATE ||
|
||||
args[i]->field_type() == MYSQL_TYPE_DATETIME))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool has_time_args()
|
||||
{
|
||||
DBUG_ASSERT(fixed == TRUE);
|
||||
for (uint i= 0; i < arg_count; i++)
|
||||
{
|
||||
if (args[i]->type() == Item::FIELD_ITEM &&
|
||||
(args[i]->field_type() == MYSQL_TYPE_TIME ||
|
||||
args[i]->field_type() == MYSQL_TYPE_DATETIME))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool has_datetime_args()
|
||||
{
|
||||
DBUG_ASSERT(fixed == TRUE);
|
||||
for (uint i= 0; i < arg_count; i++)
|
||||
{
|
||||
if (args[i]->type() == Item::FIELD_ITEM &&
|
||||
args[i]->field_type() == MYSQL_TYPE_DATETIME)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
We assume the result of any function that has a TIMESTAMP argument to be
|
||||
timezone-dependent, since a TIMESTAMP value in both numeric and string
|
||||
|
@ -256,7 +296,7 @@ public:
|
|||
representation of a TIMESTAMP argument verbatim, and thus does not depend on
|
||||
the timezone.
|
||||
*/
|
||||
virtual bool is_timezone_dependent_processor(uchar *bool_arg)
|
||||
virtual bool check_valid_arguments_processor(uchar *bool_arg)
|
||||
{
|
||||
return has_timestamp_args();
|
||||
}
|
||||
|
|
|
@ -181,6 +181,7 @@ public:
|
|||
String *val_str(String *);
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
Item_geometry_func::fix_length_and_dec();
|
||||
for (unsigned int i= 0; i < arg_count; ++i)
|
||||
{
|
||||
if (args[i]->fixed && args[i]->field_type() != MYSQL_TYPE_GEOMETRY)
|
||||
|
|
|
@ -1116,6 +1116,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
|
|||
select_lex->having= join->having= and_items(join->having, item);
|
||||
if (join->having == item)
|
||||
item->name= (char*)in_having_cond;
|
||||
select_lex->having->top_level_item();
|
||||
select_lex->having_fix_field= 1;
|
||||
/*
|
||||
we do not check join->having->fixed, because Item_and (from and_items)
|
||||
|
|
|
@ -75,6 +75,10 @@ public:
|
|||
enum_monotonicity_info get_monotonicity_info() const;
|
||||
longlong val_int_endpoint(bool left_endp, bool *incl_endp);
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_date_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -102,6 +106,12 @@ public:
|
|||
*input_version= output_version;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Only meaningful with date part and optional time part */
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_date_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -118,6 +128,10 @@ public:
|
|||
maybe_null=1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_date_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -142,6 +156,10 @@ public:
|
|||
maybe_null= 1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_date_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -171,6 +189,10 @@ public:
|
|||
maybe_null= 1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_date_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -187,6 +209,10 @@ public:
|
|||
maybe_null=1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_time_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -203,6 +229,10 @@ public:
|
|||
maybe_null=1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_time_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -219,6 +249,10 @@ public:
|
|||
maybe_null=1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_date_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -235,6 +269,10 @@ public:
|
|||
maybe_null=1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_time_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -265,6 +303,10 @@ public:
|
|||
maybe_null=1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_date_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -283,6 +325,10 @@ public:
|
|||
maybe_null=1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_date_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -312,6 +358,10 @@ public:
|
|||
maybe_null= 1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_date_args();
|
||||
}
|
||||
};
|
||||
|
||||
class Item_func_dayname :public Item_func_weekday
|
||||
|
@ -341,7 +391,7 @@ public:
|
|||
(and thus may not be used as a partitioning function)
|
||||
when its argument is NOT of the TIMESTAMP type.
|
||||
*/
|
||||
bool is_timezone_dependent_processor(uchar *int_arg)
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_timestamp_args();
|
||||
}
|
||||
|
@ -366,6 +416,10 @@ public:
|
|||
max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_time_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -621,6 +675,10 @@ public:
|
|||
const char *func_name() const { return "from_days"; }
|
||||
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return has_date_args() || has_time_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -746,6 +804,42 @@ class Item_extract :public Item_int_func
|
|||
bool eq(const Item *item, bool binary_cmp) const;
|
||||
virtual void print(String *str, enum_query_type query_type);
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
switch (int_type) {
|
||||
case INTERVAL_YEAR:
|
||||
case INTERVAL_YEAR_MONTH:
|
||||
case INTERVAL_QUARTER:
|
||||
case INTERVAL_MONTH:
|
||||
/* case INTERVAL_WEEK: Not allowed as partitioning function, bug#57071 */
|
||||
case INTERVAL_DAY:
|
||||
return !has_date_args();
|
||||
case INTERVAL_DAY_HOUR:
|
||||
case INTERVAL_DAY_MINUTE:
|
||||
case INTERVAL_DAY_SECOND:
|
||||
case INTERVAL_DAY_MICROSECOND:
|
||||
return !has_datetime_args();
|
||||
case INTERVAL_HOUR:
|
||||
case INTERVAL_HOUR_MINUTE:
|
||||
case INTERVAL_HOUR_SECOND:
|
||||
case INTERVAL_MINUTE:
|
||||
case INTERVAL_MINUTE_SECOND:
|
||||
case INTERVAL_SECOND:
|
||||
case INTERVAL_MICROSECOND:
|
||||
case INTERVAL_HOUR_MICROSECOND:
|
||||
case INTERVAL_MINUTE_MICROSECOND:
|
||||
case INTERVAL_SECOND_MICROSECOND:
|
||||
return !has_time_args();
|
||||
default:
|
||||
/*
|
||||
INTERVAL_LAST is only an end marker,
|
||||
INTERVAL_WEEK depends on default_week_format which is a session
|
||||
variable and cannot be used for partitioning. See bug#57071.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -991,6 +1085,10 @@ public:
|
|||
maybe_null=1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_valid_arguments_processor(uchar *int_arg)
|
||||
{
|
||||
return !has_time_args();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -164,17 +164,7 @@ my_bool net_realloc(NET *net, size_t length)
|
|||
DBUG_ENTER("net_realloc");
|
||||
DBUG_PRINT("enter",("length: %lu", (ulong) length));
|
||||
|
||||
/*
|
||||
When compression is off, net->where_b is always 0.
|
||||
With compression turned on, net->where_b may indicate
|
||||
that we still have a piece of the previous logical
|
||||
packet in the buffer, unprocessed. Take it into account
|
||||
when checking that max_allowed_packet is not exceeded.
|
||||
This ensures that the client treats max_allowed_packet
|
||||
limit identically, regardless of compression being on
|
||||
or off.
|
||||
*/
|
||||
if (length >= (net->max_packet_size + net->where_b))
|
||||
if (length >= net->max_packet_size)
|
||||
{
|
||||
DBUG_PRINT("error", ("Packet too large. Max size: %lu",
|
||||
net->max_packet_size));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -728,7 +728,7 @@ send_result_message:
|
|||
protocol->store(operator_name, system_charset_info);
|
||||
if (result_code) // either mysql_recreate_table or analyze failed
|
||||
{
|
||||
DBUG_ASSERT(thd->is_error());
|
||||
DBUG_ASSERT(thd->is_error() || thd->killed);
|
||||
if (thd->is_error())
|
||||
{
|
||||
const char *err_msg= thd->stmt_da->message();
|
||||
|
|
|
@ -3068,6 +3068,11 @@ retry_share:
|
|||
table->reginfo.lock_type=TL_READ; /* Assume read */
|
||||
|
||||
reset:
|
||||
/*
|
||||
Check that there is no reference to a condtion from an earlier query
|
||||
(cf. Bug#58553).
|
||||
*/
|
||||
DBUG_ASSERT(table->file->pushed_cond == NULL);
|
||||
table_list->updatable= 1; // It is not derived table nor non-updatable VIEW
|
||||
table_list->table= table;
|
||||
|
||||
|
|
|
@ -1130,12 +1130,13 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
|
|||
}
|
||||
|
||||
/*
|
||||
We don't allow creating partitions with timezone-dependent expressions as
|
||||
a (sub)partitioning function, but we want to allow such expressions when
|
||||
opening existing tables for easier maintenance. This exception should be
|
||||
deprecated at some point in future so that we always throw an error.
|
||||
We don't allow creating partitions with expressions with non matching
|
||||
arguments as a (sub)partitioning function,
|
||||
but we want to allow such expressions when opening existing tables for
|
||||
easier maintenance. This exception should be deprecated at some point
|
||||
in future so that we always throw an error.
|
||||
*/
|
||||
if (func_expr->walk(&Item::is_timezone_dependent_processor,
|
||||
if (func_expr->walk(&Item::check_valid_arguments_processor,
|
||||
0, NULL))
|
||||
{
|
||||
if (is_create_table_ind)
|
||||
|
|
|
@ -6476,7 +6476,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
|||
tab->select_cond=sel->cond=tmp;
|
||||
/* Push condition to storage engine if this is enabled
|
||||
and the condition is not guarded */
|
||||
tab->table->file->pushed_cond= NULL;
|
||||
if (thd->variables.optimizer_switch &
|
||||
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN)
|
||||
{
|
||||
|
@ -10043,7 +10042,12 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
|||
convert_blob_length);
|
||||
if (orig_type == Item::REF_ITEM && orig_modify)
|
||||
((Item_ref*)orig_item)->set_result_field(result);
|
||||
if (field->field->eq_def(result))
|
||||
/*
|
||||
Fields that are used as arguments to the DEFAULT() function already have
|
||||
their data pointers set to the default value during name resulotion. See
|
||||
Item_default_value::fix_fields.
|
||||
*/
|
||||
if (orig_type != Item::DEFAULT_VALUE_ITEM && field->field->eq_def(result))
|
||||
*default_field= field->field;
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1270,6 +1270,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
|
|||
TABLE_LIST *view_tables= lex->query_tables;
|
||||
TABLE_LIST *view_tables_tail= 0;
|
||||
TABLE_LIST *tbl;
|
||||
Security_context *security_ctx;
|
||||
|
||||
/*
|
||||
Check rights to run commands (EXPLAIN SELECT & SHOW CREATE) which show
|
||||
|
@ -1416,25 +1417,38 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
|
|||
if (table->view_suid)
|
||||
{
|
||||
/*
|
||||
Prepare a security context to check underlying objects of the view
|
||||
For suid views prepare a security context for checking underlying
|
||||
objects of the view.
|
||||
*/
|
||||
if (!(table->view_sctx= (Security_context *)
|
||||
thd->stmt_arena->alloc(sizeof(Security_context))))
|
||||
goto err;
|
||||
/* Assign the context to the tables referenced in the view */
|
||||
if (view_tables)
|
||||
{
|
||||
DBUG_ASSERT(view_tables_tail);
|
||||
for (tbl= view_tables; tbl != view_tables_tail->next_global;
|
||||
tbl= tbl->next_global)
|
||||
tbl->security_ctx= table->view_sctx;
|
||||
}
|
||||
/* assign security context to SELECT name resolution contexts of view */
|
||||
for(SELECT_LEX *sl= lex->all_selects_list;
|
||||
sl;
|
||||
sl= sl->next_select_in_list())
|
||||
sl->context.security_ctx= table->view_sctx;
|
||||
security_ctx= table->view_sctx;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
For non-suid views inherit security context from view's table list.
|
||||
This allows properly handle situation when non-suid view is used
|
||||
from within suid view.
|
||||
*/
|
||||
security_ctx= table->security_ctx;
|
||||
}
|
||||
|
||||
/* Assign the context to the tables referenced in the view */
|
||||
if (view_tables)
|
||||
{
|
||||
DBUG_ASSERT(view_tables_tail);
|
||||
for (tbl= view_tables; tbl != view_tables_tail->next_global;
|
||||
tbl= tbl->next_global)
|
||||
tbl->security_ctx= security_ctx;
|
||||
}
|
||||
|
||||
/* assign security context to SELECT name resolution contexts of view */
|
||||
for(SELECT_LEX *sl= lex->all_selects_list;
|
||||
sl;
|
||||
sl= sl->next_select_in_list())
|
||||
sl->context.security_ctx= security_ctx;
|
||||
|
||||
/*
|
||||
Setup an error processor to hide error messages issued by stored
|
||||
|
|
|
@ -1963,8 +1963,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
|
|||
{
|
||||
if (work_part_info_used)
|
||||
tmp= fix_partition_func(thd, outparam, is_create_table);
|
||||
outparam->part_info->item_free_list= part_func_arena.free_list;
|
||||
}
|
||||
outparam->part_info->item_free_list= part_func_arena.free_list;
|
||||
partititon_err:
|
||||
if (tmp)
|
||||
{
|
||||
|
|
|
@ -17,9 +17,7 @@
|
|||
|
||||
#include <my_base.h> /* This includes global */
|
||||
C_MODE_START
|
||||
#ifdef THREAD
|
||||
#include <my_pthread.h>
|
||||
#endif
|
||||
#include "heap.h" /* Structs & some defines */
|
||||
#include "my_tree.h"
|
||||
|
||||
|
@ -102,14 +100,11 @@ extern void hp_clear(HP_SHARE *info);
|
|||
extern void hp_clear_keys(HP_SHARE *info);
|
||||
extern uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
|
||||
key_part_map keypart_map);
|
||||
#ifdef THREAD
|
||||
|
||||
extern mysql_mutex_t THR_LOCK_heap;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
#ifdef THREAD
|
||||
extern PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock;
|
||||
#endif /* THREAD */
|
||||
void init_heap_psi_keys();
|
||||
#endif /* HAVE_PSI_INTERFACE */
|
||||
|
||||
|
|
|
@ -86,7 +86,6 @@ int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length)
|
|||
}
|
||||
else
|
||||
{
|
||||
dont_break(); /* Dont allow SIGHUP or SIGINT */
|
||||
if ((uint) i == block->levels)
|
||||
{
|
||||
/* Adding a new level on top of the existing ones. */
|
||||
|
@ -117,7 +116,6 @@ int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length)
|
|||
allocated bytes. Use it as a leaf block.
|
||||
*/
|
||||
block->level_info[0].last_blocks= root;
|
||||
allow_break(); /* Allow SIGHUP & SIGINT */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -192,11 +192,9 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
|
|||
my_free(share);
|
||||
goto err;
|
||||
}
|
||||
#ifdef THREAD
|
||||
thr_lock_init(&share->lock);
|
||||
mysql_mutex_init(hp_key_mutex_HP_SHARE_intern_lock,
|
||||
&share->intern_lock, MY_MUTEX_INIT_FAST);
|
||||
#endif
|
||||
if (!create_info->internal_table)
|
||||
{
|
||||
share->open_list.data= (void*) share;
|
||||
|
@ -301,10 +299,8 @@ void hp_free(HP_SHARE *share)
|
|||
if (share->open_list.data) /* If not internal table */
|
||||
heap_share_list= list_delete(heap_share_list, &share->open_list);
|
||||
hp_clear(share); /* Remove blocks from memory */
|
||||
#ifdef THREAD
|
||||
thr_lock_delete(&share->lock);
|
||||
mysql_mutex_destroy(&share->intern_lock);
|
||||
#endif
|
||||
my_free(share->name);
|
||||
my_free(share);
|
||||
return;
|
||||
|
|
|
@ -37,9 +37,7 @@ HP_INFO *heap_open_from_share(HP_SHARE *share, int mode)
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
share->open_count++;
|
||||
#ifdef THREAD
|
||||
thr_lock_data_init(&share->lock,&info->lock,NULL);
|
||||
#endif
|
||||
info->s= share;
|
||||
info->lastkey= (uchar*) (info + 1);
|
||||
info->recbuf= (uchar*) (info->lastkey + share->max_key_length);
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
LIST *heap_open_list=0,*heap_share_list=0;
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
#ifdef THREAD
|
||||
PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock;
|
||||
|
||||
static PSI_mutex_info all_heap_mutexes[]=
|
||||
|
@ -36,11 +35,9 @@ static PSI_mutex_info all_heap_mutexes[]=
|
|||
THR_LOCK_heap is part of mysys, not storage/heap.
|
||||
*/
|
||||
};
|
||||
#endif /* THREAD */
|
||||
|
||||
void init_heap_psi_keys()
|
||||
{
|
||||
#ifdef THREAD
|
||||
const char* category= "memory";
|
||||
int count;
|
||||
|
||||
|
@ -49,7 +46,6 @@ void init_heap_psi_keys()
|
|||
|
||||
count= array_elements(all_heap_mutexes);
|
||||
PSI_server->register_mutex(category, all_heap_mutexes, count);
|
||||
#endif /* THREAD */
|
||||
}
|
||||
#endif /* HAVE_PSI_INTERFACE */
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2000-2003, 2006 MySQL AB
|
||||
/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights
|
||||
reserved
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -656,11 +657,6 @@ static int rnd(int max_value)
|
|||
|
||||
static sig_handler endprog(int sig_number __attribute__((unused)))
|
||||
{
|
||||
#ifndef THREAD
|
||||
if (my_dont_interrupt)
|
||||
my_remember_signal(sig_number,endprog);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
hp_panic(HA_PANIC_CLOSE);
|
||||
my_end(1);
|
||||
|
|
|
@ -168,10 +168,9 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
|
|||
Also we likely need to lock mutex here (in both cases with protocol and
|
||||
push_warning).
|
||||
*/
|
||||
#ifdef THREAD
|
||||
if (param->need_print_msg_lock)
|
||||
mysql_mutex_lock(¶m->print_msg_mutex);
|
||||
#endif
|
||||
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(name, length, system_charset_info);
|
||||
protocol->store(param->op_name, system_charset_info);
|
||||
|
@ -180,10 +179,10 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
|
|||
if (protocol->write())
|
||||
sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n",
|
||||
msgbuf);
|
||||
#ifdef THREAD
|
||||
|
||||
if (param->need_print_msg_lock)
|
||||
mysql_mutex_unlock(¶m->print_msg_mutex);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,9 +99,7 @@ void myisamchk_init(MI_CHECK *param)
|
|||
param->max_record_length= LONGLONG_MAX;
|
||||
param->key_cache_block_size= KEY_CACHE_BLOCK_SIZE;
|
||||
param->stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
|
||||
#ifdef THREAD
|
||||
param->need_print_msg_lock= 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Check the status flags for the table */
|
||||
|
@ -2631,9 +2629,6 @@ err:
|
|||
int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
|
||||
const char * name, int rep_quick)
|
||||
{
|
||||
#ifndef THREAD
|
||||
return mi_repair_by_sort(param, info, name, rep_quick);
|
||||
#else
|
||||
int got_error;
|
||||
uint i,key, total_key_length, istep;
|
||||
ulong rec_length;
|
||||
|
@ -3122,7 +3117,6 @@ err:
|
|||
share->pack.header_length=0;
|
||||
}
|
||||
DBUG_RETURN(got_error);
|
||||
#endif /* THREAD */
|
||||
}
|
||||
|
||||
/* Read next record and return next key */
|
||||
|
|
|
@ -91,7 +91,6 @@ int mi_close(register MI_INFO *info)
|
|||
my_free(share->decode_trees);
|
||||
my_free(share->decode_tables);
|
||||
}
|
||||
#ifdef THREAD
|
||||
thr_lock_delete(&share->lock);
|
||||
mysql_mutex_destroy(&share->intern_lock);
|
||||
{
|
||||
|
@ -102,7 +101,6 @@ int mi_close(register MI_INFO *info)
|
|||
mysql_rwlock_destroy(&share->key_root_lock[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
my_free(info->s);
|
||||
}
|
||||
mysql_mutex_unlock(&THR_LOCK_myisam);
|
||||
|
|
|
@ -102,7 +102,7 @@ int mi_delete(MI_INFO *info,const uchar *record)
|
|||
mi_sizestore(lastpos,info->lastpos);
|
||||
myisam_log_command(MI_LOG_DELETE,info,(uchar*) lastpos,sizeof(lastpos),0);
|
||||
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
|
||||
allow_break(); /* Allow SIGHUP & SIGINT */
|
||||
|
||||
if (info->invalidator != 0)
|
||||
{
|
||||
DBUG_PRINT("info", ("invalidator... '%s' (delete)", info->filename));
|
||||
|
@ -122,7 +122,6 @@ err:
|
|||
}
|
||||
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
|
||||
info->update|=HA_STATE_WRITTEN; /* Buffer changed */
|
||||
allow_break(); /* Allow SIGHUP & SIGINT */
|
||||
my_errno=save_errno;
|
||||
if (save_errno == HA_ERR_KEY_NOT_FOUND)
|
||||
{
|
||||
|
|
|
@ -66,7 +66,6 @@ int mi_delete_all_rows(MI_INFO *info)
|
|||
if (share->file_map)
|
||||
mi_dynmap_file(info, (my_off_t) 0);
|
||||
#endif
|
||||
allow_break(); /* Allow SIGHUP & SIGINT */
|
||||
DBUG_RETURN(0);
|
||||
|
||||
err:
|
||||
|
@ -74,7 +73,6 @@ err:
|
|||
int save_errno=my_errno;
|
||||
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
|
||||
info->update|=HA_STATE_WRITTEN; /* Buffer changed */
|
||||
allow_break(); /* Allow SIGHUP & SIGINT */
|
||||
DBUG_RETURN(my_errno=save_errno);
|
||||
}
|
||||
} /* mi_delete */
|
||||
|
|
|
@ -39,13 +39,11 @@ static int delete_dynamic_record(MI_INFO *info,my_off_t filepos,
|
|||
static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
|
||||
uint length);
|
||||
|
||||
#ifdef THREAD
|
||||
/* Play it safe; We have a small stack when using threads */
|
||||
#undef my_alloca
|
||||
#undef my_afree
|
||||
#define my_alloca(A) my_malloc((A),MYF(0))
|
||||
#define my_afree(A) my_free((A))
|
||||
#endif
|
||||
|
||||
/* Interface function from MI_INFO */
|
||||
|
||||
|
@ -1579,9 +1577,6 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const uchar *record)
|
|||
MI_BLOCK_INFO block_info;
|
||||
DBUG_ENTER("_mi_cmp_dynamic_record");
|
||||
|
||||
/* We are going to do changes; dont let anybody disturb */
|
||||
dont_break(); /* Dont allow SIGHUP or SIGINT */
|
||||
|
||||
if (info->opt_flag & WRITE_CACHE_USED)
|
||||
{
|
||||
info->update&= ~(HA_STATE_WRITE_AT_END | HA_STATE_EXTEND_BLOCK);
|
||||
|
|
|
@ -24,11 +24,7 @@
|
|||
#endif
|
||||
|
||||
#undef GETPID /* For HPUX */
|
||||
#ifdef THREAD
|
||||
#define GETPID() (log_type == 1 ? (long) myisam_pid : (long) my_thread_dbug_id())
|
||||
#else
|
||||
#define GETPID() myisam_pid
|
||||
#endif
|
||||
|
||||
/* Activate logging if flag is 1 and reset logging if flag is 0 */
|
||||
|
||||
|
|
|
@ -286,9 +286,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
|||
&share->state.key_root,keys*sizeof(my_off_t),
|
||||
&share->state.key_del,
|
||||
(share->state.header.max_block_size_index*sizeof(my_off_t)),
|
||||
#ifdef THREAD
|
||||
&share->key_root_lock, sizeof(mysql_rwlock_t)*keys,
|
||||
#endif
|
||||
&share->mmap_lock, sizeof(mysql_rwlock_t),
|
||||
NullS))
|
||||
goto err;
|
||||
|
@ -498,7 +496,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
|||
my_afree(disk_cache);
|
||||
mi_setup_functions(share);
|
||||
share->is_log_table= FALSE;
|
||||
#ifdef THREAD
|
||||
thr_lock_init(&share->lock);
|
||||
mysql_mutex_init(mi_key_mutex_MYISAM_SHARE_intern_lock,
|
||||
&share->intern_lock, MY_MUTEX_INIT_FAST);
|
||||
|
@ -528,7 +525,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
|||
share->lock.check_status=mi_check_status;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
Memory mapping can only be requested after initializing intern_lock.
|
||||
*/
|
||||
|
@ -625,9 +621,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
|||
bzero(info.rec_buff, mi_get_rec_buff_len(&info, info.rec_buff));
|
||||
|
||||
*m_info=info;
|
||||
#ifdef THREAD
|
||||
thr_lock_data_init(&share->lock,&m_info->lock,(void*) m_info);
|
||||
#endif
|
||||
m_info->open_list.data=(void*) m_info;
|
||||
myisam_open_list=list_add(myisam_open_list,&m_info->open_list);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ File myisam_log_file= -1;
|
|||
uint myisam_quick_table_bits=9;
|
||||
ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */
|
||||
my_bool myisam_flush=0, myisam_delay_key_write=0, myisam_single_user=0;
|
||||
#if defined(THREAD) && !defined(DONT_USE_RW_LOCKS)
|
||||
#if !defined(DONT_USE_RW_LOCKS)
|
||||
ulong myisam_concurrent_insert= 2;
|
||||
#else
|
||||
ulong myisam_concurrent_insert= 0;
|
||||
|
|
|
@ -114,9 +114,6 @@ int _mi_cmp_static_record(register MI_INFO *info, register const uchar *old)
|
|||
{
|
||||
DBUG_ENTER("_mi_cmp_static_record");
|
||||
|
||||
/* We are going to do changes; dont let anybody disturb */
|
||||
dont_break(); /* Dont allow SIGHUP or SIGINT */
|
||||
|
||||
if (info->opt_flag & WRITE_CACHE_USED)
|
||||
{
|
||||
if (flush_io_cache(&info->rec_cache))
|
||||
|
|
|
@ -179,7 +179,6 @@ int mi_update(register MI_INFO *info, const uchar *oldrec, uchar *newrec)
|
|||
there is no index change there could be data change.
|
||||
*/
|
||||
(void) _mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
|
||||
allow_break(); /* Allow SIGHUP & SIGINT */
|
||||
if (info->invalidator != 0)
|
||||
{
|
||||
DBUG_PRINT("info", ("invalidator... '%s' (update)", info->filename));
|
||||
|
@ -230,7 +229,6 @@ err:
|
|||
err_end:
|
||||
myisam_log_record(MI_LOG_UPDATE,info,newrec,info->lastpos,my_errno);
|
||||
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
|
||||
allow_break(); /* Allow SIGHUP & SIGINT */
|
||||
if (save_errno == HA_ERR_KEY_NOT_FOUND)
|
||||
{
|
||||
mi_print_error(info->s, HA_ERR_CRASHED);
|
||||
|
|
|
@ -60,7 +60,7 @@ int mi_write(MI_INFO *info, uchar *record)
|
|||
}
|
||||
if (_mi_readinfo(info,F_WRLCK,1))
|
||||
DBUG_RETURN(my_errno);
|
||||
dont_break(); /* Dont allow SIGHUP or SIGINT */
|
||||
|
||||
filepos= ((share->state.dellink != HA_OFFSET_ERROR &&
|
||||
!info->append_insert_at_end) ?
|
||||
share->state.dellink :
|
||||
|
@ -169,7 +169,6 @@ int mi_write(MI_INFO *info, uchar *record)
|
|||
if (share->is_log_table)
|
||||
mi_update_status((void*) info);
|
||||
|
||||
allow_break(); /* Allow SIGHUP & SIGINT */
|
||||
DBUG_RETURN(0);
|
||||
|
||||
err:
|
||||
|
@ -228,7 +227,6 @@ err2:
|
|||
save_errno=my_errno;
|
||||
myisam_log_record(MI_LOG_WRITE,info,record,filepos,my_errno);
|
||||
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
|
||||
allow_break(); /* Allow SIGHUP & SIGINT */
|
||||
DBUG_RETURN(my_errno=save_errno);
|
||||
} /* mi_write */
|
||||
|
||||
|
|
|
@ -18,12 +18,8 @@
|
|||
#include "myisam.h" /* Structs & some defines */
|
||||
#include "myisampack.h" /* packing of keys */
|
||||
#include <my_tree.h>
|
||||
#ifdef THREAD
|
||||
#include <my_pthread.h>
|
||||
#include <thr_lock.h>
|
||||
#else
|
||||
#include <my_no_pthread.h>
|
||||
#endif
|
||||
#include <mysql/psi/mysql_file.h>
|
||||
|
||||
/* undef map from my_nosys; We need test-if-disk full */
|
||||
|
@ -211,11 +207,10 @@ typedef struct st_mi_isam_share { /* Shared between opens */
|
|||
not_flushed,
|
||||
temporary,delay_key_write,
|
||||
concurrent_insert;
|
||||
#ifdef THREAD
|
||||
|
||||
THR_LOCK lock;
|
||||
mysql_mutex_t intern_lock; /* Locking for use with _locking */
|
||||
mysql_rwlock_t *key_root_lock;
|
||||
#endif
|
||||
my_off_t mmaped_length;
|
||||
uint nonmmaped_inserts; /* counter of writing in non-mmaped
|
||||
area */
|
||||
|
@ -298,9 +293,7 @@ struct st_myisam_info {
|
|||
#ifdef __WIN__
|
||||
my_bool owned_by_merge; /* This MyISAM table is part of a merge union */
|
||||
#endif
|
||||
#ifdef THREAD
|
||||
THR_LOCK_DATA lock;
|
||||
#endif
|
||||
uchar *rtree_recursion_state; /* For RTREE */
|
||||
int rtree_recursion_depth;
|
||||
};
|
||||
|
@ -461,10 +454,9 @@ typedef struct st_mi_sort_param
|
|||
#define MI_UNIQUE_HASH_TYPE HA_KEYTYPE_ULONG_INT
|
||||
#define mi_unique_store(A,B) mi_int4store((A),(B))
|
||||
|
||||
#ifdef THREAD
|
||||
extern mysql_mutex_t THR_LOCK_myisam;
|
||||
#endif
|
||||
#if !defined(THREAD) || defined(DONT_USE_RW_LOCKS)
|
||||
|
||||
#if defined(DONT_USE_RW_LOCKS)
|
||||
#define mysql_rwlock_wrlock(A) {}
|
||||
#define mysql_rwlock_rdlock(A) {}
|
||||
#define mysql_rwlock_unlock(A) {}
|
||||
|
@ -774,9 +766,7 @@ void mi_check_print_info(MI_CHECK *param, const char *fmt,...);
|
|||
int flush_pending_blocks(MI_SORT_PARAM *param);
|
||||
int sort_ft_buf_flush(MI_SORT_PARAM *sort_param);
|
||||
int thr_write_keys(MI_SORT_PARAM *sort_param);
|
||||
#ifdef THREAD
|
||||
pthread_handler_t thr_find_all_keys(void *arg);
|
||||
#endif
|
||||
int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file);
|
||||
|
||||
int sort_write_record(MI_SORT_PARAM *sort_param);
|
||||
|
|
|
@ -302,7 +302,6 @@ static ha_rows find_all_keys(MI_SORT_PARAM *info, uint keys,
|
|||
} /* find_all_keys */
|
||||
|
||||
|
||||
#ifdef THREAD
|
||||
/* Search after all keys and place them in a temp. file */
|
||||
|
||||
pthread_handler_t thr_find_all_keys(void *arg)
|
||||
|
@ -637,7 +636,6 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
|
|||
my_free(mergebuf);
|
||||
DBUG_RETURN(got_error);
|
||||
}
|
||||
#endif /* THREAD */
|
||||
|
||||
/* Write all keys in memory to file for later merge */
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue