Commit c40a424a authored by unknown's avatar unknown

Let ALTER TABLE and LOAD DATA INFILE use sorting to create index

Call init_signals before intializing table handlers. This should fix the signal problem in Innobase on Solaris


Docs/manual.texi:
  Updated changelog
include/myisam.h:
  Let ALTER TABLE and LOAD DATA INFILE use sorting to create index
myisam/mi_check.c:
  Let ALTER TABLE and LOAD DATA INFILE use sorting to create index
myisam/myisamchk.c:
  Let ALTER TABLE and LOAD DATA INFILE use sorting to create index
sql/ha_myisam.cc:
  Let ALTER TABLE and LOAD DATA INFILE use sorting to create index
sql/mysqld.cc:
  Call init_signals before intializing table handlers. This should fix the signal problem in Innobase on Solaris
parent b2c0b7ce
......@@ -407,6 +407,7 @@ MySQL Language Reference
* COMMIT:: @code{BEGIN/COMMIT/ROLLBACK} syntax
* LOCK TABLES:: @code{LOCK TABLES/UNLOCK TABLES} syntax
* SET OPTION:: @code{SET OPTION} syntax
* SET TRANSACTION:: @code{SET TRANSACTION} syntax
* GRANT:: @code{GRANT} and @code{REVOKE} syntax
* CREATE INDEX:: @code{CREATE INDEX} syntax
* DROP INDEX:: @code{DROP INDEX} syntax
......@@ -420,7 +421,7 @@ Literals: How to Write Strings and Numbers
* Number syntax:: Numbers
* Hexadecimal values:: Hexadecimal values
* NULL values:: @code{NULL} values
* Legal names:: Database, table, index, column and alias names
* Legal names:: Database, Table, Index, Column, and Alias Names
Database, Table, Index, Column, and Alias Names
......@@ -898,6 +899,8 @@ Changes in release 4.0.x (Development; Alpha)
Changes in release 3.23.x (Stable)
* News-3.23.37::
* News-3.23.36:: Changes in release 3.23.36
* News-3.23.35:: Changes in release 3.23.35
* News-3.23.34a:: Changes in release 3.23.34a
* News-3.23.34:: Changes in release 3.23.34
......@@ -42376,6 +42379,7 @@ users uses this code as the rest of the code and because of this we are
not yet 100 % confident in this code.
@menu
* News-3.23.37:: Changes in release 3.23.37
* News-3.23.36:: Changes in release 3.23.36
* News-3.23.35:: Changes in release 3.23.35
* News-3.23.34a:: Changes in release 3.23.34a
......@@ -42416,7 +42420,17 @@ not yet 100 % confident in this code.
* News-3.23.0:: Changes in release 3.23.0
@end menu
@node News-3.23.36, News-3.23.35, News-3.23.x, News-3.23.x
@node News-3.23.37, News-3.23.36, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.37
@itemize @bullet
@item
Fixed bug in @code{ALTER TABLE} and @code{LOAD DATA INFILE} that disabled
key-sorting. These command should now be faster in most cases.
@item
Initialize signals early to avoid problem with signals in Innobase..
@end itemize
@node News-3.23.36, News-3.23.35, News-3.23.37, News-3.23.x
@appendixsubsec Changes in release 3.23.36
@itemize @bullet
@item
......@@ -42429,8 +42443,8 @@ of connections in a short time).
Don't free the key cache on @code{FLUSH TABLES} as this will cause problems
with temporary tables.
@item
Fixed problem in Innobase with with other character sets than latin1,
alarms on Solaris and many columns.
Fixed a problem in Innobase with with other character sets than
latin1 and another problem when using many columns.
@item
Fixed a core-dump bug when using very complex query involving
@code{DISTINCT} and summary functions.
......@@ -384,7 +384,8 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
int test_if_almost_full(MI_INFO *info);
int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename);
void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows);
my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, my_bool force);
my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, ulonglong key_map,
my_bool force);
#ifdef __cplusplus
}
......
......@@ -3166,12 +3166,18 @@ void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows)
*/
my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows,
ulonglong key_map,
my_bool force)
{
MYISAM_SHARE *share=info->s;
uint i;
MI_KEYDEF *key=share->keyinfo;
if (!share->state.key_map)
uint i;
/*
repair_by_sort only works if we have at least one key. If we don't
have any keys, we should use the normal repair.
*/
if (!key_map)
return FALSE; /* Can't use sort */
for (i=0 ; i < share->base.keys ; i++,key++)
{
......
......@@ -693,6 +693,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
(share->state.key_map ||
(rep_quick && !param->keys_in_use && !recreate)) &&
mi_test_if_sort_rep(info, info->state->records,
info->s->state.key_map,
check_param.force_sort))
{
error=mi_repair_by_sort(&check_param,info,fixed_name,rep_quick);
......
......@@ -544,8 +544,10 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
(!param.opt_rep_quick ||
!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))))
{
optimize_done=1;
if (mi_test_if_sort_rep(file,file->state->records,0) &&
ulonglong key_map= ((param.testflag & T_CREATE_MISSING_KEYS) ?
((ulonglong) 1L << share->base.keys)-1 :
share->state.key_map);
if (mi_test_if_sort_rep(file,file->state->records,key_map,0) &&
(param.testflag & T_REP_BY_SORT))
{
uint testflag=param.testflag;
......@@ -646,7 +648,6 @@ bool ha_myisam::activate_all_index(THD *thd)
param.sort_buffer_length= myisam_sort_buffer_size;
param.opt_rep_quick++; // Don't copy data file
param.tmpdir=mysql_tmpdir;
error=repair(thd,param,0) != HA_ADMIN_OK;
thd->proc_info=save_proc_info;
}
......
......@@ -324,6 +324,7 @@ HANDLE hEventShutdown;
static NTService Service; // Service object for WinNT
#endif
static void start_signal_handler(void);
static void *signal_hand(void *arg);
static void set_options(void);
static void get_options(int argc,char **argv);
......@@ -1059,6 +1060,10 @@ static void init_signals(void)
signal(SIGBREAK,SIG_IGN); //ignore SIGBREAK for NT
}
static void start_signal_handler(void)
{
}
#elif defined(__EMX__)
static void sig_reload(int signo)
{
......@@ -1087,6 +1092,11 @@ static void init_signals(void)
signal(SIGBREAK,SIG_IGN);
signal_thread = pthread_self();
}
static void start_signal_handler(void)
{
}
#else /* if ! __WIN__ && ! __EMX__ */
#ifdef HAVE_LINUXTHREADS
......@@ -1226,8 +1236,6 @@ static sig_handler write_core(int sig)
static void init_signals(void)
{
sigset_t set;
pthread_attr_t thr_attr;
int error;
DBUG_ENTER("init_signals");
sigset(THR_KILL_SIGNAL,end_thread_signal);
......@@ -1269,6 +1277,15 @@ static void init_signals(void)
sigdelset(&set,THR_KILL_SIGNAL); // May be SIGINT
sigdelset(&set,THR_CLIENT_ALARM); // For alarms
(void) pthread_sigmask(SIG_SETMASK,&set,NULL);
DBUG_VOID_RETURN;
}
static void start_signal_handler(void)
{
int error;
pthread_attr_t thr_attr;
DBUG_ENTER("start_signal_handler");
(void) pthread_attr_init(&thr_attr);
#if !defined(HAVE_DEC_3_2_THREADS)
......@@ -1337,8 +1354,9 @@ static void *signal_hand(void *arg __attribute__((unused)))
}
}
// signal to start_signal_handler that we are ready
(void) pthread_mutex_lock(&LOCK_thread_count);
(void) pthread_cond_signal(&COND_thread_count); /* continue init_signals */
(void) pthread_cond_signal(&COND_thread_count);
(void) pthread_mutex_unlock(&LOCK_thread_count);
for (;;)
......@@ -1596,6 +1614,7 @@ int main(int argc, char **argv)
(void) pthread_cond_init(&COND_binlog_update, NULL);
(void) pthread_cond_init(&COND_slave_stopped, NULL);
(void) pthread_cond_init(&COND_slave_start, NULL);
init_signals();
if (set_default_charset_by_name(default_charset, MYF(MY_WME)))
unireg_abort(1);
......@@ -1774,7 +1793,7 @@ The server will not act as a slave.");
sql_print_error("Can't create thread-keys");
exit(1);
}
init_signals(); // Creates pidfile
start_signal_handler(); // Creates pidfile
if (acl_init(opt_noacl))
{
select_thread_in_use=0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment