summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2005-04-16 00:34:05 +0200
committerunknown <serg@serg.mylan>2005-04-16 00:34:05 +0200
commit7fee6080ed9a57a4f39f8f18277daffe78edbd88 (patch)
tree126985d40a1a34cd963d6f1a6b44ada56ca5905b
parentf88eaa7d9ee2c82c0a468acf50af620aa2a829af (diff)
parent918c8edb3bec6102331432cb5700b44b737d17fb (diff)
downloadmariadb-git-7fee6080ed9a57a4f39f8f18277daffe78edbd88.tar.gz
Merge serg@bk-internal.mysql.com:/home/bk/mysql-4.1/
into serg.mylan:/usr/home/serg/Abk/mysql-4.1
-rw-r--r--sql/ha_ndbcluster.cc28
-rw-r--r--sql/handler.cc14
-rw-r--r--sql/handler.h1
-rw-r--r--sql/mysqld.cc13
-rw-r--r--support-files/mysql.server.sh10
5 files changed, 59 insertions, 7 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 6dc9c8df64a..d14d5f6f5c3 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -47,6 +47,8 @@ static const char *ha_ndb_ext=".ndb";
#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8
+#define NDB_FAILED_AUTO_INCREMENT ~(Uint64)0
+#define NDB_AUTO_INCREMENT_RETRIES 10
#define ERR_PRINT(err) \
DBUG_PRINT("error", ("%d message: %s", err.code, err.message))
@@ -1838,7 +1840,15 @@ int ha_ndbcluster::write_row(byte *record)
{
// Table has hidden primary key
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->fields, (const byte*)&auto_value))
ERR_RETURN(op->getNdbError());
}
@@ -3971,10 +3981,18 @@ longlong ha_ndbcluster::get_auto_increment()
: (m_rows_to_insert > m_autoincrement_prefetch) ?
m_rows_to_insert
: m_autoincrement_prefetch;
- Uint64 auto_value=
- (m_skip_auto_increment) ?
- ndb->readAutoIncrementValue((const NDBTAB *) m_table)
- : ndb->getAutoIncrementValue((const NDBTAB *) m_table, cache_size);
+ Uint64 auto_value= NDB_FAILED_AUTO_INCREMENT;
+ uint retries= NDB_AUTO_INCREMENT_RETRIES;
+ do {
+ auto_value=
+ (m_skip_auto_increment) ?
+ ndb->readAutoIncrementValue((const NDBTAB *) m_table)
+ : 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);
}
diff --git a/sql/handler.cc b/sql/handler.cc
index b12032ccd81..7d8fc5d8110 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -145,6 +145,20 @@ const char *ha_get_storage_engine(enum db_type db_type)
return "none";
}
+
+my_bool ha_storage_engine_is_enabled(enum db_type database_type)
+{
+ show_table_type_st *types;
+ for (types= sys_table_types; types->type; types++)
+ {
+ if ((database_type == types->db_type) &&
+ (*types->value == SHOW_OPTION_YES))
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
/* Use other database handler if databasehandler is not incompiled */
enum db_type ha_checktype(enum db_type database_type)
diff --git a/sql/handler.h b/sql/handler.h
index 4c31da6a492..d2f77c4149a 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -542,6 +542,7 @@ int ha_init(void);
int ha_panic(enum ha_panic_function flag);
void ha_close_connection(THD* thd);
enum db_type ha_checktype(enum db_type database_type);
+my_bool ha_storage_engine_is_enabled(enum db_type database_type);
int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
bool update_create_info);
int ha_create_table_from_engine(THD* thd, const char *db, const char *name,
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index b568b75fbad..b13851df479 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1165,6 +1165,7 @@ static struct passwd *check_user(const char *user)
err:
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
return NULL;
}
@@ -6435,6 +6436,18 @@ static void get_options(int argc,char **argv)
sql_print_warning("this binary does not contain BDB storage engine");
#endif
+ /*
+ Check that the default storage engine is actually available.
+ */
+ if (!ha_storage_engine_is_enabled((enum db_type)
+ global_system_variables.table_type))
+ {
+ sql_print_error("Default storage engine (%s) is not available",
+ ha_get_storage_engine((enum db_type)
+ global_system_variables.table_type));
+ exit(1);
+ }
+
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);
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh
index 376d9051b10..f9015824e6b 100644
--- a/support-files/mysql.server.sh
+++ b/support-files/mysql.server.sh
@@ -61,8 +61,14 @@ lsb_functions="/lib/lsb/init-functions"
if test -f $lsb_functions ; then
source $lsb_functions
else
- alias log_success_msg="echo \ SUCCESS! "
- alias log_failure_msg="echo \ ERROR! "
+ log_success_msg()
+ {
+ echo " SUCCESS! $@"
+ }
+ log_failure_msg()
+ {
+ echo " ERROR! $@"
+ }
fi
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin