Commit c8170b34 authored by monty@mishka.local's avatar monty@mishka.local

Merge with 4.1

parents f0fa1a6f 2b322f36
...@@ -722,6 +722,7 @@ fi ...@@ -722,6 +722,7 @@ fi
cat << END_OF_DATA cat << END_OF_DATA
use mysql; use mysql;
set table_type=myisam;
$c_d $c_d
$i_d $i_d
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
-- this sql script. -- this sql script.
-- On windows you should do 'mysql --force mysql < mysql_fix_privilege_tables.sql' -- On windows you should do 'mysql --force mysql < mysql_fix_privilege_tables.sql'
set table_type=MyISAM;
CREATE TABLE IF NOT EXISTS func ( CREATE TABLE IF NOT EXISTS func (
name char(64) binary DEFAULT '' NOT NULL, name char(64) binary DEFAULT '' NOT NULL,
ret tinyint(1) DEFAULT '0' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL,
......
...@@ -67,6 +67,8 @@ static handlerton ndbcluster_hton = { ...@@ -67,6 +67,8 @@ static handlerton ndbcluster_hton = {
#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8 #define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8
#define NDB_FAILED_AUTO_INCREMENT ~(Uint64)0
#define NDB_AUTO_INCREMENT_RETRIES 10
#define ERR_PRINT(err) \ #define ERR_PRINT(err) \
DBUG_PRINT("error", ("%d message: %s", err.code, err.message)) DBUG_PRINT("error", ("%d message: %s", err.code, err.message))
...@@ -1928,7 +1930,15 @@ int ha_ndbcluster::write_row(byte *record) ...@@ -1928,7 +1930,15 @@ int ha_ndbcluster::write_row(byte *record)
{ {
// Table has hidden primary key // Table has hidden primary key
Ndb *ndb= get_ndb(); Ndb *ndb= get_ndb();
Uint64 auto_value= ndb->getAutoIncrementValue((const NDBTAB *) m_table); Uint64 auto_value= NDB_FAILED_AUTO_INCREMENT;
uint retries= NDB_AUTO_INCREMENT_RETRIES;
do {
auto_value= ndb->getAutoIncrementValue((const NDBTAB *) m_table);
} while (auto_value == NDB_FAILED_AUTO_INCREMENT &&
--retries &&
ndb->getNdbError().status == NdbError::TemporaryError);
if (auto_value == NDB_FAILED_AUTO_INCREMENT)
ERR_RETURN(ndb->getNdbError());
if (set_hidden_key(op, table->s->fields, (const byte*)&auto_value)) if (set_hidden_key(op, table->s->fields, (const byte*)&auto_value))
ERR_RETURN(op->getNdbError()); ERR_RETURN(op->getNdbError());
} }
...@@ -4119,10 +4129,18 @@ ulonglong ha_ndbcluster::get_auto_increment() ...@@ -4119,10 +4129,18 @@ ulonglong ha_ndbcluster::get_auto_increment()
: (m_rows_to_insert > m_autoincrement_prefetch) ? : (m_rows_to_insert > m_autoincrement_prefetch) ?
m_rows_to_insert m_rows_to_insert
: m_autoincrement_prefetch; : m_autoincrement_prefetch;
auto_value= NDB_FAILED_AUTO_INCREMENT;
uint retries= NDB_AUTO_INCREMENT_RETRIES;
do {
auto_value= auto_value=
(m_skip_auto_increment) ? (m_skip_auto_increment) ?
ndb->readAutoIncrementValue((const NDBTAB *) m_table) ndb->readAutoIncrementValue((const NDBTAB *) m_table)
: ndb->getAutoIncrementValue((const NDBTAB *) m_table, cache_size); : ndb->getAutoIncrementValue((const NDBTAB *) m_table, cache_size);
} while (auto_value == NDB_FAILED_AUTO_INCREMENT &&
--retries &&
ndb->getNdbError().status == NdbError::TemporaryError);
if (auto_value == NDB_FAILED_AUTO_INCREMENT)
ERR_RETURN(ndb->getNdbError());
DBUG_RETURN((longlong)auto_value); DBUG_RETURN((longlong)auto_value);
} }
......
...@@ -149,18 +149,27 @@ const char *ha_get_storage_engine(enum db_type db_type) ...@@ -149,18 +149,27 @@ const char *ha_get_storage_engine(enum db_type db_type)
return "none"; return "none";
} }
/* Use other database handler if databasehandler is not incompiled */
enum db_type ha_checktype(enum db_type database_type) my_bool ha_storage_engine_is_enabled(enum db_type database_type)
{ {
show_table_type_st *types; show_table_type_st *types;
THD *thd= current_thd;
for (types= sys_table_types; types->type; types++) for (types= sys_table_types; types->type; types++)
{ {
if ((database_type == types->db_type) && if ((database_type == types->db_type) &&
(*types->value == SHOW_OPTION_YES)) (*types->value == SHOW_OPTION_YES))
return database_type; return TRUE;
} }
return FALSE;
}
/* Use other database handler if databasehandler is not incompiled */
enum db_type ha_checktype(enum db_type database_type)
{
THD *thd;
if (ha_storage_engine_is_enabled(database_type))
return database_type;
switch (database_type) { switch (database_type) {
#ifndef NO_HASH #ifndef NO_HASH
...@@ -173,6 +182,7 @@ enum db_type ha_checktype(enum db_type database_type) ...@@ -173,6 +182,7 @@ enum db_type ha_checktype(enum db_type database_type)
break; break;
} }
thd= current_thd;
return ((enum db_type) thd->variables.table_type != DB_TYPE_UNKNOWN ? return ((enum db_type) thd->variables.table_type != DB_TYPE_UNKNOWN ?
(enum db_type) thd->variables.table_type : (enum db_type) thd->variables.table_type :
(enum db_type) global_system_variables.table_type != (enum db_type) global_system_variables.table_type !=
......
...@@ -819,6 +819,7 @@ TYPELIB *ha_known_exts(void); ...@@ -819,6 +819,7 @@ TYPELIB *ha_known_exts(void);
int ha_panic(enum ha_panic_function flag); int ha_panic(enum ha_panic_function flag);
int ha_update_statistics(); int ha_update_statistics();
void ha_close_connection(THD* thd); void ha_close_connection(THD* thd);
my_bool ha_storage_engine_is_enabled(enum db_type database_type);
bool ha_flush_logs(void); bool ha_flush_logs(void);
void ha_drop_database(char* path); void ha_drop_database(char* path);
int ha_create_table(const char *name, HA_CREATE_INFO *create_info, int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
......
...@@ -1185,6 +1185,7 @@ static struct passwd *check_user(const char *user) ...@@ -1185,6 +1185,7 @@ static struct passwd *check_user(const char *user)
err: err:
sql_print_error("Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user); sql_print_error("Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user);
unireg_abort(1);
#endif #endif
return NULL; return NULL;
} }
...@@ -2436,7 +2437,9 @@ static int init_common_variables(const char *conf_file_name, int argc, ...@@ -2436,7 +2437,9 @@ static int init_common_variables(const char *conf_file_name, int argc,
{ {
struct tm tm_tmp; struct tm tm_tmp;
localtime_r(&start_time,&tm_tmp); localtime_r(&start_time,&tm_tmp);
strmov(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0]); strmake(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0],
sizeof(system_time_zone)-1);
} }
#endif #endif
/* /*
...@@ -3144,6 +3147,7 @@ we force server id to 2, but this MySQL server will not act as a slave."); ...@@ -3144,6 +3147,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
if (opt_bootstrap) if (opt_bootstrap)
{ {
select_thread_in_use= 0; // Allow 'kill' to work
bootstrap(stdin); bootstrap(stdin);
end_thr_alarm(1); // Don't allow alarms end_thr_alarm(1); // Don't allow alarms
unireg_abort(bootstrap_error ? 1 : 0); unireg_abort(bootstrap_error ? 1 : 0);
...@@ -6383,9 +6387,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -6383,9 +6387,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case OPT_STORAGE_ENGINE: case OPT_STORAGE_ENGINE:
{ {
if ((enum db_type)((global_system_variables.table_type= if ((enum db_type)((global_system_variables.table_type=
ha_resolve_by_name(argument, strlen(argument)))) == DB_TYPE_UNKNOWN) ha_resolve_by_name(argument, strlen(argument)))) ==
DB_TYPE_UNKNOWN)
{ {
fprintf(stderr,"Unknown table type: %s\n",argument); fprintf(stderr,"Unknown/unsupported table type: %s\n",argument);
exit(1); exit(1);
} }
break; break;
...@@ -6659,6 +6664,22 @@ static void get_options(int argc,char **argv) ...@@ -6659,6 +6664,22 @@ static void get_options(int argc,char **argv)
sql_print_warning("this binary does not contain BDB storage engine"); sql_print_warning("this binary does not contain BDB storage engine");
#endif #endif
/*
Check that the default storage engine is actually available.
*/
if (!ha_storage_engine_is_enabled((enum db_type)
global_system_variables.table_type))
{
if (!opt_bootstrap)
{
sql_print_error("Default storage engine (%s) is not available",
ha_get_storage_engine((enum db_type)
global_system_variables.table_type));
exit(1);
}
global_system_variables.table_type= DB_TYPE_MYISAM;
}
if (argc > 0) if (argc > 0)
{ {
fprintf(stderr, "%s: Too many arguments (first extra is '%s').\nUse --help to get a list of available options\n", my_progname, *argv); fprintf(stderr, "%s: Too many arguments (first extra is '%s').\nUse --help to get a list of available options\n", my_progname, *argv);
......
...@@ -66,8 +66,14 @@ lsb_functions="/lib/lsb/init-functions" ...@@ -66,8 +66,14 @@ lsb_functions="/lib/lsb/init-functions"
if test -f $lsb_functions ; then if test -f $lsb_functions ; then
source $lsb_functions source $lsb_functions
else else
alias log_success_msg="echo \ SUCCESS! " log_success_msg()
alias log_failure_msg="echo \ ERROR! " {
echo " SUCCESS! $@"
}
log_failure_msg()
{
echo " ERROR! $@"
}
fi fi
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin
......
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