3014 Stewart Smith 2008-10-21 [merge]
merge mainline 6.4
modified:
mysql-test/suite/funcs_1/r/ndb_trig_1011ext.result
mysql-test/suite/funcs_1/t/disabled.def
mysql-test/suite/ndb/r/ndb_insert.result
mysql-test/suite/ndb/r/ndb_single_user.result
mysql-test/suite/ndb/t/ndb_insert.test
mysql-test/suite/ndb/t/ndb_single_user.test
mysql-test/suite/ndb_team/r/ndb_autodiscover3.result
mysql-test/suite/ndb_team/t/ndb_autodiscover3.test
mysql-test/suite/rpl/r/rpl_heartbeat.result
mysql-test/suite/rpl_ndb/r/rpl_ndb_rep_error.result
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.h
sql/share/errmsg.txt
storage/ndb/src/common/transporter/Transporter.hpp
storage/ndb/src/kernel/vm/ArrayPool.hpp
storage/ndb/src/kernel/vm/SimulatedBlock.cpp
storage/ndb/src/kernel/vm/mt.cpp
storage/ndb/test/include/HugoAsynchTransactions.hpp
storage/ndb/test/ndbapi/flexAsynch.cpp
storage/ndb/test/run-test/setup.cpp
storage/ndb/test/src/HugoAsynchTransactions.cpp
=== modified file 'include/config-win.h'
--- a/include/config-win.h 2008-09-21 15:53:13 +0000
+++ b/include/config-win.h 2008-10-21 14:49:10 +0000
@@ -428,7 +428,7 @@ inline double ulonglong2double(ulonglong
#define ENOTSUP 48
#endif
-#if _MSC_VER >= 1500 /* strtok_s is like strtok_r, but is new */
+#if _MSC_VER >= 1400 /* strtok_s is like strtok_r, but is new */
#define HAVE_STRTOK_R
#define strtok_r(A, B, C) strtok_s((A), (B), (C))
#endif
=== modified file 'include/my_pthread.h'
--- a/include/my_pthread.h 2008-08-21 06:38:03 +0000
+++ b/include/my_pthread.h 2008-10-15 05:27:54 +0000
@@ -101,7 +101,6 @@ struct timespec {
}
void win_pthread_init(void);
-int win_pthread_mutex_trylock(pthread_mutex_t *mutex);
int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *);
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
@@ -135,18 +134,58 @@ void pthread_exit(void *a); /* was #def
#undef SAFE_MUTEX /* This will cause conflicts */
typedef DWORD pthread_key_t;
#define pthread_key(T,V) DWORD V
-#define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF)
-#define pthread_key_delete(A) TlsFree(A)
-#define my_pthread_setspecific_ptr(T,V) (!TlsSetValue((T),(V)))
-#define pthread_setspecific(A,B) (!TlsSetValue((A),(B)))
-#define pthread_getspecific(A) (TlsGetValue(A))
-#define my_pthread_getspecific(T,A) ((T) TlsGetValue(A))
-#define my_pthread_getspecific_ptr(T,V) ((T) TlsGetValue(V))
-#define pthread_equal(A,B) ((A) == (B))
-#define pthread_mutex_init(A,B) (InitializeCriticalSection(A),0)
-#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
-#define pthread_mutex_trylock(A) win_pthread_mutex_trylock((A))
+static inline int pthread_key_create(pthread_key_t *key, void (*destr_function)(void*))
+{
+ *key= TlsAlloc();
+ if(*key == TLS_OUT_OF_INDEXES)
+ return EAGAIN;
+ return 0;
+}
+
+static inline int pthread_key_delete(pthread_key_t key)
+{
+ if(TlsFree(key))
+ return 0;
+ return 1;
+}
+
+#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,V)
+
+static inline int pthread_setspecific(pthread_key_t key, const void *pointer)
+{
+ if(TlsSetValue(key, (void*)pointer))
+ return 0;
+ return 1;
+}
+
+static inline void* pthread_getspecific(pthread_key_t key)
+{
+ return TlsGetValue(key);
+}
+
+#define my_pthread_getspecific(T,A) ((T) pthread_getspecific(A))
+#define my_pthread_getspecific_ptr(T,V) ((T) pthread_getspecific(V))
+
+static inline int pthread_equal(pthread_t thread1, pthread_t thread2)
+{
+ return thread1 == thread2;
+}
+
+typedef void pthread_mutex_attr_t;
+static inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutex_attr_t *mutex_attr)
+{
+ InitializeCriticalSection(mutex);
+ return 0;
+}
+
+static inline int pthread_mutex_lock(pthread_mutex_t *mutex)
+{
+ EnterCriticalSection(mutex);
+ return 0;
+}
+
+int pthread_mutex_trylock(pthread_mutex_t *mutex);
static inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
{
=== modified file 'mysql-test/include/ndb_show_tables_result.inc'
--- a/mysql-test/include/ndb_show_tables_result.inc 2008-10-13 17:45:03 +0000
+++ b/mysql-test/include/ndb_show_tables_result.inc 2008-10-15 14:33:11 +0000
@@ -2,7 +2,7 @@
--disable_query_log
CREATE TEMPORARY TABLE IF NOT EXISTS ndb_show_tables_results (id INT, type VARCHAR(20), state VARCHAR(20), logging VARCHAR(20), _database VARCHAR(255), _schema VARCHAR(20), name VARCHAR(255));
---exec $NDB_SHOW_TABLES --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+--exec $NDB_SHOW_TABLES --p |sed -e 's/\r\n/\n/' > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables_results;
--enable_query_log
--enable_warnings
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2008-10-13 17:45:03 +0000
+++ b/mysql-test/mysql-test-run.pl 2008-10-21 14:56:15 +0000
@@ -1624,33 +1624,34 @@ sub executable_setup_ndb () {
"$ndb_path/ndb_waiter"));
$exe_ndb_desc= mtr_native_path(
- mtr_path_exists(vs_config_dirs("storage/ndb/tools",'ndb_desc'),
- "$ndb_path/tools/ndb_desc",
- "$ndb_path/ndb_desc"));
+ mtr_exe_maybe_exists(vs_config_dirs("storage/ndb/tools",'ndb_desc'),
+ "$ndb_path/tools/ndb_desc",
+ "$ndb_path/ndb_desc"));
+
$exe_ndb_restore= mtr_native_path(
- mtr_path_exists(vs_config_dirs("storage/ndb/tools",'ndb_restore'),
- "$ndb_path/tools/ndb_restore",
- "$ndb_path/ndb_restore"));
+ mtr_exe_maybe_exists(vs_config_dirs("storage/ndb/tools",'ndb_restore'),
+ "$ndb_path/tools/ndb_restore",
+ "$ndb_path/ndb_restore"));
$exe_ndb_select_all= mtr_native_path(
- mtr_path_exists(vs_config_dirs("storage/ndb/tools",'ndb_select_all'),
- "$ndb_path/tools/ndb_select_all",
- "$ndb_path/ndb_select_all"));
+ mtr_exe_maybe_exists(vs_config_dirs("storage/ndb/tools",'ndb_select_all'),
+ "$ndb_path/tools/ndb_select_all",
+ "$ndb_path/ndb_select_all"));
$exe_ndb_drop_table= mtr_native_path(
- mtr_path_exists(vs_config_dirs("storage/ndb/tools",'ndb_drop_table'),
- "$ndb_path/tools/ndb_drop_table",
- "$ndb_path/ndb_drop_table"));
+ mtr_exe_maybe_exists(vs_config_dirs("storage/ndb/tools",'ndb_drop_table'),
+ "$ndb_path/tools/ndb_drop_table",
+ "$ndb_path/ndb_drop_table"));
$exe_ndb_config= mtr_native_path(
- mtr_path_exists(vs_config_dirs("storage/ndb/tools",'ndb_config'),
- "$ndb_path/tools/ndb_config",
- "$ndb_path/ndb_config"));
+ mtr_exe_maybe_exists(vs_config_dirs("storage/ndb/tools",'ndb_config'),
+ "$ndb_path/tools/ndb_config",
+ "$ndb_path/ndb_config"));
$exe_ndb_show_tables= mtr_native_path(
- mtr_path_exists(vs_config_dirs("storage/ndb/tools",'ndb_show_tables'),
- "$ndb_path/tools/ndb_show_tables",
- "$ndb_path/ndb_show_tables"));
+ mtr_exe_maybe_exists(vs_config_dirs("storage/ndb/tools",'ndb_show_tables'),
+ "$ndb_path/tools/ndb_show_tables",
+ "$ndb_path/ndb_show_tables"));
# May not exist
$path_ndb_examples_dir=
=== modified file 'mysql-test/suite/ndb/t/ndb_alter_table_online2.test'
--- a/mysql-test/suite/ndb/t/ndb_alter_table_online2.test 2008-10-04 18:50:37 +0000
+++ b/mysql-test/suite/ndb/t/ndb_alter_table_online2.test 2008-10-21 15:03:19 +0000
@@ -12,6 +12,8 @@
-- source include/have_multi_ndb.inc
# test uses mysqlslap, hence not in embedded
-- source include/not_embedded.inc
+# mysqlslap seems to be not_windows. remove this when removed from mysqlslap.test
+-- source include/not_windows.inc
-- source include/have_log_bin.inc
--disable_warnings
=== modified file 'mysys/my_winthread.c'
--- a/mysys/my_winthread.c 2008-09-19 08:52:44 +0000
+++ b/mysys/my_winthread.c 2008-10-15 05:27:54 +0000
@@ -47,8 +47,7 @@ void win_pthread_init(void)
@retval 0 Mutex was acquired
@retval EBUSY Mutex was already locked by a thread
*/
-int
-win_pthread_mutex_trylock(pthread_mutex_t *mutex)
+int pthread_mutex_trylock(pthread_mutex_t *mutex)
{
if (TryEnterCriticalSection(mutex))
{
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2008-10-18 07:25:20 +0000
+++ b/sql/ha_ndbcluster.cc 2008-10-21 04:02:59 +0000
@@ -2116,7 +2116,7 @@ bool ha_ndbcluster::check_index_fields_i
*/
int ha_ndbcluster::pk_read(const uchar *key, uint key_len, uchar *buf,
- uint32 part_id)
+ uint32 *part_id)
{
NdbConnection *trans= m_thd_ndb->trans;
const NdbOperation *op;
@@ -2132,7 +2132,7 @@ int ha_ndbcluster::pk_read(const uchar *
if (!(op= pk_unique_index_read_key(table->s->primary_key, key, buf, lm,
(m_user_defined_partitioning ?
- &part_id :
+ part_id :
NULL))))
ERR_RETURN(trans->getNdbError());
@@ -4452,7 +4452,7 @@ int ha_ndbcluster::read_range_first_to_b
if (m_active_cursor && (error= close_scan()))
DBUG_RETURN(error);
error= pk_read(start_key->key, start_key->length, buf,
- part_spec.start_part);
+ (m_use_partition_pruning)? &(part_spec.start_part) : NULL);
DBUG_RETURN(error == HA_ERR_KEY_NOT_FOUND ? HA_ERR_END_OF_FILE : error);
}
break;
@@ -4479,7 +4479,7 @@ int ha_ndbcluster::read_range_first_to_b
}
// Start the ordered index scan and fetch the first row
DBUG_RETURN(ordered_index_scan(start_key, end_key, sorted, desc, buf,
- &part_spec));
+ (m_use_partition_pruning)? &part_spec : NULL));
}
int ha_ndbcluster::read_range_first(const key_range *start_key,
@@ -4617,7 +4617,8 @@ int ha_ndbcluster::rnd_pos(uchar *buf, u
DBUG_PRINT("info", ("partition id %u", part_spec.start_part));
}
DBUG_DUMP("key", pos, key_length);
- DBUG_RETURN(pk_read(pos, key_length, buf, part_spec.start_part));
+ DBUG_RETURN(pk_read(pos, key_length, buf,
+ (m_user_defined_partitioning)? &(part_spec.start_part) : NULL));
}
}
=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h 2008-10-16 07:55:04 +0000
+++ b/sql/ha_ndbcluster.h 2008-10-21 04:02:59 +0000
@@ -598,7 +598,7 @@ private:
int ndb_pk_update_row(THD *thd,
const uchar *old_data, uchar *new_data,
uint32 old_part_id);
- int pk_read(const uchar *key, uint key_len, uchar *buf, uint32 part_id);
+ int pk_read(const uchar *key, uint key_len, uchar *buf, uint32 *part_id);
int ordered_index_scan(const key_range *start_key,
const key_range *end_key,
bool sorted, bool descending, uchar* buf,
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2008-10-09 09:33:43 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2008-10-22 02:24:15 +0000
@@ -3164,6 +3164,20 @@ ndb_rep_event_name(String *event_name,co
else
event_name->set_ascii("REPL$", 5);
event_name->append(db);
+#ifdef NDB_WIN32
+ /*
+ * Some bright spark decided that we should sometimes have backslashes.
+ * This causes us pain as the event is db/table and not db\table so trying
+ * to drop db\table when we meant db/table ends in the event lying around
+ * after drop table, leading to all sorts of pain.
+ */
+ String backslash_sep(1);
+ backslash_sep.set_ascii("\\",1);
+
+ int bsloc;
+ if((bsloc= event_name->strstr(backslash_sep,0))!=-1)
+ event_name->replace(bsloc, 1, "/", 1);
+#endif
if (tbl)
{
event_name->append('/');
=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp 2008-10-01 09:20:40 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp 2008-10-14 07:34:55 +0000
@@ -183,8 +183,15 @@ Filename::set(Filename::NameSpec& spec,
strncpy(theName, buf, PATH_MAX);
m_base_name = theName;
}
- else
+ else
{
+#ifdef NDB_WIN32
+ char* b= buf;
+ while((b= strchr(b, '/')) && b)
+ {
+ *b= '\\';
+ }
+#endif
BaseString::snprintf(theName, sizeof(theName), "%s%s",
spec.fs_path.c_str(), buf);
m_base_name = theName + spec.fs_path.length();
=== modified file 'storage/ndb/src/kernel/blocks/suma/Suma.cpp'
--- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp 2008-10-09 19:17:11 +0000
+++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp 2008-10-21 15:07:54 +0000
@@ -1373,6 +1373,8 @@ void Suma::execDBINFO_SCANREQ(Signal *si
struct dbinfo_row r;
struct dbinfo_ratelimit rl;
+ dbinfo_ratelimit_init(&rl, &req);
+
jamEntry();
if(req.tableId == NDBINFO_POOLS_TABLEID)
=== modified file 'storage/ndb/src/mgmclient/CommandInterpreter.cpp'
--- a/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2008-10-07 06:47:09 +0000
+++ b/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2008-10-21 15:07:01 +0000
@@ -896,7 +896,7 @@ printLogEvent(struct ndb_logevent* event
//*****************************************************************************
//*****************************************************************************
-static int do_event_thread;
+static int do_event_thread= 0;
static void*
event_thread_run(void* p)
{
@@ -932,7 +932,7 @@ event_thread_run(void* p)
}
else
{
- do_event_thread= -1;
+ do_event_thread= 0;
}
DBUG_RETURN(NULL);
| Thread |
|---|
| • bzr push into mysql-5.1 branch (stewart:3014) | Stewart Smith | 21 Oct |