mirror of
https://github.com/MariaDB/server.git
synced 2025-11-10 23:02:54 +03:00
Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into mysql.com:/usr/home/bar/mysql-5.1-new.b16319
This commit is contained in:
@@ -291,7 +291,7 @@ init_event_thread(THD* thd)
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
sigset_t set;
|
||||
VOID(sigemptyset(&set)); // Get mask in use
|
||||
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
|
||||
|
||||
@@ -63,8 +63,7 @@
|
||||
pool. For MyISAM its a question of how much the file system caches the
|
||||
MyISAM file. With enough free memory MyISAM is faster. Its only when the OS
|
||||
doesn't have enough memory to cache entire table that archive turns out
|
||||
to be any faster. For writes it is always a bit slower then MyISAM. It has no
|
||||
internal limits though for row length.
|
||||
to be any faster.
|
||||
|
||||
Examples between MyISAM (packed) and Archive.
|
||||
|
||||
@@ -81,11 +80,8 @@
|
||||
TODO:
|
||||
Add bzip optional support.
|
||||
Allow users to set compression level.
|
||||
Add truncate table command.
|
||||
Implement versioning, should be easy.
|
||||
Allow for errors, find a way to mark bad rows.
|
||||
Talk to the azip guys, come up with a writable format so that updates are doable
|
||||
without switching to a block method.
|
||||
Add optional feature so that rows can be flushed at interval (which will cause less
|
||||
compression but may speed up ordered searches).
|
||||
Checkpoint the meta file to allow for faster rebuilds.
|
||||
@@ -126,10 +122,12 @@ static HASH archive_open_tables;
|
||||
#define ARN ".ARN" // Files used during an optimize call
|
||||
#define ARM ".ARM" // Meta file
|
||||
/*
|
||||
uchar + uchar + ulonglong + ulonglong + ulonglong + ulonglong + uchar
|
||||
uchar + uchar + ulonglong + ulonglong + ulonglong + ulonglong + FN_REFLEN
|
||||
+ uchar
|
||||
*/
|
||||
#define META_BUFFER_SIZE sizeof(uchar) + sizeof(uchar) + sizeof(ulonglong) \
|
||||
+ sizeof(ulonglong) + sizeof(ulonglong) + sizeof(ulonglong) + sizeof(uchar)
|
||||
+ sizeof(ulonglong) + sizeof(ulonglong) + sizeof(ulonglong) + FN_REFLEN \
|
||||
+ sizeof(uchar)
|
||||
|
||||
/*
|
||||
uchar + uchar
|
||||
@@ -317,7 +315,8 @@ error:
|
||||
*/
|
||||
int ha_archive::read_meta_file(File meta_file, ha_rows *rows,
|
||||
ulonglong *auto_increment,
|
||||
ulonglong *forced_flushes)
|
||||
ulonglong *forced_flushes,
|
||||
char *real_path)
|
||||
{
|
||||
uchar meta_buffer[META_BUFFER_SIZE];
|
||||
uchar *ptr= meta_buffer;
|
||||
@@ -342,6 +341,8 @@ int ha_archive::read_meta_file(File meta_file, ha_rows *rows,
|
||||
ptr+= sizeof(ulonglong); // Move past auto_increment
|
||||
*forced_flushes= uint8korr(ptr);
|
||||
ptr+= sizeof(ulonglong); // Move past forced_flush
|
||||
memmove(real_path, ptr, FN_REFLEN);
|
||||
ptr+= FN_REFLEN; // Move past the possible location of the file
|
||||
|
||||
DBUG_PRINT("ha_archive::read_meta_file", ("Check %d", (uint)meta_buffer[0]));
|
||||
DBUG_PRINT("ha_archive::read_meta_file", ("Version %d", (uint)meta_buffer[1]));
|
||||
@@ -349,6 +350,7 @@ int ha_archive::read_meta_file(File meta_file, ha_rows *rows,
|
||||
DBUG_PRINT("ha_archive::read_meta_file", ("Checkpoint %llu", check_point));
|
||||
DBUG_PRINT("ha_archive::read_meta_file", ("Auto-Increment %llu", *auto_increment));
|
||||
DBUG_PRINT("ha_archive::read_meta_file", ("Forced Flushes %llu", *forced_flushes));
|
||||
DBUG_PRINT("ha_archive::read_meta_file", ("Real Path %s", real_path));
|
||||
DBUG_PRINT("ha_archive::read_meta_file", ("Dirty %d", (int)(*ptr)));
|
||||
|
||||
if ((meta_buffer[0] != (uchar)ARCHIVE_CHECK_HEADER) ||
|
||||
@@ -368,6 +370,7 @@ int ha_archive::read_meta_file(File meta_file, ha_rows *rows,
|
||||
int ha_archive::write_meta_file(File meta_file, ha_rows rows,
|
||||
ulonglong auto_increment,
|
||||
ulonglong forced_flushes,
|
||||
char *real_path,
|
||||
bool dirty)
|
||||
{
|
||||
uchar meta_buffer[META_BUFFER_SIZE];
|
||||
@@ -388,6 +391,12 @@ int ha_archive::write_meta_file(File meta_file, ha_rows rows,
|
||||
ptr += sizeof(ulonglong);
|
||||
int8store(ptr, forced_flushes);
|
||||
ptr += sizeof(ulonglong);
|
||||
// No matter what, we pad with nulls
|
||||
if (real_path)
|
||||
strncpy((char *)ptr, real_path, FN_REFLEN);
|
||||
else
|
||||
bzero(ptr, FN_REFLEN);
|
||||
ptr += FN_REFLEN;
|
||||
*ptr= (uchar)dirty;
|
||||
DBUG_PRINT("ha_archive::write_meta_file", ("Check %d",
|
||||
(uint)ARCHIVE_CHECK_HEADER));
|
||||
@@ -399,6 +408,8 @@ int ha_archive::write_meta_file(File meta_file, ha_rows rows,
|
||||
auto_increment));
|
||||
DBUG_PRINT("ha_archive::write_meta_file", ("Forced Flushes %llu",
|
||||
forced_flushes));
|
||||
DBUG_PRINT("ha_archive::write_meta_file", ("Real path %s",
|
||||
real_path));
|
||||
DBUG_PRINT("ha_archive::write_meta_file", ("Dirty %d", (uint)dirty));
|
||||
|
||||
VOID(my_seek(meta_file, 0, MY_SEEK_SET, MYF(0)));
|
||||
@@ -448,8 +459,12 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name,
|
||||
share->table_name_length= length;
|
||||
share->table_name= tmp_name;
|
||||
share->crashed= FALSE;
|
||||
fn_format(share->data_file_name,table_name,"",ARZ,MY_REPLACE_EXT|MY_UNPACK_FILENAME);
|
||||
fn_format(meta_file_name,table_name,"",ARM,MY_REPLACE_EXT|MY_UNPACK_FILENAME);
|
||||
fn_format(share->data_file_name, table_name, "",
|
||||
ARZ,MY_REPLACE_EXT|MY_UNPACK_FILENAME);
|
||||
fn_format(meta_file_name, table_name, "", ARM,
|
||||
MY_REPLACE_EXT|MY_UNPACK_FILENAME);
|
||||
DBUG_PRINT("info", ("archive opening (1) up write at %s",
|
||||
share->data_file_name));
|
||||
strmov(share->table_name,table_name);
|
||||
/*
|
||||
We will use this lock for rows.
|
||||
@@ -457,6 +472,8 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name,
|
||||
VOID(pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST));
|
||||
if ((share->meta_file= my_open(meta_file_name, O_RDWR, MYF(0))) == -1)
|
||||
share->crashed= TRUE;
|
||||
DBUG_PRINT("info", ("archive opening (1) up write at %s",
|
||||
share->data_file_name));
|
||||
|
||||
/*
|
||||
After we read, we set the file to dirty. When we close, we will do the
|
||||
@@ -465,13 +482,21 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name,
|
||||
*/
|
||||
if (read_meta_file(share->meta_file, &share->rows_recorded,
|
||||
&share->auto_increment_value,
|
||||
&share->forced_flushes))
|
||||
&share->forced_flushes,
|
||||
share->real_path))
|
||||
share->crashed= TRUE;
|
||||
else
|
||||
(void)write_meta_file(share->meta_file, share->rows_recorded,
|
||||
share->auto_increment_value,
|
||||
share->forced_flushes,
|
||||
share->real_path,
|
||||
TRUE);
|
||||
/*
|
||||
Since we now possibly no real_path, we will use it instead if it exists.
|
||||
*/
|
||||
if (*share->real_path)
|
||||
fn_format(share->data_file_name, share->real_path, "", ARZ,
|
||||
MY_REPLACE_EXT|MY_UNPACK_FILENAME);
|
||||
/*
|
||||
It is expensive to open and close the data files and since you can't have
|
||||
a gzip file that can be both read and written we keep a writer open
|
||||
@@ -527,6 +552,7 @@ int ha_archive::free_share(ARCHIVE_SHARE *share)
|
||||
(void)write_meta_file(share->meta_file, share->rows_recorded,
|
||||
share->auto_increment_value,
|
||||
share->forced_flushes,
|
||||
share->real_path,
|
||||
share->crashed ? TRUE :FALSE);
|
||||
if (azclose(&(share->archive_write)))
|
||||
rc= 1;
|
||||
@@ -566,7 +592,7 @@ int ha_archive::open(const char *name, int mode, uint open_options)
|
||||
int rc= 0;
|
||||
DBUG_ENTER("ha_archive::open");
|
||||
|
||||
DBUG_PRINT("info", ("archive table was opened for crash %s",
|
||||
DBUG_PRINT("info", ("archive table was opened for crash: %s",
|
||||
(open_options & HA_OPEN_FOR_REPAIR) ? "yes" : "no"));
|
||||
share= get_share(name, table, &rc);
|
||||
|
||||
@@ -582,6 +608,7 @@ int ha_archive::open(const char *name, int mode, uint open_options)
|
||||
|
||||
thr_lock_data_init(&share->lock,&lock,NULL);
|
||||
|
||||
DBUG_PRINT("info", ("archive data_file_name %s", share->data_file_name));
|
||||
if (!(azopen(&archive, share->data_file_name, O_RDONLY|O_BINARY)))
|
||||
{
|
||||
if (errno == EROFS || errno == EACCES)
|
||||
@@ -679,18 +706,40 @@ int ha_archive::create(const char *name, TABLE *table_arg,
|
||||
}
|
||||
}
|
||||
|
||||
write_meta_file(create_file, 0, auto_increment_value, 0, FALSE);
|
||||
write_meta_file(create_file, 0, auto_increment_value, 0,
|
||||
(char *)create_info->data_file_name,
|
||||
FALSE);
|
||||
my_close(create_file,MYF(0));
|
||||
|
||||
/*
|
||||
We reuse name_buff since it is available.
|
||||
*/
|
||||
if ((create_file= my_create(fn_format(name_buff,name,"",ARZ,
|
||||
MY_REPLACE_EXT|MY_UNPACK_FILENAME),0,
|
||||
O_RDWR | O_TRUNC,MYF(MY_WME))) < 0)
|
||||
if (create_info->data_file_name)
|
||||
{
|
||||
error= my_errno;
|
||||
goto error;
|
||||
char linkname[FN_REFLEN];
|
||||
DBUG_PRINT("info", ("archive will create stream file %s",
|
||||
create_info->data_file_name));
|
||||
|
||||
fn_format(name_buff, create_info->data_file_name, "", ARZ,
|
||||
MY_REPLACE_EXT|MY_UNPACK_FILENAME);
|
||||
fn_format(linkname, name, "", ARZ,
|
||||
MY_UNPACK_FILENAME | MY_APPEND_EXT);
|
||||
if ((create_file= my_create_with_symlink(linkname, name_buff, 0,
|
||||
O_RDWR | O_TRUNC,MYF(MY_WME))) < 0)
|
||||
{
|
||||
error= my_errno;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((create_file= my_create(fn_format(name_buff, name,"", ARZ,
|
||||
MY_REPLACE_EXT|MY_UNPACK_FILENAME),0,
|
||||
O_RDWR | O_TRUNC,MYF(MY_WME))) < 0)
|
||||
{
|
||||
error= my_errno;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
if (!azdopen(&archive, create_file, O_WRONLY|O_BINARY))
|
||||
{
|
||||
@@ -1348,8 +1397,10 @@ void ha_archive::update_create_info(HA_CREATE_INFO *create_info)
|
||||
ha_archive::info(HA_STATUS_AUTO | HA_STATUS_CONST);
|
||||
if (!(create_info->used_fields & HA_CREATE_USED_AUTO))
|
||||
{
|
||||
create_info->auto_increment_value=auto_increment_value;
|
||||
create_info->auto_increment_value= auto_increment_value;
|
||||
}
|
||||
if (*share->real_path)
|
||||
create_info->data_file_name= share->real_path;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ typedef struct st_archive_share {
|
||||
ulonglong auto_increment_value;
|
||||
ulonglong forced_flushes;
|
||||
ulonglong mean_rec_length;
|
||||
char real_path[FN_REFLEN];
|
||||
} ARCHIVE_SHARE;
|
||||
|
||||
/*
|
||||
@@ -102,10 +103,12 @@ public:
|
||||
int get_row(azio_stream *file_to_read, byte *buf);
|
||||
int read_meta_file(File meta_file, ha_rows *rows,
|
||||
ulonglong *auto_increment,
|
||||
ulonglong *forced_flushes);
|
||||
ulonglong *forced_flushes,
|
||||
char *real_path);
|
||||
int write_meta_file(File meta_file, ha_rows rows,
|
||||
ulonglong auto_increment,
|
||||
ulonglong forced_flushes,
|
||||
char *real_path,
|
||||
bool dirty);
|
||||
ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table, int *rc);
|
||||
int free_share(ARCHIVE_SHARE *share);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" { // Because of SCO 3.2V4.2
|
||||
#endif
|
||||
#if !defined( __WIN__) && !defined(OS2)
|
||||
#if !defined( __WIN__)
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
|
||||
@@ -2002,6 +2002,41 @@ longlong Item_date_add_interval::val_int()
|
||||
((date*100L + ltime.hour)*100L+ ltime.minute)*100L + ltime.second;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Item_date_add_interval::eq(const Item *item, bool binary_cmp) const
|
||||
{
|
||||
INTERVAL interval, other_interval;
|
||||
String val= value; // Because of const
|
||||
|
||||
if (this == item)
|
||||
return TRUE;
|
||||
|
||||
if ((item->type() != FUNC_ITEM) ||
|
||||
(arg_count != ((Item_func*) item)->arg_count) ||
|
||||
(func_name() != ((Item_func*) item)->func_name()))
|
||||
return FALSE;
|
||||
|
||||
Item_date_add_interval *other= (Item_date_add_interval*) item;
|
||||
|
||||
if ((int_type != other->int_type) ||
|
||||
(!args[0]->eq(other->args[0], binary_cmp)) ||
|
||||
(get_interval_value(args[1], int_type, &val, &interval)))
|
||||
return FALSE;
|
||||
|
||||
val= other->value;
|
||||
|
||||
if ((get_interval_value(other->args[1], other->int_type, &val,
|
||||
&other_interval)) ||
|
||||
((date_sub_interval ^ interval.neg) ^
|
||||
(other->date_sub_interval ^ other_interval.neg)))
|
||||
return FALSE;
|
||||
|
||||
// Assume comparing same types here due to earlier check
|
||||
return memcmp(&interval, &other_interval, sizeof(INTERVAL)) == 0;
|
||||
}
|
||||
|
||||
|
||||
static const char *interval_names[]=
|
||||
{
|
||||
"year", "quarter", "month", "day", "hour",
|
||||
|
||||
@@ -647,6 +647,7 @@ public:
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
longlong val_int();
|
||||
bool get_date(TIME *res, uint fuzzy_date);
|
||||
bool eq(const Item *item, bool binary_cmp) const;
|
||||
void print(String *str);
|
||||
};
|
||||
|
||||
|
||||
42
sql/log.cc
42
sql/log.cc
@@ -18,10 +18,6 @@
|
||||
/* logging of commands */
|
||||
/* TODO: Abort logging when we get an error in reading or writing log files */
|
||||
|
||||
#ifdef __EMX__
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "mysql_priv.h"
|
||||
#include "sql_repl.h"
|
||||
#include "rpl_filter.h"
|
||||
@@ -680,20 +676,36 @@ bool LOGGER::flush_logs(THD *thd)
|
||||
/* reopen log files */
|
||||
file_log_handler->flush();
|
||||
|
||||
/*
|
||||
this will lock and wait for all but the logger thread to release the
|
||||
tables. Then we could reopen log tables. Then release the name locks.
|
||||
*/
|
||||
lock_and_wait_for_table_name(thd, &close_slow_log);
|
||||
lock_and_wait_for_table_name(thd, &close_general_log);
|
||||
/* flush tables, in the case they are enabled */
|
||||
if (logger.is_log_tables_initialized)
|
||||
{
|
||||
/*
|
||||
This will lock and wait for all but the logger thread to release the
|
||||
tables. Then we could reopen log tables. Then release the name locks.
|
||||
|
||||
/* deny others from logging to general and slow log, while reopening tables */
|
||||
logger.lock();
|
||||
NOTE: in fact, the first parameter used in lock_and_wait_for_table_name()
|
||||
and table_log_handler->flush() could be any non-NULL THD, as the
|
||||
underlying code makes certain assumptions about this.
|
||||
Here we use one of the logger handler THD's. Simply because it
|
||||
seems appropriate.
|
||||
*/
|
||||
lock_and_wait_for_table_name(table_log_handler->general_log_thd,
|
||||
&close_slow_log);
|
||||
lock_and_wait_for_table_name(table_log_handler->general_log_thd,
|
||||
&close_general_log);
|
||||
|
||||
table_log_handler->flush(thd, &close_slow_log, &close_general_log);
|
||||
/*
|
||||
Deny others from logging to general and slow log,
|
||||
while reopening tables.
|
||||
*/
|
||||
logger.lock();
|
||||
|
||||
/* end of log tables flush */
|
||||
logger.unlock();
|
||||
table_log_handler->flush(table_log_handler->general_log_thd,
|
||||
&close_slow_log, &close_general_log);
|
||||
|
||||
/* end of log tables flush */
|
||||
logger.unlock();
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,6 @@
|
||||
#ifndef _log_event_h
|
||||
#define _log_event_h
|
||||
|
||||
#ifdef __EMX__
|
||||
#undef write // remove pthread.h macro definition, conflict with write() class member
|
||||
#endif
|
||||
|
||||
#if defined(USE_PRAGMA_INTERFACE) && !defined(MYSQL_CLIENT)
|
||||
#pragma interface /* gcc class implementation */
|
||||
#endif
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#if defined(__EMX__) || defined(__NETWARE__)
|
||||
#if defined(__NETWARE__)
|
||||
#include "../mysys/my_lock.c"
|
||||
#else
|
||||
|
||||
|
||||
@@ -36,10 +36,6 @@
|
||||
#include "sql_bitmap.h"
|
||||
#include "sql_array.h"
|
||||
|
||||
#ifdef __EMX__
|
||||
#undef write /* remove pthread.h macro definition for EMX */
|
||||
#endif
|
||||
|
||||
/* TODO convert all these three maps to Bitmap classes */
|
||||
typedef ulonglong table_map; /* Used for table bits in join */
|
||||
#if MAX_INDEXES <= 64
|
||||
@@ -206,7 +202,7 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
|
||||
#define IF_NETWARE(A,B) (B)
|
||||
#endif
|
||||
|
||||
#if defined(__WIN__) || defined(OS2)
|
||||
#if defined(__WIN__)
|
||||
#define IF_WIN(A,B) (A)
|
||||
#undef FLUSH_TIME
|
||||
#define FLUSH_TIME 1800 /* Flush every half hour */
|
||||
|
||||
118
sql/mysqld.cc
118
sql/mysqld.cc
@@ -95,9 +95,7 @@ extern "C" { // Because of SCO 3.2V4.2
|
||||
#endif
|
||||
#include <my_net.h>
|
||||
|
||||
#if defined(OS2)
|
||||
# include <sys/un.h>
|
||||
#elif !defined(__WIN__)
|
||||
#if !defined(__WIN__)
|
||||
# ifndef __NETWARE__
|
||||
#include <sys/resource.h>
|
||||
# endif /* __NETWARE__ */
|
||||
@@ -648,10 +646,6 @@ static SECURITY_DESCRIPTOR sdPipeDescriptor;
|
||||
static HANDLE hPipe = INVALID_HANDLE_VALUE;
|
||||
#endif
|
||||
|
||||
#ifdef OS2
|
||||
pthread_cond_t eventShutdown;
|
||||
#endif
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
bool mysqld_embedded=0;
|
||||
#else
|
||||
@@ -751,7 +745,7 @@ static void close_connections(void)
|
||||
(void) pthread_mutex_unlock(&LOCK_manager);
|
||||
|
||||
/* kill connection thread */
|
||||
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
DBUG_PRINT("quit",("waiting for select thread: 0x%lx",select_thread));
|
||||
(void) pthread_mutex_lock(&LOCK_thread_count);
|
||||
|
||||
@@ -980,8 +974,6 @@ void kill_mysql(void)
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
#elif defined(OS2)
|
||||
pthread_cond_signal(&eventShutdown); // post semaphore
|
||||
#elif defined(HAVE_PTHREAD_KILL)
|
||||
if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL))
|
||||
{
|
||||
@@ -1007,7 +999,7 @@ void kill_mysql(void)
|
||||
|
||||
/* Force server down. kill all connections and threads and exit */
|
||||
|
||||
#if defined(OS2) || defined(__NETWARE__)
|
||||
#if defined(__NETWARE__)
|
||||
extern "C" void kill_server(int sig_ptr)
|
||||
#define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN
|
||||
#elif !defined(__WIN__)
|
||||
@@ -1044,7 +1036,7 @@ static void __cdecl kill_server(int sig_ptr)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__NETWARE__) || (defined(USE_ONE_SIGNAL_HAND) && !defined(__WIN__) && !defined(OS2))
|
||||
#if defined(__NETWARE__) || (defined(USE_ONE_SIGNAL_HAND) && !defined(__WIN__))
|
||||
my_thread_init(); // If this is a new thread
|
||||
#endif
|
||||
close_connections();
|
||||
@@ -1082,7 +1074,7 @@ extern "C" sig_handler print_signal_warning(int sig)
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
my_sigset(sig,print_signal_warning); /* int. thread system calls */
|
||||
#endif
|
||||
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
if (sig == SIGALRM)
|
||||
alarm(2); /* reschedule alarm */
|
||||
#endif
|
||||
@@ -1336,7 +1328,7 @@ static void set_ports()
|
||||
|
||||
static struct passwd *check_user(const char *user)
|
||||
{
|
||||
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
struct passwd *user_info;
|
||||
uid_t user_id= geteuid();
|
||||
|
||||
@@ -1390,7 +1382,7 @@ err:
|
||||
|
||||
static void set_user(const char *user, struct passwd *user_info)
|
||||
{
|
||||
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
DBUG_ASSERT(user_info != 0);
|
||||
#ifdef HAVE_INITGROUPS
|
||||
/*
|
||||
@@ -1419,7 +1411,7 @@ static void set_user(const char *user, struct passwd *user_info)
|
||||
|
||||
static void set_effective_user(struct passwd *user_info)
|
||||
{
|
||||
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
DBUG_ASSERT(user_info != 0);
|
||||
if (setregid((gid_t)-1, user_info->pw_gid) == -1)
|
||||
{
|
||||
@@ -1439,7 +1431,7 @@ static void set_effective_user(struct passwd *user_info)
|
||||
|
||||
static void set_root(const char *path)
|
||||
{
|
||||
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
if (chroot(path) == -1)
|
||||
{
|
||||
sql_perror("chroot");
|
||||
@@ -1786,7 +1778,7 @@ extern "C" sig_handler abort_thread(int sig __attribute__((unused)))
|
||||
the signal thread is ready before continuing
|
||||
******************************************************************************/
|
||||
|
||||
#if defined(__WIN__) || defined(OS2)
|
||||
#if defined(__WIN__)
|
||||
static void init_signals(void)
|
||||
{
|
||||
int signals[] = {SIGINT,SIGILL,SIGFPE,SIGSEGV,SIGTERM,SIGABRT } ;
|
||||
@@ -2046,44 +2038,7 @@ static void check_data_home(const char *path)
|
||||
{
|
||||
}
|
||||
|
||||
#elif defined(__EMX__)
|
||||
static void sig_reload(int signo)
|
||||
{
|
||||
// Flush everything
|
||||
bool not_used;
|
||||
reload_acl_and_cache((THD*) 0,REFRESH_LOG, (TABLE_LIST*) 0, ¬_used);
|
||||
signal(signo, SIG_ACK);
|
||||
}
|
||||
|
||||
static void sig_kill(int signo)
|
||||
{
|
||||
if (!kill_in_progress)
|
||||
{
|
||||
abort_loop=1; // mark abort for threads
|
||||
kill_server((void*) signo);
|
||||
}
|
||||
signal(signo, SIG_ACK);
|
||||
}
|
||||
|
||||
static void init_signals(void)
|
||||
{
|
||||
signal(SIGQUIT, sig_kill);
|
||||
signal(SIGKILL, sig_kill);
|
||||
signal(SIGTERM, sig_kill);
|
||||
signal(SIGINT, sig_kill);
|
||||
signal(SIGHUP, sig_reload); // Flush everything
|
||||
signal(SIGALRM, SIG_IGN);
|
||||
signal(SIGBREAK,SIG_IGN);
|
||||
signal_thread = pthread_self();
|
||||
}
|
||||
|
||||
static void start_signal_handler(void)
|
||||
{}
|
||||
|
||||
static void check_data_home(const char *path)
|
||||
{}
|
||||
|
||||
#else /* if ! __WIN__ && ! __EMX__ */
|
||||
#else /* if ! __WIN__ */
|
||||
|
||||
#ifdef HAVE_LINUXTHREADS
|
||||
#define UNSAFE_DEFAULT_LINUX_THREADS 200
|
||||
@@ -2556,33 +2511,6 @@ int STDCALL handle_kill(ulong ctrl_type)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef OS2
|
||||
pthread_handler_t handle_shutdown(void *arg)
|
||||
{
|
||||
my_thread_init();
|
||||
|
||||
// wait semaphore
|
||||
pthread_cond_wait(&eventShutdown, NULL);
|
||||
|
||||
// close semaphore and kill server
|
||||
pthread_cond_destroy(&eventShutdown);
|
||||
|
||||
/*
|
||||
Exit main loop on main thread, so kill will be done from
|
||||
main thread (this is thread 2)
|
||||
*/
|
||||
abort_loop = 1;
|
||||
|
||||
// unblock select()
|
||||
so_cancel(ip_sock);
|
||||
so_cancel(unix_sock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static const char *load_default_groups[]= {
|
||||
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
|
||||
"mysql_cluster",
|
||||
@@ -2650,14 +2578,6 @@ static int init_common_variables(const char *conf_file_name, int argc,
|
||||
return 1;
|
||||
mysql_init_variables();
|
||||
|
||||
#ifdef OS2
|
||||
{
|
||||
// fix timezone for daylight saving
|
||||
struct tm *ts = localtime(&start_time);
|
||||
if (ts->tm_isdst > 0)
|
||||
_timezone -= 3600;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_TZNAME
|
||||
{
|
||||
struct tm tm_tmp;
|
||||
@@ -3360,12 +3280,6 @@ static void create_shutdown_thread()
|
||||
// On "Stop Service" we have to do regular shutdown
|
||||
Service.SetShutdownEvent(hEventShutdown);
|
||||
#endif
|
||||
#ifdef OS2
|
||||
pthread_cond_init(&eventShutdown, NULL);
|
||||
pthread_t hThread;
|
||||
if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0))
|
||||
sql_print_warning("Can't create thread to handle shutdown requests");
|
||||
#endif
|
||||
#endif // EMBEDDED_LIBRARY
|
||||
}
|
||||
|
||||
@@ -4292,10 +4206,6 @@ pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused)))
|
||||
create_new_thread(thd);
|
||||
}
|
||||
|
||||
#ifdef OS2
|
||||
// kill server must be invoked from thread 1!
|
||||
kill_server(MYSQL_KILL_SIGNAL);
|
||||
#endif
|
||||
decrement_handler_count();
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
@@ -5666,7 +5576,7 @@ log and this option does nothing anymore.",
|
||||
0, 0, 0, 0, 0},
|
||||
{"tmpdir", 't',
|
||||
"Path for temporary files. Several paths may be specified, separated by a "
|
||||
#if defined(__WIN__) || defined(OS2) || defined(__NETWARE__)
|
||||
#if defined(__WIN__) || defined(__NETWARE__)
|
||||
"semicolon (;)"
|
||||
#else
|
||||
"colon (:)"
|
||||
@@ -6864,6 +6774,10 @@ SHOW_VAR status_vars[]= {
|
||||
static void print_version(void)
|
||||
{
|
||||
set_server_version();
|
||||
/*
|
||||
Note: the instance manager keys off the string 'Ver' so it can find the
|
||||
version from the output of 'mysqld --version', so don't change it!
|
||||
*/
|
||||
printf("%s Ver %s for %s on %s (%s)\n",my_progname,
|
||||
server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT);
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ my_bool my_net_init(NET *net, Vio* vio)
|
||||
if (vio != 0) /* If real connection */
|
||||
{
|
||||
net->fd = vio_fd(vio); /* For perl DBI/DBD */
|
||||
#if defined(MYSQL_SERVER) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
|
||||
#if defined(MYSQL_SERVER) && !defined(__WIN__)
|
||||
if (!(test_flags & TEST_BLOCKING))
|
||||
{
|
||||
my_bool old_mode;
|
||||
@@ -604,7 +604,7 @@ net_real_write(NET *net,const char *packet,ulong len)
|
||||
if ((long) (length=vio_write(net->vio,pos,(uint32) (end-pos))) <= 0)
|
||||
{
|
||||
my_bool interrupted = vio_should_retry(net->vio);
|
||||
#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2))
|
||||
#if !defined(__WIN__)
|
||||
if ((interrupted || length==0) && !thr_alarm_in_use(&alarmed))
|
||||
{
|
||||
if (!thr_alarm(&alarmed,(uint) net->write_timeout,&alarm_buff))
|
||||
@@ -631,7 +631,7 @@ net_real_write(NET *net,const char *packet,ulong len)
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* (!defined(__WIN__) && !defined(__EMX__)) */
|
||||
#endif /* !defined(__WIN__) */
|
||||
if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
|
||||
interrupted)
|
||||
{
|
||||
@@ -803,7 +803,7 @@ my_real_read(NET *net, ulong *complen)
|
||||
|
||||
DBUG_PRINT("info",("vio_read returned %d, errno: %d",
|
||||
length, vio_errno(net->vio)));
|
||||
#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2)) || defined(MYSQL_SERVER)
|
||||
#if !defined(__WIN__) || defined(MYSQL_SERVER)
|
||||
/*
|
||||
We got an error that there was no data on the socket. We now set up
|
||||
an alarm to not 'read forever', change the socket to non blocking
|
||||
@@ -839,7 +839,7 @@ my_real_read(NET *net, ulong *complen)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif /* (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER) */
|
||||
#endif /* (!defined(__WIN__) || defined(MYSQL_SERVER) */
|
||||
if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
|
||||
interrupted)
|
||||
{ /* Probably in MIT threads */
|
||||
|
||||
@@ -83,7 +83,7 @@ static int init_failsafe_rpl_thread(THD* thd)
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
sigset_t set;
|
||||
VOID(sigemptyset(&set)); // Get mask in use
|
||||
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
|
||||
|
||||
@@ -5826,6 +5826,9 @@ ER_NDB_CANT_SWITCH_BINLOG_FORMAT
|
||||
eng "The NDB cluster engine does not support changing the binlog format on the fly yet"
|
||||
ER_PARTITION_NO_TEMPORARY
|
||||
eng "Cannot create temporary table with partitions"
|
||||
ER_NULL_IN_VALUES_LESS_THAN
|
||||
eng "Not allowed to use NULL value in VALUES LESS THAN"
|
||||
swe "Det <20>r inte till<6C>tet att anv<6E>nda NULL-v<>rden i VALUES LESS THAN"
|
||||
ER_WRONG_PARTITION_NAME
|
||||
eng "Incorrect partition name"
|
||||
swe "Felaktigt partitionsnamn"
|
||||
|
||||
@@ -2601,7 +2601,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
sigset_t set;
|
||||
VOID(sigemptyset(&set)); // Get mask in use
|
||||
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
|
||||
|
||||
@@ -3000,13 +3000,13 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
|
||||
|
||||
if (table)
|
||||
{
|
||||
#if defined( __WIN__) || defined(OS2)
|
||||
#if defined( __WIN__)
|
||||
/* Win32 can't drop a file that is open */
|
||||
if (lock_type == TL_WRITE_ALLOW_READ)
|
||||
{
|
||||
lock_type= TL_WRITE;
|
||||
}
|
||||
#endif /* __WIN__ || OS2 */
|
||||
#endif /* __WIN__ */
|
||||
table_list->lock_type= lock_type;
|
||||
table_list->table= table;
|
||||
table->grant= table_list->grant;
|
||||
|
||||
@@ -1713,7 +1713,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
|
||||
since it does not find one in the list.
|
||||
*/
|
||||
pthread_mutex_lock(&di->mutex);
|
||||
#if !defined( __WIN__) && !defined(OS2) /* Win32 calls this in pthread_create */
|
||||
#if !defined( __WIN__) /* Win32 calls this in pthread_create */
|
||||
if (my_thread_init())
|
||||
{
|
||||
strmov(thd->net.last_error,ER(thd->net.last_errno=ER_OUT_OF_RESOURCES));
|
||||
@@ -1729,7 +1729,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
|
||||
strmov(thd->net.last_error,ER(thd->net.last_errno=ER_OUT_OF_RESOURCES));
|
||||
goto err;
|
||||
}
|
||||
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
sigset_t set;
|
||||
VOID(sigemptyset(&set)); // Get mask in use
|
||||
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
|
||||
|
||||
@@ -294,7 +294,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
{
|
||||
(void) fn_format(name, ex->file_name, mysql_real_data_home, "",
|
||||
MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
|
||||
#if !defined(__WIN__) && !defined(OS2) && ! defined(__NETWARE__)
|
||||
#if !defined(__WIN__) && ! defined(__NETWARE__)
|
||||
MY_STAT stat_info;
|
||||
if (!my_stat(name,&stat_info,MYF(MY_WME)))
|
||||
DBUG_RETURN(TRUE);
|
||||
@@ -302,9 +302,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
// if we are not in slave thread, the file must be:
|
||||
if (!thd->slave_thread &&
|
||||
!((stat_info.st_mode & S_IROTH) == S_IROTH && // readable by others
|
||||
#ifndef __EMX__
|
||||
(stat_info.st_mode & S_IFLNK) != S_IFLNK && // and not a symlink
|
||||
#endif
|
||||
((stat_info.st_mode & S_IFREG) == S_IFREG ||
|
||||
(stat_info.st_mode & S_IFIFO) == S_IFIFO)))
|
||||
{
|
||||
|
||||
@@ -118,10 +118,6 @@ static void test_signal(int sig_ptr)
|
||||
#if !defined( DBUG_OFF)
|
||||
MessageBox(NULL,"Test signal","DBUG",MB_OK);
|
||||
#endif
|
||||
#if defined(OS2)
|
||||
fprintf(stderr, "Test signal %d\n", sig_ptr);
|
||||
fflush(stderr);
|
||||
#endif
|
||||
}
|
||||
static void init_signals(void)
|
||||
{
|
||||
@@ -1092,7 +1088,7 @@ pthread_handler_t handle_one_connection(void *arg)
|
||||
|
||||
pthread_detach_this_thread();
|
||||
|
||||
#if !defined( __WIN__) && !defined(OS2) // Win32 calls this in pthread_create
|
||||
#if !defined( __WIN__) // Win32 calls this in pthread_create
|
||||
/* The following calls needs to be done before we call DBUG_ macros */
|
||||
if (!(test_flags & TEST_NO_THREADS) & my_thread_init())
|
||||
{
|
||||
@@ -1116,7 +1112,7 @@ pthread_handler_t handle_one_connection(void *arg)
|
||||
|
||||
#if defined(__WIN__)
|
||||
init_signals();
|
||||
#elif !defined(OS2) && !defined(__NETWARE__)
|
||||
#elif !defined(__NETWARE__)
|
||||
sigset_t set;
|
||||
VOID(sigemptyset(&set)); // Get mask in use
|
||||
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
|
||||
@@ -1240,7 +1236,7 @@ pthread_handler_t handle_bootstrap(void *arg)
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
pthread_detach_this_thread();
|
||||
thd->thread_stack= (char*) &thd;
|
||||
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
sigset_t set;
|
||||
VOID(sigemptyset(&set)); // Get mask in use
|
||||
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
|
||||
@@ -1969,9 +1965,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
#ifdef __WIN__
|
||||
sleep(1); // must wait after eof()
|
||||
#endif
|
||||
#ifndef OS2
|
||||
send_eof(thd); // This is for 'quit request'
|
||||
#endif
|
||||
close_connection(thd, 0, 1);
|
||||
close_thread_tables(thd); // Free before kill
|
||||
kill_mysql();
|
||||
|
||||
@@ -529,8 +529,16 @@ static int plugin_initialize(struct st_plugin_int *plugin)
|
||||
switch (plugin->plugin->type)
|
||||
{
|
||||
case MYSQL_STORAGE_ENGINE_PLUGIN:
|
||||
sql_print_error("Storage Engine plugins are unsupported in this version.");
|
||||
goto err;
|
||||
if (ha_initialize_handlerton((handlerton*) plugin->plugin->info))
|
||||
{
|
||||
sql_print_error("Plugin '%s' handlerton init returned error.",
|
||||
plugin->name.str);
|
||||
DBUG_PRINT("warning", ("Plugin '%s' handlerton init returned error.",
|
||||
plugin->name.str));
|
||||
goto err;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3625,11 +3625,7 @@ err:
|
||||
|
||||
bool mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
#ifdef OS2
|
||||
thr_lock_type lock_type = TL_WRITE;
|
||||
#else
|
||||
thr_lock_type lock_type = TL_READ_NO_INSERT;
|
||||
#endif
|
||||
|
||||
DBUG_ENTER("mysql_analyze_table");
|
||||
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
|
||||
@@ -3640,11 +3636,7 @@ bool mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
||||
|
||||
bool mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
#ifdef OS2
|
||||
thr_lock_type lock_type = TL_WRITE;
|
||||
#else
|
||||
thr_lock_type lock_type = TL_READ_NO_INSERT;
|
||||
#endif
|
||||
|
||||
DBUG_ENTER("mysql_check_table");
|
||||
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
|
||||
@@ -4998,7 +4990,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
}
|
||||
}
|
||||
|
||||
#if (!defined( __WIN__) && !defined( __EMX__) && !defined( OS2))
|
||||
#if !defined( __WIN__)
|
||||
if (table->file->has_transactions())
|
||||
#endif
|
||||
{
|
||||
@@ -5011,7 +5003,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
table=0; // Marker that table is closed
|
||||
no_table_reopen= TRUE;
|
||||
}
|
||||
#if (!defined( __WIN__) && !defined( __EMX__) && !defined( OS2))
|
||||
#if !defined( __WIN__)
|
||||
else
|
||||
table->file->extra(HA_EXTRA_FORCE_REOPEN); // Don't use this file anymore
|
||||
#endif
|
||||
|
||||
@@ -3721,6 +3721,11 @@ part_func_max:
|
||||
yyerror(ER(ER_PARTITION_MAXVALUE_ERROR));
|
||||
YYABORT;
|
||||
}
|
||||
if (Lex->part_info->curr_part_elem->has_null_value)
|
||||
{
|
||||
yyerror(ER(ER_NULL_IN_VALUES_LESS_THAN));
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user