diff options
author | unknown <stewart@mysql.com> | 2005-06-04 18:14:34 +1000 |
---|---|---|
committer | unknown <stewart@mysql.com> | 2005-06-04 18:14:34 +1000 |
commit | 0602da4d0ca2b87ac4a6bc5a4686a5741d1db3e2 (patch) | |
tree | 184aee1d97a9af35de26a618f3b47a675e83c9c4 | |
parent | a681af904d4fc8e02042b93b9035855ea989a155 (diff) | |
download | mariadb-git-0602da4d0ca2b87ac4a6bc5a4686a5741d1db3e2.tar.gz |
BUG#10948 NDB Replication: Race condition with ALTER/DROP table
BUG#9826 Server crash on schema change ("drop table", "alter table") with NDB
See note on 10948 for detailed explanation.
struct a { void* a; long long b[1]; };
on PPC32 (and 32bit pa risc): 16
on x86: 12
so a malloc(sizeof(void*)+extra_bits) is wrong.
Assuming that the long long is 64 bit aligned as non-aligned 64bit accesses
are rather expensive on ppc.
Thanks to paulus for doing the PPC port of valgrind.
Without which I would no doubt still be trying to find this.
ndb/src/ndbapi/DictCache.cpp:
Fix allocation size for Ndb_local_table_info for architectures such as PPC and PA-RISC (32bit)
where
struct a { void* a; long long b;};
is 64 bit aligned (i.e. sizeof(struct a)==16)
ndb/src/ndbapi/DictCache.hpp:
Add warning about having to be the last member in the structure
-rw-r--r-- | ndb/src/ndbapi/DictCache.cpp | 3 | ||||
-rw-r--r-- | ndb/src/ndbapi/DictCache.hpp | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/ndb/src/ndbapi/DictCache.cpp b/ndb/src/ndbapi/DictCache.cpp index 9cdd68272ad..ccc45a04824 100644 --- a/ndb/src/ndbapi/DictCache.cpp +++ b/ndb/src/ndbapi/DictCache.cpp @@ -24,7 +24,8 @@ Ndb_local_table_info * Ndb_local_table_info::create(NdbTableImpl *table_impl, Uint32 sz) { - Uint32 tot_size= sizeof(NdbTableImpl *) + ((sz+7)>>3)<<3; // round to Uint64 + Uint32 tot_size= sizeof(Ndb_local_table_info) - sizeof(Uint64) + + ((sz+7) & ~7); // round to Uint64 void *data= malloc(tot_size); if (data == 0) return 0; diff --git a/ndb/src/ndbapi/DictCache.hpp b/ndb/src/ndbapi/DictCache.hpp index 58c08a93e61..ca31c345396 100644 --- a/ndb/src/ndbapi/DictCache.hpp +++ b/ndb/src/ndbapi/DictCache.hpp @@ -33,7 +33,7 @@ public: static Ndb_local_table_info *create(NdbTableImpl *table_impl, Uint32 sz=0); static void destroy(Ndb_local_table_info *); NdbTableImpl *m_table_impl; - Uint64 m_local_data[1]; + Uint64 m_local_data[1]; // Must be last member. Used to access extra space. private: Ndb_local_table_info(NdbTableImpl *table_impl); ~Ndb_local_table_info(); |