3556 John David Duncan 2011-09-27
Fix one more bad alignment error on sparc
modified:
storage/ndb/memcache/include/DataTypeHandler.h
storage/ndb/memcache/src/DataTypeHandler.cc
storage/ndb/memcache/src/Record.cc
3555 John David Duncan 2011-09-26
Fix for race condition in ndb/memcache S scheduler.
It was possible for an ndb_send_thread to start up and try to use a WorkerConnection that the main thread had not yet initialized.
This should fix http://pb2.no.oracle.com/?template=mysql_show_test_failure&search=yes&push_id=2586144&test_id=2586293&test_run=n_mix&test_suite=ndb_memcache&test_case=basic
modified:
storage/ndb/memcache/src/schedulers/S_sched.cc
storage/ndb/memcache/src/schedulers/S_sched.h
=== modified file 'storage/ndb/memcache/include/DataTypeHandler.h'
--- a/storage/ndb/memcache/include/DataTypeHandler.h 2011-09-26 02:42:21 +0000
+++ b/storage/ndb/memcache/include/DataTypeHandler.h 2011-09-27 07:53:52 +0000
@@ -26,6 +26,30 @@
#include "ndbmemcache_global.h"
+// FOR INTEGER TYPES: x86 allows unaligned access, but most other machines do not.
+// FOR FLOATING POINT TYPES: access must be aligned on all architectures
+#define LOAD_UNALIGNED(Type, x, buf) \
+Type x = *((Type *) buf);
+
+#define STORE_UNALIGNED(Type, x, buf) \
+*((Type *) buf) = (Type) x;
+
+#define LOAD_ALIGNED(Type, x, buf) \
+Type x; \
+memcpy(&x, buf, sizeof(x));
+
+#define STORE_ALIGNED(Type, x, buf) \
+Type tmp_value = (Type) x; \
+memcpy(buf, &tmp_value, sizeof(tmp_value));
+
+#if defined(__i386) || defined(__x86_64)
+#define LOAD_FOR_ARCHITECTURE LOAD_UNALIGNED
+#define STORE_FOR_ARCHITECTURE STORE_UNALIGNED
+#else
+#define LOAD_FOR_ARCHITECTURE LOAD_ALIGNED
+#define STORE_FOR_ARCHITECTURE STORE_ALIGNED
+#endif
+
/* DataTypeHandler is an interface.
Each instance of DataTypeHandler is able to read values of a certain
=== modified file 'storage/ndb/memcache/src/DataTypeHandler.cc'
--- a/storage/ndb/memcache/src/DataTypeHandler.cc 2011-09-26 02:42:21 +0000
+++ b/storage/ndb/memcache/src/DataTypeHandler.cc 2011-09-27 07:53:52 +0000
@@ -37,31 +37,6 @@
#include "DataTypeHandler.h"
#include "debug.h"
#include "int3korr.h"
-
-// FOR INTEGER TYPES: x86 allows unaligned access, but most other machines do not.
-// FOR FLOATING POINT TYPES: access must be aligned on all architectures
-#define LOAD_UNALIGNED(Type, x, buf) \
-Type x = *((Type *) buf);
-
-#define STORE_UNALIGNED(Type, x, buf) \
-*((Type *) buf) = (Type) x;
-
-#define LOAD_ALIGNED(Type, x, buf) \
-Type x; \
-memcpy(&x, buf, sizeof(x));
-
-#define STORE_ALIGNED(Type, x, buf) \
-Type tmp_value = (Type) x; \
-memcpy(buf, &tmp_value, sizeof(tmp_value));
-
-#if defined(__i386) || defined(__x86_64)
-#define LOAD_FOR_ARCHITECTURE LOAD_UNALIGNED
-#define STORE_FOR_ARCHITECTURE STORE_UNALIGNED
-#else
-#define LOAD_FOR_ARCHITECTURE LOAD_ALIGNED
-#define STORE_FOR_ARCHITECTURE STORE_ALIGNED
-#endif
-
extern EXTENSION_LOGGER_DESCRIPTOR *logger;
=== modified file 'storage/ndb/memcache/src/Record.cc'
--- a/storage/ndb/memcache/src/Record.cc 2011-09-26 02:42:21 +0000
+++ b/storage/ndb/memcache/src/Record.cc 2011-09-27 07:53:52 +0000
@@ -237,7 +237,8 @@ Uint64 Record::getUint64Value(int id, ch
return 0;
}
- return * ((Uint64 *) buffer);
+ LOAD_FOR_ARCHITECTURE(Uint64, value, buffer);
+ return value;
}
@@ -251,7 +252,7 @@ bool Record::setUint64Value(int id, Uint
return false;
}
- * ((Uint64 *) buffer) = value;
+ STORE_FOR_ARCHITECTURE(Uint64, value, buffer);
return true;
}
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5-cluster branch (john.duncan:3555 to 3556) | John David Duncan | 29 Sep |