2765 Jonas Oreland 2008-09-18 [merge]
merge 6.3 to 6.4
modified:
sql/ha_ndbcluster.cc
sql/ha_ndbcluster_binlog.h
storage/ndb/src/common/portlib/NdbTick.c
storage/ndb/src/common/util/ndb_init.cpp
storage/ndb/src/kernel/blocks/trix/Trix.cpp
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2008-09-11 08:46:19 +0000
+++ b/sql/ha_ndbcluster.cc 2008-09-18 14:39:00 +0000
@@ -6945,6 +6945,17 @@ int ha_ndbcluster::final_drop_index(TABL
DBUG_RETURN(error);
}
+/*
+ Find the base name in the format "<database>/<table>"
+*/
+static const char *get_base_name(const char *ptr)
+{
+ ptr+= strlen(ptr);
+ while (*(--ptr) != '/');
+ while (*(--ptr) != '/');
+ return ptr+1;
+}
+
/**
Rename a table in NDB Cluster.
*/
@@ -7062,8 +7073,8 @@ int ha_ndbcluster::rename_table(const ch
/* handle old table */
if (!is_old_table_tmpfile)
{
- ndbcluster_drop_event(thd, ndb, share, "rename table",
- from + sizeof(share_prefix) - 1);
+ const char *ptr= get_base_name(from);
+ ndbcluster_drop_event(thd, ndb, share, "rename table", ptr);
}
if (!result && !is_new_table_tmpfile)
@@ -7077,8 +7088,8 @@ int ha_ndbcluster::rename_table(const ch
#endif
/* always create an event for the table */
String event_name(INJECTOR_EVENT_LEN);
- ndb_rep_event_name(&event_name, to + sizeof(share_prefix) - 1, 0,
- get_binlog_full(share));
+ const char *ptr= get_base_name(to);
+ ndb_rep_event_name(&event_name, ptr, 0, get_binlog_full(share));
if (!ndbcluster_create_event(thd, ndb, ndbtab, event_name.c_ptr(), share,
share && ndb_binlog_running ? 2 : 1/* push warning */))
@@ -7297,9 +7308,9 @@ retry_temporary_error1:
int table_dropped= dict->getNdbError().code != 709;
{
+ const char *ptr= get_base_name(path);
ndbcluster_handle_drop_table(thd, ndb, share, "delete table",
- table_dropped ?
- (path + sizeof(share_prefix) - 1) : 0);
+ table_dropped ? ptr : 0);
}
if (!IS_TMP_PREFIX(table_name) && share &&
=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h 2008-05-07 07:31:15 +0000
+++ b/sql/ha_ndbcluster_binlog.h 2008-09-18 14:39:00 +0000
@@ -94,7 +94,6 @@ enum SCHEMA_OP_TYPE
const uint max_ndb_nodes= 256; /* multiple of 32 */
static const char *ha_ndb_ext=".ndb";
-static const char share_prefix[]= "./";
#ifdef HAVE_NDB_BINLOG
#define NDB_EXCEPTIONS_TABLE_SUFFIX "$EX"
=== modified file 'storage/ndb/src/common/portlib/NdbTick.c'
--- a/storage/ndb/src/common/portlib/NdbTick.c 2008-06-09 11:57:17 +0000
+++ b/storage/ndb/src/common/portlib/NdbTick.c 2008-09-11 11:40:54 +0000
@@ -26,15 +26,34 @@
#ifdef HAVE_CLOCK_GETTIME
#ifdef CLOCK_MONOTONIC
-#define CLOCK CLOCK_MONOTONIC
+static clockid_t NdbTick_clk_id = CLOCK_MONOTONIC;
#else
-#define CLOCK CLOCK_REALTIME
+static clockid_t NdbTick_clk_id = CLOCK_REALTIME;
#endif
+void NdbTick_Init()
+{
+ struct timespec tick_time;
+ if (clock_gettime(NdbTick_clk_id, &tick_time) == 0)
+ return;
+#ifdef CLOCK_MONOTONIC
+ fprintf(stderr, "Failed to use CLOCK_MONOTONIC for clock_realtime,"
+ " errno= %u\n", errno);
+ fflush(stderr);
+ NdbTick_clk_id = CLOCK_REALTIME;
+ if (clock_gettime(NdbTick_clk_id, &tick_time) == 0)
+ return;
+#endif
+ fprintf(stderr, "Failed to use CLOCK_REALTIME for clock_realtime,"
+ " errno=%u. Aborting\n", errno);
+ fflush(stderr);
+ abort();
+}
+
NDB_TICKS NdbTick_CurrentMillisecond(void)
{
struct timespec tick_time;
- clock_gettime(CLOCK, &tick_time);
+ clock_gettime(NdbTick_clk_id, &tick_time);
return
((NDB_TICKS)tick_time.tv_sec) * ((NDB_TICKS)MILLISEC_PER_SEC) +
@@ -44,12 +63,16 @@ NDB_TICKS NdbTick_CurrentMillisecond(voi
int
NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros){
struct timespec t;
- int res = clock_gettime(CLOCK, &t);
+ int res = clock_gettime(NdbTick_clk_id, &t);
* secs = t.tv_sec;
* micros = t.tv_nsec / 1000;
return res;
}
#else
+void NdbTick_Init()
+{
+}
+
NDB_TICKS NdbTick_CurrentMillisecond(void)
{
struct timeval tick_time;
=== modified file 'storage/ndb/src/common/util/ndb_init.cpp'
--- a/storage/ndb/src/common/util/ndb_init.cpp 2008-06-09 11:57:17 +0000
+++ b/storage/ndb/src/common/util/ndb_init.cpp 2008-09-11 11:40:54 +0000
@@ -27,6 +27,7 @@ extern void destroy_event_logger(class E
static int ndb_init_called = 0;
extern "C" void NdbCondition_Init();
+extern "C" void NdbTick_Init();
extern "C"
{
@@ -46,7 +47,7 @@ ndb_init_internal()
exit(1);
}
}
-
+ NdbTick_Init();
NdbCondition_Init();
}
=== modified file 'storage/ndb/src/kernel/blocks/trix/Trix.cpp'
--- a/storage/ndb/src/kernel/blocks/trix/Trix.cpp 2008-06-07 12:40:09 +0000
+++ b/storage/ndb/src/kernel/blocks/trix/Trix.cpp 2008-09-18 14:39:00 +0000
@@ -560,8 +560,11 @@ void Trix::execUTIL_PREPARE_REF(Signal*
return;
}
subRecPtr.p = subRec;
- subRec->errorCode = BuildIndxRef::InternalError;
- ndbrequire(false);
+ subRec->errorCode = (BuildIndxRef::ErrorCode)utilPrepareRef->errorCode;
+
+ UtilReleaseConf* conf = (UtilReleaseConf*)signal->getDataPtrSend();
+ conf->senderData = subRecPtr.i;
+ execUTIL_RELEASE_CONF(signal);
}
void Trix::execUTIL_EXECUTE_CONF(Signal* signal)
@@ -632,20 +635,27 @@ void Trix::execSUB_CREATE_REF(Signal* si
{
jamEntry();
DBUG_ENTER("Trix::execSUB_CREATE_REF");
- // THIS SIGNAL IS NEVER SENT FROM SUMA?
- /*
+
SubCreateRef * subCreateRef = (SubCreateRef *)signal->getDataPtr();
SubscriptionRecPtr subRecPtr;
SubscriptionRecord* subRec;
- subRecPtr.i = subCreateRef->subscriberData;
- if ((subRec = c_theSubscriptions.getPtr(subRecPtr.i)) == NULL) {
+ subRecPtr.i = subCreateRef->senderData;
+ if ((subRec = c_theSubscriptions.getPtr(subRecPtr.i)) == NULL)
+ {
printf("Trix::execSUB_CREATE_REF: Failed to find subscription data %u\n", subRecPtr.i);
return;
}
subRecPtr.p = subRec;
- buildFailed(signal, subRecPtr, BuildIndxRef::InternalError);
- */
+ subRecPtr.p->errorCode = (BuildIndxRef::ErrorCode)subCreateRef->errorCode;
+
+ UtilReleaseReq * const req = (UtilReleaseReq*)signal->getDataPtrSend();
+ req->prepareId = subRecPtr.p->prepareId;
+ req->senderData = subRecPtr.i;
+
+ sendSignal(DBUTIL_REF, GSN_UTIL_RELEASE_REQ, signal,
+ UtilReleaseReq::SignalLength, JBB);
+
DBUG_VOID_RETURN;
}
@@ -757,6 +767,7 @@ void Trix::setupSubscription(Signal* sig
sendSignal(SUMA_REF, GSN_SUB_CREATE_REQ,
signal, SubCreateReq::SignalLength, JBB);
+
DBUG_VOID_RETURN;
}
| Thread |
|---|
| • bzr push into mysql-5.1 branch (jonas:2765) | Jonas Oreland | 18 Sep |