summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorbrian@avenger.(none) <>2004-11-30 10:10:40 -0800
committerbrian@avenger.(none) <>2004-11-30 10:10:40 -0800
commitb85f4677d594ef6bea154fbb0511bb70a2271bac (patch)
tree1f0afa7d9329a51b6fd4a5de7db6fbe43b47d328 /sql
parent0285686fd8c86c5cdf79775f3bd3b0e9ee563b01 (diff)
parentaec0b4e4d784eb406386c0e3b41725c9c546d97d (diff)
downloadmariadb-git-b85f4677d594ef6bea154fbb0511bb70a2271bac.tar.gz
Merge for Matt for Innodb bug.
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc1
-rw-r--r--sql/ha_innodb.cc63
-rw-r--r--sql/ha_ndbcluster.cc23
-rw-r--r--sql/mysqld.cc42
4 files changed, 100 insertions, 29 deletions
diff --git a/sql/field.cc b/sql/field.cc
index e573f6528f4..5e76c590aac 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1866,6 +1866,7 @@ int Field_long::store(double nr)
else if (nr > (double) UINT_MAX32)
{
res= UINT_MAX32;
+ set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index c7384857d79..35bcf794d4a 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -2408,20 +2408,58 @@ ha_innobase::write_row(
position in the source table need not be adjusted after the
intermediate COMMIT, since writes by other transactions are
being blocked by a MySQL table lock TL_WRITE_ALLOW_READ. */
- ut_a(prebuilt->trx->mysql_n_tables_locked == 2);
- ut_a(UT_LIST_GET_LEN(prebuilt->trx->trx_locks) >= 2);
- dict_table_t* table = lock_get_ix_table(
- UT_LIST_GET_FIRST(prebuilt->trx->trx_locks));
+
+ dict_table_t* src_table;
+ ibool mode;
+
num_write_row = 0;
+
/* Commit the transaction. This will release the table
locks, so they have to be acquired again. */
- innobase_commit(user_thd, prebuilt->trx);
- /* Note that this transaction is still active. */
- user_thd->transaction.all.innodb_active_trans = 1;
- /* Re-acquire the IX table lock on the source table. */
- row_lock_table_for_mysql(prebuilt, table);
- /* We will need an IX lock on the destination table. */
- prebuilt->sql_stat_start = TRUE;
+
+ /* Altering an InnoDB table */
+ /* Get the source table. */
+ src_table = lock_get_src_table(
+ prebuilt->trx, prebuilt->table, &mode);
+ if (!src_table) {
+ no_commit:
+ /* Unknown situation: do not commit */
+ /*
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB error: ALTER TABLE is holding lock"
+ " on %lu tables!\n",
+ prebuilt->trx->mysql_n_tables_locked);
+ */
+ ;
+ } else if (src_table == prebuilt->table) {
+ /* Source table is not in InnoDB format:
+ no need to re-acquire locks on it. */
+
+ /* Altering to InnoDB format */
+ innobase_commit(user_thd, prebuilt->trx);
+ /* Note that this transaction is still active. */
+ user_thd->transaction.all.innodb_active_trans = 1;
+ /* We will need an IX lock on the destination table. */
+ prebuilt->sql_stat_start = TRUE;
+ } else {
+ /* Ensure that there are no other table locks than
+ LOCK_IX and LOCK_AUTO_INC on the destination table. */
+ if (!lock_is_table_exclusive(prebuilt->table,
+ prebuilt->trx)) {
+ goto no_commit;
+ }
+
+ /* Commit the transaction. This will release the table
+ locks, so they have to be acquired again. */
+ innobase_commit(user_thd, prebuilt->trx);
+ /* Note that this transaction is still active. */
+ user_thd->transaction.all.innodb_active_trans = 1;
+ /* Re-acquire the table lock on the source table. */
+ row_lock_table_for_mysql(prebuilt, src_table, mode);
+ /* We will need an IX lock on the destination table. */
+ prebuilt->sql_stat_start = TRUE;
+ }
}
num_write_row++;
@@ -5145,7 +5183,8 @@ ha_innobase::external_lock(
if (thd->in_lock_tables &&
thd->variables.innodb_table_locks) {
ulint error;
- error = row_lock_table_for_mysql(prebuilt, 0);
+ error = row_lock_table_for_mysql(prebuilt,
+ NULL, LOCK_TABLE_EXP);
if (error != DB_SUCCESS) {
error = convert_error_code_to_mysql(
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 74e3c22e443..9133de9c546 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -4244,7 +4244,7 @@ bool ndbcluster_init()
new Ndb_cluster_connection(ndbcluster_connectstring)) == 0)
{
DBUG_PRINT("error",("Ndb_cluster_connection(%s)",ndbcluster_connectstring));
- DBUG_RETURN(TRUE);
+ goto ndbcluster_init_error;
}
// Create a Ndb object to open the connection to NDB
@@ -4253,25 +4253,33 @@ bool ndbcluster_init()
if (g_ndb->init() != 0)
{
ERR_PRINT (g_ndb->getNdbError());
- DBUG_RETURN(TRUE);
+ goto ndbcluster_init_error;
}
- if ((res= g_ndb_cluster_connection->connect(1)) == 0)
+ if ((res= g_ndb_cluster_connection->connect(0,0,0)) == 0)
{
+ DBUG_PRINT("info",("NDBCLUSTER storage engine at %s on port %d",
+ g_ndb_cluster_connection->get_connected_host(),
+ g_ndb_cluster_connection->get_connected_port()));
g_ndb->waitUntilReady(10);
}
else if(res == 1)
{
if (g_ndb_cluster_connection->start_connect_thread()) {
DBUG_PRINT("error", ("g_ndb_cluster_connection->start_connect_thread()"));
- DBUG_RETURN(TRUE);
+ goto ndbcluster_init_error;
+ }
+ {
+ char buf[1024];
+ DBUG_PRINT("info",("NDBCLUSTER storage engine not started, will connect using %s",
+ g_ndb_cluster_connection->get_connectstring(buf,sizeof(buf))));
}
}
else
{
DBUG_ASSERT(res == -1);
DBUG_PRINT("error", ("permanent error"));
- DBUG_RETURN(TRUE);
+ goto ndbcluster_init_error;
}
(void) hash_init(&ndbcluster_open_tables,system_charset_info,32,0,0,
@@ -4281,9 +4289,12 @@ bool ndbcluster_init()
ndbcluster_inited= 1;
#ifdef USE_DISCOVER_ON_STARTUP
if (ndb_discover_tables() != 0)
- DBUG_RETURN(TRUE);
+ goto ndbcluster_init_error;
#endif
DBUG_RETURN(FALSE);
+ ndbcluster_init_error:
+ ndbcluster_end();
+ DBUG_RETURN(TRUE);
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 382042e2b42..226b462a2bf 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1539,14 +1539,13 @@ void mysql_down_server_cb(void *, void *)
// destroy callback resources
void mysql_cb_destroy(void *)
-{
- UnRegisterEventNotification(eh); // cleanup down event notification
+{
+ UnRegisterEventNotification(eh); // cleanup down event notification
NX_UNWRAP_INTERFACE(ref);
-
- /* Deregister NSS volume deactivation event */
- NX_UNWRAP_INTERFACE(refneb);
+ /* Deregister NSS volume deactivation event */
+ NX_UNWRAP_INTERFACE(refneb);
if (neb_consumer_id)
- UnRegisterConsumer(neb_consumer_id, NULL);
+ UnRegisterConsumer(neb_consumer_id, NULL);
}
@@ -1665,6 +1664,7 @@ ulong neb_event_callback(struct EventBlock *eblock)
nw_panic = TRUE;
event_flag= TRUE;
kill_server(0);
+
}
}
return 0;
@@ -1738,8 +1738,8 @@ static void init_signals(void)
for (uint i=0 ; i < sizeof(signals)/sizeof(int) ; i++)
signal(signals[i], kill_server);
mysql_cb_init(); // initialize callbacks
-}
+}
static void start_signal_handler(void)
{
@@ -2262,7 +2262,13 @@ extern "C" pthread_handler_decl(handle_shutdown,arg)
#endif
-const char *load_default_groups[]= { "mysqld","server",MYSQL_BASE_VERSION,0,0};
+const char *load_default_groups[]= {
+#ifdef HAVE_NDBCLUSTER_DB
+"mysql_cluster",
+#endif
+"mysqld","server",MYSQL_BASE_VERSION,0,0};
+static const int load_default_groups_sz=
+sizeof(load_default_groups)/sizeof(load_default_groups[0]);
bool open_log(MYSQL_LOG *log, const char *hostname,
const char *opt_name, const char *extension,
@@ -2884,6 +2890,7 @@ int win_main(int argc, char **argv)
int main(int argc, char **argv)
#endif
{
+
DEBUGGER_OFF;
MY_INIT(argv[0]); // init my_sys library & pthreads
@@ -3079,7 +3086,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
#endif /* __NT__ */
/* (void) pthread_attr_destroy(&connection_attrib); */
-
+
DBUG_PRINT("quit",("Exiting main thread"));
#ifndef __WIN__
@@ -3129,6 +3136,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
#endif
clean_up_mutexes();
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+
exit(0);
return(0); /* purecov: deadcode */
}
@@ -3256,7 +3264,7 @@ int main(int argc, char **argv)
and we are now stuck with it.
*/
if (my_strcasecmp(system_charset_info, argv[1],"mysql"))
- load_default_groups[3]= argv[1];
+ load_default_groups[load_default_groups_sz-2]= argv[1];
start_mode= 1;
Service.Init(argv[1], mysql_service);
return 0;
@@ -3277,7 +3285,7 @@ int main(int argc, char **argv)
opt_argv=argv;
start_mode= 1;
if (my_strcasecmp(system_charset_info, argv[2],"mysql"))
- load_default_groups[3]= argv[2];
+ load_default_groups[load_default_groups_sz-2]= argv[2];
Service.Init(argv[2], mysql_service);
return 0;
}
@@ -6257,6 +6265,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
have_berkeley_db= SHOW_OPTION_YES;
else
have_berkeley_db= SHOW_OPTION_DISABLED;
+#else
+ if (opt_bdb)
+ sql_print_warning("this binary does not contain BDB storage engine");
#endif
break;
case OPT_ISAM:
@@ -6265,6 +6276,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
have_isam= SHOW_OPTION_YES;
else
have_isam= SHOW_OPTION_DISABLED;
+#else
+ if (opt_isam)
+ sql_print_warning("this binary does not contain ISAM storage engine");
#endif
break;
case OPT_NDBCLUSTER:
@@ -6273,6 +6287,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
have_ndbcluster= SHOW_OPTION_YES;
else
have_ndbcluster= SHOW_OPTION_DISABLED;
+#else
+ if (opt_ndbcluster)
+ sql_print_warning("this binary does not contain NDBCLUSTER storage engine");
#endif
break;
case OPT_INNODB:
@@ -6281,6 +6298,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
have_innodb= SHOW_OPTION_YES;
else
have_innodb= SHOW_OPTION_DISABLED;
+#else
+ if (opt_innodb)
+ sql_print_warning("this binary does not contain INNODB storage engine");
#endif
break;
case OPT_INNODB_DATA_FILE_PATH: