3526 magnus.blaudd@stripped 2011-09-27 [merge]
Merge wl5881/5.5-cluster -> 5.5-cluster
modified:
mysql-test/suite/innodb/r/innodb-index.result
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.h
sql/ha_ndbcluster_binlog.cc
sql/ha_ndbcluster_binlog.h
sql/ha_ndbcluster_glue.h
sql/handler.cc
sql/handler.h
sql/lock.h
sql/ndb_global_schema_lock.cc
sql/ndb_global_schema_lock.h
sql/sql_db.cc
sql/sql_parse.cc
sql/sql_rename.cc
sql/sql_table.cc
sql/sql_truncate.cc
storage/ndb/CMakeLists.txt
storage/ndb/src/common/logger/FileLogHandler.cpp
storage/ndb/src/common/util/File.cpp
3525 Jonas Oreland 2011-09-26 [merge]
ndb - merge 7.1 to cluster-5.5
modified:
storage/ndb/src/kernel/SimBlockList.cpp
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp
storage/ndb/src/kernel/ndbd.cpp
storage/ndb/src/kernel/vm/Configuration.cpp
storage/ndb/src/kernel/vm/mt_thr_config.cpp
storage/ndb/src/kernel/vm/mt_thr_config.hpp
=== modified file 'mysql-test/suite/innodb/r/innodb-index.result'
--- a/mysql-test/suite/innodb/r/innodb-index.result 2011-08-31 10:39:08 +0000
+++ b/mysql-test/suite/innodb/r/innodb-index.result 2011-09-25 20:16:51 +0000
@@ -877,7 +877,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
explain select * from t1 where b like 'adfd%';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range b b 769 NULL 11 Using where
+1 SIMPLE t1 ALL b NULL NULL NULL 15 Using where
drop table t1;
set global innodb_file_per_table=on;
set global innodb_file_format='Barracuda';
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2011-09-22 17:03:53 +0000
+++ b/sql/ha_ndbcluster.cc 2011-09-27 10:55:07 +0000
@@ -342,7 +342,7 @@ ndbcluster_partition_flags()
HA_CAN_PARTITION_UNIQUE | HA_USE_AUTO_PARTITION);
}
-#ifndef MCP_WL3749
+#ifndef NDB_WITHOUT_ONLINE_ALTER
static uint
ndbcluster_alter_table_flags(uint flags)
{
@@ -352,13 +352,6 @@ ndbcluster_alter_table_flags(uint flags)
return (HA_PARTITION_FUNCTION_SUPPORTED);
}
#else
-#ifndef NDB_WITHOUT_ONLINE_ALTER
-static uint
-ndbcluster_alter_partition_flags()
-{
- return HA_PARTITION_FUNCTION_SUPPORTED;
-}
-#else
static uint
ndbcluster_alter_table_flags(uint flags)
{
@@ -384,7 +377,6 @@ ndbcluster_alter_table_flags(uint flags)
return f;
}
#endif
-#endif
#define NDB_AUTO_INCREMENT_RETRIES 100
#define BATCH_FLUSH_SIZE (32768)
@@ -1218,8 +1210,8 @@ Thd_ndb::Thd_ndb(THD* thd) :
m_pushed_queries_dropped= 0;
m_pushed_queries_executed= 0;
m_pushed_reads= 0;
- bzero(m_transaction_no_hint_count, sizeof(m_transaction_no_hint_count));
- bzero(m_transaction_hint_count, sizeof(m_transaction_hint_count));
+ memset(m_transaction_no_hint_count, 0, sizeof(m_transaction_no_hint_count));
+ memset(m_transaction_hint_count, 0, sizeof(m_transaction_hint_count));
global_schema_lock_trans= NULL;
global_schema_lock_count= 0;
global_schema_lock_error= 0;
@@ -1394,7 +1386,7 @@ int ha_ndbcluster::ndb_err(NdbTransactio
m_table->setStatusInvalid();
/* Close other open handlers not used by any thread */
TABLE_LIST table_list;
- bzero((char*) &table_list,sizeof(table_list));
+ memset(&table_list, 0, sizeof(table_list));
table_list.db= m_dbname;
table_list.alias= table_list.table_name= m_tabname;
close_cached_tables(thd, &table_list, have_lock, FALSE, FALSE);
@@ -6974,7 +6966,7 @@ void ha_ndbcluster::unpack_record(uchar
production code.
*/
if (actual_length < field->pack_length())
- bzero(field->ptr + actual_length,
+ memset(field->ptr + actual_length, 0,
field->pack_length() - actual_length);
#endif
field->move_field_offset(-dst_offset);
@@ -7038,7 +7030,7 @@ static void get_default_value(void *def_
memcpy(def_val, src_ptr, actual_length);
#ifdef HAVE_purify
if (actual_length < field->pack_length())
- bzero(((char*)def_val) + actual_length,
+ memset(((char*)def_val) + actual_length, 0,
field->pack_length() - actual_length);
#endif
}
@@ -7847,7 +7839,7 @@ void ha_ndbcluster::get_dynamic_partitio
{
DBUG_PRINT("info", ("ha_ndbcluster::get_dynamic_partition_info"));
- bzero((char*) stat_info, sizeof(PARTITION_STATS));
+ memset(stat_info, 0, sizeof(PARTITION_STATS));
int error = 0;
THD *thd = table->in_use;
@@ -12670,7 +12662,7 @@ static int ndbcluster_init(void *p)
ndb_dictionary_is_mysqld= 1;
ndb_setup_complete= 0;
ndbcluster_hton= (handlerton *)p;
- ndbcluster_global_schema_lock_init();
+ ndbcluster_global_schema_lock_init(ndbcluster_hton);
{
handlerton *h= ndbcluster_hton;
@@ -12685,18 +12677,8 @@ static int ndbcluster_init(void *p)
h->show_status= ndbcluster_show_status; /* Show status */
h->alter_tablespace= ndbcluster_alter_tablespace; /* Show status */
h->partition_flags= ndbcluster_partition_flags; /* Partition flags */
-#ifndef MCP_WL3749
- h->alter_table_flags=
- ndbcluster_alter_table_flags; /* Alter table flags */
-#else
-#ifndef NDB_WITHOUT_ONLINE_ALTER
- h->alter_partition_flags=
- ndbcluster_alter_partition_flags; /* Alter partition flags */
-#else
h->alter_table_flags=
ndbcluster_alter_table_flags; /* Alter table flags */
-#endif
-#endif
#if MYSQL_VERSION_ID >= 50501
h->fill_is_table= ndbcluster_fill_is_table;
#else
@@ -13249,13 +13231,9 @@ ulonglong ha_ndbcluster::table_flags(voi
HA_HAS_OWN_BINLOGGING |
HA_BINLOG_ROW_CAPABLE |
HA_HAS_RECORDS |
-#ifndef MCP_WL3749
- HA_ONLINE_ALTER |
-#else
#ifndef NDB_WITHOUT_ONLINE_ALTER
HA_ONLINE_ALTER |
#endif
-#endif
0;
/*
@@ -13675,7 +13653,7 @@ int handle_trailing_share(THD *thd, NDB_
pthread_mutex_unlock(&ndbcluster_mutex);
TABLE_LIST table_list;
- bzero((char*) &table_list,sizeof(table_list));
+ memset(&table_list, 0, sizeof(table_list));
table_list.db= share->db;
table_list.alias= table_list.table_name= share->table_name;
close_cached_tables(thd, &table_list, TRUE, FALSE, FALSE);
@@ -16360,7 +16338,7 @@ ha_ndbcluster::set_up_partition_info(par
DBUG_RETURN(0);
}
-#ifndef MCP_WL3749
+#ifndef NDB_WITHOUT_ONLINE_ALTER
static
HA_ALTER_FLAGS supported_alter_operations()
{
=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h 2011-09-14 14:23:55 +0000
+++ b/sql/ha_ndbcluster.h 2011-09-23 12:40:40 +0000
@@ -279,7 +279,7 @@ struct Ndb_local_table_statistics {
#include "ndb_thd_ndb.h"
struct st_ndb_status {
- st_ndb_status() { bzero(this, sizeof(struct st_ndb_status)); }
+ st_ndb_status() { memset(this, 0, sizeof(struct st_ndb_status)); }
long cluster_node_id;
const char * connected_host;
long connected_port;
@@ -511,7 +511,7 @@ static void set_tabname(const char *path
qc_engine_callback *engine_callback,
ulonglong *engine_data);
-#ifndef MCP_WL3749
+#ifndef NDB_WITHOUT_ONLINE_ALTER
int check_if_supported_alter(TABLE *altered_table,
HA_CREATE_INFO *create_info,
HA_ALTER_INFO *alter_info,
@@ -631,7 +631,7 @@ private:
int ndb_optimize_table(THD* thd, uint delay);
-#ifndef MCP_WL3749
+#ifndef NDB_WITHOUT_ONLINE_ALTER
int alter_frm(THD *thd, const char *file, NDB_ALTER_DATA *alter_data);
#endif
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2011-09-21 10:57:59 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2011-09-23 12:40:40 +0000
@@ -338,7 +338,13 @@ ndb_binlog_open_shadow_table(THD *thd, N
if ((error= open_table_def(thd, shadow_table_share, 0)) ||
(error= open_table_from_share(thd, shadow_table_share, "", 0,
(uint) (OPEN_FRM_FILE_ONLY | DELAYED_OPEN | READ_ALL),
- 0, shadow_table, OTM_OPEN)))
+ 0, shadow_table,
+#ifdef NDB_WITHOUT_ONLINE_ALTER
+ false
+#else
+ OTM_OPEN
+#endif
+ )))
{
DBUG_PRINT("error", ("failed to open shadow table, error: %d my_errno: %d",
error, my_errno));
@@ -2330,7 +2336,7 @@ ndb_handle_schema_change(THD *thd, Ndb *
if (do_close_cached_tables)
{
TABLE_LIST table_list;
- bzero((char*) &table_list,sizeof(table_list));
+ memset(&table_list, 0, sizeof(table_list));
table_list.db= (char *)dbname;
table_list.alias= table_list.table_name= (char *)tabname;
close_cached_tables(thd, &table_list, FALSE, FALSE, FALSE);
@@ -2556,7 +2562,7 @@ ndb_binlog_thread_handle_schema_event(TH
ndbtab_g.invalidate();
}
TABLE_LIST table_list;
- bzero((char*) &table_list,sizeof(table_list));
+ memset(&table_list, 0, sizeof(table_list));
table_list.db= schema->db;
table_list.alias= table_list.table_name= schema->name;
close_cached_tables(thd, &table_list, FALSE, FALSE, FALSE);
@@ -2886,7 +2892,7 @@ ndb_binlog_thread_handle_schema_event_po
}
{
TABLE_LIST table_list;
- bzero((char*) &table_list,sizeof(table_list));
+ memset(&table_list, 0, sizeof(table_list));
table_list.db= schema->db;
table_list.alias= table_list.table_name= schema->name;
close_cached_tables(thd, &table_list, FALSE, FALSE, FALSE);
@@ -2922,7 +2928,7 @@ ndb_binlog_thread_handle_schema_event_po
}
{
TABLE_LIST table_list;
- bzero((char*) &table_list,sizeof(table_list));
+ memset(&table_list, 0, sizeof(table_list));
table_list.db= schema->db;
table_list.alias= table_list.table_name= schema->name;
close_cached_tables(thd, &table_list, FALSE, FALSE, FALSE);
@@ -2991,7 +2997,7 @@ ndb_binlog_thread_handle_schema_event_po
remote on-line alter table
*/
TABLE_LIST table_list;
- bzero((char*) &table_list,sizeof(table_list));
+ memset(&table_list, 0, sizeof(table_list));
table_list.db= (char *)schema->db;
table_list.alias= table_list.table_name= (char *)schema->name;
close_cached_tables(thd, &table_list, TRUE, FALSE, FALSE);
@@ -3514,7 +3520,7 @@ inline void slave_reset_conflict_fn(NDB_
NDB_CONFLICT_FN_SHARE *cfn_share= share->m_cfn_share;
if (cfn_share)
{
- bzero((char*)cfn_share, sizeof(*cfn_share));
+ memset(cfn_share, 0, sizeof(*cfn_share));
}
}
@@ -5841,7 +5847,7 @@ ndb_find_binlog_index_row(ndb_binlog_ind
if (row == NULL)
{
row= (ndb_binlog_index_row*)sql_alloc(sizeof(ndb_binlog_index_row));
- bzero((char*)row, sizeof(ndb_binlog_index_row));
+ memset(row, 0, sizeof(ndb_binlog_index_row));
row->next= first;
*rows= row;
if (found_id)
@@ -6925,7 +6931,7 @@ restart_cluster_failure:
DBUG_PRINT("info", ("Initializing transaction"));
inj->new_trans(thd, &trans);
rows= &_row;
- bzero((char*)&_row, sizeof(_row));
+ memset(&_row, 0, sizeof(_row));
thd->variables.character_set_client= &my_charset_latin1;
goto commit_to_binlog;
}
@@ -6952,7 +6958,7 @@ restart_cluster_failure:
setReportThreshEventGCISlip(opt_ndb_report_thresh_binlog_epoch_slip);
i_ndb->setReportThreshEventFreeMem(opt_ndb_report_thresh_binlog_mem_usage);
- bzero((char*)&_row, sizeof(_row));
+ memset(&_row, 0, sizeof(_row));
thd->variables.character_set_client= &my_charset_latin1;
DBUG_PRINT("info", ("Initializing transaction"));
inj->new_trans(thd, &trans);
=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h 2011-09-19 13:37:03 +0000
+++ b/sql/ha_ndbcluster_binlog.h 2011-09-22 13:41:13 +0000
@@ -120,9 +120,6 @@ private:
extern Ndb_cluster_connection* g_ndb_cluster_connection;
-void ndbcluster_global_schema_lock_init();
-void ndbcluster_global_schema_lock_deinit();
-
extern unsigned char g_node_id_map[max_ndb_nodes];
extern pthread_mutex_t LOCK_ndb_util_thread;
extern pthread_cond_t COND_ndb_util_thread;
=== modified file 'sql/ha_ndbcluster_glue.h'
--- a/sql/ha_ndbcluster_glue.h 2011-09-09 09:30:43 +0000
+++ b/sql/ha_ndbcluster_glue.h 2011-09-23 12:40:40 +0000
@@ -66,9 +66,6 @@ bool close_cached_tables(THD *thd, TABLE
return close_cached_tables(thd, tables, wait_for_refresh, LONG_TIMEOUT);
}
-/* Online alter table not supported */
-#define NDB_WITHOUT_ONLINE_ALTER
-
/* thd has no version field anymore */
#define NDB_THD_HAS_NO_VERSION
@@ -78,15 +75,6 @@ bool close_cached_tables(THD *thd, TABLE
/* No mysql_rm_table_part2 anymore in 5.5.8 */
#define NDB_NO_MYSQL_RM_TABLE_PART2
-#ifdef MCP_WL3749
-/*
- The enum open_table_mode has been removed in 5.5.7 and 'open_table_from_share'
- now takes "bool is_create_table" instead of the enum type. Define OTM_OPEN
- to false since it's not a create table
-*/
-#define OTM_OPEN false
-#endif
-
#endif
#if MYSQL_VERSION_ID >= 50600
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2011-09-14 13:56:17 +0000
+++ b/sql/handler.cc 2011-09-22 13:41:13 +0000
@@ -4639,7 +4639,6 @@ int ha_make_pushed_joins(THD *thd, AQP::
}
#endif
-#ifdef HAVE_NDB_BINLOG
/*
TODO: change this into a dynamic struct
List<handlerton> does not work as
@@ -4653,6 +4652,7 @@ struct hton_list_st
uint sz;
};
+#ifdef HAVE_NDB_BINLOG
struct binlog_func_st
{
enum_binlog_func fn;
@@ -4777,6 +4777,91 @@ void ha_binlog_log_query(THD *thd, handl
}
#endif
+
+#ifndef MC_GLOBAL_SCHEMA_LOCK
+/**
+ Fill list of htons which are initialized and have the global_schema_func set
+*/
+static my_bool global_schema_func_list(THD *thd, plugin_ref plugin, void *arg)
+{
+ hton_list_st *hton_list= (hton_list_st *)arg;
+ handlerton *hton= plugin_data(plugin, handlerton *);
+ if (hton->state == SHOW_OPTION_YES && hton->global_schema_func)
+ {
+ uint sz= hton_list->sz;
+ if (sz == MAX_HTON_LIST_ST-1)
+ {
+ /* list full */
+ return FALSE;
+ }
+ hton_list->hton[sz]= hton;
+ hton_list->sz= sz+1;
+ }
+ return FALSE;
+}
+
+
+/**
+ Lock the global(distributed) schema lock
+*/
+static int ha_global_schema_lock(THD *thd, bool no_lock_queue)
+{
+ hton_list_st hton_list;
+ uint i, sz, res= 0;
+
+ hton_list.sz= 0;
+ plugin_foreach(thd, global_schema_func_list,
+ MYSQL_STORAGE_ENGINE_PLUGIN, &hton_list);
+
+ for (i= 0, sz= hton_list.sz; i < sz ; i++)
+ res|= hton_list.hton[i]->global_schema_func(thd, true, (void*)no_lock_queue);
+ return res;
+}
+
+/**
+ Unlock the global(distributed) schema lock
+*/
+static int ha_global_schema_unlock(THD *thd)
+{
+ hton_list_st hton_list;
+ uint i, sz, res= 0;
+
+ hton_list.sz= 0;
+ plugin_foreach(thd, global_schema_func_list,
+ MYSQL_STORAGE_ENGINE_PLUGIN, &hton_list);
+
+ for (i= 0, sz= hton_list.sz; i < sz ; i++)
+ res|= hton_list.hton[i]->global_schema_func(thd, false, NULL);
+ return res;
+}
+
+Ha_global_schema_lock_guard::Ha_global_schema_lock_guard(THD *thd)
+ : m_thd(thd), m_locked(false)
+{
+}
+
+Ha_global_schema_lock_guard::~Ha_global_schema_lock_guard()
+{
+ if (m_locked)
+ ha_global_schema_unlock(m_thd);
+}
+
+int Ha_global_schema_lock_guard::lock(bool no_lock_queue)
+{
+ /* only one lock call allowed */
+ DBUG_ASSERT(!m_locked);
+
+ /*
+ Always set m_locked, even if lock fails. Since the
+ lock/unlock calls are reference counted, the number
+ of calls to lock and unlock need to match up.
+ */
+ m_locked= true;
+
+ return ha_global_schema_lock(m_thd, no_lock_queue);
+}
+#endif
+
/**
Read the first row of a multi-range set.
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2011-09-14 13:56:17 +0000
+++ b/sql/handler.h 2011-09-22 13:41:13 +0000
@@ -921,6 +921,9 @@ struct handlerton
AQP::Join_plan* plan,
uint* pushed);
#endif
+#ifndef MCP_GLOBAL_SCHEMA_LOCK
+ int (*global_schema_func)(THD* thd, bool lock, void* args);
+#endif
uint32 license; /* Flag for Engine License */
void *data; /* Location for engines to keep personal structures */
@@ -2608,6 +2611,19 @@ int ha_binlog_end(THD *thd);
#define ha_binlog_end(a) do {} while (0)
#endif
+#ifndef MCP_GLOBAL_SCHEMA_LOCK
+class Ha_global_schema_lock_guard
+{
+public:
+ Ha_global_schema_lock_guard(THD *thd);
+ ~Ha_global_schema_lock_guard();
+ int lock(bool no_lock_queue= false);
+private:
+ THD* m_thd;
+ bool m_locked;
+};
+#endif
+
const char *get_canonical_filename(handler *file, const char *path,
char *tmp_path);
bool mysql_xa_recover(THD *thd);
=== modified file 'sql/lock.h'
--- a/sql/lock.h 2011-08-31 10:39:08 +0000
+++ b/sql/lock.h 2011-09-22 13:41:13 +0000
@@ -40,8 +40,4 @@ bool lock_schema_name(THD *thd, const ch
bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
const char *db, const char *name);
-#ifndef MCP_GLOBAL_SCHEMA_LOCK
-#include "ndb_global_schema_lock_guard.h"
-#endif
-
#endif /* LOCK_INCLUDED */
=== modified file 'sql/ndb_global_schema_lock.cc'
--- a/sql/ndb_global_schema_lock.cc 2011-07-01 09:56:57 +0000
+++ b/sql/ndb_global_schema_lock.cc 2011-09-22 13:41:13 +0000
@@ -177,7 +177,8 @@ private:
extern ulong opt_ndb_extra_logging;
-static int
+static
+int
ndbcluster_global_schema_lock(THD *thd, bool no_lock_queue,
bool report_cluster_disconnected)
{
@@ -352,15 +353,30 @@ ndbcluster_global_schema_unlock(THD *thd
DBUG_RETURN(0);
}
+static
+int
+ndbcluster_global_schema_func(THD *thd, bool lock, void* args)
+{
+ if (lock)
+ {
+ bool no_lock_queue = (bool)args;
+ return ndbcluster_global_schema_lock(thd, no_lock_queue, true);
+ }
+
+ return ndbcluster_global_schema_unlock(thd);
+}
+
#include "ndb_global_schema_lock.h"
-void ndbcluster_global_schema_lock_init(void)
+void ndbcluster_global_schema_lock_init(handlerton *hton)
{
assert(gsl_initialized == false);
assert(gsl_is_locked_or_queued == 0);
assert(gsl_no_locking_allowed == 0);
gsl_initialized= true;
pthread_mutex_init(&gsl_mutex, MY_MUTEX_INIT_FAST);
+
+ hton->global_schema_func= ndbcluster_global_schema_func;
}
=== modified file 'sql/ndb_global_schema_lock.h'
--- a/sql/ndb_global_schema_lock.h 2011-03-08 22:08:44 +0000
+++ b/sql/ndb_global_schema_lock.h 2011-09-22 13:41:13 +0000
@@ -18,7 +18,7 @@
#ifndef NDB_GLOBAL_SCHEMA_LOCK_H
#define NDB_GLOBAL_SCHEMA_LOCK_H
-void ndbcluster_global_schema_lock_init(void);
+void ndbcluster_global_schema_lock_init(struct handlerton*);
void ndbcluster_global_schema_lock_deinit(void);
#endif
=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc 2011-08-31 10:39:08 +0000
+++ b/sql/sql_db.cc 2011-09-22 13:41:13 +0000
@@ -563,7 +563,7 @@ int mysql_create_db(THD *thd, char *db,
}
#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ndb_global_schema_lock_guard global_schema_lock(thd);
+ Ha_global_schema_lock_guard global_schema_lock(thd);
(void)global_schema_lock.lock();
#endif
@@ -700,7 +700,7 @@ bool mysql_alter_db(THD *thd, const char
DBUG_ENTER("mysql_alter_db");
#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ndb_global_schema_lock_guard global_schema_lock(thd);
+ Ha_global_schema_lock_guard global_schema_lock(thd);
(void)global_schema_lock.lock();
#endif
@@ -786,7 +786,7 @@ bool mysql_rm_db(THD *thd,char *db,bool
DBUG_ENTER("mysql_rm_db");
#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ndb_global_schema_lock_guard global_schema_lock(thd);
+ Ha_global_schema_lock_guard global_schema_lock(thd);
(void)global_schema_lock.lock();
#endif
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2011-08-31 10:39:08 +0000
+++ b/sql/sql_parse.cc 2011-09-22 13:41:13 +0000
@@ -2434,7 +2434,7 @@ case SQLCOM_PREPARE:
}
#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ndb_global_schema_lock_guard global_schema_lock(thd);
+ Ha_global_schema_lock_guard global_schema_lock(thd);
if (!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
(void)global_schema_lock.lock();
=== modified file 'sql/sql_rename.cc'
--- a/sql/sql_rename.cc 2011-08-31 10:39:08 +0000
+++ b/sql/sql_rename.cc 2011-09-22 13:41:13 +0000
@@ -49,7 +49,7 @@ bool mysql_rename_tables(THD *thd, TABLE
DBUG_ENTER("mysql_rename_tables");
#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ndb_global_schema_lock_guard global_schema_lock(thd);
+ Ha_global_schema_lock_guard global_schema_lock(thd);
#endif
/*
Avoid problems with a rename on a table that we have locked or
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2011-09-09 12:41:37 +0000
+++ b/sql/sql_table.cc 2011-09-22 13:41:13 +0000
@@ -1865,7 +1865,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST
DBUG_ENTER("mysql_rm_table");
#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ndb_global_schema_lock_guard global_schema_lock(thd);
+ Ha_global_schema_lock_guard global_schema_lock(thd);
#endif
/* Disable drop of enabled log tables, must be done before name locking */
@@ -4386,7 +4386,7 @@ bool mysql_create_table(THD *thd, TABLE_
DBUG_ENTER("mysql_create_table");
#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ndb_global_schema_lock_guard global_schema_lock(thd);
+ Ha_global_schema_lock_guard global_schema_lock(thd);
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
!create_info->frm_only)
{
@@ -4600,7 +4600,7 @@ bool mysql_create_like_table(THD* thd, T
DBUG_ENTER("mysql_create_like_table");
#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ndb_global_schema_lock_guard global_schema_lock(thd);
+ Ha_global_schema_lock_guard global_schema_lock(thd);
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
(void)global_schema_lock.lock();
@@ -6869,7 +6869,7 @@ bool mysql_alter_table(THD *thd,char *ne
}
#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ndb_global_schema_lock_guard global_schema_lock_guard(thd);
+ Ha_global_schema_lock_guard global_schema_lock_guard(thd);
if (ha_legacy_type(table->s->db_type()) == DB_TYPE_NDBCLUSTER ||
ha_legacy_type(create_info->db_type) == DB_TYPE_NDBCLUSTER)
{
=== modified file 'sql/sql_truncate.cc'
--- a/sql/sql_truncate.cc 2011-05-30 21:13:02 +0000
+++ b/sql/sql_truncate.cc 2011-09-22 13:41:13 +0000
@@ -406,7 +406,7 @@ bool Truncate_statement::truncate_table(
DBUG_ENTER("Truncate_statement::truncate_table");
#ifndef MCP_GLOBAL_SCHEMA_LOCK
- Ndb_global_schema_lock_guard global_schema_lock_guard(thd);
+ Ha_global_schema_lock_guard global_schema_lock_guard(thd);
#endif
/* Initialize, or reinitialize in case of reexecution (SP). */
=== modified file 'storage/ndb/CMakeLists.txt'
--- a/storage/ndb/CMakeLists.txt 2011-09-16 14:31:26 +0000
+++ b/storage/ndb/CMakeLists.txt 2011-09-23 12:40:40 +0000
@@ -38,19 +38,14 @@ MACRO(NDB_CHECK_MYSQL_CLUSTER version_st
# Split the cluster_version further into Y.Y.Y subcomponents
IF(${cluster_version} MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
- SET(MYSQL_CLUSTER_VERSION_MAJOR ${CMAKE_MATCH_1} CACHE INTERNAL
- "MySQL Cluster Major version calculated from MySQL version" FORCE)
- SET(MYSQL_CLUSTER_VERSION_MINOR ${CMAKE_MATCH_2} CACHE INTERNAL
- "MySQL Cluster Minor version calculated from MySQL version" FORCE)
- SET(MYSQL_CLUSTER_VERSION_BUILD ${CMAKE_MATCH_3} CACHE INTERNAL
- "MySQL Cluster Build version calculated from MySQL version" FORCE)
+ SET(MYSQL_CLUSTER_VERSION_MAJOR ${CMAKE_MATCH_1})
+ SET(MYSQL_CLUSTER_VERSION_MINOR ${CMAKE_MATCH_2})
+ SET(MYSQL_CLUSTER_VERSION_BUILD ${CMAKE_MATCH_3})
ENDIF()
# Finally set MYSQL_CLUSTER_VERSION to be used as an indicator
# that this is a MySQL Cluster build, yay!
- SET(MYSQL_CLUSTER_VERSION ${cluster_version} CACHE INTERNAL
- "This is MySQL Cluster" FORCE)
-
+ SET(MYSQL_CLUSTER_VERSION ${cluster_version})
ENDIF()
ENDMACRO()
@@ -64,128 +59,12 @@ IF(CMAKE_CXX_FLAGS)
STRING(REPLACE "-Werror" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
ENDIF()
-IF (MYSQL_VERSION_ID LESS 50500)
- # Use same compiler defines as MySQL Server for debug compile
- MESSAGE(STATUS "Setting same debug compile defines")
- SET(CMAKE_CXX_FLAGS_DEBUG
- "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
- SET(CMAKE_C_FLAGS_DEBUG
- "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-ENDIF()
-
-IF(SOURCE_SUBLIBS)
- # Sourced by libmysqld/CMakeLists.txt in 5.1 only to get
- # NDBCLUSTER_SOURCES and NDBCLUSTER_LIBS, don't configure
- # again
-ELSE()
-
- NDB_CHECK_MYSQL_CLUSTER(${VERSION})
-
- INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/ndb_configure.cmake)
-
- INCLUDE_DIRECTORIES(
- # MySQL Server includes
- ${CMAKE_SOURCE_DIR}/include
- ${CMAKE_BINARY_DIR}/include
-
- # NDB includes
- ${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_SOURCE_DIR}/include/util
- ${CMAKE_CURRENT_SOURCE_DIR}/include/portlib
- ${CMAKE_CURRENT_SOURCE_DIR}/include/debugger
- ${CMAKE_CURRENT_SOURCE_DIR}/include/transporter
- ${CMAKE_CURRENT_SOURCE_DIR}/include/kernel
- ${CMAKE_CURRENT_SOURCE_DIR}/include/mgmapi
- ${CMAKE_CURRENT_SOURCE_DIR}/include/mgmcommon
- ${CMAKE_CURRENT_SOURCE_DIR}/include/ndbapi
- ${CMAKE_CURRENT_SOURCE_DIR}/include/logger
- ${CMAKE_CURRENT_BINARY_DIR}/include
-
- # Util library includes
- ${ZLIB_INCLUDE_DIR}
- ${READLINE_INCLUDE_DIR})
-
- # The root of storage/ndb/
- SET(NDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-
- OPTION(WITH_NDB_TEST
- "Include the NDB Cluster ndbapi test programs" OFF)
- IF(WITH_NDB_TEST)
- MESSAGE(STATUS "Building NDB test programs")
- ENDIF()
-
- OPTION(WITH_NDB_BINLOG
- "Disable NDB binlog" ON)
-
- OPTION(WITH_ERROR_INSERT
- "Enable error injection in MySQL Cluster" OFF)
-
- OPTION(WITH_NDB_DEBUG
- "Disable special ndb debug features" OFF)
-
- SET(NDB_CCFLAGS "")
- IF(DEFINED WITH_NDB_CCFLAGS)
- SET(NDB_CCFLAGS "${WITH_NDB_CCFLAGS}")
- ENDIF()
-
- IF(WITH_NDB_DEBUG OR CMAKE_BUILD_TYPE MATCHES "Debug")
- SET(NDB_CCFLAGS "${NDB_CCFLAGS} -DVM_TRACE -DNDB_DEBUG -DERROR_INSERT -DARRAY_GUARD -DACC_SAFE_QUEUE -DAPI_TRACE")
- ELSE()
- IF(WITH_ERROR_INSERT)
- SET(NDB_CCFLAGS "${NDB_CCFLAGS} -DERROR_INSERT")
- ENDIF()
- SET(NDB_CCFLAGS "${NDB_CCFLAGS} -DNDEBUG")
- ENDIF()
- SET(NDB_CCFLAGS "${NDB_CCFLAGS} $ENV{NDB_EXTRA_FLAGS}")
- MESSAGE(STATUS "Using extra FLAGS for ndb: \"${NDB_CCFLAGS}\"")
-
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NDB_CCFLAGS}")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${NDB_CCFLAGS}")
-
- # Check for Java and JDK needed by ndbjtie and clusterj
- INCLUDE(FindJava)
- INCLUDE(FindJNI)
- INCLUDE("${CMAKE_SOURCE_DIR}/storage/ndb/config/type_JAVA.cmake")
-
- IF(JAVA_COMPILE AND JAVA_ARCHIVE)
- MESSAGE(STATUS "Found Java")
- SET(HAVE_JAVA TRUE)
- ELSE()
- MESSAGE(STATUS "Could not find Java")
- SET(HAVE_JAVA FALSE)
- ENDIF()
-
- IF(JAVA_INCLUDE_PATH AND JAVA_INCLUDE_PATH2)
- MESSAGE(STATUS "Found JDK")
- SET(HAVE_JDK TRUE)
- ELSE()
- MESSAGE(STATUS "Could not find JDK")
- SET(HAVE_JDK FALSE)
- ENDIF()
-
- SET(WITH_CLASSPATH ${WITH_CLASSPATH} CACHE STRING
- "Enable the classpath for MySQL Cluster Java Connector")
-
- ADD_SUBDIRECTORY(include)
- ADD_SUBDIRECTORY(src)
- ADD_SUBDIRECTORY(tools)
- ADD_SUBDIRECTORY(test)
- IF(WITH_NDB_TEST)
- ADD_SUBDIRECTORY(src/cw/cpcd)
- ENDIF()
- IF (HAVE_JDK)
- ADD_SUBDIRECTORY(clusterj)
- ENDIF()
- ADD_SUBDIRECTORY(memcache)
-
-ENDIF()
-
-
-IF(WITHOUT_PARTITION_STORAGE_ENGINE)
- MESSAGE(FATAL_ERROR "NDBCLUSTER can't be compiled without PARTITION")
-ENDIF(WITHOUT_PARTITION_STORAGE_ENGINE)
+NDB_CHECK_MYSQL_CLUSTER(${VERSION})
+#
+# Add the ndbcluster plugin
+#
SET(NDBCLUSTER_SOURCES
../../sql/ha_ndbcluster.cc
../../sql/ha_ndbcluster_cond.cc
@@ -202,32 +81,134 @@ SET(NDBCLUSTER_SOURCES
../../sql/ndb_mi.cc
../../sql/ndb_conflict_trans.cc
)
+
+# Inlude directories used when building ha_ndbcluster
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/ndb/include)
-IF(EXISTS ${CMAKE_SOURCE_DIR}/storage/mysql_storage_engine.cmake)
- # Old plugin support on Windows only
- INCLUDE(${CMAKE_SOURCE_DIR}/storage/mysql_storage_engine.cmake)
- SET(NDBCLUSTER_LIBS ndbclient_static)
- MYSQL_STORAGE_ENGINE(NDBCLUSTER)
+IF(NOT MYSQL_CLUSTER_VERSION)
+ # Online alter table not supported in non MySQL Cluster
+ # versions yet, compile ndbcluster without online alter support
+ ADD_DEFINITIONS(-DNDB_WITHOUT_ONLINE_ALTER)
+ENDIF()
+
+# NDB is DEFAULT plugin in MySQL Cluster
+SET(is_default_plugin "")
+IF(MYSQL_CLUSTER_VERSION)
+ SET(is_default_plugin "DEFAULT")
+ENDIF()
+
+MYSQL_ADD_PLUGIN(ndbcluster ${NDBCLUSTER_SOURCES} STORAGE_ENGINE
+ ${is_default_plugin} STATIC_ONLY RECOMPILE_FOR_EMBEDDED
+ LINK_LIBRARIES ndbclient_static)
+
+#
+# Add NDB binaries if ndbcluster is built
+#
+IF (NOT DEFINED WITH_NDBCLUSTER)
+ # Not building NDB
+ RETURN()
+ENDIF()
+
+MESSAGE(STATUS "Building NDB")
+
+INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/ndb_configure.cmake)
+
+INCLUDE_DIRECTORIES(
+ # MySQL Server includes
+ ${CMAKE_SOURCE_DIR}/include
+ ${CMAKE_BINARY_DIR}/include
+
+ # NDB includes
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/util
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/portlib
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/debugger
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/transporter
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/kernel
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/mgmapi
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/mgmcommon
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/ndbapi
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/logger
+ ${CMAKE_CURRENT_BINARY_DIR}/include
+
+ # Util library includes
+ ${ZLIB_INCLUDE_DIR}
+ ${READLINE_INCLUDE_DIR})
+
+# The root of storage/ndb/
+SET(NDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+
+OPTION(WITH_NDB_TEST
+ "Include the NDB Cluster ndbapi test programs" OFF)
+IF(WITH_NDB_TEST)
+ MESSAGE(STATUS "Building NDB test programs")
+ENDIF()
+
+OPTION(WITH_NDB_BINLOG
+ "Disable NDB binlog" ON)
+
+OPTION(WITH_ERROR_INSERT
+ "Enable error injection in MySQL Cluster" OFF)
+
+OPTION(WITH_NDB_DEBUG
+ "Disable special ndb debug features" OFF)
+
+SET(NDB_CCFLAGS "")
+IF(DEFINED WITH_NDB_CCFLAGS)
+ SET(NDB_CCFLAGS "${WITH_NDB_CCFLAGS}")
+ENDIF()
+
+IF(WITH_NDB_DEBUG OR CMAKE_BUILD_TYPE MATCHES "Debug")
+ SET(NDB_CCFLAGS "${NDB_CCFLAGS} -DVM_TRACE -DNDB_DEBUG -DERROR_INSERT -DARRAY_GUARD -DACC_SAFE_QUEUE -DAPI_TRACE")
ELSE()
- # New plugin support, cross-platform
-
- # NDB is DEFAULT plugin in MySQL Cluster
- SET(is_default_plugin "")
- IF(MYSQL_CLUSTER_VERSION)
- SET(is_default_plugin "DEFAULT")
+ IF(WITH_ERROR_INSERT)
+ SET(NDB_CCFLAGS "${NDB_CCFLAGS} -DERROR_INSERT")
ENDIF()
+ SET(NDB_CCFLAGS "${NDB_CCFLAGS} -DNDEBUG")
+ENDIF()
- MYSQL_ADD_PLUGIN(ndbcluster ${NDBCLUSTER_SOURCES} STORAGE_ENGINE
- ${is_default_plugin} STATIC_ONLY RECOMPILE_FOR_EMBEDDED
- LINK_LIBRARIES ndbclient_static)
-
- IF (NOT MCP_BUG58158)
- IF(WITH_EMBEDDED_SERVER)
- # Kludge libndbclient into variable used when creating libmysqld
- SET (MYSQLD_STATIC_PLUGIN_LIBS ${MYSQLD_STATIC_PLUGIN_LIBS}
- ndbclient_static CACHE INTERNAL "" FORCE)
- ENDIF()
- ENDIF()
+SET(NDB_CCFLAGS "${NDB_CCFLAGS} $ENV{NDB_EXTRA_FLAGS}")
+MESSAGE(STATUS "Using extra FLAGS for ndb: \"${NDB_CCFLAGS}\"")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NDB_CCFLAGS}")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${NDB_CCFLAGS}")
+
+# Check for Java and JDK needed by ndbjtie and clusterj
+INCLUDE(FindJava)
+INCLUDE(FindJNI)
+INCLUDE("${CMAKE_SOURCE_DIR}/storage/ndb/config/type_JAVA.cmake")
+
+IF(JAVA_COMPILE AND JAVA_ARCHIVE)
+ MESSAGE(STATUS "Found Java")
+ SET(HAVE_JAVA TRUE)
+ELSE()
+ MESSAGE(STATUS "Could not find Java")
+ SET(HAVE_JAVA FALSE)
+ENDIF()
+
+IF(JAVA_INCLUDE_PATH AND JAVA_INCLUDE_PATH2)
+ MESSAGE(STATUS "Found JDK")
+ SET(HAVE_JDK TRUE)
+ELSE()
+ MESSAGE(STATUS "Could not find JDK")
+ SET(HAVE_JDK FALSE)
ENDIF()
+SET(WITH_CLASSPATH ${WITH_CLASSPATH} CACHE STRING
+ "Enable the classpath for MySQL Cluster Java Connector")
+
+ADD_SUBDIRECTORY(include)
+ADD_SUBDIRECTORY(src)
+ADD_SUBDIRECTORY(tools)
+ADD_SUBDIRECTORY(test)
+IF(WITH_NDB_TEST)
+ ADD_SUBDIRECTORY(src/cw/cpcd)
+ENDIF()
+IF (HAVE_JDK)
+ ADD_SUBDIRECTORY(clusterj)
+ENDIF()
+ADD_SUBDIRECTORY(memcache)
+
+IF(WITHOUT_PARTITION_STORAGE_ENGINE)
+ MESSAGE(FATAL_ERROR "NDBCLUSTER can't be compiled without PARTITION")
+ENDIF(WITHOUT_PARTITION_STORAGE_ENGINE)
=== modified file 'storage/ndb/src/common/logger/FileLogHandler.cpp'
--- a/storage/ndb/src/common/logger/FileLogHandler.cpp 2011-07-05 12:46:07 +0000
+++ b/storage/ndb/src/common/logger/FileLogHandler.cpp 2011-09-22 09:27:20 +0000
@@ -18,7 +18,7 @@
#include <ndb_global.h>
#include <FileLogHandler.hpp>
-#include <File.hpp>
+#include <util/File.hpp>
//
// PUBLIC
=== modified file 'storage/ndb/src/common/util/File.cpp'
--- a/storage/ndb/src/common/util/File.cpp 2011-07-05 12:46:07 +0000
+++ b/storage/ndb/src/common/util/File.cpp 2011-09-22 09:27:20 +0000
@@ -17,7 +17,7 @@
#include <ndb_global.h>
-#include <File.hpp>
+#include <util/File.hpp>
#include <NdbOut.hpp>
//
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5-cluster branch (magnus.blaudd:3525 to 3526) | magnus.blaudd | 29 Sep |