mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Use new bitmap interface
Patches for Armstrong Removed warnings when using REPAIR TABLE .. EXTENDED
This commit is contained in:
@ -41096,6 +41096,8 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
|
|||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@item
|
||||||
|
Changed output format of @code{SHOW OPEN TABLES}.
|
||||||
|
@item
|
||||||
Allow @code{SELECT expression LIMIT ...}.
|
Allow @code{SELECT expression LIMIT ...}.
|
||||||
@item
|
@item
|
||||||
Added @code{IDENTITY} as a synonym for @code{AUTO_INCREMENT} (like SyBase).
|
Added @code{IDENTITY} as a synonym for @code{AUTO_INCREMENT} (like SyBase).
|
||||||
@ -41175,6 +41177,8 @@ not yet 100 % confident in this code.
|
|||||||
@appendixsubsec Changes in release 3.23.33
|
@appendixsubsec Changes in release 3.23.33
|
||||||
@itemize bullet
|
@itemize bullet
|
||||||
@item
|
@item
|
||||||
|
Removed warnings when running @code{REPAIR TABLE .. EXTENDED}.
|
||||||
|
@item
|
||||||
Fixed core-dump bug when using @code{GROUP BY} on an alias, where
|
Fixed core-dump bug when using @code{GROUP BY} on an alias, where
|
||||||
the alias was the same as an existing column name.
|
the alias was the same as an existing column name.
|
||||||
@item
|
@item
|
||||||
|
@ -879,9 +879,9 @@ then
|
|||||||
MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
|
MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
|
||||||
if expr "$CC" : ".*gcc.*"
|
if expr "$CC" : ".*gcc.*"
|
||||||
then
|
then
|
||||||
with_named_thread="-pthread -lnsl"
|
with_named_thread="-pthread -lsocket -lnsl"
|
||||||
else
|
else
|
||||||
with_named_thread="-Kthread -lnsl"
|
with_named_thread="-Kthread -lsocket -lnsl"
|
||||||
fi
|
fi
|
||||||
if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
|
if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
|
||||||
then
|
then
|
||||||
@ -923,7 +923,7 @@ then
|
|||||||
if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so
|
if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so
|
||||||
then
|
then
|
||||||
MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
|
MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
|
||||||
with_named_thread="-Kthread -lnsl"
|
with_named_thread="-Kthread -lsocket -lnsl"
|
||||||
if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
|
if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
|
||||||
then
|
then
|
||||||
AC_DEFINE(HAVE_UNIXWARE7_THREADS)
|
AC_DEFINE(HAVE_UNIXWARE7_THREADS)
|
||||||
|
@ -811,6 +811,28 @@ typedef union {
|
|||||||
#else
|
#else
|
||||||
#define float4get(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float))
|
#define float4get(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float))
|
||||||
#define float4store(V,M) memcpy_fixed((byte*) V,(byte*) (&M),sizeof(float))
|
#define float4store(V,M) memcpy_fixed((byte*) V,(byte*) (&M),sizeof(float))
|
||||||
|
|
||||||
|
#if (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
|
||||||
|
#define doublestore(T,V) { *(T)= ((byte *) &V)[4];\
|
||||||
|
*((T)+1)=(char) ((byte *) &V)[5];\
|
||||||
|
*((T)+2)=(char) ((byte *) &V)[6];\
|
||||||
|
*((T)+3)=(char) ((byte *) &V)[7];\
|
||||||
|
*((T)+4)=(char) ((byte *) &V)[0];\
|
||||||
|
*((T)+5)=(char) ((byte *) &V)[1];\
|
||||||
|
*((T)+6)=(char) ((byte *) &V)[2];\
|
||||||
|
*((T)+7)=(char) ((byte *) &V)[3]; }
|
||||||
|
#define doubleget(V,M) { double def_temp;\
|
||||||
|
((byte*) &def_temp)[0]=(M)[4];\
|
||||||
|
((byte*) &def_temp)[1]=(M)[5];\
|
||||||
|
((byte*) &def_temp)[2]=(M)[6];\
|
||||||
|
((byte*) &def_temp)[3]=(M)[7];\
|
||||||
|
((byte*) &def_temp)[4]=(M)[0];\
|
||||||
|
((byte*) &def_temp)[5]=(M)[1];\
|
||||||
|
((byte*) &def_temp)[6]=(M)[2];\
|
||||||
|
((byte*) &def_temp)[7]=(M)[3];\
|
||||||
|
(V) = def_temp; }
|
||||||
|
#endif /* __FLOAT_WORD_ORDER */
|
||||||
|
|
||||||
#define float8get(V,M) doubleget((V),(M))
|
#define float8get(V,M) doubleget((V),(M))
|
||||||
#define float8store(V,M) doublestore((V),(M))
|
#define float8store(V,M) doublestore((V),(M))
|
||||||
#endif /* WORDS_BIGENDIAN */
|
#endif /* WORDS_BIGENDIAN */
|
||||||
@ -863,7 +885,7 @@ typedef union {
|
|||||||
#ifndef doubleget
|
#ifndef doubleget
|
||||||
#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
|
#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
|
||||||
#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
|
#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
|
||||||
#endif
|
#endif /* doubleget */
|
||||||
#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
|
#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
|
||||||
#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
|
#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
|
||||||
|
|
||||||
|
@ -18,18 +18,29 @@
|
|||||||
#ifndef _my_bitmap_h_
|
#ifndef _my_bitmap_h_
|
||||||
#define _my_bitmap_h_
|
#define _my_bitmap_h_
|
||||||
|
|
||||||
#define MY_BIT_NONE ~(uint)0
|
#include <my_pthread.h>
|
||||||
|
|
||||||
|
#define MY_BIT_NONE (~(uint) 0)
|
||||||
|
|
||||||
|
typedef struct st_bitmap
|
||||||
|
{
|
||||||
|
uchar *bitmap;
|
||||||
|
uint bitmap_size;
|
||||||
|
#ifdef THREAD
|
||||||
|
pthread_mutex_t mutex;
|
||||||
|
#endif
|
||||||
|
} BITMAP;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
extern my_bool bitmap_init(BITMAP *bitmap, uint bitmap_size);
|
||||||
extern void bitmap_set_bit(uchar *bitmap, uint bitmap_size, uint bitmap_bit);
|
extern void bitmap_free(BITMAP *bitmap);
|
||||||
extern uint bitmap_set_next(uchar *bitmap, uint bitmap_size);
|
extern void bitmap_set_bit(BITMAP *bitmap, uint bitmap_bit);
|
||||||
extern void bitmap_clear_bit(uchar *bitmap,uint bitmap_size,uint bitmap_bit);
|
extern uint bitmap_set_next(BITMAP *bitmap);
|
||||||
|
extern void bitmap_clear_bit(BITMAP *bitmap, uint bitmap_bit);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif /* _my_bitmap_h_ */
|
||||||
|
@ -167,6 +167,28 @@
|
|||||||
((byte*) &def_temp)[3]=(M)[0];\
|
((byte*) &def_temp)[3]=(M)[0];\
|
||||||
(V)=def_temp; }
|
(V)=def_temp; }
|
||||||
|
|
||||||
|
#if (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
|
||||||
|
#define mi_float8store(T,V) { *(T)= ((byte *) &V)[3];\
|
||||||
|
*((T)+1)=(char) ((byte *) &V)[2];\
|
||||||
|
*((T)+2)=(char) ((byte *) &V)[1];\
|
||||||
|
*((T)+3)=(char) ((byte *) &V)[0];\
|
||||||
|
*((T)+4)=(char) ((byte *) &V)[7];\
|
||||||
|
*((T)+5)=(char) ((byte *) &V)[6];\
|
||||||
|
*((T)+6)=(char) ((byte *) &V)[5];\
|
||||||
|
*((T)+7)=(char) ((byte *) &V)[4];}
|
||||||
|
|
||||||
|
#define mi_float8get(V,M) { double def_temp;\
|
||||||
|
((byte*) &def_temp)[0]=(M)[3];\
|
||||||
|
((byte*) &def_temp)[1]=(M)[2];\
|
||||||
|
((byte*) &def_temp)[2]=(M)[1];\
|
||||||
|
((byte*) &def_temp)[3]=(M)[0];\
|
||||||
|
((byte*) &def_temp)[4]=(M)[7];\
|
||||||
|
((byte*) &def_temp)[5]=(M)[6];\
|
||||||
|
((byte*) &def_temp)[6]=(M)[5];\
|
||||||
|
((byte*) &def_temp)[7]=(M)[4];\
|
||||||
|
(V)=def_temp; }
|
||||||
|
|
||||||
|
#else
|
||||||
#define mi_float8store(T,V) { *(T)= ((byte *) &V)[7];\
|
#define mi_float8store(T,V) { *(T)= ((byte *) &V)[7];\
|
||||||
*((T)+1)=(char) ((byte *) &V)[6];\
|
*((T)+1)=(char) ((byte *) &V)[6];\
|
||||||
*((T)+2)=(char) ((byte *) &V)[5];\
|
*((T)+2)=(char) ((byte *) &V)[5];\
|
||||||
@ -186,7 +208,8 @@
|
|||||||
((byte*) &def_temp)[6]=(M)[1];\
|
((byte*) &def_temp)[6]=(M)[1];\
|
||||||
((byte*) &def_temp)[7]=(M)[0];\
|
((byte*) &def_temp)[7]=(M)[0];\
|
||||||
(V)=def_temp; }
|
(V)=def_temp; }
|
||||||
#endif
|
#endif /* __FLOAT_WORD_ORDER */
|
||||||
|
#endif /* WORDS_BIGENDIAN */
|
||||||
|
|
||||||
/* Fix to avoid warnings when sizeof(ha_rows) == sizeof(long) */
|
/* Fix to avoid warnings when sizeof(ha_rows) == sizeof(long) */
|
||||||
|
|
||||||
|
@ -1291,8 +1291,10 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
|
|||||||
# The next should give an error
|
# The next should give an error
|
||||||
#
|
#
|
||||||
|
|
||||||
!$1072 explain select fld3 from t2 ignore index (fld3,not_used);
|
-- error 1072
|
||||||
!$1072 explain select fld3 from t2 use index (not_used);
|
explain select fld3 from t2 ignore index (fld3,not_used);
|
||||||
|
-- error 1072
|
||||||
|
explain select fld3 from t2 use index (not_used);
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test sorting with a used key (there is no need for sorting)
|
# Test sorting with a used key (there is no need for sorting)
|
||||||
|
@ -20,33 +20,58 @@
|
|||||||
We assume that the size of the used bitmap is less than ~(uint) 0
|
We assume that the size of the used bitmap is less than ~(uint) 0
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
|
Make assembler THREAD safe versions of these using test-and-set instructions
|
||||||
create an unique structure for this that includes the mutex and bitmap size
|
|
||||||
make a init function that will allocate the bitmap and init the mutex
|
|
||||||
make an end function that will free everything
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mysys_priv.h"
|
#include "mysys_priv.h"
|
||||||
#include <my_bitmap.h>
|
#include <my_bitmap.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
pthread_mutex_t LOCK_bitmap;
|
pthread_mutex_t LOCK_bitmap;
|
||||||
|
|
||||||
void bitmap_set_bit(uchar *bitmap, uint bitmap_size, uint bitmap_bit)
|
my_bool bitmap_init(BITMAP *map, uint bitmap_size)
|
||||||
{
|
{
|
||||||
if (bitmap_bit < bitmap_size*8)
|
if (!(map->bitmap=(uchar*) my_malloc((bitmap_size+7)/8,MYF(MY_WME))))
|
||||||
|
return 1;
|
||||||
|
dbug_assert(bitmap_size != ~(uint) 0);
|
||||||
|
#ifdef THREAD
|
||||||
|
pthread_mutex_init(&map->mutex, NULL);
|
||||||
|
#endif
|
||||||
|
map->bitmap_size=bitmap_size;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bitmap_free(BITMAP *map)
|
||||||
|
{
|
||||||
|
if (map->bitmap)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&LOCK_bitmap);
|
my_free((char*) map->bitmap, MYF(0));
|
||||||
bitmap[bitmap_bit / 8] |= (1 << (bitmap_bit & 7));
|
map->bitmap=0;
|
||||||
pthread_mutex_unlock(&LOCK_bitmap);
|
#ifdef THREAD
|
||||||
|
pthread_mutex_destroy(&map->mutex);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint bitmap_set_next(uchar *bitmap, uint bitmap_size)
|
void bitmap_set_bit(BITMAP *map, uint bitmap_bit)
|
||||||
{
|
{
|
||||||
|
if (bitmap_bit < map->bitmap_size)
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&map->mutex);
|
||||||
|
map->bitmap[bitmap_bit / 8] |= (1 << (bitmap_bit & 7));
|
||||||
|
pthread_mutex_unlock(&map->mutex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint bitmap_set_next(BITMAP *map)
|
||||||
|
{
|
||||||
|
uchar *bitmap=map->bitmap;
|
||||||
uint bit_found = MY_BIT_NONE;
|
uint bit_found = MY_BIT_NONE;
|
||||||
|
uint bitmap_size=map->bitmap_size;
|
||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
pthread_mutex_lock(&LOCK_bitmap);
|
pthread_mutex_lock(&map->mutex);
|
||||||
for (i=0; i < bitmap_size ; i++, bitmap++)
|
for (i=0; i < bitmap_size ; i++, bitmap++)
|
||||||
{
|
{
|
||||||
if (*bitmap != 0xff)
|
if (*bitmap != 0xff)
|
||||||
@ -64,18 +89,18 @@ uint bitmap_set_next(uchar *bitmap, uint bitmap_size)
|
|||||||
break; /* Found bit */
|
break; /* Found bit */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&LOCK_bitmap);
|
pthread_mutex_unlock(&map->mutex);
|
||||||
return bit_found;
|
return bit_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void bitmap_clear_bit(uchar *bitmap, uint bitmap_size, uint bitmap_bit)
|
void bitmap_clear_bit(BITMAP *map, uint bitmap_bit)
|
||||||
{
|
{
|
||||||
if (bitmap_bit < bitmap_size*8)
|
if (bitmap_bit < map->bitmap_size)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&LOCK_bitmap);
|
pthread_mutex_lock(&map->mutex);
|
||||||
bitmap[bitmap_bit / 8] &= ~ (1 << (bitmap_bit & 7));
|
map->bitmap[bitmap_bit / 8] &= ~ (1 << (bitmap_bit & 7));
|
||||||
pthread_mutex_unlock(&LOCK_bitmap);
|
pthread_mutex_unlock(&map->mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,8 +80,7 @@ void my_init(void)
|
|||||||
#ifndef __WIN__
|
#ifndef __WIN__
|
||||||
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
|
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
|
||||||
#endif
|
#endif
|
||||||
pthread_mutex_init(&LOCK_bitmap, NULL);
|
#endif /* THREAD */
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
DBUG_ENTER("my_init");
|
DBUG_ENTER("my_init");
|
||||||
DBUG_PROCESS(my_progname ? my_progname : (char*) "unknown");
|
DBUG_PROCESS(my_progname ? my_progname : (char*) "unknown");
|
||||||
|
11
sql/field.cc
11
sql/field.cc
@ -2106,8 +2106,14 @@ int Field_double::cmp(const char *a_ptr, const char *b_ptr)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
/* could this ALWAYS be 2 calls to doubleget() ?? */
|
||||||
|
#if (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
|
||||||
|
doubleget(a, a_ptr);
|
||||||
|
doubleget(b, b_ptr);
|
||||||
|
#else
|
||||||
memcpy_fixed(&a,a_ptr,sizeof(double));
|
memcpy_fixed(&a,a_ptr,sizeof(double));
|
||||||
memcpy_fixed(&b,b_ptr,sizeof(double));
|
memcpy_fixed(&b,b_ptr,sizeof(double));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return (a < b) ? -1 : (a > b) ? 1 : 0;
|
return (a < b) ? -1 : (a > b) ? 1 : 0;
|
||||||
}
|
}
|
||||||
@ -2127,7 +2133,12 @@ void Field_double::sort_string(char *to,uint length __attribute__((unused)))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
/* could this ALWAYS be 2 calls to doubleget() ?? */
|
||||||
|
#if (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
|
||||||
|
doubleget(nr,ptr);
|
||||||
|
#else
|
||||||
memcpy_fixed(&nr,ptr,sizeof(nr));
|
memcpy_fixed(&nr,ptr,sizeof(nr));
|
||||||
|
#endif
|
||||||
change_double_for_sort(nr, (byte*) to);
|
change_double_for_sort(nr, (byte*) to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,8 +932,13 @@ void change_double_for_sort(double nr,byte *to)
|
|||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
uchar *ptr= (uchar*) &nr;
|
uchar *ptr= (uchar*) &nr;
|
||||||
|
#if (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
|
||||||
|
tmp[0]= ptr[3]; tmp[1]=ptr[2]; tmp[2]= ptr[1]; tmp[3]=ptr[0];
|
||||||
|
tmp[4]= ptr[7]; tmp[5]=ptr[6]; tmp[6]= ptr[5]; tmp[7]=ptr[4];
|
||||||
|
#else
|
||||||
tmp[0]= ptr[7]; tmp[1]=ptr[6]; tmp[2]= ptr[5]; tmp[3]=ptr[4];
|
tmp[0]= ptr[7]; tmp[1]=ptr[6]; tmp[2]= ptr[5]; tmp[3]=ptr[4];
|
||||||
tmp[4]= ptr[3]; tmp[5]=ptr[2]; tmp[6]= ptr[1]; tmp[7]=ptr[0];
|
tmp[4]= ptr[3]; tmp[5]=ptr[2]; tmp[6]= ptr[1]; tmp[7]=ptr[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (tmp[0] & 128) /* Negative */
|
if (tmp[0] & 128) /* Negative */
|
||||||
|
@ -457,7 +457,8 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
|
|||||||
myisamchk_init(¶m);
|
myisamchk_init(¶m);
|
||||||
param.thd = thd;
|
param.thd = thd;
|
||||||
param.op_name = (char*) "repair";
|
param.op_name = (char*) "repair";
|
||||||
param.testflag = ((check_opt->flags | T_SILENT | T_FORCE_CREATE) |
|
param.testflag = ((check_opt->flags & ~T_EXTEND) |
|
||||||
|
T_SILENT | T_FORCE_CREATE |
|
||||||
(check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT));
|
(check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT));
|
||||||
if (check_opt->quick)
|
if (check_opt->quick)
|
||||||
param.opt_rep_quick++;
|
param.opt_rep_quick++;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <thr_lock.h>
|
#include <thr_lock.h>
|
||||||
#include <my_base.h> /* Needed by field.h */
|
#include <my_base.h> /* Needed by field.h */
|
||||||
|
#include <my_bitmap.h>
|
||||||
#include <violite.h>
|
#include <violite.h>
|
||||||
|
|
||||||
#undef write // remove pthread.h macro definition for EMX
|
#undef write // remove pthread.h macro definition for EMX
|
||||||
@ -508,7 +509,7 @@ extern ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count,
|
|||||||
ha_read_key_count, ha_read_next_count, ha_read_prev_count,
|
ha_read_key_count, ha_read_next_count, ha_read_prev_count,
|
||||||
ha_read_first_count, ha_read_last_count,
|
ha_read_first_count, ha_read_last_count,
|
||||||
ha_read_rnd_count, ha_read_rnd_next_count;
|
ha_read_rnd_count, ha_read_rnd_next_count;
|
||||||
extern uchar temp_pool[TEMP_POOL_SIZE];
|
extern BITMAP temp_pool;
|
||||||
extern bool use_temp_pool;
|
extern bool use_temp_pool;
|
||||||
extern char f_fyllchar;
|
extern char f_fyllchar;
|
||||||
extern uchar *days_in_month;
|
extern uchar *days_in_month;
|
||||||
|
@ -284,8 +284,8 @@ I_List<THD> threads,thread_cache;
|
|||||||
time_t start_time;
|
time_t start_time;
|
||||||
|
|
||||||
|
|
||||||
uchar temp_pool[TEMP_POOL_SIZE];
|
BITMAP temp_pool;
|
||||||
bool use_temp_pool;
|
bool use_temp_pool=0;
|
||||||
|
|
||||||
pthread_key(MEM_ROOT*,THR_MALLOC);
|
pthread_key(MEM_ROOT*,THR_MALLOC);
|
||||||
pthread_key(THD*, THR_THD);
|
pthread_key(THD*, THR_THD);
|
||||||
@ -646,6 +646,7 @@ void clean_up(void)
|
|||||||
free_defaults(defaults_argv);
|
free_defaults(defaults_argv);
|
||||||
my_free(mysql_tmpdir,MYF(0));
|
my_free(mysql_tmpdir,MYF(0));
|
||||||
x_free(opt_bin_logname);
|
x_free(opt_bin_logname);
|
||||||
|
bitmap_free(&temp_pool);
|
||||||
#ifndef __WIN__
|
#ifndef __WIN__
|
||||||
if (!opt_bootstrap)
|
if (!opt_bootstrap)
|
||||||
(void) my_delete(pidfile_name,MYF(0)); // This may not always exist
|
(void) my_delete(pidfile_name,MYF(0)); // This may not always exist
|
||||||
@ -1073,7 +1074,7 @@ static void init_signals(void)
|
|||||||
signal(SIGBREAK,SIG_IGN);
|
signal(SIGBREAK,SIG_IGN);
|
||||||
signal_thread = pthread_self();
|
signal_thread = pthread_self();
|
||||||
}
|
}
|
||||||
#else
|
#else /* if ! __WIN__ && ! __EMX__ */
|
||||||
|
|
||||||
#ifdef HAVE_LINUXTHREADS
|
#ifdef HAVE_LINUXTHREADS
|
||||||
static sig_handler write_core(int sig);
|
static sig_handler write_core(int sig);
|
||||||
@ -1085,8 +1086,8 @@ static sig_handler write_core(int sig);
|
|||||||
extern char* __bss_start;
|
extern char* __bss_start;
|
||||||
static char* heap_start, *heap_end;
|
static char* heap_start, *heap_end;
|
||||||
|
|
||||||
inline static __volatile__ void print_str(const char* name,
|
inline __volatile__ void print_str(const char* name,
|
||||||
const char* val, int max_len)
|
const char* val, int max_len)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s at %p ", name, val);
|
fprintf(stderr, "%s at %p ", name, val);
|
||||||
if(!PTR_SANE(val))
|
if(!PTR_SANE(val))
|
||||||
@ -1101,7 +1102,7 @@ inline static __volatile__ void print_str(const char* name,
|
|||||||
fputc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static __volatile__ void trace_stack()
|
inline __volatile__ void trace_stack()
|
||||||
{
|
{
|
||||||
uchar **stack_bottom;
|
uchar **stack_bottom;
|
||||||
uchar** ebp;
|
uchar** ebp;
|
||||||
@ -1227,7 +1228,9 @@ static void init_signals(void)
|
|||||||
sa.sa_handler=handle_segfault;
|
sa.sa_handler=handle_segfault;
|
||||||
#endif
|
#endif
|
||||||
sigaction(SIGSEGV, &sa, NULL);
|
sigaction(SIGSEGV, &sa, NULL);
|
||||||
|
#ifdef SIGBUS
|
||||||
sigaction(SIGBUS, &sa, NULL);
|
sigaction(SIGBUS, &sa, NULL);
|
||||||
|
#endif
|
||||||
sigaction(SIGILL, &sa, NULL);
|
sigaction(SIGILL, &sa, NULL);
|
||||||
(void) sigemptyset(&set);
|
(void) sigemptyset(&set);
|
||||||
#ifdef THREAD_SPECIFIC_SIGPIPE
|
#ifdef THREAD_SPECIFIC_SIGPIPE
|
||||||
@ -1532,9 +1535,6 @@ int main(int argc, char **argv)
|
|||||||
if (!mysql_tmpdir || !mysql_tmpdir[0])
|
if (!mysql_tmpdir || !mysql_tmpdir[0])
|
||||||
mysql_tmpdir=(char*) P_tmpdir; /* purecov: inspected */
|
mysql_tmpdir=(char*) P_tmpdir; /* purecov: inspected */
|
||||||
|
|
||||||
bzero(temp_pool, TEMP_POOL_SIZE);
|
|
||||||
use_temp_pool = 0;
|
|
||||||
|
|
||||||
set_options();
|
set_options();
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
/* service parameters can be overwritten by options */
|
/* service parameters can be overwritten by options */
|
||||||
@ -1641,6 +1641,8 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
select_thread=pthread_self();
|
select_thread=pthread_self();
|
||||||
select_thread_in_use=1;
|
select_thread_in_use=1;
|
||||||
|
if (use_temp_pool && bitmap_init(&temp_pool,1024))
|
||||||
|
unireg_abort(1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** We have enough space for fiddling with the argv, continue
|
** We have enough space for fiddling with the argv, continue
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include <hash.h>
|
#include <hash.h>
|
||||||
#include <ft_global.h>
|
#include <ft_global.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <my_bitmap.h>
|
|
||||||
|
|
||||||
const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
|
const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
|
||||||
"MAYBE_REF","ALL","range","index","fulltext" };
|
"MAYBE_REF","ALL","range","index","fulltext" };
|
||||||
@ -3298,7 +3297,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||||||
statistic_increment(created_tmp_tables, &LOCK_status);
|
statistic_increment(created_tmp_tables, &LOCK_status);
|
||||||
|
|
||||||
if (use_temp_pool)
|
if (use_temp_pool)
|
||||||
temp_pool_slot = bitmap_set_next(temp_pool, TEMP_POOL_SIZE);
|
temp_pool_slot = bitmap_set_next(&temp_pool);
|
||||||
|
|
||||||
if (temp_pool_slot != MY_BIT_NONE) // we got a slot
|
if (temp_pool_slot != MY_BIT_NONE) // we got a slot
|
||||||
sprintf(path, "%s%s_%lx_%i", mysql_tmpdir, tmp_file_prefix,
|
sprintf(path, "%s%s_%lx_%i", mysql_tmpdir, tmp_file_prefix,
|
||||||
@ -3336,12 +3335,12 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||||||
param->group_length : 0,
|
param->group_length : 0,
|
||||||
NullS))
|
NullS))
|
||||||
{
|
{
|
||||||
bitmap_clear_bit(temp_pool, TEMP_POOL_SIZE, temp_pool_slot);
|
bitmap_clear_bit(&temp_pool, temp_pool_slot);
|
||||||
DBUG_RETURN(NULL); /* purecov: inspected */
|
DBUG_RETURN(NULL); /* purecov: inspected */
|
||||||
}
|
}
|
||||||
if (!(param->copy_field=copy=new Copy_field[field_count]))
|
if (!(param->copy_field=copy=new Copy_field[field_count]))
|
||||||
{
|
{
|
||||||
bitmap_clear_bit(temp_pool, TEMP_POOL_SIZE, temp_pool_slot);
|
bitmap_clear_bit(&temp_pool, temp_pool_slot);
|
||||||
my_free((gptr) table,MYF(0)); /* purecov: inspected */
|
my_free((gptr) table,MYF(0)); /* purecov: inspected */
|
||||||
DBUG_RETURN(NULL); /* purecov: inspected */
|
DBUG_RETURN(NULL); /* purecov: inspected */
|
||||||
}
|
}
|
||||||
@ -3687,7 +3686,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||||||
|
|
||||||
err:
|
err:
|
||||||
free_tmp_table(thd,table); /* purecov: inspected */
|
free_tmp_table(thd,table); /* purecov: inspected */
|
||||||
bitmap_clear_bit(temp_pool, TEMP_POOL_SIZE, temp_pool_slot);
|
bitmap_clear_bit(&temp_pool, temp_pool_slot);
|
||||||
DBUG_RETURN(NULL); /* purecov: inspected */
|
DBUG_RETURN(NULL); /* purecov: inspected */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3835,7 +3834,7 @@ free_tmp_table(THD *thd, TABLE *entry)
|
|||||||
my_free((gptr) entry->record[0],MYF(0));
|
my_free((gptr) entry->record[0],MYF(0));
|
||||||
free_io_cache(entry);
|
free_io_cache(entry);
|
||||||
|
|
||||||
bitmap_clear_bit(temp_pool, TEMP_POOL_SIZE, entry->temp_pool_slot);
|
bitmap_clear_bit(&temp_pool, entry->temp_pool_slot);
|
||||||
|
|
||||||
my_free((gptr) entry,MYF(0));
|
my_free((gptr) entry,MYF(0));
|
||||||
thd->proc_info=save_proc_info;
|
thd->proc_info=save_proc_info;
|
||||||
|
Reference in New Issue
Block a user